@ada-support/embed2 1.14.13 → 1.14.14

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.
@@ -19,6 +19,10 @@ export interface EmbedRequestPayloadByEvent {
19
19
  url: string;
20
20
  openInNewTab: boolean;
21
21
  };
22
+ proactiveConfig?: {
23
+ key: string;
24
+ params: Record<string, string>;
25
+ };
22
26
  };
23
27
  DELETE_HISTORY: undefined;
24
28
  DISPATCH: StoreDispatchPayload;
@@ -45,6 +45,7 @@ export interface StoreState extends StartOptionsNoFunction {
45
45
  adaSettings: StartOptions;
46
46
  wasCampaignShownButNowClosed: boolean;
47
47
  proactiveCampaignHadMessages: boolean;
48
+ proactiveEngaged: boolean;
48
49
  deviceToken: string | null;
49
50
  activeModality?: Modality;
50
51
  }
@@ -16125,7 +16125,7 @@ const client = new BrowserClient({
16125
16125
  return event;
16126
16126
  },
16127
16127
  environment: "production",
16128
- release: "1.14.13-26c9c4d",
16128
+ release: "1.14.14-ac7ed67",
16129
16129
  sampleRate: 0.25,
16130
16130
  autoSessionTracking: false,
16131
16131
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -16751,7 +16751,7 @@ function getEmbedURL(_ref) {
16751
16751
  } else {
16752
16752
  host = `http://${handle}.localhost:${ports.localhost.default}`;
16753
16753
  }
16754
- return `${host}/embed/${frameName}/${"26c9c4d"}/index.html`;
16754
+ return `${host}/embed/${frameName}/${"ac7ed67"}/index.html`;
16755
16755
  }
16756
16756
  function constructQueryString(query) {
16757
16757
  return Object.keys(query).map(key => {
@@ -17489,6 +17489,7 @@ const getInitialState = adaSettings => ({
17489
17489
  chatterInLiveChat: false,
17490
17490
  wasCampaignShownButNowClosed: false,
17491
17491
  proactiveCampaignHadMessages: false,
17492
+ proactiveEngaged: false,
17492
17493
  deviceToken: null,
17493
17494
  showFallbackOnTimeout: true
17494
17495
  });
@@ -17538,9 +17539,9 @@ async function log(message, extra, options) {
17538
17539
  service: "embed",
17539
17540
  env: "production",
17540
17541
  embedVersion: 2,
17541
- version: "1.14.13",
17542
+ version: "1.14.14",
17542
17543
  isNpm: true,
17543
- commitHash: "26c9c4d"
17544
+ commitHash: "ac7ed67"
17544
17545
  }))
17545
17546
  });
17546
17547
  }
@@ -18819,7 +18820,6 @@ function proactiveTriggerImpl(_ref3) {
18819
18820
  adaSettings,
18820
18821
  messageService,
18821
18822
  language,
18822
- setRecentProactiveConversationConfig,
18823
18823
  clearProactiveConversation
18824
18824
  } = _ref3;
