@pelcro/react-pelcro-js 4.0.0-alpha.26 → 4.0.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -3464,7 +3464,7 @@ var youAreSafe$3 = "You're safe - PCI compliant 128 SSL by";
3464
3464
  var cancel$3 = "Cancel your subscription online at anytime.";
3465
3465
  var giftSent$3 = "Subscription gift has been sent to";
3466
3466
  var successfully$3 = "successfully";
3467
- var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
3467
+ var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1> Subscribe </1> now to get full page access.";
3468
3468
  var recaptcha$3 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
3469
3469
  var invalidInvoice$3 = "Invalid invoice ID, please contact support";
3470
3470
  var invalidSubscription$2 = "Invalid subscription ID, please contact support";
@@ -3915,6 +3915,7 @@ var labels$U = {
3915
3915
  addCard: "Add Card",
3916
3916
  actions: "Actions",
3917
3917
  expiresOn: "Ends",
3918
+ until: "Until",
3918
3919
  startsOn: "Starts",
3919
3920
  startDate: "Start date",
3920
3921
  renewsOn: "Renews",
@@ -4405,7 +4406,7 @@ var youAreSafe$2 = "Vous êtes en sécurité - PCI conforme 128 SSL par";
4405
4406
  var cancel$2 = "Annuler votre abonnement en ligne à tout moment.";
4406
4407
  var giftSent$2 = "Le cadeau d’abonnement a été envoyé à";
4407
4408
  var successfully$2 = "avec succès.";
4408
- var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4409
+ var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1> Abonnez-vous </1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4409
4410
  var recaptcha$2 = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
4410
4411
  var invalidInvoice$2 = "Identifiant de facture non valide, veuillez contacter l'assistance";
4411
4412
  var invalidSubscription$1 = "ID d'abonnement invalide, veuillez contacter l'assistance";
@@ -4857,6 +4858,7 @@ var labels$z = {
4857
4858
  addCard: "Ajouter une carte",
4858
4859
  actions: "Actes",
4859
4860
  expiresOn: "Expire le",
4861
+ until: "Jusqu'à ce que",
4860
4862
  startsOn: "Débute le",
4861
4863
  startDate: "Date de début",
4862
4864
  renewsOn: "Renouvelle le",
@@ -5293,7 +5295,7 @@ var youAreSafe$1 = "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제
5293
5295
  var cancel$1 = "유료 멤버십은 언제든 온라인으로 취소가 가능합니다.";
5294
5296
  var giftSent$1 = "유료 멤버십 선물이 ";
5295
5297
  var successfully$1 = "님께 성공적으로 전송되었습니다.";
5296
- var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1>멤버십에 가입</1>하세요.";
5298
+ var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1> 멤버십에 가입 </1>하세요.";
5297
5299
  var recaptcha$1 = "이 사이트는 reCAPTCHA로 보호되며, Google <1>개인정보 보호정책</1> 및 <3>서비스 약관</3>이 적용됩니다.";
5298
5300
  var invalidInvoice$1 = "유효하지 않은 인보이스 ID입니다. 지원팀에 문의하십시오.";
5299
5301
  var invalidSubscription = "잘못된 구독 ID입니다. 지원팀에 문의하세요.";
@@ -5744,6 +5746,7 @@ var labels$k = {
5744
5746
  addCard: "카드 추가",
5745
5747
  actions: "조치",
5746
5748
  expiresOn: "종료",
5749
+ until: "까지",
5747
5750
  startsOn: "시작",
5748
5751
  startDate: "시작일",
5749
5752
  renewsOn: "갱신",
@@ -6230,7 +6233,7 @@ var youAreSafe = "Estás seguro - PCI compliance 128 SSL por";
6230
6233
  var cancel = "Cancela tu suscripción en línea en cualquier momento.";
6231
6234
  var giftSent = "La suscripción de regalo se ha enviado a";
6232
6235
  var successfully = "exitosamente";
6233
- var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1>Suscríbete</1> ahora para obtener acceso completo.";
6236
+ var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1> Suscríbete </1> ahora para obtener acceso completo.";
6234
6237
  var recaptcha = "Este sitio está protegido por reCAPTCHA, aplica la <1>Política de Privacidad</1> y los <3>Términos de Servicio</3> de Google.";
6235
6238
  var invalidInvoice = "Número de comprobante de pago inválido, por favor contacta a soporte.";
6236
6239
  var zeroTotalInvoice = "No puedes ver un comprobante de pago de $0";
@@ -6672,6 +6675,7 @@ var labels$5 = {
6672
6675
  paymentSource: "Datos de pago",
6673
6676
  actions: "Acciones",
6674
6677
  expiresOn: "Finaliza",
6678
+ until: "Hasta que",
6675
6679
  startsOn: "Inicia",
6676
6680
  startDate: "Fecha de inicio",
6677
6681
  renewsOn: "Renovación",
@@ -9070,6 +9074,27 @@ function userMustVerifyEmail() {
9070
9074
  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;
9071
9075
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9072
9076
  }
9077
+ function notifyBugsnag(callback, startOptions) {
9078
+ if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9079
+ //load bugsnag CDN
9080
+ window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9081
+ document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9082
+ var _window$Pelcro$enviro, _window$Pelcro3, _window$Pelcro3$envir, _window$Pelcro4, _window$Pelcro4$envir;
9083
+
9084
+ Bugsnag.start({
9085
+ apiKey: (_window$Pelcro$enviro = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$envir = _window$Pelcro3.environment) === null || _window$Pelcro3$envir === void 0 ? void 0 : _window$Pelcro3$envir.bugsnagKey) !== null && _window$Pelcro$enviro !== void 0 ? _window$Pelcro$enviro : "e8f6852b322540e8c25386048b99ab01",
9086
+ autoDetectErrors: false,
9087
+ releaseStage: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$envir = _window$Pelcro4.environment) === null || _window$Pelcro4$envir === void 0 ? void 0 : _window$Pelcro4$envir.bugsnagReleaseStage,
9088
+ redactedKeys: ["security_key", "password", "password_confirmation", "auth_token", "token"],
9089
+ ...startOptions
9090
+ });
9091
+ callback();
9092
+ });
9093
+ return;
9094
+ }
9095
+
9096
+ callback();
9097
+ }
9073
9098
 
