@pelcro/react-pelcro-js 3.26.0 → 3.26.1

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
@@ -8193,7 +8193,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8193
8193
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8194
8194
  OutboundLink$1.trackLink = outboundLink;
8195
8195
  var OutboundLink = OutboundLink$1;
8196
- var ReactGA1 = _objectSpread({}, Defaults, {
8196
+ var ReactGA = _objectSpread({}, Defaults, {
8197
8197
  OutboundLink: OutboundLink
8198
8198
  });
8199
8199
 
@@ -8732,8 +8732,6 @@ exports["default"] = _default;
8732
8732
  var ReactGA4 = unwrapExports(dist);
8733
8733
  dist.ReactGAImplementation;
8734
8734
 
8735
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8736
- 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;
8737
8735
  class PelcroActions {
8738
8736
  constructor(storeSetter, storeGetter) {
8739
8737
  var _this = this;
@@ -8913,23 +8911,31 @@ class PelcroActions {
8913
8911
  });
8914
8912
  });
8915
8913
  _defineProperty$3(this, "logout", function () {
8916
- var _ReactGA$event;
8914
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
8917
8915
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8918
8916
  const {
8919
8917
  switchView,
8920
8918
  resetView,
8921
8919
  isAuthenticated
8922
8920
  } = _this.get();
8921
+ 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;
8923
8922
  // if user is not authenticated function execution is terminated
8924
8923
  if (!isAuthenticated()) {
8925
8924
  return console.warn("You are already logged out.");
8926
8925
  }
8927
8926
  window.Pelcro.user.logout();
8928
- 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, {
8929
- category: "ACTIONS",
8930
- action: "Logged out",
8931
- nonInteraction: true
8932
- });
8927
+ if (enableReactGA4) {
8928
+ ReactGA4.event("Logged out", {
8929
+ nonInteraction: true
8930
+ });
8931
+ } else {
8932
+ var _ReactGA$event;
8933
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
8934
+ category: "ACTIONS",
8935
+ action: "Logged out",
8936
+ nonInteraction: true
8937
+ });
8938
+ }
8933
8939
  resetView();
8934
8940
  if (displayLogin) {
8935
8941
  switchView("login");
@@ -8942,7 +8948,7 @@ class PelcroActions {
8942
8948
  return false;
8943
8949
  }
8944
8950
 
8945
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
8951
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
8946
8952
  document.dispatchEvent(cartItemAdded(itemToAdd));
8947
8953
  const {
8948
8954
  cartItems
@@ -9151,9 +9157,6 @@ if (process.env.NODE_ENV === "development") {
9151
9157
  c$1("Pelcro Store", usePelcro);
9152
9158
  }
9153
9159
 
9154
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9155
- 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;
9156
-
9157
9160
  /**
9158
9161
  * List of zero-decimal currencies.
9159
9162
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9239,8 +9242,8 @@ const getLanguageWithoutRegion = localeName => {
9239
9242
  * @return {string | undefined}
9240
9243
  */
9241
9244
  const getPageOrDefaultLanguage = () => {
9242
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9243
- 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);
9245
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9246
+ 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);
9244
9247
  };
9245
9248
 
9246
9249
  /**
@@ -9293,9 +9296,9 @@ const isValidViewFromURL = viewID => {
9293
9296
  *
9294
9297
  */
