@pelcro/react-pelcro-js 3.26.0-beta.1 → 3.26.0-beta.2

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.esm.js CHANGED
@@ -8381,7 +8381,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8381
8381
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8382
8382
  OutboundLink$1.trackLink = outboundLink;
8383
8383
  var OutboundLink = OutboundLink$1;
8384
- var ReactGA1 = _objectSpread({}, Defaults, {
8384
+ var ReactGA = _objectSpread({}, Defaults, {
8385
8385
  OutboundLink: OutboundLink
8386
8386
  });
8387
8387
 
@@ -8920,8 +8920,8 @@ exports["default"] = _default;
8920
8920
  var ReactGA4 = unwrapExports(dist);
8921
8921
  dist.ReactGAImplementation;
8922
8922
 
8923
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8924
- const ReactGA$d = (_window$d = window) !== null && _window$d !== void 0 && (_window$Pelcro$d = _window$d.Pelcro) !== null && _window$Pelcro$d !== void 0 && (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) !== null && _window$Pelcro$uiSett$d !== void 0 && _window$Pelcro$uiSett$d.enableReactGA4 ? ReactGA4 : ReactGA1;
8923
+ var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
8924
+ const enableReactGA4$f = (_window$f = window) === null || _window$f === void 0 ? void 0 : (_window$Pelcro$f = _window$f.Pelcro) === null || _window$Pelcro$f === void 0 ? void 0 : (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) === null || _window$Pelcro$uiSett$f === void 0 ? void 0 : _window$Pelcro$uiSett$f.enableReactGA4;
8925
8925
  class PelcroActions {
8926
8926
  constructor(storeSetter, storeGetter) {
8927
8927
  var _this = this;
@@ -9101,7 +9101,6 @@ class PelcroActions {
9101
9101
  });
9102
9102
  });
9103
9103
  _defineProperty$3(this, "logout", function () {
9104
- var _ReactGA$event;
9105
9104
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9106
9105
  const {
9107
9106
  switchView,
@@ -9113,11 +9112,18 @@ class PelcroActions {
9113
9112
  return console.warn("You are already logged out.");
9114
9113
  }
9115
9114
  window.Pelcro.user.logout();
9116
- ReactGA$d === null || ReactGA$d === void 0 ? void 0 : (_ReactGA$event = ReactGA$d.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$d, {
9117
- category: "ACTIONS",
9118
- action: "Logged out",
9119
- nonInteraction: true
9120
- });
9115
+ if (enableReactGA4$f) {
9116
+ ReactGA4.event("Logged out", {
9117
+ nonInteraction: true
9118
+ });
9119
+ } else {
9120
+ var _ReactGA$event;
9121
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9122
+ category: "ACTIONS",
9123
+ action: "Logged out",
9124
+ nonInteraction: true
9125
+ });
9126
+ }
9121
9127
  resetView();
9122
9128
  if (displayLogin) {
9123
9129
  switchView("login");
@@ -9130,7 +9136,7 @@ class PelcroActions {
9130
9136
  return false;
9131
9137
  }
9132
9138
 
9133
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9139
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9134
9140
  document.dispatchEvent(cartItemAdded(itemToAdd));
9135
9141
  const {
9136
9142
  cartItems
@@ -9342,8 +9348,8 @@ if (process.env.NODE_ENV === "development") {
9342
9348
  c$1("Pelcro Store", usePelcro);
9343
9349
  }
9344
9350
 
9345
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9346
- const ReactGA$c = (_window$c = window) !== null && _window$c !== void 0 && (_window$Pelcro$c = _window$c.Pelcro) !== null && _window$Pelcro$c !== void 0 && (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) !== null && _window$Pelcro$uiSett$c !== void 0 && _window$Pelcro$uiSett$c.enableReactGA4 ? ReactGA4 : ReactGA1;
9351
+ var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9352
+ const enableReactGA4$e = (_window$e = window) === null || _window$e === void 0 ? void 0 : (_window$Pelcro$e = _window$e.Pelcro) === null || _window$Pelcro$e === void 0 ? void 0 : (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) === null || _window$Pelcro$uiSett$e === void 0 ? void 0 : _window$Pelcro$uiSett$e.enableReactGA4;
9347
9353
 
9348
9354
  /**
9349
9355
  * List of zero-decimal currencies.
@@ -9532,7 +9538,7 @@ const disableScroll = () => {
9532
9538
  }
9533
9539
  };
9534
9540
  const trackSubscriptionOnGA = () => {
9535
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9541
+ var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9536
9542
  const {
9537
9543
  product,
9538
9544
  plan,
@@ -9551,29 +9557,51 @@ const trackSubscriptionOnGA = () => {
9551
9557
  return;
9552
9558
  }
9553
9559
  const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
9554
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$set = ReactGA$c.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA$c, {
9555
- currencyCode: currencyCode
9556
- });
9557
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$c.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9558
- id: lastSubscriptionId,
9559
- affiliation: "Pelcro",
9560
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9561
- coupon: couponCode
9562
- });
9563
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA$c.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9564
- id: lastSubscriptionId,
9565
- name: product.name,
9566
- category: product.description,
9567
- variant: plan.nickname,
9568
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9569
- quantity: 1
9570
- });
9571
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA$c.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9572
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$event = ReactGA$c.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$c, {
9573
- category: "ACTIONS",
9574
- action: "Subscribed",
9575
- nonInteraction: true
9576
- });
9560
+ if (enableReactGA4$e) {
9561
+ ReactGA4.event("purchase", {
9562
+ transaction_id: lastSubscriptionId,
9563
+ affiliation: "Pelcro",
9564
+ currency: currencyCode,
9565
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9566
+ coupon: couponCode,
9567
+ items: [{
9568
+ item_id: lastSubscriptionId,
9569
+ item_name: product.name,
9570
+ item_category: product.description,
9571
+ item_variant: plan.nickname,
9572
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9573
+ quantity: 1
9574
+ }]
9575
+ });
9576
+ ReactGA4.event("Subscribed", {
9577
+ nonInteraction: true
9578
+ });
9579
+ } else {
9580
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9581
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9582
+ currencyCode: currencyCode
9583
+ });
9584
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9585
+ id: lastSubscriptionId,
9586
+ affiliation: "Pelcro",
9587
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9588
+ coupon: couponCode
9589
+ });
9590
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9591
+ id: lastSubscriptionId,
9592
+ name: product.name,
9593
+ category: product.description,
9594
+ variant: plan.nickname,
9595
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9596
+ quantity: 1
9597
+ });
9598
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9599
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9600
+ category: "ACTIONS",
9601
+ action: "Subscribed",
9602
+ nonInteraction: true
9603
+ });
9604
+ }
9577
9605
  };
9578
9606
 
9579
9607
  /** check wether or not the user have any existing payment method
@@ -9664,7 +9692,7 @@ function userMustVerifyEmail() {
9664
9692
  }
9665
9693
  function notifyBugsnag(callback, startOptions) {
9666
9694
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9667
- //load bugsnag CDN
9695
+ // load bugsnag CDN
9668
9696
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9669
9697
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9670
9698
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10027,10 +10055,10 @@ function _classPrivateFieldGet(receiver, privateMap) {
10027
10055
  return descriptor.value;
10028
10056
  }
10029
10057
 
10030
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
10058
+ var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10031
10059
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10032
10060
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10033
- const ReactGA$b = (_window$b = window) !== null && _window$b !== void 0 && (_window$Pelcro$b = _window$b.Pelcro) !== null && _window$Pelcro$b !== void 0 && (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) !== null && _window$Pelcro$uiSett$b !== void 0 && _window$Pelcro$uiSett$b.enableReactGA4 ? ReactGA4 : ReactGA1;
10061
+ const enableReactGA4$d = (_window$d = window) === null || _window$d === void 0 ? void 0 : (_window$Pelcro$d = _window$d.Pelcro) === null || _window$Pelcro$d === void 0 ? void 0 : (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) === null || _window$Pelcro$uiSett$d === void 0 ? void 0 : _window$Pelcro$uiSett$d.enableReactGA4;
10034
10062
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10035
10063
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10036
10064
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10148,16 +10176,22 @@ class SaveToMetadataButtonClass {
10148
10176
  value: newMetadataValue,
10149
10177
  auth_token: window.Pelcro.user.read().auth_token
10150
10178
  }, (err, resp) => {
10151
- var _ReactGA$event;
10152
10179
  if (err) {
10153
10180
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10154
10181
  }
10155
10182
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10156
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event = ReactGA$b.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$b, {
10157
- category: "ACTIONS",
10158
- action: "Save/Follow",
10159
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10160
- });
10183
+ if (enableReactGA4$d) {
10184
+ ReactGA4.event("Save/Follow", {
10185
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10186
+ });
10187
+ } else {
10188
+ var _ReactGA$event;
10189
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10190
+ category: "ACTIONS",
10191
+ action: "Save/Follow",
10192
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10193
+ });
10194
+ }
10161
10195
  });
10162
10196
  }
10163
10197
  }
@@ -10180,16 +10214,22 @@ class SaveToMetadataButtonClass {
10180
10214
  value: newMetadataValue,
10181
10215
  auth_token: window.Pelcro.user.read().auth_token
10182
10216
  }, (err, resp) => {
10183
- var _ReactGA$event2;
10184
10217
  if (err) {
10185
10218
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10186
10219
  }
10187
10220
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10188
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$b.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$b, {
10189
- category: "ACTIONS",
10190
- action: "Unsave/Unfollow",
10191
- label: title
10192
- });
10221
+ if (enableReactGA4$d) {
10222
+ ReactGA4.event("Unsave/Unfollow", {
10223
+ event_label: title
10224
+ });
10225
+ } else {
10226
+ var _ReactGA$event2;
10227
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10228
+ category: "ACTIONS",
10229
+ action: "Unsave/Unfollow",
10230
+ label: title
10231
+ });
10232
+ }
10193
10233
  });
10194
10234
  }
10195
10235
  }
@@ -11712,8 +11752,8 @@ function getSiteCardProcessor() {
11712
11752
  return "stripe";
11713
11753
  }
11714
11754
 
11715
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11716
- const ReactGA$a = (_window$a = window) !== null && _window$a !== void 0 && (_window$Pelcro$a = _window$a.Pelcro) !== null && _window$Pelcro$a !== void 0 && (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) !== null && _window$Pelcro$uiSett$a !== void 0 && _window$Pelcro$uiSett$a.enableReactGA4 ? ReactGA4 : ReactGA1;
11755
+ var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11756
+ const enableReactGA4$c = (_window$c = window) === null || _window$c === void 0 ? void 0 : (_window$Pelcro$c = _window$c.Pelcro) === null || _window$Pelcro$c === void 0 ? void 0 : (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) === null || _window$Pelcro$uiSett$c === void 0 ? void 0 : _window$Pelcro$uiSett$c.enableReactGA4;
11717
11757
 
11718
11758
  /**
11719
11759
  * @typedef {Object} OptionsType
@@ -11837,17 +11877,41 @@ const initSecuritySdk = () => {
11837
11877
  });
11838
11878
  };
11839
11879
  const initGATracking = () => {
11840
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11841
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$initialize = ReactGA$a.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA$a, window.Pelcro.site.read().google_analytics_id);
11842
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$a.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11880
+ if (window.Pelcro.site.read().google_analytics_id) {
11881
+ if (enableReactGA4$c) {
11882
+ // Initialize ReactGA4 with your tracking ID
11883
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11884
+ // Enable e-commerce tracking
11885
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11886
+ gaOptions: {
11887
+ send_page_view: true,
11888
+ ecommerce: {
11889
+ enabled: true
11890
+ }
11891
+ }
11892
+ });
11893
+ } else {
11894
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11895
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
11896
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11897
+ }
11898
+ }
11843
11899
  };
11844
11900
  const dispatchModalDisplayEvents = modalName => {
11845
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11846
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$event = ReactGA$a.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$a, {
11847
- category: "VIEWS",
11848
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11849
- nonInteraction: true
11850
- });
11901
+ var _modalName$replace, _modalName$replace2;
11902
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11903
+ if (enableReactGA4$c) {
11904
+ ReactGA4.event(`${formattedAction} viewed`, {
11905
+ nonInteraction: true
11906
+ });
11907
+ } else {
11908
+ var _ReactGA$event;
11909
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11910
+ category: "VIEWS",
11911
+ action: `${formattedAction} viewed`,
11912
+ nonInteraction: true
11913
+ });
11914
+ }
11851
11915
  window.Pelcro.insight.track("Modal Displayed", {
11852
11916
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11853
11917
  });
@@ -12722,6 +12786,8 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12722
12786
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12723
12787
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12724
12788
 
12789
+ var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12790
+ const enableReactGA4$b = (_window$b = window) === null || _window$b === void 0 ? void 0 : (_window$Pelcro$b = _window$b.Pelcro) === null || _window$Pelcro$b === void 0 ? void 0 : (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) === null || _window$Pelcro$uiSett$b === void 0 ? void 0 : _window$Pelcro$uiSett$b.enableReactGA4;
12725
12791
  const initialState$m = {
12726
12792
  email: "",
12727
12793
  username: "",
@@ -12776,13 +12842,19 @@ const LoginContainer = _ref => {
12776
12842
  });
12777
12843
  onFailure(err);
12778
12844
  } else {
12779
- var _ReactGA$event;
12780
12845
  onSuccess(res);
12781
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12782
- category: "ACTIONS",
12783
- action: "Logged in",
12784
- nonInteraction: true
12785
- });
12846
+ if (enableReactGA4$b) {
12847
+ ReactGA4.event("Logged in", {
12848
+ nonInteraction: true
12849
+ });
12850
+ } else {
12851
+ var _ReactGA$event;
12852
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12853
+ category: "ACTIONS",
12854
+ action: "Logged in",
12855
+ nonInteraction: true
12856
+ });
12857
+ }
12786
12858
  }
12787
12859
  });
12788
12860
  };
@@ -13168,17 +13240,23 @@ function ConfirmPassword(_ref) {
13168
13240
  }, otherProps));
13169
13241
  }
13170
13242
 
13171
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
13172
- const ReactGA$9 = (_window$9 = window) !== null && _window$9 !== void 0 && (_window$Pelcro$9 = _window$9.Pelcro) !== null && _window$Pelcro$9 !== void 0 && (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) !== null && _window$Pelcro$uiSett$9 !== void 0 && _window$Pelcro$uiSett$9.enableReactGA4 ? ReactGA4 : ReactGA1;
13243
+ var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13244
+ const enableReactGA4$a = (_window$a = window) === null || _window$a === void 0 ? void 0 : (_window$Pelcro$a = _window$a.Pelcro) === null || _window$Pelcro$a === void 0 ? void 0 : (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) === null || _window$Pelcro$uiSett$a === void 0 ? void 0 : _window$Pelcro$uiSett$a.enableReactGA4;
13173
13245
  const Logout = props => {
13174
13246
  const handleLogout = () => {
13175
- var _ReactGA$event;
13176
13247
  window.Pelcro.user.logout();
13177
- ReactGA$9 === null || ReactGA$9 === void 0 ? void 0 : (_ReactGA$event = ReactGA$9.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$9, {
13178
- category: "ACTIONS",
13179
- action: "Logged out",
13180
- nonInteraction: true
13181
- });
13248
+ if (enableReactGA4$a) {
13249
+ ReactGA4.event("Logged out", {
13250
+ nonInteraction: true
13251
+ });
13252
+ } else {
13253
+ var _ReactGA$event;
13254
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13255
+ category: "ACTIONS",
13256
+ action: "Logged out",
13257
+ nonInteraction: true
13258
+ });
13259
+ }
13182
13260
  };
13183
13261
  return /*#__PURE__*/React__default.createElement("button", {
13184
13262
  name: "logout",
@@ -14736,8 +14814,8 @@ const RegisterCompany = props => {
14736
14814
  }, props));
14737
14815
  };
14738
14816
 
14739
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14740
- const ReactGA$8 = (_window$8 = window) !== null && _window$8 !== void 0 && (_window$Pelcro$8 = _window$8.Pelcro) !== null && _window$Pelcro$8 !== void 0 && (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) !== null && _window$Pelcro$uiSett$8 !== void 0 && _window$Pelcro$uiSett$8.enableReactGA4 ? ReactGA4 : ReactGA1;
14817
+ var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14818
+ const enableReactGA4$9 = (_window$9 = window) === null || _window$9 === void 0 ? void 0 : (_window$Pelcro$9 = _window$9.Pelcro) === null || _window$Pelcro$9 === void 0 ? void 0 : (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) === null || _window$Pelcro$uiSett$9 === void 0 ? void 0 : _window$Pelcro$uiSett$9.enableReactGA4;
14741
14819
 
14742
14820
  /**
14743
14821
  *
@@ -14763,12 +14841,19 @@ function RegisterModal(props) {
14763
14841
  handleAfterRegistrationLogic();
14764
14842
  };
14765
14843
  const handleAfterRegistrationLogic = () => {
14766
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14767
- ReactGA$8 === null || ReactGA$8 === void 0 ? void 0 : (_ReactGA$event = ReactGA$8.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$8, {
14768
- category: "ACTIONS",
14769
- action: "Registered",
14770
- nonInteraction: true
14771
- });
14844
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14845
+ if (enableReactGA4$9) {
14846
+ ReactGA4.event("Registered", {
14847
+ nonInteraction: true
14848
+ });
14849
+ } else {
14850
+ var _ReactGA$event;
14851
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14852
+ category: "ACTIONS",
14853
+ action: "Registered",
14854
+ nonInteraction: true
14855
+ });
14856
+ }
14772
14857
  const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
14773
14858
  if (isEmailVerificationEnabled) {
14774
14859
  return switchView("email-verify");
@@ -14855,8 +14940,8 @@ function Radio(_ref) {
14855
14940
  }, children));
14856
14941
  }
14857
14942
 
14858
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14859
- const ReactGA$7 = (_window$7 = window) !== null && _window$7 !== void 0 && (_window$Pelcro$7 = _window$7.Pelcro) !== null && _window$Pelcro$7 !== void 0 && (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) !== null && _window$Pelcro$uiSett$7 !== void 0 && _window$Pelcro$uiSett$7.enableReactGA4 ? ReactGA4 : ReactGA1;
14943
+ var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14944
+ const enableReactGA4$8 = (_window$8 = window) === null || _window$8 === void 0 ? void 0 : (_window$Pelcro$8 = _window$8.Pelcro) === null || _window$Pelcro$8 === void 0 ? void 0 : (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) === null || _window$Pelcro$uiSett$8 === void 0 ? void 0 : _window$Pelcro$uiSett$8.enableReactGA4;
14860
14945
 
14861
14946
  /**
14862
14947
  *
@@ -15204,19 +15289,31 @@ class SelectModal extends Component {
15204
15289
  disableGifting
15205
15290
  } = this.props;
15206
15291
  if (this.state.mode === "product") {
15207
- var _ReactGA$event;
15208
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event = ReactGA$7.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$7, {
15209
- category: "VIEWS",
15210
- action: "Product Modal Viewed",
15211
- nonInteraction: true
15212
- });
15292
+ if (enableReactGA4$8) {
15293
+ ReactGA4.event("Product Modal Viewed", {
15294
+ nonInteraction: true
15295
+ });
15296
+ } else {
15297
+ var _ReactGA$event;
15298
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15299
+ category: "VIEWS",
15300
+ action: "Product Modal Viewed",
15301
+ nonInteraction: true
15302
+ });
15303
+ }
15213
15304
  } else if (this.state.mode === "plan") {
15214
- var _ReactGA$event2;
15215
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$7.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$7, {
15216
- category: "VIEWS",
15217
- action: "Plan Modal Viewed",
15218
- nonInteraction: true
15219
- });
15305
+ if (enableReactGA4$8) {
15306
+ ReactGA4.event("Plan Modal Viewed", {
15307
+ nonInteraction: true
15308
+ });
15309
+ } else {
15310
+ var _ReactGA$event2;
15311
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15312
+ category: "VIEWS",
15313
+ action: "Plan Modal Viewed",
15314
+ nonInteraction: true
15315
+ });
15316
+ }
15220
15317
  }
15221
15318
  return /*#__PURE__*/React__default.createElement(Modal, {
15222
15319
  hideCloseButton: !this.closeButton,
@@ -15647,14 +15744,14 @@ class DonationModal extends Component {
15647
15744
  this.props;
15648
15745
  if (this.state.mode === "product") {
15649
15746
  var _ReactGA$event;
15650
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
15747
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15651
15748
  category: "VIEWS",
15652
15749
  action: "Product Modal Viewed",
15653
15750
  nonInteraction: true
15654
15751
  });
15655
15752
  } else if (this.state.mode === "plan") {
15656
15753
  var _ReactGA$event2;
15657
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA1.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA1, {
15754
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15658
15755
  category: "VIEWS",
15659
15756
  action: "Plan Modal Viewed",
15660
15757
  nonInteraction: true
@@ -21147,8 +21244,8 @@ const SubscriptionRenewView = _ref => {
21147
21244
  }));
21148
21245
  };
21149
21246
 
21150
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21151
- const ReactGA$6 = (_window$6 = window) !== null && _window$6 !== void 0 && (_window$Pelcro$6 = _window$6.Pelcro) !== null && _window$Pelcro$6 !== void 0 && (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) !== null && _window$Pelcro$uiSett$6 !== void 0 && _window$Pelcro$uiSett$6.enableReactGA4 ? ReactGA4 : ReactGA1;
21247
+ var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
21248
+ const enableReactGA4$7 = (_window$7 = window) === null || _window$7 === void 0 ? void 0 : (_window$Pelcro$7 = _window$7.Pelcro) === null || _window$Pelcro$7 === void 0 ? void 0 : (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) === null || _window$Pelcro$uiSett$7 === void 0 ? void 0 : _window$Pelcro$uiSett$7.enableReactGA4;
21152
21249
 
21153
21250
  /**
21154
21251
  *
@@ -21163,23 +21260,37 @@ function SubscriptionRenewModal(_ref) {
21163
21260
  switchView
21164
21261
  } = usePelcro();
21165
21262
  const onSuccess = res => {
21166
- var _otherProps$onSuccess, _ReactGA$event;
21263
+ var _otherProps$onSuccess;
21167
21264
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21168
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event = ReactGA$6.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$6, {
21169
- category: "ACTIONS",
21170
- action: "Renewed",
21171
- nonInteraction: true
21172
- });
21265
+ if (enableReactGA4$7) {
21266
+ ReactGA4.event("Renewed", {
21267
+ nonInteraction: true
21268
+ });
21269
+ } else {
21270
+ var _ReactGA$event;
21271
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21272
+ category: "ACTIONS",
21273
+ action: "Renewed",
21274
+ nonInteraction: true
21275
+ });
21276
+ }
21173
21277
  return switchView("subscription-success");
21174
21278
  };
21175
21279
  const onGiftRenewalSuccess = () => {
21176
- var _otherProps$onGiftRen, _ReactGA$event2;
21280
+ var _otherProps$onGiftRen;
21177
21281
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21178
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$6.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$6, {
21179
- category: "ACTIONS",
21180
- action: "Renewed Gift",
21181
- nonInteraction: true
21182
- });
21282
+ if (enableReactGA4$7) {
21283
+ ReactGA4.event("Renewed Gift", {
21284
+ nonInteraction: true
21285
+ });
21286
+ } else {
21287
+ var _ReactGA$event2;
21288
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
21289
+ category: "ACTIONS",
21290
+ action: "Renewed Gift",
21291
+ nonInteraction: true
21292
+ });
21293
+ }
21183
21294
  return switchView("subscription-success");
21184
21295
  };
21185
21296
  return /*#__PURE__*/React__default.createElement(Modal, {
@@ -21349,8 +21460,8 @@ function SvgSubscription(props) {
21349
21460
  }))))));
