@pelcro/react-pelcro-js 4.0.0-alpha.46 → 4.0.0-alpha.47

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
@@ -8273,7 +8273,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8273
8273
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8274
8274
  OutboundLink$1.trackLink = outboundLink;
8275
8275
  var OutboundLink = OutboundLink$1;
8276
- var ReactGA1 = _objectSpread({}, Defaults, {
8276
+ var ReactGA = _objectSpread({}, Defaults, {
8277
8277
  OutboundLink: OutboundLink
8278
8278
  });
8279
8279
 
@@ -9054,8 +9054,6 @@ exports["default"] = _default;
9054
9054
  var ReactGA4 = unwrapExports(dist);
9055
9055
  dist.ReactGAImplementation;
9056
9056
 
9057
- var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
9058
- const ReactGA$f = (_window$f = window) !== null && _window$f !== void 0 && (_window$Pelcro$f = _window$f.Pelcro) !== null && _window$Pelcro$f !== void 0 && (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) !== null && _window$Pelcro$uiSett$f !== void 0 && _window$Pelcro$uiSett$f.enableReactGA4 ? ReactGA4 : ReactGA1;
9059
9057
  class PelcroActions {
9060
9058
  constructor(storeSetter, storeGetter) {
9061
9059
  _defineProperty$3(this, "resetState", () => {
@@ -9277,24 +9275,35 @@ class PelcroActions {
9277
9275
  });
9278
9276
 
9279
9277
  _defineProperty$3(this, "logout", (displayLogin = true) => {
9280
- var _ReactGA$event;
9278
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9281
9279
 
9282
9280
  const {
9283
9281
  switchView,
9284
9282
  resetView,
9285
9283
  isAuthenticated
9286
- } = this.get(); // if user is not authenticated function execution is terminated
9284
+ } = this.get();
9285
+ 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; // if user is not authenticated function execution is terminated
9287
9286
 
9288
9287
  if (!isAuthenticated()) {
9289
9288
  return console.warn("You are already logged out.");
9290
9289
  }
9291
9290
 
9292
9291
  window.Pelcro.user.logout();
9293
- ReactGA$f === null || ReactGA$f === void 0 ? void 0 : (_ReactGA$event = ReactGA$f.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$f, {
9294
- category: "ACTIONS",
9295
- action: "Logged out",
9296
- nonInteraction: true
9297
- });
9292
+
9293
+ if (enableReactGA4) {
9294
+ ReactGA4.event("Logged out", {
9295
+ nonInteraction: true
9296
+ });
9297
+ } else {
9298
+ var _ReactGA$event;
9299
+
9300
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9301
+ category: "ACTIONS",
9302
+ action: "Logged out",
9303
+ nonInteraction: true
9304
+ });
9305
+ }
9306
+
9298
9307
  resetView();
9299
9308
 
9300
9309
  if (displayLogin) {
@@ -9308,7 +9317,7 @@ class PelcroActions {
9308
9317
  if (!itemToAdd) {
9309
9318
  console.error("invalid item SKU id");
9310
9319
  return false;
9311
- } //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9320
+ } // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9312
9321
 
9313
9322
 
9314
9323
  document.dispatchEvent(cartItemAdded(itemToAdd));
@@ -9540,8 +9549,6 @@ if (process.env.NODE_ENV === "development") {
9540
9549
  c$1("Pelcro Store", usePelcro);
9541
9550
  }
9542
9551
 
9543
- var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9544
- const ReactGA$e = (_window$e = window) !== null && _window$e !== void 0 && (_window$Pelcro$e = _window$e.Pelcro) !== null && _window$Pelcro$e !== void 0 && (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) !== null && _window$Pelcro$uiSett$e !== void 0 && _window$Pelcro$uiSett$e.enableReactGA4 ? ReactGA4 : ReactGA1;
9545
9552
  /**
9546
9553
  * List of zero-decimal currencies.
9547
9554
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9623,9 +9630,9 @@ const getLanguageWithoutRegion = localeName => {
9623
9630
  */
9624
9631
 
9625
9632
  const getPageOrDefaultLanguage = () => {
9626
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9633
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9627
9634
 
9628
- return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : (_window$Pelcro2$site$ = _window$Pelcro2$site.read) === null || _window$Pelcro2$site$ === void 0 ? void 0 : (_window$Pelcro2$site$2 = _window$Pelcro2$site$.call(_window$Pelcro2$site)) === null || _window$Pelcro2$site$2 === void 0 ? void 0 : _window$Pelcro2$site$2.default_locale);
9635
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
9629
9636
  };
9630
9637
  /**
9631
9638
  * Returns a formatted price string depending on locale
@@ -9680,10 +9687,10 @@ const isValidViewFromURL = viewID => {
9680
9687
  */
9681
9688
 
9682
9689
  function hasValidNewsletterUpdateUrl() {
9683
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9690
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9684
9691
 
9685
9692
  if (viewID !== "newsletter-update") return false;
9686
- const newsletters = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.newsletters;
9693
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
9687
9694
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9688
9695
 
9689
9696
  if (!siteHasNewslettersDefined) {
@@ -9738,7 +9745,7 @@ const disableScroll = () => {
9738
9745
  }
9739
9746
  };
9740
9747
  const trackSubscriptionOnGA = () => {
9741
- 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;
9748
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9742
9749
 
9743
9750
  const {
9744
9751
  product,
@@ -9754,35 +9761,60 @@ const trackSubscriptionOnGA = () => {
9754
9761
  invoices
9755
9762
  } = window.Pelcro.user.read();
9756
9763
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9764
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro3 = _window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.enableReactGA4;
9757
9765
 
9758
9766
  if (!lastSubscriptionId) {
9759
9767
  return;
9760
9768
  }
9761
9769
 
9762
9770
  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;
9763
- ReactGA$e === null || ReactGA$e === void 0 ? void 0 : (_ReactGA$set = ReactGA$e.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA$e, {
9764
- currencyCode: currencyCode
9765
- });
9766
- ReactGA$e === null || ReactGA$e === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$e.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", {
9767
- id: lastSubscriptionId,
9768
- affiliation: "Pelcro",
9769
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9770
- coupon: couponCode
9771
- });
9772
- ReactGA$e === null || ReactGA$e === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA$e.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", {
9773
- id: lastSubscriptionId,
9774
- name: product.name,
9775
- category: product.description,
9776
- variant: plan.nickname,
9777
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9778
- quantity: 1
9779
- });
9780
- ReactGA$e === null || ReactGA$e === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA$e.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");
9781
- ReactGA$e === null || ReactGA$e === void 0 ? void 0 : (_ReactGA$event = ReactGA$e.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$e, {
9782
- category: "ACTIONS",
9783
- action: "Subscribed",
9784
- nonInteraction: true
9785
- });
9771
+
9772
+ if (enableReactGA4) {
9773
+ ReactGA4.event("purchase", {
9774
+ transaction_id: lastSubscriptionId,
9775
+ affiliation: "Pelcro",
9776
+ currency: currencyCode,
9777
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9778
+ coupon: couponCode,
9779
+ items: [{
9780
+ item_id: lastSubscriptionId,
9781
+ item_name: product.name,
9782
+ item_category: product.description,
9783
+ item_variant: plan.nickname,
9784
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9785
+ quantity: 1
9786
+ }]
9787
+ });
9788
+ ReactGA4.event("Subscribed", {
9789
+ nonInteraction: true
9790
+ });
9791
+ } else {
9792
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9793
+
9794
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9795
+ currencyCode: currencyCode
9796
+ });
9797
+ 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", {
9798
+ id: lastSubscriptionId,
9799
+ affiliation: "Pelcro",
9800
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9801
+ coupon: couponCode
9802
+ });
9803
+ 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", {
9804
+ id: lastSubscriptionId,
9805
+ name: product.name,
9806
+ category: product.description,
9807
+ variant: plan.nickname,
9808
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9809
+ quantity: 1
9810
+ });
9811
+ 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");
9812
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9813
+ category: "ACTIONS",
9814
+ action: "Subscribed",
9815
+ nonInteraction: true
9816
+ });
9817
+ }
9786
9818
  };
