@ada-support/embed2 1.0.77 → 1.0.78

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.
@@ -74,7 +74,7 @@ export interface StoreState extends StartOptionsNoFunction {
74
74
  language?: string;
75
75
  adaSettings: StartOptions;
76
76
  wasCampaignShownButNowClosed: boolean;
77
- isChatEmpty: boolean;
77
+ proactiveCampaignHadMessages: boolean;
78
78
  }
79
79
  export interface StartOptionsNoFunction {
80
80
  handle?: string;
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
8788
8788
  return event;
8789
8789
  },
8790
8790
  environment: "production",
8791
- release: "1.0.77-12e8ab2",
8791
+ release: "1.0.78-033c4a1",
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, "12e8ab2", "/index.html");
9493
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "033c4a1", "/index.html");
9494
9494
  }
9495
9495
  /**
9496
9496
  * Generate the Chat / API URL
@@ -9595,9 +9595,10 @@ var actions = {
9595
9595
  }
9596
9596
 
9597
9597
  var hasChatOpenedAfterProactiveMessagesShown = currentState.hasChatOpenedAfterProactiveMessagesShown,
9598
- wasCampaignShownButNowClosed = currentState.wasCampaignShownButNowClosed;
9598
+ wasCampaignShownButNowClosed = currentState.wasCampaignShownButNowClosed,
9599
+ proactiveCampaignHadMessages = currentState.proactiveCampaignHadMessages;
9599
9600
 
9600
- if (!currentState.isDrawerOpen && !hasChatOpenedAfterProactiveMessagesShown && !wasCampaignShownButNowClosed && currentState.latestCampaignKey) {
9601
+ if (!currentState.isDrawerOpen && !hasChatOpenedAfterProactiveMessagesShown && !wasCampaignShownButNowClosed && proactiveCampaignHadMessages && currentState.latestCampaignKey) {
9601
9602
  var _url = getURL({
9602
9603
  name: "api",
9603
9604
  handle: currentState.handle,
@@ -9971,7 +9972,7 @@ var state = {
9971
9972
  chatterInLiveChat: false,
9972
9973
  adaSettings: {},
9973
9974
  wasCampaignShownButNowClosed: false,
9974
- isChatEmpty: false
9975
+ proactiveCampaignHadMessages: false
9975
9976
  };
9976
9977
  /* harmony default export */ var store_state = (state);
9977
9978
  ;// CONCATENATED MODULE: ./src/client/store/index.ts
@@ -12774,8 +12775,7 @@ var Container = /*#__PURE__*/function (_Component) {
12774
12775
  adaSettings = _this$props2.adaSettings,
12775
12776
  chatterInLiveChat = _this$props2.chatterInLiveChat,
12776
12777
  messageService = _this$props2.messageService,
12777
- wasCampaignShownButNowClosed = _this$props2.wasCampaignShownButNowClosed,
12778
- isChatEmpty = _this$props2.isChatEmpty;
12778
+ wasCampaignShownButNowClosed = _this$props2.wasCampaignShownButNowClosed;
12779
12779
  var adaReadyCallback = adaSettings.adaReadyCallback,
12780
12780
  toggleCallback = adaSettings.toggleCallback;
12781
12781
 
@@ -12842,10 +12842,12 @@ var Container = /*#__PURE__*/function (_Component) {
12842
12842
 
12843
12843
  if (chatChannel) {
12844
12844
  if (!wasCampaignShownButNowClosed) {
12845
+ // If the campaign has not been closed (i.e. is still visible), send the follow up response
12845
12846
  chatChannel.postMessage(SEND_GREETING, {
12846
12847
  responseId: followUpResponseId
12847
- }); // If the campaign has not been closed (i.e. is still visible), send the follow up response
12848
- } else if (isChatEmpty) {
12848
+ });
12849
+ } else {
12850
+ // otherwise, send the bot's default greeting answer (if the conversation has messages already, `chat` will ignore this message)
12849
12851
  chatChannel.postMessage(SEND_GREETING);
12850
12852
  }
12851
12853
 
@@ -13015,7 +13017,8 @@ var Container = /*#__PURE__*/function (_Component) {
13015
13017
  setState({
13016
13018
  latestCampaignKey: campaignKey,
13017
13019
  hasChatOpenedAfterProactiveMessagesShown: false,
13018
- wasCampaignShownButNowClosed: false
13020
+ wasCampaignShownButNowClosed: false,
13021
+ proactiveCampaignHadMessages: false
13019
13022
  });
13020
13023
  this.setState({
13021
13024
  // Only need to load chat for engage campaigns, not free tier (message_text) campaigns
@@ -13735,8 +13738,7 @@ function Container_mapStateToProps(storeState) {
13735
13738
  chatDimensions = storeState.chatDimensions,
13736
13739
  isIntroShown = storeState.isIntroShown,
13737
13740
  language = storeState.language,
13738
- wasCampaignShownButNowClosed = storeState.wasCampaignShownButNowClosed,
13739
- isChatEmpty = storeState.isChatEmpty;
13741
+ wasCampaignShownButNowClosed = storeState.wasCampaignShownButNowClosed;
13740
13742
  return {
13741
13743
  client: client,
13742
13744
  hideMask: hideMask,
@@ -13751,8 +13753,7 @@ function Container_mapStateToProps(storeState) {
13751
13753
  chatDimensions: chatDimensions,
13752
13754
  isIntroShown: isIntroShown,
13753
13755
  language: language,
13754
- wasCampaignShownButNowClosed: wasCampaignShownButNowClosed,
13755
- isChatEmpty: isChatEmpty
13756
+ wasCampaignShownButNowClosed: wasCampaignShownButNowClosed
13756
13757
  };
13757
13758
  }
13758
13759
 
@@ -14347,7 +14348,7 @@ window.__AdaEmbedConstructor = Embed;
14347
14348
  /* harmony export */ });
14348
14349
  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);
14349
14350
  var isProduction = "production" === "production";
14350
- var embed2Version = "12e8ab2";
14351
+ var embed2Version = "033c4a1";
14351
14352
 
14352
14353
  /***/ }),
14353
14354
 
@@ -14693,9 +14694,9 @@ function _log() {
14693
14694
  service: "embed",
14694
14695
  env: "production",
14695
14696
  embedVersion: 2,
14696
- version: "1.0.77",
14697
+ version: "1.0.78",
14697
14698
  isNpm: true,
14698
- commitHash: "12e8ab2"
14699
+ commitHash: "033c4a1"
14699
14700
  }))
14700
14701
  });
14701
14702
 
@@ -25636,7 +25637,7 @@ function _loadEmbed() {
25636
25637
  polyfillVersionString = "legacy";
25637
25638
  }
25638
25639
 
25639
- embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "12e8ab2", "/index.js");
25640
+ embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "033c4a1", "/index.js");
25640
25641
  }
25641
25642
 
25642
25643
  clientScriptExists = Boolean( true || // The client script is bundled with npm module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",