21350
21461
  }
21351
21462
 
21352
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21353
- const ReactGA$5 = (_window$5 = window) !== null && _window$5 !== void 0 && (_window$Pelcro$5 = _window$5.Pelcro) !== null && _window$Pelcro$5 !== void 0 && (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) !== null && _window$Pelcro$uiSett$5 !== void 0 && _window$Pelcro$uiSett$5.enableReactGA4 ? ReactGA4 : ReactGA1;
21463
+ var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21464
+ const enableReactGA4$6 = (_window$6 = window) === null || _window$6 === void 0 ? void 0 : (_window$Pelcro$6 = _window$6.Pelcro) === null || _window$Pelcro$6 === void 0 ? void 0 : (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) === null || _window$Pelcro$uiSett$6 === void 0 ? void 0 : _window$Pelcro$uiSett$6.enableReactGA4;
21354
21465
  const SubscriptionCancelNowButton = _ref => {
21355
21466
  let {
21356
21467
  subscription,
@@ -21378,15 +21489,21 @@ const SubscriptionCancelNowButton = _ref => {
21378
21489
  reason: payload.reason
21379
21490
  })
21380
21491
  }, (err, res) => {
21381
- var _ReactGA$event;
21382
21492
  if (err) {
21383
21493
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21384
21494
  }
21385
- ReactGA$5 === null || ReactGA$5 === void 0 ? void 0 : (_ReactGA$event = ReactGA$5.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$5, {
21386
- category: "ACTIONS",
21387
- action: "Canceled",
21388
- nonInteraction: true
21389
- });
21495
+ if (enableReactGA4$6) {
21496
+ ReactGA4.event("Canceled", {
21497
+ nonInteraction: true
21498
+ });
21499
+ } else {
21500
+ var _ReactGA$event;
21501
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21502
+ category: "ACTIONS",
21503
+ action: "Canceled",
21504
+ nonInteraction: true
21505
+ });
21506
+ }
21390
21507
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21391
21508
  });