9787
9819
  /** check wether or not the user have any existing payment method
9788
9820
  * @return {boolean} true if the user have at least one payment method (source), false otherwise
@@ -9869,15 +9901,15 @@ function getDateWithoutTime(dateObject) {
9869
9901
  return date;
9870
9902
  }
9871
9903
  function userMustVerifyEmail() {
9872
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9904
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9873
9905
 
9874
- 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;
9906
+ const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
9875
9907
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
9876
9908
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9877
9909
  }
9878
9910
  function notifyBugsnag(callback, startOptions) {
9879
9911
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9880
- //load bugsnag CDN
9912
+ // load bugsnag CDN
9881
9913
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9882
9914
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9883
9915
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10059,9 +10091,6 @@ function _classPrivateFieldGet(receiver, privateMap) {
10059
10091
  return descriptor.value;
10060
10092
  }
10061
10093
 
10062
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10063
- 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;
10064
-
10065
10094
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10066
10095
 
10067
10096
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
@@ -10170,7 +10199,7 @@ class SaveToMetadataButtonClass {
10170
10199
  _saveToMetadata.set(this, {
10171
10200
  writable: true,
10172
10201
  value: event => {
10173
- var _user$metadata;
10202
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10174
10203
 
10175
10204
  const button = event.currentTarget;
10176
10205
  const user = window.Pelcro.user.read();
@@ -10181,6 +10210,7 @@ class SaveToMetadataButtonClass {
10181
10210
  key,
10182
10211
  ...buttonMetadata
10183
10212
  } = button.dataset;
10213
+ 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;
10184
10214
 
10185
10215
  if (userMustVerifyEmail()) {
10186
10216
  return switchView("email-verify");
@@ -10212,19 +10242,25 @@ class SaveToMetadataButtonClass {
10212
10242
  value: newMetadataValue,
10213
10243
  auth_token: window.Pelcro.user.read().auth_token
10214
10244
  }, (err, resp) => {
10215
- var _ReactGA$event;
10216
-
10217
10245
  if (err) {
10218
10246
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10219
10247
  }
10220
10248
 
10221
10249
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10222
10250
 
10223
- 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, {
10224
- category: "ACTIONS",
10225
- action: "Save/Follow",
10226
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10227
- });
10251
+ if (enableReactGA4) {
10252
+ ReactGA4.event("Save/Follow", {
10253
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10254
+ });
10255
+ } else {
10256
+ var _ReactGA$event;
10257
+
10258
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10259
+ category: "ACTIONS",
10260
+ action: "Save/Follow",
10261
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10262
+ });
10263
+ }
10228
10264
  });
10229
10265
  }
10230
10266
  }
@@ -10233,6 +10269,8 @@ class SaveToMetadataButtonClass {
10233
10269
  _removeMetaData.set(this, {
10234
10270
  writable: true,
10235
10271
  value: event => {
10272
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10273
+
10236
10274
  const button = event.currentTarget;
10237
10275
  const user = window.Pelcro.user.read();
10238
10276
  const {
@@ -10240,6 +10278,7 @@ class SaveToMetadataButtonClass {
10240
10278
  title
10241
10279
  } = button.dataset;
10242
10280
  const oldValue = user.metadata[`metadata_saved_${key}`];
10281
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
10243
10282
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10244
10283
 
10245
10284
  if (window.Pelcro.user.isAuthenticated()) {
@@ -10250,19 +10289,25 @@ class SaveToMetadataButtonClass {
10250
10289
  value: newMetadataValue,
10251
10290
  auth_token: window.Pelcro.user.read().auth_token
10252
10291
  }, (err, resp) => {
10253
- var _ReactGA$event2;
10254
-
10255
10292
  if (err) {
10256
10293
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10257
10294
  }
10258
10295
 
10259
10296
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10260
10297
 
10261
- ReactGA$d === null || ReactGA$d === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$d.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$d, {
10262
- category: "ACTIONS",
10263
- action: "Unsave/Unfollow",
10264
- label: title
10265
- });
10298
+ if (enableReactGA4) {
10299
+ ReactGA4.event("Unsave/Unfollow", {
10300
+ event_label: title
10301
+ });
10302
+ } else {
10303
+ var _ReactGA$event2;
10304
+
10305
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10306
+ category: "ACTIONS",
10307
+ action: "Unsave/Unfollow",
10308
+ label: title
10309
+ });
10310
+ }
10266
10311
  });
10267
10312
  }
10268
10313
  }
@@ -11992,8 +12037,6 @@ function getSiteCardProcessor() {
11992
12037
  return "stripe";
11993
12038
  }
11994
12039
 
11995
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11996
- 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;
11997
12040
  /**
11998
12041
  * @typedef {Object} OptionsType
11999
12042
  * @property {boolean} loadPaymentSDKs
@@ -12124,19 +12167,51 @@ const initSecuritySdk = () => {
12124
12167
  });
12125
12168
  };
12126
12169
  const initGATracking = () => {
12127
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
12170
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12171
+
12172
+ 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;
12173
+
12174
+ if (window.Pelcro.site.read().google_analytics_id) {
12175
+ if (enableReactGA4) {
12176
+ // Initialize ReactGA4 with your tracking ID
12177
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id); // Enable e-commerce tracking
12128
12178
 
12129
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$initialize = ReactGA$c.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA$c, window.Pelcro.site.read().google_analytics_id);
12130
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$c.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");
12179
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
12180
+ gaOptions: {
12181
+ send_page_view: true,
12182
+ ecommerce: {
12183
+ enabled: true
12184
+ }
12185
+ }
12186
+ });
12187
+ } else {
12188
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
12189
+
12190
+ 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);
12191
+ 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");
12192
+ }
12193
+ }
12131
12194
  };
12132
12195
  const dispatchModalDisplayEvents = modalName => {
12133
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
12196
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
12197
+
12198
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
12199
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
12200
+
12201
+ if (enableReactGA4) {
12202
+ ReactGA4.event(`${formattedAction} viewed`, {
12203
+ nonInteraction: true
12204
+ });
12205
+ } else {
12206
+ var _ReactGA$event;
12207
+
12208
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12209
+ category: "VIEWS",
12210
+ action: `${formattedAction} viewed`,
12211
+ nonInteraction: true
12212
+ });
12213
+ }
12134
12214
 
12135
- 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, {
12136
- category: "VIEWS",
12137
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
12138
- nonInteraction: true
12139
- });
12140
12215
  window.Pelcro.insight.track("Modal Displayed", {
12141
12216
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
12142
12217
  });
@@ -12988,8 +13063,6 @@ const CANCEL_SUBSCRIPTION = "CANCEL_SUBSCRIPTION";
12988
13063
  const UNSUSPEND_SUBSCRIPTION = "UNSUSPEND_SUBSCRIPTION";
12989
13064
  const REACTIVATE_SUBSCRIPTION = "REACTIVATE_SUBSCRIPTION"; //========
12990
13065
 
12991
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12992
- 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;
12993
13066
  const initialState$n = {
12994
13067
  email: "",
12995
13068
  username: "",
@@ -13015,6 +13088,10 @@ const LoginContainer = ({
13015
13088
  onFailure = () => {},
13016
13089
  children
13017
13090
  }) => {
13091
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13092
+
13093
+ 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;
13094
+
13018
13095
  const handleLogin = ({
13019
13096
  email,
13020
13097
  username,
@@ -13043,14 +13120,21 @@ const LoginContainer = ({
13043
13120
  });
13044
13121
  onFailure(err);
13045
13122
  } else {
13046
- var _ReactGA$event;
13047
-
13048
13123
  onSuccess(res);
13049
- 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, {
13050
- category: "ACTIONS",
13051
- action: "Logged in",
13052
- nonInteraction: true
13053
- });
13124
+
13125
+ if (enableReactGA4) {
13126
+ ReactGA4.event("Logged in", {
13127
+ nonInteraction: true
13128
+ });
13129
+ } else {
13130
+ var _ReactGA$event;
13131
+
13132
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13133
+ category: "ACTIONS",
13134
+ action: "Logged in",
13135
+ nonInteraction: true
13136
+ });
13137
+ }
13054
13138
  }
13055
13139
  });
13056
13140
  };
@@ -13446,18 +13530,26 @@ function ConfirmPassword({
13446
13530
  }, otherProps));
13447
13531
  }
13448
13532
 
13449
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13450
- 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;
13451
13533
  const Logout = props => {
13452
13534
  const handleLogout = () => {
13453
- var _ReactGA$event;
13535
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13454
13536
 
13455
13537
  window.Pelcro.user.logout();
13456
- 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, {
13457
- category: "ACTIONS",
13458
- action: "Logged out",
13459
- nonInteraction: true
13460
- });
13538
+ 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;
13539
+
13540
+ if (enableReactGA4) {
13541
+ ReactGA4.event("Logged out", {
13542
+ nonInteraction: true
13543
+ });
13544
+ } else {
13545
+ var _ReactGA$event;
13546
+
13547
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13548
+ category: "ACTIONS",
13549
+ action: "Logged out",
13550
+ nonInteraction: true
13551
+ });
13552
+ }
13461
13553
  };
13462
13554
 
13463
13555
  return /*#__PURE__*/React__default['default'].createElement("button", {
@@ -14905,14 +14997,12 @@ const RegisterCompany = props => {
14905
14997
  }, props));
