@pelcro/react-pelcro-js 3.26.0 → 3.27.0

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
@@ -4048,12 +4048,16 @@ var invoiceDetails_en = {
4048
4048
  var labels$R = {
4049
4049
  title: "Cancel subscription",
4050
4050
  cancelReason: "Cancellation reason",
4051
+ endOn: "End on",
4052
+ endImmediately: "End immediately",
4053
+ cancel: "Cancel",
4051
4054
  subCancellation: {
4052
4055
  goBack: "Go back"
4053
4056
  }
4054
4057
  };
4055
4058
  var messages$T = {
4056
4059
  subscriptionEnd: "This subscription is set to expire on",
4060
+ cancelWhen: "When would you like to cancel?",
4057
4061
  cancelNow: "Cancel Subscription Now",
4058
4062
  cancelLater: "Cancel at Period End",
4059
4063
  subCancellation: {
@@ -4916,12 +4920,16 @@ var invoiceDetails_fr = {
4916
4920
  var labels$A = {
4917
4921
  title: "Annuler l'abonnement",
4918
4922
  cancelReason: "Motif d'annulation",
4923
+ endOn: "Fin sur",
4924
+ endImmediately: "Fin immédiate",
4925
+ cancel: "Annuler",
4919
4926
  subCancellation: {
4920
4927
  goBack: "Retourner"
4921
4928
  }
4922
4929
  };
4923
4930
  var messages$B = {
4924
4931
  subscriptionEnd: "Cet abonnement doit expirer le",
4932
+ cancelWhen: "Quand voulez-vous annuler?",
4925
4933
  cancelNow: "Cancel Subscription Now",
4926
4934
  cancelLater: "Annuler l'abonnement maintenant",
4927
4935
  subCancellation: {
@@ -5890,12 +5898,16 @@ var invoiceDetails_ko = {
5890
5898
  var labels$j = {
5891
5899
  title: "구독 취소",
5892
5900
  cancelReason: "취소 사유",
5901
+ endOn: "종료",
5902
+ endImmediately: "즉시 종료",
5903
+ cancel: "취소",
5893
5904
  subCancellation: {
5894
5905
  goBack: "돌아가기"
5895
5906
  }
5896
5907
  };
5897
5908
  var messages$j = {
5898
5909
  subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
5910
+ cancelWhen: "언제 취소하시겠습니까?",
5899
5911
  cancelNow: "지금 구독 취소",
5900
5912
  cancelLater: "기간 종료 시 취소",
5901
5913
  subCancellation: {
@@ -6750,12 +6762,16 @@ var invoiceDetails_es = {
6750
6762
  var labels$2 = {
6751
6763
  title: "Cancelar suscripción",
6752
6764
  cancelReason: "Razón de la cancelación",
6765
+ endOn: "Fin de",
6766
+ endImmediately: "Fin inmediato",
6767
+ cancel: "Cancelar",
6753
6768
  subCancellation: {
6754
6769
  goBack: "Volver"
6755
6770
  }
6756
6771
  };
6757
6772
  var messages$1 = {
6758
6773
  subscriptionEnd: "Esta suscripción expirará el",
6774
+ cancelWhen: "¿Cuándo desea cancelar?",
6759
6775
  cancelNow: "Cancelar Suscripción Ahora",
6760
6776
  cancelLater: "Cancelar al Final del Periodo",
6761
6777
  subCancellation: {
@@ -8193,7 +8209,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8193
8209
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8194
8210
  OutboundLink$1.trackLink = outboundLink;
8195
8211
  var OutboundLink = OutboundLink$1;
8196
- var ReactGA1 = _objectSpread({}, Defaults, {
8212
+ var ReactGA = _objectSpread({}, Defaults, {
8197
8213
  OutboundLink: OutboundLink
8198
8214
  });
8199
8215
 
@@ -8732,8 +8748,6 @@ exports["default"] = _default;
8732
8748
  var ReactGA4 = unwrapExports(dist);
8733
8749
  dist.ReactGAImplementation;
8734
8750
 
8735
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8736
- const ReactGA$d = (_window$d = window) !== null && _window$d !== void 0 && (_window$Pelcro$d = _window$d.Pelcro) !== null && _window$Pelcro$d !== void 0 && (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) !== null && _window$Pelcro$uiSett$d !== void 0 && _window$Pelcro$uiSett$d.enableReactGA4 ? ReactGA4 : ReactGA1;
8737
8751
  class PelcroActions {
8738
8752
  constructor(storeSetter, storeGetter) {
8739
8753
  var _this = this;
@@ -8913,23 +8927,31 @@ class PelcroActions {
8913
8927
  });
8914
8928
  });
8915
8929
  _defineProperty$3(this, "logout", function () {
8916
- var _ReactGA$event;
8930
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
8917
8931
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8918
8932
  const {
8919
8933
  switchView,
8920
8934
  resetView,
8921
8935
  isAuthenticated
8922
8936
  } = _this.get();
8937
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
8923
8938
  // if user is not authenticated function execution is terminated
8924
8939
  if (!isAuthenticated()) {
8925
8940
  return console.warn("You are already logged out.");
8926
8941
  }
8927
8942
  window.Pelcro.user.logout();
8928
- ReactGA$d === null || ReactGA$d === void 0 ? void 0 : (_ReactGA$event = ReactGA$d.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$d, {
8929
- category: "ACTIONS",
8930
- action: "Logged out",
8931
- nonInteraction: true
8932
- });
8943
+ if (enableReactGA4) {
8944
+ ReactGA4.event("Logged out", {
8945
+ nonInteraction: true
8946
+ });
8947
+ } else {
8948
+ var _ReactGA$event;
8949
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
8950
+ category: "ACTIONS",
8951
+ action: "Logged out",
8952
+ nonInteraction: true
8953
+ });
8954
+ }
8933
8955
  resetView();
8934
8956
  if (displayLogin) {
8935
8957
  switchView("login");
@@ -8942,7 +8964,7 @@ class PelcroActions {
8942
8964
  return false;
8943
8965
  }
8944
8966
 
8945
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
8967
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
8946
8968
  document.dispatchEvent(cartItemAdded(itemToAdd));
8947
8969
  const {
8948
8970
  cartItems
@@ -9151,9 +9173,6 @@ if (process.env.NODE_ENV === "development") {
9151
9173
  c$1("Pelcro Store", usePelcro);
9152
9174
  }
9153
9175
 
9154
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9155
- const ReactGA$c = (_window$c = window) !== null && _window$c !== void 0 && (_window$Pelcro$c = _window$c.Pelcro) !== null && _window$Pelcro$c !== void 0 && (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) !== null && _window$Pelcro$uiSett$c !== void 0 && _window$Pelcro$uiSett$c.enableReactGA4 ? ReactGA4 : ReactGA1;
9156
-
9157
9176
  /**
9158
9177
  * List of zero-decimal currencies.
9159
9178
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9239,8 +9258,8 @@ const getLanguageWithoutRegion = localeName => {
9239
9258
  * @return {string | undefined}
9240
9259
  */
9241
9260
  const getPageOrDefaultLanguage = () => {
9242
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9243
- return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : (_window$Pelcro2$site$ = _window$Pelcro2$site.read) === null || _window$Pelcro2$site$ === void 0 ? void 0 : (_window$Pelcro2$site$2 = _window$Pelcro2$site$.call(_window$Pelcro2$site)) === null || _window$Pelcro2$site$2 === void 0 ? void 0 : _window$Pelcro2$site$2.default_locale);
9261
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9262
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
9244
9263
  };
9245
9264
 
9246
9265
  /**
@@ -9293,9 +9312,9 @@ const isValidViewFromURL = viewID => {
9293
9312
  *
9294
9313
  */
9295
9314
  function hasValidNewsletterUpdateUrl() {
9296
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9315
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9297
9316
  if (viewID !== "newsletter-update") return false;
9298
- const newsletters = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.newsletters;
9317
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
9299
9318
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9300
9319
  if (!siteHasNewslettersDefined) {
9301
9320
  return false;
@@ -9341,7 +9360,7 @@ const disableScroll = () => {
9341
9360
  }
9342
9361
  };
9343
9362
  const trackSubscriptionOnGA = () => {
9344
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9363
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9345
9364
  const {
9346
9365
  product,
9347
9366
  plan,
@@ -9356,33 +9375,56 @@ const trackSubscriptionOnGA = () => {
9356
9375
  invoices
9357
9376
  } = window.Pelcro.user.read();
9358
9377
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9378
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro3 = _window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.enableReactGA4;
9359
9379
  if (!lastSubscriptionId) {
9360
9380
  return;
9361
9381
  }
9362
9382
  const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
9363
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$set = ReactGA$c.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA$c, {
9364
- currencyCode: currencyCode
9365
- });
9366
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$c.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9367
- id: lastSubscriptionId,
9368
- affiliation: "Pelcro",
9369
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9370
- coupon: couponCode
9371
- });
9372
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA$c.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9373
- id: lastSubscriptionId,
9374
- name: product.name,
9375
- category: product.description,
9376
- variant: plan.nickname,
9377
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9378
- quantity: 1
9379
- });
9380
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA$c.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9381
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$event = ReactGA$c.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$c, {
9382
- category: "ACTIONS",
9383
- action: "Subscribed",
9384
- nonInteraction: true
9385
- });
9383
+ if (enableReactGA4) {
9384
+ ReactGA4.event("purchase", {
9385
+ transaction_id: lastSubscriptionId,
9386
+ affiliation: "Pelcro",
9387
+ currency: currencyCode,
9388
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9389
+ coupon: couponCode,
9390
+ items: [{
9391
+ item_id: lastSubscriptionId,
9392
+ item_name: product.name,
9393
+ item_category: product.description,
9394
+ item_variant: plan.nickname,
9395
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9396
+ quantity: 1
9397
+ }]
9398
+ });
9399
+ ReactGA4.event("Subscribed", {
9400
+ nonInteraction: true
9401
+ });
9402
+ } else {
9403
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9404
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9405
+ currencyCode: currencyCode
9406
+ });
9407
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9408
+ id: lastSubscriptionId,
9409
+ affiliation: "Pelcro",
9410
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9411
+ coupon: couponCode
9412
+ });
9413
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9414
+ id: lastSubscriptionId,
9415
+ name: product.name,
9416
+ category: product.description,
9417
+ variant: plan.nickname,
9418
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9419
+ quantity: 1
9420
+ });
9421
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9422
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9423
+ category: "ACTIONS",
9424
+ action: "Subscribed",
9425
+ nonInteraction: true
9426
+ });
9427
+ }
9386
9428
  };
9387
9429
 
9388
9430
  /** check wether or not the user have any existing payment method
@@ -9466,14 +9508,14 @@ function getDateWithoutTime(dateObject) {
9466
9508
  return date;
9467
9509
  }
9468
9510
  function userMustVerifyEmail() {
9469
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9470
- const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
9511
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9512
+ const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
9471
9513
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
9472
9514
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9473
9515
  }
9474
9516
  function notifyBugsnag(callback, startOptions) {
9475
9517
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9476
- //load bugsnag CDN
9518
+ // load bugsnag CDN
9477
9519
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9478
9520
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9479
9521
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -9652,10 +9694,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
9652
9694
  return descriptor.value;
9653
9695
  }
9654
9696
 
9655
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
9656
9697
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
9657
9698
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9658
- const ReactGA$b = (_window$b = window) !== null && _window$b !== void 0 && (_window$Pelcro$b = _window$b.Pelcro) !== null && _window$Pelcro$b !== void 0 && (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) !== null && _window$Pelcro$uiSett$b !== void 0 && _window$Pelcro$uiSett$b.enableReactGA4 ? ReactGA4 : ReactGA1;
9659
9699
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
9660
9700
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
9661
9701
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -9739,7 +9779,7 @@ class SaveToMetadataButtonClass {
9739
9779
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
9740
9780
  writable: true,
9741
9781
  value: event => {
9742
- var _user$metadata;
9782
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
9743
9783
  const button = event.currentTarget;
9744
9784
  const user = window.Pelcro.user.read();
9745
9785
  const {
@@ -9749,6 +9789,7 @@ class SaveToMetadataButtonClass {
9749
9789
  key,
9750
9790
  ...buttonMetadata
9751
9791
  } = button.dataset;
9792
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
9752
9793
  if (userMustVerifyEmail()) {
9753
9794
  return switchView("email-verify");
9754
9795
  }
@@ -9773,16 +9814,22 @@ class SaveToMetadataButtonClass {
9773
9814
  value: newMetadataValue,
9774
9815
  auth_token: window.Pelcro.user.read().auth_token
9775
9816
  }, (err, resp) => {
9776
- var _ReactGA$event;
9777
9817
  if (err) {
9778
9818
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
9779
9819
  }
9780
9820
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
9781
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event = ReactGA$b.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$b, {
9782
- category: "ACTIONS",
9783
- action: "Save/Follow",
9784
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9785
- });
9821
+ if (enableReactGA4) {
9822
+ ReactGA4.event("Save/Follow", {
9823
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9824
+ });
9825
+ } else {
9826
+ var _ReactGA$event;
9827
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9828
+ category: "ACTIONS",
9829
+ action: "Save/Follow",
9830
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
9831
+ });
9832
+ }
9786
9833
  });
9787
9834
  }
9788
9835
  }
@@ -9790,6 +9837,7 @@ class SaveToMetadataButtonClass {
9790
9837
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
9791
9838
  writable: true,
9792
9839
  value: event => {
9840
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
9793
9841
  const button = event.currentTarget;
9794
9842
  const user = window.Pelcro.user.read();
9795
9843
  const {
@@ -9797,6 +9845,7 @@ class SaveToMetadataButtonClass {
9797
9845
  title
9798
9846
  } = button.dataset;
9799
9847
  const oldValue = user.metadata[`metadata_saved_${key}`];
9848
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
9800
9849
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
9801
9850
  if (window.Pelcro.user.isAuthenticated()) {
9802
9851
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -9805,16 +9854,22 @@ class SaveToMetadataButtonClass {
9805
9854
  value: newMetadataValue,
9806
9855
  auth_token: window.Pelcro.user.read().auth_token
9807
9856
  }, (err, resp) => {
9808
- var _ReactGA$event2;
9809
9857
  if (err) {
9810
9858
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
9811
9859
  }
9812
9860
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
9813
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$b.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$b, {
9814
- category: "ACTIONS",
9815
- action: "Unsave/Unfollow",
9816
- label: title
9817
- });
9861
+ if (enableReactGA4) {
9862
+ ReactGA4.event("Unsave/Unfollow", {
9863
+ event_label: title
9864
+ });
9865
+ } else {
9866
+ var _ReactGA$event2;
9867
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
9868
+ category: "ACTIONS",
9869
+ action: "Unsave/Unfollow",
9870
+ label: title
9871
+ });
9872
+ }
9818
9873
  });
9819
9874
  }
9820
9875
  }
@@ -11455,9 +11510,6 @@ function getSiteCardProcessor() {
11455
11510
  return "stripe";
11456
11511
  }
11457
11512
 
11458
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11459
- const ReactGA$a = (_window$a = window) !== null && _window$a !== void 0 && (_window$Pelcro$a = _window$a.Pelcro) !== null && _window$Pelcro$a !== void 0 && (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) !== null && _window$Pelcro$uiSett$a !== void 0 && _window$Pelcro$uiSett$a.enableReactGA4 ? ReactGA4 : ReactGA1;
11460
-
11461
11513
  /**
11462
11514
  * @typedef {Object} OptionsType
11463
11515
  * @property {boolean} loadPaymentSDKs
@@ -11584,17 +11636,44 @@ const initSecuritySdk = () => {
11584
11636
  });
11585
11637
  };
11586
11638
  const initGATracking = () => {
11587
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11588
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$initialize = ReactGA$a.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA$a, window.Pelcro.site.read().google_analytics_id);
11589
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$a.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11639
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11640
+ 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;
11641
+ if (window.Pelcro.site.read().google_analytics_id) {
11642
+ if (enableReactGA4) {
11643
+ // Initialize ReactGA4 with your tracking ID
11644
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11645
+ // Enable e-commerce tracking
11646
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11647
+ gaOptions: {
11648
+ send_page_view: true,
11649
+ ecommerce: {
11650
+ enabled: true
11651
+ }
11652
+ }
11653
+ });
11654
+ } else {
11655
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11656
+ 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);
11657
+ 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");
11658
+ }
11659
+ }
11590
11660
  };
11591
11661
  const dispatchModalDisplayEvents = modalName => {
11592
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11593
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$event = ReactGA$a.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$a, {
11594
- category: "VIEWS",
11595
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11596
- nonInteraction: true
11597
- });
11662
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11663
+ 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;
11664
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11665
+ if (enableReactGA4) {
11666
+ ReactGA4.event(`${formattedAction} viewed`, {
11667
+ nonInteraction: true
11668
+ });
11669
+ } else {
11670
+ var _ReactGA$event;
11671
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11672
+ category: "VIEWS",
11673
+ action: `${formattedAction} viewed`,
11674
+ nonInteraction: true
11675
+ });
11676
+ }
11598
11677
  window.Pelcro.insight.track("Modal Displayed", {
11599
11678
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11600
11679
  });
@@ -12389,6 +12468,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12389
12468
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12390
12469
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12391
12470
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12471
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12392
12472
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12393
12473
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12394
12474
  const SET_EMAILS = "SET_EMAILS";
@@ -12419,6 +12499,7 @@ const {
12419
12499
  Provider: Provider$m
12420
12500
  } = store$m;
12421
12501
  const LoginContainer = _ref => {
12502
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12422
12503
  let {
12423
12504
  style,
12424
12505
  className = "",
@@ -12426,6 +12507,7 @@ const LoginContainer = _ref => {
12426
12507
  onFailure = () => {},
12427
12508
  children
12428
12509
  } = _ref;
12510
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
12429
12511
  const handleLogin = (_ref2, dispatch) => {
12430
12512
  let {
12431
12513
  email,
@@ -12455,13 +12537,19 @@ const LoginContainer = _ref => {
12455
12537
  });
12456
12538
  onFailure(err);
12457
12539
  } else {
12458
- var _ReactGA$event;
12459
12540
  onSuccess(res);
12460
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12461
- category: "ACTIONS",
12462
- action: "Logged in",
12463
- nonInteraction: true
12464
- });
12541
+ if (enableReactGA4) {
12542
+ ReactGA4.event("Logged in", {
12543
+ nonInteraction: true
12544
+ });
12545
+ } else {
12546
+ var _ReactGA$event;
12547
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12548
+ category: "ACTIONS",
12549
+ action: "Logged in",
12550
+ nonInteraction: true
12551
+ });
12552
+ }
12465
12553
  }
12466
12554
  });
12467
12555
  };
@@ -12847,17 +12935,23 @@ function ConfirmPassword(_ref) {
12847
12935
  }, otherProps));
12848
12936
  }
12849
12937
 
12850
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
12851
- const ReactGA$9 = (_window$9 = window) !== null && _window$9 !== void 0 && (_window$Pelcro$9 = _window$9.Pelcro) !== null && _window$Pelcro$9 !== void 0 && (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) !== null && _window$Pelcro$uiSett$9 !== void 0 && _window$Pelcro$uiSett$9.enableReactGA4 ? ReactGA4 : ReactGA1;
12852
12938
  const Logout = props => {
12853
12939
  const handleLogout = () => {
12854
- var _ReactGA$event;
12940
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12855
12941
  window.Pelcro.user.logout();
12856
- ReactGA$9 === null || ReactGA$9 === void 0 ? void 0 : (_ReactGA$event = ReactGA$9.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$9, {
12857
- category: "ACTIONS",
12858
- action: "Logged out",
12859
- nonInteraction: true
12860
- });
12942
+ 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;
12943
+ if (enableReactGA4) {
12944
+ ReactGA4.event("Logged out", {
12945
+ nonInteraction: true
12946
+ });
12947
+ } else {
12948
+ var _ReactGA$event;
12949
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12950
+ category: "ACTIONS",
12951
+ action: "Logged out",
12952
+ nonInteraction: true
12953
+ });
12954
+ }
12861
12955
  };
12862
12956
  return /*#__PURE__*/React__default['default'].createElement("button", {
12863
12957
  name: "logout",
@@ -14415,13 +14509,11 @@ const RegisterCompany = props => {
14415
14509
  }, props));
14416
14510
  };
14417
14511
 
14418
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14419
- const ReactGA$8 = (_window$8 = window) !== null && _window$8 !== void 0 && (_window$Pelcro$8 = _window$8.Pelcro) !== null && _window$Pelcro$8 !== void 0 && (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) !== null && _window$Pelcro$uiSett$8 !== void 0 && _window$Pelcro$uiSett$8.enableReactGA4 ? ReactGA4 : ReactGA1;
14420
-
14421
14512
  /**
14422
14513
  *
14423
14514
  */
14424
14515
  function RegisterModal(props) {
14516
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14425
14517
  const {
14426
14518
  t
14427
14519
  } = useTranslation("register");
@@ -14436,18 +14528,26 @@ function RegisterModal(props) {
14436
14528
  giftCode,
14437
14529
  isGift
14438
14530
  } = usePelcro();
14531
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
14439
14532
  const onSuccess = res => {
14440
14533
  var _props$onSuccess;
14441
14534
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
14442
14535
  handleAfterRegistrationLogic();
14443
14536
  };
14444
14537
  const handleAfterRegistrationLogic = () => {
14445
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14446
- ReactGA$8 === null || ReactGA$8 === void 0 ? void 0 : (_ReactGA$event = ReactGA$8.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$8, {
14447
- category: "ACTIONS",
14448
- action: "Registered",
14449
- nonInteraction: true
14450
- });
14538
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14539
+ if (enableReactGA4) {
14540
+ ReactGA4.event("Registered", {
14541
+ nonInteraction: true
14542
+ });
14543
+ } else {
14544
+ var _ReactGA$event;
14545
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14546
+ category: "ACTIONS",
14547
+ action: "Registered",
14548
+ nonInteraction: true
14549
+ });
14550
+ }
14451
14551
  const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
14452
14552
  if (isEmailVerificationEnabled) {
14453
14553
  return switchView("email-verify");
@@ -14534,9 +14634,6 @@ function Radio(_ref) {
14534
14634
  }, children));
