@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.esm.js CHANGED
@@ -8243,7 +8243,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8243
8243
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8244
8244
  OutboundLink$1.trackLink = outboundLink;
8245
8245
  var OutboundLink = OutboundLink$1;
8246
- var ReactGA1 = _objectSpread({}, Defaults, {
8246
+ var ReactGA = _objectSpread({}, Defaults, {
8247
8247
  OutboundLink: OutboundLink
8248
8248
  });
8249
8249
 
@@ -9024,8 +9024,6 @@ exports["default"] = _default;
9024
9024
  var ReactGA4 = unwrapExports(dist);
9025
9025
  dist.ReactGAImplementation;
9026
9026
 
9027
- var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
9028
- 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;
9029
9027
  class PelcroActions {
9030
9028
  constructor(storeSetter, storeGetter) {
9031
9029
  _defineProperty$3(this, "resetState", () => {
@@ -9247,24 +9245,35 @@ class PelcroActions {
9247
9245
  });
9248
9246
 
9249
9247
  _defineProperty$3(this, "logout", (displayLogin = true) => {
9250
- var _ReactGA$event;
9248
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9251
9249
 
9252
9250
  const {
9253
9251
  switchView,
9254
9252
  resetView,
9255
9253
  isAuthenticated
9256
- } = this.get(); // if user is not authenticated function execution is terminated
9254
+ } = this.get();
9255
+ 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
9257
9256
 
9258
9257
  if (!isAuthenticated()) {
9259
9258
  return console.warn("You are already logged out.");
9260
9259
  }
9261
9260
 
9262
9261
  window.Pelcro.user.logout();
9263
- 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, {
9264
- category: "ACTIONS",
9265
- action: "Logged out",
9266
- nonInteraction: true
9267
- });
9262
+
9263
+ if (enableReactGA4) {
9264
+ ReactGA4.event("Logged out", {
9265
+ nonInteraction: true
9266
+ });
9267
+ } else {
9268
+ var _ReactGA$event;
9269
+
9270
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9271
+ category: "ACTIONS",
9272
+ action: "Logged out",
9273
+ nonInteraction: true
9274
+ });
9275
+ }
9276
+
9268
9277
  resetView();
9269
9278
 
9270
9279
  if (displayLogin) {
@@ -9278,7 +9287,7 @@ class PelcroActions {
9278
9287
  if (!itemToAdd) {
9279
9288
  console.error("invalid item SKU id");
9280
9289
  return false;
9281
- } //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9290
+ } // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9282
9291
 
9283
9292
 
9284
9293
  document.dispatchEvent(cartItemAdded(itemToAdd));
@@ -9510,8 +9519,6 @@ if (process.env.NODE_ENV === "development") {
9510
9519
  c$1("Pelcro Store", usePelcro);
9511
9520
  }
9512
9521
 
9513
- var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9514
- 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;
9515
9522
  /**
9516
9523
  * List of zero-decimal currencies.
9517
9524
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9593,9 +9600,9 @@ const getLanguageWithoutRegion = localeName => {
9593
9600
  */
9594
9601
 
9595
9602
  const getPageOrDefaultLanguage = () => {
9596
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9603
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9597
9604
 
9598
- 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);
9605
+ 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);
9599
9606
  };
9600
9607
  /**
9601
9608
  * Returns a formatted price string depending on locale
@@ -9650,10 +9657,10 @@ const isValidViewFromURL = viewID => {
9650
9657
  */
9651
9658
 
9652
9659
  function hasValidNewsletterUpdateUrl() {
9653
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9660
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9654
9661
 
9655
9662
  if (viewID !== "newsletter-update") return false;
9656
- 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;
9663
+ 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;
9657
9664
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9658
9665
 
9659
9666
  if (!siteHasNewslettersDefined) {
@@ -9708,7 +9715,7 @@ const disableScroll = () => {
9708
9715
  }
9709
9716
  };
9710
9717
  const trackSubscriptionOnGA = () => {
9711
- 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;
9718
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9712
9719
 
9713
9720
  const {
9714
9721
  product,
@@ -9724,35 +9731,60 @@ const trackSubscriptionOnGA = () => {
9724
9731
  invoices
9725
9732
  } = window.Pelcro.user.read();
9726
9733
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9734
+ 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;
9727
9735
 
9728
9736
  if (!lastSubscriptionId) {
9729
9737
  return;
9730
9738
  }
9731
9739
 
9732
9740
  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;
9733
- 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, {
9734
- currencyCode: currencyCode
9735
- });
9736
- 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", {
9737
- id: lastSubscriptionId,
9738
- affiliation: "Pelcro",
9739
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9740
- coupon: couponCode
9741
- });
9742
- 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", {
9743
- id: lastSubscriptionId,
9744
- name: product.name,
9745
- category: product.description,
9746
- variant: plan.nickname,
9747
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9748
- quantity: 1
9749
- });
9750
- 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");
9751
- 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, {
9752
- category: "ACTIONS",
9753
- action: "Subscribed",
9754
- nonInteraction: true
9755
- });
9741
+
9742
+ if (enableReactGA4) {
9743
+ ReactGA4.event("purchase", {
9744
+ transaction_id: lastSubscriptionId,
9745
+ affiliation: "Pelcro",
9746
+ currency: currencyCode,
9747
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9748
+ coupon: couponCode,
9749
+ items: [{
9750
+ item_id: lastSubscriptionId,
9751
+ item_name: product.name,
9752
+ item_category: product.description,
9753
+ item_variant: plan.nickname,
9754
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9755
+ quantity: 1
9756
+ }]
9757
+ });
9758
+ ReactGA4.event("Subscribed", {
9759
+ nonInteraction: true
9760
+ });
9761
+ } else {
9762
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9763
+
9764
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9765
+ currencyCode: currencyCode
9766
+ });
9767
+ 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", {
9768
+ id: lastSubscriptionId,
9769
+ affiliation: "Pelcro",
9770
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9771
+ coupon: couponCode
9772
+ });
9773
+ 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", {
9774
+ id: lastSubscriptionId,
9775
+ name: product.name,
9776
+ category: product.description,
9777
+ variant: plan.nickname,
9778
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9779
+ quantity: 1
9780
+ });
9781
+ 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");
9782
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9783
+ category: "ACTIONS",
9784
+ action: "Subscribed",
9785
+ nonInteraction: true
9786
+ });
9787
+ }
9756
9788
  };
