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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -3422,7 +3422,7 @@ var labels$15 = {
3422
3422
  code: "Coupon code",
3423
3423
  "for": "for",
3424
3424
  interval: "{{count}} {{interval}}",
3425
- interval_plural: "{{count}} {{interval}}s",
3425
+ interval_plural: "{{count}} {{interval}}",
3426
3426
  tax: "Tax",
3427
3427
  removeCoupon: "REMOVE",
3428
3428
  firstName: "First name",
@@ -4073,12 +4073,16 @@ var invoiceDetails_en = {
4073
4073
  var labels$U = {
4074
4074
  title: "Cancel subscription",
4075
4075
  cancelReason: "Cancellation reason",
4076
+ endOn: "End on",
4077
+ endImmediately: "End immediately",
4078
+ cancel: "Cancel",
4076
4079
  subCancellation: {
4077
4080
  goBack: "Go back"
4078
4081
  }
4079
4082
  };
4080
4083
  var messages$W = {
4081
4084
  subscriptionEnd: "This subscription is set to expire on",
4085
+ cancelWhen: "When would you like to cancel?",
4082
4086
  cancelNow: "Cancel Subscription Now",
4083
4087
  cancelLater: "Cancel at Period End",
4084
4088
  subCancellation: {
@@ -4344,7 +4348,7 @@ var labels$P = {
4344
4348
  code: "Code promo",
4345
4349
  "for": "pour",
4346
4350
  interval: "{{count}} {{interval}}",
4347
- interval_plural: "{{count}} {{interval}}s",
4351
+ interval_plural: "{{count}} {{interval}}",
4348
4352
  tax: "Taxe",
4349
4353
  removeCoupon: "RETIRER",
4350
4354
  firstName: "Prénom",
@@ -4995,12 +4999,16 @@ var invoiceDetails_fr = {
4995
4999
  var labels$C = {
4996
5000
  title: "Annuler l'abonnement",
4997
5001
  cancelReason: "Motif d'annulation",
5002
+ endOn: "Fin sur",
5003
+ endImmediately: "Fin immédiate",
5004
+ cancel: "Annuler",
4998
5005
  subCancellation: {
4999
5006
  goBack: "Retourner"
5000
5007
  }
5001
5008
  };
5002
5009
  var messages$D = {
5003
5010
  subscriptionEnd: "Cet abonnement doit expirer le",
5011
+ cancelWhen: "Quand voulez-vous annuler?",
5004
5012
  cancelNow: "Cancel Subscription Now",
5005
5013
  cancelLater: "Annuler l'abonnement maintenant",
5006
5014
  subCancellation: {
@@ -6024,12 +6032,16 @@ var invoiceDetails_ko = {
6024
6032
  var labels$k = {
6025
6033
  title: "구독 취소",
6026
6034
  cancelReason: "취소 사유",
6035
+ endOn: "종료",
6036
+ endImmediately: "즉시 종료",
6037
+ cancel: "취소",
6027
6038
  subCancellation: {
6028
6039
  goBack: "돌아가기"
6029
6040
  }
6030
6041
  };
6031
6042
  var messages$k = {
6032
6043
  subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
6044
+ cancelWhen: "언제 취소하시겠습니까?",
6033
6045
  cancelNow: "지금 구독 취소",
6034
6046
  cancelLater: "기간 종료 시 취소",
6035
6047
  subCancellation: {
@@ -6291,7 +6303,7 @@ var labels$f = {
6291
6303
  code: "Código de cupón",
6292
6304
  "for": "por",
6293
6305
  interval: "{{count}} {{interval}}",
6294
- interval_plural: "{{count}} {{interval}}s",
6306
+ interval_plural: "{{count}} {{interval}}",
6295
6307
  tax: "Impuesto",
6296
6308
  removeCoupon: "ELIMINAR",
6297
6309
  firstName: "Nombre",
@@ -6938,12 +6950,16 @@ var invoiceDetails_es = {
6938
6950
  var labels$2 = {
6939
6951
  title: "Cancelar suscripción",
6940
6952
  cancelReason: "Razón de la cancelación",
6953
+ endOn: "Fin de",
6954
+ endImmediately: "Fin inmediato",
6955
+ cancel: "Cancelar",
6941
6956
  subCancellation: {
6942
6957
  goBack: "Volver"
6943
6958
  }
6944
6959
  };
6945
6960
  var messages$1 = {
6946
6961
  subscriptionEnd: "Esta suscripción expirará el",
6962
+ cancelWhen: "¿Cuándo desea cancelar?",
6947
6963
  cancelNow: "Cancelar Suscripción Ahora",
6948
6964
  cancelLater: "Cancelar al Final del Periodo",
6949
6965
  subCancellation: {
@@ -8381,7 +8397,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
8381
8397
  OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
8382
8398
  OutboundLink$1.trackLink = outboundLink;
8383
8399
  var OutboundLink = OutboundLink$1;
8384
- var ReactGA1 = _objectSpread({}, Defaults, {
8400
+ var ReactGA = _objectSpread({}, Defaults, {
8385
8401
  OutboundLink: OutboundLink
8386
8402
  });
8387
8403
 
@@ -8920,8 +8936,6 @@ exports["default"] = _default;
8920
8936
  var ReactGA4 = unwrapExports(dist);
8921
8937
  dist.ReactGAImplementation;
8922
8938
 
8923
- var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
8924
- 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;
8925
8939
  class PelcroActions {
8926
8940
  constructor(storeSetter, storeGetter) {
8927
8941
  var _this = this;
@@ -9101,23 +9115,31 @@ class PelcroActions {
9101
9115
  });
9102
9116
  });
9103
9117
  _defineProperty$3(this, "logout", function () {
9104
- var _ReactGA$event;
9118
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
9105
9119
  let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
9106
9120
  const {
9107
9121
  switchView,
9108
9122
  resetView,
9109
9123
  isAuthenticated
9110
9124
  } = _this.get();
9125
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
9111
9126
  // if user is not authenticated function execution is terminated
9112
9127
  if (!isAuthenticated()) {
9113
9128
  return console.warn("You are already logged out.");
9114
9129
  }
9115
9130
  window.Pelcro.user.logout();
9116
- 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, {
9117
- category: "ACTIONS",
9118
- action: "Logged out",
9119
- nonInteraction: true
9120
- });
9131
+ if (enableReactGA4) {
9132
+ ReactGA4.event("Logged out", {
9133
+ nonInteraction: true
9134
+ });
9135
+ } else {
9136
+ var _ReactGA$event;
9137
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9138
+ category: "ACTIONS",
9139
+ action: "Logged out",
9140
+ nonInteraction: true
9141
+ });
9142
+ }
9121
9143
  resetView();
9122
9144
  if (displayLogin) {
9123
9145
  switchView("login");
@@ -9130,7 +9152,7 @@ class PelcroActions {
9130
9152
  return false;
9131
9153
  }
9132
9154
 
9133
- //Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9155
+ // Dispatch PelcroElementsCartItemAdded when an item added successfully to the
9134
9156
  document.dispatchEvent(cartItemAdded(itemToAdd));
9135
9157
  const {
9136
9158
  cartItems
@@ -9342,9 +9364,6 @@ if (process.env.NODE_ENV === "development") {
9342
9364
  c$1("Pelcro Store", usePelcro);
9343
9365
  }
9344
9366
 
9345
- var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
9346
- 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;
9347
-
9348
9367
  /**
9349
9368
  * List of zero-decimal currencies.
9350
9369
  * @see https://stripe.com/docs/currencies#zero-decimal
@@ -9430,8 +9449,8 @@ const getLanguageWithoutRegion = localeName => {
9430
9449
  * @return {string | undefined}
9431
9450
  */
9432
9451
  const getPageOrDefaultLanguage = () => {
9433
- var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
9434
- return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : (_window$Pelcro2$site$ = _window$Pelcro2$site.read) === null || _window$Pelcro2$site$ === void 0 ? void 0 : (_window$Pelcro2$site$2 = _window$Pelcro2$site$.call(_window$Pelcro2$site)) === null || _window$Pelcro2$site$2 === void 0 ? void 0 : _window$Pelcro2$site$2.default_locale);
9452
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
9453
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
9435
9454
  };
9436
9455
 
9437
9456
  /**
@@ -9484,9 +9503,9 @@ const isValidViewFromURL = viewID => {
9484
9503
  *
9485
9504
  */
9486
9505
  function hasValidNewsletterUpdateUrl() {
9487
- var _window$Pelcro3, _window$Pelcro3$uiSet;
9506
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
9488
9507
  if (viewID !== "newsletter-update") return false;
9489
- const newsletters = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.newsletters;
9508
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
9490
9509
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
9491
9510
  if (!siteHasNewslettersDefined) {
9492
9511
  return false;
@@ -9532,7 +9551,7 @@ const disableScroll = () => {
9532
9551
  }
9533
9552
  };
9534
9553
  const trackSubscriptionOnGA = () => {
9535
- 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;
9554
+ var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
9536
9555
  const {
9537
9556
  product,
9538
9557
  plan,
@@ -9547,33 +9566,56 @@ const trackSubscriptionOnGA = () => {
9547
9566
  invoices
9548
9567
  } = window.Pelcro.user.read();
9549
9568
  const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
9569
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro3 = _window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.enableReactGA4;
9550
9570
  if (!lastSubscriptionId) {
9551
9571
  return;
9552
9572
  }
9553
9573
  const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
9554
- 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, {
9555
- currencyCode: currencyCode
9556
- });
9557
- 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", {
9558
- id: lastSubscriptionId,
9559
- affiliation: "Pelcro",
9560
- revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9561
- coupon: couponCode
9562
- });
9563
- 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", {
9564
- id: lastSubscriptionId,
9565
- name: product.name,
9566
- category: product.description,
9567
- variant: plan.nickname,
9568
- price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9569
- quantity: 1
9570
- });
9571
- 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");
9572
- 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, {
9573
- category: "ACTIONS",
9574
- action: "Subscribed",
9575
- nonInteraction: true
9576
- });
9574
+ if (enableReactGA4) {
9575
+ ReactGA4.event("purchase", {
9576
+ transaction_id: lastSubscriptionId,
9577
+ affiliation: "Pelcro",
9578
+ currency: currencyCode,
9579
+ value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9580
+ coupon: couponCode,
9581
+ items: [{
9582
+ item_id: lastSubscriptionId,
9583
+ item_name: product.name,
9584
+ item_category: product.description,
9585
+ item_variant: plan.nickname,
9586
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9587
+ quantity: 1
9588
+ }]
9589
+ });
9590
+ ReactGA4.event("Subscribed", {
9591
+ nonInteraction: true
9592
+ });
9593
+ } else {
9594
+ var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
9595
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
9596
+ currencyCode: currencyCode
9597
+ });
9598
+ 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", {
9599
+ id: lastSubscriptionId,
9600
+ affiliation: "Pelcro",
9601
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9602
+ coupon: couponCode
9603
+ });
9604
+ 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", {
9605
+ id: lastSubscriptionId,
9606
+ name: product.name,
9607
+ category: product.description,
9608
+ variant: plan.nickname,
9609
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
9610
+ quantity: 1
9611
+ });
9612
+ 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");
9613
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
9614
+ category: "ACTIONS",
9615
+ action: "Subscribed",
9616
+ nonInteraction: true
9617
+ });
9618
+ }
9577
9619
  };
9578
9620
 
9579
9621
  /** check wether or not the user have any existing payment method
@@ -9657,14 +9699,14 @@ function getDateWithoutTime(dateObject) {
9657
9699
  return date;
9658
9700
  }
9659
9701
  function userMustVerifyEmail() {
9660
- var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9661
- const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
9702
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
9703
+ const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
9662
9704
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
9663
9705
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9664
9706
  }
9665
9707
  function notifyBugsnag(callback, startOptions) {
9666
9708
  if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9667
- //load bugsnag CDN
9709
+ // load bugsnag CDN
9668
9710
  window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9669
9711
  document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9670
9712
  var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
@@ -10027,10 +10069,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
10027
10069
  return descriptor.value;
10028
10070
  }
10029
10071
 
10030
- var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
10031
10072
  function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
10032
10073
  function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
10033
- 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;
10034
10074
  var _isAlreadySaved = /*#__PURE__*/new WeakMap();
10035
10075
  var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
10036
10076
  var _removeLoadingState = /*#__PURE__*/new WeakMap();
@@ -10114,7 +10154,7 @@ class SaveToMetadataButtonClass {
10114
10154
  _classPrivateFieldInitSpec$2(this, _saveToMetadata, {
10115
10155
  writable: true,
10116
10156
  value: event => {
10117
- var _user$metadata;
10157
+ var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
10118
10158
  const button = event.currentTarget;
10119
10159
  const user = window.Pelcro.user.read();
10120
10160
  const {
@@ -10124,6 +10164,7 @@ class SaveToMetadataButtonClass {
10124
10164
  key,
10125
10165
  ...buttonMetadata
10126
10166
  } = button.dataset;
10167
+ const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
10127
10168
  if (userMustVerifyEmail()) {
10128
10169
  return switchView("email-verify");
10129
10170
  }
@@ -10148,16 +10189,22 @@ class SaveToMetadataButtonClass {
10148
10189
  value: newMetadataValue,
10149
10190
  auth_token: window.Pelcro.user.read().auth_token
10150
10191
  }, (err, resp) => {
10151
- var _ReactGA$event;
10152
10192
  if (err) {
10153
10193
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10154
10194
  }
10155
10195
  _classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
10156
- 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, {
10157
- category: "ACTIONS",
10158
- action: "Save/Follow",
10159
- label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10160
- });
10196
+ if (enableReactGA4) {
10197
+ ReactGA4.event("Save/Follow", {
10198
+ event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10199
+ });
10200
+ } else {
10201
+ var _ReactGA$event;
10202
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
10203
+ category: "ACTIONS",
10204
+ action: "Save/Follow",
10205
+ label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
10206
+ });
10207
+ }
10161
10208
  });
10162
10209
  }
10163
10210
  }
@@ -10165,6 +10212,7 @@ class SaveToMetadataButtonClass {
10165
10212
  _classPrivateFieldInitSpec$2(this, _removeMetaData, {
10166
10213
  writable: true,
10167
10214
  value: event => {
10215
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
10168
10216
  const button = event.currentTarget;
10169
10217
  const user = window.Pelcro.user.read();
10170
10218
  const {
@@ -10172,6 +10220,7 @@ class SaveToMetadataButtonClass {
10172
10220
  title
10173
10221
  } = button.dataset;
10174
10222
  const oldValue = user.metadata[`metadata_saved_${key}`];
10223
+ const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
10175
10224
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
10176
10225
  if (window.Pelcro.user.isAuthenticated()) {
10177
10226
  _classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
@@ -10180,16 +10229,22 @@ class SaveToMetadataButtonClass {
10180
10229
  value: newMetadataValue,
10181
10230
  auth_token: window.Pelcro.user.read().auth_token
10182
10231
  }, (err, resp) => {
10183
- var _ReactGA$event2;
10184
10232
  if (err) {
10185
10233
  return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
10186
10234
  }
10187
10235
  _classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
10188
- 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, {
10189
- category: "ACTIONS",
10190
- action: "Unsave/Unfollow",
10191
- label: title
10192
- });
10236
+ if (enableReactGA4) {
10237
+ ReactGA4.event("Unsave/Unfollow", {
10238
+ event_label: title
10239
+ });
10240
+ } else {
10241
+ var _ReactGA$event2;
10242
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
10243
+ category: "ACTIONS",
10244
+ action: "Unsave/Unfollow",
10245
+ label: title
10246
+ });
10247
+ }
10193
10248
  });
10194
10249
  }
10195
10250
  }
@@ -11712,9 +11767,6 @@ function getSiteCardProcessor() {
11712
11767
  return "stripe";
11713
11768
  }
11714
11769
 
11715
- var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
11716
- 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;
11717
-
11718
11770
  /**
11719
11771
  * @typedef {Object} OptionsType
11720
11772
  * @property {boolean} loadPaymentSDKs
@@ -11766,21 +11818,31 @@ const initPaywalls = () => {
11766
11818
  return;
11767
11819
  }
11768
11820
  const {
11769
- switchView
11821
+ switchView,
11822
+ isAuthenticated
11770
11823
  } = usePelcro.getStore();
11771
- if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11772
- /*
11773
- showing both the meter and the entitlements notification doesn't make sense from
11774
- a product prespective + they would take half the screen on mobile devies, so we're
11775
- not showing the meter, and only showing the entitlements notification.
11776
- */
11777
- if (!didBlurContent) {
11778
- switchView("meter");
11824
+ function displayPaywalls() {
11825
+ if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11826
+ /*
11827
+ showing both the meter and the entitlements notification doesn't make sense from
11828
+ a product prespective + they would take half the screen on mobile devies, so we're
11829
+ not showing the meter, and only showing the entitlements notification.
11830
+ */
11831
+ if (!didBlurContent) {
11832
+ switchView("meter");
11833
+ }
11834
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11835
+ switchView("newsletter");
11836
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11837
+ switchView("plan-select");
11779
11838
  }
11780
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11781
- switchView("newsletter");
11782
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11783
- switchView("plan-select");
11839
+ }
11840
+ if (isAuthenticated()) {
11841
+ addEventListener("PelcroUserLoaded", function () {
11842
+ displayPaywalls();
11843
+ });
11844
+ } else {
11845
+ displayPaywalls();
11784
11846
  }
11785
11847
  }
11786
11848
  };
@@ -11792,6 +11854,7 @@ const loadPaymentSDKs = () => {
11792
11854
  if (!window.Stripe && !supportsVantiv && !supportsTap) {
11793
11855
  pure_1(window.Pelcro.environment.stripe);
11794
11856
  }
11857
+ window.Pelcro.helpers.loadSDK("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js", "apple-pay-sdk");
11795
11858
 
11796
11859
  // Load PayPal SDKs
11797
11860
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
@@ -11805,6 +11868,8 @@ const loadPaymentSDKs = () => {
11805
11868
  if (!window.jQuery) {
11806
11869
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
11807
11870
  }
11871
+ window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
11872
+ window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js", "vantiv-eprotect-api");
11808
11873
  if (!window.EprotectIframeClient) {
11809
11874
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
11810
11875
  const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
@@ -11837,17 +11902,44 @@ const initSecuritySdk = () => {
11837
11902
  });
11838
11903
  };
11839
11904
  const initGATracking = () => {
11840
- var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11841
- 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);
11842
- 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");
11905
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
11906
+ 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;
11907
+ if (window.Pelcro.site.read().google_analytics_id) {
11908
+ if (enableReactGA4) {
11909
+ // Initialize ReactGA4 with your tracking ID
11910
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
11911
+ // Enable e-commerce tracking
11912
+ ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
11913
+ gaOptions: {
11914
+ send_page_view: true,
11915
+ ecommerce: {
11916
+ enabled: true
11917
+ }
11918
+ }
11919
+ });
11920
+ } else {
11921
+ var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
11922
+ 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);
11923
+ 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");
11924
+ }
11925
+ }
11843
11926
  };