9295
9298
  function hasValidNewsletterUpdateUrl() {
9296
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9299
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9297
9300
  if (viewID !== "newsletter-update") return false;
9298
- 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;
9301
+ 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;
9299
9302
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9300
9303
  if (!siteHasNewslettersDefined) {
9301
9304
  return false;
@@ -9341,7 +9344,7 @@ const disableScroll = () => {
9341
9344
  }
9342
9345
  };
9343
9346
  const trackSubscriptionOnGA = () => {
9344
- 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;
9347
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9345
9348
  const {
9346
9349
  product,
9347
9350
  plan,
@@ -9356,33 +9359,56 @@ const trackSubscriptionOnGA = () => {
9356
9359
  invoices
9357
9360
  } = window.Pelcro.user.read();
9358
9361
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9362
+ 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;
9359
9363
  if (!lastSubscriptionId) {
9360
9364
  return;
9361
9365
  }
9362
9366
  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;
9363
- 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, {
9364
- currencyCode: currencyCode
9365
- });
9366
- 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", {
9367
- id: lastSubscriptionId,
9368
- affiliation: "Pelcro",
9369
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9370
- coupon: couponCode
9371
- });
9372
- 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", {
9373
- id: lastSubscriptionId,
9374
- name: product.name,
9375
- category: product.description,
9376
- variant: plan.nickname,
9377
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9378
- quantity: 1
9379
- });
9380
- 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");
9381
- 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, {
9382
- category: "ACTIONS",
9383
- action: "Subscribed",
9384
- nonInteraction: true
9385
- });
9367
+ if (enableReactGA4) {
9368
+ ReactGA4.event("purchase", {
9369
+ transaction_id: lastSubscriptionId,
9370
+ affiliation: "Pelcro",
9371
+ currency: currencyCode,
9372
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9373
+ coupon: couponCode,
9374
+ items: [{
9375
+ item_id: lastSubscriptionId,
9376
+ item_name: product.name,
9377
+ item_category: product.description,
9378
+ item_variant: plan.nickname,
9379
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9380
+ quantity: 1
9381
+ }]
9382
+ });
9383
+ ReactGA4.event("Subscribed", {
9384
+ nonInteraction: true
9385
+ });
9386
+ } else {
9387
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9388
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9389
+ currencyCode: currencyCode
9390
+ });
9391
+ 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", {
9392
+ id: lastSubscriptionId,
9393
+ affiliation: "Pelcro",
9394
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9395
+ coupon: couponCode
9396
+ });
9397
+ 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", {
9398
+ id: lastSubscriptionId,
9399
+ name: product.name,
9400
+ category: product.description,
9401
+ variant: plan.nickname,
9402
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9403
+ quantity: 1
9404
+ });
9405
+ 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");
9406
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9407
+ category: "ACTIONS",
9408
+ action: "Subscribed",
9409
+ nonInteraction: true
9410
+ });
9411
+ }
9386
9412
  };
9387
9413
 