18825
18825
  const {
@@ -18885,10 +18885,6 @@ function proactiveTriggerImpl(_ref3) {
18885
18885
  if (triggerMethod === "url") {
18886
18886
  recordRankedShown(handle, messageKey);
18887
18887
  }
18888
- setRecentProactiveConversationConfig({
18889
- key: messageKey,
18890
- params
18891
- });
18892
18888
  const {
18893
18889
  image,
18894
18890
  cta
@@ -18900,7 +18896,11 @@ function proactiveTriggerImpl(_ref3) {
18900
18896
  duration,
18901
18897
  delay,
18902
18898
  image,
18903
- cta
18899
+ cta,
18900
+ proactiveConfig: {
18901
+ key: messageKey,
18902
+ params
18903
+ }
18904
18904
  });
18905
18905
  log("Proactive message displayed", {
18906
18906
  handle,
@@ -20350,7 +20350,7 @@ class ChatFrame extends d {
20350
20350
  log("Chat frame mount", {
20351
20351
  handle,
20352
20352
  chatUrl: this.url,
20353
- embedVersion: "26c9c4d".slice(0, 7),
20353
+ embedVersion: "ac7ed67".slice(0, 7),
20354
20354
  embedSettings: adaSettings
20355
20355
  });
20356
20356
 
@@ -20438,7 +20438,7 @@ class ChatFrame extends d {
20438
20438
  const hostPageUrlParams = new URL(window.location.href).searchParams;
20439
20439
  const smsToken = hostPageUrlParams.get("adaSMSToken");
20440
20440
  const queryParams = {
20441
- embedVersion: "26c9c4d".slice(0, 7),
20441
+ embedVersion: "ac7ed67".slice(0, 7),
20442
20442
  greeting,
20443
20443
  language,
20444
20444
  skipGreeting,
@@ -21594,6 +21594,7 @@ class Container extends d {
21594
21594
  chatterInLiveChat,
21595
21595
  messageService,
21596
21596
  wasCampaignShownButNowClosed,
21597
+ proactiveEngaged,
21597
21598
  setGlobalState,
21598
21599
  language
21599
21600
  } = this.props;
@@ -21651,9 +21652,6 @@ class Container extends d {
21651
21652
  adaSettings,
21652
21653
  messageService,
21653
21654
  language: language || get_browser_language(),
21654
- setRecentProactiveConversationConfig: config => this.setState({
21655
- recentProactiveConversationConfig: config
21656
- }),
21657
21655
  clearProactiveConversation: () => this.setState({
21658
21656
  proactiveConversation: null
21659
21657
  })
@@ -21678,7 +21676,12 @@ class Container extends d {
21678
21676
  });
21679
21677
  }
21680
21678
  }
21681
- if (isChatWebsocketConnected && isDrawerOpen && recentProactiveConversationConfig) {
21679
+
21680
+ // Only attribute the proactive when the customer engaged it (clicked the
21681
+ // bubble), not on any drawer open. Without the `proactiveEngaged` gate the
21682
+ // meta leaks on: opening during a delay, opening after dismiss, or opening
21683
+ // on a page the proactive no longer matches.
21684
+ if (isChatWebsocketConnected && isDrawerOpen && recentProactiveConversationConfig && proactiveEngaged) {
21682
21685
  const chatChannel = messageService.getChannel(CHAT_IFRAME);
21683
21686
  if (chatChannel) {
21684
21687
  const {
@@ -21696,6 +21699,9 @@ class Container extends d {
21696
21699
  handle: adaSettings.handle,
21697
21700
  embedSettings: adaSettings
21698
21701
  });
21702
+ setGlobalState({
21703
+ proactiveEngaged: false
21704
+ });
21699
21705
  this.setState({
21700
21706
  recentProactiveConversationConfig: null
21701
21707
  });
@@ -22197,11 +22203,17 @@ class Container extends d {
22197
22203
  duration,
22198
22204
  delay,
22199
22205
  image,
22200
- cta
22206
+ cta,
22207
+ proactiveConfig = null
22201
22208
  } = payload;
22202
22209
  const EXTRA_PROACTIVE_DELAY = 1000;
22210
+
22211
+ // A newly shown intro is a fresh engagement opportunity: track only the
22212
+ // proactive it carries (campaigns carry none, clearing any stale config)
22213
+ // and reset engagement so a prior bubble's flag can't attribute this one.
22203
22214
  this.setState({
22204
- hideIntroOverride: true
22215
+ hideIntroOverride: true,
22216
+ recentProactiveConversationConfig: proactiveConfig
22205
22217
  }, async () => {
22206
22218
  const {
22207
22219
  setGlobalState
@@ -22220,7 +22232,8 @@ class Container extends d {
22220
22232
  }));
22221
22233
  await setGlobalState({
22222
22234
  client: newClient,
22223
- isIntroShown: false
22235
+ isIntroShown: false,
22236
+ proactiveEngaged: false
22224
22237
  });
22225
22238
  this.setState({
22226
22239
  hideIntroOverride: false
@@ -22282,8 +22295,21 @@ class Container extends d {
22282
22295
  });
22283
22296
  }
22284
22297
  locationChangeHandler() {
22298
+ const {
22299
+ setGlobalState
22300
+ } = this.props;
22301
+
22302
+ // Drop the proactive recorded on the previous page so navigating to a page
22303
+ // without a matching proactive can't later attribute the stale one; the
22304
+ // re-evaluation below records a fresh config only if the new page matches.
22305
+ // Clear engagement in lockstep so a pre-nav click can't attribute the new
22306
+ // page's proactive.
22307
+ setGlobalState({
22308
+ proactiveEngaged: false
22309
+ });
22285
22310
  this.setState({
22286
- hideIntroOverride: true
22311
+ hideIntroOverride: true,
22312
+ recentProactiveConversationConfig: null
22287
22313
  }, () => {
22288
22314
  /**
22289
22315
  * Re-fetch client (this is especially important for intros)
@@ -22617,7 +22643,8 @@ function Container_mapStateToProps(storeState) {
22617
22643
  chatDimensions,
22618
22644
  isIntroShown,
22619
22645
  language,
22620
- wasCampaignShownButNowClosed
22646
+ wasCampaignShownButNowClosed,
22647
+ proactiveEngaged
22621
22648
  } = storeState;
22622
22649
  return {
22623
22650
  client,
@@ -22634,7 +22661,8 @@ function Container_mapStateToProps(storeState) {
22634
22661
  chatDimensions,
22635
22662
  isIntroShown,
22636
22663
  language,
22637
- wasCampaignShownButNowClosed
22664
+ wasCampaignShownButNowClosed,
22665
+ proactiveEngaged
22638
22666
  };
22639
22667
  }
22640
22668
  function Container_mapDispatchToProps(dispatch) {
@@ -1,15 +1,14 @@
1
1
  import type { StartOptions } from "@ada-support/embed-types";
2
2
  import type { MessageService } from "client/lib/message-service";
3
- import type { ProactiveConversation, ProactiveConversationTriggerMethod, ProactiveConversationUrlTriggerConditions, ProactiveConversations, RecentProactiveConversationConfig } from "./types";
3
+ import type { ProactiveConversation, ProactiveConversationTriggerMethod, ProactiveConversationUrlTriggerConditions, ProactiveConversations } from "./types";
4
4
  export declare function isWithinSchedule(scheduleStart?: string | null, scheduleEnd?: string | null): boolean;
5
5
  export declare function pickHighestPriorityMatch(matches: Array<[string, ProactiveConversation]>): [string, ProactiveConversation] | undefined;
6
- export declare function proactiveTriggerImpl({ proactiveConversation, triggerMethod, adaSettings, messageService, language, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
6
+ export declare function proactiveTriggerImpl({ proactiveConversation, triggerMethod, adaSettings, messageService, language, clearProactiveConversation, }: {
7
7
  proactiveConversation: ProactiveConversation;
8
8
  triggerMethod: ProactiveConversationTriggerMethod | null;
9
9
  adaSettings: StartOptions;
10
10
  messageService: MessageService;
11
11
  language: string;
12
- setRecentProactiveConversationConfig: (config: RecentProactiveConversationConfig) => void;
13
12
  clearProactiveConversation: () => void;
14
13
  }): void;
15
14
  export declare function evaluateUrlTriggerConditions(conditions: ProactiveConversationUrlTriggerConditions, url: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.14.13",
3
+ "version": "1.14.14",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",