14535
14635
  }
14536
14636
 
14537
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14538
- const ReactGA$7 = (_window$7 = window) !== null && _window$7 !== void 0 && (_window$Pelcro$7 = _window$7.Pelcro) !== null && _window$Pelcro$7 !== void 0 && (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) !== null && _window$Pelcro$uiSett$7 !== void 0 && _window$Pelcro$uiSett$7.enableReactGA4 ? ReactGA4 : ReactGA1;
14539
-
14540
14637
  /**
14541
14638
  *
14542
14639
  */
@@ -14596,6 +14693,7 @@ function productMatchPageLanguage(product) {
14596
14693
  SelectModalWithHook.viewId = "plan-select";
14597
14694
  class SelectModal extends React.Component {
14598
14695
  constructor(props) {
14696
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
14599
14697
  super(props);
14600
14698
  _defineProperty$3(this, "componentDidMount", () => {
14601
14699
  if (this.props.product) {
@@ -14630,11 +14728,11 @@ class SelectModal extends React.Component {
14630
14728
  }
14631
14729
  document.addEventListener("keydown", this.handleSubmit);
14632
14730
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
14633
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
14634
- const userCurrency = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read().currency;
14635
- const userCountry = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.location.countryCode;
14636
- const userLanguage = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$user = _window$Pelcro4.user) === null || _window$Pelcro4$user === void 0 ? void 0 : _window$Pelcro4$user.read().language;
14637
- const productsMatchingUserCurrency = (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read().products.filter(product => {
14731
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
14732
+ 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;
14733
+ 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;
14734
+ 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;
14735
+ const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
14638
14736
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14639
14737
  if (filteredPlans.length) return filteredPlans;
14640
14738
  });
@@ -14647,12 +14745,12 @@ class SelectModal extends React.Component {
14647
14745
  });
14648
14746
  notifyBugsnag(() => {
14649
14747
  Bugsnag.notify("SelectModal - No data viewed", event => {
14650
- var _window$Pelcro6, _window$Pelcro6$site, _window$Pelcro7, _window$Pelcro7$user, _window$Pelcro8, _window$Pelcro8$uiSet, _window$Pelcro9, _this$props, _window$Pelcro10, _window$Pelcro10$help, _window$Pelcro11, _window$Pelcro11$site;
14748
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
14651
14749
  event.addMetadata("MetaData", {
14652
- site: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$site = _window$Pelcro6.site) === null || _window$Pelcro6$site === void 0 ? void 0 : _window$Pelcro6$site.read(),
14653
- user: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$user = _window$Pelcro7.user) === null || _window$Pelcro7$user === void 0 ? void 0 : _window$Pelcro7$user.read(),
14654
- uiVersion: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$uiSet = _window$Pelcro8.uiSettings) === null || _window$Pelcro8$uiSet === void 0 ? void 0 : _window$Pelcro8$uiSet.uiVersion,
14655
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
14750
+ 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(),
14751
+ 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(),
14752
+ 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,
14753
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
14656
14754
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
14657
14755
  productListState: this.state.productList,
14658
14756
  methods: {
@@ -14663,8 +14761,8 @@ class SelectModal extends React.Component {
14663
14761
  userCurrency: userCurrency,
14664
14762
  userCountry: userCountry,
14665
14763
  userLanguage: userLanguage,
14666
- siteLanguage: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$help = _window$Pelcro10.helpers) === null || _window$Pelcro10$help === void 0 ? void 0 : _window$Pelcro10$help.getHtmlLanguageAttribute(),
14667
- products: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read().products.length,
14764
+ 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(),
14765
+ products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
14668
14766
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14669
14767
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14670
14768
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -14875,6 +14973,7 @@ class SelectModal extends React.Component {
14875
14973
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
14876
14974
  this.locale = this.props.t;
14877
14975
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
14976
+ this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro11 = _window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$uiSe = _window$Pelcro11.uiSettings) === null || _window$Pelcro11$uiSe === void 0 ? void 0 : _window$Pelcro11$uiSe.enableReactGA4;
14878
14977
  }
14879
14978
  render() {
14880
14979
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -14882,19 +14981,31 @@ class SelectModal extends React.Component {
14882
14981
  disableGifting
14883
14982
  } = this.props;
14884
14983
  if (this.state.mode === "product") {
14885
- var _ReactGA$event;
14886
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event = ReactGA$7.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$7, {
14887
- category: "VIEWS",
14888
- action: "Product Modal Viewed",
14889
- nonInteraction: true
14890
- });
14984
+ if (this.enableReactGA4) {
14985
+ ReactGA4.event("Product Modal Viewed", {
14986
+ nonInteraction: true
14987
+ });
14988
+ } else {
14989
+ var _ReactGA$event;
14990
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14991
+ category: "VIEWS",
14992
+ action: "Product Modal Viewed",
14993
+ nonInteraction: true
14994
+ });
14995
+ }
14891
14996
  } else if (this.state.mode === "plan") {
14892
- var _ReactGA$event2;
14893
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$7.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$7, {
14894
- category: "VIEWS",
14895
- action: "Plan Modal Viewed",
14896
- nonInteraction: true
14897
- });
14997
+ if (this.enableReactGA4) {
14998
+ ReactGA4.event("Plan Modal Viewed", {
14999
+ nonInteraction: true
15000
+ });
15001
+ } else {
15002
+ var _ReactGA$event2;
15003
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15004
+ category: "VIEWS",
15005
+ action: "Plan Modal Viewed",
15006
+ nonInteraction: true
15007
+ });
15008
+ }
14898
15009
  }
14899
15010
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
14900
15011
  hideCloseButton: !this.closeButton,
@@ -20228,13 +20339,11 @@ const SubscriptionRenewView = _ref => {
20228
20339
  }));
20229
20340
  };
