@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.cjs.js CHANGED
@@ -4103,12 +4103,16 @@ var invoiceDetails_en = {
4103
4103
  var labels$U = {
4104
4104
  title: "Cancel subscription",
4105
4105
  cancelReason: "Cancellation reason",
4106
+ endOn: "End on",
4107
+ endImmediately: "End immediately",
4108
+ cancel: "Cancel",
4106
4109
  subCancellation: {
4107
4110
  goBack: "Go back"
4108
4111
  }
4109
4112
  };
4110
4113
  var messages$W = {
4111
4114
  subscriptionEnd: "This subscription is set to expire on",
4115
+ cancelWhen: "When would you like to cancel?",
4112
4116
  cancelNow: "Cancel Subscription Now",
4113
4117
  cancelLater: "Cancel at Period End",
4114
4118
  subCancellation: {
@@ -5025,12 +5029,16 @@ var invoiceDetails_fr = {
5025
5029
  var labels$C = {
5026
5030
  title: "Annuler l'abonnement",
5027
5031
  cancelReason: "Motif d'annulation",
5032
+ endOn: "Fin sur",
5033
+ endImmediately: "Fin immédiate",
5034
+ cancel: "Annuler",
5028
5035
  subCancellation: {
5029
5036
  goBack: "Retourner"
5030
5037
  }
5031
5038
  };
5032
5039
  var messages$D = {
5033
5040
  subscriptionEnd: "Cet abonnement doit expirer le",
5041
+ cancelWhen: "Quand voulez-vous annuler?",
5034
5042
  cancelNow: "Cancel Subscription Now",
5035
5043
  cancelLater: "Annuler l'abonnement maintenant",
5036
5044
  subCancellation: {
@@ -6054,12 +6062,16 @@ var invoiceDetails_ko = {
6054
6062
  var labels$k = {
6055
6063
  title: "구독 취소",
6056
6064
  cancelReason: "취소 사유",
6065
+ endOn: "종료",
6066
+ endImmediately: "즉시 종료",
6067
+ cancel: "취소",
6057
6068
  subCancellation: {
6058
6069
  goBack: "돌아가기"
6059
6070
  }
6060
6071
  };
6061
6072
  var messages$k = {
6062
6073
  subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
6074
+ cancelWhen: "언제 취소하시겠습니까?",
6063
6075
  cancelNow: "지금 구독 취소",
6064
6076
  cancelLater: "기간 종료 시 취소",
6065
6077
  subCancellation: {
@@ -6968,12 +6980,16 @@ var invoiceDetails_es = {
6968
6980
  var labels$2 = {
6969
6981
  title: "Cancelar suscripción",
6970
6982
  cancelReason: "Razón de la cancelación",
6983
+ endOn: "Fin de",
6984
+ endImmediately: "Fin inmediato",
6985
+ cancel: "Cancelar",
6971
6986
  subCancellation: {
6972
6987
  goBack: "Volver"
6973
6988
  }
6974
6989
  };
6975
6990
  var messages$1 = {
6976
6991
  subscriptionEnd: "Esta suscripción expirará el",
6992
+ cancelWhen: "¿Cuándo desea cancelar?",
6977
6993
  cancelNow: "Cancelar Suscripción Ahora",
6978
6994
  cancelLater: "Cancelar al Final del Periodo",
6979
6995
  subCancellation: {
@@ -8950,8 +8966,6 @@ exports["default"] = _default;
8950
8966
  var ReactGA4 = unwrapExports(dist);
8951
8967
  dist.ReactGAImplementation;
8952
8968
 
8953
- var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
8954
- const enableReactGA4$f = (_window$f = window) === null || _window$f === void 0 ? void 0 : (_window$Pelcro$f = _window$f.Pelcro) === null || _window$Pelcro$f === void 0 ? void 0 : (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) === null || _window$Pelcro$uiSett$f === void 0 ? void 0 : _window$Pelcro$uiSett$f.enableReactGA4;
8955
8969
  class PelcroActions {
8956
8970
  constructor(storeSetter, storeGetter) {
8957
8971
  var _this = this;
@@ -9131,18 +9145,20 @@ class PelcroActions {
9131
9145
  });
9132
9146
  });
9133
9147
  _defineProperty$3(this, "logout", function () {
9148
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9134
9149
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9135
9150
  const {
9136
9151
  switchView,
9137
9152
  resetView,
9138
9153
  isAuthenticated
9139
9154
  } = _this.get();
9155
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
9140
9156
  // if user is not authenticated function execution is terminated
9141
9157
  if (!isAuthenticated()) {
9142
9158
  return console.warn("You are already logged out.");
9143
9159
  }
9144
9160
  window.Pelcro.user.logout();
9145
- if (enableReactGA4$f) {
9161
+ if (enableReactGA4) {
9146
9162
  ReactGA4.event("Logged out", {
9147
9163
  nonInteraction: true
9148
9164
  });
@@ -9378,9 +9394,6 @@ if (process.env.NODE_ENV === "development") {
9378
9394
  c$1("Pelcro Store", usePelcro);
9379
9395
  }
9380
9396
 
9381
- var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
9382
- const enableReactGA4$e = (_window$e = window) === null || _window$e === void 0 ? void 0 : (_window$Pelcro$e = _window$e.Pelcro) === null || _window$Pelcro$e === void 0 ? void 0 : (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) === null || _window$Pelcro$uiSett$e === void 0 ? void 0 : _window$Pelcro$uiSett$e.enableReactGA4;
9383
-
9384
9397
  /**
9385
9398
  * List of zero-decimal currencies.
9386
9399
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9466,8 +9479,8 @@ const getLanguageWithoutRegion = localeName => {
9466
9479
  * @return {string | undefined}
9467
9480
  */
9468
9481
  const getPageOrDefaultLanguage = () => {
9469
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9470
- return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : (_window$Pelcro2$site$ = _window$Pelcro2$site.read) === null || _window$Pelcro2$site$ === void 0 ? void 0 : (_window$Pelcro2$site$2 = _window$Pelcro2$site$.call(_window$Pelcro2$site)) === null || _window$Pelcro2$site$2 === void 0 ? void 0 : _window$Pelcro2$site$2.default_locale);
9482
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9483
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
9471
9484
  };
9472
9485
 
9473
9486
  /**
@@ -9520,9 +9533,9 @@ const isValidViewFromURL = viewID => {
9520
9533
  *
9521
9534
  */
9522
9535
  function hasValidNewsletterUpdateUrl() {
9523
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9536
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9524
9537
  if (viewID !== "newsletter-update") return false;
9525
- const newsletters = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.newsletters;
9538
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
9526
9539
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9527
9540
  if (!siteHasNewslettersDefined) {
9528
9541
  return false;
@@ -9568,7 +9581,7 @@ const disableScroll = () => {
9568
9581
  }
9569
9582
  };
9570
9583
  const trackSubscriptionOnGA = () => {
9571
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9584
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9572
9585
  const {
9573
9586
  product,
9574
9587
  plan,
@@ -9583,11 +9596,12 @@ const trackSubscriptionOnGA = () => {
9583
9596
  invoices
9584
9597
  } = window.Pelcro.user.read();
9585
9598
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9599
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro3 = _window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.enableReactGA4;
9586
9600
  if (!lastSubscriptionId) {
9587
9601
  return;
9588
9602
  }
9589
9603
  const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
9590
- if (enableReactGA4$e) {
9604
+ if (enableReactGA4) {
9591
9605
  ReactGA4.event("purchase", {
9592
9606
  transaction_id: lastSubscriptionId,
9593
9607
  affiliation: "Pelcro",
@@ -9715,8 +9729,8 @@ function getDateWithoutTime(dateObject) {
9715
9729
  return date;
9716
9730
  }
9717
9731
  function userMustVerifyEmail() {
9718
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9719
- const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
9732
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9733
+ const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
9720
9734
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
9721
9735
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9722
9736
  }
@@ -10085,10 +10099,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10085
10099
  return descriptor.value;
10086
10100
  }
10087
10101
 
10088
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
10089
10102
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10090
10103
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10091
- const enableReactGA4$d = (_window$d = window) === null || _window$d === void 0 ? void 0 : (_window$Pelcro$d = _window$d.Pelcro) === null || _window$Pelcro$d === void 0 ? void 0 : (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) === null || _window$Pelcro$uiSett$d === void 0 ? void 0 : _window$Pelcro$uiSett$d.enableReactGA4;
10092
10104
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10093
10105
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10094
10106
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10172,7 +10184,7 @@ class SaveToMetadataButtonClass {
10172
10184
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10173
10185
  writable: true,
10174
10186
  value: event => {
10175
- var _user$metadata;
10187
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10176
10188
  const button = event.currentTarget;
10177
10189
  const user = window.Pelcro.user.read();
10178
10190
  const {
@@ -10182,6 +10194,7 @@ class SaveToMetadataButtonClass {
10182
10194
  key,
10183
10195
  ...buttonMetadata
10184
10196
  } = button.dataset;
10197
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
10185
10198
  if (userMustVerifyEmail()) {
10186
10199
  return switchView("email-verify");
10187
10200
  }
@@ -10210,7 +10223,7 @@ class SaveToMetadataButtonClass {
10210
10223
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10211
10224
  }
10212
10225
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10213
- if (enableReactGA4$d) {
10226
+ if (enableReactGA4) {
10214
10227
  ReactGA4.event("Save/Follow", {
10215
10228
  event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10216
10229
  });
@@ -10229,6 +10242,7 @@ class SaveToMetadataButtonClass {
10229
10242
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10230
10243
  writable: true,
10231
10244
  value: event => {
10245
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10232
10246
  const button = event.currentTarget;
10233
10247
  const user = window.Pelcro.user.read();
10234
10248
  const {
@@ -10236,6 +10250,7 @@ class SaveToMetadataButtonClass {
10236
10250
  title
10237
10251
  } = button.dataset;
10238
10252
  const oldValue = user.metadata[`metadata_saved_${key}`];
10253
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
10239
10254
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10240
10255
  if (window.Pelcro.user.isAuthenticated()) {
10241
10256
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10248,7 +10263,7 @@ class SaveToMetadataButtonClass {
10248
10263
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10249
10264
  }
10250
10265
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10251
- if (enableReactGA4$d) {
10266
+ if (enableReactGA4) {
10252
10267
  ReactGA4.event("Unsave/Unfollow", {
10253
10268
  event_label: title
10254
10269
  });
@@ -11782,9 +11797,6 @@ function getSiteCardProcessor() {
11782
11797
  return "stripe";
11783
11798
  }
11784
11799
 
11785
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
11786
- const enableReactGA4$c = (_window$c = window) === null || _window$c === void 0 ? void 0 : (_window$Pelcro$c = _window$c.Pelcro) === null || _window$Pelcro$c === void 0 ? void 0 : (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) === null || _window$Pelcro$uiSett$c === void 0 ? void 0 : _window$Pelcro$uiSett$c.enableReactGA4;
11787
-
11788
11800
  /**
11789
11801
  * @typedef {Object} OptionsType
11790
11802
  * @property {boolean} loadPaymentSDKs
@@ -11907,8 +11919,10 @@ const initSecuritySdk = () => {
11907
11919
  });
11908
11920
  };
11909
11921
  const initGATracking = () => {
11922
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11923
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
11910
11924
  if (window.Pelcro.site.read().google_analytics_id) {
11911
- if (enableReactGA4$c) {
11925
+ if (enableReactGA4) {
11912
11926
  // Initialize ReactGA4 with your tracking ID
11913
11927
  ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11914
11928
  // Enable e-commerce tracking
@@ -11928,9 +11942,10 @@ const initGATracking = () => {
11928
11942
  }
11929
11943
  };
11930
11944
  const dispatchModalDisplayEvents = modalName => {
11931
- var _modalName$replace, _modalName$replace2;
11945
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11946
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
11932
11947
  const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11933
- if (enableReactGA4$c) {
11948
+ if (enableReactGA4) {
11934
11949
  ReactGA4.event(`${formattedAction} viewed`, {
11935
11950
  nonInteraction: true
11936
11951
  });
@@ -12804,6 +12819,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12804
12819
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12805
12820
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12806
12821
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12822
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12807
12823
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12808
12824
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12809
12825
  const SET_EMAILS = "SET_EMAILS";
@@ -12816,8 +12832,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12816
12832
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12817
12833
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12818
12834
 
12819
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
12820
- const enableReactGA4$b = (_window$b = window) === null || _window$b === void 0 ? void 0 : (_window$Pelcro$b = _window$b.Pelcro) === null || _window$Pelcro$b === void 0 ? void 0 : (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) === null || _window$Pelcro$uiSett$b === void 0 ? void 0 : _window$Pelcro$uiSett$b.enableReactGA4;
12821
12835
  const initialState$m = {
12822
12836
  email: "",
12823
12837
  username: "",
@@ -12836,6 +12850,7 @@ const {
12836
12850
  Provider: Provider$m
12837
12851
  } = store$m;
12838
12852
  const LoginContainer = _ref => {
12853
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12839
12854
  let {
12840
12855
  style,
12841
12856
  className = "",
@@ -12843,6 +12858,7 @@ const LoginContainer = _ref => {
12843
12858
  onFailure = () => {},
12844
12859
  children
12845
12860
  } = _ref;
12861
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
12846
12862
  const handleLogin = (_ref2, dispatch) => {
12847
12863
  let {
12848
12864
  email,
@@ -12873,7 +12889,7 @@ const LoginContainer = _ref => {
12873
12889
  onFailure(err);
12874
12890
  } else {
12875
12891
  onSuccess(res);
12876
- if (enableReactGA4$b) {
12892
+ if (enableReactGA4) {
12877
12893
  ReactGA4.event("Logged in", {
12878
12894
  nonInteraction: true
12879
12895
  });
@@ -13270,12 +13286,12 @@ function ConfirmPassword(_ref) {
13270
13286
  }, otherProps));
13271
13287
  }
13272
13288
 
13273
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
13274
- const enableReactGA4$a = (_window$a = window) === null || _window$a === void 0 ? void 0 : (_window$Pelcro$a = _window$a.Pelcro) === null || _window$Pelcro$a === void 0 ? void 0 : (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) === null || _window$Pelcro$uiSett$a === void 0 ? void 0 : _window$Pelcro$uiSett$a.enableReactGA4;
13275
13289
  const Logout = props => {
13276
13290
  const handleLogout = () => {
13291
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13277
13292
  window.Pelcro.user.logout();
13278
- if (enableReactGA4$a) {
13293
+ 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;
13294
+ if (enableReactGA4) {
13279
13295
  ReactGA4.event("Logged out", {
13280
13296
  nonInteraction: true
13281
13297
  });
@@ -14844,13 +14860,11 @@ const RegisterCompany = props => {
14844
14860
  }, props));
14845
14861
  };
14846
14862
 
14847
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
14848
- const enableReactGA4$9 = (_window$9 = window) === null || _window$9 === void 0 ? void 0 : (_window$Pelcro$9 = _window$9.Pelcro) === null || _window$Pelcro$9 === void 0 ? void 0 : (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) === null || _window$Pelcro$uiSett$9 === void 0 ? void 0 : _window$Pelcro$uiSett$9.enableReactGA4;
14849
-
14850
14863
  /**
14851
14864
  *
14852
14865
  */
14853
14866
  function RegisterModal(props) {
14867
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14854
14868
  const {
14855
14869
  t
14856
14870
  } = useTranslation("register");
@@ -14865,6 +14879,7 @@ function RegisterModal(props) {
14865
14879
  giftCode,
14866
14880
  isGift
14867
14881
  } = usePelcro();
14882
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
14868
14883
  const onSuccess = res => {
14869
14884
  var _props$onSuccess;
14870
14885
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -14872,7 +14887,7 @@ function RegisterModal(props) {
14872
14887
  };
14873
14888
  const handleAfterRegistrationLogic = () => {
14874
14889
  var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14875
- if (enableReactGA4$9) {
14890
+ if (enableReactGA4) {
14876
14891
  ReactGA4.event("Registered", {
14877
14892
  nonInteraction: true
14878
14893
  });
@@ -14970,9 +14985,6 @@ function Radio(_ref) {
14970
14985
  }, children));
14971
14986
  }
14972
14987
 
14973
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14974
- const enableReactGA4$8 = (_window$8 = window) === null || _window$8 === void 0 ? void 0 : (_window$Pelcro$8 = _window$8.Pelcro) === null || _window$Pelcro$8 === void 0 ? void 0 : (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) === null || _window$Pelcro$uiSett$8 === void 0 ? void 0 : _window$Pelcro$uiSett$8.enableReactGA4;
14975
-
14976
14988
  /**
14977
14989
  *
14978
14990
  */
@@ -15032,6 +15044,7 @@ function productMatchPageLanguage(product) {
15032
15044
  SelectModalWithHook.viewId = "plan-select";
15033
15045
  class SelectModal extends React.Component {
15034
15046
  constructor(props) {
15047
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
15035
15048
  super(props);
15036
15049
  _defineProperty$3(this, "componentDidMount", () => {
15037
15050
  if (this.props.product) {
@@ -15066,11 +15079,11 @@ class SelectModal extends React.Component {
15066
15079
  }
15067
15080
  document.addEventListener("keydown", this.handleSubmit);
15068
15081
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
15069
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
15070
- const userCurrency = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read().currency;
15071
- const userCountry = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.location.countryCode;
15072
- const userLanguage = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$user = _window$Pelcro4.user) === null || _window$Pelcro4$user === void 0 ? void 0 : _window$Pelcro4$user.read().language;
15073
- const productsMatchingUserCurrency = (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read().products.filter(product => {
15082
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15083
+ 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;
15084
+ 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;
15085
+ 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;
15086
+ const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
15074
15087
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
15075
15088
  if (filteredPlans.length) return filteredPlans;
15076
15089
  });
@@ -15083,12 +15096,12 @@ class SelectModal extends React.Component {
15083
15096
  });
15084
15097
  notifyBugsnag(() => {
15085
15098
  Bugsnag.notify("SelectModal - No data viewed", event => {
15086
- var _window$Pelcro6, _window$Pelcro6$site, _window$Pelcro7, _window$Pelcro7$user, _window$Pelcro8, _window$Pelcro8$uiSet, _window$Pelcro9, _this$props, _window$Pelcro10, _window$Pelcro10$help, _window$Pelcro11, _window$Pelcro11$site;
15099
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
15087
15100
  event.addMetadata("MetaData", {
15088
- site: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$site = _window$Pelcro6.site) === null || _window$Pelcro6$site === void 0 ? void 0 : _window$Pelcro6$site.read(),
15089
- user: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$user = _window$Pelcro7.user) === null || _window$Pelcro7$user === void 0 ? void 0 : _window$Pelcro7$user.read(),
15090
- uiVersion: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$uiSet = _window$Pelcro8.uiSettings) === null || _window$Pelcro8$uiSet === void 0 ? void 0 : _window$Pelcro8$uiSet.uiVersion,
15091
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
15101
+ 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(),
15102
+ 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(),
15103
+ 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,
15104
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15092
15105
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15093
15106
  productListState: this.state.productList,
15094
15107
  methods: {
@@ -15099,8 +15112,8 @@ class SelectModal extends React.Component {
15099
15112
  userCurrency: userCurrency,
15100
15113
  userCountry: userCountry,
15101
15114
  userLanguage: userLanguage,
15102
- siteLanguage: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$help = _window$Pelcro10.helpers) === null || _window$Pelcro10$help === void 0 ? void 0 : _window$Pelcro10$help.getHtmlLanguageAttribute(),
15103
- products: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read().products.length,
15115
+ 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(),
15116
+ products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
15104
15117
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15105
15118
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15106
15119
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15312,6 +15325,7 @@ class SelectModal extends React.Component {
15312
15325
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15313
15326
  this.locale = this.props.t;
15314
15327
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15328
+ this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro11 = _window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$uiSe = _window$Pelcro11.uiSettings) === null || _window$Pelcro11$uiSe === void 0 ? void 0 : _window$Pelcro11$uiSe.enableReactGA4;
15315
15329
  }
15316
15330
  render() {
15317
15331
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15319,7 +15333,7 @@ class SelectModal extends React.Component {
15319
15333
  disableGifting
15320
15334
  } = this.props;
15321
15335
  if (this.state.mode === "product") {
15322
- if (enableReactGA4$8) {
15336
+ if (this.enableReactGA4) {
15323
15337
  ReactGA4.event("Product Modal Viewed", {
15324
15338
  nonInteraction: true
15325
15339
  });
@@ -15332,7 +15346,7 @@ class SelectModal extends React.Component {
15332
15346
  });
15333
15347
  }
15334
15348
  } else if (this.state.mode === "plan") {
15335
- if (enableReactGA4$8) {
15349
+ if (this.enableReactGA4) {
15336
15350
  ReactGA4.event("Plan Modal Viewed", {
15337
15351
  nonInteraction: true
15338
15352
  });
@@ -21274,13 +21288,11 @@ const SubscriptionRenewView = _ref => {
21274
21288
  }));
21275
21289
  };
21276
21290
 
21277
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
21278
- const enableReactGA4$7 = (_window$7 = window) === null || _window$7 === void 0 ? void 0 : (_window$Pelcro$7 = _window$7.Pelcro) === null || _window$Pelcro$7 === void 0 ? void 0 : (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) === null || _window$Pelcro$uiSett$7 === void 0 ? void 0 : _window$Pelcro$uiSett$7.enableReactGA4;
21279
-
21280
21291
  /**
21281
21292
  *
21282
21293
  */
21283
21294
  function SubscriptionRenewModal(_ref) {
21295
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21284
21296
  let {
21285
21297
  onDisplay,
21286
21298
  onClose,
@@ -21289,10 +21301,11 @@ function SubscriptionRenewModal(_ref) {
21289
21301
  const {
21290
21302
  switchView
21291
21303
  } = usePelcro();
21304
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
21292
21305
  const onSuccess = res => {
21293
21306
  var _otherProps$onSuccess;
21294
21307
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21295
- if (enableReactGA4$7) {
21308
+ if (enableReactGA4) {
21296
21309
  ReactGA4.event("Renewed", {
21297
21310
  nonInteraction: true
21298
21311
  });
@@ -21309,7 +21322,7 @@ function SubscriptionRenewModal(_ref) {
21309
21322
  const onGiftRenewalSuccess = () => {
21310
21323
  var _otherProps$onGiftRen;
21311
21324
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21312
- if (enableReactGA4$7) {
21325
+ if (enableReactGA4) {
21313
21326
  ReactGA4.event("Renewed Gift", {
21314
21327
  nonInteraction: true
21315
21328
  });
@@ -21335,7 +21348,8 @@ function SubscriptionRenewModal(_ref) {
21335
21348
  SubscriptionRenewModal.viewId = "subscription-renew";
21336
21349
 
21337
21350
  const initialState$j = {
21338
- cancelationReason: ""
21351
+ cancelationReason: "",
21352
+ cancelationOption: ""
21339
21353
  };
21340
21354
  const store$j = /*#__PURE__*/React.createContext(initialState$j);
21341
21355
  const {
@@ -21350,7 +21364,6 @@ const SubscriptionCancelContainer = _ref => {
21350
21364
  children,
21351
21365
  ...props
21352
21366
  } = _ref;
21353
- useTranslation("verifyEmail");
21354
21367
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
21355
21368
  switch (action.type) {
21356
21369
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -21358,6 +21371,11 @@ const SubscriptionCancelContainer = _ref => {
21358
21371
  ...state,
21359
21372
  cancelationReason: action.payload
21360
21373
  });
21374
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
21375
+ return lib_7({
21376
+ ...state,
21377
+ cancelationOption: action.payload
21378
+ });
21361
21379
  default:
21362
21380
  return state;
21363
21381
  }
@@ -21457,8 +21475,7 @@ const SubscriptionCancelReason = props => {
21457
21475
  t
21458
21476
  } = useTranslation("subscriptionCancel");
21459
21477
  const {
21460
- dispatch,
21461
- state
21478
+ dispatch
21462
21479
  } = React.useContext(store$j);
21463
21480
  const handleOnTextAreaBlur = e => {
21464
21481
  dispatch({
@@ -21490,9 +21507,7 @@ function SvgSubscription(props) {
21490
21507
  }))))));
21491
21508
  }
21492
21509
 
21493
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21494
- const enableReactGA4$6 = (_window$6 = window) === null || _window$6 === void 0 ? void 0 : (_window$Pelcro$6 = _window$6.Pelcro) === null || _window$Pelcro$6 === void 0 ? void 0 : (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) === null || _window$Pelcro$uiSett$6 === void 0 ? void 0 : _window$Pelcro$uiSett$6.enableReactGA4;
21495
- const SubscriptionCancelNowButton = _ref => {
21510
+ const SubscriptionCancelButton = _ref => {
21496
21511
  let {
21497
21512
  subscription,
21498
21513
  onClick,
@@ -21503,14 +21518,16 @@ const SubscriptionCancelNowButton = _ref => {
21503
21518
  } = usePelcro();
21504
21519
  const {
21505
21520
  state: {
21506
- cancelationReason
21507
- },
21508
- dispatch
21521
+ cancelationReason,
21522
+ cancelationOption
21523
+ }
21509
21524
  } = React.useContext(store$j);
21510
21525
  const {
21511
21526
  t
21512
21527
  } = useTranslation("subscriptionCancel");
21513
21528
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21529
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21530
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
21514
21531
  window.Pelcro.subscription.cancel({
21515
21532
  auth_token: window.Pelcro.user.read().auth_token,
21516
21533
  subscription_id: payload.subscription_id,
@@ -21522,7 +21539,7 @@ const SubscriptionCancelNowButton = _ref => {
21522
21539
  if (err) {
21523
21540
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21524
21541
  }
21525
- if (enableReactGA4$6) {
21542
+ if (enableReactGA4) {
21526
21543
  ReactGA4.event("Canceled", {
21527
21544
  nonInteraction: true
21528
21545
  });
@@ -21537,10 +21554,10 @@ const SubscriptionCancelNowButton = _ref => {
21537
21554
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21538
21555
  });
21539
21556
  };
21540
- const handleCancelNowClick = () => {
21557
+ const handleCancelClick = () => {
21541
21558
  const payload = {
21542
21559
  subscription_id: subscription.id,
21543
- mode: "now",
21560
+ mode: cancelationOption,
21544
21561
  ...(cancelationReason && {
21545
21562
  reason: cancelationReason
21546
21563
  })
@@ -21554,7 +21571,7 @@ const SubscriptionCancelNowButton = _ref => {
21554
21571
  notify.confirm((onSuccess, onFailure) => {
21555
21572
  cancelSubscription(payload, onSuccess, onFailure);
21556
21573
  }, {
21557
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
21574
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
21558
21575
  loadingMessage: t("messages.subCancellation.loading"),
21559
21576
  successMessage: t("messages.subCancellation.success"),
21560
21577
  errorMessage: t("messages.subCancellation.error")
@@ -21563,96 +21580,88 @@ const SubscriptionCancelNowButton = _ref => {
21563
21580
  });
21564
21581
  };
21565
21582
  return /*#__PURE__*/React__default['default'].createElement(Button, {
21566
- onClick: handleCancelNowClick,
21567
- className: `${className}`
21568
- }, t("messages.cancelNow"));
21583
+ onClick: handleCancelClick,
21584
+ className: `${className}`,
21585
+ disabled: !cancelationOption
21586
+ }, t("labels.cancel"));
21569
21587
  };
21570
21588
 
21571
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21572
- const enableReactGA4$5 = (_window$5 = window) === null || _window$5 === void 0 ? void 0 : (_window$Pelcro$5 = _window$5.Pelcro) === null || _window$Pelcro$5 === void 0 ? void 0 : (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) === null || _window$Pelcro$uiSett$5 === void 0 ? void 0 : _window$Pelcro$uiSett$5.enableReactGA4;
21573
- const SubscriptionCancelLaterButton = _ref => {
21589
+ const SubscriptionCancelOptions = _ref => {
21590
+ var _subscription$schedul;
21574
21591
  let {
21575
21592
  subscription,
21593
+ hasPhases,
21576
21594
  onClick,
21577
21595
  className
21578
21596
  } = _ref;
21579
- const {
21580
- switchView
21581
- } = usePelcro();
21582
21597
  const {
21583
21598
  state: {
21584
- cancelationReason
21599
+ cancelationOption
21585
21600
  },
21586
21601
  dispatch
21587
21602
  } = React.useContext(store$j);
21588
21603
  const {
21589
21604
  t
21590
21605
  } = useTranslation("subscriptionCancel");
21591
- const cancelSubscription = (payload, onSuccess, onFailure) => {
21592
- window.Pelcro.subscription.cancel({
21593
- auth_token: window.Pelcro.user.read().auth_token,
21594
- subscription_id: payload.subscription_id,
21595
- mode: payload.mode,
21596
- ...(payload.reason && {
21597
- reason: payload.reason
21598
- })
21599
- }, (err, res) => {
21600
- if (err) {
21601
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21602
- }
21603
- if (enableReactGA4$5) {
21604
- ReactGA4.event("Canceled", {
21605
- nonInteraction: true
21606
- });
21607
- } else {
21608
- var _ReactGA$event;
21609
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21610
- category: "ACTIONS",
21611
- action: "Canceled",
21612
- nonInteraction: true
21613
- });
21614
- }
21615
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21616
- });
21617
- };
21618
- const handleCancelNowClick = () => {
21619
- const payload = {
21620
- subscription_id: subscription.id,
21621
- mode: "period_end",
21622
- ...(cancelationReason && {
21623
- reason: cancelationReason
21624
- })
21625
- };
21626
- onClick === null || onClick === void 0 ? void 0 : onClick();
21627
-
21628
- // Close the modal
21629
- switchView(null);
21630
-
21631
- // Show confirmation alert after closing the modal
21632
- notify.confirm((onSuccess, onFailure) => {
21633
- cancelSubscription(payload, onSuccess, onFailure);
21634
- }, {
21635
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
21636
- loadingMessage: t("messages.subCancellation.loading"),
21637
- successMessage: t("messages.subCancellation.success"),
21638
- errorMessage: t("messages.subCancellation.error")
21639
- }, {
21640
- closeButtonLabel: t("labels.subCancellation.goBack")
21606
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
21607
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21608
+ const handleOptionSelect = event => {
21609
+ dispatch({
21610
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
21611
+ payload: event.target.value
21641
21612
  });
21642
21613
  };
21643
- return /*#__PURE__*/React__default['default'].createElement(Button, {
21644
- onClick: handleCancelNowClick,
21645
- className: `${className}`
21646
- }, t("messages.cancelLater"));
21614
+ return /*#__PURE__*/React__default['default'].createElement("div", {
21615
+ className: "plc-text-left plc-mr-auto plc-mb-6"
21616
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
21617
+ className: "plc-mb-3"
21618
+ }, t("messages.cancelWhen")), hasPhases && /*#__PURE__*/React__default['default'].createElement(Radio, {
21619
+ onChange: handleOptionSelect,
21620
+ checked: cancelationOption === "period_end",
21621
+ value: "period_end"
21622
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21623
+ year: "numeric",
21624
+ month: "short",
21625
+ day: "numeric"
21626
+ })), /*#__PURE__*/React__default['default'].createElement(Radio, {
21627
+ onChange: handleOptionSelect,
21628
+ checked: cancelationOption === "current_period_end",
21629
+ value: "current_period_end"
21630
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
21631
+ year: "numeric",
21632
+ month: "short",
21633
+ day: "numeric"
21634
+ })), /*#__PURE__*/React__default['default'].createElement(Radio, {
21635
+ onChange: handleOptionSelect,
21636
+ checked: cancelationOption === "now",
21637
+ value: "now"
21638
+ }, t("labels.endImmediately")));
21647
21639
  };
21648
21640
 
21649
21641
  const SubscriptionCancelView = props => {
21642
+ var _subscriptionToCancel7, _subscriptionToCancel8;
21650
21643
  const {
21651
- subscriptionToCancel
21644
+ subscriptionToCancel,
21645
+ switchView
21652
21646
  } = usePelcro();
21653
21647
  const {
21654
21648
  t
21655
21649
  } = useTranslation("subscriptionCancel");
21650
+ const getPhases = () => {
21651
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
21652
+ if (!subscriptionToCancel.schedule) return [];
21653
+ 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;
21654
+ 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 => {
21655
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
21656
+ });
21657
+ 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 => {
21658
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
21659
+ });
21660
+ return [currentPhase, ...futurePhases];
21661
+ };
21662
+ const hasPhases = getPhases().length > 0;
21663
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
21664
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21656
21665
  return /*#__PURE__*/React__default['default'].createElement("div", {
21657
21666
  id: "pelcro-subscription-cancel-view"
21658
21667
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21661,22 +21670,35 @@ const SubscriptionCancelView = props => {
21661
21670
  className: "plc-text-2xl plc-font-semibold"
21662
21671
  }, t("labels.title"), /*#__PURE__*/React__default['default'].createElement("span", {
21663
21672
  className: "plc-text-gray-400 plc-text-base plc-block"
21664
- }, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
21673
+ }, "(", 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", {
21665
21674
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
21666
21675
  }, /*#__PURE__*/React__default['default'].createElement(SvgSubscription, {
21667
21676
  className: "plc-w-32 plc-h-32"
21668
21677
  }), /*#__PURE__*/React__default['default'].createElement("p", {
21669
- className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
21670
- }, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21678
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
21679
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21671
21680
  year: "numeric",
21672
21681
  month: "short",
21673
21682
  day: "numeric"
21674
- }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelNowButton, {
21675
- className: "plc-mb-2",
21676
- subscription: subscriptionToCancel
21677
- }), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelLaterButton, {
21683
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21684
+ year: "numeric",
21685
+ month: "short",
21686
+ day: "numeric"
21687
+ }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelOptions, {
21688
+ subscription: subscriptionToCancel,
21689
+ hasPhases: hasPhases
21690
+ }), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
21691
+ 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"
21692
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
21693
+ className: "plc-w-3/4 md:plc-w-2/5",
21678
21694
  subscription: subscriptionToCancel
21679
- }))));
21695
+ }), /*#__PURE__*/React__default['default'].createElement(Button, {
21696
+ variant: "outline",
21697
+ className: "plc-w-3/4 md:plc-w-2/5",
21698
+ onClick: () => {
21699
+ switchView("dashboard");
21700
+ }
21701
+ }, t("labels.subCancellation.goBack"))))));
21680
21702
  };
21681
21703
 
21682
21704
  const SubscriptionCancelModal = _ref => {
@@ -21816,9 +21838,8 @@ const SubscriptionSuspendDate = props => {
21816
21838
  }, props));
21817
21839
  };
21818
21840
 
21819
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21820
- const enableReactGA4$4 = (_window$4 = window) === null || _window$4 === void 0 ? void 0 : (_window$Pelcro$4 = _window$4.Pelcro) === null || _window$Pelcro$4 === void 0 ? void 0 : (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) === null || _window$Pelcro$uiSett$4 === void 0 ? void 0 : _window$Pelcro$uiSett$4.enableReactGA4;
21821
21841
  const SubscriptionSuspendButton = _ref => {
21842
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21822
21843
  let {
21823
21844
  subscription,
21824
21845
  onClick,
@@ -21837,6 +21858,7 @@ const SubscriptionSuspendButton = _ref => {
21837
21858
  const {
21838
21859
  t
21839
21860
  } = useTranslation("subscriptionSuspend");
21861
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
21840
21862
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21841
21863
  window.Pelcro.subscription.update({
21842
21864
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21847,7 +21869,7 @@ const SubscriptionSuspendButton = _ref => {
21847
21869
  if (err) {
21848
21870
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21849
21871
  }
21850
- if (enableReactGA4$4) {
21872
+ if (enableReactGA4) {
21851
21873
  ReactGA4.event("Suspended", {
21852
21874
  nonInteraction: true
21853
21875
  });
@@ -24571,8 +24593,6 @@ const AddressCreateLine2 = props => {
24571
24593
  }, props));
24572
24594
  };
24573
24595
 
24574
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
24575
- const enableReactGA4$3 = (_window$3 = window) === null || _window$3 === void 0 ? void 0 : (_window$Pelcro$3 = _window$3.Pelcro) === null || _window$Pelcro$3 === void 0 ? void 0 : (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) === null || _window$Pelcro$uiSett$3 === void 0 ? void 0 : _window$Pelcro$uiSett$3.enableReactGA4;
24576
24596
  const initialState$d = {
24577
24597
  isSubmitting: false,
24578
24598
  firstName: "",
@@ -24604,7 +24624,7 @@ const {
24604
24624
  Provider: Provider$d
24605
24625
  } = store$d;
24606
24626
  const AddressUpdateContainer = _ref => {
24607
- var _props$addressId;
24627
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24608
24628
  let {
24609
24629
  style,
24610
24630
  className = "",
@@ -24618,6 +24638,7 @@ const AddressUpdateContainer = _ref => {
24618
24638
  addressIdToEdit
24619
24639
  } = usePelcro();
24620
24640
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24641
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
24621
24642
  const [t] = useTranslation("address");
24622
24643
  React.useEffect(() => {
24623
24644
  const getCountries = () => {
@@ -24716,7 +24737,7 @@ const AddressUpdateContainer = _ref => {
24716
24737
  }
24717
24738
  });
24718
24739
  onSuccess(res);
24719
- if (enableReactGA4$3) {
24740
+ if (enableReactGA4) {
24720
24741
  ReactGA4.event("Updated address", {
24721
24742
  nonInteraction: true
24722
24743
  });
@@ -25251,13 +25272,13 @@ function PaymentMethodUpdateView(props) {
25251
25272
  }));
25252
25273
  }
25253
25274
 
25254
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25255
- const enableReactGA4$2 = (_window$2 = window) === null || _window$2 === void 0 ? void 0 : (_window$Pelcro$2 = _window$2.Pelcro) === null || _window$Pelcro$2 === void 0 ? void 0 : (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) === null || _window$Pelcro$uiSett$2 === void 0 ? void 0 : _window$Pelcro$uiSett$2.enableReactGA4;
25256
25275
  const PaymentMethodUpdateModal = props => {
25276
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25277
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
25257
25278
  const onSuccess = res => {
25258
25279
  var _props$onSuccess;
25259
25280
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25260
- if (enableReactGA4$2) {
25281
+ if (enableReactGA4) {
25261
25282
  ReactGA4.event("Updated payment card", {
25262
25283
  nonInteraction: true
25263
25284
  });
@@ -29145,8 +29166,6 @@ const OrderItems = _ref => {
29145
29166
  });
29146
29167
  };
29147
29168
 
29148
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
29149
- const enableReactGA4$1 = (_window$1 = window) === null || _window$1 === void 0 ? void 0 : (_window$Pelcro$1 = _window$1.Pelcro) === null || _window$Pelcro$1 === void 0 ? void 0 : (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) === null || _window$Pelcro$uiSett$1 === void 0 ? void 0 : _window$Pelcro$uiSett$1.enableReactGA4;
29150
29169
  const SavedItemsMenu = () => {
29151
29170
  const {
29152
29171
  t
@@ -29195,8 +29214,10 @@ const SavedItems = _ref3 => {
29195
29214
  isAuthenticated
29196
29215
  } = usePelcro();
29197
29216
  const removeItemFromMetadata = (category, title) => {
29217
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29198
29218
  const user = window.Pelcro.user.read();
29199
29219
  const oldValue = user.metadata[`metadata_saved_${category}`];
29220
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
29200
29221
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29201
29222
  if (isAuthenticated()) {
29202
29223
  setLoading(true);
@@ -29211,7 +29232,7 @@ const SavedItems = _ref3 => {
29211
29232
  return;
29212
29233
  }
29213
29234
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29214
- if (enableReactGA4$1) {
29235
+ if (enableReactGA4) {
29215
29236
  ReactGA4.event("Unsave/Unfollow", {
29216
29237
  event_label: title
29217
29238
  });
@@ -30175,8 +30196,6 @@ function getMemberShipStatus(status) {
30175
30196
  };
30176
30197
  }
30177
30198
 
30178
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
30179
- const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
30180
30199
  const SUB_MENUS = {
30181
30200
  PROFILE: "profile",
30182
30201
  SUBSCRIPTIONS: "subscriptions",
@@ -30231,7 +30250,7 @@ function DashboardWithHook(props) {
30231
30250
  DashboardWithHook.viewId = "dashboard";
30232
30251
  class Dashboard extends React.Component {
30233
30252
  constructor(props) {
30234
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30253
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30235
30254
  super(props);
30236
30255
  _defineProperty$3(this, "componentDidMount", () => {
30237
30256
  this.setState({
@@ -30240,7 +30259,7 @@ class Dashboard extends React.Component {
30240
30259
  window.Pelcro.insight.track("Modal Displayed", {
30241
30260
  name: "dashboard"
30242
30261
  });
30243
- if (enableReactGA4) {
30262
+ if (this.enableReactGA4) {
30244
30263
  ReactGA4.event("Dashboard Modal Viewed", {
30245
30264
  nonInteraction: true
30246
30265
  });
@@ -30282,7 +30301,7 @@ class Dashboard extends React.Component {
30282
30301
  if (err) {
30283
30302
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30284
30303
  }
30285
- if (enableReactGA4) {
30304
+ if (this.enableReactGA4) {
30286
30305
  ReactGA4.event("Canceled", {
30287
30306
  nonInteraction: true
30288
30307
  });
@@ -30306,7 +30325,7 @@ class Dashboard extends React.Component {
30306
30325
  if (err) {
30307
30326
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30308
30327
  }
30309
- if (enableReactGA4) {
30328
+ if (this.enableReactGA4) {
30310
30329
  ReactGA4.event("UnSuspended", {
30311
30330
  nonInteraction: true
30312
30331
  });
@@ -30602,6 +30621,7 @@ class Dashboard extends React.Component {
30602
30621
  this.locale = this.props.t;
30603
30622
  this.user = window.Pelcro.user.read();
30604
30623
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
30624
+ this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
30605
30625
  }
30606
30626
  render() {
30607
30627
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;