9757
9789
  /** check wether or not the user have any existing payment method
9758
9790
  * @return {boolean} true if the user have at least one payment method (source), false otherwise
@@ -9839,15 +9871,15 @@ function getDateWithoutTime(dateObject) {
9839
9871
  return date;
9840
9872
  }
9841
9873
  function userMustVerifyEmail() {
9842
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9874
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9843
9875
 
9844
- 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;
9876
+ 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;
9845
9877
  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;
9846
9878
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9847
9879
  }
9848
9880
  function notifyBugsnag(callback, startOptions) {
9849
9881
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9850
- //load bugsnag CDN
9882
+ // load bugsnag CDN
9851
9883
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9852
9884
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9853
9885
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10029,9 +10061,6 @@ function _classPrivateFieldGet(receiver, privateMap) {
10029
10061
  return descriptor.value;
10030
10062
  }
10031
10063
 
10032
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10033
- 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;
10034
-
10035
10064
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10036
10065
 
10037
10066
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
@@ -10140,7 +10169,7 @@ class SaveToMetadataButtonClass {
10140
10169
  _saveToMetadata.set(this, {
10141
10170
  writable: true,
10142
10171
  value: event => {
10143
- var _user$metadata;
10172
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10144
10173
 
10145
10174
  const button = event.currentTarget;
10146
10175
  const user = window.Pelcro.user.read();
@@ -10151,6 +10180,7 @@ class SaveToMetadataButtonClass {
10151
10180
  key,
10152
10181
  ...buttonMetadata
10153
10182
  } = button.dataset;
10183
+ 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;
10154
10184
 
10155
10185
  if (userMustVerifyEmail()) {
10156
10186
  return switchView("email-verify");
@@ -10182,19 +10212,25 @@ class SaveToMetadataButtonClass {
10182
10212
  value: newMetadataValue,
10183
10213
  auth_token: window.Pelcro.user.read().auth_token
10184
10214
  }, (err, resp) => {
10185
- var _ReactGA$event;
10186
-
10187
10215
  if (err) {
10188
10216
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10189
10217
  }
10190
10218
 
10191
10219
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10192
10220
 
10193
- 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, {
10194
- category: "ACTIONS",
10195
- action: "Save/Follow",
10196
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10197
- });
10221
+ if (enableReactGA4) {
10222
+ ReactGA4.event("Save/Follow", {
10223
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10224
+ });
10225
+ } else {
10226
+ var _ReactGA$event;
10227
+
10228
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10229
+ category: "ACTIONS",
10230
+ action: "Save/Follow",
10231
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10232
+ });
10233
+ }
10198
10234
  });
10199
10235
  }
10200
10236
  }
@@ -10203,6 +10239,8 @@ class SaveToMetadataButtonClass {
10203
10239
  _removeMetaData.set(this, {
10204
10240
  writable: true,
10205
10241
  value: event => {
10242
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10243
+
10206
10244
  const button = event.currentTarget;
10207
10245
  const user = window.Pelcro.user.read();
10208
10246
  const {
@@ -10210,6 +10248,7 @@ class SaveToMetadataButtonClass {
10210
10248
  title
10211
10249
  } = button.dataset;
10212
10250
  const oldValue = user.metadata[`metadata_saved_${key}`];
10251
+ 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;
10213
10252
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10214
10253
 
10215
10254
  if (window.Pelcro.user.isAuthenticated()) {
@@ -10220,19 +10259,25 @@ class SaveToMetadataButtonClass {
10220
10259
  value: newMetadataValue,
10221
10260
  auth_token: window.Pelcro.user.read().auth_token
10222
10261
  }, (err, resp) => {
10223
- var _ReactGA$event2;
10224
-
10225
10262
  if (err) {
10226
10263
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10227
10264
  }
10228
10265
 
10229
10266
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10230
10267
 
10231
- 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, {
10232
- category: "ACTIONS",
10233
- action: "Unsave/Unfollow",
10234
- label: title
10235
- });
10268
+ if (enableReactGA4) {
10269
+ ReactGA4.event("Unsave/Unfollow", {
10270
+ event_label: title
10271
+ });
10272
+ } else {
10273
+ var _ReactGA$event2;
10274
+
10275
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10276
+ category: "ACTIONS",
10277
+ action: "Unsave/Unfollow",
10278
+ label: title
10279
+ });
10280
+ }
10236
10281
  });
10237
10282
  }
10238
10283
  }
@@ -11962,8 +12007,6 @@ function getSiteCardProcessor() {
11962
12007
  return "stripe";
11963
12008
  }
11964
12009
 
11965
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11966
- 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;
11967
12010
  /**
11968
12011
  * @typedef {Object} OptionsType
11969
12012
  * @property {boolean} loadPaymentSDKs
@@ -12094,19 +12137,51 @@ const initSecuritySdk = () => {
12094
12137
  });
12095
12138
  };
12096
12139
  const initGATracking = () => {
12097
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
12140
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12141
+
12142
+ 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;
12143
+
12144
+ if (window.Pelcro.site.read().google_analytics_id) {
12145
+ if (enableReactGA4) {
12146
+ // Initialize ReactGA4 with your tracking ID
12147
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id); // Enable e-commerce tracking
12098
12148
 
12099
- 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);
12100
- 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");
12149
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
12150
+ gaOptions: {
12151
+ send_page_view: true,
12152
+ ecommerce: {
12153
+ enabled: true
12154
+ }
12155
+ }
12156
+ });
12157
+ } else {
12158
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
12159
+
12160
+ 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);
12161
+ 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");
12162
+ }
12163
+ }
12101
12164
  };
12102
12165
  const dispatchModalDisplayEvents = modalName => {
12103
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
12166
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
12167
+
12168
+ 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;
12169
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
12170
+
12171
+ if (enableReactGA4) {
12172
+ ReactGA4.event(`${formattedAction} viewed`, {
12173
+ nonInteraction: true
12174
+ });
12175
+ } else {
12176
+ var _ReactGA$event;
12177
+
12178
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12179
+ category: "VIEWS",
12180
+ action: `${formattedAction} viewed`,
12181
+ nonInteraction: true
12182
+ });
12183
+ }
12104
12184
 
12105
- 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, {
12106
- category: "VIEWS",
12107
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
12108
- nonInteraction: true
12109
- });
12110
12185
  window.Pelcro.insight.track("Modal Displayed", {
12111
12186
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
12112
12187
  });
@@ -12958,8 +13033,6 @@ const CANCEL_SUBSCRIPTION = "CANCEL_SUBSCRIPTION";
12958
13033
  const UNSUSPEND_SUBSCRIPTION = "UNSUSPEND_SUBSCRIPTION";
12959
13034
  const REACTIVATE_SUBSCRIPTION = "REACTIVATE_SUBSCRIPTION"; //========
12960
13035
 
12961
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12962
- 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;
12963
13036
  const initialState$n = {
12964
13037
  email: "",
12965
13038
  username: "",
@@ -12985,6 +13058,10 @@ const LoginContainer = ({
12985
13058
  onFailure = () => {},
12986
13059
  children
12987
13060
  }) => {
13061
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13062
+
13063
+ 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;
13064
+
12988
13065
  const handleLogin = ({
12989
13066
  email,
12990
13067
  username,
@@ -13013,14 +13090,21 @@ const LoginContainer = ({
13013
13090
  });
13014
13091
  onFailure(err);
13015
13092
  } else {
13016
- var _ReactGA$event;
13017
-
13018
13093
  onSuccess(res);
13019
- 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, {
13020
- category: "ACTIONS",
13021
- action: "Logged in",
13022
- nonInteraction: true
13023
- });
13094
+
13095
+ if (enableReactGA4) {
13096
+ ReactGA4.event("Logged in", {
13097
+ nonInteraction: true
13098
+ });
13099
+ } else {
13100
+ var _ReactGA$event;
13101
+
13102
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13103
+ category: "ACTIONS",
13104
+ action: "Logged in",
13105
+ nonInteraction: true
13106
+ });
13107
+ }
13024
13108
  }
13025
13109
  });
13026
13110
  };
@@ -13416,18 +13500,26 @@ function ConfirmPassword({
13416
13500
  }, otherProps));
13417
13501
  }
13418
13502
 
13419
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13420
- 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;
13421
13503
  const Logout = props => {
13422
13504
  const handleLogout = () => {
13423
- var _ReactGA$event;
13505
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13424
13506
 
13425
13507
  window.Pelcro.user.logout();
13426
- 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, {
13427
- category: "ACTIONS",
13428
- action: "Logged out",
13429
- nonInteraction: true
13430
- });
13508
+ 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;
13509
+
13510
+ if (enableReactGA4) {
13511
+ ReactGA4.event("Logged out", {
13512
+ nonInteraction: true
13513
+ });
13514
+ } else {
13515
+ var _ReactGA$event;
13516
+
13517
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13518
+ category: "ACTIONS",
13519
+ action: "Logged out",
13520
+ nonInteraction: true
13521
+ });
13522
+ }
13431
13523
  };
13432
13524
 
13433
13525
  return /*#__PURE__*/React__default.createElement("button", {
@@ -14875,14 +14967,12 @@ const RegisterCompany = props => {
14875
14967
  }, props));