21392
21509
  };
@@ -21400,10 +21517,10 @@ const SubscriptionCancelNowButton = _ref => {
21400
21517
  };
21401
21518
  onClick === null || onClick === void 0 ? void 0 : onClick();
21402
21519
 
21403
- //Close the modal
21520
+ // Close the modal
21404
21521
  switchView(null);
21405
21522
 
21406
- //Show confirmation alert after closing the modal
21523
+ // Show confirmation alert after closing the modal
21407
21524
  notify.confirm((onSuccess, onFailure) => {
21408
21525
  cancelSubscription(payload, onSuccess, onFailure);
21409
21526
  }, {
@@ -21421,8 +21538,8 @@ const SubscriptionCancelNowButton = _ref => {
21421
21538
  }, t("messages.cancelNow"));
21422
21539
  };
21423
21540
 
21424
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21425
- const ReactGA$4 = (_window$4 = window) !== null && _window$4 !== void 0 && (_window$Pelcro$4 = _window$4.Pelcro) !== null && _window$Pelcro$4 !== void 0 && (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) !== null && _window$Pelcro$uiSett$4 !== void 0 && _window$Pelcro$uiSett$4.enableReactGA4 ? ReactGA4 : ReactGA1;
21541
+ var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21542
+ const enableReactGA4$5 = (_window$5 = window) === null || _window$5 === void 0 ? void 0 : (_window$Pelcro$5 = _window$5.Pelcro) === null || _window$Pelcro$5 === void 0 ? void 0 : (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) === null || _window$Pelcro$uiSett$5 === void 0 ? void 0 : _window$Pelcro$uiSett$5.enableReactGA4;
21426
21543
  const SubscriptionCancelLaterButton = _ref => {
21427
21544
  let {
21428
21545
  subscription,
@@ -21450,15 +21567,21 @@ const SubscriptionCancelLaterButton = _ref => {
21450
21567
  reason: payload.reason
21451
21568
  })
21452
21569
  }, (err, res) => {
21453
- var _ReactGA$event;
21454
21570
  if (err) {
21455
21571
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21456
21572
  }
21457
- ReactGA$4 === null || ReactGA$4 === void 0 ? void 0 : (_ReactGA$event = ReactGA$4.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$4, {
21458
- category: "ACTIONS",
21459
- action: "Canceled",
21460
- nonInteraction: true
21461
- });
21573
+ if (enableReactGA4$5) {
21574
+ ReactGA4.event("Canceled", {
21575
+ nonInteraction: true
21576
+ });
21577
+ } else {
21578
+ var _ReactGA$event;
21579
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21580
+ category: "ACTIONS",
21581
+ action: "Canceled",
21582
+ nonInteraction: true
21583
+ });
21584
+ }
21462
21585
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21463
21586
  });
