@pelcro/react-pelcro-js 3.26.0-beta.1 → 3.26.0-beta.11

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: {
@@ -8411,7 +8427,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8411
8427
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8412
8428
  OutboundLink$1.trackLink = outboundLink;
8413
8429
  var OutboundLink = OutboundLink$1;
8414
- var ReactGA1 = _objectSpread({}, Defaults, {
8430
+ var ReactGA = _objectSpread({}, Defaults, {
8415
8431
  OutboundLink: OutboundLink
8416
8432
  });
8417
8433
 
@@ -8950,8 +8966,6 @@ exports["default"] = _default;
8950
8966
  var ReactGA4 = unwrapExports(dist);
8951
8967
  dist.ReactGAImplementation;
8952
8968
 
8953
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8954
- const ReactGA$d = (_window$d = window) !== null && _window$d !== void 0 && (_window$Pelcro$d = _window$d.Pelcro) !== null && _window$Pelcro$d !== void 0 && (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) !== null && _window$Pelcro$uiSett$d !== void 0 && _window$Pelcro$uiSett$d.enableReactGA4 ? ReactGA4 : ReactGA1;
8955
8969
  class PelcroActions {
8956
8970
  constructor(storeSetter, storeGetter) {
8957
8971
  var _this = this;
@@ -9131,23 +9145,31 @@ class PelcroActions {
9131
9145
  });
9132
9146
  });
9133
9147
  _defineProperty$3(this, "logout", function () {
9134
- var _ReactGA$event;
9148
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9135
9149
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9136
9150
  const {
9137
9151
  switchView,
9138
9152
  resetView,
9139
9153
  isAuthenticated
9140
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;
9141
9156
  // if user is not authenticated function execution is terminated
9142
9157
  if (!isAuthenticated()) {
9143
9158
  return console.warn("You are already logged out.");
9144
9159
  }
9145
9160
  window.Pelcro.user.logout();
9146
- ReactGA$d === null || ReactGA$d === void 0 ? void 0 : (_ReactGA$event = ReactGA$d.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$d, {
9147
- category: "ACTIONS",
9148
- action: "Logged out",
9149
- nonInteraction: true
9150
- });
9161
+ if (enableReactGA4) {
9162
+ ReactGA4.event("Logged out", {
9163
+ nonInteraction: true
9164
+ });
9165
+ } else {
9166
+ var _ReactGA$event;
9167
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9168
+ category: "ACTIONS",
9169
+ action: "Logged out",
9170
+ nonInteraction: true
9171
+ });
9172
+ }
9151
9173
  resetView();
9152
9174
  if (displayLogin) {
9153
9175
  switchView("login");
@@ -9160,7 +9182,7 @@ class PelcroActions {
9160
9182
  return false;
9161
9183
  }
9162
9184
 
9163
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9185
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9164
9186
  document.dispatchEvent(cartItemAdded(itemToAdd));
9165
9187
  const {
9166
9188
  cartItems
@@ -9372,9 +9394,6 @@ if (process.env.NODE_ENV === "development") {
9372
9394
  c$1("Pelcro Store", usePelcro);
9373
9395
  }
9374
9396
 
9375
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9376
- const ReactGA$c = (_window$c = window) !== null && _window$c !== void 0 && (_window$Pelcro$c = _window$c.Pelcro) !== null && _window$Pelcro$c !== void 0 && (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) !== null && _window$Pelcro$uiSett$c !== void 0 && _window$Pelcro$uiSett$c.enableReactGA4 ? ReactGA4 : ReactGA1;
9377
-
9378
9397
  /**
9379
9398
  * List of zero-decimal currencies.
9380
9399
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9460,8 +9479,8 @@ const getLanguageWithoutRegion = localeName => {
9460
9479
  * @return {string | undefined}
9461
9480
  */
9462
9481
  const getPageOrDefaultLanguage = () => {
9463
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9464
- 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);
9465
9484
  };
9466
9485
 
9467
9486
  /**
@@ -9514,9 +9533,9 @@ const isValidViewFromURL = viewID => {
9514
9533
  *
9515
9534
  */
9516
9535
  function hasValidNewsletterUpdateUrl() {
9517
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9536
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9518
9537
  if (viewID !== "newsletter-update") return false;
9519
- 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;
9520
9539
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9521
9540
  if (!siteHasNewslettersDefined) {
9522
9541
  return false;
@@ -9562,7 +9581,7 @@ const disableScroll = () => {
9562
9581
  }
9563
9582
  };
9564
9583
  const trackSubscriptionOnGA = () => {
9565
- var _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9584
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9566
9585
  const {
9567
9586
  product,
9568
9587
  plan,
@@ -9577,33 +9596,56 @@ const trackSubscriptionOnGA = () => {
9577
9596
  invoices
9578
9597
  } = window.Pelcro.user.read();
9579
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;
9580
9600
  if (!lastSubscriptionId) {
9581
9601
  return;
9582
9602
  }
9583
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;
9584
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$set = ReactGA$c.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA$c, {
9585
- currencyCode: currencyCode
9586
- });
9587
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$c.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9588
- id: lastSubscriptionId,
9589
- affiliation: "Pelcro",
9590
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9591
- coupon: couponCode
9592
- });
9593
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA$c.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9594
- id: lastSubscriptionId,
9595
- name: product.name,
9596
- category: product.description,
9597
- variant: plan.nickname,
9598
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9599
- quantity: 1
9600
- });
9601
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA$c.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9602
- ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$event = ReactGA$c.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$c, {
9603
- category: "ACTIONS",
9604
- action: "Subscribed",
9605
- nonInteraction: true
9606
- });
9604
+ if (enableReactGA4) {
9605
+ ReactGA4.event("purchase", {
9606
+ transaction_id: lastSubscriptionId,
9607
+ affiliation: "Pelcro",
9608
+ currency: currencyCode,
9609
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9610
+ coupon: couponCode,
9611
+ items: [{
9612
+ item_id: lastSubscriptionId,
9613
+ item_name: product.name,
9614
+ item_category: product.description,
9615
+ item_variant: plan.nickname,
9616
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9617
+ quantity: 1
9618
+ }]
9619
+ });
9620
+ ReactGA4.event("Subscribed", {
9621
+ nonInteraction: true
9622
+ });
9623
+ } else {
9624
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9625
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9626
+ currencyCode: currencyCode
9627
+ });
9628
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
9629
+ id: lastSubscriptionId,
9630
+ affiliation: "Pelcro",
9631
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9632
+ coupon: couponCode
9633
+ });
9634
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
9635
+ id: lastSubscriptionId,
9636
+ name: product.name,
9637
+ category: product.description,
9638
+ variant: plan.nickname,
9639
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9640
+ quantity: 1
9641
+ });
9642
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
9643
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9644
+ category: "ACTIONS",
9645
+ action: "Subscribed",
9646
+ nonInteraction: true
9647
+ });
9648
+ }
9607
9649
  };
9608
9650
 
