@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.cjs.js CHANGED
@@ -8411,7 +8411,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8411
8411
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8412
8412
  OutboundLink$1.trackLink = outboundLink;
8413
8413
  var OutboundLink = OutboundLink$1;
8414
- var ReactGA1 = _objectSpread({}, Defaults, {
8414
+ var ReactGA = _objectSpread({}, Defaults, {
8415
8415
  OutboundLink: OutboundLink
8416
8416
  });
8417
8417
 
@@ -8950,8 +8950,8 @@ exports["default"] = _default;
8950
8950
  var ReactGA4 = unwrapExports(dist);
8951
8951
  dist.ReactGAImplementation;
8952
8952
 
8953
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8954
- 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;
8953
+ var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
8954
+ 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;
8955
8955
  class PelcroActions {
8956
8956
  constructor(storeSetter, storeGetter) {
8957
8957
  var _this = this;
@@ -9131,7 +9131,6 @@ class PelcroActions {
9131
9131
  });
9132
9132
  });
9133
9133
  _defineProperty$3(this, "logout", function () {
9134
- var _ReactGA$event;
9135
9134
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9136
9135
  const {
9137
9136
  switchView,
@@ -9143,11 +9142,18 @@ class PelcroActions {
9143
9142
  return console.warn("You are already logged out.");
9144
9143
  }
9145
9144
  window.Pelcro.user.logout();
9146
- 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, {
9147
- category: "ACTIONS",
9148
- action: "Logged out",
9149
- nonInteraction: true
9150
- });
9145
+ if (enableReactGA4$f) {
9146
+ ReactGA4.event("Logged out", {
9147
+ nonInteraction: true
9148
+ });
9149
+ } else {
9150
+ var _ReactGA$event;
9151
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9152
+ category: "ACTIONS",
9153
+ action: "Logged out",
9154
+ nonInteraction: true
9155
+ });
9156
+ }
9151
9157
  resetView();
9152
9158
  if (displayLogin) {
9153
9159
  switchView("login");
@@ -9160,7 +9166,7 @@ class PelcroActions {
9160
9166
  return false;
9161
9167
  }
9162
9168
 
9163
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9169
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9164
9170
  document.dispatchEvent(cartItemAdded(itemToAdd));
9165
9171
  const {
9166
9172
  cartItems
@@ -9372,8 +9378,8 @@ if (process.env.NODE_ENV === "development") {
9372
9378
  c$1("Pelcro Store", usePelcro);
9373
9379
  }
9374
9380
 
9375
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9376
- 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;
9381
+ var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9382
+ 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;
9377
9383
 
9378
9384
  /**
9379
9385
  * List of zero-decimal currencies.
@@ -9562,7 +9568,7 @@ const disableScroll = () => {
9562
9568
  }
9563
9569
  };
9564
9570
  const trackSubscriptionOnGA = () => {
9565
- 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;
9571
+ var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9566
9572
  const {
9567
9573
  product,
9568
9574
  plan,
@@ -9581,29 +9587,51 @@ const trackSubscriptionOnGA = () => {
9581
9587
  return;
9582
9588
  }
9583
9589
  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;
9584
- 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, {
9585
- currencyCode: currencyCode
9586
- });
9587
- 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", {
9588
- id: lastSubscriptionId,
9589
- affiliation: "Pelcro",
9590
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9591
- coupon: couponCode
9592
- });
9593
- 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", {
9594
- id: lastSubscriptionId,
9595
- name: product.name,
9596
- category: product.description,
9597
- variant: plan.nickname,
9598
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9599
- quantity: 1
9600
- });
9601
- 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");
9602
- 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, {
9603
- category: "ACTIONS",
9604
- action: "Subscribed",
9605
- nonInteraction: true
9606
- });
9590
+ if (enableReactGA4$e) {
9591
+ ReactGA4.event("purchase", {
9592
+ transaction_id: lastSubscriptionId,
9593
+ affiliation: "Pelcro",
9594
+ currency: currencyCode,
9595
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9596
+ coupon: couponCode,
9597
+ items: [{
9598
+ item_id: lastSubscriptionId,
9599
+ item_name: product.name,
9600
+ item_category: product.description,
9601
+ item_variant: plan.nickname,
9602
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9603
+ quantity: 1
9604
+ }]
9605
+ });
9606
+ ReactGA4.event("Subscribed", {
9607
+ nonInteraction: true
9608
+ });
9609
+ } else {
9610
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9611
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9612
+ currencyCode: currencyCode
9613
+ });
9614
+ 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", {
9615
+ id: lastSubscriptionId,
9616
+ affiliation: "Pelcro",
9617
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9618
+ coupon: couponCode
9619
+ });
9620
+ 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", {
9621
+ id: lastSubscriptionId,
9622
+ name: product.name,
9623
+ category: product.description,
9624
+ variant: plan.nickname,
9625
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9626
+ quantity: 1
9627
+ });
9628
+ 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");
9629
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9630
+ category: "ACTIONS",
9631
+ action: "Subscribed",
9632
+ nonInteraction: true
9633
+ });
9634
+ }
9607
9635
  };
9608
9636
 
9609
9637
  /** check wether or not the user have any existing payment method
@@ -9694,7 +9722,7 @@ function userMustVerifyEmail() {
9694
9722
  }
9695
9723
  function notifyBugsnag(callback, startOptions) {
9696
9724
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9697
- //load bugsnag CDN
9725
+ // load bugsnag CDN
9698
9726
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9699
9727
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9700
9728
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10057,10 +10085,10 @@ function _classPrivateFieldGet(receiver, privateMap) {
10057
10085
  return descriptor.value;
10058
10086
  }
10059
10087
 
10060
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
10088
+ var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10061
10089
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10062
10090
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10063
- 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;
10091
+ 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;
10064
10092
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10065
10093
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10066
10094
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10178,16 +10206,22 @@ class SaveToMetadataButtonClass {
10178
10206
  value: newMetadataValue,
10179
10207
  auth_token: window.Pelcro.user.read().auth_token
10180
10208
  }, (err, resp) => {
10181
- var _ReactGA$event;
10182
10209
  if (err) {
10183
10210
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10184
10211
  }
10185
10212
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10186
- 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, {
10187
- category: "ACTIONS",
10188
- action: "Save/Follow",
10189
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10190
- });
10213
+ if (enableReactGA4$d) {
10214
+ ReactGA4.event("Save/Follow", {
10215
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10216
+ });
10217
+ } else {
10218
+ var _ReactGA$event;
10219
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10220
+ category: "ACTIONS",
10221
+ action: "Save/Follow",
10222
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10223
+ });
10224
+ }
10191
10225
  });
10192
10226
  }
10193
10227
  }
@@ -10210,16 +10244,22 @@ class SaveToMetadataButtonClass {
10210
10244
  value: newMetadataValue,
10211
10245
  auth_token: window.Pelcro.user.read().auth_token
10212
10246
  }, (err, resp) => {
10213
- var _ReactGA$event2;
10214
10247
  if (err) {
10215
10248
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10216
10249
  }
10217
10250
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10218
- 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, {
10219
- category: "ACTIONS",
10220
- action: "Unsave/Unfollow",
10221
- label: title
10222
- });
10251
+ if (enableReactGA4$d) {
10252
+ ReactGA4.event("Unsave/Unfollow", {
10253
+ event_label: title
10254
+ });
10255
+ } else {
10256
+ var _ReactGA$event2;
10257
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10258
+ category: "ACTIONS",
10259
+ action: "Unsave/Unfollow",
10260
+ label: title
10261
+ });
10262
+ }
10223
10263
  });
10224
10264
  }
10225
10265
  }
@@ -11742,8 +11782,8 @@ function getSiteCardProcessor() {
11742
11782
  return "stripe";
11743
11783
  }
11744
11784
 
11745
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11746
- 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;
11785
+ var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11786
+ 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;
11747
11787
 
11748
11788
  /**
11749
11789
  * @typedef {Object} OptionsType
@@ -11867,17 +11907,41 @@ const initSecuritySdk = () => {
11867
11907
  });
11868
11908
  };
11869
11909
  const initGATracking = () => {
11870
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11871
- 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);
11872
- 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");
11910
+ if (window.Pelcro.site.read().google_analytics_id) {
11911
+ if (enableReactGA4$c) {
11912
+ // Initialize ReactGA4 with your tracking ID
11913
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11914
+ // Enable e-commerce tracking
11915
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11916
+ gaOptions: {
11917
+ send_page_view: true,
11918
+ ecommerce: {
11919
+ enabled: true
11920
+ }
11921
+ }
11922
+ });
11923
+ } else {
11924
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11925
+ 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);
11926
+ 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");
11927
+ }
11928
+ }
11873
11929
  };
11874
11930
  const dispatchModalDisplayEvents = modalName => {
11875
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11876
- 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, {
11877
- category: "VIEWS",
11878
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11879
- nonInteraction: true
11880
- });
11931
+ var _modalName$replace, _modalName$replace2;
11932
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11933
+ if (enableReactGA4$c) {
11934
+ ReactGA4.event(`${formattedAction} viewed`, {
11935
+ nonInteraction: true
11936
+ });
11937
+ } else {
11938
+ var _ReactGA$event;
11939
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11940
+ category: "VIEWS",
11941
+ action: `${formattedAction} viewed`,
11942
+ nonInteraction: true
11943
+ });
11944
+ }
11881
11945
  window.Pelcro.insight.track("Modal Displayed", {
11882
11946
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11883
11947
  });
@@ -12752,6 +12816,8 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12752
12816
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12753
12817
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12754
12818
 
12819
+ var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12820
+ 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;
12755
12821
  const initialState$m = {
12756
12822
  email: "",
12757
12823
  username: "",
@@ -12806,13 +12872,19 @@ const LoginContainer = _ref => {
12806
12872
  });
12807
12873
  onFailure(err);
12808
12874
  } else {
12809
- var _ReactGA$event;
12810
12875
  onSuccess(res);
12811
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12812
- category: "ACTIONS",
12813
- action: "Logged in",
12814
- nonInteraction: true
12815
- });
12876
+ if (enableReactGA4$b) {
12877
+ ReactGA4.event("Logged in", {
12878
+ nonInteraction: true
12879
+ });
12880
+ } else {
12881
+ var _ReactGA$event;
12882
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12883
+ category: "ACTIONS",
12884
+ action: "Logged in",
12885
+ nonInteraction: true
12886
+ });
12887
+ }
12816
12888
  }
12817
12889
  });
12818
12890
  };
@@ -13198,17 +13270,23 @@ function ConfirmPassword(_ref) {
13198
13270
  }, otherProps));
13199
13271
  }
13200
13272
 
13201
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
13202
- 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;
13273
+ var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13274
+ 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;
13203
13275
  const Logout = props => {
13204
13276
  const handleLogout = () => {
13205
- var _ReactGA$event;
13206
13277
  window.Pelcro.user.logout();
13207
- 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, {
13208
- category: "ACTIONS",
13209
- action: "Logged out",
13210
- nonInteraction: true
13211
- });
13278
+ if (enableReactGA4$a) {
13279
+ ReactGA4.event("Logged out", {
13280
+ nonInteraction: true
13281
+ });
13282
+ } else {
13283
+ var _ReactGA$event;
13284
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13285
+ category: "ACTIONS",
13286
+ action: "Logged out",
13287
+ nonInteraction: true
13288
+ });
13289
+ }
13212
13290
  };
13213
13291
  return /*#__PURE__*/React__default['default'].createElement("button", {
13214
13292
  name: "logout",
@@ -14766,8 +14844,8 @@ const RegisterCompany = props => {
14766
14844
  }, props));
14767
14845
  };
14768
14846
 
14769
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14770
- 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;
14847
+ var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14848
+ 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;
14771
14849
 
14772
14850
  /**
14773
14851
  *
@@ -14793,12 +14871,19 @@ function RegisterModal(props) {
14793
14871
  handleAfterRegistrationLogic();
14794
14872
  };
14795
14873
  const handleAfterRegistrationLogic = () => {
14796
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14797
- 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, {
14798
- category: "ACTIONS",
14799
- action: "Registered",
14800
- nonInteraction: true
14801
- });
14874
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14875
+ if (enableReactGA4$9) {
14876
+ ReactGA4.event("Registered", {
14877
+ nonInteraction: true
14878
+ });
14879
+ } else {
14880
+ var _ReactGA$event;
14881
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14882
+ category: "ACTIONS",
14883
+ action: "Registered",
14884
+ nonInteraction: true
14885
+ });
14886
+ }
14802
14887
  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;
14803
14888
  if (isEmailVerificationEnabled) {
14804
14889
  return switchView("email-verify");
@@ -14885,8 +14970,8 @@ function Radio(_ref) {
14885
14970
  }, children));
14886
14971
  }
14887
14972
 
14888
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14889
- 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;
14973
+ var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14974
+ 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;
14890
14975
 
14891
14976
  /**
14892
14977
  *
@@ -15234,19 +15319,31 @@ class SelectModal extends React.Component {
15234
15319
  disableGifting
15235
15320
  } = this.props;
15236
15321
  if (this.state.mode === "product") {
15237
- var _ReactGA$event;
15238
- 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, {
15239
- category: "VIEWS",
15240
- action: "Product Modal Viewed",
15241
- nonInteraction: true
15242
- });
15322
+ if (enableReactGA4$8) {
15323
+ ReactGA4.event("Product Modal Viewed", {
15324
+ nonInteraction: true
15325
+ });
15326
+ } else {
15327
+ var _ReactGA$event;
15328
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15329
+ category: "VIEWS",
15330
+ action: "Product Modal Viewed",
15331
+ nonInteraction: true
15332
+ });
15333
+ }
15243
15334
  } else if (this.state.mode === "plan") {
15244
- var _ReactGA$event2;
15245
- 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, {
15246
- category: "VIEWS",
15247
- action: "Plan Modal Viewed",
15248
- nonInteraction: true
15249
- });
15335
+ if (enableReactGA4$8) {
15336
+ ReactGA4.event("Plan Modal Viewed", {
15337
+ nonInteraction: true
15338
+ });
15339
+ } else {
15340
+ var _ReactGA$event2;
15341
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15342
+ category: "VIEWS",
15343
+ action: "Plan Modal Viewed",
15344
+ nonInteraction: true
15345
+ });
15346
+ }
15250
15347
  }
15251
15348
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
15252
15349
  hideCloseButton: !this.closeButton,
@@ -15677,14 +15774,14 @@ class DonationModal extends React.Component {
15677
15774
  this.props;
15678
15775
  if (this.state.mode === "product") {
15679
15776
  var _ReactGA$event;
15680
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
15777
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15681
15778
  category: "VIEWS",
15682
15779
  action: "Product Modal Viewed",
15683
15780
  nonInteraction: true
15684
15781
  });
15685
15782
  } else if (this.state.mode === "plan") {
15686
15783
  var _ReactGA$event2;
15687
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA1.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA1, {
15784
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15688
15785
  category: "VIEWS",
15689
15786
  action: "Plan Modal Viewed",
15690
15787
  nonInteraction: true
@@ -21177,8 +21274,8 @@ const SubscriptionRenewView = _ref => {
21177
21274
  }));
21178
21275
  };
21179
21276
 
21180
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21181
- 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;
21277
+ var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
21278
+ 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;
21182
21279
 
21183
21280
  /**
21184
21281
  *
@@ -21193,23 +21290,37 @@ function SubscriptionRenewModal(_ref) {
21193
21290
  switchView
21194
21291
  } = usePelcro();
21195
21292
  const onSuccess = res => {
21196
- var _otherProps$onSuccess, _ReactGA$event;
21293
+ var _otherProps$onSuccess;
21197
21294
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21198
- 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, {
21199
- category: "ACTIONS",
21200
- action: "Renewed",
21201
- nonInteraction: true
21202
- });
21295
+ if (enableReactGA4$7) {
21296
+ ReactGA4.event("Renewed", {
21297
+ nonInteraction: true
21298
+ });
21299
+ } else {
21300
+ var _ReactGA$event;
21301
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21302
+ category: "ACTIONS",
21303
+ action: "Renewed",
21304
+ nonInteraction: true
21305
+ });
21306
+ }
21203
21307
  return switchView("subscription-success");
21204
21308
  };
21205
21309
  const onGiftRenewalSuccess = () => {
21206
- var _otherProps$onGiftRen, _ReactGA$event2;
21310
+ var _otherProps$onGiftRen;
21207
21311
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21208
- 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, {
21209
- category: "ACTIONS",
21210
- action: "Renewed Gift",
21211
- nonInteraction: true
21212
- });
21312
+ if (enableReactGA4$7) {
21313
+ ReactGA4.event("Renewed Gift", {
21314
+ nonInteraction: true
21315
+ });
21316
+ } else {
21317
+ var _ReactGA$event2;
21318
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
21319
+ category: "ACTIONS",
21320
+ action: "Renewed Gift",
21321
+ nonInteraction: true
21322
+ });
21323
+ }
21213
21324
  return switchView("subscription-success");
21214
21325
  };
21215
21326
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -21379,8 +21490,8 @@ function SvgSubscription(props) {
21379
21490
  }))))));
21380
21491
  }
21381
21492
 
21382
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21383
- 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;
21493
+ var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21494
+ 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;
21384
21495
  const SubscriptionCancelNowButton = _ref => {
21385
21496
  let {
21386
21497
  subscription,
@@ -21408,15 +21519,21 @@ const SubscriptionCancelNowButton = _ref => {
21408
21519
  reason: payload.reason
21409
21520
  })
21410
21521
  }, (err, res) => {
21411
- var _ReactGA$event;
21412
21522
  if (err) {
21413
21523
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21414
21524
  }
21415
- 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, {
21416
- category: "ACTIONS",
21417
- action: "Canceled",
21418
- nonInteraction: true
21419
- });
21525
+ if (enableReactGA4$6) {
21526
+ ReactGA4.event("Canceled", {
21527
+ nonInteraction: true
21528
+ });
21529
+ } else {
21530
+ var _ReactGA$event;
21531
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21532
+ category: "ACTIONS",
21533
+ action: "Canceled",
21534
+ nonInteraction: true
21535
+ });
21536
+ }
21420
21537
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21421
21538
  });
21422
21539
  };
@@ -21430,10 +21547,10 @@ const SubscriptionCancelNowButton = _ref => {
21430
21547
  };
21431
21548
  onClick === null || onClick === void 0 ? void 0 : onClick();
21432
21549
 
21433
- //Close the modal
21550
+ // Close the modal
21434
21551
  switchView(null);
21435
21552
 
21436
- //Show confirmation alert after closing the modal
21553
+ // Show confirmation alert after closing the modal
21437
21554
  notify.confirm((onSuccess, onFailure) => {
21438
21555
  cancelSubscription(payload, onSuccess, onFailure);
21439
21556
  }, {
@@ -21451,8 +21568,8 @@ const SubscriptionCancelNowButton = _ref => {
21451
21568
  }, t("messages.cancelNow"));
21452
21569
  };
21453
21570
 
21454
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21455
- 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;
21571
+ var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21572
+ 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;
21456
21573
  const SubscriptionCancelLaterButton = _ref => {
21457
21574
  let {
21458
21575
  subscription,
@@ -21480,15 +21597,21 @@ const SubscriptionCancelLaterButton = _ref => {
21480
21597
  reason: payload.reason
21481
21598
  })
21482
21599
  }, (err, res) => {
21483
- var _ReactGA$event;
21484
21600
  if (err) {
21485
21601
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21486
21602
  }
21487
- 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, {
21488
- category: "ACTIONS",
21489
- action: "Canceled",
21490
- nonInteraction: true
21491
- });
21603
+ if (enableReactGA4$5) {
21604
+ ReactGA4.event("Canceled", {
21605
+ nonInteraction: true
21606
+ });
21607
+ } else {
21608
+ var _ReactGA$event;
21609
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21610
+ category: "ACTIONS",
21611
+ action: "Canceled",
21612
+ nonInteraction: true
21613
+ });
21614
+ }
21492
21615
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21493
21616
  });
21494
21617
  };
@@ -21502,10 +21625,10 @@ const SubscriptionCancelLaterButton = _ref => {
21502
21625
  };
21503
21626
  onClick === null || onClick === void 0 ? void 0 : onClick();
21504
21627
 
21505
- //Close the modal
21628
+ // Close the modal
21506
21629
  switchView(null);
21507
21630
 
21508
- //Show confirmation alert after closing the modal
21631
+ // Show confirmation alert after closing the modal
21509
21632
  notify.confirm((onSuccess, onFailure) => {
21510
21633
  cancelSubscription(payload, onSuccess, onFailure);
21511
21634
  }, {
@@ -21693,8 +21816,8 @@ const SubscriptionSuspendDate = props => {
21693
21816
  }, props));
21694
21817
  };
21695
21818
 
21696
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
21697
- 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;
21819
+ var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21820
+ 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;
21698
21821
  const SubscriptionSuspendButton = _ref => {
21699
21822
  let {
21700
21823
  subscription,
@@ -21721,15 +21844,21 @@ const SubscriptionSuspendButton = _ref => {
21721
21844
  suspend: 1,
21722
21845
  shipments_suspended_until: suspendDate
21723
21846
  }, (err, res) => {
21724
- var _ReactGA$event;
21725
21847
  if (err) {
21726
21848
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21727
21849
  }
21728
- 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, {
21729
- category: "ACTIONS",
21730
- action: "Suspended",
21731
- nonInteraction: true
21732
- });
21850
+ if (enableReactGA4$4) {
21851
+ ReactGA4.event("Suspended", {
21852
+ nonInteraction: true
21853
+ });
21854
+ } else {
21855
+ var _ReactGA$event;
21856
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21857
+ category: "ACTIONS",
21858
+ action: "Suspended",
21859
+ nonInteraction: true
21860
+ });
21861
+ }
21733
21862
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21734
21863
  });
21735
21864
  };
@@ -21739,10 +21868,10 @@ const SubscriptionSuspendButton = _ref => {
21739
21868
  };
21740
21869
  onClick === null || onClick === void 0 ? void 0 : onClick();
21741
21870
 
21742
- //Close the modal
21871
+ // Close the modal
21743
21872
  switchView(null);
21744
21873
 
21745
- //Show confirmation alert after closing the modal
21874
+ // Show confirmation alert after closing the modal
21746
21875
  notify.confirm((onSuccess, onFailure) => {
21747
21876
  suspendSubscription(payload, onSuccess, onFailure);
21748
21877
  }, {
@@ -24442,6 +24571,8 @@ const AddressCreateLine2 = props => {
24442
24571
  }, props));
24443
24572
  };
24444
24573
 
24574
+ var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
24575
+ 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;
24445
24576
  const initialState$d = {
24446
24577
  isSubmitting: false,
24447
24578
  firstName: "",
@@ -24577,7 +24708,6 @@ const AddressUpdateContainer = _ref => {
24577
24708
  });
24578
24709
  onFailure(err);
24579
24710
  } else {
24580
- var _ReactGA$event;
24581
24711
  dispatch({
24582
24712
  type: SHOW_ALERT,
24583
24713
  payload: {
@@ -24586,11 +24716,18 @@ const AddressUpdateContainer = _ref => {
24586
24716
  }
24587
24717
  });
24588
24718
  onSuccess(res);
24589
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
24590
- category: "ACTIONS",
24591
- action: "Updated address",
24592
- nonInteraction: true
24593
- });
24719
+ if (enableReactGA4$3) {
24720
+ ReactGA4.event("Updated address", {
24721
+ nonInteraction: true
24722
+ });
24723
+ } else {
24724
+ var _ReactGA$event;
24725
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
24726
+ category: "ACTIONS",
24727
+ action: "Updated address",
24728
+ nonInteraction: true
24729
+ });
24730
+ }
24594
24731
  }
24595
24732
  });
24596
24733
  };
@@ -25115,16 +25252,23 @@ function PaymentMethodUpdateView(props) {
25115
25252
  }
25116
25253
 
25117
25254
  var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25118
- 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;
25255
+ 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;
25119
25256
  const PaymentMethodUpdateModal = props => {
25120
25257
  const onSuccess = res => {
25121
- var _props$onSuccess, _ReactGA$event;
25258
+ var _props$onSuccess;
25122
25259
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25123
- 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, {
25124
- category: "ACTIONS",
25125
- action: "Updated payment card",
25126
- nonInteraction: true
25127
- });
25260
+ if (enableReactGA4$2) {
25261
+ ReactGA4.event("Updated payment card", {
25262
+ nonInteraction: true
25263
+ });
25264
+ } else {
25265
+ var _ReactGA$event;
25266
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25267
+ category: "ACTIONS",
25268
+ action: "Updated payment card",
25269
+ nonInteraction: true
25270
+ });
25271
+ }
25128
25272
  };
25129
25273
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
25130
25274
  id: "pelcro-payment-method-update-modal",
@@ -29002,7 +29146,7 @@ const OrderItems = _ref => {
29002
29146
  };
29003
29147
 
29004
29148
  var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
29005
- 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;
29149
+ 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;
29006
29150
  const SavedItemsMenu = () => {
29007
29151
  const {
29008
29152
  t
@@ -29061,17 +29205,24 @@ const SavedItems = _ref3 => {
29061
29205
  value: newMetadataValue,
29062
29206
  auth_token: window.Pelcro.user.read().auth_token
29063
29207
  }, (error, response) => {
29064
- var _response$data, _ReactGA$event;
29208
+ var _response$data;
29065
29209
  setLoading(false);
29066
29210
  if (error) {
29067
29211
  return;
29068
29212
  }
29069
29213
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29070
- 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, {
29071
- category: "ACTIONS",
29072
- action: "Unsave/Unfollow",
29073
- label: title
29074
- });
29214
+ if (enableReactGA4$1) {
29215
+ ReactGA4.event("Unsave/Unfollow", {
29216
+ event_label: title
29217
+ });
29218
+ } else {
29219
+ var _ReactGA$event;
29220
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29221
+ category: "ACTIONS",
29222
+ action: "Unsave/Unfollow",
29223
+ label: title
29224
+ });
29225
+ }
29075
29226
  });
29076
29227
  }
29077
29228
  };
@@ -30025,7 +30176,7 @@ function getMemberShipStatus(status) {
30025
30176
  }
30026
30177
 
30027
30178
  var _window, _window$Pelcro, _window$Pelcro$uiSett;
30028
- 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;
30179
+ 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;
30029
30180
  const SUB_MENUS = {
30030
30181
  PROFILE: "profile",
30031
30182
  SUBSCRIPTIONS: "subscriptions",
@@ -30083,18 +30234,24 @@ class Dashboard extends React.Component {
30083
30234
  var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30084
30235
  super(props);
30085
30236
  _defineProperty$3(this, "componentDidMount", () => {
30086
- var _ReactGA$event;
30087
30237
  this.setState({
30088
30238
  isOpen: true
30089
30239
  });
30090
30240
  window.Pelcro.insight.track("Modal Displayed", {
30091
30241
  name: "dashboard"
30092
30242
  });
30093
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30094
- category: "VIEWS",
30095
- action: "Dashboard Modal Viewed",
30096
- nonInteraction: true
30097
- });
30243
+ if (enableReactGA4) {
30244
+ ReactGA4.event("Dashboard Modal Viewed", {
30245
+ nonInteraction: true
30246
+ });
30247
+ } else {
30248
+ var _ReactGA$event;
30249
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30250
+ category: "VIEWS",
30251
+ action: "Dashboard Modal Viewed",
30252
+ nonInteraction: true
30253
+ });
30254
+ }
30098
30255
  const {
30099
30256
  addresses
30100
30257
  } = window.Pelcro.user.read();
@@ -30122,15 +30279,21 @@ class Dashboard extends React.Component {
30122
30279
  auth_token: window.Pelcro.user.read().auth_token,
30123
30280
  subscription_id: subscription_id
30124
30281
  }, (err, res) => {
30125
- var _ReactGA$event2;
30126
30282
  if (err) {
30127
30283
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30128
30284
  }
30129
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30130
- category: "ACTIONS",
30131
- action: "Canceled",
30132
- nonInteraction: true
30133
- });
30285
+ if (enableReactGA4) {
30286
+ ReactGA4.event("Canceled", {
30287
+ nonInteraction: true
30288
+ });
30289
+ } else {
30290
+ var _ReactGA$event2;
30291
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30292
+ category: "ACTIONS",
30293
+ action: "Canceled",
30294
+ nonInteraction: true
30295
+ });
30296
+ }
30134
30297
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30135
30298
  });
30136
30299
  });
@@ -30140,15 +30303,21 @@ class Dashboard extends React.Component {
30140
30303
  subscription_id: subscription_id,
30141
30304
  suspend: 0
30142
30305
  }, (err, res) => {
30143
- var _ReactGA$event3;
30144
30306
  if (err) {
30145
30307
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30146
30308
  }
30147
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30148
- category: "ACTIONS",
30149
- action: "UnSuspended",
30150
- nonInteraction: true
30151
- });
30309
+ if (enableReactGA4) {
30310
+ ReactGA4.event("UnSuspended", {
30311
+ nonInteraction: true
30312
+ });
30313
+ } else {
30314
+ var _ReactGA$event3;
30315
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30316
+ category: "ACTIONS",
30317
+ action: "UnSuspended",
30318
+ nonInteraction: true
30319
+ });
30320
+ }
30152
30321
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30153
30322
  });
30154
30323
  });