14906
14998
  };
14907
14999
 
14908
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14909
- 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;
14910
15000
  /**
14911
15001
  *
14912
15002
  */
14913
15003
 
14914
15004
  function RegisterModal(props) {
14915
- var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2;
15005
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2;
14916
15006
 
14917
15007
  const {
14918
15008
  t
@@ -14928,6 +15018,7 @@ function RegisterModal(props) {
14928
15018
  giftCode,
14929
15019
  isGift
14930
15020
  } = usePelcro();
15021
+ 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;
14931
15022
 
14932
15023
  const onSuccess = res => {
14933
15024
  var _props$onSuccess;
@@ -14937,13 +15028,22 @@ function RegisterModal(props) {
14937
15028
  };
14938
15029
 
14939
15030
  const handleAfterRegistrationLogic = () => {
14940
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
15031
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
15032
+
15033
+ if (enableReactGA4) {
15034
+ ReactGA4.event("Registered", {
15035
+ nonInteraction: true
15036
+ });
15037
+ } else {
15038
+ var _ReactGA$event;
15039
+
15040
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15041
+ category: "ACTIONS",
15042
+ action: "Registered",
15043
+ nonInteraction: true
15044
+ });
15045
+ }
14941
15046
 
14942
- 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, {
14943
- category: "ACTIONS",
14944
- action: "Registered",
14945
- nonInteraction: true
14946
- });
14947
15047
  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;
14948
15048
 
14949
15049
  if (isEmailVerificationEnabled) {
@@ -19786,8 +19886,6 @@ function SvgArrowLeft(props) {
19786
19886
  })));