9388
9414
  /** check wether or not the user have any existing payment method
@@ -9466,14 +9492,14 @@ function getDateWithoutTime(dateObject) {
9466
9492
  return date;
9467
9493
  }
9468
9494
  function userMustVerifyEmail() {
9469
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9470
- 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;
9495
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9496
+ 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;
9471
9497
  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;
9472
9498
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9473
9499
  }
9474
9500
  function notifyBugsnag(callback, startOptions) {
9475
9501
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9476
- //load bugsnag CDN
9502
+ // load bugsnag CDN
9477
9503
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9478
9504
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9479
9505
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -9652,10 +9678,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
9652
9678
  return descriptor.value;
9653
9679
  }
9654
9680
 
9655
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
9656
9681
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
9657
9682
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9658
- 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;
9659
9683
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
9660
9684
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
9661
9685
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -9739,7 +9763,7 @@ class SaveToMetadataButtonClass {
9739
9763
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
9740
9764
  writable: true,
9741
9765
  value: event => {
9742
- var _user$metadata;
9766
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
9743
9767
  const button = event.currentTarget;
9744
9768
  const user = window.Pelcro.user.read();
9745
9769
  const {
@@ -9749,6 +9773,7 @@ class SaveToMetadataButtonClass {
9749
9773
  key,
9750
9774
  ...buttonMetadata
9751
9775
  } = button.dataset;
9776
+ 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;
9752
9777
  if (userMustVerifyEmail()) {
9753
9778
  return switchView("email-verify");
9754
9779
  }
@@ -9773,16 +9798,22 @@ class SaveToMetadataButtonClass {
9773
9798
  value: newMetadataValue,
9774
9799
  auth_token: window.Pelcro.user.read().auth_token
9775
9800
  }, (err, resp) => {
9776
- var _ReactGA$event;
9777
9801
  if (err) {
9778
9802
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
9779
9803
  }
9780
9804
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
9781
- 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, {
9782
- category: "ACTIONS",
9783
- action: "Save/Follow",
9784
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9785
- });
9805
+ if (enableReactGA4) {
9806
+ ReactGA4.event("Save/Follow", {
9807
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9808
+ });
9809
+ } else {
9810
+ var _ReactGA$event;
9811
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9812
+ category: "ACTIONS",
9813
+ action: "Save/Follow",
9814
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9815
+ });
9816
+ }
9786
9817
  });
9787
9818
  }
9788
9819
  }
@@ -9790,6 +9821,7 @@ class SaveToMetadataButtonClass {
9790
9821
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
9791
9822
  writable: true,
9792
9823
  value: event => {
9824
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
9793
9825
  const button = event.currentTarget;
9794
9826
  const user = window.Pelcro.user.read();
9795
9827
  const {
@@ -9797,6 +9829,7 @@ class SaveToMetadataButtonClass {
9797
9829
  title
9798
9830
  } = button.dataset;
9799
9831
  const oldValue = user.metadata[`metadata_saved_${key}`];
9832
+ 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;
9800
9833
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
9801
9834
  if (window.Pelcro.user.isAuthenticated()) {
9802
9835
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -9805,16 +9838,22 @@ class SaveToMetadataButtonClass {
9805
9838
  value: newMetadataValue,
9806
9839
  auth_token: window.Pelcro.user.read().auth_token
9807
9840
  }, (err, resp) => {
9808
- var _ReactGA$event2;
9809
9841
  if (err) {
9810
9842
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
9811
9843
  }
9812
9844
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
9813
- 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, {
9814
- category: "ACTIONS",
9815
- action: "Unsave/Unfollow",
9816
- label: title
9817
- });
9845
+ if (enableReactGA4) {
9846
+ ReactGA4.event("Unsave/Unfollow", {
9847
+ event_label: title
9848
+ });
9849
+ } else {
9850
+ var _ReactGA$event2;
9851
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
9852
+ category: "ACTIONS",
9853
+ action: "Unsave/Unfollow",
9854
+ label: title
9855
+ });
9856
+ }
9818
9857
  });
9819
9858
  }
9820
9859
  }
@@ -11455,9 +11494,6 @@ function getSiteCardProcessor() {
11455
11494
  return "stripe";
11456
11495
  }
11457
11496
 
11458
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11459
- 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;
11460
-
11461
11497
  /**
11462
11498
  * @typedef {Object} OptionsType
11463
11499
  * @property {boolean} loadPaymentSDKs
@@ -11584,17 +11620,44 @@ const initSecuritySdk = () => {
11584
11620
  });
11585
11621
  };
11586
11622
  const initGATracking = () => {
11587
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11588
- 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);
11589
- 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");
11623
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11624
+ 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;
11625
+ if (window.Pelcro.site.read().google_analytics_id) {
11626
+ if (enableReactGA4) {
11627
+ // Initialize ReactGA4 with your tracking ID
11628
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11629
+ // Enable e-commerce tracking
11630
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11631
+ gaOptions: {
11632
+ send_page_view: true,
11633
+ ecommerce: {
11634
+ enabled: true
11635
+ }
11636
+ }
11637
+ });
11638
+ } else {
11639
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11640
+ 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);
11641
+ 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");
11642
+ }
11643
+ }
11590
11644
  };
11591
11645
  const dispatchModalDisplayEvents = modalName => {
11592
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11593
- 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, {
11594
- category: "VIEWS",
11595
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11596
- nonInteraction: true
11597
- });
11646
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11647
+ 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;
11648
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11649
+ if (enableReactGA4) {
11650
+ ReactGA4.event(`${formattedAction} viewed`, {
11651
+ nonInteraction: true
11652
+ });
11653
+ } else {
11654
+ var _ReactGA$event;
11655
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11656
+ category: "VIEWS",
11657
+ action: `${formattedAction} viewed`,
11658
+ nonInteraction: true
11659
+ });
11660
+ }
11598
11661
  window.Pelcro.insight.track("Modal Displayed", {
11599
11662
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11600
11663
  });
@@ -12419,6 +12482,7 @@ const {
12419
12482
  Provider: Provider$m
12420
12483
  } = store$m;
12421
12484
  const LoginContainer = _ref => {
12485
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12422
12486
  let {
12423
12487
  style,
12424
12488
  className = "",
@@ -12426,6 +12490,7 @@ const LoginContainer = _ref => {
12426
12490
  onFailure = () => {},
12427
12491
  children
12428
12492
  } = _ref;
12493
+ 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;
12429
12494
  const handleLogin = (_ref2, dispatch) => {
12430
12495
  let {
12431
12496
  email,
@@ -12455,13 +12520,19 @@ const LoginContainer = _ref => {
12455
12520
  });
12456
12521
  onFailure(err);
12457
12522
  } else {
12458
- var _ReactGA$event;
12459
12523
  onSuccess(res);
12460
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12461
- category: "ACTIONS",
12462
- action: "Logged in",
12463
- nonInteraction: true
12464
- });
12524
+ if (enableReactGA4) {
12525
+ ReactGA4.event("Logged in", {
12526
+ nonInteraction: true
12527
+ });
12528
+ } else {
12529
+ var _ReactGA$event;
12530
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12531
+ category: "ACTIONS",
12532
+ action: "Logged in",
12533
+ nonInteraction: true
12534
+ });
12535
+ }
12465
12536
  }
12466
12537
  });
12467
12538
  };
@@ -12847,17 +12918,23 @@ function ConfirmPassword(_ref) {
12847
12918
  }, otherProps));
12848
12919
  }
12849
12920
 
12850
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
12851
- 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;
12852
12921
  const Logout = props => {
12853
12922
  const handleLogout = () => {
12854
- var _ReactGA$event;
12923
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12855
12924
  window.Pelcro.user.logout();
12856
- 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, {
12857
- category: "ACTIONS",
12858
- action: "Logged out",
12859
- nonInteraction: true
12860
- });
12925
+ 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;
12926
+ if (enableReactGA4) {
12927
+ ReactGA4.event("Logged out", {
12928
+ nonInteraction: true
12929
+ });
12930
+ } else {
12931
+ var _ReactGA$event;
12932
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12933
+ category: "ACTIONS",
12934
+ action: "Logged out",
12935
+ nonInteraction: true
12936
+ });
12937
+ }
12861
12938
  };
12862
12939
  return /*#__PURE__*/React__default['default'].createElement("button", {
12863
12940
  name: "logout",
@@ -14415,13 +14492,11 @@ const RegisterCompany = props => {
14415
14492
  }, props));