14876
14968
  };
14877
14969
 
14878
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14879
- 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;
14880
14970
  /**
14881
14971
  *
14882
14972
  */
14883
14973
 
14884
14974
  function RegisterModal(props) {
14885
- var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2;
14975
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2;
14886
14976
 
14887
14977
  const {
14888
14978
  t
@@ -14898,6 +14988,7 @@ function RegisterModal(props) {
14898
14988
  giftCode,
14899
14989
  isGift
14900
14990
  } = usePelcro();
14991
+ 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;
14901
14992
 
14902
14993
  const onSuccess = res => {
14903
14994
  var _props$onSuccess;
@@ -14907,13 +14998,22 @@ function RegisterModal(props) {
14907
14998
  };
14908
14999
 
14909
15000
  const handleAfterRegistrationLogic = () => {
14910
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
15001
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
15002
+
15003
+ if (enableReactGA4) {
15004
+ ReactGA4.event("Registered", {
15005
+ nonInteraction: true
15006
+ });
15007
+ } else {
15008
+ var _ReactGA$event;
15009
+
15010
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15011
+ category: "ACTIONS",
15012
+ action: "Registered",
15013
+ nonInteraction: true
15014
+ });
15015
+ }
14911
15016
 
14912
- 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, {
14913
- category: "ACTIONS",
14914
- action: "Registered",
14915
- nonInteraction: true
14916
- });
14917
15017
  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;
14918
15018
 
14919
15019
  if (isEmailVerificationEnabled) {
@@ -19756,8 +19856,6 @@ function SvgArrowLeft(props) {
19756
19856
  })));
