@microsoft/omnichannel-chat-widget 0.1.0-main.20562ae → 0.1.0-main.4188c11
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/lib/cjs/common/Constants.js +32 -4
- package/lib/cjs/common/telemetry/TelemetryConstants.js +9 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -1
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +16 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -14
- package/lib/cjs/components/livechatwidget/common/endChat.js +10 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +7 -0
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -15
- package/lib/cjs/components/livechatwidget/common/startChat.js +38 -29
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +30 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +22 -21
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +28 -3
- package/lib/esm/common/telemetry/TelemetryConstants.js +9 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +9 -1
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +12 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -15
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +6 -0
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -13
- package/lib/esm/components/livechatwidget/common/startChat.js +39 -30
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +22 -21
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/esm/contexts/createReducer.js +8 -0
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +16 -1
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +9 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +22 -21
- package/package.json +6 -7
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.ElementType = exports.Constants = exports.ChatSDKError = void 0;
|
|
6
|
+
exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.Constants = exports.ChatSDKError = exports.AriaTelemetryConstants = void 0;
|
|
7
7
|
|
|
8
8
|
var _class;
|
|
9
9
|
|
|
@@ -131,8 +131,6 @@ _defineProperty(Constants, "InputSubmit", "InputSubmit");
|
|
|
131
131
|
|
|
132
132
|
_defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
|
|
133
133
|
|
|
134
|
-
_defineProperty(Constants, "redirectPageRequest", "redirectPageRequest");
|
|
135
|
-
|
|
136
134
|
_defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
|
|
137
135
|
|
|
138
136
|
_defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
|
|
@@ -284,6 +282,16 @@ exports.ChatSDKError = ChatSDKError;
|
|
|
284
282
|
ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
|
|
285
283
|
})(ChatSDKError || (exports.ChatSDKError = ChatSDKError = {}));
|
|
286
284
|
|
|
285
|
+
let EnvironmentVersion;
|
|
286
|
+
exports.EnvironmentVersion = EnvironmentVersion;
|
|
287
|
+
|
|
288
|
+
(function (EnvironmentVersion) {
|
|
289
|
+
EnvironmentVersion["prod"] = "prod";
|
|
290
|
+
EnvironmentVersion["dogfood"] = "df";
|
|
291
|
+
EnvironmentVersion["int"] = "int";
|
|
292
|
+
EnvironmentVersion["test"] = "test";
|
|
293
|
+
})(EnvironmentVersion || (exports.EnvironmentVersion = EnvironmentVersion = {}));
|
|
294
|
+
|
|
287
295
|
class TranscriptConstants {}
|
|
288
296
|
|
|
289
297
|
exports.TranscriptConstants = TranscriptConstants;
|
|
@@ -306,4 +314,24 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
|
|
|
306
314
|
|
|
307
315
|
_defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
|
|
308
316
|
|
|
309
|
-
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
317
|
+
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
318
|
+
|
|
319
|
+
class AriaTelemetryConstants {}
|
|
320
|
+
|
|
321
|
+
exports.AriaTelemetryConstants = AriaTelemetryConstants;
|
|
322
|
+
|
|
323
|
+
_defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
|
|
324
|
+
|
|
325
|
+
_defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
|
|
326
|
+
|
|
327
|
+
_defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
|
|
328
|
+
|
|
329
|
+
_defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
|
|
330
|
+
|
|
331
|
+
_defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
|
|
332
|
+
|
|
333
|
+
_defineProperty(AriaTelemetryConstants, "Public", "Public");
|
|
334
|
+
|
|
335
|
+
_defineProperty(AriaTelemetryConstants, "EU", "Europe");
|
|
336
|
+
|
|
337
|
+
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
@@ -46,6 +46,10 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
46
46
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
47
47
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
48
48
|
BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
|
|
49
|
+
BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
|
|
50
|
+
BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
|
|
51
|
+
BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
|
|
52
|
+
BroadcastEvent["SetCustomContext"] = "SetCustomContext";
|
|
49
53
|
})(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
|
|
50
54
|
|
|
51
55
|
let TelemetryEvent;
|
|
@@ -135,6 +139,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
135
139
|
TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
|
|
136
140
|
TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
|
|
137
141
|
TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
|
|
142
|
+
TelemetryEvent["WebChatEvent"] = "WebChatEvent";
|
|
138
143
|
TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
|
|
139
144
|
TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
|
|
140
145
|
TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
|
|
@@ -148,6 +153,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
148
153
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
149
154
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
150
155
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
156
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
151
157
|
})(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
|
|
152
158
|
|
|
153
159
|
class TelemetryConstants {
|
|
@@ -190,6 +196,9 @@ class TelemetryConstants {
|
|
|
190
196
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
191
197
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
192
198
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
199
|
+
case TelemetryEvent.MessageSent:
|
|
200
|
+
case TelemetryEvent.MessageReceived:
|
|
201
|
+
case TelemetryEvent.CustomContextReceived:
|
|
193
202
|
return ScenarioType.ACTIONS;
|
|
194
203
|
|
|
195
204
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -276,5 +276,18 @@ _defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
|
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
|
|
279
|
+
_omnichannelChatComponents.BroadcastService.postMessage(telemetryEvent);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
_defineProperty(TelemetryHelper, "logWebChatEvent", (logLevel, payload) => {
|
|
283
|
+
const telemetryEvent = {
|
|
284
|
+
eventName: _TelemetryConstants.TelemetryEvent.WebChatEvent,
|
|
285
|
+
logLevel: logLevel,
|
|
286
|
+
payload: { ...payload,
|
|
287
|
+
type: _TelemetryConstants.TelemetryEvent.WebChatEvent,
|
|
288
|
+
scenarioType: _TelemetryConstants.ScenarioType.WEBCHAT
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
279
292
|
_omnichannelChatComponents.BroadcastService.postMessage(telemetryEvent);
|
|
280
293
|
});
|
|
@@ -15,6 +15,8 @@ var _consoleLogger = require("./loggers/consoleLogger");
|
|
|
15
15
|
|
|
16
16
|
var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
|
|
17
17
|
|
|
18
|
+
var _TelemetryHelper = require("./TelemetryHelper");
|
|
19
|
+
|
|
18
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
21
|
|
|
20
22
|
class TelemetryTimers {}
|
|
@@ -88,8 +90,15 @@ const RegisterLoggers = () => {
|
|
|
88
90
|
|
|
89
91
|
const logTelemetry = telemetryEvent => {
|
|
90
92
|
loggers.map(logger => {
|
|
93
|
+
var _payload;
|
|
94
|
+
|
|
91
95
|
const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
|
|
92
|
-
|
|
96
|
+
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? _TelemetryConstants.ScenarioType.UNDEFINED;
|
|
97
|
+
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
98
|
+
telemetryInput.telemetryInfo = {
|
|
99
|
+
telemetryInfo: _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
100
|
+
};
|
|
101
|
+
logger.log(logLevel, telemetryInput);
|
|
93
102
|
});
|
|
94
103
|
};
|
|
95
104
|
|
|
@@ -11,6 +11,9 @@ const defaultTelemetryConfiguration = {
|
|
|
11
11
|
telemetryDisabled: false,
|
|
12
12
|
disableConsoleLog: false,
|
|
13
13
|
telemetryLoggers: [],
|
|
14
|
-
ariaConfigurations: _defaultAriaConfig.defaultAriaConfig
|
|
14
|
+
ariaConfigurations: _defaultAriaConfig.defaultAriaConfig,
|
|
15
|
+
chatWidgetVersion: "0.0.0-0",
|
|
16
|
+
chatComponentVersion: "0.0.0-0",
|
|
17
|
+
OCChatSDKVersion: "0.0.0-0"
|
|
15
18
|
};
|
|
16
19
|
exports.defaultTelemetryConfiguration = defaultTelemetryConfiguration;
|
|
@@ -15,7 +15,7 @@ var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/E
|
|
|
15
15
|
|
|
16
16
|
var _Constants = require("../../Constants");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _TelemetryManager = require("../TelemetryManager");
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -30,6 +30,21 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
30
30
|
|
|
31
31
|
if (!(0, _utils.isNullOrEmptyString)(collectiorUriForTelemetry)) {
|
|
32
32
|
configuration.collectorUri = collectiorUriForTelemetry;
|
|
33
|
+
} else {
|
|
34
|
+
if (_TelemetryManager.TelemetryManager.InternalTelemetryData.environmentVersion == _Constants.EnvironmentVersion.prod) {
|
|
35
|
+
var _TelemetryManager$Int;
|
|
36
|
+
|
|
37
|
+
const orgUrl = (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
|
|
38
|
+
|
|
39
|
+
if (!(0, _utils.isNullOrUndefined)(orgUrl)) {
|
|
40
|
+
// If the given org is a Production EU org, modify the Aria collector uri
|
|
41
|
+
const region = (0, _utils.getDomain)(orgUrl);
|
|
42
|
+
|
|
43
|
+
if (region === _Constants.AriaTelemetryConstants.EU) {
|
|
44
|
+
configuration.collectorUri = _Constants.AriaTelemetryConstants.EUROPE_ENDPOINT;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
try {
|
|
@@ -48,20 +63,25 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
48
63
|
|
|
49
64
|
const ariaLogger = {
|
|
50
65
|
log: (logLevel, telemetryInput) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
try {
|
|
67
|
+
let property;
|
|
68
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
69
|
+
const eventProperties = new _AWTEventProperties.default();
|
|
70
|
+
eventProperties.setName(telemetryInput.scenarioType);
|
|
71
|
+
|
|
72
|
+
if (telemetryInfo) {
|
|
73
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
74
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
75
|
+
eventProperties.setProperty(key, property);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
79
|
+
}
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
61
84
|
}
|
|
62
|
-
|
|
63
|
-
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
64
|
-
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
65
85
|
},
|
|
66
86
|
dispose: () => {
|
|
67
87
|
_AWTLogManager.default.flush(function () {
|
|
@@ -13,27 +13,28 @@ const consoleLogger = () => {
|
|
|
13
13
|
const consoleLogger = {
|
|
14
14
|
log: (logLevel, telemetryInput) => {
|
|
15
15
|
const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
|
|
16
|
+
const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
19
|
switch (logLevel) {
|
|
19
20
|
case _TelemetryConstants.LogLevel.INFO:
|
|
20
|
-
console.info(_Constants.Constants.LiveChatWidget, payload);
|
|
21
|
+
console.info(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
21
22
|
break;
|
|
22
23
|
|
|
23
24
|
case _TelemetryConstants.LogLevel.DEBUG:
|
|
24
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
25
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
25
26
|
break;
|
|
26
27
|
|
|
27
28
|
case _TelemetryConstants.LogLevel.WARN:
|
|
28
|
-
console.warn(_Constants.Constants.LiveChatWidget, payload);
|
|
29
|
+
console.warn(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
29
30
|
break;
|
|
30
31
|
|
|
31
32
|
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
-
console.error(_Constants.Constants.LiveChatWidget, payload);
|
|
33
|
+
console.error(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
33
34
|
break;
|
|
34
35
|
|
|
35
36
|
default:
|
|
36
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
37
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
} catch (ex) {
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
|
|
6
|
+
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
|
|
7
7
|
|
|
8
8
|
var _Constants = require("./Constants");
|
|
9
9
|
|
|
@@ -332,6 +332,20 @@ const createTimer = () => {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
};
|
|
335
|
+
}; // Returns the domain of the org
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
exports.createTimer = createTimer;
|
|
340
|
+
|
|
341
|
+
const getDomain = hostValue => {
|
|
342
|
+
for (let i = 0; i < _Constants.AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
343
|
+
if (hostValue.endsWith(_Constants.AriaTelemetryConstants.lcwEUDomainNames[i])) {
|
|
344
|
+
return _Constants.AriaTelemetryConstants.EU;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return _Constants.AriaTelemetryConstants.Public;
|
|
335
349
|
};
|
|
336
350
|
|
|
337
|
-
exports.
|
|
351
|
+
exports.getDomain = getDomain;
|
|
@@ -206,6 +206,20 @@ const CallingContainerStateful = props => {
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
+
window.addEventListener("beforeunload", () => {
|
|
210
|
+
if (state.uiStates.isIncomingCall) {
|
|
211
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
212
|
+
} else {
|
|
213
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
217
|
+
dispatch({
|
|
218
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
219
|
+
payload: false
|
|
220
|
+
});
|
|
221
|
+
resetCallingStates(true);
|
|
222
|
+
});
|
|
209
223
|
}, []);
|
|
210
224
|
const controlProps = {
|
|
211
225
|
id: "oc-lcw-callingcontainer",
|
|
@@ -50,7 +50,7 @@ const ChatButtonStateful = props => {
|
|
|
50
50
|
dir: state.domainStates.globalDir,
|
|
51
51
|
titleText: "Let's Chat!",
|
|
52
52
|
subtitleText: "We're online.",
|
|
53
|
-
hideNotificationBubble:
|
|
53
|
+
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
54
54
|
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? _Constants.Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
|
|
55
55
|
onClick: async () => {
|
|
56
56
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -123,8 +123,7 @@ const FooterStateful = props => {
|
|
|
123
123
|
styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
|
|
124
124
|
}), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
|
|
125
125
|
audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
|
|
126
|
-
|
|
127
|
-
isAudioMuted: state.appStates.isAudioMuted ?? false
|
|
126
|
+
isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
|
|
128
127
|
}));
|
|
129
128
|
};
|
|
130
129
|
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -138,7 +138,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
138
138
|
|
|
139
139
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
140
140
|
fileAttachmentName = value.attachments[0].name;
|
|
141
|
-
value.content = attachmentMessage
|
|
141
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -27,6 +27,8 @@ var _groupActivitiesMiddleware = require("../../../webchatcontainerstateful/webc
|
|
|
27
27
|
|
|
28
28
|
var _typingIndicatorMiddleware = require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware");
|
|
29
29
|
|
|
30
|
+
var _WebChatLogger = require("../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
/* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any */
|
|
@@ -272,18 +274,6 @@ const dummyDefaultProps = {
|
|
|
272
274
|
width: "50px",
|
|
273
275
|
fontSize: "18px"
|
|
274
276
|
},
|
|
275
|
-
currentCallTimerStyleProps: {
|
|
276
|
-
borderRadius: "2px",
|
|
277
|
-
margin: "1px",
|
|
278
|
-
color: "#FFFFFF",
|
|
279
|
-
paddingTop: "18px",
|
|
280
|
-
fontSize: 12,
|
|
281
|
-
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
282
|
-
backgroundColor: "darkgrey",
|
|
283
|
-
height: "45px",
|
|
284
|
-
width: "50px",
|
|
285
|
-
textAlign: "center"
|
|
286
|
-
},
|
|
287
277
|
videoTileStyleProps: {
|
|
288
278
|
width: "100%",
|
|
289
279
|
marginLeft: "auto",
|
|
@@ -1444,7 +1434,8 @@ const dummyDefaultProps = {
|
|
|
1444
1434
|
},
|
|
1445
1435
|
authClientFunction: undefined,
|
|
1446
1436
|
isReconnectEnabled: undefined,
|
|
1447
|
-
reconnectId: undefined
|
|
1437
|
+
reconnectId: undefined,
|
|
1438
|
+
redirectInSameWindow: undefined
|
|
1448
1439
|
},
|
|
1449
1440
|
styleProps: {
|
|
1450
1441
|
generalStyles: {
|
|
@@ -1516,7 +1507,7 @@ const dummyDefaultProps = {
|
|
|
1516
1507
|
internalErrorBoxClass: undefined,
|
|
1517
1508
|
internalRenderErrorBox: undefined,
|
|
1518
1509
|
locale: "en-US",
|
|
1519
|
-
onTelemetry:
|
|
1510
|
+
onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
|
|
1520
1511
|
overrideLocalizedStrings: undefined,
|
|
1521
1512
|
renderMarkdown: (0, _createMarkdown.createMarkdown)(false, false),
|
|
1522
1513
|
scrollToEndButtonMiddleware: undefined,
|
|
@@ -63,7 +63,16 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
63
63
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
66
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat()); // Need to clear these states immediately when chat ended from OC.
|
|
67
|
+
|
|
68
|
+
dispatch({
|
|
69
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
70
|
+
payload: undefined
|
|
71
|
+
});
|
|
72
|
+
dispatch({
|
|
73
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
74
|
+
payload: undefined
|
|
75
|
+
});
|
|
67
76
|
} catch (ex) {
|
|
68
77
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
69
78
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
|
|
@@ -100,14 +109,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
100
109
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
|
|
101
110
|
payload: null
|
|
102
111
|
});
|
|
103
|
-
dispatch({
|
|
104
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
105
|
-
payload: undefined
|
|
106
|
-
});
|
|
107
|
-
dispatch({
|
|
108
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
109
|
-
payload: undefined
|
|
110
|
-
});
|
|
111
112
|
|
|
112
113
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
113
114
|
eventName: _TelemetryConstants.BroadcastEvent.EndChat
|
|
@@ -43,6 +43,8 @@ var _createMarkdown = require("./createMarkdown");
|
|
|
43
43
|
|
|
44
44
|
var _maxMessageSizeValidator = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator"));
|
|
45
45
|
|
|
46
|
+
var _WebChatLogger = require("../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
|
|
47
|
+
|
|
46
48
|
var _defaultAttachmentProps = require("../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps");
|
|
47
49
|
|
|
48
50
|
var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
@@ -121,6 +123,10 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
121
123
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
122
124
|
payload: undefined
|
|
123
125
|
});
|
|
126
|
+
dispatch({
|
|
127
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
128
|
+
payload: undefined
|
|
129
|
+
});
|
|
124
130
|
};
|
|
125
131
|
|
|
126
132
|
webChatStore = (0, _botframeworkWebchat.createStore)({}, //initial state
|
|
@@ -141,6 +147,7 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
141
147
|
avatarMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableAvatarMiddleware ? undefined : (0, _avatarMiddleware.createAvatarMiddleware)((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.avatarStyleProps, (_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.avatarTextStyleProps),
|
|
142
148
|
groupActivitiesMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
|
|
143
149
|
typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
|
|
150
|
+
onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
|
|
144
151
|
...((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.webChatProps)
|
|
145
152
|
};
|
|
146
153
|
return webChatProps;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.handleUnauthenticatedReconnectChat = exports.getReconnectIdForAuthenticatedChat = void 0;
|
|
6
|
+
exports.startUnauthenticatedReconnectChat = exports.handleUnauthenticatedReconnectChat = exports.handleRedirectUnauthenticatedReconnectChat = exports.getReconnectIdForAuthenticatedChat = exports.getChatReconnectContext = void 0;
|
|
7
7
|
|
|
8
8
|
require("regenerator-runtime/runtime");
|
|
9
9
|
|
|
10
10
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
13
|
|
|
14
14
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
15
15
|
|
|
@@ -41,6 +41,8 @@ const getChatReconnectContext = async (chatSDK, reconnectId) => {
|
|
|
41
41
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
exports.getChatReconnectContext = getChatReconnectContext;
|
|
45
|
+
|
|
44
46
|
const getReconnectIdForAuthenticatedChat = async (props, chatSDK) => {
|
|
45
47
|
var _props$reconnectChatP, _props$reconnectChatP2;
|
|
46
48
|
|
|
@@ -61,33 +63,116 @@ const getReconnectIdForAuthenticatedChat = async (props, chatSDK) => {
|
|
|
61
63
|
|
|
62
64
|
exports.getReconnectIdForAuthenticatedChat = getReconnectIdForAuthenticatedChat;
|
|
63
65
|
|
|
64
|
-
const handleUnauthenticatedReconnectChat = async (dispatch, reconnectId, initStartChat) => {
|
|
65
|
-
const reconnectAvailabilityResponse = await getChatReconnectContext(reconnectId);
|
|
66
|
+
const handleUnauthenticatedReconnectChat = async (chatSDK, dispatch, setAdapter, reconnectId, initStartChat, redirectInSameWindow) => {
|
|
67
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
66
68
|
|
|
67
|
-
if (reconnectAvailabilityResponse
|
|
68
|
-
|
|
69
|
+
if (shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
70
|
+
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK, dispatch, setAdapter, initStartChat, redirectInSameWindow);
|
|
69
71
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
await setReconnectIdAndStartChat(chatSDK, dispatch, setAdapter, reconnectId, initStartChat);
|
|
73
|
+
}
|
|
74
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
exports.handleUnauthenticatedReconnectChat = handleUnauthenticatedReconnectChat;
|
|
78
|
+
|
|
79
|
+
const startUnauthenticatedReconnectChat = async (chatSDK, dispatch, setAdapter, reconnectId, initStartChat) => {
|
|
80
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
81
|
+
|
|
82
|
+
if (!shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
83
|
+
await setReconnectIdAndStartChat(chatSDK, dispatch, setAdapter, reconnectId, initStartChat);
|
|
84
|
+
}
|
|
85
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
exports.startUnauthenticatedReconnectChat = startUnauthenticatedReconnectChat;
|
|
89
|
+
|
|
90
|
+
const setReconnectIdAndStartChat = async (chatSDK, dispatch, setAdapter, reconnectId, initStartChat) => {
|
|
91
|
+
const startUnauthenticatedReconnectChat = {
|
|
92
|
+
eventName: _TelemetryConstants.BroadcastEvent.StartUnauthenticatedReconnectChat
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
_omnichannelChatComponents.BroadcastService.postMessage(startUnauthenticatedReconnectChat);
|
|
96
|
+
|
|
97
|
+
const optionalParams = {
|
|
98
|
+
reconnectId: reconnectId
|
|
99
|
+
};
|
|
100
|
+
dispatch({
|
|
101
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
102
|
+
payload: reconnectId
|
|
103
|
+
});
|
|
104
|
+
dispatch({
|
|
105
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
106
|
+
payload: _ConversationState.ConversationState.Loading
|
|
107
|
+
});
|
|
108
|
+
await initStartChat(chatSDK, dispatch, setAdapter, optionalParams);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const redirectPage = (redirectURL, redirectInSameWindow) => {
|
|
112
|
+
const redirectPageRequest = {
|
|
113
|
+
eventName: _TelemetryConstants.BroadcastEvent.RedirectPageRequest,
|
|
114
|
+
payload: {
|
|
115
|
+
redirectURL: redirectURL
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_omnichannelChatComponents.BroadcastService.postMessage(redirectPageRequest);
|
|
120
|
+
|
|
121
|
+
if (redirectInSameWindow) {
|
|
122
|
+
window.location.href = redirectURL;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const shouldRedirectOrStartNewChat = reconnectAvailabilityResponse => {
|
|
127
|
+
return reconnectAvailabilityResponse && !reconnectAvailabilityResponse.reconnectId;
|
|
128
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
const startNewChatEmptyRedirectionUrl = async (chatSDK, dispatch, setAdapter, initStartChat) => {
|
|
132
|
+
const startUnauthenticatedReconnectChat = {
|
|
133
|
+
eventName: _TelemetryConstants.BroadcastEvent.StartUnauthenticatedReconnectChat
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
_omnichannelChatComponents.BroadcastService.postMessage(startUnauthenticatedReconnectChat); // Getting PreChat Survey Context
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const parseToJson = false;
|
|
140
|
+
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
141
|
+
|
|
142
|
+
if (preChatSurveyResponse) {
|
|
143
|
+
dispatch({
|
|
144
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
145
|
+
payload: preChatSurveyResponse
|
|
146
|
+
});
|
|
73
147
|
dispatch({
|
|
74
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
75
|
-
payload:
|
|
148
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
149
|
+
payload: _ConversationState.ConversationState.Prechat
|
|
76
150
|
});
|
|
151
|
+
} else {
|
|
77
152
|
dispatch({
|
|
78
153
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
79
154
|
payload: _ConversationState.ConversationState.Loading
|
|
80
155
|
});
|
|
81
|
-
await initStartChat(
|
|
156
|
+
await initStartChat(chatSDK, dispatch, setAdapter);
|
|
82
157
|
}
|
|
83
|
-
};
|
|
158
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
159
|
|
|
85
|
-
exports.handleUnauthenticatedReconnectChat = handleUnauthenticatedReconnectChat;
|
|
86
160
|
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
161
|
+
const handleRedirectUnauthenticatedReconnectChat = async (chatSDK, dispatch, setAdapter, initStartChat, reconnectId, redirectInSameWindow) => {
|
|
162
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
163
|
+
|
|
164
|
+
if (shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
165
|
+
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK, dispatch, setAdapter, initStartChat, redirectInSameWindow);
|
|
166
|
+
}
|
|
167
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
exports.handleRedirectUnauthenticatedReconnectChat = handleRedirectUnauthenticatedReconnectChat;
|
|
171
|
+
|
|
172
|
+
const redirectOrStartNewChat = async (reconnectAvailabilityResponse, chatSDK, dispatch, setAdapter, initStartChat, redirectInSameWindow) => {
|
|
173
|
+
if (reconnectAvailabilityResponse.redirectURL) {
|
|
174
|
+
redirectPage(reconnectAvailabilityResponse.redirectURL, redirectInSameWindow);
|
|
175
|
+
} else {
|
|
176
|
+
await startNewChatEmptyRedirectionUrl(chatSDK, dispatch, setAdapter, initStartChat);
|
|
177
|
+
}
|
|
93
178
|
};
|