19787
19887
  }
19788
19888
 
19789
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
19790
- 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;
19791
19889
  /**
19792
19890
  *
19793
19891
  */
@@ -19857,6 +19955,8 @@ SelectModalWithHook.viewId = "plan-select";
19857
19955
 
19858
19956
  class SelectModal extends React.Component {
19859
19957
  constructor(props) {
19958
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
19959
+
19860
19960
  super(props);
19861
19961
 
19862
19962
  _defineProperty$3(this, "componentDidMount", () => {
@@ -19897,12 +19997,12 @@ class SelectModal extends React.Component {
19897
19997
  document.addEventListener("keydown", this.handleSubmit);
19898
19998
 
19899
19999
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
19900
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
20000
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
19901
20001
 
19902
- const userCurrency = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read().currency;
19903
- const userCountry = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.location.countryCode;
19904
- const userLanguage = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$user = _window$Pelcro4.user) === null || _window$Pelcro4$user === void 0 ? void 0 : _window$Pelcro4$user.read().language;
19905
- const productsMatchingUserCurrency = (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read().products.filter(product => {
20002
+ const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
20003
+ const userCountry = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.location.countryCode;
20004
+ const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
20005
+ const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
19906
20006
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
19907
20007
  if (filteredPlans.length) return filteredPlans;
19908
20008
  });
@@ -19916,13 +20016,13 @@ class SelectModal extends React.Component {
19916
20016
  });
19917
20017
  notifyBugsnag(() => {
19918
20018
  Bugsnag.notify("SelectModal - No data viewed", event => {
19919
- var _window$Pelcro6, _window$Pelcro6$site, _window$Pelcro7, _window$Pelcro7$user, _window$Pelcro8, _window$Pelcro8$uiSet, _window$Pelcro9, _this$props, _window$Pelcro10, _window$Pelcro10$help, _window$Pelcro11, _window$Pelcro11$site;
20019
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
19920
20020
 
19921
20021
  event.addMetadata("MetaData", {
19922
- site: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$site = _window$Pelcro6.site) === null || _window$Pelcro6$site === void 0 ? void 0 : _window$Pelcro6$site.read(),
19923
- user: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$user = _window$Pelcro7.user) === null || _window$Pelcro7$user === void 0 ? void 0 : _window$Pelcro7$user.read(),
19924
- uiVersion: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$uiSet = _window$Pelcro8.uiSettings) === null || _window$Pelcro8$uiSet === void 0 ? void 0 : _window$Pelcro8$uiSet.uiVersion,
19925
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
20022
+ site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
20023
+ user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
20024
+ uiVersion: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$uiSet = _window$Pelcro7.uiSettings) === null || _window$Pelcro7$uiSet === void 0 ? void 0 : _window$Pelcro7$uiSet.uiVersion,
20025
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
19926
20026
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
19927
20027
  productListState: this.state.productList,
19928
20028
  methods: {
@@ -19933,8 +20033,8 @@ class SelectModal extends React.Component {
19933
20033
  userCurrency: userCurrency,
19934
20034
  userCountry: userCountry,
19935
20035
  userLanguage: userLanguage,
19936
- siteLanguage: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$help = _window$Pelcro10.helpers) === null || _window$Pelcro10$help === void 0 ? void 0 : _window$Pelcro10$help.getHtmlLanguageAttribute(),
19937
- products: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read().products.length,
20036
+ siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
20037
+ products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
19938
20038
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
19939
20039
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
19940
20040
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -20312,27 +20412,40 @@ class SelectModal extends React.Component {
20312
20412
  this.locale = this.props.t;
20313
20413
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
20314
20414
  this.productsTabRef = /*#__PURE__*/React__default['default'].createRef();
20415
+ this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro11 = _window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$uiSe = _window$Pelcro11.uiSettings) === null || _window$Pelcro11$uiSe === void 0 ? void 0 : _window$Pelcro11$uiSe.enableReactGA4;
20315
20416
  }
20316
20417
 
20317
20418
  render() {
20318
20419
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
20319
20420
 
20320
20421
  if (this.state.mode === "product") {
20321
- var _ReactGA$event;
20422
+ if (this.enableReactGA4) {
20423
+ ReactGA4.event("Product Modal Viewed", {
20424
+ nonInteraction: true
20425
+ });
20426
+ } else {
20427
+ var _ReactGA$event;
20322
20428
 
20323
- 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, {
20324
- category: "VIEWS",
20325
- action: "Product Modal Viewed",
20326
- nonInteraction: true
20327
- });
20429
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20430
+ category: "VIEWS",
20431
+ action: "Product Modal Viewed",
20432
+ nonInteraction: true
20433
+ });
20434
+ }
20328
20435
  } else if (this.state.mode === "plan") {
20329
- var _ReactGA$event2;
20436
+ if (this.enableReactGA4) {
20437
+ ReactGA4.event("Plan Modal Viewed", {
20438
+ nonInteraction: true
20439
+ });
20440
+ } else {
20441
+ var _ReactGA$event2;
20330
20442
 
20331
- ReactGA$8 === null || ReactGA$8 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$8.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$8, {
20332
- category: "VIEWS",
20333
- action: "Plan Modal Viewed",
20334
- nonInteraction: true
20335
- });
20443
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
20444
+ category: "VIEWS",
20445
+ action: "Plan Modal Viewed",
20446
+ nonInteraction: true
20447
+ });
20448
+ }
20336
20449
  }
20337
20450
 
20338
20451
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -25295,8 +25408,6 @@ const SubscriptionRenewView = ({
25295
25408
  }));
