@xapp/chat-widget 1.104.1 → 1.105.0

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.
package/dist/index.js CHANGED
@@ -3871,6 +3871,31 @@ function useVisualViewportProperties(enabled) {
3871
3871
  return trackVisualViewport();
3872
3872
  }, [enabled]);
3873
3873
  }
3874
+ /** The sessionStorage key the booking page writes the flag to. */
3875
+ var TEST_LEAD_STORAGE_KEY = "xa_test";
3876
+ /** The attribute sent with a lead submission. */
3877
+ var TEST_LEAD_ATTRIBUTE = "xaTest";
3878
+ /** True when the current browser session is a test-lead page view. */
3879
+ function isTestLeadSession() {
3880
+ try {
3881
+ return sessionStorage.getItem(TEST_LEAD_STORAGE_KEY) === "1";
3882
+ }
3883
+ catch (_a) {
3884
+ // Storage can be blocked by the browser; treat that as a real visit.
3885
+ return false;
3886
+ }
3887
+ }
3888
+ /**
3889
+ * Tags the attributes as a test lead when the session flag is set. A test must
3890
+ * never be counted as Google traffic, so any `rwg_token` is dropped as well.
3891
+ */
3892
+ function addTestLeadAttribute(attributes) {
3893
+ if (isTestLeadSession()) {
3894
+ attributes[TEST_LEAD_ATTRIBUTE] = true;
3895
+ delete attributes["rwg_token"];
3896
+ }
3897
+ return attributes;
3898
+ }
3874
3899
 
3875
3900
  /**
3876
3901
  * Quicker configurable uuid
@@ -3894,6 +3919,7 @@ function uuid() {
3894
3919
  var IconButton_1 = IconButton;
3895
3920
  var RichInput_1 = RichInput;
3896
3921
  var SuggestionsList_1 = SuggestionsList;
3922
+ var addTestLeadAttribute_1 = addTestLeadAttribute;
3897
3923
  var findItemByIndex_1 = findItemByIndex;
3898
3924
  var getAttribution_1 = getAttribution;
3899
3925
  var getItemsLength_1 = getItemsLength;
@@ -6363,6 +6389,8 @@ var StentorDirectChat = /** @class */ (function () {
6363
6389
  if (origin) {
6364
6390
  attributes["origin"] = origin;
6365
6391
  }
6392
+ // A test lead from Studio's "send yourself a test lead" booking page
6393
+ addTestLeadAttribute_1(attributes);
6366
6394
  // Add current time for accurate date/time responses
6367
6395
  attributes["currentTime"] = new Date().toISOString();
6368
6396
  now = new Date().getTime();
@@ -7591,6 +7619,8 @@ var StentorRouterChat = /** @class */ (function () {
7591
7619
  if (origin) {
7592
7620
  attributes["origin"] = origin;
7593
7621
  }
7622
+ // A test lead from Studio's "send yourself a test lead" booking page
7623
+ addTestLeadAttribute_1(attributes);
7594
7624
  // Add current time for accurate date/time responses
7595
7625
  attributes["currentTime"] = new Date().toISOString();
7596
7626
  request = requestFromMessage(message, userId, this.isNewSession, sessionId, accessToken, attributes, this.visitorInfo);