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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -4073,12 +4073,16 @@ var invoiceDetails_en = {
4073
4073
  var labels$U = {
4074
4074
  title: "Cancel subscription",
4075
4075
  cancelReason: "Cancellation reason",
4076
+ endOn: "End on",
4077
+ endImmediately: "End immediately",
4078
+ cancel: "Cancel",
4076
4079
  subCancellation: {
4077
4080
  goBack: "Go back"
4078
4081
  }
4079
4082
  };
4080
4083
  var messages$W = {
4081
4084
  subscriptionEnd: "This subscription is set to expire on",
4085
+ cancelWhen: "When would you like to cancel?",
4082
4086
  cancelNow: "Cancel Subscription Now",
4083
4087
  cancelLater: "Cancel at Period End",
4084
4088
  subCancellation: {
@@ -4995,12 +4999,16 @@ var invoiceDetails_fr = {
4995
4999
  var labels$C = {
4996
5000
  title: "Annuler l'abonnement",
4997
5001
  cancelReason: "Motif d'annulation",
5002
+ endOn: "Fin sur",
5003
+ endImmediately: "Fin immédiate",
5004
+ cancel: "Annuler",
4998
5005
  subCancellation: {
4999
5006
  goBack: "Retourner"
5000
5007
  }
5001
5008
  };
5002
5009
  var messages$D = {
5003
5010
  subscriptionEnd: "Cet abonnement doit expirer le",
5011
+ cancelWhen: "Quand voulez-vous annuler?",
5004
5012
  cancelNow: "Cancel Subscription Now",
5005
5013
  cancelLater: "Annuler l'abonnement maintenant",
5006
5014
  subCancellation: {
@@ -6024,12 +6032,16 @@ var invoiceDetails_ko = {
6024
6032
  var labels$k = {
6025
6033
  title: "구독 취소",
6026
6034
  cancelReason: "취소 사유",
6035
+ endOn: "종료",
6036
+ endImmediately: "즉시 종료",
6037
+ cancel: "취소",
6027
6038
  subCancellation: {
6028
6039
  goBack: "돌아가기"
6029
6040
  }
6030
6041
  };
6031
6042
  var messages$k = {
6032
6043
  subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
6044
+ cancelWhen: "언제 취소하시겠습니까?",
6033
6045
  cancelNow: "지금 구독 취소",
6034
6046
  cancelLater: "기간 종료 시 취소",
6035
6047
  subCancellation: {
@@ -6938,12 +6950,16 @@ var invoiceDetails_es = {
6938
6950
  var labels$2 = {
6939
6951
  title: "Cancelar suscripción",
6940
6952
  cancelReason: "Razón de la cancelación",
6953
+ endOn: "Fin de",
6954
+ endImmediately: "Fin inmediato",
6955
+ cancel: "Cancelar",
6941
6956
  subCancellation: {
6942
6957
  goBack: "Volver"
6943
6958
  }
6944
6959
  };
6945
6960
  var messages$1 = {
6946
6961
  subscriptionEnd: "Esta suscripción expirará el",
6962
+ cancelWhen: "¿Cuándo desea cancelar?",
6947
6963
  cancelNow: "Cancelar Suscripción Ahora",
6948
6964
  cancelLater: "Cancelar al Final del Periodo",
6949
6965
  subCancellation: {
@@ -8920,8 +8936,6 @@ exports["default"] = _default;
8920
8936
  var ReactGA4 = unwrapExports(dist);
8921
8937
  dist.ReactGAImplementation;
8922
8938
 
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
8939
  class PelcroActions {
8926
8940
  constructor(storeSetter, storeGetter) {
8927
8941
  var _this = this;
@@ -9101,18 +9115,20 @@ class PelcroActions {
9101
9115
  });
9102
9116
  });
9103
9117
  _defineProperty$3(this, "logout", function () {
9118
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9104
9119
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9105
9120
  const {
9106
9121
  switchView,
9107
9122
  resetView,
9108
9123
  isAuthenticated
9109
9124
  } = _this.get();
9125
+ 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
9126
  // if user is not authenticated function execution is terminated
9111
9127
  if (!isAuthenticated()) {
9112
9128
  return console.warn("You are already logged out.");
9113
9129
  }
9114
9130
  window.Pelcro.user.logout();
9115
- if (enableReactGA4$f) {
9131
+ if (enableReactGA4) {
9116
9132
  ReactGA4.event("Logged out", {
9117
9133
  nonInteraction: true
9118
9134
  });
@@ -9348,9 +9364,6 @@ if (process.env.NODE_ENV === "development") {
9348
9364
  c$1("Pelcro Store", usePelcro);
9349
9365
  }
9350
9366
 
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
9367
  /**
9355
9368
  * List of zero-decimal currencies.
9356
9369
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9436,8 +9449,8 @@ const getLanguageWithoutRegion = localeName => {
9436
9449
  * @return {string | undefined}
9437
9450
  */
9438
9451
  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);
9452
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9453
+ 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
9454
  };
9442
9455
 
9443
9456
  /**
@@ -9490,9 +9503,9 @@ const isValidViewFromURL = viewID => {
9490
9503
  *
9491
9504
  */
9492
9505
  function hasValidNewsletterUpdateUrl() {
9493
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9506
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9494
9507
  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;
9508
+ 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
9509
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9497
9510
  if (!siteHasNewslettersDefined) {
9498
9511
  return false;
@@ -9538,7 +9551,7 @@ const disableScroll = () => {
9538
9551
  }
9539
9552
  };
9540
9553
  const trackSubscriptionOnGA = () => {
9541
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9554
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9542
9555
  const {
9543
9556
  product,
9544
9557
  plan,
@@ -9553,11 +9566,12 @@ const trackSubscriptionOnGA = () => {
9553
9566
  invoices
9554
9567
  } = window.Pelcro.user.read();
9555
9568
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9569
+ 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
9570
  if (!lastSubscriptionId) {
9557
9571
  return;
9558
9572
  }
9559
9573
  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) {
9574
+ if (enableReactGA4) {
9561
9575
  ReactGA4.event("purchase", {
9562
9576
  transaction_id: lastSubscriptionId,
9563
9577
  affiliation: "Pelcro",
@@ -9685,8 +9699,8 @@ function getDateWithoutTime(dateObject) {
9685
9699
  return date;
9686
9700
  }
9687
9701
  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;
9702
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9703
+ 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
9704
  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
9705
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9692
9706
  }
@@ -10055,10 +10069,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10055
10069
  return descriptor.value;
10056
10070
  }
10057
10071
 
10058
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10059
10072
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10060
10073
  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
10074
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10063
10075
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10064
10076
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10142,7 +10154,7 @@ class SaveToMetadataButtonClass {
10142
10154
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10143
10155
  writable: true,
10144
10156
  value: event => {
10145
- var _user$metadata;
10157
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10146
10158
  const button = event.currentTarget;
10147
10159
  const user = window.Pelcro.user.read();
10148
10160
  const {
@@ -10152,6 +10164,7 @@ class SaveToMetadataButtonClass {
10152
10164
  key,
10153
10165
  ...buttonMetadata
10154
10166
  } = button.dataset;
10167
+ 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
10168
  if (userMustVerifyEmail()) {
10156
10169
  return switchView("email-verify");
10157
10170
  }
@@ -10180,7 +10193,7 @@ class SaveToMetadataButtonClass {
10180
10193
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10181
10194
  }
10182
10195
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10183
- if (enableReactGA4$d) {
10196
+ if (enableReactGA4) {
10184
10197
  ReactGA4.event("Save/Follow", {
10185
10198
  event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10186
10199
  });
@@ -10199,6 +10212,7 @@ class SaveToMetadataButtonClass {
10199
10212
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10200
10213
  writable: true,
10201
10214
  value: event => {
10215
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10202
10216
  const button = event.currentTarget;
10203
10217
  const user = window.Pelcro.user.read();
10204
10218
  const {
@@ -10206,6 +10220,7 @@ class SaveToMetadataButtonClass {
10206
10220
  title
10207
10221
  } = button.dataset;
10208
10222
  const oldValue = user.metadata[`metadata_saved_${key}`];
10223
+ 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
10224
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10210
10225
  if (window.Pelcro.user.isAuthenticated()) {
10211
10226
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10218,7 +10233,7 @@ class SaveToMetadataButtonClass {
10218
10233
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10219
10234
  }
10220
10235
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10221
- if (enableReactGA4$d) {
10236
+ if (enableReactGA4) {
10222
10237
  ReactGA4.event("Unsave/Unfollow", {
10223
10238
  event_label: title
10224
10239
  });
@@ -11752,9 +11767,6 @@ function getSiteCardProcessor() {
11752
11767
  return "stripe";
11753
11768
  }
11754
11769
 
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
11770
  /**
11759
11771
  * @typedef {Object} OptionsType
11760
11772
  * @property {boolean} loadPaymentSDKs
@@ -11877,8 +11889,10 @@ const initSecuritySdk = () => {
11877
11889
  });
11878
11890
  };
11879
11891
  const initGATracking = () => {
11892
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11893
+ 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
11894
  if (window.Pelcro.site.read().google_analytics_id) {
11881
- if (enableReactGA4$c) {
11895
+ if (enableReactGA4) {
11882
11896
  // Initialize ReactGA4 with your tracking ID
11883
11897
  ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11884
11898
  // Enable e-commerce tracking
@@ -11898,9 +11912,10 @@ const initGATracking = () => {
11898
11912
  }
11899
11913
  };
11900
11914
  const dispatchModalDisplayEvents = modalName => {
11901
- var _modalName$replace, _modalName$replace2;
11915
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11916
+ 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
11917
  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) {
11918
+ if (enableReactGA4) {
11904
11919
  ReactGA4.event(`${formattedAction} viewed`, {
11905
11920
  nonInteraction: true
11906
11921
  });
@@ -12774,6 +12789,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12774
12789
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12775
12790
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12776
12791
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12792
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12777
12793
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12778
12794
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12779
12795
  const SET_EMAILS = "SET_EMAILS";
@@ -12786,8 +12802,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12786
12802
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12787
12803
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12788
12804
 
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
12805
  const initialState$m = {
12792
12806
  email: "",
12793
12807
  username: "",
@@ -12806,6 +12820,7 @@ const {
12806
12820
  Provider: Provider$m
12807
12821
  } = store$m;
12808
12822
  const LoginContainer = _ref => {
12823
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12809
12824
  let {
12810
12825
  style,
12811
12826
  className = "",
@@ -12813,6 +12828,7 @@ const LoginContainer = _ref => {
12813
12828
  onFailure = () => {},
12814
12829
  children
12815
12830
  } = _ref;
12831
+ 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
12832
  const handleLogin = (_ref2, dispatch) => {
12817
12833
  let {
12818
12834
  email,
@@ -12843,7 +12859,7 @@ const LoginContainer = _ref => {
12843
12859
  onFailure(err);
12844
12860
  } else {
12845
12861
  onSuccess(res);
12846
- if (enableReactGA4$b) {
12862
+ if (enableReactGA4) {
12847
12863
  ReactGA4.event("Logged in", {
12848
12864
  nonInteraction: true
12849
12865
  });
@@ -13240,12 +13256,12 @@ function ConfirmPassword(_ref) {
13240
13256
  }, otherProps));
13241
13257
  }
13242
13258
 
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
13259
  const Logout = props => {
13246
13260
  const handleLogout = () => {
13261
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13247
13262
  window.Pelcro.user.logout();
13248
- if (enableReactGA4$a) {
13263
+ 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;
13264
+ if (enableReactGA4) {
13249
13265
  ReactGA4.event("Logged out", {
13250
13266
  nonInteraction: true
13251
13267
  });
@@ -14814,13 +14830,11 @@ const RegisterCompany = props => {
14814
14830
  }, props));
14815
14831
  };
14816
14832
 
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
14833
  /**
14821
14834
  *
14822
14835
  */
14823
14836
  function RegisterModal(props) {
14837
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14824
14838
  const {
14825
14839
  t
14826
14840
  } = useTranslation("register");
@@ -14835,6 +14849,7 @@ function RegisterModal(props) {
14835
14849
  giftCode,
14836
14850
  isGift
14837
14851
  } = usePelcro();
14852
+ 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
14853
  const onSuccess = res => {
14839
14854
  var _props$onSuccess;
14840
14855
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -14842,7 +14857,7 @@ function RegisterModal(props) {
14842
14857
  };
14843
14858
  const handleAfterRegistrationLogic = () => {
14844
14859
  var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14845
- if (enableReactGA4$9) {
14860
+ if (enableReactGA4) {
14846
14861
  ReactGA4.event("Registered", {
14847
14862
  nonInteraction: true
14848
14863
  });
@@ -14940,9 +14955,6 @@ function Radio(_ref) {
14940
14955
  }, children));
14941
14956
  }
14942
14957
 
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
14958
  /**
14947
14959
  *
14948
14960
  */
@@ -15002,6 +15014,7 @@ function productMatchPageLanguage(product) {
15002
15014
  SelectModalWithHook.viewId = "plan-select";
15003
15015
  class SelectModal extends Component {
15004
15016
  constructor(props) {
15017
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
15005
15018
  super(props);
15006
15019
  _defineProperty$3(this, "componentDidMount", () => {
15007
15020
  if (this.props.product) {
@@ -15036,11 +15049,11 @@ class SelectModal extends Component {
15036
15049
  }
15037
15050
  document.addEventListener("keydown", this.handleSubmit);
15038
15051
  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 => {
15052
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15053
+ 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;
15054
+ 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;
15055
+ 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;
15056
+ 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
15057
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
15045
15058
  if (filteredPlans.length) return filteredPlans;
15046
15059
  });
@@ -15053,12 +15066,12 @@ class SelectModal extends Component {
15053
15066
  });
15054
15067
  notifyBugsnag(() => {
15055
15068
  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;
15069
+ 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
15070
  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,
15071
+ 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(),
15072
+ 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(),
15073
+ 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,
15074
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15062
15075
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15063
15076
  productListState: this.state.productList,
15064
15077
  methods: {
@@ -15069,8 +15082,8 @@ class SelectModal extends Component {
15069
15082
  userCurrency: userCurrency,
15070
15083
  userCountry: userCountry,
15071
15084
  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,
15085
+ 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(),
15086
+ 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
15087
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15075
15088
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15076
15089
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15282,6 +15295,7 @@ class SelectModal extends Component {
15282
15295
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15283
15296
  this.locale = this.props.t;
15284
15297
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15298
+ 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
15299
  }
15286
15300
  render() {
15287
15301
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15289,7 +15303,7 @@ class SelectModal extends Component {
15289
15303
  disableGifting
15290
15304
  } = this.props;
15291
15305
  if (this.state.mode === "product") {
15292
- if (enableReactGA4$8) {
15306
+ if (this.enableReactGA4) {
15293
15307
  ReactGA4.event("Product Modal Viewed", {
15294
15308
  nonInteraction: true
15295
15309
  });
@@ -15302,7 +15316,7 @@ class SelectModal extends Component {
15302
15316
  });
15303
15317
  }
15304
15318
  } else if (this.state.mode === "plan") {
15305
- if (enableReactGA4$8) {
15319
+ if (this.enableReactGA4) {
15306
15320
  ReactGA4.event("Plan Modal Viewed", {
15307
15321
  nonInteraction: true
15308
15322
  });
@@ -21244,13 +21258,11 @@ const SubscriptionRenewView = _ref => {
21244
21258
  }));
21245
21259
  };
21246
21260
 
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
21261
  /**
21251
21262
  *
21252
21263
  */
21253
21264
  function SubscriptionRenewModal(_ref) {
21265
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21254
21266
  let {
21255
21267
  onDisplay,
21256
21268
  onClose,
@@ -21259,10 +21271,11 @@ function SubscriptionRenewModal(_ref) {
21259
21271
  const {
21260
21272
  switchView
21261
21273
  } = usePelcro();
21274
+ 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
21275
  const onSuccess = res => {
21263
21276
  var _otherProps$onSuccess;
21264
21277
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21265
- if (enableReactGA4$7) {
21278
+ if (enableReactGA4) {
21266
21279
  ReactGA4.event("Renewed", {
21267
21280
  nonInteraction: true
21268
21281
  });
@@ -21279,7 +21292,7 @@ function SubscriptionRenewModal(_ref) {
21279
21292
  const onGiftRenewalSuccess = () => {
21280
21293
  var _otherProps$onGiftRen;
21281
21294
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21282
- if (enableReactGA4$7) {
21295
+ if (enableReactGA4) {
21283
21296
  ReactGA4.event("Renewed Gift", {
21284
21297
  nonInteraction: true
21285
21298
  });
@@ -21305,7 +21318,8 @@ function SubscriptionRenewModal(_ref) {
21305
21318
  SubscriptionRenewModal.viewId = "subscription-renew";
21306
21319
 
21307
21320
  const initialState$j = {
21308
- cancelationReason: ""
21321
+ cancelationReason: "",
21322
+ cancelationOption: ""
21309
21323
  };
21310
21324
  const store$j = /*#__PURE__*/createContext(initialState$j);
21311
21325
  const {
@@ -21320,7 +21334,6 @@ const SubscriptionCancelContainer = _ref => {
21320
21334
  children,
21321
21335
  ...props
21322
21336
  } = _ref;
21323
- useTranslation("verifyEmail");
21324
21337
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
21325
21338
  switch (action.type) {
21326
21339
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -21328,6 +21341,11 @@ const SubscriptionCancelContainer = _ref => {
21328
21341
  ...state,
21329
21342
  cancelationReason: action.payload
21330
21343
  });
21344
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
21345
+ return lib_7({
21346
+ ...state,
21347
+ cancelationOption: action.payload
21348
+ });
21331
21349
  default:
21332
21350
  return state;
21333
21351
  }
@@ -21427,8 +21445,7 @@ const SubscriptionCancelReason = props => {
21427
21445
  t
21428
21446
  } = useTranslation("subscriptionCancel");
21429
21447
  const {
21430
- dispatch,
21431
- state
21448
+ dispatch
21432
21449
  } = useContext(store$j);
21433
21450
  const handleOnTextAreaBlur = e => {
21434
21451
  dispatch({
@@ -21460,9 +21477,7 @@ function SvgSubscription(props) {
21460
21477
  }))))));
21461
21478
  }
21462
21479
 
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
- const SubscriptionCancelNowButton = _ref => {
21480
+ const SubscriptionCancelButton = _ref => {
21466
21481
  let {
21467
21482
  subscription,
21468
21483
  onClick,
@@ -21473,14 +21488,16 @@ const SubscriptionCancelNowButton = _ref => {
21473
21488
  } = usePelcro();
21474
21489
  const {
21475
21490
  state: {
21476
- cancelationReason
21477
- },
21478
- dispatch
21491
+ cancelationReason,
21492
+ cancelationOption
21493
+ }
21479
21494
  } = useContext(store$j);
21480
21495
  const {
21481
21496
  t
21482
21497
  } = useTranslation("subscriptionCancel");
21483
21498
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21499
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21500
+ 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
21501
  window.Pelcro.subscription.cancel({
21485
21502
  auth_token: window.Pelcro.user.read().auth_token,
21486
21503
  subscription_id: payload.subscription_id,
@@ -21492,7 +21509,7 @@ const SubscriptionCancelNowButton = _ref => {
21492
21509
  if (err) {
21493
21510
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21494
21511
  }
21495
- if (enableReactGA4$6) {
21512
+ if (enableReactGA4) {
21496
21513
  ReactGA4.event("Canceled", {
21497
21514
  nonInteraction: true
21498
21515
  });
@@ -21507,10 +21524,10 @@ const SubscriptionCancelNowButton = _ref => {
21507
21524
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21508
21525
  });
21509
21526
  };
21510
- const handleCancelNowClick = () => {
21527
+ const handleCancelClick = () => {
21511
21528
  const payload = {
21512
21529
  subscription_id: subscription.id,
21513
- mode: "now",
21530
+ mode: cancelationOption,
21514
21531
  ...(cancelationReason && {
21515
21532
  reason: cancelationReason
21516
21533
  })
@@ -21524,7 +21541,7 @@ const SubscriptionCancelNowButton = _ref => {
21524
21541
  notify.confirm((onSuccess, onFailure) => {
21525
21542
  cancelSubscription(payload, onSuccess, onFailure);
21526
21543
  }, {
21527
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
21544
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
21528
21545
  loadingMessage: t("messages.subCancellation.loading"),
21529
21546
  successMessage: t("messages.subCancellation.success"),
21530
21547
  errorMessage: t("messages.subCancellation.error")
@@ -21533,96 +21550,88 @@ const SubscriptionCancelNowButton = _ref => {
21533
21550
  });
21534
21551
  };
21535
21552
  return /*#__PURE__*/React__default.createElement(Button, {
21536
- onClick: handleCancelNowClick,
21537
- className: `${className}`
21538
- }, t("messages.cancelNow"));
21553
+ onClick: handleCancelClick,
21554
+ className: `${className}`,
21555
+ disabled: !cancelationOption
21556
+ }, t("labels.cancel"));
21539
21557
  };
21540
21558
 
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
- const SubscriptionCancelLaterButton = _ref => {
21559
+ const SubscriptionCancelOptions = _ref => {
21560
+ var _subscription$schedul;
21544
21561
  let {
21545
21562
  subscription,
21563
+ hasPhases,
21546
21564
  onClick,
21547
21565
  className
21548
21566
  } = _ref;
21549
- const {
21550
- switchView
21551
- } = usePelcro();
21552
21567
  const {
21553
21568
  state: {
21554
- cancelationReason
21569
+ cancelationOption
21555
21570
  },
21556
21571
  dispatch
21557
21572
  } = useContext(store$j);
21558
21573
  const {
21559
21574
  t
21560
21575
  } = useTranslation("subscriptionCancel");
21561
- const cancelSubscription = (payload, onSuccess, onFailure) => {
21562
- window.Pelcro.subscription.cancel({
21563
- auth_token: window.Pelcro.user.read().auth_token,
21564
- subscription_id: payload.subscription_id,
21565
- mode: payload.mode,
21566
- ...(payload.reason && {
21567
- reason: payload.reason
21568
- })
21569
- }, (err, res) => {
21570
- if (err) {
21571
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21572
- }
21573
- if (enableReactGA4$5) {
21574
- ReactGA4.event("Canceled", {
21575
- nonInteraction: true
21576
- });
21577
- } else {
21578
- var _ReactGA$event;
21579
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21580
- category: "ACTIONS",
21581
- action: "Canceled",
21582
- nonInteraction: true
21583
- });
21584
- }
21585
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21586
- });
21587
- };
21588
- const handleCancelNowClick = () => {
21589
- const payload = {
21590
- subscription_id: subscription.id,
21591
- mode: "period_end",
21592
- ...(cancelationReason && {
21593
- reason: cancelationReason
21594
- })
21595
- };
21596
- onClick === null || onClick === void 0 ? void 0 : onClick();
21597
-
21598
- // Close the modal
21599
- switchView(null);
21600
-
21601
- // Show confirmation alert after closing the modal
21602
- notify.confirm((onSuccess, onFailure) => {
21603
- cancelSubscription(payload, onSuccess, onFailure);
21604
- }, {
21605
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
21606
- loadingMessage: t("messages.subCancellation.loading"),
21607
- successMessage: t("messages.subCancellation.success"),
21608
- errorMessage: t("messages.subCancellation.error")
21609
- }, {
21610
- closeButtonLabel: t("labels.subCancellation.goBack")
21576
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
21577
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21578
+ const handleOptionSelect = event => {
21579
+ dispatch({
21580
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
21581
+ payload: event.target.value
21611
21582
  });
21612
21583
  };
21613
- return /*#__PURE__*/React__default.createElement(Button, {
21614
- onClick: handleCancelNowClick,
21615
- className: `${className}`
21616
- }, t("messages.cancelLater"));
21584
+ return /*#__PURE__*/React__default.createElement("div", {
21585
+ className: "plc-text-left plc-mr-auto plc-mb-6"
21586
+ }, /*#__PURE__*/React__default.createElement("p", {
21587
+ className: "plc-mb-3"
21588
+ }, t("messages.cancelWhen")), hasPhases && /*#__PURE__*/React__default.createElement(Radio, {
21589
+ onChange: handleOptionSelect,
21590
+ checked: cancelationOption === "period_end",
21591
+ value: "period_end"
21592
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21593
+ year: "numeric",
21594
+ month: "short",
21595
+ day: "numeric"
21596
+ })), /*#__PURE__*/React__default.createElement(Radio, {
21597
+ onChange: handleOptionSelect,
21598
+ checked: cancelationOption === "current_period_end",
21599
+ value: "current_period_end"
21600
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
21601
+ year: "numeric",
21602
+ month: "short",
21603
+ day: "numeric"
21604
+ })), /*#__PURE__*/React__default.createElement(Radio, {
21605
+ onChange: handleOptionSelect,
21606
+ checked: cancelationOption === "now",
21607
+ value: "now"
21608
+ }, t("labels.endImmediately")));
21617
21609
  };
21618
21610
 
21619
21611
  const SubscriptionCancelView = props => {
21612
+ var _subscriptionToCancel7, _subscriptionToCancel8;
21620
21613
  const {
21621
- subscriptionToCancel
21614
+ subscriptionToCancel,
21615
+ switchView
21622
21616
  } = usePelcro();
21623
21617
  const {
21624
21618
  t
21625
21619
  } = useTranslation("subscriptionCancel");
21620
+ const getPhases = () => {
21621
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
21622
+ if (!subscriptionToCancel.schedule) return [];
21623
+ 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;
21624
+ 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 => {
21625
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
21626
+ });
21627
+ 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 => {
21628
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
21629
+ });
21630
+ return [currentPhase, ...futurePhases];
21631
+ };
21632
+ const hasPhases = getPhases().length > 0;
21633
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
21634
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21626
21635
  return /*#__PURE__*/React__default.createElement("div", {
21627
21636
  id: "pelcro-subscription-cancel-view"
21628
21637
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -21631,22 +21640,35 @@ const SubscriptionCancelView = props => {
21631
21640
  className: "plc-text-2xl plc-font-semibold"
21632
21641
  }, t("labels.title"), /*#__PURE__*/React__default.createElement("span", {
21633
21642
  className: "plc-text-gray-400 plc-text-base plc-block"
21634
- }, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
21643
+ }, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
21635
21644
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
21636
21645
  }, /*#__PURE__*/React__default.createElement(SvgSubscription, {
21637
21646
  className: "plc-w-32 plc-h-32"
21638
21647
  }), /*#__PURE__*/React__default.createElement("p", {
21639
- className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
21640
- }, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21648
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
21649
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21641
21650
  year: "numeric",
21642
21651
  month: "short",
21643
21652
  day: "numeric"
21644
- }), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement(SubscriptionCancelNowButton, {
21645
- className: "plc-mb-2",
21646
- subscription: subscriptionToCancel
21647
- }), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(SubscriptionCancelLaterButton, {
21653
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21654
+ year: "numeric",
21655
+ month: "short",
21656
+ day: "numeric"
21657
+ }), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelOptions, {
21658
+ subscription: subscriptionToCancel,
21659
+ hasPhases: hasPhases
21660
+ }), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement("div", {
21661
+ 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"
21662
+ }, /*#__PURE__*/React__default.createElement(SubscriptionCancelButton, {
21663
+ className: "plc-w-3/4 md:plc-w-2/5",
21648
21664
  subscription: subscriptionToCancel
21649
- }))));
21665
+ }), /*#__PURE__*/React__default.createElement(Button, {
21666
+ variant: "outline",
21667
+ className: "plc-w-3/4 md:plc-w-2/5",
21668
+ onClick: () => {
21669
+ switchView("dashboard");
21670
+ }
21671
+ }, t("labels.subCancellation.goBack"))))));
21650
21672
  };
21651
21673
 
21652
21674
  const SubscriptionCancelModal = _ref => {
@@ -21786,9 +21808,8 @@ const SubscriptionSuspendDate = props => {
21786
21808
  }, props));
21787
21809
  };
21788
21810
 
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
21811
  const SubscriptionSuspendButton = _ref => {
21812
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21792
21813
  let {
21793
21814
  subscription,
21794
21815
  onClick,
@@ -21807,6 +21828,7 @@ const SubscriptionSuspendButton = _ref => {
21807
21828
  const {
21808
21829
  t
21809
21830
  } = useTranslation("subscriptionSuspend");
21831
+ 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
21832
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21811
21833
  window.Pelcro.subscription.update({
21812
21834
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21817,7 +21839,7 @@ const SubscriptionSuspendButton = _ref => {
21817
21839
  if (err) {
21818
21840
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21819
21841
  }
21820
- if (enableReactGA4$4) {
21842
+ if (enableReactGA4) {
21821
21843
  ReactGA4.event("Suspended", {
21822
21844
  nonInteraction: true
21823
21845
  });
@@ -24541,8 +24563,6 @@ const AddressCreateLine2 = props => {
24541
24563
  }, props));
24542
24564
  };
24543
24565
 
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
24566
  const initialState$d = {
24547
24567
  isSubmitting: false,
24548
24568
  firstName: "",
@@ -24574,7 +24594,7 @@ const {
24574
24594
  Provider: Provider$d
24575
24595
  } = store$d;
24576
24596
  const AddressUpdateContainer = _ref => {
24577
- var _props$addressId;
24597
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24578
24598
  let {
24579
24599
  style,
24580
24600
  className = "",
@@ -24588,6 +24608,7 @@ const AddressUpdateContainer = _ref => {
24588
24608
  addressIdToEdit
24589
24609
  } = usePelcro();
24590
24610
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24611
+ 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
24612
  const [t] = useTranslation("address");
24592
24613
  useEffect(() => {
24593
24614
  const getCountries = () => {
@@ -24686,7 +24707,7 @@ const AddressUpdateContainer = _ref => {
24686
24707
  }
24687
24708
  });
24688
24709
  onSuccess(res);
24689
- if (enableReactGA4$3) {
24710
+ if (enableReactGA4) {
24690
24711
  ReactGA4.event("Updated address", {
24691
24712
  nonInteraction: true
24692
24713
  });
@@ -25221,13 +25242,13 @@ function PaymentMethodUpdateView(props) {
25221
25242
  }));
25222
25243
  }
25223
25244
 
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
25245
  const PaymentMethodUpdateModal = props => {
25246
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25247
+ 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
25248
  const onSuccess = res => {
25228
25249
  var _props$onSuccess;
25229
25250
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25230
- if (enableReactGA4$2) {
25251
+ if (enableReactGA4) {
25231
25252
  ReactGA4.event("Updated payment card", {
25232
25253
  nonInteraction: true
25233
25254
  });
@@ -29115,8 +29136,6 @@ const OrderItems = _ref => {
29115
29136
  });
29116
29137
  };
29117
29138
 
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
29139
  const SavedItemsMenu = () => {
29121
29140
  const {
29122
29141
  t
@@ -29165,8 +29184,10 @@ const SavedItems = _ref3 => {
29165
29184
  isAuthenticated
29166
29185
  } = usePelcro();
29167
29186
  const removeItemFromMetadata = (category, title) => {
29187
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29168
29188
  const user = window.Pelcro.user.read();
29169
29189
  const oldValue = user.metadata[`metadata_saved_${category}`];
29190
+ 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
29191
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29171
29192
  if (isAuthenticated()) {
29172
29193
  setLoading(true);
@@ -29181,7 +29202,7 @@ const SavedItems = _ref3 => {
29181
29202
  return;
29182
29203
  }
29183
29204
  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) {
29205
+ if (enableReactGA4) {
29185
29206
  ReactGA4.event("Unsave/Unfollow", {
29186
29207
  event_label: title
29187
29208
  });
@@ -30145,8 +30166,6 @@ function getMemberShipStatus(status) {
30145
30166
  };
30146
30167
  }
30147
30168
 
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
30169
  const SUB_MENUS = {
30151
30170
  PROFILE: "profile",
30152
30171
  SUBSCRIPTIONS: "subscriptions",
@@ -30201,7 +30220,7 @@ function DashboardWithHook(props) {
30201
30220
  DashboardWithHook.viewId = "dashboard";
30202
30221
  class Dashboard extends Component {
30203
30222
  constructor(props) {
30204
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30223
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30205
30224
  super(props);
30206
30225
  _defineProperty$3(this, "componentDidMount", () => {
30207
30226
  this.setState({
@@ -30210,7 +30229,7 @@ class Dashboard extends Component {
30210
30229
  window.Pelcro.insight.track("Modal Displayed", {
30211
30230
  name: "dashboard"
30212
30231
  });
30213
- if (enableReactGA4) {
30232
+ if (this.enableReactGA4) {
30214
30233
  ReactGA4.event("Dashboard Modal Viewed", {
30215
30234
  nonInteraction: true
30216
30235
  });
@@ -30252,7 +30271,7 @@ class Dashboard extends Component {
30252
30271
  if (err) {
30253
30272
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30254
30273
  }
30255
- if (enableReactGA4) {
30274
+ if (this.enableReactGA4) {
30256
30275
  ReactGA4.event("Canceled", {
30257
30276
  nonInteraction: true
30258
30277
  });
@@ -30276,7 +30295,7 @@ class Dashboard extends Component {
30276
30295
  if (err) {
30277
30296
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30278
30297
  }
30279
- if (enableReactGA4) {
30298
+ if (this.enableReactGA4) {
30280
30299
  ReactGA4.event("UnSuspended", {
30281
30300
  nonInteraction: true
30282
30301
  });
@@ -30572,6 +30591,7 @@ class Dashboard extends Component {
30572
30591
  this.locale = this.props.t;
30573
30592
  this.user = window.Pelcro.user.read();
30574
30593
  this.menuRef = /*#__PURE__*/React__default.createRef();
30594
+ 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
30595
  }
30576
30596
  render() {
30577
30597
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;