@ada-support/embed2 1.1.35 → 1.1.38

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.
@@ -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.35-5a03f92",
8801
+ release: "1.1.38-864fd65",
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, "5a03f92", "/index.html");
9503
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "864fd65", "/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()("5a03f92").call("5a03f92", 0, 7),
11748
+ embedVersion: slice_default()("864fd65").call("864fd65", 0, 7),
11749
11749
  greeting: greeting,
11750
11750
  language: language,
11751
11751
  skipGreeting: skipGreeting,
@@ -13153,58 +13153,49 @@ var Container = /*#__PURE__*/function (_Component) {
13153
13153
 
13154
13154
  case 7:
13155
13155
  _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;
13156
+ _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
13157
  break;
13158
13158
 
13159
13159
  case 10:
13160
- if (client.features.afm_business_events) {
13161
- _context3.next = 13;
13162
- break;
13160
+ if (!client.features.afm_business_events) {
13161
+ console.error("Ada Embed - business events not available in your feature set.");
13162
+ } else {
13163
+ this.trackEvent(payload);
13163
13164
  }
13164
13165
 
13165
- localChannel.postMessage(TRACK_EVENT_RESPONSE, "Ada Embed - business events not available in your feature set.", id, FetchEventStatus.Failure);
13166
- return _context3.abrupt("return");
13166
+ localChannel.postMessage(TRACK_EVENT_RESPONSE, null, id);
13167
+ return _context3.abrupt("break", 85);
13167
13168
 
13168
13169
  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;
13170
+ if (!client.features.afm_proactive_messaging) {
13171
+ console.error("Ada Embed - proactive campaigns not available in your feature set.");
13172
+ } else {
13173
+ this.triggerCampaign(payload);
13176
13174
  }
13177
13175
 
13178
- localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
13179
- return _context3.abrupt("return");
13176
+ localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, null, id);
13177
+ return _context3.abrupt("break", 85);
13180
13178
 
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;
13179
+ case 16:
13180
+ if (!client.features.afm_proactive_messaging) {
13181
+ console.error("Ada Embed - proactive campaigns not available in your feature set.");
13182
+ } else {
13183
+ this.evaluateCampaignConditions(payload);
13189
13184
  }
13190
13185
 
13191
- localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
13192
- return _context3.abrupt("return");
13186
+ localChannel.postMessage(EVAL_CAMPAIGN_CONDITIONS_RESPONSE, null, id);
13187
+ return _context3.abrupt("break", 85);
13193
13188
 
13194
- case 23:
13195
- this.evaluateCampaignConditions(payload);
13196
- return _context3.abrupt("break", 91);
13197
-
13198
- case 25:
13189
+ case 19:
13199
13190
  toggleChat = this.props.toggleChat;
13200
- _context3.next = 28;
13191
+ _context3.next = 22;
13201
13192
  return toggleChat();
13202
13193
 
13203
- case 28:
13194
+ case 22:
13204
13195
  localChannel.postMessage(TOGGLE_RESPONSE, null, id);
13205
- return _context3.abrupt("break", 91);
13196
+ return _context3.abrupt("break", 85);
13206
13197
 
13207
- case 30:
13198
+ case 24:
13208
13199
  _this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
13209
13200
  contentToReturn = {
13210
13201
  isDrawerOpen: isDrawerOpen,
@@ -13213,38 +13204,38 @@ var Container = /*#__PURE__*/function (_Component) {
13213
13204
  hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
13214
13205
  };
13215
13206
  localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
13216
- return _context3.abrupt("break", 91);
13207
+ return _context3.abrupt("break", 85);
13217
13208
 
13218
- case 34:
13209
+ case 28:
13219
13210
  _this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
13220
13211
  metaData = payload;
13221
13212
  newMetaFields = Container_objectSpread(Container_objectSpread({}, metaFields), metaData);
13222
- _context3.next = 39;
13213
+ _context3.next = 33;
13223
13214
  return setState({
13224
13215
  metaFields: newMetaFields
13225
13216
  });
13226
13217
 
13227
- case 39:
13218
+ case 33:
13228
13219
  localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
13229
- return _context3.abrupt("break", 91);
13220
+ return _context3.abrupt("break", 85);
13230
13221
 
13231
- case 41:
13222
+ case 35:
13232
13223
  _this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
13233
- _context3.next = 44;
13224
+ _context3.next = 38;
13234
13225
  return _setState({
13235
13226
  sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), payload)
13236
13227
  });
13237
13228
 
13238
- case 44:
13229
+ case 38:
13239
13230
  localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
13240
- return _context3.abrupt("break", 91);
13231
+ return _context3.abrupt("break", 85);
13241
13232
 
13242
- case 46:
13233
+ case 40:
13243
13234
  localChannel.postMessage(STOP_RESPONSE, null, id);
13244
13235
  this.unmount();
13245
- return _context3.abrupt("break", 91);
13236
+ return _context3.abrupt("break", 85);
13246
13237
 
13247
- case 49:
13238
+ case 43:
13248
13239
  _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
13240
  _setState2 = this.props.setState;
13250
13241
  chatHasBeenRendered = this.state.chatHasBeenRendered;
@@ -13257,18 +13248,18 @@ var Container = /*#__PURE__*/function (_Component) {
13257
13248
  };
13258
13249
 
13259
13250
  if (!resetChatHistory) {
13260
- _context3.next = 62;
13251
+ _context3.next = 56;
13261
13252
  break;
13262
13253
  }
13263
13254
 
13264
13255
  if (xStorageChannel) {
13265
- _context3.next = 56;
13256
+ _context3.next = 50;
13266
13257
  break;
13267
13258
  }
