@ada-support/embed2 1.1.6 → 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;
@@ -8798,7 +8798,7 @@ var client = new error_tracker_BrowserClient({
8798
8798
  return event;
8799
8799
  },
8800
8800
  environment: "production",
8801
- release: "1.1.6-49eb0e4",
8801
+ release: "1.1.8-af3374e",
8802
8802
  sampleRate: 0.25,
8803
8803
  autoSessionTracking: false,
8804
8804
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9500,7 +9500,7 @@ function getEmbedURL(_ref) {
9500
9500
  polyfillVersionString = "legacy";
9501
9501
  }
9502
9502
 
9503
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "49eb0e4", "/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");
9504
9504
  }
9505
9505
  /**
9506
9506
  * Generate the Chat / API URL
@@ -9596,7 +9596,7 @@ var actions = {
9596
9596
  domain: currentState.domain,
9597
9597
  route: "chatters/".concat(currentState.chatterToken, "/live_chat_unread_amount")
9598
9598
  });
9599
- (0,http/* default */.Z)({
9599
+ (0,http/* httpRequest */.c)({
9600
9600
  url: url,
9601
9601
  method: "DELETE"
9602
9602
  }).catch(function (e) {
@@ -9616,7 +9616,7 @@ var actions = {
9616
9616
  domain: currentState.domain
9617
9617
  });
9618
9618
 
9619
- (0,http/* default */.Z)({
9619
+ (0,http/* httpRequest */.c)({
9620
9620
  url: "".concat(_url, "business_events/track"),
9621
9621
  method: "POST",
9622
9622
  body: stringify_default()({
@@ -10357,7 +10357,7 @@ function trackEventImpl(adaSettings, chatterToken, params) {
10357
10357
  value = params.value,
10358
10358
  meta = params.meta; // eslint-disable-next-line @typescript-eslint/ban-types
10359
10359
 
10360
- (0,http/* default */.Z)({
10360
+ (0,http/* httpRequest */.c)({
10361
10361
  url: "".concat(baseApiUrl, "business_events/track"),
10362
10362
  method: "POST",
10363
10363
  body: stringify_default()({
@@ -10562,7 +10562,7 @@ function triggerCampaignImpl(_ref) {
10562
10562
  domain: domain
10563
10563
  }); // eslint-disable-next-line @typescript-eslint/ban-types
10564
10564
 
10565
- (0,http/* default */.Z)({
10565
+ (0,http/* httpRequest */.c)({
10566
10566
  url: url,
10567
10567
  method: "POST",
10568
10568
  body: stringify_default()({
@@ -10927,7 +10927,7 @@ function _fetchClient() {
10927
10927
  case 0:
10928
10928
  _context.prev = 0;
10929
10929
  _context.next = 3;
10930
- return (0,http/* default */.Z)({
10930
+ return (0,http/* httpRequest */.c)({
10931
10931
  url: getClientCacheUrl(handle, cluster, domain)
10932
10932
  });
10933
10933
 
@@ -10955,7 +10955,7 @@ function _fetchClient() {
10955
10955
  case 11:
10956
10956
  _context.prev = 11;
10957
10957
  _context.next = 14;
10958
- return (0,http/* default */.Z)({
10958
+ return (0,http/* httpRequest */.c)({
10959
10959
  url: getURL({
10960
10960
  name: "api",
10961
10961
  handle: handle,
@@ -12326,7 +12326,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12326
12326
  handle = _this$props11.handle,
12327
12327
  adaSettings = _this$props11.adaSettings; // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12328
12328
 
12329
- var chatFrameTimeoutCallback = adaSettings.chatFrameTimeoutCallback;
12329
+ var _ref7 = adaSettings,
12330
+ chatFrameTimeoutCallback = _ref7.chatFrameTimeoutCallback;
12330
12331
  this.chatRenderTimeout = window.setTimeout(function () {
12331
12332
  var _this6$channel;
12332
12333
 
@@ -12341,7 +12342,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12341
12342
  chatFrameTimeoutCallback();
12342
12343
  }
12343
12344
 
12344
- publishEvent("ada:chat_frame_timeout", {});
12345
+ publishEvent("ada:chat_frame_timeout", undefined);
12345
12346
  }
12346
12347
  }, 5000);
12347
12348
  }
@@ -13508,7 +13509,7 @@ var Container = /*#__PURE__*/function (_Component) {
13508
13509
 
13509
13510
  _context8.prev = 14;
13510
13511
  _context8.next = 17;
13511
- return (0,http/* default */.Z)({
13512
+ return (0,http/* httpRequest */.c)({
13512
13513
  url: "".concat(baseApiUrl, "business_events/")
13513
13514
  });
13514
13515
 
@@ -13532,7 +13533,7 @@ var Container = /*#__PURE__*/function (_Component) {
13532
13533
 
13533
13534
  _context8.prev = 26;
13534
13535
  _context8.next = 29;
13535
- return (0,http/* default */.Z)({
13536
+ return (0,http/* httpRequest */.c)({
13536
13537
  url: "".concat(baseApiUrl, "campaigns/")
13537
13538
  });
13538
13539
 
@@ -13881,8 +13882,6 @@ var Embed = /*#__PURE__*/function () {
13881
13882
 
13882
13883
  (0,defineProperty/* default */.Z)(this, "messageService", void 0);
13883
13884
 
13884
- (0,defineProperty/* default */.Z)(this, "buttonWasMoved", void 0);
13885
-
13886
13885
  (0,defineProperty/* default */.Z)(this, "adaSettings", void 0);
13887
13886
 
13888
13887
  (0,defineProperty/* default */.Z)(this, "initialized", void 0);
@@ -13974,7 +13973,7 @@ var Embed = /*#__PURE__*/function () {
13974
13973
  key: "setUpFrameParent",
13975
13974
  value: function setUpFrameParent() {
13976
13975
  var parentElement = this.adaSettings.parentElement;
13977
- var targetElement;
13976
+ var targetElement = null;
13978
13977
 
13979
13978
  if (!parentElement) {
13980
13979
  return null;
@@ -14335,7 +14334,7 @@ var Embed = /*#__PURE__*/function () {
14335
14334
  case 9:
14336
14335
  _context12.prev = 9;
14337
14336
  _context12.t0 = _context12["catch"](4);
14338
- throw new errors/* AdaEmbedError */.S(_context12.t0);
14337
+ throw new errors/* AdaEmbedError */.S("".concat(_context12.t0));
14339
14338
 
14340
14339
  case 12:
14341
14340
  case "end":
@@ -14416,9 +14415,9 @@ window.__AdaEmbedConstructor = Embed;
14416
14415
  /* harmony export */ "yv": function() { return /* binding */ isProduction; },
14417
14416
  /* harmony export */ "Mk": function() { return /* binding */ embed2Version; }
14418
14417
  /* harmony export */ });
14419
- 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);
14420
14419
  var isProduction = "production" === "production";
14421
- var embed2Version = "49eb0e4";
14420
+ var embed2Version = "af3374e";
14422
14421
 
14423
14422
  /***/ }),
14424
14423
 
@@ -14613,7 +14612,7 @@ function warn(warningText) {
14613
14612
 
14614
14613
  "use strict";
14615
14614
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14616
- /* harmony export */ "Z": function() { return /* binding */ httpRequest; }
14615
+ /* harmony export */ "c": function() { return /* binding */ httpRequest; }
14617
14616
  /* harmony export */ });
14618
14617
  /* harmony import */ var _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(875);
14619
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__);
@@ -14628,20 +14627,19 @@ function warn(warningText) {
14628
14627
  function httpRequest(obj) {
14629
14628
  return new (_babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0___default())(function (resolve, reject) {
14630
14629
  var method = obj.method || "GET";
14630
+ var headers = obj.headers;
14631
14631
  var xhr = new XMLHttpRequest();
14632
14632
 
14633
14633
  if ("withCredentials" in xhr) {
14634
14634
  // XMLHttpRequest for Chrome/Firefox/Opera/Safari.
14635
14635
  xhr.open(method, obj.url, true);
14636
14636
  } else {
14637
- // CORS not supported.
14638
- xhr = null;
14639
14637
  return;
14640
14638
  }
14641
14639
 
14642
- if (obj.headers) {
14643
- _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_1___default()(obj.headers).forEach(function (key) {
14644
- 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]);
14645
14643
  });
14646
14644
  }
14647
14645
 
@@ -14754,7 +14752,7 @@ function _log() {
14754
14752
 
14755
14753
  case 2:
14756
14754
  _context.next = 4;
14757
- return (0,common_helpers_http__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)({
14755
+ return (0,common_helpers_http__WEBPACK_IMPORTED_MODULE_12__/* .httpRequest */ .c)({
14758
14756
  url: "".concat(DD_BASE_URL).concat(DD_TOKEN, "?ddsource=browser&ddtags=version:1.5.0"),
14759
14757
  method: "POST",
14760
14758
  body: _babel_runtime_corejs3_core_js_stable_json_stringify__WEBPACK_IMPORTED_MODULE_10___default()(_objectSpread(_objectSpread({
@@ -14764,9 +14762,9 @@ function _log() {
14764
14762
  service: "embed",
14765
14763
  env: "production",
14766
14764
  embedVersion: 2,
14767
- version: "1.1.6",
14765
+ version: "1.1.8",
14768
14766
  isNpm: true,
14769
- commitHash: "49eb0e4"
14767
+ commitHash: "af3374e"
14770
14768
  }))
14771
14769
  });
14772
14770
 
@@ -25707,7 +25705,7 @@ function _loadClientChunk() {
25707
25705
  polyfillVersionString = "legacy";
25708
25706
  }
25709
25707
 
25710
- clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "49eb0e4", "/index.js");
25708
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "af3374e", "/index.js");
25711
25709
  } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25712
25710
 
25713
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.6",
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",