@pelcro/react-pelcro-js 3.26.0-beta.59 → 3.26.0-beta.60

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
@@ -23460,6 +23460,84 @@ const SubscriptionCancelModal = _ref => {
23460
23460
  };
23461
23461
  SubscriptionCancelModal.viewId = "subscription-cancel";
23462
23462
 
23463
+ const SubscriptionCancelLaterButton = _ref => {
23464
+ let {
23465
+ subscription,
23466
+ onClick,
23467
+ className
23468
+ } = _ref;
23469
+ const {
23470
+ switchView
23471
+ } = usePelcro();
23472
+ const {
23473
+ state: {
23474
+ cancelationReason
23475
+ },
23476
+ dispatch
23477
+ } = React.useContext(store$k);
23478
+ const {
23479
+ t
23480
+ } = useTranslation("subscriptionCancel");
23481
+ const cancelSubscription = (payload, onSuccess, onFailure) => {
23482
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
23483
+ 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;
23484
+ window.Pelcro.subscription.cancel({
23485
+ auth_token: window.Pelcro.user.read().auth_token,
23486
+ subscription_id: payload.subscription_id,
23487
+ mode: payload.mode,
23488
+ ...(payload.reason && {
23489
+ reason: payload.reason
23490
+ })
23491
+ }, (err, res) => {
23492
+ if (err) {
23493
+ return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
23494
+ }
23495
+ if (enableReactGA4) {
23496
+ ReactGA4.event("Canceled", {
23497
+ nonInteraction: true
23498
+ });
23499
+ } else {
23500
+ var _ReactGA$event;
23501
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
23502
+ category: "ACTIONS",
23503
+ action: "Canceled",
23504
+ nonInteraction: true
23505
+ });
23506
+ }
23507
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
23508
+ });
23509
+ };
23510
+ const handleCancelNowClick = () => {
23511
+ const payload = {
23512
+ subscription_id: subscription.id,
23513
+ mode: "period_end",
23514
+ ...(cancelationReason && {
23515
+ reason: cancelationReason
23516
+ })
23517
+ };
23518
+ onClick === null || onClick === void 0 ? void 0 : onClick();
23519
+
23520
+ // Close the modal
23521
+ switchView(null);
23522
+
23523
+ // Show confirmation alert after closing the modal
23524
+ notify.confirm((onSuccess, onFailure) => {
23525
+ cancelSubscription(payload, onSuccess, onFailure);
23526
+ }, {
23527
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
23528
+ loadingMessage: t("messages.subCancellation.loading"),
23529
+ successMessage: t("messages.subCancellation.success"),
23530
+ errorMessage: t("messages.subCancellation.error")
23531
+ }, {
23532
+ closeButtonLabel: t("labels.subCancellation.goBack")
23533
+ });
23534
+ };
23535
+ return /*#__PURE__*/React__default['default'].createElement(Button, {
23536
+ onClick: handleCancelNowClick,
23537
+ className: `${className}`
23538
+ }, t("messages.cancelLater"));
23539
+ };
23540
+
23463
23541
  const initialState$j = {
23464
23542
  suspendDate: null,
23465
23543
  buttonDisabled: false
@@ -37400,7 +37478,13 @@ exports.ShopPurchaseButton = ShopPurchaseButton;
37400
37478
  exports.ShopSelectProductButton = ShopSelectProductButton;
37401
37479
  exports.ShopView = ShopView;
37402
37480
  exports.SubmitPaymentMethod = SubmitPaymentMethod;
37481
+ exports.SubscriptionCancelButton = SubscriptionCancelButton;
37482
+ exports.SubscriptionCancelContainer = SubscriptionCancelContainer;
37483
+ exports.SubscriptionCancelLaterButton = SubscriptionCancelLaterButton;
37403
37484
  exports.SubscriptionCancelModal = SubscriptionCancelModal;
37485
+ exports.SubscriptionCancelOptions = SubscriptionCancelOptions;
37486
+ exports.SubscriptionCancelReason = SubscriptionCancelReason;
37487
+ exports.SubscriptionCancelView = SubscriptionCancelView;
37404
37488
  exports.SubscriptionCreateContainer = SubscriptionCreateContainer;
37405
37489
  exports.SubscriptionCreateFreePlanButton = SubscriptionCreateFreePlanButton;
37406
37490
  exports.SubscriptionCreateModal = SubscriptionCreateModal;
package/dist/index.esm.js CHANGED
@@ -23430,6 +23430,84 @@ const SubscriptionCancelModal = _ref => {
23430
23430
  };
23431
23431
  SubscriptionCancelModal.viewId = "subscription-cancel";
23432
23432
 
23433
+ const SubscriptionCancelLaterButton = _ref => {
23434
+ let {
23435
+ subscription,
23436
+ onClick,
23437
+ className
23438
+ } = _ref;
23439
+ const {
23440
+ switchView
23441
+ } = usePelcro();
23442
+ const {
23443
+ state: {
23444
+ cancelationReason
23445
+ },
23446
+ dispatch
23447
+ } = useContext(store$k);
23448
+ const {
23449
+ t
23450
+ } = useTranslation("subscriptionCancel");
23451
+ const cancelSubscription = (payload, onSuccess, onFailure) => {
23452
+ var _window, _window$Pelcro, _window$Pelcro$uiSett;
23453
+ 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;
23454
+ window.Pelcro.subscription.cancel({
23455
+ auth_token: window.Pelcro.user.read().auth_token,
23456
+ subscription_id: payload.subscription_id,
23457
+ mode: payload.mode,
23458
+ ...(payload.reason && {
23459
+ reason: payload.reason
23460
+ })
23461
+ }, (err, res) => {
23462
+ if (err) {
23463
+ return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
23464
+ }
23465
+ if (enableReactGA4) {
23466
+ ReactGA4.event("Canceled", {
23467
+ nonInteraction: true
23468
+ });
23469
+ } else {
23470
+ var _ReactGA$event;
23471
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
23472
+ category: "ACTIONS",
23473
+ action: "Canceled",
23474
+ nonInteraction: true
23475
+ });
23476
+ }
23477
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
23478
+ });
23479
+ };
23480
+ const handleCancelNowClick = () => {
23481
+ const payload = {
23482
+ subscription_id: subscription.id,
23483
+ mode: "period_end",
23484
+ ...(cancelationReason && {
23485
+ reason: cancelationReason
23486
+ })
23487
+ };
23488
+ onClick === null || onClick === void 0 ? void 0 : onClick();
23489
+
23490
+ // Close the modal
23491
+ switchView(null);
23492
+
23493
+ // Show confirmation alert after closing the modal
23494
+ notify.confirm((onSuccess, onFailure) => {
23495
+ cancelSubscription(payload, onSuccess, onFailure);
23496
+ }, {
23497
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
23498
+ loadingMessage: t("messages.subCancellation.loading"),
23499
+ successMessage: t("messages.subCancellation.success"),
23500
+ errorMessage: t("messages.subCancellation.error")
23501
+ }, {
23502
+ closeButtonLabel: t("labels.subCancellation.goBack")
23503
+ });
23504
+ };
23505
+ return /*#__PURE__*/React__default.createElement(Button, {
23506
+ onClick: handleCancelNowClick,
23507
+ className: `${className}`
23508
+ }, t("messages.cancelLater"));
23509
+ };
23510
+
23433
23511
  const initialState$j = {
23434
23512
  suspendDate: null,
23435
23513
  buttonDisabled: false
@@ -37169,4 +37247,4 @@ const QrCodeModal = _ref => {
37169
37247
  };
37170
37248
  QrCodeModal.viewId = "qrcode";
37171
37249
 
37172
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, DonationModalWithHook as DonationModal, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, TextInput, Tooltip, UserNameInput, UserUpdateButton, UserUpdateCompany, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateJobTitle, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, initPaywalls, initViewFromURL, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
37250
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, DonationModalWithHook as DonationModal, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelButton, SubscriptionCancelContainer, SubscriptionCancelLaterButton, SubscriptionCancelModal, SubscriptionCancelOptions, SubscriptionCancelReason, SubscriptionCancelView, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, TextInput, Tooltip, UserNameInput, UserUpdateButton, UserUpdateCompany, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateJobTitle, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, initPaywalls, initViewFromURL, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
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": "3.26.0-beta.59",
4
+ "version": "3.26.0-beta.60",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",