@ada-support/embed2 1.0.40 → 1.0.44

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,7 +1,7 @@
1
- import MessageService from "client/lib/message-service";
2
- import { EvaluateCampaignParams } from "common/types";
3
- import { StartOptions } from "common/types/store-state";
4
- import { MarketingCampaign } from "./types";
1
+ import type { MessageService } from "client/lib/message-service";
2
+ import type { EvaluateCampaignParams } from "common/types";
3
+ import type { StartOptions } from "common/types/store-state";
4
+ import type { MarketingCampaign } from "./types";
5
5
  interface TriggerCampaignImplParams {
6
6
  adaSettings: StartOptions;
7
7
  chatterToken: string;
@@ -1,5 +1,5 @@
1
1
  import { h } from "preact";
2
- import { StartOptions } from "common/types/store-state";
2
+ import type { StartOptions } from "common/types/store-state";
3
3
  interface OwnProps {
4
4
  frameWidth: number;
5
5
  adaSettings: StartOptions;
@@ -1,8 +1,8 @@
1
1
  import { h } from "preact";
2
- import MessageService from "client/lib/message-service";
2
+ import type { MessageService } from "client/lib/message-service";
3
3
  import type { StoreProxy } from "client/lib/store-proxy";
4
- import { Module } from "common/types/modules";
5
- import { StartOptions } from "common/types/store-state";
4
+ import type { Module } from "common/types/modules";
5
+ import type { StartOptions } from "common/types/store-state";
6
6
  interface OwnProps {
7
7
  name: Module;
8
8
  adaSettings: StartOptions;
@@ -1,7 +1,7 @@
1
1
  import { h } from "preact";
2
- import MessageService from "client/lib/message-service";
2
+ import type { MessageService } from "client/lib/message-service";
3
3
  import type { StoreProxy } from "client/lib/store-proxy";
4
- import { StartOptions } from "common/types/store-state";
4
+ import type { StartOptions } from "common/types/store-state";
5
5
  interface OwnProps {
6
6
  store: StoreProxy;
7
7
  messageService: MessageService;
@@ -1,7 +1,7 @@
1
1
  import { h } from "preact";
2
- import MessageService from "client/lib/message-service";
2
+ import type { MessageService } from "client/lib/message-service";
3
3
  import type { StoreProxy } from "client/lib/store-proxy";
4
- import { Module } from "common/types/modules";
4
+ import type { Module } from "common/types/modules";
5
5
  interface OwnProps {
6
6
  name: Module;
7
7
  styles: string;
@@ -1,16 +1,16 @@
1
- import { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
- import MessageService from "client/lib/message-service";
1
+ import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
+ import { MessageService } from "client/lib/message-service";
3
3
  import { StoreProxy } from "client/lib/store-proxy";
4
4
  import "client/lib/error-tracker";
5
- import Client from "common/models/client";
6
- import { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
7
- import { MetaFieldPayload } from "common/types/store";
8
- import { StartOptions } from "common/types/store-state";
9
- import { CE } from "./lib/ce";
5
+ import type Client from "common/models/client";
6
+ import type { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
7
+ import type { MetaFieldPayload } from "common/types/store";
8
+ import type { StartOptions } from "common/types/store-state";
9
+ import type { CustomEventChannel } from "./lib/ce";
10
10
  export declare class Embed {
11
11
  client: Client;
12
12
  storage: Storage;
13
- localChannel: CE;
13
+ localChannel: CustomEventChannel;
14
14
  store: StoreProxy;
15
15
  messageService: MessageService;
16
16
  buttonWasMoved: boolean;
@@ -1,10 +1,11 @@
1
- import { FetchEventStatusType } from "common/constants/events";
2
- import { Channel, EmbedEvent, PayloadByEvent } from "common/lib/channel";
3
- import { AdaCustomEvent, Refhandler } from "common/types/events";
1
+ import type { FetchEventStatusType } from "common/constants/events";
2
+ import type { EmbedEvent, PayloadByEvent } from "common/lib/channel";
3
+ import { Channel } from "common/lib/channel";
4
+ import type { AdaCustomEvent, Refhandler } from "common/types/events";
4
5
  /**
5
6
  * Custom Event Channel
6
7
  */
7
- export declare class CE extends Channel {
8
+ export declare class CustomEventChannel extends Channel {
8
9
  protected trackedListeners: Set<Refhandler>;
9
10
  protected trackedTimeouts: Set<number>;
10
11
  protected eventType: string;
@@ -1,11 +1,11 @@
1
- import FC from "common/lib/fc";
2
- import { Channels } from "common/types/channels";
3
- import { Module } from "common/types/modules";
4
- import { CE } from "./ce";
5
- export default class MessageService {
1
+ import { FrameChannel } from "common/lib/fc";
2
+ import type { Channels } from "common/types/channels";
3
+ import type { Module } from "common/types/modules";
4
+ import { CustomEventChannel } from "./ce";
5
+ export declare class MessageService {
6
6
  channels: Channels;
7
- registerFrameChannel(name: Module, targetWindow: Window, targetOrigin?: string): FC;
7
+ registerFrameChannel(name: Module, targetWindow: Window, targetOrigin?: string): FrameChannel;
8
8
  unregisterChannel(name: keyof Channels): void;
9
- getChannel(name: keyof Channels): FC | CE | null;
10
- getAllChannels(): (CE | FC)[];
9
+ getChannel(name: keyof Channels): FrameChannel | CustomEventChannel | null;
10
+ getAllChannels(): (FrameChannel | CustomEventChannel)[];
11
11
  }
@@ -1,11 +1,11 @@
1
- import MessageService from "client/lib/message-service";
1
+ import type { MessageService } from "client/lib/message-service";
2
2
  import { Store } from "client/store";
3
- import { Channels } from "common/types/channels";
4
- import { StoreProxyInterface } from "common/types/store";
5
- import { StoreState } from "common/types/store-state";
6
- import { CE } from "./ce";
3
+ import type { Channels } from "common/types/channels";
4
+ import type { StoreProxyInterface } from "common/types/store";
5
+ import type { StoreState } from "common/types/store-state";
6
+ import type { CustomEventChannel } from "./ce";
7
7
  export declare class StoreProxy implements StoreProxyInterface {
8
- localChannel: CE;
8
+ localChannel: CustomEventChannel;
9
9
  store: Store;
10
10
  registeredCallbacks: ((payload: StoreState) => void)[];
11
11
  constructor(messageService: MessageService);
@@ -1,6 +1,6 @@
1
- import MessageService from "client/lib/message-service";
2
- import { Channels } from "common/types/channels";
3
- import { StoreState } from "common/types/store-state";
1
+ import type { MessageService } from "client/lib/message-service";
2
+ import type { Channels } from "common/types/channels";
3
+ import type { StoreState } from "common/types/store-state";
4
4
  export declare class Store {
5
5
  state: StoreState;
6
6
  defaultState: StoreState;
@@ -1,3 +1,3 @@
1
- import { StoreState } from "common/types/store-state";
1
+ import type { StoreState } from "common/types/store-state";
2
2
  declare const state: StoreState;
3
3
  export default state;
@@ -1,13 +1,14 @@
1
- import { FetchEventStatusType } from "common/constants/events";
2
- import { Channel, EmbedEvent, PayloadByEvent } from "common/lib/channel";
3
- import { Refhandler } from "common/types/events";
1
+ import type { FetchEventStatusType } from "common/constants/events";
2
+ import type { EmbedEvent, PayloadByEvent } from "common/lib/channel";
3
+ import { Channel } from "common/lib/channel";
4
+ import type { Refhandler } from "common/types/events";
4
5
  /**
5
6
  * Frame Channel: Used for postMessage communication between iFrames.
6
7
  * NOTE: iFrames must have the same domain - when postMessages are sent between
7
8
  * iframes they use the eventListener below to check if the target domain matches
8
9
  * the domain from where the postMessage originated from.
9
10
  */
10
- export default class FC extends Channel {
11
+ export declare class FrameChannel extends Channel {
11
12
  protected trackedListeners: Set<Refhandler>;
12
13
  protected trackedTimeouts: Set<number>;
13
14
  protected eventType: string;
@@ -20,5 +21,5 @@ export default class FC extends Channel {
20
21
  private static isMessageEvent;
21
22
  postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
22
23
  addEventListener(handler: (type: string, payload?: object, id?: string, status?: FetchEventStatusType) => void): Refhandler;
23
- constructObjectToSend(type?: string, payload?: unknown, id?: string, status?: FetchEventStatusType): string;
24
+ constructObjectToSend(eventName?: string, payload?: unknown, id?: string, status?: FetchEventStatusType): string;
24
25
  }
@@ -1,10 +1,10 @@
1
- import { CE } from "client/lib/ce";
2
- import FC from "common/lib/fc";
3
- import { PartialRecord } from "common/types/helpers";
4
- import { Module } from "common/types/modules";
5
- declare type FrameChannels = PartialRecord<Module, FC>;
1
+ import type { CustomEventChannel } from "client/lib/ce";
2
+ import type { FrameChannel } from "common/lib/fc";
3
+ import type { PartialRecord } from "common/types/helpers";
4
+ import type { Module } from "common/types/modules";
5
+ declare type FrameChannels = PartialRecord<Module, FrameChannel>;
6
6
  interface LocalChannel {
7
- local: CE;
7
+ local: CustomEventChannel;
8
8
  }
9
9
  export declare type Channels = FrameChannels & LocalChannel;
10
10
  export {};
@@ -1,4 +1,3 @@
1
- export declare type ValueOf<T> = T[keyof T];
2
1
  export declare type PartialRecord<K extends keyof any, T> = {
3
2
  [P in K]?: T;
4
3
  };
@@ -1,7 +1,6 @@
1
- import { ConnectionState } from "common/constants/events";
2
- import Client from "common/models/client";
3
- import { ChatterEventPayload } from "common/types/events";
4
- import { ValueOf } from "common/types/helpers";
1
+ import type { ConnectionState } from "common/constants/events";
2
+ import type Client from "common/models/client";
3
+ import type { ChatterEventPayload } from "common/types/events";
5
4
  export interface StartOptions {
6
5
  handle?: string;
7
6
  lazy?: boolean;
@@ -41,7 +40,7 @@ export interface StartOptions {
41
40
  export interface StoreState extends StartOptionsNoFunction {
42
41
  chatterCreated?: string | null;
43
42
  chatterToken?: string | null;
44
- client: Client;
43
+ client?: Client;
45
44
  isDrawerOpen: boolean;
46
45
  zdSessionId?: string | null;
47
46
  zdPreviousTags?: string | null;
@@ -52,7 +51,7 @@ export interface StoreState extends StartOptionsNoFunction {
52
51
  height?: number;
53
52
  width?: number;
54
53
  };
55
- initialURL: string;
54
+ initialURL?: string;
56
55
  wasIntroShown: boolean;
57
56
  unreadMessageCount: number;
58
57
  embedStyles?: string;
@@ -60,14 +59,14 @@ export interface StoreState extends StartOptionsNoFunction {
60
59
  [key: string]: ConnectionState;
61
60
  };
62
61
  appConnectionState: ConnectionState;
63
- notificationsPermission: NotificationPermission;
62
+ notificationsPermission?: NotificationPermission;
64
63
  browserHasNotificationSupport: boolean;
65
- chatDimensions: {
64
+ chatDimensions?: {
66
65
  height?: number;
67
66
  width?: number;
68
67
  };
69
68
  isChatWebsocketConnected: boolean;
70
- latestCampaignKey: string;
69
+ latestCampaignKey?: string;
71
70
  hasChatOpenedAfterProactiveMessagesShown: boolean;
72
71
  chatterInLiveChat: boolean;
73
72
  language?: string;
@@ -96,4 +95,3 @@ export interface StartOptionsNoFunction {
96
95
  };
97
96
  preload?: boolean;
98
97
  }
99
- export declare type ResponsePayload = Promise<StoreState | ValueOf<StoreState>>;
@@ -0,0 +1,12 @@
1
+ import "frames/lib/error-tracker";
2
+ export declare const LIVE_CHAT_PENDING_STORAGE_KEY = "liveChatPending";
3
+ export declare const IS_DRAWER_OPEN_STORAGE_KEY = "ada-embed_is-drawer-open";
4
+ /**
5
+ * NOTE: If you import this file into any other file
6
+ * it will trigger the init() function below - may cause errors!
7
+ */
8
+ /**
9
+ * Auto-opens the chat door if crossWindowPersistence is one, the chatter is in
10
+ * a live chat, and if the drawer was previously opened.
11
+ */
12
+ export declare function setIsDrawerOpen(): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { StoreState } from "common/types/store-state";
2
+ export declare function initializeFrame(waitForOtherFrames?: boolean, initialState?: Partial<StoreState>): Promise<boolean>;
3
+ export declare function addCustomStyles(styles: string, hasUICustomization: boolean): void;
@@ -0,0 +1,6 @@
1
+ import * as Sentry from "@sentry/browser";
2
+ declare const errorTracker: {
3
+ trackException(error: Error): void;
4
+ addBreadCrumb(category: string, message: string, data: object, level?: Sentry.Severity): void;
5
+ };
6
+ export default errorTracker;
@@ -0,0 +1,3 @@
1
+ import FC from "common/lib/fc";
2
+ declare const _default: FC;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { StoreProxyInterface } from "common/types/store";
2
+ export declare const store: StoreProxyInterface;
@@ -873,12 +873,14 @@ var values_default = /*#__PURE__*/__webpack_require__.n(values);
873
873
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/construct.js
874
874
  var construct = __webpack_require__(1068);
875
875
  var construct_default = /*#__PURE__*/__webpack_require__.n(construct);
876
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/typeof.js
877
+ var esm_typeof = __webpack_require__(9623);
876
878
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/assertThisInitialized.js
877
879
  var assertThisInitialized = __webpack_require__(5281);
878
880
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/inherits.js
879
881
  var inherits = __webpack_require__(306);
880
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js + 1 modules
881
- var possibleConstructorReturn = __webpack_require__(1770);
882
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js
883
+ var possibleConstructorReturn = __webpack_require__(3020);
882
884
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js
883
885
  var getPrototypeOf = __webpack_require__(3362);
884
886
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/set.js
@@ -890,6 +892,9 @@ var includes_default = /*#__PURE__*/__webpack_require__.n(includes);
890
892
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/json/stringify.js
891
893
  var stringify = __webpack_require__(9340);
892
894
  var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
895
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js
896
+ var concat = __webpack_require__(7766);
897
+ var concat_default = /*#__PURE__*/__webpack_require__.n(concat);
893
898
  // EXTERNAL MODULE: ./node_modules/uniqid/index.js
894
899
  var uniqid = __webpack_require__(6104);
895
900
  var uniqid_default = /*#__PURE__*/__webpack_require__.n(uniqid);
@@ -8495,7 +8500,7 @@ var client = new error_tracker_BrowserClient({
8495
8500
  return event;
8496
8501
  },
8497
8502
  environment: "production",
8498
- release: "f19ff23c3540dea5849b9545cf7188b0bf11bf6e",
8503
+ release: "b4c1ab7de28e3f1320658bfad5883ada73141b44",
8499
8504
  sampleRate: 0.25,
8500
8505
  autoSessionTracking: false,
8501
8506
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -8775,27 +8780,31 @@ var Channel = /*#__PURE__*/function () {
8775
8780
 
8776
8781
 
8777
8782
 
8783
+
8784
+
8785
+
8778
8786
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0,getPrototypeOf/* default */.Z)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0,getPrototypeOf/* default */.Z)(this).constructor; result = construct_default()(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0,possibleConstructorReturn/* default */.Z)(this, result); }; }
8779
8787
 
8780
8788
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !(construct_default())) return false; if ((construct_default()).sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct_default()(Boolean, [], function () {})); return true; } catch (e) { return false; } }
8781
8789
 
8782
8790
 
8783
8791
 
8792
+
8784
8793
  /**
8785
8794
  * Frame Channel: Used for postMessage communication between iFrames.
8786
8795
  * NOTE: iFrames must have the same domain - when postMessages are sent between
8787
8796
  * iframes they use the eventListener below to check if the target domain matches
8788
8797
  * the domain from where the postMessage originated from.
8789
8798
  */
8790
- var FC = /*#__PURE__*/function (_Channel) {
8791
- (0,inherits/* default */.Z)(FC, _Channel);
8799
+ var FrameChannel = /*#__PURE__*/function (_Channel) {
8800
+ (0,inherits/* default */.Z)(FrameChannel, _Channel);
8792
8801
 
8793
- var _super = _createSuper(FC);
8802
+ var _super = _createSuper(FrameChannel);
8794
8803
 
8795
- function FC(name, targetWindow, targetOrigin) {
8804
+ function FrameChannel(name, targetWindow, targetOrigin) {
8796
8805
  var _this;
8797
8806
 
8798
- (0,classCallCheck/* default */.Z)(this, FC);
8807
+ (0,classCallCheck/* default */.Z)(this, FrameChannel);
8799
8808
 
8800
8809
  _this = _super.call(this);
8801
8810
 
@@ -8821,7 +8830,7 @@ var FC = /*#__PURE__*/function (_Channel) {
8821
8830
  return _this;
8822
8831
  }
8823
8832
 
8824
- _createClass(FC, [{
8833
+ _createClass(FrameChannel, [{
8825
8834
  key: "postMessage",
8826
8835
  value: function postMessage(eventName, data, id, status) {
8827
8836
  this.targetWindow.postMessage(this.constructObjectToSend(eventName, data, id, status), this.targetOrigin);
@@ -8841,7 +8850,7 @@ var FC = /*#__PURE__*/function (_Channel) {
8841
8850
  }
8842
8851
 
8843
8852
  try {
8844
- if (FC.isMessageEvent(event)) {
8853
+ if (FrameChannel.isMessageEvent(event)) {
8845
8854
  parsedData = JSON.parse(event.data);
8846
8855
  }
8847
8856
  } catch (_unused) {
@@ -8868,19 +8877,28 @@ var FC = /*#__PURE__*/function (_Channel) {
8868
8877
  }, {
8869
8878
  key: "constructObjectToSend",
8870
8879
  value: function constructObjectToSend() {
8871
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
8880
+ var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
8872
8881
  var payload = arguments.length > 1 ? arguments[1] : undefined;
8873
8882
  var id = arguments.length > 2 ? arguments[2] : undefined;
8874
8883
  var status = arguments.length > 3 ? arguments[3] : undefined;
8884
+
8875
8885
  // IE passes event message data as a string, so we normalize to string for all objects
8876
8886
  // (for all browsers)
8877
- return stringify_default()({
8878
- name: this.name,
8879
- type: type,
8880
- payload: payload,
8881
- id: id,
8882
- status: status
8883
- });
8887
+ try {
8888
+ return stringify_default()({
8889
+ name: this.name,
8890
+ type: eventName,
8891
+ payload: payload,
8892
+ id: id,
8893
+ status: status
8894
+ });
8895
+ } catch (e) {
8896
+ var _context2, _context3;
8897
+
8898
+ var reason = e instanceof Error ? e.message : "unknown";
8899
+ var payloadRootKeys = payload && (0,esm_typeof/* default */.Z)(payload) === "object" ? keys_default()(payload) : [];
8900
+ throw new errors/* AdaEmbedError */.S(concat_default()(_context2 = concat_default()(_context3 = "Failed to stringify object to JSON. Reason: \"".concat(reason, "\". Event name: \"")).call(_context3, eventName, "\". Payload root keys: ")).call(_context2, payloadRootKeys.join(", "), "."));
8901
+ }
8884
8902
  }
8885
8903
  }], [{
8886
8904
  key: "isMessageEvent",
@@ -8889,13 +8907,8 @@ var FC = /*#__PURE__*/function (_Channel) {
8889
8907
  }
8890
8908
  }]);
8891
8909
 
8892
- return FC;
8910
+ return FrameChannel;
8893
8911
  }(Channel);
8894
-
8895
-
8896
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js
8897
- var concat = __webpack_require__(7766);
8898
- var concat_default = /*#__PURE__*/__webpack_require__.n(concat);
8899
8912
  ;// CONCATENATED MODULE: ./src/client/helpers/events/index.ts
8900
8913
  /**
8901
8914
  * Older browsers like IE11 cannot use Event and CustomEvent constructors. These
@@ -8961,17 +8974,17 @@ var ADA_CUSTOM_EVENT = "ada-custom-message";
8961
8974
  * Custom Event Channel
8962
8975
  */
8963
8976
 
8964
- var CE = /*#__PURE__*/function (_Channel) {
8965
- (0,inherits/* default */.Z)(CE, _Channel);
8977
+ var CustomEventChannel = /*#__PURE__*/function (_Channel) {
8978
+ (0,inherits/* default */.Z)(CustomEventChannel, _Channel);
8966
8979
 
8967
- var _super = ce_createSuper(CE);
8980
+ var _super = ce_createSuper(CustomEventChannel);
8968
8981
 
8969
- function CE() {
8982
+ function CustomEventChannel() {
8970
8983
  var _context;
8971
8984
 
8972
8985
  var _this;
8973
8986
 
8974
- (0,classCallCheck/* default */.Z)(this, CE);
8987
+ (0,classCallCheck/* default */.Z)(this, CustomEventChannel);
8975
8988
 
8976
8989
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8977
8990
  args[_key] = arguments[_key];
@@ -8990,9 +9003,9 @@ var CE = /*#__PURE__*/function (_Channel) {
8990
9003
  return _this;
8991
9004
  }
8992
9005
 
8993
- _createClass(CE, [{
9006
+ _createClass(CustomEventChannel, [{
8994
9007
  key: "postMessage",
8995
- value: // We want CE to have the same interface as FC
9008
+ value: // We want CustomEventChannel to have the same interface as FrameChannel
8996
9009
  function postMessage(eventName, data, id, status) {
8997
9010
  var customEvent = createNewCustomEvent(this.eventType, this.constructObjectToSend(eventName, data, id, status));
8998
9011
  window.dispatchEvent(customEvent);
@@ -9020,8 +9033,6 @@ var CE = /*#__PURE__*/function (_Channel) {
9020
9033
  }, {
9021
9034
  key: "constructObjectToSend",
9022
9035
  value: function constructObjectToSend(type, payload, id, status) {
9023
- // IE passes event message data as a string, so we normalize to string for all objects
9024
- // (for all browsers)
9025
9036
  return {
9026
9037
  type: type || "",
9027
9038
  payload: payload,
@@ -9031,7 +9042,7 @@ var CE = /*#__PURE__*/function (_Channel) {
9031
9042
  }
9032
9043
  }]);
9033
9044
 
9034
- return CE;
9045
+ return CustomEventChannel;
9035
9046
  }(Channel);
9036
9047
  ;// CONCATENATED MODULE: ./src/client/lib/message-service.ts
9037
9048
 
@@ -9041,20 +9052,19 @@ var CE = /*#__PURE__*/function (_Channel) {
9041
9052
 
9042
9053
 
9043
9054
 
9044
-
9045
9055
  var MessageService = /*#__PURE__*/function () {
9046
9056
  function MessageService() {
9047
9057
  (0,classCallCheck/* default */.Z)(this, MessageService);
9048
9058
 
9049
9059
  (0,defineProperty/* default */.Z)(this, "channels", {
9050
- local: new CE()
9060
+ local: new CustomEventChannel()
9051
9061
  });
9052
9062
  }
9053
9063
 
9054
9064
  _createClass(MessageService, [{
9055
9065
  key: "registerFrameChannel",
9056
9066
  value: function registerFrameChannel(name, targetWindow, targetOrigin) {
9057
- var frameChannel = new FC(name, targetWindow, targetOrigin);
9067
+ var frameChannel = new FrameChannel(name, targetWindow, targetOrigin);
9058
9068
  this.channels[name] = frameChannel;
9059
9069
  return frameChannel;
9060
9070
  }
@@ -9091,8 +9101,6 @@ var MessageService = /*#__PURE__*/function () {
9091
9101
 
9092
9102
  return MessageService;
9093
9103
  }();
9094
-
9095
-
9096
9104
  // EXTERNAL MODULE: ./node_modules/json-stable-stringify/index.js
9097
9105
  var json_stable_stringify = __webpack_require__(7266);
9098
9106
  var json_stable_stringify_default = /*#__PURE__*/__webpack_require__.n(json_stable_stringify);
@@ -9179,7 +9187,7 @@ function getEmbedURL(_ref) {
9179
9187
  polyfillVersionString = "legacy";
9180
9188
  }
9181
9189
 
9182
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "f19ff23", "/index.html");
9190
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "b4c1ab7", "/index.html");
9183
9191
  }
9184
9192
  /**
9185
9193
  * Generate the Chat / API URL
@@ -11447,7 +11455,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11447
11455
  closeTransitionTime = _this$state.closeTransitionTime;
11448
11456
  var isShown = isDrawerOpen && isMounted;
11449
11457
  var backgroundColor = this.darkMode ? "#121212" : "#fff";
11450
- var borderRadius = (client === null || client === void 0 ? void 0 : (_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : _client$ui_settings2.chat.style) === "rectangular" ? "8px" : "16px";
11458
+ var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : _client$ui_settings2.chat.style) === "rectangular" ? "8px" : "16px";
11451
11459
  var WINDOW_HEIGHT = 725;
11452
11460
  var TEST_BOT_NAV_HEIGHT = 48;
11453
11461
  var isTestBot = client.features.embed_test_bot && testMode;
@@ -11471,7 +11479,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11471
11479
  }, {
11472
11480
  key: "visibleProactiveStyles",
11473
11481
  get: function get() {
11474
- var _client$ui_settings3, _client$ui_settings3$, _client$chat_button, _context15, _context16, _context17;
11482
+ var _client$ui_settings3, _client$ui_settings3$, _context15, _context16, _context17;
11475
11483
 
11476
11484
  var _this$props5 = this.props,
11477
11485
  chatDimensions = _this$props5.chatDimensions,
@@ -11481,7 +11489,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
11481
11489
 
11482
11490
  var delta = 3;
11483
11491
  var TEXT_BUTTON_HEIGHT = 44;
11484
- 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 = client.chat_button) === null || _client$chat_button === void 0 ? void 0 : _client$chat_button.size) - delta;
11492
+ 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;
11485
11493
  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 ");
11486
11494
  }
11487
11495
  }, {
@@ -11994,7 +12002,7 @@ var IntroFrame = /*#__PURE__*/function (_Component) {
11994
12002
  var introPositionRight = INTRO_BUTTON_PADDING + buttonSize;
11995
12003
  var stylesForHiding = "\n visibility: \"hidden\";\n top: -9999px !important;\n left: -9999px !important;\n ";
11996
12004
 
11997
- var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.height, "px;\n width: ")).call(_context2, introDimensions === null || introDimensions === void 0 ? void 0 : introDimensions.width, "px;\n\n ")).call(_context, Boolean(client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && concat_default()(_context6 = "\n max-height: auto;\n max-width: 350px;\n z-index: 9999;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context6, buttonSize - 20, "px;\n "), "\n ");
12005
+ var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions.height, "px;\n width: ")).call(_context2, introDimensions.width, "px;\n\n ")).call(_context, Boolean(client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && concat_default()(_context6 = "\n max-height: auto;\n max-width: 350px;\n z-index: 9999;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context6, buttonSize - 20, "px;\n "), "\n ");
11998
12006
 
11999
12007
  if (!this.isShown) {
12000
12008
  return styles + stylesForHiding;
@@ -12439,7 +12447,7 @@ var Container = /*#__PURE__*/function (_Component) {
12439
12447
  */
12440
12448
 
12441
12449
 
12442
- if (chatterToken && prevProps.chatterToken !== chatterToken && client !== null && client !== void 0 && client.business_events && client !== null && client !== void 0 && client.features.afm_business_events) {
12450
+ if (chatterToken && prevProps.chatterToken !== chatterToken && client !== null && client !== void 0 && client.business_events && client.features.afm_business_events) {
12443
12451
  this.evaluateBusinessEventConditions();
12444
12452
  }
12445
12453
  }
@@ -13879,7 +13887,7 @@ window.__AdaEmbedConstructor = Embed;
13879
13887
  /* harmony export */ });
13880
13888
  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);
13881
13889
  var isProduction = "production" === "production";
13882
- var embed2Version = "f19ff23";
13890
+ var embed2Version = "b4c1ab7";
13883
13891
 
13884
13892
  /***/ }),
13885
13893
 
@@ -13901,8 +13909,8 @@ var construct_default = /*#__PURE__*/__webpack_require__.n(construct);
13901
13909
  var classCallCheck = __webpack_require__(8420);
13902
13910
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/inherits.js
13903
13911
  var inherits = __webpack_require__(306);
13904
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js + 1 modules
13905
- var possibleConstructorReturn = __webpack_require__(1770);
13912
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js
13913
+ var possibleConstructorReturn = __webpack_require__(3020);
13906
13914
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js
13907
13915
  var getPrototypeOf = __webpack_require__(3362);
13908
13916
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/map.js
@@ -23399,51 +23407,25 @@ function _inherits(subClass, superClass) {
23399
23407
 
23400
23408
  /***/ }),
23401
23409
 
23402
- /***/ 1770:
23410
+ /***/ 3020:
23403
23411
  /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
23404
23412
 
23405
23413
  "use strict";
23406
-
23407
- // EXPORTS
23408
- __webpack_require__.d(__webpack_exports__, {
23409
- "Z": function() { return /* binding */ _possibleConstructorReturn; }
23410
- });
23411
-
23412
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/symbol.js
23413
- var symbol = __webpack_require__(1446);
23414
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/symbol/iterator.js
23415
- var iterator = __webpack_require__(3327);
23416
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/typeof.js
23417
-
23418
-
23419
- function _typeof(obj) {
23420
- "@babel/helpers - typeof";
23421
-
23422
- if (typeof symbol === "function" && typeof iterator === "symbol") {
23423
- _typeof = function _typeof(obj) {
23424
- return typeof obj;
23425
- };
23426
- } else {
23427
- _typeof = function _typeof(obj) {
23428
- return obj && typeof symbol === "function" && obj.constructor === symbol && obj !== symbol.prototype ? "symbol" : typeof obj;
23429
- };
23430
- }
23431
-
23432
- return _typeof(obj);
23433
- }
23434
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/assertThisInitialized.js
23435
- var assertThisInitialized = __webpack_require__(5281);
23436
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js
23414
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23415
+ /* harmony export */ "Z": function() { return /* binding */ _possibleConstructorReturn; }
23416
+ /* harmony export */ });
23417
+ /* harmony import */ var _babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9623);
23418
+ /* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5281);
23437
23419
 
23438
23420
 
23439
23421
  function _possibleConstructorReturn(self, call) {
23440
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
23422
+ if (call && ((0,_babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(call) === "object" || typeof call === "function")) {
23441
23423
  return call;
23442
23424
  } else if (call !== void 0) {
23443
23425
  throw new TypeError("Derived constructors may only return object or undefined");
23444
23426
  }
23445
23427
 
23446
- return (0,assertThisInitialized/* default */.Z)(self);
23428
+ return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(self);
23447
23429
  }
23448
23430
 
23449
23431
  /***/ }),
@@ -23466,6 +23448,35 @@ function _setPrototypeOf(o, p) {
23466
23448
  return _setPrototypeOf(o, p);
23467
23449
  }
23468
23450
 
23451
+ /***/ }),
23452
+
23453
+ /***/ 9623:
23454
+ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
23455
+
23456
+ "use strict";
23457
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23458
+ /* harmony export */ "Z": function() { return /* binding */ _typeof; }
23459
+ /* harmony export */ });
23460
+ /* harmony import */ var _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1446);
23461
+ /* harmony import */ var _babel_runtime_corejs3_core_js_symbol_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3327);
23462
+
23463
+
23464
+ function _typeof(obj) {
23465
+ "@babel/helpers - typeof";
23466
+
23467
+ if (typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ === "function" && typeof _babel_runtime_corejs3_core_js_symbol_iterator__WEBPACK_IMPORTED_MODULE_1__ === "symbol") {
23468
+ _typeof = function _typeof(obj) {
23469
+ return typeof obj;
23470
+ };
23471
+ } else {
23472
+ _typeof = function _typeof(obj) {
23473
+ return obj && typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ === "function" && obj.constructor === _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ && obj !== _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__.prototype ? "symbol" : typeof obj;
23474
+ };
23475
+ }
23476
+
23477
+ return _typeof(obj);
23478
+ }
23479
+
23469
23480
  /***/ })
23470
23481
 
23471
23482
  /******/ });
@@ -23660,7 +23671,7 @@ function _loadEmbed() {
23660
23671
  polyfillVersionString = "legacy";
23661
23672
  }
23662
23673
 
23663
- embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "f19ff23", "/index.js");
23674
+ embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "b4c1ab7", "/index.js");
23664
23675
  }
23665
23676
 
23666
23677
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
@@ -23787,10 +23798,10 @@ function createEmbedObject() {
23787
23798
  handle: adaSettings.handle,
23788
23799
  embedVersion: 2,
23789
23800
  embedSettings: adaSettings,
23790
- version: "1.0.40",
23801
+ version: "1.0.44",
23791
23802
  isNpm: true,
23792
23803
  hostPage: window.location.href,
23793
- commitHash: "f19ff23"
23804
+ commitHash: "b4c1ab7"
23794
23805
  }, {
23795
23806
  sampleRate: 0.01 // 1% of logs will go through
23796
23807
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.40",
3
+ "version": "1.0.44",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "build:modern": "NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
11
11
  "build:npm-types": "tsc --project tsconfig.npm.json --declaration --outDir dist/npm-entry --emitDeclarationOnly --allowJs false --checkJs false",
12
12
  "build:npm": "./npm-build.sh",
13
- "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 26",
13
+ "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 129",
14
14
  "lint:fix": "yarn lint --fix",
15
15
  "deploy-legacy": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=legacy npx webpack --config webpack.prod.ts",
16
16
  "deploy-modern": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
@@ -53,7 +53,7 @@
53
53
  "author": "",
54
54
  "license": "ISC",
55
55
  "devDependencies": {
56
- "@ada-support/eslint-config-ada": "^1.1.1",
56
+ "@ada-support/eslint-config-ada": "^1.1.5",
57
57
  "@babel/core": "^7.14.8",
58
58
  "@babel/plugin-proposal-class-properties": "^7.14.5",
59
59
  "@babel/plugin-proposal-numeric-separator": "^7.14.5",
@@ -76,6 +76,7 @@
76
76
  "cypress": "^9.1.0",
77
77
  "enzyme": "^3.11.0",
78
78
  "enzyme-adapter-preact-pure": "^2.2.0",
79
+ "eslint": "^8.6.0",
79
80
  "eslint-plugin-chai-friendly": "^0.7.2",
80
81
  "eslint-plugin-compat": "^3.13.0",
81
82
  "eslint-plugin-cypress": "^2.11.3",
@@ -121,6 +122,7 @@
121
122
  "resolutions": {
122
123
  "json-schema": ">=0.4.0",
123
124
  "minimist": ">=0.2.1",
125
+ "node-forge": ">=1.0.0",
124
126
  "nth-check": ">=2.0.1"
125
127
  },
126
128
  "files": [