@ada-support/embed2 1.0.49 → 1.0.50

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.
@@ -11,7 +11,7 @@ export interface CSInterface {
11
11
  domain?: string;
12
12
  route?: string;
13
13
  qp?: {
14
- [key: string]: string | boolean | number;
14
+ [key: string]: string | boolean | number | null | undefined;
15
15
  };
16
16
  isEmbedFramed?: boolean;
17
17
  }
@@ -22,7 +22,7 @@ export interface StartOptions {
22
22
  onAdaEmbedLoaded?(): void;
23
23
  toggleCallback?(isDrawerOpen: boolean): void;
24
24
  eventCallbacks?: {
25
- [eventName: string]: (customJavascriptEvent: object) => void;
25
+ [eventName: string]: ((customJavascriptEvent: object) => void) | undefined;
26
26
  };
27
27
  zdChatterAuthCallback?(callback: (token: string) => void): void;
28
28
  embedStyles?: string;
@@ -8514,7 +8514,7 @@ var client = new error_tracker_BrowserClient({
8514
8514
  return event;
8515
8515
  },
8516
8516
  environment: "production",
8517
- release: "1.0.49-4562505",
8517
+ release: "1.0.50-64cd4d3",
8518
8518
  sampleRate: 0.25,
8519
8519
  autoSessionTracking: false,
8520
8520
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9213,7 +9213,7 @@ function getEmbedURL(_ref) {
9213
9213
  polyfillVersionString = "legacy";
9214
9214
  }
9215
9215
 
9216
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "4562505", "/index.html");
9216
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "64cd4d3", "/index.html");
9217
9217
  }
9218
9218
  /**
9219
9219
  * Generate the Chat / API URL
@@ -9230,12 +9230,18 @@ function getURL(_ref2) {
9230
9230
  _ref2$qp = _ref2.qp,
9231
9231
  qp = _ref2$qp === void 0 ? {} : _ref2$qp;
9232
9232
 
9233
- var queryString = map_default()(_context8 = filter_default()(_context9 = keys_default()(qp)).call(_context9, function (key) {
9234
- return qp[key] !== undefined && qp[key] !== null;
9235
- })).call(_context8, function (key) {
9233
+ var queryString = filter_default()(_context8 = map_default()(_context9 = keys_default()(qp)).call(_context9, function (key) {
9236
9234
  var _context10;
9237
9235
 
9238
- return concat_default()(_context10 = "".concat(key, "=")).call(_context10, window.encodeURIComponent(qp[key]));
9236
+ var value = qp[key];
9237
+
9238
+ if (value === undefined || value === null) {
9239
+ return null;
9240
+ }
9241
+
9242
+ return concat_default()(_context10 = "".concat(key, "=")).call(_context10, window.encodeURIComponent(value));
9243
+ })).call(_context8, function (v) {
9244
+ return v !== null;
9239
9245
  }).join("&");
9240
9246
 
9241
9247
  var questionSym = queryString.length ? "?" : "";
@@ -11385,6 +11391,7 @@ function ChatFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefine
11385
11391
 
11386
11392
 
11387
11393
 
11394
+
11388
11395
  var ChatFrame = /*#__PURE__*/function (_Component) {
11389
11396
  (0,inherits/* default */.Z)(ChatFrame, _Component);
11390
11397
 
@@ -11405,21 +11412,19 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11405
11412
 
11406
11413
  (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "iframeRef", y());
11407
11414
 
11408
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "pageYOffset", void 0);
11409
-
11410
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyOverflow", void 0);
11415
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "pageYOffset", 0);
11411
11416
 
11412
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyPosition", void 0);
11417
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyOverflow", "");
11413
11418
 
11414
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyTop", void 0);
11419
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyPosition", "");
11415
11420
 
11416
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyBottom", void 0);
11421
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyTop", "");
11417
11422
 
11418
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyLeft", void 0);
11423
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyBottom", "");
11419
11424
 
11420
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyRight", void 0);
11425
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyLeft", "");
11421
11426
 
11422
- (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "frameConnected", void 0);
11427
+ (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "documentBodyRight", "");
11423
11428
 
11424
11429
  (0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "url", _this.getURL);
11425
11430
 
@@ -11439,6 +11444,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11439
11444
  var _this2 = this;
11440
11445
 
11441
11446
  var _this$props = this.props,
11447
+ adaSettings = _this$props.adaSettings,
11448
+ handle = _this$props.handle,
11442
11449
  name = _this$props.name,
11443
11450
  setChatHasBeenRendered = _this$props.setChatHasBeenRendered,