9609
9651
  /** check wether or not the user have any existing payment method
@@ -9687,14 +9729,14 @@ function getDateWithoutTime(dateObject) {
9687
9729
  return date;
9688
9730
  }
9689
9731
  function userMustVerifyEmail() {
9690
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9691
- 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;
9692
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;
9693
9735
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9694
9736
  }
9695
9737
  function notifyBugsnag(callback, startOptions) {
9696
9738
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9697
- //load bugsnag CDN
9739
+ // load bugsnag CDN
9698
9740
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9699
9741
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9700
9742
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10057,10 +10099,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10057
10099
  return descriptor.value;
10058
10100
  }
10059
10101
 
10060
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
10061
10102
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10062
10103
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10063
- const ReactGA$b = (_window$b = window) !== null && _window$b !== void 0 && (_window$Pelcro$b = _window$b.Pelcro) !== null && _window$Pelcro$b !== void 0 && (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) !== null && _window$Pelcro$uiSett$b !== void 0 && _window$Pelcro$uiSett$b.enableReactGA4 ? ReactGA4 : ReactGA1;
10064
10104
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10065
10105
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10066
10106
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10144,7 +10184,7 @@ class SaveToMetadataButtonClass {
10144
10184
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10145
10185
  writable: true,
10146
10186
  value: event => {
10147
- var _user$metadata;
10187
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10148
10188
  const button = event.currentTarget;
10149
10189
  const user = window.Pelcro.user.read();
10150
10190
  const {
@@ -10154,6 +10194,7 @@ class SaveToMetadataButtonClass {
10154
10194
  key,
10155
10195
  ...buttonMetadata
10156
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;
10157
10198
  if (userMustVerifyEmail()) {
10158
10199
  return switchView("email-verify");
10159
10200
  }
@@ -10178,16 +10219,22 @@ class SaveToMetadataButtonClass {
10178
10219
  value: newMetadataValue,
10179
10220
  auth_token: window.Pelcro.user.read().auth_token
10180
10221
  }, (err, resp) => {
10181
- var _ReactGA$event;
10182
10222
  if (err) {
10183
10223
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10184
10224
  }
10185
10225
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10186
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event = ReactGA$b.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$b, {
10187
- category: "ACTIONS",
10188
- action: "Save/Follow",
10189
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10190
- });
10226
+ if (enableReactGA4) {
10227
+ ReactGA4.event("Save/Follow", {
10228
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10229
+ });
10230
+ } else {
10231
+ var _ReactGA$event;
10232
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10233
+ category: "ACTIONS",
10234
+ action: "Save/Follow",
10235
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10236
+ });
10237
+ }
10191
10238
  });
10192
10239
  }
10193
10240
  }
@@ -10195,6 +10242,7 @@ class SaveToMetadataButtonClass {
10195
10242
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10196
10243
  writable: true,
10197
10244
  value: event => {
10245
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10198
10246
  const button = event.currentTarget;
10199
10247
  const user = window.Pelcro.user.read();
10200
10248
  const {
@@ -10202,6 +10250,7 @@ class SaveToMetadataButtonClass {
10202
10250
  title
10203
10251
  } = button.dataset;
10204
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;
10205
10254
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10206
10255
  if (window.Pelcro.user.isAuthenticated()) {
10207
10256
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10210,16 +10259,22 @@ class SaveToMetadataButtonClass {
10210
10259
  value: newMetadataValue,
10211
10260
  auth_token: window.Pelcro.user.read().auth_token
10212
10261
  }, (err, resp) => {
10213
- var _ReactGA$event2;
10214
10262
  if (err) {
10215
10263
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10216
10264
  }
10217
10265
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10218
- ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$b.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$b, {
10219
- category: "ACTIONS",
10220
- action: "Unsave/Unfollow",
10221
- label: title
10222
- });
10266
+ if (enableReactGA4) {
10267
+ ReactGA4.event("Unsave/Unfollow", {
10268
+ event_label: title
10269
+ });
10270
+ } else {
10271
+ var _ReactGA$event2;
10272
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10273
+ category: "ACTIONS",
10274
+ action: "Unsave/Unfollow",
10275
+ label: title
10276
+ });
10277
+ }
10223
10278
  });
10224
10279
  }
10225
10280
  }
@@ -11742,9 +11797,6 @@ function getSiteCardProcessor() {
11742
11797
  return "stripe";
11743
11798
  }
11744
11799
 
11745
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11746
- const ReactGA$a = (_window$a = window) !== null && _window$a !== void 0 && (_window$Pelcro$a = _window$a.Pelcro) !== null && _window$Pelcro$a !== void 0 && (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) !== null && _window$Pelcro$uiSett$a !== void 0 && _window$Pelcro$uiSett$a.enableReactGA4 ? ReactGA4 : ReactGA1;
11747
-
11748
11800
  /**
11749
11801
  * @typedef {Object} OptionsType
11750
11802
  * @property {boolean} loadPaymentSDKs
@@ -11796,21 +11848,31 @@ const initPaywalls = () => {
11796
11848
  return;
11797
11849
  }
11798
11850
  const {
11799
- switchView
11851
+ switchView,
11852
+ isAuthenticated
11800
11853
  } = usePelcro.getStore();
11801
- if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11802
- /*
11803
- showing both the meter and the entitlements notification doesn't make sense from
11804
- a product prespective + they would take half the screen on mobile devies, so we're
11805
- not showing the meter, and only showing the entitlements notification.
11806
- */
11807
- if (!didBlurContent) {
11808
- switchView("meter");
11854
+ function displayPaywalls() {
11855
+ if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11856
+ /*
11857
+ showing both the meter and the entitlements notification doesn't make sense from
11858
+ a product prespective + they would take half the screen on mobile devies, so we're
11859
+ not showing the meter, and only showing the entitlements notification.
11860
+ */
11861
+ if (!didBlurContent) {
11862
+ switchView("meter");
11863
+ }
11864
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11865
+ switchView("newsletter");
11866
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11867
+ switchView("plan-select");
11809
11868
  }
11810
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11811
- switchView("newsletter");
11812
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11813
- switchView("plan-select");
11869
+ }
11870
+ if (isAuthenticated()) {
11871
+ addEventListener("PelcroUserLoaded", function () {
11872
+ displayPaywalls();
11873
+ });
11874
+ } else {
11875
+ displayPaywalls();
11814
11876
  }
11815
11877
  }
11816
11878
  };
@@ -11822,6 +11884,7 @@ const loadPaymentSDKs = () => {
11822
11884
  if (!window.Stripe && !supportsVantiv && !supportsTap) {
11823
11885
  pure_1(window.Pelcro.environment.stripe);
11824
11886
  }
11887
+ window.Pelcro.helpers.loadSDK("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js", "apple-pay-sdk");
11825
11888
 
11826
11889
  // Load PayPal SDKs
11827
11890
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
@@ -11835,6 +11898,8 @@ const loadPaymentSDKs = () => {
11835
11898
  if (!window.jQuery) {
11836
11899
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
11837
11900
  }
11901
+ window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
11902
+ window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js", "vantiv-eprotect-api");
11838
11903
  if (!window.EprotectIframeClient) {
11839
11904
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
11840
11905
  const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
@@ -11867,17 +11932,44 @@ const initSecuritySdk = () => {
11867
11932
  });
11868
11933
  };
11869
11934
  const initGATracking = () => {
11870
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11871
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$initialize = ReactGA$a.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA$a, window.Pelcro.site.read().google_analytics_id);
11872
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$a.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11935
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11936
+ 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;
11937
+ if (window.Pelcro.site.read().google_analytics_id) {
11938
+ if (enableReactGA4) {
11939
+ // Initialize ReactGA4 with your tracking ID
11940
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11941
+ // Enable e-commerce tracking
11942
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11943
+ gaOptions: {
11944
+ send_page_view: true,
11945
+ ecommerce: {
11946
+ enabled: true
11947
+ }
11948
+ }
11949
+ });
11950
+ } else {
11951
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11952
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
11953
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
11954
+ }
11955
+ }
11873
11956
  };
11874
11957
  const dispatchModalDisplayEvents = modalName => {
11875
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11876
- ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$event = ReactGA$a.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$a, {
11877
- category: "VIEWS",
11878
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11879
- nonInteraction: true
11880
- });
11958
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11959
+ 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;
11960
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11961
+ if (enableReactGA4) {
11962
+ ReactGA4.event(`${formattedAction} viewed`, {
11963
+ nonInteraction: true
11964
+ });
11965
+ } else {
11966
+ var _ReactGA$event;
11967
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11968
+ category: "VIEWS",
11969
+ action: `${formattedAction} viewed`,
11970
+ nonInteraction: true
11971
+ });
11972
+ }
11881
11973
  window.Pelcro.insight.track("Modal Displayed", {
11882
11974
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11883
11975
  });
@@ -12679,6 +12771,7 @@ const LOADING = "LOADING";
12679
12771
  const SUBMIT_PAYMENT = "SUBMIT_PAYMENT";
12680
12772
  const SUBSCRIBE = "CREATE_SUBSCRIPTION";
12681
12773
  const HANDLE_PAYPAL_SUBSCRIPTION = "HANDLE_PAYPAL_SUBSCRIPTION";
12774
+ const HANDLE_APPLEPAY_SUBSCRIPTION = "HANDLE_APPLEPAY_SUBSCRIPTION";
12682
12775
  const DISABLE_COUPON_BUTTON = "DISABLE_COUPON_BUTTON";
12683
12776
  const APPLY_COUPON_CODE = "APPLY_COUPON_CODE";
12684
12777
  const REMOVE_APPLIED_COUPON = "REMOVE_APPLIED_COUPON";
@@ -12740,6 +12833,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12740
12833
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12741
12834
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12742
12835
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12836
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12743
12837
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12744
12838
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12745
12839
  const SET_EMAILS = "SET_EMAILS";
@@ -12770,6 +12864,7 @@ const {
12770
12864
  Provider: Provider$m
12771
12865
  } = store$m;
12772
12866
  const LoginContainer = _ref => {
12867
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12773
12868
  let {
12774
12869
  style,
12775
12870
  className = "",
@@ -12777,6 +12872,7 @@ const LoginContainer = _ref => {
12777
12872
  onFailure = () => {},
12778
12873
  children
12779
12874
  } = _ref;
12875
+ 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;
12780
12876
  const handleLogin = (_ref2, dispatch) => {
12781
12877
  let {
12782
12878
  email,
@@ -12806,13 +12902,19 @@ const LoginContainer = _ref => {
12806
12902
  });
12807
12903
  onFailure(err);
12808
12904
  } else {
12809
- var _ReactGA$event;
12810
12905
  onSuccess(res);
12811
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12812
- category: "ACTIONS",
12813
- action: "Logged in",
12814
- nonInteraction: true
12815
- });
12906
+ if (enableReactGA4) {
12907
+ ReactGA4.event("Logged in", {
12908
+ nonInteraction: true
12909
+ });
12910
+ } else {
12911
+ var _ReactGA$event;
12912
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12913
+ category: "ACTIONS",
12914
+ action: "Logged in",
12915
+ nonInteraction: true
12916
+ });
12917
+ }
12816
12918
  }
12817
12919
  });
12818
12920
  };
@@ -13198,17 +13300,23 @@ function ConfirmPassword(_ref) {
13198
13300
  }, otherProps));
13199
13301
  }
13200
13302
 
13201
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
13202
- const ReactGA$9 = (_window$9 = window) !== null && _window$9 !== void 0 && (_window$Pelcro$9 = _window$9.Pelcro) !== null && _window$Pelcro$9 !== void 0 && (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) !== null && _window$Pelcro$uiSett$9 !== void 0 && _window$Pelcro$uiSett$9.enableReactGA4 ? ReactGA4 : ReactGA1;
13203
13303
  const Logout = props => {
13204
13304
  const handleLogout = () => {
13205
- var _ReactGA$event;
13305
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13206
13306
  window.Pelcro.user.logout();
13207
- ReactGA$9 === null || ReactGA$9 === void 0 ? void 0 : (_ReactGA$event = ReactGA$9.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$9, {
13208
- category: "ACTIONS",
13209
- action: "Logged out",
13210
- nonInteraction: true
13211
- });
13307
+ 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;
13308
+ if (enableReactGA4) {
13309
+ ReactGA4.event("Logged out", {
13310
+ nonInteraction: true
13311
+ });
13312
+ } else {
13313
+ var _ReactGA$event;
13314
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13315
+ category: "ACTIONS",
13316
+ action: "Logged out",
13317
+ nonInteraction: true
13318
+ });
13319
+ }
13212
13320
  };
