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

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
@@ -3452,7 +3452,7 @@ var labels$15 = {
3452
3452
  code: "Coupon code",
3453
3453
  "for": "for",
3454
3454
  interval: "{{count}} {{interval}}",
3455
- interval_plural: "{{count}} {{interval}}s",
3455
+ interval_plural: "{{count}} {{interval}}",
3456
3456
  tax: "Tax",
3457
3457
  removeCoupon: "REMOVE",
3458
3458
  firstName: "First name",
@@ -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: {
@@ -4374,7 +4378,7 @@ var labels$P = {
4374
4378
  code: "Code promo",
4375
4379
  "for": "pour",
4376
4380
  interval: "{{count}} {{interval}}",
4377
- interval_plural: "{{count}} {{interval}}s",
4381
+ interval_plural: "{{count}} {{interval}}",
4378
4382
  tax: "Taxe",
4379
4383
  removeCoupon: "RETIRER",
4380
4384
  firstName: "Prénom",
@@ -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: {
@@ -6321,7 +6333,7 @@ var labels$f = {
6321
6333
  code: "Código de cupón",
6322
6334
  "for": "por",
6323
6335
  interval: "{{count}} {{interval}}",
6324
- interval_plural: "{{count}} {{interval}}s",
6336
+ interval_plural: "{{count}} {{interval}}",
6325
6337
  tax: "Impuesto",
6326
6338
  removeCoupon: "ELIMINAR",
6327
6339
  firstName: "Nombre",
@@ -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
@@ -11836,21 +11848,33 @@ const initPaywalls = () => {
11836
11848
  return;
11837
11849
  }
11838
11850
  const {
11839
- switchView
11851
+ switchView,
11852
+ isAuthenticated
11840
11853
  } = usePelcro.getStore();
11841
- if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11842
- /*
11843
- showing both the meter and the entitlements notification doesn't make sense from
11844
- a product prespective + they would take half the screen on mobile devies, so we're
11845
- not showing the meter, and only showing the entitlements notification.
11846
- */
11847
- if (!didBlurContent) {
11848
- switchView("meter");
11854
+
11855
+ // eslint-disable-next-line no-inner-declarations
11856
+ function displayPaywalls() {
11857
+ if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11858
+ /*
11859
+ showing both the meter and the entitlements notification doesn't make sense from
11860
+ a product prespective + they would take half the screen on mobile devies, so we're
11861
+ not showing the meter, and only showing the entitlements notification.
11862
+ */
11863
+ if (!didBlurContent) {
11864
+ switchView("meter");
11865
+ }
11866
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11867
+ switchView("newsletter");
11868
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11869
+ switchView("plan-select");
11849
11870
  }
11850
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11851
- switchView("newsletter");
11852
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11853
- switchView("plan-select");
11871
+ }
11872
+ if ("id" in Pelcro.user.read() || !isAuthenticated()) {
11873
+ displayPaywalls();
11874
+ } else {
11875
+ addEventListener("PelcroUserLoaded", function () {
11876
+ displayPaywalls();
11877
+ }, true);
11854
11878
  }
11855
11879
  }
11856
11880
  };
@@ -11862,6 +11886,7 @@ const loadPaymentSDKs = () => {
11862
11886
  if (!window.Stripe && !supportsVantiv && !supportsTap) {
11863
11887
  pure_1(window.Pelcro.environment.stripe);
11864
11888
  }
11889
+ window.Pelcro.helpers.loadSDK("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js", "apple-pay-sdk");
11865
11890
 
11866
11891
  // Load PayPal SDKs
11867
11892
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
@@ -11875,6 +11900,11 @@ const loadPaymentSDKs = () => {
11875
11900
  if (!window.jQuery) {
11876
11901
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
11877
11902
  }
11903
+ window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
11904
+ const eProtectApi3PreLiveURL = "https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js";
11905
+ const eProtectApi3ProductionURL = "https://request.eprotect.vantivcnp.com/eProtect/eProtect-api3.js";
11906
+ const eProtectApi3scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? eProtectApi3ProductionURL : eProtectApi3PreLiveURL;
11907
+ window.Pelcro.helpers.loadSDK(eProtectApi3scriptUrlToUse, "vantiv-eprotect-api");
11878
11908
  if (!window.EprotectIframeClient) {
11879
11909
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
11880
11910
  const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
@@ -11907,8 +11937,10 @@ const initSecuritySdk = () => {
11907
11937
  });
11908
11938
  };
11909
11939
  const initGATracking = () => {
11940
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11941
+ 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
11942
  if (window.Pelcro.site.read().google_analytics_id) {
11911
- if (enableReactGA4$c) {
11943
+ if (enableReactGA4) {
11912
11944
  // Initialize ReactGA4 with your tracking ID
11913
11945
  ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11914
11946
  // Enable e-commerce tracking
@@ -11928,9 +11960,10 @@ const initGATracking = () => {
11928
11960
  }
11929
11961
  };
11930
11962
  const dispatchModalDisplayEvents = modalName => {
11931
- var _modalName$replace, _modalName$replace2;
11963
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11964
+ 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
11965
  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) {
11966
+ if (enableReactGA4) {
11934
11967
  ReactGA4.event(`${formattedAction} viewed`, {
11935
11968
  nonInteraction: true
11936
11969
  });
@@ -12743,6 +12776,7 @@ const LOADING = "LOADING";
12743
12776
  const SUBMIT_PAYMENT = "SUBMIT_PAYMENT";
12744
12777
  const SUBSCRIBE = "CREATE_SUBSCRIPTION";
12745
12778
  const HANDLE_PAYPAL_SUBSCRIPTION = "HANDLE_PAYPAL_SUBSCRIPTION";
12779
+ const HANDLE_APPLEPAY_SUBSCRIPTION = "HANDLE_APPLEPAY_SUBSCRIPTION";
12746
12780
  const DISABLE_COUPON_BUTTON = "DISABLE_COUPON_BUTTON";
12747
12781
  const APPLY_COUPON_CODE = "APPLY_COUPON_CODE";
12748
12782
  const REMOVE_APPLIED_COUPON = "REMOVE_APPLIED_COUPON";
@@ -12804,6 +12838,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12804
12838
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12805
12839
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12806
12840
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12841
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12807
12842
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12808
12843
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12809
12844
  const SET_EMAILS = "SET_EMAILS";
@@ -12816,8 +12851,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12816
12851
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12817
12852
  const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12818
12853
 
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
12854
  const initialState$m = {
12822
12855
  email: "",
12823
12856
  username: "",
@@ -12836,6 +12869,7 @@ const {
12836
12869
  Provider: Provider$m
12837
12870
  } = store$m;
12838
12871
  const LoginContainer = _ref => {
12872
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12839
12873
  let {
12840
12874
  style,
12841
12875
  className = "",
@@ -12843,6 +12877,7 @@ const LoginContainer = _ref => {
12843
12877
  onFailure = () => {},
12844
12878
  children
12845
12879
  } = _ref;
12880
+ 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
12881
  const handleLogin = (_ref2, dispatch) => {
12847
12882
  let {
12848
12883
  email,
@@ -12873,7 +12908,7 @@ const LoginContainer = _ref => {
12873
12908
  onFailure(err);
12874
12909
  } else {
12875
12910
  onSuccess(res);
12876
- if (enableReactGA4$b) {
12911
+ if (enableReactGA4) {
12877
12912
  ReactGA4.event("Logged in", {
12878
12913
  nonInteraction: true
12879
12914
  });
@@ -13270,12 +13305,12 @@ function ConfirmPassword(_ref) {
13270
13305
  }, otherProps));
13271
13306
  }
13272
13307
 
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
13308
  const Logout = props => {
13276
13309
  const handleLogout = () => {
13310
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13277
13311
  window.Pelcro.user.logout();
13278
- if (enableReactGA4$a) {
13312
+ 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;
13313
+ if (enableReactGA4) {
13279
13314
  ReactGA4.event("Logged out", {
13280
13315
  nonInteraction: true
13281
13316
  });
@@ -14844,13 +14879,11 @@ const RegisterCompany = props => {
14844
14879
  }, props));
14845
14880
  };
14846
14881
 
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
14882
  /**
14851
14883
  *
14852
14884
  */
14853
14885
  function RegisterModal(props) {
14886
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14854
14887
  const {
14855
14888
  t
14856
14889
  } = useTranslation("register");
@@ -14865,6 +14898,7 @@ function RegisterModal(props) {
14865
14898
  giftCode,
14866
14899
  isGift
14867
14900
  } = usePelcro();
14901
+ 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
14902
  const onSuccess = res => {
14869
14903
  var _props$onSuccess;
14870
14904
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -14872,7 +14906,7 @@ function RegisterModal(props) {
14872
14906
  };
14873
14907
  const handleAfterRegistrationLogic = () => {
14874
14908
  var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14875
- if (enableReactGA4$9) {
14909
+ if (enableReactGA4) {
14876
14910
  ReactGA4.event("Registered", {
14877
14911
  nonInteraction: true
14878
14912
  });
@@ -14970,9 +15004,6 @@ function Radio(_ref) {
14970
15004
  }, children));
14971
15005
  }
14972
15006
 
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
15007
  /**
14977
15008
  *
14978
15009
  */
@@ -15032,6 +15063,7 @@ function productMatchPageLanguage(product) {
15032
15063
  SelectModalWithHook.viewId = "plan-select";
15033
15064
  class SelectModal extends React.Component {
15034
15065
  constructor(props) {
15066
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
15035
15067
  super(props);
15036
15068
  _defineProperty$3(this, "componentDidMount", () => {
15037
15069
  if (this.props.product) {
@@ -15066,11 +15098,11 @@ class SelectModal extends React.Component {
15066
15098
  }
15067
15099
  document.addEventListener("keydown", this.handleSubmit);
15068
15100
  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 => {
15101
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15102
+ 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;
15103
+ 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;
15104
+ 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;
15105
+ 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
15106
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
15075
15107
  if (filteredPlans.length) return filteredPlans;
15076
15108
  });
@@ -15083,12 +15115,12 @@ class SelectModal extends React.Component {
15083
15115
  });
15084
15116
  notifyBugsnag(() => {
15085
15117
  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;
15118
+ 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
15119
  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,
15120
+ 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(),
15121
+ 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(),
15122
+ 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,
15123
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15092
15124
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15093
15125
  productListState: this.state.productList,
15094
15126
  methods: {
@@ -15099,8 +15131,8 @@ class SelectModal extends React.Component {
15099
15131
  userCurrency: userCurrency,
15100
15132
  userCountry: userCountry,
15101
15133
  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,
15134
+ 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(),
15135
+ 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
15136
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15105
15137
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15106
15138
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15139,7 +15171,7 @@ class SelectModal extends React.Component {
15139
15171
  startingPlan = plan;
15140
15172
  }
15141
15173
  }
15142
- return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval}s` : `${startingPlan.interval}`}`;
15174
+ return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
15143
15175
  });
15144
15176
  _defineProperty$3(this, "renderOneProduct", (product, index, options) => {
15145
15177
  const isPlanMode = Boolean(this.state.mode === "plan");
@@ -15312,6 +15344,7 @@ class SelectModal extends React.Component {
15312
15344
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15313
15345
  this.locale = this.props.t;
15314
15346
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15347
+ 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
15348
  }
15316
15349
  render() {
15317
15350
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15319,7 +15352,7 @@ class SelectModal extends React.Component {
15319
15352
  disableGifting
15320
15353
  } = this.props;
15321
15354
  if (this.state.mode === "product") {
15322
- if (enableReactGA4$8) {
15355
+ if (this.enableReactGA4) {
15323
15356
  ReactGA4.event("Product Modal Viewed", {
15324
15357
  nonInteraction: true
15325
15358
  });
@@ -15332,7 +15365,7 @@ class SelectModal extends React.Component {
15332
15365
  });
15333
15366
  }
15334
15367
  } else if (this.state.mode === "plan") {
15335
- if (enableReactGA4$8) {
15368
+ if (this.enableReactGA4) {
15336
15369
  ReactGA4.event("Plan Modal Viewed", {
15337
15370
  nonInteraction: true
15338
15371
  });
@@ -18118,7 +18151,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18118
18151
  });
18119
18152
  };
18120
18153
 
18121
- /*====== Start Cybersource integration ========*/
18154
+ /* ====== Start Cybersource integration ======== */
18122
18155
  const cybersourceErrorHandle = err => {
18123
18156
  var _err$details, _err$details$response, _err$details$response2;
18124
18157
  if ((err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : (_err$details$response2 = _err$details$response.details) === null || _err$details$response2 === void 0 ? void 0 : _err$details$response2.length) > 0) {
@@ -18183,7 +18216,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18183
18216
  } else if (type === "orderCreate") {
18184
18217
  purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18185
18218
  } else if (type === "invoicePayment") {
18186
- payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18219
+ payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18187
18220
  } else if (type === "updatePaymentSource") {
18188
18221
  createNewCybersourceCard();
18189
18222
  }
@@ -18387,9 +18420,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18387
18420
  });
18388
18421
  };
18389
18422
 
18390
- /*====== End Cybersource integration ========*/
18423
+ /* ====== End Cybersource integration ======== */
18391
18424
 
18392
- /*====== Start Tap integration ========*/
18425
+ /* ====== Start Tap integration ======== */
18393
18426
  const submitUsingTap = state => {
18394
18427
  var _ref4, _ref5, _getPlanAmount;
18395
18428
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18513,7 +18546,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18513
18546
  } else if (type === "orderCreate") {
18514
18547
  purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18515
18548
  } else if (type === "invoicePayment") {
18516
- payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18549
+ payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18517
18550
  } else if (type === "updatePaymentSource") {
18518
18551
  createNewTapCard();
18519
18552
  }
@@ -18661,28 +18694,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18661
18694
  cardHolder: "Card Holder Name"
18662
18695
  };
18663
18696
 
18664
- //payment options
18697
+ // payment options
18665
18698
  let paymentOptions = {
18666
18699
  labels: labels,
18667
18700
  TextDirection: "ltr"
18668
18701
  };
18669
18702
 
18670
- //create element, pass style and payment options
18703
+ // create element, pass style and payment options
18671
18704
  let card = elements.create("card", {
18672
18705
  style: style
18673
18706
  }, paymentOptions);
18674
18707
 
18675
- //mount element
18708
+ // mount element
18676
18709
  card.mount("#tapPaymentIframe");
18677
18710
 
18678
- //card change event listener
18711
+ // card change event listener
18679
18712
  card.addEventListener("change", function (event) {
18680
- //If needed
18713
+ // If needed
18681
18714
  });
18682
18715
  tapInstanceRef.current = tapKey;
18683
18716
  tapInstanceCard.current = card;
18684
18717
  };
18685
- /*====== End Tap integration ========*/
18718
+ /* ====== End Tap integration ======== */
18686
18719
 
18687
18720
  const submitUsingVantiv = state => {
18688
18721
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18724,7 +18757,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18724
18757
  } else if (type === "orderCreate") {
18725
18758
  purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18726
18759
  } else if (type === "invoicePayment") {
18727
- payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18760
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18728
18761
  } else if (type === "updatePaymentSource") {
18729
18762
  createNewVantivCard();
18730
18763
  }
@@ -18870,7 +18903,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18870
18903
  }
18871
18904
  }, [selectedPaymentMethodId]);
18872
18905
 
18873
- //Trigger the handleVantivPayment method when a vantivePaymentRequest is present
18906
+ // Trigger the handleVantivPayment method when a vantivPaymentRequest is present
18874
18907
  React.useEffect(() => {
18875
18908
  if (vantivPaymentRequest) {
18876
18909
  handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
@@ -19030,7 +19063,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19030
19063
  if (err) {
19031
19064
  onFailure(err);
19032
19065
 
19033
- //reset the coupon code in local state
19066
+ // reset the coupon code in local state
19034
19067
  setUpdatedCouponCode("");
19035
19068
  dispatch({
19036
19069
  type: SET_COUPON_ERROR,
@@ -19091,7 +19124,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19091
19124
  payload: res.data.coupon
19092
19125
  });
19093
19126
 
19094
- //set the coupon code in local state to be able to use with Vantiv
19127
+ // set the coupon code in local state to be able to use with Vantiv
19095
19128
  setUpdatedCouponCode(res.data.coupon.code);
19096
19129
  dispatch({
19097
19130
  type: SET_PERCENT_OFF,
@@ -19164,7 +19197,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19164
19197
  const removeAppliedCoupon = state => {
19165
19198
  state.couponCode = "";
19166
19199
 
19167
- //reset the coupon code in local state
19200
+ // reset the coupon code in local state
19168
19201
  setUpdatedCouponCode("");
19169
19202
  dispatch({
19170
19203
  type: SET_COUPON_ERROR,
@@ -19556,7 +19589,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19556
19589
  });
19557
19590
  });
19558
19591
  };
19559
- const payInvoice = (gatewayService, gatewayToken, dispatch) => {
19592
+ const payInvoice = function (gatewayService, gatewayToken, dispatch) {
19593
+ let cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
19560
19594
  const payment = new Payment(gatewayService);
19561
19595
  return payment.execute({
19562
19596
  type: PAYMENT_TYPES.PAY_INVOICE,
@@ -19564,7 +19598,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19564
19598
  isExistingSource: Boolean(selectedPaymentMethodId),
19565
19599
  invoiceId: invoice.id
19566
19600
  }, (err, res) => {
19567
- confirmStripeCardPayment(res, err);
19601
+ if (cb && typeof cb == "function") {
19602
+ cb(res, err);
19603
+ } else {
19604
+ dispatch({
19605
+ type: DISABLE_SUBMIT,
19606
+ payload: false
19607
+ });
19608
+ dispatch({
19609
+ type: LOADING,
19610
+ payload: false
19611
+ });
19612
+ if (err) {
19613
+ onFailure(err);
19614
+ return dispatch({
19615
+ type: SHOW_ALERT,
19616
+ payload: {
19617
+ type: "error",
19618
+ content: getErrorMessages(err)
19619
+ }
19620
+ });
19621
+ }
19622
+ onSuccess(res);
19623
+ }
19568
19624
  });
19569
19625
  };
19570
19626
  const updatePaymentSource = (state, dispatch) => {
@@ -19808,7 +19864,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19808
19864
  } else if (stripeSource && type === "orderCreate") {
19809
19865
  purchase(new StripeGateway(), stripeSource.id, state, dispatch);
19810
19866
  } else if (stripeSource && type === "invoicePayment") {
19811
- payInvoice(new StripeGateway(), stripeSource.id);
19867
+ payInvoice(new StripeGateway(), stripeSource.id, dispatch, confirmStripeCardPayment);
19812
19868
  }
19813
19869
  };
19814
19870
  const handlePaymentError = error => {
@@ -19980,11 +20036,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19980
20036
  case HANDLE_PAYPAL_SUBSCRIPTION:
19981
20037
  return lib_5(state, (state, dispatch) => {
19982
20038
  if (type === "invoicePayment") {
19983
- payInvoice(new PaypalGateway(), action.payload);
20039
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
19984
20040
  } else {
19985
20041
  handlePaypalSubscription(state, action.payload);
19986
20042
  }
19987
20043
  });
20044
+ case HANDLE_APPLEPAY_SUBSCRIPTION:
20045
+ return lib_5(state, (state, dispatch) => {
20046
+ setVantivPaymentRequest(action.payload);
20047
+ });
19988
20048
  case SET_UPDATED_PRICE:
19989
20049
  return lib_7({
19990
20050
  ...state,
@@ -21126,6 +21186,341 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
21126
21186
  store: store$k
21127
21187
  }, props));
21128
21188
 
21189
+ /**
21190
+ * ApplePayButton component
21191
+ * @return {JSX}
21192
+ */
21193
+ const ApplePayButton = _ref => {
21194
+ var _window$Pelcro$site$r;
21195
+ let {
21196
+ onClick,
21197
+ props,
21198
+ ...otherProps
21199
+ } = _ref;
21200
+ const {
21201
+ dispatch,
21202
+ state
21203
+ } = React.useContext(store$k);
21204
+ const {
21205
+ plan,
21206
+ invoice,
21207
+ order
21208
+ } = usePelcro();
21209
+ const {
21210
+ pay_page_id: payPageId,
21211
+ report_group: reportGroup,
21212
+ apple_pay_merchant_id: ApplePayMerchantId,
21213
+ apple_pay_enabled: ApplePayEnabled
21214
+ } = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
21215
+ const getOrderInfo = () => {
21216
+ if (!order) {
21217
+ return {
21218
+ price: null,
21219
+ currency: null,
21220
+ label: null
21221
+ };
21222
+ }
21223
+ const isQuickPurchase = !Array.isArray(order);
21224
+ if (isQuickPurchase) {
21225
+ return {
21226
+ price: order.price * order.quantity,
21227
+ currency: order.currency,
21228
+ label: order.name
21229
+ };
21230
+ }
21231
+ if (order.length === 0) {
21232
+ return {
21233
+ price: null,
21234
+ currency: null,
21235
+ label: null
21236
+ };
21237
+ }
21238
+ const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
21239
+ return {
21240
+ price,
21241
+ currency: order[0].currency,
21242
+ label: "Order"
21243
+ };
21244
+ };
21245
+ const orderPrice = getOrderInfo().price;
21246
+ const orderCurrency = getOrderInfo().currency;
21247
+ const orderLabel = getOrderInfo().label;
21248
+ React.useEffect(() => {
21249
+ if (window.ApplePaySession) {
21250
+ // Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
21251
+ // eslint-disable-next-line no-undef
21252
+ const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
21253
+ promise.then(function (canMakePayments) {
21254
+ if (canMakePayments && ApplePayEnabled) {
21255
+ // Display Apple Pay Buttons here…
21256
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21257
+ if (pelcroApplyPayButton) {
21258
+ pelcroApplyPayButton.style.display = "block";
21259
+ }
21260
+ console.log("canMakePayments", canMakePayments);
21261
+ }
21262
+ });
21263
+ } else {
21264
+ console.error("ApplePay is not available on this browser");
21265
+ }
21266
+ }, []);
21267
+ React.useEffect(() => {
21268
+ function onApplePayButtonClicked() {
21269
+ var _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan, _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$l;
21270
+ // eslint-disable-next-line no-undef
21271
+ if (!ApplePaySession) {
21272
+ return;
21273
+ }
21274
+ const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref5 !== void 0 ? _ref5 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref4 !== void 0 ? _ref4 : orderPrice) !== null && _ref3 !== void 0 ? _ref3 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref2 !== void 0 ? _ref2 : null;
21275
+ const getCurrencyCode = () => {
21276
+ if (plan) {
21277
+ return plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase();
21278
+ } else if (order) {
21279
+ return orderCurrency.toUpperCase();
21280
+ } else if (invoice) {
21281
+ return invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase();
21282
+ }
21283
+ };
21284
+ dispatch({
21285
+ type: DISABLE_SUBMIT,
21286
+ payload: true
21287
+ });
21288
+
21289
+ // Define ApplePayPaymentRequest
21290
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
21291
+ const ApplePayPaymentRequest = {
21292
+ countryCode: ((_window = window) === null || _window === void 0 ? void 0 : (_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$l = _window$Pelcro$user.location) === null || _window$Pelcro$user$l === void 0 ? void 0 : _window$Pelcro$user$l.countryCode) || "US",
21293
+ currencyCode: getCurrencyCode(),
21294
+ merchantCapabilities: ["supports3DS"],
21295
+ supportedNetworks: ["visa", "masterCard", "amex", "discover"],
21296
+ total: {
21297
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
21298
+ type: "final",
21299
+ amount: updatedPrice / 100
21300
+ }
21301
+ };
21302
+ console.log(ApplePayPaymentRequest);
21303
+ // Create ApplePaySession
21304
+ // @todo - Clarify supported version parameter
21305
+ // @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
21306
+ const session = new ApplePaySession(3, ApplePayPaymentRequest); // eslint-disable-line no-undef
21307
+
21308
+ // @todo - Detect whether web browser supports a particular Apple Pay version.
21309
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778014-supportsversion
21310
+
21311
+ session.onvalidatemerchant = async event => {
21312
+ const {
21313
+ validationURL
21314
+ } = event;
21315
+ console.log("then merchantSession step", event);
21316
+ // Call your own server to request a new merchant session.
21317
+ window.Pelcro.payment.startSession({
21318
+ auth_token: window.Pelcro.user.read().auth_token,
21319
+ site_id: window.Pelcro.siteid,
21320
+ validation_url: validationURL
21321
+ }, (err, res) => {
21322
+ if (err) {
21323
+ // Handle any errors during merchant validation
21324
+ console.error("Merchant validation SDK error: ", err);
21325
+ session.abort();
21326
+ return dispatch({
21327
+ type: SHOW_ALERT,
21328
+ payload: {
21329
+ type: "error",
21330
+ content: getErrorMessages(err)
21331
+ }
21332
+ });
21333
+ }
21334
+ // Complete merchant validation with the merchant session object
21335
+ console.log("Merchant validation SDK response: ", res);
21336
+ const merchantSession = res;
21337
+ session.completeMerchantValidation(merchantSession);
21338
+ });
21339
+ };
21340
+ session.onpaymentmethodselected = event => {
21341
+ console.log("payment method selected step", event);
21342
+ // Define ApplePayPaymentMethodUpdate based on the selected payment method.
21343
+ // No updates or errors are needed, pass an empty object.
21344
+ const newTotal = {
21345
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
21346
+ type: "final",
21347
+ amount: updatedPrice / 100
21348
+ };
21349
+ const newLineItems = [{
21350
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
21351
+ type: "final",
21352
+ amount: updatedPrice / 100
21353
+ }];
21354
+ session.completePaymentMethodSelection(newTotal, newLineItems);
21355
+ };
21356
+
21357
+ // TODO: Check if onshippingmethodselected it should be implemented
21358
+ // session.onshippingmethodselected = (event) => {
21359
+ // console.log("on shipping method selected step", event);
21360
+ // // Define ApplePayShippingMethodUpdate based on the selected shipping method.
21361
+ // // No updates or errors are needed, pass an empty object.
21362
+ // const newTotal = {
21363
+ // label: plan?.nickname || orderLabel || `invoice #${invoice?.id}`,
21364
+ // type: "final",
21365
+ // amount: updatedPrice / 100
21366
+ // };
21367
+
21368
+ // const newLineItems = [
21369
+ // {
21370
+ // label: plan?.nickname || orderLabel || `invoice #${invoice?.id}`,
21371
+ // type: "final",
21372
+ // amount: updatedPrice / 100
21373
+ // }
21374
+ // ];
21375
+
21376
+ // session.completeShippingMethodSelection(newTotal, newLineItems);
21377
+ // };
21378
+
21379
+ // TODO: Check if onshippingcontactselected it should be implemented
21380
+ // session.onshippingcontactselected = (event) => {
21381
+ // console.log("on shipping contact selected step", event);
21382
+ // // Define ApplePayShippingContactUpdate based on the selected shipping contact.
21383
+ // const update = {};
21384
+ // session.completeShippingContactSelection(update);
21385
+ // };
21386
+
21387
+ session.onpaymentauthorized = event => {
21388
+ console.log("on payment authorized step", event);
21389
+ // Define ApplePayPaymentAuthorizationResult
21390
+ const result = {
21391
+ status: ApplePaySession.STATUS_SUCCESS // eslint-disable-line no-undef
21392
+ };
21393
+
21394
+ const {
21395
+ paymentData
21396
+ } = event.payment.token;
21397
+ const {
21398
+ data,
21399
+ signature,
21400
+ version
21401
+ } = paymentData;
21402
+ const {
21403
+ ephemeralPublicKey,
21404
+ publicKeyHash,
21405
+ transactionId
21406
+ } = paymentData.header;
21407
+ const applePayToken = {
21408
+ data: data,
21409
+ signature: signature,
21410
+ version: version,
21411
+ header: {
21412
+ ephemeralPublicKey: ephemeralPublicKey,
21413
+ publicKeyHash: publicKeyHash,
21414
+ transactionId: transactionId
21415
+ }
21416
+ };
21417
+ console.log(applePayToken);
21418
+ const orderId = `pelcro-${new Date().getTime()}`;
21419
+ const eProtectRequest = {
21420
+ paypageId: payPageId,
21421
+ reportGroup: reportGroup,
21422
+ orderId: orderId,
21423
+ id: orderId,
21424
+ applepay: applePayToken,
21425
+ url: "https://request.eprotect.vantivprelive.com"
21426
+ };
21427
+
21428
+ // successCallback function to handle the response from WorldPay.
21429
+ function successCallback(vantivResponse) {
21430
+ const {
21431
+ expDate
21432
+ } = vantivResponse;
21433
+ console.log("Response:", vantivResponse);
21434
+ const expMonth = expDate.substring(0, 2);
21435
+ const expYear = expDate.substring(2);
21436
+ const vantivPaymentRequest = {
21437
+ ...vantivResponse,
21438
+ expMonth: expMonth,
21439
+ expYear: expYear,
21440
+ applePay: true
21441
+ };
21442
+
21443
+ // Process the registrationId or continue with further payment processing.
21444
+ dispatch({
21445
+ type: HANDLE_APPLEPAY_SUBSCRIPTION,
21446
+ payload: vantivPaymentRequest
21447
+ });
21448
+ dispatch({
21449
+ type: LOADING,
21450
+ payload: true
21451
+ });
21452
+ session.completePayment(result);
21453
+ }
21454
+
21455
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21456
+ function errorCallback(error) {
21457
+ console.error("Error retrieving Registration ID:", error);
21458
+ // Handle error appropriately.
21459
+ }
21460
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21461
+ function timeoutCallback() {
21462
+ console.error("eProtect Timeout");
21463
+ // Handle error appropriately.
21464
+ }
21465
+
21466
+ // eslint-disable-next-line no-undef
21467
+ new eProtect().sendToEprotect(eProtectRequest, {}, successCallback, errorCallback, timeoutCallback, 15000);
21468
+ };
21469
+
21470
+ // TODO: Check if oncouponcodechanged it should be implemented
21471
+ // session.oncouponcodechanged = (event) => {
21472
+ // console.log("on coupon code changed step", event);
21473
+ // // Define ApplePayCouponCodeUpdate
21474
+ // const newTotal = calculateNewTotal(event.couponCode);
21475
+ // const newLineItems = calculateNewLineItems(event.couponCode);
21476
+ // const newShippingMethods = calculateNewShippingMethods(
21477
+ // event.couponCode
21478
+ // );
21479
+ // const errors = calculateErrors(event.couponCode);
21480
+
21481
+ // session.completeCouponCodeChange({
21482
+ // newTotal: newTotal,
21483
+ // newLineItems: newLineItems,
21484
+ // newShippingMethods: newShippingMethods,
21485
+ // errors: errors
21486
+ // });
21487
+ // };
21488
+
21489
+ session.oncancel = event => {
21490
+ // Payment cancelled by WebKit
21491
+ console.log("on cancel step", event);
21492
+ dispatch({
21493
+ type: LOADING,
21494
+ payload: false
21495
+ });
21496
+ dispatch({
21497
+ type: DISABLE_SUBMIT,
21498
+ payload: false
21499
+ });
21500
+ };
21501
+ session.begin();
21502
+ }
21503
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21504
+ if (pelcroApplyPayButton) {
21505
+ pelcroApplyPayButton.addEventListener("click", onApplePayButtonClicked);
21506
+ }
21507
+ return () => {
21508
+ if (pelcroApplyPayButton) {
21509
+ pelcroApplyPayButton.removeEventListener("click", onApplePayButtonClicked);
21510
+ }
21511
+ };
21512
+ }, [state.updatedPrice]);
21513
+ return /*#__PURE__*/React__default['default'].createElement("apple-pay-button", {
21514
+ id: "pelcro-apple-pay-button",
21515
+ style: {
21516
+ display: "none"
21517
+ },
21518
+ buttonstyle: "black",
21519
+ type: "plain",
21520
+ locale: "en-US"
21521
+ });
21522
+ };
21523
+
21129
21524
  /**
21130
21525
  *
21131
21526
  */
@@ -21140,6 +21535,7 @@ function PaymentMethodView(_ref) {
21140
21535
  showExternalPaymentMethods,
21141
21536
  showSubscriptionButton,
21142
21537
  showOrderButton,
21538
+ showApplePayButton,
21143
21539
  order
21144
21540
  } = _ref;
21145
21541
  const {
@@ -21216,7 +21612,7 @@ function PaymentMethodView(_ref) {
21216
21612
  className: "plc-mb-2"
21217
21613
  }, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
21218
21614
  className: "plc-grid plc-mt-4 plc-gap-y-2"
21219
- }, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null)))));
21615
+ }, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ApplePayButton, null)) : null)))));
21220
21616
  }
21221
21617
 
21222
21618
  const SubscriptionRenewView = _ref => {
@@ -21238,11 +21634,11 @@ const SubscriptionRenewView = _ref => {
21238
21634
  const getPricingText = plan => {
21239
21635
  const autoRenewed = plan.auto_renew;
21240
21636
  const {
21241
- interval,
21637
+ interval_translated,
21242
21638
  interval_count
21243
21639
  } = plan;
21244
21640
  const intervalText = t("labels.interval", {
21245
- interval,
21641
+ interval: interval_translated,
21246
21642
  count: interval_count
21247
21643
  });
21248
21644
  return /*#__PURE__*/React__default['default'].createElement("p", {
@@ -21267,6 +21663,7 @@ const SubscriptionRenewView = _ref => {
21267
21663
  type: "createPayment",
21268
21664
  showCoupon: true,
21269
21665
  showExternalPaymentMethods: false,
21666
+ showApplePayButton: true,
21270
21667
  onSuccess: onSuccess,
21271
21668
  onGiftRenewalSuccess: onGiftRenewalSuccess,
21272
21669
  onFailure: onFailure,
@@ -21274,13 +21671,11 @@ const SubscriptionRenewView = _ref => {
21274
21671
  }));
21275
21672
  };
21276
21673
 
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
21674
  /**
21281
21675
  *
21282
21676
  */
21283
21677
  function SubscriptionRenewModal(_ref) {
21678
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21284
21679
  let {
21285
21680
  onDisplay,
21286
21681
  onClose,
@@ -21289,10 +21684,11 @@ function SubscriptionRenewModal(_ref) {
21289
21684
  const {
21290
21685
  switchView
21291
21686
  } = usePelcro();
21687
+ 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
21688
  const onSuccess = res => {
21293
21689
  var _otherProps$onSuccess;
21294
21690
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21295
- if (enableReactGA4$7) {
21691
+ if (enableReactGA4) {
21296
21692
  ReactGA4.event("Renewed", {
21297
21693
  nonInteraction: true
21298
21694
  });
@@ -21309,7 +21705,7 @@ function SubscriptionRenewModal(_ref) {
21309
21705
  const onGiftRenewalSuccess = () => {
21310
21706
  var _otherProps$onGiftRen;
21311
21707
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21312
- if (enableReactGA4$7) {
21708
+ if (enableReactGA4) {
21313
21709
  ReactGA4.event("Renewed Gift", {
21314
21710
  nonInteraction: true
21315
21711
  });
@@ -21335,7 +21731,8 @@ function SubscriptionRenewModal(_ref) {
21335
21731
  SubscriptionRenewModal.viewId = "subscription-renew";
21336
21732
 
21337
21733
  const initialState$j = {
21338
- cancelationReason: ""
21734
+ cancelationReason: "",
21735
+ cancelationOption: ""
21339
21736
  };
21340
21737
  const store$j = /*#__PURE__*/React.createContext(initialState$j);
21341
21738
  const {
@@ -21350,7 +21747,6 @@ const SubscriptionCancelContainer = _ref => {
21350
21747
  children,
21351
21748
  ...props
21352
21749
  } = _ref;
21353
- useTranslation("verifyEmail");
21354
21750
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
21355
21751
  switch (action.type) {
21356
21752
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -21358,6 +21754,11 @@ const SubscriptionCancelContainer = _ref => {
21358
21754
  ...state,
21359
21755
  cancelationReason: action.payload
21360
21756
  });
21757
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
21758
+ return lib_7({
21759
+ ...state,
21760
+ cancelationOption: action.payload
21761
+ });
21361
21762
  default:
21362
21763
  return state;
21363
21764
  }
@@ -21457,8 +21858,7 @@ const SubscriptionCancelReason = props => {
21457
21858
  t
21458
21859
  } = useTranslation("subscriptionCancel");
21459
21860
  const {
21460
- dispatch,
21461
- state
21861
+ dispatch
21462
21862
  } = React.useContext(store$j);
21463
21863
  const handleOnTextAreaBlur = e => {
21464
21864
  dispatch({
@@ -21490,9 +21890,7 @@ function SvgSubscription(props) {
21490
21890
  }))))));
21491
21891
  }
21492
21892
 
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 => {
21893
+ const SubscriptionCancelButton = _ref => {
21496
21894
  let {
21497
21895
  subscription,
21498
21896
  onClick,
@@ -21503,14 +21901,16 @@ const SubscriptionCancelNowButton = _ref => {
21503
21901
  } = usePelcro();
21504
21902
  const {
21505
21903
  state: {
21506
- cancelationReason
21507
- },
21508
- dispatch
21904
+ cancelationReason,
21905
+ cancelationOption
21906
+ }
21509
21907
  } = React.useContext(store$j);
21510
21908
  const {
21511
21909
  t
21512
21910
  } = useTranslation("subscriptionCancel");
21513
21911
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21912
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21913
+ 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
21914
  window.Pelcro.subscription.cancel({
21515
21915
  auth_token: window.Pelcro.user.read().auth_token,
21516
21916
  subscription_id: payload.subscription_id,
@@ -21522,7 +21922,7 @@ const SubscriptionCancelNowButton = _ref => {
21522
21922
  if (err) {
21523
21923
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21524
21924
  }
21525
- if (enableReactGA4$6) {
21925
+ if (enableReactGA4) {
21526
21926
  ReactGA4.event("Canceled", {
21527
21927
  nonInteraction: true
21528
21928
  });
@@ -21537,10 +21937,10 @@ const SubscriptionCancelNowButton = _ref => {
21537
21937
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21538
21938
  });
21539
21939
  };
21540
- const handleCancelNowClick = () => {
21940
+ const handleCancelClick = () => {
21541
21941
  const payload = {
21542
21942
  subscription_id: subscription.id,
21543
- mode: "now",
21943
+ mode: cancelationOption,
21544
21944
  ...(cancelationReason && {
21545
21945
  reason: cancelationReason
21546
21946
  })
@@ -21554,7 +21954,7 @@ const SubscriptionCancelNowButton = _ref => {
21554
21954
  notify.confirm((onSuccess, onFailure) => {
21555
21955
  cancelSubscription(payload, onSuccess, onFailure);
21556
21956
  }, {
21557
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
21957
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
21558
21958
  loadingMessage: t("messages.subCancellation.loading"),
21559
21959
  successMessage: t("messages.subCancellation.success"),
21560
21960
  errorMessage: t("messages.subCancellation.error")
@@ -21563,96 +21963,89 @@ const SubscriptionCancelNowButton = _ref => {
21563
21963
  });
21564
21964
  };
21565
21965
  return /*#__PURE__*/React__default['default'].createElement(Button, {
21566
- onClick: handleCancelNowClick,
21567
- className: `${className}`
21568
- }, t("messages.cancelNow"));
21966
+ onClick: handleCancelClick,
21967
+ className: `${className}`,
21968
+ disabled: !cancelationOption
21969
+ }, t("labels.cancel"));
21569
21970
  };
21570
21971
 
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 => {
21972
+ // New cancellation option modal
21973
+ const SubscriptionCancelOptions = _ref => {
21974
+ var _subscription$schedul;
21574
21975
  let {
21575
21976
  subscription,
21977
+ hasPhases,
21576
21978
  onClick,
21577
21979
  className
21578
21980
  } = _ref;
21579
- const {
21580
- switchView
21581
- } = usePelcro();
21582
21981
  const {
21583
21982
  state: {
21584
- cancelationReason
21983
+ cancelationOption
21585
21984
  },
21586
21985
  dispatch
21587
21986
  } = React.useContext(store$j);
21588
21987
  const {
21589
21988
  t
21590
21989
  } = 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")
21990
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
21991
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21992
+ const handleOptionSelect = event => {
21993
+ dispatch({
21994
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
21995
+ payload: event.target.value
21641
21996
  });
21642
21997
  };
21643
- return /*#__PURE__*/React__default['default'].createElement(Button, {
21644
- onClick: handleCancelNowClick,
21645
- className: `${className}`
21646
- }, t("messages.cancelLater"));
21998
+ return /*#__PURE__*/React__default['default'].createElement("div", {
21999
+ className: "plc-text-left plc-mr-auto plc-mb-6"
22000
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
22001
+ className: "plc-mb-3"
22002
+ }, t("messages.cancelWhen")), subscription.cancel_at_period_end === 0 && hasPhases && /*#__PURE__*/React__default['default'].createElement(Radio, {
22003
+ onChange: handleOptionSelect,
22004
+ checked: cancelationOption === "period_end",
22005
+ value: "period_end"
22006
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
22007
+ year: "numeric",
22008
+ month: "short",
22009
+ day: "numeric"
22010
+ })), subscription.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Radio, {
22011
+ onChange: handleOptionSelect,
22012
+ checked: cancelationOption === "current_period_end",
22013
+ value: "current_period_end"
22014
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
22015
+ year: "numeric",
22016
+ month: "short",
22017
+ day: "numeric"
22018
+ })), /*#__PURE__*/React__default['default'].createElement(Radio, {
22019
+ onChange: handleOptionSelect,
22020
+ checked: cancelationOption === "now",
22021
+ value: "now"
22022
+ }, t("labels.endImmediately")));
21647
22023
  };
21648
22024
 
21649
22025
  const SubscriptionCancelView = props => {
22026
+ var _subscriptionToCancel7, _subscriptionToCancel8;
21650
22027
  const {
21651
- subscriptionToCancel
22028
+ subscriptionToCancel,
22029
+ switchView
21652
22030
  } = usePelcro();
21653
22031
  const {
21654
22032
  t
21655
22033
  } = useTranslation("subscriptionCancel");
22034
+ const getPhases = () => {
22035
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
22036
+ if (!subscriptionToCancel.schedule) return [];
22037
+ 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;
22038
+ 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 => {
22039
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
22040
+ });
22041
+ 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 => {
22042
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
22043
+ });
22044
+ return [currentPhase, ...futurePhases];
22045
+ };
22046
+ const hasPhases = getPhases().length > 0;
22047
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
22048
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21656
22049
  return /*#__PURE__*/React__default['default'].createElement("div", {
21657
22050
  id: "pelcro-subscription-cancel-view"
21658
22051
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21661,22 +22054,35 @@ const SubscriptionCancelView = props => {
21661
22054
  className: "plc-text-2xl plc-font-semibold"
21662
22055
  }, t("labels.title"), /*#__PURE__*/React__default['default'].createElement("span", {
21663
22056
  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", {
22057
+ }, "(", 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
22058
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
21666
22059
  }, /*#__PURE__*/React__default['default'].createElement(SvgSubscription, {
21667
22060
  className: "plc-w-32 plc-h-32"
21668
22061
  }), /*#__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", {
22062
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
22063
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21671
22064
  year: "numeric",
21672
22065
  month: "short",
21673
22066
  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, {
22067
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
22068
+ year: "numeric",
22069
+ month: "short",
22070
+ day: "numeric"
22071
+ }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelOptions, {
22072
+ subscription: subscriptionToCancel,
22073
+ hasPhases: hasPhases
22074
+ }), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
22075
+ 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"
22076
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
22077
+ className: "plc-w-3/4 md:plc-w-2/5",
21678
22078
  subscription: subscriptionToCancel
21679
- }))));
22079
+ }), /*#__PURE__*/React__default['default'].createElement(Button, {
22080
+ variant: "outline",
22081
+ className: "plc-w-3/4 md:plc-w-2/5",
22082
+ onClick: () => {
22083
+ switchView("dashboard");
22084
+ }
22085
+ }, t("labels.subCancellation.goBack"))))));
21680
22086
  };
21681
22087
 
21682
22088
  const SubscriptionCancelModal = _ref => {
@@ -21816,9 +22222,8 @@ const SubscriptionSuspendDate = props => {
21816
22222
  }, props));
21817
22223
  };
21818
22224
 
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
22225
  const SubscriptionSuspendButton = _ref => {
22226
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21822
22227
  let {
21823
22228
  subscription,
21824
22229
  onClick,
@@ -21837,6 +22242,7 @@ const SubscriptionSuspendButton = _ref => {
21837
22242
  const {
21838
22243
  t
21839
22244
  } = useTranslation("subscriptionSuspend");
22245
+ 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
22246
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21841
22247
  window.Pelcro.subscription.update({
21842
22248
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21847,7 +22253,7 @@ const SubscriptionSuspendButton = _ref => {
21847
22253
  if (err) {
21848
22254
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21849
22255
  }
21850
- if (enableReactGA4$4) {
22256
+ if (enableReactGA4) {
21851
22257
  ReactGA4.event("Suspended", {
21852
22258
  nonInteraction: true
21853
22259
  });
@@ -22602,11 +23008,11 @@ const SubscriptionCreateView = _ref => {
22602
23008
  var _plan$quantity, _plan$quantity2, _plan$quantity3;
22603
23009
  const autoRenewed = plan.auto_renew;
22604
23010
  const {
22605
- interval,
23011
+ interval_translated,
22606
23012
  interval_count
22607
23013
  } = plan;
22608
23014
  const intervalText = t("labels.interval", {
22609
- interval,
23015
+ interval: interval_translated,
22610
23016
  count: interval_count
22611
23017
  });
22612
23018
  const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -22632,6 +23038,7 @@ const SubscriptionCreateView = _ref => {
22632
23038
  type: "createPayment",
22633
23039
  showCoupon: true,
22634
23040
  showExternalPaymentMethods: true,
23041
+ showApplePayButton: true,
22635
23042
  onSuccess: onSuccess,
22636
23043
  onFailure: onFailure,
22637
23044
  showSubscriptionButton: showSubscriptionButton
@@ -24571,8 +24978,6 @@ const AddressCreateLine2 = props => {
24571
24978
  }, props));
24572
24979
  };
24573
24980
 
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
24981
  const initialState$d = {
24577
24982
  isSubmitting: false,
24578
24983
  firstName: "",
@@ -24604,7 +25009,7 @@ const {
24604
25009
  Provider: Provider$d
24605
25010
  } = store$d;
24606
25011
  const AddressUpdateContainer = _ref => {
24607
- var _props$addressId;
25012
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24608
25013
  let {
24609
25014
  style,
24610
25015
  className = "",
@@ -24618,6 +25023,7 @@ const AddressUpdateContainer = _ref => {
24618
25023
  addressIdToEdit
24619
25024
  } = usePelcro();
24620
25025
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
25026
+ 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
25027
  const [t] = useTranslation("address");
24622
25028
  React.useEffect(() => {
24623
25029
  const getCountries = () => {
@@ -24716,7 +25122,7 @@ const AddressUpdateContainer = _ref => {
24716
25122
  }
24717
25123
  });
24718
25124
  onSuccess(res);
24719
- if (enableReactGA4$3) {
25125
+ if (enableReactGA4) {
24720
25126
  ReactGA4.event("Updated address", {
24721
25127
  nonInteraction: true
24722
25128
  });
@@ -25245,19 +25651,20 @@ function PaymentMethodUpdateView(props) {
25245
25651
  type: "updatePaymentSource",
25246
25652
  showCoupon: false,
25247
25653
  showExternalPaymentMethods: false,
25654
+ showApplePayButton: false,
25248
25655
  onDisplay: props.onDisplay,
25249
25656
  onFailure: props.onFailure,
25250
25657
  onSuccess: props.onSuccess
25251
25658
  }));
25252
25659
  }
25253
25660
 
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
25661
  const PaymentMethodUpdateModal = props => {
25662
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25663
+ 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
25664
  const onSuccess = res => {
25258
25665
  var _props$onSuccess;
25259
25666
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25260
- if (enableReactGA4$2) {
25667
+ if (enableReactGA4) {
25261
25668
  ReactGA4.event("Updated payment card", {
25262
25669
  nonInteraction: true
25263
25670
  });
@@ -26668,6 +27075,7 @@ const OrderCreateView = props => {
26668
27075
  type: "orderCreate",
26669
27076
  showCoupon: true,
26670
27077
  showExternalPaymentMethods: false,
27078
+ showApplePayButton: true,
26671
27079
  showOrderButton: showOrderButton,
26672
27080
  order: order
26673
27081
  }, props))));
@@ -29145,8 +29553,6 @@ const OrderItems = _ref => {
29145
29553
  });
29146
29554
  };
29147
29555
 
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
29556
  const SavedItemsMenu = () => {
29151
29557
  const {
29152
29558
  t
@@ -29195,8 +29601,10 @@ const SavedItems = _ref3 => {
29195
29601
  isAuthenticated
29196
29602
  } = usePelcro();
29197
29603
  const removeItemFromMetadata = (category, title) => {
29604
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29198
29605
  const user = window.Pelcro.user.read();
29199
29606
  const oldValue = user.metadata[`metadata_saved_${category}`];
29607
+ 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
29608
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29201
29609
  if (isAuthenticated()) {
29202
29610
  setLoading(true);
@@ -29211,7 +29619,7 @@ const SavedItems = _ref3 => {
29211
29619
  return;
29212
29620
  }
29213
29621
  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) {
29622
+ if (enableReactGA4) {
29215
29623
  ReactGA4.event("Unsave/Unfollow", {
29216
29624
  event_label: title
29217
29625
  });
@@ -30175,8 +30583,6 @@ function getMemberShipStatus(status) {
30175
30583
  };
30176
30584
  }
30177
30585
 
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
30586
  const SUB_MENUS = {
30181
30587
  PROFILE: "profile",
30182
30588
  SUBSCRIPTIONS: "subscriptions",
@@ -30231,7 +30637,7 @@ function DashboardWithHook(props) {
30231
30637
  DashboardWithHook.viewId = "dashboard";
30232
30638
  class Dashboard extends React.Component {
30233
30639
  constructor(props) {
30234
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30640
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30235
30641
  super(props);
30236
30642
  _defineProperty$3(this, "componentDidMount", () => {
30237
30643
  this.setState({
@@ -30240,7 +30646,7 @@ class Dashboard extends React.Component {
30240
30646
  window.Pelcro.insight.track("Modal Displayed", {
30241
30647
  name: "dashboard"
30242
30648
  });
30243
- if (enableReactGA4) {
30649
+ if (this.enableReactGA4) {
30244
30650
  ReactGA4.event("Dashboard Modal Viewed", {
30245
30651
  nonInteraction: true
30246
30652
  });
@@ -30282,7 +30688,7 @@ class Dashboard extends React.Component {
30282
30688
  if (err) {
30283
30689
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30284
30690
  }
30285
- if (enableReactGA4) {
30691
+ if (this.enableReactGA4) {
30286
30692
  ReactGA4.event("Canceled", {
30287
30693
  nonInteraction: true
30288
30694
  });
@@ -30306,7 +30712,7 @@ class Dashboard extends React.Component {
30306
30712
  if (err) {
30307
30713
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30308
30714
  }
30309
- if (enableReactGA4) {
30715
+ if (this.enableReactGA4) {
30310
30716
  ReactGA4.event("UnSuspended", {
30311
30717
  nonInteraction: true
30312
30718
  });
@@ -30602,6 +31008,7 @@ class Dashboard extends React.Component {
30602
31008
  this.locale = this.props.t;
30603
31009
  this.user = window.Pelcro.user.read();
30604
31010
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
31011
+ 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
31012
  }
30606
31013
  render() {
30607
31014
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
@@ -33015,7 +33422,8 @@ const InvoicePaymentView = props => {
33015
33422
  }, /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
33016
33423
  type: "invoicePayment",
33017
33424
  showCoupon: false,
33018
- showExternalPaymentMethods: true
33425
+ showExternalPaymentMethods: true,
33426
+ showApplePayButton: true
33019
33427
  }, props))));
33020
33428
  };
33021
33429
 
@@ -34677,6 +35085,7 @@ exports.AddressUpdateTextInput = AddressUpdateTextInput;
34677
35085
  exports.AddressUpdateView = AddressUpdateView;
34678
35086
  exports.Alert = AlertWithContext;
34679
35087
  exports.AlertElement = Alert;
35088
+ exports.ApplePayButton = ApplePayButton;
34680
35089
  exports.ApplyCouponButton = ApplyCouponButton;
34681
35090
  exports.Auth0LoginButton = Auth0LoginButton;
34682
35091
  exports.Badge = Badge;