@ada-support/embed2 1.0.76 → 1.0.79

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.
@@ -14,6 +14,7 @@ export interface StartOptions {
14
14
  sensitiveMetaFields?: Record<string, unknown>;
15
15
  parentElement?: string | HTMLElement;
16
16
  privateMode?: boolean;
17
+ chatFrameTimeoutCallback?(): void;
17
18
  adaReadyCallback?(params: {
18
19
  isRolledOut: boolean;
19
20
  }): void;
@@ -74,7 +75,7 @@ export interface StoreState extends StartOptionsNoFunction {
74
75
  language?: string;
75
76
  adaSettings: StartOptions;
76
77
  wasCampaignShownButNowClosed: boolean;
77
- isChatEmpty: boolean;
78
+ proactiveCampaignHadMessages: boolean;
78
79
  }
79
80
  export interface StartOptionsNoFunction {
80
81
  handle?: string;
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
8788
8788
  return event;
8789
8789
  },
8790
8790
  environment: "production",
8791
- release: "1.0.76-0f7dd6a",
8791
+ release: "1.0.79-cc742de",
8792
8792
  sampleRate: 0.25,
8793
8793
  autoSessionTracking: false,
8794
8794
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9490,7 +9490,7 @@ function getEmbedURL(_ref) {
9490
9490
  polyfillVersionString = "legacy";
9491
9491
  }
9492
9492
 
9493
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "0f7dd6a", "/index.html");
9493
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "cc742de", "/index.html");
9494
9494
  }
9495
9495
  /**
9496
9496
  * Generate the Chat / API URL
@@ -9595,9 +9595,10 @@ var actions = {
9595
9595
  }
9596
9596
 
9597
9597
  var hasChatOpenedAfterProactiveMessagesShown = currentState.hasChatOpenedAfterProactiveMessagesShown,
9598
- wasCampaignShownButNowClosed = currentState.wasCampaignShownButNowClosed;
9598
+ wasCampaignShownButNowClosed = currentState.wasCampaignShownButNowClosed,
9599
+ proactiveCampaignHadMessages = currentState.proactiveCampaignHadMessages;
9599
9600
 
9600
- if (!currentState.isDrawerOpen && !hasChatOpenedAfterProactiveMessagesShown && !wasCampaignShownButNowClosed && currentState.latestCampaignKey) {
9601
+ if (!currentState.isDrawerOpen && !hasChatOpenedAfterProactiveMessagesShown && !wasCampaignShownButNowClosed && proactiveCampaignHadMessages && currentState.latestCampaignKey) {
9601
9602
  var _url = getURL({
9602
9603
  name: "api",
9603
9604
  handle: currentState.handle,
@@ -9971,7 +9972,7 @@ var state = {
9971
9972
  chatterInLiveChat: false,
9972
9973
  adaSettings: {},
9973
9974
  wasCampaignShownButNowClosed: false,
9974
- isChatEmpty: false
9975
+ proactiveCampaignHadMessages: false
9975
9976
  };
9976
9977
  /* harmony default export */ var store_state = (state);
9977
9978
  ;// CONCATENATED MODULE: ./src/client/store/index.ts
