@ada-support/embed2 1.1.36 → 1.1.39

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.
@@ -8,8 +8,8 @@ interface OwnProps {
8
8
  adaSettings: StartOptions;
9
9
  entryContainer: HTMLElement;
10
10
  unmountCallback: () => void;
11
- initializationResolve: () => void;
12
- initializationReject: (error: Error) => void;
11
+ initializationResolve?: () => void;
12
+ initializationReject?: (error: Error) => void;
13
13
  }
14
14
  declare const _default: (ownProps: OwnProps) => h.JSX.Element;
15
15
  export default _default;
@@ -1,6 +1,3 @@
1
- export interface AgentArrivePayload {
2
- agentName: string;
3
- }
4
1
  export declare const browserHasNotificationSupport: boolean;
5
2
  export declare function checkIfUserHasGivenPermission(): boolean;
6
3
  export declare function requestNotificationPermission(): Promise<NotificationPermission | undefined> | null;
@@ -11,4 +8,4 @@ export declare function createNotification(title: string, isChatOpen: boolean, o
11
8
  /**
12
9
  * Used to listen for changes in Notification permission state
13
10
  */
14
- export declare function notificationPermListener(notificationPermChangeHandler: (notificationStatus: NotificationPermission) => void): Promise<void>;
11
+ export declare function notificationPermListener(notificationPermChangeHandler: (notificationStatus: NotificationPermission) => void): void;
@@ -1 +1 @@
1
- export default function checkRollout(rollout: number, handle: string): boolean;
1
+ export declare function checkRollout(rollout: number, handle: string): boolean;
@@ -47,8 +47,8 @@ export interface EmbedResponsePayloadByEvent {
47
47
  STATE_CHANGE: StoreState;
48
48
  STOP_RESPONSE: unknown;
49
49
  TOGGLE_RESPONSE: unknown;
50
- TRACK_EVENT_RESPONSE: string;
51
- TRIGGER_CAMPAIGN_RESPONSE: string;
50
+ TRACK_EVENT_RESPONSE: string | null;
51
+ TRIGGER_CAMPAIGN_RESPONSE: string | null;
52
52
  CLOSE_CAMPAIGN_RESPONSE: unknown;
53
53
  entry_INIT: unknown;
54
54
  client_INIT: unknown;
@@ -8798,7 +8798,7 @@ var client = new error_tracker_BrowserClient({
8798
8798
  return event;
8799
8799
  },
8800
8800
  environment: "production",
8801
- release: "1.1.36-510d827",
8801
+ release: "1.1.39-0590af1",
8802
8802
  sampleRate: 0.25,
8803
8803
  autoSessionTracking: false,
8804
8804
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9500,7 +9500,7 @@ function getEmbedURL(_ref) {
9500
9500
  polyfillVersionString = "legacy";
9501
9501
  }
9502
9502
 
9503
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "510d827", "/index.html");
9503
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "0590af1", "/index.html");
9504
9504
  }
9505
9505
  /**
9506
9506
  * Generate the Chat / API URL
@@ -11745,7 +11745,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11745
11745
  cluster: cluster,
11746
11746
  domain: domain,
11747
11747
  qp: {
11748
- embedVersion: slice_default()("510d827").call("510d827", 0, 7),
11748
+ embedVersion: slice_default()("0590af1").call("0590af1", 0, 7),
11749
11749
  greeting: greeting,
11750
11750
  language: language,
11751
11751
  skipGreeting: skipGreeting,
@@ -12827,6 +12827,54 @@ var Container = /*#__PURE__*/function (_Component) {
12827
12827
  bindLocationChangeOverrides();
12828
12828
  window.addEventListener("locationchange", this.locationChangeHandlerBound);
12829
12829
  }
