@ada-support/embed2 1.0.67 → 1.0.70-dev.1

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.
@@ -0,0 +1,3 @@
1
+ import { TriggerCondition, URLMatchTriggerCondition } from "./types";
2
+ export declare const evalUrlMatchTriggerCondition: (triggerCondition: URLMatchTriggerCondition, url: string) => boolean;
3
+ export declare const evalTriggerCondition: (triggerCondition: TriggerCondition) => boolean;
@@ -0,0 +1,4 @@
1
+ import { DateTimeTriggerCondition, TriggerCondition, URLMatchTriggerCondition } from "./types";
2
+ export declare const evalUrlMatchTriggerCondition: (triggerCondition: URLMatchTriggerCondition, url: string) => boolean;
3
+ export declare const evalDatetimeTriggerCondition: (triggerCondition: DateTimeTriggerCondition, currentDateTime: Date) => boolean;
4
+ export declare const evalTriggerCondition: (triggerCondition: TriggerCondition) => boolean;
@@ -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;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("./common/types").AdaEmbedAPI;
2
+ export default _default;
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
8788
8788
  return event;
8789
8789
  },
8790
8790
  environment: "production",
8791
- release: "1.0.67-91b1c31",
8791
+ release: "1.0.70-7b202fa",
8792
8792
  sampleRate: 0.25,
8793
8793
  autoSessionTracking: false,
8794
8794
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9490,7 +9490,7 @@ function getEmbedURL(_ref) {
9490
9490
  polyfillVersionString = "legacy";
9491
9491
  }
9492
9492
 
9493
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "91b1c31", "/index.html");
9493
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "7b202fa", "/index.html");
9494
9494
  }