21464
21587
  };
@@ -21472,10 +21595,10 @@ const SubscriptionCancelLaterButton = _ref => {
21472
21595
  };
21473
21596
  onClick === null || onClick === void 0 ? void 0 : onClick();
21474
21597
 
21475
- //Close the modal
21598
+ // Close the modal
21476
21599
  switchView(null);
21477
21600
 
21478
- //Show confirmation alert after closing the modal
21601
+ // Show confirmation alert after closing the modal
21479
21602
  notify.confirm((onSuccess, onFailure) => {
21480
21603
  cancelSubscription(payload, onSuccess, onFailure);
21481
21604
  }, {
@@ -21663,8 +21786,8 @@ const SubscriptionSuspendDate = props => {
21663
21786
  }, props));
21664
21787
  };
21665
21788
 
21666
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
21667
- const ReactGA$3 = (_window$3 = window) !== null && _window$3 !== void 0 && (_window$Pelcro$3 = _window$3.Pelcro) !== null && _window$Pelcro$3 !== void 0 && (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) !== null && _window$Pelcro$uiSett$3 !== void 0 && _window$Pelcro$uiSett$3.enableReactGA4 ? ReactGA4 : ReactGA1;
21789
+ var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21790
+ const enableReactGA4$4 = (_window$4 = window) === null || _window$4 === void 0 ? void 0 : (_window$Pelcro$4 = _window$4.Pelcro) === null || _window$Pelcro$4 === void 0 ? void 0 : (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) === null || _window$Pelcro$uiSett$4 === void 0 ? void 0 : _window$Pelcro$uiSett$4.enableReactGA4;
21668
21791
  const SubscriptionSuspendButton = _ref => {
21669
21792
  let {
21670
21793
  subscription,
@@ -21691,15 +21814,21 @@ const SubscriptionSuspendButton = _ref => {
21691
21814
  suspend: 1,
21692
21815
  shipments_suspended_until: suspendDate
21693
21816
  }, (err, res) => {
21694
- var _ReactGA$event;
21695
21817
  if (err) {
21696
21818
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21697
21819
  }
21698
- ReactGA$3 === null || ReactGA$3 === void 0 ? void 0 : (_ReactGA$event = ReactGA$3.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$3, {
21699
- category: "ACTIONS",
21700
- action: "Suspended",
21701
- nonInteraction: true
21702
- });
21820
+ if (enableReactGA4$4) {
21821
+ ReactGA4.event("Suspended", {
21822
+ nonInteraction: true
21823
+ });
21824
+ } else {
21825
+ var _ReactGA$event;
21826
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21827
+ category: "ACTIONS",
21828
+ action: "Suspended",
21829
+ nonInteraction: true
21830
+ });
21831
+ }
21703
21832
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21704
21833
  });
