@ada-support/embed2 1.0.29 → 1.0.33

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.
@@ -722,7 +722,7 @@ var browserPerformanceTimeOrigin = (function () {
722
722
 
723
723
  /***/ }),
724
724
 
725
- /***/ 8180:
725
+ /***/ 2396:
726
726
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
727
727
 
728
728
  "use strict";
@@ -1738,7 +1738,7 @@ var States;
1738
1738
  * Thenable class that behaves like a Promise and follows it's interface
1739
1739
  * but is not async internally
1740
1740
  */
1741
- var SyncPromise = /** @class */ (function () {
1741
+ var syncpromise_SyncPromise = /** @class */ (function () {
1742
1742
  function SyncPromise(executor) {
1743
1743
  var _this = this;
1744
1744
  this._state = States.PENDING;
@@ -2287,7 +2287,7 @@ var Scope = /** @class */ (function () {
2287
2287
  Scope.prototype._notifyEventProcessors = function (processors, event, hint, index) {
2288
2288
  var _this = this;
2289
2289
  if (index === void 0) { index = 0; }
2290
- return new SyncPromise(function (resolve, reject) {
2290
+ return new syncpromise_SyncPromise(function (resolve, reject) {
2291
2291
  var processor = processors[index];
2292
2292
  if (event === null || typeof processor !== 'function') {
2293
2293
  resolve(event);
@@ -3818,7 +3818,7 @@ function makeMain(hub) {
3818
3818
  * contains a more recent version, it replaces the registered version.
3819
3819
  * Otherwise, the currently registered hub will be returned.
3820
3820
  */
3821
- function getCurrentHub() {
3821
+ function hub_getCurrentHub() {
3822
3822
  // Get main carrier (global for every environment)
3823
3823
  var registry = getMainCarrier();
3824
3824
  // If there's no hub, or its an old API, assign a new one
@@ -3924,7 +3924,7 @@ var InboundFilters = /** @class */ (function () {
3924
3924
  */
3925
3925
  InboundFilters.prototype.setupOnce = function () {
3926
3926
  addGlobalEventProcessor(function (event) {
3927
- var hub = getCurrentHub();
3927
+ var hub = hub_getCurrentHub();
3928
3928
  if (!hub) {
3929
3929
  return event;
3930
3930
  }
@@ -5186,7 +5186,7 @@ function eventFromException(options, exception, hint) {
5186
5186
  if (hint && hint.event_id) {
5187
5187
  event.event_id = hint.event_id;
5188
5188
  }
5189
- return SyncPromise.resolve(event);
5189
+ return syncpromise_SyncPromise.resolve(event);
5190
5190
  }
5191
5191
  /**
5192
5192
  * Builds and Event from a Message
@@ -5202,7 +5202,7 @@ function eventFromMessage(options, message, level, hint) {
5202
5202
  if (hint && hint.event_id) {
5203
5203
  event.event_id = hint.event_id;
5204
5204
  }
5205
- return SyncPromise.resolve(event);
5205
+ return syncpromise_SyncPromise.resolve(event);
5206
5206
  }
5207
5207
  /**
5208
5208
  * @hidden
@@ -5512,7 +5512,7 @@ function callOnHub(method) {
5512
5512
  for (var _i = 1; _i < arguments.length; _i++) {
5513
5513
  args[_i - 1] = arguments[_i];
5514
5514
  }
5515
- var hub = getCurrentHub();
5515
+ var hub = hub_getCurrentHub();
5516
5516
  if (hub && hub[method]) {
5517
5517
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5518
5518
  return hub[method].apply(hub, minimal_node_modules_tslib_tslib_es6_spread(args));
@@ -6172,7 +6172,7 @@ var GlobalHandlers = /** @class */ (function () {
6172
6172
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6173
6173
  callback: function (data) {
6174
6174
  var error = data.error;
6175
- var currentHub = getCurrentHub();
6175
+ var currentHub = hub_getCurrentHub();
6176
6176
  var hasIntegration = currentHub.getIntegration(GlobalHandlers);
6177
6177
  var isFailedOwnDelivery = error && error.__sentry_own_request__ === true;
6178
6178
  if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {
@@ -6226,7 +6226,7 @@ var GlobalHandlers = /** @class */ (function () {
6226
6226
  catch (_oO) {
6227
6227
  // no-empty
6228
6228
  }
6229
- var currentHub = getCurrentHub();
6229
+ var currentHub = hub_getCurrentHub();
6230
6230
  var hasIntegration = currentHub.getIntegration(GlobalHandlers);
6231
6231
  var isFailedOwnDelivery = error && error.__sentry_own_request__ === true;
6232
6232
  if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {
@@ -6588,7 +6588,7 @@ var Breadcrumbs = /** @class */ (function () {
6588
6588
  if (!this._options.sentry) {
6589
6589
  return;
6590
6590
  }
6591
- getCurrentHub().addBreadcrumb({
6591
+ hub_getCurrentHub().addBreadcrumb({
6592
6592
  category: "sentry." + (event.type === 'transaction' ? 'transaction' : 'event'),
6593
6593
  event_id: event.event_id,
6594
6594
  level: event.level,
@@ -6692,7 +6692,7 @@ var Breadcrumbs = /** @class */ (function () {
6692
6692
  return;
6693
6693
  }
6694
6694
  }
6695
- getCurrentHub().addBreadcrumb(breadcrumb, {
6695
+ hub_getCurrentHub().addBreadcrumb(breadcrumb, {
6696
6696
  input: handlerData.args,
6697
6697
  level: handlerData.level,
6698
6698
  });
@@ -6719,7 +6719,7 @@ var Breadcrumbs = /** @class */ (function () {
6719
6719
  if (target.length === 0) {
6720
6720
  return;
6721
6721
  }
6722
- getCurrentHub().addBreadcrumb({
6722
+ hub_getCurrentHub().addBreadcrumb({
6723
6723
  category: "ui." + handlerData.name,
6724
6724
  message: target,
6725
6725
  }, {
@@ -6739,7 +6739,7 @@ var Breadcrumbs = /** @class */ (function () {
6739
6739
  return;
6740
6740
  }
6741
6741
  var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
6742
- getCurrentHub().addBreadcrumb({
6742
+ hub_getCurrentHub().addBreadcrumb({
6743
6743
  category: 'xhr',
6744
6744
  data: {
6745
6745
  method: method,
@@ -6768,7 +6768,7 @@ var Breadcrumbs = /** @class */ (function () {
6768
6768
  return;
6769
6769
  }
6770
6770
  if (handlerData.error) {
6771
- getCurrentHub().addBreadcrumb({
6771
+ hub_getCurrentHub().addBreadcrumb({
6772
6772
  category: 'fetch',
6773
6773
  data: handlerData.fetchData,
6774
6774
  level: Severity.Error,
@@ -6779,7 +6779,7 @@ var Breadcrumbs = /** @class */ (function () {
6779
6779
  });
6780
6780
  }
6781
6781
  else {
6782
- getCurrentHub().addBreadcrumb({
6782
+ hub_getCurrentHub().addBreadcrumb({
6783
6783
  category: 'fetch',
6784
6784
  data: tslib_es6_assign(tslib_es6_assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
6785
6785
  type: 'http',
@@ -6812,7 +6812,7 @@ var Breadcrumbs = /** @class */ (function () {
6812
6812
  if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
6813
6813
  from = parsedFrom.relative;
6814
6814
  }
6815
- getCurrentHub().addBreadcrumb({
6815
+ hub_getCurrentHub().addBreadcrumb({
6816
6816
  category: 'navigation',
6817
6817
  data: {
6818
6818
  from: from,
@@ -6855,7 +6855,7 @@ var LinkedErrors = /** @class */ (function () {
6855
6855
  */
6856
6856
  LinkedErrors.prototype.setupOnce = function () {
6857
6857
  addGlobalEventProcessor(function (event, hint) {
6858
- var self = getCurrentHub().getIntegration(LinkedErrors);
6858
+ var self = hub_getCurrentHub().getIntegration(LinkedErrors);
6859
6859
  if (self) {
6860
6860
  var handler = self._handler && self._handler.bind(self);
6861
6861
  return typeof handler === 'function' ? handler(event, hint) : event;
@@ -6913,7 +6913,7 @@ var UserAgent = /** @class */ (function () {
6913
6913
  UserAgent.prototype.setupOnce = function () {
6914
6914
  addGlobalEventProcessor(function (event) {
6915
6915
  var _a, _b, _c;
6916
- if (getCurrentHub().getIntegration(UserAgent)) {
6916
+ if (hub_getCurrentHub().getIntegration(UserAgent)) {
6917
6917
  // if none of the information we want exists, don't bother
6918
6918
  if (!useragent_global.navigator && !useragent_global.location && !useragent_global.document) {
6919
6919
  return event;
@@ -7176,7 +7176,7 @@ function setupIntegration(integration) {
7176
7176
  if (installedIntegrations.indexOf(integration.name) !== -1) {
7177
7177
  return;
7178
7178
  }
7179
- integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
7179
+ integration.setupOnce(addGlobalEventProcessor, hub_getCurrentHub);
7180
7180
  installedIntegrations.push(integration.name);
7181
7181
  logger_logger.log("Integration installed: " + integration.name);
7182
7182
  }
@@ -7420,7 +7420,7 @@ var BaseClient = /** @class */ (function () {
7420
7420
  */
7421
7421
  BaseClient.prototype._isClientDoneProcessing = function (timeout) {
7422
7422
  var _this = this;
7423
- return new SyncPromise(function (resolve) {
7423
+ return new syncpromise_SyncPromise(function (resolve) {
7424
7424
  var ticked = 0;
7425
7425
  var tick = 1;
7426
7426
  var interval = setInterval(function () {
@@ -7473,7 +7473,7 @@ var BaseClient = /** @class */ (function () {
7473
7473
  finalScope = Scope.clone(finalScope).update(hint.captureContext);
7474
7474
  }
7475
7475
  // We prepare the result here with a resolved Event.
7476
- var result = SyncPromise.resolve(prepared);
7476
+ var result = syncpromise_SyncPromise.resolve(prepared);
7477
7477
  // This should be the last thing called, since we want that
7478
7478
  // {@link Hub.addEventProcessor} gets the finished prepared event.
7479
7479
  if (finalScope) {
@@ -7609,14 +7609,14 @@ var BaseClient = /** @class */ (function () {
7609
7609
  // eslint-disable-next-line @typescript-eslint/unbound-method
7610
7610
  var _a = this.getOptions(), beforeSend = _a.beforeSend, sampleRate = _a.sampleRate;
7611
7611
  if (!this._isEnabled()) {
7612
- return SyncPromise.reject(new SentryError('SDK not enabled, will not capture event.'));
7612
+ return syncpromise_SyncPromise.reject(new SentryError('SDK not enabled, will not capture event.'));
7613
7613
  }
7614
7614
  var isTransaction = event.type === 'transaction';
7615
7615
  // 1.0 === 100% events are sent
7616
7616
  // 0.0 === 0% events are sent
7617
7617
  // Sampling for transaction happens somewhere else
7618
7618
  if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {
7619
- return SyncPromise.reject(new SentryError("Discarding event because it's not included in the random sample (sampling rate = " + sampleRate + ")"));
7619
+ return syncpromise_SyncPromise.reject(new SentryError("Discarding event because it's not included in the random sample (sampling rate = " + sampleRate + ")"));
7620
7620
  }
7621
7621
  return this._prepareEvent(event, scope, hint)
7622
7622
  .then(function (prepared) {
@@ -7747,7 +7747,7 @@ var NoopTransport = /** @class */ (function () {
7747
7747
  * @inheritDoc
7748
7748
  */
7749
7749
  NoopTransport.prototype.sendEvent = function (_) {
7750
- return SyncPromise.resolve({
7750
+ return syncpromise_SyncPromise.resolve({
7751
7751
  reason: "NoopTransport: Event has been skipped because no Dsn is configured.",
7752
7752
  status: Status.Skipped,
7753
7753
  });
@@ -7756,7 +7756,7 @@ var NoopTransport = /** @class */ (function () {
7756
7756
  * @inheritDoc
7757
7757
  */
7758
7758
  NoopTransport.prototype.close = function (_) {
7759
- return SyncPromise.resolve(true);
7759
+ return syncpromise_SyncPromise.resolve(true);
7760
7760
  };
7761
7761
  return NoopTransport;
7762
7762
  }());
@@ -7937,7 +7937,7 @@ var PromiseBuffer = /** @class */ (function () {
7937
7937
  PromiseBuffer.prototype.add = function (taskProducer) {
7938
7938
  var _this = this;
7939
7939
  if (!this.isReady()) {
7940
- return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));
7940
+ return syncpromise_SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));
7941
7941
  }
7942
7942
  // start the task and add its promise to the queue
7943
7943
  var task = taskProducer();
@@ -7983,7 +7983,7 @@ var PromiseBuffer = /** @class */ (function () {
7983
7983
  */
7984
7984
  PromiseBuffer.prototype.drain = function (timeout) {
7985
7985
  var _this = this;
7986
- return new SyncPromise(function (resolve) {
7986
+ return new syncpromise_SyncPromise(function (resolve) {
7987
7987
  // wait for `timeout` ms and then resolve to `false` (if not cancelled first)
7988
7988
  var capturedSetTimeout = setTimeout(function () {
7989
7989
  if (timeout && timeout > 0) {
@@ -7991,7 +7991,7 @@ var PromiseBuffer = /** @class */ (function () {
7991
7991
  }
7992
7992
  }, timeout);
7993
7993
  // if all promises resolve in time, cancel the timer and resolve to `true`
7994
- void SyncPromise.all(_this._buffer)
7994
+ void syncpromise_SyncPromise.all(_this._buffer)
7995
7995
  .then(function () {
7996
7996
  clearTimeout(capturedSetTimeout);
7997
7997
  resolve(true);
@@ -8253,7 +8253,7 @@ var FetchTransport = /** @class */ (function (_super) {
8253
8253
  options.headers = this.options.headers;
8254
8254
  }
8255
8255
  return this._buffer.add(function () {
8256
- return new SyncPromise(function (resolve, reject) {
8256
+ return new syncpromise_SyncPromise(function (resolve, reject) {
8257
8257
  void _this._fetch(sentryRequest.url, options)
8258
8258
  .then(function (response) {
8259
8259
  var headers = {
@@ -8314,7 +8314,7 @@ var XHRTransport = /** @class */ (function (_super) {
8314
8314
  });
8315
8315
  }
8316
8316
  return this._buffer.add(function () {
8317
- return new SyncPromise(function (resolve, reject) {
8317
+ return new syncpromise_SyncPromise(function (resolve, reject) {
8318
8318
  var request = new XMLHttpRequest();
8319
8319
  request.onreadystatechange = function () {
8320
8320
  if (request.readyState === 4) {
@@ -8492,7 +8492,7 @@ var client = new error_tracker_BrowserClient({
8492
8492
  return event;
8493
8493
  },
8494
8494
  environment: "production",
8495
- release: "cc93ef46a28aaae279edd93ba7fe028f52a19dae",
8495
+ release: "d8793bab7e9f4d33dc03840b7e8b322dd7e4cff9",
8496
8496
  sampleRate: 0.25,
8497
8497
  autoSessionTracking: false,
8498
8498
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -8778,7 +8778,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !(c
8778
8778
 
8779
8779
 
8780
8780
 
8781
-
8782
8781
  /**
8783
8782
  * Frame Channel: Used for postMessage communication between iFrames.
8784
8783
  * NOTE: iFrames must have the same domain - when postMessages are sent between
@@ -8843,7 +8842,6 @@ var FC = /*#__PURE__*/function (_Channel) {
8843
8842
  parsedData = JSON.parse(event.data);
8844
8843
  }
8845
8844
  } catch (_unused) {
8846
- (0,errors/* warn */.Z)("postMessage not sent as JSON.");
8847
8845
  return;
8848
8846
  }
8849
8847
 
@@ -8868,7 +8866,7 @@ var FC = /*#__PURE__*/function (_Channel) {
8868
8866
  key: "constructObjectToSend",
8869
8867
  value: function constructObjectToSend() {
8870
8868
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
8871
- var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8869
+ var payload = arguments.length > 1 ? arguments[1] : undefined;
8872
8870
  var id = arguments.length > 2 ? arguments[2] : undefined;
8873
8871
  var status = arguments.length > 3 ? arguments[3] : undefined;
8874
8872
  // IE passes event message data as a string, so we normalize to string for all objects
@@ -9023,7 +9021,7 @@ var CE = /*#__PURE__*/function (_Channel) {
9023
9021
  // (for all browsers)
9024
9022
  return {
9025
9023
  type: type || "",
9026
- payload: payload || {},
9024
+ payload: payload,
9027
9025
  id: id,
9028
9026
  status: status
9029
9027
  };
@@ -9178,7 +9176,7 @@ function getEmbedURL(_ref) {
9178
9176
  polyfillVersionString = "legacy";
9179
9177
  }
9180
9178
 
9181
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "cc93ef4", "/index.html");
9179
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "d8793ba", "/index.html");
9182
9180
  }
9183
9181
  /**
9184
9182
  * Generate the Chat / API URL
@@ -9215,18 +9213,26 @@ function getURL(_ref2) {
9215
9213
  }
9216
9214
 
9217
9215
  if (includes_default()(_context17 = window.location.hostname).call(_context17, "localhost") || handle === "e2ereference") {
9218
- var _context18, _context19, _context20, _context21;
9216
+ var _context18, _context23, _context24, _context25;
9219
9217
 
9220
9218
  var host = window.location.hostname;
9221
9219
  var domainName = includes_default()(_context18 = window.location.hostname).call(_context18, "localhost") ? "localhost" : "e2ereference";
9222
9220
 
9221
+ if (domainName === "localhost" && name === "chat") {
9222
+ var _context19, _context20, _context21, _context22;
9223
+
9224
+ // Chat should be on a different domain (even though the port is different).
9225
+ // We need this to test Embed+Chat behaviour when third-party cookies are disabled (incognito mode).
9226
+ return concat_default()(_context19 = concat_default()(_context20 = concat_default()(_context21 = concat_default()(_context22 = "".concat(window.location.protocol, "//")).call(_context22, handle, ".chat:8002/")).call(_context21, routeString)).call(_context20, questionSym)).call(_context19, queryString);
9227
+ }
9228
+
9223
9229
  if (name === "api" || name === "chat") {
9224
9230
  host += ":".concat(ports[domainName][name]);
9225
9231
  } else {
9226
9232
  host += ":".concat(ports[domainName].default);
9227
9233
  }
9228
9234
 
9229
- return concat_default()(_context19 = concat_default()(_context20 = concat_default()(_context21 = "http://".concat(host, "/")).call(_context21, routeString)).call(_context20, questionSym)).call(_context19, queryString);
9235
+ return concat_default()(_context23 = concat_default()(_context24 = concat_default()(_context25 = "http://".concat(host, "/")).call(_context25, routeString)).call(_context24, questionSym)).call(_context23, queryString);
9230
9236
  }
9231
9237
 
9232
9238
  return prodUrl;
@@ -9319,165 +9325,839 @@ var actions = {
9319
9325
  }
9320
9326
  };
9321
9327
  /* harmony default export */ var store_actions = (actions);
9322
- ;// CONCATENATED MODULE: ./src/client/store/mutations/index.ts
9328
+ ;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
9329
+ var CHATTER_TOKEN_STORAGE_KEY = "chatter";
9330
+ var CHATTER_CREATED_STORAGE_KEY = "ada-embed_chatter-created";
9331
+ var IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
9332
+ var ZD_SESSION_STORAGE_KEY = "ada-embed_zd-session-id";
9333
+ var ZD_PREVIOUS_TAGS_STORAGE_KEY = "ada-embed_zd-previous-tags";
9334
+ /** @deprecated - Use CHATTER_TOKEN_STORAGE_KEY */
9323
9335
 
9336
+ var CHATTER_STORAGE_KEY = CHATTER_TOKEN_STORAGE_KEY;
9337
+ ;// CONCATENATED MODULE: ./src/frames/lib/frame-fc.ts
9324
9338
 
9339
+ var frameName = null;
9340
+ /* harmony default export */ var frame_fc = (new FC(frameName, window.parent));
9341
+ ;// CONCATENATED MODULE: ./src/frames/helpers/frame-init.ts
9325
9342
 
9326
9343
 
9327
9344
 
9328
9345
 
9346
+ function initializeFrame() {
9347
+ var waitForOtherFrames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9348
+ var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9329
9349
 
9350
+ if (!waitForOtherFrames) {
9351
+ return promise_default().resolve(true);
9352
+ }
9330
9353
 
9331
- function ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9354
+ return new (promise_default())(function (resolve) {
9355
+ var timeout;
9356
+ var handlerRef;
9357
+
9358
+ var initMessageHandler = function initMessageHandler(type) {
9359
+ if (type === ALL_FRAMES_LOADED) {
9360
+ frame_fc.removeEventListener(handlerRef);
9361
+ clearTimeout(timeout);
9362
+ resolve(true);
9363
+ }
9364
+ };
9332
9365
 
9333
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,defineProperty/* default */.Z)(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { Object.defineProperties(target, get_own_property_descriptors_default()(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
9366
+ timeout = window.setTimeout(function () {
9367
+ frame_fc.removeEventListener(handlerRef);
9368
+ (0,errors/* warn */.Z)("".concat(null, " frame never received all frames loaded"));
9369
+ resolve(false);
9370
+ }, DEFAULT_CONNECTION_TIMEOUT);
9371
+ handlerRef = frame_fc.addEventListener(initMessageHandler);
9372
+ frame_fc.postMessage("".concat(null, "_INIT"), initialState);
9373
+ });
9374
+ }
9375
+ function addCustomStyles(styles, hasUICustomization) {
9376
+ if (!styles) {
9377
+ return;
9378
+ }
9334
9379
 
9380
+ if (!hasUICustomization) {
9381
+ warn("UI Customization is not available in your feature set.");
9382
+ return;
9383
+ }
9335
9384
 
9385
+ var styleSheet = document.createElement("style");
9386
+ styleSheet.type = "text/css";
9387
+ styleSheet.appendChild(document.createTextNode(styles)); // Append the stylesheet to the head of the document
9336
9388
 
9389
+ document.head.appendChild(styleSheet);
9390
+ }
9391
+ ;// CONCATENATED MODULE: ./src/frames/lib/safe-storage/index.ts
9337
9392
 
9338
- var mutations = function mutations(state, action) {
9339
- switch (action.type) {
9340
- case ActionTypes.TOGGLE_CHAT_TYPE:
9341
- {
9342
- var hasChatOpenedAfterProactiveMessagesShown = state.hasChatOpenedAfterProactiveMessagesShown;
9343
9393
 
9344
- if (!state.isDrawerOpen && state.latestCampaignKey && !hasChatOpenedAfterProactiveMessagesShown) {
9345
- hasChatOpenedAfterProactiveMessagesShown = true;
9346
- }
9347
9394
 
9348
- return _objectSpread(_objectSpread({}, state), {}, {
9349
- isDrawerOpen: !state.isDrawerOpen,
9350
- isIntroShown: false,
9351
- drawerHasBeenOpened: true,
9352
- unreadMessageCount: 0,
9353
- hasChatOpenedAfterProactiveMessagesShown: hasChatOpenedAfterProactiveMessagesShown
9354
- });
9355
- }
9356
9395
 
9357
- case ActionTypes.SET_STATE_TYPE:
9358
- return _objectSpread(_objectSpread({}, state), action.payload);
9359
9396
 
9360
- case ActionTypes.INCREMENT_MESSAGE_COUNT_TYPE:
9361
- {
9362
- var messages = action.payload.messages; // Filter out Proactive Messages
9363
9397
 
9364
- var nonProactive = filter_default()(messages).call(messages, function (message) {
9365
- return !message.campaign_key;
9366
- });
9398
+ var StorageTypes;
9367
9399
 
9368
- return _objectSpread(_objectSpread({}, state), {}, {
9369
- unreadMessageCount: nonProactive.length
9370
- });
9400
+ (function (StorageTypes) {
9401
+ StorageTypes["Local"] = "local";
9402
+ StorageTypes["Session"] = "session";
9403
+ })(StorageTypes || (StorageTypes = {}));
9404
+
9405
+ /**
9406
+ * local and session storage can throw exceptions when trying to access them
9407
+ * from the Window object and third-party cookies are disabled. SafeStorage
9408
+ * wraps common Storage methods in try catch blocks.
9409
+ */
9410
+ var SafeStorage = /*#__PURE__*/function () {
9411
+ function SafeStorage(storageType) {
9412
+ (0,classCallCheck/* default */.Z)(this, SafeStorage);
9413
+
9414
+ (0,defineProperty/* default */.Z)(this, "storageType", void 0);
9415
+
9416
+ (0,defineProperty/* default */.Z)(this, "storage", null);
9417
+
9418
+ this.storageType = storageType;
9419
+
9420
+ try {
9421
+ this.storage = storageType === "local" ? window.localStorage : window.sessionStorage;
9422
+ } catch (e) {
9423
+ (0,errors/* warn */.Z)("".concat(this.storageType, "Storage is disabled. This is likely because your browser is blocking third-party cookies."));
9424
+ }
9425
+ } // eslint-disable-next-line class-methods-use-this
9426
+
9427
+
9428
+ _createClass(SafeStorage, [{
9429
+ key: "seralizeItem",
9430
+ value: function seralizeItem(value) {
9431
+ try {
9432
+ return stringify_default()(value);
9433
+ } catch (error) {
9434
+ (0,errors/* warn */.Z)("Attempt to seralize failed: ".concat(error));
9371
9435
  }
9372
9436
 
9373
- case ActionTypes.SET_CONNECTION_STATE_TYPE:
9374
- {
9375
- var newConnections = _objectSpread(_objectSpread({}, state.connections), action.payload);
9437
+ return null;
9438
+ } // eslint-disable-next-line class-methods-use-this
9376
9439
 
9377
- var connectionValues = values_default()(newConnections);
9440
+ }, {
9441
+ key: "deserializeItem",
9442
+ value: function deserializeItem(value) {
9443
+ try {
9444
+ return JSON.parse(value);
9445
+ } catch (error) {
9446
+ (0,errors/* warn */.Z)("Attempt to deserialize failed: ".concat(error));
9447
+ }
9378
9448
 
9379
- var appConnectionState;
9380
- var done = connectionValues.every(function (connectionState) {
9381
- return connectionState === ConnectionState.Done;
9382
- });
9383
- var loading = connectionValues.some(function (connectionState) {
9384
- return connectionState === ConnectionState.Done;
9385
- });
9386
- var failure = connectionValues.some(function (connectionState) {
9387
- return connectionState === ConnectionState.Failure;
9388
- });
9449
+ return null;
9450
+ }
9451
+ }, {
9452
+ key: "getItem",
9453
+ value: function getItem(key) {
9454
+ try {
9455
+ if (!this.storage) {
9456
+ throw new errors/* AdaEmbedError */.S("`storage` is null");
9457
+ }
9389
9458
 
9390
- if (done) {
9391
- appConnectionState = ConnectionState.Done;
9392
- } else if (failure) {
9393
- appConnectionState = ConnectionState.Failure;
9394
- } else if (loading) {
9395
- appConnectionState = ConnectionState.Loading;
9396
- } else {
9397
- appConnectionState = ConnectionState.Uninitiated;
9459
+ return this.deserializeItem(this.storage.getItem(key));
9460
+ } catch (e) {
9461
+ (0,errors/* warn */.Z)("Cannot getItem from ".concat(this.storageType, "Storage."));
9462
+ return null;
9463
+ }
9464
+ }
9465
+ }, {
9466
+ key: "setItem",
9467
+ value: function setItem(key, value) {
9468
+ try {
9469
+ if (!this.storage) {
9470
+ throw new errors/* AdaEmbedError */.S("`storage` is null");
9398
9471
  }
9399
9472
 
9400
- return _objectSpread(_objectSpread({}, state), {}, {
9401
- connections: newConnections,
9402
- appConnectionState: appConnectionState
9403
- });
9473
+ this.storage.setItem(key, this.seralizeItem(value));
9474
+ } catch (e) {
9475
+ (0,errors/* warn */.Z)("Cannot setItem in ".concat(this.storageType, "Storage."));
9404
9476
  }
9477
+ }
9478
+ }, {
9479
+ key: "removeItem",
9480
+ value: function removeItem(key) {
9481
+ try {
9482
+ if (!this.storage) {
9483
+ throw new errors/* AdaEmbedError */.S("`storage` is null");
9484
+ }
9405
9485
 
9406
- default:
9407
- return state;
9408
- }
9409
- };
9486
+ this.storage.removeItem(key);
9487
+ } catch (e) {
9488
+ (0,errors/* warn */.Z)("Cannot removeItem from ".concat(this.storageType, "Storage."));
9489
+ }
9490
+ }
9491
+ }]);
9410
9492
 
9411
- /* harmony default export */ var store_mutations = (mutations);
9412
- ;// CONCATENATED MODULE: ./src/client/helpers/local-notifications/index.ts
9413
- var browserHasNotificationSupport = ("Notification" in window);
9414
- function checkIfUserHasGivenPermission() {
9415
- if (!browserHasNotificationSupport) {
9416
- return false;
9417
- }
9493
+ return SafeStorage;
9494
+ }();
9495
+ var safeLocalStorage = new SafeStorage(StorageTypes.Local);
9496
+ var safeSessionStorage = new SafeStorage(StorageTypes.Session);
9497
+ ;// CONCATENATED MODULE: ./src/frames/helpers/storage/index.ts
9418
9498
 
9419
- return Notification.permission === "granted";
9420
- }
9421
- function requestNotificationPermission() {
9422
- if (!browserHasNotificationSupport) {
9423
- return null;
9424
- }
9499
+ var PERSISTENCE_NORMAL = "normal";
9500
+ var PERSISTENCE_SESSION = "session";
9501
+ /**
9502
+ * Retrieves items from local or session storage, depending on the client's
9503
+ * persistence setting. If privateMode is set, it returns null.
9504
+ */
9425
9505
 
9426
- return Notification.requestPermission();
9427
- }
9428
- function createNotification(title, isChatOpen, onClickHandler, options) {
9429
- if (!checkIfUserHasGivenPermission() || !document.hidden && isChatOpen) {
9506
+ function retrieveStorage(key, client, privateMode) {
9507
+ var persistence = client.persistence;
9508
+
9509
+ if (privateMode) {
9430
9510
  return null;
9431
9511
  }
9432
9512
 
9433
- var notification = new Notification(title, options);
9434
-
9435
- notification.onclick = function () {
9436
- if (onClickHandler) {
9437
- onClickHandler();
9438
- }
9513
+ if (persistence === PERSISTENCE_NORMAL) {
9514
+ return safeLocalStorage.getItem(key);
9515
+ }
9439
9516
 
9440
- notification.close();
9441
- };
9517
+ if (persistence === PERSISTENCE_SESSION) {
9518
+ return safeSessionStorage.getItem(key);
9519
+ }
9442
9520
 
9443
- return notification;
9521
+ return null;
9444
9522
  }
9523
+ ;// CONCATENATED MODULE: ./src/frames/lib/store-proxy.ts
9445
9524
 
9446
- function notificationPermissionGuard(state) {
9447
- if (state === "granted" || state === "denied") {
9448
- return state;
9525
+
9526
+ var store = {
9527
+ get: function get(key) {
9528
+ return frame_fc.fetch(GET_EVENT, GET_RESPONSE_EVENT, {
9529
+ key: key
9530
+ });
9531
+ },
9532
+ getState: function getState() {
9533
+ return frame_fc.fetch(GET_STATE_EVENT, GET_STATE_RESPONSE_EVENT);
9534
+ },
9535
+ dispatch: function dispatch(actionKey, payload) {
9536
+ return frame_fc.fetch(DISPATCH_EVENT, DISPATCH_RESPONSE_EVENT, {
9537
+ actionKey: actionKey,
9538
+ payload: payload
9539
+ });
9540
+ },
9541
+ subscribe: function subscribe(callback) {
9542
+ frame_fc.addEventListener(function (type, payload) {
9543
+ if (type === STATE_CHANGE_EVENT) {
9544
+ callback(payload);
9545
+ }
9546
+ });
9449
9547
  }
9548
+ };
9549
+ ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/sdk.js
9550
+
9450
9551
 
9451
- return "default";
9452
- }
9453
9552
  /**
9454
- * Used to listen for changes in Notification permission state
9553
+ * Internal function to create a new SDK client instance. The client is
9554
+ * installed and then bound to the current scope.
9555
+ *
9556
+ * @param clientClass The client class to instantiate.
9557
+ * @param options Options to pass to the client.
9455
9558
  */
9559
+ function initAndBind(clientClass, options) {
9560
+ var _a;
9561
+ if (options.debug === true) {
9562
+ logger_logger.enable();
9563
+ }
9564
+ var hub = hub_getCurrentHub();
9565
+ (_a = hub.getScope()) === null || _a === void 0 ? void 0 : _a.update(options.initialScope);
9566
+ var client = new clientClass(options);
9567
+ hub.bindClient(client);
9568
+ }
9569
+ //# sourceMappingURL=sdk.js.map
9570
+ ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/sdk.js
9456
9571
 
9457
9572
 
9458
- function notificationPermListener(notificationPermChangeHandler) {
9459
- if (!("permissions" in navigator)) {
9460
- return;
9461
- }
9462
9573
 
9463
- navigator.permissions.query({
9464
- name: "notifications"
9465
- }).then(function (notificationPerm) {
9466
- // eslint-disable-next-line no-param-reassign
9467
- notificationPerm.onchange = function () {
9468
- notificationPermChangeHandler(notificationPermissionGuard(notificationPerm.state));
9469
- };
9470
- });
9471
- }
9472
- ;// CONCATENATED MODULE: ./src/client/store/state.ts
9473
9574
 
9474
9575
 
9475
- var state = {
9476
- handle: undefined,
9477
- styles: undefined,
9478
- domain: undefined,
9479
- cluster: undefined,
9480
- language: undefined,
9576
+
9577
+ var defaultIntegrations = [
9578
+ new InboundFilters(),
9579
+ new FunctionToString(),
9580
+ new TryCatch(),
9581
+ new Breadcrumbs(),
9582
+ new GlobalHandlers(),
9583
+ new LinkedErrors(),
9584
+ new Dedupe(),
9585
+ new UserAgent(),
9586
+ ];
9587
+ /**
9588
+ * The Sentry Browser SDK Client.
9589
+ *
9590
+ * To use this SDK, call the {@link init} function as early as possible when
9591
+ * loading the web page. To set context information or send manual events, use
9592
+ * the provided methods.
9593
+ *
9594
+ * @example
9595
+ *
9596
+ * ```
9597
+ *
9598
+ * import { init } from '@sentry/browser';
9599
+ *
9600
+ * init({
9601
+ * dsn: '__DSN__',
9602
+ * // ...
9603
+ * });
9604
+ * ```
9605
+ *
9606
+ * @example
9607
+ * ```
9608
+ *
9609
+ * import { configureScope } from '@sentry/browser';
9610
+ * configureScope((scope: Scope) => {
9611
+ * scope.setExtra({ battery: 0.7 });
9612
+ * scope.setTag({ user_mode: 'admin' });
9613
+ * scope.setUser({ id: '4711' });
9614
+ * });
9615
+ * ```
9616
+ *
9617
+ * @example
9618
+ * ```
9619
+ *
9620
+ * import { addBreadcrumb } from '@sentry/browser';
9621
+ * addBreadcrumb({
9622
+ * message: 'My Breadcrumb',
9623
+ * // ...
9624
+ * });
9625
+ * ```
9626
+ *
9627
+ * @example
9628
+ *
9629
+ * ```
9630
+ *
9631
+ * import * as Sentry from '@sentry/browser';
9632
+ * Sentry.captureMessage('Hello, world!');
9633
+ * Sentry.captureException(new Error('Good bye'));
9634
+ * Sentry.captureEvent({
9635
+ * message: 'Manual',
9636
+ * stacktrace: [
9637
+ * // ...
9638
+ * ],
9639
+ * });
9640
+ * ```
9641
+ *
9642
+ * @see {@link BrowserOptions} for documentation on configuration options.
9643
+ */
9644
+ function init(options) {
9645
+ if (options === void 0) { options = {}; }
9646
+ if (options.defaultIntegrations === undefined) {
9647
+ options.defaultIntegrations = defaultIntegrations;
9648
+ }
9649
+ if (options.release === undefined) {
9650
+ var window_1 = (0,misc/* getGlobalObject */.Rf)();
9651
+ // This supports the variable that sentry-webpack-plugin injects
9652
+ if (window_1.SENTRY_RELEASE && window_1.SENTRY_RELEASE.id) {
9653
+ options.release = window_1.SENTRY_RELEASE.id;
9654
+ }
9655
+ }
9656
+ if (options.autoSessionTracking === undefined) {
9657
+ options.autoSessionTracking = true;
9658
+ }
9659
+ initAndBind(BrowserClient, options);
9660
+ if (options.autoSessionTracking) {
9661
+ startSessionTracking();
9662
+ }
9663
+ }
9664
+ /**
9665
+ * Present the user with a report dialog.
9666
+ *
9667
+ * @param options Everything is optional, we try to fetch all info need from the global scope.
9668
+ */
9669
+ function showReportDialog(options) {
9670
+ if (options === void 0) { options = {}; }
9671
+ var hub = getCurrentHub();
9672
+ var scope = hub.getScope();
9673
+ if (scope) {
9674
+ options.user = __assign(__assign({}, scope.getUser()), options.user);
9675
+ }
9676
+ if (!options.eventId) {
9677
+ options.eventId = hub.lastEventId();
9678
+ }
9679
+ var client = hub.getClient();
9680
+ if (client) {
9681
+ client.showReportDialog(options);
9682
+ }
9683
+ }
9684
+ /**
9685
+ * This is the getter for lastEventId.
9686
+ *
9687
+ * @returns The last event id of a captured event.
9688
+ */
9689
+ function lastEventId() {
9690
+ return getCurrentHub().lastEventId();
9691
+ }
9692
+ /**
9693
+ * This function is here to be API compatible with the loader.
9694
+ * @hidden
9695
+ */
9696
+ function forceLoad() {
9697
+ // Noop
9698
+ }
9699
+ /**
9700
+ * This function is here to be API compatible with the loader.
9701
+ * @hidden
9702
+ */
9703
+ function onLoad(callback) {
9704
+ callback();
9705
+ }
9706
+ /**
9707
+ * Call `flush()` on the current client, if there is one. See {@link Client.flush}.
9708
+ *
9709
+ * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
9710
+ * the client to wait until all events are sent before resolving the promise.
9711
+ * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
9712
+ * doesn't (or if there's no client defined).
9713
+ */
9714
+ function flush(timeout) {
9715
+ var client = getCurrentHub().getClient();
9716
+ if (client) {
9717
+ return client.flush(timeout);
9718
+ }
9719
+ logger.warn('Cannot flush events. No client defined.');
9720
+ return SyncPromise.resolve(false);
9721
+ }
9722
+ /**
9723
+ * Call `close()` on the current client, if there is one. See {@link Client.close}.
9724
+ *
9725
+ * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
9726
+ * parameter will cause the client to wait until all events are sent before disabling itself.
9727
+ * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
9728
+ * doesn't (or if there's no client defined).
9729
+ */
9730
+ function sdk_close(timeout) {
9731
+ var client = getCurrentHub().getClient();
9732
+ if (client) {
9733
+ return client.close(timeout);
9734
+ }
9735
+ logger.warn('Cannot flush events and disable SDK. No client defined.');
9736
+ return SyncPromise.resolve(false);
9737
+ }
9738
+ /**
9739
+ * Wrap code within a try/catch block so the SDK is able to capture errors.
9740
+ *
9741
+ * @param fn A function to wrap.
9742
+ *
9743
+ * @returns The result of wrapped function call.
9744
+ */
9745
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9746
+ function sdk_wrap(fn) {
9747
+ return internalWrap(fn)();
9748
+ }
9749
+ /**
9750
+ * Enable automatic Session Tracking for the initial page load.
9751
+ */
9752
+ function startSessionTracking() {
9753
+ var window = (0,misc/* getGlobalObject */.Rf)();
9754
+ var document = window.document;
9755
+ if (typeof document === 'undefined') {
9756
+ logger_logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
9757
+ return;
9758
+ }
9759
+ var hub = hub_getCurrentHub();
9760
+ // The only way for this to be false is for there to be a version mismatch between @sentry/browser (>= 6.0.0) and
9761
+ // @sentry/hub (< 5.27.0). In the simple case, there won't ever be such a mismatch, because the two packages are
9762
+ // pinned at the same version in package.json, but there are edge cases where it's possible. See
9763
+ // https://github.com/getsentry/sentry-javascript/issues/3207 and
9764
+ // https://github.com/getsentry/sentry-javascript/issues/3234 and
9765
+ // https://github.com/getsentry/sentry-javascript/issues/3278.
9766
+ if (typeof hub.startSession !== 'function' || typeof hub.captureSession !== 'function') {
9767
+ return;
9768
+ }
9769
+ // The session duration for browser sessions does not track a meaningful
9770
+ // concept that can be used as a metric.
9771
+ // Automatically captured sessions are akin to page views, and thus we
9772
+ // discard their duration.
9773
+ hub.startSession({ ignoreDuration: true });
9774
+ hub.captureSession();
9775
+ // We want to create a session for every navigation as well
9776
+ addInstrumentationHandler({
9777
+ callback: function (_a) {
9778
+ var from = _a.from, to = _a.to;
9779
+ // Don't create an additional session for the initial route or if the location did not change
9780
+ if (from === undefined || from === to) {
9781
+ return;
9782
+ }
9783
+ hub.startSession({ ignoreDuration: true });
9784
+ hub.captureSession();
9785
+ },
9786
+ type: 'history',
9787
+ });
9788
+ }
9789
+ //# sourceMappingURL=sdk.js.map
9790
+ ;// CONCATENATED MODULE: ./src/frames/lib/error-tracker.ts
9791
+ var _window$location$host;
9792
+
9793
+
9794
+
9795
+ var IGNORED_ERRORS = [// This error most likely comes from a browser extension
9796
+ /ceCurrentVideo\.currentTime/];
9797
+ init({
9798
+ dsn: null,
9799
+ environment: "production",
9800
+ release: "d8793bab7e9f4d33dc03840b7e8b322dd7e4cff9",
9801
+ ignoreErrors: IGNORED_ERRORS,
9802
+ tracesSampleRate: 0.1,
9803
+ autoSessionTracking: false
9804
+ });
9805
+ setTag("client", (_window$location$host = window.location.hostname) === null || _window$location$host === void 0 ? void 0 : _window$location$host.split(".")[0]);
9806
+ setTag("Embed2 Component", null);
9807
+ var error_tracker_errorTracker = {
9808
+ trackException: function trackException(error) {
9809
+ (0,errors/* warn */.Z)(error.message);
9810
+ captureException(error);
9811
+ },
9812
+ addBreadCrumb: function addBreadCrumb(category, message, data) {
9813
+ var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Severity.Info;
9814
+ addBreadcrumb({
9815
+ category: category,
9816
+ message: message,
9817
+ data: data,
9818
+ level: level
9819
+ });
9820
+ }
9821
+ };
9822
+ /* harmony default export */ var lib_error_tracker = ((/* unused pure expression or super */ null && (error_tracker_errorTracker)));
9823
+ ;// CONCATENATED MODULE: ./src/frames/components/x-storage/index.ts
9824
+
9825
+
9826
+
9827
+
9828
+
9829
+
9830
+
9831
+
9832
+
9833
+
9834
+
9835
+ var LIVE_CHAT_PENDING_STORAGE_KEY = "liveChatPending";
9836
+ var IS_DRAWER_OPEN_STORAGE_KEY = "ada-embed_is-drawer-open";
9837
+ var lastDrawerState;
9838
+ /**
9839
+ * NOTE: If you import this file into any other file
9840
+ * it will trigger the init() function below - may cause errors!
9841
+ */
9842
+
9843
+ /**
9844
+ * Auto-opens the chat door if crossWindowPersistence is one, the chatter is in
9845
+ * a live chat, and if the drawer was previously opened.
9846
+ */
9847
+
9848
+ function setIsDrawerOpen() {
9849
+ return _setIsDrawerOpen.apply(this, arguments);
9850
+ }
9851
+ /**
9852
+ * Retrieves the chatter token from storage.
9853
+ */
9854
+
9855
+ function _setIsDrawerOpen() {
9856
+ _setIsDrawerOpen = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2() {
9857
+ var _yield$store$getState, crossWindowPersistence, client, privateMode, isDrawerOpen, liveChatPending, inLiveChat, liveChatActive;
9858
+
9859
+ return regenerator_default().wrap(function _callee2$(_context2) {
9860
+ while (1) {
9861
+ switch (_context2.prev = _context2.next) {
9862
+ case 0:
9863
+ _context2.next = 2;
9864
+ return store.getState();
9865
+
9866
+ case 2:
9867
+ _yield$store$getState = _context2.sent;
9868
+ crossWindowPersistence = _yield$store$getState.crossWindowPersistence;
9869
+ client = _yield$store$getState.client;
9870
+ privateMode = _yield$store$getState.privateMode;
9871
+ isDrawerOpen = safeSessionStorage.getItem(IS_DRAWER_OPEN_STORAGE_KEY);
9872
+ liveChatPending = retrieveStorage(LIVE_CHAT_PENDING_STORAGE_KEY, client, privateMode);
9873
+ inLiveChat = retrieveStorage(IN_LIVE_CHAT_STORAGE_KEY, client, privateMode);
9874
+ liveChatActive = inLiveChat || liveChatPending;
9875
+
9876
+ if (crossWindowPersistence && isDrawerOpen && liveChatActive) {
9877
+ store.dispatch(ActionCreators.TOGGLE_CHAT_ACTION);
9878
+ }
9879
+
9880
+ case 11:
9881
+ case "end":
9882
+ return _context2.stop();
9883
+ }
9884
+ }
9885
+ }, _callee2);
9886
+ }));
9887
+ return _setIsDrawerOpen.apply(this, arguments);
9888
+ }
9889
+
9890
+ function getChatterFromStorage() {
9891
+ return _getChatterFromStorage.apply(this, arguments);
9892
+ }
9893
+ /**
9894
+ * Initialization
9895
+ */
9896
+
9897
+
9898
+ function _getChatterFromStorage() {
9899
+ _getChatterFromStorage = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee3() {
9900
+ var _yield$store$getState2, privateMode, client;
9901
+
9902
+ return regenerator_default().wrap(function _callee3$(_context3) {
9903
+ while (1) {
9904
+ switch (_context3.prev = _context3.next) {
9905
+ case 0:
9906
+ _context3.next = 2;
9907
+ return store.getState();
9908
+
9909
+ case 2:
9910
+ _yield$store$getState2 = _context3.sent;
9911
+ privateMode = _yield$store$getState2.privateMode;
9912
+ client = _yield$store$getState2.client;
9913
+ return _context3.abrupt("return", retrieveStorage(CHATTER_STORAGE_KEY, client, Boolean(privateMode)));
9914
+
9915
+ case 6:
9916
+ case "end":
9917
+ return _context3.stop();
9918
+ }
9919
+ }
9920
+ }, _callee3);
9921
+ }));
9922
+ return _getChatterFromStorage.apply(this, arguments);
9923
+ }
9924
+
9925
+ (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
9926
+ var chatterFromStorage, frameInitialized;
9927
+ return regenerator_default().wrap(function _callee$(_context) {
9928
+ while (1) {
9929
+ switch (_context.prev = _context.next) {
9930
+ case 0:
9931
+ _context.next = 2;
9932
+ return getChatterFromStorage();
9933
+
9934
+ case 2:
9935
+ chatterFromStorage = _context.sent;
9936
+ _context.next = 5;
9937
+ return initializeFrame(true, {
9938
+ chatterToken: chatterFromStorage || undefined
9939
+ });
9940
+
9941
+ case 5:
9942
+ frameInitialized = _context.sent;
9943
+
9944
+ if (frameInitialized) {
9945
+ _context.next = 8;
9946
+ break;
9947
+ }
9948
+
9949
+ return _context.abrupt("return");
9950
+
9951
+ case 8:
9952
+ setIsDrawerOpen();
9953
+ /**
9954
+ * Listen for FC events
9955
+ */
9956
+
9957
+ frame_fc.addEventListener(function (type) {
9958
+ switch (type) {
9959
+ case DELETE_HISTORY_EVENT:
9960
+ {
9961
+ safeLocalStorage.removeItem(CHATTER_STORAGE_KEY);
9962
+ safeSessionStorage.removeItem(CHATTER_STORAGE_KEY);
9963
+ safeLocalStorage.removeItem(IN_LIVE_CHAT_STORAGE_KEY);
9964
+ safeSessionStorage.removeItem(IN_LIVE_CHAT_STORAGE_KEY);
9965
+ break;
9966
+ }
9967
+
9968
+ default:
9969
+ break;
9970
+ }
9971
+ });
9972
+ /**
9973
+ * Listen for store changes
9974
+ */
9975
+
9976
+ store.subscribe(function (state) {
9977
+ /**
9978
+ * Store isDrawerOpen state in sessionStorage if crossWindowPersistence is enabled
9979
+ */
9980
+ if (state.isDrawerOpen !== lastDrawerState && state.crossWindowPersistence) {
9981
+ safeSessionStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, state.isDrawerOpen);
9982
+ }
9983
+ });
9984
+
9985
+ case 11:
9986
+ case "end":
9987
+ return _context.stop();
9988
+ }
9989
+ }
9990
+ }, _callee);
9991
+ }))();
9992
+ ;// CONCATENATED MODULE: ./src/client/store/mutations/index.ts
9993
+
9994
+
9995
+
9996
+
9997
+
9998
+
9999
+
10000
+
10001
+ function ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
10002
+
10003
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,defineProperty/* default */.Z)(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { Object.defineProperties(target, get_own_property_descriptors_default()(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
10004
+
10005
+
10006
+
10007
+
10008
+
10009
+
10010
+ var mutations = function mutations(state, action) {
10011
+ switch (action.type) {
10012
+ case ActionTypes.TOGGLE_CHAT_TYPE:
10013
+ {
10014
+ var hasChatOpenedAfterProactiveMessagesShown = state.hasChatOpenedAfterProactiveMessagesShown;
10015
+
10016
+ if (!state.isDrawerOpen && state.latestCampaignKey && !hasChatOpenedAfterProactiveMessagesShown) {
10017
+ hasChatOpenedAfterProactiveMessagesShown = true;
10018
+ }
10019
+
10020
+ safeLocalStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, !state.isDrawerOpen);
10021
+ return _objectSpread(_objectSpread({}, state), {}, {
10022
+ isDrawerOpen: !state.isDrawerOpen,
10023
+ isIntroShown: false,
10024
+ drawerHasBeenOpened: true,
10025
+ unreadMessageCount: 0,
10026
+ hasChatOpenedAfterProactiveMessagesShown: hasChatOpenedAfterProactiveMessagesShown
10027
+ });
10028
+ }
10029
+
10030
+ case ActionTypes.SET_STATE_TYPE:
10031
+ return _objectSpread(_objectSpread({}, state), action.payload);
10032
+
10033
+ case ActionTypes.INCREMENT_MESSAGE_COUNT_TYPE:
10034
+ {
10035
+ var messages = action.payload.messages; // Filter out Proactive Messages
10036
+
10037
+ var nonProactive = filter_default()(messages).call(messages, function (message) {
10038
+ return !message.campaign_key;
10039
+ });
10040
+
10041
+ return _objectSpread(_objectSpread({}, state), {}, {
10042
+ unreadMessageCount: nonProactive.length
10043
+ });
10044
+ }
10045
+
10046
+ case ActionTypes.SET_CONNECTION_STATE_TYPE:
10047
+ {
10048
+ var newConnections = _objectSpread(_objectSpread({}, state.connections), action.payload);
10049
+
10050
+ var connectionValues = values_default()(newConnections);
10051
+
10052
+ var appConnectionState;
10053
+ var done = connectionValues.every(function (connectionState) {
10054
+ return connectionState === ConnectionState.Done;
10055
+ });
10056
+ var loading = connectionValues.some(function (connectionState) {
10057
+ return connectionState === ConnectionState.Done;
10058
+ });
10059
+ var failure = connectionValues.some(function (connectionState) {
10060
+ return connectionState === ConnectionState.Failure;
10061
+ });
10062
+
10063
+ if (done) {
10064
+ appConnectionState = ConnectionState.Done;
10065
+ } else if (failure) {
10066
+ appConnectionState = ConnectionState.Failure;
10067
+ } else if (loading) {
10068
+ appConnectionState = ConnectionState.Loading;
10069
+ } else {
10070
+ appConnectionState = ConnectionState.Uninitiated;
10071
+ }
10072
+
10073
+ return _objectSpread(_objectSpread({}, state), {}, {
10074
+ connections: newConnections,
10075
+ appConnectionState: appConnectionState
10076
+ });
10077
+ }
10078
+
10079
+ default:
10080
+ return state;
10081
+ }
10082
+ };
10083
+
10084
+ /* harmony default export */ var store_mutations = (mutations);
10085
+ ;// CONCATENATED MODULE: ./src/client/helpers/local-notifications/index.ts
10086
+ var browserHasNotificationSupport = ("Notification" in window);
10087
+ function checkIfUserHasGivenPermission() {
10088
+ if (!browserHasNotificationSupport) {
10089
+ return false;
10090
+ }
10091
+
10092
+ return Notification.permission === "granted";
10093
+ }
10094
+ function requestNotificationPermission() {
10095
+ if (!browserHasNotificationSupport) {
10096
+ return null;
10097
+ }
10098
+
10099
+ return Notification.requestPermission();
10100
+ }
10101
+ function createNotification(title, isChatOpen, onClickHandler, options) {
10102
+ if (!checkIfUserHasGivenPermission() || !document.hidden && isChatOpen) {
10103
+ return null;
10104
+ }
10105
+
10106
+ var notification = new Notification(title, options);
10107
+
10108
+ notification.onclick = function () {
10109
+ if (onClickHandler) {
10110
+ onClickHandler();
10111
+ }
10112
+
10113
+ notification.close();
10114
+ };
10115
+
10116
+ return notification;
10117
+ }
10118
+
10119
+ function notificationPermissionGuard(state) {
10120
+ if (state === "granted" || state === "denied") {
10121
+ return state;
10122
+ }
10123
+
10124
+ return "default";
10125
+ }
10126
+ /**
10127
+ * Used to listen for changes in Notification permission state
10128
+ */
10129
+
10130
+
10131
+ function notificationPermListener(notificationPermChangeHandler) {
10132
+ if (!("permissions" in navigator)) {
10133
+ return;
10134
+ }
10135
+
10136
+ navigator.permissions.query({
10137
+ name: "notifications"
10138
+ }).then(function (notificationPerm) {
10139
+ // eslint-disable-next-line no-param-reassign
10140
+ notificationPerm.onchange = function () {
10141
+ notificationPermChangeHandler(notificationPermissionGuard(notificationPerm.state));
10142
+ };
10143
+ });
10144
+ }
10145
+ ;// CONCATENATED MODULE: ./src/client/store/state.ts
10146
+
10147
+
10148
+
10149
+
10150
+
10151
+ function getValueFromStorage(key) {
10152
+ return safeLocalStorage.getItem(key) || safeSessionStorage.getItem(key);
10153
+ }
10154
+
10155
+ var state = {
10156
+ handle: undefined,
10157
+ styles: undefined,
10158
+ domain: undefined,
10159
+ cluster: undefined,
10160
+ language: undefined,
9481
10161
  greeting: undefined,
9482
10162
  crossWindowPersistence: true,
9483
10163
  hideMask: true,
@@ -9495,7 +10175,10 @@ var state = {
9495
10175
  initialURL: undefined,
9496
10176
  privateMode: false,
9497
10177
  rolloutOverride: undefined,
9498
- chatterToken: undefined,
10178
+ chatterToken: getValueFromStorage(CHATTER_TOKEN_STORAGE_KEY) || undefined,
10179
+ chatterCreated: getValueFromStorage(CHATTER_CREATED_STORAGE_KEY) || undefined,
10180
+ zdSessionId: getValueFromStorage(ZD_SESSION_STORAGE_KEY) || undefined,
10181
+ zdPreviousTags: getValueFromStorage(ZD_PREVIOUS_TAGS_STORAGE_KEY) || undefined,
9499
10182
  connections: {},
9500
10183
  appConnectionState: ConnectionState.Uninitiated,
9501
10184
  testMode: false,
@@ -9507,7 +10190,8 @@ var state = {
9507
10190
  isChatWebsocketConnected: false,
9508
10191
  latestCampaignKey: undefined,
9509
10192
  hasChatOpenedAfterProactiveMessagesShown: false,
9510
- chatterInLiveChat: false
10193
+ chatterInLiveChat: false,
10194
+ adaSettings: {}
9511
10195
  };
9512
10196
  /* harmony default export */ var store_state = (state);
9513
10197
  ;// CONCATENATED MODULE: ./src/client/store/index.ts
@@ -9871,121 +10555,100 @@ var DEFAULT_LANGUAGE_CODE = "en";
9871
10555
  * I'M SO SORRY.
9872
10556
  */
9873
10557
 
9874
- var getBrowserLanguage = function getBrowserLanguage() {
10558
+ var get_browser_language_getBrowserLanguage = function getBrowserLanguage() {
9875
10559
  return (navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || DEFAULT_LANGUAGE_CODE).split("-")[0];
9876
10560
  };
9877
10561
 
9878
- /* harmony default export */ var get_browser_language = (getBrowserLanguage);
9879
- ;// CONCATENATED MODULE: ./src/frames/lib/safe-storage/index.ts
9880
-
9881
-
9882
-
10562
+ /* harmony default export */ var get_browser_language = (get_browser_language_getBrowserLanguage);
10563
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js
10564
+ var trim = __webpack_require__(5843);
10565
+ var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
10566
+ ;// CONCATENATED MODULE: ./src/common/helpers/get-intro-for-url.ts
9883
10567
 
9884
10568
 
9885
- var StorageTypes;
9886
10569
 
9887
- (function (StorageTypes) {
9888
- StorageTypes["Local"] = "local";
9889
- StorageTypes["Session"] = "session";
9890
- })(StorageTypes || (StorageTypes = {}));
10570
+ var INTRO_STYLE_EMOJI = "Emoji";
10571
+ var INTRO_STYLE_TEXT = "Text";
10572
+ function getProcessedPath(path) {
10573
+ var regex = new RegExp("^http(s)?://(www.)?");
10574
+ return trim_default()(path).call(path).replace(regex, "");
10575
+ }
10576
+ function getPathSearchRegex(path) {
10577
+ var params = path.split("?");
9891
10578
 
9892
- /**
9893
- * local and session storage can throw exceptions when trying to access them
9894
- * from the Window object and third-party cookies are disabled. SafeStorage
9895
- * wraps common Storage methods in try catch blocks.
9896
- */
9897
- var SafeStorage = /*#__PURE__*/function () {
9898
- function SafeStorage(storageType) {
9899
- (0,classCallCheck/* default */.Z)(this, SafeStorage);
10579
+ if (params.length > 1) {
10580
+ var _context;
9900
10581
 
9901
- (0,defineProperty/* default */.Z)(this, "storageType", void 0);
10582
+ var escapedParams = encodeURI(params[1]);
10583
+ return new RegExp(concat_default()(_context = "^".concat(params[0], "\\?")).call(_context, escapedParams, "$"));
10584
+ }
9902
10585
 
9903
- (0,defineProperty/* default */.Z)(this, "storage", null);
10586
+ var newPath = path.replace("*", ".*");
10587
+ return new RegExp("^".concat(newPath, "$"));
10588
+ }
10589
+ function doesUrlMatchPath(url, path) {
10590
+ var processedUrl = getProcessedPath(url);
10591
+ var processedPath = getProcessedPath(path);
10592
+ var pathRegex = getPathSearchRegex(processedPath);
10593
+ var matches = pathRegex.exec(processedUrl);
10594
+ return matches !== null;
10595
+ }
9904
10596
 
9905
- this.storageType = storageType;
10597
+ function findMatchingIntro(intros) {
10598
+ var currentUrl = window.location.href;
9906
10599
 
9907
- try {
9908
- this.storage = storageType === "local" ? window.localStorage : window.sessionStorage;
9909
- } catch (e) {
9910
- (0,errors/* warn */.Z)("".concat(this.storageType, "Storage is disabled. This is likely because your browser is blocking third-party cookies."));
9911
- }
9912
- } // eslint-disable-next-line class-methods-use-this
10600
+ var matchingIntros = filter_default()(intros).call(intros, function (intro) {
10601
+ var _context2;
9913
10602
 
10603
+ var matchingPaths = filter_default()(_context2 = intro.paths).call(_context2, function (path) {
10604
+ return doesUrlMatchPath(currentUrl, path);
10605
+ });
9914
10606
 
9915
- _createClass(SafeStorage, [{
9916
- key: "seralizeItem",
9917
- value: function seralizeItem(value) {
9918
- try {
9919
- return stringify_default()(value);
9920
- } catch (error) {
9921
- (0,errors/* warn */.Z)("Attempt to seralize failed: ".concat(error));
9922
- }
10607
+ return matchingPaths.length > 0;
10608
+ });
9923
10609
 
9924
- return null;
9925
- } // eslint-disable-next-line class-methods-use-this
10610
+ if (matchingIntros.length === 0) {
10611
+ return null;
10612
+ }
9926
10613
 
9927
- }, {
9928
- key: "deserializeItem",
9929
- value: function deserializeItem(value) {
9930
- try {
9931
- return JSON.parse(value);
9932
- } catch (error) {
9933
- (0,errors/* warn */.Z)("Attempt to deserialize failed: ".concat(error));
9934
- }
10614
+ return matchingIntros[0];
10615
+ }
9935
10616
 
9936
- return null;
9937
- }
9938
- }, {
9939
- key: "getItem",
9940
- value: function getItem(key) {
9941
- try {
9942
- if (!this.storage) {
9943
- throw new errors/* AdaEmbedError */.S("`storage` is null");
9944
- }
10617
+ function getIntroForCurrentUrl(intros, language) {
10618
+ var matchingIntro = findMatchingIntro(intros);
9945
10619
 
9946
- return this.deserializeItem(this.storage.getItem(key));
9947
- } catch (e) {
9948
- (0,errors/* warn */.Z)("Cannot getItem from ".concat(this.storageType, "Storage."));
9949
- return null;
9950
- }
9951
- }
9952
- }, {
9953
- key: "setItem",
9954
- value: function setItem(key, value) {
9955
- try {
9956
- if (!this.storage) {
9957
- throw new errors/* AdaEmbedError */.S("`storage` is null");
9958
- }
10620
+ if (!matchingIntro) {
10621
+ return null;
10622
+ }
9959
10623
 
9960
- this.storage.setItem(key, this.seralizeItem(value));
9961
- } catch (e) {
9962
- (0,errors/* warn */.Z)("Cannot setItem in ".concat(this.storageType, "Storage."));
9963
- }
9964
- }
9965
- }, {
9966
- key: "removeItem",
9967
- value: function removeItem(key) {
9968
- try {
9969
- if (!this.storage) {
9970
- throw new errors/* AdaEmbedError */.S("`storage` is null");
9971
- }
10624
+ if (matchingIntro.style === INTRO_STYLE_TEXT) {
10625
+ return {
10626
+ response_id: matchingIntro.response_id,
10627
+ body: matchingIntro.body.message_text[language],
10628
+ style: matchingIntro.style,
10629
+ delay: matchingIntro.delay,
10630
+ duration: matchingIntro.duration
10631
+ };
10632
+ }
9972
10633
 
9973
- this.storage.removeItem(key);
9974
- } catch (e) {
9975
- (0,errors/* warn */.Z)("Cannot removeItem from ".concat(this.storageType, "Storage."));
9976
- }
9977
- }
9978
- }]);
10634
+ if (matchingIntro.style === INTRO_STYLE_EMOJI) {
10635
+ return {
10636
+ response_id: matchingIntro.response_id,
10637
+ body: matchingIntro.body.emoji_link,
10638
+ style: matchingIntro.style,
10639
+ delay: matchingIntro.delay,
10640
+ duration: matchingIntro.duration
10641
+ };
10642
+ }
9979
10643
 
9980
- return SafeStorage;
9981
- }();
9982
- var safeLocalStorage = new SafeStorage(StorageTypes.Local);
9983
- var safeSessionStorage = new SafeStorage(StorageTypes.Session);
10644
+ return null;
10645
+ }
9984
10646
  ;// CONCATENATED MODULE: ./src/campaigns/TriggerConditionEvaluator.ts
9985
10647
 
9986
10648
 
9987
10649
 
9988
10650
 
10651
+
9989
10652
  var TriggerConditionEvaluator_stripTrailingSlash = function stripTrailingSlash(url) {
9990
10653
  return ends_with_default()(url).call(url, "/") ? slice_default()(url).call(url, 0, -1) : url;
9991
10654
  };
@@ -10013,7 +10676,9 @@ var TriggerConditionEvaluator_evalUrlMatchTriggerCondition = function evalUrlMat
10013
10676
  return includes_default()(url).call(url, condition.value);
10014
10677
 
10015
10678
  case "equals":
10016
- return urlWithoutQueryParams === condition.value;
10679
+ {
10680
+ return doesUrlMatchPath(urlWithoutQueryParams, condition.value);
10681
+ }
10017
10682
 
10018
10683
  case "regex":
10019
10684
  {
@@ -10523,92 +11188,6 @@ function bindActionCreators(action, dispatch) {
10523
11188
  return dispatch(action, payload);
10524
11189
  };
10525
11190
  }
10526
- ;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
10527
- var CHATTER_STORAGE_KEY = "chatter";
10528
- var IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
10529
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js
10530
- var trim = __webpack_require__(5843);
10531
- var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
10532
- ;// CONCATENATED MODULE: ./src/common/helpers/get-intro-for-url.ts
10533
-
10534
-
10535
-
10536
- var INTRO_STYLE_EMOJI = "Emoji";
10537
- var INTRO_STYLE_TEXT = "Text";
10538
- function getProcessedPath(path) {
10539
- var regex = new RegExp("^http(s)?://(www.)?");
10540
- return trim_default()(path).call(path).replace(regex, "");
10541
- }
10542
- function getPathSearchRegex(path) {
10543
- var params = path.split("?");
10544
-
10545
- if (params.length > 1) {
10546
- var _context;
10547
-
10548
- var escapedParams = encodeURI(params[1]);
10549
- return new RegExp(concat_default()(_context = "^".concat(params[0], "\\?")).call(_context, escapedParams, "$"));
10550
- }
10551
-
10552
- var newPath = path.replace("*", ".*");
10553
- return new RegExp("^".concat(newPath, "$"));
10554
- }
10555
- function doesUrlMatchPath(url, path) {
10556
- var processedUrl = getProcessedPath(url);
10557
- var processedPath = getProcessedPath(path);
10558
- var pathRegex = getPathSearchRegex(processedPath);
10559
- var matches = pathRegex.exec(processedUrl);
10560
- return matches !== null;
10561
- }
10562
-
10563
- function findMatchingIntro(intros) {
10564
- var currentUrl = window.location.href;
10565
-
10566
- var matchingIntros = filter_default()(intros).call(intros, function (intro) {
10567
- var _context2;
10568
-
10569
- var matchingPaths = filter_default()(_context2 = intro.paths).call(_context2, function (path) {
10570
- return doesUrlMatchPath(currentUrl, path);
10571
- });
10572
-
10573
- return matchingPaths.length > 0;
10574
- });
10575
-
10576
- if (matchingIntros.length === 0) {
10577
- return null;
10578
- }
10579
-
10580
- return matchingIntros[0];
10581
- }
10582
-
10583
- function getIntroForCurrentUrl(intros, language) {
10584
- var matchingIntro = findMatchingIntro(intros);
10585
-
10586
- if (!matchingIntro) {
10587
- return null;
10588
- }
10589
-
10590
- if (matchingIntro.style === INTRO_STYLE_TEXT) {
10591
- return {
10592
- response_id: matchingIntro.response_id,
10593
- body: matchingIntro.body.message_text[language],
10594
- style: matchingIntro.style,
10595
- delay: matchingIntro.delay,
10596
- duration: matchingIntro.duration
10597
- };
10598
- }
10599
-
10600
- if (matchingIntro.style === INTRO_STYLE_EMOJI) {
10601
- return {
10602
- response_id: matchingIntro.response_id,
10603
- body: matchingIntro.body.emoji_link,
10604
- style: matchingIntro.style,
10605
- delay: matchingIntro.delay,
10606
- duration: matchingIntro.duration
10607
- };
10608
- }
10609
-
10610
- return null;
10611
- }
10612
11191
  ;// CONCATENATED MODULE: ./src/common/helpers/fetch-client.ts
10613
11192
 
10614
11193
 
@@ -10720,12 +11299,26 @@ function _fetchClient() {
10720
11299
 
10721
11300
 
10722
11301
  var RTLLanguages = ["ar", "he"];
11302
+ var isRTLLanguage = function isRTLLanguage(language) {
11303
+ return Boolean(language && includes_default()(RTLLanguages).call(RTLLanguages, language)) || false;
11304
+ };
10723
11305
  var isRTL = function isRTL(client, language) {
10724
- var rtlLanguageBool = language && includes_default()(RTLLanguages).call(RTLLanguages, language) || includes_default()(RTLLanguages).call(RTLLanguages, get_browser_language());
10725
-
11306
+ var rtlLanguageBool = isRTLLanguage(language) || isRTLLanguage(getBrowserLanguage());
10726
11307
  var featureFlagsBool = (client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && (client === null || client === void 0 ? void 0 : client.features.rtl_language_support) && (client === null || client === void 0 ? void 0 : client.features.translations);
10727
11308
  return featureFlagsBool && rtlLanguageBool || false;
10728
11309
  };
11310
+ ;// CONCATENATED MODULE: ./src/common/helpers/getAlignment.ts
11311
+
11312
+ function getAlignment(adaSettings) {
11313
+ var language = adaSettings.language,
11314
+ align = adaSettings.align;
11315
+
11316
+ if (align === "auto") {
11317
+ return isRTLLanguage(language) ? "left" : "right";
11318
+ }
11319
+
11320
+ return align || "right";
11321
+ }
10729
11322
  ;// CONCATENATED MODULE: ./src/common/helpers/wait.ts
10730
11323
 
10731
11324
  function wait(ms) {
@@ -10804,32 +11397,6 @@ var INTRO_IFRAME = "intro";
10804
11397
  var BUTTON_IFRAME = "button";
10805
11398
  var MASK_IFRAME = "drawer-mask";
10806
11399
  var XSTORAGE_IFRAME = "x-storage";
10807
- ;// CONCATENATED MODULE: ./src/frames/helpers/storage/index.ts
10808
-
10809
- var PERSISTENCE_NORMAL = "normal";
10810
- var PERSISTENCE_SESSION = "session";
10811
- /**
10812
- * Retrieves items from local or session storage, depending on the client's
10813
- * persistence setting. If privateMode is set, it returns null.
10814
- */
10815
-
10816
- function retrieveStorage(key, client, privateMode) {
10817
- var persistence = client.persistence;
10818
-
10819
- if (privateMode) {
10820
- return null;
10821
- }
10822
-
10823
- if (persistence === PERSISTENCE_NORMAL) {
10824
- return safeLocalStorage.getItem(key);
10825
- }
10826
-
10827
- if (persistence === PERSISTENCE_SESSION) {
10828
- return safeSessionStorage.getItem(key);
10829
- }
10830
-
10831
- return null;
10832
- }
10833
11400
  // EXTERNAL MODULE: ./src/services/logger/index.ts
10834
11401
  var services_logger = __webpack_require__(9517);
10835
11402
  ;// CONCATENATED MODULE: ./src/client/components/IFrame/index.tsx
@@ -11114,36 +11681,38 @@ var ButtonFrame = /*#__PURE__*/function (_Component) {
11114
11681
  buttonSize = _this$props.buttonSize,
11115
11682
  buttonStyle = _this$props.buttonStyle,
11116
11683
  frameWidth = _this$props.frameWidth,
11117
- language = _this$props.language;
11684
+ adaSettings = _this$props.adaSettings;
11118
11685
 
11119
11686
  if (!client) {
11120
11687
  return "";
11121
11688
  }
11122
11689
 
11123
- var delayedIsShown = this.state.delayedIsShown; // 56 = (SHADOW BLUR=48) + (2 * SPREAD=8)
11690
+ var delayedIsShown = this.state.delayedIsShown; // 48 = (SHADOW BLUR=40) + (2 * SPREAD=8)
11124
11691
 
11125
- var BOX_SHADOW_BUFFER = client.features.chat_ui_v2 ? 56 : 8;
11692
+ var BOX_SHADOW_BUFFER = client.features.chat_ui_v2 ? 48 : 8;
11126
11693
  var POSITION_FROM_SCREEN_EDGE = 24;
11127
11694
  var buttonSizeWithBuffer = buttonSize + BOX_SHADOW_BUFFER;
11128
11695
  var buttonPosition = POSITION_FROM_SCREEN_EDGE - BOX_SHADOW_BUFFER / 2;
11129
- var frameHeight = buttonSize + BOX_SHADOW_BUFFER;
11696
+ var roundFrameHeight = buttonSize + BOX_SHADOW_BUFFER; // text button has a fixed height of 44px
11697
+
11698
+ var textFrameHeight = 44 + BOX_SHADOW_BUFFER;
11130
11699
  var stylesForHiding = "\n top: -9999px !important;\n left: -9999px !important;\n ";
11131
11700
 
11132
- var styles = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "\n position: fixed;\n bottom: ".concat(buttonPosition, "px;\n ")).call(_context7, isRTL(client, language) ? "left" : "right", ": ")).call(_context6, buttonPosition, "px;\n z-index: 10000;\n height: ")).call(_context5, buttonSizeWithBuffer, "px;\n width: ")).call(_context4, buttonSizeWithBuffer, "px;\n overflow: hidden;\n visibility: ")).call(_context3, this.isShown ? "visible" : "hidden", ";\n opacity: ")).call(_context2, this.isShown ? "1" : "0", ";\n transition: visibility 200ms ease, opacity 200ms ease;\n ");
11701
+ var styles = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "\n position: fixed;\n bottom: ".concat(buttonPosition, "px;\n ")).call(_context7, getAlignment(adaSettings), ": ")).call(_context6, buttonPosition, "px;\n z-index: 10000;\n height: ")).call(_context5, buttonSizeWithBuffer, "px;\n width: ")).call(_context4, buttonSizeWithBuffer, "px;\n overflow: hidden;\n visibility: ")).call(_context3, this.isShown ? "visible" : "hidden", ";\n opacity: ")).call(_context2, this.isShown ? "1" : "0", ";\n transition: visibility 200ms ease, opacity 200ms ease;\n ");
11133
11702
 
11134
11703
  if (client.features.chat_ui_v2) {
11135
11704
  var _context8;
11136
11705
 
11137
- styles += concat_default()(_context8 = "\n transform: translate(0, 10%);\n transition: visibility 250ms ease, opacity 250ms ease, transform 250ms ease;\n ".concat(isRTL(client, language) ? "left" : "right", ": 0;\n bottom: 0;\n \n ")).call(_context8, this.isShown ? "transform: translate(0, 0);" : "", "\n ");
11706
+ styles += concat_default()(_context8 = "\n transform: translate(0, 10%);\n transition: visibility 250ms ease, opacity 250ms ease, transform 250ms ease;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: 0;\n \n ")).call(_context8, this.isShown ? "transform: translate(0, 0);" : "", "\n ");
11138
11707
 
11139
11708
  if (buttonStyle === "text") {
11140
11709
  var _context9;
11141
11710
 
11142
- styles += concat_default()(_context9 = "\n width: ".concat(frameWidth, "px;\n height: ")).call(_context9, frameHeight, "px;\n ");
11711
+ styles += concat_default()(_context9 = "\n width: ".concat(frameWidth, "px;\n height: ")).call(_context9, textFrameHeight, "px;\n ");
11143
11712
  } else {
11144
11713
  var _context10;
11145
11714
 
11146
- styles += concat_default()(_context10 = "\n width: ".concat(frameHeight, "px;\n height: ")).call(_context10, frameHeight, "px;\n ");
11715
+ styles += concat_default()(_context10 = "\n width: ".concat(roundFrameHeight, "px;\n height: ")).call(_context10, roundFrameHeight, "px;\n ");
11147
11716
  }
11148
11717
  }
11149
11718
 
@@ -11234,6 +11803,7 @@ function ChatFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefine
11234
11803
 
11235
11804
 
11236
11805
 
11806
+
11237
11807
  var ChatFrame = /*#__PURE__*/function (_Component) {
11238
11808
  (0,inherits/* default */.Z)(ChatFrame, _Component);
11239
11809
 
@@ -11353,7 +11923,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11353
11923
  skipGreeting = _this$props3.skipGreeting,
11354
11924
  wasIntroShown = _this$props3.wasIntroShown,
11355
11925
  privateMode = _this$props3.privateMode,
11356
- testMode = _this$props3.testMode;
11926
+ testMode = _this$props3.testMode,
11927
+ adaSettings = _this$props3.adaSettings;
11357
11928
  return getURL({
11358
11929
  name: name,
11359
11930
  handle: handle,
@@ -11366,7 +11937,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11366
11937
  introShown: wasIntroShown,
11367
11938
  embed2: 1,
11368
11939
  private: privateMode ? 1 : null,
11369
- test_user: testMode ? 1 : null
11940
+ test_user: testMode ? 1 : null,
11941
+ align: getAlignment(adaSettings)
11370
11942
  }
11371
11943
  });
11372
11944
  }
@@ -11379,7 +11951,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11379
11951
  isDrawerOpen = _this$props4.isDrawerOpen,
11380
11952
  client = _this$props4.client,
11381
11953
  testMode = _this$props4.testMode,
11382
- language = _this$props4.language;
11954
+ adaSettings = _this$props4.adaSettings;
11383
11955
 
11384
11956
  if (!client) {
11385
11957
  return "";
@@ -11399,10 +11971,10 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11399
11971
  if (client.features.chat_ui_v2) {
11400
11972
  var _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9;
11401
11973
 
11402
- return concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "\n position: fixed;\n\n ".concat(isMobile ? "\n ".concat(isRTL(client, language) ? "left" : "right", ": 0;\n bottom: 0;\n height: 100%;\n ") : concat_default()(_context8 = concat_default()(_context9 = "\n height: 90%;\n ".concat(isRTL(client, language) ? "left" : "right", ": 24px;\n bottom: 24px;\n max-width: 375px;\n max-height: ")).call(_context9, totalWindowHeight, ";\n border-radius: ")).call(_context8, borderRadius, ";\n "), "\n\n width: 100%;\n ")).call(_context7, this.hasVisibleProactiveMessages || isShown ? "pointer-events: auto" : "pointer-events: none", ";\n opacity: 0;\n transform: translate(0, 100px);\n transition: transform ")).call(_context6, closeTransitionTime, "ms ease, opacity ")).call(_context5, closeTransitionTime, "ms ease, visibility 0ms linear ")).call(_context4, closeTransitionTime, "ms;\n box-shadow: 0px 12px 48px 4px rgba(0, 0, 0, 0.12);\n background-color: ")).call(_context3, backgroundColor, ";\n visibility: hidden;\n z-index: 10010;\n\n ")).call(_context2, isShown && "\n opacity: 1;\n transform: translate(0, 0);\n transition: transform 300ms ease, opacity 300ms ease;\n visibility: visible;\n ", "\n ");
11974
+ return concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "\n position: fixed;\n\n ".concat(isMobile ? "\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: 0;\n height: 100%;\n ") : concat_default()(_context8 = concat_default()(_context9 = "\n height: 90%;\n ".concat(getAlignment(adaSettings), ": 24px;\n bottom: 24px;\n max-width: 375px;\n max-height: ")).call(_context9, totalWindowHeight, ";\n border-radius: ")).call(_context8, borderRadius, ";\n "), "\n\n width: 100%;\n ")).call(_context7, this.hasVisibleProactiveMessages || isShown ? "pointer-events: auto" : "pointer-events: none", ";\n opacity: 0;\n transform: translate(0, 100px);\n transition: transform ")).call(_context6, closeTransitionTime, "ms ease, opacity ")).call(_context5, closeTransitionTime, "ms ease, visibility 0ms linear ")).call(_context4, closeTransitionTime, "ms;\n box-shadow: 0px 12px 48px 4px rgba(0, 0, 0, 0.12);\n background-color: ")).call(_context3, backgroundColor, ";\n visibility: hidden;\n z-index: 10010;\n\n ")).call(_context2, isShown && "\n opacity: 1;\n transform: translate(0, 0);\n transition: transform 300ms ease, opacity 300ms ease;\n visibility: visible;\n ", "\n ");
11403
11975
  }
11404
11976
 
11405
- return concat_default()(_context10 = concat_default()(_context11 = concat_default()(_context12 = concat_default()(_context13 = concat_default()(_context14 = "\n position: fixed;\n ".concat(isRTL(client, language) ? "left" : "right", ": 0;\n bottom: 0;\n transform: translate(")).call(_context14, isDrawerOpen && isMounted ? "0" : "375px", ", 0);\n opacity: ")).call(_context13, isDrawerOpen && isMounted ? "1" : "0", ";\n transition: transform 200ms ease, opacity 200ms ease;\n z-index: 9999;\n box-shadow: -1px 0 0 rgba(0, 0, 0, .1), -3px 0 9px rgba(0, 0, 0, .15);\n background-color: #ffffff;\n width: 100%;\n max-width: ")).call(_context12, isMobile ? "none" : "375px", ";\n height: ")).call(_context11, isMobile ? "100%" : "100vh", ";\n min-height: ")).call(_context10, isMobile ? "100%" : "initial", ";\n max-height: -webkit-fill-available;\n max-height: -moz-available;\n max-height: stretch;\n ");
11977
+ return concat_default()(_context10 = concat_default()(_context11 = concat_default()(_context12 = concat_default()(_context13 = concat_default()(_context14 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: 0;\n transform: translate(")).call(_context14, isDrawerOpen && isMounted ? "0" : "375px", ", 0);\n opacity: ")).call(_context13, isDrawerOpen && isMounted ? "1" : "0", ";\n transition: transform 200ms ease, opacity 200ms ease;\n z-index: 9999;\n box-shadow: -1px 0 0 rgba(0, 0, 0, .1), -3px 0 9px rgba(0, 0, 0, .15);\n background-color: #ffffff;\n width: 100%;\n max-width: ")).call(_context12, isMobile ? "none" : "375px", ";\n height: ")).call(_context11, isMobile ? "100%" : "100vh", ";\n min-height: ")).call(_context10, isMobile ? "100%" : "initial", ";\n max-height: -webkit-fill-available;\n max-height: -moz-available;\n max-height: stretch;\n ");
11406
11978
  }
11407
11979
  }, {
11408
11980
  key: "hasVisibleProactiveMessages",
@@ -11419,13 +11991,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11419
11991
  var _this$props5 = this.props,
11420
11992
  chatDimensions = _this$props5.chatDimensions,
11421
11993
  client = _this$props5.client,
11422
- language = _this$props5.language; // delta is used to determine how much of the button's height should be ignored
11994
+ adaSettings = _this$props5.adaSettings; // delta is used to determine how much of the button's height should be ignored
11423
11995
  // when spacing the proactive message
11424
11996
 
11425
- var delta = 14;
11997
+ var delta = 3;
11426
11998
  var TEXT_BUTTON_HEIGHT = 44;
11427
11999
  var bottomOffset = (client === null || client === void 0 ? void 0 : (_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 === null || client === void 0 ? void 0 : (_client$chat_button = client.chat_button) === null || _client$chat_button === void 0 ? void 0 : _client$chat_button.size) - delta;
11428
- 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, isRTL(client, language) ? "left" : "right", ": 0;\n bottom: ")).call(_context15, bottomOffset, "px;\n z-index: 9999;\n ");
12000
+ 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 ");
11429
12001
  }
11430
12002
  }, {
11431
12003
  key: "chooseStyles",
@@ -11560,7 +12132,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11560
12132
  var _handleChatEvent = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(type, payload, id) {
11561
12133
  var _this4 = this;
11562
12134
 
11563
- var _this$props8, adaSettings, setState, setConnectionState, _ref, eventKey, data, _ref2, analytics, analyticsCallback, client, _ref3, chatter, chatterTokenCallback, _client, _ref4, inLiveChat, eventCallbacks, customJavascriptEvent, specificCallback, genericCallback, resetChat, zdChatterAuthCallback, conversationEndCallback;
12135
+ var _this$props8, adaSettings, setState, setConnectionState, _ref, eventKey, data, _ref2, analytics, analyticsCallback, client, _ref3, chatter, created, chatterTokenCallback, _client, _ref4, zdSessionId, zdPreviousTags, storage, _client2, _ref5, inLiveChat, eventCallbacks, customJavascriptEvent, specificCallback, genericCallback, resetChat, zdChatterAuthCallback, conversationEndCallback;
11564
12136
 
11565
12137
  return regenerator_default().wrap(function _callee$(_context22) {
11566
12138
  while (1) {
@@ -11568,30 +12140,30 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11568
12140
  case 0:
11569
12141
  _this$props8 = this.props, adaSettings = _this$props8.adaSettings, setState = _this$props8.setState, setConnectionState = _this$props8.setConnectionState;
11570
12142
  _context22.t0 = type;
11571
- _context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ? 6 : _context22.t0 === CHAT_WEBSOCKET_CONNECTED ? 9 : _context22.t0 === PUBLISH_EVENT ? 11 : _context22.t0 === ANALYTICS_EVENT ? 14 : _context22.t0 === CHATTER_EVENT ? 18 : _context22.t0 === CHATTER_LIVECHAT_EVENT ? 26 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 32 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 41 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 44 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 47 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 49 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 51 : _context22.t0 === END_CONVERSATION_EVENT ? 53 : 56;
12143
+ _context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ? 6 : _context22.t0 === CHAT_WEBSOCKET_CONNECTED ? 9 : _context22.t0 === PUBLISH_EVENT ? 11 : _context22.t0 === ANALYTICS_EVENT ? 14 : _context22.t0 === CHATTER_EVENT ? 18 : _context22.t0 === "ZD_SESSION" ? 28 : _context22.t0 === CHATTER_LIVECHAT_EVENT ? 37 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 43 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 52 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 55 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 58 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 60 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 62 : _context22.t0 === END_CONVERSATION_EVENT ? 64 : 67;
11572
12144
  break;
11573
12145
 
11574
12146
  case 4:
11575
12147
  this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
11576
- return _context22.abrupt("break", 57);
12148
+ return _context22.abrupt("break", 68);
11577
12149
 
11578
12150
  case 6:
11579
12151
  this.channel.isConnected = true;
11580
12152
  setConnectionState({
11581
12153
  "chat": ConnectionState.Done
11582
12154
  });
11583
- return _context22.abrupt("break", 57);
12155
+ return _context22.abrupt("break", 68);
11584
12156
 
11585
12157
  case 9:
11586
12158
  setState({
11587
12159
  isChatWebsocketConnected: true
11588
12160
  });
11589
- return _context22.abrupt("break", 57);
12161
+ return _context22.abrupt("break", 68);
11590
12162
 
11591
12163
  case 11:
11592
12164
  _ref = payload, eventKey = _ref.eventKey, data = _ref.data;
11593
12165
  publishEvent(eventKey, data);
11594
- return _context22.abrupt("break", 57);
12166
+ return _context22.abrupt("break", 68);
11595
12167
 
11596
12168
  case 14:
11597
12169
  _ref2 = payload, analytics = _ref2.analytics;
@@ -11601,66 +12173,124 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11601
12173
  analyticsCallback(analytics);
11602
12174
  }
11603
12175
 
11604
- return _context22.abrupt("break", 57);
12176
+ return _context22.abrupt("break", 68);
11605
12177
 
11606
12178
  case 18:
11607
12179
  client = this.props.client;
11608
- _ref3 = payload, chatter = _ref3.chatter;
12180
+ _ref3 = payload, chatter = _ref3.chatter, created = _ref3.created;
11609
12181
  chatterTokenCallback = adaSettings.chatterTokenCallback;
11610
- _context22.next = 23;
12182
+
12183
+ if (client) {
12184
+ _context22.next = 23;
12185
+ break;
12186
+ }
12187
+
12188
+ throw new errors/* AdaEmbedError */.S("`client` is undefined");
12189
+
12190
+ case 23:
12191
+ _context22.next = 25;
11611
12192
  return setState({
11612
- chatterToken: chatter
12193
+ chatterToken: chatter,
12194
+ chatterCreated: created
11613
12195
  });
11614
12196
 
11615
- case 23:
12197
+ case 25:
11616
12198
  /**
11617
12199
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11618
12200
  * come from chat. This is important for campaign and business event triggers.
11619
12201
  */
11620
12202
  if (client.persistence === PERSISTENCE_NORMAL) {
11621
12203
  safeLocalStorage.setItem(CHATTER_STORAGE_KEY, chatter);
12204
+ safeLocalStorage.setItem(CHATTER_CREATED_STORAGE_KEY, created);
11622
12205
  } else if (client.persistence === PERSISTENCE_SESSION) {
11623
12206
  safeSessionStorage.setItem(CHATTER_STORAGE_KEY, chatter);
12207
+ safeSessionStorage.setItem(CHATTER_CREATED_STORAGE_KEY, created);
11624
12208
  }
11625
12209
 
11626
12210
  if (chatterTokenCallback) {
11627
12211
  chatterTokenCallback(chatter);
11628
12212
  }
11629
12213
 
11630
- return _context22.abrupt("break", 57);
12214
+ return _context22.abrupt("break", 68);
11631
12215
 
11632
- case 26:
12216
+ case 28:
11633
12217
  _client = this.props.client;
11634
- _ref4 = payload, inLiveChat = _ref4.inLiveChat;
11635
- _context22.next = 30;
12218
+ _ref4 = payload, zdSessionId = _ref4.zdSessionId, zdPreviousTags = _ref4.zdPreviousTags;
12219
+
12220
+ if (_client) {
12221
+ _context22.next = 32;
12222
+ break;
12223
+ }
12224
+
12225
+ throw new errors/* AdaEmbedError */.S("`client` is undefined");
12226
+
12227
+ case 32:
12228
+ _context22.next = 34;
12229
+ return setState({
12230
+ zdSessionId: zdSessionId
12231
+ });
12232
+
12233
+ case 34:
12234
+ storage = function () {
12235
+ if (_client.persistence === PERSISTENCE_NORMAL) {
12236
+ return safeLocalStorage;
12237
+ }
12238
+
12239
+ if (_client.persistence === PERSISTENCE_SESSION) {
12240
+ return safeSessionStorage;
12241
+ }
12242
+
12243
+ return null;
12244
+ }();
12245
+
12246
+ if (storage) {
12247
+ if (zdSessionId === null) {
12248
+ storage.removeItem(ZD_SESSION_STORAGE_KEY);
12249
+ } else {
12250
+ storage.setItem(ZD_SESSION_STORAGE_KEY, zdSessionId);
12251
+ }
12252
+
12253
+ if (zdPreviousTags === null) {
12254
+ storage.removeItem(ZD_PREVIOUS_TAGS_STORAGE_KEY);
12255
+ } else {
12256
+ storage.setItem(ZD_PREVIOUS_TAGS_STORAGE_KEY, zdPreviousTags);
12257
+ }
12258
+ }
12259
+
12260
+ return _context22.abrupt("break", 68);
12261
+
12262
+ case 37:
12263
+ _client2 = this.props.client;
12264
+ _ref5 = payload, inLiveChat = _ref5.inLiveChat;
12265
+ _context22.next = 41;
11636
12266
  return setState({
11637
12267
  chatterInLiveChat: inLiveChat
11638
12268
  });
11639
12269
 
11640
- case 30:
12270
+ case 41:
11641
12271
  /**
11642
12272
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11643
12273
  * come from chat. This is important for campaign and business event triggers.
11644
12274
  */
11645
- if (_client.persistence === PERSISTENCE_NORMAL) {
12275
+ if (_client2.persistence === PERSISTENCE_NORMAL) {
11646
12276
  safeLocalStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
11647
- } else if (_client.persistence === PERSISTENCE_SESSION) {
12277
+ } else if (_client2.persistence === PERSISTENCE_SESSION) {
11648
12278
  safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
11649
12279
  }
11650
12280
 
11651
- return _context22.abrupt("break", 57);
12281
+ return _context22.abrupt("break", 68);
11652
12282
 
11653
- case 32:
12283
+ case 43:
11654
12284
  eventCallbacks = adaSettings.eventCallbacks;
11655
12285
 
11656
12286
  if (eventCallbacks) {
11657
- _context22.next = 35;
12287
+ _context22.next = 46;
11658
12288
  break;
11659
12289
  }
11660
12290
 
11661
- return _context22.abrupt("break", 57);
12291
+ return _context22.abrupt("break", 68);
11662
12292
 
11663
- case 35:
12293
+ case 46:
11664
12294
  customJavascriptEvent = payload.event_data;
11665
12295
  specificCallback = eventCallbacks[customJavascriptEvent.event_name];
11666
12296
  genericCallback = eventCallbacks["*"];
@@ -11673,14 +12303,14 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11673
12303
  genericCallback(customJavascriptEvent);
11674
12304
  }
11675
12305
 
11676
- return _context22.abrupt("break", 57);
12306
+ return _context22.abrupt("break", 68);
11677
12307
 
11678
- case 41:
12308
+ case 52:
11679
12309
  resetChat = this.props.resetChat;
11680
12310
  resetChat();
11681
- return _context22.abrupt("break", 57);
12311
+ return _context22.abrupt("break", 68);
11682
12312
 
11683
- case 44:
12313
+ case 55:
11684
12314
  zdChatterAuthCallback = adaSettings.zdChatterAuthCallback;
11685
12315
 
11686
12316
  if (zdChatterAuthCallback) {
@@ -11698,35 +12328,35 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11698
12328
  this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11699
12329
  }
11700
12330
 
11701
- return _context22.abrupt("break", 57);
12331
+ return _context22.abrupt("break", 68);
11702
12332
 
11703
- case 47:
12333
+ case 58:
11704
12334
  this.handleNotifications(payload);
11705
- return _context22.abrupt("break", 57);
12335
+ return _context22.abrupt("break", 68);
11706
12336
 
11707
- case 49:
12337
+ case 60:
11708
12338
  this.channel.postMessage(BROWSER_HAS_NOTIFICATIONS_RESPONSE_EVENT, {
11709
12339
  browserHasNotificationSupport: browserHasNotificationSupport
11710
12340
  });
11711
- return _context22.abrupt("break", 57);
12341
+ return _context22.abrupt("break", 68);
11712
12342
 
11713
- case 51:
12343
+ case 62:
11714
12344
  requestNotificationPermission();
11715
- return _context22.abrupt("break", 57);
12345
+ return _context22.abrupt("break", 68);
11716
12346
 
11717
- case 53:
12347
+ case 64:
11718
12348
  conversationEndCallback = adaSettings.conversationEndCallback;
11719
12349
 
11720
12350
  if (conversationEndCallback) {
11721
12351
  conversationEndCallback(payload);
11722
12352
  }
11723
12353
 
11724
- return _context22.abrupt("break", 57);
12354
+ return _context22.abrupt("break", 68);
11725
12355
 
11726
- case 56:
11727
- return _context22.abrupt("break", 57);
12356
+ case 67:
12357
+ return _context22.abrupt("break", 68);
11728
12358
 
11729
- case 57:
12359
+ case 68:
11730
12360
  case "end":
11731
12361
  return _context22.stop();
11732
12362
  }
@@ -11874,12 +12504,12 @@ var IntroFrame = /*#__PURE__*/function (_Component) {
11874
12504
  client = _this$props2.client,
11875
12505
  buttonSize = _this$props2.buttonSize,
11876
12506
  introDimensions = _this$props2.introDimensions,
11877
- language = _this$props2.language;
12507
+ adaSettings = _this$props2.adaSettings;
11878
12508
  var INTRO_BUTTON_PADDING = 16;
11879
12509
  var introPositionRight = INTRO_BUTTON_PADDING + buttonSize;
11880
12510
  var stylesForHiding = "\n visibility: \"hidden\";\n top: -9999px !important;\n left: -9999px !important;\n ";
11881
12511
 
11882
- var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(isRTL(client, language) ? "left" : "right", ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.height, "px;\n width: ")).call(_context2, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.width, "px;\n \n ")).call(_context, Boolean(client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && concat_default()(_context6 = "\n max-height: auto;\n max-width: 350px;\n z-index: 9999;\n ".concat(isRTL(client, language) ? "left" : "right", ": 0;\n bottom: ")).call(_context6, buttonSize - 20, "px;\n "), "\n ");
12512
+ var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.height, "px;\n width: ")).call(_context2, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.width, "px;\n\n ")).call(_context, Boolean(client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && concat_default()(_context6 = "\n max-height: auto;\n max-width: 350px;\n z-index: 9999;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context6, buttonSize - 20, "px;\n "), "\n ");
11883
12513
 
11884
12514
  if (!this.isShown) {
11885
12515
  return styles + stylesForHiding;
@@ -11915,14 +12545,16 @@ function IntroFrame_mapStateToProps(storeState) {
11915
12545
  introDimensions = storeState.introDimensions,
11916
12546
  isIntroShown = storeState.isIntroShown,
11917
12547
  isDrawerOpen = storeState.isDrawerOpen,
11918
- language = storeState.language;
12548
+ language = storeState.language,
12549
+ adaSettings = storeState.adaSettings;
11919
12550
  return {
11920
12551
  client: client,
11921
12552
  buttonSize: client === null || client === void 0 ? void 0 : (_client$chat_button = client.chat_button) === null || _client$chat_button === void 0 ? void 0 : _client$chat_button.size,
11922
12553
  introDimensions: introDimensions,
11923
12554
  isIntroShown: isIntroShown,
11924
12555
  isDrawerOpen: isDrawerOpen,
11925
- language: language
12556
+ language: language,
12557
+ adaSettings: adaSettings
11926
12558
  };
11927
12559
  }
11928
12560
 
@@ -12144,6 +12776,7 @@ function Container_isNativeReflectConstruct() { if (typeof Reflect === "undefine
12144
12776
 
12145
12777
 
12146
12778
 
12779
+
12147
12780
 
12148
12781
 
12149
12782
  var Container = /*#__PURE__*/function (_Component) {
@@ -12201,8 +12834,13 @@ var Container = /*#__PURE__*/function (_Component) {
12201
12834
  _createClass(Container, [{
12202
12835
  key: "componentDidMount",
12203
12836
  value: function componentDidMount() {
12204
- var adaSettings = this.props.adaSettings;
12205
- var onAdaEmbedLoaded = adaSettings.onAdaEmbedLoaded; // We want to make sure this happens before any publishEvent calls
12837
+ var _this$props = this.props,
12838
+ adaSettings = _this$props.adaSettings,
12839
+ setState = _this$props.setState;
12840
+ var onAdaEmbedLoaded = adaSettings.onAdaEmbedLoaded;
12841
+ setState({
12842
+ adaSettings: adaSettings
12843
+ }); // We want to make sure this happens before any publishEvent calls
12206
12844
  // This is why it happens even before calling initialize
12207
12845
 
12208
12846
  if (onAdaEmbedLoaded) {
@@ -12221,17 +12859,17 @@ var Container = /*#__PURE__*/function (_Component) {
12221
12859
  _client$ui_settings$e,
12222
12860
  _this2 = this;
12223
12861
 
12224
- var _this$props = this.props,
12225
- isDrawerOpen = _this$props.isDrawerOpen,
12226
- appConnectionState = _this$props.appConnectionState,
12227
- initializationReject = _this$props.initializationReject,
12228
- initializationResolve = _this$props.initializationResolve,
12229
- chatterToken = _this$props.chatterToken,
12230
- client = _this$props.client,
12231
- isChatWebsocketConnected = _this$props.isChatWebsocketConnected,
12232
- adaSettings = _this$props.adaSettings,
12233
- chatterInLiveChat = _this$props.chatterInLiveChat,
12234
- messageService = _this$props.messageService;
12862
+ var _this$props2 = this.props,
12863
+ isDrawerOpen = _this$props2.isDrawerOpen,
12864
+ appConnectionState = _this$props2.appConnectionState,
12865
+ initializationReject = _this$props2.initializationReject,
12866
+ initializationResolve = _this$props2.initializationResolve,
12867
+ chatterToken = _this$props2.chatterToken,
12868
+ client = _this$props2.client,
12869
+ isChatWebsocketConnected = _this$props2.isChatWebsocketConnected,
12870
+ adaSettings = _this$props2.adaSettings,
12871
+ chatterInLiveChat = _this$props2.chatterInLiveChat,
12872
+ messageService = _this$props2.messageService;
12235
12873
  var adaReadyCallback = adaSettings.adaReadyCallback,
12236
12874
  toggleCallback = adaSettings.toggleCallback;
12237
12875
 
@@ -12267,7 +12905,6 @@ var Container = /*#__PURE__*/function (_Component) {
12267
12905
  campaignToTrigger = _this$state.campaignToTrigger,
12268
12906
  campaignTriggerOptions = _this$state.campaignTriggerOptions,
12269
12907
  followUpResponseId = _this$state.followUpResponseId;
12270
- var chatChannel = messageService.getChannel(CHAT_IFRAME);
12271
12908
  /* We wait for all necessary preconditions (e.g. necessary connections established) to be true,
12272
12909
  * then trigger the campaign. campaignToTrigger is cleared after triggering, so we do not need
12273
12910
  * to worry about duplicate triggers.
@@ -12290,13 +12927,17 @@ var Container = /*#__PURE__*/function (_Component) {
12290
12927
  } // If a follow-up response has been queued by a triggered Campaign, tell chat to show it
12291
12928
 
12292
12929
 
12293
- if (chatChannel && isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
12294
- chatChannel.postMessage(SEND_GREETING, {
12295
- responseId: followUpResponseId
12296
- });
12297
- this.setState({
12298
- followUpResponseId: null
12299
- });
12930
+ if (isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
12931
+ var chatChannel = messageService.getChannel(CHAT_IFRAME);
12932
+
12933
+ if (chatChannel) {
12934
+ chatChannel.postMessage(SEND_GREETING, {
12935
+ responseId: followUpResponseId
12936
+ });
12937
+ this.setState({
12938
+ followUpResponseId: null
12939
+ });
12940
+ }
12300
12941
  }
12301
12942
 
12302
12943
  if (prevProps.isDrawerOpen !== isDrawerOpen && toggleCallback) {
@@ -12320,10 +12961,10 @@ var Container = /*#__PURE__*/function (_Component) {
12320
12961
  }, {
12321
12962
  key: "shouldRenderChatFrame",
12322
12963
  get: function get() {
12323
- var _this$props2 = this.props,
12324
- isDrawerOpen = _this$props2.isDrawerOpen,
12325
- adaSettings = _this$props2.adaSettings,
12326
- chatterInLiveChat = _this$props2.chatterInLiveChat;
12964
+ var _this$props3 = this.props,
12965
+ isDrawerOpen = _this$props3.isDrawerOpen,
12966
+ adaSettings = _this$props3.adaSettings,
12967
+ chatterInLiveChat = _this$props3.chatterInLiveChat;
12327
12968
  var parentElement = adaSettings.parentElement,
12328
12969
  preload = adaSettings.preload;
12329
12970
  var _this$state2 = this.state,
@@ -12367,9 +13008,9 @@ var Container = /*#__PURE__*/function (_Component) {
12367
13008
  }, {
12368
13009
  key: "computeButtonFrameWidth",
12369
13010
  value: function computeButtonFrameWidth() {
12370
- var _this$props3 = this.props,
12371
- entryContainer = _this$props3.entryContainer,
12372
- client = _this$props3.client;
13011
+ var _this$props4 = this.props,
13012
+ entryContainer = _this$props4.entryContainer,
13013
+ client = _this$props4.client;
12373
13014
  var buttonPadding = 26;
12374
13015
  var iconWithSpace = 30;
12375
13016
  var margins = 48;
@@ -12388,10 +13029,10 @@ var Container = /*#__PURE__*/function (_Component) {
12388
13029
  }, {
12389
13030
  key: "unmount",
12390
13031
  value: function unmount() {
12391
- var _this$props4 = this.props,
12392
- entryContainer = _this$props4.entryContainer,
12393
- messageService = _this$props4.messageService,
12394
- unmountCallback = _this$props4.unmountCallback;
13032
+ var _this$props5 = this.props,
13033
+ entryContainer = _this$props5.entryContainer,
13034
+ messageService = _this$props5.messageService,
13035
+ unmountCallback = _this$props5.unmountCallback;
12395
13036
  entryContainer.parentNode.removeChild(entryContainer);
12396
13037
  messageService.getAllChannels().forEach(function (channel) {
12397
13038
  channel.clearTimeoutsAndListeners();
@@ -12403,9 +13044,9 @@ var Container = /*#__PURE__*/function (_Component) {
12403
13044
  }, {
12404
13045
  key: "trackEvent",
12405
13046
  value: function trackEvent(trackEventParams) {
12406
- var _this$props5 = this.props,
12407
- adaSettings = _this$props5.adaSettings,
12408
- chatterToken = _this$props5.chatterToken;
13047
+ var _this$props6 = this.props,
13048
+ adaSettings = _this$props6.adaSettings,
13049
+ chatterToken = _this$props6.chatterToken;
12409
13050
  trackEventImpl(adaSettings, chatterToken, trackEventParams);
12410
13051
  }
12411
13052
  }, {
@@ -12432,10 +13073,10 @@ var Container = /*#__PURE__*/function (_Component) {
12432
13073
  value: function triggerCampaign(params) {
12433
13074
  var _client$marketing_cam;
12434
13075
 
12435
- var _this$props6 = this.props,
12436
- client = _this$props6.client,
12437
- isDrawerOpen = _this$props6.isDrawerOpen,
12438
- setState = _this$props6.setState;
13076
+ var _this$props7 = this.props,
13077
+ client = _this$props7.client,
13078
+ isDrawerOpen = _this$props7.isDrawerOpen,
13079
+ setState = _this$props7.setState;
12439
13080
  var chatHasBeenRendered = this.state.chatHasBeenRendered;
12440
13081
  var campaignKey = params.campaignKey,
12441
13082
  ignoreStatus = params.ignoreStatus,
@@ -12474,10 +13115,10 @@ var Container = /*#__PURE__*/function (_Component) {
12474
13115
  var _this4 = this;
12475
13116
 
12476
13117
  var useDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12477
- var _this$props7 = this.props,
12478
- adaSettings = _this$props7.adaSettings,
12479
- chatterToken = _this$props7.chatterToken,
12480
- client = _this$props7.client;
13118
+ var _this$props8 = this.props,
13119
+ adaSettings = _this$props8.adaSettings,
13120
+ chatterToken = _this$props8.chatterToken,
13121
+ client = _this$props8.client;
12481
13122
 
12482
13123
  if (!hasCampaignsEnabled(client)) {
12483
13124
  return;
@@ -12505,13 +13146,13 @@ var Container = /*#__PURE__*/function (_Component) {
12505
13146
  var _handleEmbedAction = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(type, payload, id) {
12506
13147
  var _this5 = this;
12507
13148
 
12508
- var _this$props8, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, toggleChat, _this$props9, isDrawerOpen, drawerHasBeenOpened, chatterToken, contentToReturn, _this$props10, metaFields, setState, metaData, newMetaFields, _this$props11, sensitiveMetaFields, _setState, _ref, greeting, language, _newMetaFields, _sensitiveMetaFields, _ref$resetChatHistory, resetChatHistory, _setState2, chatHasBeenRendered, _ref2, body, duration, EXTRA_PROACTIVE_DELAY, canCreateProactive;
13149
+ var _this$props9, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, toggleChat, _this$props10, isDrawerOpen, drawerHasBeenOpened, chatterToken, contentToReturn, _this$props11, metaFields, setState, metaData, newMetaFields, _this$props12, sensitiveMetaFields, _setState, _ref, greeting, language, _newMetaFields, _sensitiveMetaFields, _ref$resetChatHistory, resetChatHistory, _setState2, chatHasBeenRendered, newState, _setState3, _ref2, body, duration, EXTRA_PROACTIVE_DELAY, canCreateProactive;
12509
13150
 
12510
13151
  return regenerator_default().wrap(function _callee2$(_context3) {
12511
13152
  while (1) {
12512
13153
  switch (_context3.prev = _context3.next) {
12513
13154
  case 0:
12514
- _this$props8 = this.props, client = _this$props8.client, messageService = _this$props8.messageService, adaSettings = _this$props8.adaSettings;
13155
+ _this$props9 = this.props, client = _this$props9.client, messageService = _this$props9.messageService, adaSettings = _this$props9.adaSettings;
12515
13156
  parentElement = adaSettings.parentElement;
12516
13157
  localChannel = messageService.getChannel("local");
12517
13158
  xStorageChannel = messageService.getChannel(XSTORAGE_IFRAME);
@@ -12525,7 +13166,7 @@ var Container = /*#__PURE__*/function (_Component) {
12525
13166
 
12526
13167
  case 6:
12527
13168
  _context3.t0 = type;
12528
- _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 ? 60 : _context3.t0 === CREATE_PROACTIVE ? 65 : 76;
13169
+ _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 : 89;
12529
13170
  break;
12530
13171
 
12531
13172
  case 9:
@@ -12539,7 +13180,7 @@ var Container = /*#__PURE__*/function (_Component) {
12539
13180
 
12540
13181
  case 12:
12541
13182
  this.trackEvent(payload);
12542
- return _context3.abrupt("break", 76);
13183
+ return _context3.abrupt("break", 89);
12543
13184
 
12544
13185
  case 14:
12545
13186
  if (client.features.afm_proactive_messaging) {
@@ -12552,7 +13193,7 @@ var Container = /*#__PURE__*/function (_Component) {
12552
13193
 
12553
13194
  case 17:
12554
13195
  this.triggerCampaign(payload);
12555
- return _context3.abrupt("break", 76);
13196
+ return _context3.abrupt("break", 89);
12556
13197
 
12557
13198
  case 19:
12558
13199
  if (client.features.afm_proactive_messaging) {
@@ -12565,7 +13206,7 @@ var Container = /*#__PURE__*/function (_Component) {
12565
13206
 
12566
13207
  case 22:
12567
13208
  this.evaluateCampaignConditions(payload);
12568
- return _context3.abrupt("break", 76);
13209
+ return _context3.abrupt("break", 89);
12569
13210
 
12570
13211
  case 24:
12571
13212
  toggleChat = this.props.toggleChat;
@@ -12574,10 +13215,10 @@ var Container = /*#__PURE__*/function (_Component) {
12574
13215
 
12575
13216
  case 27:
12576
13217
  localChannel.postMessage(TOGGLE_RESPONSE, null, id);
12577
- return _context3.abrupt("break", 76);
13218
+ return _context3.abrupt("break", 89);
12578
13219
 
12579
13220
  case 29:
12580
- _this$props9 = this.props, isDrawerOpen = _this$props9.isDrawerOpen, drawerHasBeenOpened = _this$props9.drawerHasBeenOpened, chatterToken = _this$props9.chatterToken;
13221
+ _this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
12581
13222
  contentToReturn = {
12582
13223
  isDrawerOpen: isDrawerOpen,
12583
13224
  isChatOpen: isDrawerOpen || Boolean(parentElement),
@@ -12585,10 +13226,10 @@ var Container = /*#__PURE__*/function (_Component) {
12585
13226
  hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
12586
13227
  };
12587
13228
  localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
12588
- return _context3.abrupt("break", 76);
13229
+ return _context3.abrupt("break", 89);
12589
13230
 
12590
13231
  case 33:
12591
- _this$props10 = this.props, metaFields = _this$props10.metaFields, setState = _this$props10.setState;
13232
+ _this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
12592
13233
  metaData = payload;
12593
13234
  newMetaFields = Container_objectSpread(Container_objectSpread({}, metaFields), metaData);
12594
13235
  _context3.next = 38;
@@ -12598,10 +13239,10 @@ var Container = /*#__PURE__*/function (_Component) {
12598
13239
 
12599
13240
  case 38:
12600
13241
  localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
12601
- return _context3.abrupt("break", 76);
13242
+ return _context3.abrupt("break", 89);
12602
13243
 
12603
13244
  case 40:
12604
- _this$props11 = this.props, sensitiveMetaFields = _this$props11.sensitiveMetaFields, _setState = _this$props11.setState;
13245
+ _this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
12605
13246
  _context3.next = 43;
12606
13247
  return _setState({
12607
13248
  sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), payload)
@@ -12609,42 +13250,54 @@ var Container = /*#__PURE__*/function (_Component) {
12609
13250
 
12610
13251
  case 43:
12611
13252
  localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
12612
- return _context3.abrupt("break", 76);
13253
+ return _context3.abrupt("break", 89);
12613
13254
 
12614
13255
  case 45:
12615
13256
  localChannel.postMessage(STOP_RESPONSE, null, id);
12616
13257
  this.unmount();
12617
- return _context3.abrupt("break", 76);
13258
+ return _context3.abrupt("break", 89);
12618
13259
 
12619
13260
  case 48:
12620
13261
  _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;
12621
13262
  _setState2 = this.props.setState;
12622
13263
  chatHasBeenRendered = this.state.chatHasBeenRendered;
12623
- _context3.next = 53;
12624
- return _setState2({
13264
+ newState = {
12625
13265
  greeting: greeting,
12626
13266
  language: language,
12627
13267
  metaFields: _newMetaFields,
12628
13268
  sensitiveMetaFields: _sensitiveMetaFields
12629
- });
13269
+ };
12630
13270
 
12631
- case 53:
12632
13271
  if (!resetChatHistory) {
12633
- _context3.next = 57;
13272
+ _context3.next = 61;
12634
13273
  break;
12635
13274
  }
12636
13275
 
12637
13276
  if (xStorageChannel) {
12638
- _context3.next = 56;
13277
+ _context3.next = 55;
12639
13278
  break;
12640
13279
  }
12641
13280
 
12642
13281
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
12643
13282
 
12644
- case 56:
12645
- xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
13283
+ case 55:
13284
+ xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
13285
+
13286
+ safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13287
+ safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13288
+ safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13289
+ safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13290
+
13291
+ newState = Container_objectSpread(Container_objectSpread({}, newState), {}, {
13292
+ chatterToken: null,
13293
+ chatterCreated: null
13294
+ });
13295
+
13296
+ case 61:
13297
+ _context3.next = 63;
13298
+ return _setState2(newState);
12646
13299
 
12647
- case 57:
13300
+ case 63:
12648
13301
  if (chatHasBeenRendered) {
12649
13302
  this.setState({
12650
13303
  hideChatOverride: true
@@ -12656,36 +13309,51 @@ var Container = /*#__PURE__*/function (_Component) {
12656
13309
  }
12657
13310
 
12658
13311
  localChannel.postMessage(RESET_RESPONSE, null, id);
12659
- return _context3.abrupt("break", 76);
13312
+ return _context3.abrupt("break", 89);
13313
+
13314
+ case 66:
13315
+ _setState3 = this.props.setState;
12660
13316
 
12661
- case 60:
12662
13317
  if (xStorageChannel) {
12663
- _context3.next = 62;
13318
+ _context3.next = 69;
12664
13319
  break;
12665
13320
  }
12666
13321
 
12667
13322
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
12668
13323
 
12669
- case 62:
13324
+ case 69:
13325
+ // Clear chatter data from local storage
13326
+ safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13327
+ safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13328
+ safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13329
+ safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13330
+
13331
+ _context3.next = 75;
13332
+ return _setState3({
13333
+ chatterToken: null,
13334
+ chatterCreated: null
13335
+ });
13336
+
13337
+ case 75:
12670
13338
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
12671
13339
  localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
12672
- return _context3.abrupt("break", 76);
13340
+ return _context3.abrupt("break", 89);
12673
13341
 
12674
- case 65:
13342
+ case 78:
12675
13343
  _ref2 = payload, body = _ref2.body, duration = _ref2.duration;
12676
13344
  EXTRA_PROACTIVE_DELAY = 1000; // Free tier campaigns re-use the createProactive infrastructure
12677
13345
 
12678
13346
  canCreateProactive = client.features.developer_proactive || client.features.afm_proactive_messaging_free_tier;
12679
13347
 
12680
13348
  if (canCreateProactive) {
12681
- _context3.next = 71;
13349
+ _context3.next = 84;
12682
13350
  break;
12683
13351
  }
12684
13352
 
12685
13353
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, "Ada Embed - Proactive intros are not available in your feature set.", id, FetchEventStatus.Failure);
12686
13354
  return _context3.abrupt("return");
12687
13355
 
12688
- case 71:
13356
+ case 84:
12689
13357
  this.setState({
12690
13358
  hideIntroOverride: true
12691
13359
  }, /*#__PURE__*/(0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
@@ -12723,14 +13391,14 @@ var Container = /*#__PURE__*/function (_Component) {
12723
13391
  }
12724
13392
  }, _callee);
12725
13393
  })));
12726
- _context3.next = 74;
13394
+ _context3.next = 87;
12727
13395
  return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
12728
13396
 
12729
- case 74:
13397
+ case 87:
12730
13398
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
12731
- return _context3.abrupt("break", 76);
13399
+ return _context3.abrupt("break", 89);
12732
13400
 
12733
- case 76:
13401
+ case 89:
12734
13402
  case "end":
12735
13403
  return _context3.stop();
12736
13404
  }
@@ -12792,13 +13460,13 @@ var Container = /*#__PURE__*/function (_Component) {
12792
13460
  var _initialize = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee3() {
12793
13461
  var _context4;
12794
13462
 
12795
- var _this$props12, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
13463
+ var _this$props13, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
12796
13464
 
12797
13465
  return regenerator_default().wrap(function _callee3$(_context8) {
12798
13466
  while (1) {
12799
13467
  switch (_context8.prev = _context8.next) {
12800
13468
  case 0:
12801
- _this$props12 = this.props, adaSettings = _this$props12.adaSettings, setState = _this$props12.setState;
13469
+ _this$props13 = this.props, adaSettings = _this$props13.adaSettings, setState = _this$props13.setState;
12802
13470
  handle = adaSettings.handle, cluster = adaSettings.cluster, domain = adaSettings.domain, rolloutOverride = adaSettings.rolloutOverride, adaReadyCallback = adaSettings.adaReadyCallback, privateMode = adaSettings.privateMode;
12803
13471
  language = adaSettings.language || get_browser_language(); // We do not want to store functions in our store. The rest of the values are useful however.
12804
13472
 
@@ -13003,10 +13671,10 @@ var Container = /*#__PURE__*/function (_Component) {
13003
13671
  key: "renderChatFrame",
13004
13672
  value: function renderChatFrame() {
13005
13673
  var name = CHAT_IFRAME;
13006
- var _this$props13 = this.props,
13007
- messageService = _this$props13.messageService,
13008
- store = _this$props13.store,
13009
- adaSettings = _this$props13.adaSettings;
13674
+ var _this$props14 = this.props,
13675
+ messageService = _this$props14.messageService,
13676
+ store = _this$props14.store,
13677
+ adaSettings = _this$props14.adaSettings;
13010
13678
  var _this$state3 = this.state,
13011
13679
  campaignToTrigger = _this$state3.campaignToTrigger,
13012
13680
  followUpResponseId = _this$state3.followUpResponseId;
@@ -13030,9 +13698,9 @@ var Container = /*#__PURE__*/function (_Component) {
13030
13698
  value: function renderIntroFrame() {
13031
13699
  var _intro$style;
13032
13700
 
13033
- var _this$props14 = this.props,
13034
- adaSettings = _this$props14.adaSettings,
13035
- intro = _this$props14.intro;
13701
+ var _this$props15 = this.props,
13702
+ adaSettings = _this$props15.adaSettings,
13703
+ intro = _this$props15.intro;
13036
13704
  var parentElement = adaSettings.parentElement;
13037
13705
  var hideIntroOverride = this.state.hideIntroOverride;
13038
13706
 
@@ -13046,9 +13714,9 @@ var Container = /*#__PURE__*/function (_Component) {
13046
13714
  }, {
13047
13715
  key: "renderMaskFrame",
13048
13716
  value: function renderMaskFrame() {
13049
- var _this$props15 = this.props,
13050
- adaSettings = _this$props15.adaSettings,
13051
- hideMask = _this$props15.hideMask;
13717
+ var _this$props16 = this.props,
13718
+ adaSettings = _this$props16.adaSettings,
13719
+ hideMask = _this$props16.hideMask;
13052
13720
  var parentElement = adaSettings.parentElement;
13053
13721
 
13054
13722
  if (parentElement || hideMask) {
@@ -13060,13 +13728,12 @@ var Container = /*#__PURE__*/function (_Component) {
13060
13728
  }, {
13061
13729
  key: "renderBackdrop",
13062
13730
  value: function renderBackdrop() {
13063
- var _this$props16 = this.props,
13064
- client = _this$props16.client,
13065
- adaSettings = _this$props16.adaSettings,
13066
- chatDimensions = _this$props16.chatDimensions,
13067
- isDrawerOpen = _this$props16.isDrawerOpen,
13068
- isIntroShown = _this$props16.isIntroShown,
13069
- language = _this$props16.language;
13731
+ var _this$props17 = this.props,
13732
+ client = _this$props17.client,
13733
+ adaSettings = _this$props17.adaSettings,
13734
+ chatDimensions = _this$props17.chatDimensions,
13735
+ isDrawerOpen = _this$props17.isDrawerOpen,
13736
+ isIntroShown = _this$props17.isIntroShown;
13070
13737
  var parentElement = adaSettings.parentElement; // checking for a non-empty parentElement here to
13071
13738
  // hide the backdrop in the SDKs
13072
13739
 
@@ -13077,15 +13744,11 @@ var Container = /*#__PURE__*/function (_Component) {
13077
13744
  var hasProactiveMessagesShown = Boolean(chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.height);
13078
13745
  var shouldShowShadow = isDrawerOpen || hasProactiveMessagesShown || isIntroShown;
13079
13746
  return v("div", {
13080
- style: Container_objectSpread(Container_objectSpread(Container_objectSpread({
13747
+ style: Container_objectSpread(Container_objectSpread((0,defineProperty/* default */.Z)({
13081
13748
  position: "fixed",
13082
13749
  width: "635px",
13083
13750
  height: "785px"
13084
- }, isRTL(client, language) ? {
13085
- left: 0
13086
- } : {
13087
- right: 0
13088
- }), isRTL(client, language) ? {
13751
+ }, getAlignment(adaSettings), 0), getAlignment(adaSettings) === "left" ? {
13089
13752
  background: "linear-gradient(45deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0) 40.92%)"
13090
13753
  } : {
13091
13754
  background: "linear-gradient(315.92deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0) 40.92%)"
@@ -13117,7 +13780,8 @@ var Container = /*#__PURE__*/function (_Component) {
13117
13780
  var frameWidth = this.frameWidth; // when using text button style, the frame shouldn't be wider than the button
13118
13781
 
13119
13782
  return v(components_ButtonFrame, {
13120
- frameWidth: frameWidth
13783
+ frameWidth: frameWidth,
13784
+ adaSettings: adaSettings
13121
13785
  });
13122
13786
  }
13123
13787
  }, {
@@ -13703,7 +14367,7 @@ window.__AdaEmbedConstructor = Embed;
13703
14367
  /* harmony export */ });
13704
14368
  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);
13705
14369
  var isProduction = "production" === "production";
13706
- var embed2Version = "cc93ef4";
14370
+ var embed2Version = "d8793ba";
13707
14371
 
13708
14372
  /***/ }),
13709
14373
 
@@ -23100,7 +23764,7 @@ function _loadEmbed() {
23100
23764
  polyfillVersionString = "legacy";
23101
23765
  }
23102
23766
 
23103
- embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "cc93ef4", "/index.js");
23767
+ embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "d8793ba", "/index.js");
23104
23768
  }
23105
23769
 
23106
23770
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
@@ -23227,10 +23891,10 @@ function createEmbedObject() {
23227
23891
  handle: adaSettings.handle,
23228
23892
  embedVersion: 2,
23229
23893
  embedSettings: adaSettings,
23230
- version: "1.0.29",
23894
+ version: "1.0.33",
23231
23895
  isNpm: true,
23232
23896
  hostPage: window.location.href,
23233
- commitHash: "cc93ef4"
23897
+ commitHash: "d8793ba"
23234
23898
  }, {
23235
23899
  sampleRate: 0.01 // 1% of logs will go through
23236
23900
 
@@ -23645,7 +24309,7 @@ function createEmbedObject() {
23645
24309
  }
23646
24310
  ;// CONCATENATED MODULE: ./src/index-npm.ts
23647
24311
 
23648
- Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 8180));
24312
+ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 2396));
23649
24313
  /* harmony default export */ var index_npm = (createEmbedObject());
23650
24314
  }();
23651
24315
  module.exports = __webpack_exports__;