25296
25409
  };
25297
25410
 
25298
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
25299
- 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;
25300
25411
  /**
25301
25412
  *
25302
25413
  */
@@ -25306,34 +25417,55 @@ function SubscriptionRenewModal({
25306
25417
  onClose,
25307
25418
  ...otherProps
25308
25419
  }) {
25309
- var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
25420
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
25310
25421
 
25311
25422
  const {
25312
25423
  product,
25313
25424
  switchView
25314
25425
  } = usePelcro();
25426
+ 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;
25315
25427
 
25316
25428
  const onSuccess = res => {
25317
- var _otherProps$onSuccess, _ReactGA$event;
25429
+ var _otherProps$onSuccess;
25318
25430
 
25319
25431
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
25320
- 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, {
25321
- category: "ACTIONS",
25322
- action: "Renewed",
25323
- nonInteraction: true
25324
- });
25432
+
25433
+ if (enableReactGA4) {
25434
+ ReactGA4.event("Renewed", {
25435
+ nonInteraction: true
25436
+ });
25437
+ } else {
25438
+ var _ReactGA$event;
25439
+
25440
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25441
+ category: "ACTIONS",
25442
+ action: "Renewed",
25443
+ nonInteraction: true
25444
+ });
25445
+ }
25446
+
25325
25447
  return switchView("subscription-success");
25326
25448
  };
25327
25449
 
25328
25450
  const onGiftRenewalSuccess = () => {
25329
- var _otherProps$onGiftRen, _ReactGA$event2;
25451
+ var _otherProps$onGiftRen;
25330
25452
 
25331
25453
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
25332
- 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, {
25333
- category: "ACTIONS",
25334
- action: "Renewed Gift",
25335
- nonInteraction: true
25336
- });
25454
+
25455
+ if (enableReactGA4) {
25456
+ ReactGA4.event("Renewed Gift", {
25457
+ nonInteraction: true
25458
+ });
25459
+ } else {
25460
+ var _ReactGA$event2;
25461
+
25462
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
25463
+ category: "ACTIONS",
25464
+ action: "Renewed Gift",
25465
+ nonInteraction: true
25466
+ });
25467
+ }
25468
+
25337
25469
  return switchView("subscription-success");
25338
25470
  };