21705
21834
  };
@@ -21709,10 +21838,10 @@ const SubscriptionSuspendButton = _ref => {
21709
21838
  };
21710
21839
  onClick === null || onClick === void 0 ? void 0 : onClick();
21711
21840
 
21712
- //Close the modal
21841
+ // Close the modal
21713
21842
  switchView(null);
21714
21843
 
21715
- //Show confirmation alert after closing the modal
21844
+ // Show confirmation alert after closing the modal
21716
21845
  notify.confirm((onSuccess, onFailure) => {
21717
21846
  suspendSubscription(payload, onSuccess, onFailure);
21718
21847
  }, {
@@ -24412,6 +24541,8 @@ const AddressCreateLine2 = props => {
24412
24541
  }, props));
24413
24542
  };
24414
24543
 
24544
+ var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
24545
+ const enableReactGA4$3 = (_window$3 = window) === null || _window$3 === void 0 ? void 0 : (_window$Pelcro$3 = _window$3.Pelcro) === null || _window$Pelcro$3 === void 0 ? void 0 : (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) === null || _window$Pelcro$uiSett$3 === void 0 ? void 0 : _window$Pelcro$uiSett$3.enableReactGA4;
24415
24546
  const initialState$d = {
24416
24547
  isSubmitting: false,
24417
24548
  firstName: "",
@@ -24547,7 +24678,6 @@ const AddressUpdateContainer = _ref => {
24547
24678
  });
