@microsoft/omnichannel-chat-sdk 1.2.1-main.a42cdc5 → 1.2.1-main.b9980c9
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/CHANGELOG.md +5 -0
- package/lib/OmnichannelChatSDK.d.ts +1 -0
- package/lib/OmnichannelChatSDK.js +76 -64
- package/lib/OmnichannelChatSDK.js.map +1 -1
- package/lib/core/GetAgentAvailabilityOptionalParams.d.ts +1 -0
- package/lib/core/StartChatOptionalParams.d.ts +1 -0
- package/lib/external/ACSAdapter/AMSFileManager.js +2 -1
- package/lib/external/ACSAdapter/AMSFileManager.js.map +1 -1
- package/lib/telemetry/AriaTelemetry.d.ts +1 -0
- package/lib/telemetry/AriaTelemetry.js +49 -0
- package/lib/telemetry/AriaTelemetry.js.map +1 -1
- package/lib/telemetry/ScenarioType.d.ts +1 -0
- package/lib/telemetry/ScenarioType.js +1 -0
- package/lib/telemetry/ScenarioType.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +20 -19
- package/lib/utils/loggers.d.ts +16 -0
- package/lib/utils/loggers.js +69 -1
- package/lib/utils/loggers.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -7,11 +7,16 @@ All notable changes to this project will be documented in this file.
|
|
7
7
|
- Add `CreateACSAdapter` telemetry event
|
8
8
|
- Improve `ChatSDK.createChatAdapter()` with retries using exponential backoff & additional details on failures
|
9
9
|
- Add `GetAgentAvailability` SDK method for auth chat
|
10
|
+
- Pass `logger` to AMSClient
|
11
|
+
- Add `portalContactId` in `StartChatOptionalParams` and `GetAgentAvailabilityOptionalParams`
|
10
12
|
|
11
13
|
### Fixed
|
12
14
|
- Fix `ChatAdapterOptionalParams.ACSAdapter.options.egressMiddleware` being used as `ingressMiddleware`
|
13
15
|
- Fix `ChatSDK.onTypingEvent()` being triggered on current user typing
|
14
16
|
|
17
|
+
### Changed
|
18
|
+
- Uptake [@microsoft/omnichannel-amsclient@0.1.4](https://www.npmjs.com/package/@microsoft/omnichannel-amsclient/v/0.1.4)
|
19
|
+
|
15
20
|
## [1.2.0] - 2022-11-11
|
16
21
|
### Added
|
17
22
|
- Add `sendDefaultInitContext` optional parameter to `ChatSDK.startChat()` to automatically populate `browser`, `device`, `originurl` & `os` as default init context on web
|
@@ -95,7 +95,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
95
95
|
function OmnichannelChatSDK(omnichannelConfig, chatSDKConfig) {
|
96
96
|
var _this = this;
|
97
97
|
if (chatSDKConfig === void 0) { chatSDKConfig = SDKConfigValidators_1.defaultChatSDKConfig; }
|
98
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
99
99
|
this.ACSClient = null;
|
100
100
|
this.AMSClient = null;
|
101
101
|
this.authSettings = null;
|
@@ -108,6 +108,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
108
108
|
this.acsClientLogger = null;
|
109
109
|
this.acsAdapterLogger = null;
|
110
110
|
this.callingSdkLogger = null;
|
111
|
+
this.amsClientLogger = null;
|
111
112
|
this.isPersistentChat = false;
|
112
113
|
this.isChatReconnect = false;
|
113
114
|
this.reconnectId = null;
|
@@ -132,6 +133,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
132
133
|
if (optionalParams.preChatResponse) {
|
133
134
|
requestOptionalParams.initContext.preChatResponse = optionalParams.preChatResponse;
|
134
135
|
}
|
136
|
+
if (optionalParams.portalContactId) {
|
137
|
+
requestOptionalParams.initContext.portalcontactid = optionalParams.portalContactId;
|
138
|
+
}
|
135
139
|
if (optionalParams.sendDefaultInitContext) {
|
136
140
|
if (platform_1.default.isNode() || platform_1.default.isReactNative()) {
|
137
141
|
var exceptionDetails = {
|
@@ -182,18 +186,21 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
182
186
|
this.acsClientLogger = loggers_1.createACSClientLogger(this.omnichannelConfig);
|
183
187
|
this.acsAdapterLogger = loggers_1.createACSAdapterLogger(this.omnichannelConfig);
|
184
188
|
this.callingSdkLogger = loggers_1.createCallingSDKLogger(this.omnichannelConfig);
|
189
|
+
this.amsClientLogger = loggers_1.createAMSClientLogger(this.omnichannelConfig);
|
185
190
|
this.scenarioMarker.useTelemetry(this.telemetry);
|
186
191
|
this.ic3ClientLogger.useTelemetry(this.telemetry);
|
187
192
|
this.ocSdkLogger.useTelemetry(this.telemetry);
|
188
193
|
this.acsClientLogger.useTelemetry(this.telemetry);
|
189
194
|
this.acsAdapterLogger.useTelemetry(this.telemetry);
|
190
195
|
this.callingSdkLogger.useTelemetry(this.telemetry);
|
196
|
+
this.amsClientLogger.useTelemetry(this.telemetry);
|
191
197
|
this.scenarioMarker.setRuntimeId(this.runtimeId);
|
192
198
|
this.ic3ClientLogger.setRuntimeId(this.runtimeId);
|
193
199
|
this.ocSdkLogger.setRuntimeId(this.runtimeId);
|
194
200
|
this.acsClientLogger.setRuntimeId(this.runtimeId);
|
195
201
|
this.acsAdapterLogger.setRuntimeId(this.runtimeId);
|
196
202
|
this.callingSdkLogger.setRuntimeId(this.runtimeId);
|
203
|
+
this.amsClientLogger.setRuntimeId(this.runtimeId);
|
197
204
|
OmnichannelConfigValidator_1.default(omnichannelConfig);
|
198
205
|
SDKConfigValidators_1.default(chatSDKConfig);
|
199
206
|
((_a = this.chatSDKConfig.telemetry) === null || _a === void 0 ? void 0 : _a.disable) && ((_b = this.telemetry) === null || _b === void 0 ? void 0 : _b.disable());
|
@@ -205,10 +212,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
205
212
|
(_f = this.acsClientLogger) === null || _f === void 0 ? void 0 : _f.setRequestId(this.requestId);
|
206
213
|
(_g = this.acsAdapterLogger) === null || _g === void 0 ? void 0 : _g.setRequestId(this.requestId);
|
207
214
|
(_h = this.callingSdkLogger) === null || _h === void 0 ? void 0 : _h.setRequestId(this.requestId);
|
215
|
+
(_j = this.amsClientLogger) === null || _j === void 0 ? void 0 : _j.setRequestId(this.requestId);
|
208
216
|
}
|
209
217
|
/* istanbul ignore next */
|
210
218
|
OmnichannelChatSDK.prototype.setDebug = function (flag) {
|
211
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
219
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
212
220
|
this.debug = flag;
|
213
221
|
(_a = this.AMSClient) === null || _a === void 0 ? void 0 : _a.setDebug(flag);
|
214
222
|
(_b = this.telemetry) === null || _b === void 0 ? void 0 : _b.setDebug(flag);
|
@@ -218,6 +226,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
218
226
|
(_e = this.acsClientLogger) === null || _e === void 0 ? void 0 : _e.setDebug(flag);
|
219
227
|
(_f = this.acsAdapterLogger) === null || _f === void 0 ? void 0 : _f.setDebug(flag);
|
220
228
|
(_g = this.callingSdkLogger) === null || _g === void 0 ? void 0 : _g.setDebug(flag);
|
229
|
+
(_h = this.amsClientLogger) === null || _h === void 0 ? void 0 : _h.setDebug(flag);
|
221
230
|
};
|
222
231
|
OmnichannelChatSDK.prototype.initialize = function (optionalParams) {
|
223
232
|
if (optionalParams === void 0) { optionalParams = {}; }
|
@@ -250,7 +259,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
250
259
|
framedMode: platform_1.isBrowser(),
|
251
260
|
multiClient: true,
|
252
261
|
debug: false,
|
253
|
-
logger:
|
262
|
+
logger: this.amsClientLogger
|
254
263
|
})];
|
255
264
|
case 4:
|
256
265
|
_b.AMSClient = _e.sent();
|
@@ -359,44 +368,44 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
359
368
|
});
|
360
369
|
};
|
361
370
|
OmnichannelChatSDK.prototype.startChat = function (optionalParams) {
|
362
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
371
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
363
372
|
if (optionalParams === void 0) { optionalParams = {}; }
|
364
373
|
return __awaiter(this, void 0, void 0, function () {
|
365
|
-
var shouldReinitIC3Client,
|
374
|
+
var shouldReinitIC3Client, _w, reconnectableChatsParams, reconnectableChatsResponse, _x, exceptionDetails, conversationDetails, exceptionDetails, exceptionDetails, _y, exceptionDetails, sessionInitOptionalParams, location_2, error_3, exceptionDetails, chatAdapterConfig, error_4, exceptionDetails, _z, error_5, exceptionDetails, error_6, exceptionDetails, error_7, exceptionDetails, _0, error_8, exceptionDetails;
|
366
375
|
var _this = this;
|
367
|
-
return __generator(this, function (
|
368
|
-
switch (
|
376
|
+
return __generator(this, function (_1) {
|
377
|
+
switch (_1.label) {
|
369
378
|
case 0:
|
370
379
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.StartChat, {
|
371
380
|
RequestId: this.requestId
|
372
381
|
});
|
373
382
|
shouldReinitIC3Client = !platform_1.default.isNode() && !platform_1.default.isReactNative() && !this.IC3Client && this.liveChatVersion === LiveChatVersion_1.default.V1;
|
374
383
|
if (!shouldReinitIC3Client) return [3 /*break*/, 2];
|
375
|
-
|
384
|
+
_w = this;
|
376
385
|
return [4 /*yield*/, this.getIC3Client()];
|
377
386
|
case 1:
|
378
|
-
|
379
|
-
|
387
|
+
_w.IC3Client = _1.sent();
|
388
|
+
_1.label = 2;
|
380
389
|
case 2:
|
381
390
|
if (this.isChatReconnect && !((_a = this.chatSDKConfig.chatReconnect) === null || _a === void 0 ? void 0 : _a.disable) && !this.isPersistentChat && optionalParams.reconnectId) {
|
382
391
|
this.reconnectId = optionalParams.reconnectId;
|
383
392
|
}
|
384
393
|
if (!(this.isPersistentChat && !((_b = this.chatSDKConfig.persistentChat) === null || _b === void 0 ? void 0 : _b.disable))) return [3 /*break*/, 6];
|
385
|
-
|
394
|
+
_1.label = 3;
|
386
395
|
case 3:
|
387
|
-
|
396
|
+
_1.trys.push([3, 5, , 6]);
|
388
397
|
reconnectableChatsParams = {
|
389
398
|
authenticatedUserToken: this.authenticatedUserToken
|
390
399
|
};
|
391
400
|
return [4 /*yield*/, this.OCClient.getReconnectableChats(reconnectableChatsParams)];
|
392
401
|
case 4:
|
393
|
-
reconnectableChatsResponse =
|
402
|
+
reconnectableChatsResponse = _1.sent();
|
394
403
|
if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
|
395
404
|
this.reconnectId = reconnectableChatsResponse.reconnectid;
|
396
405
|
}
|
397
406
|
return [3 /*break*/, 6];
|
398
407
|
case 5:
|
399
|
-
|
408
|
+
_x = _1.sent();
|
400
409
|
exceptionDetails = {
|
401
410
|
response: "OCClientGetReconnectableChatsFailed"
|
402
411
|
};
|
@@ -407,7 +416,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
407
416
|
this.requestId = optionalParams.liveChatContext.requestId || ocsdk_1.uuidv4();
|
408
417
|
return [4 /*yield*/, this.getConversationDetails()];
|
409
418
|
case 7:
|
410
|
-
conversationDetails =
|
419
|
+
conversationDetails = _1.sent();
|
411
420
|
if (Object.keys(conversationDetails).length === 0) {
|
412
421
|
exceptionDetails = {
|
413
422
|
response: "InvalidConversation"
|
@@ -432,30 +441,30 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
432
441
|
console.error("Unable to join conversation that's in '" + conversationDetails.state + "' state");
|
433
442
|
throw Error(exceptionDetails.response);
|
434
443
|
}
|
435
|
-
|
444
|
+
_1.label = 8;
|
436
445
|
case 8:
|
437
446
|
if (!this.authSettings) return [3 /*break*/, 14];
|
438
447
|
if (!!this.authenticatedUserToken) return [3 /*break*/, 10];
|
439
448
|
return [4 /*yield*/, this.setAuthTokenProvider(this.chatSDKConfig.getAuthToken)];
|
440
449
|
case 9:
|
441
|
-
|
442
|
-
|
450
|
+
_1.sent();
|
451
|
+
_1.label = 10;
|
443
452
|
case 10:
|
444
453
|
if (!(optionalParams.liveChatContext && Object.keys(optionalParams.liveChatContext).length > 0)) return [3 /*break*/, 14];
|
445
454
|
this.chatToken = optionalParams.liveChatContext.chatToken || {};
|
446
455
|
this.requestId = optionalParams.liveChatContext.requestId || ocsdk_1.uuidv4();
|
447
|
-
|
456
|
+
_1.label = 11;
|
448
457
|
case 11:
|
449
|
-
|
458
|
+
_1.trys.push([11, 13, , 14]);
|
450
459
|
return [4 /*yield*/, this.OCClient.validateAuthChatRecord(this.requestId, {
|
451
460
|
authenticatedUserToken: this.authenticatedUserToken,
|
452
461
|
chatId: this.chatToken.chatId
|
453
462
|
})];
|
454
463
|
case 12:
|
455
|
-
|
464
|
+
_1.sent();
|
456
465
|
return [3 /*break*/, 14];
|
457
466
|
case 13:
|
458
|
-
|
467
|
+
_y = _1.sent();
|
459
468
|
exceptionDetails = {
|
460
469
|
response: "OCClientValidateAuthChatRecordFailed",
|
461
470
|
message: "InvalidAuthChatRecord"
|
@@ -470,48 +479,49 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
470
479
|
if (!(this.chatToken && Object.keys(this.chatToken).length === 0)) return [3 /*break*/, 16];
|
471
480
|
return [4 /*yield*/, this.getChatToken(false)];
|
472
481
|
case 15:
|
473
|
-
|
474
|
-
|
482
|
+
_1.sent();
|
483
|
+
_1.label = 16;
|
475
484
|
case 16:
|
476
485
|
(_c = this.ic3ClientLogger) === null || _c === void 0 ? void 0 : _c.setChatId(this.chatToken.chatId || '');
|
477
486
|
(_d = this.ocSdkLogger) === null || _d === void 0 ? void 0 : _d.setChatId(this.chatToken.chatId || '');
|
478
487
|
(_e = this.acsClientLogger) === null || _e === void 0 ? void 0 : _e.setChatId(this.chatToken.chatId || '');
|
479
488
|
(_f = this.acsAdapterLogger) === null || _f === void 0 ? void 0 : _f.setChatId(this.chatToken.chatId || '');
|
480
489
|
(_g = this.callingSdkLogger) === null || _g === void 0 ? void 0 : _g.setChatId(this.chatToken.chatId || '');
|
490
|
+
(_h = this.amsClientLogger) === null || _h === void 0 ? void 0 : _h.setChatId(this.chatToken.chatId || '');
|
481
491
|
sessionInitOptionalParams = {
|
482
492
|
initContext: {}
|
483
493
|
};
|
484
494
|
sessionInitOptionalParams = this.populateInitChatOptionalParam(sessionInitOptionalParams, optionalParams);
|
485
495
|
sessionInitOptionalParams.initContext.isProactiveChat = !!optionalParams.isProactiveChat;
|
486
|
-
if (this.isPersistentChat && !((
|
496
|
+
if (this.isPersistentChat && !((_j = this.chatSDKConfig.persistentChat) === null || _j === void 0 ? void 0 : _j.disable)) {
|
487
497
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
488
498
|
}
|
489
|
-
else if (this.isChatReconnect && !((
|
499
|
+
else if (this.isChatReconnect && !((_k = this.chatSDKConfig.chatReconnect) === null || _k === void 0 ? void 0 : _k.disable) && !this.isPersistentChat) {
|
490
500
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
491
501
|
}
|
492
|
-
if (!(((
|
502
|
+
if (!(((_m = (_l = this.liveChatConfig) === null || _l === void 0 ? void 0 : _l.LiveWSAndLiveChatEngJoin) === null || _m === void 0 ? void 0 : _m.msdyn_requestvisitorlocation) === "true")) return [3 /*break*/, 18];
|
493
503
|
return [4 /*yield*/, location_1.getLocationInfo(this.scenarioMarker, this.chatToken.chatId, this.requestId)];
|
494
504
|
case 17:
|
495
|
-
location_2 =
|
505
|
+
location_2 = _1.sent();
|
496
506
|
sessionInitOptionalParams.initContext.latitude = location_2.latitude;
|
497
507
|
sessionInitOptionalParams.initContext.longitude = location_2.longitude;
|
498
|
-
|
508
|
+
_1.label = 18;
|
499
509
|
case 18:
|
500
510
|
if (!!optionalParams.liveChatContext) return [3 /*break*/, 22];
|
501
|
-
|
511
|
+
_1.label = 19;
|
502
512
|
case 19:
|
503
|
-
|
513
|
+
_1.trys.push([19, 21, , 22]);
|
504
514
|
return [4 /*yield*/, this.OCClient.sessionInit(this.requestId, sessionInitOptionalParams)];
|
505
515
|
case 20:
|
506
|
-
|
516
|
+
_1.sent();
|
507
517
|
return [3 /*break*/, 22];
|
508
518
|
case 21:
|
509
|
-
error_3 =
|
519
|
+
error_3 = _1.sent();
|
510
520
|
exceptionDetails = {
|
511
521
|
response: "OCClientSessionInitFailed"
|
512
522
|
};
|
513
523
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
514
|
-
if (((
|
524
|
+
if (((_o = error_3) === null || _o === void 0 ? void 0 : _o.isAxiosError) && ((_q = (_p = error_3.response) === null || _p === void 0 ? void 0 : _p.headers) === null || _q === void 0 ? void 0 : _q.errorcode.toString()) === OmnichannelErrorCodes_1.default.WidgetUseOutsideOperatingHour.toString()) {
|
515
525
|
exceptionDetails.response = OmnichannelErrorCodes_1.default[OmnichannelErrorCodes_1.default.WidgetUseOutsideOperatingHour].toString();
|
516
526
|
exceptionDetails.message = 'Widget used outside of operating hours';
|
517
527
|
console.error(exceptionDetails.message);
|
@@ -531,18 +541,18 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
531
541
|
environmentUrl: this.chatToken.acsEndpoint,
|
532
542
|
pollingInterval: 30000
|
533
543
|
};
|
534
|
-
|
544
|
+
_1.label = 23;
|
535
545
|
case 23:
|
536
|
-
|
537
|
-
return [4 /*yield*/, ((
|
546
|
+
_1.trys.push([23, 25, , 26]);
|
547
|
+
return [4 /*yield*/, ((_r = this.ACSClient) === null || _r === void 0 ? void 0 : _r.initialize({
|
538
548
|
token: chatAdapterConfig.token,
|
539
549
|
environmentUrl: chatAdapterConfig.environmentUrl
|
540
550
|
}))];
|
541
551
|
case 24:
|
542
|
-
|
552
|
+
_1.sent();
|
543
553
|
return [3 /*break*/, 26];
|
544
554
|
case 25:
|
545
|
-
error_4 =
|
555
|
+
error_4 = _1.sent();
|
546
556
|
exceptionDetails = {
|
547
557
|
response: "ACSClientInitializeFailed"
|
548
558
|
};
|
@@ -554,22 +564,22 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
554
564
|
console.error("OmnichannelChatSDK/startChat/initialize/error " + error_4);
|
555
565
|
return [2 /*return*/, error_4];
|
556
566
|
case 26:
|
557
|
-
|
558
|
-
|
559
|
-
return [4 /*yield*/, ((
|
567
|
+
_1.trys.push([26, 28, , 29]);
|
568
|
+
_z = this;
|
569
|
+
return [4 /*yield*/, ((_s = this.ACSClient) === null || _s === void 0 ? void 0 : _s.joinConversation({
|
560
570
|
id: chatAdapterConfig.id,
|
561
571
|
threadId: chatAdapterConfig.threadId,
|
562
572
|
pollingInterval: chatAdapterConfig.pollingInterval
|
563
573
|
}))];
|
564
574
|
case 27:
|
565
|
-
|
575
|
+
_z.conversation = (_1.sent());
|
566
576
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.StartChat, {
|
567
577
|
RequestId: this.requestId,
|
568
578
|
ChatId: this.chatToken.chatId
|
569
579
|
});
|
570
580
|
return [3 /*break*/, 29];
|
571
581
|
case 28:
|
572
|
-
error_5 =
|
582
|
+
error_5 = _1.sent();
|
573
583
|
exceptionDetails = {
|
574
584
|
response: "ACSClientJoinConversationFailed"
|
575
585
|
};
|
@@ -581,15 +591,15 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
581
591
|
console.error("OmnichannelChatSDK/startChat/joinConversation/error " + error_5);
|
582
592
|
throw Error(exceptionDetails.response);
|
583
593
|
case 29:
|
584
|
-
|
585
|
-
return [4 /*yield*/, ((
|
594
|
+
_1.trys.push([29, 31, , 32]);
|
595
|
+
return [4 /*yield*/, ((_t = this.AMSClient) === null || _t === void 0 ? void 0 : _t.initialize({
|
586
596
|
chatToken: this.chatToken
|
587
597
|
}))];
|
588
598
|
case 30:
|
589
|
-
|
599
|
+
_1.sent();
|
590
600
|
return [3 /*break*/, 32];
|
591
601
|
case 31:
|
592
|
-
error_6 =
|
602
|
+
error_6 = _1.sent();
|
593
603
|
exceptionDetails = {
|
594
604
|
response: "AMSClientInitializeFailed"
|
595
605
|
};
|
@@ -601,17 +611,17 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
601
611
|
throw Error(exceptionDetails.response);
|
602
612
|
case 32: return [3 /*break*/, 39];
|
603
613
|
case 33:
|
604
|
-
|
614
|
+
_1.trys.push([33, 35, , 36]);
|
605
615
|
return [4 /*yield*/, this.IC3Client.initialize({
|
606
616
|
token: this.chatToken.token,
|
607
617
|
regionGtms: this.chatToken.regionGTMS,
|
608
618
|
visitor: true
|
609
619
|
})];
|
610
620
|
case 34:
|
611
|
-
|
621
|
+
_1.sent();
|
612
622
|
return [3 /*break*/, 36];
|
613
623
|
case 35:
|
614
|
-
error_7 =
|
624
|
+
error_7 = _1.sent();
|
615
625
|
exceptionDetails = {
|
616
626
|
response: "IC3ClientInitializeFailed"
|
617
627
|
};
|
@@ -623,18 +633,18 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
623
633
|
console.error("OmnichannelChatSDK/startChat/initialize/error " + error_7);
|
624
634
|
return [2 /*return*/, error_7];
|
625
635
|
case 36:
|
626
|
-
|
627
|
-
|
636
|
+
_1.trys.push([36, 38, , 39]);
|
637
|
+
_0 = this;
|
628
638
|
return [4 /*yield*/, this.IC3Client.joinConversation(this.chatToken.chatId)];
|
629
639
|
case 37:
|
630
|
-
|
640
|
+
_0.conversation = _1.sent();
|
631
641
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.StartChat, {
|
632
642
|
RequestId: this.requestId,
|
633
643
|
ChatId: this.chatToken.chatId
|
634
644
|
});
|
635
645
|
return [3 /*break*/, 39];
|
636
646
|
case 38:
|
637
|
-
error_8 =
|
647
|
+
error_8 = _1.sent();
|
638
648
|
exceptionDetails = {
|
639
649
|
response: "IC3ClientJoinConversationFailed"
|
640
650
|
};
|
@@ -646,7 +656,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
646
656
|
console.error("OmnichannelChatSDK/startChat/joinConversation/error " + error_8);
|
647
657
|
return [2 /*return*/, error_8];
|
648
658
|
case 39:
|
649
|
-
if (this.isPersistentChat && !((
|
659
|
+
if (this.isPersistentChat && !((_u = this.chatSDKConfig.persistentChat) === null || _u === void 0 ? void 0 : _u.disable)) {
|
650
660
|
this.refreshTokenTimer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
651
661
|
return __generator(this, function (_a) {
|
652
662
|
switch (_a.label) {
|
@@ -657,7 +667,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
657
667
|
return [2 /*return*/];
|
658
668
|
}
|
659
669
|
});
|
660
|
-
}); }, (
|
670
|
+
}); }, (_v = this.chatSDKConfig.persistentChat) === null || _v === void 0 ? void 0 : _v.tokenUpdateTime);
|
661
671
|
}
|
662
672
|
return [2 /*return*/];
|
663
673
|
}
|
@@ -665,11 +675,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
665
675
|
});
|
666
676
|
};
|
667
677
|
OmnichannelChatSDK.prototype.endChat = function () {
|
668
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
678
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
669
679
|
return __awaiter(this, void 0, void 0, function () {
|
670
680
|
var sessionCloseOptionalParams, isReconnectChat, isChatReconnect, error_9, exceptionDetails;
|
671
|
-
return __generator(this, function (
|
672
|
-
switch (
|
681
|
+
return __generator(this, function (_r) {
|
682
|
+
switch (_r.label) {
|
673
683
|
case 0:
|
674
684
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.EndChat, {
|
675
685
|
RequestId: this.requestId,
|
@@ -689,12 +699,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
689
699
|
if (this.authenticatedUserToken) {
|
690
700
|
sessionCloseOptionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
691
701
|
}
|
692
|
-
|
702
|
+
_r.label = 1;
|
693
703
|
case 1:
|
694
|
-
|
704
|
+
_r.trys.push([1, 3, , 4]);
|
695
705
|
return [4 /*yield*/, this.OCClient.sessionClose(this.requestId, sessionCloseOptionalParams)];
|
696
706
|
case 2:
|
697
|
-
|
707
|
+
_r.sent();
|
698
708
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.EndChat, {
|
699
709
|
RequestId: this.requestId,
|
700
710
|
ChatId: this.chatToken.chatId
|
@@ -719,9 +729,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
719
729
|
(_l = this.acsAdapterLogger) === null || _l === void 0 ? void 0 : _l.setChatId('');
|
720
730
|
(_m = this.callingSdkLogger) === null || _m === void 0 ? void 0 : _m.setRequestId(this.requestId);
|
721
731
|
(_o = this.callingSdkLogger) === null || _o === void 0 ? void 0 : _o.setChatId('');
|
732
|
+
(_p = this.amsClientLogger) === null || _p === void 0 ? void 0 : _p.setRequestId(this.requestId);
|
733
|
+
(_q = this.amsClientLogger) === null || _q === void 0 ? void 0 : _q.setChatId('');
|
722
734
|
return [3 /*break*/, 4];
|
723
735
|
case 3:
|
724
|
-
error_9 =
|
736
|
+
error_9 = _r.sent();
|
725
737
|
exceptionDetails = {
|
726
738
|
response: "OCClientSessionCloseFailed"
|
727
739
|
};
|