11844
11927
  const dispatchModalDisplayEvents = modalName => {
11845
- var _ReactGA$event, _modalName$replace, _modalName$replace2;
11846
- 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, {
11847
- category: "VIEWS",
11848
- action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
11849
- nonInteraction: true
11850
- });
11928
+ var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
11929
+ 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;
11930
+ const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
11931
+ if (enableReactGA4) {
11932
+ ReactGA4.event(`${formattedAction} viewed`, {
11933
+ nonInteraction: true
11934
+ });
11935
+ } else {
11936
+ var _ReactGA$event;
11937
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
11938
+ category: "VIEWS",
11939
+ action: `${formattedAction} viewed`,
11940
+ nonInteraction: true
11941
+ });
11942
+ }
11851
11943
  window.Pelcro.insight.track("Modal Displayed", {
11852
11944
  name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
11853
11945
  });
@@ -12649,6 +12741,7 @@ const LOADING = "LOADING";
12649
12741
  const SUBMIT_PAYMENT = "SUBMIT_PAYMENT";
12650
12742
  const SUBSCRIBE = "CREATE_SUBSCRIPTION";
12651
12743
  const HANDLE_PAYPAL_SUBSCRIPTION = "HANDLE_PAYPAL_SUBSCRIPTION";
12744
+ const HANDLE_APPLEPAY_SUBSCRIPTION = "HANDLE_APPLEPAY_SUBSCRIPTION";
12652
12745
  const DISABLE_COUPON_BUTTON = "DISABLE_COUPON_BUTTON";
