@microsoft/omnichannel-chat-widget 1.8.2-main.fc93d3d → 1.8.3-main.1381896

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.
Files changed (126) hide show
  1. package/README.md +46 -1
  2. package/lib/cjs/common/Constants.js +10 -2
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +6 -0
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +7 -5
  5. package/lib/cjs/common/utils.js +27 -2
  6. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
  7. package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
  8. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
  9. package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
  10. package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  11. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
  12. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  13. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
  14. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +54 -1
  15. package/lib/cjs/components/livechatwidget/common/customEventHandler.js +53 -0
  16. package/lib/cjs/components/livechatwidget/common/endChat.js +34 -4
  17. package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  18. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -5
  19. package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  20. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
  21. package/lib/cjs/components/livechatwidget/common/startChat.js +8 -6
  22. package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
  23. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
  24. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -13
  25. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
  26. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  27. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  28. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +62 -3
  29. package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
  30. package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +42 -0
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +139 -0
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +41 -0
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +54 -0
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +45 -0
  38. package/lib/cjs/contexts/common/CustomEventType.js +1 -0
  39. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
  40. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  41. package/lib/cjs/contexts/createReducer.js +15 -0
  42. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
  43. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
  44. package/lib/cjs/firstresponselatency/util.js +24 -10
  45. package/lib/cjs/index.js +9 -1
  46. package/lib/cjs/plugins/createChatTranscript.js +13 -0
  47. package/lib/cjs/plugins/newMessageEventHandler.js +2 -2
  48. package/lib/esm/common/Constants.js +10 -2
  49. package/lib/esm/common/telemetry/TelemetryConstants.js +6 -0
  50. package/lib/esm/common/telemetry/TelemetryHelper.js +7 -5
  51. package/lib/esm/common/utils.js +21 -0
  52. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
  53. package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
  54. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
  55. package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
  56. package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  57. package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
  58. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  59. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
  60. package/lib/esm/components/livechatwidget/common/createMarkdown.js +54 -1
  61. package/lib/esm/components/livechatwidget/common/customEventHandler.js +45 -0
  62. package/lib/esm/components/livechatwidget/common/endChat.js +35 -5
  63. package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  64. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -6
  65. package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  66. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
  67. package/lib/esm/components/livechatwidget/common/startChat.js +8 -6
  68. package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
  69. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
  70. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -14
  71. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
  72. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  73. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  74. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +55 -0
  75. package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
  76. package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  77. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  78. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +36 -0
  80. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +133 -0
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +33 -0
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +46 -0
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +38 -0
  84. package/lib/esm/contexts/common/CustomEventType.js +1 -0
  85. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
  86. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  87. package/lib/esm/contexts/createReducer.js +15 -0
  88. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
  89. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
  90. package/lib/esm/firstresponselatency/util.js +21 -8
  91. package/lib/esm/index.js +1 -0
  92. package/lib/esm/plugins/createChatTranscript.js +13 -0
  93. package/lib/esm/plugins/newMessageEventHandler.js +3 -3
  94. package/lib/types/common/Constants.d.ts +10 -2
  95. package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -0
  96. package/lib/types/common/utils.d.ts +8 -0
  97. package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
  98. package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
  99. package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
  100. package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
  101. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
  102. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
  103. package/lib/types/components/livechatwidget/common/customEventHandler.d.ts +4 -0
  104. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
  105. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
  106. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
  107. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
  108. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
  109. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +8 -1
  110. package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
  111. package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
  112. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.d.ts +8 -0
  113. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +4 -0
  114. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.d.ts +22 -0
  115. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +5 -0
  116. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +5 -0
  117. package/lib/types/contexts/common/CustomEventType.d.ts +6 -0
  118. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  119. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
  120. package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +2 -2
  121. package/lib/types/firstresponselatency/util.d.ts +1 -0
  122. package/lib/types/index.d.ts +1 -0
  123. package/package.json +5 -4
  124. /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  125. /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  126. /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _WebChatActionType = require("../../enums/WebChatActionType");
