@ada-support/embed2 1.0.83 → 1.1.2

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.
@@ -1,5 +1,6 @@
1
- import { ComponentType, h } from "preact";
2
- import { ActionCreators } from "common/constants/actions";
3
- import { Dispatch, MapDispatchToProps, MapStateToProps } from "common/types/store";
1
+ import type { ComponentType } from "preact";
2
+ import { h } from "preact";
3
+ import type { ActionCreators } from "common/constants/actions";
4
+ import type { Dispatch, MapDispatchToProps, MapStateToProps } from "common/types/store";
4
5
  export declare function connect<MSP extends MapStateToProps, MDP extends MapDispatchToProps>(mapStateToProps?: MSP, mapDispatchToProps?: MDP): <O>(WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>) => (ownProps: O) => h.JSX.Element;
5
6
  export declare function bindActionCreators(action: Partial<ActionCreators>, dispatch: Dispatch): (payload?: object) => Promise<import("../../common/types/store-state").StoreState>;
@@ -1,8 +1,8 @@
1
- import { ActionCreators } from "common/constants/actions";
2
- import { MessagePayload } from "common/types/events";
3
- import { StoreAction } from "common/types/index";
4
- import { DirectDispatch } from "common/types/store";
5
- import { StoreState } from "common/types/store-state";
1
+ import type { ActionCreators } from "common/constants/actions";
2
+ import type { MessagePayload } from "common/types/events";
3
+ import type { StoreAction } from "common/types/index";
4
+ import type { DirectDispatch } from "common/types/store";
5
+ import type { StoreState } from "common/types/store-state";
6
6
  declare const actions: {
7
7
  [key in ActionCreators]: ({ currentState, payload, dispatch }: {
8
8
  payload?: MessagePayload;
@@ -1,2 +1,2 @@
1
- import { StartOptions } from "common/types/store-state";
1
+ import type { StartOptions } from "common/types/store-state";
2
2
  export declare function getAlignment(adaSettings: StartOptions): "right" | "left";
@@ -1,6 +1,7 @@
1
- import { Component, ComponentType, h } from "preact";
2
- import { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
3
- import { StoreState } from "common/types/store-state";
1
+ import type { ComponentType } from "preact";
2
+ import { Component, h } from "preact";
3
+ import type { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
4
+ import type { StoreState } from "common/types/store-state";
4
5
  declare type Props<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> = {
5
6
  store: StoreProxyInterface;
6
7
  WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>;
@@ -1,4 +1,4 @@
1
- import { FetchEventStatusType } from "common/constants/events";
1
+ import type { FetchEventStatusType } from "common/constants/events";
2
2
  import type { EmbedEvent, EmbedRequestEvent, PayloadByEvent } from "common/lib/channel";
3
3
  export interface MessagePayload {
4
4
  [key: string]: any;
@@ -1,7 +1,7 @@
1
- import { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
- import { ActionTypes } from "common/constants/actions";
3
- import { MetaFieldPayload } from "common/types/store";
4
- import { StartOptions, StoreState } from "./store-state";
1
+ import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
+ import type { ActionTypes } from "common/constants/actions";
3
+ import type { MetaFieldPayload } from "common/types/store";
4
+ import type { StartOptions, StoreState } from "./store-state";
5
5
  export interface StoreAction {
6
6
  [key: string]: string | object | number;
7
7
  type: ActionTypes;
@@ -1,4 +1,4 @@
1
- import { StoreState } from "./store-state";
1
+ import type { StoreState } from "./store-state";
2
2
  export declare type Get = <K extends keyof StoreState>(key: K) => Promise<StoreState[K]>;
3
3
  export declare type GetState = () => Promise<StoreState>;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
1
+ import type { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
2
2
  export declare enum StorageTypes {
3
3
  Local = "local",
4
4
  Session = "session"
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
8788
8788
  return event;
8789
8789
  },
8790
8790
  environment: "production",
8791
- release: "1.0.83-6728389",
8791
+ release: "1.1.2-c955770",
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, "6728389", "/index.html");
9493
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "c955770", "/index.html");
9494
9494
  }
9495
9495
  /**
9496
9496
  * Generate the Chat / API URL
@@ -9663,7 +9663,6 @@ var CHATTER_STORAGE_KEY = CHATTER_TOKEN_STORAGE_KEY;
9663
9663
 
9664
9664
 
9665
9665
 
9666
-
9667
9666
  var StorageTypes;
9668
9667
 
9669
9668
  (function (StorageTypes) {
@@ -12299,7 +12298,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12299
12298
 
12300
12299
  var _this$props11 = this.props,
12301
12300
  handle = _this$props11.handle,
12302
- adaSettings = _this$props11.adaSettings;
12301
+ adaSettings = _this$props11.adaSettings; // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12302
+
12303
12303
  var chatFrameTimeoutCallback = adaSettings.chatFrameTimeoutCallback;
12304
12304
  this.chatRenderTimeout = window.setTimeout(function () {
12305
12305
  var _this6$channel;
@@ -12309,8 +12309,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12309
12309
  embedSettings: adaSettings
12310
12310
  });
12311
12311
 
12312
- if (chatFrameTimeoutCallback && !((_this6$channel = _this6.channel) !== null && _this6$channel !== void 0 && _this6$channel.isConnected)) {
12313
- chatFrameTimeoutCallback();
12312
+ if (!((_this6$channel = _this6.channel) !== null && _this6$channel !== void 0 && _this6$channel.isConnected)) {
12313
+ // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12314
+ if (chatFrameTimeoutCallback) {
12315
+ chatFrameTimeoutCallback();
12316
+ }
12317
+
12318
+ publishEvent("ada:chat_frame_timeout", {});
12314
12319
  }
12315
12320
  }, 5000);
12316
12321
  }
@@ -14374,7 +14379,7 @@ window.__AdaEmbedConstructor = Embed;
14374
14379
  /* harmony export */ });
14375
14380
  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);
14376
14381
  var isProduction = "production" === "production";
14377
- var embed2Version = "6728389";
14382
+ var embed2Version = "c955770";
14378
14383
 
14379
14384
  /***/ }),
14380
14385
 
@@ -14720,9 +14725,9 @@ function _log() {
14720
14725
  service: "embed",
14721
14726
  env: "production",
14722
14727
  embedVersion: 2,
14723
- version: "1.0.83",
14728
+ version: "1.1.2",
14724
14729
  isNpm: true,
14725
- commitHash: "6728389"
14730
+ commitHash: "c955770"
14726
14731
  }))