13213
13321
  return /*#__PURE__*/React__default['default'].createElement("button", {
13214
13322
  name: "logout",
@@ -14766,13 +14874,11 @@ const RegisterCompany = props => {
14766
14874
  }, props));
14767
14875
  };
14768
14876
 
14769
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14770
- const ReactGA$8 = (_window$8 = window) !== null && _window$8 !== void 0 && (_window$Pelcro$8 = _window$8.Pelcro) !== null && _window$Pelcro$8 !== void 0 && (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) !== null && _window$Pelcro$uiSett$8 !== void 0 && _window$Pelcro$uiSett$8.enableReactGA4 ? ReactGA4 : ReactGA1;
14771
-
14772
14877
  /**
14773
14878
  *
14774
14879
  */
14775
14880
  function RegisterModal(props) {
14881
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14776
14882
  const {
14777
14883
  t
14778
14884
  } = useTranslation("register");
@@ -14787,18 +14893,26 @@ function RegisterModal(props) {
14787
14893
  giftCode,
14788
14894
  isGift
14789
14895
  } = usePelcro();
14896
+ 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;
14790
14897
  const onSuccess = res => {
14791
14898
  var _props$onSuccess;
14792
14899
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
14793
14900
  handleAfterRegistrationLogic();
14794
14901
  };
14795
14902
  const handleAfterRegistrationLogic = () => {
14796
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14797
- ReactGA$8 === null || ReactGA$8 === void 0 ? void 0 : (_ReactGA$event = ReactGA$8.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$8, {
14798
- category: "ACTIONS",
14799
- action: "Registered",
14800
- nonInteraction: true
14801
- });
14903
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14904
+ if (enableReactGA4) {
14905
+ ReactGA4.event("Registered", {
14906
+ nonInteraction: true
14907
+ });
14908
+ } else {
14909
+ var _ReactGA$event;
14910
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14911
+ category: "ACTIONS",
14912
+ action: "Registered",
14913
+ nonInteraction: true
14914
+ });
14915
+ }
14802
14916
  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;
14803
14917
  if (isEmailVerificationEnabled) {
14804
14918
  return switchView("email-verify");
@@ -14885,9 +14999,6 @@ function Radio(_ref) {
14885
14999
  }, children));
14886
15000
  }
14887
15001
 
14888
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14889
- const ReactGA$7 = (_window$7 = window) !== null && _window$7 !== void 0 && (_window$Pelcro$7 = _window$7.Pelcro) !== null && _window$Pelcro$7 !== void 0 && (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) !== null && _window$Pelcro$uiSett$7 !== void 0 && _window$Pelcro$uiSett$7.enableReactGA4 ? ReactGA4 : ReactGA1;
14890
-
14891
15002
  /**
14892
15003
  *
14893
15004
  */
@@ -14947,6 +15058,7 @@ function productMatchPageLanguage(product) {
14947
15058
  SelectModalWithHook.viewId = "plan-select";
14948
15059
  class SelectModal extends React.Component {
14949
15060
  constructor(props) {
15061
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
14950
15062
  super(props);
14951
15063
  _defineProperty$3(this, "componentDidMount", () => {
14952
15064
  if (this.props.product) {
@@ -14981,11 +15093,11 @@ class SelectModal extends React.Component {
14981
15093
  }
14982
15094
  document.addEventListener("keydown", this.handleSubmit);
14983
15095
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
14984
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
14985
- 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;
14986
- 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;
14987
- 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;
14988
- 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 => {
15096
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15097
+ 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;
15098
+ 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;
15099
+ 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;
15100
+ 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 => {
14989
15101
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14990
15102
  if (filteredPlans.length) return filteredPlans;
14991
15103
  });
@@ -14998,12 +15110,12 @@ class SelectModal extends React.Component {
14998
15110
  });
14999
15111
  notifyBugsnag(() => {
15000
15112
  Bugsnag.notify("SelectModal - No data viewed", event => {
15001
- 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;
15113
+ 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;
15002
15114
  event.addMetadata("MetaData", {
15003
- 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(),
15004
- 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(),
15005
- 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,
15006
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
15115
+ 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(),
15116
+ 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(),
15117
+ 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,
15118
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
15007
15119
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
15008
15120
  productListState: this.state.productList,
15009
15121
  methods: {
@@ -15014,8 +15126,8 @@ class SelectModal extends React.Component {
15014
15126
  userCurrency: userCurrency,
15015
15127
  userCountry: userCountry,
15016
15128
  userLanguage: userLanguage,
15017
- 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(),
15018
- 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,
15129
+ 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(),
15130
+ 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,
15019
15131
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
15020
15132
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
15021
15133
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15054,7 +15166,7 @@ class SelectModal extends React.Component {
15054
15166
  startingPlan = plan;
15055
15167
  }
15056
15168
  }
15057
- return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval}s` : `${startingPlan.interval}`}`;
15169
+ return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
15058
15170
  });
15059
15171
  _defineProperty$3(this, "renderOneProduct", (product, index, options) => {
15060
15172
  const isPlanMode = Boolean(this.state.mode === "plan");
@@ -15227,6 +15339,7 @@ class SelectModal extends React.Component {
15227
15339
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15228
15340
  this.locale = this.props.t;
15229
15341
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15342
+ 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;
15230
15343
  }
15231
15344
  render() {
15232
15345
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15234,19 +15347,31 @@ class SelectModal extends React.Component {
15234
15347
  disableGifting
15235
15348
  } = this.props;
15236
15349
  if (this.state.mode === "product") {
15237
- var _ReactGA$event;
15238
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event = ReactGA$7.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$7, {
15239
- category: "VIEWS",
15240
- action: "Product Modal Viewed",
15241
- nonInteraction: true
15242
- });
15350
+ if (this.enableReactGA4) {
15351
+ ReactGA4.event("Product Modal Viewed", {
15352
+ nonInteraction: true
15353
+ });
15354
+ } else {
15355
+ var _ReactGA$event;
15356
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15357
+ category: "VIEWS",
15358
+ action: "Product Modal Viewed",
15359
+ nonInteraction: true
15360
+ });
15361
+ }
15243
15362
  } else if (this.state.mode === "plan") {
15244
- var _ReactGA$event2;
15245
- ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$7.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$7, {
15246
- category: "VIEWS",
15247
- action: "Plan Modal Viewed",
15248
- nonInteraction: true
15249
- });
15363
+ if (this.enableReactGA4) {
15364
+ ReactGA4.event("Plan Modal Viewed", {
15365
+ nonInteraction: true
15366
+ });
15367
+ } else {
15368
+ var _ReactGA$event2;
15369
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15370
+ category: "VIEWS",
15371
+ action: "Plan Modal Viewed",
15372
+ nonInteraction: true
15373
+ });
15374
+ }
15250
15375
  }
15251
15376
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
15252
15377
  hideCloseButton: !this.closeButton,
@@ -15677,14 +15802,14 @@ class DonationModal extends React.Component {
15677
15802
  this.props;
15678
15803
  if (this.state.mode === "product") {
15679
15804
  var _ReactGA$event;
15680
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
15805
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15681
15806
  category: "VIEWS",
15682
15807
  action: "Product Modal Viewed",
15683
15808
  nonInteraction: true
15684
15809
  });
15685
15810
  } else if (this.state.mode === "plan") {
15686
15811
  var _ReactGA$event2;
15687
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA1.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA1, {
15812
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15688
15813
  category: "VIEWS",
15689
15814
  action: "Plan Modal Viewed",
15690
15815
  nonInteraction: true
@@ -18021,7 +18146,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18021
18146
  });
18022
18147
  };
18023
18148
 
18024
- /*====== Start Cybersource integration ========*/
18149
+ /* ====== Start Cybersource integration ======== */
18025
18150
  const cybersourceErrorHandle = err => {
18026
18151
  var _err$details, _err$details$response, _err$details$response2;
18027
18152
  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) {
@@ -18086,7 +18211,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18086
18211
  } else if (type === "orderCreate") {
18087
18212
  purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18088
18213
  } else if (type === "invoicePayment") {
18089
- payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18214
+ payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18090
18215
  } else if (type === "updatePaymentSource") {
18091
18216
  createNewCybersourceCard();
18092
18217
  }
@@ -18290,9 +18415,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18290
18415
  });
18291
18416
  };
18292
18417
 
18293
- /*====== End Cybersource integration ========*/
18418
+ /* ====== End Cybersource integration ======== */
18294
18419
 
18295
- /*====== Start Tap integration ========*/
18420
+ /* ====== Start Tap integration ======== */
18296
18421
  const submitUsingTap = state => {
18297
18422
  var _ref4, _ref5, _getPlanAmount;
18298
18423
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18416,7 +18541,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18416
18541
  } else if (type === "orderCreate") {
18417
18542
  purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18418
18543
  } else if (type === "invoicePayment") {
18419
- payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18544
+ payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18420
18545
  } else if (type === "updatePaymentSource") {
18421
18546
  createNewTapCard();
18422
18547
  }
@@ -18564,28 +18689,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18564
18689
  cardHolder: "Card Holder Name"
18565
18690
  };