13268
13259
 
13269
13260
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
13270
13261
 
13271
- case 56:
13262
+ case 50:
13272
13263
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
13273
13264
 
13274
13265
  safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
@@ -13281,11 +13272,11 @@ var Container = /*#__PURE__*/function (_Component) {
13281
13272
  chatterCreated: null
13282
13273
  });
13283
13274
 
13284
- case 62:
13285
- _context3.next = 64;
13275
+ case 56:
13276
+ _context3.next = 58;
13286
13277
  return _setState2(newState);
13287
13278
 
13288
- case 64:
13279
+ case 58:
13289
13280
  if (chatHasBeenRendered) {
13290
13281
  this.setState({
13291
13282
  hideChatOverride: true
@@ -13297,48 +13288,48 @@ var Container = /*#__PURE__*/function (_Component) {
13297
13288
  }
13298
13289
 
13299
13290
  localChannel.postMessage(RESET_RESPONSE, null, id);
13300
- return _context3.abrupt("break", 91);
13291
+ return _context3.abrupt("break", 85);
13301
13292
 
13302
- case 67:
13293
+ case 61:
13303
13294
  _setState3 = this.props.setState;
13304
13295
 
13305
13296
  if (xStorageChannel) {
13306
- _context3.next = 70;
13297
+ _context3.next = 64;
13307
13298
  break;
13308
13299
  }
13309
13300
 
13310
13301
  throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
13311
13302
 
13312
- case 70:
13303
+ case 64:
13313
13304
  // Clear chatter data from local storage
13314
13305
  safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13315
13306
  safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
13316
13307
  safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
13317
13308
  safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
13318
13309
 
13319
- _context3.next = 76;
13310
+ _context3.next = 70;
13320
13311
  return _setState3({
13321
13312
  chatterToken: null,
13322
13313
  chatterCreated: null
13323
13314
  });
13324
13315
 
13325
- case 76:
13316
+ case 70:
13326
13317
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
13327
13318
  localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
13328
- return _context3.abrupt("break", 91);
13319
+ return _context3.abrupt("break", 85);
13329
13320
 
13330
- case 79:
13321
+ case 73:
13331
13322
  _ref2 = payload, body = _ref2.body, duration = _ref2.duration;
13332
13323
  EXTRA_PROACTIVE_DELAY = 1000;
13333
13324
 
13334
13325
  if (client) {
13335
- _context3.next = 83;
13326
+ _context3.next = 77;
13336
13327
  break;
13337
13328
  }
13338
13329
 
13339
13330
  throw new errors/* AdaEmbedError */.S("`client` is not defined");
13340
13331
 
13341
- case 83:
13332
+ case 77:
13342
13333
  // Do not feature flag gate this behind the developer_proactive flag
13343
13334
  // It's also used for free-tier campaigns, which are available to all clients
13344
13335
  this.setState({
@@ -13378,22 +13369,22 @@ var Container = /*#__PURE__*/function (_Component) {
13378
13369
  }
13379
13370
  }, _callee);
13380
13371
  })));
13381
- _context3.next = 86;
13372
+ _context3.next = 80;
13382
13373
  return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
13383
13374
 
13384
- case 86:
13375
+ case 80:
13385
13376
  localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
13386
- return _context3.abrupt("break", 91);
13377
+ return _context3.abrupt("break", 85);
13387
13378
 
13388
- case 88:
13379
+ case 82:
13389
13380
  if (chatChannel) {
13390
13381
  chatChannel.postMessage(CLOSE_CAMPAIGN);
13391
13382
  }
13392
13383
 
13393
13384
  localChannel.postMessage(CLOSE_CAMPAIGN_RESPONSE, null, id);
13394
- return _context3.abrupt("break", 91);
13385
+ return _context3.abrupt("break", 85);
13395
13386
 
13396
- case 91:
13387
+ case 85:
13397
13388
  case "end":
13398
13389
  return _context3.stop();
13399
13390
  }
@@ -14401,7 +14392,7 @@ var Embed = /*#__PURE__*/function () {
14401
14392
  * Bind to the window object so it can be used by the entry file.
14402
14393
  */
14403
14394
 
14404
- (0,defineProperty/* default */.Z)(Embed, "embed2Version", "5a03f92");
14395
+ (0,defineProperty/* default */.Z)(Embed, "embed2Version", "864fd65");
14405
14396
 
14406
14397
  window.__AdaEmbedConstructor = Embed;
14407
14398
 
@@ -14761,9 +14752,9 @@ function _log() {
14761
14752
  service: "embed",
14762
14753
  env: "production",
14763
14754
  embedVersion: 2,
14764
- version: "1.1.35",
14755
+ version: "1.1.38",
14765
14756
  isNpm: true,
14766
- commitHash: "5a03f92"
14757
+ commitHash: "864fd65"
14767
14758
  }))
14768
14759
  });
14769
14760
 
@@ -25704,7 +25695,7 @@ function _loadClientChunk() {
25704
25695
  polyfillVersionString = "legacy";
25705
25696
  }
25706
25697
 
25707
- clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "5a03f92", "/index.js");
25698
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "864fd65", "/index.js");
25708
25699
  } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25709
25700
 
25710
25701
 
@@ -25817,7 +25808,7 @@ function createEmbedObject() {
25817
25808
  throw new Error("`window.__AdaEmbedConstructor` is not defined");
25818
25809
 
25819
25810
  case 7:
25820
- if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !== "5a03f92")) {
25811
+ if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !== "864fd65")) {
25821
25812
  _context2.next = 9;
25822
25813
  break;
25823
25814
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.1.35",
3
+ "version": "1.1.38",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",