@ada-support/embed2 1.0.44 → 1.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/npm-entry/client/index.d.ts +1 -1
- package/dist/npm-entry/common/helpers/fetch-client.d.ts +3 -3
- package/dist/npm-entry/common/helpers/get-intro-for-url.d.ts +2 -2
- package/dist/npm-entry/common/helpers/startup.d.ts +1 -1
- package/dist/npm-entry/common/helpers/url/index.d.ts +1 -1
- package/dist/npm-entry/common/lib/channel.d.ts +5 -5
- package/dist/npm-entry/common/lib/fc/index.d.ts +0 -1
- package/dist/npm-entry/common/models/client/index.d.ts +6 -6
- package/dist/npm-entry/common/types/http.d.ts +6 -3
- package/dist/npm-entry/common/types/languages.d.ts +2 -3
- package/dist/npm-entry/common/types/store-state.d.ts +2 -2
- package/dist/npm-entry/frames/helpers/storage/index.d.ts +2 -2
- package/dist/npm-entry/index.js +361 -151
- package/package.json +4 -3
- package/dist/npm-entry/frames/components/x-storage/index.d.ts +0 -12
- package/dist/npm-entry/frames/helpers/frame-init.d.ts +0 -3
- package/dist/npm-entry/frames/lib/error-tracker.d.ts +0 -6
- package/dist/npm-entry/frames/lib/frame-fc.d.ts +0 -3
- package/dist/npm-entry/frames/lib/store-proxy.d.ts +0 -2
package/dist/npm-entry/index.js
CHANGED
|
@@ -190,6 +190,13 @@ module.exports = __webpack_require__(3685);
|
|
|
190
190
|
|
|
191
191
|
/***/ }),
|
|
192
192
|
|
|
193
|
+
/***/ 3263:
|
|
194
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
195
|
+
|
|
196
|
+
module.exports = __webpack_require__(4710);
|
|
197
|
+
|
|
198
|
+
/***/ }),
|
|
199
|
+
|
|
193
200
|
/***/ 4889:
|
|
194
201
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
195
202
|
|
|
@@ -197,6 +204,13 @@ module.exports = __webpack_require__(4303);
|
|
|
197
204
|
|
|
198
205
|
/***/ }),
|
|
199
206
|
|
|
207
|
+
/***/ 9356:
|
|
208
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
209
|
+
|
|
210
|
+
module.exports = __webpack_require__(3799);
|
|
211
|
+
|
|
212
|
+
/***/ }),
|
|
213
|
+
|
|
200
214
|
/***/ 9542:
|
|
201
215
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
202
216
|
|
|
@@ -722,7 +736,7 @@ var browserPerformanceTimeOrigin = (function () {
|
|
|
722
736
|
|
|
723
737
|
/***/ }),
|
|
724
738
|
|
|
725
|
-
/***/
|
|
739
|
+
/***/ 9136:
|
|
726
740
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
727
741
|
|
|
728
742
|
"use strict";
|
|
@@ -8500,7 +8514,7 @@ var client = new error_tracker_BrowserClient({
|
|
|
8500
8514
|
return event;
|
|
8501
8515
|
},
|
|
8502
8516
|
environment: "production",
|
|
8503
|
-
release: "
|
|
8517
|
+
release: "1.0.50-64cd4d3",
|
|
8504
8518
|
sampleRate: 0.25,
|
|
8505
8519
|
autoSessionTracking: false,
|
|
8506
8520
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -8728,7 +8742,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
8728
8742
|
|
|
8729
8743
|
_this.postMessage(requestEvent, payload, id);
|
|
8730
8744
|
}).catch(function (e) {
|
|
8731
|
-
//
|
|
8745
|
+
// We should NOT silently catch errors for "GET_STATE" request event - it is critical for application to work.
|
|
8746
|
+
if (requestEvent === "GET_STATE") {
|
|
8747
|
+
throw new errors/* AdaEmbedError */.S("Failed to respond to \"GET_STATE\" request. Reason: \"".concat(e.message, "\"."));
|
|
8748
|
+
} // handling promise
|
|
8749
|
+
|
|
8750
|
+
|
|
8732
8751
|
if (e.message !== "Could not connect frame channel.") {
|
|
8733
8752
|
error_tracker.trackException(e);
|
|
8734
8753
|
}
|
|
@@ -8820,8 +8839,6 @@ var FrameChannel = /*#__PURE__*/function (_Channel) {
|
|
|
8820
8839
|
|
|
8821
8840
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "targetOrigin", void 0);
|
|
8822
8841
|
|
|
8823
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "eventTarget", void 0);
|
|
8824
|
-
|
|
8825
8842
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "isConnected", false);
|
|
8826
8843
|
|
|
8827
8844
|
_this.name = name;
|
|
@@ -8893,11 +8910,20 @@ var FrameChannel = /*#__PURE__*/function (_Channel) {
|
|
|
8893
8910
|
status: status
|
|
8894
8911
|
});
|
|
8895
8912
|
} catch (e) {
|
|
8896
|
-
var
|
|
8913
|
+
var _context4, _context5;
|
|
8897
8914
|
|
|
8898
8915
|
var reason = e instanceof Error ? e.message : "unknown";
|
|
8899
8916
|
var payloadRootKeys = payload && (0,esm_typeof/* default */.Z)(payload) === "object" ? keys_default()(payload) : [];
|
|
8900
|
-
|
|
8917
|
+
|
|
8918
|
+
if (eventName === "DISPATCH" && payload && (0,esm_typeof/* default */.Z)(payload) === "object") {
|
|
8919
|
+
var _context2, _context3;
|
|
8920
|
+
|
|
8921
|
+
var p = payload;
|
|
8922
|
+
var dispatchPayloadKeys = p.payload && (0,esm_typeof/* default */.Z)(p.payload) === "object" ? keys_default()(p.payload) : [];
|
|
8923
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context2 = concat_default()(_context3 = "Failed to stringify payload for \"DISPATCH\" event. Reason: \"".concat(reason, "\". Action: \"")).call(_context3, p.actionKey, "\". Payload keys: ")).call(_context2, dispatchPayloadKeys.join(", "), "."));
|
|
8924
|
+
}
|
|
8925
|
+
|
|
8926
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context4 = concat_default()(_context5 = "Failed to stringify object. Reason: \"".concat(reason, "\". Event: \"")).call(_context5, eventName, "\". Payload keys: ")).call(_context4, payloadRootKeys.join(", "), "."));
|
|
8901
8927
|
}
|
|
8902
8928
|
}
|
|
8903
8929
|
}], [{
|
|
@@ -9187,7 +9213,7 @@ function getEmbedURL(_ref) {
|
|
|
9187
9213
|
polyfillVersionString = "legacy";
|
|
9188
9214
|
}
|
|
9189
9215
|
|
|
9190
|
-
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "
|
|
9216
|
+
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "64cd4d3", "/index.html");
|
|
9191
9217
|
}
|
|
9192
9218
|
/**
|
|
9193
9219
|
* Generate the Chat / API URL
|
|
@@ -9204,12 +9230,18 @@ function getURL(_ref2) {
|
|
|
9204
9230
|
_ref2$qp = _ref2.qp,
|
|
9205
9231
|
qp = _ref2$qp === void 0 ? {} : _ref2$qp;
|
|
9206
9232
|
|
|
9207
|
-
var queryString =
|
|
9208
|
-
return qp[key] !== undefined && qp[key] !== null;
|
|
9209
|
-
})).call(_context8, function (key) {
|
|
9233
|
+
var queryString = filter_default()(_context8 = map_default()(_context9 = keys_default()(qp)).call(_context9, function (key) {
|
|
9210
9234
|
var _context10;
|
|
9211
9235
|
|
|
9212
|
-
|
|
9236
|
+
var value = qp[key];
|
|
9237
|
+
|
|
9238
|
+
if (value === undefined || value === null) {
|
|
9239
|
+
return null;
|
|
9240
|
+
}
|
|
9241
|
+
|
|
9242
|
+
return concat_default()(_context10 = "".concat(key, "=")).call(_context10, window.encodeURIComponent(value));
|
|
9243
|
+
})).call(_context8, function (v) {
|
|
9244
|
+
return v !== null;
|
|
9213
9245
|
}).join("&");
|
|
9214
9246
|
|
|
9215
9247
|
var questionSym = queryString.length ? "?" : "";
|
|
@@ -10030,8 +10062,6 @@ var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
|
|
|
10030
10062
|
|
|
10031
10063
|
|
|
10032
10064
|
|
|
10033
|
-
var INTRO_STYLE_EMOJI = "Emoji";
|
|
10034
|
-
var INTRO_STYLE_TEXT = "Text";
|
|
10035
10065
|
function getProcessedPath(path) {
|
|
10036
10066
|
var regex = new RegExp("^http(s)?://(www.)?");
|
|
10037
10067
|
return trim_default()(path).call(path).replace(regex, "");
|
|
@@ -10081,20 +10111,10 @@ function getIntroForCurrentUrl(intros, language) {
|
|
|
10081
10111
|
var matchingIntro = findMatchingIntro(intros);
|
|
10082
10112
|
|
|
10083
10113
|
if (!matchingIntro) {
|
|
10084
|
-
return
|
|
10114
|
+
return undefined;
|
|
10085
10115
|
}
|
|
10086
10116
|
|
|
10087
|
-
if (matchingIntro.style ===
|
|
10088
|
-
return {
|
|
10089
|
-
response_id: matchingIntro.response_id,
|
|
10090
|
-
body: matchingIntro.body.message_text[language],
|
|
10091
|
-
style: matchingIntro.style,
|
|
10092
|
-
delay: matchingIntro.delay,
|
|
10093
|
-
duration: matchingIntro.duration
|
|
10094
|
-
};
|
|
10095
|
-
}
|
|
10096
|
-
|
|
10097
|
-
if (matchingIntro.style === INTRO_STYLE_EMOJI) {
|
|
10117
|
+
if (matchingIntro.style === "Emoji") {
|
|
10098
10118
|
return {
|
|
10099
10119
|
response_id: matchingIntro.response_id,
|
|
10100
10120
|
body: matchingIntro.body.emoji_link,
|
|
@@ -10102,9 +10122,16 @@ function getIntroForCurrentUrl(intros, language) {
|
|
|
10102
10122
|
delay: matchingIntro.delay,
|
|
10103
10123
|
duration: matchingIntro.duration
|
|
10104
10124
|
};
|
|
10105
|
-
}
|
|
10125
|
+
} // Default - "Text" style
|
|
10106
10126
|
|
|
10107
|
-
|
|
10127
|
+
|
|
10128
|
+
return {
|
|
10129
|
+
response_id: matchingIntro.response_id,
|
|
10130
|
+
body: matchingIntro.body.message_text[language],
|
|
10131
|
+
style: matchingIntro.style,
|
|
10132
|
+
delay: matchingIntro.delay,
|
|
10133
|
+
duration: matchingIntro.duration
|
|
10134
|
+
};
|
|
10108
10135
|
}
|
|
10109
10136
|
;// CONCATENATED MODULE: ./src/campaigns/TriggerConditionEvaluator.ts
|
|
10110
10137
|
|
|
@@ -10674,7 +10701,7 @@ function fetch_client_objectSpread(target) { for (var i = 1; i < arguments.lengt
|
|
|
10674
10701
|
|
|
10675
10702
|
|
|
10676
10703
|
|
|
10677
|
-
function
|
|
10704
|
+
function isClientObject(client) {
|
|
10678
10705
|
// We require the following properties defined
|
|
10679
10706
|
return ["handle", "rollout", "chat", "features"].every(function (key) {
|
|
10680
10707
|
return client[key] !== undefined;
|
|
@@ -10705,14 +10732,14 @@ function _fetchClient() {
|
|
|
10705
10732
|
case 3:
|
|
10706
10733
|
cachedClient = _context.sent;
|
|
10707
10734
|
|
|
10708
|
-
if (!(cachedClient &&
|
|
10735
|
+
if (!(cachedClient && isClientObject(cachedClient))) {
|
|
10709
10736
|
_context.next = 6;
|
|
10710
10737
|
break;
|
|
10711
10738
|
}
|
|
10712
10739
|
|
|
10713
10740
|
return _context.abrupt("return", {
|
|
10714
10741
|
client: fetch_client_objectSpread({
|
|
10715
|
-
intro: getIntroForCurrentUrl(cachedClient.intros, language || cachedClient.language)
|
|
10742
|
+
intro: getIntroForCurrentUrl(cachedClient.intros || [], language || cachedClient.language)
|
|
10716
10743
|
}, cachedClient)
|
|
10717
10744
|
});
|
|
10718
10745
|
|
|
@@ -10793,6 +10820,53 @@ function wait(ms) {
|
|
|
10793
10820
|
return setTimeout(resolve, ms);
|
|
10794
10821
|
});
|
|
10795
10822
|
}
|
|
10823
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js
|
|
10824
|
+
var object_get_own_property_symbols = __webpack_require__(3263);
|
|
10825
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/instance/index-of.js
|
|
10826
|
+
var index_of = __webpack_require__(5683);
|
|
10827
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/keys.js
|
|
10828
|
+
var keys = __webpack_require__(9356);
|
|
10829
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/objectWithoutPropertiesLoose.js
|
|
10830
|
+
|
|
10831
|
+
|
|
10832
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
10833
|
+
if (source == null) return {};
|
|
10834
|
+
var target = {};
|
|
10835
|
+
|
|
10836
|
+
var sourceKeys = keys(source);
|
|
10837
|
+
|
|
10838
|
+
var key, i;
|
|
10839
|
+
|
|
10840
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
10841
|
+
key = sourceKeys[i];
|
|
10842
|
+
if (index_of(excluded).call(excluded, key) >= 0) continue;
|
|
10843
|
+
target[key] = source[key];
|
|
10844
|
+
}
|
|
10845
|
+
|
|
10846
|
+
return target;
|
|
10847
|
+
}
|
|
10848
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/objectWithoutProperties.js
|
|
10849
|
+
|
|
10850
|
+
|
|
10851
|
+
|
|
10852
|
+
function _objectWithoutProperties(source, excluded) {
|
|
10853
|
+
if (source == null) return {};
|
|
10854
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
10855
|
+
var key, i;
|
|
10856
|
+
|
|
10857
|
+
if (object_get_own_property_symbols) {
|
|
10858
|
+
var sourceSymbolKeys = object_get_own_property_symbols(source);
|
|
10859
|
+
|
|
10860
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
10861
|
+
key = sourceSymbolKeys[i];
|
|
10862
|
+
if (index_of(excluded).call(excluded, key) >= 0) continue;
|
|
10863
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
10864
|
+
target[key] = source[key];
|
|
10865
|
+
}
|
|
10866
|
+
}
|
|
10867
|
+
|
|
10868
|
+
return target;
|
|
10869
|
+
}
|
|
10796
10870
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js
|
|
10797
10871
|
var core_js_stable_object_assign = __webpack_require__(1942);
|
|
10798
10872
|
var object_assign_default = /*#__PURE__*/__webpack_require__.n(core_js_stable_object_assign);
|
|
@@ -10800,6 +10874,7 @@ var object_assign_default = /*#__PURE__*/__webpack_require__.n(core_js_stable_ob
|
|
|
10800
10874
|
|
|
10801
10875
|
|
|
10802
10876
|
|
|
10877
|
+
var _excluded = ["chat", "chat_button", "features", "handle", "language", "persistence", "privacy", "rollout", "tint"];
|
|
10803
10878
|
|
|
10804
10879
|
var Client = function Client(clientResponse) {
|
|
10805
10880
|
(0,classCallCheck/* default */.Z)(this, Client);
|
|
@@ -10832,15 +10907,34 @@ var Client = function Client(clientResponse) {
|
|
|
10832
10907
|
|
|
10833
10908
|
(0,defineProperty/* default */.Z)(this, "ui_settings", void 0);
|
|
10834
10909
|
|
|
10910
|
+
var chat = clientResponse.chat,
|
|
10911
|
+
chatButton = clientResponse.chat_button,
|
|
10912
|
+
features = clientResponse.features,
|
|
10913
|
+
handle = clientResponse.handle,
|
|
10914
|
+
language = clientResponse.language,
|
|
10915
|
+
persistence = clientResponse.persistence,
|
|
10916
|
+
privacy = clientResponse.privacy,
|
|
10917
|
+
rollout = clientResponse.rollout,
|
|
10918
|
+
tint = clientResponse.tint,
|
|
10919
|
+
rest = _objectWithoutProperties(clientResponse, _excluded);
|
|
10920
|
+
|
|
10921
|
+
this.chat = chat;
|
|
10922
|
+
this.chat_button = chatButton;
|
|
10923
|
+
this.features = features;
|
|
10924
|
+
this.handle = handle;
|
|
10925
|
+
this.language = language;
|
|
10926
|
+
this.persistence = persistence;
|
|
10927
|
+
this.privacy = privacy;
|
|
10928
|
+
this.rollout = rollout;
|
|
10929
|
+
this.tint = tint;
|
|
10835
10930
|
/**
|
|
10836
10931
|
* Even if some properties are not used by Embed2, they may be used by Chat.
|
|
10837
10932
|
* Chat can "pull" the client object from Embed2 in order to reduce an API
|
|
10838
10933
|
* request. Embed2 should thus not modify keys.
|
|
10839
10934
|
*/
|
|
10840
|
-
object_assign_default()(this, clientResponse);
|
|
10841
|
-
};
|
|
10842
|
-
|
|
10843
10935
|
|
|
10936
|
+
object_assign_default()(this, rest);
|
|
10937
|
+
};
|
|
10844
10938
|
function hasCampaignsEnabled(client) {
|
|
10845
10939
|
return (client === null || client === void 0 ? void 0 : client.features.afm_proactive_messaging) || (client === null || client === void 0 ? void 0 : client.features.afm_proactive_messaging_free_tier);
|
|
10846
10940
|
}
|
|
@@ -11297,6 +11391,7 @@ function ChatFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefine
|
|
|
11297
11391
|
|
|
11298
11392
|
|
|
11299
11393
|
|
|
11394
|
+
|
|
11300
11395
|
var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
11301
11396
|
(0,inherits/* default */.Z)(ChatFrame, _Component);
|
|
11302
11397
|
|
|
@@ -11317,21 +11412,19 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11317
11412
|
|
|
11318
11413
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "iframeRef", y());
|
|
11319
11414
|
|
|
11320
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "pageYOffset",
|
|
11321
|
-
|
|
11322
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyOverflow", void 0);
|
|
11415
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "pageYOffset", 0);
|
|
11323
11416
|
|
|
11324
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11417
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyOverflow", "");
|
|
11325
11418
|
|
|
11326
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11419
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyPosition", "");
|
|
11327
11420
|
|
|
11328
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11421
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyTop", "");
|
|
11329
11422
|
|
|
11330
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11423
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyBottom", "");
|
|
11331
11424
|
|
|
11332
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11425
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyLeft", "");
|
|
11333
11426
|
|
|
11334
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "
|
|
11427
|
+
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyRight", "");
|
|
11335
11428
|
|
|
11336
11429
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "url", _this.getURL);
|
|
11337
11430
|
|
|
@@ -11351,6 +11444,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11351
11444
|
var _this2 = this;
|
|
11352
11445
|
|
|
11353
11446
|
var _this$props = this.props,
|
|
11447
|
+
adaSettings = _this$props.adaSettings,
|
|
11448
|
+
handle = _this$props.handle,
|
|
11354
11449
|
name = _this$props.name,
|
|
11355
11450
|
setChatHasBeenRendered = _this$props.setChatHasBeenRendered,
|
|
11356
11451
|
messageService = _this$props.messageService,
|
|
@@ -11359,7 +11454,12 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11359
11454
|
this.channel = messageService.registerFrameChannel(name, this.iframeRef.current.contentWindow, this.iframeRef.current.src);
|
|
11360
11455
|
store.addChannelListener(name);
|
|
11361
11456
|
this.bindChatEventHandlers();
|
|
11362
|
-
this.handleScrollLock(); //
|
|
11457
|
+
this.handleScrollLock(); // We use this log to track number of chat impressions (times when users see chat iFrame render first time).
|
|
11458
|
+
|
|
11459
|
+
(0,services_logger/* log */.c)("Chat frame mount", {
|
|
11460
|
+
handle: handle,
|
|
11461
|
+
embedSettings: adaSettings
|
|
11462
|
+
}); // Delay to allow inline css animation to work.
|
|
11363
11463
|
|
|
11364
11464
|
setTimeout(function () {
|
|
11365
11465
|
_this2.setState({
|
|
@@ -11396,7 +11496,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11396
11496
|
}
|
|
11397
11497
|
|
|
11398
11498
|
var theme = client.ui_settings.chat.theme;
|
|
11399
|
-
var systemDarkMode =
|
|
11499
|
+
var systemDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
11400
11500
|
return theme === "dark" || theme === "auto" && systemDarkMode;
|
|
11401
11501
|
}
|
|
11402
11502
|
/**
|
|
@@ -11418,6 +11518,11 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11418
11518
|
privateMode = _this$props3.privateMode,
|
|
11419
11519
|
testMode = _this$props3.testMode,
|
|
11420
11520
|
adaSettings = _this$props3.adaSettings;
|
|
11521
|
+
|
|
11522
|
+
if (!handle) {
|
|
11523
|
+
throw new errors/* AdaEmbedError */.S("`handle` is not defined");
|
|
11524
|
+
}
|
|
11525
|
+
|
|
11421
11526
|
return getURL({
|
|
11422
11527
|
name: name,
|
|
11423
11528
|
handle: handle,
|
|
@@ -11438,7 +11543,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11438
11543
|
}, {
|
|
11439
11544
|
key: "styles",
|
|
11440
11545
|
get: function get() {
|
|
11441
|
-
var _client$ui_settings2, _context10, _context11, _context12, _context13, _context14;
|
|
11546
|
+
var _client$ui_settings2, _client$ui_settings2$, _context10, _context11, _context12, _context13, _context14;
|
|
11442
11547
|
|
|
11443
11548
|
var _this$props4 = this.props,
|
|
11444
11549
|
isDrawerOpen = _this$props4.isDrawerOpen,
|
|
@@ -11455,7 +11560,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11455
11560
|
closeTransitionTime = _this$state.closeTransitionTime;
|
|
11456
11561
|
var isShown = isDrawerOpen && isMounted;
|
|
11457
11562
|
var backgroundColor = this.darkMode ? "#121212" : "#fff";
|
|
11458
|
-
var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : _client$ui_settings2.chat
|
|
11563
|
+
var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : (_client$ui_settings2$ = _client$ui_settings2.chat) === null || _client$ui_settings2$ === void 0 ? void 0 : _client$ui_settings2$.style) === "rectangular" ? "8px" : "16px";
|
|
11459
11564
|
var WINDOW_HEIGHT = 725;
|
|
11460
11565
|
var TEST_BOT_NAV_HEIGHT = 48;
|
|
11461
11566
|
var isTestBot = client.features.embed_test_bot && testMode;
|
|
@@ -11484,12 +11589,17 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11484
11589
|
var _this$props5 = this.props,
|
|
11485
11590
|
chatDimensions = _this$props5.chatDimensions,
|
|
11486
11591
|
client = _this$props5.client,
|
|
11487
|
-
adaSettings = _this$props5.adaSettings;
|
|
11592
|
+
adaSettings = _this$props5.adaSettings;
|
|
11593
|
+
|
|
11594
|
+
if (!(client !== null && client !== void 0 && client.chat_button)) {
|
|
11595
|
+
return "";
|
|
11596
|
+
} // delta is used to determine how much of the button's height should be ignored
|
|
11488
11597
|
// when spacing the proactive message
|
|
11489
11598
|
|
|
11599
|
+
|
|
11490
11600
|
var delta = 3;
|
|
11491
11601
|
var TEXT_BUTTON_HEIGHT = 44;
|
|
11492
|
-
var bottomOffset = (
|
|
11602
|
+
var bottomOffset = ((_client$ui_settings3 = client.ui_settings) === null || _client$ui_settings3 === void 0 ? void 0 : (_client$ui_settings3$ = _client$ui_settings3.embed) === null || _client$ui_settings3$ === void 0 ? void 0 : _client$ui_settings3$.style) === "text" ? TEXT_BUTTON_HEIGHT - delta : client.chat_button.size - delta;
|
|
11493
11603
|
return concat_default()(_context15 = concat_default()(_context16 = concat_default()(_context17 = "\n box-shadow: none;\n background: none;\n height: ".concat(chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.height, "px !important;\n width: ")).call(_context17, chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.width, "px !important;\n ")).call(_context16, getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context15, bottomOffset, "px;\n z-index: 9999;\n ");
|
|
11494
11604
|
}
|
|
11495
11605
|
}, {
|
|
@@ -11505,6 +11615,10 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11505
11615
|
return ChatFrame.parentElementStyles;
|
|
11506
11616
|
}
|
|
11507
11617
|
|
|
11618
|
+
if (!client) {
|
|
11619
|
+
throw new errors/* AdaEmbedError */.S("`client` is not defined");
|
|
11620
|
+
}
|
|
11621
|
+
|
|
11508
11622
|
if (client.features.afm_proactive_messaging && !isDrawerOpen) {
|
|
11509
11623
|
var _context21;
|
|
11510
11624
|
|
|
@@ -11633,32 +11747,48 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11633
11747
|
case 0:
|
|
11634
11748
|
_this$props8 = this.props, adaSettings = _this$props8.adaSettings, setState = _this$props8.setState, setConnectionState = _this$props8.setConnectionState;
|
|
11635
11749
|
_context22.t0 = type;
|
|
11636
|
-
_context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ?
|
|
11750
|
+
_context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ? 8 : _context22.t0 === CHAT_WEBSOCKET_CONNECTED ? 13 : _context22.t0 === PUBLISH_EVENT ? 15 : _context22.t0 === ANALYTICS_EVENT ? 18 : _context22.t0 === CHATTER_EVENT ? 22 : _context22.t0 === "ZD_SESSION" ? 32 : _context22.t0 === CHATTER_LIVECHAT_EVENT ? 41 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 49 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 58 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 61 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 79 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 81 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 85 : _context22.t0 === END_CONVERSATION_EVENT ? 87 : 90;
|
|
11637
11751
|
break;
|
|
11638
11752
|
|
|
11639
11753
|
case 4:
|
|
11640
|
-
this.channel
|
|
11641
|
-
|
|
11754
|
+
if (this.channel) {
|
|
11755
|
+
_context22.next = 6;
|
|
11756
|
+
break;
|
|
11757
|
+
}
|
|
11758
|
+
|
|
11759
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
11642
11760
|
|
|
11643
11761
|
case 6:
|
|
11762
|
+
this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
|
|
11763
|
+
return _context22.abrupt("break", 91);
|
|
11764
|
+
|
|
11765
|
+
case 8:
|
|
11766
|
+
if (this.channel) {
|
|
11767
|
+
_context22.next = 10;
|
|
11768
|
+
break;
|
|
11769
|
+
}
|
|
11770
|
+
|
|
11771
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
11772
|
+
|
|
11773
|
+
case 10:
|
|
11644
11774
|
this.channel.isConnected = true;
|
|
11645
11775
|
setConnectionState({
|
|
11646
11776
|
"chat": ConnectionState.Done
|
|
11647
11777
|
});
|
|
11648
|
-
return _context22.abrupt("break",
|
|
11778
|
+
return _context22.abrupt("break", 91);
|
|
11649
11779
|
|
|
11650
|
-
case
|
|
11780
|
+
case 13:
|
|
11651
11781
|
setState({
|
|
11652
11782
|
isChatWebsocketConnected: true
|
|
11653
11783
|
});
|
|
11654
|
-
return _context22.abrupt("break",
|
|
11784
|
+
return _context22.abrupt("break", 91);
|
|
11655
11785
|
|
|
11656
|
-
case
|
|
11786
|
+
case 15:
|
|
11657
11787
|
_ref = payload, eventKey = _ref.eventKey, data = _ref.data;
|
|
11658
11788
|
publishEvent(eventKey, data);
|
|
11659
|
-
return _context22.abrupt("break",
|
|
11789
|
+
return _context22.abrupt("break", 91);
|
|
11660
11790
|
|
|
11661
|
-
case
|
|
11791
|
+
case 18:
|
|
11662
11792
|
_ref2 = payload, analytics = _ref2.analytics;
|
|
11663
11793
|
analyticsCallback = adaSettings.analyticsCallback;
|
|
11664
11794
|
|
|
@@ -11666,28 +11796,28 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11666
11796
|
analyticsCallback(analytics);
|
|
11667
11797
|
}
|
|
11668
11798
|
|
|
11669
|
-
return _context22.abrupt("break",
|
|
11799
|
+
return _context22.abrupt("break", 91);
|
|
11670
11800
|
|
|
11671
|
-
case
|
|
11801
|
+
case 22:
|
|
11672
11802
|
client = this.props.client;
|
|
11673
11803
|
_ref3 = payload, chatter = _ref3.chatter, created = _ref3.created;
|
|
11674
11804
|
chatterTokenCallback = adaSettings.chatterTokenCallback;
|
|
11675
11805
|
|
|
11676
11806
|
if (client) {
|
|
11677
|
-
_context22.next =
|
|
11807
|
+
_context22.next = 27;
|
|
11678
11808
|
break;
|
|
11679
11809
|
}
|
|
11680
11810
|
|
|
11681
11811
|
throw new errors/* AdaEmbedError */.S("`client` is undefined");
|
|
11682
11812
|
|
|
11683
|
-
case
|
|
11684
|
-
_context22.next =
|
|
11813
|
+
case 27:
|
|
11814
|
+
_context22.next = 29;
|
|
11685
11815
|
return setState({
|
|
11686
11816
|
chatterToken: chatter,
|
|
11687
11817
|
chatterCreated: created
|
|
11688
11818
|
});
|
|
11689
11819
|
|
|
11690
|
-
case
|
|
11820
|
+
case 29:
|
|
11691
11821
|
/**
|
|
11692
11822
|
* Store the token so when embed loads in the future, it doesn't have to wait for it to
|
|
11693
11823
|
* come from chat. This is important for campaign and business event triggers.
|
|
@@ -11704,26 +11834,26 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11704
11834
|
chatterTokenCallback(chatter);
|
|
11705
11835
|
}
|
|
11706
11836
|
|
|
11707
|
-
return _context22.abrupt("break",
|
|
11837
|
+
return _context22.abrupt("break", 91);
|
|
11708
11838
|
|
|
11709
|
-
case
|
|
11839
|
+
case 32:
|
|
11710
11840
|
_client = this.props.client;
|
|
11711
11841
|
_ref4 = payload, zdSessionId = _ref4.zdSessionId, zdPreviousTags = _ref4.zdPreviousTags;
|
|
11712
11842
|
|
|
11713
11843
|
if (_client) {
|
|
11714
|
-
_context22.next =
|
|
11844
|
+
_context22.next = 36;
|
|
11715
11845
|
break;
|
|
11716
11846
|
}
|
|
11717
11847
|
|
|
11718
11848
|
throw new errors/* AdaEmbedError */.S("`client` is undefined");
|
|
11719
11849
|
|
|
11720
|
-
case
|
|
11721
|
-
_context22.next =
|
|
11850
|
+
case 36:
|
|
11851
|
+
_context22.next = 38;
|
|
11722
11852
|
return setState({
|
|
11723
11853
|
zdSessionId: zdSessionId
|
|
11724
11854
|
});
|
|
11725
11855
|
|
|
11726
|
-
case
|
|
11856
|
+
case 38:
|
|
11727
11857
|
storage = function () {
|
|
11728
11858
|
if (_client.persistence === PERSISTENCE_NORMAL) {
|
|
11729
11859
|
return safeLocalStorage;
|
|
@@ -11750,17 +11880,25 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11750
11880
|
}
|
|
11751
11881
|
}
|
|
11752
11882
|
|
|
11753
|
-
return _context22.abrupt("break",
|
|
11883
|
+
return _context22.abrupt("break", 91);
|
|
11754
11884
|
|
|
11755
|
-
case
|
|
11885
|
+
case 41:
|
|
11756
11886
|
_client2 = this.props.client;
|
|
11757
11887
|
_ref5 = payload, inLiveChat = _ref5.inLiveChat;
|
|
11758
|
-
_context22.next =
|
|
11888
|
+
_context22.next = 45;
|
|
11759
11889
|
return setState({
|
|
11760
11890
|
chatterInLiveChat: inLiveChat
|
|
11761
11891
|
});
|
|
11762
11892
|
|
|
11763
|
-
case
|
|
11893
|
+
case 45:
|
|
11894
|
+
if (_client2) {
|
|
11895
|
+
_context22.next = 47;
|
|
11896
|
+
break;
|
|
11897
|
+
}
|
|
11898
|
+
|
|
11899
|
+
throw new errors/* AdaEmbedError */.S("`client` is not defined");
|
|
11900
|
+
|
|
11901
|
+
case 47:
|
|
11764
11902
|
/**
|
|
11765
11903
|
* Store the token so when embed loads in the future, it doesn't have to wait for it to
|
|
11766
11904
|
* come from chat. This is important for campaign and business event triggers.
|
|
@@ -11771,19 +11909,19 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11771
11909
|
safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
|
|
11772
11910
|
}
|
|
11773
11911
|
|
|
11774
|
-
return _context22.abrupt("break",
|
|
11912
|
+
return _context22.abrupt("break", 91);
|
|
11775
11913
|
|
|
11776
|
-
case
|
|
11914
|
+
case 49:
|
|
11777
11915
|
eventCallbacks = adaSettings.eventCallbacks;
|
|
11778
11916
|
|
|
11779
11917
|
if (eventCallbacks) {
|
|
11780
|
-
_context22.next =
|
|
11918
|
+
_context22.next = 52;
|
|
11781
11919
|
break;
|
|
11782
11920
|
}
|
|
11783
11921
|
|
|
11784
|
-
return _context22.abrupt("break",
|
|
11922
|
+
return _context22.abrupt("break", 91);
|
|
11785
11923
|
|
|
11786
|
-
case
|
|
11924
|
+
case 52:
|
|
11787
11925
|
customJavascriptEvent = payload.event_data;
|
|
11788
11926
|
specificCallback = eventCallbacks[customJavascriptEvent.event_name];
|
|
11789
11927
|
genericCallback = eventCallbacks["*"];
|
|
@@ -11796,65 +11934,107 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11796
11934
|
genericCallback(customJavascriptEvent);
|
|
11797
11935
|
}
|
|
11798
11936
|
|
|
11799
|
-
return _context22.abrupt("break",
|
|
11937
|
+
return _context22.abrupt("break", 91);
|
|
11800
11938
|
|
|
11801
|
-
case
|
|
11939
|
+
case 58:
|
|
11802
11940
|
resetChat = this.props.resetChat;
|
|
11803
11941
|
resetChat();
|
|
11804
|
-
return _context22.abrupt("break",
|
|
11942
|
+
return _context22.abrupt("break", 91);
|
|
11805
11943
|
|
|
11806
|
-
case
|
|
11944
|
+
case 61:
|
|
11807
11945
|
zdChatterAuthCallback = adaSettings.zdChatterAuthCallback;
|
|
11808
11946
|
|
|
11809
|
-
if (zdChatterAuthCallback) {
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
|
|
11947
|
+
if (!zdChatterAuthCallback) {
|
|
11948
|
+
_context22.next = 75;
|
|
11949
|
+
break;
|
|
11950
|
+
}
|
|
11951
|
+
|
|
11952
|
+
_context22.prev = 63;
|
|
11953
|
+
zdChatterAuthCallback(function (token) {
|
|
11954
|
+
if (!_this4.channel) {
|
|
11955
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
11819
11956
|
}
|
|
11820
|
-
|
|
11821
|
-
|
|
11957
|
+
|
|
11958
|
+
_this4.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {
|
|
11959
|
+
token: token
|
|
11960
|
+
}, id);
|
|
11961
|
+
});
|
|
11962
|
+
_context22.next = 73;
|
|
11963
|
+
break;
|
|
11964
|
+
|
|
11965
|
+
case 67:
|
|
11966
|
+
_context22.prev = 67;
|
|
11967
|
+
_context22.t1 = _context22["catch"](63);
|
|
11968
|
+
console.warn("Function for zdChatterAuthCallback produced an error - please ensure the callback is functioning normally");
|
|
11969
|
+
|
|
11970
|
+
if (this.channel) {
|
|
11971
|
+
_context22.next = 72;
|
|
11972
|
+
break;
|
|
11822
11973
|
}
|
|
11823
11974
|
|
|
11824
|
-
|
|
11975
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
11825
11976
|
|
|
11826
|
-
case
|
|
11977
|
+
case 72:
|
|
11978
|
+
this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
|
|
11979
|
+
|
|
11980
|
+
case 73:
|
|
11981
|
+
_context22.next = 78;
|
|
11982
|
+
break;
|
|
11983
|
+
|
|
11984
|
+
case 75:
|
|
11985
|
+
if (this.channel) {
|
|
11986
|
+
_context22.next = 77;
|
|
11987
|
+
break;
|
|
11988
|
+
}
|
|
11989
|
+
|
|
11990
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
11991
|
+
|
|
11992
|
+
case 77:
|
|
11993
|
+
this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
|
|
11994
|
+
|
|
11995
|
+
case 78:
|
|
11996
|
+
return _context22.abrupt("break", 91);
|
|
11997
|
+
|
|
11998
|
+
case 79:
|
|
11827
11999
|
this.handleNotifications(payload);
|
|
11828
|
-
return _context22.abrupt("break",
|
|
12000
|
+
return _context22.abrupt("break", 91);
|
|
11829
12001
|
|
|
11830
|
-
case
|
|
12002
|
+
case 81:
|
|
12003
|
+
if (this.channel) {
|
|
12004
|
+
_context22.next = 83;
|
|
12005
|
+
break;
|
|
12006
|
+
}
|
|
12007
|
+
|
|
12008
|
+
throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
|
|
12009
|
+
|
|
12010
|
+
case 83:
|
|
11831
12011
|
this.channel.postMessage(BROWSER_HAS_NOTIFICATIONS_RESPONSE_EVENT, {
|
|
11832
12012
|
browserHasNotificationSupport: browserHasNotificationSupport
|
|
11833
12013
|
});
|
|
11834
|
-
return _context22.abrupt("break",
|
|
12014
|
+
return _context22.abrupt("break", 91);
|
|
11835
12015
|
|
|
11836
|
-
case
|
|
12016
|
+
case 85:
|
|
11837
12017
|
requestNotificationPermission();
|
|
11838
|
-
return _context22.abrupt("break",
|
|
12018
|
+
return _context22.abrupt("break", 91);
|
|
11839
12019
|
|
|
11840
|
-
case
|
|
12020
|
+
case 87:
|
|
11841
12021
|
conversationEndCallback = adaSettings.conversationEndCallback;
|
|
11842
12022
|
|
|
11843
12023
|
if (conversationEndCallback) {
|
|
11844
12024
|
conversationEndCallback(payload);
|
|
11845
12025
|
}
|
|
11846
12026
|
|
|
11847
|
-
return _context22.abrupt("break",
|
|
12027
|
+
return _context22.abrupt("break", 91);
|
|
11848
12028
|
|
|
11849
|
-
case
|
|
11850
|
-
return _context22.abrupt("break",
|
|
12029
|
+
case 90:
|
|
12030
|
+
return _context22.abrupt("break", 91);
|
|
11851
12031
|
|
|
11852
|
-
case
|
|
12032
|
+
case 91:
|
|
11853
12033
|
case "end":
|
|
11854
12034
|
return _context22.stop();
|
|
11855
12035
|
}
|
|
11856
12036
|
}
|
|
11857
|
-
}, _callee, this);
|
|
12037
|
+
}, _callee, this, [[63, 67]]);
|
|
11858
12038
|
}));
|
|
11859
12039
|
|
|
11860
12040
|
function handleChatEvent(_x, _x2, _x3) {
|
|
@@ -11871,7 +12051,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11871
12051
|
var _this$props9 = this.props,
|
|
11872
12052
|
name = _this$props9.name,
|
|
11873
12053
|
messageService = _this$props9.messageService;
|
|
11874
|
-
messageService.getChannel(name)
|
|
12054
|
+
var channel = messageService.getChannel(name);
|
|
12055
|
+
|
|
12056
|
+
if (!channel) {
|
|
12057
|
+
throw new errors/* AdaEmbedError */.S("`channel` is not defined");
|
|
12058
|
+
}
|
|
12059
|
+
|
|
12060
|
+
channel.addEventListener(function (type, payload, id) {
|
|
11875
12061
|
_this5.handleChatEvent(type, payload, id);
|
|
11876
12062
|
});
|
|
11877
12063
|
}
|
|
@@ -12658,7 +12844,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12658
12844
|
|
|
12659
12845
|
case 6:
|
|
12660
12846
|
_context3.t0 = type;
|
|
12661
|
-
_context3.next = _context3.t0 === TRACK_EVENT ? 9 : _context3.t0 === TRIGGER_CAMPAIGN ? 14 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 19 : _context3.t0 === TOGGLE ? 24 : _context3.t0 === GET_INFO ? 29 : _context3.t0 === SET_META_FIELDS ? 33 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 40 : _context3.t0 === STOP ? 45 : _context3.t0 === RESET ? 48 : _context3.t0 === DELETE_HISTORY ? 66 : _context3.t0 === CREATE_PROACTIVE ? 78 :
|
|
12847
|
+
_context3.next = _context3.t0 === TRACK_EVENT ? 9 : _context3.t0 === TRIGGER_CAMPAIGN ? 14 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 19 : _context3.t0 === TOGGLE ? 24 : _context3.t0 === GET_INFO ? 29 : _context3.t0 === SET_META_FIELDS ? 33 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 40 : _context3.t0 === STOP ? 45 : _context3.t0 === RESET ? 48 : _context3.t0 === DELETE_HISTORY ? 66 : _context3.t0 === CREATE_PROACTIVE ? 78 : 91;
|
|
12662
12848
|
break;
|
|
12663
12849
|
|
|
12664
12850
|
case 9:
|
|
@@ -12672,7 +12858,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12672
12858
|
|
|
12673
12859
|
case 12:
|
|
12674
12860
|
this.trackEvent(payload);
|
|
12675
|
-
return _context3.abrupt("break",
|
|
12861
|
+
return _context3.abrupt("break", 91);
|
|
12676
12862
|
|
|
12677
12863
|
case 14:
|
|
12678
12864
|
if (client.features.afm_proactive_messaging) {
|
|
@@ -12685,7 +12871,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12685
12871
|
|
|
12686
12872
|
case 17:
|
|
12687
12873
|
this.triggerCampaign(payload);
|
|
12688
|
-
return _context3.abrupt("break",
|
|
12874
|
+
return _context3.abrupt("break", 91);
|
|
12689
12875
|
|
|
12690
12876
|
case 19:
|
|
12691
12877
|
if (client.features.afm_proactive_messaging) {
|
|
@@ -12698,7 +12884,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12698
12884
|
|
|
12699
12885
|
case 22:
|
|
12700
12886
|
this.evaluateCampaignConditions(payload);
|
|
12701
|
-
return _context3.abrupt("break",
|
|
12887
|
+
return _context3.abrupt("break", 91);
|
|
12702
12888
|
|
|
12703
12889
|
case 24:
|
|
12704
12890
|
toggleChat = this.props.toggleChat;
|
|
@@ -12707,7 +12893,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12707
12893
|
|
|
12708
12894
|
case 27:
|
|
12709
12895
|
localChannel.postMessage(TOGGLE_RESPONSE, null, id);
|
|
12710
|
-
return _context3.abrupt("break",
|
|
12896
|
+
return _context3.abrupt("break", 91);
|
|
12711
12897
|
|
|
12712
12898
|
case 29:
|
|
12713
12899
|
_this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
|
|
@@ -12718,7 +12904,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12718
12904
|
hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
|
|
12719
12905
|
};
|
|
12720
12906
|
localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
|
|
12721
|
-
return _context3.abrupt("break",
|
|
12907
|
+
return _context3.abrupt("break", 91);
|
|
12722
12908
|
|
|
12723
12909
|
case 33:
|
|
12724
12910
|
_this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
|
|
@@ -12731,7 +12917,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12731
12917
|
|
|
12732
12918
|
case 38:
|
|
12733
12919
|
localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
|
|
12734
|
-
return _context3.abrupt("break",
|
|
12920
|
+
return _context3.abrupt("break", 91);
|
|
12735
12921
|
|
|
12736
12922
|
case 40:
|
|
12737
12923
|
_this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
|
|
@@ -12742,12 +12928,12 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12742
12928
|
|
|
12743
12929
|
case 43:
|
|
12744
12930
|
localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
|
|
12745
|
-
return _context3.abrupt("break",
|
|
12931
|
+
return _context3.abrupt("break", 91);
|
|
12746
12932
|
|
|
12747
12933
|
case 45:
|
|
12748
12934
|
localChannel.postMessage(STOP_RESPONSE, null, id);
|
|
12749
12935
|
this.unmount();
|
|
12750
|
-
return _context3.abrupt("break",
|
|
12936
|
+
return _context3.abrupt("break", 91);
|
|
12751
12937
|
|
|
12752
12938
|
case 48:
|
|
12753
12939
|
_ref = payload, greeting = _ref.greeting, language = _ref.language, _newMetaFields = _ref.metaFields, _sensitiveMetaFields = _ref.sensitiveMetaFields, _ref$resetChatHistory = _ref.resetChatHistory, resetChatHistory = _ref$resetChatHistory === void 0 ? true : _ref$resetChatHistory;
|
|
@@ -12801,7 +12987,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12801
12987
|
}
|
|
12802
12988
|
|
|
12803
12989
|
localChannel.postMessage(RESET_RESPONSE, null, id);
|
|
12804
|
-
return _context3.abrupt("break",
|
|
12990
|
+
return _context3.abrupt("break", 91);
|
|
12805
12991
|
|
|
12806
12992
|
case 66:
|
|
12807
12993
|
_setState3 = this.props.setState;
|
|
@@ -12829,23 +13015,32 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12829
13015
|
case 75:
|
|
12830
13016
|
xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
|
|
12831
13017
|
localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
|
|
12832
|
-
return _context3.abrupt("break",
|
|
13018
|
+
return _context3.abrupt("break", 91);
|
|
12833
13019
|
|
|
12834
13020
|
case 78:
|
|
12835
13021
|
_ref2 = payload, body = _ref2.body, duration = _ref2.duration;
|
|
12836
|
-
EXTRA_PROACTIVE_DELAY = 1000;
|
|
13022
|
+
EXTRA_PROACTIVE_DELAY = 1000;
|
|
13023
|
+
|
|
13024
|
+
if (client) {
|
|
13025
|
+
_context3.next = 82;
|
|
13026
|
+
break;
|
|
13027
|
+
}
|
|
12837
13028
|
|
|
13029
|
+
throw new errors/* AdaEmbedError */.S("`client` is not defined");
|
|
13030
|
+
|
|
13031
|
+
case 82:
|
|
13032
|
+
// Free tier campaigns re-use the createProactive infrastructure
|
|
12838
13033
|
canCreateProactive = client.features.developer_proactive || client.features.afm_proactive_messaging_free_tier;
|
|
12839
13034
|
|
|
12840
13035
|
if (canCreateProactive) {
|
|
12841
|
-
_context3.next =
|
|
13036
|
+
_context3.next = 86;
|
|
12842
13037
|
break;
|
|
12843
13038
|
}
|
|
12844
13039
|
|
|
12845
13040
|
localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, "Ada Embed - Proactive intros are not available in your feature set.", id, FetchEventStatus.Failure);
|
|
12846
13041
|
return _context3.abrupt("return");
|
|
12847
13042
|
|
|
12848
|
-
case
|
|
13043
|
+
case 86:
|
|
12849
13044
|
this.setState({
|
|
12850
13045
|
hideIntroOverride: true
|
|
12851
13046
|
}, /*#__PURE__*/(0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
|
|
@@ -12883,14 +13078,14 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12883
13078
|
}
|
|
12884
13079
|
}, _callee);
|
|
12885
13080
|
})));
|
|
12886
|
-
_context3.next =
|
|
13081
|
+
_context3.next = 89;
|
|
12887
13082
|
return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
|
|
12888
13083
|
|
|
12889
|
-
case
|
|
13084
|
+
case 89:
|
|
12890
13085
|
localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
|
|
12891
|
-
return _context3.abrupt("break",
|
|
13086
|
+
return _context3.abrupt("break", 91);
|
|
12892
13087
|
|
|
12893
|
-
case
|
|
13088
|
+
case 91:
|
|
12894
13089
|
case "end":
|
|
12895
13090
|
return _context3.stop();
|
|
12896
13091
|
}
|
|
@@ -12989,9 +13184,6 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12989
13184
|
if (!newClient.features.chat_ui_v2) {
|
|
12990
13185
|
(0,services_logger/* log */.c)("Clients on old UI", {
|
|
12991
13186
|
clientHandle: newClient.handle
|
|
12992
|
-
}, {
|
|
12993
|
-
sampleRate: 0.01 // log 1 out of every 100
|
|
12994
|
-
|
|
12995
13187
|
});
|
|
12996
13188
|
}
|
|
12997
13189
|
|
|
@@ -13188,15 +13380,15 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13188
13380
|
}, {
|
|
13189
13381
|
key: "renderIntroFrame",
|
|
13190
13382
|
value: function renderIntroFrame() {
|
|
13191
|
-
var
|
|
13383
|
+
var _client$intro;
|
|
13192
13384
|
|
|
13193
13385
|
var _this$props15 = this.props,
|
|
13194
13386
|
adaSettings = _this$props15.adaSettings,
|
|
13195
|
-
|
|
13387
|
+
client = _this$props15.client;
|
|
13196
13388
|
var parentElement = adaSettings.parentElement;
|
|
13197
13389
|
var hideIntroOverride = this.state.hideIntroOverride;
|
|
13198
13390
|
|
|
13199
|
-
if (parentElement || (
|
|
13391
|
+
if (parentElement || (client === null || client === void 0 ? void 0 : (_client$intro = client.intro) === null || _client$intro === void 0 ? void 0 : _client$intro.style.toLocaleLowerCase()) !== "text" || hideIntroOverride || // This avoids intros and campaigns being shown at the same time
|
|
13200
13392
|
this.shouldRenderChatFrame) {
|
|
13201
13393
|
return null;
|
|
13202
13394
|
}
|
|
@@ -13317,7 +13509,6 @@ function Container_mapStateToProps(storeState) {
|
|
|
13317
13509
|
isChatWebsocketConnected: isChatWebsocketConnected,
|
|
13318
13510
|
isDrawerOpen: isDrawerOpen,
|
|
13319
13511
|
chatterToken: chatterToken,
|
|
13320
|
-
intro: client === null || client === void 0 ? void 0 : client.intro,
|
|
13321
13512
|
appConnectionState: appConnectionState,
|
|
13322
13513
|
drawerHasBeenOpened: drawerHasBeenOpened,
|
|
13323
13514
|
chatterInLiveChat: chatterInLiveChat,
|
|
@@ -13887,7 +14078,7 @@ window.__AdaEmbedConstructor = Embed;
|
|
|
13887
14078
|
/* harmony export */ });
|
|
13888
14079
|
var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(14|(1[5-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(92|(9[3-9]|\\d{3,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(14|(1[5-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
|
|
13889
14080
|
var isProduction = "production" === "production";
|
|
13890
|
-
var embed2Version = "
|
|
14081
|
+
var embed2Version = "64cd4d3";
|
|
13891
14082
|
|
|
13892
14083
|
/***/ }),
|
|
13893
14084
|
|
|
@@ -14175,12 +14366,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14175
14366
|
|
|
14176
14367
|
|
|
14177
14368
|
|
|
14178
|
-
var DEFAULT_LOG_SAMPLE_RATE = 0.1
|
|
14369
|
+
var DEFAULT_LOG_SAMPLE_RATE = 0.01; // 1% of logs will go through
|
|
14370
|
+
|
|
14179
14371
|
var DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
14180
14372
|
var DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1";
|
|
14181
14373
|
|
|
14182
14374
|
var shouldLog = function shouldLog(sampleRate) {
|
|
14183
|
-
if (!DD_TOKEN || sampleRate
|
|
14375
|
+
if (!DD_TOKEN || sampleRate !== undefined && sampleRate <= 0) {
|
|
14184
14376
|
return false;
|
|
14185
14377
|
}
|
|
14186
14378
|
|
|
@@ -14216,7 +14408,12 @@ function _log() {
|
|
|
14216
14408
|
body: _babel_runtime_corejs3_core_js_stable_json_stringify__WEBPACK_IMPORTED_MODULE_8___default()(_objectSpread(_objectSpread({
|
|
14217
14409
|
message: message
|
|
14218
14410
|
}, extra), {}, {
|
|
14219
|
-
|
|
14411
|
+
service: "embed",
|
|
14412
|
+
env: "production",
|
|
14413
|
+
embedVersion: 2,
|
|
14414
|
+
version: "1.0.50",
|
|
14415
|
+
isNpm: true,
|
|
14416
|
+
commitHash: "64cd4d3"
|
|
14220
14417
|
}))
|
|
14221
14418
|
});
|
|
14222
14419
|
|
|
@@ -14898,6 +15095,16 @@ var parent = __webpack_require__(1910);
|
|
|
14898
15095
|
module.exports = parent;
|
|
14899
15096
|
|
|
14900
15097
|
|
|
15098
|
+
/***/ }),
|
|
15099
|
+
|
|
15100
|
+
/***/ 4710:
|
|
15101
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
15102
|
+
|
|
15103
|
+
var parent = __webpack_require__(9534);
|
|
15104
|
+
|
|
15105
|
+
module.exports = parent;
|
|
15106
|
+
|
|
15107
|
+
|
|
14901
15108
|
/***/ }),
|
|
14902
15109
|
|
|
14903
15110
|
/***/ 4303:
|
|
@@ -14908,6 +15115,16 @@ var parent = __webpack_require__(6507);
|
|
|
14908
15115
|
module.exports = parent;
|
|
14909
15116
|
|
|
14910
15117
|
|
|
15118
|
+
/***/ }),
|
|
15119
|
+
|
|
15120
|
+
/***/ 3799:
|
|
15121
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
15122
|
+
|
|
15123
|
+
var parent = __webpack_require__(3059);
|
|
15124
|
+
|
|
15125
|
+
module.exports = parent;
|
|
15126
|
+
|
|
15127
|
+
|
|
14911
15128
|
/***/ }),
|
|
14912
15129
|
|
|
14913
15130
|
/***/ 5122:
|
|
@@ -23660,8 +23877,8 @@ function _loadEmbed() {
|
|
|
23660
23877
|
while (1) {
|
|
23661
23878
|
switch (_context18.prev = _context18.next) {
|
|
23662
23879
|
case 0:
|
|
23663
|
-
if (adaSettings
|
|
23664
|
-
embedScriptSource = config_info/* isModern */.pX ? adaSettings
|
|
23880
|
+
if (adaSettings.customDomains) {
|
|
23881
|
+
embedScriptSource = config_info/* isModern */.pX ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
|
|
23665
23882
|
} else {
|
|
23666
23883
|
if (config_info/* isProduction */.yv) {
|
|
23667
23884
|
host = "https://static.ada.support";
|
|
@@ -23671,7 +23888,7 @@ function _loadEmbed() {
|
|
|
23671
23888
|
polyfillVersionString = "legacy";
|
|
23672
23889
|
}
|
|
23673
23890
|
|
|
23674
|
-
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "
|
|
23891
|
+
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "64cd4d3", "/index.js");
|
|
23675
23892
|
}
|
|
23676
23893
|
|
|
23677
23894
|
clientScriptExists = Boolean( true || // The client script is bundled with npm module
|
|
@@ -23776,7 +23993,7 @@ function createEmbedObject() {
|
|
|
23776
23993
|
return loadEmbed(adaSettings);
|
|
23777
23994
|
|
|
23778
23995
|
case 5:
|
|
23779
|
-
if (!(adaSettings
|
|
23996
|
+
if (!(adaSettings.customDomains && window.__AdaEmbedConstructor && window.__AdaEmbedConstructor.embed2Version !== config_info/* embed2Version */.Mk)) {
|
|
23780
23997
|
_context2.next = 7;
|
|
23781
23998
|
break;
|
|
23782
23999
|
}
|
|
@@ -23796,15 +24013,8 @@ function createEmbedObject() {
|
|
|
23796
24013
|
startEmbedResolve();
|
|
23797
24014
|
(0,logger/* log */.c)("Embed start", {
|
|
23798
24015
|
handle: adaSettings.handle,
|
|
23799
|
-
embedVersion: 2,
|
|
23800
24016
|
embedSettings: adaSettings,
|
|
23801
|
-
|
|
23802
|
-
isNpm: true,
|
|
23803
|
-
hostPage: window.location.href,
|
|
23804
|
-
commitHash: "b4c1ab7"
|
|
23805
|
-
}, {
|
|
23806
|
-
sampleRate: 0.01 // 1% of logs will go through
|
|
23807
|
-
|
|
24017
|
+
hostPage: window.location.href
|
|
23808
24018
|
});
|
|
23809
24019
|
return _context2.abrupt("return", embed.initialized);
|
|
23810
24020
|
|
|
@@ -24216,7 +24426,7 @@ function createEmbedObject() {
|
|
|
24216
24426
|
}
|
|
24217
24427
|
;// CONCATENATED MODULE: ./src/index-npm.ts
|
|
24218
24428
|
|
|
24219
|
-
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__,
|
|
24429
|
+
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 9136));
|
|
24220
24430
|
/* harmony default export */ var index_npm = (createEmbedObject());
|
|
24221
24431
|
}();
|
|
24222
24432
|
module.exports = __webpack_exports__;
|