12653
12746
  const APPLY_COUPON_CODE = "APPLY_COUPON_CODE";
12654
12747
  const REMOVE_APPLIED_COUPON = "REMOVE_APPLIED_COUPON";
@@ -12710,6 +12803,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
12710
12803
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
12711
12804
  const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
12712
12805
  const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
12806
+ const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
12713
12807
  const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
12714
12808
  const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
12715
12809
  const SET_EMAILS = "SET_EMAILS";
@@ -12740,6 +12834,7 @@ const {
12740
12834
  Provider: Provider$m
12741
12835
  } = store$m;
12742
12836
  const LoginContainer = _ref => {
12837
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
12743
12838
  let {
12744
12839
  style,
12745
12840
  className = "",
@@ -12747,6 +12842,7 @@ const LoginContainer = _ref => {
12747
12842
  onFailure = () => {},
12748
12843
  children
12749
12844
  } = _ref;
12845
+ 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;
12750
12846
  const handleLogin = (_ref2, dispatch) => {
12751
12847
  let {
12752
12848
  email,
@@ -12776,13 +12872,19 @@ const LoginContainer = _ref => {
12776
12872
  });
12777
12873
  onFailure(err);
12778
12874
  } else {
12779
- var _ReactGA$event;
12780
12875
  onSuccess(res);
12781
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
12782
- category: "ACTIONS",
12783
- action: "Logged in",
12784
- nonInteraction: true
12785
- });
12876
+ if (enableReactGA4) {
12877
+ ReactGA4.event("Logged in", {
12878
+ nonInteraction: true
12879
+ });
12880
+ } else {
12881
+ var _ReactGA$event;
12882
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
12883
+ category: "ACTIONS",
12884
+ action: "Logged in",
12885
+ nonInteraction: true
12886
+ });
12887
+ }
12786
12888
  }
12787
12889
  });
12788
12890
  };
@@ -13168,17 +13270,23 @@ function ConfirmPassword(_ref) {
13168
13270
  }, otherProps));
13169
13271
  }
13170
13272
 
13171
- var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
13172
- 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;
13173
13273
  const Logout = props => {
13174
13274
  const handleLogout = () => {
13175
- var _ReactGA$event;
13275
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
13176
13276
  window.Pelcro.user.logout();
13177
- 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, {
13178
- category: "ACTIONS",
13179
- action: "Logged out",
13180
- nonInteraction: true
13181
- });
13277
+ 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;
13278
+ if (enableReactGA4) {
13279
+ ReactGA4.event("Logged out", {
13280
+ nonInteraction: true
13281
+ });
13282
+ } else {
13283
+ var _ReactGA$event;
13284
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
13285
+ category: "ACTIONS",
13286
+ action: "Logged out",
13287
+ nonInteraction: true
13288
+ });
13289
+ }
13182
13290
  };
13183
13291
  return /*#__PURE__*/React__default.createElement("button", {
13184
13292
  name: "logout",
@@ -14736,13 +14844,11 @@ const RegisterCompany = props => {
14736
14844
  }, props));
14737
14845
  };
14738
14846
 
14739
- var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
14740
- 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;
14741
-
14742
14847
  /**
14743
14848
  *
14744
14849
  */
14745
14850
  function RegisterModal(props) {
14851
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
14746
14852
  const {
14747
14853
  t
14748
14854
  } = useTranslation("register");
@@ -14757,18 +14863,26 @@ function RegisterModal(props) {
14757
14863
  giftCode,
14758
14864
  isGift
14759
14865
  } = usePelcro();
14866
+ 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;
14760
14867
  const onSuccess = res => {
14761
14868
  var _props$onSuccess;
14762
14869
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
14763
14870
  handleAfterRegistrationLogic();
14764
14871
  };
14765
14872
  const handleAfterRegistrationLogic = () => {
14766
- var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
14767
- 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, {
14768
- category: "ACTIONS",
14769
- action: "Registered",
14770
- nonInteraction: true
14771
- });
14873
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
14874
+ if (enableReactGA4) {
14875
+ ReactGA4.event("Registered", {
14876
+ nonInteraction: true
14877
+ });
14878
+ } else {
14879
+ var _ReactGA$event;
14880
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
14881
+ category: "ACTIONS",
14882
+ action: "Registered",
14883
+ nonInteraction: true
14884
+ });
14885
+ }
14772
14886
  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;
14773
14887
  if (isEmailVerificationEnabled) {
14774
14888
  return switchView("email-verify");
@@ -14855,9 +14969,6 @@ function Radio(_ref) {
14855
14969
  }, children));
14856
14970
  }
14857
14971
 
14858
- var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
14859
- 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;
14860
-
14861
14972
  /**
14862
14973
  *
14863
14974
  */