11444
11451
  messageService = _this$props.messageService,
@@ -11447,7 +11454,12 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11447
11454
  this.channel = messageService.registerFrameChannel(name, this.iframeRef.current.contentWindow, this.iframeRef.current.src);
11448
11455
  store.addChannelListener(name);
11449
11456
  this.bindChatEventHandlers();
11450
- this.handleScrollLock(); // Delay to allow inline css animation to work.
11457
+ this.handleScrollLock(); // We use this log to track number of chat impressions (times when users see chat iFrame render first time).
11458
+
11459
+ (0,services_logger/* log */.c)("Chat frame mount", {
11460
+ handle: handle,
11461
+ embedSettings: adaSettings
11462
+ }); // Delay to allow inline css animation to work.
11451
11463
 
11452
11464
  setTimeout(function () {
11453
11465
  _this2.setState({
@@ -11484,7 +11496,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11484
11496
  }
11485
11497
 
11486
11498
  var theme = client.ui_settings.chat.theme;
11487
- var systemDarkMode = Boolean(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches);
11499
+ var systemDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
11488
11500
  return theme === "dark" || theme === "auto" && systemDarkMode;
11489
11501
  }
11490
11502
  /**
@@ -11506,6 +11518,11 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11506
11518
  privateMode = _this$props3.privateMode,
11507
11519
  testMode = _this$props3.testMode,
11508
11520
  adaSettings = _this$props3.adaSettings;
11521
+
11522
+ if (!handle) {
11523
+ throw new errors/* AdaEmbedError */.S("`handle` is not defined");
11524
+ }
11525
+
11509
11526
  return getURL({
11510
11527
  name: name,
11511
11528
  handle: handle,
@@ -11526,7 +11543,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11526
11543
  }, {
11527
11544
  key: "styles",
11528
11545
  get: function get() {
11529
- var _client$ui_settings2, _context10, _context11, _context12, _context13, _context14;
11546
+ var _client$ui_settings2, _client$ui_settings2$, _context10, _context11, _context12, _context13, _context14;
11530
11547
 
11531
11548
  var _this$props4 = this.props,
11532
11549
  isDrawerOpen = _this$props4.isDrawerOpen,
@@ -11543,7 +11560,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11543
11560
  closeTransitionTime = _this$state.closeTransitionTime;
11544
11561
  var isShown = isDrawerOpen && isMounted;
11545
11562
  var backgroundColor = this.darkMode ? "#121212" : "#fff";
11546
- var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : _client$ui_settings2.chat.style) === "rectangular" ? "8px" : "16px";
11563
+ var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : (_client$ui_settings2$ = _client$ui_settings2.chat) === null || _client$ui_settings2$ === void 0 ? void 0 : _client$ui_settings2$.style) === "rectangular" ? "8px" : "16px";
11547
11564
  var WINDOW_HEIGHT = 725;
11548
11565
  var TEST_BOT_NAV_HEIGHT = 48;
11549
11566
  var isTestBot = client.features.embed_test_bot && testMode;
@@ -11572,12 +11589,17 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11572
11589
  var _this$props5 = this.props,
11573
11590
  chatDimensions = _this$props5.chatDimensions,
11574
11591
  client = _this$props5.client,
11575
- adaSettings = _this$props5.adaSettings; // delta is used to determine how much of the button's height should be ignored
11592
+ adaSettings = _this$props5.adaSettings;
11593
+
11594
+ if (!(client !== null && client !== void 0 && client.chat_button)) {
11595
+ return "";
11596
+ } // delta is used to determine how much of the button's height should be ignored
11576
11597
  // when spacing the proactive message
11577
11598
 
11599
+
11578
11600
  var delta = 3;
11579
11601
  var TEXT_BUTTON_HEIGHT = 44;
11580
- 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.size) - delta;
11602
+ var bottomOffset = ((_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.chat_button.size - delta;
11581
11603
  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 ");
11582
11604
  }
11583
11605
  }, {
@@ -11593,6 +11615,10 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11593
11615
  return ChatFrame.parentElementStyles;
11594
11616
  }
11595
11617
 
11618
+ if (!client) {
11619
+ throw new errors/* AdaEmbedError */.S("`client` is not defined");
11620
+ }
11621
+
11596
11622
  if (client.features.afm_proactive_messaging && !isDrawerOpen) {
11597
11623
  var _context21;
11598
11624
 
@@ -11721,32 +11747,48 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11721
11747
  case 0:
11722
11748
  _this$props8 = this.props, adaSettings = _this$props8.adaSettings, setState = _this$props8.setState, setConnectionState = _this$props8.setConnectionState;
11723
11749
  _context22.t0 = type;
11724
- _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;
11750
+ _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 === CHATTER_LIVECHAT_EVENT ? 41 : _context22.t0 === CUSTOM_JAVASCRIPT_EVENT ? 49 : _context22.t0 === RESET_FROM_CHAT_EVENT ? 58 : _context22.t0 === ZD_JWT_AUTH_EVENT ? 61 : _context22.t0 === CREATE_NOTIFICATION_EVENT ? 79 : _context22.t0 === BROWSER_HAS_NOTIFICATIONS_EVENT ? 81 : _context22.t0 === REQUEST_NOTIFICATIONS_EVENT ? 85 : _context22.t0 === END_CONVERSATION_EVENT ? 87 : 90;
11725
11751
  break;
11726
11752
 
11727
11753
  case 4:
11728
- this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
11729
- return _context22.abrupt("break", 68);
11754
+ if (this.channel) {
11755
+ _context22.next = 6;
11756
+ break;
11757
+ }
11758
+
11759
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11730
11760
 
11731
11761
  case 6:
11762
+ this.channel.postMessage("SET_WINDOW_ORIGIN", window.location, id);
11763
+ return _context22.abrupt("break", 91);
11764
+
11765
+ case 8:
11766
+ if (this.channel) {
11767
+ _context22.next = 10;
11768
+ break;
11769
+ }
11770
+
11771
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11772
+
11773
+ case 10:
11732
11774
  this.channel.isConnected = true;
11733
11775
  setConnectionState({
11734
11776
  "chat": ConnectionState.Done
11735
11777
  });
11736
- return _context22.abrupt("break", 68);
11778
+ return _context22.abrupt("break", 91);
11737
11779
 
11738
- case 9:
11780
+ case 13:
11739
11781
  setState({
11740
11782
  isChatWebsocketConnected: true
11741
11783
  });
11742
- return _context22.abrupt("break", 68);
11784
+ return _context22.abrupt("break", 91);
11743
11785
 
11744
- case 11:
11786
+ case 15:
11745
11787
  _ref = payload, eventKey = _ref.eventKey, data = _ref.data;
11746
11788
  publishEvent(eventKey, data);
11747
- return _context22.abrupt("break", 68);
11789
+ return _context22.abrupt("break", 91);
11748
11790
 
11749
- case 14:
11791
+ case 18:
11750
11792
  _ref2 = payload, analytics = _ref2.analytics;
11751
11793
  analyticsCallback = adaSettings.analyticsCallback;
11752
11794
 
@@ -11754,28 +11796,28 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11754
11796
  analyticsCallback(analytics);
11755
11797
  }
11756
11798
 
11757
- return _context22.abrupt("break", 68);
11799
+ return _context22.abrupt("break", 91);
11758
11800
 
11759
- case 18:
11801
+ case 22:
11760
11802
  client = this.props.client;
11761
11803
  _ref3 = payload, chatter = _ref3.chatter, created = _ref3.created;
11762
11804
  chatterTokenCallback = adaSettings.chatterTokenCallback;
11763
11805
 
11764
11806
  if (client) {
11765
- _context22.next = 23;
11807
+ _context22.next = 27;
11766
11808
  break;
11767
11809
  }
11768
11810
 
11769
11811
  throw new errors/* AdaEmbedError */.S("`client` is undefined");
11770
11812
 
11771
- case 23:
11772
- _context22.next = 25;
11813
+ case 27:
11814
+ _context22.next = 29;
11773
11815
  return setState({
11774
11816
  chatterToken: chatter,
11775
11817
  chatterCreated: created
11776
11818
  });
11777
11819
 
11778
- case 25:
11820
+ case 29:
11779
11821
  /**
11780
11822
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11781
11823
  * come from chat. This is important for campaign and business event triggers.
@@ -11792,26 +11834,26 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11792
11834
  chatterTokenCallback(chatter);
11793
11835
  }
11794
11836
 
11795
- return _context22.abrupt("break", 68);
11837
+ return _context22.abrupt("break", 91);
11796
11838
 
11797
- case 28:
11839
+ case 32:
11798
11840
  _client = this.props.client;
11799
11841
  _ref4 = payload, zdSessionId = _ref4.zdSessionId, zdPreviousTags = _ref4.zdPreviousTags;
11800
11842
 
11801
11843
  if (_client) {
11802
- _context22.next = 32;
11844
+ _context22.next = 36;
11803
11845
  break;
11804
11846
  }
11805
11847
 
11806
11848
  throw new errors/* AdaEmbedError */.S("`client` is undefined");
11807
11849
 
11808
- case 32:
11809
- _context22.next = 34;
11850
+ case 36:
11851
+ _context22.next = 38;
11810
11852
  return setState({
11811
11853
  zdSessionId: zdSessionId
11812
11854
  });
11813
11855
 
11814
- case 34:
11856
+ case 38:
11815
11857
  storage = function () {
11816
11858
  if (_client.persistence === PERSISTENCE_NORMAL) {
11817
11859
  return safeLocalStorage;
@@ -11838,17 +11880,25 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11838
11880
  }
11839
11881
  }
11840
11882
 
11841
- return _context22.abrupt("break", 68);
11883
+ return _context22.abrupt("break", 91);
11842
11884
 
11843
- case 37:
11885
+ case 41:
11844
11886
  _client2 = this.props.client;
11845
11887
  _ref5 = payload, inLiveChat = _ref5.inLiveChat;
11846
- _context22.next = 41;
11888
+ _context22.next = 45;
11847
11889
  return setState({
11848
11890
  chatterInLiveChat: inLiveChat
11849
11891
  });
11850
11892
 
11851
- case 41:
11893
+ case 45:
11894
+ if (_client2) {
11895
+ _context22.next = 47;
11896
+ break;
11897
+ }
11898
+
11899
+ throw new errors/* AdaEmbedError */.S("`client` is not defined");
11900
+
11901
+ case 47:
11852
11902
  /**
11853
11903
  * Store the token so when embed loads in the future, it doesn't have to wait for it to
11854
11904
  * come from chat. This is important for campaign and business event triggers.
@@ -11859,19 +11909,19 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11859
11909
  safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
11860
11910
  }
11861
11911
 
11862
- return _context22.abrupt("break", 68);
11912
+ return _context22.abrupt("break", 91);
11863
11913
 
11864
- case 43:
11914
+ case 49:
11865
11915
  eventCallbacks = adaSettings.eventCallbacks;
11866
11916
 
11867
11917
  if (eventCallbacks) {
11868
- _context22.next = 46;
11918
+ _context22.next = 52;
11869
11919
  break;
11870
11920
  }
11871
11921
 
11872
- return _context22.abrupt("break", 68);
11922
+ return _context22.abrupt("break", 91);
11873
11923
 
11874
- case 46:
11924
+ case 52:
11875
11925
  customJavascriptEvent = payload.event_data;
11876
11926
  specificCallback = eventCallbacks[customJavascriptEvent.event_name];
11877
11927
  genericCallback = eventCallbacks["*"];
@@ -11884,65 +11934,107 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11884
11934
  genericCallback(customJavascriptEvent);
11885
11935
  }
11886
11936
 
11887
- return _context22.abrupt("break", 68);
11937
+ return _context22.abrupt("break", 91);
11888
11938
 
11889
- case 52:
11939
+ case 58:
11890
11940
  resetChat = this.props.resetChat;
11891
11941
  resetChat();
11892
- return _context22.abrupt("break", 68);
11942
+ return _context22.abrupt("break", 91);
11893
11943
 
11894
- case 55:
11944
+ case 61:
11895
11945
  zdChatterAuthCallback = adaSettings.zdChatterAuthCallback;
11896
11946
 
11897
- if (zdChatterAuthCallback) {
11898
- try {
11899
- zdChatterAuthCallback(function (token) {
11900
- _this4.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {
11901
- token: token
11902
- }, id);
11903
- });
11904
- } catch (e) {
11905
- console.warn("Function for zdChatterAuthCallback produced an error - please ensure the callback is functioning normally");
11906
- this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11947
+ if (!zdChatterAuthCallback) {
11948
+ _context22.next = 75;
11949
+ break;
11950
+ }
11951
+
11952
+ _context22.prev = 63;
11953
+ zdChatterAuthCallback(function (token) {
11954
+ if (!_this4.channel) {
11955
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11907
11956
  }
11908
- } else {
11909
- this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11957
+
11958
+ _this4.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {
11959
+ token: token
11960
+ }, id);
11961
+ });
11962
+ _context22.next = 73;
11963
+ break;
11964
+
11965
+ case 67:
11966
+ _context22.prev = 67;
11967
+ _context22.t1 = _context22["catch"](63);
11968
+ console.warn("Function for zdChatterAuthCallback produced an error - please ensure the callback is functioning normally");
11969
+
11970
+ if (this.channel) {
11971
+ _context22.next = 72;
11972
+ break;
11910
11973
  }
11911
11974
 
11912
- return _context22.abrupt("break", 68);
11975
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11913
11976
 
11914
- case 58:
11977
+ case 72:
11978
+ this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11979
+
11980
+ case 73:
11981
+ _context22.next = 78;
11982
+ break;
11983
+
11984
+ case 75:
11985
+ if (this.channel) {
11986
+ _context22.next = 77;
11987
+ break;
11988
+ }
11989
+
11990
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
11991
+
11992
+ case 77:
11993
+ this.channel.postMessage(ZD_JWT_AUTH_RESPONSE_EVENT, {}, id);
11994
+
11995
+ case 78:
11996
+ return _context22.abrupt("break", 91);
11997
+
11998
+ case 79:
11915
11999
  this.handleNotifications(payload);
11916
- return _context22.abrupt("break", 68);
12000
+ return _context22.abrupt("break", 91);
11917
12001
 
11918
- case 60:
12002
+ case 81:
12003
+ if (this.channel) {
12004
+ _context22.next = 83;
12005
+ break;
12006
+ }
12007
+
12008
+ throw new errors/* AdaEmbedError */.S("`this.channel` is not defined");
12009
+
12010
+ case 83:
11919
12011
  this.channel.postMessage(BROWSER_HAS_NOTIFICATIONS_RESPONSE_EVENT, {
11920
12012
  browserHasNotificationSupport: browserHasNotificationSupport
11921
12013
  });
11922
- return _context22.abrupt("break", 68);
12014
+ return _context22.abrupt("break", 91);
11923
12015
 
11924
- case 62:
12016
+ case 85:
11925
12017
  requestNotificationPermission();
11926
- return _context22.abrupt("break", 68);
12018
+ return _context22.abrupt("break", 91);
11927
12019
 
11928
- case 64:
12020
+ case 87:
11929
12021
  conversationEndCallback = adaSettings.conversationEndCallback;
11930
12022
 
11931
12023
  if (conversationEndCallback) {
11932
12024
  conversationEndCallback(payload);
11933
12025
  }
11934
12026
 
11935
- return _context22.abrupt("break", 68);
12027
+ return _context22.abrupt("break", 91);
11936
12028
 
11937
- case 67:
11938
- return _context22.abrupt("break", 68);
12029
+ case 90:
12030
+ return _context22.abrupt("break", 91);
11939
12031
 
11940
- case 68:
12032
+ case 91:
11941
12033
  case "end":
11942
12034
  return _context22.stop();
11943
12035
  }
