@ada-support/embed2 1.6.36 → 1.6.40

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
1
  import type { StartOptions } from "@ada-support/embed-types";
2
2
  import type { TrackEventParams } from "common/types";
3
3
  import type { BusinessEvent } from "./types";
4
- export declare function trackEventImpl(adaSettings: StartOptions, chatterToken: string | undefined, params: TrackEventParams): void;
4
+ export declare function trackEventImpl(adaSettings: StartOptions, chatterToken: string | undefined, sessionToken: string | undefined, params: TrackEventParams): void;
5
5
  export declare const getEventsToTrigger: (businessEvents: BusinessEvent[]) => BusinessEvent[];
@@ -5,7 +5,7 @@ import type { AdaCluster } from "common/types";
5
5
  export interface StoreState extends StartOptionsNoFunction {
6
6
  chatterCreated: string | undefined;
7
7
  chatterToken: string | undefined;
8
- sessionToken?: string | null;
8
+ sessionToken: string | undefined;
9
9
  client?: Client;
10
10
  enabledLanguages: string[];
11
11
  isDrawerOpen: boolean;
@@ -13260,7 +13260,7 @@ const client = new error_tracker_BrowserClient({
13260
13260
  return event;
13261
13261
  },
13262
13262
  environment: "production",
13263
- release: "1.6.36-7a90483",
13263
+ release: "1.6.40-eca8973",
13264
13264
  sampleRate: 0.25,
13265
13265
  autoSessionTracking: false,
13266
13266
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -13832,7 +13832,7 @@ function getEmbedURL(_ref) {
13832
13832
  } else {
13833
13833
  host = `http://${window.location.hostname}:9001`;
13834
13834
  }
13835
- return `${host}/embed/${frameName}/${"7a90483"}/index.html`;
13835
+ return `${host}/embed/${frameName}/${"eca8973"}/index.html`;
13836
13836
  }
13837
13837
  function constructQueryString(query) {
13838
13838
  return Object.keys(query).map(key => {
@@ -13962,6 +13962,10 @@ const actions = {
13962
13962
  httpRequest({
13963
13963
  url: `${url}business_events/track`,
13964
13964
  method: "POST",
13965
+ headers: {
13966
+ "Session-Auth": currentState.sessionToken || "",
13967
+ "Chatter-Token": currentState.chatterToken || ""
13968
+ },
13965
13969
  body: JSON.stringify({
13966
13970
  event_key: `ada:message_opened:${currentState.latestCampaignKey}`,
13967
13971
  value: 0,
@@ -14424,7 +14428,7 @@ function businessEvent_objectSpread(target) { for (var i = 1; i < arguments.leng
14424
14428
 
14425
14429
 
14426
14430
 
14427
- function trackEventImpl(adaSettings, chatterToken, params) {
14431
+ function trackEventImpl(adaSettings, chatterToken, sessionToken, params) {
14428
14432
  const {
14429
14433
  handle,
14430
14434
  cluster,
@@ -14436,7 +14440,7 @@ function trackEventImpl(adaSettings, chatterToken, params) {
14436
14440
  cluster: cluster,
14437
14441
  domain
14438
14442
  });
14439
- if (!chatterToken) {
14443
+ if (!chatterToken || !sessionToken) {
14440
14444
  return;
14441
14445
  }
14442
14446
  const {
@@ -14449,6 +14453,10 @@ function trackEventImpl(adaSettings, chatterToken, params) {
14449
14453
  httpRequest({
14450
14454
  url: `${baseApiUrl}business_events/track`,
14451
14455
  method: "POST",
14456
+ headers: {
14457
+ "Session-Auth": sessionToken,
14458
+ "Chatter-Token": chatterToken
14459
+ },
14452
14460
  body: JSON.stringify({
14453
14461
  event_key: eventKey,
14454
14462
  value,
@@ -15296,9 +15304,9 @@ async function log(message, extra, options) {
15296
15304
  service: "embed",
15297
15305
  env: "production",
15298
15306
  embedVersion: 2,
15299
- version: "1.6.36",
15307
+ version: "1.6.40",
15300
15308
  isNpm: true,
15301
- commitHash: "7a90483"
15309
+ commitHash: "eca8973"
15302
15310
  }))
15303
15311
  });
15304
15312
  }
@@ -15667,17 +15675,16 @@ class ButtonFrame extends d {
15667
15675
  const {
15668
15676
  client
15669
15677
  } = this.props;
15670
- const roleDescription = () => {
15678
+ const getTitle = () => {
15671
15679
  if (!(client !== null && client !== void 0 && client.handle)) {
15672
- return "Chat Button";
15680
+ return "Chat Button Frame";
15673
15681
  }
15674
- return `${client.handle.charAt(0).toUpperCase() + client.handle.slice(1)} Chat Button`;
15682
+ return `${client.handle.charAt(0).toUpperCase() + client.handle.slice(1)} Chat Button Frame`;
15675
15683
  };
15676
15684
  return v(StoreContext.Consumer, null, store => v(MessageServiceContext.Consumer, null, messageService => v(components_IFrame, {
15677
- title: "Chat with bot",
15685
+ title: getTitle(),
15678
15686
  styles: this.styles,
15679
15687
  name: BUTTON_IFRAME,
15680
- roleDescription: roleDescription(),
15681
15688
  store: store,
15682
15689
  messageService: messageService,
15683
15690
  onTransitionEnd: this.handleOnTransitionEndBound
@@ -15827,7 +15834,7 @@ class ChatFrame extends d {
15827
15834
  const hostPageUrlParams = new URL(window.location.href).searchParams;
15828
15835
  const smsToken = hostPageUrlParams.get("adaSMSToken");
15829
15836
  const queryParams = {
15830
- embedVersion: "7a90483".slice(0, 7),
15837
+ embedVersion: "eca8973".slice(0, 7),
15831
15838
  greeting,
15832
15839
  language,
15833
15840
  skipGreeting,
@@ -16982,9 +16989,10 @@ class Container extends d {
16982
16989
  trackEvent(trackEventParams) {
16983
16990
  const {
16984
16991
  adaSettings,
16985
- chatterToken
16992
+ chatterToken,
16993
+ sessionToken
16986
16994
  } = this.props;
16987
- trackEventImpl(adaSettings, chatterToken, trackEventParams);
16995
+ trackEventImpl(adaSettings, chatterToken, sessionToken, trackEventParams);
16988
16996
  }
16989
16997
  evaluateBusinessEventConditions() {
16990
16998
  const {
@@ -17663,6 +17671,7 @@ function Container_mapStateToProps(storeState) {
17663
17671
  isChatWebsocketConnected,
17664
17672
  isDrawerOpen,
17665
17673
  chatterToken,
17674
+ sessionToken,
17666
17675
  appConnectionState,
17667
17676
  drawerHasBeenOpened,
17668
17677
  chatterInLiveChat,
@@ -17679,6 +17688,7 @@ function Container_mapStateToProps(storeState) {
17679
17688
  isChatWebsocketConnected,
17680
17689
  isDrawerOpen,
17681
17690
  chatterToken,
17691
+ sessionToken,
17682
17692
  appConnectionState,
17683
17693
  drawerHasBeenOpened,
17684
17694
  chatterInLiveChat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.6.36",
3
+ "version": "1.6.40",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",