@ada-support/embed2 1.0.30 → 1.0.34

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: "4bd8959a46f1e6b6aaa1e191bdc95268aa8d674f",
8495
+ release: "8920d7ba7d0078df10f4e731ddb98d3a7716a234",
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, "4bd8959", "/index.html");
9179
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "8920d7b", "/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,846 @@ 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: "8920d7ba7d0078df10f4e731ddb98d3a7716a234",
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 state, privateMode, client;
9901
+ return regenerator_default().wrap(function _callee3$(_context3) {
9902
+ while (1) {
9903
+ switch (_context3.prev = _context3.next) {
9904
+ case 0:
9905
+ _context3.next = 2;
9906
+ return store.getState();
9907
+
9908
+ case 2:
9909
+ state = _context3.sent;
9910
+
9911
+ if (state) {
9912
+ _context3.next = 5;
9913
+ break;
9914
+ }
9915
+
9916
+ return _context3.abrupt("return", null);
9917
+
9918
+ case 5:
9919
+ privateMode = state.privateMode, client = state.client;
9920
+ return _context3.abrupt("return", retrieveStorage(CHATTER_STORAGE_KEY, client, Boolean(privateMode)));
9921
+
9922
+ case 7:
9923
+ case "end":
9924
+ return _context3.stop();
9925
+ }
9926
+ }
9927
+ }, _callee3);
9928
+ }));
9929
+ return _getChatterFromStorage.apply(this, arguments);
9930
+ }
9931
+
9932
+ (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
9933
+ var chatterFromStorage, frameInitialized;
9934
+ return regenerator_default().wrap(function _callee$(_context) {
9935
+ while (1) {
9936
+ switch (_context.prev = _context.next) {
9937
+ case 0:
9938
+ _context.next = 2;
9939
+ return getChatterFromStorage();
9940
+
9941
+ case 2:
9942
+ chatterFromStorage = _context.sent;
9943
+ _context.next = 5;
9944
+ return initializeFrame(true, {
9945
+ chatterToken: chatterFromStorage || undefined
9946
+ });
9947
+
9948
+ case 5:
9949
+ frameInitialized = _context.sent;
9950
+
9951
+ if (frameInitialized) {
9952
+ _context.next = 8;
9953
+ break;
9954
+ }
9955
+
9956
+ return _context.abrupt("return");
9957
+
9958
+ case 8:
9959
+ setIsDrawerOpen();
9960
+ /**
9961
+ * Listen for FC events
9962
+ */
9963
+
9964
+ frame_fc.addEventListener(function (type) {
9965
+ switch (type) {
9966
+ case DELETE_HISTORY_EVENT:
9967
+ {
9968
+ safeLocalStorage.removeItem(CHATTER_STORAGE_KEY);
9969
+ safeSessionStorage.removeItem(CHATTER_STORAGE_KEY);
9970
+ safeLocalStorage.removeItem(IN_LIVE_CHAT_STORAGE_KEY);
9971
+ safeSessionStorage.removeItem(IN_LIVE_CHAT_STORAGE_KEY);
9972
+ break;
9973
+ }
9974
+
9975
+ default:
9976
+ break;
9977
+ }
9978
+ });
9979
+ /**
9980
+ * Listen for store changes
9981
+ */
9982
+
9983
+ store.subscribe(function (state) {
9984
+ /**
9985
+ * Store isDrawerOpen state in sessionStorage if crossWindowPersistence is enabled
9986
+ */
9987
+ if (state.isDrawerOpen !== lastDrawerState && state.crossWindowPersistence) {
9988
+ safeSessionStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, state.isDrawerOpen);
9989
+ }
9990
+ });
9991
+
9992
+ case 11:
9993
+ case "end":
9994
+ return _context.stop();
9995
+ }
9996
+ }
9997
+ }, _callee);
9998
+ }))();
9999
+ ;// CONCATENATED MODULE: ./src/client/store/mutations/index.ts
10000
+
10001
+
10002
+
10003
+
10004
+
10005
+
10006
+
10007
+
10008
+ 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; }
10009
+
10010
+ 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; }
10011
+
10012
+
10013
+
10014
+
10015
+
10016
+
10017
+ var mutations = function mutations(state, action) {
10018
+ switch (action.type) {
10019
+ case ActionTypes.TOGGLE_CHAT_TYPE:
10020
+ {
10021
+ var hasChatOpenedAfterProactiveMessagesShown = state.hasChatOpenedAfterProactiveMessagesShown;
10022
+
10023
+ if (!state.isDrawerOpen && state.latestCampaignKey && !hasChatOpenedAfterProactiveMessagesShown) {
10024
+ hasChatOpenedAfterProactiveMessagesShown = true;
10025
+ }
10026
+
10027
+ safeLocalStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, !state.isDrawerOpen);
10028
+ return _objectSpread(_objectSpread({}, state), {}, {
10029
+ isDrawerOpen: !state.isDrawerOpen,
10030
+ isIntroShown: false,
10031
+ drawerHasBeenOpened: true,
10032
+ unreadMessageCount: 0,
10033
+ hasChatOpenedAfterProactiveMessagesShown: hasChatOpenedAfterProactiveMessagesShown
10034
+ });
10035
+ }
10036
+
10037
+ case ActionTypes.SET_STATE_TYPE:
10038
+ return _objectSpread(_objectSpread({}, state), action.payload);
10039
+
10040
+ case ActionTypes.INCREMENT_MESSAGE_COUNT_TYPE:
10041
+ {
10042
+ var messages = action.payload.messages; // Filter out Proactive Messages
10043
+
10044
+ var nonProactive = filter_default()(messages).call(messages, function (message) {
10045
+ return !message.campaign_key;
10046
+ });
10047
+
10048
+ return _objectSpread(_objectSpread({}, state), {}, {
10049
+ unreadMessageCount: nonProactive.length
10050
+ });
10051
+ }
10052
+
10053
+ case ActionTypes.SET_CONNECTION_STATE_TYPE:
10054
+ {
10055
+ var newConnections = _objectSpread(_objectSpread({}, state.connections), action.payload);
10056
+
10057
+ var connectionValues = values_default()(newConnections);
10058
+
10059
+ var appConnectionState;
10060
+ var done = connectionValues.every(function (connectionState) {
10061
+ return connectionState === ConnectionState.Done;
10062
+ });
10063
+ var loading = connectionValues.some(function (connectionState) {
10064
+ return connectionState === ConnectionState.Done;
10065
+ });
10066
+ var failure = connectionValues.some(function (connectionState) {
10067
+ return connectionState === ConnectionState.Failure;
10068
+ });
10069
+
10070
+ if (done) {
10071
+ appConnectionState = ConnectionState.Done;
10072
+ } else if (failure) {
10073
+ appConnectionState = ConnectionState.Failure;
10074
+ } else if (loading) {
10075
+ appConnectionState = ConnectionState.Loading;
10076
+ } else {
10077
+ appConnectionState = ConnectionState.Uninitiated;
10078
+ }
10079
+
10080
+ return _objectSpread(_objectSpread({}, state), {}, {
10081
+ connections: newConnections,
10082
+ appConnectionState: appConnectionState
10083
+ });
10084
+ }
10085
+
10086
+ default:
10087
+ return state;
10088
+ }
10089
+ };
10090
+
10091
+ /* harmony default export */ var store_mutations = (mutations);
10092
+ ;// CONCATENATED MODULE: ./src/client/helpers/local-notifications/index.ts
10093
+ var browserHasNotificationSupport = ("Notification" in window);
10094
+ function checkIfUserHasGivenPermission() {
10095
+ if (!browserHasNotificationSupport) {
10096
+ return false;
10097
+ }
10098
+
10099
+ return Notification.permission === "granted";
10100
+ }
10101
+ function requestNotificationPermission() {
10102
+ if (!browserHasNotificationSupport) {
10103
+ return null;
10104
+ }
10105
+
10106
+ return Notification.requestPermission();
10107
+ }
10108
+ function createNotification(title, isChatOpen, onClickHandler, options) {
10109
+ if (!checkIfUserHasGivenPermission() || !document.hidden && isChatOpen) {
10110
+ return null;
10111
+ }
10112
+
10113
+ var notification = new Notification(title, options);
10114
+
10115
+ notification.onclick = function () {
10116
+ if (onClickHandler) {
10117
+ onClickHandler();
10118
+ }
10119
+
10120
+ notification.close();
10121
+ };
10122
+
10123
+ return notification;
10124
+ }
10125
+
10126
+ function notificationPermissionGuard(state) {
10127
+ if (state === "granted" || state === "denied") {
10128
+ return state;
10129
+ }
10130
+
10131
+ return "default";
10132
+ }
10133
+ /**
10134
+ * Used to listen for changes in Notification permission state
10135
+ */
10136
+
10137
+
10138
+ function notificationPermListener(notificationPermChangeHandler) {
10139
+ if (!("permissions" in navigator)) {
10140
+ return;
10141
+ }
10142
+
10143
+ navigator.permissions.query({
10144
+ name: "notifications"
10145
+ }).then(function (notificationPerm) {
10146
+ // eslint-disable-next-line no-param-reassign
10147
+ notificationPerm.onchange = function () {
10148
+ notificationPermChangeHandler(notificationPermissionGuard(notificationPerm.state));
10149
+ };
10150
+ });
10151
+ }
10152
+ ;// CONCATENATED MODULE: ./src/client/store/state.ts
10153
+
10154
+
10155
+
10156
+
10157
+
10158
+ function getValueFromStorage(key) {
10159
+ return safeLocalStorage.getItem(key) || safeSessionStorage.getItem(key);
10160
+ }
10161
+
10162
+ var state = {
10163
+ handle: undefined,
10164
+ styles: undefined,
10165
+ domain: undefined,
10166
+ cluster: undefined,
10167
+ language: undefined,
9481
10168
  greeting: undefined,
9482
10169
  crossWindowPersistence: true,
9483
10170
  hideMask: true,
@@ -9495,7 +10182,10 @@ var state = {
9495
10182
  initialURL: undefined,
9496
10183
  privateMode: false,
9497
10184
  rolloutOverride: undefined,
9498
- chatterToken: undefined,
10185
+ chatterToken: getValueFromStorage(CHATTER_TOKEN_STORAGE_KEY) || undefined,
10186
+ chatterCreated: getValueFromStorage(CHATTER_CREATED_STORAGE_KEY) || undefined,
10187
+ zdSessionId: getValueFromStorage(ZD_SESSION_STORAGE_KEY) || undefined,
10188
+ zdPreviousTags: getValueFromStorage(ZD_PREVIOUS_TAGS_STORAGE_KEY) || undefined,
9499
10189
  connections: {},
9500
10190
  appConnectionState: ConnectionState.Uninitiated,
9501
10191
  testMode: false,
@@ -9507,7 +10197,8 @@ var state = {
9507
10197
  isChatWebsocketConnected: false,
9508
10198
  latestCampaignKey: undefined,
9509
10199
  hasChatOpenedAfterProactiveMessagesShown: false,
9510
- chatterInLiveChat: false
10200
+ chatterInLiveChat: false,
10201
+ adaSettings: {}
9511
10202
  };
9512
10203
  /* harmony default export */ var store_state = (state);
9513
10204
  ;// CONCATENATED MODULE: ./src/client/store/index.ts
@@ -9871,116 +10562,11 @@ var DEFAULT_LANGUAGE_CODE = "en";
9871
10562
  * I'M SO SORRY.
9872
10563
  */
9873
10564
 
9874
- var getBrowserLanguage = function getBrowserLanguage() {
10565
+ var get_browser_language_getBrowserLanguage = function getBrowserLanguage() {
9875
10566
  return (navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || DEFAULT_LANGUAGE_CODE).split("-")[0];
9876
10567
  };
9877
10568
 
9878
- /* harmony default export */ var get_browser_language = (getBrowserLanguage);
9879
- ;// CONCATENATED MODULE: ./src/frames/lib/safe-storage/index.ts
9880
-
9881
-
9882
-
9883
-
9884
-
9885
- var StorageTypes;
9886
-
9887
- (function (StorageTypes) {
9888
- StorageTypes["Local"] = "local";
9889
- StorageTypes["Session"] = "session";
9890
- })(StorageTypes || (StorageTypes = {}));
9891
-
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);
9900
-
9901
- (0,defineProperty/* default */.Z)(this, "storageType", void 0);
9902
-
9903
- (0,defineProperty/* default */.Z)(this, "storage", null);
9904
-
9905
- this.storageType = storageType;
9906
-
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
9913
-
9914
-
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
- }
9923
-
9924
- return null;
9925
- } // eslint-disable-next-line class-methods-use-this
9926
-
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
- }
9935
-
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
- }
9945
-
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
- }
9959
-
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
- }
9972
-
9973
- this.storage.removeItem(key);
9974
- } catch (e) {
9975
- (0,errors/* warn */.Z)("Cannot removeItem from ".concat(this.storageType, "Storage."));
9976
- }
9977
- }
9978
- }]);
9979
-
9980
- return SafeStorage;
9981
- }();
9982
- var safeLocalStorage = new SafeStorage(StorageTypes.Local);
9983
- var safeSessionStorage = new SafeStorage(StorageTypes.Session);
10569
+ /* harmony default export */ var get_browser_language = (get_browser_language_getBrowserLanguage);
9984
10570
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js
9985
10571
  var trim = __webpack_require__(5843);