@@ -10397,8 +10398,20 @@ var get_browser_language_getBrowserLanguage = function getBrowserLanguage() {
10397
10398
 
10398
10399
  /* harmony default export */ var get_browser_language = (get_browser_language_getBrowserLanguage);
10399
10400
  ;// CONCATENATED MODULE: ./src/services/helpers.ts
10401
+
10400
10402
  var NO_OP_FUNCTION = function NO_OP_FUNCTION() {// Do nothing
10401
10403
  };
10404
+ function isStartOptions(input) {
10405
+ if (!(_typeof(input) === "object")) {
10406
+ return false;
10407
+ }
10408
+
10409
+ if (input === null) {
10410
+ return false;
10411
+ }
10412
+
10413
+ return typeof input.handle === "string";
10414
+ }
10402
10415
  ;// CONCATENATED MODULE: ./src/campaigns/campaign.ts
10403
10416
 
10404
10417
 
@@ -11605,6 +11618,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11605
11618
 
11606
11619
  (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "channel", void 0);
11607
11620
 
11621
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "chatRenderTimeout", void 0);
11622
+
11608
11623
  (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "state", {
11609
11624
  isMounted: false,
11610
11625
  closeTransitionTime: 200
@@ -11929,7 +11944,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11929
11944
  case 0:
11930
11945
  _this$props9 = this.props, adaSettings = _this$props9.adaSettings, setState = _this$props9.setState, setConnectionState = _this$props9.setConnectionState;
11931
11946
  _context22.t0 = type;
11932
- _context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ? 8 : _context22.t0 === CHAT_WEBSOCKET_CONNECTED ? 13 : _context22.t0 === PUBLISH_EVENT ? 15 : _context22.t0 === ANALYTICS_EVENT ? 18 : _context22.t0 === CHATTER_EVENT ? 22 : _context22.t0 === "ZD_SESSION" ? 32 : _context22.t0 === ZD_MESSAGING_HANDOFF ? 41 : _context22.t0 === CHATTER_LIVECHAT_EVENT ? 50 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 58 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 67 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 70 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 88 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 90 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 94 : _context22.t0 === END_CONVERSATION_EVENT ? 96 : 99;
11947
+ _context22.next = _context22.t0 === GET_WINDOW_ORIGIN ? 4 : _context22.t0 === CHAT_STARTED ? 8 : _context22.t0 === CHAT_WEBSOCKET_CONNECTED ? 14 : _context22.t0 === PUBLISH_EVENT ? 16 : _context22.t0 === ANALYTICS_EVENT ? 19 : _context22.t0 === CHATTER_EVENT ? 23 : _context22.t0 === "ZD_SESSION" ? 33 : _context22.t0 === ZD_MESSAGING_HANDOFF ? 42 : _context22.t0 === CHATTER_LIVECHAT_EVENT ? 51 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 59 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 68 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 71 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 89 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 91 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 95 : _context22.t0 === END_CONVERSATION_EVENT ? 97 : 100;
11933
11948
  break;
11934
11949
 
11935
11950
  case 4:
@@ -11942,7 +11957,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11942
11957
 
11943
11958
  case 6:
11944
11959
  this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
11945
- return _context22.abrupt("break", 100);
11960
+ return _context22.abrupt("break", 101);
11946
11961
 
11947
11962
  case 8:
11948
11963
  if (this.channel) {
@@ -11953,24 +11968,25 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11953
11968
  throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11954
11969
 
11955
11970
  case 10:
11971
+ clearTimeout(this.chatRenderTimeout);
11956
11972
  this.channel.isConnected = true;
11957
11973
  setConnectionState({
11958
11974
  "chat": ConnectionState.Done
11959
11975
  });
11960
- return _context22.abrupt("break", 100);
11976
+ return _context22.abrupt("break", 101);
11961
11977
 
11962
- case 13:
11978
+ case 14:
11963
11979
  setState({
11964
11980
  isChatWebsocketConnected: true
11965
11981
  });
11966
- return _context22.abrupt("break", 100);
11982
+ return _context22.abrupt("break", 101);
11967
11983
 
11968
- case 15:
11984
+ case 16:
11969
11985
  _ref = payload, eventKey = _ref.eventKey, data = _ref.data;
11970
11986
  publishEvent(eventKey, data);
11971
- return _context22.abrupt("break", 100);
11987
+ return _context22.abrupt("break", 101);
11972
11988
 
11973
- case 18:
11989
+ case 19:
11974
11990
  _ref2 = payload, analytics = _ref2.analytics;
11975
11991
  analyticsCallback = adaSettings.analyticsCallback;
11976
11992
 
@@ -11978,28 +11994,28 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11978
11994
  analyticsCallback(analytics);
11979
11995
  }
11980
11996
 
11981
- return _context22.abrupt("break", 100);
11997
+ return _context22.abrupt("break", 101);
11982
11998
 
11983
- case 22:
11999
+ case 23:
11984
12000
  client = this.props.client;
11985
12001
  _ref3 = payload, chatter = _ref3.chatter, created = _ref3.created;
11986
12002
  chatterTokenCallback = adaSettings.chatterTokenCallback;
11987
12003
 
11988
12004
  if (client) {
11989
- _context22.next = 27;
12005
+ _context22.next = 28;
11990
12006
  break;
11991
12007
  }
11992
12008
 
11993
12009
  throw new errors/* AdaEmbedError */.S("`client` is undefined");
11994
12010
 
11995
- case 27:
11996
- _context22.next = 29;
12011
+ case 28:
12012
+ _context22.next = 30;
11997
12013
  return setState({
11998
12014
  chatterToken: chatter,
11999
12015
  chatterCreated: created
12000
12016
  });
12001
12017
 
12002
- case 29:
12018
+ case 30:
12003
12019
  /**
12004
12020
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
12005
12021
  * come from chat. This is important for campaign and business event triggers.
@@ -12016,26 +12032,26 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12016
12032
  chatterTokenCallback(chatter);
12017
12033
  }
12018
12034
 
12019
- return _context22.abrupt("break", 100);
12035
+ return _context22.abrupt("break", 101);
12020
12036
 
12021
- case 32:
12037
+ case 33:
12022
12038
  _client = this.props.client;
12023
12039
  _ref4 = payload, zdSessionId = _ref4.zdSessionId, zdPreviousTags = _ref4.zdPreviousTags;
12024
12040
 
12025
12041
  if (_client) {
12026
- _context22.next = 36;
12042
+ _context22.next = 37;
12027
12043
  break;
12028
12044
  }
12029
12045
 
12030
12046
  throw new errors/* AdaEmbedError */.S("`client` is undefined");
12031
12047
 
12032
- case 36:
12033
- _context22.next = 38;
12048
+ case 37:
12049
+ _context22.next = 39;
12034
12050
  return setState({
12035
12051
  zdSessionId: zdSessionId
12036
12052
  });
12037
12053
 
12038
- case 38:
12054
+ case 39:
12039
12055
  storage = function () {
12040
12056
  if (_client.persistence === PERSISTENCE_NORMAL) {
12041
12057
  return safeLocalStorage;
@@ -12062,27 +12078,27 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12062
12078
  }
12063
12079
  }
12064
12080
 
12065
- return _context22.abrupt("break", 100);
12081
+ return _context22.abrupt("break", 101);
12066
12082
 
12067
- case 41:
12083
+ case 42:
12068
12084
  _client2 = this.props.client;
12069
12085
  _ref5 = payload, zdMessagingExternalUserId = _ref5.zdMessagingExternalUserId, zdMessagingChatterCreated = _ref5.zdMessagingChatterCreated;
12070
12086
 
12071
12087
  if (_client2) {
12072
- _context22.next = 45;
12088
+ _context22.next = 46;
12073
12089
  break;
12074
12090
  }
12075
12091
 
12076
12092
  throw new errors/* AdaEmbedError */.S("`client` is undefined");
12077
12093
 
12078
- case 45:
12079
- _context22.next = 47;
12094
+ case 46:
12095
+ _context22.next = 48;
12080
12096
  return setState({
12081
12097
  zdMessagingExternalUserId: zdMessagingExternalUserId,
12082
12098
  zdMessagingChatterCreated: zdMessagingChatterCreated
12083
12099
  });
12084
12100
 
12085
- case 47:
12101
+ case 48:
12086
12102
  if (zdMessagingExternalUserId === null) {
12087
12103
  safeLocalStorage.removeItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY);
12088
12104
  } else {
@@ -12095,25 +12111,25 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12095
12111
  safeLocalStorage.setItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, zdMessagingChatterCreated);
12096
12112
  }