14416
14493
  };
14417
14494
 
14418
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14419
- 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;
14420
-
14421
14495
  /**
14422
14496
  *
14423
14497
  */
14424
14498
  function RegisterModal(props) {
14499
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14425
14500
  const {
14426
14501
  t
14427
14502
  } = useTranslation("register");
@@ -14436,18 +14511,26 @@ function RegisterModal(props) {
14436
14511
  giftCode,
14437
14512
  isGift
14438
14513
  } = usePelcro();
14514
+ 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;
14439
14515
  const onSuccess = res => {
14440
14516
  var _props$onSuccess;
14441
14517
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
14442
14518
  handleAfterRegistrationLogic();
14443
14519
  };
14444
14520
  const handleAfterRegistrationLogic = () => {
14445
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14446
- 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, {
14447
- category: "ACTIONS",
14448
- action: "Registered",
14449
- nonInteraction: true
14450
- });
14521
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14522
+ if (enableReactGA4) {
14523
+ ReactGA4.event("Registered", {
14524
+ nonInteraction: true
14525
+ });
14526
+ } else {
14527
+ var _ReactGA$event;
14528
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14529
+ category: "ACTIONS",
14530
+ action: "Registered",
14531
+ nonInteraction: true
14532
+ });
14533
+ }
14451
14534
  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;
14452
14535
  if (isEmailVerificationEnabled) {
14453
14536
  return switchView("email-verify");
@@ -14534,9 +14617,6 @@ function Radio(_ref) {
14534
14617
  }, children));
14535
14618
  }
14536
14619
 
14537
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14538
- 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;
14539
-
14540
14620
  /**
14541
14621
  *
14542
14622
  */