19757
19857
  }
19758
19858
 
19759
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
19760
- 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;
19761
19859
  /**
19762
19860
  *
19763
19861
  */
@@ -19827,6 +19925,8 @@ SelectModalWithHook.viewId = "plan-select";
19827
19925
 
19828
19926
  class SelectModal extends Component {
19829
19927
  constructor(props) {
19928
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
19929
+
19830
19930
  super(props);
19831
19931
 
19832
19932
  _defineProperty$3(this, "componentDidMount", () => {
@@ -19867,12 +19967,12 @@ class SelectModal extends Component {
19867
19967
  document.addEventListener("keydown", this.handleSubmit);
19868
19968
 
19869
19969
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
19870
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
19970
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
19871
19971
 
19872
- 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;
19873
- 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;
19874
- 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;
19875
- 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 => {
19972
+ 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;
19973
+ 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;
19974
+ 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;
19975
+ 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 => {
19876
19976
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
19877
19977
  if (filteredPlans.length) return filteredPlans;
19878
19978
  });
@@ -19886,13 +19986,13 @@ class SelectModal extends Component {
19886
19986
  });
19887
19987
  notifyBugsnag(() => {
19888
19988
  Bugsnag.notify("SelectModal - No data viewed", event => {
19889
- 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;
19989
+ 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;
19890
19990
 
19891
19991
  event.addMetadata("MetaData", {
19892
- 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(),
19893
- 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(),
19894
- 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,
19895
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
19992
+ 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(),
19993
+ 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(),
19994
+ 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,
19995
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
19896
19996
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
19897
19997
  productListState: this.state.productList,
19898
19998
  methods: {
@@ -19903,8 +20003,8 @@ class SelectModal extends Component {
19903
20003
  userCurrency: userCurrency,
19904
20004
  userCountry: userCountry,
19905
20005
  userLanguage: userLanguage,
19906
- 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(),
19907
- 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,
20006
+ 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(),
20007
+ 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,
19908
20008
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
19909
20009
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
19910
20010
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -20282,27 +20382,40 @@ class SelectModal extends Component {
20282
20382
  this.locale = this.props.t;
20283
20383
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
20284
20384
  this.productsTabRef = /*#__PURE__*/React__default.createRef();
20385
+ 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;
20285
20386
  }
20286
20387
 
20287
20388
  render() {
20288
20389
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
20289
20390
 
20290
20391
  if (this.state.mode === "product") {
20291
- var _ReactGA$event;
20392
+ if (this.enableReactGA4) {
20393
+ ReactGA4.event("Product Modal Viewed", {
20394
+ nonInteraction: true
20395
+ });
20396
+ } else {
20397
+ var _ReactGA$event;
20292
20398
 
20293
- 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, {
20294
- category: "VIEWS",
20295
- action: "Product Modal Viewed",
20296
- nonInteraction: true
20297
- });
20399
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20400
+ category: "VIEWS",
20401
+ action: "Product Modal Viewed",
20402
+ nonInteraction: true
20403
+ });
20404
+ }
20298
20405
  } else if (this.state.mode === "plan") {
20299
- var _ReactGA$event2;
20406
+ if (this.enableReactGA4) {
20407
+ ReactGA4.event("Plan Modal Viewed", {
20408
+ nonInteraction: true
20409
+ });
20410
+ } else {
20411
+ var _ReactGA$event2;
20300
20412
 
20301
- 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, {
20302
- category: "VIEWS",
20303
- action: "Plan Modal Viewed",
20304
- nonInteraction: true
20305
- });
20413
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
20414
+ category: "VIEWS",
20415
+ action: "Plan Modal Viewed",
20416
+ nonInteraction: true
20417
+ });
20418
+ }
20306
20419
  }
20307
20420
 
20308
20421
  return /*#__PURE__*/React__default.createElement(Modal, {
@@ -25265,8 +25378,6 @@ const SubscriptionRenewView = ({
25265
25378
  }));
25266
25379
  };
25267
25380
 
25268
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
25269
- 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;
25270
25381
  /**
25271
25382
  *
25272
25383
  */
@@ -25276,34 +25387,55 @@ function SubscriptionRenewModal({
25276
25387
  onClose,
25277
25388
  ...otherProps
25278
25389
  }) {
25279
- var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
25390
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
25280
25391
 
25281
25392
  const {
25282
25393
  product,
25283
25394
  switchView
25284
25395
  } = usePelcro();
25396
+ 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;
25285
25397
 
25286
25398
  const onSuccess = res => {
25287
- var _otherProps$onSuccess, _ReactGA$event;
25399
+ var _otherProps$onSuccess;
25288
25400
 
25289
25401
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
25290
- 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, {
25291
- category: "ACTIONS",
25292
- action: "Renewed",
25293
- nonInteraction: true
25294
- });
25402
+
25403
+ if (enableReactGA4) {
25404
+ ReactGA4.event("Renewed", {
25405
+ nonInteraction: true
25406
+ });
25407
+ } else {
25408
+ var _ReactGA$event;
25409
+
25410
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25411
+ category: "ACTIONS",
25412
+ action: "Renewed",
25413
+ nonInteraction: true
25414
+ });
25415
+ }
25416
+
25295
25417
  return switchView("subscription-success");
25296
25418
  };
25297
25419
 
25298
25420
  const onGiftRenewalSuccess = () => {
25299
- var _otherProps$onGiftRen, _ReactGA$event2;
25421
+ var _otherProps$onGiftRen;
25300
25422
 
25301
25423
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
25302
- 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, {
25303
- category: "ACTIONS",
25304
- action: "Renewed Gift",
25305
- nonInteraction: true
25306
- });
25424
+
25425
+ if (enableReactGA4) {
25426
+ ReactGA4.event("Renewed Gift", {
25427
+ nonInteraction: true
25428
+ });
25429
+ } else {
25430
+ var _ReactGA$event2;
25431
+
25432
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
25433
+ category: "ACTIONS",
25434
+ action: "Renewed Gift",
25435
+ nonInteraction: true
25436
+ });
25437
+ }
25438
+
25307
25439
  return switchView("subscription-success");
25308
25440
  };
25309
25441
 
@@ -25486,8 +25618,6 @@ function SvgSubscription(props) {
25486
25618
  }))))));