@@ -14917,6 +15028,7 @@ function productMatchPageLanguage(product) {
14917
15028
  SelectModalWithHook.viewId = "plan-select";
14918
15029
  class SelectModal extends Component {
14919
15030
  constructor(props) {
15031
+ var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
14920
15032
  super(props);
14921
15033
  _defineProperty$3(this, "componentDidMount", () => {
14922
15034
  if (this.props.product) {
@@ -14951,11 +15063,11 @@ class SelectModal extends Component {
14951
15063
  }
14952
15064
  document.addEventListener("keydown", this.handleSubmit);
14953
15065
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
14954
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$site;
14955
- 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;
14956
- 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;
14957
- 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;
14958
- 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 => {
15066
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
15067
+ 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;
15068
+ 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;
15069
+ 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;
15070
+ 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 => {
14959
15071
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14960
15072
  if (filteredPlans.length) return filteredPlans;
14961
15073
  });
@@ -14968,12 +15080,12 @@ class SelectModal extends Component {
14968
15080
  });
14969
15081
  notifyBugsnag(() => {
14970
15082
  Bugsnag.notify("SelectModal - No data viewed", event => {
14971
- 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;
15083
+ 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;
14972
15084
  event.addMetadata("MetaData", {
14973
- 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(),
14974
- 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(),
14975
- 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,
14976
- environment: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : _window$Pelcro9.environment,
15085
+ 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(),
15086
+ 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(),
15087
+ 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,
15088
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
14977
15089
  matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
14978
15090
  productListState: this.state.productList,
14979
15091
  methods: {
@@ -14984,8 +15096,8 @@ class SelectModal extends Component {
14984
15096
  userCurrency: userCurrency,
14985
15097
  userCountry: userCountry,
14986
15098
  userLanguage: userLanguage,
14987
- 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(),
14988
- 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,
15099
+ 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(),
15100
+ 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,
14989
15101
  currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14990
15102
  country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14991
15103
  language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
@@ -15024,7 +15136,7 @@ class SelectModal extends Component {
15024
15136
  startingPlan = plan;
15025
15137
  }
15026
15138
  }
15027
- return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval}s` : `${startingPlan.interval}`}`;
15139
+ return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
15028
15140
  });
15029
15141
  _defineProperty$3(this, "renderOneProduct", (product, index, options) => {
15030
15142
  const isPlanMode = Boolean(this.state.mode === "plan");
@@ -15197,6 +15309,7 @@ class SelectModal extends Component {
15197
15309
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
15198
15310
  this.locale = this.props.t;
15199
15311
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
15312
+ 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;
15200
15313
  }
15201
15314
  render() {
15202
15315
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
@@ -15204,19 +15317,31 @@ class SelectModal extends Component {
15204
15317
  disableGifting
15205
15318
  } = this.props;
15206
15319
  if (this.state.mode === "product") {
15207
- var _ReactGA$event;
15208
- 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, {
15209
- category: "VIEWS",
15210
- action: "Product Modal Viewed",
15211
- nonInteraction: true
15212
- });
15320
+ if (this.enableReactGA4) {
15321
+ ReactGA4.event("Product Modal Viewed", {
15322
+ nonInteraction: true
15323
+ });
15324
+ } else {
15325
+ var _ReactGA$event;
15326
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15327
+ category: "VIEWS",
15328
+ action: "Product Modal Viewed",
15329
+ nonInteraction: true
15330
+ });
15331
+ }
15213
15332
  } else if (this.state.mode === "plan") {
15214
- var _ReactGA$event2;
15215
- 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, {
15216
- category: "VIEWS",
15217
- action: "Plan Modal Viewed",
15218
- nonInteraction: true
15219
- });
15333
+ if (this.enableReactGA4) {
15334
+ ReactGA4.event("Plan Modal Viewed", {
15335
+ nonInteraction: true
15336
+ });
15337
+ } else {
15338
+ var _ReactGA$event2;
15339
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15340
+ category: "VIEWS",
15341
+ action: "Plan Modal Viewed",
15342
+ nonInteraction: true
15343
+ });
15344
+ }
15220
15345
  }
15221
15346
  return /*#__PURE__*/React__default.createElement(Modal, {
15222
15347
  hideCloseButton: !this.closeButton,
@@ -15647,14 +15772,14 @@ class DonationModal extends Component {
15647
15772
  this.props;
15648
15773
  if (this.state.mode === "product") {
15649
15774
  var _ReactGA$event;
15650
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
15775
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
15651
15776
  category: "VIEWS",
15652
15777
  action: "Product Modal Viewed",
15653
15778
  nonInteraction: true
15654
15779
  });
15655
15780
  } else if (this.state.mode === "plan") {
15656
15781
  var _ReactGA$event2;
15657
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA1.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA1, {
15782
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
15658
15783
  category: "VIEWS",
15659
15784
  action: "Plan Modal Viewed",
15660
15785
  nonInteraction: true
@@ -17991,7 +18116,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17991
18116
  });
17992
18117
  };
17993
18118
 
17994
- /*====== Start Cybersource integration ========*/
18119
+ /* ====== Start Cybersource integration ======== */
17995
18120
  const cybersourceErrorHandle = err => {
17996
18121
  var _err$details, _err$details$response, _err$details$response2;
17997
18122
  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) {
@@ -18260,9 +18385,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18260
18385
  });
18261
18386
  };
18262
18387
 
18263
- /*====== End Cybersource integration ========*/
18388
+ /* ====== End Cybersource integration ======== */
18264
18389
 
18265
- /*====== Start Tap integration ========*/
18390
+ /* ====== Start Tap integration ======== */
18266
18391
  const submitUsingTap = state => {
18267
18392
  var _ref4, _ref5, _getPlanAmount;
18268
18393
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18534,28 +18659,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18534
18659
  cardHolder: "Card Holder Name"
18535
18660
  };
18536
18661
 
18537
- //payment options
18662
+ // payment options
18538
18663
  let paymentOptions = {
18539
18664
  labels: labels,
18540
18665
  TextDirection: "ltr"
18541
18666
  };
18542
18667
 
18543
- //create element, pass style and payment options
18668
+ // create element, pass style and payment options
18544
18669
  let card = elements.create("card", {
18545
18670
  style: style
18546
18671
  }, paymentOptions);
18547
18672
 
18548
- //mount element
18673
+ // mount element
18549
18674
  card.mount("#tapPaymentIframe");
18550
18675
 
18551
- //card change event listener
18676
+ // card change event listener
18552
18677
  card.addEventListener("change", function (event) {
18553
- //If needed
18678
+ // If needed
18554
18679
  });
18555
18680
  tapInstanceRef.current = tapKey;
18556
18681
  tapInstanceCard.current = card;
18557
18682
  };
18558
- /*====== End Tap integration ========*/
18683
+ /* ====== End Tap integration ======== */
18559
18684
 
18560
18685
  const submitUsingVantiv = state => {
18561
18686
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
@@ -18743,7 +18868,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18743
18868
  }
18744
18869
  }, [selectedPaymentMethodId]);
18745
18870
 
18746
- //Trigger the handleVantivPayment method when a vantivePaymentRequest is present
18871
+ // Trigger the handleVantivPayment method when a vantivPaymentRequest is present
18747
18872
  useEffect(() => {
18748
18873
  if (vantivPaymentRequest) {
18749
18874
  handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
@@ -18903,7 +19028,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18903
19028
  if (err) {
18904
19029
  onFailure(err);
18905
19030
 
18906
- //reset the coupon code in local state
19031
+ // reset the coupon code in local state
18907
19032
  setUpdatedCouponCode("");
18908
19033
  dispatch({
18909
19034
  type: SET_COUPON_ERROR,
@@ -18964,7 +19089,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18964
19089
  payload: res.data.coupon
18965
19090
  });
18966
19091
 
18967
- //set the coupon code in local state to be able to use with Vantiv
19092
+ // set the coupon code in local state to be able to use with Vantiv
18968
19093
  setUpdatedCouponCode(res.data.coupon.code);
18969
19094
  dispatch({
18970
19095
  type: SET_PERCENT_OFF,
@@ -19037,7 +19162,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19037
19162
  const removeAppliedCoupon = state => {
19038
19163
  state.couponCode = "";
19039
19164
 
19040
- //reset the coupon code in local state
19165
+ // reset the coupon code in local state
19041
19166
  setUpdatedCouponCode("");
19042
19167
  dispatch({
19043
19168
  type: SET_COUPON_ERROR,
@@ -19858,6 +19983,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19858
19983
  handlePaypalSubscription(state, action.payload);
19859
19984
  }
19860
19985
  });
19986
+ case HANDLE_APPLEPAY_SUBSCRIPTION:
19987
+ return lib_5(state, (state, dispatch) => {
19988
+ setVantivPaymentRequest(action.payload);
19989
+ });
19861
19990
  case SET_UPDATED_PRICE:
19862
19991
  return lib_7({
19863
19992
  ...state,
@@ -20999,6 +21128,290 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
20999
21128
  store: store$k
21000
21129
  }, props));
21001
21130
 
21131
+ /* eslint-disable no-undef */
21132
+
21133
+ /**
21134
+ * ApplePayButton component
21135
+ * @return {JSX}
21136
+ */
21137
+ const ApplePayButton = _ref => {
21138
+ var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
21139
+ let {
21140
+ onClick,
21141
+ props,
21142
+ ...otherProps
21143
+ } = _ref;
21144
+ const {
21145
+ dispatch,
21146
+ state
21147
+ } = useContext(store$k);
21148
+ const {
21149
+ plan,
21150
+ invoice
21151
+ } = usePelcro();
21152
+ const {
21153
+ pay_page_id: payPageId,
21154
+ report_group: reportGroup,
21155
+ apple_pay_merchant_id: ApplePayMerchantId,
21156
+ apple_pay_enabled: ApplePayEnabled
21157
+ } = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
21158
+ 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;
21159
+ useEffect(() => {
21160
+ if (window.ApplePaySession) {
21161
+ // Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
21162
+ const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
21163
+ promise.then(function (canMakePayments) {
21164
+ if (canMakePayments && ApplePayEnabled) {
21165
+ // Display Apple Pay Buttons here…
21166
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21167
+ if (pelcroApplyPayButton) {
21168
+ pelcroApplyPayButton.style.display = "block";
21169
+ }
21170
+ console.log("canMakePayments", canMakePayments);
21171
+ }
21172
+ });
21173
+ } else {
21174
+ console.error("ApplePay is not available on this browser");
21175
+ }
21176
+ }, []);
21177
+ function onApplePayButtonClicked() {
21178
+ var _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$l;
21179
+ if (!ApplePaySession) {
21180
+ return;
21181
+ }
21182
+ dispatch({
21183
+ type: DISABLE_SUBMIT,
21184
+ payload: true
21185
+ });
21186
+
21187
+ // Define ApplePayPaymentRequest
21188
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
21189
+ const ApplePayPaymentRequest = {
21190
+ 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",
21191
+ currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
21192
+ merchantCapabilities: ["supports3DS"],
21193
+ supportedNetworks: ["visa", "masterCard", "amex", "discover"],
21194
+ total: {
21195
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21196
+ type: "final",
21197
+ amount: updatedPrice / 100
21198
+ }
21199
+ };
21200
+ console.log(ApplePayPaymentRequest);
21201
+ // Create ApplePaySession
21202
+ // @todo - Clarify supported version parameter
21203
+ // @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
21204
+ const session = new ApplePaySession(3, ApplePayPaymentRequest);
21205
+
21206
+ // @todo - Detect whether web browser supports a particular Apple Pay version.
21207
+ // @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778014-supportsversion
21208
+
21209
+ session.onvalidatemerchant = async event => {
21210
+ const {
21211
+ validationURL
21212
+ } = event;
21213
+ console.log("then merchantSession step", event);
21214
+ // Call your own server to request a new merchant session.
21215
+ window.Pelcro.payment.startSession({
21216
+ auth_token: window.Pelcro.user.read().auth_token,
21217
+ site_id: window.Pelcro.siteid,
21218
+ validation_url: validationURL
21219
+ }, (err, res) => {
21220
+ if (err) {
21221
+ // Handle any errors during merchant validation
21222
+ console.error("Merchant validation SDK error: ", err);
21223
+ session.abort();
21224
+ return dispatch({
21225
+ type: SHOW_ALERT,
21226
+ payload: {
21227
+ type: "error",
21228
+ content: getErrorMessages(err)
21229
+ }
21230
+ });
21231
+ }
21232
+ // Complete merchant validation with the merchant session object
21233
+ console.log("Merchant validation SDK response: ", res);
21234
+ const merchantSession = res;
21235
+ session.completeMerchantValidation(merchantSession);
21236
+ });
21237
+ };
21238
+ session.onpaymentmethodselected = event => {
21239
+ console.log("payment method selected step", event);
21240
+ // Define ApplePayPaymentMethodUpdate based on the selected payment method.
21241
+ // No updates or errors are needed, pass an empty object.
21242
+ const newTotal = {
21243
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21244
+ type: "final",
21245
+ amount: updatedPrice / 100
21246
+ };
21247
+ const newLineItems = [{
21248
+ label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
21249
+ type: "final",
21250
+ amount: updatedPrice / 100
21251
+ }];
21252
+ session.completePaymentMethodSelection(newTotal, newLineItems);
21253
+ };
21254
+
21255
+ // TODO: Check if onshippingmethodselected it should be implemented
21256
+ // session.onshippingmethodselected = (event) => {
21257
+ // console.log("on shipping method selected step", event);
21258
+ // // Define ApplePayShippingMethodUpdate based on the selected shipping method.
21259
+ // // No updates or errors are needed, pass an empty object.
21260
+ // const newTotal = {
21261
+ // label: plan?.nickname || `invoice #${invoice.id}`,
21262
+ // type: "final",
21263
+ // amount: updatedPrice / 100
21264
+ // };
21265
+
21266
+ // const newLineItems = [
21267
+ // {
21268
+ // label: plan?.nickname || `invoice #${invoice.id}`,
21269
+ // type: "final",
21270
+ // amount: updatedPrice / 100
21271
+ // }
21272
+ // ];
21273
+
21274
+ // session.completeShippingMethodSelection(newTotal, newLineItems);
21275
+ // };
21276
+
21277
+ // TODO: Check if onshippingcontactselected it should be implemented
21278
+ // session.onshippingcontactselected = (event) => {
21279
+ // console.log("on shipping contact selected step", event);
21280
+ // // Define ApplePayShippingContactUpdate based on the selected shipping contact.
21281
+ // const update = {};
21282
+ // session.completeShippingContactSelection(update);
21283
+ // };
21284
+
21285
+ session.onpaymentauthorized = event => {
21286
+ console.log("on payment authorized step", event);
21287
+ // Define ApplePayPaymentAuthorizationResult
21288
+ const result = {
21289
+ status: ApplePaySession.STATUS_SUCCESS
21290
+ };
21291
+ const {
21292
+ paymentData
21293
+ } = event.payment.token;
21294
+ const {
21295
+ data,
21296
+ signature,
21297
+ version
21298
+ } = paymentData;
21299
+ const {
21300
+ ephemeralPublicKey,
21301
+ publicKeyHash,
21302
+ transactionId
21303
+ } = paymentData.header;
21304
+ const applePayToken = {
21305
+ data: data,
21306
+ signature: signature,
21307
+ version: version,
21308
+ header: {
21309
+ ephemeralPublicKey: ephemeralPublicKey,
21310
+ publicKeyHash: publicKeyHash,
21311
+ transactionId: transactionId
21312
+ }
21313
+ };
21314
+ console.log(applePayToken);
21315
+ const orderId = `pelcro-${new Date().getTime()}`;
21316
+ const eProtectRequest = {
21317
+ paypageId: payPageId,
21318
+ reportGroup: reportGroup,
21319
+ orderId: orderId,
21320
+ id: orderId,
21321
+ applepay: applePayToken,
21322
+ url: "https://request.eprotect.vantivprelive.com"
21323
+ };
21324
+
21325
+ // successCallback function to handle the response from WorldPay.
21326
+ function successCallback(vantivResponse) {
21327
+ const {
21328
+ expDate
21329
+ } = vantivResponse;
21330
+ console.log("Response:", vantivResponse);
21331
+ const expMonth = expDate.substring(0, 2);
21332
+ const expYear = expDate.substring(2);
21333
+ const vantivPaymentRequest = {
21334
+ ...vantivResponse,
21335
+ expMonth: expMonth,
21336
+ expYear: expYear
21337
+ };
21338
+
21339
+ // Process the registrationId or continue with further payment processing.
21340
+ dispatch({
21341
+ type: HANDLE_APPLEPAY_SUBSCRIPTION,
21342
+ payload: vantivPaymentRequest
21343
+ });
21344
+ dispatch({
21345
+ type: LOADING,
21346
+ payload: true
21347
+ });
21348
+ session.completePayment(result);
21349
+ }
21350
+
21351
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21352
+ function errorCallback(error) {
21353
+ console.error("Error retrieving Registration ID:", error);
21354
+ // Handle error appropriately.
21355
+ }
21356
+ // errorCallback function to handle any errors that may occur during the tokenization process.
21357
+ function timeoutCallback() {
21358
+ console.error("eProtect Timeout");
21359
+ // Handle error appropriately.
21360
+ }
21361
+
21362
+ new eProtect().sendToEprotect(eProtectRequest, {}, successCallback, errorCallback, timeoutCallback, 15000);
21363
+ };
21364
+
21365
+ // TODO: Check if oncouponcodechanged it should be implemented
21366
+ // session.oncouponcodechanged = (event) => {
21367
+ // console.log("on coupon code changed step", event);
21368
+ // // Define ApplePayCouponCodeUpdate
21369
+ // const newTotal = calculateNewTotal(event.couponCode);
21370
+ // const newLineItems = calculateNewLineItems(event.couponCode);
21371
+ // const newShippingMethods = calculateNewShippingMethods(
21372
+ // event.couponCode
21373
+ // );
21374
+ // const errors = calculateErrors(event.couponCode);
21375
+
21376
+ // session.completeCouponCodeChange({
21377
+ // newTotal: newTotal,
21378
+ // newLineItems: newLineItems,
21379
+ // newShippingMethods: newShippingMethods,
21380
+ // errors: errors
21381
+ // });
21382
+ // };
21383
+
21384
+ session.oncancel = event => {
21385
+ // Payment cancelled by WebKit
21386
+ console.log("on cancel step", event);
21387
+ dispatch({
21388
+ type: LOADING,
21389
+ payload: false
21390
+ });
21391
+ dispatch({
21392
+ type: DISABLE_SUBMIT,
21393
+ payload: false
21394
+ });
21395
+ };
21396
+ session.begin();
21397
+ }
21398
+ useEffect(() => {
21399
+ const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
21400
+ if (pelcroApplyPayButton) {
21401
+ pelcroApplyPayButton.addEventListener("click", onApplePayButtonClicked);
21402
+ }
21403
+ }, []);
21404
+ return /*#__PURE__*/React__default.createElement("apple-pay-button", {
21405
+ id: "pelcro-apple-pay-button",
21406
+ style: {
21407
+ display: "none"
21408
+ },
21409
+ buttonstyle: "black",
21410
+ type: "plain",
21411
+ locale: "en-US"
21412
+ });
21413
+ };
21414
+
21002
21415
  /**
21003
21416
  *
21004
21417
  */
@@ -21013,6 +21426,7 @@ function PaymentMethodView(_ref) {
21013
21426
  showExternalPaymentMethods,
21014
21427
  showSubscriptionButton,
21015
21428
  showOrderButton,
21429
+ showApplePayButton,
21016
21430
  order
21017
21431
  } = _ref;
21018
21432
  const {
@@ -21089,7 +21503,7 @@ function PaymentMethodView(_ref) {
21089
21503
  className: "plc-mb-2"
21090
21504
  }, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
21091
21505
  className: "plc-grid plc-mt-4 plc-gap-y-2"
21092
- }, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null)))));
21506
+ }, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ApplePayButton, null)) : null)))));
21093
21507
  }
