@pelcro/react-pelcro-js 4.0.0-alpha.75 → 4.0.0-alpha.77
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 +119 -10
- package/dist/index.esm.js +119 -10
- package/dist/pelcro.css +4 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -28541,7 +28541,9 @@ function SubscriptionCreateModal({
|
|
|
28541
28541
|
|
|
28542
28542
|
const {
|
|
28543
28543
|
product,
|
|
28544
|
-
switchView
|
|
28544
|
+
switchView,
|
|
28545
|
+
plan,
|
|
28546
|
+
giftRecipient
|
|
28545
28547
|
} = usePelcro();
|
|
28546
28548
|
|
|
28547
28549
|
const onSuccess = res => {
|
|
@@ -28552,13 +28554,50 @@ function SubscriptionCreateModal({
|
|
|
28552
28554
|
return switchView("subscription-success");
|
|
28553
28555
|
};
|
|
28554
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
|
+
|
|
28555
28590
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
28556
28591
|
id: "pelcro-subscription-create-modal",
|
|
28557
28592
|
onDisplay: onDisplay,
|
|
28558
28593
|
onClose: onClose
|
|
28559
28594
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28560
28595
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
28561
|
-
}, /*#__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", {
|
|
28562
28601
|
className: "plc-text-xl plc-font-bold"
|
|
28563
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", {
|
|
28564
28603
|
className: "plc-text-sm"
|
|
@@ -30568,7 +30607,9 @@ const AddressCreateModal = ({
|
|
|
30568
30607
|
switchView,
|
|
30569
30608
|
switchToPaymentView,
|
|
30570
30609
|
resetView,
|
|
30571
|
-
giftRecipient
|
|
30610
|
+
giftRecipient,
|
|
30611
|
+
product,
|
|
30612
|
+
plan
|
|
30572
30613
|
} = usePelcro();
|
|
30573
30614
|
const {
|
|
30574
30615
|
t
|
|
@@ -30596,13 +30637,38 @@ const AddressCreateModal = ({
|
|
|
30596
30637
|
resetView();
|
|
30597
30638
|
};
|
|
30598
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
|
+
|
|
30599
30661
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
30600
30662
|
id: "pelcro-address-create-modal",
|
|
30601
30663
|
onDisplay: onDisplay,
|
|
30602
30664
|
onClose: onClose
|
|
30603
30665
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
30604
30666
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30605
|
-
}, /*#__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", {
|
|
30606
30672
|
className: "plc-text-xl plc-font-bold"
|
|
30607
30673
|
}, giftRecipient ? t("titleGifting") : t("title")))), /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
30608
30674
|
onSuccess: onSuccess,
|
|
@@ -33993,7 +34059,10 @@ const AddressSelectModal = ({
|
|
|
33993
34059
|
const {
|
|
33994
34060
|
switchView,
|
|
33995
34061
|
switchToPaymentView,
|
|
33996
|
-
resetView
|
|
34062
|
+
resetView,
|
|
34063
|
+
product,
|
|
34064
|
+
plan,
|
|
34065
|
+
giftRecipient
|
|
33997
34066
|
} = usePelcro();
|
|
33998
34067
|
const {
|
|
33999
34068
|
t
|
|
@@ -34025,13 +34094,25 @@ const AddressSelectModal = ({
|
|
|
34025
34094
|
resetView();
|
|
34026
34095
|
};
|
|
34027
34096
|
|
|
34097
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34098
|
+
|
|
34099
|
+
const goBack = () => {
|
|
34100
|
+
if (product && plan) {
|
|
34101
|
+
switchView("plan-select");
|
|
34102
|
+
}
|
|
34103
|
+
};
|
|
34104
|
+
|
|
34028
34105
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
34029
34106
|
onDisplay: onDisplay,
|
|
34030
34107
|
onClose: onClose,
|
|
34031
34108
|
id: "pelcro-address-select-modal"
|
|
34032
34109
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34033
34110
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34034
|
-
}, /*#__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", {
|
|
34035
34116
|
className: "plc-text-xl plc-font-bold"
|
|
34036
34117
|
}, t("selectAddressTitle")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34037
34118
|
className: "plc-text-sm"
|
|
@@ -34359,7 +34440,10 @@ const PaymentMethodSelectModal = ({
|
|
|
34359
34440
|
switchToCheckoutForm,
|
|
34360
34441
|
set,
|
|
34361
34442
|
plan,
|
|
34362
|
-
order
|
|
34443
|
+
order,
|
|
34444
|
+
product,
|
|
34445
|
+
switchView,
|
|
34446
|
+
giftRecipient
|
|
34363
34447
|
} = usePelcro();
|
|
34364
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;
|
|
34365
34449
|
React.useEffect(() => {
|
|
@@ -34382,13 +34466,38 @@ const PaymentMethodSelectModal = ({
|
|
|
34382
34466
|
switchToCheckoutForm();
|
|
34383
34467
|
};
|
|
34384
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
|
+
|
|
34385
34490
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
34386
34491
|
onDisplay: onDisplay,
|
|
34387
34492
|
onClose: onClose,
|
|
34388
34493
|
id: "pelcro-payment-method-select-modal"
|
|
34389
34494
|
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34390
34495
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34391
|
-
}, /*#__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", {
|
|
34392
34501
|
className: "plc-text-xl plc-font-bold"
|
|
34393
34502
|
}, t("select.title")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34394
34503
|
className: "plc-text-sm"
|
|
@@ -36242,12 +36351,12 @@ const DashboardLink = ({
|
|
|
36242
36351
|
return show ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
36243
36352
|
id: name,
|
|
36244
36353
|
className: `plc-border-l-4 plc-border-transparent plc-border-solid plc-group
|
|
36245
|
-
${isActive ? "plc-border-solid plc-bg-grey-200 plc-border-primary
|
|
36354
|
+
${isActive ? "plc-border-solid plc-bg-grey-200 plc-border-primary" : "hover:plc-bg-gray-100"}`
|
|
36246
36355
|
}, /*#__PURE__*/React__default['default'].createElement("header", {
|
|
36247
36356
|
onClick: () => setActiveDashboardLink(name),
|
|
36248
36357
|
className: "plc-flex plc-items-center plc-justify-between plc-p-5 plc-px-4 plc-cursor-pointer plc-select-none sm:plc-px-8"
|
|
36249
36358
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
36250
|
-
className: `plc-flex plc-text-lg plc-items-center ${isActive ? "plc-text-primary
|
|
36359
|
+
className: `plc-flex plc-text-lg plc-items-center ${isActive ? "plc-text-primary" : "plc-text-gray-500"}`
|
|
36251
36360
|
}, icon, title))) : null;
|
|
36252
36361
|
};
|
|
36253
36362
|
|
package/dist/index.esm.js
CHANGED
|
@@ -28511,7 +28511,9 @@ function SubscriptionCreateModal({
|
|
|
28511
28511
|
|
|
28512
28512
|
const {
|
|
28513
28513
|
product,
|
|
28514
|
-
switchView
|
|
28514
|
+
switchView,
|
|
28515
|
+
plan,
|
|
28516
|
+
giftRecipient
|
|
28515
28517
|
} = usePelcro();
|
|
28516
28518
|
|
|
28517
28519
|
const onSuccess = res => {
|
|
@@ -28522,13 +28524,50 @@ function SubscriptionCreateModal({
|
|
|
28522
28524
|
return switchView("subscription-success");
|
|
28523
28525
|
};
|
|
28524
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
|
+
|
|
28525
28560
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
28526
28561
|
id: "pelcro-subscription-create-modal",
|
|
28527
28562
|
onDisplay: onDisplay,
|
|
28528
28563
|
onClose: onClose
|
|
28529
28564
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
28530
28565
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
28531
|
-
}, /*#__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", {
|
|
28532
28571
|
className: "plc-text-xl plc-font-bold"
|
|
28533
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", {
|
|
28534
28573
|
className: "plc-text-sm"
|
|
@@ -30538,7 +30577,9 @@ const AddressCreateModal = ({
|
|
|
30538
30577
|
switchView,
|
|
30539
30578
|
switchToPaymentView,
|
|
30540
30579
|
resetView,
|
|
30541
|
-
giftRecipient
|
|
30580
|
+
giftRecipient,
|
|
30581
|
+
product,
|
|
30582
|
+
plan
|
|
30542
30583
|
} = usePelcro();
|
|
30543
30584
|
const {
|
|
30544
30585
|
t
|
|
@@ -30566,13 +30607,38 @@ const AddressCreateModal = ({
|
|
|
30566
30607
|
resetView();
|
|
30567
30608
|
};
|
|
30568
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
|
+
|
|
30569
30631
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
30570
30632
|
id: "pelcro-address-create-modal",
|
|
30571
30633
|
onDisplay: onDisplay,
|
|
30572
30634
|
onClose: onClose
|
|
30573
30635
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
30574
30636
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30575
|
-
}, /*#__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", {
|
|
30576
30642
|
className: "plc-text-xl plc-font-bold"
|
|
30577
30643
|
}, giftRecipient ? t("titleGifting") : t("title")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
30578
30644
|
onSuccess: onSuccess,
|
|
@@ -33963,7 +34029,10 @@ const AddressSelectModal = ({
|
|
|
33963
34029
|
const {
|
|
33964
34030
|
switchView,
|
|
33965
34031
|
switchToPaymentView,
|
|
33966
|
-
resetView
|
|
34032
|
+
resetView,
|
|
34033
|
+
product,
|
|
34034
|
+
plan,
|
|
34035
|
+
giftRecipient
|
|
33967
34036
|
} = usePelcro();
|
|
33968
34037
|
const {
|
|
33969
34038
|
t
|
|
@@ -33995,13 +34064,25 @@ const AddressSelectModal = ({
|
|
|
33995
34064
|
resetView();
|
|
33996
34065
|
};
|
|
33997
34066
|
|
|
34067
|
+
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
34068
|
+
|
|
34069
|
+
const goBack = () => {
|
|
34070
|
+
if (product && plan) {
|
|
34071
|
+
switchView("plan-select");
|
|
34072
|
+
}
|
|
34073
|
+
};
|
|
34074
|
+
|
|
33998
34075
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
33999
34076
|
onDisplay: onDisplay,
|
|
34000
34077
|
onClose: onClose,
|
|
34001
34078
|
id: "pelcro-address-select-modal"
|
|
34002
34079
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
34003
34080
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34004
|
-
}, /*#__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", {
|
|
34005
34086
|
className: "plc-text-xl plc-font-bold"
|
|
34006
34087
|
}, t("selectAddressTitle")), /*#__PURE__*/React__default.createElement("p", {
|
|
34007
34088
|
className: "plc-text-sm"
|
|
@@ -34329,7 +34410,10 @@ const PaymentMethodSelectModal = ({
|
|
|
34329
34410
|
switchToCheckoutForm,
|
|
34330
34411
|
set,
|
|
34331
34412
|
plan,
|
|
34332
|
-
order
|
|
34413
|
+
order,
|
|
34414
|
+
product,
|
|
34415
|
+
switchView,
|
|
34416
|
+
giftRecipient
|
|
34333
34417
|
} = usePelcro();
|
|
34334
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;
|
|
34335
34419
|
useEffect(() => {
|
|
@@ -34352,13 +34436,38 @@ const PaymentMethodSelectModal = ({
|
|
|
34352
34436
|
switchToCheckoutForm();
|
|
34353
34437
|
};
|
|
34354
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
|
+
|
|
34355
34460
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
34356
34461
|
onDisplay: onDisplay,
|
|
34357
34462
|
onClose: onClose,
|
|
34358
34463
|
id: "pelcro-payment-method-select-modal"
|
|
34359
34464
|
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
34360
34465
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
34361
|
-
}, /*#__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", {
|
|
34362
34471
|
className: "plc-text-xl plc-font-bold"
|
|
34363
34472
|
}, t("select.title")), /*#__PURE__*/React__default.createElement("p", {
|
|
34364
34473
|
className: "plc-text-sm"
|
|
@@ -36212,12 +36321,12 @@ const DashboardLink = ({
|
|
|
36212
36321
|
return show ? /*#__PURE__*/React__default.createElement("div", {
|
|
36213
36322
|
id: name,
|
|
36214
36323
|
className: `plc-border-l-4 plc-border-transparent plc-border-solid plc-group
|
|
36215
|
-
${isActive ? "plc-border-solid plc-bg-grey-200 plc-border-primary
|
|
36324
|
+
${isActive ? "plc-border-solid plc-bg-grey-200 plc-border-primary" : "hover:plc-bg-gray-100"}`
|
|
36216
36325
|
}, /*#__PURE__*/React__default.createElement("header", {
|
|
36217
36326
|
onClick: () => setActiveDashboardLink(name),
|
|
36218
36327
|
className: "plc-flex plc-items-center plc-justify-between plc-p-5 plc-px-4 plc-cursor-pointer plc-select-none sm:plc-px-8"
|
|
36219
36328
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
36220
|
-
className: `plc-flex plc-text-lg plc-items-center ${isActive ? "plc-text-primary
|
|
36329
|
+
className: `plc-flex plc-text-lg plc-items-center ${isActive ? "plc-text-primary" : "plc-text-gray-500"}`
|
|
36221
36330
|
}, icon, title))) : null;
|
|
36222
36331
|
};
|
|
36223
36332
|
|
package/dist/pelcro.css
CHANGED