25487
25619
  }
25488
25620
 
25489
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
25490
- 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;
25491
25621
  const SubscriptionCancelNowButton = ({
25492
25622
  subscription,
25493
25623
  onClick,
@@ -25507,6 +25637,9 @@ const SubscriptionCancelNowButton = ({
25507
25637
  } = useTranslation("subscriptionCancel");
25508
25638
 
25509
25639
  const cancelSubscription = (payload, onSuccess, onFailure) => {
25640
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25641
+
25642
+ 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;
25510
25643
  window.Pelcro.subscription.cancel({
25511
25644
  auth_token: window.Pelcro.user.read().auth_token,
25512
25645
  subscription_id: payload.subscription_id,
@@ -25515,17 +25648,24 @@ const SubscriptionCancelNowButton = ({
25515
25648
  reason: payload.reason
25516
25649
  })
25517
25650
  }, (err, res) => {
25518
- var _ReactGA$event;
25519
-
25520
25651
  if (err) {
25521
25652
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25522
25653
  }
25523
25654
 
25524
- 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, {
25525
- category: "ACTIONS",
25526
- action: "Canceled",
25527
- nonInteraction: true
25528
- });
25655
+ if (enableReactGA4) {
25656
+ ReactGA4.event("Canceled", {
25657
+ nonInteraction: true
25658
+ });
25659
+ } else {
25660
+ var _ReactGA$event;
25661
+
25662
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25663
+ category: "ACTIONS",
25664
+ action: "Canceled",
25665
+ nonInteraction: true
25666
+ });
25667
+ }
25668
+
25529
25669
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25530
25670
  });
25531
25671
  };