9074
9099
  const resources = {
9075
9100
  en: {
@@ -11238,8 +11263,10 @@ const loadPaymentSDKs = () => {
11238
11263
  const {
11239
11264
  whenUserReady
11240
11265
  } = usePelcro.getStore();
11266
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11267
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11241
11268
  whenUserReady(() => {
11242
- if (!window.Stripe) {
11269
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11243
11270
  pure_1(window.Pelcro.environment.stripe);
11244
11271
  }
11245
11272
  }); // Load PayPal SDKs
@@ -11252,8 +11279,6 @@ const loadPaymentSDKs = () => {
11252
11279
  } // Load Vantiv SDKs
11253
11280
 
11254
11281
 
11255
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11256
-
11257
11282
  if (supportsVantiv) {
11258
11283
  if (!window.jQuery) {
11259
11284
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
@@ -11261,15 +11286,13 @@ const loadPaymentSDKs = () => {
11261
11286
 
11262
11287
  if (!window.EprotectIframeClient) {
11263
11288
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
11264
- const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
11289
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
11265
11290
  const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
11266
11291
  window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
11267
11292
  }
11268
11293
  } // Load Tap SDKs
11269
11294
 
11270
11295
 
11271
- const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11272
-
11273
11296
  if (supportsTap) {
11274
11297
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
11275
11298
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
@@ -11466,7 +11489,11 @@ const initSubscriptionFromURL = () => {
11466
11489
  var _selectedProduct$plan;
11467
11490
 
11468
11491
  const productsList = window.Pelcro.product.list();
11469
- if (!(productsList !== null && productsList !== void 0 && productsList.length)) return;
11492
+
11493
+ if (!(productsList !== null && productsList !== void 0 && productsList.length)) {
11494
+ return;
11495
+ }
11496
+
11470
11497
  const [productId, planId, isGiftParam] = [window.Pelcro.helpers.getURLParameter("product_id"), window.Pelcro.helpers.getURLParameter("plan_id"), window.Pelcro.helpers.getURLParameter("is_gift")];
11471
11498
  const isGift = (isGiftParam === null || isGiftParam === void 0 ? void 0 : isGiftParam.toLowerCase()) === "true";
11472
11499
  const selectedProduct = productsList.find(product => product.id === Number(productId));
@@ -12393,7 +12420,7 @@ function Email({
12393
12420
  }, []);
12394
12421
 
12395
12422
  const isEmailValid = email => {
12396
- const re = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?/;
12423
+ const re = /[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?/;
12397
12424
  return re.test(email);
12398
12425
  };
12399
12426
 
@@ -19000,6 +19027,22 @@ class SelectModal extends React.Component {
19000
19027
  }
19001
19028
 
19002
19029
  document.addEventListener("keydown", this.handleSubmit);
19030
+
19031
+ if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
19032
+ notifyBugsnag(() => {
19033
+ Bugsnag.notify("SelectModal - No data viewed", event => {
19034
+ var _window$Pelcro, _window$Pelcro$site, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro4;
19035
+
19036
+ event.addMetadata("MetaData", {
19037
+ site: (_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.read(),
19038
+ user: (_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(),
19039
+ uiVersion: (_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.uiVersion,
19040
+ environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
19041
+ });
19042
+ });
19043
+ });
19044
+ console.log("bugsnag Triggered");
19045
+ }
19003
19046
  });
19004
19047
 
19005
19048
  _defineProperty$3(this, "componentWillUnmount", () => {
@@ -22024,7 +22067,7 @@ const PaymentMethodContainerWithoutStripe = ({
22024
22067
  vantivInstanceRef.current = new window.EprotectIframeClient({
22025
22068
  paypageId: payPageId,
22026
22069
  reportGroup: reportGroup,
22027
- style: "enhancedStyle3",
22070
+ style: "enhancedStyle5",
22028
22071
  height: "245",
22029
22072
  timeout: 50000,
22030
22073
  div: "eProtectiframe",
@@ -23185,9 +23228,10 @@ const PaymentMethodContainer = props => {
23185
23228
  const {
23186
23229
  whenUserReady
23187
23230
  } = usePelcro.getStore();
23231
+ const cardProcessor = getSiteCardProcessor();
23188
23232
  React.useEffect(() => {
23189
23233
  whenUserReady(() => {
23190
- if (!window.Stripe) {
23234
+ if (!window.Stripe && cardProcessor === "stripe") {
23191
23235
  document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
23192
23236
  setIsStripeLoaded(true);
23193
23237
  });
@@ -23203,9 +23247,11 @@ const PaymentMethodContainer = props => {
23203
23247
  }, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
23204
23248
  store: store$k
23205
23249
  }, props))));
23250
+ } else {
23251
+ return /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainerWithoutStripe, Object.assign({
23252
+ store: store$k
23253
+ }, props));
23206
23254
  }
23207
-
23208
- return null;
23209
23255
  };
23210
23256
 
23211
23257
  const StripeInputStyle = {
@@ -24851,8 +24897,15 @@ const PaymentSuccessView = ({
24851
24897
 
24852
24898
  if (successTitle && successContent) {
24853
24899
  return /*#__PURE__*/React__default['default'].createElement("div", {
24854
- className: "plc-flex plc-flex-col plc-items-center"
24855
- }, successIcon, /*#__PURE__*/React__default['default'].createElement("div", {
24900
+ className: "plc-flex plc-flex-col plc-items-center plc-relative"
24901
+ }, /*#__PURE__*/React__default['default'].createElement("button", {
24902
+ type: "button",
24903
+ className: "pelcro-modal-close plc-absolute plc-top-6 plc-right-0",
24904
+ "aria-label": "close modal",
24905
+ onClick: onClose
24906
+ }, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
24907
+ className: "plc-fill-current"
24908
+ })), successIcon, /*#__PURE__*/React__default['default'].createElement("div", {
24856
24909
  className: "plc-text-center plc-text-gray-900"
24857
24910
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
24858
24911
  className: "plc-mb-4 plc-text-3xl"
@@ -33018,13 +33071,52 @@ const OrderItems = ({
33018
33071
  const DonationsMenu = ({
33019
33072
  reactivateSubscription,
33020
33073
  disableSubmit,
33021
- cancelSubscription
33074
+ cancelSubscription,
33075
+ onClose
33022
33076
  }) => {
33023
33077
  const {
33024
33078
  t
33025
33079
  } = useTranslation("dashboard");
33026
- usePelcro();
33080
+ const {
33081
+ switchView,
33082
+ setSubscriptionToCancel
33083
+ } = usePelcro();
33027
33084
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
33085
+ // Cancel button click handlers
33086
+ const onCancelClick = () => {
33087
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
33088
+
33089
+ if (isImmediateCancelationEnabled) {
33090
+ setSubscriptionToCancel(sub.id);
33091
+ return switchView("subscription-cancel");
33092
+ }
33093
+
33094
+ if (userMustVerifyEmail()) {
33095
+ return switchView("email-verify");
33096
+ }
33097
+
33098
+ switchView(null);
33099
+ onClose === null || onClose === void 0 ? void 0 : onClose();
33100
+ notify.confirm((onSuccess, onFailure) => {
33101
+ cancelSubscription(sub.id, onSuccess, onFailure);
33102
+ }, {
33103
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
33104
+ loadingMessage: t("messages.subCancellation.loading"),
33105
+ successMessage: t("messages.subCancellation.success"),
33106
+ errorMessage: t("messages.subCancellation.error")
33107
+ }, {
33108
+ closeButtonLabel: t("labels.subCancellation.goBack")
33109
+ });
33110
+ }; // Reactivate button click handlers
33111
+
33112
+
33113
+ const onReactivateClick = () => {
33114
+ if (userMustVerifyEmail()) {
33115
+ return switchView("email-verify");
33116
+ }
33117
+
33118
+ reactivateSubscription(sub.id);
33119
+ };
33028
33120
 
33029
33121
  return /*#__PURE__*/React__default['default'].createElement("tr", {
33030
33122
  key: sub.id,
@@ -33037,7 +33129,21 @@ const DonationsMenu = ({
33037
33129
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
33038
33130
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("div", {
33039
33131
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
33040
- }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))));
33132
+ }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
33133
+ variant: "ghost",
33134
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
33135
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
33136
+ onClick: onReactivateClick,
33137
+ disabled: disableSubmit,
33138
+ "data-key": sub.id
33139
+ }, t("labels.reactivate")), !sub.plan.auto_renew || sub.plan.auto_renew && sub.cancel_at_period_end === 0 ? /*#__PURE__*/React__default['default'].createElement(Button, {
33140
+ variant: "ghost",
33141
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
33142
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
33143
+ onClick: onCancelClick,
33144
+ disabled: disableSubmit,
33145
+ "data-key": sub.id
33146
+ }, t("labels.unsubscribe")) : ""));
33041
33147
  });
33042
33148
  return /*#__PURE__*/React__default['default'].createElement(Card, {
33043
33149
  id: "pelcro-dashboard-donation-menu",
@@ -33048,10 +33154,12 @@ const DonationsMenu = ({
33048
33154
  }, /*#__PURE__*/React__default['default'].createElement("thead", {
33049
33155
  className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
33050
33156
  }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
33051
- className: "plc-w-1/4"
33157
+ className: "plc-w-4/12"
33052
33158
  }, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
33053
- className: "plc-w-1/4"
33054
- }, t("labels.startDate")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, subscriptions)));
33159
+ className: "plc-w-5/12"
33160
+ }, t("labels.startDate")), /*#__PURE__*/React__default['default'].createElement("th", {
33161
+ className: "plc-w-3/12"
33162
+ }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, subscriptions)));
33055
33163
  };
33056
33164
 
33057
33165
  function getDonationSubs() {
@@ -33475,7 +33583,9 @@ const AddressesMenu = props => {
33475
33583
  const AddressesItems = props => {
33476
33584
  var _window$Pelcro$user$r;
33477
33585
 
33478
- useTranslation("dashboard");
33586
+ const {
33587
+ t
33588
+ } = useTranslation("dashboard");
33479
33589
  const {
33480
33590
  switchView
33481
33591
  } = usePelcro();
@@ -33506,7 +33616,9 @@ const AddressesItems = props => {
33506
33616
  return addresses.map((address, index) => address.type === "shipping" && /*#__PURE__*/React__default['default'].createElement("div", {
33507
33617
  key: address.id,
33508
33618
  className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark ${selectedAddressId === String(address.id) && `plc-border-primary-400 plc-border-2`}`
33509
- }, /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("p", {
33619
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
33620
+ className: "plc-flex-1 plc-relative"
33621
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
33510
33622
  className: "pelcro-address-name plc-font-semibold"
33511
33623
  }, address.first_name, " ", address.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
33512
33624
  className: "pelcro-address-company"
@@ -33514,7 +33626,9 @@ const AddressesItems = props => {
33514
33626
  className: "pelcro-address-line1 plc-text-sm plc-mt-2"
33515
33627
  }, address.line1), /*#__PURE__*/React__default['default'].createElement("p", {
33516
33628
  className: "pelcro-address-country plc-text-sm"
33517
- }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default['default'].createElement(Button, {
33629
+ }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name), address.is_default && /*#__PURE__*/React__default['default'].createElement("span", {
33630
+ className: "plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-mt-4"
33631
+ }, t("labels.default"))), /*#__PURE__*/React__default['default'].createElement(Button, {
33518
33632
  variant: "icon",
33519
33633
  className: "plc-text-gray-500",
33520
33634
  icon: /*#__PURE__*/React__default['default'].createElement(SvgEdit, null),
@@ -35412,6 +35526,13 @@ class Dashboard extends React.Component {
35412
35526
  return `${this.locale("labels.status.incomplete")}`;
35413
35527
  }
35414
35528
 
35529
+ if (subscription.status === "extended") {
35530
+ // DateTime from BE is missing 3 zeros so we add them before instancing a date
35531
+ const expiryDate = new Date(Number(`${subscription.end_date}000`));
35532
+ const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35533
+ return `${this.locale("labels.until")} ${formattedExpiryDate}`;
35534
+ }
35535
+
35415
35536
  if (subscription.cancel_at_period_end) {
35416
35537
  // DateTime from BE is missing 3 zeros so we add them before instancing a date
35417
35538
  const expiryDate = new Date(Number(`${subscription.expires_at}000`));
@@ -35600,7 +35721,7 @@ class Dashboard extends React.Component {
35600
35721
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35601
35722
  className: "plc-flex plc-items-center"
35602
35723
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35603
- className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 "
35724
+ className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35604
35725
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35605
35726
  className: "plc-relative plc-flex-shrink-0"
35606
35727
  }, /*#__PURE__*/React__default['default'].createElement("img", {
@@ -35611,9 +35732,9 @@ class Dashboard extends React.Component {
35611
35732
  }))), /*#__PURE__*/React__default['default'].createElement("div", {
35612
35733
  className: "plc-flex plc-flex-col plc-justify-between plc-flex-grow plc-w-56 plc-ml-4 plc-break-words sm:plc-w-auto"
35613
35734
  }, userHasName && /*#__PURE__*/React__default['default'].createElement("p", {
35614
- className: "plc-font-bold"
35735
+ className: "plc-font-bold plc-break-all"
35615
35736
  }, this.user.first_name, " ", this.user.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
35616
- className: `plc-m-0 plc-text-sm ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35737
+ className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35617
35738
  }, this.user.email)), /*#__PURE__*/React__default['default'].createElement("div", {
35618
35739
  className: "lg:plc-hidden"
35619
35740
  }, /*#__PURE__*/React__default['default'].createElement(Button, {
@@ -35697,6 +35818,7 @@ class Dashboard extends React.Component {
35697
35818
  setActiveDashboardLink: this.setActiveDashboardLink,
35698
35819
  activeDashboardLink: this.state.activeDashboardLink
35699
35820
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35821
+ show: hasActiveMemberships(),
35700
35822
  name: SUB_MENUS.MEMBERSHIPS,
35701
35823
  icon: /*#__PURE__*/React__default['default'].createElement(SvgMemberships, {
35702
35824
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35705,6 +35827,7 @@ class Dashboard extends React.Component {
35705
35827
  setActiveDashboardLink: this.setActiveDashboardLink,
35706
35828
  activeDashboardLink: this.state.activeDashboardLink
35707
35829
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35830
+ show: hasDonationSubs(),
35708
35831
  name: SUB_MENUS.DONATIONS,
35709
35832
  icon: /*#__PURE__*/React__default['default'].createElement(SvgDonate, {
35710
35833
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35719,6 +35842,7 @@ class Dashboard extends React.Component {
35719
35842
  setActiveDashboardLink: this.setActiveDashboardLink,
35720
35843
  activeDashboardLink: this.state.activeDashboardLink
35721
35844
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35845
+ show: window.Pelcro.site.read().ecommerce_enabled,
35722
35846
  name: SUB_MENUS.ORDERS,
35723
35847
  icon: /*#__PURE__*/React__default['default'].createElement(SvgShopping, null),
35724
35848
  title: this.locale("labels.orders.label"),
@@ -35795,6 +35919,20 @@ function showNewsletters() {
35795
35919
  return showNewslettersUiSettings;
35796
35920
  }
35797
35921
 
35922
+ function hasDonationSubs() {
35923
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
35924
+
35925
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
35926
+ const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
35927
+ return donations.length > 0 || canceledDonations.length > 0;
35928
+ }
35929
+
35930
+ function hasActiveMemberships() {
35931
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
35932
+
35933
+ return (_window$Pelcro$user$r6 = (_window$Pelcro$user$r7 = window.Pelcro.user.read().memberships) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.some(membership => membership.status === "active" && membership.subscription.ended_at === null)) !== null && _window$Pelcro$user$r6 !== void 0 ? _window$Pelcro$user$r6 : false;
35934
+ }
35935
+
35798
35936
  const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
35799
35937
 
35800
35938
  // The button in the lower left that shows the dashboard.
@@ -37792,7 +37930,6 @@ const EmailVerifyModal = ({
37792
37930
  switchToAddressView,
37793
37931
  switchToPaymentView
37794
37932
  } = usePelcro();
37795
- console.log("verify email");
37796
37933
 
37797
37934
  const onSuccess = res => {
37798
37935
  var _otherProps$onSuccess;
package/dist/index.esm.js CHANGED
@@ -3434,7 +3434,7 @@ var youAreSafe$3 = "You're safe - PCI compliant 128 SSL by";
3434
3434
  var cancel$3 = "Cancel your subscription online at anytime.";
3435
3435
  var giftSent$3 = "Subscription gift has been sent to";
3436
3436
  var successfully$3 = "successfully";
3437
- var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
3437
+ var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1> Subscribe </1> now to get full page access.";
3438
3438
  var recaptcha$3 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
3439
3439
  var invalidInvoice$3 = "Invalid invoice ID, please contact support";
3440
3440
  var invalidSubscription$2 = "Invalid subscription ID, please contact support";
@@ -3885,6 +3885,7 @@ var labels$U = {
3885
3885
  addCard: "Add Card",
3886
3886
  actions: "Actions",
3887
3887
  expiresOn: "Ends",
3888
+ until: "Until",
3888
3889
  startsOn: "Starts",
3889
3890
  startDate: "Start date",
3890
3891
  renewsOn: "Renews",
@@ -4375,7 +4376,7 @@ var youAreSafe$2 = "Vous êtes en sécurité - PCI conforme 128 SSL par";
4375
4376
  var cancel$2 = "Annuler votre abonnement en ligne à tout moment.";
4376
4377
  var giftSent$2 = "Le cadeau d’abonnement a été envoyé à";
4377
4378
  var successfully$2 = "avec succès.";
4378
- var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4379
+ var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1> Abonnez-vous </1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4379
4380
  var recaptcha$2 = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
4380
4381
  var invalidInvoice$2 = "Identifiant de facture non valide, veuillez contacter l'assistance";
4381
4382
  var invalidSubscription$1 = "ID d'abonnement invalide, veuillez contacter l'assistance";
@@ -4827,6 +4828,7 @@ var labels$z = {
4827
4828
  addCard: "Ajouter une carte",
4828
4829
  actions: "Actes",
4829
4830
  expiresOn: "Expire le",
4831
+ until: "Jusqu'à ce que",
4830
4832
  startsOn: "Débute le",
4831
4833
  startDate: "Date de début",
4832
4834
  renewsOn: "Renouvelle le",
@@ -5263,7 +5265,7 @@ var youAreSafe$1 = "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제
5263
5265
  var cancel$1 = "유료 멤버십은 언제든 온라인으로 취소가 가능합니다.";
5264
5266
  var giftSent$1 = "유료 멤버십 선물이 ";
5265
5267
  var successfully$1 = "님께 성공적으로 전송되었습니다.";
5266
- var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1>멤버십에 가입</1>하세요.";
5268
+ var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1> 멤버십에 가입 </1>하세요.";
5267
5269
  var recaptcha$1 = "이 사이트는 reCAPTCHA로 보호되며, Google <1>개인정보 보호정책</1> 및 <3>서비스 약관</3>이 적용됩니다.";
5268
5270
  var invalidInvoice$1 = "유효하지 않은 인보이스 ID입니다. 지원팀에 문의하십시오.";
5269
5271
  var invalidSubscription = "잘못된 구독 ID입니다. 지원팀에 문의하세요.";
@@ -5714,6 +5716,7 @@ var labels$k = {
5714
5716
  addCard: "카드 추가",
5715
5717
  actions: "조치",
5716
5718
  expiresOn: "종료",
5719
+ until: "까지",
5717
5720
  startsOn: "시작",
5718
5721
  startDate: "시작일",
5719
5722
  renewsOn: "갱신",
@@ -6200,7 +6203,7 @@ var youAreSafe = "Estás seguro - PCI compliance 128 SSL por";
6200
6203
  var cancel = "Cancela tu suscripción en línea en cualquier momento.";
6201
6204
  var giftSent = "La suscripción de regalo se ha enviado a";
6202
6205
  var successfully = "exitosamente";
6203
- var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1>Suscríbete</1> ahora para obtener acceso completo.";
6206
+ var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1> Suscríbete </1> ahora para obtener acceso completo.";
6204
6207
  var recaptcha = "Este sitio está protegido por reCAPTCHA, aplica la <1>Política de Privacidad</1> y los <3>Términos de Servicio</3> de Google.";
6205
6208
  var invalidInvoice = "Número de comprobante de pago inválido, por favor contacta a soporte.";
6206
6209
  var zeroTotalInvoice = "No puedes ver un comprobante de pago de $0";
@@ -6642,6 +6645,7 @@ var labels$5 = {
6642
6645
  paymentSource: "Datos de pago",
6643
6646
  actions: "Acciones",
6644
6647
  expiresOn: "Finaliza",
6648
+ until: "Hasta que",
6645
6649
  startsOn: "Inicia",
6646
6650
  startDate: "Fecha de inicio",
6647
6651
  renewsOn: "Renovación",
@@ -9040,6 +9044,27 @@ function userMustVerifyEmail() {
9040
9044
  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;
9041
9045
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
9042
9046
  }
9047
+ function notifyBugsnag(callback, startOptions) {
9048
+ if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
9049
+ //load bugsnag CDN
9050
+ window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
9051
+ document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
9052
+ var _window$Pelcro$enviro, _window$Pelcro3, _window$Pelcro3$envir, _window$Pelcro4, _window$Pelcro4$envir;
9053
+
9054
+ Bugsnag.start({
9055
+ apiKey: (_window$Pelcro$enviro = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$envir = _window$Pelcro3.environment) === null || _window$Pelcro3$envir === void 0 ? void 0 : _window$Pelcro3$envir.bugsnagKey) !== null && _window$Pelcro$enviro !== void 0 ? _window$Pelcro$enviro : "e8f6852b322540e8c25386048b99ab01",
9056
+ autoDetectErrors: false,
9057
+ releaseStage: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$envir = _window$Pelcro4.environment) === null || _window$Pelcro4$envir === void 0 ? void 0 : _window$Pelcro4$envir.bugsnagReleaseStage,
9058
+ redactedKeys: ["security_key", "password", "password_confirmation", "auth_token", "token"],
9059
+ ...startOptions
9060
+ });
9061
+ callback();
9062
+ });
9063
+ return;
9064
+ }
9065
+
9066
+ callback();
9067
+ }
9043
9068
 
9044
9069
  const resources = {
9045
9070
  en: {
@@ -11208,8 +11233,10 @@ const loadPaymentSDKs = () => {
11208
11233
  const {
11209
11234
  whenUserReady
11210
11235
  } = usePelcro.getStore();
11236
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11237
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11211
11238
  whenUserReady(() => {
11212
- if (!window.Stripe) {
11239
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11213
11240
  pure_1(window.Pelcro.environment.stripe);
11214
11241
  }
11215
11242
  }); // Load PayPal SDKs
@@ -11222,8 +11249,6 @@ const loadPaymentSDKs = () => {
11222
11249
  } // Load Vantiv SDKs
11223
11250
 
11224
11251
 
11225
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11226
-
11227
11252
  if (supportsVantiv) {
11228
11253
  if (!window.jQuery) {
11229
11254
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
@@ -11231,15 +11256,13 @@ const loadPaymentSDKs = () => {
11231
11256
 
11232
11257
  if (!window.EprotectIframeClient) {
11233
11258
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
11234
- const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
11259
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
11235
11260
  const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
11236
11261
  window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
11237
11262
  }
11238
11263
  } // Load Tap SDKs
11239
11264
 
11240
11265
 
11241
- const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11242
-
11243
11266
  if (supportsTap) {
11244
11267
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
11245
11268
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
@@ -11436,7 +11459,11 @@ const initSubscriptionFromURL = () => {
11436
11459
  var _selectedProduct$plan;
11437
11460
 
11438
11461
  const productsList = window.Pelcro.product.list();
11439
- if (!(productsList !== null && productsList !== void 0 && productsList.length)) return;
11462
+
11463
+ if (!(productsList !== null && productsList !== void 0 && productsList.length)) {
11464
+ return;
11465
+ }
11466
+
11440
11467
  const [productId, planId, isGiftParam] = [window.Pelcro.helpers.getURLParameter("product_id"), window.Pelcro.helpers.getURLParameter("plan_id"), window.Pelcro.helpers.getURLParameter("is_gift")];
11441
11468
  const isGift = (isGiftParam === null || isGiftParam === void 0 ? void 0 : isGiftParam.toLowerCase()) === "true";
11442
11469
  const selectedProduct = productsList.find(product => product.id === Number(productId));
@@ -12363,7 +12390,7 @@ function Email({
12363
12390
  }, []);
12364
12391
 
12365
12392
  const isEmailValid = email => {
12366
- const re = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?/;
12393
+ const re = /[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?/;
12367
12394
  return re.test(email);
12368
12395
  };
12369
12396
 
@@ -18970,6 +18997,22 @@ class SelectModal extends Component {
18970
18997
  }
18971
18998
 
18972
18999
  document.addEventListener("keydown", this.handleSubmit);
19000
+
19001
+ if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
19002
+ notifyBugsnag(() => {
19003
+ Bugsnag.notify("SelectModal - No data viewed", event => {
19004
+ var _window$Pelcro, _window$Pelcro$site, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro4;
19005
+
19006
+ event.addMetadata("MetaData", {
19007
+ site: (_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.read(),
19008
+ user: (_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(),
19009
+ uiVersion: (_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.uiVersion,
19010
+ environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
19011
+ });
19012
+ });
19013
+ });
19014
+ console.log("bugsnag Triggered");
19015
+ }
18973
19016
  });
18974
19017
 
18975
19018
  _defineProperty$3(this, "componentWillUnmount", () => {
@@ -21994,7 +22037,7 @@ const PaymentMethodContainerWithoutStripe = ({
21994
22037
  vantivInstanceRef.current = new window.EprotectIframeClient({
21995
22038
  paypageId: payPageId,
21996
22039
  reportGroup: reportGroup,
21997
- style: "enhancedStyle3",
22040
+ style: "enhancedStyle5",
21998
22041
  height: "245",
21999
22042
  timeout: 50000,
22000
22043
  div: "eProtectiframe",
@@ -23155,9 +23198,10 @@ const PaymentMethodContainer = props => {
23155
23198
  const {
23156
23199
  whenUserReady
23157
23200
  } = usePelcro.getStore();
23201
+ const cardProcessor = getSiteCardProcessor();
23158
23202
  useEffect(() => {
23159
23203
  whenUserReady(() => {
23160
- if (!window.Stripe) {
23204
+ if (!window.Stripe && cardProcessor === "stripe") {
23161
23205
  document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
23162
23206
  setIsStripeLoaded(true);
23163
23207
  });
@@ -23173,9 +23217,11 @@ const PaymentMethodContainer = props => {
23173
23217
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
23174
23218
  store: store$k
23175
23219
  }, props))));
23220
+ } else {
23221
+ return /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
23222
+ store: store$k
23223
+ }, props));
23176
23224
  }
23177
-
23178
- return null;
23179
23225
  };
23180
23226
 
23181
23227
  const StripeInputStyle = {
@@ -24821,8 +24867,15 @@ const PaymentSuccessView = ({
24821
24867
 
24822
24868
  if (successTitle && successContent) {
24823
24869
  return /*#__PURE__*/React__default.createElement("div", {
24824
- className: "plc-flex plc-flex-col plc-items-center"
24825
- }, successIcon, /*#__PURE__*/React__default.createElement("div", {
24870
+ className: "plc-flex plc-flex-col plc-items-center plc-relative"
24871
+ }, /*#__PURE__*/React__default.createElement("button", {
24872
+ type: "button",
24873
+ className: "pelcro-modal-close plc-absolute plc-top-6 plc-right-0",
24874
+ "aria-label": "close modal",
24875
+ onClick: onClose
24876
+ }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
24877
+ className: "plc-fill-current"
24878
+ })), successIcon, /*#__PURE__*/React__default.createElement("div", {
24826
24879
  className: "plc-text-center plc-text-gray-900"
24827
24880
  }, /*#__PURE__*/React__default.createElement("h4", {
24828
24881
  className: "plc-mb-4 plc-text-3xl"
@@ -32988,13 +33041,52 @@ const OrderItems = ({
32988
33041
  const DonationsMenu = ({
32989
33042
  reactivateSubscription,
32990
33043
  disableSubmit,
32991
- cancelSubscription
33044
+ cancelSubscription,
33045
+ onClose
32992
33046
  }) => {
32993
33047
  const {
32994
33048
  t
32995
33049
  } = useTranslation("dashboard");
32996
- usePelcro();
33050
+ const {
33051
+ switchView,
33052
+ setSubscriptionToCancel
33053
+ } = usePelcro();
32997
33054
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
33055
+ // Cancel button click handlers
33056
+ const onCancelClick = () => {
33057
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
33058
+
33059
+ if (isImmediateCancelationEnabled) {
33060
+ setSubscriptionToCancel(sub.id);
33061
+ return switchView("subscription-cancel");
33062
+ }
33063
+
33064
+ if (userMustVerifyEmail()) {
33065
+ return switchView("email-verify");
33066
+ }
33067
+
33068
+ switchView(null);
33069
+ onClose === null || onClose === void 0 ? void 0 : onClose();
33070
+ notify.confirm((onSuccess, onFailure) => {
33071
+ cancelSubscription(sub.id, onSuccess, onFailure);
33072
+ }, {
33073
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
33074
+ loadingMessage: t("messages.subCancellation.loading"),
33075
+ successMessage: t("messages.subCancellation.success"),
33076
+ errorMessage: t("messages.subCancellation.error")
33077
+ }, {
33078
+ closeButtonLabel: t("labels.subCancellation.goBack")
33079
+ });
33080
+ }; // Reactivate button click handlers
33081
+
33082
+
33083
+ const onReactivateClick = () => {
33084
+ if (userMustVerifyEmail()) {
33085
+ return switchView("email-verify");
33086
+ }
33087
+
33088
+ reactivateSubscription(sub.id);
33089
+ };
32998
33090
 
32999
33091
  return /*#__PURE__*/React__default.createElement("tr", {
33000
33092
  key: sub.id,
@@ -33007,7 +33099,21 @@ const DonationsMenu = ({
33007
33099
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
33008
33100
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("div", {
33009
33101
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
33010
- }, sub.status && /*#__PURE__*/React__default.createElement("span", null, formatStartDate(sub.start)))));
33102
+ }, sub.status && /*#__PURE__*/React__default.createElement("span", null, formatStartDate(sub.start)))), /*#__PURE__*/React__default.createElement("td", null, sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
33103
+ variant: "ghost",
33104
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
33105
+ icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
33106
+ onClick: onReactivateClick,
33107
+ disabled: disableSubmit,
33108
+ "data-key": sub.id
33109
+ }, t("labels.reactivate")), !sub.plan.auto_renew || sub.plan.auto_renew && sub.cancel_at_period_end === 0 ? /*#__PURE__*/React__default.createElement(Button, {
33110
+ variant: "ghost",
33111
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
33112
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
33113
+ onClick: onCancelClick,
33114
+ disabled: disableSubmit,
33115
+ "data-key": sub.id
33116
+ }, t("labels.unsubscribe")) : ""));
33011
33117
  });
33012
33118
  return /*#__PURE__*/React__default.createElement(Card, {
33013
33119
  id: "pelcro-dashboard-donation-menu",
@@ -33018,10 +33124,12 @@ const DonationsMenu = ({
33018
33124
  }, /*#__PURE__*/React__default.createElement("thead", {
33019
33125
  className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
33020
33126
  }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
33021
- className: "plc-w-1/4"
33127
+ className: "plc-w-4/12"
33022
33128
  }, t("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
33023
- className: "plc-w-1/4"
33024
- }, t("labels.startDate")))), /*#__PURE__*/React__default.createElement("tbody", null, subscriptions)));
33129
+ className: "plc-w-5/12"
33130
+ }, t("labels.startDate")), /*#__PURE__*/React__default.createElement("th", {
33131
+ className: "plc-w-3/12"
33132
+ }, t("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, subscriptions)));
33025
33133
  };
33026
33134
 
33027
33135
  function getDonationSubs() {
@@ -33445,7 +33553,9 @@ const AddressesMenu = props => {
33445
33553
  const AddressesItems = props => {
33446
33554
  var _window$Pelcro$user$r;
33447
33555
 
33448
- useTranslation("dashboard");
33556
+ const {
33557
+ t
33558
+ } = useTranslation("dashboard");
33449
33559
  const {
33450
33560
  switchView
33451
33561
  } = usePelcro();
@@ -33476,7 +33586,9 @@ const AddressesItems = props => {
33476
33586
  return addresses.map((address, index) => address.type === "shipping" && /*#__PURE__*/React__default.createElement("div", {
33477
33587
  key: address.id,
33478
33588
  className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark ${selectedAddressId === String(address.id) && `plc-border-primary-400 plc-border-2`}`
33479
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
33589
+ }, /*#__PURE__*/React__default.createElement("div", {
33590
+ className: "plc-flex-1 plc-relative"
33591
+ }, /*#__PURE__*/React__default.createElement("p", {
33480
33592
  className: "pelcro-address-name plc-font-semibold"
33481
33593
  }, address.first_name, " ", address.last_name), /*#__PURE__*/React__default.createElement("p", {
33482
33594
  className: "pelcro-address-company"
@@ -33484,7 +33596,9 @@ const AddressesItems = props => {
33484
33596
  className: "pelcro-address-line1 plc-text-sm plc-mt-2"
33485
33597
  }, address.line1), /*#__PURE__*/React__default.createElement("p", {
33486
33598
  className: "pelcro-address-country plc-text-sm"
33487
- }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default.createElement(Button, {
33599
+ }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name), address.is_default && /*#__PURE__*/React__default.createElement("span", {
33600
+ className: "plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-mt-4"
33601
+ }, t("labels.default"))), /*#__PURE__*/React__default.createElement(Button, {
33488
33602
  variant: "icon",
33489
33603
  className: "plc-text-gray-500",
33490
33604
  icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
@@ -35382,6 +35496,13 @@ class Dashboard extends Component {
35382
35496
  return `${this.locale("labels.status.incomplete")}`;
35383
35497
  }
35384
35498
 
35499
+ if (subscription.status === "extended") {
35500
+ // DateTime from BE is missing 3 zeros so we add them before instancing a date
35501
+ const expiryDate = new Date(Number(`${subscription.end_date}000`));
35502
+ const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35503
+ return `${this.locale("labels.until")} ${formattedExpiryDate}`;
35504
+ }
35505
+
35385
35506
  if (subscription.cancel_at_period_end) {
35386
35507
  // DateTime from BE is missing 3 zeros so we add them before instancing a date
35387
35508
  const expiryDate = new Date(Number(`${subscription.expires_at}000`));
@@ -35570,7 +35691,7 @@ class Dashboard extends Component {
35570
35691
  }, /*#__PURE__*/React__default.createElement("div", {
35571
35692
  className: "plc-flex plc-items-center"
35572
35693
  }, /*#__PURE__*/React__default.createElement("div", {
35573
- className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 "
35694
+ className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35574
35695
  }, /*#__PURE__*/React__default.createElement("div", {
35575
35696
  className: "plc-relative plc-flex-shrink-0"
35576
35697
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -35581,9 +35702,9 @@ class Dashboard extends Component {
35581
35702
  }))), /*#__PURE__*/React__default.createElement("div", {
35582
35703
  className: "plc-flex plc-flex-col plc-justify-between plc-flex-grow plc-w-56 plc-ml-4 plc-break-words sm:plc-w-auto"
35583
35704
  }, userHasName && /*#__PURE__*/React__default.createElement("p", {
35584
- className: "plc-font-bold"
35705
+ className: "plc-font-bold plc-break-all"
35585
35706
  }, this.user.first_name, " ", this.user.last_name), /*#__PURE__*/React__default.createElement("p", {
35586
- className: `plc-m-0 plc-text-sm ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35707
+ className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35587
35708
  }, this.user.email)), /*#__PURE__*/React__default.createElement("div", {
35588
35709
  className: "lg:plc-hidden"
35589
35710
  }, /*#__PURE__*/React__default.createElement(Button, {
@@ -35667,6 +35788,7 @@ class Dashboard extends Component {
35667
35788
  setActiveDashboardLink: this.setActiveDashboardLink,
35668
35789
  activeDashboardLink: this.state.activeDashboardLink
35669
35790
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35791
+ show: hasActiveMemberships(),
35670
35792
  name: SUB_MENUS.MEMBERSHIPS,
35671
35793
  icon: /*#__PURE__*/React__default.createElement(SvgMemberships, {
35672
35794
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35675,6 +35797,7 @@ class Dashboard extends Component {
35675
35797
  setActiveDashboardLink: this.setActiveDashboardLink,
35676
35798
  activeDashboardLink: this.state.activeDashboardLink
35677
35799
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35800
+ show: hasDonationSubs(),
35678
35801
  name: SUB_MENUS.DONATIONS,
35679
35802
  icon: /*#__PURE__*/React__default.createElement(SvgDonate, {
35680
35803
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35689,6 +35812,7 @@ class Dashboard extends Component {
35689
35812
  setActiveDashboardLink: this.setActiveDashboardLink,
35690
35813
  activeDashboardLink: this.state.activeDashboardLink
35691
35814
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35815
+ show: window.Pelcro.site.read().ecommerce_enabled,
35692
35816
  name: SUB_MENUS.ORDERS,
35693
35817
  icon: /*#__PURE__*/React__default.createElement(SvgShopping, null),
35694
35818
  title: this.locale("labels.orders.label"),
@@ -35765,6 +35889,20 @@ function showNewsletters() {
35765
35889
  return showNewslettersUiSettings;
35766
35890
  }
35767
35891
 
35892
+ function hasDonationSubs() {
35893
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
35894
+
35895
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
35896
+ const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
35897
+ return donations.length > 0 || canceledDonations.length > 0;
35898
+ }
35899
+
35900
+ function hasActiveMemberships() {
35901
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
35902
+
35903
+ return (_window$Pelcro$user$r6 = (_window$Pelcro$user$r7 = window.Pelcro.user.read().memberships) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.some(membership => membership.status === "active" && membership.subscription.ended_at === null)) !== null && _window$Pelcro$user$r6 !== void 0 ? _window$Pelcro$user$r6 : false;
35904
+ }
35905
+
35768
35906
  const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
35769
35907
 
35770
35908
  // The button in the lower left that shows the dashboard.
@@ -37762,7 +37900,6 @@ const EmailVerifyModal = ({
37762
37900
  switchToAddressView,
37763
37901
  switchToPaymentView
37764
37902
  } = usePelcro();
37765
- console.log("verify email");
37766
37903
 
37767
37904
  const onSuccess = res => {
37768
37905
  var _otherProps$onSuccess;
package/dist/pelcro.css CHANGED
@@ -1833,6 +1833,7 @@ Add the correct display in Chrome and Safari.
1833
1833
  display: flex !important;
1834
1834
  align-items: center;
1835
1835
  justify-content: center;
1836
+ flex-wrap: wrap;
1836
1837
  }
1837
1838
 
1838
1839
  .pelcro-root .slick-dots li {
@@ -1975,6 +1976,10 @@ in order to scope selectors under pelcro-root
1975
1976
  top: 1.25rem;
1976
1977
  }
1977
1978
 
1979
+ .pelcro-root .plc-top-6 {
1980
+ top: 1.5rem;
1981
+ }
1982
+
1978
1983
  .pelcro-root .plc-top-7 {
1979
1984
  top: 1.75rem;
1980
1985
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "4.0.0-alpha.26",
4
+ "version": "4.0.0-alpha.28",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",