20230
20341
 
20231
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
20232
- const ReactGA$6 = (_window$6 = window) !== null && _window$6 !== void 0 && (_window$Pelcro$6 = _window$6.Pelcro) !== null && _window$Pelcro$6 !== void 0 && (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) !== null && _window$Pelcro$uiSett$6 !== void 0 && _window$Pelcro$uiSett$6.enableReactGA4 ? ReactGA4 : ReactGA1;
20233
-
20234
20342
  /**
20235
20343
  *
20236
20344
  */
20237
20345
  function SubscriptionRenewModal(_ref) {
20346
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20238
20347
  let {
20239
20348
  onDisplay,
20240
20349
  onClose,
@@ -20243,24 +20352,39 @@ function SubscriptionRenewModal(_ref) {
20243
20352
  const {
20244
20353
  switchView
20245
20354
  } = usePelcro();
20355
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
20246
20356
  const onSuccess = res => {
20247
- var _otherProps$onSuccess, _ReactGA$event;
20357
+ var _otherProps$onSuccess;
20248
20358
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
20249
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event = ReactGA$6.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$6, {
20250
- category: "ACTIONS",
20251
- action: "Renewed",
20252
- nonInteraction: true
20253
- });
20359
+ if (enableReactGA4) {
20360
+ ReactGA4.event("Renewed", {
20361
+ nonInteraction: true
20362
+ });
20363
+ } else {
20364
+ var _ReactGA$event;
20365
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20366
+ category: "ACTIONS",
20367
+ action: "Renewed",
20368
+ nonInteraction: true
20369
+ });
20370
+ }
20254
20371
  return switchView("subscription-success");
20255
20372
  };