@@ -14596,6 +14676,7 @@ function productMatchPageLanguage(product) {
14596
14676
  SelectModalWithHook.viewId = "plan-select";
14597
14677
  class SelectModal extends React.Component {
14598
14678
  constructor(props) {
14679
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
14599
14680
  super(props);
14600
14681
  _defineProperty$3(this, "componentDidMount", () => {
14601
14682
  if (this.props.product) {
@@ -14630,11 +14711,11 @@ class SelectModal extends React.Component {
14630
14711
  }
14631
14712
  document.addEventListener("keydown", this.handleSubmit);
14632
14713
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
14633
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
14634
- 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;
14635
- 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;
14636
- 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;
14637
- 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 => {
14714
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
14715
+ 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;
14716
+ 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;
14717
+ 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;
14718
+ 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 => {
14638
14719
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14639
14720
  if (filteredPlans.length) return filteredPlans;
14640
14721
  });
@@ -14647,12 +14728,12 @@ class SelectModal extends React.Component {
14647
14728
  });
14648
14729
  notifyBugsnag(() => {
14649
14730
  Bugsnag.notify("SelectModal - No data viewed", event => {
14650
- 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;
14731
+ 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;
14651
14732
  event.addMetadata("MetaData", {
14652
- 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(),
14653
- 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(),
14654
- 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,
14655
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
14733
+ 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(),
14734
+ 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(),
14735
+ 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,
14736
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
14656
14737
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
14657
14738
  productListState: this.state.productList,
14658
14739
  methods: {
@@ -14663,8 +14744,8 @@ class SelectModal extends React.Component {
14663
14744
  userCurrency: userCurrency,
14664
14745
  userCountry: userCountry,
14665
14746
  userLanguage: userLanguage,
14666
- 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(),
14667
- 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,
14747
+ 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(),
14748
+ 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,
14668
14749
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14669
14750
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14670
14751
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -14875,6 +14956,7 @@ class SelectModal extends React.Component {
14875
14956
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
14876
14957
  this.locale = this.props.t;
14877
14958
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
14959
+ 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;
14878
14960
  }
14879
14961
  render() {
14880
14962
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -14882,19 +14964,31 @@ class SelectModal extends React.Component {
14882
14964
  disableGifting
14883
14965
  } = this.props;
14884
14966
  if (this.state.mode === "product") {
14885
- var _ReactGA$event;
14886
- 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, {
14887
- category: "VIEWS",
14888
- action: "Product Modal Viewed",
14889
- nonInteraction: true
14890
- });
14967
+ if (this.enableReactGA4) {
14968
+ ReactGA4.event("Product Modal Viewed", {
14969
+ nonInteraction: true
14970
+ });
14971
+ } else {
14972
+ var _ReactGA$event;
14973
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14974
+ category: "VIEWS",
14975
+ action: "Product Modal Viewed",
14976
+ nonInteraction: true
14977
+ });
14978
+ }
14891
14979
  } else if (this.state.mode === "plan") {
14892
- var _ReactGA$event2;
14893
- 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, {
14894
- category: "VIEWS",
14895
- action: "Plan Modal Viewed",
14896
- nonInteraction: true
14897
- });
14980
+ if (this.enableReactGA4) {
14981
+ ReactGA4.event("Plan Modal Viewed", {
14982
+ nonInteraction: true
14983
+ });
14984
+ } else {
14985
+ var _ReactGA$event2;
14986
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
14987
+ category: "VIEWS",
14988
+ action: "Plan Modal Viewed",
14989
+ nonInteraction: true
14990
+ });
14991
+ }
14898
14992
  }
14899
14993
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
14900
14994
  hideCloseButton: !this.closeButton,
@@ -20228,13 +20322,11 @@ const SubscriptionRenewView = _ref => {
20228
20322
  }));
20229
20323
  };
20230
20324
 
20231
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
20232
- 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;
20233
-
20234
20325
  /**
20235
20326
  *
20236
20327
  */
20237
20328
  function SubscriptionRenewModal(_ref) {
20329
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20238
20330
  let {
20239
20331
  onDisplay,
20240
20332
  onClose,
@@ -20243,24 +20335,39 @@ function SubscriptionRenewModal(_ref) {
20243
20335
  const {
20244
20336
  switchView
20245
20337
  } = usePelcro();
20338
+ 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;
20246
20339
  const onSuccess = res => {
20247
- var _otherProps$onSuccess, _ReactGA$event;
20340
+ var _otherProps$onSuccess;
20248
20341
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
20249
- 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, {
20250
- category: "ACTIONS",
20251
- action: "Renewed",
20252
- nonInteraction: true
20253
- });
20342
+ if (enableReactGA4) {
20343
+ ReactGA4.event("Renewed", {
20344
+ nonInteraction: true
20345
+ });
20346
+ } else {
20347
+ var _ReactGA$event;
20348
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20349
+ category: "ACTIONS",
20350
+ action: "Renewed",
20351
+ nonInteraction: true
20352
+ });
20353
+ }
20254
20354
  return switchView("subscription-success");
20255
20355
  };
20256
20356
  const onGiftRenewalSuccess = () => {
20257
- var _otherProps$onGiftRen, _ReactGA$event2;
20357
+ var _otherProps$onGiftRen;
20258
20358
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
20259
- 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, {
20260
- category: "ACTIONS",
20261
- action: "Renewed Gift",
20262
- nonInteraction: true
20263
- });
20359
+ if (enableReactGA4) {
20360
+ ReactGA4.event("Renewed Gift", {
20361
+ nonInteraction: true
20362
+ });
20363
+ } else {
20364
+ var _ReactGA$event2;
20365
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
20366
+ category: "ACTIONS",
20367
+ action: "Renewed Gift",
20368
+ nonInteraction: true
20369
+ });
20370
+ }
20264
20371
  return switchView("subscription-success");
20265
20372
  };
20266
20373
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -20430,8 +20537,6 @@ function SvgSubscription(props) {
20430
20537
  }))))));
20431
20538
  }
20432
20539
 
20433
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
20434
- 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;
20435
20540
  const SubscriptionCancelNowButton = _ref => {
20436
20541
  let {
20437
20542
  subscription,
@@ -20451,6 +20556,8 @@ const SubscriptionCancelNowButton = _ref => {
20451
20556
  t
20452
20557
  } = useTranslation("subscriptionCancel");
20453
20558
  const cancelSubscription = (payload, onSuccess, onFailure) => {
20559
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20560
+ 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;
20454
20561
  window.Pelcro.subscription.cancel({
20455
20562
  auth_token: window.Pelcro.user.read().auth_token,
20456
20563
  subscription_id: payload.subscription_id,
@@ -20459,15 +20566,21 @@ const SubscriptionCancelNowButton = _ref => {
20459
20566
  reason: payload.reason
20460
20567
  })
20461
20568
  }, (err, res) => {
20462
- var _ReactGA$event;
20463
20569
  if (err) {
20464
20570
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20465
20571
  }
20466
- 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, {
20467
- category: "ACTIONS",
20468
- action: "Canceled",
20469
- nonInteraction: true
20470
- });
20572
+ if (enableReactGA4) {
20573
+ ReactGA4.event("Canceled", {
20574
+ nonInteraction: true
20575
+ });
20576
+ } else {
20577
+ var _ReactGA$event;
20578
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20579
+ category: "ACTIONS",
20580
+ action: "Canceled",
20581
+ nonInteraction: true
20582
+ });
20583
+ }
20471
20584
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20472
20585
  });
