@carbon/ai-chat 1.3.0-rc.1 → 1.3.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/chat.ChatAppEntry.js +15 -7
- package/dist/es/chat.ChatAppEntry.js.map +1 -1
- package/dist/es/chat.PageObjectId.js.map +1 -1
- package/dist/es-custom/chat.ChatAppEntry.js +15 -7
- package/dist/es-custom/chat.ChatAppEntry.js.map +1 -1
- package/dist/es-custom/chat.PageObjectId.js.map +1 -1
- package/dist/types/aiChatEntry.d.ts +2 -2
- package/dist/types/{serverEntry-BMoPx5K4.d.ts → serverEntry-ojFJl1OR.d.ts} +1 -4
- package/dist/types/serverEntry.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1876,7 +1876,7 @@ class ChatActionsImpl {
|
|
|
1876
1876
|
serviceManager.store.dispatch(actions.addIsHydratingCounter(1));
|
|
1877
1877
|
if (!this.alreadyHydrated) {
|
|
1878
1878
|
history = await this.serviceManager.historyService.loadHistory();
|
|
1879
|
-
if (serviceManager.humanAgentService) {
|
|
1879
|
+
if (serviceManager.humanAgentService && !serviceManager.humanAgentService.hasInitialized) {
|
|
1880
1880
|
debugLog("Initializing the human agent service");
|
|
1881
1881
|
await serviceManager.humanAgentService.initialize();
|
|
1882
1882
|
} else {
|
|
@@ -5601,6 +5601,7 @@ const {FROM_USER: FROM_USER, RECONNECTED: RECONNECTED, DISCONNECTED: DISCONNECTE
|
|
|
5601
5601
|
|
|
5602
5602
|
class HumanAgentServiceImpl {
|
|
5603
5603
|
constructor(serviceManager) {
|
|
5604
|
+
this.hasInitialized = false;
|
|
5604
5605
|
this.chatStarted = false;
|
|
5605
5606
|
this.showingDisconnectedError = false;
|
|
5606
5607
|
this.isHumanAgentTyping = false;
|
|
@@ -5615,6 +5616,7 @@ class HumanAgentServiceImpl {
|
|
|
5615
5616
|
if (this.serviceDesk) {
|
|
5616
5617
|
throw new Error("A service desk has already been created!");
|
|
5617
5618
|
}
|
|
5619
|
+
this.hasInitialized = true;
|
|
5618
5620
|
const {store: store, instance: instance} = this.serviceManager;
|
|
5619
5621
|
const state = store.getState();
|
|
5620
5622
|
const {config: config, persistedToBrowserStorage: persistedToBrowserStorage} = state;
|
|
@@ -17468,7 +17470,7 @@ var css_248z = ".cds--layout--size-xs{\n --cds-layout-size-height-context:var(-
|
|
|
17468
17470
|
function detectConfigChanges(previousConfig, newConfig) {
|
|
17469
17471
|
if (!previousConfig) {
|
|
17470
17472
|
return {
|
|
17471
|
-
|
|
17473
|
+
humanAgentFactoryChanged: Boolean(newConfig.serviceDeskFactory),
|
|
17472
17474
|
themingChanged: Boolean(newConfig.aiEnabled !== undefined || newConfig.injectCarbonTheme !== undefined),
|
|
17473
17475
|
messagingChanged: Boolean(newConfig.messaging),
|
|
17474
17476
|
namespaceChanged: Boolean(newConfig.namespace),
|
|
@@ -17479,7 +17481,7 @@ function detectConfigChanges(previousConfig, newConfig) {
|
|
|
17479
17481
|
lightweightUIChanged: true
|
|
17480
17482
|
};
|
|
17481
17483
|
}
|
|
17482
|
-
const
|
|
17484
|
+
const humanAgentFactoryChanged = previousConfig.serviceDeskFactory !== newConfig.serviceDeskFactory;
|
|
17483
17485
|
const themingChanged = previousConfig.aiEnabled !== newConfig.aiEnabled || previousConfig.injectCarbonTheme !== newConfig.injectCarbonTheme;
|
|
17484
17486
|
const messagingChanged = !isEqual(previousConfig.messaging, newConfig.messaging);
|
|
17485
17487
|
const namespaceChanged = previousConfig.namespace !== newConfig.namespace;
|
|
@@ -17487,9 +17489,9 @@ function detectConfigChanges(previousConfig, newConfig) {
|
|
|
17487
17489
|
const layoutChanged = !isEqual(previousConfig.layout, newConfig.layout);
|
|
17488
17490
|
const headerChanged = !isEqual(previousConfig.header, newConfig.header);
|
|
17489
17491
|
const homescreenChanged = !isEqual(previousConfig.homescreen, newConfig.homescreen);
|
|
17490
|
-
const lightweightUIChanged = !isEqual(previousConfig.launcher, newConfig.launcher) || previousConfig.openChatByDefault !== newConfig.openChatByDefault || previousConfig.shouldSanitizeHTML !== newConfig.shouldSanitizeHTML || previousConfig.debug !== newConfig.debug || previousConfig.enableFocusTrap !== newConfig.enableFocusTrap || previousConfig.shouldTakeFocusIfOpensAutomatically !== newConfig.shouldTakeFocusIfOpensAutomatically || previousConfig.assistantName !== newConfig.assistantName || previousConfig.isReadonly !== newConfig.isReadonly || previousConfig.locale !== newConfig.locale || previousConfig.disableCustomElementMobileEnhancements !== newConfig.disableCustomElementMobileEnhancements || previousConfig.input?.isVisible !== newConfig.input?.isVisible || previousConfig.input?.isDisabled !== newConfig.input?.isDisabled || previousConfig.launcher?.showUnreadIndicator !== newConfig.launcher?.showUnreadIndicator;
|
|
17492
|
+
const lightweightUIChanged = !isEqual(previousConfig.launcher, newConfig.launcher) || previousConfig.openChatByDefault !== newConfig.openChatByDefault || previousConfig.shouldSanitizeHTML !== newConfig.shouldSanitizeHTML || previousConfig.debug !== newConfig.debug || previousConfig.enableFocusTrap !== newConfig.enableFocusTrap || previousConfig.shouldTakeFocusIfOpensAutomatically !== newConfig.shouldTakeFocusIfOpensAutomatically || previousConfig.assistantName !== newConfig.assistantName || previousConfig.isReadonly !== newConfig.isReadonly || previousConfig.locale !== newConfig.locale || previousConfig.disableCustomElementMobileEnhancements !== newConfig.disableCustomElementMobileEnhancements || previousConfig.input?.isVisible !== newConfig.input?.isVisible || previousConfig.input?.isDisabled !== newConfig.input?.isDisabled || previousConfig.launcher?.showUnreadIndicator !== newConfig.launcher?.showUnreadIndicator || !isEqual(previousConfig.serviceDesk, newConfig.serviceDesk);
|
|
17491
17493
|
return {
|
|
17492
|
-
|
|
17494
|
+
humanAgentFactoryChanged: humanAgentFactoryChanged,
|
|
17493
17495
|
themingChanged: themingChanged,
|
|
17494
17496
|
messagingChanged: messagingChanged,
|
|
17495
17497
|
namespaceChanged: namespaceChanged,
|
|
@@ -17532,13 +17534,19 @@ async function applyConfigChangesDynamically(changes, newConfig, serviceManager)
|
|
|
17532
17534
|
serviceManager.messageService.timeoutMS = newConfig.messaging.messageTimeoutSecs * 1e3;
|
|
17533
17535
|
}
|
|
17534
17536
|
}
|
|
17535
|
-
if (changes.
|
|
17537
|
+
if (changes.humanAgentFactoryChanged) {
|
|
17536
17538
|
try {
|
|
17537
17539
|
if (serviceManager.humanAgentService && isHumanAgentChatActive(serviceManager)) {
|
|
17540
|
+
consoleDebug("Tearing down existing service desk");
|
|
17538
17541
|
await serviceManager.humanAgentService.endChat(true, true, false);
|
|
17539
17542
|
}
|
|
17543
|
+
const wasInitialized = Boolean(serviceManager.humanAgentService?.hasInitialized);
|
|
17544
|
+
consoleDebug("Recreating human agent service");
|
|
17540
17545
|
serviceManager.humanAgentService = createHumanAgentService(serviceManager);
|
|
17541
|
-
|
|
17546
|
+
if (wasInitialized) {
|
|
17547
|
+
consoleDebug("Human agent service restarting");
|
|
17548
|
+
await serviceManager.humanAgentService.initialize();
|
|
17549
|
+
}
|
|
17542
17550
|
} catch (error) {
|
|
17543
17551
|
consoleError("Failed to update human agent service dynamically:", error);
|
|
17544
17552
|
throw error;
|