20256
20373
  const onGiftRenewalSuccess = () => {
20257
- var _otherProps$onGiftRen, _ReactGA$event2;
20374
+ var _otherProps$onGiftRen;
20258
20375
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
20259
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$6.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$6, {
20260
- category: "ACTIONS",
20261
- action: "Renewed Gift",
20262
- nonInteraction: true
20263
- });
20376
+ if (enableReactGA4) {
20377
+ ReactGA4.event("Renewed Gift", {
20378
+ nonInteraction: true
20379
+ });
20380
+ } else {
20381
+ var _ReactGA$event2;
20382
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
20383
+ category: "ACTIONS",
20384
+ action: "Renewed Gift",
20385
+ nonInteraction: true
20386
+ });
20387
+ }
20264
20388
  return switchView("subscription-success");
20265
20389
  };
20266
20390
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -20275,7 +20399,8 @@ function SubscriptionRenewModal(_ref) {
20275
20399
  SubscriptionRenewModal.viewId = "subscription-renew";
20276
20400
 
20277
20401
  const initialState$j = {
20278
- cancelationReason: ""
20402
+ cancelationReason: "",
20403
+ cancelationOption: ""
20279
20404
  };
20280
20405
  const store$j = /*#__PURE__*/React.createContext(initialState$j);
20281
20406
  const {
@@ -20290,7 +20415,6 @@ const SubscriptionCancelContainer = _ref => {
20290
20415
  children,
20291
20416
  ...props
20292
20417
  } = _ref;
20293
- useTranslation("verifyEmail");
20294
20418
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20295
20419
  switch (action.type) {
20296
20420
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -20298,6 +20422,11 @@ const SubscriptionCancelContainer = _ref => {
20298
20422
  ...state,
20299
20423
  cancelationReason: action.payload
20300
20424
  });
20425
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
20426
+ return lib_7({
20427
+ ...state,
20428
+ cancelationOption: action.payload
20429
+ });
20301
20430
  default:
20302
20431
  return state;
20303
20432
  }
@@ -20397,8 +20526,7 @@ const SubscriptionCancelReason = props => {
20397
20526
  t
20398
20527
  } = useTranslation("subscriptionCancel");
20399
20528
  const {
20400
- dispatch,
20401
- state
20529
+ dispatch
20402
20530
  } = React.useContext(store$j);
20403
20531
  const handleOnTextAreaBlur = e => {
20404
20532
  dispatch({
@@ -20430,9 +20558,7 @@ function SvgSubscription(props) {
20430
20558
  }))))));