11944
12036
  }
11945
- }, _callee, this);
12037
+ }, _callee, this, [[63, 67]]);
11946
12038
  }));
11947
12039
 
11948
12040
  function handleChatEvent(_x, _x2, _x3) {
@@ -11959,7 +12051,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11959
12051
  var _this$props9 = this.props,
11960
12052
  name = _this$props9.name,
11961
12053
  messageService = _this$props9.messageService;
11962
- messageService.getChannel(name).addEventListener(function (type, payload, id) {
12054
+ var channel = messageService.getChannel(name);
12055
+
12056
+ if (!channel) {
12057
+ throw new errors/* AdaEmbedError */.S("`channel` is not defined");
12058
+ }
12059
+
12060
+ channel.addEventListener(function (type, payload, id) {
11963
12061
  _this5.handleChatEvent(type, payload, id);
11964
12062
  });
11965
12063
  }
@@ -13980,7 +14078,7 @@ window.__AdaEmbedConstructor = Embed;
13980
14078
  /* harmony export */ });
13981
14079
  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);
13982
14080
  var isProduction = "production" === "production";
13983
- var embed2Version = "4562505";
14081
+ var embed2Version = "64cd4d3";
13984
14082
 
13985
14083
  /***/ }),
13986
14084
 
@@ -14313,9 +14411,9 @@ function _log() {
14313
14411
  service: "embed",
14314
14412
  env: "production",
14315
14413
  embedVersion: 2,
14316
- version: "1.0.49",
14414
+ version: "1.0.50",
14317
14415
  isNpm: true,
14318
- commitHash: "4562505"
14416
+ commitHash: "64cd4d3"
14319
14417
  }))
14320
14418
  });
14321
14419
 
@@ -23790,7 +23888,7 @@ function _loadEmbed() {
23790
23888
  polyfillVersionString = "legacy";
23791
23889
  }
23792
23890
 
23793
- embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "4562505", "/index.js");
23891
+ embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "64cd4d3", "/index.js");
23794
23892
  }
23795
23893
 
23796
23894
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",