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

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
@@ -8950,8 +8950,6 @@ exports["default"] = _default;
8950
8950
  var ReactGA4 = unwrapExports(dist);
8951
8951
  dist.ReactGAImplementation;
8952
8952
 
8953
- var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
8954
- const enableReactGA4$f = (_window$f = window) === null || _window$f === void 0 ? void 0 : (_window$Pelcro$f = _window$f.Pelcro) === null || _window$Pelcro$f === void 0 ? void 0 : (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) === null || _window$Pelcro$uiSett$f === void 0 ? void 0 : _window$Pelcro$uiSett$f.enableReactGA4;
8955
8953
  class PelcroActions {
8956
8954
  constructor(storeSetter, storeGetter) {
8957
8955
  var _this = this;
@@ -9131,18 +9129,20 @@ class PelcroActions {
9131
9129
  });
9132
9130
  });
9133
9131
  _defineProperty$3(this, "logout", function () {
9132
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9134
9133
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9135
9134
  const {
9136
9135
  switchView,
9137
9136
  resetView,
9138
9137
  isAuthenticated
9139
9138
  } = _this.get();
9139
+ 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;
9140
9140
  // if user is not authenticated function execution is terminated
9141
9141
  if (!isAuthenticated()) {
9142
9142
  return console.warn("You are already logged out.");
9143
9143
  }
9144
9144
  window.Pelcro.user.logout();
9145
- if (enableReactGA4$f) {
9145
+ if (enableReactGA4) {
9146
9146
  ReactGA4.event("Logged out", {
9147
9147
  nonInteraction: true
9148
9148
  });
@@ -9378,9 +9378,6 @@ if (process.env.NODE_ENV === "development") {
9378
9378
  c$1("Pelcro Store", usePelcro);
9379
9379
  }
9380
9380
 
9381
- var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9382
- const enableReactGA4$e = (_window$e = window) === null || _window$e === void 0 ? void 0 : (_window$Pelcro$e = _window$e.Pelcro) === null || _window$Pelcro$e === void 0 ? void 0 : (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) === null || _window$Pelcro$uiSett$e === void 0 ? void 0 : _window$Pelcro$uiSett$e.enableReactGA4;
9383
-
9384
9381
  /**
9385
9382
  * List of zero-decimal currencies.
9386
9383
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9466,8 +9463,8 @@ const getLanguageWithoutRegion = localeName => {
9466
9463
  * @return {string | undefined}
9467
9464
  */
9468
9465
  const getPageOrDefaultLanguage = () => {
9469
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9470
- 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);
9466
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9467
+ 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);
9471
9468
  };
9472
9469
 
9473
9470
  /**
@@ -9520,9 +9517,9 @@ const isValidViewFromURL = viewID => {
9520
9517
  *
9521
9518
  */
9522
9519
  function hasValidNewsletterUpdateUrl() {
9523
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9520
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9524
9521
  if (viewID !== "newsletter-update") return false;
9525
- 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;
9522
+ 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;
9526
9523
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9527
9524
  if (!siteHasNewslettersDefined) {
9528
9525
  return false;
@@ -9568,7 +9565,7 @@ const disableScroll = () => {
9568
9565
  }
9569
9566
  };
9570
9567
  const trackSubscriptionOnGA = () => {
9571
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9568
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9572
9569
  const {
9573
9570
  product,
9574
9571
  plan,
@@ -9583,11 +9580,12 @@ const trackSubscriptionOnGA = () => {
9583
9580
  invoices
9584
9581
  } = window.Pelcro.user.read();
9585
9582
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9583
+ 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;
9586
9584
  if (!lastSubscriptionId) {
9587
9585
  return;
9588
9586
  }
9589
9587
  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;
9590
- if (enableReactGA4$e) {
9588
+ if (enableReactGA4) {
9591
9589
  ReactGA4.event("purchase", {
9592
9590
  transaction_id: lastSubscriptionId,
9593
9591
  affiliation: "Pelcro",
@@ -9715,8 +9713,8 @@ function getDateWithoutTime(dateObject) {
9715
9713
  return date;
9716
9714
  }
9717
9715
  function userMustVerifyEmail() {
9718
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9719
- 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;
9716
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9717
+ 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;
9720
9718
  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;
9721
9719
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9722
9720
  }
@@ -10085,10 +10083,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10085
10083
  return descriptor.value;
10086
10084
  }
10087
10085
 
10088
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10089
10086
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10090
10087
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10091
- const enableReactGA4$d = (_window$d = window) === null || _window$d === void 0 ? void 0 : (_window$Pelcro$d = _window$d.Pelcro) === null || _window$Pelcro$d === void 0 ? void 0 : (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) === null || _window$Pelcro$uiSett$d === void 0 ? void 0 : _window$Pelcro$uiSett$d.enableReactGA4;
10092
10088
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10093
10089
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10094
10090
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10172,7 +10168,7 @@ class SaveToMetadataButtonClass {
10172
10168
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10173
10169
  writable: true,
10174
10170
  value: event => {
10175
- var _user$metadata;
10171
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10176
10172
  const button = event.currentTarget;
10177
10173
  const user = window.Pelcro.user.read();
10178
10174
  const {
@@ -10182,6 +10178,7 @@ class SaveToMetadataButtonClass {
10182
10178
  key,
10183
10179
  ...buttonMetadata
10184
10180
  } = button.dataset;
10181
+ 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;
10185
10182
  if (userMustVerifyEmail()) {
10186
10183
  return switchView("email-verify");
10187
10184
  }
@@ -10210,7 +10207,7 @@ class SaveToMetadataButtonClass {
10210
10207
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10211
10208
  }
10212
10209
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10213
- if (enableReactGA4$d) {
10210
+ if (enableReactGA4) {
10214
10211
  ReactGA4.event("Save/Follow", {
10215
10212
  event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10216
10213
  });
@@ -10229,6 +10226,7 @@ class SaveToMetadataButtonClass {
10229
10226
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10230
10227
  writable: true,
10231
10228
  value: event => {
10229
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10232
10230
  const button = event.currentTarget;
10233
10231
  const user = window.Pelcro.user.read();
10234
10232
  const {
@@ -10236,6 +10234,7 @@ class SaveToMetadataButtonClass {
10236
10234
  title
10237
10235
  } = button.dataset;
10238
10236
  const oldValue = user.metadata[`metadata_saved_${key}`];
10237
+ 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;
10239
10238
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10240
10239
  if (window.Pelcro.user.isAuthenticated()) {
10241
10240
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10248,7 +10247,7 @@ class SaveToMetadataButtonClass {
10248
10247
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10249
10248
  }
10250
10249
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10251
- if (enableReactGA4$d) {
10250
+ if (enableReactGA4) {
10252
10251
  ReactGA4.event("Unsave/Unfollow", {
10253
10252
  event_label: title
10254
10253
  });
@@ -11782,9 +11781,6 @@ function getSiteCardProcessor() {
11782
11781
  return "stripe";
11783
11782
  }
11784
11783
 
11785
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11786
- const enableReactGA4$c = (_window$c = window) === null || _window$c === void 0 ? void 0 : (_window$Pelcro$c = _window$c.Pelcro) === null || _window$Pelcro$c === void 0 ? void 0 : (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) === null || _window$Pelcro$uiSett$c === void 0 ? void 0 : _window$Pelcro$uiSett$c.enableReactGA4;
11787
-
11788
11784
  /**
11789
11785
  * @typedef {Object} OptionsType
11790
11786
  * @property {boolean} loadPaymentSDKs
@@ -11907,8 +11903,10 @@ const initSecuritySdk = () => {
11907
11903
  });
11908
11904
  };
11909
11905
  const initGATracking = () => {
11906
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11907
+ 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;
11910
11908
  if (window.Pelcro.site.read().google_analytics_id) {
11911
- if (enableReactGA4$c) {
11909
+ if (enableReactGA4) {
11912
11910
  // Initialize ReactGA4 with your tracking ID
11913
11911
  ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11914
11912
  // Enable e-commerce tracking
@@ -11920,20 +11918,26 @@ const initGATracking = () => {
11920
11918
  }
11921
11919
  }
11922
11920
  });
11921
+ console.log("enableReactGA4: ", enableReactGA4);
11922
+ console.log("GA4 is initialized");
11923
11923
  } else {
11924
11924
  var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11925
11925
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
11926
11926
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11927
+ console.log("enableReactGA4: " + enableReactGA4);
11928
+ console.log("GA3 is initialized");
11927
11929
  }
11928
11930
  }
11929
11931
  };
11930
11932
  const dispatchModalDisplayEvents = modalName => {
11931
- var _modalName$replace, _modalName$replace2;
11933
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11934
+ 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;
11932
11935
  const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11933
- if (enableReactGA4$c) {
11936
+ if (enableReactGA4) {
11934
11937
  ReactGA4.event(`${formattedAction} viewed`, {
11935
11938
  nonInteraction: true
11936
11939
  });
11940
+ console.log("GA4 view event is fired");
11937
11941
  } else {
11938
11942
  var _ReactGA$event;
11939
11943
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
@@ -11941,6 +11945,7 @@ const dispatchModalDisplayEvents = modalName => {
11941
11945
  action: `${formattedAction} viewed`,
11942
11946
  nonInteraction: true
11943
11947
  });
11948
+ console.log("GA3 view event is fired");
11944
11949
  }
11945
11950
  window.Pelcro.insight.track("Modal Displayed", {
11946
11951
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
@@ -12816,8 +12821,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12816
12821
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12817
12822
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12818
12823
 
12819
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12820
- const enableReactGA4$b = (_window$b = window) === null || _window$b === void 0 ? void 0 : (_window$Pelcro$b = _window$b.Pelcro) === null || _window$Pelcro$b === void 0 ? void 0 : (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) === null || _window$Pelcro$uiSett$b === void 0 ? void 0 : _window$Pelcro$uiSett$b.enableReactGA4;
12821
12824
  const initialState$m = {
12822
12825
  email: "",
12823
12826
  username: "",
@@ -12836,6 +12839,7 @@ const {
12836
12839
  Provider: Provider$m
12837
12840
  } = store$m;
12838
12841
  const LoginContainer = _ref => {
12842
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12839
12843
  let {
12840
12844
  style,
12841
12845
  className = "",
@@ -12843,6 +12847,7 @@ const LoginContainer = _ref => {
12843
12847
  onFailure = () => {},
12844
12848
  children
12845
12849
  } = _ref;
12850
+ 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;
12846
12851
  const handleLogin = (_ref2, dispatch) => {
12847
12852
  let {
12848
12853
  email,
@@ -12873,7 +12878,7 @@ const LoginContainer = _ref => {
12873
12878
  onFailure(err);
12874
12879
  } else {
12875
12880
  onSuccess(res);
12876
- if (enableReactGA4$b) {
12881
+ if (enableReactGA4) {
12877
12882
  ReactGA4.event("Logged in", {
12878
12883
  nonInteraction: true
12879
12884
  });
@@ -13270,12 +13275,12 @@ function ConfirmPassword(_ref) {
13270
13275
  }, otherProps));
13271
13276
  }
13272
13277
 
13273
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13274
- const enableReactGA4$a = (_window$a = window) === null || _window$a === void 0 ? void 0 : (_window$Pelcro$a = _window$a.Pelcro) === null || _window$Pelcro$a === void 0 ? void 0 : (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) === null || _window$Pelcro$uiSett$a === void 0 ? void 0 : _window$Pelcro$uiSett$a.enableReactGA4;
13275
13278
  const Logout = props => {
13276
13279
  const handleLogout = () => {
13280
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13277
13281
  window.Pelcro.user.logout();
13278
- if (enableReactGA4$a) {
13282
+ 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;
13283
+ if (enableReactGA4) {
13279
13284
  ReactGA4.event("Logged out", {
13280
13285
  nonInteraction: true
13281
13286
  });
@@ -14844,13 +14849,11 @@ const RegisterCompany = props => {
14844
14849
  }, props));
14845
14850
  };
14846
14851
 
14847
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14848
- const enableReactGA4$9 = (_window$9 = window) === null || _window$9 === void 0 ? void 0 : (_window$Pelcro$9 = _window$9.Pelcro) === null || _window$Pelcro$9 === void 0 ? void 0 : (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) === null || _window$Pelcro$uiSett$9 === void 0 ? void 0 : _window$Pelcro$uiSett$9.enableReactGA4;
14849
-
14850
14852
  /**
14851
14853
  *
14852
14854
  */
14853
14855
  function RegisterModal(props) {
14856
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14854
14857
  const {
14855
14858
  t
14856
14859
  } = useTranslation("register");
@@ -14865,6 +14868,7 @@ function RegisterModal(props) {
14865
14868
  giftCode,
14866
14869
  isGift
14867
14870
  } = usePelcro();
14871
+ 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;
14868
14872
  const onSuccess = res => {
14869
14873
  var _props$onSuccess;
14870
14874
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -14872,7 +14876,7 @@ function RegisterModal(props) {
14872
14876
  };
14873
14877
  const handleAfterRegistrationLogic = () => {
14874
14878
  var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14875
- if (enableReactGA4$9) {
14879
+ if (enableReactGA4) {
14876
14880
  ReactGA4.event("Registered", {
14877
14881
  nonInteraction: true
14878
14882
  });
@@ -14970,9 +14974,6 @@ function Radio(_ref) {
14970
14974
  }, children));
14971
14975
  }
14972
14976
 
14973
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14974
- const enableReactGA4$8 = (_window$8 = window) === null || _window$8 === void 0 ? void 0 : (_window$Pelcro$8 = _window$8.Pelcro) === null || _window$Pelcro$8 === void 0 ? void 0 : (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) === null || _window$Pelcro$uiSett$8 === void 0 ? void 0 : _window$Pelcro$uiSett$8.enableReactGA4;
14975
-
14976
14977
  /**
14977
14978
  *
14978
14979
  */
@@ -15032,6 +15033,7 @@ function productMatchPageLanguage(product) {
15032
15033
  SelectModalWithHook.viewId = "plan-select";
15033
15034
  class SelectModal extends React.Component {
15034
15035
  constructor(props) {
15036
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
15035
15037
  super(props);
15036
15038
  _defineProperty$3(this, "componentDidMount", () => {
15037
15039
  if (this.props.product) {
@@ -15066,11 +15068,11 @@ class SelectModal extends React.Component {
15066
15068
  }
15067
15069
  document.addEventListener("keydown", this.handleSubmit);
15068
15070
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
15069
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
15070
- 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;
15071
- 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;
15072
- 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;
15073
- 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 => {
15071
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15072
+ 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;
15073
+ 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;
15074
+ 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;
15075
+ 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 => {
15074
15076
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
15075
15077
  if (filteredPlans.length) return filteredPlans;
15076
15078
  });
@@ -15083,12 +15085,12 @@ class SelectModal extends React.Component {
15083
15085
  });
15084
15086
  notifyBugsnag(() => {
15085
15087
  Bugsnag.notify("SelectModal - No data viewed", event => {
15086
- 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;
15088
+ 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;
15087
15089
  event.addMetadata("MetaData", {
15088
- 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(),
15089
- 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(),
15090
- 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,
15091
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
15090
+ 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(),
15091
+ 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(),
15092
+ 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,
15093
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15092
15094
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15093
15095
  productListState: this.state.productList,
15094
15096
  methods: {
@@ -15099,8 +15101,8 @@ class SelectModal extends React.Component {
15099
15101
  userCurrency: userCurrency,
15100
15102
  userCountry: userCountry,
15101
15103
  userLanguage: userLanguage,
15102
- 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(),
15103
- 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,
15104
+ 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(),
15105
+ 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,
15104
15106
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15105
15107
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15106
15108
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15312,6 +15314,7 @@ class SelectModal extends React.Component {
15312
15314
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15313
15315
  this.locale = this.props.t;
15314
15316
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15317
+ 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;
15315
15318
  }
15316
15319
  render() {
15317
15320
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15319,7 +15322,7 @@ class SelectModal extends React.Component {
15319
15322
  disableGifting
15320
15323
  } = this.props;
15321
15324
  if (this.state.mode === "product") {
15322
- if (enableReactGA4$8) {
15325
+ if (this.enableReactGA4) {
15323
15326
  ReactGA4.event("Product Modal Viewed", {
15324
15327
  nonInteraction: true
15325
15328
  });
@@ -15332,7 +15335,7 @@ class SelectModal extends React.Component {
15332
15335
  });
15333
15336
  }
15334
15337
  } else if (this.state.mode === "plan") {
15335
- if (enableReactGA4$8) {
15338
+ if (this.enableReactGA4) {
15336
15339
  ReactGA4.event("Plan Modal Viewed", {
15337
15340
  nonInteraction: true
15338
15341
  });
@@ -21274,13 +21277,11 @@ const SubscriptionRenewView = _ref => {
21274
21277
  }));
21275
21278
  };
21276
21279
 
21277
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
21278
- const enableReactGA4$7 = (_window$7 = window) === null || _window$7 === void 0 ? void 0 : (_window$Pelcro$7 = _window$7.Pelcro) === null || _window$Pelcro$7 === void 0 ? void 0 : (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) === null || _window$Pelcro$uiSett$7 === void 0 ? void 0 : _window$Pelcro$uiSett$7.enableReactGA4;
21279
-
21280
21280
  /**
21281
21281
  *
21282
21282
  */
21283
21283
  function SubscriptionRenewModal(_ref) {
21284
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21284
21285
  let {
21285
21286
  onDisplay,
21286
21287
  onClose,
@@ -21289,10 +21290,11 @@ function SubscriptionRenewModal(_ref) {
21289
21290
  const {
21290
21291
  switchView
21291
21292
  } = usePelcro();
21293
+ 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;
21292
21294
  const onSuccess = res => {
21293
21295
  var _otherProps$onSuccess;
21294
21296
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21295
- if (enableReactGA4$7) {
21297
+ if (enableReactGA4) {
21296
21298
  ReactGA4.event("Renewed", {
21297
21299
  nonInteraction: true
21298
21300
  });
@@ -21309,7 +21311,7 @@ function SubscriptionRenewModal(_ref) {
21309
21311
  const onGiftRenewalSuccess = () => {
21310
21312
  var _otherProps$onGiftRen;
21311
21313
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21312
- if (enableReactGA4$7) {
21314
+ if (enableReactGA4) {
21313
21315
  ReactGA4.event("Renewed Gift", {
21314
21316
  nonInteraction: true
21315
21317
  });
@@ -21490,8 +21492,6 @@ function SvgSubscription(props) {
21490
21492
  }))))));
21491
21493
  }
21492
21494
 
21493
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21494
- const enableReactGA4$6 = (_window$6 = window) === null || _window$6 === void 0 ? void 0 : (_window$Pelcro$6 = _window$6.Pelcro) === null || _window$Pelcro$6 === void 0 ? void 0 : (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) === null || _window$Pelcro$uiSett$6 === void 0 ? void 0 : _window$Pelcro$uiSett$6.enableReactGA4;
21495
21495
  const SubscriptionCancelNowButton = _ref => {
21496
21496
  let {
21497
21497
  subscription,
@@ -21511,6 +21511,8 @@ const SubscriptionCancelNowButton = _ref => {
21511
21511
  t
21512
21512
  } = useTranslation("subscriptionCancel");
21513
21513
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21514
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21515
+ 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;
21514
21516
  window.Pelcro.subscription.cancel({
21515
21517
  auth_token: window.Pelcro.user.read().auth_token,
21516
21518
  subscription_id: payload.subscription_id,
@@ -21522,7 +21524,7 @@ const SubscriptionCancelNowButton = _ref => {
21522
21524
  if (err) {
21523
21525
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21524
21526
  }
21525
- if (enableReactGA4$6) {
21527
+ if (enableReactGA4) {
21526
21528
  ReactGA4.event("Canceled", {
21527
21529
  nonInteraction: true
21528
21530
  });
@@ -21568,8 +21570,6 @@ const SubscriptionCancelNowButton = _ref => {
21568
21570
  }, t("messages.cancelNow"));
21569
21571
  };
21570
21572
 
21571
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21572
- const enableReactGA4$5 = (_window$5 = window) === null || _window$5 === void 0 ? void 0 : (_window$Pelcro$5 = _window$5.Pelcro) === null || _window$Pelcro$5 === void 0 ? void 0 : (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) === null || _window$Pelcro$uiSett$5 === void 0 ? void 0 : _window$Pelcro$uiSett$5.enableReactGA4;
21573
21573
  const SubscriptionCancelLaterButton = _ref => {
21574
21574
  let {
21575
21575
  subscription,
@@ -21589,6 +21589,8 @@ const SubscriptionCancelLaterButton = _ref => {
21589
21589
  t
21590
21590
  } = useTranslation("subscriptionCancel");
21591
21591
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21592
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21593
+ 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;
21592
21594
  window.Pelcro.subscription.cancel({
21593
21595
  auth_token: window.Pelcro.user.read().auth_token,
21594
21596
  subscription_id: payload.subscription_id,
@@ -21600,7 +21602,7 @@ const SubscriptionCancelLaterButton = _ref => {
21600
21602
  if (err) {
21601
21603
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21602
21604
  }
21603
- if (enableReactGA4$5) {
21605
+ if (enableReactGA4) {
21604
21606
  ReactGA4.event("Canceled", {
21605
21607
  nonInteraction: true
21606
21608
  });
@@ -21816,9 +21818,8 @@ const SubscriptionSuspendDate = props => {
21816
21818
  }, props));
21817
21819
  };
21818
21820
 
21819
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21820
- const enableReactGA4$4 = (_window$4 = window) === null || _window$4 === void 0 ? void 0 : (_window$Pelcro$4 = _window$4.Pelcro) === null || _window$Pelcro$4 === void 0 ? void 0 : (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) === null || _window$Pelcro$uiSett$4 === void 0 ? void 0 : _window$Pelcro$uiSett$4.enableReactGA4;
21821
21821
  const SubscriptionSuspendButton = _ref => {
21822
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21822
21823
  let {
21823
21824
  subscription,
21824
21825
  onClick,
@@ -21837,6 +21838,7 @@ const SubscriptionSuspendButton = _ref => {
21837
21838
  const {
21838
21839
  t
21839
21840
  } = useTranslation("subscriptionSuspend");
21841
+ 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;
21840
21842
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21841
21843
  window.Pelcro.subscription.update({
21842
21844
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21847,7 +21849,7 @@ const SubscriptionSuspendButton = _ref => {
21847
21849
  if (err) {
21848
21850
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21849
21851
  }
21850
- if (enableReactGA4$4) {
21852
+ if (enableReactGA4) {
21851
21853
  ReactGA4.event("Suspended", {
21852
21854
  nonInteraction: true
21853
21855
  });
@@ -24571,8 +24573,6 @@ const AddressCreateLine2 = props => {
24571
24573
  }, props));
24572
24574
  };
24573
24575
 
24574
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
24575
- const enableReactGA4$3 = (_window$3 = window) === null || _window$3 === void 0 ? void 0 : (_window$Pelcro$3 = _window$3.Pelcro) === null || _window$Pelcro$3 === void 0 ? void 0 : (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) === null || _window$Pelcro$uiSett$3 === void 0 ? void 0 : _window$Pelcro$uiSett$3.enableReactGA4;
24576
24576
  const initialState$d = {
24577
24577
  isSubmitting: false,
24578
24578
  firstName: "",
@@ -24604,7 +24604,7 @@ const {
24604
24604
  Provider: Provider$d
24605
24605
  } = store$d;
24606
24606
  const AddressUpdateContainer = _ref => {
24607
- var _props$addressId;
24607
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24608
24608
  let {
24609
24609
  style,
24610
24610
  className = "",
@@ -24618,6 +24618,7 @@ const AddressUpdateContainer = _ref => {
24618
24618
  addressIdToEdit
24619
24619
  } = usePelcro();
24620
24620
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24621
+ 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;
24621
24622
  const [t] = useTranslation("address");
24622
24623
  React.useEffect(() => {
24623
24624
  const getCountries = () => {
@@ -24716,7 +24717,7 @@ const AddressUpdateContainer = _ref => {
24716
24717
  }
24717
24718
  });
24718
24719
  onSuccess(res);
24719
- if (enableReactGA4$3) {
24720
+ if (enableReactGA4) {
24720
24721
  ReactGA4.event("Updated address", {
24721
24722
  nonInteraction: true
24722
24723
  });
@@ -25251,13 +25252,13 @@ function PaymentMethodUpdateView(props) {
25251
25252
  }));
25252
25253
  }
25253
25254
 
25254
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25255
- const enableReactGA4$2 = (_window$2 = window) === null || _window$2 === void 0 ? void 0 : (_window$Pelcro$2 = _window$2.Pelcro) === null || _window$Pelcro$2 === void 0 ? void 0 : (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) === null || _window$Pelcro$uiSett$2 === void 0 ? void 0 : _window$Pelcro$uiSett$2.enableReactGA4;
25256
25255
  const PaymentMethodUpdateModal = props => {
25256
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25257
+ 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;
25257
25258
  const onSuccess = res => {
25258
25259
  var _props$onSuccess;
25259
25260
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25260
- if (enableReactGA4$2) {
25261
+ if (enableReactGA4) {
25261
25262
  ReactGA4.event("Updated payment card", {
25262
25263
  nonInteraction: true
25263
25264
  });
@@ -29145,8 +29146,6 @@ const OrderItems = _ref => {
29145
29146
  });
29146
29147
  };
29147
29148
 
29148
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
29149
- const enableReactGA4$1 = (_window$1 = window) === null || _window$1 === void 0 ? void 0 : (_window$Pelcro$1 = _window$1.Pelcro) === null || _window$Pelcro$1 === void 0 ? void 0 : (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) === null || _window$Pelcro$uiSett$1 === void 0 ? void 0 : _window$Pelcro$uiSett$1.enableReactGA4;
29150
29149
  const SavedItemsMenu = () => {
29151
29150
  const {
29152
29151
  t
@@ -29195,8 +29194,10 @@ const SavedItems = _ref3 => {
29195
29194
  isAuthenticated
29196
29195
  } = usePelcro();
29197
29196
  const removeItemFromMetadata = (category, title) => {
29197
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29198
29198
  const user = window.Pelcro.user.read();
29199
29199
  const oldValue = user.metadata[`metadata_saved_${category}`];
29200
+ 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;
29200
29201
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29201
29202
  if (isAuthenticated()) {
29202
29203
  setLoading(true);
@@ -29211,7 +29212,7 @@ const SavedItems = _ref3 => {
29211
29212
  return;
29212
29213
  }
29213
29214
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29214
- if (enableReactGA4$1) {
29215
+ if (enableReactGA4) {
29215
29216
  ReactGA4.event("Unsave/Unfollow", {
29216
29217
  event_label: title
29217
29218
  });
@@ -30175,8 +30176,6 @@ function getMemberShipStatus(status) {
30175
30176
  };
30176
30177
  }
30177
30178
 
30178
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
30179
- const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
30180
30179
  const SUB_MENUS = {
30181
30180
  PROFILE: "profile",
30182
30181
  SUBSCRIPTIONS: "subscriptions",
@@ -30231,7 +30230,7 @@ function DashboardWithHook(props) {
30231
30230
  DashboardWithHook.viewId = "dashboard";
30232
30231
  class Dashboard extends React.Component {
30233
30232
  constructor(props) {
30234
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30233
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30235
30234
  super(props);
30236
30235
  _defineProperty$3(this, "componentDidMount", () => {
30237
30236
  this.setState({
@@ -30240,7 +30239,7 @@ class Dashboard extends React.Component {
30240
30239
  window.Pelcro.insight.track("Modal Displayed", {
30241
30240
  name: "dashboard"
30242
30241
  });
30243
- if (enableReactGA4) {
30242
+ if (this.enableReactGA4) {
30244
30243
  ReactGA4.event("Dashboard Modal Viewed", {
30245
30244
  nonInteraction: true
30246
30245
  });
@@ -30282,7 +30281,7 @@ class Dashboard extends React.Component {
30282
30281
  if (err) {
30283
30282
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30284
30283
  }
30285
- if (enableReactGA4) {
30284
+ if (this.enableReactGA4) {
30286
30285
  ReactGA4.event("Canceled", {
30287
30286
  nonInteraction: true
30288
30287
  });
@@ -30306,7 +30305,7 @@ class Dashboard extends React.Component {
30306
30305
  if (err) {
30307
30306
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30308
30307
  }
30309
- if (enableReactGA4) {
30308
+ if (this.enableReactGA4) {
30310
30309
  ReactGA4.event("UnSuspended", {
30311
30310
  nonInteraction: true
30312
30311
  });
@@ -30602,6 +30601,7 @@ class Dashboard extends React.Component {
30602
30601
  this.locale = this.props.t;
30603
30602
  this.user = window.Pelcro.user.read();
30604
30603
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
30604
+ 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;
30605
30605
  }
30606
30606
  render() {
30607
30607
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
package/dist/index.esm.js CHANGED
@@ -8920,8 +8920,6 @@ exports["default"] = _default;
8920
8920
  var ReactGA4 = unwrapExports(dist);
8921
8921
  dist.ReactGAImplementation;
8922
8922
 
8923
- var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
8924
- const enableReactGA4$f = (_window$f = window) === null || _window$f === void 0 ? void 0 : (_window$Pelcro$f = _window$f.Pelcro) === null || _window$Pelcro$f === void 0 ? void 0 : (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) === null || _window$Pelcro$uiSett$f === void 0 ? void 0 : _window$Pelcro$uiSett$f.enableReactGA4;
8925
8923
  class PelcroActions {
8926
8924
  constructor(storeSetter, storeGetter) {
8927
8925
  var _this = this;
@@ -9101,18 +9099,20 @@ class PelcroActions {
9101
9099
  });
9102
9100
  });
9103
9101
  _defineProperty$3(this, "logout", function () {
9102
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9104
9103
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9105
9104
  const {
9106
9105
  switchView,
9107
9106
  resetView,
9108
9107
  isAuthenticated
9109
9108
  } = _this.get();
9109
+ 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;
9110
9110
  // if user is not authenticated function execution is terminated
9111
9111
  if (!isAuthenticated()) {
9112
9112
  return console.warn("You are already logged out.");
9113
9113
  }
9114
9114
  window.Pelcro.user.logout();
9115
- if (enableReactGA4$f) {
9115
+ if (enableReactGA4) {
9116
9116
  ReactGA4.event("Logged out", {
9117
9117
  nonInteraction: true
9118
9118
  });
@@ -9348,9 +9348,6 @@ if (process.env.NODE_ENV === "development") {
9348
9348
  c$1("Pelcro Store", usePelcro);
9349
9349
  }
9350
9350
 
9351
- var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9352
- const enableReactGA4$e = (_window$e = window) === null || _window$e === void 0 ? void 0 : (_window$Pelcro$e = _window$e.Pelcro) === null || _window$Pelcro$e === void 0 ? void 0 : (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) === null || _window$Pelcro$uiSett$e === void 0 ? void 0 : _window$Pelcro$uiSett$e.enableReactGA4;
9353
-
9354
9351
  /**
9355
9352
  * List of zero-decimal currencies.
9356
9353
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9436,8 +9433,8 @@ const getLanguageWithoutRegion = localeName => {
9436
9433
  * @return {string | undefined}
9437
9434
  */
9438
9435
  const getPageOrDefaultLanguage = () => {
9439
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9440
- 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);
9436
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9437
+ 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);
9441
9438
  };
9442
9439
 
9443
9440
  /**
@@ -9490,9 +9487,9 @@ const isValidViewFromURL = viewID => {
9490
9487
  *
9491
9488
  */
9492
9489
  function hasValidNewsletterUpdateUrl() {
9493
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9490
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9494
9491
  if (viewID !== "newsletter-update") return false;
9495
- 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;
9492
+ 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;
9496
9493
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9497
9494
  if (!siteHasNewslettersDefined) {
9498
9495
  return false;
@@ -9538,7 +9535,7 @@ const disableScroll = () => {
9538
9535
  }
9539
9536
  };
9540
9537
  const trackSubscriptionOnGA = () => {
9541
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9538
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9542
9539
  const {
9543
9540
  product,
9544
9541
  plan,
@@ -9553,11 +9550,12 @@ const trackSubscriptionOnGA = () => {
9553
9550
  invoices
9554
9551
  } = window.Pelcro.user.read();
9555
9552
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9553
+ 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;
9556
9554
  if (!lastSubscriptionId) {
9557
9555
  return;
9558
9556
  }
9559
9557
  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;
9560
- if (enableReactGA4$e) {
9558
+ if (enableReactGA4) {
9561
9559
  ReactGA4.event("purchase", {
9562
9560
  transaction_id: lastSubscriptionId,
9563
9561
  affiliation: "Pelcro",
@@ -9685,8 +9683,8 @@ function getDateWithoutTime(dateObject) {
9685
9683
  return date;
9686
9684
  }
9687
9685
  function userMustVerifyEmail() {
9688
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9689
- 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;
9686
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9687
+ 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;
9690
9688
  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;
9691
9689
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9692
9690
  }
@@ -10055,10 +10053,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10055
10053
  return descriptor.value;
10056
10054
  }
10057
10055
 
10058
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10059
10056
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10060
10057
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10061
- const enableReactGA4$d = (_window$d = window) === null || _window$d === void 0 ? void 0 : (_window$Pelcro$d = _window$d.Pelcro) === null || _window$Pelcro$d === void 0 ? void 0 : (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) === null || _window$Pelcro$uiSett$d === void 0 ? void 0 : _window$Pelcro$uiSett$d.enableReactGA4;
10062
10058
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10063
10059
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10064
10060
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10142,7 +10138,7 @@ class SaveToMetadataButtonClass {
10142
10138
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10143
10139
  writable: true,
10144
10140
  value: event => {
10145
- var _user$metadata;
10141
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10146
10142
  const button = event.currentTarget;
10147
10143
  const user = window.Pelcro.user.read();
10148
10144
  const {
@@ -10152,6 +10148,7 @@ class SaveToMetadataButtonClass {
10152
10148
  key,
10153
10149
  ...buttonMetadata
10154
10150
  } = button.dataset;
10151
+ 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;
10155
10152
  if (userMustVerifyEmail()) {
10156
10153
  return switchView("email-verify");
10157
10154
  }
@@ -10180,7 +10177,7 @@ class SaveToMetadataButtonClass {
10180
10177
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10181
10178
  }
10182
10179
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10183
- if (enableReactGA4$d) {
10180
+ if (enableReactGA4) {
10184
10181
  ReactGA4.event("Save/Follow", {
10185
10182
  event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10186
10183
  });
@@ -10199,6 +10196,7 @@ class SaveToMetadataButtonClass {
10199
10196
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10200
10197
  writable: true,
10201
10198
  value: event => {
10199
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10202
10200
  const button = event.currentTarget;
10203
10201
  const user = window.Pelcro.user.read();
10204
10202
  const {
@@ -10206,6 +10204,7 @@ class SaveToMetadataButtonClass {
10206
10204
  title
10207
10205
  } = button.dataset;
10208
10206
  const oldValue = user.metadata[`metadata_saved_${key}`];
10207
+ 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;
10209
10208
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10210
10209
  if (window.Pelcro.user.isAuthenticated()) {
10211
10210
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10218,7 +10217,7 @@ class SaveToMetadataButtonClass {
10218
10217
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10219
10218
  }
10220
10219
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10221
- if (enableReactGA4$d) {
10220
+ if (enableReactGA4) {
10222
10221
  ReactGA4.event("Unsave/Unfollow", {
10223
10222
  event_label: title
10224
10223
  });
@@ -11752,9 +11751,6 @@ function getSiteCardProcessor() {
11752
11751
  return "stripe";
11753
11752
  }
11754
11753
 
11755
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11756
- const enableReactGA4$c = (_window$c = window) === null || _window$c === void 0 ? void 0 : (_window$Pelcro$c = _window$c.Pelcro) === null || _window$Pelcro$c === void 0 ? void 0 : (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) === null || _window$Pelcro$uiSett$c === void 0 ? void 0 : _window$Pelcro$uiSett$c.enableReactGA4;
11757
-
11758
11754
  /**
11759
11755
  * @typedef {Object} OptionsType
11760
11756
  * @property {boolean} loadPaymentSDKs
@@ -11877,8 +11873,10 @@ const initSecuritySdk = () => {
11877
11873
  });
11878
11874
  };
11879
11875
  const initGATracking = () => {
11876
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11877
+ 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;
11880
11878
  if (window.Pelcro.site.read().google_analytics_id) {
11881
- if (enableReactGA4$c) {
11879
+ if (enableReactGA4) {
11882
11880
  // Initialize ReactGA4 with your tracking ID
11883
11881
  ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11884
11882
  // Enable e-commerce tracking
@@ -11890,20 +11888,26 @@ const initGATracking = () => {
11890
11888
  }
11891
11889
  }
11892
11890
  });
11891
+ console.log("enableReactGA4: ", enableReactGA4);
11892
+ console.log("GA4 is initialized");
11893
11893
  } else {
11894
11894
  var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11895
11895
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
11896
11896
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11897
+ console.log("enableReactGA4: " + enableReactGA4);
11898
+ console.log("GA3 is initialized");
11897
11899
  }
11898
11900
  }
11899
11901
  };
11900
11902
  const dispatchModalDisplayEvents = modalName => {
11901
- var _modalName$replace, _modalName$replace2;
11903
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11904
+ 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;
11902
11905
  const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11903
- if (enableReactGA4$c) {
11906
+ if (enableReactGA4) {
11904
11907
  ReactGA4.event(`${formattedAction} viewed`, {
11905
11908
  nonInteraction: true
11906
11909
  });
11910
+ console.log("GA4 view event is fired");
11907
11911
  } else {
11908
11912
  var _ReactGA$event;
11909
11913
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
@@ -11911,6 +11915,7 @@ const dispatchModalDisplayEvents = modalName => {
11911
11915
  action: `${formattedAction} viewed`,
11912
11916
  nonInteraction: true
11913
11917
  });
11918
+ console.log("GA3 view event is fired");
11914
11919
  }
11915
11920
  window.Pelcro.insight.track("Modal Displayed", {
11916
11921
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
@@ -12786,8 +12791,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12786
12791
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12787
12792
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12788
12793
 
12789
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12790
- const enableReactGA4$b = (_window$b = window) === null || _window$b === void 0 ? void 0 : (_window$Pelcro$b = _window$b.Pelcro) === null || _window$Pelcro$b === void 0 ? void 0 : (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) === null || _window$Pelcro$uiSett$b === void 0 ? void 0 : _window$Pelcro$uiSett$b.enableReactGA4;
12791
12794
  const initialState$m = {
12792
12795
  email: "",
12793
12796
  username: "",
@@ -12806,6 +12809,7 @@ const {
12806
12809
  Provider: Provider$m
12807
12810
  } = store$m;
12808
12811
  const LoginContainer = _ref => {
12812
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12809
12813
  let {
12810
12814
  style,
12811
12815
  className = "",
@@ -12813,6 +12817,7 @@ const LoginContainer = _ref => {
12813
12817
  onFailure = () => {},
12814
12818
  children
12815
12819
  } = _ref;
12820
+ 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;
12816
12821
  const handleLogin = (_ref2, dispatch) => {
12817
12822
  let {
12818
12823
  email,
@@ -12843,7 +12848,7 @@ const LoginContainer = _ref => {
12843
12848
  onFailure(err);
12844
12849
  } else {
12845
12850
  onSuccess(res);
12846
- if (enableReactGA4$b) {
12851
+ if (enableReactGA4) {
12847
12852
  ReactGA4.event("Logged in", {
12848
12853
  nonInteraction: true
12849
12854
  });
@@ -13240,12 +13245,12 @@ function ConfirmPassword(_ref) {
13240
13245
  }, otherProps));
13241
13246
  }
13242
13247
 
13243
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13244
- const enableReactGA4$a = (_window$a = window) === null || _window$a === void 0 ? void 0 : (_window$Pelcro$a = _window$a.Pelcro) === null || _window$Pelcro$a === void 0 ? void 0 : (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) === null || _window$Pelcro$uiSett$a === void 0 ? void 0 : _window$Pelcro$uiSett$a.enableReactGA4;
13245
13248
  const Logout = props => {
13246
13249
  const handleLogout = () => {
13250
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13247
13251
  window.Pelcro.user.logout();
13248
- if (enableReactGA4$a) {
13252
+ 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;
13253
+ if (enableReactGA4) {
13249
13254
  ReactGA4.event("Logged out", {
13250
13255
  nonInteraction: true
13251
13256
  });
@@ -14814,13 +14819,11 @@ const RegisterCompany = props => {
14814
14819
  }, props));
14815
14820
  };
14816
14821
 
14817
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14818
- const enableReactGA4$9 = (_window$9 = window) === null || _window$9 === void 0 ? void 0 : (_window$Pelcro$9 = _window$9.Pelcro) === null || _window$Pelcro$9 === void 0 ? void 0 : (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) === null || _window$Pelcro$uiSett$9 === void 0 ? void 0 : _window$Pelcro$uiSett$9.enableReactGA4;
14819
-
14820
14822
  /**
14821
14823
  *
14822
14824
  */
14823
14825
  function RegisterModal(props) {
14826
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14824
14827
  const {
14825
14828
  t
14826
14829
  } = useTranslation("register");
@@ -14835,6 +14838,7 @@ function RegisterModal(props) {
14835
14838
  giftCode,
14836
14839
  isGift
14837
14840
  } = usePelcro();
14841
+ 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;
14838
14842
  const onSuccess = res => {
14839
14843
  var _props$onSuccess;
14840
14844
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -14842,7 +14846,7 @@ function RegisterModal(props) {
14842
14846
  };
14843
14847
  const handleAfterRegistrationLogic = () => {
14844
14848
  var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14845
- if (enableReactGA4$9) {
14849
+ if (enableReactGA4) {
14846
14850
  ReactGA4.event("Registered", {
14847
14851
  nonInteraction: true
14848
14852
  });
@@ -14940,9 +14944,6 @@ function Radio(_ref) {
14940
14944
  }, children));
14941
14945
  }
14942
14946
 
14943
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14944
- const enableReactGA4$8 = (_window$8 = window) === null || _window$8 === void 0 ? void 0 : (_window$Pelcro$8 = _window$8.Pelcro) === null || _window$Pelcro$8 === void 0 ? void 0 : (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) === null || _window$Pelcro$uiSett$8 === void 0 ? void 0 : _window$Pelcro$uiSett$8.enableReactGA4;
14945
-
14946
14947
  /**
14947
14948
  *
14948
14949
  */
@@ -15002,6 +15003,7 @@ function productMatchPageLanguage(product) {
15002
15003
  SelectModalWithHook.viewId = "plan-select";
15003
15004
  class SelectModal extends Component {
15004
15005
  constructor(props) {
15006
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
15005
15007
  super(props);
15006
15008
  _defineProperty$3(this, "componentDidMount", () => {
15007
15009
  if (this.props.product) {
@@ -15036,11 +15038,11 @@ class SelectModal extends Component {
15036
15038
  }
15037
15039
  document.addEventListener("keydown", this.handleSubmit);
15038
15040
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
15039
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
15040
- 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;
15041
- 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;
15042
- 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;
15043
- 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 => {
15041
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15042
+ 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;
15043
+ 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;
15044
+ 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;
15045
+ 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 => {
15044
15046
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
15045
15047
  if (filteredPlans.length) return filteredPlans;
15046
15048
  });
@@ -15053,12 +15055,12 @@ class SelectModal extends Component {
15053
15055
  });
15054
15056
  notifyBugsnag(() => {
15055
15057
  Bugsnag.notify("SelectModal - No data viewed", event => {
15056
- 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;
15058
+ 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;
15057
15059
  event.addMetadata("MetaData", {
15058
- 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(),
15059
- 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(),
15060
- 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,
15061
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
15060
+ 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(),
15061
+ 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(),
15062
+ 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,
15063
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15062
15064
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15063
15065
  productListState: this.state.productList,
15064
15066
  methods: {
@@ -15069,8 +15071,8 @@ class SelectModal extends Component {
15069
15071
  userCurrency: userCurrency,
15070
15072
  userCountry: userCountry,
15071
15073
  userLanguage: userLanguage,
15072
- 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(),
15073
- 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,
15074
+ 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(),
15075
+ 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,
15074
15076
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15075
15077
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15076
15078
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15282,6 +15284,7 @@ class SelectModal extends Component {
15282
15284
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15283
15285
  this.locale = this.props.t;
15284
15286
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15287
+ 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;
15285
15288
  }
15286
15289
  render() {
15287
15290
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15289,7 +15292,7 @@ class SelectModal extends Component {
15289
15292
  disableGifting
15290
15293
  } = this.props;
15291
15294
  if (this.state.mode === "product") {
15292
- if (enableReactGA4$8) {
15295
+ if (this.enableReactGA4) {
15293
15296
  ReactGA4.event("Product Modal Viewed", {
15294
15297
  nonInteraction: true
15295
15298
  });
@@ -15302,7 +15305,7 @@ class SelectModal extends Component {
15302
15305
  });
15303
15306
  }
15304
15307
  } else if (this.state.mode === "plan") {
15305
- if (enableReactGA4$8) {
15308
+ if (this.enableReactGA4) {
15306
15309
  ReactGA4.event("Plan Modal Viewed", {
15307
15310
  nonInteraction: true
15308
15311
  });
@@ -21244,13 +21247,11 @@ const SubscriptionRenewView = _ref => {
21244
21247
  }));
21245
21248
  };
21246
21249
 
21247
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
21248
- const enableReactGA4$7 = (_window$7 = window) === null || _window$7 === void 0 ? void 0 : (_window$Pelcro$7 = _window$7.Pelcro) === null || _window$Pelcro$7 === void 0 ? void 0 : (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) === null || _window$Pelcro$uiSett$7 === void 0 ? void 0 : _window$Pelcro$uiSett$7.enableReactGA4;
21249
-
21250
21250
  /**
21251
21251
  *
21252
21252
  */
21253
21253
  function SubscriptionRenewModal(_ref) {
21254
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21254
21255
  let {
21255
21256
  onDisplay,
21256
21257
  onClose,
@@ -21259,10 +21260,11 @@ function SubscriptionRenewModal(_ref) {
21259
21260
  const {
21260
21261
  switchView
21261
21262
  } = usePelcro();
21263
+ 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;
21262
21264
  const onSuccess = res => {
21263
21265
  var _otherProps$onSuccess;
21264
21266
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21265
- if (enableReactGA4$7) {
21267
+ if (enableReactGA4) {
21266
21268
  ReactGA4.event("Renewed", {
21267
21269
  nonInteraction: true
21268
21270
  });
@@ -21279,7 +21281,7 @@ function SubscriptionRenewModal(_ref) {
21279
21281
  const onGiftRenewalSuccess = () => {
21280
21282
  var _otherProps$onGiftRen;
21281
21283
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21282
- if (enableReactGA4$7) {
21284
+ if (enableReactGA4) {
21283
21285
  ReactGA4.event("Renewed Gift", {
21284
21286
  nonInteraction: true
21285
21287
  });
@@ -21460,8 +21462,6 @@ function SvgSubscription(props) {
21460
21462
  }))))));
21461
21463
  }
21462
21464
 
21463
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21464
- const enableReactGA4$6 = (_window$6 = window) === null || _window$6 === void 0 ? void 0 : (_window$Pelcro$6 = _window$6.Pelcro) === null || _window$Pelcro$6 === void 0 ? void 0 : (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) === null || _window$Pelcro$uiSett$6 === void 0 ? void 0 : _window$Pelcro$uiSett$6.enableReactGA4;
21465
21465
  const SubscriptionCancelNowButton = _ref => {
21466
21466
  let {
21467
21467
  subscription,
@@ -21481,6 +21481,8 @@ const SubscriptionCancelNowButton = _ref => {
21481
21481
  t
21482
21482
  } = useTranslation("subscriptionCancel");
21483
21483
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21484
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21485
+ 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;
21484
21486
  window.Pelcro.subscription.cancel({
21485
21487
  auth_token: window.Pelcro.user.read().auth_token,
21486
21488
  subscription_id: payload.subscription_id,
@@ -21492,7 +21494,7 @@ const SubscriptionCancelNowButton = _ref => {
21492
21494
  if (err) {
21493
21495
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21494
21496
  }
21495
- if (enableReactGA4$6) {
21497
+ if (enableReactGA4) {
21496
21498
  ReactGA4.event("Canceled", {
21497
21499
  nonInteraction: true
21498
21500
  });
@@ -21538,8 +21540,6 @@ const SubscriptionCancelNowButton = _ref => {
21538
21540
  }, t("messages.cancelNow"));
21539
21541
  };
21540
21542
 
21541
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21542
- const enableReactGA4$5 = (_window$5 = window) === null || _window$5 === void 0 ? void 0 : (_window$Pelcro$5 = _window$5.Pelcro) === null || _window$Pelcro$5 === void 0 ? void 0 : (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) === null || _window$Pelcro$uiSett$5 === void 0 ? void 0 : _window$Pelcro$uiSett$5.enableReactGA4;
21543
21543
  const SubscriptionCancelLaterButton = _ref => {
21544
21544
  let {
21545
21545
  subscription,
@@ -21559,6 +21559,8 @@ const SubscriptionCancelLaterButton = _ref => {
21559
21559
  t
21560
21560
  } = useTranslation("subscriptionCancel");
21561
21561
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21562
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21563
+ 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;
21562
21564
  window.Pelcro.subscription.cancel({
21563
21565
  auth_token: window.Pelcro.user.read().auth_token,
21564
21566
  subscription_id: payload.subscription_id,
@@ -21570,7 +21572,7 @@ const SubscriptionCancelLaterButton = _ref => {
21570
21572
  if (err) {
21571
21573
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21572
21574
  }
21573
- if (enableReactGA4$5) {
21575
+ if (enableReactGA4) {
21574
21576
  ReactGA4.event("Canceled", {
21575
21577
  nonInteraction: true
21576
21578
  });
@@ -21786,9 +21788,8 @@ const SubscriptionSuspendDate = props => {
21786
21788
  }, props));
21787
21789
  };
21788
21790
 
21789
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21790
- const enableReactGA4$4 = (_window$4 = window) === null || _window$4 === void 0 ? void 0 : (_window$Pelcro$4 = _window$4.Pelcro) === null || _window$Pelcro$4 === void 0 ? void 0 : (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) === null || _window$Pelcro$uiSett$4 === void 0 ? void 0 : _window$Pelcro$uiSett$4.enableReactGA4;
21791
21791
  const SubscriptionSuspendButton = _ref => {
21792
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21792
21793
  let {
21793
21794
  subscription,
21794
21795
  onClick,
@@ -21807,6 +21808,7 @@ const SubscriptionSuspendButton = _ref => {
21807
21808
  const {
21808
21809
  t
21809
21810
  } = useTranslation("subscriptionSuspend");
21811
+ 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;
21810
21812
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21811
21813
  window.Pelcro.subscription.update({
21812
21814
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21817,7 +21819,7 @@ const SubscriptionSuspendButton = _ref => {
21817
21819
  if (err) {
21818
21820
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21819
21821
  }
21820
- if (enableReactGA4$4) {
21822
+ if (enableReactGA4) {
21821
21823
  ReactGA4.event("Suspended", {
21822
21824
  nonInteraction: true
21823
21825
  });
@@ -24541,8 +24543,6 @@ const AddressCreateLine2 = props => {
24541
24543
  }, props));
24542
24544
  };
24543
24545
 
24544
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
24545
- const enableReactGA4$3 = (_window$3 = window) === null || _window$3 === void 0 ? void 0 : (_window$Pelcro$3 = _window$3.Pelcro) === null || _window$Pelcro$3 === void 0 ? void 0 : (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) === null || _window$Pelcro$uiSett$3 === void 0 ? void 0 : _window$Pelcro$uiSett$3.enableReactGA4;
24546
24546
  const initialState$d = {
24547
24547
  isSubmitting: false,
24548
24548
  firstName: "",
@@ -24574,7 +24574,7 @@ const {
24574
24574
  Provider: Provider$d
24575
24575
  } = store$d;
24576
24576
  const AddressUpdateContainer = _ref => {
24577
- var _props$addressId;
24577
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24578
24578
  let {
24579
24579
  style,
24580
24580
  className = "",
@@ -24588,6 +24588,7 @@ const AddressUpdateContainer = _ref => {
24588
24588
  addressIdToEdit
24589
24589
  } = usePelcro();
24590
24590
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24591
+ 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;
24591
24592
  const [t] = useTranslation("address");
24592
24593
  useEffect(() => {
24593
24594
  const getCountries = () => {
@@ -24686,7 +24687,7 @@ const AddressUpdateContainer = _ref => {
24686
24687
  }
24687
24688
  });
24688
24689
  onSuccess(res);
24689
- if (enableReactGA4$3) {
24690
+ if (enableReactGA4) {
24690
24691
  ReactGA4.event("Updated address", {
24691
24692
  nonInteraction: true
24692
24693
  });
@@ -25221,13 +25222,13 @@ function PaymentMethodUpdateView(props) {
25221
25222
  }));
25222
25223
  }
25223
25224
 
25224
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25225
- const enableReactGA4$2 = (_window$2 = window) === null || _window$2 === void 0 ? void 0 : (_window$Pelcro$2 = _window$2.Pelcro) === null || _window$Pelcro$2 === void 0 ? void 0 : (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) === null || _window$Pelcro$uiSett$2 === void 0 ? void 0 : _window$Pelcro$uiSett$2.enableReactGA4;
25226
25225
  const PaymentMethodUpdateModal = props => {
25226
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25227
+ 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;
25227
25228
  const onSuccess = res => {
25228
25229
  var _props$onSuccess;
25229
25230
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25230
- if (enableReactGA4$2) {
25231
+ if (enableReactGA4) {
25231
25232
  ReactGA4.event("Updated payment card", {
25232
25233
  nonInteraction: true
25233
25234
  });
@@ -29115,8 +29116,6 @@ const OrderItems = _ref => {
29115
29116
  });
29116
29117
  };
29117
29118
 
29118
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
29119
- const enableReactGA4$1 = (_window$1 = window) === null || _window$1 === void 0 ? void 0 : (_window$Pelcro$1 = _window$1.Pelcro) === null || _window$Pelcro$1 === void 0 ? void 0 : (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) === null || _window$Pelcro$uiSett$1 === void 0 ? void 0 : _window$Pelcro$uiSett$1.enableReactGA4;
29120
29119
  const SavedItemsMenu = () => {
29121
29120
  const {
29122
29121
  t
@@ -29165,8 +29164,10 @@ const SavedItems = _ref3 => {
29165
29164
  isAuthenticated
29166
29165
  } = usePelcro();
29167
29166
  const removeItemFromMetadata = (category, title) => {
29167
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29168
29168
  const user = window.Pelcro.user.read();
29169
29169
  const oldValue = user.metadata[`metadata_saved_${category}`];
29170
+ 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;
29170
29171
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29171
29172
  if (isAuthenticated()) {
29172
29173
  setLoading(true);
@@ -29181,7 +29182,7 @@ const SavedItems = _ref3 => {
29181
29182
  return;
29182
29183
  }
29183
29184
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29184
- if (enableReactGA4$1) {
29185
+ if (enableReactGA4) {
29185
29186
  ReactGA4.event("Unsave/Unfollow", {
29186
29187
  event_label: title
29187
29188
  });
@@ -30145,8 +30146,6 @@ function getMemberShipStatus(status) {
30145
30146
  };
30146
30147
  }
30147
30148
 
30148
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
30149
- const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
30150
30149
  const SUB_MENUS = {
30151
30150
  PROFILE: "profile",
30152
30151
  SUBSCRIPTIONS: "subscriptions",
@@ -30201,7 +30200,7 @@ function DashboardWithHook(props) {
30201
30200
  DashboardWithHook.viewId = "dashboard";
30202
30201
  class Dashboard extends Component {
30203
30202
  constructor(props) {
30204
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30203
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30205
30204
  super(props);
30206
30205
  _defineProperty$3(this, "componentDidMount", () => {
30207
30206
  this.setState({
@@ -30210,7 +30209,7 @@ class Dashboard extends Component {
30210
30209
  window.Pelcro.insight.track("Modal Displayed", {
30211
30210
  name: "dashboard"
30212
30211
  });
30213
- if (enableReactGA4) {
30212
+ if (this.enableReactGA4) {
30214
30213
  ReactGA4.event("Dashboard Modal Viewed", {
30215
30214
  nonInteraction: true
30216
30215
  });
@@ -30252,7 +30251,7 @@ class Dashboard extends Component {
30252
30251
  if (err) {
30253
30252
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30254
30253
  }
30255
- if (enableReactGA4) {
30254
+ if (this.enableReactGA4) {
30256
30255
  ReactGA4.event("Canceled", {
30257
30256
  nonInteraction: true
30258
30257
  });
@@ -30276,7 +30275,7 @@ class Dashboard extends Component {
30276
30275
  if (err) {
30277
30276
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30278
30277
  }
30279
- if (enableReactGA4) {
30278
+ if (this.enableReactGA4) {
30280
30279
  ReactGA4.event("UnSuspended", {
30281
30280
  nonInteraction: true
30282
30281
  });
@@ -30572,6 +30571,7 @@ class Dashboard extends Component {
30572
30571
  this.locale = this.props.t;
30573
30572
  this.user = window.Pelcro.user.read();
30574
30573
  this.menuRef = /*#__PURE__*/React__default.createRef();
30574
+ 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;
30575
30575
  }
30576
30576
  render() {
30577
30577
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.2",
4
+ "version": "3.26.0-beta.3",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",