@pelcro/react-pelcro-js 4.0.0-alpha.74 → 4.0.0-alpha.76
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 +128 -18
- package/dist/index.esm.js +128 -18
- package/dist/pelcro.css +9 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3427,7 +3427,8 @@ var messages$16 = {
|
|
|
3427
3427
|
},
|
|
3428
3428
|
invoicePayment: {
|
|
3429
3429
|
title: "Invoice paid successfully",
|
|
3430
|
-
content: "Please contact us if you have any questions or concerns."
|
|
3430
|
+
content: "Please contact us if you have any questions or concerns.",
|
|
3431
|
+
paymentProcessing: "Invoice payment is currently being processed"
|
|
3431
3432
|
}
|
|
3432
3433
|
};
|
|
3433
3434
|
var errors$j = {
|
|
@@ -23862,13 +23863,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23862
23863
|
type: LOADING,
|
|
23863
23864
|
payload: false
|
|
23864
23865
|
});
|
|
23865
|
-
|
|
23866
|
-
|
|
23867
|
-
payload: {
|
|
23868
|
-
type: "success",
|
|
23869
|
-
content: t("messages.paymentProcessing")
|
|
23870
|
-
}
|
|
23866
|
+
set({
|
|
23867
|
+
isProcessingInvoice: true
|
|
23871
23868
|
});
|
|
23869
|
+
return onSuccess(response);
|
|
23872
23870
|
} else {
|
|
23873
23871
|
onSuccess(response);
|
|
23874
23872
|
}
|
|
@@ -27783,7 +27781,8 @@ const getSuccessContent = i18n => {
|
|
|
27783
27781
|
|
|
27784
27782
|
const flow = getCurrentFlow();
|
|
27785
27783
|
const {
|
|
27786
|
-
product
|
|
27784
|
+
product,
|
|
27785
|
+
isProcessingInvoice
|
|
27787
27786
|
} = usePelcro.getStore();
|
|
27788
27787
|
const wordingDictionary = {
|
|
27789
27788
|
subscriptionSuccess: {
|
|
@@ -27811,7 +27810,7 @@ const getSuccessContent = i18n => {
|
|
|
27811
27810
|
successIcon: /*#__PURE__*/React__default['default'].createElement(SvgCheckSolid, {
|
|
27812
27811
|
className: "plc-w-32 plc-my-4 plc-text-green-500"
|
|
27813
27812
|
}),
|
|
27814
|
-
successTitle: i18n("messages.invoicePayment.title"),
|
|
27813
|
+
successTitle: isProcessingInvoice ? i18n("messages.invoicePayment.paymentProcessing") : i18n("messages.invoicePayment.title"),
|
|
27815
27814
|
successContent: i18n("messages.invoicePayment.content")
|
|
27816
27815
|
}
|
|
27817
27816
|
};
|
|
@@ -27841,7 +27840,9 @@ function PaymentSuccessModal({
|
|
|
27841
27840
|
id: "pelcro-subscription-success-modal",
|
|
27842
27841
|
onDisplay: onDisplay,
|
|
27843
27842
|
onClose: onClose
|
|
27844
|
-
}, /*#__PURE__*/React__default['default'].createElement(ModalBody,
|
|
27843
|
+
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, {
|
|
27844
|
+
className: "plc-rounded-t-lg"
|
|
27845
|
+
}, /*#__PURE__*/React__default['default'].createElement(PaymentSuccessView, {
|
|
27845
27846
|
onClose: onClose
|
|
27846
27847
|
})), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null));
|
|
27847
27848
|
}
|
|
@@ -28540,7 +28541,9 @@ function SubscriptionCreateModal({
|
|
|
28540
28541
|
|
|
28541
28542
|
const {
|
|
28542
28543
|
product,
|
|
28543
|
-
switchView
|
|
28544
|
+
switchView,
|
|
28545
|
+
plan,
|
|
28546
|
+
giftRecipient
|
|
28544
28547
|
} = usePelcro();
|
|
28545
28548
|
|
|
28546
28549
|
const onSuccess = res => {
|
|
@@ -28551,13 +28554,50 @@ function SubscriptionCreateModal({
|
|
|
28551
28554
|
return switchView("subscription-success");
|
|
28552
28555
|
};
|
|
28553
28556
|
|
|
28557
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
28558
|
+
|
|
28559
|
+
const userHasPaymentMethod = () => {
|
|
28560
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
28561
|
+
|
|
28562
|
+
const sources = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.sources) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
28563
|
+
return sources.length > 0;
|
|
28564
|
+
};
|
|
28565
|
+
|
|
28566
|
+
const userHasAddress = () => {
|
|
28567
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
28568
|
+
|
|
28569
|
+
const addresses = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.addresses) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : [];
|
|
28570
|
+
return addresses.length > 0;
|
|
28571
|
+
};
|
|
28572
|
+
|
|
28573
|
+
const isUserHasPaymentMethod = userHasPaymentMethod();
|
|
28574
|
+
const isUserHasAddress = userHasAddress();
|
|
28575
|
+
|
|
28576
|
+
const goBack = () => {
|
|
28577
|
+
if (product && plan && isUserHasPaymentMethod) {
|
|
28578
|
+
return switchView("payment-method-select");
|
|
28579
|
+
}
|
|
28580
|
+
|
|
28581
|
+
if (product && plan && product.address_required && isUserHasAddress) {
|
|
28582
|
+
return switchView("address-select");
|
|
28583
|
+
}
|
|
28584
|
+
|
|
28585
|
+
if (product && plan) {
|
|
28586
|
+
return switchView("plan-select");
|
|
28587
|
+
}
|
|
28588
|
+
};
|
|
28589
|
+
|
|
28554
28590
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
28555
28591
|
id: "pelcro-subscription-create-modal",
|
|
28556
28592
|
onDisplay: onDisplay,
|
|
28557
28593
|
onClose: onClose
|
|
28558
28594
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28559
28595
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
28560
|
-
}, /*#__PURE__*/React__default['default'].createElement("
|
|
28596
|
+
}, showBackButton && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
28597
|
+
type: "button",
|
|
28598
|
+
onClick: goBack,
|
|
28599
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
28600
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
28561
28601
|
className: "plc-text-xl plc-font-bold"
|
|
28562
28602
|
}, (_product$paywall$subs = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.subscribe_title) !== null && _product$paywall$subs !== void 0 ? _product$paywall$subs : (_window$Pelcro$paywal = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal === void 0 ? void 0 : _window$Pelcro$paywal.subscribe_title), " ", /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28563
28603
|
className: "plc-text-sm"
|
|
@@ -30567,7 +30607,9 @@ const AddressCreateModal = ({
|
|
|
30567
30607
|
switchView,
|
|
30568
30608
|
switchToPaymentView,
|
|
30569
30609
|
resetView,
|
|
30570
|
-
giftRecipient
|
|
30610
|
+
giftRecipient,
|
|
30611
|
+
product,
|
|
30612
|
+
plan
|
|
30571
30613
|
} = usePelcro();
|
|
30572
30614
|
const {
|
|
30573
30615
|
t
|
|
@@ -30595,13 +30637,38 @@ const AddressCreateModal = ({
|
|
|
30595
30637
|
resetView();
|
|
30596
30638
|
};
|
|
30597
30639
|
|
|
30640
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
30641
|
+
|
|
30642
|
+
const userHasAddress = () => {
|
|
30643
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
30644
|
+
|
|
30645
|
+
const addresses = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
30646
|
+
return addresses.length > 0;
|
|
30647
|
+
};
|
|
30648
|
+
|
|
30649
|
+
const isUserHasAddress = userHasAddress();
|
|
30650
|
+
|
|
30651
|
+
const goBack = () => {
|
|
30652
|
+
if (product && plan && isUserHasAddress) {
|
|
30653
|
+
return switchView("address-select");
|
|
30654
|
+
}
|
|
30655
|
+
|
|
30656
|
+
if (product && plan) {
|
|
30657
|
+
return switchView("plan-select");
|
|
30658
|
+
}
|
|
30659
|
+
};
|
|
30660
|
+
|
|
30598
30661
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
30599
30662
|
id: "pelcro-address-create-modal",
|
|
30600
30663
|
onDisplay: onDisplay,
|
|
30601
30664
|
onClose: onClose
|
|
30602
30665
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
30603
30666
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30604
|
-
}, /*#__PURE__*/React__default['default'].createElement("
|
|
30667
|
+
}, showBackButton && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
30668
|
+
type: "button",
|
|
30669
|
+
onClick: goBack,
|
|
30670
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
30671
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
30605
30672
|
className: "plc-text-xl plc-font-bold"
|
|
30606
30673
|
}, giftRecipient ? t("titleGifting") : t("title")))), /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
30607
30674
|
onSuccess: onSuccess,
|
|
@@ -33992,7 +34059,10 @@ const AddressSelectModal = ({
|
|
|
33992
34059
|
const {
|
|
33993
34060
|
switchView,
|
|
33994
34061
|
switchToPaymentView,
|
|
33995
|
-
resetView
|
|
34062
|
+
resetView,
|
|
34063
|
+
product,
|
|
34064
|
+
plan,
|
|
34065
|
+
giftRecipient
|
|
33996
34066
|
} = usePelcro();
|
|
33997
34067
|
const {
|
|
33998
34068
|
t
|
|
@@ -34024,13 +34094,25 @@ const AddressSelectModal = ({
|
|
|
34024
34094
|
resetView();
|
|
34025
34095
|
};
|
|
34026
34096
|
|
|
34097
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34098
|
+
|
|
34099
|
+
const goBack = () => {
|
|
34100
|
+
if (product && plan) {
|
|
34101
|
+
switchView("plan-select");
|
|
34102
|
+
}
|
|
34103
|
+
};
|
|
34104
|
+
|
|
34027
34105
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
34028
34106
|
onDisplay: onDisplay,
|
|
34029
34107
|
onClose: onClose,
|
|
34030
34108
|
id: "pelcro-address-select-modal"
|
|
34031
34109
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34032
34110
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34033
|
-
}, /*#__PURE__*/React__default['default'].createElement("
|
|
34111
|
+
}, showBackButton && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
34112
|
+
type: "button",
|
|
34113
|
+
onClick: goBack,
|
|
34114
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
34115
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
34034
34116
|
className: "plc-text-xl plc-font-bold"
|
|
34035
34117
|
}, t("selectAddressTitle")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34036
34118
|
className: "plc-text-sm"
|
|
@@ -34358,7 +34440,10 @@ const PaymentMethodSelectModal = ({
|
|
|
34358
34440
|
switchToCheckoutForm,
|
|
34359
34441
|
set,
|
|
34360
34442
|
plan,
|
|
34361
|
-
order
|
|
34443
|
+
order,
|
|
34444
|
+
product,
|
|
34445
|
+
switchView,
|
|
34446
|
+
giftRecipient
|
|
34362
34447
|
} = usePelcro();
|
|
34363
34448
|
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;
|
|
34364
34449
|
React.useEffect(() => {
|
|
@@ -34381,13 +34466,38 @@ const PaymentMethodSelectModal = ({
|
|
|
34381
34466
|
switchToCheckoutForm();
|
|
34382
34467
|
};
|
|
34383
34468
|
|
|
34469
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34470
|
+
|
|
34471
|
+
const userHasAddress = () => {
|
|
34472
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
34473
|
+
|
|
34474
|
+
const addresses = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
34475
|
+
return addresses.length > 0;
|
|
34476
|
+
};
|
|
34477
|
+
|
|
34478
|
+
const isUserHasAddress = userHasAddress();
|
|
34479
|
+
|
|
34480
|
+
const goBack = () => {
|
|
34481
|
+
if (product && plan && product.address_required && isUserHasAddress) {
|
|
34482
|
+
return switchView("address-select");
|
|
34483
|
+
}
|
|
34484
|
+
|
|
34485
|
+
if (product && plan) {
|
|
34486
|
+
return switchView("plan-select");
|
|
34487
|
+
}
|
|
34488
|
+
};
|
|
34489
|
+
|
|
34384
34490
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
34385
34491
|
onDisplay: onDisplay,
|
|
34386
34492
|
onClose: onClose,
|
|
34387
34493
|
id: "pelcro-payment-method-select-modal"
|
|
34388
34494
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34389
34495
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34390
|
-
}, /*#__PURE__*/React__default['default'].createElement("
|
|
34496
|
+
}, showBackButton && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
34497
|
+
type: "button",
|
|
34498
|
+
onClick: goBack,
|
|
34499
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
34500
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
34391
34501
|
className: "plc-text-xl plc-font-bold"
|
|
34392
34502
|
}, t("select.title")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34393
34503
|
className: "plc-text-sm"
|
package/dist/index.esm.js
CHANGED
|
@@ -3397,7 +3397,8 @@ var messages$16 = {
|
|
|
3397
3397
|
},
|
|
3398
3398
|
invoicePayment: {
|
|
3399
3399
|
title: "Invoice paid successfully",
|
|
3400
|
-
content: "Please contact us if you have any questions or concerns."
|
|
3400
|
+
content: "Please contact us if you have any questions or concerns.",
|
|
3401
|
+
paymentProcessing: "Invoice payment is currently being processed"
|
|
3401
3402
|
}
|
|
3402
3403
|
};
|
|
3403
3404
|
var errors$j = {
|
|
@@ -23832,13 +23833,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23832
23833
|
type: LOADING,
|
|
23833
23834
|
payload: false
|
|
23834
23835
|
});
|
|
23835
|
-
|
|
23836
|
-
|
|
23837
|
-
payload: {
|
|
23838
|
-
type: "success",
|
|
23839
|
-
content: t("messages.paymentProcessing")
|
|
23840
|
-
}
|
|
23836
|
+
set({
|
|
23837
|
+
isProcessingInvoice: true
|
|
23841
23838
|
});
|
|
23839
|
+
return onSuccess(response);
|
|
23842
23840
|
} else {
|
|
23843
23841
|
onSuccess(response);
|
|
23844
23842
|
}
|
|
@@ -27753,7 +27751,8 @@ const getSuccessContent = i18n => {
|
|
|
27753
27751
|
|
|
27754
27752
|
const flow = getCurrentFlow();
|
|
27755
27753
|
const {
|
|
27756
|
-
product
|
|
27754
|
+
product,
|
|
27755
|
+
isProcessingInvoice
|
|
27757
27756
|
} = usePelcro.getStore();
|
|
27758
27757
|
const wordingDictionary = {
|
|
27759
27758
|
subscriptionSuccess: {
|
|
@@ -27781,7 +27780,7 @@ const getSuccessContent = i18n => {
|
|
|
27781
27780
|
successIcon: /*#__PURE__*/React__default.createElement(SvgCheckSolid, {
|
|
27782
27781
|
className: "plc-w-32 plc-my-4 plc-text-green-500"
|
|
27783
27782
|
}),
|
|
27784
|
-
successTitle: i18n("messages.invoicePayment.title"),
|
|
27783
|
+
successTitle: isProcessingInvoice ? i18n("messages.invoicePayment.paymentProcessing") : i18n("messages.invoicePayment.title"),
|
|
27785
27784
|
successContent: i18n("messages.invoicePayment.content")
|
|
27786
27785
|
}
|
|
27787
27786
|
};
|
|
@@ -27811,7 +27810,9 @@ function PaymentSuccessModal({
|
|
|
27811
27810
|
id: "pelcro-subscription-success-modal",
|
|
27812
27811
|
onDisplay: onDisplay,
|
|
27813
27812
|
onClose: onClose
|
|
27814
|
-
}, /*#__PURE__*/React__default.createElement(ModalBody,
|
|
27813
|
+
}, /*#__PURE__*/React__default.createElement(ModalBody, {
|
|
27814
|
+
className: "plc-rounded-t-lg"
|
|
27815
|
+
}, /*#__PURE__*/React__default.createElement(PaymentSuccessView, {
|
|
27815
27816
|
onClose: onClose
|
|
27816
27817
|
})), /*#__PURE__*/React__default.createElement(ModalFooter, null));
|
|
27817
27818
|
}
|
|
@@ -28510,7 +28511,9 @@ function SubscriptionCreateModal({
|
|
|
28510
28511
|
|
|
28511
28512
|
const {
|
|
28512
28513
|
product,
|
|
28513
|
-
switchView
|
|
28514
|
+
switchView,
|
|
28515
|
+
plan,
|
|
28516
|
+
giftRecipient
|
|
28514
28517
|
} = usePelcro();
|
|
28515
28518
|
|
|
28516
28519
|
const onSuccess = res => {
|
|
@@ -28521,13 +28524,50 @@ function SubscriptionCreateModal({
|
|
|
28521
28524
|
return switchView("subscription-success");
|
|
28522
28525
|
};
|
|
28523
28526
|
|
|
28527
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
28528
|
+
|
|
28529
|
+
const userHasPaymentMethod = () => {
|
|
28530
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
28531
|
+
|
|
28532
|
+
const sources = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.sources) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
28533
|
+
return sources.length > 0;
|
|
28534
|
+
};
|
|
28535
|
+
|
|
28536
|
+
const userHasAddress = () => {
|
|
28537
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
28538
|
+
|
|
28539
|
+
const addresses = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.addresses) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : [];
|
|
28540
|
+
return addresses.length > 0;
|
|
28541
|
+
};
|
|
28542
|
+
|
|
28543
|
+
const isUserHasPaymentMethod = userHasPaymentMethod();
|
|
28544
|
+
const isUserHasAddress = userHasAddress();
|
|
28545
|
+
|
|
28546
|
+
const goBack = () => {
|
|
28547
|
+
if (product && plan && isUserHasPaymentMethod) {
|
|
28548
|
+
return switchView("payment-method-select");
|
|
28549
|
+
}
|
|
28550
|
+
|
|
28551
|
+
if (product && plan && product.address_required && isUserHasAddress) {
|
|
28552
|
+
return switchView("address-select");
|
|
28553
|
+
}
|
|
28554
|
+
|
|
28555
|
+
if (product && plan) {
|
|
28556
|
+
return switchView("plan-select");
|
|
28557
|
+
}
|
|
28558
|
+
};
|
|
28559
|
+
|
|
28524
28560
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
28525
28561
|
id: "pelcro-subscription-create-modal",
|
|
28526
28562
|
onDisplay: onDisplay,
|
|
28527
28563
|
onClose: onClose
|
|
28528
28564
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
28529
28565
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
28530
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
28566
|
+
}, showBackButton && /*#__PURE__*/React__default.createElement("button", {
|
|
28567
|
+
type: "button",
|
|
28568
|
+
onClick: goBack,
|
|
28569
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
28570
|
+
}, /*#__PURE__*/React__default.createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default.createElement("h4", {
|
|
28531
28571
|
className: "plc-text-xl plc-font-bold"
|
|
28532
28572
|
}, (_product$paywall$subs = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.subscribe_title) !== null && _product$paywall$subs !== void 0 ? _product$paywall$subs : (_window$Pelcro$paywal = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal === void 0 ? void 0 : _window$Pelcro$paywal.subscribe_title), " ", /*#__PURE__*/React__default.createElement("p", {
|
|
28533
28573
|
className: "plc-text-sm"
|
|
@@ -30537,7 +30577,9 @@ const AddressCreateModal = ({
|
|
|
30537
30577
|
switchView,
|
|
30538
30578
|
switchToPaymentView,
|
|
30539
30579
|
resetView,
|
|
30540
|
-
giftRecipient
|
|
30580
|
+
giftRecipient,
|
|
30581
|
+
product,
|
|
30582
|
+
plan
|
|
30541
30583
|
} = usePelcro();
|
|
30542
30584
|
const {
|
|
30543
30585
|
t
|
|
@@ -30565,13 +30607,38 @@ const AddressCreateModal = ({
|
|
|
30565
30607
|
resetView();
|
|
30566
30608
|
};
|
|
30567
30609
|
|
|
30610
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
30611
|
+
|
|
30612
|
+
const userHasAddress = () => {
|
|
30613
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
30614
|
+
|
|
30615
|
+
const addresses = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
30616
|
+
return addresses.length > 0;
|
|
30617
|
+
};
|
|
30618
|
+
|
|
30619
|
+
const isUserHasAddress = userHasAddress();
|
|
30620
|
+
|
|
30621
|
+
const goBack = () => {
|
|
30622
|
+
if (product && plan && isUserHasAddress) {
|
|
30623
|
+
return switchView("address-select");
|
|
30624
|
+
}
|
|
30625
|
+
|
|
30626
|
+
if (product && plan) {
|
|
30627
|
+
return switchView("plan-select");
|
|
30628
|
+
}
|
|
30629
|
+
};
|
|
30630
|
+
|
|
30568
30631
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
30569
30632
|
id: "pelcro-address-create-modal",
|
|
30570
30633
|
onDisplay: onDisplay,
|
|
30571
30634
|
onClose: onClose
|
|
30572
30635
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
30573
30636
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30574
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
30637
|
+
}, showBackButton && /*#__PURE__*/React__default.createElement("button", {
|
|
30638
|
+
type: "button",
|
|
30639
|
+
onClick: goBack,
|
|
30640
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
30641
|
+
}, /*#__PURE__*/React__default.createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default.createElement("h4", {
|
|
30575
30642
|
className: "plc-text-xl plc-font-bold"
|
|
30576
30643
|
}, giftRecipient ? t("titleGifting") : t("title")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
30577
30644
|
onSuccess: onSuccess,
|
|
@@ -33962,7 +34029,10 @@ const AddressSelectModal = ({
|
|
|
33962
34029
|
const {
|
|
33963
34030
|
switchView,
|
|
33964
34031
|
switchToPaymentView,
|
|
33965
|
-
resetView
|
|
34032
|
+
resetView,
|
|
34033
|
+
product,
|
|
34034
|
+
plan,
|
|
34035
|
+
giftRecipient
|
|
33966
34036
|
} = usePelcro();
|
|
33967
34037
|
const {
|
|
33968
34038
|
t
|
|
@@ -33994,13 +34064,25 @@ const AddressSelectModal = ({
|
|
|
33994
34064
|
resetView();
|
|
33995
34065
|
};
|
|
33996
34066
|
|
|
34067
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34068
|
+
|
|
34069
|
+
const goBack = () => {
|
|
34070
|
+
if (product && plan) {
|
|
34071
|
+
switchView("plan-select");
|
|
34072
|
+
}
|
|
34073
|
+
};
|
|
34074
|
+
|
|
33997
34075
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
33998
34076
|
onDisplay: onDisplay,
|
|
33999
34077
|
onClose: onClose,
|
|
34000
34078
|
id: "pelcro-address-select-modal"
|
|
34001
34079
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
34002
34080
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34003
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
34081
|
+
}, showBackButton && /*#__PURE__*/React__default.createElement("button", {
|
|
34082
|
+
type: "button",
|
|
34083
|
+
onClick: goBack,
|
|
34084
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
34085
|
+
}, /*#__PURE__*/React__default.createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default.createElement("h4", {
|
|
34004
34086
|
className: "plc-text-xl plc-font-bold"
|
|
34005
34087
|
}, t("selectAddressTitle")), /*#__PURE__*/React__default.createElement("p", {
|
|
34006
34088
|
className: "plc-text-sm"
|
|
@@ -34328,7 +34410,10 @@ const PaymentMethodSelectModal = ({
|
|
|
34328
34410
|
switchToCheckoutForm,
|
|
34329
34411
|
set,
|
|
34330
34412
|
plan,
|
|
34331
|
-
order
|
|
34413
|
+
order,
|
|
34414
|
+
product,
|
|
34415
|
+
switchView,
|
|
34416
|
+
giftRecipient
|
|
34332
34417
|
} = usePelcro();
|
|
34333
34418
|
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;
|
|
34334
34419
|
useEffect(() => {
|
|
@@ -34351,13 +34436,38 @@ const PaymentMethodSelectModal = ({
|
|
|
34351
34436
|
switchToCheckoutForm();
|
|
34352
34437
|
};
|
|
34353
34438
|
|
|
34439
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34440
|
+
|
|
34441
|
+
const userHasAddress = () => {
|
|
34442
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
34443
|
+
|
|
34444
|
+
const addresses = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
34445
|
+
return addresses.length > 0;
|
|
34446
|
+
};
|
|
34447
|
+
|
|
34448
|
+
const isUserHasAddress = userHasAddress();
|
|
34449
|
+
|
|
34450
|
+
const goBack = () => {
|
|
34451
|
+
if (product && plan && product.address_required && isUserHasAddress) {
|
|
34452
|
+
return switchView("address-select");
|
|
34453
|
+
}
|
|
34454
|
+
|
|
34455
|
+
if (product && plan) {
|
|
34456
|
+
return switchView("plan-select");
|
|
34457
|
+
}
|
|
34458
|
+
};
|
|
34459
|
+
|
|
34354
34460
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
34355
34461
|
onDisplay: onDisplay,
|
|
34356
34462
|
onClose: onClose,
|
|
34357
34463
|
id: "pelcro-payment-method-select-modal"
|
|
34358
34464
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
34359
34465
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34360
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
34466
|
+
}, showBackButton && /*#__PURE__*/React__default.createElement("button", {
|
|
34467
|
+
type: "button",
|
|
34468
|
+
onClick: goBack,
|
|
34469
|
+
className: "plc-absolute plc-w-6 plc-text-gray-500 focus:plc-text-black plc-z-max plc-top-1/2 plc-left-2 plc-transform plc--translate-y-1/2 plc-border-0 hover:plc-text-black hover:plc-shadow-none plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent"
|
|
34470
|
+
}, /*#__PURE__*/React__default.createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default.createElement("h4", {
|
|
34361
34471
|
className: "plc-text-xl plc-font-bold"
|
|
34362
34472
|
}, t("select.title")), /*#__PURE__*/React__default.createElement("p", {
|
|
34363
34473
|
className: "plc-text-sm"
|
package/dist/pelcro.css
CHANGED
|
@@ -2116,6 +2116,10 @@ apple-pay-button {
|
|
|
2116
2116
|
left: 0px;
|
|
2117
2117
|
}
|
|
2118
2118
|
|
|
2119
|
+
.pelcro-root .plc-left-2{
|
|
2120
|
+
left: 0.5rem;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2119
2123
|
.pelcro-root .plc-left-4{
|
|
2120
2124
|
left: 1rem;
|
|
2121
2125
|
}
|
|
@@ -2911,6 +2915,11 @@ apple-pay-button {
|
|
|
2911
2915
|
border-radius: 9999px;
|
|
2912
2916
|
}
|
|
2913
2917
|
|
|
2918
|
+
.pelcro-root .plc-rounded-t-lg{
|
|
2919
|
+
border-top-left-radius: 0.5rem;
|
|
2920
|
+
border-top-right-radius: 0.5rem;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2914
2923
|
.pelcro-root .plc-rounded-b-sm{
|
|
2915
2924
|
border-bottom-right-radius: 0.125rem;
|
|
2916
2925
|
border-bottom-left-radius: 0.125rem;
|