18566
18691
 
18567
- //payment options
18692
+ // payment options
18568
18693
  let paymentOptions = {
18569
18694
  labels: labels,
18570
18695
  TextDirection: "ltr"
18571
18696
  };
18572
18697
 
18573
- //create element, pass style and payment options
18698
+ // create element, pass style and payment options
18574
18699
  let card = elements.create("card", {
18575
18700
  style: style
18576
18701
  }, paymentOptions);
18577
18702
 
18578
- //mount element
18703
+ // mount element
18579
18704
  card.mount("#tapPaymentIframe");
18580
18705
 
18581
- //card change event listener
18706
+ // card change event listener
18582
18707
  card.addEventListener("change", function (event) {
18583
- //If needed
18708
+ // If needed
18584
18709
  });
18585
18710
  tapInstanceRef.current = tapKey;
18586
18711
  tapInstanceCard.current = card;
18587
18712
  };
18588
- /*====== End Tap integration ========*/
18713
+ /* ====== End Tap integration ======== */
18589
18714
 
18590
18715
  const submitUsingVantiv = state => {
18591
18716
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18627,7 +18752,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18627
18752
  } else if (type === "orderCreate") {
18628
18753
  purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
18629
18754
  } else if (type === "invoicePayment") {
18630
- payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
18755
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
18631
18756
  } else if (type === "updatePaymentSource") {
18632
18757
  createNewVantivCard();
18633
18758
  }
@@ -18773,7 +18898,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18773
18898
  }
18774
18899
  }, [selectedPaymentMethodId]);
18775
18900
 