8
+ /******
9
+ * CallActionMiddleware
10
+ *
11
+ * Intercepts custom call actions and handles tel: URL navigation
12
+ ******/
13
+
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
15
+ const createCallActionMiddleware = () => () => next => action => {
16
+ // Intercept incoming activities to modify suggested actions with call type
17
+ if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
18
+ var _action$payload, _activity$suggestedAc;
19
+ const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
20
+
21
+ // Check if activity has suggested actions with call type
22
+ if (activity !== null && activity !== void 0 && (_activity$suggestedAc = activity.suggestedActions) !== null && _activity$suggestedAc !== void 0 && _activity$suggestedAc.actions) {
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ activity.suggestedActions.actions = activity.suggestedActions.actions.map(suggestedAction => {
25
+ if (suggestedAction.type === "call") {
26
+ // Convert call action to openUrl with encoded tel URL scheme
27
+ const telUrl = suggestedAction.value;
28
+ const convertedAction = {
29
+ ...suggestedAction,
30
+ type: "openUrl",
31
+ value: `tel:${telUrl}`
32
+ };
33
+ return convertedAction;
34
+ }
35
+ return suggestedAction;
36
+ });
37
+ }
38
+ }
39
+ return next(action);
40
+ };
41
+ var _default = createCallActionMiddleware;
42
+ exports.default = _default;
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCitationsMiddleware = void 0;
7
+ var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
8
+ var _LiveChatWidgetActionType = require("../../../../../contexts/common/LiveChatWidgetActionType");
9
+ var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
10
+ var _createReducer = require("../../../../../contexts/createReducer");
11
+ // Middleware that extracts citation metadata from incoming ACS activities and
12
+ // updates in-memory app state with a global citation map. Also rewrites
13
+ // per-message citation labels in the activity text to use a stable,
14
+ // message-scoped prefix when the producer provides a message id.
15
+
16
+ const createCitationsMiddleware = (state, dispatch) => () => next => action => {
17
+ var _action$payload;
18
+ if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
19
+ if (isApplicable(action)) {
20
+ try {
21
+ var _action$payload2, _action$payload2$acti, _gptFeedback$summariz, _gptFeedback$summariz2;
22
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
23
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
24
+ payload: null
25
+ });
26
+
27
+ // Use the producer-supplied messageid as a stable per-message prefix
28
+ // when present. Do not derive a prefix from activity.id or timestamps.
29
+ const messagePrefix = ((_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.messageid) ?? "";
30
+ const gptFeedback = JSON.parse(action.payload.activity.channelData.metadata["pva:gpt-feedback"]);
31
+ // Extract citation objects from the model response
32
+ const citations = (_gptFeedback$summariz = gptFeedback.summarizationOpenAIResponse) === null || _gptFeedback$summariz === void 0 ? void 0 : (_gptFeedback$summariz2 = _gptFeedback$summariz.result) === null || _gptFeedback$summariz2 === void 0 ? void 0 : _gptFeedback$summariz2.textCitations;
33
+ // Rewrite inline citation labels in activity.text to match the global map keys
34
+ const updatedText = replaceCitations(action.payload.activity.text, citations, messagePrefix);
35
+ action.payload.activity.text = updatedText;
36
+ // Build a global citation map keyed by the prefixed citation id and
37
+ // dispatch it to app state so the UI container can render citations.
38
+ try {
39
+ var _inMemoryState$domain;
40
+ const citationMap = {};
41
+ if (citations && Array.isArray(citations)) {
42
+ citations.forEach(citation => {
43
+ if (citation !== null && citation !== void 0 && citation.id) {
44
+ // Preserve the 'cite:' scheme so renderer click handling remains consistent
45
+ const idWithoutScheme = citation.id.replace(/^cite:/, "");
46
+ const prefixedId = `cite:${messagePrefix}_${idWithoutScheme}`;
47
+ citationMap[prefixedId] = citation.text || citation.title || "";
48
+ }
49
+ });
50
+ }
51
+
52
+ // Read current in-memory state to merge with existing citations
53
+ //const inMemoryState = executeReducer(state, { type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE, payload: null });
54
+ const existingCitations = (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : _inMemoryState$domain.citations) || {};
55
+ const updatedCitations = {
56
+ ...existingCitations,
57
+ ...citationMap
58
+ };
59
+ // Always dispatch to app state
60
+ dispatch({
61
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS,
62
+ payload: updatedCitations
63
+ });
64
+ } catch (innerErr) {
65
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
66
+ Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
67
+ ExceptionDetails: {
68
+ ErrorData: "Error while populating citation map",
69
+ Exception: innerErr
70
+ }
71
+ });
72
+ }
73
+ } catch (error) {
74
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
75
+ Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
76
+ ExceptionDetails: {
77
+ ErrorData: "Error while converting citation labels",
78
+ Exception: error
79
+ }
80
+ });
81
+ }
82
+ }
83
+ }
84
+ return next(action);
85
+ };
86
+ exports.createCitationsMiddleware = createCitationsMiddleware;
87
+ const isApplicable = action => {
88
+ var _action$payload3, _action$payload3$acti, _action$payload4, _action$payload4$acti;
89
+ if ((action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : _action$payload3$acti.actionType) === "DIRECT_LINE/INCOMING_ACTIVITY" && (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : _action$payload4$acti.channelId) === "ACS_CHANNEL") {
90
+ var _action$payload5, _action$payload5$acti, _action$payload5$acti2, _action$payload5$acti3;
91
+ // Only applicable for ACS incoming activities that include pva:gpt-feedback
92
+ if (action !== null && action !== void 0 && (_action$payload5 = action.payload) !== null && _action$payload5 !== void 0 && (_action$payload5$acti = _action$payload5.activity) !== null && _action$payload5$acti !== void 0 && (_action$payload5$acti2 = _action$payload5$acti.channelData) !== null && _action$payload5$acti2 !== void 0 && (_action$payload5$acti3 = _action$payload5$acti2.metadata) !== null && _action$payload5$acti3 !== void 0 && _action$payload5$acti3["pva:gpt-feedback"]) {
93
+ return true;
94
+ }
95
+ }
96
+ return false;
97
+ };
98
+ const replaceCitations = (text, citations, messagePrefix) => {
99
+ if (!citations || !Array.isArray(citations)) {
100
+ return text;
101
+ }
102
+ try {
103
+ let updatedText = text;
104
+
105
+ // First, handle the citation reference definitions at the end (e.g., [1]: cite:1757450535119_1 "index.html")
106
+ // These should NOT be escaped as they are proper citation definitions
107
+ updatedText = updatedText.replace(/\[(\d+)\]:\s(cite:\d+)\s"([^\\"]+)"/g, (match, number, citeId) => {
108
+ // Attempt to find a citation object matching the inline cite id and
109
+ // update the displayed id/title. When a messagePrefix exists we
110
+ // rewrite the id to the prefixed form so it aligns with the
111
+ // global citation map keys.
112
+ const lookupId = citeId;
113
+ const citation = citations.find(c => c.id === lookupId);
114
+ if (citation) {
115
+ const idWithoutScheme = citeId.replace(/^cite:/, "");
116
+ const prefixed = messagePrefix ? `cite:${messagePrefix}_${idWithoutScheme}` : citeId;
117
+ return `[${number}]: ${prefixed} "${citation.title}"`;
118
+ }
119
+ return match;
120
+ });
121
+
122
+ // Second, escape inline citation references that are NOT followed by a colon
123
+ // This handles cases like "[1][2]"" in the middle of text that should be escaped for markdown
124
+ updatedText = updatedText.replace(/\[(\d+)\](?!:)/g, (match, number) => {
125
+ // Escape the brackets to prevent markdown from treating them as incomplete link syntax
126
+ return `[${number}]`;
127
+ });
128
+ return updatedText;
129
+ } catch (error) {
130
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
131
+ Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
132
+ ExceptionDetails: {
133
+ ErrorData: "Error while finding citations references",
134
+ Exception: error
135
+ }
136
+ });
137
+ return text;
138
+ }
139
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidCustomEvent = exports.default = void 0;
7
+ var _Constants = require("../../../../../common/Constants");
8
+ var _WebChatActionType = require("../../enums/WebChatActionType");
9
+ /******
10
+ * CustomEventMiddleware
11
+ *
12
+ * This middleware is invoked when a custom event is received.
13
+ * The callback is then invoked to handle the custom event.
14
+ ******/
15
+
16
+ const isValidCustomEvent = activity => {
17
+ var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6, _activity$channelData7, _activity$from, _activity$channelData8, _activity$channelData9, _activity$channelData10, _activity$channelData11;
18
+ return !!(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.metadata) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.customEvent && typeof (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : (_activity$channelData4 = _activity$channelData3.metadata) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.customEvent) === _Constants.Constants.String && (activity === null || activity === void 0 ? void 0 : (_activity$channelData5 = activity.channelData) === null || _activity$channelData5 === void 0 ? void 0 : (_activity$channelData6 = _activity$channelData5.metadata) === null || _activity$channelData6 === void 0 ? void 0 : (_activity$channelData7 = _activity$channelData6.customEvent) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.toLowerCase()) === _Constants.Constants.true && (activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) !== _Constants.Constants.userMessageTag && typeof (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.metadata) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.customEventName) === _Constants.Constants.String && activity !== null && activity !== void 0 && (_activity$channelData10 = activity.channelData) !== null && _activity$channelData10 !== void 0 && (_activity$channelData11 = _activity$channelData10.metadata) !== null && _activity$channelData11 !== void 0 && _activity$channelData11.customEventValue);
19
+ };
20
+ exports.isValidCustomEvent = isValidCustomEvent;
21
+ const createCustomEventMiddleware = broadcastservice => () => next => action => {
22
+ var _action$payload;
23
+ if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
24
+ const activity = action.payload.activity;
25
+ if (isValidCustomEvent(activity)) {
26
+ const customEvent = {
27
+ eventName: _Constants.Constants.onCustomEvent,
28
+ payload: {
29
+ messageId: activity.messageid ?? activity.id,
30
+ customEventName: activity.channelData.metadata.customEventName,
31
+ customEventValue: activity.channelData.metadata.customEventValue
32
+ }
33
+ };
34
+ broadcastservice.postMessage(customEvent);
35
+ return;
36
+ }
37
+ }
38
+ return next(action);
39
+ };
40
+ var _default = createCustomEventMiddleware;
41
+ exports.default = _default;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.localizedStringsBotInitialsMiddleware = exports.getOverriddenLocalizedStrings = void 0;
7
+ var _Constants = require("../../../../../common/Constants");
8
+ var _utils = require("../../../../../common/utils");
9
+ var _defaultWebChatStyles = require("../../../common/defaultStyles/defaultWebChatStyles");
10
+ var _WebChatActionType = require("../../enums/WebChatActionType");
11
+ /* eslint-disable @typescript-eslint/no-explicit-any */
12
+
13
+ let currentAgentInitials = _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials;
14
+ const localizedStringsBotInitialsMiddleware = () => _ref => {
15
+ let {
16
+ dispatch
17
+ } = _ref;
18
+ return next => action => {
19
+ if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
20
+ var _action$payload, _activity$from;
21
+ const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
22
+ if (activity !== null && activity !== void 0 && (_activity$from = activity.from) !== null && _activity$from !== void 0 && _activity$from.name && activity.from.role !== _Constants.Constants.userMessageTag && activity.from.name !== _Constants.Constants.userMessageTag) {
23
+ var _activity$channelData, _activity$channelData2, _activity$tags;
24
+ const agentName = activity.from.name.trim();
25
+ const isSystemMessage = agentName === "__agent__" || agentName.startsWith("__") || ((_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.systemMessageTag)) || ((_activity$tags = activity.tags) === null || _activity$tags === void 0 ? void 0 : _activity$tags.includes(_Constants.Constants.systemMessageTag));
26
+ if (!isSystemMessage && agentName !== "") {
27
+ // Update initials for valid agent/bot names
28
+ const newInitials = (0, _utils.getIconText)(agentName) || currentAgentInitials;
29
+ currentAgentInitials = newInitials;
30
+ }
31
+ }
32
+ }
33
+ return next(action);
34
+ };
35
+ };
36
+ exports.localizedStringsBotInitialsMiddleware = localizedStringsBotInitialsMiddleware;
37
+ const getOverriddenLocalizedStrings = existingOverrides => {
38
+ return strings => {
39
+ const result = {
40
+ ...strings,
41
+ ...existingOverrides
42
+ };
43
+
44
+ // Apply dynamic bot initials to alt text if not already overridden through props
45
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_SAID_ALT)) {
46
+ result.ACTIVITY_BOT_SAID_ALT = `${currentAgentInitials} said:`;
47
+ }
48
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_ATTACHED_ALT)) {
49
+ result.ACTIVITY_BOT_ATTACHED_ALT = `${currentAgentInitials} attached:`;
50
+ }
51
+ return result;
52
+ };
53
+ };
54
+ exports.getOverriddenLocalizedStrings = getOverriddenLocalizedStrings;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createQueueOverflowMiddleware = void 0;
7
+ var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
8
+ var _LiveChatWidgetActionType = require("../../../../../contexts/common/LiveChatWidgetActionType");
9
+ var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
10
+ var _WebChatActionType = require("../../enums/WebChatActionType");
11
+ var _createReducer = require("../../../../../contexts/createReducer");
12
+ var _utils = require("../../../../../common/utils");
13
+ const queueOverflowHandlingHelper = async (state, dispatch) => {
14
+ const {
15
+ appStates
16
+ } = (0, _createReducer.executeReducer)(state, {
17
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
18
+ payload: undefined
19
+ });
20
+ if (!appStates.chatDisconnectEventReceived) {
21
+ dispatch({
22
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
23
+ payload: true
24
+ });
25
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
26
+ Event: _TelemetryConstants.TelemetryEvent.QueueOverflowEvent,
27
+ Description: "Set chat disconnect event received."
28
+ });
29
+ }
30
+ };
31
+ const createQueueOverflowMiddleware = (state, dispatch) => () => next => action => {
32
+ var _action$payload;
33
+ if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
34
+ const activity = action.payload.activity;
35
+ if ((0, _utils.isEndConversationDueToOverflowActivity)(activity)) {
36
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
37
+ Event: _TelemetryConstants.TelemetryEvent.QueueOverflowEvent,
38
+ Description: "Queue overflow event received."
39
+ });
40
+ queueOverflowHandlingHelper(state, dispatch);
41
+ }
42
+ }
43
+ return next(action);
44
+ };
45
+ exports.createQueueOverflowMiddleware = createQueueOverflowMiddleware;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -10,49 +10,50 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
10
10
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
11
11
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
12
12
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MIDDLEWARE_LOCALIZED_TEXTS"] = 2] = "SET_MIDDLEWARE_LOCALIZED_TEXTS";
13
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 3] = "SET_GLOBAL_DIR";
14
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
15
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
16
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
17
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 8] = "SET_START_CHAT_FAILURE_TYPE";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 9] = "SET_OUTSIDE_OPERATING_HOURS";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 10] = "SET_PRE_CHAT_SURVEY_RESPONSE";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 11] = "SET_CUSTOM_CONTEXT";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 12] = "SET_SHOW_CONFIRMATION";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 13] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 14] = "SET_PRECHAT_RESPONSE_EMAIL";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 15] = "SET_AUDIO_NOTIFICATION";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 16] = "SET_E2VV_ENABLED";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 17] = "SET_POST_CHAT_CONTEXT";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 18] = "SHOW_CALLING_CONTAINER";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 19] = "SET_INCOMING_CALL";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 20] = "DISABLE_VIDEO_CALL";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 21] = "DISABLE_LOCAL_VIDEO";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 22] = "DISABLE_REMOTE_VIDEO";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 23] = "SET_CHAT_TOKEN";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 24] = "SET_START_CHAT_BUTTON_DISPLAY";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 25] = "SET_PROACTIVE_CHAT_PARAMS";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 26] = "SET_TELEMETRY_DATA";
37
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 27] = "SET_RECONNECT_ID";
38
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 28] = "SET_UNREAD_MESSAGE_COUNT";
39
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 29] = "SET_FOCUS_CHAT_BUTTON";
40
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 30] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
41
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 31] = "SET_CONVERSATION_ENDED_BY";
42
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 32] = "SET_WIDGET_STATE";
43
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 33] = "SET_LIVE_CHAT_CONTEXT";
44
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 34] = "SET_BOT_OAUTH_SIGNIN_ID";
45
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 35] = "SET_WIDGET_SIZE";
46
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 36] = "SET_WIDGET_INSTANCE_ID";
47
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 37] = "SET_LIVE_CHAT_CONFIG";
48
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 38] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
49
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 39] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
50
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 40] = "SET_SHOULD_USE_BOT_SURVEY";
51
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 41] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
52
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
53
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
54
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
55
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 45] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
56
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 46] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
57
- LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 47] = "GET_IN_MEMORY_STATE";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CITATIONS"] = 3] = "SET_CITATIONS";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 4] = "SET_GLOBAL_DIR";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 5] = "SET_MINIMIZED";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 6] = "SET_CONVERSATION_STATE";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 7] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 8] = "SET_START_CHAT_FAILING";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 9] = "SET_START_CHAT_FAILURE_TYPE";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 10] = "SET_OUTSIDE_OPERATING_HOURS";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 11] = "SET_PRE_CHAT_SURVEY_RESPONSE";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 12] = "SET_CUSTOM_CONTEXT";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 13] = "SET_SHOW_CONFIRMATION";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 14] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 15] = "SET_PRECHAT_RESPONSE_EMAIL";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 16] = "SET_AUDIO_NOTIFICATION";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 17] = "SET_E2VV_ENABLED";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 18] = "SET_POST_CHAT_CONTEXT";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 19] = "SHOW_CALLING_CONTAINER";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 20] = "SET_INCOMING_CALL";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 21] = "DISABLE_VIDEO_CALL";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 22] = "DISABLE_LOCAL_VIDEO";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 23] = "DISABLE_REMOTE_VIDEO";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 24] = "SET_CHAT_TOKEN";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 25] = "SET_START_CHAT_BUTTON_DISPLAY";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 26] = "SET_PROACTIVE_CHAT_PARAMS";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 27] = "SET_TELEMETRY_DATA";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 28] = "SET_RECONNECT_ID";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 29] = "SET_UNREAD_MESSAGE_COUNT";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 30] = "SET_FOCUS_CHAT_BUTTON";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 31] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 32] = "SET_CONVERSATION_ENDED_BY";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 33] = "SET_WIDGET_STATE";
44
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 34] = "SET_LIVE_CHAT_CONTEXT";
45
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 35] = "SET_BOT_OAUTH_SIGNIN_ID";
46
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 36] = "SET_WIDGET_SIZE";
47
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 37] = "SET_WIDGET_INSTANCE_ID";
48
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 38] = "SET_LIVE_CHAT_CONFIG";
49
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 39] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
50
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 40] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
51
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 41] = "SET_SHOULD_USE_BOT_SURVEY";
52
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 42] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
53
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 43] = "SET_SURVEY_MODE";
54
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 44] = "SET_CONFIRMATION_STATE";
55
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 45] = "SET_POST_CHAT_PARTICIPANT_TYPE";
56
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
57
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
58
+ LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
58
59
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
@@ -45,6 +45,8 @@ const getLiveChatWidgetContextInitialState = props => {
45
45
  domainStates: {
46
46
  liveChatConfig: props.chatConfig,
47
47
  widgetElementId: "",
48
+ // Map of citation id => content injected by citations middleware
49
+ citations: {},
48
50
  renderingMiddlewareProps: (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.renderingMiddlewareProps,
49
51
  middlewareLocalizedTexts: _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
50
52
  preChatSurveyResponse: "{}",
@@ -70,6 +70,21 @@ const reducer = (state, action) => {
70
70
  middlewareLocalizedTexts: action.payload
71
71
  }
72
72
  };
73
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS:
74
+ inMemory = {
75
+ ...inMemory,
76
+ domainStates: {
77
+ ...inMemory.domainStates,
78
+ citations: action.payload
79
+ }
80
+ };
81
+ return {
82
+ ...state,
83
+ domainStates: {
84
+ ...state.domainStates,
85
+ citations: action.payload
86
+ }
87
+ };
73
88
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_GLOBAL_DIR:
74
89
  inMemory = {
75
90
  ...inMemory,