21094
21508
 
21095
21509
  const SubscriptionRenewView = _ref => {
@@ -21111,11 +21525,11 @@ const SubscriptionRenewView = _ref => {
21111
21525
  const getPricingText = plan => {
21112
21526
  const autoRenewed = plan.auto_renew;
21113
21527
  const {
21114
- interval,
21528
+ interval_translated,
21115
21529
  interval_count
21116
21530
  } = plan;
21117
21531
  const intervalText = t("labels.interval", {
21118
- interval,
21532
+ interval: interval_translated,
21119
21533
  count: interval_count
21120
21534
  });
21121
21535
  return /*#__PURE__*/React__default.createElement("p", {
@@ -21140,6 +21554,7 @@ const SubscriptionRenewView = _ref => {
21140
21554
  type: "createPayment",
21141
21555
  showCoupon: true,
21142
21556
  showExternalPaymentMethods: false,
21557
+ showApplePayButton: true,
21143
21558
  onSuccess: onSuccess,
21144
21559
  onGiftRenewalSuccess: onGiftRenewalSuccess,
21145
21560
  onFailure: onFailure,
@@ -21147,13 +21562,11 @@ const SubscriptionRenewView = _ref => {
21147
21562
  }));
21148
21563
  };
21149
21564
 
21150
- var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
21151
- 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;
21152
-
21153
21565
  /**
21154
21566
  *
21155
21567
  */
21156
21568
  function SubscriptionRenewModal(_ref) {
21569
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21157
21570
  let {
21158
21571
  onDisplay,
21159
21572
  onClose,
@@ -21162,24 +21575,39 @@ function SubscriptionRenewModal(_ref) {
21162
21575
  const {
21163
21576
  switchView
21164
21577
  } = usePelcro();
21578
+ 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;
21165
21579
  const onSuccess = res => {
21166
- var _otherProps$onSuccess, _ReactGA$event;
21580
+ var _otherProps$onSuccess;
21167
21581
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
21168
- 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, {
21169
- category: "ACTIONS",
21170
- action: "Renewed",
21171
- nonInteraction: true
21172
- });
21582
+ if (enableReactGA4) {
21583
+ ReactGA4.event("Renewed", {
21584
+ nonInteraction: true
21585
+ });
21586
+ } else {
21587
+ var _ReactGA$event;
21588
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21589
+ category: "ACTIONS",
21590
+ action: "Renewed",
21591
+ nonInteraction: true
21592
+ });
21593
+ }
21173
21594
  return switchView("subscription-success");
21174
21595
  };
21175
21596
  const onGiftRenewalSuccess = () => {
21176
- var _otherProps$onGiftRen, _ReactGA$event2;
21597
+ var _otherProps$onGiftRen;
21177
21598
  (_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
21178
- 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, {
21179
- category: "ACTIONS",
21180
- action: "Renewed Gift",
21181
- nonInteraction: true
21182
- });
21599
+ if (enableReactGA4) {
21600
+ ReactGA4.event("Renewed Gift", {
21601
+ nonInteraction: true
21602
+ });
21603
+ } else {
21604
+ var _ReactGA$event2;
21605
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
21606
+ category: "ACTIONS",
21607
+ action: "Renewed Gift",
21608
+ nonInteraction: true
21609
+ });
21610
+ }
21183
21611
  return switchView("subscription-success");
21184
21612
  };
21185
21613
  return /*#__PURE__*/React__default.createElement(Modal, {
@@ -21194,7 +21622,8 @@ function SubscriptionRenewModal(_ref) {
21194
21622
  SubscriptionRenewModal.viewId = "subscription-renew";
21195
21623
 
21196
21624
  const initialState$j = {
21197
- cancelationReason: ""
21625
+ cancelationReason: "",
21626
+ cancelationOption: ""
21198
21627
  };
21199
21628
  const store$j = /*#__PURE__*/createContext(initialState$j);
21200
21629
  const {
@@ -21209,7 +21638,6 @@ const SubscriptionCancelContainer = _ref => {
21209
21638
  children,
21210
21639
  ...props
21211
21640
  } = _ref;
21212
- useTranslation("verifyEmail");
21213
21641
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
21214
21642
  switch (action.type) {
21215
21643
  case SET_CANCEL_SUBSCRIPTION_REASON:
@@ -21217,6 +21645,11 @@ const SubscriptionCancelContainer = _ref => {
21217
21645
  ...state,
21218
21646
  cancelationReason: action.payload
21219
21647
  });
21648
+ case SET_CANCEL_SUBSCRIPTION_OPTION:
21649
+ return lib_7({
21650
+ ...state,
21651
+ cancelationOption: action.payload
21652
+ });
21220
21653
  default:
21221
21654
  return state;
21222
21655
  }
@@ -21316,8 +21749,7 @@ const SubscriptionCancelReason = props => {
21316
21749
  t
21317
21750
  } = useTranslation("subscriptionCancel");
21318
21751
  const {
21319
- dispatch,
21320
- state
21752
+ dispatch
21321
21753
  } = useContext(store$j);
21322
21754
  const handleOnTextAreaBlur = e => {
21323
21755
  dispatch({
@@ -21349,9 +21781,7 @@ function SvgSubscription(props) {
21349
21781
  }))))));
21350
21782
  }
