@ada-support/embed2 1.1.4 → 1.1.8

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,5 @@
1
+ import type { StartOptions } from "@ada-support/embed-types";
1
2
  import type { TrackEventParams } from "common/types";
2
- import type { StartOptions } from "common/types/store-state";
3
3
  import type { BusinessEvent } from "./types";
4
4
  export declare function trackEventImpl(adaSettings: StartOptions, chatterToken: string, params: TrackEventParams): void;
5
5
  export declare const getEventsToTrigger: (businessEvents: BusinessEvent[]) => BusinessEvent[];
@@ -1,6 +1,5 @@
1
+ import type { EvaluateCampaignParams, StartOptions } from "@ada-support/embed-types";
1
2
  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
3
  import type { MarketingCampaign } from "./types";
5
4
  interface TriggerCampaignImplParams {
6
5
  adaSettings: StartOptions;
@@ -1,5 +1,5 @@
1
+ import type { StartOptions } from "@ada-support/embed-types";
1
2
  import { h } from "preact";
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
+ import type { StartOptions } from "@ada-support/embed-types";
1
2
  import { h } from "preact";
2
3
  import type { MessageService } from "client/lib/message-service";
3
4
  import type { StoreProxy } from "client/lib/store-proxy";
4
5
  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
+ import type { StartOptions } from "@ada-support/embed-types";
1
2
  import { h } from "preact";
2
3
  import type { MessageService } from "client/lib/message-service";
3
4
  import type { StoreProxy } from "client/lib/store-proxy";
4
- import type { StartOptions } from "common/types/store-state";
5
5
  interface OwnProps {
6
6
  store: StoreProxy;
7
7
  messageService: MessageService;
@@ -1,4 +1,4 @@
1
- export declare type EventSubscriptionCallback = (data: Record<string, unknown>, context: Record<string, unknown>) => unknown;
1
+ import type { AdaEventDataKeyedByEvent, AdaEventKey, AdaEventSubscriptionCallback } from "@ada-support/embed-types";
2
2
  export declare function unsubscribeEvent(id: number): void;
3
- export declare function subscribeEvent(eventKey: string, callback: EventSubscriptionCallback): number;
4
- export declare function publishEvent(eventKey: string, data: Record<string, unknown>): void;
3
+ export declare function subscribeEvent<K extends AdaEventKey>(eventKey: K, callback: AdaEventSubscriptionCallback<K>): number;
4
+ export declare function publishEvent<K extends AdaEventKey>(eventKey: K, data: AdaEventDataKeyedByEvent[K]): void;
@@ -1,25 +1,22 @@
1
- import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
1
+ import type { AdaEventKey, AdaEventSubscriptionCallback, EvaluateCampaignParams, ResetParams, StartOptions, WindowInfo } from "@ada-support/embed-types";
2
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
5
  import type { Client } from "common/models/client";
6
- import type { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
7
6
  import type { MetaFieldPayload } from "common/types/store";
8
- import type { StartOptions } from "common/types/store-state";
9
7
  import type { CustomEventChannel } from "./lib/ce";
10
8
  export declare class Embed {
11
- client: Client;
12
- storage: Storage;
9
+ client?: Client;
10
+ storage?: Storage;
13
11
  localChannel: CustomEventChannel;
14
12
  store: StoreProxy;
15
13
  messageService: MessageService;
16
- buttonWasMoved: boolean;
17
14
  adaSettings: StartOptions;
18
15
  initialized: Promise<void>;
19
- entryContainer: HTMLElement;
16
+ entryContainer?: HTMLElement;
20
17
  unmountCallback: () => void;
21
- initializationReject: (error: Error) => void;
22
- initializationResolve: () => void;
18
+ initializationReject?: (error: Error) => void;
19
+ initializationResolve?: () => void;
23
20
  private debounceCampaignTrigger;
24
21
  static embed2Version: string;
25
22
  constructor(adaSettings: StartOptions, unmountCallback: () => void);
@@ -36,7 +33,7 @@ export declare class Embed {
36
33
  triggerCampaign(campaignKey: string, triggerCampaignParams?: {}): Promise<void>;
37
34
  evaluateCampaignConditions(options: EvaluateCampaignParams): Promise<void>;
38
35
  createProactive(body: string, duration: number, responseId?: string): Promise<void>;
39
- subscribeEvent(eventKey: string, callback: EventSubscriptionCallback): number;
36
+ subscribeEvent<K extends AdaEventKey>(eventKey: K, callback: AdaEventSubscriptionCallback<K>): number;
40
37
  unsubscribeEvent(id: number): void;
41
38
  closeCampaign(): Promise<void>;
42
39
  }
@@ -1,2 +1,2 @@
1
- import type { StartOptions } from "common/types/store-state";
1
+ import type { StartOptions } from "@ada-support/embed-types";
2
2
  export declare function getAlignment(adaSettings: StartOptions): "right" | "left";
@@ -9,5 +9,5 @@ interface InterfaceRequestObject {
9
9
  /**
10
10
  * Vanilla HTTP request. Returns a Promise.
11
11
  */
12
- export default function httpRequest<T = object>(obj: InterfaceRequestObject): Promise<T>;
12
+ export declare function httpRequest<T = object>(obj: InterfaceRequestObject): Promise<T>;
13
13
  export {};
@@ -1,4 +1,4 @@
1
- import type { AdaEmbedAPI } from "common/types/index";
1
+ import type { AdaEmbedAPI } from "@ada-support/embed-types";
2
2
  /**
3
3
  * Returns the public Embed methods to be bound to the window object.
4
4
  */
@@ -1,6 +1,7 @@
1
+ import type { EvaluateCampaignParams, ResetParams } from "@ada-support/embed-types";
1
2
  import type { FetchEventStatusType } from "common/constants/events";
2
3
  import type { AdaCustomEvent, Refhandler } from "common/types/events";
3
- import type { EvaluateCampaignParams, ResetParams, SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
4
+ import type { SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
4
5
  import type { MetaFieldPayload } from "common/types/store";
5
6
  import type { StoreState } from "common/types/store-state";
6
7
  export interface EmbedRequestPayloadByEvent {
@@ -1,3 +1,4 @@
1
+ import type { AdaEventDataKeyedByEvent, AdaEventKey } from "@ada-support/embed-types";
1
2
  import type { FetchEventStatusType } from "common/constants/events";
2
3
  import type { EmbedEvent, EmbedRequestEvent, PayloadByEvent } from "common/lib/channel";
3
4
  export interface MessagePayload {
@@ -13,9 +14,9 @@ export interface CustomJavascriptEventPayload {
13
14
  event_name: string;
14
15
  };
15
16
  }
16
- export interface PublishEventPayload {
17
- eventKey: string;
18
- data: Record<string, unknown>;
17
+ export interface PublishEventPayload<K extends AdaEventKey> {
18
+ eventKey: K;
19
+ data: AdaEventDataKeyedByEvent[K];
19
20
  }
20
21
  export interface AdaCustomEvent<E extends (EmbedEvent | string) = string> {
21
22
  type: E;
@@ -24,34 +25,3 @@ export interface AdaCustomEvent<E extends (EmbedEvent | string) = string> {
24
25
  status?: FetchEventStatusType;
25
26
  }
26
27
  export declare type Refhandler<E extends (EmbedRequestEvent | string) = string> = (handleEvent: MessageEvent | CustomEventInit<AdaCustomEvent<E>>) => void;
27
- interface ChatterMetaData {
28
- "initialurl": string;
29
- "user_agent": string;
30
- "browser": string;
31
- "browser_version": string;
32
- "device": string;
33
- "introshown": "True" | "False";
34
- "language": string;
35
- "test_user": string;
36
- "last_question_asked": string;
37
- "last_answer_id": string;
38
- }
39
- interface ChatterData extends ChatterMetaData {
40
- "chatter_token": string;
41
- "channel": string;
42
- }
43
- export interface ChatterEventPayload {
44
- "chatter_id": string;
45
- "session_id": string;
46
- "event_data": {
47
- "user_data": {
48
- "all_data": ChatterData;
49
- "meta": ChatterMetaData;
50
- "global": Record<string, unknown>;
51
- "local": Record<string, unknown>;
52
- };
53
- "chatter_transcript": string;
54
- "event_name": string;
55
- };
56
- }
57
- export {};
@@ -1,7 +1,6 @@
1
- import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
1
+ import type { AdaEmbedAPI } from "@ada-support/embed-types";
2
2
  import type { ActionTypes } from "common/constants/actions";
3
- import type { MetaFieldPayload } from "common/types/store";
4
- import type { StartOptions, StoreState } from "./store-state";
3
+ import type { StoreState } from "./store-state";
5
4
  export interface StoreAction {
6
5
  [key: string]: string | object | number;
7
6
  type: ActionTypes;
@@ -16,13 +15,6 @@ export interface StoreDispatchPayload {
16
15
  export interface StoreGetPayload {
17
16
  key: string;
18
17
  }
19
- export interface ResetParams {
20
- resetChatHistory?: boolean;
21
- metaFields?: MetaFieldPayload;
22
- sensitiveMetaFields?: MetaFieldPayload;
23
- greeting?: string;
24
- language?: string;
25
- }
26
18
  export interface TrackEventParams {
27
19
  eventKey: string;
28
20
  value?: number;
@@ -36,35 +28,6 @@ export interface TriggerCampaignParams {
36
28
  ignoreStatus?: boolean;
37
29
  ignoreFrequency?: boolean;
38
30
  }
39
- export interface EvaluateCampaignParams {
40
- ignoreStatus?: boolean;
41
- ignoreFrequency?: boolean;
42
- }
43
- export interface MessageHandler {
44
- (type: string, payload: object, id: string): any;
45
- }
46
- export interface WindowInfo {
47
- isDrawerOpen: boolean;
48
- isChatOpen: boolean;
49
- hasActiveChatter: boolean;
50
- hasClosedChat: boolean;
51
- }
52
- export interface AdaEmbedAPI {
53
- start(adaSettings: StartOptions): Promise<void>;
54
- stop(): Promise<void>;
55
- toggle(): Promise<void>;
56
- deleteHistory(): Promise<void>;
57
- setMetaFields(options: MetaFieldPayload): Promise<void>;
58
- setSensitiveMetaFields(options: MetaFieldPayload): Promise<void>;
59
- getInfo(): Promise<WindowInfo>;
60
- reset(resetParams?: ResetParams): Promise<void>;
61
- createProactive(body: string, duration?: number, responseId?: string): Promise<void>;
62
- trackEvent(eventKey: string, value: number, meta: object): Promise<void>;
63
- triggerCampaign(campaignKey: string, options: object): Promise<void>;
64
- evaluateCampaignConditions(options: EvaluateCampaignParams): Promise<void>;
65
- subscribeEvent(eventKey: string, callback: EventSubscriptionCallback): Promise<number>;
66
- unsubscribeEvent(id: number): Promise<void>;
67
- }
68
31
  export interface CustomWindow extends Window {
69
32
  adaEmbed: AdaEmbedAPI;
70
33
  navigator: Navigator;
@@ -1,43 +1,6 @@
1
+ import type { StartOptions } from "@ada-support/embed-types";
1
2
  import type { ConnectionState } from "common/constants/events";
2
3
  import type { Client } from "common/models/client";
3
- import type { ChatterEventPayload } from "common/types/events";
4
- export interface StartOptions {
5
- handle?: string;
6
- lazy?: boolean;
7
- styles?: string;
8
- domain?: string;
9
- cluster?: string;
10
- language?: string;
11
- greeting?: string;
12
- hideMask?: boolean;
13
- metaFields?: Record<string, unknown>;
14
- sensitiveMetaFields?: Record<string, unknown>;
15
- parentElement?: string | HTMLElement;
16
- privateMode?: boolean;
17
- chatFrameTimeoutCallback?(): void;
18
- adaReadyCallback?(params: {
19
- isRolledOut: boolean;
20
- }): void;
21
- analyticsCallback?(analytics: Record<string, unknown>): void;
22
- chatterTokenCallback?(chatter: string): void;
23
- onAdaEmbedLoaded?(): void;
24
- toggleCallback?(isDrawerOpen: boolean): void;
25
- eventCallbacks?: {
26
- [eventName: string]: ((customJavascriptEvent: object) => void) | undefined;
27
- };
28
- zdChatterAuthCallback?(callback: (token: string) => void): void;
29
- embedStyles?: string;
30
- rolloutOverride?: number;
31
- crossWindowPersistence?: boolean;
32
- testMode?: boolean;
33
- customDomains?: {
34
- embedLegacy: string;
35
- embedModern: string;
36
- };
37
- preload?: boolean;
38
- conversationEndCallback?(payload: ChatterEventPayload): void;
39
- align?: "right" | "left" | "auto";
40
- }
41
4
  export interface StoreState extends StartOptionsNoFunction {
42
5
  chatterCreated?: string | null;
43
6
  chatterToken?: string | null;
@@ -1,2 +1,2 @@
1
- declare const _default: import("./common/types").AdaEmbedAPI;
1
+ declare const _default: import("@ada-support/embed-types").AdaEmbedAPI;
2
2
  export default _default;
@@ -36,6 +36,13 @@ module.exports = __webpack_require__(3778);
36
36
 
37
37
  /***/ }),
38
38
 
39
+ /***/ 1643:
40
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41
+
42
+ module.exports = __webpack_require__(9373);
43
+
44
+ /***/ }),
45
+
39
46
  /***/ 3811:
40
47
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41
48
 
@@ -721,9 +728,9 @@ var getPrototypeOf = __webpack_require__(3362);
721
728
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/set.js
722
729
  var set = __webpack_require__(6384);
723
730
  var set_default = /*#__PURE__*/__webpack_require__.n(set);
724
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js
725
- var includes = __webpack_require__(9632);
726
- var includes_default = /*#__PURE__*/__webpack_require__.n(includes);
731
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js
732
+ var index_of = __webpack_require__(1643);
733
+ var index_of_default = /*#__PURE__*/__webpack_require__.n(index_of);
727
734
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/json/stringify.js
728
735
  var stringify = __webpack_require__(9340);
729
736
  var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
@@ -733,6 +740,9 @@ var concat_default = /*#__PURE__*/__webpack_require__.n(concat);
733
740
  // EXTERNAL MODULE: ./node_modules/uniqid/index.js
734
741
  var uniqid = __webpack_require__(6104);
735
742
  var uniqid_default = /*#__PURE__*/__webpack_require__.n(uniqid);
743
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js
744
+ var includes = __webpack_require__(9632);
745
+ var includes_default = /*#__PURE__*/__webpack_require__.n(includes);
736
746
  ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/node_modules/tslib/tslib.es6.js
737
747
  /*! *****************************************************************************
738
748
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8788,7 +8798,7 @@ var client = new error_tracker_BrowserClient({
8788
8798
  return event;
8789
8799
  },
8790
8800
  environment: "production",
8791
- release: "1.1.4-729d237",
8801
+ release: "1.1.8-af3374e",
8792
8802
  sampleRate: 0.25,
8793
8803
  autoSessionTracking: false,
8794
8804
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9139,7 +9149,7 @@ var FrameChannel = /*#__PURE__*/function (_Channel) {
9139
9149
 
9140
9150
  var parsedData;
9141
9151
 
9142
- if ( true && _this2.targetOrigin !== "*" && (!("origin" in event) || !includes_default()(_context = _this2.targetOrigin).call(_context, event.origin))) {
9152
+ if ( true && _this2.targetOrigin !== "*" && (!("origin" in event) || index_of_default()(_context = _this2.targetOrigin).call(_context, event.origin) < 0)) {
9143
9153
  return;
9144
9154
  }
9145
9155
 
@@ -9490,7 +9500,7 @@ function getEmbedURL(_ref) {
9490
9500
  polyfillVersionString = "legacy";
9491
9501
  }
9492
9502
 
9493
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "729d237", "/index.html");
9503
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "af3374e", "/index.html");
9494
9504
  }
9495
9505
  /**
9496
9506
  * Generate the Chat / API URL
@@ -9586,7 +9596,7 @@ var actions = {
9586
9596
  domain: currentState.domain,
9587
9597
  route: "chatters/".concat(currentState.chatterToken, "/live_chat_unread_amount")
9588
9598
  });
9589
- (0,http/* default */.Z)({
9599
+ (0,http/* httpRequest */.c)({
9590
9600
  url: url,
9591
9601
  method: "DELETE"
9592
9602
  }).catch(function (e) {
@@ -9606,7 +9616,7 @@ var actions = {
9606
9616
  domain: currentState.domain
9607
9617
  });
9608
9618
 
9609
- (0,http/* default */.Z)({
9619
+ (0,http/* httpRequest */.c)({
9610
9620
  url: "".concat(_url, "business_events/track"),
9611
9621
  method: "POST",
9612
9622
  body: stringify_default()({
@@ -10347,7 +10357,7 @@ function trackEventImpl(adaSettings, chatterToken, params) {
10347
10357
  value = params.value,
10348
10358
  meta = params.meta; // eslint-disable-next-line @typescript-eslint/ban-types
10349
10359
 
10350
- (0,http/* default */.Z)({
10360
+ (0,http/* httpRequest */.c)({
10351
10361
  url: "".concat(baseApiUrl, "business_events/track"),
10352
10362
  method: "POST",
10353
10363
  body: stringify_default()({
@@ -10552,7 +10562,7 @@ function triggerCampaignImpl(_ref) {
10552
10562
  domain: domain
10553
10563
  }); // eslint-disable-next-line @typescript-eslint/ban-types
10554
10564
 
10555
- (0,http/* default */.Z)({
10565
+ (0,http/* httpRequest */.c)({
10556
10566
  url: url,
10557
10567
  method: "POST",
10558
10568
  body: stringify_default()({
@@ -10917,7 +10927,7 @@ function _fetchClient() {
10917
10927
  case 0:
10918
10928
  _context.prev = 0;
10919
10929
  _context.next = 3;
10920
- return (0,http/* default */.Z)({
10930
+ return (0,http/* httpRequest */.c)({
10921
10931
  url: getClientCacheUrl(handle, cluster, domain)
10922
10932
  });
10923
10933
 
@@ -10945,7 +10955,7 @@ function _fetchClient() {
10945
10955
  case 11:
10946
10956
  _context.prev = 11;
10947
10957
  _context.next = 14;
10948
- return (0,http/* default */.Z)({
10958
+ return (0,http/* httpRequest */.c)({
10949
10959
  url: getURL({
10950
10960
  name: "api",
10951
10961
  handle: handle,
@@ -11013,7 +11023,7 @@ function wait(ms) {
11013
11023
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js
11014
11024
  var object_get_own_property_symbols = __webpack_require__(3263);
11015
11025
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/instance/index-of.js
11016
- var index_of = __webpack_require__(5683);
11026
+ var instance_index_of = __webpack_require__(5683);
11017
11027
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/keys.js
11018
11028
  var keys = __webpack_require__(9356);
11019
11029
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/objectWithoutPropertiesLoose.js
@@ -11029,7 +11039,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
11029
11039
 
11030
11040
  for (i = 0; i < sourceKeys.length; i++) {
11031
11041
  key = sourceKeys[i];
11032
- if (index_of(excluded).call(excluded, key) >= 0) continue;
11042
+ if (instance_index_of(excluded).call(excluded, key) >= 0) continue;
11033
11043
  target[key] = source[key];
11034
11044
  }
11035
11045
 
@@ -11049,7 +11059,7 @@ function _objectWithoutProperties(source, excluded) {
11049
11059
 
11050
11060
  for (i = 0; i < sourceSymbolKeys.length; i++) {
11051
11061
  key = sourceSymbolKeys[i];
11052
- if (index_of(excluded).call(excluded, key) >= 0) continue;
11062
+ if (instance_index_of(excluded).call(excluded, key) >= 0) continue;
11053
11063
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
11054
11064
  target[key] = source[key];
11055
11065
  }
@@ -12316,7 +12326,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12316
12326
  handle = _this$props11.handle,
12317
12327
  adaSettings = _this$props11.adaSettings; // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12318
12328
 
12319
- var chatFrameTimeoutCallback = adaSettings.chatFrameTimeoutCallback;
12329
+ var _ref7 = adaSettings,
12330
+ chatFrameTimeoutCallback = _ref7.chatFrameTimeoutCallback;
12320
12331
  this.chatRenderTimeout = window.setTimeout(function () {
12321
12332
  var _this6$channel;
12322
12333
 
@@ -12331,7 +12342,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12331
12342
  chatFrameTimeoutCallback();
12332
12343
  }
12333
12344
 
12334
- publishEvent("ada:chat_frame_timeout", {});
12345
+ publishEvent("ada:chat_frame_timeout", undefined);
12335
12346
  }
12336
12347
  }, 5000);
12337
12348
  }
@@ -13498,7 +13509,7 @@ var Container = /*#__PURE__*/function (_Component) {
13498
13509
 
13499
13510
  _context8.prev = 14;
13500
13511
  _context8.next = 17;
13501
- return (0,http/* default */.Z)({
13512
+ return (0,http/* httpRequest */.c)({
13502
13513
  url: "".concat(baseApiUrl, "business_events/")
13503
13514
  });
13504
13515
 
@@ -13522,7 +13533,7 @@ var Container = /*#__PURE__*/function (_Component) {
13522
13533
 
13523
13534
  _context8.prev = 26;
13524
13535
  _context8.next = 29;
13525
- return (0,http/* default */.Z)({
13536
+ return (0,http/* httpRequest */.c)({
13526
13537
  url: "".concat(baseApiUrl, "campaigns/")
13527
13538
  });
13528
13539
 
@@ -13871,8 +13882,6 @@ var Embed = /*#__PURE__*/function () {
13871
13882
 
13872
13883
  (0,defineProperty/* default */.Z)(this, "messageService", void 0);
13873
13884
 
13874
- (0,defineProperty/* default */.Z)(this, "buttonWasMoved", void 0);
13875
-
13876
13885
  (0,defineProperty/* default */.Z)(this, "adaSettings", void 0);
13877
13886
 
13878
13887
  (0,defineProperty/* default */.Z)(this, "initialized", void 0);
@@ -13964,7 +13973,7 @@ var Embed = /*#__PURE__*/function () {
13964
13973
  key: "setUpFrameParent",
13965
13974
  value: function setUpFrameParent() {
13966
13975
  var parentElement = this.adaSettings.parentElement;
13967
- var targetElement;
13976
+ var targetElement = null;
13968
13977
 
13969
13978
  if (!parentElement) {
13970
13979
  return null;
@@ -14325,7 +14334,7 @@ var Embed = /*#__PURE__*/function () {
14325
14334
  case 9:
14326
14335
  _context12.prev = 9;
14327
14336
  _context12.t0 = _context12["catch"](4);
14328
- throw new errors/* AdaEmbedError */.S(_context12.t0);
14337
+ throw new errors/* AdaEmbedError */.S("".concat(_context12.t0));
14329
14338
 
14330
14339
  case 12:
14331
14340
  case "end":
@@ -14406,9 +14415,9 @@ window.__AdaEmbedConstructor = Embed;
14406
14415
  /* harmony export */ "yv": function() { return /* binding */ isProduction; },
14407
14416
  /* harmony export */ "Mk": function() { return /* binding */ embed2Version; }
14408
14417
  /* harmony export */ });
14409
- 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);
14418
+ 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)\\/(100|(10[1-9]|1[1-9]\\d|[2-9]\\d\\d|\\d{4,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+\\.\\d+)|(Firefox\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
14410
14419
  var isProduction = "production" === "production";
14411
- var embed2Version = "729d237";
14420
+ var embed2Version = "af3374e";
14412
14421
 
14413
14422
  /***/ }),
14414
14423
 
@@ -14603,7 +14612,7 @@ function warn(warningText) {
14603
14612
 
14604
14613
  "use strict";
14605
14614
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14606
- /* harmony export */ "Z": function() { return /* binding */ httpRequest; }
14615
+ /* harmony export */ "c": function() { return /* binding */ httpRequest; }
14607
14616
  /* harmony export */ });
14608
14617
  /* harmony import */ var _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(875);
14609
14618
  /* harmony import */ var _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__);
@@ -14618,20 +14627,19 @@ function warn(warningText) {
14618
14627
  function httpRequest(obj) {
14619
14628
  return new (_babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0___default())(function (resolve, reject) {
14620
14629
  var method = obj.method || "GET";
14630
+ var headers = obj.headers;
14621
14631
  var xhr = new XMLHttpRequest();
14622
14632
 
14623
14633
  if ("withCredentials" in xhr) {
14624
14634
  // XMLHttpRequest for Chrome/Firefox/Opera/Safari.
14625
14635
  xhr.open(method, obj.url, true);
14626
14636
  } else {
14627
- // CORS not supported.
14628
- xhr = null;
14629
14637
  return;
14630
14638
  }
14631
14639
 
14632
- if (obj.headers) {
14633
- _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_1___default()(obj.headers).forEach(function (key) {
14634
- xhr.setRequestHeader(key, obj.headers[key]);
14640
+ if (headers) {
14641
+ _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_1___default()(headers).forEach(function (key) {
14642
+ xhr.setRequestHeader(key, headers[key]);
14635
14643
  });
14636
14644
  }
14637
14645
 
@@ -14744,7 +14752,7 @@ function _log() {
14744
14752
 
14745
14753
  case 2:
14746
14754
  _context.next = 4;
14747
- return (0,common_helpers_http__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)({
14755
+ return (0,common_helpers_http__WEBPACK_IMPORTED_MODULE_12__/* .httpRequest */ .c)({
14748
14756
  url: "".concat(DD_BASE_URL).concat(DD_TOKEN, "?ddsource=browser&ddtags=version:1.5.0"),
14749
14757
  method: "POST",
14750
14758
  body: _babel_runtime_corejs3_core_js_stable_json_stringify__WEBPACK_IMPORTED_MODULE_10___default()(_objectSpread(_objectSpread({
@@ -14754,9 +14762,9 @@ function _log() {
14754
14762
  service: "embed",
14755
14763
  env: "production",
14756
14764
  embedVersion: 2,
14757
- version: "1.1.4",
14765
+ version: "1.1.8",
14758
14766
  isNpm: true,
14759
- commitHash: "729d237"
14767
+ commitHash: "af3374e"
14760
14768
  }))
14761
14769
  });
14762
14770
 
@@ -25697,7 +25705,7 @@ function _loadClientChunk() {
25697
25705
  polyfillVersionString = "legacy";
25698
25706
  }
25699
25707
 
25700
- clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "729d237", "/index.js");
25708
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "af3374e", "/index.js");
25701
25709
  } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25702
25710
 
25703
25711
 
@@ -1,3 +1,3 @@
1
- import type { StartOptions } from "common/types/store-state";
1
+ import type { StartOptions } from "@ada-support/embed-types";
2
2
  export declare const NO_OP_FUNCTION: () => void;
3
3
  export declare function isStartOptions(input: unknown): input is StartOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.1.4",
3
+ "version": "1.1.8",
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 66",
13
+ "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 28",
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",
@@ -54,7 +54,7 @@
54
54
  "author": "",
55
55
  "license": "ISC",
56
56
  "devDependencies": {
57
- "@ada-support/embed-types": "^1.0.0",
57
+ "@ada-support/embed-types": "^1.0.4",
58
58
  "@ada-support/eslint-config-ada": "^1.2.1",
59
59
  "@types/enzyme": "^3.10.11",
60
60
  "@types/jest": "^27.0.2",