20431
20559
  }
20432
20560
 
20433
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
20434
- const ReactGA$5 = (_window$5 = window) !== null && _window$5 !== void 0 && (_window$Pelcro$5 = _window$5.Pelcro) !== null && _window$Pelcro$5 !== void 0 && (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) !== null && _window$Pelcro$uiSett$5 !== void 0 && _window$Pelcro$uiSett$5.enableReactGA4 ? ReactGA4 : ReactGA1;
20435
- const SubscriptionCancelNowButton = _ref => {
20561
+ const SubscriptionCancelButton = _ref => {
20436
20562
  let {
20437
20563
  subscription,
20438
20564
  onClick,
@@ -20443,14 +20569,16 @@ const SubscriptionCancelNowButton = _ref => {
20443
20569
  } = usePelcro();
20444
20570
  const {
20445
20571
  state: {
20446
- cancelationReason
20447
- },
20448
- dispatch
20572
+ cancelationReason,
20573
+ cancelationOption
20574
+ }
20449
20575
  } = React.useContext(store$j);
20450
20576
  const {
20451
20577
  t
20452
20578
  } = useTranslation("subscriptionCancel");
20453
20579
  const cancelSubscription = (payload, onSuccess, onFailure) => {
20580
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20581
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
20454
20582
  window.Pelcro.subscription.cancel({
20455
20583
  auth_token: window.Pelcro.user.read().auth_token,
20456
20584
  subscription_id: payload.subscription_id,
@@ -20459,36 +20587,42 @@ const SubscriptionCancelNowButton = _ref => {
20459
20587
  reason: payload.reason
20460
20588
  })
20461
20589
  }, (err, res) => {
20462
- var _ReactGA$event;
20463
20590
  if (err) {
20464
20591
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20465
20592
  }
20466
- ReactGA$5 === null || ReactGA$5 === void 0 ? void 0 : (_ReactGA$event = ReactGA$5.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$5, {
20467
- category: "ACTIONS",
20468
- action: "Canceled",
20469
- nonInteraction: true
20470
- });
20593
+ if (enableReactGA4) {
20594
+ ReactGA4.event("Canceled", {
20595
+ nonInteraction: true
20596
+ });
20597
+ } else {
20598
+ var _ReactGA$event;
20599
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20600
+ category: "ACTIONS",
20601
+ action: "Canceled",
20602
+ nonInteraction: true
20603
+ });
20604
+ }
20471
20605
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20472
20606
  });
20473
20607
  };
