@ada-support/embed2 1.11.2 → 1.11.4
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.
|
@@ -46,6 +46,7 @@ export declare class ChatFrame extends Component<ChatFrameProps, ChatFrameState>
|
|
|
46
46
|
documentBodyOverflow: string;
|
|
47
47
|
channel?: FrameChannel;
|
|
48
48
|
chatRenderTimeout?: number;
|
|
49
|
+
chatRenderTimeoutLater?: number;
|
|
49
50
|
url: string;
|
|
50
51
|
state: ChatFrameState;
|
|
51
52
|
componentDidMount(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AdaEventDataKeyedByEvent, AdaEventKey, AdaEventSubscriptionCallback } from "@ada-support/embed-types";
|
|
2
|
+
export declare function hasEventSubscription(eventKey: AdaEventKey): boolean;
|
|
2
3
|
export declare function unsubscribeEvent(id: number): void;
|
|
3
4
|
export declare function subscribeEvent<K extends AdaEventKey>(eventKey: K, callback: AdaEventSubscriptionCallback<K>): number;
|
|
4
5
|
export declare function publishEvent<K extends AdaEventKey>(eventKey: K, data: AdaEventDataKeyedByEvent[K]): void;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -15919,7 +15919,7 @@ const client = new BrowserClient({
|
|
|
15919
15919
|
return event;
|
|
15920
15920
|
},
|
|
15921
15921
|
environment: "production",
|
|
15922
|
-
release: "1.11.
|
|
15922
|
+
release: "1.11.4-d5f191c",
|
|
15923
15923
|
sampleRate: 0.25,
|
|
15924
15924
|
autoSessionTracking: false,
|
|
15925
15925
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16368,22 +16368,48 @@ let ActionTypes = /*#__PURE__*/function (ActionTypes) {
|
|
|
16368
16368
|
ActionTypes["FOCUS_OFF_ADA_TYPE"] = "FOCUS_OFF_ADA";
|
|
16369
16369
|
return ActionTypes;
|
|
16370
16370
|
}({});
|
|
16371
|
-
;// CONCATENATED MODULE: ./src/
|
|
16372
|
-
|
|
16373
|
-
|
|
16374
|
-
|
|
16375
|
-
|
|
16376
|
-
|
|
16377
|
-
|
|
16378
|
-
|
|
16379
|
-
|
|
16380
|
-
return
|
|
16381
|
-
}
|
|
16382
|
-
|
|
16371
|
+
;// CONCATENATED MODULE: ./src/client/helpers/event-subscriptions/index.ts
|
|
16372
|
+
let subscriptions = [];
|
|
16373
|
+
function hasEventSubscription(eventKey) {
|
|
16374
|
+
return subscriptions.some(subscription => subscription.eventKey === eventKey);
|
|
16375
|
+
}
|
|
16376
|
+
const getNextUniqueId = (() => {
|
|
16377
|
+
let lastId = 0;
|
|
16378
|
+
return () => {
|
|
16379
|
+
lastId += 1;
|
|
16380
|
+
return lastId;
|
|
16381
|
+
};
|
|
16382
|
+
})();
|
|
16383
|
+
function unsubscribeEvent(id) {
|
|
16384
|
+
subscriptions = subscriptions.filter(s => s.id !== id);
|
|
16385
|
+
}
|
|
16386
|
+
function subscribeEvent(eventKey, callback) {
|
|
16387
|
+
const id = getNextUniqueId();
|
|
16388
|
+
subscriptions.push({
|
|
16389
|
+
eventKey,
|
|
16390
|
+
callback,
|
|
16391
|
+
id
|
|
16392
|
+
});
|
|
16393
|
+
return id;
|
|
16394
|
+
}
|
|
16395
|
+
function publishEvent(eventKey, data) {
|
|
16396
|
+
subscriptions.forEach(subscription => {
|
|
16397
|
+
// Using startsWith instead of === allows subscribing to a specific event OR a namespace,
|
|
16398
|
+
// e.g. ada:campaigns subscribes to ada:campaigns:opened, ada:campaigns:engaged, and
|
|
16399
|
+
// ada:campaigns:shown. Broadcasting this way simultaneously reaches subscriptions
|
|
16400
|
+
// that have subscribed to a specific event, and those that have subscribed to a namespace
|
|
16401
|
+
if (eventKey.startsWith(subscription.eventKey)) {
|
|
16402
|
+
// try/catch to guard against missing or bad callbacks
|
|
16403
|
+
try {
|
|
16404
|
+
subscription.callback(data, {
|
|
16405
|
+
eventKey
|
|
16406
|
+
});
|
|
16407
|
+
} catch {
|
|
16408
|
+
// silently fail and proceed with remaining callbacks
|
|
16409
|
+
}
|
|
16410
|
+
}
|
|
16411
|
+
});
|
|
16383
16412
|
}
|
|
16384
|
-
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
16385
|
-
var lodash_memoize = __webpack_require__(7654);
|
|
16386
|
-
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
16387
16413
|
;// CONCATENATED MODULE: ./src/common/helpers/http.ts
|
|
16388
16414
|
/**
|
|
16389
16415
|
* Vanilla HTTP request. Returns a Promise.
|
|
@@ -16428,102 +16454,6 @@ function httpRequest(obj) {
|
|
|
16428
16454
|
xhr.send(obj.body);
|
|
16429
16455
|
});
|
|
16430
16456
|
}
|
|
16431
|
-
;// CONCATENATED MODULE: ./src/services/logger/index.ts
|
|
16432
|
-
|
|
16433
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16434
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
const DEFAULT_LOG_SAMPLE_RATE = 0.01;
|
|
16438
|
-
const DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
16439
|
-
const DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1";
|
|
16440
|
-
|
|
16441
|
-
// We need memoization to ensure consistency of logs
|
|
16442
|
-
const shouldLog = lodash_memoize_default()(sampleRate => {
|
|
16443
|
-
if (!DD_TOKEN || sampleRate === 0) {
|
|
16444
|
-
return false;
|
|
16445
|
-
}
|
|
16446
|
-
return Math.random() < (sampleRate || DEFAULT_LOG_SAMPLE_RATE);
|
|
16447
|
-
});
|
|
16448
|
-
|
|
16449
|
-
/**
|
|
16450
|
-
* Sends log to Datadog
|
|
16451
|
-
*/
|
|
16452
|
-
async function log(message, extra, options) {
|
|
16453
|
-
if (!shouldLog(options === null || options === void 0 ? void 0 : options.sampleRate)) {
|
|
16454
|
-
return;
|
|
16455
|
-
}
|
|
16456
|
-
await httpRequest({
|
|
16457
|
-
url: `${DD_BASE_URL}${DD_TOKEN}?ddsource=browser&ddtags=version:1.5.0,env:${"production"}`,
|
|
16458
|
-
method: "POST",
|
|
16459
|
-
body: JSON.stringify(_objectSpread(_objectSpread({
|
|
16460
|
-
message
|
|
16461
|
-
}, extra), {}, {
|
|
16462
|
-
level: (options === null || options === void 0 ? void 0 : options.level) || "info",
|
|
16463
|
-
sampleRate: (options === null || options === void 0 ? void 0 : options.sampleRate) || DEFAULT_LOG_SAMPLE_RATE,
|
|
16464
|
-
service: "embed",
|
|
16465
|
-
env: "production",
|
|
16466
|
-
embedVersion: 2,
|
|
16467
|
-
version: "1.11.2",
|
|
16468
|
-
isNpm: true,
|
|
16469
|
-
commitHash: "6ffecd9"
|
|
16470
|
-
}))
|
|
16471
|
-
});
|
|
16472
|
-
}
|
|
16473
|
-
;// CONCATENATED MODULE: ./src/client/helpers/event-subscriptions/index.ts
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
let subscriptions = [];
|
|
16477
|
-
const getNextUniqueId = (() => {
|
|
16478
|
-
let lastId = 0;
|
|
16479
|
-
return () => {
|
|
16480
|
-
lastId += 1;
|
|
16481
|
-
return lastId;
|
|
16482
|
-
};
|
|
16483
|
-
})();
|
|
16484
|
-
function unsubscribeEvent(id) {
|
|
16485
|
-
subscriptions = subscriptions.filter(s => s.id !== id);
|
|
16486
|
-
}
|
|
16487
|
-
function subscribeEvent(eventKey, callback) {
|
|
16488
|
-
const id = getNextUniqueId();
|
|
16489
|
-
|
|
16490
|
-
// Log chat_frame_timeout event subscriptions
|
|
16491
|
-
if (eventKey === "ada:chat_frame_timeout") {
|
|
16492
|
-
var _document$getElementB;
|
|
16493
|
-
const domHandle = (_document$getElementB = document.getElementById("__ada")) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.getAttribute("data-handle");
|
|
16494
|
-
log("Client subscribed to chat_frame_timeout event", {
|
|
16495
|
-
handle: domHandle || (isStartOptions(window.adaSettings) ? window.adaSettings.handle : undefined),
|
|
16496
|
-
hostPage: window.location.href
|
|
16497
|
-
}, {
|
|
16498
|
-
sampleRate: 0.1,
|
|
16499
|
-
level: "info"
|
|
16500
|
-
});
|
|
16501
|
-
}
|
|
16502
|
-
subscriptions.push({
|
|
16503
|
-
eventKey,
|
|
16504
|
-
callback,
|
|
16505
|
-
id
|
|
16506
|
-
});
|
|
16507
|
-
return id;
|
|
16508
|
-
}
|
|
16509
|
-
function publishEvent(eventKey, data) {
|
|
16510
|
-
subscriptions.forEach(subscription => {
|
|
16511
|
-
// Using startsWith instead of === allows subscribing to a specific event OR a namespace,
|
|
16512
|
-
// e.g. ada:campaigns subscribes to ada:campaigns:opened, ada:campaigns:engaged, and
|
|
16513
|
-
// ada:campaigns:shown. Broadcasting this way simultaneously reaches subscriptions
|
|
16514
|
-
// that have subscribed to a specific event, and those that have subscribed to a namespace
|
|
16515
|
-
if (eventKey.startsWith(subscription.eventKey)) {
|
|
16516
|
-
// try/catch to guard against missing or bad callbacks
|
|
16517
|
-
try {
|
|
16518
|
-
subscription.callback(data, {
|
|
16519
|
-
eventKey
|
|
16520
|
-
});
|
|
16521
|
-
} catch {
|
|
16522
|
-
// silently fail and proceed with remaining callbacks
|
|
16523
|
-
}
|
|
16524
|
-
}
|
|
16525
|
-
});
|
|
16526
|
-
}
|
|
16527
16457
|
;// CONCATENATED MODULE: ./src/common/helpers/config-info.ts
|
|
16528
16458
|
const isProduction = "production" === "production";
|
|
16529
16459
|
;// CONCATENATED MODULE: ./src/common/helpers/url/constants.ts
|
|
@@ -16541,8 +16471,8 @@ const ports = {
|
|
|
16541
16471
|
};
|
|
16542
16472
|
;// CONCATENATED MODULE: ./src/common/helpers/url/index.ts
|
|
16543
16473
|
|
|
16544
|
-
function
|
|
16545
|
-
function
|
|
16474
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16475
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16546
16476
|
|
|
16547
16477
|
|
|
16548
16478
|
const DEFAULT_ADA_DOMAIN = "ada";
|
|
@@ -16569,7 +16499,7 @@ function getEmbedURL(_ref) {
|
|
|
16569
16499
|
} else {
|
|
16570
16500
|
host = `http://${handle}.localhost:9001`;
|
|
16571
16501
|
}
|
|
16572
|
-
return `${host}/embed/${frameName}/${"
|
|
16502
|
+
return `${host}/embed/${frameName}/${"d5f191c"}/index.html`;
|
|
16573
16503
|
}
|
|
16574
16504
|
function constructQueryString(query) {
|
|
16575
16505
|
return Object.keys(query).map(key => {
|
|
@@ -16617,7 +16547,7 @@ function getChatURL(_ref3) {
|
|
|
16617
16547
|
domain,
|
|
16618
16548
|
qp
|
|
16619
16549
|
} = _ref3;
|
|
16620
|
-
const queryParams =
|
|
16550
|
+
const queryParams = _objectSpread(_objectSpread({}, qp), {}, {
|
|
16621
16551
|
version
|
|
16622
16552
|
});
|
|
16623
16553
|
const queryString = constructQueryString(queryParams);
|
|
@@ -17110,7 +17040,7 @@ const getInitialState = adaSettings => ({
|
|
|
17110
17040
|
wasCampaignShownButNowClosed: false,
|
|
17111
17041
|
proactiveCampaignHadMessages: false,
|
|
17112
17042
|
deviceToken: null,
|
|
17113
|
-
showFallbackOnTimeout:
|
|
17043
|
+
showFallbackOnTimeout: true
|
|
17114
17044
|
});
|
|
17115
17045
|
;// CONCATENATED MODULE: ./src/common/helpers/get-intro-for-url.ts
|
|
17116
17046
|
function getProcessedPath(path) {
|
|
@@ -17376,6 +17306,19 @@ const get_browser_language_getBrowserLanguage = () => {
|
|
|
17376
17306
|
return browserLanguageString;
|
|
17377
17307
|
};
|
|
17378
17308
|
/* harmony default export */ var get_browser_language = (get_browser_language_getBrowserLanguage);
|
|
17309
|
+
;// CONCATENATED MODULE: ./src/services/helpers.ts
|
|
17310
|
+
const NO_OP_FUNCTION = () => {
|
|
17311
|
+
// Do nothing
|
|
17312
|
+
};
|
|
17313
|
+
function isStartOptions(input) {
|
|
17314
|
+
if (!(typeof input === "object")) {
|
|
17315
|
+
return false;
|
|
17316
|
+
}
|
|
17317
|
+
if (input === null) {
|
|
17318
|
+
return false;
|
|
17319
|
+
}
|
|
17320
|
+
return typeof input.handle === "string";
|
|
17321
|
+
}
|
|
17379
17322
|
;// CONCATENATED MODULE: ./src/campaigns/campaign.ts
|
|
17380
17323
|
|
|
17381
17324
|
function campaign_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -17698,6 +17641,51 @@ function getButtonText(client) {
|
|
|
17698
17641
|
}
|
|
17699
17642
|
return buttonTextMap[languageKey];
|
|
17700
17643
|
}
|
|
17644
|
+
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
17645
|
+
var lodash_memoize = __webpack_require__(7654);
|
|
17646
|
+
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
17647
|
+
;// CONCATENATED MODULE: ./src/services/logger/index.ts
|
|
17648
|
+
|
|
17649
|
+
function logger_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17650
|
+
function logger_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? logger_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : logger_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17651
|
+
|
|
17652
|
+
|
|
17653
|
+
const DEFAULT_LOG_SAMPLE_RATE = 0.01;
|
|
17654
|
+
const DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
17655
|
+
const DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1";
|
|
17656
|
+
|
|
17657
|
+
// We need memoization to ensure consistency of logs
|
|
17658
|
+
const shouldLog = lodash_memoize_default()(sampleRate => {
|
|
17659
|
+
if (!DD_TOKEN || sampleRate === 0) {
|
|
17660
|
+
return false;
|
|
17661
|
+
}
|
|
17662
|
+
return Math.random() < (sampleRate || DEFAULT_LOG_SAMPLE_RATE);
|
|
17663
|
+
});
|
|
17664
|
+
|
|
17665
|
+
/**
|
|
17666
|
+
* Sends log to Datadog
|
|
17667
|
+
*/
|
|
17668
|
+
async function log(message, extra, options) {
|
|
17669
|
+
if (!shouldLog(options === null || options === void 0 ? void 0 : options.sampleRate)) {
|
|
17670
|
+
return;
|
|
17671
|
+
}
|
|
17672
|
+
await httpRequest({
|
|
17673
|
+
url: `${DD_BASE_URL}${DD_TOKEN}?ddsource=browser&ddtags=version:1.5.0,env:${"production"}`,
|
|
17674
|
+
method: "POST",
|
|
17675
|
+
body: JSON.stringify(logger_objectSpread(logger_objectSpread({
|
|
17676
|
+
message
|
|
17677
|
+
}, extra), {}, {
|
|
17678
|
+
level: (options === null || options === void 0 ? void 0 : options.level) || "info",
|
|
17679
|
+
sampleRate: (options === null || options === void 0 ? void 0 : options.sampleRate) || DEFAULT_LOG_SAMPLE_RATE,
|
|
17680
|
+
service: "embed",
|
|
17681
|
+
env: "production",
|
|
17682
|
+
embedVersion: 2,
|
|
17683
|
+
version: "1.11.4",
|
|
17684
|
+
isNpm: true,
|
|
17685
|
+
commitHash: "d5f191c"
|
|
17686
|
+
}))
|
|
17687
|
+
});
|
|
17688
|
+
}
|
|
17701
17689
|
;// CONCATENATED MODULE: ./src/client/helpers/alternative-bot-rollout/index.ts
|
|
17702
17690
|
|
|
17703
17691
|
function alternative_bot_rollout_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -18354,8 +18342,8 @@ const loadChatManifest = async () => {
|
|
|
18354
18342
|
hostPage: window.location.href,
|
|
18355
18343
|
manifestUrl: CHAT_MANIFEST_PATH
|
|
18356
18344
|
}, {
|
|
18357
|
-
level: "
|
|
18358
|
-
sampleRate:
|
|
18345
|
+
level: "warn",
|
|
18346
|
+
sampleRate: 0.01
|
|
18359
18347
|
});
|
|
18360
18348
|
return undefined;
|
|
18361
18349
|
}
|
|
@@ -18367,8 +18355,8 @@ const loadChatManifest = async () => {
|
|
|
18367
18355
|
hostPage: window.location.href,
|
|
18368
18356
|
manifestUrl: CHAT_MANIFEST_PATH
|
|
18369
18357
|
}, {
|
|
18370
|
-
level: "
|
|
18371
|
-
sampleRate:
|
|
18358
|
+
level: "warn",
|
|
18359
|
+
sampleRate: 0.01
|
|
18372
18360
|
});
|
|
18373
18361
|
return undefined;
|
|
18374
18362
|
}
|
|
@@ -18750,7 +18738,8 @@ function ButtonFrame_mapStateToProps(storeState) {
|
|
|
18750
18738
|
/* harmony default export */ var components_ButtonFrame = (connect(ButtonFrame_mapStateToProps)(ButtonFrame));
|
|
18751
18739
|
;// CONCATENATED MODULE: ./src/common/constants/timeouts.ts
|
|
18752
18740
|
const ANIMATION_DELAY = 50;
|
|
18753
|
-
const
|
|
18741
|
+
const CHAT_FRAME_TIMEOUT_EVENT_MS = 5000;
|
|
18742
|
+
const CHAT_FALLBACK_DELAY_MS = 10000;
|
|
18754
18743
|
;// CONCATENATED MODULE: ./src/common/helpers/is-mobile.ts
|
|
18755
18744
|
const isMobile = /(iPhone)|(iPod)|(android)|(webOS)/i.exec(navigator.userAgent) !== null;
|
|
18756
18745
|
;// CONCATENATED MODULE: ./src/client/components/ChatFrame/chatFrameEvents/chatterEvent/index.ts
|
|
@@ -18928,6 +18917,7 @@ class ChatFrame extends d {
|
|
|
18928
18917
|
_defineProperty(this, "documentBodyOverflow", "");
|
|
18929
18918
|
_defineProperty(this, "channel", void 0);
|
|
18930
18919
|
_defineProperty(this, "chatRenderTimeout", void 0);
|
|
18920
|
+
_defineProperty(this, "chatRenderTimeoutLater", void 0);
|
|
18931
18921
|
_defineProperty(this, "url", this.getIframeSrc());
|
|
18932
18922
|
_defineProperty(this, "state", {
|
|
18933
18923
|
isMounted: false,
|
|
@@ -18960,7 +18950,7 @@ class ChatFrame extends d {
|
|
|
18960
18950
|
log("Chat frame mount", {
|
|
18961
18951
|
handle,
|
|
18962
18952
|
chatUrl: this.url,
|
|
18963
|
-
embedVersion: "
|
|
18953
|
+
embedVersion: "d5f191c".slice(0, 7),
|
|
18964
18954
|
embedSettings: adaSettings
|
|
18965
18955
|
});
|
|
18966
18956
|
|
|
@@ -19010,6 +19000,10 @@ class ChatFrame extends d {
|
|
|
19010
19000
|
clearTimeout(this.chatRenderTimeout);
|
|
19011
19001
|
this.chatRenderTimeout = undefined;
|
|
19012
19002
|
}
|
|
19003
|
+
if (this.chatRenderTimeoutLater) {
|
|
19004
|
+
clearTimeout(this.chatRenderTimeoutLater);
|
|
19005
|
+
this.chatRenderTimeoutLater = undefined;
|
|
19006
|
+
}
|
|
19013
19007
|
}
|
|
19014
19008
|
get darkMode() {
|
|
19015
19009
|
var _client$ui_settings, _client$ui_settings$c;
|
|
@@ -19044,7 +19038,7 @@ class ChatFrame extends d {
|
|
|
19044
19038
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
19045
19039
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
19046
19040
|
const queryParams = {
|
|
19047
|
-
embedVersion: "
|
|
19041
|
+
embedVersion: "d5f191c".slice(0, 7),
|
|
19048
19042
|
greeting,
|
|
19049
19043
|
language,
|
|
19050
19044
|
skipGreeting,
|
|
@@ -19641,29 +19635,20 @@ class ChatFrame extends d {
|
|
|
19641
19635
|
if (currentSrc !== null && currentSrc !== void 0 && currentSrc.startsWith("data:text/html")) {
|
|
19642
19636
|
return;
|
|
19643
19637
|
}
|
|
19644
|
-
|
|
19645
|
-
// Clear any existing timeout before starting new one (prevents orphaned timeouts)
|
|
19646
19638
|
this.clearFallbackTimeout();
|
|
19647
19639
|
this.chatRenderTimeout = window.setTimeout(() => {
|
|
19648
19640
|
var _this$channel;
|
|
19649
|
-
log(`Chat frame took over ${CHAT_FALLBACK_DELAY_MS / 1000} seconds to respond`, {
|
|
19650
|
-
handle,
|
|
19651
|
-
chatUrl: this.url,
|
|
19652
|
-
embedVersion: "6ffecd9".slice(0, 7),
|
|
19653
|
-
embedSettings: adaSettings
|
|
19654
|
-
}, {
|
|
19655
|
-
level: "error",
|
|
19656
|
-
sampleRate: 1.0
|
|
19657
|
-
});
|
|
19658
19641
|
const {
|
|
19659
19642
|
isDrawerOpen: drawerIsOpen
|
|
19660
19643
|
} = this.props;
|
|
19661
19644
|
|
|
19662
|
-
// Only
|
|
19645
|
+
// Only fire event if drawer is STILL open and chat hasn't connected
|
|
19663
19646
|
if (!((_this$channel = this.channel) !== null && _this$channel !== void 0 && _this$channel.isConnected) && drawerIsOpen) {
|
|
19664
19647
|
log("Chat frame took over 5 seconds to respond", {
|
|
19665
|
-
handle
|
|
19666
|
-
|
|
19648
|
+
handle
|
|
19649
|
+
}, {
|
|
19650
|
+
level: "warn",
|
|
19651
|
+
sampleRate: 0.01
|
|
19667
19652
|
});
|
|
19668
19653
|
|
|
19669
19654
|
// SUP-1141- TODO: Remove chatFrameTimeoutCallback
|
|
@@ -19671,7 +19656,23 @@ class ChatFrame extends d {
|
|
|
19671
19656
|
chatFrameTimeoutCallback();
|
|
19672
19657
|
}
|
|
19673
19658
|
publishEvent("ada:chat_frame_timeout", undefined);
|
|
19674
|
-
|
|
19659
|
+
}
|
|
19660
|
+
}, CHAT_FRAME_TIMEOUT_EVENT_MS);
|
|
19661
|
+
this.chatRenderTimeoutLater = window.setTimeout(() => {
|
|
19662
|
+
var _this$channel2;
|
|
19663
|
+
const {
|
|
19664
|
+
isDrawerOpen: drawerIsOpen
|
|
19665
|
+
} = this.props;
|
|
19666
|
+
if (!((_this$channel2 = this.channel) !== null && _this$channel2 !== void 0 && _this$channel2.isConnected) && drawerIsOpen) {
|
|
19667
|
+
log("Chat frame took over 10 seconds to respond", {
|
|
19668
|
+
handle
|
|
19669
|
+
}, {
|
|
19670
|
+
level: "warn",
|
|
19671
|
+
sampleRate: 0.01
|
|
19672
|
+
});
|
|
19673
|
+
const hasTimeoutEventSubscription = hasEventSubscription("ada:chat_frame_timeout");
|
|
19674
|
+
const shouldShowFallback = showFallbackOnTimeout !== false && !hasTimeoutEventSubscription;
|
|
19675
|
+
if (shouldShowFallback) {
|
|
19675
19676
|
this.setState({
|
|
19676
19677
|
showFallback: true
|
|
19677
19678
|
});
|