18776
- //Trigger the handleVantivPayment method when a vantivePaymentRequest is present
18901
+ // Trigger the handleVantivPayment method when a vantivPaymentRequest is present
18777
18902
  React.useEffect(() => {
18778
18903
  if (vantivPaymentRequest) {
18779
18904
  handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
@@ -18933,7 +19058,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18933
19058
  if (err) {
18934
19059
  onFailure(err);
18935
19060
 
18936
- //reset the coupon code in local state
19061
+ // reset the coupon code in local state
18937
19062
  setUpdatedCouponCode("");
18938
19063
  dispatch({
18939
19064
  type: SET_COUPON_ERROR,
@@ -18994,7 +19119,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18994
19119
  payload: res.data.coupon
18995
19120
  });
18996
19121
 
18997
- //set the coupon code in local state to be able to use with Vantiv
19122
+ // set the coupon code in local state to be able to use with Vantiv
18998
19123
  setUpdatedCouponCode(res.data.coupon.code);
18999
19124
  dispatch({
19000
19125
  type: SET_PERCENT_OFF,
@@ -19067,7 +19192,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19067
19192
  const removeAppliedCoupon = state => {
19068
19193
  state.couponCode = "";
19069
19194
 
19070
- //reset the coupon code in local state
19195
+ // reset the coupon code in local state
19071
19196
  setUpdatedCouponCode("");
19072
19197
  dispatch({
19073
19198
  type: SET_COUPON_ERROR,
@@ -19459,7 +19584,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19459
19584
  });
19460
19585
  });
19461
19586
  };
19462
- const payInvoice = (gatewayService, gatewayToken, dispatch) => {
19587
+ const payInvoice = function (gatewayService, gatewayToken, dispatch) {
19588
+ let cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
19463
19589
  const payment = new Payment(gatewayService);
19464
19590
  return payment.execute({
19465
19591
  type: PAYMENT_TYPES.PAY_INVOICE,
@@ -19467,7 +19593,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19467
19593
  isExistingSource: Boolean(selectedPaymentMethodId),
19468
19594
  invoiceId: invoice.id
19469
19595
  }, (err, res) => {
19470
- confirmStripeCardPayment(res, err);
19596
+ if (cb && typeof cb == "function") {
19597
+ cb(res, err);
19598
+ } else {
19599
+ dispatch({
19600
+ type: DISABLE_SUBMIT,
19601
+ payload: false
19602
+ });
19603
+ dispatch({
19604
+ type: LOADING,
19605
+ payload: false
19606
+ });
19607
+ if (err) {
19608
+ onFailure(err);
19609
+ return dispatch({
19610
+ type: SHOW_ALERT,
19611
+ payload: {
19612
+ type: "error",
19613
+ content: getErrorMessages(err)
19614
+ }
19615
+ });
19616
+ }
19617
+ onSuccess(res);
19618
+ }
19471
19619
  });
19472
19620
  };
19473
19621
  const updatePaymentSource = (state, dispatch) => {
@@ -19711,7 +19859,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19711
19859
  } else if (stripeSource && type === "orderCreate") {
19712
19860
  purchase(new StripeGateway(), stripeSource.id, state, dispatch);
19713
19861
  } else if (stripeSource && type === "invoicePayment") {
19714
- payInvoice(new StripeGateway(), stripeSource.id);
19862
+ payInvoice(new StripeGateway(), stripeSource.id, dispatch, confirmStripeCardPayment);
19715
19863
  }
19716
19864
  };
19717
19865
  const handlePaymentError = error => {
@@ -19883,11 +20031,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19883
20031
  case HANDLE_PAYPAL_SUBSCRIPTION:
19884
20032
  return lib_5(state, (state, dispatch) => {
19885
20033
  if (type === "invoicePayment") {
19886
- payInvoice(new PaypalGateway(), action.payload);
20034
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
19887
20035
  } else {
19888
20036
  handlePaypalSubscription(state, action.payload);
19889
20037
  }
19890
20038
  });
20039
+ case HANDLE_APPLEPAY_SUBSCRIPTION:
20040
+ return lib_5(state, (state, dispatch) => {
20041
+ setVantivPaymentRequest(action.payload);
20042
+ });
19891
20043
  case SET_UPDATED_PRICE:
19892
20044
  return lib_7({
19893
20045
  ...state,
@@ -21029,6 +21181,290 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
21029
21181
  store: store$k
21030
21182
  }, props));
21031
21183
 
21184
+ /* eslint-disable no-undef */
21185
+
21186
+ /**
21187
+ * ApplePayButton component
21188
+ * @return {JSX}
21189
+ */
21190
+ const ApplePayButton = _ref => {
21191
+ var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
21192
+ let {
21193
+ onClick,
21194
+ props,
21195
+ ...otherProps
21196
+ } = _ref;
21197
+ const {
21198
+ dispatch,
21199
+ state
21200
+ } = React.useContext(store$k);
21201
+ const {
21202
+ plan,
21203
+ invoice
21204
+ } = usePelcro();
21205
+ const {
21206
+ pay_page_id: payPageId,
21207
+ report_group: reportGroup,
21208
+ apple_pay_merchant_id: ApplePayMerchantId,
21209
+ apple_pay_enabled: ApplePayEnabled
21210
+ } = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
21211
+ const updatedPrice = (_ref2 = (_ref3 = (_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 && _ref3 !== void 0 ? _ref3 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice.amount_remaining;
21212
+ React.useEffect(() => {
21213
+ if (window.ApplePaySession) {
21214
+ // Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
21215
+ const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
21216
+ promise.then(function (canMakePayments) {
21217
+ if (canMakePayments && ApplePayEnabled) {
21218
+ // Display Apple Pay Buttons here…
21219
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21220
+ if (pelcroApplyPayButton) {
21221
+ pelcroApplyPayButton.style.display = "block";
21222
+ }
21223
+ console.log("canMakePayments", canMakePayments);
21224
+ }
21225
+ });
21226
+ } else {
21227
+ console.error("ApplePay is not available on this browser");
21228
+ }
21229
+ }, []);
21230
+ function onApplePayButtonClicked() {
21231
+ var _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$l;
21232
+ if (!ApplePaySession) {
21233
+ return;
21234
+ }
21235
+ dispatch({
21236
+ type: DISABLE_SUBMIT,
21237
+ payload: true
21238
+ });
21239
+
21240
+ // Define ApplePayPaymentRequest
21241
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
21242
+ const ApplePayPaymentRequest = {
21243
+ 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",
21244
+ currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
21245
+ merchantCapabilities: ["supports3DS"],
21246
+ supportedNetworks: ["visa", "masterCard", "amex", "discover"],
21247
+ total: {
21248
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21249
+ type: "final",
21250
+ amount: updatedPrice / 100
21251
+ }
21252
+ };
21253
+ console.log(ApplePayPaymentRequest);
21254
+ // Create ApplePaySession
21255
+ // @todo - Clarify supported version parameter
21256
+ // @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
21257
+ const session = new ApplePaySession(3, ApplePayPaymentRequest);
21258
+
21259
+ // @todo - Detect whether web browser supports a particular Apple Pay version.
21260
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778014-supportsversion
21261
+
21262
+ session.onvalidatemerchant = async event => {
21263
+ const {
21264
+ validationURL
21265
+ } = event;
21266
+ console.log("then merchantSession step", event);
21267
+ // Call your own server to request a new merchant session.
21268
+ window.Pelcro.payment.startSession({
21269
+ auth_token: window.Pelcro.user.read().auth_token,
21270
+ site_id: window.Pelcro.siteid,
21271
+ validation_url: validationURL
21272
+ }, (err, res) => {
21273
+ if (err) {
21274
+ // Handle any errors during merchant validation
21275
+ console.error("Merchant validation SDK error: ", err);
21276
+ session.abort();
21277
+ return dispatch({
21278
+ type: SHOW_ALERT,
21279
+ payload: {
21280
+ type: "error",
21281
+ content: getErrorMessages(err)
21282
+ }
21283
+ });
21284
+ }
21285
+ // Complete merchant validation with the merchant session object
21286
+ console.log("Merchant validation SDK response: ", res);
21287
+ const merchantSession = res;
21288
+ session.completeMerchantValidation(merchantSession);
21289
+ });
21290
+ };
21291
+ session.onpaymentmethodselected = event => {
21292
+ console.log("payment method selected step", event);
21293
+ // Define ApplePayPaymentMethodUpdate based on the selected payment method.
21294
+ // No updates or errors are needed, pass an empty object.
21295
+ const newTotal = {
21296
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21297
+ type: "final",
21298
+ amount: updatedPrice / 100
21299
+ };
21300
+ const newLineItems = [{
21301
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21302
+ type: "final",
21303
+ amount: updatedPrice / 100
21304
+ }];
21305
+ session.completePaymentMethodSelection(newTotal, newLineItems);
21306
+ };
21307
+
21308
+ // TODO: Check if onshippingmethodselected it should be implemented
21309
+ // session.onshippingmethodselected = (event) => {
21310
+ // console.log("on shipping method selected step", event);
21311
+ // // Define ApplePayShippingMethodUpdate based on the selected shipping method.
21312
+ // // No updates or errors are needed, pass an empty object.
21313
+ // const newTotal = {
21314
+ // label: plan?.nickname || `invoice #${invoice.id}`,
21315
+ // type: "final",
21316
+ // amount: updatedPrice / 100
21317
+ // };
21318
+
21319
+ // const newLineItems = [
21320
+ // {
21321
+ // label: plan?.nickname || `invoice #${invoice.id}`,
21322
+ // type: "final",
21323
+ // amount: updatedPrice / 100
21324
+ // }
21325
+ // ];
21326
+
21327
+ // session.completeShippingMethodSelection(newTotal, newLineItems);
21328
+ // };
21329
+
21330
+ // TODO: Check if onshippingcontactselected it should be implemented
21331
+ // session.onshippingcontactselected = (event) => {
21332
+ // console.log("on shipping contact selected step", event);
21333
+ // // Define ApplePayShippingContactUpdate based on the selected shipping contact.
21334
+ // const update = {};
21335
+ // session.completeShippingContactSelection(update);
21336
+ // };
21337
+
21338
+ session.onpaymentauthorized = event => {
21339
+ console.log("on payment authorized step", event);
21340
+ // Define ApplePayPaymentAuthorizationResult
21341
+ const result = {
21342
+ status: ApplePaySession.STATUS_SUCCESS
21343
+ };
21344
+ const {
21345
+ paymentData
21346
+ } = event.payment.token;
21347
+ const {
21348
+ data,
21349
+ signature,
21350
+ version
21351
+ } = paymentData;
21352
+ const {
21353
+ ephemeralPublicKey,
21354
+ publicKeyHash,
21355
+ transactionId
21356
+ } = paymentData.header;
21357
+ const applePayToken = {
21358
+ data: data,
21359
+ signature: signature,
21360
+ version: version,
21361
+ header: {
21362
+ ephemeralPublicKey: ephemeralPublicKey,
21363
+ publicKeyHash: publicKeyHash,
21364
+ transactionId: transactionId
21365
+ }
21366
+ };
21367
+ console.log(applePayToken);
21368
+ const orderId = `pelcro-${new Date().getTime()}`;
21369
+ const eProtectRequest = {
21370
+ paypageId: payPageId,
21371
+ reportGroup: reportGroup,
21372
+ orderId: orderId,
21373
+ id: orderId,
21374
+ applepay: applePayToken,
21375
+ url: "https://request.eprotect.vantivprelive.com"
21376
+ };
21377
+
21378
+ // successCallback function to handle the response from WorldPay.
21379
+ function successCallback(vantivResponse) {
21380
+ const {
21381
+ expDate
21382
+ } = vantivResponse;
21383
+ console.log("Response:", vantivResponse);
21384
+ const expMonth = expDate.substring(0, 2);
21385
+ const expYear = expDate.substring(2);
21386
+ const vantivPaymentRequest = {
21387
+ ...vantivResponse,
21388
+ expMonth: expMonth,
21389
+ expYear: expYear
21390
+ };
21391
+
21392
+ // Process the registrationId or continue with further payment processing.
21393
+ dispatch({
21394
+ type: HANDLE_APPLEPAY_SUBSCRIPTION,
21395
+ payload: vantivPaymentRequest
21396
+ });
21397
+ dispatch({
21398
+ type: LOADING,
21399
+ payload: true
21400
+ });
21401
+ session.completePayment(result);
21402
+ }
21403
+
21404
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21405
+ function errorCallback(error) {
21406
+ console.error("Error retrieving Registration ID:", error);
21407
+ // Handle error appropriately.
21408
+ }
21409
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21410
+ function timeoutCallback() {
21411
+ console.error("eProtect Timeout");
21412
+ // Handle error appropriately.
21413
+ }
21414
+
21415
+ new eProtect().sendToEprotect(eProtectRequest, {}, successCallback, errorCallback, timeoutCallback, 15000);
21416
+ };
21417
+
21418
+ // TODO: Check if oncouponcodechanged it should be implemented
21419
+ // session.oncouponcodechanged = (event) => {
21420
+ // console.log("on coupon code changed step", event);
21421
+ // // Define ApplePayCouponCodeUpdate
21422
+ // const newTotal = calculateNewTotal(event.couponCode);
21423
+ // const newLineItems = calculateNewLineItems(event.couponCode);
21424
+ // const newShippingMethods = calculateNewShippingMethods(
21425
+ // event.couponCode
21426
+ // );
21427
+ // const errors = calculateErrors(event.couponCode);
21428
+
21429
+ // session.completeCouponCodeChange({
21430
+ // newTotal: newTotal,
21431
+ // newLineItems: newLineItems,
21432
+ // newShippingMethods: newShippingMethods,
21433
+ // errors: errors
21434
+ // });
21435
+ // };
21436
+
21437
+ session.oncancel = event => {
21438
+ // Payment cancelled by WebKit
21439
+ console.log("on cancel step", event);
21440
+ dispatch({
21441
+ type: LOADING,
21442
+ payload: false
21443
+ });
21444
+ dispatch({
21445
+ type: DISABLE_SUBMIT,
21446
+ payload: false
21447
+ });
21448
+ };
21449
+ session.begin();
21450
+ }
21451
+ React.useEffect(() => {
21452
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21453
+ if (pelcroApplyPayButton) {
21454
+ pelcroApplyPayButton.addEventListener("click", onApplePayButtonClicked);
21455
+ }
21456
+ }, []);
21457
+ return /*#__PURE__*/React__default['default'].createElement("apple-pay-button", {
21458
+ id: "pelcro-apple-pay-button",
21459
+ style: {
21460
+ display: "none"
21461
+ },
21462
+ buttonstyle: "black",
21463
+ type: "plain",
21464
+ locale: "en-US"
21465
+ });
21466
+ };
21467
+
21032
21468
  /**
21033
21469
  *
21034
21470
  */
@@ -21043,6 +21479,7 @@ function PaymentMethodView(_ref) {
21043
21479
  showExternalPaymentMethods,
21044
21480
  showSubscriptionButton,
21045
21481
  showOrderButton,
21482
+ showApplePayButton,
21046
21483
  order
21047
21484
  } = _ref;
21048
21485
  const {
@@ -21119,7 +21556,7 @@ function PaymentMethodView(_ref) {
21119
21556
  className: "plc-mb-2"
21120
21557
  }, /*#__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", {
21121
21558
  className: "plc-grid plc-mt-4 plc-gap-y-2"
21122
- }, /*#__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)))));
21559
+ }, /*#__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)))));
21123
21560
  }
21124
21561
 
21125
21562
  const SubscriptionRenewView = _ref => {
@@ -21141,11 +21578,11 @@ const SubscriptionRenewView = _ref => {
21141
21578
  const getPricingText = plan => {
21142
21579
  const autoRenewed = plan.auto_renew;
21143
21580
  const {
21144
- interval,
21581
+ interval_translated,
21145
21582
  interval_count
21146
21583
  } = plan;
21147
21584
  const intervalText = t("labels.interval", {
21148
- interval,
21585
+ interval: interval_translated,
21149
21586
  count: interval_count
21150
21587
  });
21151
21588
  return /*#__PURE__*/React__default['default'].createElement("p", {
@@ -21170,6 +21607,7 @@ const SubscriptionRenewView = _ref => {
21170
21607
  type: "createPayment",
21171
21608
  showCoupon: true,
21172
21609
  showExternalPaymentMethods: false,
21610
+ showApplePayButton: true,
21173
21611
  onSuccess: onSuccess,
21174
21612
  onGiftRenewalSuccess: onGiftRenewalSuccess,
21175
21613
  onFailure: onFailure,
@@ -21177,13 +21615,11 @@ const SubscriptionRenewView = _ref => {
21177
21615
  }));
21178
21616
  };
21179
21617
 
21180
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21181
- const ReactGA$6 = (_window$6 = window) !== null && _window$6 !== void 0 && (_window$Pelcro$6 = _window$6.Pelcro) !== null && _window$Pelcro$6 !== void 0 && (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) !== null && _window$Pelcro$uiSett$6 !== void 0 && _window$Pelcro$uiSett$6.enableReactGA4 ? ReactGA4 : ReactGA1;
21182
-
21183
21618
  /**
21184
21619
  *
21185
21620
  */
21186
21621
  function SubscriptionRenewModal(_ref) {
21622
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21187
21623
  let {
21188
21624
  onDisplay,
21189
21625
  onClose,
@@ -21192,24 +21628,39 @@ function SubscriptionRenewModal(_ref) {
21192
21628
  const {
21193
21629
  switchView
21194
21630
  } = usePelcro();
21631
+ 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;
21195
21632
  const onSuccess = res => {
21196
- var _otherProps$onSuccess, _ReactGA$event;
21633
+ var _otherProps$onSuccess;
21197
21634
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21198
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event = ReactGA$6.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$6, {
21199
- category: "ACTIONS",
21200
- action: "Renewed",
21201
- nonInteraction: true
21202
- });
21635
+ if (enableReactGA4) {
21636
+ ReactGA4.event("Renewed", {
21637
+ nonInteraction: true
21638
+ });
21639
+ } else {
21640
+ var _ReactGA$event;
21641
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21642
+ category: "ACTIONS",
21643
+ action: "Renewed",
21644
+ nonInteraction: true
21645
+ });
21646
+ }
21203
21647
  return switchView("subscription-success");
21204
21648
  };
21205
21649
  const onGiftRenewalSuccess = () => {
21206
- var _otherProps$onGiftRen, _ReactGA$event2;
21650
+ var _otherProps$onGiftRen;
21207
21651
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21208
- ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$6.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$6, {
21209
- category: "ACTIONS",
21210
- action: "Renewed Gift",
21211
- nonInteraction: true
21212
- });
21652
+ if (enableReactGA4) {
21653
+ ReactGA4.event("Renewed Gift", {
21654
+ nonInteraction: true
21655
+ });
21656
+ } else {
21657
+ var _ReactGA$event2;
21658
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
21659
+ category: "ACTIONS",
21660
+ action: "Renewed Gift",
21661
+ nonInteraction: true
21662
+ });
21663
+ }
21213
21664
  return switchView("subscription-success");
21214
21665
  };
21215
21666
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -21224,7 +21675,8 @@ function SubscriptionRenewModal(_ref) {
21224
21675
  SubscriptionRenewModal.viewId = "subscription-renew";
21225
21676
 
21226
21677
  const initialState$j = {
21227
- cancelationReason: ""
21678
+ cancelationReason: "",
21679
+ cancelationOption: ""
21228
21680
  };
21229
21681
  const store$j = /*#__PURE__*/React.createContext(initialState$j);
21230
21682
  const {
@@ -21239,7 +21691,6 @@ const SubscriptionCancelContainer = _ref => {
21239
21691
  children,
21240
21692
  ...props
21241
21693
  } = _ref;
21242
- useTranslation("verifyEmail");
21243
21694
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
21244
21695
  switch (action.type) {
21245
21696
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -21247,6 +21698,11 @@ const SubscriptionCancelContainer = _ref => {
21247
21698
  ...state,
21248
21699
  cancelationReason: action.payload
21249
21700
  });
21701
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
21702
+ return lib_7({
21703
+ ...state,
21704
+ cancelationOption: action.payload
21705
+ });
21250
21706
  default:
21251
21707
  return state;
21252
21708
  }
@@ -21346,8 +21802,7 @@ const SubscriptionCancelReason = props => {
21346
21802
  t
21347
21803
  } = useTranslation("subscriptionCancel");
21348
21804
  const {
21349
- dispatch,
21350
- state
21805
+ dispatch
21351
21806
  } = React.useContext(store$j);
21352
21807
  const handleOnTextAreaBlur = e => {
21353
21808
  dispatch({
@@ -21379,9 +21834,7 @@ function SvgSubscription(props) {
21379
21834
  }))))));
21380
21835
  }
21381
21836
 
21382
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21383
- const ReactGA$5 = (_window$5 = window) !== null && _window$5 !== void 0 && (_window$Pelcro$5 = _window$5.Pelcro) !== null && _window$Pelcro$5 !== void 0 && (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) !== null && _window$Pelcro$uiSett$5 !== void 0 && _window$Pelcro$uiSett$5.enableReactGA4 ? ReactGA4 : ReactGA1;
21384
- const SubscriptionCancelNowButton = _ref => {
21837
+ const SubscriptionCancelButton = _ref => {
21385
21838
  let {
21386
21839
  subscription,
21387
21840
  onClick,
@@ -21392,14 +21845,16 @@ const SubscriptionCancelNowButton = _ref => {
21392
21845
  } = usePelcro();
21393
21846
  const {
21394
21847
  state: {
21395
- cancelationReason
21396
- },
21397
- dispatch
21848
+ cancelationReason,
21849
+ cancelationOption
21850
+ }
21398
21851
  } = React.useContext(store$j);
21399
21852
  const {
21400
21853
  t
21401
21854
  } = useTranslation("subscriptionCancel");
21402
21855
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21856
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21857
+ 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;
21403
21858
  window.Pelcro.subscription.cancel({
21404
21859
  auth_token: window.Pelcro.user.read().auth_token,
21405
21860
  subscription_id: payload.subscription_id,
@@ -21408,36 +21863,42 @@ const SubscriptionCancelNowButton = _ref => {
21408
21863
  reason: payload.reason
21409
21864
  })
21410
21865
  }, (err, res) => {
21411
- var _ReactGA$event;
21412
21866
  if (err) {
21413
21867
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21414
21868
  }
21415
- ReactGA$5 === null || ReactGA$5 === void 0 ? void 0 : (_ReactGA$event = ReactGA$5.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$5, {
21416
- category: "ACTIONS",
21417
- action: "Canceled",
21418
- nonInteraction: true
21419
- });
21869
+ if (enableReactGA4) {
21870
+ ReactGA4.event("Canceled", {
21871
+ nonInteraction: true
21872
+ });
21873
+ } else {
21874
+ var _ReactGA$event;
21875
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21876
+ category: "ACTIONS",
21877
+ action: "Canceled",
21878
+ nonInteraction: true
21879
+ });
21880
+ }
21420
21881
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21421
21882
  });
21422
21883
  };