24548
24679
  onFailure(err);
24549
24680
  } else {
24550
- var _ReactGA$event;
24551
24681
  dispatch({
24552
24682
  type: SHOW_ALERT,
24553
24683
  payload: {
@@ -24556,11 +24686,18 @@ const AddressUpdateContainer = _ref => {
24556
24686
  }
24557
24687
  });
24558
24688
  onSuccess(res);
24559
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
24560
- category: "ACTIONS",
24561
- action: "Updated address",
24562
- nonInteraction: true
24563
- });
24689
+ if (enableReactGA4$3) {
24690
+ ReactGA4.event("Updated address", {
24691
+ nonInteraction: true
24692
+ });
24693
+ } else {
24694
+ var _ReactGA$event;
24695
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
24696
+ category: "ACTIONS",
24697
+ action: "Updated address",
24698
+ nonInteraction: true
24699
+ });
24700
+ }
24564
24701
  }
24565
24702
  });
24566
24703
  };
@@ -25085,16 +25222,23 @@ function PaymentMethodUpdateView(props) {
25085
25222
  }
25086
25223
 
25087
25224
  var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25088
- const ReactGA$2 = (_window$2 = window) !== null && _window$2 !== void 0 && (_window$Pelcro$2 = _window$2.Pelcro) !== null && _window$Pelcro$2 !== void 0 && (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) !== null && _window$Pelcro$uiSett$2 !== void 0 && _window$Pelcro$uiSett$2.enableReactGA4 ? ReactGA4 : ReactGA1;
25225
+ const enableReactGA4$2 = (_window$2 = window) === null || _window$2 === void 0 ? void 0 : (_window$Pelcro$2 = _window$2.Pelcro) === null || _window$Pelcro$2 === void 0 ? void 0 : (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) === null || _window$Pelcro$uiSett$2 === void 0 ? void 0 : _window$Pelcro$uiSett$2.enableReactGA4;
25089
25226
  const PaymentMethodUpdateModal = props => {
25090
25227
  const onSuccess = res => {
25091
- var _props$onSuccess, _ReactGA$event;
25228
+ var _props$onSuccess;
25092
25229
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25093
- ReactGA$2 === null || ReactGA$2 === void 0 ? void 0 : (_ReactGA$event = ReactGA$2.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$2, {
25094
- category: "ACTIONS",
25095
- action: "Updated payment card",
25096
- nonInteraction: true
25097
- });
25230
+ if (enableReactGA4$2) {
25231
+ ReactGA4.event("Updated payment card", {
25232
+ nonInteraction: true
25233
+ });
25234
+ } else {
25235
+ var _ReactGA$event;
25236
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25237
+ category: "ACTIONS",
25238
+ action: "Updated payment card",
25239
+ nonInteraction: true
25240
+ });
25241
+ }
25098
25242
  };
