@pelcro/react-pelcro-js 3.12.0 → 3.13.0-beta.2
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 +79 -15
- package/dist/index.esm.js +79 -16
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3252,7 +3252,8 @@ var validation$2 = {
|
|
|
3252
3252
|
};
|
|
3253
3253
|
var buttons$e = {
|
|
3254
3254
|
account: "Accès abonné(e)s",
|
|
3255
|
-
login: "Se connecter"
|
|
3255
|
+
login: "Se connecter",
|
|
3256
|
+
subscribe: "S'abonner"
|
|
3256
3257
|
};
|
|
3257
3258
|
var dashboard$3 = {
|
|
3258
3259
|
labels: {
|
|
@@ -3344,7 +3345,8 @@ var validation$1 = {
|
|
|
3344
3345
|
};
|
|
3345
3346
|
var buttons$d = {
|
|
3346
3347
|
account: "My account",
|
|
3347
|
-
login: "Login"
|
|
3348
|
+
login: "Login",
|
|
3349
|
+
subscribe: "Subscribe"
|
|
3348
3350
|
};
|
|
3349
3351
|
var dashboard$2 = {
|
|
3350
3352
|
labels: {
|
|
@@ -3435,7 +3437,8 @@ var validation = {
|
|
|
3435
3437
|
};
|
|
3436
3438
|
var buttons$c = {
|
|
3437
3439
|
account: "내 계정",
|
|
3438
|
-
login: "로그인"
|
|
3440
|
+
login: "로그인",
|
|
3441
|
+
subscribe: "구독하다"
|
|
3439
3442
|
};
|
|
3440
3443
|
var dashboard$1 = {
|
|
3441
3444
|
labels: {
|
|
@@ -9610,7 +9613,11 @@ const authenticatedButtons = () => {
|
|
|
9610
9613
|
|
|
9611
9614
|
if (pelcroLoginByClass) {
|
|
9612
9615
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9613
|
-
pelcroLoginByClass.item(i).
|
|
9616
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-dashboard-text")) {
|
|
9617
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-dashboard-text");
|
|
9618
|
+
} else {
|
|
9619
|
+
pelcroLoginByClass.item(i).innerHTML = translations.account;
|
|
9620
|
+
}
|
|
9614
9621
|
}
|
|
9615
9622
|
}
|
|
9616
9623
|
|
|
@@ -9630,7 +9637,11 @@ const unauthenticatedButtons = () => {
|
|
|
9630
9637
|
|
|
9631
9638
|
if (pelcroLoginByClass) {
|
|
9632
9639
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9633
|
-
pelcroLoginByClass.item(i).
|
|
9640
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-login-text")) {
|
|
9641
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-login-text");
|
|
9642
|
+
} else {
|
|
9643
|
+
pelcroLoginByClass.item(i).innerHTML = translations.login;
|
|
9644
|
+
}
|
|
9634
9645
|
}
|
|
9635
9646
|
}
|
|
9636
9647
|
};
|
|
@@ -15401,7 +15412,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15401
15412
|
onFailure = () => {},
|
|
15402
15413
|
...props
|
|
15403
15414
|
}) => {
|
|
15404
|
-
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
|
|
15415
|
+
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett;
|
|
15405
15416
|
|
|
15406
15417
|
const {
|
|
15407
15418
|
t
|
|
@@ -15424,6 +15435,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15424
15435
|
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
15425
15436
|
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
15426
15437
|
const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
|
|
15438
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
15427
15439
|
const cardProcessor = getSiteCardProcessor();
|
|
15428
15440
|
React.useEffect(() => {
|
|
15429
15441
|
if (window.Pelcro.coupon.getFromUrl()) {
|
|
@@ -15970,6 +15982,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15970
15982
|
}, [selectedPaymentMethodId]);
|
|
15971
15983
|
|
|
15972
15984
|
const initPaymentRequest = (state, dispatch) => {
|
|
15985
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
15986
|
+
|
|
15973
15987
|
try {
|
|
15974
15988
|
const paymentRequest = stripe.paymentRequest({
|
|
15975
15989
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16041,6 +16055,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16041
16055
|
const updateTotalAmountWithTax = () => {
|
|
16042
16056
|
var _window$Pelcro$site$r4;
|
|
16043
16057
|
|
|
16058
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16044
16059
|
const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
|
|
16045
16060
|
|
|
16046
16061
|
if (taxesEnabled && type === "createPayment") {
|
|
@@ -16367,8 +16382,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16367
16382
|
|
|
16368
16383
|
if (!subscriptionIdToRenew) {
|
|
16369
16384
|
window.Pelcro.subscription.create({
|
|
16370
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16371
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16385
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16386
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16372
16387
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16373
16388
|
plan_id: plan.id,
|
|
16374
16389
|
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
@@ -17926,6 +17941,41 @@ const IncludePhone = props => /*#__PURE__*/React__default['default'].createEleme
|
|
|
17926
17941
|
store: store$j
|
|
17927
17942
|
}, props));
|
|
17928
17943
|
|
|
17944
|
+
const SubscriptionCreateFreePlanButton = ({
|
|
17945
|
+
name,
|
|
17946
|
+
onClick,
|
|
17947
|
+
...otherProps
|
|
17948
|
+
}) => {
|
|
17949
|
+
const {
|
|
17950
|
+
state: {
|
|
17951
|
+
disableSubmit
|
|
17952
|
+
},
|
|
17953
|
+
dispatch
|
|
17954
|
+
} = React.useContext(store$j);
|
|
17955
|
+
const {
|
|
17956
|
+
t
|
|
17957
|
+
} = useTranslation("common");
|
|
17958
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
17959
|
+
React.useEffect(() => {
|
|
17960
|
+
setDisabled(disableSubmit);
|
|
17961
|
+
}, [disableSubmit]);
|
|
17962
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
17963
|
+
className: "plc-w-full",
|
|
17964
|
+
onClick: () => {
|
|
17965
|
+
dispatch({
|
|
17966
|
+
type: DISABLE_SUBMIT,
|
|
17967
|
+
payload: true
|
|
17968
|
+
});
|
|
17969
|
+
dispatch({
|
|
17970
|
+
type: SUBSCRIBE
|
|
17971
|
+
});
|
|
17972
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17973
|
+
},
|
|
17974
|
+
disabled: isDisabled,
|
|
17975
|
+
isLoading: disableSubmit
|
|
17976
|
+
}, otherProps), t("buttons.subscribe"));
|
|
17977
|
+
};
|
|
17978
|
+
|
|
17929
17979
|
/**
|
|
17930
17980
|
*
|
|
17931
17981
|
*/
|
|
@@ -17936,7 +17986,8 @@ function PaymentMethodView({
|
|
|
17936
17986
|
onFailure,
|
|
17937
17987
|
type,
|
|
17938
17988
|
showCoupon,
|
|
17939
|
-
showExternalPaymentMethods
|
|
17989
|
+
showExternalPaymentMethods,
|
|
17990
|
+
showSubscriptionButton
|
|
17940
17991
|
}) {
|
|
17941
17992
|
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
17942
17993
|
|
|
@@ -17951,7 +18002,7 @@ function PaymentMethodView({
|
|
|
17951
18002
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17952
18003
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17953
18004
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17954
|
-
}, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18005
|
+
}, cardProcessor === "stripe" && !showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17955
18006
|
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
17956
18007
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
17957
18008
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -17968,9 +18019,9 @@ function PaymentMethodView({
|
|
|
17968
18019
|
onSuccess: onSuccess,
|
|
17969
18020
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
17970
18021
|
onFailure: onFailure
|
|
17971
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
18022
|
+
}, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
17972
18023
|
className: "plc-mb-2"
|
|
17973
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18024
|
+
}), showSubscriptionButton ? /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null) : /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17974
18025
|
className: "plc-flex plc-items-start"
|
|
17975
18026
|
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
17976
18027
|
id: "pelcro-input-first-name",
|
|
@@ -19383,7 +19434,7 @@ const SubscriptionCreateView = ({
|
|
|
19383
19434
|
onSuccess = () => {},
|
|
19384
19435
|
onFailure = () => {}
|
|
19385
19436
|
}) => {
|
|
19386
|
-
var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
19437
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
19387
19438
|
|
|
19388
19439
|
const {
|
|
19389
19440
|
t
|
|
@@ -19392,6 +19443,8 @@ const SubscriptionCreateView = ({
|
|
|
19392
19443
|
product,
|
|
19393
19444
|
plan
|
|
19394
19445
|
} = usePelcro();
|
|
19446
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
19447
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
19395
19448
|
|
|
19396
19449
|
const getPricingText = plan => {
|
|
19397
19450
|
var _plan$quantity;
|
|
@@ -19430,7 +19483,8 @@ const SubscriptionCreateView = ({
|
|
|
19430
19483
|
showCoupon: true,
|
|
19431
19484
|
showExternalPaymentMethods: true,
|
|
19432
19485
|
onSuccess: onSuccess,
|
|
19433
|
-
onFailure: onFailure
|
|
19486
|
+
onFailure: onFailure,
|
|
19487
|
+
showSubscriptionButton: showSubscriptionButton
|
|
19434
19488
|
}));
|
|
19435
19489
|
};
|
|
19436
19490
|
|
|
@@ -24183,10 +24237,19 @@ const PaymentMethodSelectModal = ({
|
|
|
24183
24237
|
onClose,
|
|
24184
24238
|
...otherProps
|
|
24185
24239
|
}) => {
|
|
24240
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
24241
|
+
|
|
24186
24242
|
const {
|
|
24187
24243
|
switchToCheckoutForm,
|
|
24188
|
-
set
|
|
24244
|
+
set,
|
|
24245
|
+
plan
|
|
24189
24246
|
} = usePelcro();
|
|
24247
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
24248
|
+
React.useEffect(() => {
|
|
24249
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
24250
|
+
switchToCheckoutForm();
|
|
24251
|
+
}
|
|
24252
|
+
}, []);
|
|
24190
24253
|
|
|
24191
24254
|
const onSuccess = selectedPaymentMethodId => {
|
|
24192
24255
|
var _otherProps$onSuccess;
|
|
@@ -31130,6 +31193,7 @@ exports.ShopView = ShopView;
|
|
|
31130
31193
|
exports.SubmitPaymentMethod = SubmitPaymentMethod;
|
|
31131
31194
|
exports.SubscriptionCancelModal = SubscriptionCancelModal;
|
|
31132
31195
|
exports.SubscriptionCreateContainer = SubscriptionCreateContainer;
|
|
31196
|
+
exports.SubscriptionCreateFreePlanButton = SubscriptionCreateFreePlanButton;
|
|
31133
31197
|
exports.SubscriptionCreateModal = SubscriptionCreateModal;
|
|
31134
31198
|
exports.SubscriptionCreateView = SubscriptionCreateView;
|
|
31135
31199
|
exports.SubscriptionRenewContainer = SubscriptionRenewContainer;
|
package/dist/index.esm.js
CHANGED
|
@@ -3222,7 +3222,8 @@ var validation$2 = {
|
|
|
3222
3222
|
};
|
|
3223
3223
|
var buttons$e = {
|
|
3224
3224
|
account: "Accès abonné(e)s",
|
|
3225
|
-
login: "Se connecter"
|
|
3225
|
+
login: "Se connecter",
|
|
3226
|
+
subscribe: "S'abonner"
|
|
3226
3227
|
};
|
|
3227
3228
|
var dashboard$3 = {
|
|
3228
3229
|
labels: {
|
|
@@ -3314,7 +3315,8 @@ var validation$1 = {
|
|
|
3314
3315
|
};
|
|
3315
3316
|
var buttons$d = {
|
|
3316
3317
|
account: "My account",
|
|
3317
|
-
login: "Login"
|
|
3318
|
+
login: "Login",
|
|
3319
|
+
subscribe: "Subscribe"
|
|
3318
3320
|
};
|
|
3319
3321
|
var dashboard$2 = {
|
|
3320
3322
|
labels: {
|
|
@@ -3405,7 +3407,8 @@ var validation = {
|
|
|
3405
3407
|
};
|
|
3406
3408
|
var buttons$c = {
|
|
3407
3409
|
account: "내 계정",
|
|
3408
|
-
login: "로그인"
|
|
3410
|
+
login: "로그인",
|
|
3411
|
+
subscribe: "구독하다"
|
|
3409
3412
|
};
|
|
3410
3413
|
var dashboard$1 = {
|
|
3411
3414
|
labels: {
|
|
@@ -9580,7 +9583,11 @@ const authenticatedButtons = () => {
|
|
|
9580
9583
|
|
|
9581
9584
|
if (pelcroLoginByClass) {
|
|
9582
9585
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9583
|
-
pelcroLoginByClass.item(i).
|
|
9586
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-dashboard-text")) {
|
|
9587
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-dashboard-text");
|
|
9588
|
+
} else {
|
|
9589
|
+
pelcroLoginByClass.item(i).innerHTML = translations.account;
|
|
9590
|
+
}
|
|
9584
9591
|
}
|
|
9585
9592
|
}
|
|
9586
9593
|
|
|
@@ -9600,7 +9607,11 @@ const unauthenticatedButtons = () => {
|
|
|
9600
9607
|
|
|
9601
9608
|
if (pelcroLoginByClass) {
|
|
9602
9609
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9603
|
-
pelcroLoginByClass.item(i).
|
|
9610
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-login-text")) {
|
|
9611
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-login-text");
|
|
9612
|
+
} else {
|
|
9613
|
+
pelcroLoginByClass.item(i).innerHTML = translations.login;
|
|
9614
|
+
}
|
|
9604
9615
|
}
|
|
9605
9616
|
}
|
|
9606
9617
|
};
|
|
@@ -15371,7 +15382,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15371
15382
|
onFailure = () => {},
|
|
15372
15383
|
...props
|
|
15373
15384
|
}) => {
|
|
15374
|
-
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
|
|
15385
|
+
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett;
|
|
15375
15386
|
|
|
15376
15387
|
const {
|
|
15377
15388
|
t
|
|
@@ -15394,6 +15405,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15394
15405
|
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
15395
15406
|
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
15396
15407
|
const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
|
|
15408
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
15397
15409
|
const cardProcessor = getSiteCardProcessor();
|
|
15398
15410
|
useEffect(() => {
|
|
15399
15411
|
if (window.Pelcro.coupon.getFromUrl()) {
|
|
@@ -15940,6 +15952,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15940
15952
|
}, [selectedPaymentMethodId]);
|
|
15941
15953
|
|
|
15942
15954
|
const initPaymentRequest = (state, dispatch) => {
|
|
15955
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
15956
|
+
|
|
15943
15957
|
try {
|
|
15944
15958
|
const paymentRequest = stripe.paymentRequest({
|
|
15945
15959
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16011,6 +16025,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16011
16025
|
const updateTotalAmountWithTax = () => {
|
|
16012
16026
|
var _window$Pelcro$site$r4;
|
|
16013
16027
|
|
|
16028
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16014
16029
|
const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
|
|
16015
16030
|
|
|
16016
16031
|
if (taxesEnabled && type === "createPayment") {
|
|
@@ -16337,8 +16352,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16337
16352
|
|
|
16338
16353
|
if (!subscriptionIdToRenew) {
|
|
16339
16354
|
window.Pelcro.subscription.create({
|
|
16340
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16341
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16355
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16356
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16342
16357
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16343
16358
|
plan_id: plan.id,
|
|
16344
16359
|
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
@@ -17896,6 +17911,41 @@ const IncludePhone = props => /*#__PURE__*/React__default.createElement(Phone, O
|
|
|
17896
17911
|
store: store$j
|
|
17897
17912
|
}, props));
|
|
17898
17913
|
|
|
17914
|
+
const SubscriptionCreateFreePlanButton = ({
|
|
17915
|
+
name,
|
|
17916
|
+
onClick,
|
|
17917
|
+
...otherProps
|
|
17918
|
+
}) => {
|
|
17919
|
+
const {
|
|
17920
|
+
state: {
|
|
17921
|
+
disableSubmit
|
|
17922
|
+
},
|
|
17923
|
+
dispatch
|
|
17924
|
+
} = useContext(store$j);
|
|
17925
|
+
const {
|
|
17926
|
+
t
|
|
17927
|
+
} = useTranslation("common");
|
|
17928
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
17929
|
+
useEffect(() => {
|
|
17930
|
+
setDisabled(disableSubmit);
|
|
17931
|
+
}, [disableSubmit]);
|
|
17932
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
17933
|
+
className: "plc-w-full",
|
|
17934
|
+
onClick: () => {
|
|
17935
|
+
dispatch({
|
|
17936
|
+
type: DISABLE_SUBMIT,
|
|
17937
|
+
payload: true
|
|
17938
|
+
});
|
|
17939
|
+
dispatch({
|
|
17940
|
+
type: SUBSCRIBE
|
|
17941
|
+
});
|
|
17942
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17943
|
+
},
|
|
17944
|
+
disabled: isDisabled,
|
|
17945
|
+
isLoading: disableSubmit
|
|
17946
|
+
}, otherProps), t("buttons.subscribe"));
|
|
17947
|
+
};
|
|
17948
|
+
|
|
17899
17949
|
/**
|
|
17900
17950
|
*
|
|
17901
17951
|
*/
|
|
@@ -17906,7 +17956,8 @@ function PaymentMethodView({
|
|
|
17906
17956
|
onFailure,
|
|
17907
17957
|
type,
|
|
17908
17958
|
showCoupon,
|
|
17909
|
-
showExternalPaymentMethods
|
|
17959
|
+
showExternalPaymentMethods,
|
|
17960
|
+
showSubscriptionButton
|
|
17910
17961
|
}) {
|
|
17911
17962
|
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
17912
17963
|
|
|
@@ -17921,7 +17972,7 @@ function PaymentMethodView({
|
|
|
17921
17972
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17922
17973
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17923
17974
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17924
|
-
}, cardProcessor === "stripe" && /*#__PURE__*/React__default.createElement("div", {
|
|
17975
|
+
}, cardProcessor === "stripe" && !showSubscriptionButton && /*#__PURE__*/React__default.createElement("div", {
|
|
17925
17976
|
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
17926
17977
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
17927
17978
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -17938,9 +17989,9 @@ function PaymentMethodView({
|
|
|
17938
17989
|
onSuccess: onSuccess,
|
|
17939
17990
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
17940
17991
|
onFailure: onFailure
|
|
17941
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
17992
|
+
}, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
17942
17993
|
className: "plc-mb-2"
|
|
17943
|
-
}), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
17994
|
+
}), showSubscriptionButton ? /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
17944
17995
|
className: "plc-flex plc-items-start"
|
|
17945
17996
|
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
17946
17997
|
id: "pelcro-input-first-name",
|
|
@@ -19353,7 +19404,7 @@ const SubscriptionCreateView = ({
|
|
|
19353
19404
|
onSuccess = () => {},
|
|
19354
19405
|
onFailure = () => {}
|
|
19355
19406
|
}) => {
|
|
19356
|
-
var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
19407
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
19357
19408
|
|
|
19358
19409
|
const {
|
|
19359
19410
|
t
|
|
@@ -19362,6 +19413,8 @@ const SubscriptionCreateView = ({
|
|
|
19362
19413
|
product,
|
|
19363
19414
|
plan
|
|
19364
19415
|
} = usePelcro();
|
|
19416
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
19417
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
19365
19418
|
|
|
19366
19419
|
const getPricingText = plan => {
|
|
19367
19420
|
var _plan$quantity;
|
|
@@ -19400,7 +19453,8 @@ const SubscriptionCreateView = ({
|
|
|
19400
19453
|
showCoupon: true,
|
|
19401
19454
|
showExternalPaymentMethods: true,
|
|
19402
19455
|
onSuccess: onSuccess,
|
|
19403
|
-
onFailure: onFailure
|
|
19456
|
+
onFailure: onFailure,
|
|
19457
|
+
showSubscriptionButton: showSubscriptionButton
|
|
19404
19458
|
}));
|
|
19405
19459
|
};
|
|
19406
19460
|
|
|
@@ -24153,10 +24207,19 @@ const PaymentMethodSelectModal = ({
|
|
|
24153
24207
|
onClose,
|
|
24154
24208
|
...otherProps
|
|
24155
24209
|
}) => {
|
|
24210
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
24211
|
+
|
|
24156
24212
|
const {
|
|
24157
24213
|
switchToCheckoutForm,
|
|
24158
|
-
set
|
|
24214
|
+
set,
|
|
24215
|
+
plan
|
|
24159
24216
|
} = usePelcro();
|
|
24217
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
24218
|
+
useEffect(() => {
|
|
24219
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
24220
|
+
switchToCheckoutForm();
|
|
24221
|
+
}
|
|
24222
|
+
}, []);
|
|
24160
24223
|
|
|
24161
24224
|
const onSuccess = selectedPaymentMethodId => {
|
|
24162
24225
|
var _otherProps$onSuccess;
|
|
@@ -30910,4 +30973,4 @@ const QrCodeModal = ({
|
|
|
30910
30973
|
};
|
|
30911
30974
|
QrCodeModal.viewId = "qrcode";
|
|
30912
30975
|
|
|
30913
|
-
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, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, 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, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, 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, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, 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, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|
|
30976
|
+
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, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, 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, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, 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, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, 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, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|