12097
12113
 
12098
- return _context22.abrupt("break", 100);
12114
+ return _context22.abrupt("break", 101);
12099
12115
 
12100
- case 50:
12116
+ case 51:
12101
12117
  _client3 = this.props.client;
12102
12118
  _ref6 = payload, inLiveChat = _ref6.inLiveChat;
12103
- _context22.next = 54;
12119
+ _context22.next = 55;
12104
12120
  return setState({
12105
12121
  chatterInLiveChat: inLiveChat
12106
12122
  });
12107
12123
 
12108
- case 54:
12124
+ case 55:
12109
12125
  if (_client3) {
12110
- _context22.next = 56;
12126
+ _context22.next = 57;
12111
12127
  break;
12112
12128
  }
12113
12129
 
12114
12130
  throw new errors/* AdaEmbedError */.S("`client` is not defined");
12115
12131
 
12116
- case 56:
12132
+ case 57:
12117
12133
  /**
12118
12134
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
12119
12135
  * come from chat. This is important for campaign and business event triggers.
@@ -12124,19 +12140,19 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12124
12140
  safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
12125
12141
  }
12126
12142
 
12127
- return _context22.abrupt("break", 100);
12143
+ return _context22.abrupt("break", 101);
12128
12144
 
12129
- case 58:
12145
+ case 59:
12130
12146
  eventCallbacks = adaSettings.eventCallbacks;
12131
12147
 
12132
12148
  if (eventCallbacks) {
12133
- _context22.next = 61;
12149
+ _context22.next = 62;
12134
12150
  break;
12135
12151
  }
12136
12152
 
12137
- return _context22.abrupt("break", 100);
12153
+ return _context22.abrupt("break", 101);
12138
12154
 
12139
- case 61:
12155
+ case 62:
12140
12156
  customJavascriptEvent = payload.event_data;
12141
12157
  specificCallback = eventCallbacks[customJavascriptEvent.event_name];
12142
12158
  genericCallback = eventCallbacks["*"];
@@ -12149,22 +12165,22 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12149
12165
  genericCallback(customJavascriptEvent);
12150
12166
  }
12151
12167
 
12152
- return _context22.abrupt("break", 100);
12168
+ return _context22.abrupt("break", 101);
12153
12169
 
12154
- case 67:
12170
+ case 68:
12155
12171
  resetChat = this.props.resetChat;
12156
12172
  resetChat();
12157
- return _context22.abrupt("break", 100);
12173
+ return _context22.abrupt("break", 101);
12158
12174
 
12159
- case 70:
12175
+ case 71:
12160
12176
  zdChatterAuthCallback = adaSettings.zdChatterAuthCallback;
12161
12177
 
12162
12178
  if (!zdChatterAuthCallback) {
12163
- _context22.next = 84;
12179
+ _context22.next = 85;
12164
12180
  break;
12165
12181
  }
12166
12182
 
12167
- _context22.prev = 72;
12183
+ _context22.prev = 73;
12168
12184
  zdChatterAuthCallback(function (token) {
12169
12185
  if (!_this4.channel) {
12170
12186
  throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
@@ -12174,82 +12190,82 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12174
12190
  token: token
12175
12191
  }, id);
12176
12192
  });
12177
- _context22.next = 82;
12193
+ _context22.next = 83;
12178
12194
  break;
12179
12195
 
12180
- case 76:
12181
- _context22.prev = 76;
12182
- _context22.t1 = _context22["catch"](72);
12196
+ case 77:
12197
+ _context22.prev = 77;
12198
+ _context22.t1 = _context22["catch"](73);
12183
12199
  console.warn("Function for zdChatterAuthCallback produced an error - please ensure the callback is functioning normally");
12184
12200
 
12185
12201
  if (this.channel) {
12186
- _context22.next = 81;
12202
+ _context22.next = 82;
12187
12203
  break;
12188
12204
  }
12189
12205
 
12190
12206
  throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
12191
12207
 
12192
- case 81:
12208
+ case 82:
12193
12209
  this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
12194
12210
 
12195
- case 82:
12196
- _context22.next = 87;
12211
+ case 83:
12212
+ _context22.next = 88;
12197
12213
  break;
12198
12214
 
12199
- case 84:
12215
+ case 85:
12200
12216
  if (this.channel) {
12201
- _context22.next = 86;
12217
+ _context22.next = 87;
12202
12218
  break;
12203
12219
  }
12204
12220
 
12205
12221
  throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
12206
12222
 
12207
- case 86:
12208
- this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
12209
-
12210
12223
  case 87:
12211
- return _context22.abrupt("break", 100);
12224
+ this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
12212
12225
 
12213
12226
  case 88:
12227
+ return _context22.abrupt("break", 101);
12228
+
12229
+ case 89:
12214
12230
  this.handleNotifications(payload);
12215
- return _context22.abrupt("break", 100);
12231
+ return _context22.abrupt("break", 101);
12216
12232
 
12217
- case 90:
12233
+ case 91:
12218
12234
  if (this.channel) {
12219
- _context22.next = 92;
12235
+ _context22.next = 93;
12220
12236
  break;
12221
12237
  }
12222
12238
 
12223
12239
  throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
12224
12240
 
12225
- case 92:
12241
+ case 93:
12226
12242
  this.channel.postMessage(BROWSER_HAS_NOTIFICATIONS_RESPONSE_EVENT, {
12227
12243
  browserHasNotificationSupport: browserHasNotificationSupport
12228
12244
  });
12229
- return _context22.abrupt("break", 100);
12245
+ return _context22.abrupt("break", 101);
12230
12246
 
12231
- case 94:
12247
+ case 95:
12232
12248
  requestNotificationPermission();
12233
- return _context22.abrupt("break", 100);
12249
+ return _context22.abrupt("break", 101);
12234
12250
 
12235
- case 96:
12251
+ case 97:
12236
12252
  conversationEndCallback = adaSettings.conversationEndCallback;
12237
12253
 
12238
12254
  if (conversationEndCallback) {
12239
12255
  conversationEndCallback(payload);
12240
12256
  }
12241
12257
 
12242
- return _context22.abrupt("break", 100);
12243
-
12244
- case 99:
12245
- return _context22.abrupt("break", 100);
12258
+ return _context22.abrupt("break", 101);
12246
12259
 
12247
12260
  case 100:
12261
+ return _context22.abrupt("break", 101);
12262
+
12263
+ case 101:
12248
12264
  case "end":
12249
12265
  return _context22.stop();
12250
12266
  }
12251
12267
  }
12252
- }, _callee, this, [[72, 76]]);
12268
+ }, _callee, this, [[73, 77]]);
12253
12269
  }));
12254
12270
 
12255
12271
  function handleChatEvent(_x, _x2, _x3) {
@@ -12276,12 +12292,34 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12276
12292
  _this5.handleChatEvent(type, payload, id);
12277
12293
  });
12278
12294
  }
12295
+ }, {
12296
+ key: "frameLoaded",
12297
+ value: function frameLoaded() {
12298
+ var _this6 = this;
12299
+
12300
+ var _this$props11 = this.props,
12301
+ handle = _this$props11.handle,
12302
+ adaSettings = _this$props11.adaSettings;
12303
+ var chatFrameTimeoutCallback = adaSettings.chatFrameTimeoutCallback;
12304
+ this.chatRenderTimeout = window.setTimeout(function () {
12305
+ var _this6$channel;
12306
+
12307
+ (0,services_logger/* log */.cM)("Chat frame took over 5 seconds to respond", {
12308
+ handle: handle,
12309
+ embedSettings: adaSettings
12310
+ });
12311
+
12312
+ if (chatFrameTimeoutCallback && !((_this6$channel = _this6.channel) !== null && _this6$channel !== void 0 && _this6$channel.isConnected)) {
12313
+ chatFrameTimeoutCallback();
12314
+ }
12315
+ }, 5000);
12316
+ }
12279
12317
  }, {
12280
12318
  key: "render",
12281
12319
  value: function render() {
12282
- var _this$props11 = this.props,
12283
- name = _this$props11.name,
12284
- isDrawerOpen = _this$props11.isDrawerOpen;
12320
+ var _this$props12 = this.props,
12321
+ name = _this$props12.name,
12322
+ isDrawerOpen = _this$props12.isDrawerOpen;
12285
12323
  var iFrameName = "ada-".concat(name, "-frame");
12286
12324
  return v("iframe", {
12287
12325
  src: this.url,
@@ -12295,7 +12333,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12295
12333
  className: iFrameName,
12296
12334
  "aria-expanded": isDrawerOpen,
12297
12335
  allowTransparency: true,
12298
- allowFullScreen: true
12336
+ allowFullScreen: true,
12337
+ onLoad: this.frameLoaded.bind(this)
12299
12338
  });
12300
12339
  }
12301
12340
  }], [{
@@ -12762,8 +12801,7 @@ var Container = /*#__PURE__*/function (_Component) {
12762
12801
  adaSettings = _this$props2.adaSettings,
12763
12802
  chatterInLiveChat = _this$props2.chatterInLiveChat,
12764
12803
  messageService = _this$props2.messageService,
12765
- wasCampaignShownButNowClosed = _this$props2.wasCampaignShownButNowClosed,
12766
- isChatEmpty = _this$props2.isChatEmpty;
12804
+ wasCampaignShownButNowClosed = _this$props2.wasCampaignShownButNowClosed;
12767
12805
  var adaReadyCallback = adaSettings.adaReadyCallback,
12768
12806
  toggleCallback = adaSettings.toggleCallback;
12769
12807
 
@@ -12830,10 +12868,12 @@ var Container = /*#__PURE__*/function (_Component) {
12830
12868
 
12831
12869
  if (chatChannel) {
12832
12870
  if (!wasCampaignShownButNowClosed) {
12871
+ // If the campaign has not been closed (i.e. is still visible), send the follow up response
12833
12872
  chatChannel.postMessage(SEND_GREETING, {
12834
12873
  responseId: followUpResponseId
12835
- }); // If the campaign has not been closed (i.e. is still visible), send the follow up response
12836
- } else if (isChatEmpty) {
12874
+ });
12875
+ } else {
12876
+ // otherwise, send the bot's default greeting answer (if the conversation has messages already, `chat` will ignore this message)
12837
12877
  chatChannel.postMessage(SEND_GREETING);
12838
12878
  }
12839
12879
 
@@ -13003,7 +13043,8 @@ var Container = /*#__PURE__*/function (_Component) {
13003
13043
  setState({
13004
13044
  latestCampaignKey: campaignKey,
13005
13045
  hasChatOpenedAfterProactiveMessagesShown: false,
13006
- wasCampaignShownButNowClosed: false
13046
+ wasCampaignShownButNowClosed: false,
13047
+ proactiveCampaignHadMessages: false
13007
13048
  });
13008
13049
  this.setState({
13009
13050
  // Only need to load chat for engage campaigns, not free tier (message_text) campaigns
@@ -13723,8 +13764,7 @@ function Container_mapStateToProps(storeState) {
13723
13764
  chatDimensions = storeState.chatDimensions,
13724
13765
  isIntroShown = storeState.isIntroShown,
13725
13766
  language = storeState.language,
13726
- wasCampaignShownButNowClosed = storeState.wasCampaignShownButNowClosed,
13727
- isChatEmpty = storeState.isChatEmpty;
13767
+ wasCampaignShownButNowClosed = storeState.wasCampaignShownButNowClosed;
13728
13768
  return {
13729
13769
  client: client,
13730
13770
  hideMask: hideMask,
@@ -13739,8 +13779,7 @@ function Container_mapStateToProps(storeState) {
13739
13779
  chatDimensions: chatDimensions,
13740
13780
  isIntroShown: isIntroShown,
13741
13781
  language: language,
13742
- wasCampaignShownButNowClosed: wasCampaignShownButNowClosed,
13743
- isChatEmpty: isChatEmpty
13782
+ wasCampaignShownButNowClosed: wasCampaignShownButNowClosed
13744
13783
  };
13745
13784
  }
13746
13785
 
@@ -14335,7 +14374,7 @@ window.__AdaEmbedConstructor = Embed;
14335
14374
  /* harmony export */ });
14336
14375
  var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(15|(1[6-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(98|(99|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(98|(99|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
14337
14376
  var isProduction = "production" === "production";
14338
- var embed2Version = "0f7dd6a";
14377
+ var embed2Version = "cc742de";
14339
14378
 
14340
14379
  /***/ }),
14341
14380
 
@@ -14681,9 +14720,9 @@ function _log() {
14681
14720
  service: "embed",
14682
14721
  env: "production",
14683
14722
  embedVersion: 2,
14684
- version: "1.0.76",
14723
+ version: "1.0.79",
14685
14724
  isNpm: true,
14686
- commitHash: "0f7dd6a"
14725
+ commitHash: "cc742de"
14687
14726
  }))
14688
14727
  });
14689
14728
 
@@ -25624,7 +25663,7 @@ function _loadEmbed() {
25624
25663
  polyfillVersionString = "legacy";
25625
25664
  }
25626
25665
 
25627
- embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "0f7dd6a", "/index.js");
25666
+ embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "cc742de", "/index.js");
25628
25667
  }
25629
25668
 
25630
25669
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
@@ -1 +1,3 @@
1
+ import type { StartOptions } from "common/types/store-state";
1
2
  export declare const NO_OP_FUNCTION: () => void;
3
+ export declare function isStartOptions(input: unknown): input is StartOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.76",
3
+ "version": "1.0.79",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",
@@ -76,7 +76,7 @@
76
76
  "eslint-plugin-cypress": "^2.11.3",
77
77
  "eslint-plugin-sonarjs": "^0.11.0",
78
78
  "husky": "^7.0.0",
79
- "jest": "^27.3.1",
79
+ "jest": "^27.5.1",
80
80
  "jest-localstorage-mock": "^2.4.0",
81
81
  "lint-staged": "^11.2.3",
82
82
  "npm-run-all": "^4.1.5",
@@ -100,7 +100,7 @@
100
100
  "@babel/preset-typescript": "^7.16.7",
101
101
  "@babel/runtime-corejs3": "^7.15.4",
102
102
  "@sentry/browser": "^6.17.1",
103
- "@sentry/webpack-plugin": "^1.18.4",
103
+ "@sentry/webpack-plugin": "^1.18.8",
104
104
  "babel-loader": "^8.2.3",
105
105
  "babel-preset-preact": "^2.0.0",
106
106
  "browserslist-useragent-regexp": "^3.0.2",