21351
21783
 
21352
- var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
21353
- 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;
21354
- const SubscriptionCancelNowButton = _ref => {
21784
+ const SubscriptionCancelButton = _ref => {
21355
21785
  let {
21356
21786
  subscription,
21357
21787
  onClick,
@@ -21362,14 +21792,16 @@ const SubscriptionCancelNowButton = _ref => {
21362
21792
  } = usePelcro();
21363
21793
  const {
21364
21794
  state: {
21365
- cancelationReason
21366
- },
21367
- dispatch
21795
+ cancelationReason,
21796
+ cancelationOption
21797
+ }
21368
21798
  } = useContext(store$j);
21369
21799
  const {
21370
21800
  t
21371
21801
  } = useTranslation("subscriptionCancel");
21372
21802
  const cancelSubscription = (payload, onSuccess, onFailure) => {
21803
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21804
+ 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;
21373
21805
  window.Pelcro.subscription.cancel({
21374
21806
  auth_token: window.Pelcro.user.read().auth_token,
21375
21807
  subscription_id: payload.subscription_id,
@@ -21378,36 +21810,42 @@ const SubscriptionCancelNowButton = _ref => {
21378
21810
  reason: payload.reason
21379
21811
  })
21380
21812
  }, (err, res) => {
21381
- var _ReactGA$event;
21382
21813
  if (err) {
21383
21814
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21384
21815
  }
21385
- 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, {
21386
- category: "ACTIONS",
21387
- action: "Canceled",
21388
- nonInteraction: true
21389
- });
21816
+ if (enableReactGA4) {
21817
+ ReactGA4.event("Canceled", {
21818
+ nonInteraction: true
21819
+ });
21820
+ } else {
21821
+ var _ReactGA$event;
21822
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
21823
+ category: "ACTIONS",
21824
+ action: "Canceled",
21825
+ nonInteraction: true
21826
+ });
21827
+ }
21390
21828
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21391
21829
  });
21392
21830
  };
21393
- const handleCancelNowClick = () => {
21831
+ const handleCancelClick = () => {
21394
21832
  const payload = {
21395
21833
  subscription_id: subscription.id,
21396
- mode: "now",
21834
+ mode: cancelationOption,
21397
21835
  ...(cancelationReason && {
21398
21836
  reason: cancelationReason
21399
21837
  })
21400
21838
  };
21401
21839
  onClick === null || onClick === void 0 ? void 0 : onClick();
21402
21840
 
21403
- //Close the modal
21841
+ // Close the modal
21404
21842
  switchView(null);
21405
21843
 
21406
- //Show confirmation alert after closing the modal
21844
+ // Show confirmation alert after closing the modal
21407
21845
  notify.confirm((onSuccess, onFailure) => {
21408
21846
  cancelSubscription(payload, onSuccess, onFailure);
21409
21847
  }, {
21410
- confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
21848
+ confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
21411
21849
  loadingMessage: t("messages.subCancellation.loading"),
21412
21850
  successMessage: t("messages.subCancellation.success"),
21413
21851
  errorMessage: t("messages.subCancellation.error")
@@ -21416,90 +21854,89 @@ const SubscriptionCancelNowButton = _ref => {
21416
21854
  });
21417
21855
  };
21418
21856
  return /*#__PURE__*/React__default.createElement(Button, {
21419
- onClick: handleCancelNowClick,
21420
- className: `${className}`
21421
- }, t("messages.cancelNow"));
21857
+ onClick: handleCancelClick,
21858
+ className: `${className}`,
21859
+ disabled: !cancelationOption
21860
+ }, t("labels.cancel"));
21422
21861
  };
21423
21862
 