20473
20586
  };
@@ -20481,10 +20594,10 @@ const SubscriptionCancelNowButton = _ref => {
20481
20594
  };
20482
20595
  onClick === null || onClick === void 0 ? void 0 : onClick();
20483
20596
 
20484
- //Close the modal
20597
+ // Close the modal
20485
20598
  switchView(null);
20486
20599
 
20487
- //Show confirmation alert after closing the modal
20600
+ // Show confirmation alert after closing the modal
20488
20601
  notify$1.confirm((onSuccess, onFailure) => {
20489
20602
  cancelSubscription(payload, onSuccess, onFailure);
20490
20603
  }, {
@@ -20502,8 +20615,6 @@ const SubscriptionCancelNowButton = _ref => {
20502
20615
  }, t("messages.cancelNow"));
20503
20616
  };
20504
20617
 
20505
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
20506
- 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;
20507
20618
  const SubscriptionCancelLaterButton = _ref => {
20508
20619
  let {
20509
20620
  subscription,
@@ -20523,6 +20634,8 @@ const SubscriptionCancelLaterButton = _ref => {
20523
20634
  t
20524
20635
  } = useTranslation("subscriptionCancel");
20525
20636
  const cancelSubscription = (payload, onSuccess, onFailure) => {
20637
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20638
+ 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;
20526
20639
  window.Pelcro.subscription.cancel({
20527
20640
  auth_token: window.Pelcro.user.read().auth_token,
20528
20641
  subscription_id: payload.subscription_id,
@@ -20531,15 +20644,21 @@ const SubscriptionCancelLaterButton = _ref => {
20531
20644
  reason: payload.reason
20532
20645
  })
20533
20646
  }, (err, res) => {
20534
- var _ReactGA$event;
20535
20647
  if (err) {
20536
20648
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20537
20649
  }
20538
- 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, {
20539
- category: "ACTIONS",
20540
- action: "Canceled",
20541
- nonInteraction: true
20542
- });
20650
+ if (enableReactGA4) {
20651
+ ReactGA4.event("Canceled", {
20652
+ nonInteraction: true
20653
+ });
20654
+ } else {
20655
+ var _ReactGA$event;
20656
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20657
+ category: "ACTIONS",
20658
+ action: "Canceled",
20659
+ nonInteraction: true
20660
+ });
20661
+ }
20543
20662
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20544
20663
  });
20545
20664
  };
@@ -20553,10 +20672,10 @@ const SubscriptionCancelLaterButton = _ref => {
20553
20672
  };
20554
20673
  onClick === null || onClick === void 0 ? void 0 : onClick();
20555
20674
 
20556
- //Close the modal
20675
+ // Close the modal
20557
20676
  switchView(null);
20558
20677
 
20559
- //Show confirmation alert after closing the modal
20678
+ // Show confirmation alert after closing the modal
20560
20679
  notify$1.confirm((onSuccess, onFailure) => {
20561
20680
  cancelSubscription(payload, onSuccess, onFailure);
20562
20681
  }, {
@@ -20744,9 +20863,8 @@ const SubscriptionSuspendDate = props => {
20744
20863
  }, props));
20745
20864
  };
20746
20865
 