20474
- const handleCancelNowClick = () => {
20608
+ const handleCancelClick = () => {
20475
20609
  const payload = {
20476
20610
  subscription_id: subscription.id,
20477
- mode: "now",
20611
+ mode: cancelationOption,
20478
20612
  ...(cancelationReason && {
20479
20613
  reason: cancelationReason
20480
20614
  })
20481
20615
  };
20482
20616
  onClick === null || onClick === void 0 ? void 0 : onClick();
20483
20617
 
20484
- //Close the modal
20618
+ // Close the modal
20485
20619
  switchView(null);
20486
20620
 
20487
- //Show confirmation alert after closing the modal
20621
+ // Show confirmation alert after closing the modal
20488
20622
  notify$1.confirm((onSuccess, onFailure) => {
20489
20623
  cancelSubscription(payload, onSuccess, onFailure);
20490
20624
  }, {
20491
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
20625
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
20492
20626
  loadingMessage: t("messages.subCancellation.loading"),
20493
20627
  successMessage: t("messages.subCancellation.success"),
20494
20628
  errorMessage: t("messages.subCancellation.error")
@@ -20497,90 +20631,89 @@ const SubscriptionCancelNowButton = _ref => {
20497
20631
  });
20498
20632
  };
20499
20633
  return /*#__PURE__*/React__default['default'].createElement(Button, {
20500
- onClick: handleCancelNowClick,
20501
- className: `${className}`
20502
- }, t("messages.cancelNow"));
20634
+ onClick: handleCancelClick,
20635
+ className: `${className}`,
20636
+ disabled: !cancelationOption
20637
+ }, t("labels.cancel"));
20503
20638
  };
20504
20639
 
20505
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
20506
- const ReactGA$4 = (_window$4 = window) !== null && _window$4 !== void 0 && (_window$Pelcro$4 = _window$4.Pelcro) !== null && _window$Pelcro$4 !== void 0 && (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) !== null && _window$Pelcro$uiSett$4 !== void 0 && _window$Pelcro$uiSett$4.enableReactGA4 ? ReactGA4 : ReactGA1;
20507
- const SubscriptionCancelLaterButton = _ref => {
20640
+ // New cancellation option modal
20641
+ const SubscriptionCancelOptions = _ref => {
20642
+ var _subscription$schedul;
20508
20643
  let {
20509
20644
  subscription,
20645
+ hasPhases,
20510
20646
  onClick,
20511
20647
  className
20512
20648
  } = _ref;
20513
- const {
20514
- switchView
20515
- } = usePelcro();
20516
20649
  const {
20517
20650
  state: {
20518
- cancelationReason
20651
+ cancelationOption
20519
20652
  },
20520
20653
  dispatch
20521
20654
  } = React.useContext(store$j);
20522
20655
  const {
20523
20656
  t
20524
20657
  } = useTranslation("subscriptionCancel");
20525
- const cancelSubscription = (payload, onSuccess, onFailure) => {
20526
- window.Pelcro.subscription.cancel({
20527
- auth_token: window.Pelcro.user.read().auth_token,
20528
- subscription_id: payload.subscription_id,
20529
- mode: payload.mode,
20530
- ...(payload.reason && {
20531
- reason: payload.reason
20532
- })
20533
- }, (err, res) => {
20534
- var _ReactGA$event;
20535
- if (err) {
20536
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20537
- }
20538
- ReactGA$4 === null || ReactGA$4 === void 0 ? void 0 : (_ReactGA$event = ReactGA$4.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$4, {
20539
- category: "ACTIONS",
20540
- action: "Canceled",
20541
- nonInteraction: true
20542
- });
20543
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20544
- });
20545
- };
20546
- const handleCancelNowClick = () => {
20547
- const payload = {
20548
- subscription_id: subscription.id,
20549
- mode: "period_end",
20550
- ...(cancelationReason && {
20551
- reason: cancelationReason
20552
- })
20553
- };
20554
- onClick === null || onClick === void 0 ? void 0 : onClick();
20555
-
20556
- //Close the modal
20557
- switchView(null);
20558
-
20559
- //Show confirmation alert after closing the modal
20560
- notify$1.confirm((onSuccess, onFailure) => {
20561
- cancelSubscription(payload, onSuccess, onFailure);
20562
- }, {
20563
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
20564
- loadingMessage: t("messages.subCancellation.loading"),
20565
- successMessage: t("messages.subCancellation.success"),
20566
- errorMessage: t("messages.subCancellation.error")
20567
- }, {
20568
- closeButtonLabel: t("labels.subCancellation.goBack")
20658
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
20659
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
20660
+ const handleOptionSelect = event => {
20661
+ dispatch({
20662
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
20663
+ payload: event.target.value
20569
20664
  });
20570
20665
  };
20571
- return /*#__PURE__*/React__default['default'].createElement(Button, {
20572
- onClick: handleCancelNowClick,
20573
- className: `${className}`
20574
- }, t("messages.cancelLater"));
20666
+ return /*#__PURE__*/React__default['default'].createElement("div", {
20667
+ className: "plc-text-left plc-mr-auto plc-mb-6"
20668
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
20669
+ className: "plc-mb-3"
20670
+ }, t("messages.cancelWhen")), subscription.cancel_at_period_end === 0 && hasPhases && /*#__PURE__*/React__default['default'].createElement(Radio, {
20671
+ onChange: handleOptionSelect,
20672
+ checked: cancelationOption === "period_end",
20673
+ value: "period_end"
20674
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
20675
+ year: "numeric",
20676
+ month: "short",
20677
+ day: "numeric"
20678
+ })), subscription.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Radio, {
20679
+ onChange: handleOptionSelect,
20680
+ checked: cancelationOption === "current_period_end",
20681
+ value: "current_period_end"
20682
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
20683
+ year: "numeric",
20684
+ month: "short",
20685
+ day: "numeric"
20686
+ })), /*#__PURE__*/React__default['default'].createElement(Radio, {
20687
+ onChange: handleOptionSelect,
20688
+ checked: cancelationOption === "now",
20689
+ value: "now"
20690
+ }, t("labels.endImmediately")));
20575
20691
  };
20576
20692
 