25339
25471
 
@@ -25516,8 +25648,6 @@ function SvgSubscription(props) {
25516
25648
  }))))));
25517
25649
  }
25518
25650
 
25519
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
25520
- 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;
25521
25651
  const SubscriptionCancelNowButton = ({
25522
25652
  subscription,
25523
25653
  onClick,
@@ -25537,6 +25667,9 @@ const SubscriptionCancelNowButton = ({
25537
25667
  } = useTranslation("subscriptionCancel");
25538
25668
 
25539
25669
  const cancelSubscription = (payload, onSuccess, onFailure) => {
25670
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25671
+
25672
+ 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;
25540
25673
  window.Pelcro.subscription.cancel({
25541
25674
  auth_token: window.Pelcro.user.read().auth_token,
25542
25675
  subscription_id: payload.subscription_id,
@@ -25545,17 +25678,24 @@ const SubscriptionCancelNowButton = ({
25545
25678
  reason: payload.reason
25546
25679
  })
25547
25680
  }, (err, res) => {
25548
- var _ReactGA$event;
25549
-
25550
25681
  if (err) {
25551
25682
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25552
25683
  }
25553
25684
 
25554
- 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, {
25555
- category: "ACTIONS",
25556
- action: "Canceled",
25557
- nonInteraction: true
25558
- });
25685
+ if (enableReactGA4) {
25686
+ ReactGA4.event("Canceled", {
25687
+ nonInteraction: true
25688
+ });
25689
+ } else {
25690
+ var _ReactGA$event;
25691
+
25692
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25693
+ category: "ACTIONS",
25694
+ action: "Canceled",
25695
+ nonInteraction: true
25696
+ });
25697
+ }
25698
+
25559
25699
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25560
25700
  });
25561
25701
  };
@@ -25568,9 +25708,9 @@ const SubscriptionCancelNowButton = ({
25568
25708
  reason: cancelationReason
25569
25709
  })
25570
25710
  };
25571
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
25711
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25572
25712
 
25573
- switchView(null); //Show confirmation alert after closing the modal
25713
+ switchView(null); // Show confirmation alert after closing the modal
25574
25714
 
25575
25715
  notify.confirm((onSuccess, onFailure) => {
25576
25716
  cancelSubscription(payload, onSuccess, onFailure);
@@ -25590,8 +25730,6 @@ const SubscriptionCancelNowButton = ({
25590
25730
  }, t("messages.cancelNow"));
25591
25731
  };
25592
25732
 
25593
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
25594
- 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;
25595
25733
  const SubscriptionCancelLaterButton = ({
25596
25734
  subscription,
25597
25735
  onClick,
@@ -25611,6 +25749,9 @@ const SubscriptionCancelLaterButton = ({
25611
25749
  } = useTranslation("subscriptionCancel");
25612
25750
 
25613
25751
  const cancelSubscription = (payload, onSuccess, onFailure) => {
25752
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25753
+
25754
+ 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;
25614
25755
  window.Pelcro.subscription.cancel({
25615
25756
  auth_token: window.Pelcro.user.read().auth_token,
25616
25757
  subscription_id: payload.subscription_id,
@@ -25619,17 +25760,24 @@ const SubscriptionCancelLaterButton = ({
25619
25760
  reason: payload.reason
25620
25761
  })
25621
25762
  }, (err, res) => {
25622
- var _ReactGA$event;
25623
-
25624
25763
  if (err) {
25625
25764
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25626
25765
  }
25627
25766
 
25628
- 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, {
25629
- category: "ACTIONS",
25630
- action: "Canceled",
25631
- nonInteraction: true
25632
- });
25767
+ if (enableReactGA4) {
25768
+ ReactGA4.event("Canceled", {
25769
+ nonInteraction: true
25770
+ });
25771
+ } else {
25772
+ var _ReactGA$event;
25773
+
25774
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25775
+ category: "ACTIONS",
25776
+ action: "Canceled",
25777
+ nonInteraction: true
25778
+ });
25779
+ }
25780
+
25633
25781
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25634
25782
  });
25635
25783
  };
@@ -25642,9 +25790,9 @@ const SubscriptionCancelLaterButton = ({
25642
25790
  reason: cancelationReason
25643
25791
  })
25644
25792
  };
25645
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
25793
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25646
25794
 
25647
- switchView(null); //Show confirmation alert after closing the modal
25795
+ switchView(null); // Show confirmation alert after closing the modal
25648
25796
 
25649
25797
  notify.confirm((onSuccess, onFailure) => {
25650
25798
  cancelSubscription(payload, onSuccess, onFailure);
@@ -25841,13 +25989,13 @@ const SubscriptionSuspendDate = props => {
25841
25989
  }, props));
25842
25990
  };
25843
25991
 