20747
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
20748
- 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;
20749
20866
  const SubscriptionSuspendButton = _ref => {
20867
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20750
20868
  let {
20751
20869
  subscription,
20752
20870
  onClick,
@@ -20765,6 +20883,7 @@ const SubscriptionSuspendButton = _ref => {
20765
20883
  const {
20766
20884
  t
20767
20885
  } = useTranslation("subscriptionSuspend");
20886
+ 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;
20768
20887
  const suspendSubscription = (payload, onSuccess, onFailure) => {
20769
20888
  window.Pelcro.subscription.update({
20770
20889
  auth_token: window.Pelcro.user.read().auth_token,
@@ -20772,15 +20891,21 @@ const SubscriptionSuspendButton = _ref => {
20772
20891
  suspend: 1,
20773
20892
  shipments_suspended_until: suspendDate
20774
20893
  }, (err, res) => {
20775
- var _ReactGA$event;
20776
20894
  if (err) {
20777
20895
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20778
20896
  }
20779
- 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, {
20780
- category: "ACTIONS",
20781
- action: "Suspended",
20782
- nonInteraction: true
20783
- });
20897
+ if (enableReactGA4) {
20898
+ ReactGA4.event("Suspended", {
20899
+ nonInteraction: true
20900
+ });
20901
+ } else {
20902
+ var _ReactGA$event;
20903
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20904
+ category: "ACTIONS",
20905
+ action: "Suspended",
20906
+ nonInteraction: true
20907
+ });
20908
+ }
20784
20909
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20785
20910
  });
20786
20911
  };
@@ -20790,10 +20915,10 @@ const SubscriptionSuspendButton = _ref => {
20790
20915
  };
20791
20916
  onClick === null || onClick === void 0 ? void 0 : onClick();
20792
20917
 
20793
- //Close the modal
20918
+ // Close the modal
20794
20919
  switchView(null);
20795
20920
 
20796
- //Show confirmation alert after closing the modal
20921
+ // Show confirmation alert after closing the modal
20797
20922
  notify$1.confirm((onSuccess, onFailure) => {
20798
20923
  suspendSubscription(payload, onSuccess, onFailure);
20799
20924
  }, {
@@ -23522,7 +23647,7 @@ const {
23522
23647
  Provider: Provider$d
23523
23648
  } = store$d;
23524
23649
  const AddressUpdateContainer = _ref => {
23525
- var _props$addressId;
23650
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
23526
23651
  let {
23527
23652
  style,
23528
23653
  className = "",
@@ -23536,6 +23661,7 @@ const AddressUpdateContainer = _ref => {
23536
23661
  addressIdToEdit
23537
23662
  } = usePelcro();
23538
23663
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
23664
+ 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;
23539
23665
  const [t] = useTranslation("address");
23540
23666
  React.useEffect(() => {
23541
23667
  const getCountries = () => {
@@ -23626,7 +23752,6 @@ const AddressUpdateContainer = _ref => {
23626
23752
  });
23627
23753
  onFailure(err);
23628
23754
  } else {
23629
- var _ReactGA$event;
23630
23755
  dispatch({
23631
23756
  type: SHOW_ALERT,
23632
23757
  payload: {
@@ -23635,11 +23760,18 @@ const AddressUpdateContainer = _ref => {
23635
23760
  }
23636
23761
  });
23637
23762
  onSuccess(res);
23638
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
23639
- category: "ACTIONS",
23640
- action: "Updated address",
23641
- nonInteraction: true
23642
- });
23763
+ if (enableReactGA4) {
23764
+ ReactGA4.event("Updated address", {
23765
+ nonInteraction: true
23766
+ });
23767
+ } else {
23768
+ var _ReactGA$event;
23769
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
23770
+ category: "ACTIONS",
23771
+ action: "Updated address",
23772
+ nonInteraction: true
23773
+ });
23774
+ }
23643
23775
  }
23644
23776
  });
23645
23777
  };
@@ -24163,17 +24295,24 @@ function PaymentMethodUpdateView(props) {
24163
24295
  }));
24164
24296
  }
24165
24297
 
24166
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
24167
- 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;
24168
24298
  const PaymentMethodUpdateModal = props => {
24299
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
24300
+ 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;
24169
24301
  const onSuccess = res => {
24170
- var _props$onSuccess, _ReactGA$event;
24302
+ var _props$onSuccess;
24171
24303
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
24172
- 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, {
24173
- category: "ACTIONS",
24174
- action: "Updated payment card",
24175
- nonInteraction: true
24176
- });
24304
+ if (enableReactGA4) {
24305
+ ReactGA4.event("Updated payment card", {
24306
+ nonInteraction: true
24307
+ });
24308
+ } else {
24309
+ var _ReactGA$event;
24310
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
24311
+ category: "ACTIONS",
24312
+ action: "Updated payment card",
24313
+ nonInteraction: true
24314
+ });
24315
+ }
24177
24316
  };
24178
24317
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
24179
24318
  id: "pelcro-payment-method-update-modal",
@@ -28050,8 +28189,6 @@ const OrderItems = _ref => {
28050
28189
  });
28051
28190
  };
28052
28191
 