@@ -25538,9 +25678,9 @@ const SubscriptionCancelNowButton = ({
25538
25678
  reason: cancelationReason
25539
25679
  })
25540
25680
  };
25541
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
25681
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25542
25682
 
25543
- switchView(null); //Show confirmation alert after closing the modal
25683
+ switchView(null); // Show confirmation alert after closing the modal
25544
25684
 
25545
25685
  notify.confirm((onSuccess, onFailure) => {
25546
25686
  cancelSubscription(payload, onSuccess, onFailure);
@@ -25560,8 +25700,6 @@ const SubscriptionCancelNowButton = ({
25560
25700
  }, t("messages.cancelNow"));
25561
25701
  };
25562
25702
 
25563
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
25564
- 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;
25565
25703
  const SubscriptionCancelLaterButton = ({
25566
25704
  subscription,
25567
25705
  onClick,
@@ -25581,6 +25719,9 @@ const SubscriptionCancelLaterButton = ({
25581
25719
  } = useTranslation("subscriptionCancel");
25582
25720
 
25583
25721
  const cancelSubscription = (payload, onSuccess, onFailure) => {
25722
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25723
+
25724
+ 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;
25584
25725
  window.Pelcro.subscription.cancel({
25585
25726
  auth_token: window.Pelcro.user.read().auth_token,
25586
25727
  subscription_id: payload.subscription_id,
@@ -25589,17 +25730,24 @@ const SubscriptionCancelLaterButton = ({
25589
25730
  reason: payload.reason
25590
25731
  })
25591
25732
  }, (err, res) => {
25592
- var _ReactGA$event;
25593
-
25594
25733
  if (err) {
25595
25734
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25596
25735
  }
25597
25736
 
25598
- 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, {
25599
- category: "ACTIONS",
25600
- action: "Canceled",
25601
- nonInteraction: true
25602
- });
25737
+ if (enableReactGA4) {
25738
+ ReactGA4.event("Canceled", {
25739
+ nonInteraction: true
25740
+ });
25741
+ } else {
25742
+ var _ReactGA$event;
25743
+
25744
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25745
+ category: "ACTIONS",
25746
+ action: "Canceled",
25747
+ nonInteraction: true
25748
+ });
25749
+ }
25750
+
25603
25751
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25604
25752
  });
25605
25753
  };
@@ -25612,9 +25760,9 @@ const SubscriptionCancelLaterButton = ({
25612
25760
  reason: cancelationReason
25613
25761
  })
25614
25762
  };
25615
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
25763
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25616
25764
 
25617
- switchView(null); //Show confirmation alert after closing the modal
25765
+ switchView(null); // Show confirmation alert after closing the modal
25618
25766
 
25619
25767
  notify.confirm((onSuccess, onFailure) => {
25620
25768
  cancelSubscription(payload, onSuccess, onFailure);
@@ -25811,13 +25959,13 @@ const SubscriptionSuspendDate = props => {
25811
25959
  }, props));
25812
25960
  };
25813
25961
 