9495
9495
  /**
9496
9496
  * Generate the Chat / API URL
@@ -11519,14 +11519,12 @@ function ButtonFrame_mapStateToProps(storeState) {
11519
11519
  var _client$chat_button, _client$ui_settings, _client$ui_settings$e;
11520
11520
 
11521
11521
  var client = storeState.client,
11522
- isDrawerOpen = storeState.isDrawerOpen,
11523
- language = storeState.language;
11522
+ isDrawerOpen = storeState.isDrawerOpen;
11524
11523
  return {
11525
11524
  buttonSize: 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,
11526
11525
  buttonStyle: client === null || client === void 0 ? void 0 : (_client$ui_settings = client.ui_settings) === null || _client$ui_settings === void 0 ? void 0 : (_client$ui_settings$e = _client$ui_settings.embed) === null || _client$ui_settings$e === void 0 ? void 0 : _client$ui_settings$e.style,
11527
11526
  client: client,
11528
- isDrawerOpen: isDrawerOpen,
11529
- language: language
11527
+ isDrawerOpen: isDrawerOpen
11530
11528
  };
11531
11529
  }
11532
11530
 
@@ -12323,8 +12321,7 @@ function ChatFrame_mapStateToProps(storeState) {
12323
12321
  testMode = storeState.testMode,
12324
12322
  client = storeState.client,
12325
12323
  chatDimensions = storeState.chatDimensions,
12326
- drawerHasBeenOpened = storeState.drawerHasBeenOpened,
12327
- chatterInLiveChat = storeState.chatterInLiveChat;
12324
+ drawerHasBeenOpened = storeState.drawerHasBeenOpened;
12328
12325
  return {
12329
12326
  handle: handle,
12330
12327
  domain: domain,
@@ -12338,8 +12335,7 @@ function ChatFrame_mapStateToProps(storeState) {
12338
12335
  testMode: testMode,
12339
12336
  client: client,
12340
12337
  chatDimensions: chatDimensions,
12341
- drawerHasBeenOpened: drawerHasBeenOpened,
12342
- chatterInLiveChat: chatterInLiveChat
12338
+ drawerHasBeenOpened: drawerHasBeenOpened
12343
12339
  };
12344
12340
  }
12345
12341
 
@@ -12441,7 +12437,6 @@ function IntroFrame_mapStateToProps(storeState) {
12441
12437
  introDimensions = storeState.introDimensions,
12442
12438
  isIntroShown = storeState.isIntroShown,
12443
12439
  isDrawerOpen = storeState.isDrawerOpen,
12444
- language = storeState.language,
12445
12440
  adaSettings = storeState.adaSettings;
12446
12441
  return {
12447
12442
  client: client,
@@ -12449,7 +12444,6 @@ function IntroFrame_mapStateToProps(storeState) {
12449
12444
  introDimensions: introDimensions,
12450
12445
  isIntroShown: isIntroShown,
12451
12446
  isDrawerOpen: isDrawerOpen,
12452
- language: language,
12453
12447
  adaSettings: adaSettings
12454
12448
  };
12455
12449
  }
@@ -12773,10 +12767,6 @@ var Container = /*#__PURE__*/function (_Component) {
12773
12767
  setState = _this$props2.setState;
12774
12768
  var adaReadyCallback = adaSettings.adaReadyCallback,
12775
12769
  toggleCallback = adaSettings.toggleCallback;
12776
- (0,services_logger/* log */.cM)("SEND_GREETING Init", {
12777
- clientHandle: client === null || client === void 0 ? void 0 : client.handle,
12778
- wasCampaignShownButNowClosed: wasCampaignShownButNowClosed
12779
- });
12780
12770
 
12781
12771
  if ((client === null || client === void 0 ? void 0 : (_client$ui_settings = client.ui_settings) === null || _client$ui_settings === void 0 ? void 0 : (_client$ui_settings$e = _client$ui_settings.embed) === null || _client$ui_settings$e === void 0 ? void 0 : _client$ui_settings$e.style) === "text") {
12782
12772
  this.computeButtonFrameWidth();
@@ -12838,12 +12828,6 @@ var Container = /*#__PURE__*/function (_Component) {
12838
12828
 
12839
12829
  if (isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
12840
12830
  var chatChannel = messageService.getChannel(CHAT_IFRAME);
12841
- (0,services_logger/* log */.cM)("SEND_GREETING", {
12842
- clientHandle: client === null || client === void 0 ? void 0 : client.handle,
12843
- chatChannel: chatChannel,
12844
- followUpResponseId: followUpResponseId,
12845
- wasCampaignShownButNowClosed: wasCampaignShownButNowClosed
12846
- });
12847
12831
 
12848
12832
  if (chatChannel) {
12849
12833
  if (!wasCampaignShownButNowClosed) {
@@ -13008,7 +12992,14 @@ var Container = /*#__PURE__*/function (_Component) {
13008
12992
  var chatHasBeenRendered = this.state.chatHasBeenRendered;
13009
12993
  var campaignKey = params.campaignKey,
13010
12994
  ignoreStatus = params.ignoreStatus,
13011
- ignoreFrequency = params.ignoreFrequency; // Don't allow sending campaigns when chat is open, it would interrupt the conversation
12995
+ ignoreFrequency = params.ignoreFrequency;
12996
+ (0,services_logger/* log */.cM)("triggerCampaign called", {
12997
+ clientHandle: client === null || client === void 0 ? void 0 : client.handle,
12998
+ campaignKey: campaignKey,
12999
+ isDrawerOpen: isDrawerOpen
13000
+ }, {
13001
+ sampleRate: (client === null || client === void 0 ? void 0 : client.handle) === "tsi-cocoon" ? 1 : 0
13002
+ }); // Don't allow sending campaigns when chat is open, it would interrupt the conversation
13012
13003
 
13013
13004
  if (isDrawerOpen) {
13014
13005
  return;
@@ -13026,6 +13017,8 @@ var Container = /*#__PURE__*/function (_Component) {
13026
13017
  (0,services_logger/* log */.cM)("followUpResponseId initialized", {
13027
13018
  clientHandle: client === null || client === void 0 ? void 0 : client.handle,
13028
13019
  followUpResponseId: followUpResponseId
13020
+ }, {
13021
+ sampleRate: (client === null || client === void 0 ? void 0 : client.handle) === "tsi-cocoon" ? 1 : 0
13029
13022
  });
13030
13023
  setState({
13031
13024
  latestCampaignKey: campaignKey,
@@ -14360,9 +14353,9 @@ window.__AdaEmbedConstructor = Embed;
14360
14353
  /* harmony export */ "yv": function() { return /* binding */ isProduction; },
14361
14354
  /* harmony export */ "Mk": function() { return /* binding */ embed2Version; }
14362
14355
  /* harmony export */ });
14363
- 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)\\/(97|(9[8-9]|\\d{3,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(96|(9[7-9]|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(96|(9[7-9]|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
14356
+ 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);
14364
14357
  var isProduction = "production" === "production";
14365
- var embed2Version = "91b1c31";
14358
+ var embed2Version = "7b202fa";
14366
14359
 
14367
14360
  /***/ }),
14368
14361
 
@@ -14708,9 +14701,9 @@ function _log() {
14708
14701
  service: "embed",
14709
14702
  env: "production",
14710
14703
  embedVersion: 2,
14711
- version: "1.0.67",
14704
+ version: "1.0.70",
14712
14705
  isNpm: true,
14713
- commitHash: "91b1c31"
14706
+ commitHash: "7b202fa"
14714
14707
  }))
14715
14708
  });
14716
14709
 
@@ -25651,7 +25644,7 @@ function _loadEmbed() {
25651
25644
  polyfillVersionString = "legacy";
25652
25645
  }
25653
25646
 
25654
- embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "91b1c31", "/index.js");
25647
+ embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "7b202fa", "/index.js");
25655
25648
  }
25656
25649
 
25657
25650
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
@@ -26217,7 +26210,9 @@ function createEmbedObject() {
26217
26210
  }
26218
26211
  ;// CONCATENATED MODULE: ./src/index-npm.ts
26219
26212
 
26220
- Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 5265));
26213
+ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 5265)); // We need "export default" for NPM module to be used as `import adaEmbed from "@ada-support/embed2";`
26214
+ // eslint-disable-next-line import/no-default-export
26215
+
26221
26216
  /* harmony default export */ var index_npm = (createEmbedObject());
26222
26217
  }();