28053
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
28054
- 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;
28055
28192
  const SavedItemsMenu = () => {
28056
28193
  const {
28057
28194
  t
@@ -28100,8 +28237,10 @@ const SavedItems = _ref3 => {
28100
28237
  isAuthenticated
28101
28238
  } = usePelcro();
28102
28239
  const removeItemFromMetadata = (category, title) => {
28240
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
28103
28241
  const user = window.Pelcro.user.read();
28104
28242
  const oldValue = user.metadata[`metadata_saved_${category}`];
28243
+ 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;
28105
28244
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
28106
28245
  if (isAuthenticated()) {
28107
28246
  setLoading(true);
@@ -28110,17 +28249,24 @@ const SavedItems = _ref3 => {
28110
28249
  value: newMetadataValue,
28111
28250
  auth_token: window.Pelcro.user.read().auth_token
28112
28251
  }, (error, response) => {
28113
- var _response$data, _ReactGA$event;
28252
+ var _response$data;
28114
28253
  setLoading(false);
28115
28254
  if (error) {
28116
28255
  return;
28117
28256
  }
28118
28257
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
28119
- 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, {
28120
- category: "ACTIONS",
28121
- action: "Unsave/Unfollow",
28122
- label: title
28123
- });
28258
+ if (enableReactGA4) {
28259
+ ReactGA4.event("Unsave/Unfollow", {
28260
+ event_label: title
28261
+ });
28262
+ } else {
28263
+ var _ReactGA$event;
28264
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
28265
+ category: "ACTIONS",
28266
+ action: "Unsave/Unfollow",
28267
+ label: title
28268
+ });
28269
+ }
28124
28270
  });
28125
28271
  }
28126
28272
  };
@@ -29063,8 +29209,6 @@ function getMemberShipStatus(status) {
29063
29209
  };
29064
29210
  }
29065
29211
 
29066
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
29067
- 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;
29068
29212
  const SUB_MENUS = {
29069
29213
  PROFILE: "profile",
29070
29214
  SUBSCRIPTIONS: "subscriptions",
@@ -29119,21 +29263,27 @@ function DashboardWithHook(props) {
29119
29263
  DashboardWithHook.viewId = "dashboard";
29120
29264
  class Dashboard extends React.Component {
29121
29265
  constructor(props) {
29122
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
29266
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
29123
29267
  super(props);
29124
29268
  _defineProperty$3(this, "componentDidMount", () => {
29125
- var _ReactGA$event;
29126
29269
  this.setState({
29127
29270
  isOpen: true
29128
29271
  });
29129
29272
  window.Pelcro.insight.track("Modal Displayed", {
29130
29273
  name: "dashboard"
29131
29274
  });
29132
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29133
- category: "VIEWS",
29134
- action: "Dashboard Modal Viewed",
29135
- nonInteraction: true
29136
- });
29275
+ if (this.enableReactGA4) {
29276
+ ReactGA4.event("Dashboard Modal Viewed", {
29277
+ nonInteraction: true
29278
+ });
29279
+ } else {
29280
+ var _ReactGA$event;
29281
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29282
+ category: "VIEWS",
29283
+ action: "Dashboard Modal Viewed",
29284
+ nonInteraction: true
29285
+ });
29286
+ }
29137
29287
  const {
29138
29288
  addresses
29139
29289
  } = window.Pelcro.user.read();
@@ -29161,15 +29311,21 @@ class Dashboard extends React.Component {
29161
29311
  auth_token: window.Pelcro.user.read().auth_token,
29162
29312
  subscription_id: subscription_id
29163
29313
  }, (err, res) => {
29164
- var _ReactGA$event2;
29165
29314
  if (err) {
29166
29315
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
29167
29316
  }
29168
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
29169
- category: "ACTIONS",
29170
- action: "Canceled",
29171
- nonInteraction: true
29172
- });
29317
+ if (this.enableReactGA4) {
29318
+ ReactGA4.event("Canceled", {
29319
+ nonInteraction: true
29320
+ });
29321
+ } else {
29322
+ var _ReactGA$event2;
29323
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
29324
+ category: "ACTIONS",
29325
+ action: "Canceled",
29326
+ nonInteraction: true
29327
+ });
29328
+ }
29173
29329
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
29174
29330
  });
29175
29331
  });
@@ -29179,15 +29335,21 @@ class Dashboard extends React.Component {
29179
29335
  subscription_id: subscription_id,
29180
29336
  suspend: 0
29181
29337
  }, (err, res) => {
29182
- var _ReactGA$event3;
29183
29338
  if (err) {
29184
29339
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
29185
29340
  }
29186
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
29187
- category: "ACTIONS",
29188
- action: "UnSuspended",
29189
- nonInteraction: true
29190
- });
29341
+ if (this.enableReactGA4) {
29342
+ ReactGA4.event("UnSuspended", {
29343
+ nonInteraction: true
29344
+ });
29345
+ } else {
29346
+ var _ReactGA$event3;
29347
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
29348
+ category: "ACTIONS",
29349
+ action: "UnSuspended",
29350
+ nonInteraction: true
29351
+ });
29352
+ }
29191
29353
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
29192
29354
  });
29193
29355
  });
@@ -29464,6 +29626,7 @@ class Dashboard extends React.Component {
29464
29626
  this.locale = this.props.t;
29465
29627
  this.user = window.Pelcro.user.read();
29466
29628
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
29629
+ this.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;
29467
29630
  }
29468
29631
  render() {
29469
29632
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;