21424
- var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
21425
- 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;
21426
- const SubscriptionCancelLaterButton = _ref => {
21863
+ // New cancellation option modal
21864
+ const SubscriptionCancelOptions = _ref => {
21865
+ var _subscription$schedul;
21427
21866
  let {
21428
21867
  subscription,
21868
+ hasPhases,
21429
21869
  onClick,
21430
21870
  className
21431
21871
  } = _ref;
21432
- const {
21433
- switchView
21434
- } = usePelcro();
21435
21872
  const {
21436
21873
  state: {
21437
- cancelationReason
21874
+ cancelationOption
21438
21875
  },
21439
21876
  dispatch
21440
21877
  } = useContext(store$j);
21441
21878
  const {
21442
21879
  t
21443
21880
  } = useTranslation("subscriptionCancel");
21444
- const cancelSubscription = (payload, onSuccess, onFailure) => {
21445
- window.Pelcro.subscription.cancel({
21446
- auth_token: window.Pelcro.user.read().auth_token,
21447
- subscription_id: payload.subscription_id,
21448
- mode: payload.mode,
21449
- ...(payload.reason && {
21450
- reason: payload.reason
21451
- })
21452
- }, (err, res) => {
21453
- var _ReactGA$event;
21454
- if (err) {
21455
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21456
- }
21457
- 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, {
21458
- category: "ACTIONS",
21459
- action: "Canceled",
21460
- nonInteraction: true
21461
- });
21462
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21463
- });
21464
- };
21465
- const handleCancelNowClick = () => {
21466
- const payload = {
21467
- subscription_id: subscription.id,
21468
- mode: "period_end",
21469
- ...(cancelationReason && {
21470
- reason: cancelationReason
21471
- })
21472
- };
21473
- onClick === null || onClick === void 0 ? void 0 : onClick();
21474
-
21475
- //Close the modal
21476
- switchView(null);
21477
-
21478
- //Show confirmation alert after closing the modal
21479
- notify.confirm((onSuccess, onFailure) => {
21480
- cancelSubscription(payload, onSuccess, onFailure);
21481
- }, {
21482
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
21483
- loadingMessage: t("messages.subCancellation.loading"),
21484
- successMessage: t("messages.subCancellation.success"),
21485
- errorMessage: t("messages.subCancellation.error")
21486
- }, {
21487
- closeButtonLabel: t("labels.subCancellation.goBack")
21881
+ const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
21882
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21883
+ const handleOptionSelect = event => {
21884
+ dispatch({
21885
+ type: SET_CANCEL_SUBSCRIPTION_OPTION,
21886
+ payload: event.target.value
21488
21887
  });
21489
21888
  };
21490
- return /*#__PURE__*/React__default.createElement(Button, {
21491
- onClick: handleCancelNowClick,
21492
- className: `${className}`
21493
- }, t("messages.cancelLater"));
21889
+ return /*#__PURE__*/React__default.createElement("div", {
21890
+ className: "plc-text-left plc-mr-auto plc-mb-6"
21891
+ }, /*#__PURE__*/React__default.createElement("p", {
21892
+ className: "plc-mb-3"
21893
+ }, t("messages.cancelWhen")), subscription.cancel_at_period_end === 0 && hasPhases && /*#__PURE__*/React__default.createElement(Radio, {
21894
+ onChange: handleOptionSelect,
21895
+ checked: cancelationOption === "period_end",
21896
+ value: "period_end"
21897
+ }, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21898
+ year: "numeric",
21899
+ month: "short",
21900
+ day: "numeric"
21901
+ })), subscription.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(Radio, {
21902
+ onChange: handleOptionSelect,
21903
+ checked: cancelationOption === "current_period_end",
21904
+ value: "current_period_end"
21905
+ }, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
21906
+ year: "numeric",
21907
+ month: "short",
21908
+ day: "numeric"
21909
+ })), /*#__PURE__*/React__default.createElement(Radio, {
21910
+ onChange: handleOptionSelect,
21911
+ checked: cancelationOption === "now",
21912
+ value: "now"
21913
+ }, t("labels.endImmediately")));
21494
21914
  };
21495
21915
 
21496
21916
  const SubscriptionCancelView = props => {
21917
+ var _subscriptionToCancel7, _subscriptionToCancel8;
21497
21918
  const {
21498
- subscriptionToCancel
21919
+ subscriptionToCancel,
21920
+ switchView
21499
21921
  } = usePelcro();
21500
21922
  const {
21501
21923
  t
21502
21924
  } = useTranslation("subscriptionCancel");
21925
+ const getPhases = () => {
21926
+ var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
21927
+ if (!subscriptionToCancel.schedule) return [];
21928
+ 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;
21929
+ 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 => {
21930
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
21931
+ });
21932
+ 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 => {
21933
+ return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
21934
+ });
21935
+ return [currentPhase, ...futurePhases];
21936
+ };
21937
+ const hasPhases = getPhases().length > 0;
21938
+ const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
21939
+ const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
21503
21940
  return /*#__PURE__*/React__default.createElement("div", {
21504
21941
  id: "pelcro-subscription-cancel-view"
21505
21942
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -21508,22 +21945,35 @@ const SubscriptionCancelView = props => {
21508
21945
  className: "plc-text-2xl plc-font-semibold"
21509
21946
  }, t("labels.title"), /*#__PURE__*/React__default.createElement("span", {
21510
21947
  className: "plc-text-gray-400 plc-text-base plc-block"
21511
- }, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
21948
+ }, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
21512
21949
  className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
21513
21950
  }, /*#__PURE__*/React__default.createElement(SvgSubscription, {
21514
21951
  className: "plc-w-32 plc-h-32"
21515
21952
  }), /*#__PURE__*/React__default.createElement("p", {
21516
- className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
21517
- }, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21953
+ className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
21954
+ }, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
21518
21955
  year: "numeric",
21519
21956
  month: "short",
21520
21957
  day: "numeric"
21521
- }), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement(SubscriptionCancelNowButton, {
21522
- className: "plc-mb-2",
21523
- subscription: subscriptionToCancel
21524
- }), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(SubscriptionCancelLaterButton, {
21958
+ }) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
21959
+ year: "numeric",
21960
+ month: "short",
21961
+ day: "numeric"
21962
+ }), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelOptions, {
21963
+ subscription: subscriptionToCancel,
21964
+ hasPhases: hasPhases
21965
+ }), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement("div", {
21966
+ 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"
21967
+ }, /*#__PURE__*/React__default.createElement(SubscriptionCancelButton, {
21968
+ className: "plc-w-3/4 md:plc-w-2/5",
21525
21969
  subscription: subscriptionToCancel
21526
- }))));
21970
+ }), /*#__PURE__*/React__default.createElement(Button, {
21971
+ variant: "outline",
21972
+ className: "plc-w-3/4 md:plc-w-2/5",
21973
+ onClick: () => {
21974
+ switchView("dashboard");
21975
+ }
21976
+ }, t("labels.subCancellation.goBack"))))));
21527
21977
  };
21528
21978
 
21529
21979
  const SubscriptionCancelModal = _ref => {
@@ -21663,9 +22113,8 @@ const SubscriptionSuspendDate = props => {
21663
22113
  }, props));
21664
22114
  };
21665
22115
 
21666
- var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
21667
- 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;
21668
22116
  const SubscriptionSuspendButton = _ref => {
22117
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
21669
22118
  let {
21670
22119
  subscription,
21671
22120
  onClick,
@@ -21684,6 +22133,7 @@ const SubscriptionSuspendButton = _ref => {
21684
22133
  const {
21685
22134
  t
21686
22135
  } = useTranslation("subscriptionSuspend");
22136
+ 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;
21687
22137
  const suspendSubscription = (payload, onSuccess, onFailure) => {
21688
22138
  window.Pelcro.subscription.update({
21689
22139
  auth_token: window.Pelcro.user.read().auth_token,
@@ -21691,15 +22141,21 @@ const SubscriptionSuspendButton = _ref => {
21691
22141
  suspend: 1,
21692
22142
  shipments_suspended_until: suspendDate
21693
22143
  }, (err, res) => {
21694
- var _ReactGA$event;
21695
22144
  if (err) {
21696
22145
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
21697
22146
  }
21698
- 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, {
21699
- category: "ACTIONS",
21700
- action: "Suspended",
21701
- nonInteraction: true
21702
- });
22147
+ if (enableReactGA4) {
22148
+ ReactGA4.event("Suspended", {
22149
+ nonInteraction: true
22150
+ });
22151
+ } else {
22152
+ var _ReactGA$event;
22153
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
22154
+ category: "ACTIONS",
22155
+ action: "Suspended",
22156
+ nonInteraction: true
22157
+ });
22158
+ }
21703
22159
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
21704
22160
  });
21705
22161
  };
@@ -21709,10 +22165,10 @@ const SubscriptionSuspendButton = _ref => {
21709
22165
  };
21710
22166
  onClick === null || onClick === void 0 ? void 0 : onClick();
21711
22167
 
21712
- //Close the modal
22168
+ // Close the modal
21713
22169
  switchView(null);
21714
22170
 
21715
- //Show confirmation alert after closing the modal
22171
+ // Show confirmation alert after closing the modal
21716
22172
  notify.confirm((onSuccess, onFailure) => {
21717
22173
  suspendSubscription(payload, onSuccess, onFailure);
21718
22174
  }, {
@@ -22443,11 +22899,11 @@ const SubscriptionCreateView = _ref => {
22443
22899
  var _plan$quantity, _plan$quantity2, _plan$quantity3;
22444
22900
  const autoRenewed = plan.auto_renew;
22445
22901
  const {
22446
- interval,
22902
+ interval_translated,
22447
22903
  interval_count
22448
22904
  } = plan;
22449
22905
  const intervalText = t("labels.interval", {
22450
- interval,
22906
+ interval: interval_translated,
22451
22907
  count: interval_count
22452
22908
  });
22453
22909
  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());
@@ -22473,6 +22929,7 @@ const SubscriptionCreateView = _ref => {
22473
22929
  type: "createPayment",
22474
22930
  showCoupon: true,
22475
22931
  showExternalPaymentMethods: true,
22932
+ showApplePayButton: true,
22476
22933
  onSuccess: onSuccess,
22477
22934
  onFailure: onFailure,
22478
22935
  showSubscriptionButton: showSubscriptionButton
@@ -24443,7 +24900,7 @@ const {
24443
24900
  Provider: Provider$d
24444
24901
  } = store$d;
24445
24902
  const AddressUpdateContainer = _ref => {
24446
- var _props$addressId;
24903
+ var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
24447
24904
  let {
24448
24905
  style,
24449
24906
  className = "",
@@ -24457,6 +24914,7 @@ const AddressUpdateContainer = _ref => {
24457
24914
  addressIdToEdit
24458
24915
  } = usePelcro();
24459
24916
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
24917
+ 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;
24460
24918
  const [t] = useTranslation("address");
24461
24919
  useEffect(() => {
24462
24920
  const getCountries = () => {
@@ -24547,7 +25005,6 @@ const AddressUpdateContainer = _ref => {
24547
25005
  });
24548
25006
  onFailure(err);
24549
25007
  } else {
24550
- var _ReactGA$event;
24551
25008
  dispatch({
24552
25009
  type: SHOW_ALERT,
24553
25010
  payload: {
@@ -24556,11 +25013,18 @@ const AddressUpdateContainer = _ref => {
24556
25013
  }
24557
25014
  });
24558
25015
  onSuccess(res);
24559
- ReactGA1 === null || ReactGA1 === void 0 ? void 0 : (_ReactGA$event = ReactGA1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA1, {
24560
- category: "ACTIONS",
24561
- action: "Updated address",
24562
- nonInteraction: true
24563
- });
25016
+ if (enableReactGA4) {
25017
+ ReactGA4.event("Updated address", {
25018
+ nonInteraction: true
25019
+ });
25020
+ } else {
25021
+ var _ReactGA$event;
25022
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25023
+ category: "ACTIONS",
25024
+ action: "Updated address",
25025
+ nonInteraction: true
25026
+ });
25027
+ }
24564
25028
  }
24565
25029
  });
24566
25030
  };
@@ -25078,23 +25542,31 @@ function PaymentMethodUpdateView(props) {
25078
25542
  type: "updatePaymentSource",
25079
25543
  showCoupon: false,
25080
25544
  showExternalPaymentMethods: false,
25545
+ showApplePayButton: false,
25081
25546
  onDisplay: props.onDisplay,
25082
25547
  onFailure: props.onFailure,
25083
25548
  onSuccess: props.onSuccess
25084
25549
  }));
25085
25550
  }