14727
14732
  });
14728
14733
 
@@ -25636,24 +25641,24 @@ function loadScript(options) {
25636
25641
  */
25637
25642
 
25638
25643
 
25639
- function loadEmbed(_x) {
25640
- return _loadEmbed.apply(this, arguments);
25644
+ function loadClientChunk(_x) {
25645
+ return _loadClientChunk.apply(this, arguments);
25641
25646
  }
25642
25647
  /**
25643
25648
  * Returns the public Embed methods to be bound to the window object.
25644
25649
  */
25645
25650
 
25646
25651
 
25647
- function _loadEmbed() {
25648
- _loadEmbed = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee17(adaSettings) {
25649
- var embedScriptSource, _context17, _context18, polyfillVersionString, host, clientScriptExists;
25652
+ function _loadClientChunk() {
25653
+ _loadClientChunk = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee17(adaSettings) {
25654
+ var clientScriptSource, _context17, _context18, polyfillVersionString, host, clientScriptLoaded;
25650
25655
 
25651
25656
  return regenerator_default().wrap(function _callee17$(_context19) {
25652
25657
  while (1) {
25653
25658
  switch (_context19.prev = _context19.next) {
25654
25659
  case 0:
25655
25660
  if (adaSettings.customDomains) {
25656
- embedScriptSource = config_info/* isModern */.pX ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
25661
+ clientScriptSource = config_info/* isModern */.pX ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
25657
25662
  } else {
25658
25663
  if (config_info/* isProduction */.yv) {
25659
25664
  host = "https://static.ada.support";
@@ -25663,16 +25668,16 @@ function _loadEmbed() {
25663
25668
  polyfillVersionString = "legacy";
25664
25669
  }
25665
25670
 
25666
- embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "6728389", "/index.js");
25667
- }
25671
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "c955770", "/index.js");
25672
+ } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25673
+
25668
25674
 
25669
- clientScriptExists = Boolean( true || // The client script is bundled with npm module
25670
- 0);
25675
+ clientScriptLoaded = Boolean(window.__AdaEmbedConstructor);
25671
25676
  /**
25672
25677
  * Check to see if the script has already been added. We only ever want to add the script once.
25673
25678
  */
25674
25679
 
25675
- if (clientScriptExists) {
25680
+ if (clientScriptLoaded) {
25676
25681
  _context19.next = 11;
25677
25682
  break;
25678
25683
  }
@@ -25680,7 +25685,7 @@ function _loadEmbed() {
25680
25685
  _context19.prev = 3;
25681
25686
  _context19.next = 6;
25682
25687
  return loadScript({
25683
- src: embedScriptSource
25688
+ src: clientScriptSource
25684
25689
  });
25685
25690
 
25686
25691
  case 6:
@@ -25704,7 +25709,7 @@ function _loadEmbed() {
25704
25709
  }
25705
25710
  }, _callee17, null, [[3, 8]]);
25706
25711
  }));
25707
- return _loadEmbed.apply(this, arguments);
25712
+ return _loadClientChunk.apply(this, arguments);
25708
25713
  }
25709
25714
 
25710
25715
  function createEmbedObject() {
@@ -25765,7 +25770,7 @@ function createEmbedObject() {
25765
25770
  */
25766
25771
 
25767
25772
  _context2.next = 5;
25768
- return loadEmbed(adaSettings);
25773
+ return loadClientChunk(adaSettings);
25769
25774
 
25770
25775
  case 5:
25771
25776
  if (!(adaSettings.customDomains && window.__AdaEmbedConstructor && window.__AdaEmbedConstructor.embed2Version !== config_info/* embed2Version */.Mk)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.83",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",
@@ -54,6 +54,7 @@
54
54
  "author": "",
55
55
  "license": "ISC",
56
56
  "devDependencies": {
57
+ "@ada-support/embed-types": "^1.0.0",
57
58
  "@ada-support/eslint-config-ada": "^1.2.1",
58
59
  "@types/enzyme": "^3.10.11",
59
60
  "@types/jest": "^27.0.2",