9986
10572
  var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
@@ -10609,9 +11195,6 @@ function bindActionCreators(action, dispatch) {
10609
11195
  return dispatch(action, payload);
10610
11196
  };
10611
11197
  }
10612
- ;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
10613
- var CHATTER_STORAGE_KEY = "chatter";
10614
- var IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
10615
11198
  ;// CONCATENATED MODULE: ./src/common/helpers/fetch-client.ts
10616
11199
 
10617
11200
 
@@ -10723,12 +11306,26 @@ function _fetchClient() {
10723
11306
 
10724
11307
 
10725
11308
  var RTLLanguages = ["ar", "he"];
11309
+ var isRTLLanguage = function isRTLLanguage(language) {
11310
+ return Boolean(language && includes_default()(RTLLanguages).call(RTLLanguages, language)) || false;
11311
+ };
10726
11312
  var isRTL = function isRTL(client, language) {
10727
- var rtlLanguageBool = language && includes_default()(RTLLanguages).call(RTLLanguages, language) || includes_default()(RTLLanguages).call(RTLLanguages, get_browser_language());
10728
-
11313
+ var rtlLanguageBool = isRTLLanguage(language) || isRTLLanguage(getBrowserLanguage());
10729
11314
  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);
10730
11315
  return featureFlagsBool && rtlLanguageBool || false;
10731
11316
  };
11317
+ ;// CONCATENATED MODULE: ./src/common/helpers/getAlignment.ts
11318
+
11319
+ function getAlignment(adaSettings) {
11320
+ var language = adaSettings.language,
11321
+ align = adaSettings.align;
11322
+
11323
+ if (align === "auto") {
11324
+ return isRTLLanguage(language) ? "left" : "right";
11325
+ }
11326
+
11327
+ return align || "right";
11328
+ }
10732
11329
  ;// CONCATENATED MODULE: ./src/common/helpers/wait.ts