26223
26218
  module.exports = __webpack_exports__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.67",
3
+ "version": "1.0.70-dev.1",
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 74",
13
+ "lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 66",
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",
@@ -72,7 +72,7 @@
72
72
  "enzyme-adapter-preact-pure": "^2.2.0",
73
73
  "eslint": "^8.8.0",
74
74
  "eslint-plugin-chai-friendly": "^0.7.2",
75
- "eslint-plugin-compat": "^3.13.0",
75
+ "eslint-plugin-compat": "^4.0.2",
76
76
  "eslint-plugin-cypress": "^2.11.3",
77
77
  "eslint-plugin-sonarjs": "^0.11.0",
78
78
  "husky": "^7.0.0",
@@ -81,11 +81,10 @@
81
81
  "lint-staged": "^11.2.3",
82
82
  "npm-run-all": "^4.1.5",
83
83
  "start-server-and-test": "^1.14.0",
84
- "testcafe": "^1.18.2",
85
- "testcafe-browser-provider-lambdatest": "^2.0.10",
84
+ "testcafe": "^1.18.4",
85
+ "testcafe-browser-provider-lambdatest": "^2.0.18",
86
86
  "ts-node": "^10.2.1",
87
87
  "tsconfig-paths": "^3.11.0",
88
- "typescript-eslint-language-service": "^4.1.5",
89
88
  "webpack-bundle-analyzer": "^4.5.0",
90
89
  "webpack-dev-server": "^4.3.1"
91
90
  },
@@ -112,7 +111,7 @@
112
111
  "lodash.debounce": "^4.0.8",
113
112
  "lodash.memoize": "^4.1.2",
114
113
  "preact": "10.4.5",
115
- "typescript": "^4.5.5",
114
+ "typescript": "^4.6.2",
116
115
  "uniqid": "^5.3.0",
117
116
  "webpack": "^5.67.0",
118
117
  "webpack-cli": "^4.9.2",