21423
- const handleCancelNowClick = () => {
21884
+ const handleCancelClick = () => {
21424
21885
  const payload = {
21425
21886
  subscription_id: subscription.id,
21426
- mode: "now",
21887
+ mode: cancelationOption,
21427
21888
  ...(cancelationReason && {
21428
21889
  reason: cancelationReason
21429
21890
  })
21430
21891
  };
21431
21892
  onClick === null || onClick === void 0 ? void 0 : onClick();
21432
21893
 
21433
- //Close the modal
21894
+ // Close the modal
21434
21895
  switchView(null);
21435
21896
 
21436
- //Show confirmation alert after closing the modal
21897
+ // Show confirmation alert after closing the modal
21437
21898
  notify.confirm((onSuccess, onFailure) => {
21438
21899
  cancelSubscription(payload, onSuccess, onFailure);
21439
21900
  }, {
21440
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
21901
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
21441
21902
  loadingMessage: t("messages.subCancellation.loading"),
21442
21903
  successMessage: t("messages.subCancellation.success"),
21443
21904
  errorMessage: t("messages.subCancellation.error")
@@ -21446,90 +21907,89 @@ const SubscriptionCancelNowButton = _ref => {
21446
21907
  });
21447
21908
  };
21448
21909
  return /*#__PURE__*/React__default['default'].createElement(Button, {
21449
- onClick: handleCancelNowClick,
21450
- className: `${className}`
21451
- }, t("messages.cancelNow"));
21910
+ onClick: handleCancelClick,
21911
+ className: `${className}`,
21912
+ disabled: !cancelationOption
21913
+ }, t("labels.cancel"));
21452
21914
  };
21453
21915
 