25099
25243
  return /*#__PURE__*/React__default.createElement(Modal, {
25100
25244
  id: "pelcro-payment-method-update-modal",
@@ -28972,7 +29116,7 @@ const OrderItems = _ref => {
28972
29116
  };
28973
29117
 
28974
29118
  var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
28975
- const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
29119
+ const enableReactGA4$1 = (_window$1 = window) === null || _window$1 === void 0 ? void 0 : (_window$Pelcro$1 = _window$1.Pelcro) === null || _window$Pelcro$1 === void 0 ? void 0 : (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) === null || _window$Pelcro$uiSett$1 === void 0 ? void 0 : _window$Pelcro$uiSett$1.enableReactGA4;
28976
29120
  const SavedItemsMenu = () => {
28977
29121
  const {
28978
29122
  t
@@ -29031,17 +29175,24 @@ const SavedItems = _ref3 => {
29031
29175
  value: newMetadataValue,
29032
29176
  auth_token: window.Pelcro.user.read().auth_token
29033
29177
  }, (error, response) => {
29034
- var _response$data, _ReactGA$event;
29178
+ var _response$data;
29035
29179
  setLoading(false);
29036
29180
  if (error) {
29037
29181
  return;
29038
29182
  }
29039
29183
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29040
- ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event = ReactGA$1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$1, {
29041
- category: "ACTIONS",
29042
- action: "Unsave/Unfollow",
29043
- label: title
29044
- });
29184
+ if (enableReactGA4$1) {
29185
+ ReactGA4.event("Unsave/Unfollow", {
29186
+ event_label: title
29187
+ });
29188
+ } else {
29189
+ var _ReactGA$event;
29190
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29191
+ category: "ACTIONS",
29192
+ action: "Unsave/Unfollow",
29193
+ label: title
29194
+ });
29195
+ }
29045
29196
  });