12830
+ /** To be called when `props.appConnectionState` value changes */
12831
+
12832
+ }, {
12833
+ key: "onAppConnectionStateChange",
12834
+ value: function onAppConnectionStateChange() {
12835
+ var _this$props2 = this.props,
12836
+ appConnectionState = _this$props2.appConnectionState,
12837
+ initializationReject = _this$props2.initializationReject,
12838
+ initializationResolve = _this$props2.initializationResolve,
12839
+ adaSettings = _this$props2.adaSettings;
12840
+
12841
+ switch (appConnectionState) {
12842
+ case ConnectionState.Done:
12843
+ {
12844
+ if (!initializationResolve) {
12845
+ throw new errors/* AdaEmbedError */.S("`initializationResolve` is undefined");
12846
+ }
12847
+
12848
+ initializationResolve();
12849
+ this.bindEmbedActionEventHandlerOnce();
12850
+
12851
+ if (adaSettings.adaReadyCallback) {
12852
+ adaSettings.adaReadyCallback({
12853
+ isRolledOut: true
12854
+ });
12855
+ }
12856
+
12857
+ break;
12858
+ }
12859
+
12860
+ case ConnectionState.Failure:
12861
+ {
12862
+ if (!initializationReject) {
12863
+ throw new errors/* AdaEmbedError */.S("`initializationReject` is undefined");
12864
+ }
12865
+
12866
+ var _error = new errors/* AdaEmbedError */.S("Embed startup failed. This is likely because one or all frame components failed to connect. Please check your internet connection.");
12867
+
12868
+ initializationReject(_error);
12869
+ this.unmount();
12870
+ break;
12871
+ }
12872
+
12873
+ default:
12874
+ {// Do nothing
12875
+ }
12876
+ }
12877
+ }
12830
12878
  }, {
12831
12879
  key: "componentDidUpdate",
12832
12880
  value: function componentDidUpdate(prevProps) {
@@ -12834,20 +12882,17 @@ var Container = /*#__PURE__*/function (_Component) {
12834
12882
  _client$ui_settings$e,
12835
12883
  _this2 = this;
12836
12884
 
12837
- var _this$props2 = this.props,
12838
- isDrawerOpen = _this$props2.isDrawerOpen,
12839
- appConnectionState = _this$props2.appConnectionState,
12840
- initializationReject = _this$props2.initializationReject,
12841
- initializationResolve = _this$props2.initializationResolve,
12842
- chatterToken = _this$props2.chatterToken,
12843
- client = _this$props2.client,
12844
- isChatWebsocketConnected = _this$props2.isChatWebsocketConnected,
12845
- adaSettings = _this$props2.adaSettings,
12846
- chatterInLiveChat = _this$props2.chatterInLiveChat,
12847
- messageService = _this$props2.messageService,
12848
- wasCampaignShownButNowClosed = _this$props2.wasCampaignShownButNowClosed;
12849
- var adaReadyCallback = adaSettings.adaReadyCallback,
12850
- toggleCallback = adaSettings.toggleCallback;
12885
+ var _this$props3 = this.props,
12886
+ isDrawerOpen = _this$props3.isDrawerOpen,
12887
+ appConnectionState = _this$props3.appConnectionState,
12888
+ chatterToken = _this$props3.chatterToken,
12889
+ client = _this$props3.client,
12890
+ isChatWebsocketConnected = _this$props3.isChatWebsocketConnected,
12891
+ adaSettings = _this$props3.adaSettings,
12892
+ chatterInLiveChat = _this$props3.chatterInLiveChat,
12893
+ messageService = _this$props3.messageService,
12894
+ wasCampaignShownButNowClosed = _this$props3.wasCampaignShownButNowClosed;
12895
+ var toggleCallback = adaSettings.toggleCallback;
12851
12896
 
12852
12897
  if ((client === null || client === void 0 ? void 0 : (_client$ui_settings = client.ui_settings) === null || _client$ui_settings === void 0 ? void 0 : (_client$ui_settings$e = _client$ui_settings.embed) === null || _client$ui_settings$e === void 0 ? void 0 : _client$ui_settings$e.style) === "text") {
12853
12898
  this.computeButtonFrameWidth();
@@ -12858,23 +12903,7 @@ var Container = /*#__PURE__*/function (_Component) {
12858
12903
 
12859
12904
 
12860
12905
  if (prevProps.appConnectionState !== appConnectionState) {
12861
- if (appConnectionState === ConnectionState.Done) {
12862
- initializationResolve();
12863
- this.bindEmbedActionEventHandlerOnce();
12864
-
12865
- if (adaReadyCallback) {
12866
- adaReadyCallback({
12867
- isRolledOut: true
12868
- });
12869
- }
12870
- }
12871
-
12872
- if (appConnectionState === ConnectionState.Failure) {
12873
- var _error = new errors/* AdaEmbedError */.S("Embed startup failed. This is likely because one or all frame components failed to connect. Please check your internet connection.");
12874
-
12875
- initializationReject(_error);
12876
- this.unmount();
12877
- }
12906
+ this.onAppConnectionStateChange();
12878
12907
  }
12879
12908
 
12880
12909
  var _this$state = this.state,
@@ -12948,10 +12977,10 @@ var Container = /*#__PURE__*/function (_Component) {
12948
12977
  }, {
12949
12978
  key: "shouldRenderChatFrame",
12950
12979
  get: function get() {
12951
- var _this$props3 = this.props,
12952
- isDrawerOpen = _this$props3.isDrawerOpen,
12953
- adaSettings = _this$props3.adaSettings,
12954
- chatterInLiveChat = _this$props3.chatterInLiveChat;
12980
+ var _this$props4 = this.props,
12981
+ isDrawerOpen = _this$props4.isDrawerOpen,
12982
+ adaSettings = _this$props4.adaSettings,
12983
+ chatterInLiveChat = _this$props4.chatterInLiveChat;
12955
12984
  var parentElement = adaSettings.parentElement,
12956
12985
  preload = adaSettings.preload;
12957
12986
  var _this$state2 = this.state,
@@ -12995,9 +13024,9 @@ var Container = /*#__PURE__*/function (_Component) {
12995
13024
  }, {
12996
13025
  key: "computeButtonFrameWidth",
12997
13026
  value: function computeButtonFrameWidth() {
12998
- var _this$props4 = this.props,
12999
- entryContainer = _this$props4.entryContainer,
13000
- client = _this$props4.client;
13027
+ var _this$props5 = this.props,
13028
+ entryContainer = _this$props5.entryContainer,
13029
+ client = _this$props5.client;
13001
13030
  var buttonPadding = 26;
13002
13031
  var iconWithSpace = 30;
13003
13032
  var margins = 48;
@@ -13016,11 +13045,13 @@ var Container = /*#__PURE__*/function (_Component) {
13016
13045
  }, {
13017
13046
  key: "unmount",
13018
13047
  value: function unmount() {
13019
- var _this$props5 = this.props,
13020
- entryContainer = _this$props5.entryContainer,
13021
- messageService = _this$props5.messageService,
13022
- unmountCallback = _this$props5.unmountCallback;
13023
- entryContainer.parentNode.removeChild(entryContainer);
13048
+ var _entryContainer$paren;
13049
+
13050
+ var _this$props6 = this.props,
13051
+ entryContainer = _this$props6.entryContainer,
13052
+ messageService = _this$props6.messageService,
13053
+ unmountCallback = _this$props6.unmountCallback;
13054
+ (_entryContainer$paren = entryContainer.parentNode) === null || _entryContainer$paren === void 0 ? void 0 : _entryContainer$paren.removeChild(entryContainer);
13024
13055
  messageService.getAllChannels().forEach(function (channel) {
13025
13056
  channel.clearTimeoutsAndListeners();
13026
13057
  });
@@ -13031,9 +13062,9 @@ var Container = /*#__PURE__*/function (_Component) {
13031
13062
  }, {
13032
13063
  key: "trackEvent",
13033
13064
  value: function trackEvent(trackEventParams) {
13034
- var _this$props6 = this.props,
13035
- adaSettings = _this$props6.adaSettings,
13036
- chatterToken = _this$props6.chatterToken;
13065
+ var _this$props7 = this.props,
13066
+ adaSettings = _this$props7.adaSettings,
13067
+ chatterToken = _this$props7.chatterToken;
13037
13068
  trackEventImpl(adaSettings, chatterToken, trackEventParams);
13038
13069
  }
13039
13070
  }, {
@@ -13060,10 +13091,10 @@ var Container = /*#__PURE__*/function (_Component) {
13060
13091
  value: function triggerCampaign(params) {
13061
13092
  var _client$marketing_cam;
13062
13093
 
13063
- var _this$props7 = this.props,
13064
- client = _this$props7.client,
13065
- isDrawerOpen = _this$props7.isDrawerOpen,
13066
- setState = _this$props7.setState;
13094
+ var _this$props8 = this.props,
13095
+ client = _this$props8.client,
13096
+ isDrawerOpen = _this$props8.isDrawerOpen,
13097
+ setState = _this$props8.setState;
13067
13098
  var chatHasBeenRendered = this.state.chatHasBeenRendered;
13068
13099
  var campaignKey = params.campaignKey,
13069
13100
  ignoreStatus = params.ignoreStatus,
@@ -13107,9 +13138,9 @@ var Container = /*#__PURE__*/function (_Component) {
13107
13138
  var _this4 = this;
13108
13139
 
13109
13140
  var useDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13110
- var _this$props8 = this.props,
13111
- adaSettings = _this$props8.adaSettings,
13112
- client = _this$props8.client;
13141
+ var _this$props9 = this.props,
13142
+ adaSettings = _this$props9.adaSettings,
13143
+ client = _this$props9.client;
13113
13144
  var campaignToTrigger = getCampaignToTrigger(adaSettings, client.marketing_campaigns, params, !client.features.afm_proactive_messaging);
13114
13145
 
13115
13146
  if (campaignToTrigger) {
@@ -13132,13 +13163,13 @@ var Container = /*#__PURE__*/function (_Component) {
13132
13163
  var _handleEmbedAction = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(type, payload, id) {
13133
13164
  var _this5 = this;
13134
13165
 
13135
- var _this$props9, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, chatChannel, 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;
13166
+ var _this$props10, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, chatChannel, toggleChat, _this$props11, isDrawerOpen, drawerHasBeenOpened, chatterToken, contentToReturn, _this$props12, metaFields, setState, metaData, newMetaFields, _this$props13, sensitiveMetaFields, _setState, _ref, greeting, language, _newMetaFields, _sensitiveMetaFields, _ref$resetChatHistory, resetChatHistory, _setState2, chatHasBeenRendered, newState, _setState3, _ref2, body, duration, EXTRA_PROACTIVE_DELAY;
13136
13167
 
13137
13168
  return regenerator_default().wrap(function _callee2$(_context3) {
13138
13169
  while (1) {
13139
13170
  switch (_context3.prev = _context3.next) {
13140
13171
  case 0:
13141
- _this$props9 = this.props, client = _this$props9.client, messageService = _this$props9.messageService, adaSettings = _this$props9.adaSettings;
13172
+ _this$props10 = this.props, client = _this$props10.client, messageService = _this$props10.messageService, adaSettings = _this$props10.adaSettings;
13142
13173
  parentElement = adaSettings.parentElement;
13143
13174
  localChannel = messageService.getChannel("local");
13144
13175
  xStorageChannel = messageService.getChannel(XSTORAGE_IFRAME);
@@ -13153,59 +13184,50 @@ var Container = /*#__PURE__*/function (_Component) {
13153
13184
 
13154
13185
  case 7:
13155
13186
  _context3.t0 = type;
13156
- _context3.next = _context3.t0 === TRACK_EVENT ? 10 : _context3.t0 === TRIGGER_CAMPAIGN ? 15 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 20 : _context3.t0 === TOGGLE ? 25 : _context3.t0 === GET_INFO ? 30 : _context3.t0 === SET_META_FIELDS ? 34 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 41 : _context3.t0 === STOP ? 46 : _context3.t0 === RESET ? 49 : _context3.t0 === DELETE_HISTORY ? 67 : _context3.t0 === CREATE_PROACTIVE ? 79 : _context3.t0 === CLOSE_CAMPAIGN ? 88 : 91;
13187
+ _context3.next = _context3.t0 === TRACK_EVENT ? 10 : _context3.t0 === TRIGGER_CAMPAIGN ? 13 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 16 : _context3.t0 === TOGGLE ? 19 : _context3.t0 === GET_INFO ? 24 : _context3.t0 === SET_META_FIELDS ? 28 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 35 : _context3.t0 === STOP ? 40 : _context3.t0 === RESET ? 43 : _context3.t0 === DELETE_HISTORY ? 61 : _context3.t0 === CREATE_PROACTIVE ? 73 : _context3.t0 === CLOSE_CAMPAIGN ? 82 : 85;
13157
13188
  break;
13158
13189
 
13159
13190
  case 10:
13160
- if (client.features.afm_business_events) {
13161
- _context3.next = 13;
13162
- break;
13191
+ if (!client.features.afm_business_events) {
13192
+ console.error("Ada Embed - business events not available in your feature set.");
13193
+ } else {
13194
+ this.trackEvent(payload);
13163
13195
  }
13164
13196
 
13165
- localChannel.postMessage(TRACK_EVENT_RESPONSE, "Ada Embed - business events not available in your feature set.", id, FetchEventStatus.Failure);
13166
- return _context3.abrupt("return");
13197
+ localChannel.postMessage(TRACK_EVENT_RESPONSE, null, id);
13198
+ return _context3.abrupt("break", 85);
13167
13199
 
13168
13200
  case 13:
13169
- this.trackEvent(payload);
13170
- return _context3.abrupt("break", 91);
13171
-
13172
- case 15:
13173
- if (client.features.afm_proactive_messaging) {
13174
- _context3.next = 18;
13175
- break;
13201
+ if (!client.features.afm_proactive_messaging) {
13202
+ console.error("Ada Embed - proactive campaigns not available in your feature set.");
13203
+ } else {
13204
+ this.triggerCampaign(payload);
13176
13205
  }
13177
13206
 
13178
- localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
13179
- return _context3.abrupt("return");
13207
+ localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, null, id);
13208
+ return _context3.abrupt("break", 85);
13180
13209
 
13181
- case 18:
13182
- this.triggerCampaign(payload);
13183
- return _context3.abrupt("break", 91);
13184
-
13185
- case 20:
13186
- if (client.features.afm_proactive_messaging) {
13187
- _context3.next = 23;
13188
- break;
13210
+ case 16:
13211
+ if (!client.features.afm_proactive_messaging) {
13212
+ console.error("Ada Embed - proactive campaigns not available in your feature set.");
13213
+ } else {
13214
+ this.evaluateCampaignConditions(payload);
13189
13215
  }
13190
13216
 
13191
- localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
13192
- return _context3.abrupt("return");
13193
-
13194
- case 23:
13195
- this.evaluateCampaignConditions(payload);
13196
- return _context3.abrupt("break", 91);
13217
+ localChannel.postMessage(EVAL_CAMPAIGN_CONDITIONS_RESPONSE, null, id);
13218
+ return _context3.abrupt("break", 85);
13197
13219
 
13198
- case 25:
13220
+ case 19:
13199
13221
  toggleChat = this.props.toggleChat;
13200
- _context3.next = 28;
13222
+ _context3.next = 22;
13201
13223
  return toggleChat();
13202
13224
 
13203
- case 28:
13225
+ case 22:
13204
13226
  localChannel.postMessage(TOGGLE_RESPONSE, null, id);
13205
- return _context3.abrupt("break", 91);
13227
+ return _context3.abrupt("break", 85);
13206
13228
 
13207
- case 30:
13208
- _this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
13229
+ case 24:
13230
+ _this$props11 = this.props, isDrawerOpen = _this$props11.isDrawerOpen, drawerHasBeenOpened = _this$props11.drawerHasBeenOpened, chatterToken = _this$props11.chatterToken;
13209
13231
  contentToReturn = {
13210
13232
  isDrawerOpen: isDrawerOpen,
13211
13233
  isChatOpen: isDrawerOpen || Boolean(parentElement),
@@ -13213,38 +13235,38 @@ var Container = /*#__PURE__*/function (_Component) {
13213
13235
  hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
13214
13236
  };
13215
13237
  localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
13216
- return _context3.abrupt("break", 91);
13238
+ return _context3.abrupt("break", 85);
13217
13239
 
13218
- case 34:
13219
- _this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
13240
+ case 28:
13241
+ _this$props12 = this.props, metaFields = _this$props12.metaFields, setState = _this$props12.setState;
13220
13242
  metaData = payload;
13221
13243
  newMetaFields = Container_objectSpread(Container_objectSpread({}, metaFields), metaData);
13222
- _context3.next = 39;
13244
+ _context3.next = 33;
13223
13245
  return setState({
13224
13246
  metaFields: newMetaFields
13225
13247
  });
13226
13248
 
13227
- case 39:
13249
+ case 33:
13228
13250
  localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
13229
- return _context3.abrupt("break", 91);
13251
+ return _context3.abrupt("break", 85);
13230
13252
 
13231
- case 41:
13232
- _this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
13233
- _context3.next = 44;
13253
+ case 35:
13254
+ _this$props13 = this.props, sensitiveMetaFields = _this$props13.sensitiveMetaFields, _setState = _this$props13.setState;
13255
+ _context3.next = 38;
13234
13256
  return _setState({
13235
13257
  sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), payload)
13236
13258
  });
13237
13259
 
13238
- case 44:
13260
+ case 38:
13239
13261
  localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
13240
- return _context3.abrupt("break", 91);
13262
+ return _context3.abrupt("break", 85);
13241
13263
 
13242
- case 46:
13264
+ case 40:
13243
13265
  localChannel.postMessage(STOP_RESPONSE, null, id);
13244
13266
  this.unmount();
13245
- return _context3.abrupt("break", 91);
13267
+ return _context3.abrupt("break", 85);
13246
13268
 
13247
- case 49:
13269
+ case 43:
13248
13270
  _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;
13249
13271
  _setState2 = this.props.setState;
13250
13272
  chatHasBeenRendered = this.state.chatHasBeenRendered;
@@ -13257,18 +13279,18 @@ var Container = /*#__PURE__*/function (_Component) {
13257
13279
  };
13258
13280
 
13259
13281
  if (!resetChatHistory) {
13260
- _context3.next = 62;
13282
+ _context3.next = 56;
13261
13283
  break;
13262
13284
  }
13263
13285
 
13264
13286
  if (xStorageChannel) {
13265
- _context3.next = 56;
13287
+ _context3.next = 50;
13266
13288
  break;
13267
13289
  }
13268
13290
 
13269
13291
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
13270
13292
 
13271
- case 56:
13293
+ case 50:
13272
13294
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
13273
13295
 
13274
13296
  safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
@@ -13281,11 +13303,11 @@ var Container = /*#__PURE__*/function (_Component) {
13281
13303
  chatterCreated: null
13282
13304
  });
13283
13305
 
13284
- case 62:
13285
- _context3.next = 64;
13306
+ case 56:
13307
+ _context3.next = 58;
13286
13308
  return _setState2(newState);
13287
13309
 
13288
- case 64:
13310
+ case 58:
13289
13311
  if (chatHasBeenRendered) {
13290
13312
  this.setState({
13291
13313
  hideChatOverride: true
@@ -13297,48 +13319,48 @@ var Container = /*#__PURE__*/function (_Component) {
13297
13319
  }
13298
13320
 
13299
13321
  localChannel.postMessage(RESET_RESPONSE, null, id);
13300
- return _context3.abrupt("break", 91);
13322
+ return _context3.abrupt("break", 85);
13301
13323
 
13302
- case 67:
13324
+ case 61:
13303
13325
  _setState3 = this.props.setState;
13304
13326
 
13305
13327
  if (xStorageChannel) {
13306
- _context3.next = 70;
13328
+ _context3.next = 64;
13307
13329
  break;
13308
13330
  }
13309
13331
 
13310
13332
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
13311
13333
 
13312
- case 70:
13334
+ case 64:
13313
13335
  // Clear chatter data from local storage
13314
13336
  safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13315
13337
  safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13316
13338
  safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13317
13339
  safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13318
13340
 
13319
- _context3.next = 76;
13341
+ _context3.next = 70;
13320
13342
  return _setState3({
13321
13343
  chatterToken: null,
13322
13344
  chatterCreated: null
13323
13345
  });
13324
13346
 
13325
- case 76:
13347
+ case 70:
13326
13348
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
13327
13349
  localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
13328
- return _context3.abrupt("break", 91);
13350
+ return _context3.abrupt("break", 85);
13329
13351
 
13330
- case 79:
13352
+ case 73:
13331
13353
  _ref2 = payload, body = _ref2.body, duration = _ref2.duration;
13332
13354
  EXTRA_PROACTIVE_DELAY = 1000;
13333
13355
 
13334
13356
  if (client) {
13335
- _context3.next = 83;
13357
+ _context3.next = 77;
13336
13358
  break;
13337
13359
  }
13338
13360
 
13339
13361
  throw new errors/* AdaEmbedError */.S("`client` is not defined");
13340
13362
 
13341
- case 83:
13363
+ case 77:
13342
13364
  // Do not feature flag gate this behind the developer_proactive flag
13343
13365
  // It's also used for free-tier campaigns, which are available to all clients
13344
13366
  this.setState({
@@ -13378,22 +13400,22 @@ var Container = /*#__PURE__*/function (_Component) {
13378
13400
  }
13379
13401
  }, _callee);
13380
13402
  })));
13381
- _context3.next = 86;
13403
+ _context3.next = 80;
13382
13404
  return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
13383
13405
 
13384
- case 86:
13406
+ case 80:
13385
13407
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
13386
- return _context3.abrupt("break", 91);
13408
+ return _context3.abrupt("break", 85);
13387
13409
 
13388
- case 88:
13410
+ case 82:
13389
13411
  if (chatChannel) {
13390
13412
  chatChannel.postMessage(CLOSE_CAMPAIGN);
13391
13413
  }
13392
13414
 
13393
13415
  localChannel.postMessage(CLOSE_CAMPAIGN_RESPONSE, null, id);
13394
- return _context3.abrupt("break", 91);
13416
+ return _context3.abrupt("break", 85);
13395
13417
 
13396
- case 91:
13418
+ case 85:
13397
13419
  case "end":
13398
13420
  return _context3.stop();
13399
13421
  }
@@ -13455,13 +13477,13 @@ var Container = /*#__PURE__*/function (_Component) {
13455
13477
  var _initialize = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee3() {
13456
13478
  var _context4;
13457
13479
 
13458
- var _this$props13, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
13480
+ var _this$props14, adaSettings, setState, handle, cluster, domain, rolloutOverride, adaReadyCallback, privateMode, language, adaSettingsWithoutFunctions, clientResponse, newClient, baseApiUrl, businessEvents, marketingCampaigns, _context5, _context6, chatIsOn, rollout, chatterInLiveChat;
13459
13481
 
13460
13482
  return regenerator_default().wrap(function _callee3$(_context8) {
13461
13483
  while (1) {
13462
13484
  switch (_context8.prev = _context8.next) {
13463
13485
  case 0:
13464
- _this$props13 = this.props, adaSettings = _this$props13.adaSettings, setState = _this$props13.setState;
13486
+ _this$props14 = this.props, adaSettings = _this$props14.adaSettings, setState = _this$props14.setState;
13465
13487
  handle = adaSettings.handle, cluster = adaSettings.cluster, domain = adaSettings.domain, rolloutOverride = adaSettings.rolloutOverride, adaReadyCallback = adaSettings.adaReadyCallback, privateMode = adaSettings.privateMode;
13466
13488
  language = adaSettings.language || get_browser_language(); // We do not want to store functions in our store. The rest of the values are useful however.
13467
13489
 
@@ -13662,10 +13684,10 @@ var Container = /*#__PURE__*/function (_Component) {
13662
13684
  }, {
13663
13685
  key: "renderChatFrame",
13664
13686
  value: function renderChatFrame() {
13665
- var _this$props14 = this.props,
13666
- messageService = _this$props14.messageService,
13667
- store = _this$props14.store,
13668
- adaSettings = _this$props14.adaSettings;
13687
+ var _this$props15 = this.props,
13688
+ messageService = _this$props15.messageService,
13689
+ store = _this$props15.store,
13690
+ adaSettings = _this$props15.adaSettings;
13669
13691
  var _this$state3 = this.state,
13670
13692
  campaignToTrigger = _this$state3.campaignToTrigger,
13671
13693
  followUpResponseId = _this$state3.followUpResponseId;
@@ -13688,9 +13710,9 @@ var Container = /*#__PURE__*/function (_Component) {
13688
13710
  value: function renderIntroFrame() {
13689
13711
  var _client$intro;
13690
13712
 
13691
- var _this$props15 = this.props,
13692
- adaSettings = _this$props15.adaSettings,
13693
- client = _this$props15.client;
13713
+ var _this$props16 = this.props,
13714
+ adaSettings = _this$props16.adaSettings,
13715
+ client = _this$props16.client;
13694
13716
  var parentElement = adaSettings.parentElement;
13695
13717
  var hideIntroOverride = this.state.hideIntroOverride;
13696
13718
 
@@ -13704,9 +13726,9 @@ var Container = /*#__PURE__*/function (_Component) {
13704
13726
  }, {
13705
13727
  key: "renderMaskFrame",
13706
13728
  value: function renderMaskFrame() {
13707
- var _this$props16 = this.props,
13708
- adaSettings = _this$props16.adaSettings,
13709
- hideMask = _this$props16.hideMask;
13729
+ var _this$props17 = this.props,
13730
+ adaSettings = _this$props17.adaSettings,
13731
+ hideMask = _this$props17.hideMask;
13710
13732
  var parentElement = adaSettings.parentElement;
13711
13733
 
13712
13734
  if (parentElement || hideMask) {
@@ -13718,12 +13740,12 @@ var Container = /*#__PURE__*/function (_Component) {
13718
13740
  }, {
13719
13741
  key: "renderBackdrop",
13720
13742
  value: function renderBackdrop() {
13721
- var _this$props17 = this.props,
13722
- client = _this$props17.client,
13723
- adaSettings = _this$props17.adaSettings,
13724
- chatDimensions = _this$props17.chatDimensions,
13725
- isDrawerOpen = _this$props17.isDrawerOpen,
13726
- isIntroShown = _this$props17.isIntroShown;
13743
+ var _this$props18 = this.props,
13744
+ client = _this$props18.client,
13745
+ adaSettings = _this$props18.adaSettings,
13746
+ chatDimensions = _this$props18.chatDimensions,
13747
+ isDrawerOpen = _this$props18.isDrawerOpen,
13748
+ isIntroShown = _this$props18.isIntroShown;
13727
13749
  var parentElement = adaSettings.parentElement; // checking for a non-empty parentElement here to
13728
13750
  // hide the backdrop in the SDKs
13729
13751
 
@@ -14401,7 +14423,7 @@ var Embed = /*#__PURE__*/function () {
14401
14423
  * Bind to the window object so it can be used by the entry file.
14402
14424
  */
14403
14425
 
14404
- (0,defineProperty/* default */.Z)(Embed, "embed2Version", "510d827");
14426
+ (0,defineProperty/* default */.Z)(Embed, "embed2Version", "0590af1");
14405
14427
 
14406
14428
  window.__AdaEmbedConstructor = Embed;
14407
14429
 
@@ -14761,9 +14783,9 @@ function _log() {
14761
14783
  service: "embed",
14762
14784
  env: "production",
14763
14785
  embedVersion: 2,
14764
- version: "1.1.36",
14786
+ version: "1.1.39",
14765
14787
  isNpm: true,
14766
- commitHash: "510d827"
14788
+ commitHash: "0590af1"
14767
14789
  }))
14768
14790
  });
14769
14791
 
@@ -25704,7 +25726,7 @@ function _loadClientChunk() {
25704
25726
  polyfillVersionString = "legacy";
25705
25727
  }
25706
25728
 
25707
- clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "510d827", "/index.js");
25729
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "0590af1", "/index.js");
25708
25730
  } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25709
25731
 
25710
25732
 
@@ -25817,7 +25839,7 @@ function createEmbedObject() {
25817
25839
  throw new Error("`window.__AdaEmbedConstructor` is not defined");
25818
25840
 
25819
25841
  case 7:
25820
- if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !== "510d827")) {
25842
+ if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !== "0590af1")) {
25821
25843
  _context2.next = 9;
25822
25844
  break;
25823
25845
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.1.36",
3
+ "version": "1.1.39",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build:modern": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
14
14
  "build:npm-types": "tsc --project tsconfig.npm.json --declaration --outDir dist/npm-entry --emitDeclarationOnly --allowJs false --checkJs false",
15
15
  "build:npm": "./npm-build.sh",
16
- "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 25",
16
+ "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 24",
17
17
  "lint:fix": "yarn lint --fix",
18
18
  "test": "jest",
19
19
  "check-types": "./node_modules/typescript/bin/tsc --project ./tsconfig.json --noEmit --strict false",
@@ -56,6 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@ada-support/embed-types": "^1.0.4",
58
58
  "@ada-support/eslint-config-ada": "^1.2.1",
59
+ "@testing-library/preact": "^2.0.1",
59
60
  "@types/enzyme": "^3.10.11",
60
61
  "@types/jest": "^27.0.2",
61
62
  "@types/json-stable-stringify": "^1.0.33",
@@ -70,7 +71,7 @@
70
71
  "cypress": "^9.6.1",
71
72
  "depcheck": "^1.4.3",
72
73
  "enzyme": "^3.11.0",
73
- "enzyme-adapter-preact-pure": "^2.2.0",
74
+ "enzyme-adapter-preact-pure": "^4.0.1",
74
75
  "eslint": "^8.8.0",
75
76
  "eslint-plugin-chai-friendly": "^0.7.2",
76
77
  "eslint-plugin-compat": "^4.0.2",
@@ -80,6 +81,7 @@
80
81
  "jest": "^27.5.1",
81
82
  "jest-localstorage-mock": "^2.4.0",
82
83
  "lint-staged": "^11.2.3",
84
+ "mock-xmlhttprequest": "^7.0.4",
83
85
  "npm-run-all": "^4.1.5",
84
86
  "start-server-and-test": "^1.14.0",
85
87
  "testcafe": "^1.18.4",