21454
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21455
- const ReactGA$4 = (_window$4 = window) !== null && _window$4 !== void 0 && (_window$Pelcro$4 = _window$4.Pelcro) !== null && _window$Pelcro$4 !== void 0 && (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) !== null && _window$Pelcro$uiSett$4 !== void 0 && _window$Pelcro$uiSett$4.enableReactGA4 ? ReactGA4 : ReactGA1;
21456
- const SubscriptionCancelLaterButton = _ref => {
21916
+ // New cancellation option modal
21917
+ const SubscriptionCancelOptions = _ref => {
21918
+ var _subscription$schedul;
21457
21919
  let {
21458
21920
  subscription,
21921
+ hasPhases,
21459
21922
  onClick,
21460
21923
  className
21461
21924
  } = _ref;
21462
- const {
21463
- switchView
21464
- } = usePelcro();
21465
21925
  const {
21466
21926
  state: {
21467
- cancelationReason
21927
+ cancelationOption
21468
21928
  },
21469
21929
  dispatch
21470
21930
  } = React.useContext(store$j);
21471
21931
  const {
21472
21932
  t
21473
21933
  } = useTranslation("subscriptionCancel");
21474
- const cancelSubscription = (payload, onSuccess, onFailure) => {
21475
- window.Pelcro.subscription.cancel({
21476
- auth_token: window.Pelcro.user.read().auth_token,
21477
- subscription_id: payload.subscription_id,
21478
- mode: payload.mode,
21479
- ...(payload.reason && {
21480
- reason: payload.reason
21481
- })
21482
- }, (err, res) => {
21483
- var _ReactGA$event;
21484
- if (err) {
21485
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21486
- }
21487
- ReactGA$4 === null || ReactGA$4 === void 0 ? void 0 : (_ReactGA$event = ReactGA$4.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$4, {
21488
- category: "ACTIONS",
21489
- action: "Canceled",
21490
- nonInteraction: true
21491
- });
21492
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21493
- });
21494
- };
21495
- const handleCancelNowClick = () => {
21496
- const payload = {
21497
- subscription_id: subscription.id,
21498
- mode: "period_end",
21499
- ...(cancelationReason && {
21500
- reason: cancelationReason
21501
- })
21502
- };
21503
- onClick === null || onClick === void 0 ? void 0 : onClick();
21504
-
21505
- //Close the modal
21506
- switchView(null);
21507
-
21508
- //Show confirmation alert after closing the modal
21509
- notify.confirm((onSuccess, onFailure) => {
21510
- cancelSubscription(payload, onSuccess, onFailure);
21511
- }, {
21512
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
21513
- loadingMessage: t("messages.subCancellation.loading"),
21514
- successMessage: t("messages.subCancellation.success"),
21515
- errorMessage: t("messages.subCancellation.error")
21516
- }, {
21517
- closeButtonLabel: t("labels.subCancellation.goBack")
21934
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
21935
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21936
+ const handleOptionSelect = event => {
21937
+ dispatch({
21938
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
21939
+ payload: event.target.value
21518
21940
  });
21519
21941
  };
21520
- return /*#__PURE__*/React__default['default'].createElement(Button, {
21521
- onClick: handleCancelNowClick,
21522
- className: `${className}`
21523
- }, t("messages.cancelLater"));
21942
+ return /*#__PURE__*/React__default['default'].createElement("div", {
21943
+ className: "plc-text-left plc-mr-auto plc-mb-6"
21944
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
21945
+ className: "plc-mb-3"
21946
+ }, t("messages.cancelWhen")), subscription.cancel_at_period_end === 0 && hasPhases && /*#__PURE__*/React__default['default'].createElement(Radio, {
21947
+ onChange: handleOptionSelect,
21948
+ checked: cancelationOption === "period_end",
21949
+ value: "period_end"
21950
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21951
+ year: "numeric",
21952
+ month: "short",
21953
+ day: "numeric"
21954
+ })), subscription.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Radio, {
21955
+ onChange: handleOptionSelect,
21956
+ checked: cancelationOption === "current_period_end",
21957
+ value: "current_period_end"
21958
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
21959
+ year: "numeric",
21960
+ month: "short",
21961
+ day: "numeric"
21962
+ })), /*#__PURE__*/React__default['default'].createElement(Radio, {
21963
+ onChange: handleOptionSelect,
21964
+ checked: cancelationOption === "now",
21965
+ value: "now"
21966
+ }, t("labels.endImmediately")));
21524
21967
  };
21525
21968
 
21526
21969
  const SubscriptionCancelView = props => {
21970
+ var _subscriptionToCancel7, _subscriptionToCancel8;
21527
21971
  const {
21528
- subscriptionToCancel
21972
+ subscriptionToCancel,
21973
+ switchView
21529
21974
  } = usePelcro();
21530
21975
  const {
21531
21976
  t
21532
21977
  } = useTranslation("subscriptionCancel");
21978
+ const getPhases = () => {
21979
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
21980
+ if (!subscriptionToCancel.schedule) return [];
21981
+ 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;
21982
+ 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 => {
21983
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
21984
+ });
21985
+ 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 => {
21986
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
21987
+ });
21988
+ return [currentPhase, ...futurePhases];
21989
+ };
21990
+ const hasPhases = getPhases().length > 0;
21991
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
21992
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21533
21993
  return /*#__PURE__*/React__default['default'].createElement("div", {
21534
21994
  id: "pelcro-subscription-cancel-view"
21535
21995
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21538,22 +21998,35 @@ const SubscriptionCancelView = props => {
21538
21998
  className: "plc-text-2xl plc-font-semibold"
21539
21999
  }, t("labels.title"), /*#__PURE__*/React__default['default'].createElement("span", {
21540
22000
  className: "plc-text-gray-400 plc-text-base plc-block"
21541
- }, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
22001
+ }, "(", 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", {
21542
22002
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
21543
22003
  }, /*#__PURE__*/React__default['default'].createElement(SvgSubscription, {
21544
22004
  className: "plc-w-32 plc-h-32"
21545
22005
  }), /*#__PURE__*/React__default['default'].createElement("p", {
21546
- className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
21547
- }, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
22006
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
22007
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21548
22008
  year: "numeric",
21549
22009
  month: "short",
21550
22010
  day: "numeric"
21551
- }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelNowButton, {
21552
- className: "plc-mb-2",
21553
- subscription: subscriptionToCancel
21554
- }), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelLaterButton, {
22011
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
22012
+ year: "numeric",
22013
+ month: "short",
22014
+ day: "numeric"
22015
+ }), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelOptions, {
22016
+ subscription: subscriptionToCancel,
22017
+ hasPhases: hasPhases
22018
+ }), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
22019
+ 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"
22020
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
22021
+ className: "plc-w-3/4 md:plc-w-2/5",
21555
22022
  subscription: subscriptionToCancel
21556
- }))));
22023
+ }), /*#__PURE__*/React__default['default'].createElement(Button, {
22024
+ variant: "outline",
22025
+ className: "plc-w-3/4 md:plc-w-2/5",
22026
+ onClick: () => {
22027
+ switchView("dashboard");
22028
+ }
22029
+ }, t("labels.subCancellation.goBack"))))));
21557
22030
  };
21558
22031
 
21559
22032
  const SubscriptionCancelModal = _ref => {
@@ -21693,9 +22166,8 @@ const SubscriptionSuspendDate = props => {
21693
22166
  }, props));
21694
22167
  };
21695
22168
 
21696
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
21697
- const ReactGA$3 = (_window$3 = window) !== null && _window$3 !== void 0 && (_window$Pelcro$3 = _window$3.Pelcro) !== null && _window$Pelcro$3 !== void 0 && (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) !== null && _window$Pelcro$uiSett$3 !== void 0 && _window$Pelcro$uiSett$3.enableReactGA4 ? ReactGA4 : ReactGA1;
21698
22169
  const SubscriptionSuspendButton = _ref => {
22170
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21699
22171
  let {
21700
22172
  subscription,
21701
22173
  onClick,
@@ -21714,6 +22186,7 @@ const SubscriptionSuspendButton = _ref => {
21714
22186
  const {
21715
22187
  t
21716
22188
  } = useTranslation("subscriptionSuspend");
22189
+ 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;
21717
22190
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21718
22191
  window.Pelcro.subscription.update({
21719
22192
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21721,15 +22194,21 @@ const SubscriptionSuspendButton = _ref => {
21721
22194
  suspend: 1,
21722
22195
  shipments_suspended_until: suspendDate
21723
22196
  }, (err, res) => {
21724
- var _ReactGA$event;
21725
22197
  if (err) {
21726
22198
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21727
22199
  }
21728
- ReactGA$3 === null || ReactGA$3 === void 0 ? void 0 : (_ReactGA$event = ReactGA$3.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$3, {
21729
- category: "ACTIONS",
21730
- action: "Suspended",
21731
- nonInteraction: true
21732
- });
22200
+ if (enableReactGA4) {
22201
+ ReactGA4.event("Suspended", {
22202
+ nonInteraction: true
22203
+ });
22204
+ } else {
22205
+ var _ReactGA$event;
22206
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
22207
+ category: "ACTIONS",
22208
+ action: "Suspended",
22209
+ nonInteraction: true
22210
+ });
22211
+ }
21733
22212
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21734
22213
  });
21735
22214
  };
@@ -21739,10 +22218,10 @@ const SubscriptionSuspendButton = _ref => {
21739
22218
  };
21740
22219
  onClick === null || onClick === void 0 ? void 0 : onClick();
21741
22220
 
21742
- //Close the modal
22221
+ // Close the modal
21743
22222
  switchView(null);
21744
22223
 
21745
- //Show confirmation alert after closing the modal
22224
+ // Show confirmation alert after closing the modal
21746
22225
  notify.confirm((onSuccess, onFailure) => {
21747
22226
  suspendSubscription(payload, onSuccess, onFailure);
21748
22227
  }, {
@@ -22473,11 +22952,11 @@ const SubscriptionCreateView = _ref => {
22473
22952
  var _plan$quantity, _plan$quantity2, _plan$quantity3;
22474
22953
  const autoRenewed = plan.auto_renew;
22475
22954
  const {
22476
- interval,
22955
+ interval_translated,
22477
22956
  interval_count
22478
22957
  } = plan;
22479
22958
  const intervalText = t("labels.interval", {
22480
- interval,
22959
+ interval: interval_translated,
22481
22960
  count: interval_count
22482
22961
  });
22483
22962
  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());
@@ -22503,6 +22982,7 @@ const SubscriptionCreateView = _ref => {
22503
22982
  type: "createPayment",
22504
22983
  showCoupon: true,
22505
22984
  showExternalPaymentMethods: true,
22985
+ showApplePayButton: true,
22506
22986
  onSuccess: onSuccess,
22507
22987
  onFailure: onFailure,
22508
22988
  showSubscriptionButton: showSubscriptionButton
@@ -24473,7 +24953,7 @@ const {
24473
24953
  Provider: Provider$d
24474
24954
  } = store$d;
24475
24955
  const AddressUpdateContainer = _ref => {
24476
- var _props$addressId;
24956
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24477
24957
  let {
24478
24958
  style,
24479
24959
  className = "",
@@ -24487,6 +24967,7 @@ const AddressUpdateContainer = _ref => {
24487
24967
  addressIdToEdit
24488
24968
  } = usePelcro();
24489
24969
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24970
+ 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;
24490
24971
  const [t] = useTranslation("address");
24491
24972
  React.useEffect(() => {
24492
24973
  const getCountries = () => {
@@ -24577,7 +25058,6 @@ const AddressUpdateContainer = _ref => {
24577
25058
  });
24578
25059
  onFailure(err);
24579
25060
  } else {
24580
- var _ReactGA$event;
24581
25061
  dispatch({
24582
25062
  type: SHOW_ALERT,
24583
25063
  payload: {
@@ -24586,11 +25066,18 @@ const AddressUpdateContainer = _ref => {
24586
25066
  }
24587
25067
  });
24588
25068
  onSuccess(res);
24589
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
24590
- category: "ACTIONS",
24591
- action: "Updated address",
24592
- nonInteraction: true
24593
- });
25069
+ if (enableReactGA4) {
25070
+ ReactGA4.event("Updated address", {
25071
+ nonInteraction: true
25072
+ });
25073
+ } else {
25074
+ var _ReactGA$event;
25075
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25076
+ category: "ACTIONS",
25077
+ action: "Updated address",
25078
+ nonInteraction: true
25079
+ });
25080
+ }
24594
25081
  }
24595
25082
  });
24596
25083
  };
@@ -25108,23 +25595,31 @@ function PaymentMethodUpdateView(props) {
25108
25595
  type: "updatePaymentSource",
25109
25596
  showCoupon: false,
25110
25597
  showExternalPaymentMethods: false,
25598
+ showApplePayButton: false,
25111
25599
  onDisplay: props.onDisplay,
25112
25600
  onFailure: props.onFailure,
25113
25601
  onSuccess: props.onSuccess
25114
25602
  }));