25844
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
25845
- 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;
25846
25992
  const SubscriptionSuspendButton = ({
25847
25993
  subscription,
25848
25994
  onClick,
25849
25995
  className
25850
25996
  }) => {
25997
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25998
+
25851
25999
  const {
25852
26000
  switchView
25853
26001
  } = usePelcro();
@@ -25861,6 +26009,7 @@ const SubscriptionSuspendButton = ({
25861
26009
  const {
25862
26010
  t
25863
26011
  } = useTranslation("subscriptionSuspend");
26012
+ 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;
25864
26013
 
25865
26014
  const suspendSubscription = (payload, onSuccess, onFailure) => {
25866
26015
  window.Pelcro.subscription.update({
@@ -25869,17 +26018,24 @@ const SubscriptionSuspendButton = ({
25869
26018
  suspend: 1,
25870
26019
  shipments_suspended_until: suspendDate
25871
26020
  }, (err, res) => {
25872
- var _ReactGA$event;
25873
-
25874
26021
  if (err) {
25875
26022
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25876
26023
  }
25877
26024
 
25878
- 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, {
25879
- category: "ACTIONS",
25880
- action: "Suspended",
25881
- nonInteraction: true
25882
- });
26025
+ if (enableReactGA4) {
26026
+ ReactGA4.event("Suspended", {
26027
+ nonInteraction: true
26028
+ });
26029
+ } else {
26030
+ var _ReactGA$event;
26031
+
26032
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
26033
+ category: "ACTIONS",
26034
+ action: "Suspended",
26035
+ nonInteraction: true
26036
+ });
26037
+ }
26038
+
25883
26039
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25884
26040
  });
25885
26041
  };
@@ -25888,9 +26044,9 @@ const SubscriptionSuspendButton = ({
25888
26044
  const payload = {
25889
26045
  subscription_id: subscription.id
25890
26046
  };
25891
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
26047
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25892
26048
 
25893
- switchView(null); //Show confirmation alert after closing the modal
26049
+ switchView(null); // Show confirmation alert after closing the modal
25894
26050
 
25895
26051
  notify.confirm((onSuccess, onFailure) => {
25896
26052
  suspendSubscription(payload, onSuccess, onFailure);
@@ -28766,8 +28922,6 @@ const AddressCreateLine2 = props => {
28766
28922
  }, props));
28767
28923
  };
28768
28924
 
28769
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
28770
- 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;
28771
28925
  const initialState$e = {
28772
28926
  isSubmitting: false,
28773
28927
  firstName: "",
@@ -28808,12 +28962,13 @@ const AddressUpdateContainer = ({
28808
28962
  children,
28809
28963
  ...props
28810
28964
  }) => {
28811
- var _props$addressId;
28965
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
28812
28966
 
28813
28967
  const {
28814
28968
  addressIdToEdit
28815
28969
  } = usePelcro();
28816
28970
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
28971
+ 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;
28817
28972
  const [t] = useTranslation("address");
28818
28973
  React.useEffect(() => {
28819
28974
  const getCountries = () => {
@@ -28907,8 +29062,6 @@ const AddressUpdateContainer = ({
28907
29062
  });
28908
29063
  onFailure(err);
28909
29064
  } else {
28910
- var _ReactGA$event;
28911
-
28912
29065
  dispatch({
28913
29066
  type: SHOW_ALERT,
28914
29067
  payload: {
@@ -28917,11 +29070,20 @@ const AddressUpdateContainer = ({
28917
29070
  }
28918
29071
  });
28919
29072
  onSuccess(res);
28920
- 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, {
28921
- category: "ACTIONS",
28922
- action: "Updated address",
28923
- nonInteraction: true
28924
- });
29073
+
29074
+ if (enableReactGA4) {
29075
+ ReactGA4.event("Updated address", {
29076
+ nonInteraction: true
29077
+ });
29078
+ } else {
29079
+ var _ReactGA$event;
29080
+
29081
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29082
+ category: "ACTIONS",
29083
+ action: "Updated address",
29084
+ nonInteraction: true
29085
+ });
29086
+ }
28925
29087
  }
28926
29088
  });
28927
29089
  };
@@ -29462,22 +29624,32 @@ function PaymentMethodUpdateView(props) {
29462
29624
  }));
29463
29625
  }
29464
29626
 
29465
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
29466
- 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;
29467
29627
  const PaymentMethodUpdateModal = props => {
29628
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29629
+
29468
29630
  const {
29469
29631
  t
29470
29632
  } = useTranslation("paymentMethod");
29633
+ 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;
29471
29634
 
29472
29635
  const onSuccess = res => {
29473
- var _props$onSuccess, _ReactGA$event;
29636
+ var _props$onSuccess;
29474
29637
 
29475
29638
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
29476
- 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, {
29477
- category: "ACTIONS",
29478
- action: "Updated payment card",
29479
- nonInteraction: true
29480
- });
29639
+
29640
+ if (enableReactGA4) {
29641
+ ReactGA4.event("Updated payment card", {
29642
+ nonInteraction: true
29643
+ });
29644
+ } else {
29645
+ var _ReactGA$event;
29646
+
29647
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29648
+ category: "ACTIONS",
29649
+ action: "Updated payment card",
29650
+ nonInteraction: true
29651
+ });
29652
+ }
29481
29653
  };
29482
29654
 
