added voiceEnabled option to sendConversationEvent in Brand Concierge component#1457
added voiceEnabled option to sendConversationEvent in Brand Concierge component#1457MasonPinZ wants to merge 1 commit intoadobe:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 4f91ca4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
b101cfe to
4f91ca4
Compare
|
@carterworks , @ninaceban , this is the new PR of adding |
| return resultPromise; | ||
| }); | ||
| }); | ||
|
|
There was a problem hiding this comment.
Both of these tests are better written with async/await instead of flushPromiseChains()
it("passes voiceEnabled from options to the service request", async () => {
const mockResponse = {
ok: true,
status: 200,
body: createMockReadableStream([]),
};
mockDependencies.sendConversationServiceRequest.mockResolvedValue(
mockResponse,
);
const sendConversationEvent = createSendConversationEvent(mockDependencies);
await sendConversationEvent({
message: "Hello",
onStreamResponse: vi.fn(),
voiceEnabled: true,
});
expect(mockDependencies.buildEndpointUrl).toHaveBeenCalledTimes(1);
const [{ request }] = mockDependencies.buildEndpointUrl.mock.calls[0];
expect(request.getEdgeSubPath()).toBe("/brand-concierge-voice");
});
it("defaults to text subpath when voiceEnabled is not provided", async () => {
const mockResponse = {
ok: true,
status: 200,
body: createMockReadableStream([]),
};
mockDependencies.sendConversationServiceRequest.mockResolvedValue(
mockResponse,
);
const sendConversationEvent = createSendConversationEvent(mockDependencies);
await sendConversationEvent({
message: "Hello",
onStreamResponse: vi.fn(),
});
expect(mockDependencies.buildEndpointUrl).toHaveBeenCalledTimes(1);
const [{ request }] = mockDependencies.buildEndpointUrl.mock.calls[0];
expect(request.getEdgeSubPath()).toBe("/brand-concierge");
});| }), | ||
| }), | ||
| }), | ||
| }).required(), |
There was a problem hiding this comment.
As-is, this version gets past your validation
validateMessage({ {
xdm: {
interactionId: "test-interaction-id",
},
voiceEnabled: "yes",
}
});
What does bc-backend do on this kind of message? We can tighten up the validation here to prevent that from getting past.
|
Don't worry about the sonarqube report action failing - it is unreleated. |
Description
voiceEnabledboolean option to thesendConversationEventcommand, allowing callers to route requests to the voice subpath (/brand-concierge-voice) on a per-call basis.voiceEnabledisfalse(default), requests continue to use the existing/brand-conciergesubpath — fully backwards compatible.validateMessage.jsfor bothmessage-based anddata-based option shapes.Usage example
Related Issue
BRANDCON-3982
Motivation and Context
Screenshots (if appropriate):
Checklist:
pnpm changeset) or it is not necessary because this PR is not consumer-facing.