20577
20693
  const SubscriptionCancelView = props => {
20694
+ var _subscriptionToCancel7, _subscriptionToCancel8;
20578
20695
  const {
20579
- subscriptionToCancel
20696
+ subscriptionToCancel,
20697
+ switchView
20580
20698
  } = usePelcro();
20581
20699
  const {
20582
20700
  t
20583
20701
  } = useTranslation("subscriptionCancel");
20702
+ const getPhases = () => {
20703
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
20704
+ if (!subscriptionToCancel.schedule) return [];
20705
+ const currentPhaseStartDate = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel = subscriptionToCancel.schedule) === null || _subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel2 = _subscriptionToCancel.current_phase) === null || _subscriptionToCancel2 === void 0 ? void 0 : _subscriptionToCancel2.start_date;
20706
+ const currentPhase = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel3 = subscriptionToCancel.schedule) === null || _subscriptionToCancel3 === void 0 ? void 0 : (_subscriptionToCancel4 = _subscriptionToCancel3.phases) === null || _subscriptionToCancel4 === void 0 ? void 0 : _subscriptionToCancel4.find(phase => {
20707
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
20708
+ });
20709
+ const futurePhases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel5 = subscriptionToCancel.schedule) === null || _subscriptionToCancel5 === void 0 ? void 0 : (_subscriptionToCancel6 = _subscriptionToCancel5.phases) === null || _subscriptionToCancel6 === void 0 ? void 0 : _subscriptionToCancel6.filter(phase => {
20710
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
20711
+ });
20712
+ return [currentPhase, ...futurePhases];
20713
+ };
20714
+ const hasPhases = getPhases().length > 0;
20715
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
20716
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
20584
20717
  return /*#__PURE__*/React__default['default'].createElement("div", {
20585
20718
  id: "pelcro-subscription-cancel-view"
20586
20719
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -20589,22 +20722,35 @@ const SubscriptionCancelView = props => {
20589
20722
  className: "plc-text-2xl plc-font-semibold"
20590
20723
  }, t("labels.title"), /*#__PURE__*/React__default['default'].createElement("span", {
20591
20724
  className: "plc-text-gray-400 plc-text-base plc-block"
20592
- }, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
20725
+ }, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
20593
20726
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
20594
20727
  }, /*#__PURE__*/React__default['default'].createElement(SvgSubscription, {
20595
20728
  className: "plc-w-32 plc-h-32"
20596
20729
  }), /*#__PURE__*/React__default['default'].createElement("p", {
20597
- className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
20598
- }, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
20730
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
20731
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
20599
20732
  year: "numeric",
20600
20733
  month: "short",
20601
20734
  day: "numeric"
20602
- }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelNowButton, {
20603
- className: "plc-mb-2",
20604
- subscription: subscriptionToCancel
20605
- }), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelLaterButton, {
20735
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
20736
+ year: "numeric",
20737
+ month: "short",
20738
+ day: "numeric"
20739
+ }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelOptions, {
20740
+ subscription: subscriptionToCancel,
20741
+ hasPhases: hasPhases
20742
+ }), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
20743
+ className: "plc-space-x-0 plc-space-y-3 md:plc-space-x-3 md:plc-space-y-0 plc-w-full plc-flex plc-flex-col md:plc-flex-row plc-items-center plc-justify-center"
20744
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
20745
+ className: "plc-w-3/4 md:plc-w-2/5",
20606
20746
  subscription: subscriptionToCancel
20607
- }))));
20747
+ }), /*#__PURE__*/React__default['default'].createElement(Button, {
20748
+ variant: "outline",
20749
+ className: "plc-w-3/4 md:plc-w-2/5",
20750
+ onClick: () => {
20751
+ switchView("dashboard");
20752
+ }
20753
+ }, t("labels.subCancellation.goBack"))))));
20608
20754
  };
20609
20755
 
20610
20756
  const SubscriptionCancelModal = _ref => {
@@ -20744,9 +20890,8 @@ const SubscriptionSuspendDate = props => {
20744
20890
  }, props));
20745
20891
  };
20746
20892
 
20747
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
20748
- const ReactGA$3 = (_window$3 = window) !== null && _window$3 !== void 0 && (_window$Pelcro$3 = _window$3.Pelcro) !== null && _window$Pelcro$3 !== void 0 && (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) !== null && _window$Pelcro$uiSett$3 !== void 0 && _window$Pelcro$uiSett$3.enableReactGA4 ? ReactGA4 : ReactGA1;
20749
20893
  const SubscriptionSuspendButton = _ref => {
20894
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
20750
20895
  let {
20751
20896
  subscription,
20752
20897
  onClick,
@@ -20765,6 +20910,7 @@ const SubscriptionSuspendButton = _ref => {
20765
20910
  const {
20766
20911
  t
20767
20912
  } = useTranslation("subscriptionSuspend");
20913
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
20768
20914
  const suspendSubscription = (payload, onSuccess, onFailure) => {
20769
20915
  window.Pelcro.subscription.update({
20770
20916
  auth_token: window.Pelcro.user.read().auth_token,
@@ -20772,15 +20918,21 @@ const SubscriptionSuspendButton = _ref => {
20772
20918
  suspend: 1,
20773
20919
  shipments_suspended_until: suspendDate
20774
20920
  }, (err, res) => {
20775
- var _ReactGA$event;
20776
20921
  if (err) {
20777
20922
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
20778
20923
  }
20779
- ReactGA$3 === null || ReactGA$3 === void 0 ? void 0 : (_ReactGA$event = ReactGA$3.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$3, {
20780
- category: "ACTIONS",
20781
- action: "Suspended",
20782
- nonInteraction: true
20783
- });
20924
+ if (enableReactGA4) {
20925
+ ReactGA4.event("Suspended", {
20926
+ nonInteraction: true
20927
+ });
20928
+ } else {
20929
+ var _ReactGA$event;
20930
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
20931
+ category: "ACTIONS",
20932
+ action: "Suspended",
20933
+ nonInteraction: true
20934
+ });
20935
+ }
20784
20936
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
20785
20937
  });
20786
20938
  };
@@ -20790,10 +20942,10 @@ const SubscriptionSuspendButton = _ref => {
20790
20942
  };
20791
20943
  onClick === null || onClick === void 0 ? void 0 : onClick();
20792
20944
 
20793
- //Close the modal
20945
+ // Close the modal
20794
20946
  switchView(null);
20795
20947
 
20796
- //Show confirmation alert after closing the modal
20948
+ // Show confirmation alert after closing the modal
20797
20949
  notify$1.confirm((onSuccess, onFailure) => {
20798
20950
  suspendSubscription(payload, onSuccess, onFailure);
20799
20951
  }, {
@@ -23522,7 +23674,7 @@ const {
23522
23674
  Provider: Provider$d
23523
23675
  } = store$d;
23524
23676
  const AddressUpdateContainer = _ref => {
23525
- var _props$addressId;
23677
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
23526
23678
  let {
23527
23679
  style,
23528
23680
  className = "",
@@ -23536,6 +23688,7 @@ const AddressUpdateContainer = _ref => {
23536
23688
  addressIdToEdit
23537
23689
  } = usePelcro();
23538
23690
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
23691
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
23539
23692
  const [t] = useTranslation("address");
23540
23693
  React.useEffect(() => {
23541
23694
  const getCountries = () => {
@@ -23626,7 +23779,6 @@ const AddressUpdateContainer = _ref => {
23626
23779
  });
23627
23780
  onFailure(err);
23628
23781
  } else {
23629
- var _ReactGA$event;
23630
23782
  dispatch({
23631
23783
  type: SHOW_ALERT,
23632
23784
  payload: {
@@ -23635,11 +23787,18 @@ const AddressUpdateContainer = _ref => {
23635
23787
  }
23636
23788
  });
23637
23789
  onSuccess(res);
23638
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
23639
- category: "ACTIONS",
23640
- action: "Updated address",
23641
- nonInteraction: true
23642
- });
23790
+ if (enableReactGA4) {
23791
+ ReactGA4.event("Updated address", {
23792
+ nonInteraction: true
23793
+ });
23794
+ } else {
23795
+ var _ReactGA$event;
23796
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
23797
+ category: "ACTIONS",
23798
+ action: "Updated address",
23799
+ nonInteraction: true
23800
+ });
23801
+ }
23643
23802
  }
23644
23803
  });
23645
23804
  };
@@ -24163,17 +24322,24 @@ function PaymentMethodUpdateView(props) {
24163
24322
  }));