25814
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
25815
- 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;
25816
25962
  const SubscriptionSuspendButton = ({
25817
25963
  subscription,
25818
25964
  onClick,
25819
25965
  className
25820
25966
  }) => {
25967
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25968
+
25821
25969
  const {
25822
25970
  switchView
25823
25971
  } = usePelcro();
@@ -25831,6 +25979,7 @@ const SubscriptionSuspendButton = ({
25831
25979
  const {
25832
25980
  t
25833
25981
  } = useTranslation("subscriptionSuspend");
25982
+ 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;
25834
25983
 
25835
25984
  const suspendSubscription = (payload, onSuccess, onFailure) => {
25836
25985
  window.Pelcro.subscription.update({
@@ -25839,17 +25988,24 @@ const SubscriptionSuspendButton = ({
25839
25988
  suspend: 1,
25840
25989
  shipments_suspended_until: suspendDate
25841
25990
  }, (err, res) => {
25842
- var _ReactGA$event;
25843
-
25844
25991
  if (err) {
25845
25992
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
25846
25993
  }
25847
25994
 
25848
- 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, {
25849
- category: "ACTIONS",
25850
- action: "Suspended",
25851
- nonInteraction: true
25852
- });
25995
+ if (enableReactGA4) {
25996
+ ReactGA4.event("Suspended", {
25997
+ nonInteraction: true
25998
+ });
25999
+ } else {
26000
+ var _ReactGA$event;
26001
+
26002
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
26003
+ category: "ACTIONS",
26004
+ action: "Suspended",
26005
+ nonInteraction: true
26006
+ });
26007
+ }
26008
+
25853
26009
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
25854
26010
  });
25855
26011
  };
@@ -25858,9 +26014,9 @@ const SubscriptionSuspendButton = ({
25858
26014
  const payload = {
25859
26015
  subscription_id: subscription.id
25860
26016
  };
25861
- onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
26017
+ onClick === null || onClick === void 0 ? void 0 : onClick(); // Close the modal
25862
26018
 
25863
- switchView(null); //Show confirmation alert after closing the modal
26019
+ switchView(null); // Show confirmation alert after closing the modal
25864
26020
 
25865
26021
  notify.confirm((onSuccess, onFailure) => {
25866
26022
  suspendSubscription(payload, onSuccess, onFailure);
@@ -28736,8 +28892,6 @@ const AddressCreateLine2 = props => {
28736
28892
  }, props));
28737
28893
  };
28738
28894
 
28739
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
28740
- 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;
28741
28895
  const initialState$e = {
28742
28896
  isSubmitting: false,
28743
28897
  firstName: "",
@@ -28778,12 +28932,13 @@ const AddressUpdateContainer = ({
28778
28932
  children,
28779
28933
  ...props
28780
28934
  }) => {
28781
- var _props$addressId;
28935
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
28782
28936
 
28783
28937
  const {
28784
28938
  addressIdToEdit
28785
28939
  } = usePelcro();
28786
28940
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
28941
+ 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;
28787
28942
  const [t] = useTranslation("address");
28788
28943
  useEffect(() => {
28789
28944
  const getCountries = () => {
@@ -28877,8 +29032,6 @@ const AddressUpdateContainer = ({
28877
29032
  });
28878
29033
  onFailure(err);
28879
29034
  } else {
28880
- var _ReactGA$event;
28881
-
28882
29035
  dispatch({
28883
29036
  type: SHOW_ALERT,
28884
29037
  payload: {
@@ -28887,11 +29040,20 @@ const AddressUpdateContainer = ({
28887
29040
  }
28888
29041
  });
28889
29042
  onSuccess(res);
28890
- 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, {
28891
- category: "ACTIONS",
28892
- action: "Updated address",
28893
- nonInteraction: true
28894
- });
29043
+
29044
+ if (enableReactGA4) {
29045
+ ReactGA4.event("Updated address", {
29046
+ nonInteraction: true
29047
+ });
29048
+ } else {
29049
+ var _ReactGA$event;
29050
+
29051
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29052
+ category: "ACTIONS",
29053
+ action: "Updated address",
29054
+ nonInteraction: true
29055
+ });
29056
+ }
28895
29057
  }
28896
29058
  });
28897
29059
  };
@@ -29432,22 +29594,32 @@ function PaymentMethodUpdateView(props) {
29432
29594
  }));
29433
29595
  }
29434
29596
 
29435
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
29436
- 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;
29437
29597
  const PaymentMethodUpdateModal = props => {
29598
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29599
+
29438
29600
  const {
29439
29601
  t
29440
29602
  } = useTranslation("paymentMethod");
29603
+ 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;
29441
29604
 
29442
29605
  const onSuccess = res => {
29443
- var _props$onSuccess, _ReactGA$event;
29606
+ var _props$onSuccess;
29444
29607
 
29445
29608
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
29446
- 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, {
29447
- category: "ACTIONS",
29448
- action: "Updated payment card",
29449
- nonInteraction: true
29450
- });
29609
+
29610
+ if (enableReactGA4) {
29611
+ ReactGA4.event("Updated payment card", {
29612
+ nonInteraction: true
29613
+ });
29614
+ } else {
29615
+ var _ReactGA$event;
29616
+
29617
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29618
+ category: "ACTIONS",
29619
+ action: "Updated payment card",
29620
+ nonInteraction: true
29621
+ });
29622
+ }
29451
29623
  };
29452
29624
 
