@pelcro/react-pelcro-js 4.0.0-alpha.86 → 4.0.0-alpha.88
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 +22 -4
- package/dist/index.esm.js +22 -4
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -30658,7 +30658,8 @@ const AddressCreateModal = ({
|
|
|
30658
30658
|
resetView,
|
|
30659
30659
|
giftRecipient,
|
|
30660
30660
|
product,
|
|
30661
|
-
plan
|
|
30661
|
+
plan,
|
|
30662
|
+
order
|
|
30662
30663
|
} = usePelcro();
|
|
30663
30664
|
const {
|
|
30664
30665
|
t
|
|
@@ -30686,7 +30687,7 @@ const AddressCreateModal = ({
|
|
|
30686
30687
|
resetView();
|
|
30687
30688
|
};
|
|
30688
30689
|
|
|
30689
|
-
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
30690
|
+
const showBackButton = Boolean(product && plan && !giftRecipient || order);
|
|
30690
30691
|
|
|
30691
30692
|
const userHasAddress = () => {
|
|
30692
30693
|
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
@@ -30702,9 +30703,17 @@ const AddressCreateModal = ({
|
|
|
30702
30703
|
return switchView("address-select");
|
|
30703
30704
|
}
|
|
30704
30705
|
|
|
30706
|
+
if (order && isUserHasAddress) {
|
|
30707
|
+
return switchView("address-select");
|
|
30708
|
+
}
|
|
30709
|
+
|
|
30705
30710
|
if (product && plan) {
|
|
30706
30711
|
return switchView("plan-select");
|
|
30707
30712
|
}
|
|
30713
|
+
|
|
30714
|
+
if (order) {
|
|
30715
|
+
return switchView("cart");
|
|
30716
|
+
}
|
|
30708
30717
|
};
|
|
30709
30718
|
|
|
30710
30719
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
@@ -33053,12 +33062,21 @@ const OrderCreateSummary = ({
|
|
|
33053
33062
|
const [items, setItems] = React.useState([]);
|
|
33054
33063
|
const [orderTotal, setOrderTotal] = React.useState("");
|
|
33055
33064
|
React.useEffect(() => {
|
|
33056
|
-
|
|
33065
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
33066
|
+
|
|
33067
|
+
if (isQuickPurchase) {
|
|
33057
33068
|
var _calcAndFormatItemsTo, _order$;
|
|
33058
33069
|
|
|
33059
|
-
setItems(order);
|
|
33070
|
+
setItems([order]);
|
|
33060
33071
|
setOrderTotal((_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage()));
|
|
33061
33072
|
}
|
|
33073
|
+
|
|
33074
|
+
if ((order === null || order === void 0 ? void 0 : order.length) > 0) {
|
|
33075
|
+
var _calcAndFormatItemsTo2, _order$2;
|
|
33076
|
+
|
|
33077
|
+
setItems(order);
|
|
33078
|
+
setOrderTotal((_calcAndFormatItemsTo2 = calcAndFormatItemsTotal(order, (_order$2 = order[0]) === null || _order$2 === void 0 ? void 0 : _order$2.currency)) !== null && _calcAndFormatItemsTo2 !== void 0 ? _calcAndFormatItemsTo2 : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage()));
|
|
33079
|
+
}
|
|
33062
33080
|
}, []);
|
|
33063
33081
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33064
33082
|
className: "plc-px-8 md:plc-px-0"
|
package/dist/index.esm.js
CHANGED
|
@@ -30628,7 +30628,8 @@ const AddressCreateModal = ({
|
|
|
30628
30628
|
resetView,
|
|
30629
30629
|
giftRecipient,
|
|
30630
30630
|
product,
|
|
30631
|
-
plan
|
|
30631
|
+
plan,
|
|
30632
|
+
order
|
|
30632
30633
|
} = usePelcro();
|
|
30633
30634
|
const {
|
|
30634
30635
|
t
|
|
@@ -30656,7 +30657,7 @@ const AddressCreateModal = ({
|
|
|
30656
30657
|
resetView();
|
|
30657
30658
|
};
|
|
30658
30659
|
|
|
30659
|
-
const showBackButton = Boolean(product && plan && !giftRecipient);
|
|
30660
|
+
const showBackButton = Boolean(product && plan && !giftRecipient || order);
|
|
30660
30661
|
|
|
30661
30662
|
const userHasAddress = () => {
|
|
30662
30663
|
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
@@ -30672,9 +30673,17 @@ const AddressCreateModal = ({
|
|
|
30672
30673
|
return switchView("address-select");
|
|
30673
30674
|
}
|
|
30674
30675
|
|
|
30676
|
+
if (order && isUserHasAddress) {
|
|
30677
|
+
return switchView("address-select");
|
|
30678
|
+
}
|
|
30679
|
+
|
|
30675
30680
|
if (product && plan) {
|
|
30676
30681
|
return switchView("plan-select");
|
|
30677
30682
|
}
|
|
30683
|
+
|
|
30684
|
+
if (order) {
|
|
30685
|
+
return switchView("cart");
|
|
30686
|
+
}
|
|
30678
30687
|
};
|
|
30679
30688
|
|
|
30680
30689
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
@@ -33023,12 +33032,21 @@ const OrderCreateSummary = ({
|
|
|
33023
33032
|
const [items, setItems] = useState([]);
|
|
33024
33033
|
const [orderTotal, setOrderTotal] = useState("");
|
|
33025
33034
|
useEffect(() => {
|
|
33026
|
-
|
|
33035
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
33036
|
+
|
|
33037
|
+
if (isQuickPurchase) {
|
|
33027
33038
|
var _calcAndFormatItemsTo, _order$;
|
|
33028
33039
|
|
|
33029
|
-
setItems(order);
|
|
33040
|
+
setItems([order]);
|
|
33030
33041
|
setOrderTotal((_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage()));
|
|
33031
33042
|
}
|
|
33043
|
+
|
|
33044
|
+
if ((order === null || order === void 0 ? void 0 : order.length) > 0) {
|
|
33045
|
+
var _calcAndFormatItemsTo2, _order$2;
|
|
33046
|
+
|
|
33047
|
+
setItems(order);
|
|
33048
|
+
setOrderTotal((_calcAndFormatItemsTo2 = calcAndFormatItemsTotal(order, (_order$2 = order[0]) === null || _order$2 === void 0 ? void 0 : _order$2.currency)) !== null && _calcAndFormatItemsTo2 !== void 0 ? _calcAndFormatItemsTo2 : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage()));
|
|
33049
|
+
}
|
|
33032
33050
|
}, []);
|
|
33033
33051
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33034
33052
|
className: "plc-px-8 md:plc-px-0"
|