29483
29655
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -32260,8 +32432,7 @@ const PaymentMethodSelectModal = ({
32260
32432
  };
32261
32433
  PaymentMethodSelectModal.viewId = "payment-method-select";
32262
32434
 
32263
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1, _window$Pelcro$user$r, _window$Pelcro$user$r2;
32264
- 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;
32435
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2;
32265
32436
  const initialState$4 = {
32266
32437
  isOpen: false,
32267
32438
  activeDashboardLink: null,
@@ -32282,12 +32453,13 @@ const DashboardContainer = ({
32282
32453
  children,
32283
32454
  ...props
32284
32455
  }) => {
32456
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
32457
+
32285
32458
  const {
32286
32459
  t
32287
32460
  } = useTranslation("dashboard");
32461
+ 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;
32288
32462
  React.useEffect(() => {
32289
- var _ReactGA$event;
32290
-
32291
32463
  dispatch({
32292
32464
  type: SET_IS_OPEN,
32293
32465
  payload: true
@@ -32295,11 +32467,21 @@ const DashboardContainer = ({
32295
32467
  window.Pelcro.insight.track("Modal Displayed", {
32296
32468
  name: "dashboard"
32297
32469
  });
32298
- 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, {
32299
- category: "VIEWS",
32300
- action: "Dashboard Modal Viewed",
32301
- nonInteraction: true
32302
- });
32470
+
32471
+ if (enableReactGA4) {
32472
+ ReactGA4.event("Dashboard Modal Viewed", {
32473
+ nonInteraction: true
32474
+ });
32475
+ } else {
32476
+ var _ReactGA$event;
32477
+
32478
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
32479
+ category: "VIEWS",
32480
+ action: "Dashboard Modal Viewed",
32481
+ nonInteraction: true
32482
+ });
32483
+ }
32484
+
32303
32485
  const {
32304
32486
  addresses
32305
32487
  } = window.Pelcro.user.read();
@@ -32324,8 +32506,6 @@ const DashboardContainer = ({
32324
32506
  auth_token: window.Pelcro.user.read().auth_token,
32325
32507
  subscription_id: subscription_id
32326
32508
  }, (err, res) => {
32327
- var _ReactGA$event2;
32328
-
32329
32509
  dispatch({
32330
32510
  type: SET_DISABLESUBMIT,
32331
32511
  payload: false
@@ -32335,11 +32515,20 @@ const DashboardContainer = ({
32335
32515
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
32336
32516
  }
32337
32517
 
32338
- ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$1.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$1, {
32339
- category: "ACTIONS",
32340
- action: "Canceled",
32341
- nonInteraction: true
32342
- });
32518
+ if (enableReactGA4) {
32519
+ ReactGA4.event("Canceled", {
32520
+ nonInteraction: true
32521
+ });
32522
+ } else {
32523
+ var _ReactGA$event2;
32524
+
32525
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
32526
+ category: "ACTIONS",
32527
+ action: "Canceled",
32528
+ nonInteraction: true
32529
+ });
32530
+ }
32531
+
32343
32532
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
32344
32533
  });
32345
32534
  };
@@ -32360,8 +32549,6 @@ const DashboardContainer = ({
32360
32549
  subscription_id: subscription_id,
32361
32550
  suspend: 0
32362
32551
  }, (err, res) => {
32363
- var _ReactGA$event3;
32364
-
32365
32552
  dispatch({
32366
32553
  type: SET_DISABLESUBMIT,
32367
32554
  payload: false
@@ -32371,11 +32558,20 @@ const DashboardContainer = ({
32371
32558
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
32372
32559
  }
32373
32560
 
32374
- ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event3 = ReactGA$1.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA$1, {
32375
- category: "ACTIONS",
32376
- action: "UnSuspended",
32377
- nonInteraction: true
32378
- });
32561
+ if (enableReactGA4) {
32562
+ ReactGA4.event("UnSuspended", {
32563
+ nonInteraction: true
32564
+ });
32565
+ } else {
32566
+ var _ReactGA$event3;
32567
+
32568
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
32569
+ category: "ACTIONS",
32570
+ action: "UnSuspended",
32571
+ nonInteraction: true
32572
+ });
32573
+ }
32574
+
32379
32575
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
32380
32576
  });
32381
32577
  };
@@ -33623,8 +33819,6 @@ const Card = ({
33623
33819
  }, "Failed"))), children);
33624
33820
  };
33625
33821
 
33626
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
33627
- 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;
33628
33822
  const SavedItemsMenu = () => {
33629
33823
  const {
33630
33824
  t
@@ -33655,8 +33849,11 @@ const SavedItems = ({
33655
33849
  } = usePelcro();
33656
33850
 
33657
33851
  const removeItemFromMetadata = (category, title) => {
33852
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
33853
+
33658
33854
  const user = window.Pelcro.user.read();
33659
33855
  const oldValue = user.metadata[`metadata_saved_${category}`];
33856
+ 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;
33660
33857
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
33661
33858
 
33662
33859
  if (isAuthenticated()) {
@@ -33666,7 +33863,7 @@ const SavedItems = ({
33666
33863
  value: newMetadataValue,
33667
33864
  auth_token: window.Pelcro.user.read().auth_token
33668
33865
  }, (error, response) => {
33669
- var _response$data, _ReactGA$event;
33866
+ var _response$data;
33670
33867
 
33671
33868
  setLoading(false);
33672
33869
 
@@ -33675,11 +33872,20 @@ const SavedItems = ({
33675
33872
  }
33676
33873
 
33677
33874
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
33678
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
33679
- category: "ACTIONS",
33680
- action: "Unsave/Unfollow",
33681
- label: title
33682
- });
33875
+
33876
+ if (enableReactGA4) {
33877
+ ReactGA4.event("Unsave/Unfollow", {
33878
+ event_label: title
33879
+ });
33880
+ } else {
33881
+ var _ReactGA$event;
33882
+
33883
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
33884
+ category: "ACTIONS",
33885
+ action: "Unsave/Unfollow",
33886
+ label: title
33887
+ });
33888
+ }
33683
33889
  });
33684
33890
  }
33685
33891
  };