10733
11330
 
10734
11331
  function wait(ms) {
@@ -10807,32 +11404,6 @@ var INTRO_IFRAME = "intro";
10807
11404
  var BUTTON_IFRAME = "button";
10808
11405
  var MASK_IFRAME = "drawer-mask";
10809
11406
  var XSTORAGE_IFRAME = "x-storage";
10810
- ;// CONCATENATED MODULE: ./src/frames/helpers/storage/index.ts
10811
-
10812
- var PERSISTENCE_NORMAL = "normal";
10813
- var PERSISTENCE_SESSION = "session";
10814
- /**
10815
- * Retrieves items from local or session storage, depending on the client's
10816
- * persistence setting. If privateMode is set, it returns null.
10817
- */
10818
-
10819
- function retrieveStorage(key, client, privateMode) {
10820
- var persistence = client.persistence;
10821
-
10822
- if (privateMode) {
10823
- return null;
10824
- }
10825
-
10826
- if (persistence === PERSISTENCE_NORMAL) {
10827
- return safeLocalStorage.getItem(key);
10828
- }
10829
-
10830
- if (persistence === PERSISTENCE_SESSION) {
10831
- return safeSessionStorage.getItem(key);
10832
- }
10833
-
10834
- return null;
10835
- }
10836
11407
  // EXTERNAL MODULE: ./src/services/logger/index.ts
10837
11408
  var services_logger = __webpack_require__(9517);
10838
11409
  ;// CONCATENATED MODULE: ./src/client/components/IFrame/index.tsx
@@ -11117,36 +11688,38 @@ var ButtonFrame = /*#__PURE__*/function (_Component) {
11117
11688
  buttonSize = _this$props.buttonSize,
11118
11689
  buttonStyle = _this$props.buttonStyle,
11119
11690
  frameWidth = _this$props.frameWidth,
11120
- language = _this$props.language;
11691
+ adaSettings = _this$props.adaSettings;
11121
11692
 
11122
11693
  if (!client) {
11123
11694
  return "";
11124
11695
  }
11125
11696
 
11126
- var delayedIsShown = this.state.delayedIsShown; // 56 = (SHADOW BLUR=48) + (2 * SPREAD=8)
11697
+ var delayedIsShown = this.state.delayedIsShown; // 48 = (SHADOW BLUR=40) + (2 * SPREAD=8)
11127
11698
 
11128
- var BOX_SHADOW_BUFFER = client.features.chat_ui_v2 ? 56 : 8;
11699
+ var BOX_SHADOW_BUFFER = client.features.chat_ui_v2 ? 48 : 8;
11129
11700
  var POSITION_FROM_SCREEN_EDGE = 24;
11130
11701
  var buttonSizeWithBuffer = buttonSize + BOX_SHADOW_BUFFER;
11131
11702
  var buttonPosition = POSITION_FROM_SCREEN_EDGE - BOX_SHADOW_BUFFER / 2;
11132
- var frameHeight = buttonSize + BOX_SHADOW_BUFFER;
11703
+ var roundFrameHeight = buttonSize + BOX_SHADOW_BUFFER; // text button has a fixed height of 44px
11704
+
11705
+ var textFrameHeight = 44 + BOX_SHADOW_BUFFER;
11133
11706
  var stylesForHiding = "\n top: -9999px !important;\n left: -9999px !important;\n ";
11134
11707
 
11135
- 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 ");
11708
+ 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 ");
11136
11709
 
11137
11710
  if (client.features.chat_ui_v2) {
11138
11711
  var _context8;
11139
11712
 
11140
- 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 ");
11713
+ 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 ");
11141
11714
 
11142
11715
  if (buttonStyle === "text") {
11143
11716
  var _context9;
11144
11717
 
11145
- styles += concat_default()(_context9 = "\n width: ".concat(frameWidth, "px;\n height: ")).call(_context9, frameHeight, "px;\n ");
11718
+ styles += concat_default()(_context9 = "\n width: ".concat(frameWidth, "px;\n height: ")).call(_context9, textFrameHeight, "px;\n ");
11146
11719
  } else {
11147
11720
  var _context10;
11148
11721
 
11149
- styles += concat_default()(_context10 = "\n width: ".concat(frameHeight, "px;\n height: ")).call(_context10, frameHeight, "px;\n ");
11722
+ styles += concat_default()(_context10 = "\n width: ".concat(roundFrameHeight, "px;\n height: ")).call(_context10, roundFrameHeight, "px;\n ");
11150
11723
  }
11151
11724
  }
11152
11725
 
@@ -11237,6 +11810,7 @@ function ChatFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefine
11237
11810
 
11238
11811
 
11239
11812
 
11813
+
11240
11814
  var ChatFrame = /*#__PURE__*/function (_Component) {
11241
11815
  (0,inherits/* default */.Z)(ChatFrame, _Component);
11242
11816
 
@@ -11356,7 +11930,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11356
11930
  skipGreeting = _this$props3.skipGreeting,
11357
11931
  wasIntroShown = _this$props3.wasIntroShown,
11358
11932
  privateMode = _this$props3.privateMode,
11359
- testMode = _this$props3.testMode;
11933
+ testMode = _this$props3.testMode,
11934
+ adaSettings = _this$props3.adaSettings;
11360
11935
  return getURL({
11361
11936
  name: name,
11362
11937
  handle: handle,
@@ -11369,7 +11944,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11369
11944
  introShown: wasIntroShown,
11370
11945
  embed2: 1,
11371
11946
  private: privateMode ? 1 : null,
11372
- test_user: testMode ? 1 : null
11947
+ test_user: testMode ? 1 : null,
11948
+ align: getAlignment(adaSettings)
11373
11949
  }
11374
11950
  });
11375
11951
  }
@@ -11382,7 +11958,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11382
11958
  isDrawerOpen = _this$props4.isDrawerOpen,
11383
11959
  client = _this$props4.client,
11384
11960
  testMode = _this$props4.testMode,
11385
- language = _this$props4.language;
11961
+ adaSettings = _this$props4.adaSettings;
11386
11962
 
11387
11963
  if (!client) {
11388
11964
  return "";
@@ -11402,10 +11978,10 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11402
11978
  if (client.features.chat_ui_v2) {
11403
11979
  var _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9;
11404
11980
 
11405
- 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 ");
11981
+ 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 ");
11406
11982
  }
11407
11983
 
11408
- 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 ");
11984
+ 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 ");
11409
11985
  }
11410
11986
  }, {
11411
11987
  key: "hasVisibleProactiveMessages",
@@ -11422,13 +11998,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11422
11998
  var _this$props5 = this.props,
11423
11999
  chatDimensions = _this$props5.chatDimensions,
11424
12000
  client = _this$props5.client,
11425
- language = _this$props5.language; // delta is used to determine how much of the button's height should be ignored
12001
+ adaSettings = _this$props5.adaSettings; // delta is used to determine how much of the button's height should be ignored
11426
12002
  // when spacing the proactive message
11427
12003
 
11428
- var delta = 14;
12004
+ var delta = 3;
11429
12005
  var TEXT_BUTTON_HEIGHT = 44;
11430
12006
  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;
11431
- 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 ");
12007
+ 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 ");
11432
12008
  }