29046
29197
  }
29047
29198
  };
@@ -29995,7 +30146,7 @@ function getMemberShipStatus(status) {
29995
30146
  }
29996
30147
 
29997
30148
  var _window, _window$Pelcro, _window$Pelcro$uiSett;
29998
- const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
30149
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
29999
30150
  const SUB_MENUS = {
30000
30151
  PROFILE: "profile",
30001
30152
  SUBSCRIPTIONS: "subscriptions",
@@ -30053,18 +30204,24 @@ class Dashboard extends Component {
30053
30204
  var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30054
30205
  super(props);
30055
30206
  _defineProperty$3(this, "componentDidMount", () => {
30056
- var _ReactGA$event;
30057
30207
  this.setState({
30058
30208
  isOpen: true
30059
30209
  });
30060
30210
  window.Pelcro.insight.track("Modal Displayed", {
30061
30211
  name: "dashboard"
30062
30212
  });
30063
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30064
- category: "VIEWS",
30065
- action: "Dashboard Modal Viewed",
30066
- nonInteraction: true
30067
- });
30213
+ if (enableReactGA4) {
30214
+ ReactGA4.event("Dashboard Modal Viewed", {
30215
+ nonInteraction: true
30216
+ });
30217
+ } else {
30218
+ var _ReactGA$event;
30219
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30220
+ category: "VIEWS",
30221
+ action: "Dashboard Modal Viewed",
30222
+ nonInteraction: true
30223
+ });
30224
+ }
30068
30225
  const {
30069
30226
  addresses
30070
30227
  } = window.Pelcro.user.read();
@@ -30092,15 +30249,21 @@ class Dashboard extends Component {
30092
30249
  auth_token: window.Pelcro.user.read().auth_token,
30093
30250
  subscription_id: subscription_id
30094
30251
  }, (err, res) => {
30095
- var _ReactGA$event2;
30096
30252
  if (err) {
30097
30253
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30098
30254
  }
30099
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30100
- category: "ACTIONS",
30101
- action: "Canceled",
30102
- nonInteraction: true
30103
- });
30255
+ if (enableReactGA4) {
30256
+ ReactGA4.event("Canceled", {
30257
+ nonInteraction: true
30258
+ });
30259
+ } else {
30260
+ var _ReactGA$event2;
30261
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30262
+ category: "ACTIONS",
30263
+ action: "Canceled",
30264
+ nonInteraction: true
30265
+ });
30266
+ }
30104
30267
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30105
30268
  });
30106
30269
  });
@@ -30110,15 +30273,21 @@ class Dashboard extends Component {
30110
30273
  subscription_id: subscription_id,
30111
30274
  suspend: 0
30112
30275
  }, (err, res) => {
30113
- var _ReactGA$event3;
30114
30276
  if (err) {
30115
30277
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30116
30278
  }
30117
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30118
- category: "ACTIONS",
30119
- action: "UnSuspended",
30120
- nonInteraction: true
30121
- });
30279
+ if (enableReactGA4) {
30280
+ ReactGA4.event("UnSuspended", {
30281
+ nonInteraction: true
30282
+ });
30283
+ } else {
30284
+ var _ReactGA$event3;
30285
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30286
+ category: "ACTIONS",
30287
+ action: "UnSuspended",
30288
+ nonInteraction: true
30289
+ });
30290
+ }
30122
30291
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30123
30292
  });
30124
30293
  });