24164
24323
  }
24165
24324
 
24166
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
24167
- const ReactGA$2 = (_window$2 = window) !== null && _window$2 !== void 0 && (_window$Pelcro$2 = _window$2.Pelcro) !== null && _window$Pelcro$2 !== void 0 && (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) !== null && _window$Pelcro$uiSett$2 !== void 0 && _window$Pelcro$uiSett$2.enableReactGA4 ? ReactGA4 : ReactGA1;
24168
24325
  const PaymentMethodUpdateModal = props => {
24326
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
24327
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
24169
24328
  const onSuccess = res => {
24170
- var _props$onSuccess, _ReactGA$event;
24329
+ var _props$onSuccess;
24171
24330
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
24172
- ReactGA$2 === null || ReactGA$2 === void 0 ? void 0 : (_ReactGA$event = ReactGA$2.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$2, {
24173
- category: "ACTIONS",
24174
- action: "Updated payment card",
24175
- nonInteraction: true
24176
- });
24331
+ if (enableReactGA4) {
24332
+ ReactGA4.event("Updated payment card", {
24333
+ nonInteraction: true
24334
+ });
24335
+ } else {
24336
+ var _ReactGA$event;
24337
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
24338
+ category: "ACTIONS",
24339
+ action: "Updated payment card",
24340
+ nonInteraction: true
24341
+ });
24342
+ }
24177
24343
  };
24178
24344
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
24179
24345
  id: "pelcro-payment-method-update-modal",
@@ -28050,8 +28216,6 @@ const OrderItems = _ref => {
28050
28216
  });
28051
28217
  };
28052
28218
 
28053
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
28054
- const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
28055
28219
  const SavedItemsMenu = () => {
28056
28220
  const {
28057
28221
  t
@@ -28100,8 +28264,10 @@ const SavedItems = _ref3 => {
28100
28264
  isAuthenticated
28101
28265
  } = usePelcro();
28102
28266
  const removeItemFromMetadata = (category, title) => {
28267
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
28103
28268
  const user = window.Pelcro.user.read();
28104
28269
  const oldValue = user.metadata[`metadata_saved_${category}`];
28270
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
28105
28271
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
28106
28272
  if (isAuthenticated()) {
28107
28273
  setLoading(true);
@@ -28110,17 +28276,24 @@ const SavedItems = _ref3 => {
28110
28276
  value: newMetadataValue,
28111
28277
  auth_token: window.Pelcro.user.read().auth_token
28112
28278
  }, (error, response) => {
28113
- var _response$data, _ReactGA$event;
28279
+ var _response$data;
28114
28280
  setLoading(false);
28115
28281
  if (error) {
28116
28282
  return;
28117
28283
  }
28118
28284
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
28119
- ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event = ReactGA$1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$1, {
28120
- category: "ACTIONS",
28121
- action: "Unsave/Unfollow",
28122
- label: title
28123
- });
28285
+ if (enableReactGA4) {
28286
+ ReactGA4.event("Unsave/Unfollow", {
28287
+ event_label: title
28288
+ });
28289
+ } else {
28290
+ var _ReactGA$event;
28291
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
28292
+ category: "ACTIONS",
28293
+ action: "Unsave/Unfollow",
28294
+ label: title
28295
+ });
28296
+ }
28124
28297
  });
28125
28298
  }
28126
28299
  };
@@ -29063,8 +29236,6 @@ function getMemberShipStatus(status) {
29063
29236
  };
29064
29237
  }
29065
29238
 
29066
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
29067
- const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
29068
29239
  const SUB_MENUS = {
29069
29240
  PROFILE: "profile",
29070
29241
  SUBSCRIPTIONS: "subscriptions",
@@ -29119,21 +29290,27 @@ function DashboardWithHook(props) {
29119
29290
  DashboardWithHook.viewId = "dashboard";
29120
29291
  class Dashboard extends React.Component {
29121
29292
  constructor(props) {
29122
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
29293
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
29123
29294
  super(props);
29124
29295
  _defineProperty$3(this, "componentDidMount", () => {
29125
- var _ReactGA$event;
29126
29296
  this.setState({
29127
29297
  isOpen: true
29128
29298
  });
29129
29299
  window.Pelcro.insight.track("Modal Displayed", {
29130
29300
  name: "dashboard"
29131
29301
  });
29132
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29133
- category: "VIEWS",
29134
- action: "Dashboard Modal Viewed",
29135
- nonInteraction: true
29136
- });
29302
+ if (this.enableReactGA4) {
29303
+ ReactGA4.event("Dashboard Modal Viewed", {
29304
+ nonInteraction: true
29305
+ });
29306
+ } else {
29307
+ var _ReactGA$event;
29308
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29309
+ category: "VIEWS",
29310
+ action: "Dashboard Modal Viewed",
29311
+ nonInteraction: true
29312
+ });
29313
+ }
29137
29314
  const {
29138
29315
  addresses
29139
29316
  } = window.Pelcro.user.read();
@@ -29161,15 +29338,21 @@ class Dashboard extends React.Component {
29161
29338
  auth_token: window.Pelcro.user.read().auth_token,
29162
29339
  subscription_id: subscription_id
29163
29340
  }, (err, res) => {
29164
- var _ReactGA$event2;
29165
29341
  if (err) {
29166
29342
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
29167
29343
  }
29168
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
29169
- category: "ACTIONS",
29170
- action: "Canceled",
29171
- nonInteraction: true
29172
- });
29344
+ if (this.enableReactGA4) {
29345
+ ReactGA4.event("Canceled", {
29346
+ nonInteraction: true
29347
+ });
29348
+ } else {
29349
+ var _ReactGA$event2;
29350
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
29351
+ category: "ACTIONS",
29352
+ action: "Canceled",
29353
+ nonInteraction: true
29354
+ });
29355
+ }
29173
29356
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
29174
29357
  });
29175
29358
  });
@@ -29179,15 +29362,21 @@ class Dashboard extends React.Component {
29179
29362
  subscription_id: subscription_id,
29180
29363
  suspend: 0
29181
29364
  }, (err, res) => {
29182
- var _ReactGA$event3;
29183
29365
  if (err) {
29184
29366
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
29185
29367
  }
29186
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
29187
- category: "ACTIONS",
29188
- action: "UnSuspended",
29189
- nonInteraction: true
29190
- });
29368
+ if (this.enableReactGA4) {
29369
+ ReactGA4.event("UnSuspended", {
29370
+ nonInteraction: true
29371
+ });
29372
+ } else {
29373
+ var _ReactGA$event3;
29374
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
29375
+ category: "ACTIONS",
29376
+ action: "UnSuspended",
29377
+ nonInteraction: true
29378
+ });
29379
+ }
29191
29380
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
29192
29381
  });
29193
29382
  });
@@ -29464,6 +29653,7 @@ class Dashboard extends React.Component {
29464
29653
  this.locale = this.props.t;
29465
29654
  this.user = window.Pelcro.user.read();
29466
29655
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
29656
+ this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
29467
29657
  }
29468
29658
  render() {
29469
29659
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;