29453
29625
  return /*#__PURE__*/React__default.createElement(Modal, {
@@ -32230,8 +32402,7 @@ const PaymentMethodSelectModal = ({
32230
32402
  };
32231
32403
  PaymentMethodSelectModal.viewId = "payment-method-select";
32232
32404
 
32233
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1, _window$Pelcro$user$r, _window$Pelcro$user$r2;
32234
- 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;
32405
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2;
32235
32406
  const initialState$4 = {
32236
32407
  isOpen: false,
32237
32408
  activeDashboardLink: null,
@@ -32252,12 +32423,13 @@ const DashboardContainer = ({
32252
32423
  children,
32253
32424
  ...props
32254
32425
  }) => {
32426
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
32427
+
32255
32428
  const {
32256
32429
  t
32257
32430
  } = useTranslation("dashboard");
32431
+ 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;
32258
32432
  useEffect(() => {
32259
- var _ReactGA$event;
32260
-
32261
32433
  dispatch({
32262
32434
  type: SET_IS_OPEN,
32263
32435
  payload: true
@@ -32265,11 +32437,21 @@ const DashboardContainer = ({
32265
32437
  window.Pelcro.insight.track("Modal Displayed", {
32266
32438
  name: "dashboard"
32267
32439
  });
32268
- 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, {
32269
- category: "VIEWS",
32270
- action: "Dashboard Modal Viewed",
32271
- nonInteraction: true
32272
- });
32440
+
32441
+ if (enableReactGA4) {
32442
+ ReactGA4.event("Dashboard Modal Viewed", {
32443
+ nonInteraction: true
32444
+ });
32445
+ } else {
32446
+ var _ReactGA$event;
32447
+
32448
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
32449
+ category: "VIEWS",
32450
+ action: "Dashboard Modal Viewed",
32451
+ nonInteraction: true
32452
+ });
32453
+ }
32454
+
32273
32455
  const {
32274
32456
  addresses
32275
32457
  } = window.Pelcro.user.read();
@@ -32294,8 +32476,6 @@ const DashboardContainer = ({
32294
32476
  auth_token: window.Pelcro.user.read().auth_token,
32295
32477
  subscription_id: subscription_id
32296
32478
  }, (err, res) => {
32297
- var _ReactGA$event2;
32298
-
32299
32479
  dispatch({
32300
32480
  type: SET_DISABLESUBMIT,
32301
32481
  payload: false
@@ -32305,11 +32485,20 @@ const DashboardContainer = ({
32305
32485
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
32306
32486
  }
32307
32487
 
32308
- 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, {
32309
- category: "ACTIONS",
32310
- action: "Canceled",
32311
- nonInteraction: true
32312
- });
32488
+ if (enableReactGA4) {
32489
+ ReactGA4.event("Canceled", {
32490
+ nonInteraction: true
32491
+ });
32492
+ } else {
32493
+ var _ReactGA$event2;
32494
+
32495
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
32496
+ category: "ACTIONS",
32497
+ action: "Canceled",
32498
+ nonInteraction: true
32499
+ });
32500
+ }
32501
+
32313
32502
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
32314
32503
  });
32315
32504
  };
@@ -32330,8 +32519,6 @@ const DashboardContainer = ({
32330
32519
  subscription_id: subscription_id,
32331
32520
  suspend: 0
32332
32521
  }, (err, res) => {
32333
- var _ReactGA$event3;
32334
-
32335
32522
  dispatch({
32336
32523
  type: SET_DISABLESUBMIT,
32337
32524
  payload: false
@@ -32341,11 +32528,20 @@ const DashboardContainer = ({
32341
32528
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
32342
32529
  }
32343
32530
 
32344
- 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, {
32345
- category: "ACTIONS",
32346
- action: "UnSuspended",
32347
- nonInteraction: true
32348
- });
32531
+ if (enableReactGA4) {
32532
+ ReactGA4.event("UnSuspended", {
32533
+ nonInteraction: true
32534
+ });
32535
+ } else {
32536
+ var _ReactGA$event3;
32537
+
32538
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
32539
+ category: "ACTIONS",
32540
+ action: "UnSuspended",
32541
+ nonInteraction: true
32542
+ });
32543
+ }
32544
+
32349
32545
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
32350
32546
  });
32351
32547
  };
@@ -33593,8 +33789,6 @@ const Card = ({
33593
33789
  }, "Failed"))), children);
33594
33790
  };
33595
33791
 
33596
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
33597
- 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;
33598
33792
  const SavedItemsMenu = () => {
33599
33793
  const {
33600
33794
  t
@@ -33625,8 +33819,11 @@ const SavedItems = ({
33625
33819
  } = usePelcro();
33626
33820
 
33627
33821
  const removeItemFromMetadata = (category, title) => {
33822
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
33823
+
33628
33824
  const user = window.Pelcro.user.read();
33629
33825
  const oldValue = user.metadata[`metadata_saved_${category}`];
33826
+ 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;
33630
33827
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
33631
33828
 
33632
33829
  if (isAuthenticated()) {
@@ -33636,7 +33833,7 @@ const SavedItems = ({
33636
33833
  value: newMetadataValue,
33637
33834
  auth_token: window.Pelcro.user.read().auth_token
33638
33835
  }, (error, response) => {
33639
- var _response$data, _ReactGA$event;
33836
+ var _response$data;
33640
33837
 
33641
33838
  setLoading(false);
33642
33839
 
@@ -33645,11 +33842,20 @@ const SavedItems = ({
33645
33842
  }
33646
33843
 
33647
33844
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
33648
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
33649
- category: "ACTIONS",
33650
- action: "Unsave/Unfollow",
33651
- label: title
33652
- });
33845
+
33846
+ if (enableReactGA4) {
33847
+ ReactGA4.event("Unsave/Unfollow", {
33848
+ event_label: title
33849
+ });
33850
+ } else {
33851
+ var _ReactGA$event;
33852
+
33853
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
33854
+ category: "ACTIONS",
33855
+ action: "Unsave/Unfollow",
33856
+ label: title
33857
+ });
33858
+ }
33653
33859
  });
33654
33860
  }
33655
33861
  };