25086
25551
 
25087
- var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
25088
- 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;
25089
25552
  const PaymentMethodUpdateModal = props => {
25553
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
25554
+ 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;
25090
25555
  const onSuccess = res => {
25091
- var _props$onSuccess, _ReactGA$event;
25556
+ var _props$onSuccess;
25092
25557
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25093
- 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, {
25094
- category: "ACTIONS",
25095
- action: "Updated payment card",
25096
- nonInteraction: true
25097
- });
25558
+ if (enableReactGA4) {
25559
+ ReactGA4.event("Updated payment card", {
25560
+ nonInteraction: true
25561
+ });
25562
+ } else {
25563
+ var _ReactGA$event;
25564
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
25565
+ category: "ACTIONS",
25566
+ action: "Updated payment card",
25567
+ nonInteraction: true
25568
+ });
25569
+ }
25098
25570
  };
25099
25571
  return /*#__PURE__*/React__default.createElement(Modal, {
25100
25572
  id: "pelcro-payment-method-update-modal",
@@ -26494,6 +26966,7 @@ const OrderCreateView = props => {
26494
26966
  type: "orderCreate",
26495
26967
  showCoupon: true,
26496
26968
  showExternalPaymentMethods: false,
26969
+ showApplePayButton: false,
26497
26970
  showOrderButton: showOrderButton,
26498
26971
  order: order
26499
26972
  }, props))));
@@ -28971,8 +29444,6 @@ const OrderItems = _ref => {
28971
29444
  });
28972
29445
  };
28973
29446
 
28974
- var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
28975
- 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;
28976
29447
  const SavedItemsMenu = () => {
28977
29448
  const {
28978
29449
  t
@@ -29021,8 +29492,10 @@ const SavedItems = _ref3 => {
29021
29492
  isAuthenticated
29022
29493
  } = usePelcro();
29023
29494
  const removeItemFromMetadata = (category, title) => {
29495
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
29024
29496
  const user = window.Pelcro.user.read();
29025
29497
  const oldValue = user.metadata[`metadata_saved_${category}`];
29498
+ 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;
29026
29499
  const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
29027
29500
  if (isAuthenticated()) {
29028
29501
  setLoading(true);
@@ -29031,17 +29504,24 @@ const SavedItems = _ref3 => {
29031
29504
  value: newMetadataValue,
29032
29505
  auth_token: window.Pelcro.user.read().auth_token
29033
29506
  }, (error, response) => {
29034
- var _response$data, _ReactGA$event;
29507
+ var _response$data;
29035
29508
  setLoading(false);
29036
29509
  if (error) {
29037
29510
  return;
29038
29511
  }
29039
29512
  setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
29040
- 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, {
29041
- category: "ACTIONS",
29042
- action: "Unsave/Unfollow",
29043
- label: title
29044
- });
29513
+ if (enableReactGA4) {
29514
+ ReactGA4.event("Unsave/Unfollow", {
29515
+ event_label: title
29516
+ });
29517
+ } else {
29518
+ var _ReactGA$event;
29519
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
29520
+ category: "ACTIONS",
29521
+ action: "Unsave/Unfollow",
29522
+ label: title
29523
+ });
29524
+ }
29045
29525
  });
29046
29526
  }
29047
29527
  };
@@ -29994,8 +30474,6 @@ function getMemberShipStatus(status) {
29994
30474
  };
29995
30475
  }
29996
30476
 
29997
- var _window, _window$Pelcro, _window$Pelcro$uiSett;
29998
- 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;
29999
30477
  const SUB_MENUS = {
30000
30478
  PROFILE: "profile",
30001
30479
  SUBSCRIPTIONS: "subscriptions",
@@ -30050,21 +30528,27 @@ function DashboardWithHook(props) {
30050
30528
  DashboardWithHook.viewId = "dashboard";
30051
30529
  class Dashboard extends Component {
30052
30530
  constructor(props) {
30053
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
30531
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
30054
30532
  super(props);
30055
30533
  _defineProperty$3(this, "componentDidMount", () => {
30056
- var _ReactGA$event;
30057
30534
  this.setState({
30058
30535
  isOpen: true
30059
30536
  });
30060
30537
  window.Pelcro.insight.track("Modal Displayed", {
30061
30538
  name: "dashboard"
30062
30539
  });
30063
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30064
- category: "VIEWS",
30065
- action: "Dashboard Modal Viewed",
30066
- nonInteraction: true
30067
- });
30540
+ if (this.enableReactGA4) {
30541
+ ReactGA4.event("Dashboard Modal Viewed", {
30542
+ nonInteraction: true
30543
+ });
30544
+ } else {
30545
+ var _ReactGA$event;
30546
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
30547
+ category: "VIEWS",
30548
+ action: "Dashboard Modal Viewed",
30549
+ nonInteraction: true
30550
+ });
30551
+ }
30068
30552
  const {
30069
30553
  addresses
30070
30554
  } = window.Pelcro.user.read();
@@ -30092,15 +30576,21 @@ class Dashboard extends Component {
30092
30576
  auth_token: window.Pelcro.user.read().auth_token,
30093
30577
  subscription_id: subscription_id
30094
30578
  }, (err, res) => {
30095
- var _ReactGA$event2;
30096
30579
  if (err) {
30097
30580
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30098
30581
  }
30099
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30100
- category: "ACTIONS",
30101
- action: "Canceled",
30102
- nonInteraction: true
30103
- });
30582
+ if (this.enableReactGA4) {
30583
+ ReactGA4.event("Canceled", {
30584
+ nonInteraction: true
30585
+ });
30586
+ } else {
30587
+ var _ReactGA$event2;
30588
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
30589
+ category: "ACTIONS",
30590
+ action: "Canceled",
30591
+ nonInteraction: true
30592
+ });
30593
+ }
30104
30594
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30105
30595
  });
30106
30596
  });
@@ -30110,15 +30600,21 @@ class Dashboard extends Component {
30110
30600
  subscription_id: subscription_id,
30111
30601
  suspend: 0
30112
30602
  }, (err, res) => {
30113
- var _ReactGA$event3;
30114
30603
  if (err) {
30115
30604
  return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
30116
30605
  }
30117
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30118
- category: "ACTIONS",
30119
- action: "UnSuspended",
30120
- nonInteraction: true
30121
- });
30606
+ if (this.enableReactGA4) {
30607
+ ReactGA4.event("UnSuspended", {
30608
+ nonInteraction: true
30609
+ });
30610
+ } else {
30611
+ var _ReactGA$event3;
30612
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
30613
+ category: "ACTIONS",
30614
+ action: "UnSuspended",
30615
+ nonInteraction: true
30616
+ });
30617
+ }
30122
30618
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
30123
30619
  });
30124
30620
  });
@@ -30403,6 +30899,7 @@ class Dashboard extends Component {
30403
30899
  this.locale = this.props.t;
30404
30900
  this.user = window.Pelcro.user.read();
30405
30901
  this.menuRef = /*#__PURE__*/React__default.createRef();
30902
+ 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;
30406
30903
  }
30407
30904
  render() {
30408
30905
  var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
@@ -32816,7 +33313,8 @@ const InvoicePaymentView = props => {
32816
33313
  }, /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
32817
33314
  type: "invoicePayment",
32818
33315
  showCoupon: false,
32819
- showExternalPaymentMethods: true
33316
+ showExternalPaymentMethods: true,
33317
+ showApplePayButton: true
32820
33318
  }, props))));
32821
33319
  };
32822
33320