25115
25603
  }
25116
25604
 
25117
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25118
- const ReactGA$2 = (_window$2 = window) !== null && _window$2 !== void 0 && (_window$Pelcro$2 = _window$2.Pelcro) !== null && _window$Pelcro$2 !== void 0 && (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) !== null && _window$Pelcro$uiSett$2 !== void 0 && _window$Pelcro$uiSett$2.enableReactGA4 ? ReactGA4 : ReactGA1;
25119
25605
  const PaymentMethodUpdateModal = props => {
25606
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25607
+ 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;
25120
25608
  const onSuccess = res => {
25121
- var _props$onSuccess, _ReactGA$event;
25609
+ var _props$onSuccess;
25122
25610
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25123
- ReactGA$2 === null || ReactGA$2 === void 0 ? void 0 : (_ReactGA$event = ReactGA$2.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$2, {
25124
- category: "ACTIONS",
25125
- action: "Updated payment card",
25126
- nonInteraction: true
25127
- });
25611
+ if (enableReactGA4) {
25612
+ ReactGA4.event("Updated payment card", {
25613
+ nonInteraction: true
25614
+ });
25615
+ } else {
25616
+ var _ReactGA$event;
25617
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25618
+ category: "ACTIONS",
25619
+ action: "Updated payment card",
25620
+ nonInteraction: true
25621
+ });
25622
+ }
25128
25623
  };
25129
25624
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
25130
25625
  id: "pelcro-payment-method-update-modal",
@@ -26524,6 +27019,7 @@ const OrderCreateView = props => {
26524
27019
  type: "orderCreate",
26525
27020
  showCoupon: true,
26526
27021
  showExternalPaymentMethods: false,
27022
+ showApplePayButton: false,
26527
27023
  showOrderButton: showOrderButton,
26528
27024
  order: order
26529
27025
  }, props))));
@@ -29001,8 +29497,6 @@ const OrderItems = _ref => {
29001
29497
  });
29002
29498
  };
29003
29499
 
29004
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
29005
- const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
29006
29500
  const SavedItemsMenu = () => {
29007
29501
  const {
29008
29502
  t
@@ -29051,8 +29545,10 @@ const SavedItems = _ref3 => {
29051
29545
  isAuthenticated
29052
29546
  } = usePelcro();
29053
29547
  const removeItemFromMetadata = (category, title) => {
29548
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29054
29549
  const user = window.Pelcro.user.read();
29055
29550
  const oldValue = user.metadata[`metadata_saved_${category}`];
29551
+ 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;
29056
29552
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29057
29553
  if (isAuthenticated()) {
29058
29554
  setLoading(true);
@@ -29061,17 +29557,24 @@ const SavedItems = _ref3 => {
29061
29557
  value: newMetadataValue,
29062
29558
  auth_token: window.Pelcro.user.read().auth_token
29063
29559
  }, (error, response) => {
29064
- var _response$data, _ReactGA$event;
29560
+ var _response$data;
29065
29561
  setLoading(false);
29066
29562
  if (error) {
29067
29563
  return;
29068
29564
  }
29069
29565
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29070
- ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event = ReactGA$1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$1, {
29071
- category: "ACTIONS",
29072
- action: "Unsave/Unfollow",
29073
- label: title
29074
- });
29566
+ if (enableReactGA4) {
29567
+ ReactGA4.event("Unsave/Unfollow", {
29568
+ event_label: title
29569
+ });
29570
+ } else {
29571
+ var _ReactGA$event;
29572
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29573
+ category: "ACTIONS",
29574
+ action: "Unsave/Unfollow",
29575
+ label: title
29576
+ });
29577
+ }
29075
29578
  });
29076
29579
  }
29077
29580
  };
@@ -30024,8 +30527,6 @@ function getMemberShipStatus(status) {
30024
30527
  };
30025
30528
  }
30026
30529
 
30027
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
30028
- const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
30029
30530
  const SUB_MENUS = {
30030
30531
  PROFILE: "profile",
30031
30532
  SUBSCRIPTIONS: "subscriptions",
@@ -30080,21 +30581,27 @@ function DashboardWithHook(props) {
30080
30581
  DashboardWithHook.viewId = "dashboard";
30081
30582
  class Dashboard extends React.Component {
30082
30583
  constructor(props) {
30083
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30584
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30084
30585
  super(props);
30085
30586
  _defineProperty$3(this, "componentDidMount", () => {
30086
- var _ReactGA$event;
30087
30587
  this.setState({
30088
30588
  isOpen: true
30089
30589
  });
30090
30590
  window.Pelcro.insight.track("Modal Displayed", {
30091
30591
  name: "dashboard"
30092
30592
  });
30093
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30094
- category: "VIEWS",
30095
- action: "Dashboard Modal Viewed",
30096
- nonInteraction: true
30097
- });
30593
+ if (this.enableReactGA4) {
30594
+ ReactGA4.event("Dashboard Modal Viewed", {
30595
+ nonInteraction: true
30596
+ });
30597
+ } else {
30598
+ var _ReactGA$event;
30599
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30600
+ category: "VIEWS",
30601
+ action: "Dashboard Modal Viewed",
30602
+ nonInteraction: true
30603
+ });
30604
+ }
30098
30605
  const {
30099
30606
  addresses
30100
30607
  } = window.Pelcro.user.read();
@@ -30122,15 +30629,21 @@ class Dashboard extends React.Component {
30122
30629
  auth_token: window.Pelcro.user.read().auth_token,
30123
30630
  subscription_id: subscription_id
30124
30631
  }, (err, res) => {
30125
- var _ReactGA$event2;
30126
30632
  if (err) {
30127
30633
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30128
30634
  }
30129
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30130
- category: "ACTIONS",
30131
- action: "Canceled",
30132
- nonInteraction: true
30133
- });
30635
+ if (this.enableReactGA4) {
30636
+ ReactGA4.event("Canceled", {
30637
+ nonInteraction: true
30638
+ });
30639
+ } else {
30640
+ var _ReactGA$event2;
30641
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30642
+ category: "ACTIONS",
30643
+ action: "Canceled",
30644
+ nonInteraction: true
30645
+ });
30646
+ }
30134
30647
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30135
30648
  });
30136
30649
  });
@@ -30140,15 +30653,21 @@ class Dashboard extends React.Component {
30140
30653
  subscription_id: subscription_id,
30141
30654
  suspend: 0
30142
30655
  }, (err, res) => {
30143
- var _ReactGA$event3;
30144
30656
  if (err) {
30145
30657
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30146
30658
  }
30147
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30148
- category: "ACTIONS",
30149
- action: "UnSuspended",
30150
- nonInteraction: true
30151
- });
30659
+ if (this.enableReactGA4) {
30660
+ ReactGA4.event("UnSuspended", {
30661
+ nonInteraction: true
30662
+ });
30663
+ } else {
30664
+ var _ReactGA$event3;
30665
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30666
+ category: "ACTIONS",
30667
+ action: "UnSuspended",
30668
+ nonInteraction: true
30669
+ });
30670
+ }
30152
30671
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30153
30672
  });
30154
30673
  });
@@ -30433,6 +30952,7 @@ class Dashboard extends React.Component {
30433
30952
  this.locale = this.props.t;
30434
30953
  this.user = window.Pelcro.user.read();
30435
30954
  this.menuRef = /*#__PURE__*/React__default['default'].createRef();
30955
+ 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;
30436
30956
  }
30437
30957
  render() {
30438
30958
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
@@ -32846,7 +33366,8 @@ const InvoicePaymentView = props => {
32846
33366
  }, /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
32847
33367
  type: "invoicePayment",
32848
33368
  showCoupon: false,
32849
- showExternalPaymentMethods: true
33369
+ showExternalPaymentMethods: true,
33370
+ showApplePayButton: true
32850
33371
  }, props))));
32851
33372
  };
32852
33373