11433
12009
  }, {
11434
12010
  key: "chooseStyles",
@@ -11563,7 +12139,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11563
12139
  var _handleChatEvent = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(type, payload, id) {
11564
12140
  var _this4 = this;
11565
12141
 
11566
- 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;
12142
+ 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;
11567
12143
 
11568
12144
  return regenerator_default().wrap(function _callee$(_context22) {
11569
12145
  while (1) {
@@ -11571,30 +12147,30 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11571
12147
  case 0:
11572
12148
  _this$props8 = this.props, adaSettings = _this$props8.adaSettings, setState = _this$props8.setState, setConnectionState = _this$props8.setConnectionState;
11573
12149
  _context22.t0 = type;
11574
- _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;
12150
+ _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;
11575
12151
  break;
11576
12152
 
11577
12153
  case 4:
11578
12154
  this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
11579
- return _context22.abrupt("break", 57);
12155
+ return _context22.abrupt("break", 68);
11580
12156
 
11581
12157
  case 6:
11582
12158
  this.channel.isConnected = true;
11583
12159
  setConnectionState({
11584
12160
  "chat": ConnectionState.Done
11585
12161
  });
11586
- return _context22.abrupt("break", 57);
12162
+ return _context22.abrupt("break", 68);
11587
12163
 
11588
12164
  case 9:
11589
12165
  setState({
11590
12166
  isChatWebsocketConnected: true
11591
12167
  });
11592
- return _context22.abrupt("break", 57);
12168
+ return _context22.abrupt("break", 68);
11593
12169
 
11594
12170
  case 11:
11595
12171
  _ref = payload, eventKey = _ref.eventKey, data = _ref.data;
11596
12172
  publishEvent(eventKey, data);
11597
- return _context22.abrupt("break", 57);
12173
+ return _context22.abrupt("break", 68);
11598
12174
 
11599
12175
  case 14:
11600
12176
  _ref2 = payload, analytics = _ref2.analytics;
@@ -11604,66 +12180,124 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11604
12180
  analyticsCallback(analytics);
11605
12181
  }
11606
12182
 
11607
- return _context22.abrupt("break", 57);
12183
+ return _context22.abrupt("break", 68);
11608
12184
 
11609
12185
  case 18:
11610
12186
  client = this.props.client;
11611
- _ref3 = payload, chatter = _ref3.chatter;
12187
+ _ref3 = payload, chatter = _ref3.chatter, created = _ref3.created;
11612
12188
  chatterTokenCallback = adaSettings.chatterTokenCallback;
11613
- _context22.next = 23;
12189
+
12190
+ if (client) {
12191
+ _context22.next = 23;
12192
+ break;
12193
+ }
12194
+
12195
+ throw new errors/* AdaEmbedError */.S("`client` is undefined");
12196
+
12197
+ case 23:
12198
+ _context22.next = 25;
11614
12199
  return setState({
11615
- chatterToken: chatter
12200
+ chatterToken: chatter,
12201
+ chatterCreated: created
11616
12202
  });
11617
12203
 
11618
- case 23:
12204
+ case 25:
11619
12205
  /**
11620
12206
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11621
12207
  * come from chat. This is important for campaign and business event triggers.
11622
12208
  */
11623
12209
  if (client.persistence === PERSISTENCE_NORMAL) {
11624
12210
  safeLocalStorage.setItem(CHATTER_STORAGE_KEY, chatter);
12211
+ safeLocalStorage.setItem(CHATTER_CREATED_STORAGE_KEY, created);
11625
12212
  } else if (client.persistence === PERSISTENCE_SESSION) {
11626
12213
  safeSessionStorage.setItem(CHATTER_STORAGE_KEY, chatter);
12214
+ safeSessionStorage.setItem(CHATTER_CREATED_STORAGE_KEY, created);
11627
12215
  }
11628
12216
 
11629
12217
  if (chatterTokenCallback) {
11630
12218
  chatterTokenCallback(chatter);
11631
12219
  }
11632
12220
 
11633
- return _context22.abrupt("break", 57);
12221
+ return _context22.abrupt("break", 68);
11634
12222
 
11635
- case 26:
12223
+ case 28:
11636
12224
  _client = this.props.client;
11637
- _ref4 = payload, inLiveChat = _ref4.inLiveChat;
11638
- _context22.next = 30;
12225
+ _ref4 = payload, zdSessionId = _ref4.zdSessionId, zdPreviousTags = _ref4.zdPreviousTags;
12226
+
12227
+ if (_client) {
12228
+ _context22.next = 32;
12229
+ break;
12230
+ }
12231
+
12232
+ throw new errors/* AdaEmbedError */.S("`client` is undefined");
12233
+
12234
+ case 32:
12235
+ _context22.next = 34;
12236
+ return setState({
12237
+ zdSessionId: zdSessionId
12238
+ });
12239
+
12240
+ case 34:
12241
+ storage = function () {
12242
+ if (_client.persistence === PERSISTENCE_NORMAL) {
12243
+ return safeLocalStorage;
12244
+ }
12245
+
12246
+ if (_client.persistence === PERSISTENCE_SESSION) {
12247
+ return safeSessionStorage;
12248
+ }
12249
+
12250
+ return null;
12251
+ }();
12252
+
12253
+ if (storage) {
12254
+ if (zdSessionId === null) {
12255
+ storage.removeItem(ZD_SESSION_STORAGE_KEY);
12256
+ } else {
12257
+ storage.setItem(ZD_SESSION_STORAGE_KEY, zdSessionId);
12258
+ }
12259
+
12260
+ if (zdPreviousTags === null) {
12261
+ storage.removeItem(ZD_PREVIOUS_TAGS_STORAGE_KEY);
12262
+ } else {
12263
+ storage.setItem(ZD_PREVIOUS_TAGS_STORAGE_KEY, zdPreviousTags);
12264
+ }
12265
+ }
12266
+
12267
+ return _context22.abrupt("break", 68);
12268
+
12269
+ case 37:
12270
+ _client2 = this.props.client;
12271
+ _ref5 = payload, inLiveChat = _ref5.inLiveChat;
12272
+ _context22.next = 41;
11639
12273
  return setState({
11640
12274
  chatterInLiveChat: inLiveChat
11641
12275
  });
11642
12276
 
11643
- case 30:
12277
+ case 41:
11644
12278
  /**
11645
12279
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11646
12280
  * come from chat. This is important for campaign and business event triggers.
11647
12281
  */
11648
- if (_client.persistence === PERSISTENCE_NORMAL) {
12282
+ if (_client2.persistence === PERSISTENCE_NORMAL) {
11649
12283
  safeLocalStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
11650
- } else if (_client.persistence === PERSISTENCE_SESSION) {
12284
+ } else if (_client2.persistence === PERSISTENCE_SESSION) {
11651
12285
  safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
11652
12286
  }
11653
12287
 
11654
- return _context22.abrupt("break", 57);
12288
+ return _context22.abrupt("break", 68);
11655
12289
 
11656
- case 32:
12290
+ case 43:
11657
12291
  eventCallbacks = adaSettings.eventCallbacks;
11658
12292
 
11659
12293
  if (eventCallbacks) {
11660
- _context22.next = 35;
12294
+ _context22.next = 46;
11661
12295
  break;
11662
12296
  }
11663
12297
 
11664
- return _context22.abrupt("break", 57);
12298
+ return _context22.abrupt("break", 68);
11665
12299
 
11666
- case 35:
12300
+ case 46:
11667
12301
  customJavascriptEvent = payload.event_data;
11668
12302
  specificCallback = eventCallbacks[customJavascriptEvent.event_name];
11669
12303
  genericCallback = eventCallbacks["*"];
@@ -11676,14 +12310,14 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11676
12310
  genericCallback(customJavascriptEvent);
11677
12311
  }
11678
12312
 
11679
- return _context22.abrupt("break", 57);
12313
+ return _context22.abrupt("break", 68);
11680
12314
 
11681
- case 41:
12315
+ case 52:
11682
12316
  resetChat = this.props.resetChat;
11683
12317
  resetChat();
11684
- return _context22.abrupt("break", 57);
12318
+ return _context22.abrupt("break", 68);
11685
12319
 
11686
- case 44:
12320
+ case 55:
11687
12321
  zdChatterAuthCallback = adaSettings.zdChatterAuthCallback;
11688
12322
 
11689
12323
  if (zdChatterAuthCallback) {
@@ -11701,35 +12335,35 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11701
12335
  this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11702
12336
  }
11703
12337
 
11704
- return _context22.abrupt("break", 57);
12338
+ return _context22.abrupt("break", 68);
11705
12339
 
11706
- case 47:
12340
+ case 58:
11707
12341
  this.handleNotifications(payload);
11708
- return _context22.abrupt("break", 57);
12342
+ return _context22.abrupt("break", 68);
11709
12343
 
11710
- case 49:
12344
+ case 60:
11711
12345
  this.channel.postMessage(BROWSER_HAS_NOTIFICATIONS_RESPONSE_EVENT, {
11712
12346
  browserHasNotificationSupport: browserHasNotificationSupport
11713
12347
  });
11714
- return _context22.abrupt("break", 57);
12348
+ return _context22.abrupt("break", 68);
11715
12349
 
11716
- case 51:
12350
+ case 62:
11717
12351
  requestNotificationPermission();
11718
- return _context22.abrupt("break", 57);
12352
+ return _context22.abrupt("break", 68);
11719
12353
 
11720
- case 53:
12354
+ case 64:
11721
12355
  conversationEndCallback = adaSettings.conversationEndCallback;
11722
12356
 
11723
12357
  if (conversationEndCallback) {
11724
12358
  conversationEndCallback(payload);
11725
12359
  }
11726
12360
 
11727
- return _context22.abrupt("break", 57);
12361
+ return _context22.abrupt("break", 68);
11728
12362
 
11729
- case 56:
11730
- return _context22.abrupt("break", 57);
12363
+ case 67:
12364
+ return _context22.abrupt("break", 68);
11731
12365
 
11732
- case 57:
12366
+ case 68:
11733
12367
  case "end":
11734
12368
  return _context22.stop();
11735
12369
  }
@@ -11877,12 +12511,12 @@ var IntroFrame = /*#__PURE__*/function (_Component) {
11877
12511
  client = _this$props2.client,
11878
12512
  buttonSize = _this$props2.buttonSize,
11879
12513
  introDimensions = _this$props2.introDimensions,
11880
- language = _this$props2.language;
12514
+ adaSettings = _this$props2.adaSettings;
11881
12515
  var INTRO_BUTTON_PADDING = 16;
11882
12516
  var introPositionRight = INTRO_BUTTON_PADDING + buttonSize;
11883
12517
  var stylesForHiding = "\n visibility: \"hidden\";\n top: -9999px !important;\n left: -9999px !important;\n ";
11884
12518
 
11885
- 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 ");
12519
+ 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 ");
11886
12520
 
11887
12521
  if (!this.isShown) {
11888
12522
  return styles + stylesForHiding;
@@ -11918,14 +12552,16 @@ function IntroFrame_mapStateToProps(storeState) {
11918
12552
  introDimensions = storeState.introDimensions,
11919
12553
  isIntroShown = storeState.isIntroShown,
11920
12554
  isDrawerOpen = storeState.isDrawerOpen,
11921
- language = storeState.language;
12555
+ language = storeState.language,
12556
+ adaSettings = storeState.adaSettings;
11922
12557
  return {
11923
12558
  client: client,
11924
12559
  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,
11925
12560
  introDimensions: introDimensions,
11926
12561
  isIntroShown: isIntroShown,
11927
12562
  isDrawerOpen: isDrawerOpen,
11928
- language: language
12563
+ language: language,
12564
+ adaSettings: adaSettings
11929
12565
  };
11930
12566
  }
11931
12567
 
@@ -12147,6 +12783,7 @@ function Container_isNativeReflectConstruct() { if (typeof Reflect === "undefine
12147
12783
 
12148
12784
 
12149
12785
 
12786
+
12150
12787
 
12151
12788
 
12152
12789
  var Container = /*#__PURE__*/function (_Component) {
@@ -12204,8 +12841,13 @@ var Container = /*#__PURE__*/function (_Component) {
12204
12841
  _createClass(Container, [{
12205
12842
  key: "componentDidMount",
12206
12843
  value: function componentDidMount() {
12207
- var adaSettings = this.props.adaSettings;
12208
- var onAdaEmbedLoaded = adaSettings.onAdaEmbedLoaded; // We want to make sure this happens before any publishEvent calls
12844
+ var _this$props = this.props,
12845
+ adaSettings = _this$props.adaSettings,
12846
+ setState = _this$props.setState;
12847
+ var onAdaEmbedLoaded = adaSettings.onAdaEmbedLoaded;
12848
+ setState({
12849
+ adaSettings: adaSettings
12850
+ }); // We want to make sure this happens before any publishEvent calls
12209
12851
  // This is why it happens even before calling initialize
12210
12852
 
12211
12853
  if (onAdaEmbedLoaded) {
@@ -12224,17 +12866,17 @@ var Container = /*#__PURE__*/function (_Component) {
12224
12866
  _client$ui_settings$e,
12225
12867
  _this2 = this;
12226
12868
 
12227
- var _this$props = this.props,
12228
- isDrawerOpen = _this$props.isDrawerOpen,
12229
- appConnectionState = _this$props.appConnectionState,
12230
- initializationReject = _this$props.initializationReject,
12231
- initializationResolve = _this$props.initializationResolve,
12232
- chatterToken = _this$props.chatterToken,
12233
- client = _this$props.client,
12234
- isChatWebsocketConnected = _this$props.isChatWebsocketConnected,
12235
- adaSettings = _this$props.adaSettings,
12236
- chatterInLiveChat = _this$props.chatterInLiveChat,
12237
- messageService = _this$props.messageService;
12869
+ var _this$props2 = this.props,
12870
+ isDrawerOpen = _this$props2.isDrawerOpen,
12871
+ appConnectionState = _this$props2.appConnectionState,
12872
+ initializationReject = _this$props2.initializationReject,
12873
+ initializationResolve = _this$props2.initializationResolve,
12874
+ chatterToken = _this$props2.chatterToken,
12875
+ client = _this$props2.client,
12876
+ isChatWebsocketConnected = _this$props2.isChatWebsocketConnected,
12877
+ adaSettings = _this$props2.adaSettings,
12878
+ chatterInLiveChat = _this$props2.chatterInLiveChat,
12879
+ messageService = _this$props2.messageService;
12238
12880
  var adaReadyCallback = adaSettings.adaReadyCallback,
12239
12881
  toggleCallback = adaSettings.toggleCallback;
12240
12882
 
@@ -12270,7 +12912,6 @@ var Container = /*#__PURE__*/function (_Component) {
12270
12912
  campaignToTrigger = _this$state.campaignToTrigger,
12271
12913
  campaignTriggerOptions = _this$state.campaignTriggerOptions,
12272
12914
  followUpResponseId = _this$state.followUpResponseId;
12273
- var chatChannel = messageService.getChannel(CHAT_IFRAME);
12274
12915
  /* We wait for all necessary preconditions (e.g. necessary connections established) to be true,
12275
12916
  * then trigger the campaign. campaignToTrigger is cleared after triggering, so we do not need
12276
12917
  * to worry about duplicate triggers.
@@ -12293,13 +12934,17 @@ var Container = /*#__PURE__*/function (_Component) {
12293
12934
  } // If a follow-up response has been queued by a triggered Campaign, tell chat to show it
12294
12935
 
12295
12936
 
12296
- if (chatChannel && isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
12297
- chatChannel.postMessage(SEND_GREETING, {
12298
- responseId: followUpResponseId
12299
- });
12300
- this.setState({
12301
- followUpResponseId: null
12302
- });
12937
+ if (isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
12938
+ var chatChannel = messageService.getChannel(CHAT_IFRAME);
12939
+
12940
+ if (chatChannel) {
12941
+ chatChannel.postMessage(SEND_GREETING, {
12942
+ responseId: followUpResponseId
12943
+ });
12944
+ this.setState({
12945
+ followUpResponseId: null
12946
+ });
12947
+ }
12303
12948
  }
12304
12949
 
12305
12950
  if (prevProps.isDrawerOpen !== isDrawerOpen && toggleCallback) {
@@ -12323,10 +12968,10 @@ var Container = /*#__PURE__*/function (_Component) {
12323
12968
  }, {
12324
12969
  key: "shouldRenderChatFrame",
12325
12970
  get: function get() {
12326
- var _this$props2 = this.props,
12327
- isDrawerOpen = _this$props2.isDrawerOpen,
12328
- adaSettings = _this$props2.adaSettings,
12329
- chatterInLiveChat = _this$props2.chatterInLiveChat;
12971
+ var _this$props3 = this.props,
12972
+ isDrawerOpen = _this$props3.isDrawerOpen,
12973
+ adaSettings = _this$props3.adaSettings,
12974
+ chatterInLiveChat = _this$props3.chatterInLiveChat;
12330
12975
  var parentElement = adaSettings.parentElement,
12331
12976
  preload = adaSettings.preload;
12332
12977
  var _this$state2 = this.state,
@@ -12370,9 +13015,9 @@ var Container = /*#__PURE__*/function (_Component) {
12370
13015
  }, {
12371
13016
  key: "computeButtonFrameWidth",
12372
13017
  value: function computeButtonFrameWidth() {
12373
- var _this$props3 = this.props,
12374
- entryContainer = _this$props3.entryContainer,
12375
- client = _this$props3.client;
13018
+ var _this$props4 = this.props,
13019
+ entryContainer = _this$props4.entryContainer,
13020
+ client = _this$props4.client;
12376
13021
  var buttonPadding = 26;
12377
13022
  var iconWithSpace = 30;
12378
13023
  var margins = 48;
@@ -12391,10 +13036,10 @@ var Container = /*#__PURE__*/function (_Component) {
12391
13036
  }, {
12392
13037
  key: "unmount",
12393
13038
  value: function unmount() {
12394
- var _this$props4 = this.props,
12395
- entryContainer = _this$props4.entryContainer,
12396
- messageService = _this$props4.messageService,
12397
- unmountCallback = _this$props4.unmountCallback;
13039
+ var _this$props5 = this.props,
13040
+ entryContainer = _this$props5.entryContainer,
13041
+ messageService = _this$props5.messageService,
13042
+ unmountCallback = _this$props5.unmountCallback;
12398
13043
  entryContainer.parentNode.removeChild(entryContainer);
12399
13044
  messageService.getAllChannels().forEach(function (channel) {
12400
13045
  channel.clearTimeoutsAndListeners();
@@ -12406,9 +13051,9 @@ var Container = /*#__PURE__*/function (_Component) {
12406
13051
  }, {
12407
13052
  key: "trackEvent",
12408
13053
  value: function trackEvent(trackEventParams) {
12409
- var _this$props5 = this.props,
12410
- adaSettings = _this$props5.adaSettings,
12411
- chatterToken = _this$props5.chatterToken;
13054
+ var _this$props6 = this.props,
13055
+ adaSettings = _this$props6.adaSettings,
13056
+ chatterToken = _this$props6.chatterToken;
12412
13057
  trackEventImpl(adaSettings, chatterToken, trackEventParams);
12413
13058
  }
12414
13059
  }, {
@@ -12435,10 +13080,10 @@ var Container = /*#__PURE__*/function (_Component) {
12435
13080
  value: function triggerCampaign(params) {
12436
13081
  var _client$marketing_cam;
12437
13082
 
12438
- var _this$props6 = this.props,
12439
- client = _this$props6.client,
12440
- isDrawerOpen = _this$props6.isDrawerOpen,
12441
- setState = _this$props6.setState;
13083
+ var _this$props7 = this.props,
13084
+ client = _this$props7.client,
13085
+ isDrawerOpen = _this$props7.isDrawerOpen,
13086
+ setState = _this$props7.setState;
12442
13087
  var chatHasBeenRendered = this.state.chatHasBeenRendered;
12443
13088
  var campaignKey = params.campaignKey,
12444
13089
  ignoreStatus = params.ignoreStatus,
@@ -12477,10 +13122,10 @@ var Container = /*#__PURE__*/function (_Component) {
12477
13122
  var _this4 = this;
12478
13123
 
12479
13124
  var useDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12480
- var _this$props7 = this.props,
12481
- adaSettings = _this$props7.adaSettings,
12482
- chatterToken = _this$props7.chatterToken,
12483
- client = _this$props7.client;
13125
+ var _this$props8 = this.props,
13126
+ adaSettings = _this$props8.adaSettings,
13127
+ chatterToken = _this$props8.chatterToken,
13128
+ client = _this$props8.client;
12484
13129
 
12485
13130
  if (!hasCampaignsEnabled(client)) {
12486
13131
  return;
@@ -12508,13 +13153,13 @@ var Container = /*#__PURE__*/function (_Component) {
12508
13153
  var _handleEmbedAction = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(type, payload, id) {
12509
13154
  var _this5 = this;
12510
13155
 
12511
- 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;
13156
+ 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;
12512
13157
 
12513
13158
  return regenerator_default().wrap(function _callee2$(_context3) {
12514
13159
  while (1) {
12515
13160
  switch (_context3.prev = _context3.next) {
12516
13161
  case 0:
12517
- _this$props8 = this.props, client = _this$props8.client, messageService = _this$props8.messageService, adaSettings = _this$props8.adaSettings;
13162
+ _this$props9 = this.props, client = _this$props9.client, messageService = _this$props9.messageService, adaSettings = _this$props9.adaSettings;
12518
13163
  parentElement = adaSettings.parentElement;
12519
13164
  localChannel = messageService.getChannel("local");
12520
13165
  xStorageChannel = messageService.getChannel(XSTORAGE_IFRAME);
@@ -12528,7 +13173,7 @@ var Container = /*#__PURE__*/function (_Component) {
12528
13173
 
12529
13174
  case 6:
12530
13175
  _context3.t0 = type;
12531
- _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;
13176
+ _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;
12532
13177
  break;
12533
13178
 
12534
13179
  case 9:
@@ -12542,7 +13187,7 @@ var Container = /*#__PURE__*/function (_Component) {
12542
13187
 
12543
13188
  case 12:
12544
13189
  this.trackEvent(payload);
12545
- return _context3.abrupt("break", 76);
13190
+ return _context3.abrupt("break", 89);
12546
13191
 
12547
13192
  case 14:
12548
13193
  if (client.features.afm_proactive_messaging) {
@@ -12555,7 +13200,7 @@ var Container = /*#__PURE__*/function (_Component) {
12555
13200
 
12556
13201
  case 17:
12557
13202
  this.triggerCampaign(payload);
12558
- return _context3.abrupt("break", 76);
13203
+ return _context3.abrupt("break", 89);
12559
13204
 
12560
13205
  case 19:
12561
13206
  if (client.features.afm_proactive_messaging) {
@@ -12568,7 +13213,7 @@ var Container = /*#__PURE__*/function (_Component) {
12568
13213
 
12569
13214
  case 22:
12570
13215
  this.evaluateCampaignConditions(payload);
12571
- return _context3.abrupt("break", 76);
13216
+ return _context3.abrupt("break", 89);
12572
13217
 
12573
13218
  case 24:
12574
13219
  toggleChat = this.props.toggleChat;
@@ -12577,10 +13222,10 @@ var Container = /*#__PURE__*/function (_Component) {
12577
13222
 
12578
13223
  case 27:
12579
13224
  localChannel.postMessage(TOGGLE_RESPONSE, null, id);
12580
- return _context3.abrupt("break", 76);
13225
+ return _context3.abrupt("break", 89);
12581
13226
 
12582
13227
  case 29:
12583
- _this$props9 = this.props, isDrawerOpen = _this$props9.isDrawerOpen, drawerHasBeenOpened = _this$props9.drawerHasBeenOpened, chatterToken = _this$props9.chatterToken;
13228
+ _this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
12584
13229
  contentToReturn = {
12585
13230
  isDrawerOpen: isDrawerOpen,
12586
13231
  isChatOpen: isDrawerOpen || Boolean(parentElement),
@@ -12588,10 +13233,10 @@ var Container = /*#__PURE__*/function (_Component) {
12588
13233
  hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
12589
13234
  };
12590
13235
  localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
12591
- return _context3.abrupt("break", 76);
13236
+ return _context3.abrupt("break", 89);
12592
13237
 
12593
13238
  case 33:
12594
- _this$props10 = this.props, metaFields = _this$props10.metaFields, setState = _this$props10.setState;
13239
+ _this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
12595
13240
  metaData = payload;
12596
13241
  newMetaFields = Container_objectSpread(Container_objectSpread({}, metaFields), metaData);
12597
13242
  _context3.next = 38;
@@ -12601,10 +13246,10 @@ var Container = /*#__PURE__*/function (_Component) {
12601
13246
 
12602
13247
  case 38:
12603
13248
  localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
12604
- return _context3.abrupt("break", 76);
13249
+ return _context3.abrupt("break", 89);
12605
13250
 
12606
13251
  case 40:
12607
- _this$props11 = this.props, sensitiveMetaFields = _this$props11.sensitiveMetaFields, _setState = _this$props11.setState;
13252
+ _this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
12608
13253
  _context3.next = 43;
12609
13254
  return _setState({
12610
13255
  sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), payload)
@@ -12612,42 +13257,54 @@ var Container = /*#__PURE__*/function (_Component) {
12612
13257
 
12613
13258
  case 43:
12614
13259
  localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
12615
- return _context3.abrupt("break", 76);
13260
+ return _context3.abrupt("break", 89);
12616
13261
 
12617
13262
  case 45:
12618
13263
  localChannel.postMessage(STOP_RESPONSE, null, id);
12619
13264
  this.unmount();
12620
- return _context3.abrupt("break", 76);
13265
+ return _context3.abrupt("break", 89);
12621
13266
 
12622
13267
  case 48:
12623
13268
  _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;
12624
13269
  _setState2 = this.props.setState;
12625
13270
  chatHasBeenRendered = this.state.chatHasBeenRendered;
12626
- _context3.next = 53;
12627
- return _setState2({
13271
+ newState = {
12628
13272
  greeting: greeting,
12629
13273
  language: language,
12630
13274
  metaFields: _newMetaFields,
12631
13275
  sensitiveMetaFields: _sensitiveMetaFields
12632
- });
13276
+ };
12633
13277
 
12634
- case 53:
12635
13278
  if (!resetChatHistory) {
12636
- _context3.next = 57;
13279
+ _context3.next = 61;
12637
13280
  break;
12638
13281
  }
12639
13282
 
12640
13283
  if (xStorageChannel) {
12641
- _context3.next = 56;
13284
+ _context3.next = 55;
12642
13285
  break;
12643
13286
  }
12644
13287
 
12645
13288
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
12646
13289
 
12647
- case 56:
12648
- xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
13290
+ case 55:
13291
+ xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
13292
+
13293
+ safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13294
+ safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13295
+ safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13296
+ safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13297
+
13298
+ newState = Container_objectSpread(Container_objectSpread({}, newState), {}, {
13299
+ chatterToken: null,
13300
+ chatterCreated: null
13301
+ });
13302
+
13303
+ case 61:
13304
+ _context3.next = 63;
13305
+ return _setState2(newState);
12649
13306
 
12650
- case 57:
13307
+ case 63:
12651
13308
  if (chatHasBeenRendered) {
12652
13309
  this.setState({
12653
13310
  hideChatOverride: true
@@ -12659,36 +13316,51 @@ var Container = /*#__PURE__*/function (_Component) {
12659
13316
  }
12660
13317
 
12661
13318
  localChannel.postMessage(RESET_RESPONSE, null, id);
12662
- return _context3.abrupt("break", 76);
13319
+ return _context3.abrupt("break", 89);
13320
+
13321
+ case 66:
13322
+ _setState3 = this.props.setState;
12663
13323
 
12664
- case 60:
12665
13324
  if (xStorageChannel) {
12666
- _context3.next = 62;
13325
+ _context3.next = 69;
12667
13326
  break;
12668
13327
  }
12669
13328
 
12670
13329
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
12671
13330
 
12672
- case 62:
13331
+ case 69:
13332
+ // Clear chatter data from local storage
13333
+ safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13334
+ safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13335
+ safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13336
+ safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13337
+
13338
+ _context3.next = 75;
13339
+ return _setState3({
13340
+ chatterToken: null,
13341
+ chatterCreated: null
13342
+ });
13343
+
13344
+ case 75:
12673
13345
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
12674
13346
  localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
12675
- return _context3.abrupt("break", 76);
13347
+ return _context3.abrupt("break", 89);
12676
13348
 
12677
- case 65:
13349
+ case 78:
12678
13350
  _ref2 = payload, body = _ref2.body, duration = _ref2.duration;
12679
13351
  EXTRA_PROACTIVE_DELAY = 1000; // Free tier campaigns re-use the createProactive infrastructure
12680
13352
 
12681
13353
  canCreateProactive = client.features.developer_proactive || client.features.afm_proactive_messaging_free_tier;
12682
13354
 
12683
13355
  if (canCreateProactive) {
12684
- _context3.next = 71;
13356
+ _context3.next = 84;
12685
13357
  break;
12686
13358
  }
12687
13359
 
12688
13360
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, "Ada Embed - Proactive intros are not available in your feature set.", id, FetchEventStatus.Failure);
12689
13361
  return _context3.abrupt("return");
12690
13362
 
12691
- case 71:
13363
+ case 84:
12692
13364
  this.setState({
12693
13365
  hideIntroOverride: true
12694
13366
  }, /*#__PURE__*/(0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
@@ -12726,14 +13398,14 @@ var Container = /*#__PURE__*/function (_Component) {
12726
13398
  }
12727
13399
  }, _callee);
12728
13400
  })));
12729
- _context3.next = 74;
13401
+ _context3.next = 87;
12730
13402
  return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
12731
13403
 
12732
- case 74:
13404
+ case 87:
12733
13405
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
12734
- return _context3.abrupt("break", 76);
13406
+ return _context3.abrupt("break", 89);
12735
13407
 
12736
- case 76:
13408
+ case 89:
12737
13409
  case "end":
12738
13410
  return _context3.stop();
12739
13411
  }
@@ -12795,13 +13467,13 @@ var Container = /*#__PURE__*/function (_Component) {
12795
13467
  var _initialize = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee3() {
12796
13468
  var _context4;
12797
13469
 
12798
- var _this$props12, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
13470
+ var _this$props13, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
12799
13471
 
12800
13472
  return regenerator_default().wrap(function _callee3$(_context8) {
12801
13473
  while (1) {
12802
13474
  switch (_context8.prev = _context8.next) {
12803
13475
  case 0:
12804
- _this$props12 = this.props, adaSettings = _this$props12.adaSettings, setState = _this$props12.setState;
13476
+ _this$props13 = this.props, adaSettings = _this$props13.adaSettings, setState = _this$props13.setState;
12805
13477
  handle = adaSettings.handle, cluster = adaSettings.cluster, domain = adaSettings.domain, rolloutOverride = adaSettings.rolloutOverride, adaReadyCallback = adaSettings.adaReadyCallback, privateMode = adaSettings.privateMode;
12806
13478
  language = adaSettings.language || get_browser_language(); // We do not want to store functions in our store. The rest of the values are useful however.
12807
13479
 
@@ -13006,10 +13678,10 @@ var Container = /*#__PURE__*/function (_Component) {
13006
13678
  key: "renderChatFrame",
13007
13679
  value: function renderChatFrame() {
13008
13680
  var name = CHAT_IFRAME;
13009
- var _this$props13 = this.props,
13010
- messageService = _this$props13.messageService,
13011
- store = _this$props13.store,
13012
- adaSettings = _this$props13.adaSettings;
13681
+ var _this$props14 = this.props,
13682
+ messageService = _this$props14.messageService,
13683
+ store = _this$props14.store,
13684
+ adaSettings = _this$props14.adaSettings;
13013
13685
  var _this$state3 = this.state,
13014
13686
  campaignToTrigger = _this$state3.campaignToTrigger,
13015
13687
  followUpResponseId = _this$state3.followUpResponseId;
@@ -13033,9 +13705,9 @@ var Container = /*#__PURE__*/function (_Component) {
13033
13705
  value: function renderIntroFrame() {
13034
13706
  var _intro$style;
13035
13707
 
13036
- var _this$props14 = this.props,
13037
- adaSettings = _this$props14.adaSettings,
13038
- intro = _this$props14.intro;
13708
+ var _this$props15 = this.props,
13709
+ adaSettings = _this$props15.adaSettings,
13710
+ intro = _this$props15.intro;
13039
13711
  var parentElement = adaSettings.parentElement;
13040
13712
  var hideIntroOverride = this.state.hideIntroOverride;
13041
13713
 
@@ -13049,9 +13721,9 @@ var Container = /*#__PURE__*/function (_Component) {
13049
13721
  }, {
13050
13722
  key: "renderMaskFrame",
13051
13723
  value: function renderMaskFrame() {
13052
- var _this$props15 = this.props,
13053
- adaSettings = _this$props15.adaSettings,
13054
- hideMask = _this$props15.hideMask;
13724
+ var _this$props16 = this.props,
13725
+ adaSettings = _this$props16.adaSettings,
13726
+ hideMask = _this$props16.hideMask;
13055
13727
  var parentElement = adaSettings.parentElement;
13056
13728
 
13057
13729
  if (parentElement || hideMask) {
@@ -13063,13 +13735,12 @@ var Container = /*#__PURE__*/function (_Component) {
13063
13735
  }, {
13064
13736
  key: "renderBackdrop",
13065
13737
  value: function renderBackdrop() {
13066
- var _this$props16 = this.props,
13067
- client = _this$props16.client,
13068
- adaSettings = _this$props16.adaSettings,
13069
- chatDimensions = _this$props16.chatDimensions,
13070
- isDrawerOpen = _this$props16.isDrawerOpen,
13071
- isIntroShown = _this$props16.isIntroShown,
13072
- language = _this$props16.language;
13738
+ var _this$props17 = this.props,
13739
+ client = _this$props17.client,
13740
+ adaSettings = _this$props17.adaSettings,
13741
+ chatDimensions = _this$props17.chatDimensions,
13742
+ isDrawerOpen = _this$props17.isDrawerOpen,
13743
+ isIntroShown = _this$props17.isIntroShown;
13073
13744
  var parentElement = adaSettings.parentElement; // checking for a non-empty parentElement here to
13074
13745
  // hide the backdrop in the SDKs
13075
13746
 
@@ -13080,15 +13751,11 @@ var Container = /*#__PURE__*/function (_Component) {
13080
13751
  var hasProactiveMessagesShown = Boolean(chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.height);
13081
13752
  var shouldShowShadow = isDrawerOpen || hasProactiveMessagesShown || isIntroShown;
13082
13753
  return v("div", {
13083
- style: Container_objectSpread(Container_objectSpread(Container_objectSpread({
13754
+ style: Container_objectSpread(Container_objectSpread((0,defineProperty/* default */.Z)({
13084
13755
  position: "fixed",
13085
13756
  width: "635px",
13086
13757
  height: "785px"
13087
- }, isRTL(client, language) ? {
13088
- left: 0
13089
- } : {
13090
- right: 0
13091
- }), isRTL(client, language) ? {
13758
+ }, getAlignment(adaSettings), 0), getAlignment(adaSettings) === "left" ? {
13092
13759
  background: "linear-gradient(45deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0) 40.92%)"
13093
13760
  } : {
13094
13761
  background: "linear-gradient(315.92deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0) 40.92%)"
@@ -13120,7 +13787,8 @@ var Container = /*#__PURE__*/function (_Component) {
13120
13787
  var frameWidth = this.frameWidth; // when using text button style, the frame shouldn't be wider than the button
13121
13788
 
13122
13789
  return v(components_ButtonFrame, {
13123
- frameWidth: frameWidth
13790
+ frameWidth: frameWidth,
13791
+ adaSettings: adaSettings
13124
13792
  });
13125
13793
  }
13126
13794
  }, {
@@ -13706,7 +14374,7 @@ window.__AdaEmbedConstructor = Embed;
13706
14374
  /* harmony export */ });
13707
14375
  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);
13708
14376
  var isProduction = "production" === "production";
13709
- var embed2Version = "4bd8959";
14377
+ var embed2Version = "8920d7b";
13710
14378
 
13711
14379
  /***/ }),
13712
14380
 
@@ -23103,7 +23771,7 @@ function _loadEmbed() {
23103
23771
  polyfillVersionString = "legacy";
23104
23772
  }
23105
23773
 
23106
- embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "4bd8959", "/index.js");
23774
+ embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "8920d7b", "/index.js");
23107
23775
  }
23108
23776
 
23109
23777
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
@@ -23230,10 +23898,10 @@ function createEmbedObject() {
23230
23898
  handle: adaSettings.handle,
23231
23899
  embedVersion: 2,
23232
23900
  embedSettings: adaSettings,
23233
- version: "1.0.30",
23901
+ version: "1.0.34",
23234
23902
  isNpm: true,
23235
23903
  hostPage: window.location.href,
23236
- commitHash: "4bd8959"
23904
+ commitHash: "8920d7b"
23237
23905
  }, {
23238
23906
  sampleRate: 0.01 // 1% of logs will go through
23239
23907
 
@@ -23648,7 +24316,7 @@ function createEmbedObject() {
23648
24316
  }
23649
24317
  ;// CONCATENATED MODULE: ./src/index-npm.ts
23650
24318
 
23651
- Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 8180));
24319
+ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 2396));
23652
24320
  /* harmony default export */ var index_npm = (createEmbedObject());
23653
24321
  }();
23654
24322
  module.exports = __webpack_exports__;