@pelcro/react-pelcro-js 4.0.0-alpha.81 → 4.0.0-alpha.83
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 +103 -22
- package/dist/index.esm.js +103 -22
- package/dist/pelcro.css +93 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -14404,6 +14404,7 @@ function Modal({
|
|
|
14404
14404
|
const ModalHeader = ({
|
|
14405
14405
|
id,
|
|
14406
14406
|
onDisplay,
|
|
14407
|
+
onCloseModal,
|
|
14407
14408
|
className = "",
|
|
14408
14409
|
hideCloseButton,
|
|
14409
14410
|
children,
|
|
@@ -14414,9 +14415,7 @@ const ModalHeader = ({
|
|
|
14414
14415
|
const resetView = usePelcro(state => state.resetView);
|
|
14415
14416
|
|
|
14416
14417
|
const onClose = () => {
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
14418
|
+
onCloseModal === null || onCloseModal === void 0 ? void 0 : onCloseModal();
|
|
14420
14419
|
resetView();
|
|
14421
14420
|
};
|
|
14422
14421
|
|
|
@@ -26858,7 +26857,7 @@ function PaymentMethodView({
|
|
|
26858
26857
|
showApplePayButton,
|
|
26859
26858
|
order
|
|
26860
26859
|
}) {
|
|
26861
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3
|
|
26860
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
26862
26861
|
|
|
26863
26862
|
const {
|
|
26864
26863
|
t
|
|
@@ -26872,15 +26871,7 @@ function PaymentMethodView({
|
|
|
26872
26871
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
26873
26872
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26874
26873
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 plc-px-8 md:plc-px-0 pelcro-payment-block"
|
|
26875
|
-
},
|
|
26876
|
-
className: "plc-w-full plc-p-2 plc-mb-4 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
|
|
26877
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26878
|
-
className: "plc-text-gray-600"
|
|
26879
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
26880
|
-
className: "plc-tracking-wider plc-uppercase"
|
|
26881
|
-
}, t("labels.amount")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
26882
|
-
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
26883
|
-
}, (_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())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26874
|
+
}, cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26884
26875
|
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 pelcro-stripe-compliance"
|
|
26885
26876
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
26886
26877
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -33054,21 +33045,109 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default['default'].cre
|
|
|
33054
33045
|
className: "pelcro-order-create-container"
|
|
33055
33046
|
}, props));
|
|
33056
33047
|
|
|
33048
|
+
const OrderCreateSummary = ({
|
|
33049
|
+
order
|
|
33050
|
+
}) => {
|
|
33051
|
+
var _calcAndFormatItemsTo, _order$;
|
|
33052
|
+
|
|
33053
|
+
const items = (order === null || order === void 0 ? void 0 : order.length) > 0 ? order : [];
|
|
33054
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33055
|
+
className: "plc-px-8 md:plc-px-0"
|
|
33056
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33057
|
+
className: "plc-mx-auto plc-w-full"
|
|
33058
|
+
}, /*#__PURE__*/React__default['default'].createElement("h2", {
|
|
33059
|
+
className: "plc-font-semibold"
|
|
33060
|
+
}, "Order summary"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33061
|
+
className: "plc-flow-root plc-mt-4"
|
|
33062
|
+
}, /*#__PURE__*/React__default['default'].createElement("ul", {
|
|
33063
|
+
role: "list",
|
|
33064
|
+
className: "plc-divide-y plc-divide-gray-200 plc-overflow-y-auto plc-max-h-checkout"
|
|
33065
|
+
}, items.map(item => {
|
|
33066
|
+
return /*#__PURE__*/React__default['default'].createElement("li", {
|
|
33067
|
+
key: item === null || item === void 0 ? void 0 : item.id,
|
|
33068
|
+
className: "plc-flex plc-space-x-6 plc-py-6"
|
|
33069
|
+
}, /*#__PURE__*/React__default['default'].createElement("img", {
|
|
33070
|
+
alt: "order item image",
|
|
33071
|
+
src: item === null || item === void 0 ? void 0 : item.image,
|
|
33072
|
+
className: "plc-h-24 plc-w-24 plc-flex-none plc-rounded-md plc-bg-gray-100 plc-object-cover plc-object-center"
|
|
33073
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33074
|
+
className: "plc-flex-auto"
|
|
33075
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33076
|
+
className: "plc-space-y-1 sm:plc-flex sm:plc-items-start sm:plc-justify-between sm:plc-space-x-6"
|
|
33077
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33078
|
+
className: "plc-flex-auto plc-space-y-1 plc-text-sm plc-font-medium"
|
|
33079
|
+
}, /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
33080
|
+
className: "plc-text-gray-900"
|
|
33081
|
+
}, item === null || item === void 0 ? void 0 : item.name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33082
|
+
className: "plc-hidden plc-text-gray-500 sm:plc-block"
|
|
33083
|
+
}, "quantity: ", item === null || item === void 0 ? void 0 : item.quantity)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33084
|
+
className: "plc-flex plc-flex-none plc-space-x-4"
|
|
33085
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33086
|
+
className: "plc-text-gray-900"
|
|
33087
|
+
}, item && item.currency && calcAndFormatItemsTotal([item], item === null || item === void 0 ? void 0 : item.currency))))));
|
|
33088
|
+
})))), /*#__PURE__*/React__default['default'].createElement("dl", {
|
|
33089
|
+
className: "plc-mt-6 plc-space-y-6 plc-text-sm plc-font-medium plc-text-gray-500"
|
|
33090
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33091
|
+
className: "plc-flex plc-justify-between plc-border-t plc-border-gray-200 plc-pt-6 plc-text-gray-900"
|
|
33092
|
+
}, /*#__PURE__*/React__default['default'].createElement("dt", {
|
|
33093
|
+
className: "plc-text-base"
|
|
33094
|
+
}, "Total"), /*#__PURE__*/React__default['default'].createElement("dd", {
|
|
33095
|
+
className: "plc-text-base"
|
|
33096
|
+
}, order && ((_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()))))));
|
|
33097
|
+
};
|
|
33098
|
+
|
|
33057
33099
|
const OrderCreateView = props => {
|
|
33058
|
-
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
33100
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _addresses$find, _addresses$find2;
|
|
33059
33101
|
|
|
33060
|
-
useTranslation("payment");
|
|
33061
33102
|
const {
|
|
33062
|
-
|
|
33103
|
+
t
|
|
33104
|
+
} = useTranslation("checkoutForm");
|
|
33105
|
+
const {
|
|
33106
|
+
order,
|
|
33107
|
+
selectedAddressId
|
|
33063
33108
|
} = usePelcro();
|
|
33064
33109
|
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;
|
|
33065
33110
|
const showOrderButton = skipPayment && ((order === null || order === void 0 ? void 0 : order.price) === 0 || (order === null || order === void 0 ? void 0 : order.length) > 0 && order.every(item => (item === null || item === void 0 ? void 0 : item.price) === 0));
|
|
33111
|
+
const {
|
|
33112
|
+
addresses
|
|
33113
|
+
} = (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro2 = _window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read()) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
33114
|
+
const user = (_window$Pelcro$user$r2 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : _window2$Pelcro$user.read()) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : [];
|
|
33115
|
+
const address = selectedAddressId ? (_addresses$find = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.id == selectedAddressId)) !== null && _addresses$find !== void 0 ? _addresses$find : null : (_addresses$find2 = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.type == "shipping" && address.is_default)) !== null && _addresses$find2 !== void 0 ? _addresses$find2 : null;
|
|
33066
33116
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33067
|
-
id: "pelcro-order-create-view"
|
|
33068
|
-
|
|
33117
|
+
id: "pelcro-order-create-view",
|
|
33118
|
+
className: "plc-grid plc-grid-cols-1 md:plc-grid-cols-2 plc-gap-20"
|
|
33119
|
+
}, /*#__PURE__*/React__default['default'].createElement(OrderCreateSummary, {
|
|
33120
|
+
order: order
|
|
33121
|
+
}), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
33069
33122
|
action: "javascript:void(0);",
|
|
33070
33123
|
className: "plc-mt-2 pelcro-form"
|
|
33071
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
33124
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33125
|
+
className: "plc-flex plc-flex-row plc-justify-between plc-px-8 md:plc-px-0"
|
|
33126
|
+
}, address && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33127
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
33128
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
33129
|
+
name: "address"
|
|
33130
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33131
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
33132
|
+
}, t("labels.shippingAddress")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33133
|
+
className: "pelcro-address-company"
|
|
33134
|
+
}, address === null || address === void 0 ? void 0 : address.company), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33135
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
33136
|
+
}, address === null || address === void 0 ? void 0 : address.first_name, " ", address === null || address === void 0 ? void 0 : address.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33137
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
33138
|
+
}, address === null || address === void 0 ? void 0 : address.line1), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33139
|
+
className: "pelcro-address-country plc-text-sm"
|
|
33140
|
+
}, address === null || address === void 0 ? void 0 : address.city, ", ", address === null || address === void 0 ? void 0 : address.state, " ", address === null || address === void 0 ? void 0 : address.postal_code, ", ", address === null || address === void 0 ? void 0 : address.country))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33141
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
33142
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
33143
|
+
name: "address"
|
|
33144
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33145
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
33146
|
+
}, t("labels.contactDetails")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33147
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
33148
|
+
}, user.email), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
33149
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
33150
|
+
}, address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
33072
33151
|
type: "orderCreate",
|
|
33073
33152
|
showCoupon: true,
|
|
33074
33153
|
showExternalPaymentMethods: false,
|
|
@@ -33099,9 +33178,11 @@ const OrderCreateModal = ({
|
|
|
33099
33178
|
|
|
33100
33179
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
33101
33180
|
id: "pelcro-order-create-modal",
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader,
|
|
33181
|
+
className: "plc-max-w-7xl",
|
|
33182
|
+
onDisplay: onDisplay
|
|
33183
|
+
}, /*#__PURE__*/React__default['default'].createElement(ModalHeader, {
|
|
33184
|
+
onCloseModal: onClose
|
|
33185
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33105
33186
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
33106
33187
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
33107
33188
|
className: "plc-text-xl plc-font-bold "
|
package/dist/index.esm.js
CHANGED
|
@@ -14374,6 +14374,7 @@ function Modal({
|
|
|
14374
14374
|
const ModalHeader = ({
|
|
14375
14375
|
id,
|
|
14376
14376
|
onDisplay,
|
|
14377
|
+
onCloseModal,
|
|
14377
14378
|
className = "",
|
|
14378
14379
|
hideCloseButton,
|
|
14379
14380
|
children,
|
|
@@ -14384,9 +14385,7 @@ const ModalHeader = ({
|
|
|
14384
14385
|
const resetView = usePelcro(state => state.resetView);
|
|
14385
14386
|
|
|
14386
14387
|
const onClose = () => {
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
14388
|
+
onCloseModal === null || onCloseModal === void 0 ? void 0 : onCloseModal();
|
|
14390
14389
|
resetView();
|
|
14391
14390
|
};
|
|
14392
14391
|
|
|
@@ -26828,7 +26827,7 @@ function PaymentMethodView({
|
|
|
26828
26827
|
showApplePayButton,
|
|
26829
26828
|
order
|
|
26830
26829
|
}) {
|
|
26831
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3
|
|
26830
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
26832
26831
|
|
|
26833
26832
|
const {
|
|
26834
26833
|
t
|
|
@@ -26842,15 +26841,7 @@ function PaymentMethodView({
|
|
|
26842
26841
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
26843
26842
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
26844
26843
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 plc-px-8 md:plc-px-0 pelcro-payment-block"
|
|
26845
|
-
},
|
|
26846
|
-
className: "plc-w-full plc-p-2 plc-mb-4 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
|
|
26847
|
-
}, /*#__PURE__*/React__default.createElement("p", {
|
|
26848
|
-
className: "plc-text-gray-600"
|
|
26849
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26850
|
-
className: "plc-tracking-wider plc-uppercase"
|
|
26851
|
-
}, t("labels.amount")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
26852
|
-
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
26853
|
-
}, (_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())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", {
|
|
26844
|
+
}, cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", {
|
|
26854
26845
|
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 pelcro-stripe-compliance"
|
|
26855
26846
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
26856
26847
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -33024,21 +33015,109 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default.createElement(
|
|
|
33024
33015
|
className: "pelcro-order-create-container"
|
|
33025
33016
|
}, props));
|
|
33026
33017
|
|
|
33018
|
+
const OrderCreateSummary = ({
|
|
33019
|
+
order
|
|
33020
|
+
}) => {
|
|
33021
|
+
var _calcAndFormatItemsTo, _order$;
|
|
33022
|
+
|
|
33023
|
+
const items = (order === null || order === void 0 ? void 0 : order.length) > 0 ? order : [];
|
|
33024
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
33025
|
+
className: "plc-px-8 md:plc-px-0"
|
|
33026
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33027
|
+
className: "plc-mx-auto plc-w-full"
|
|
33028
|
+
}, /*#__PURE__*/React__default.createElement("h2", {
|
|
33029
|
+
className: "plc-font-semibold"
|
|
33030
|
+
}, "Order summary"), /*#__PURE__*/React__default.createElement("div", {
|
|
33031
|
+
className: "plc-flow-root plc-mt-4"
|
|
33032
|
+
}, /*#__PURE__*/React__default.createElement("ul", {
|
|
33033
|
+
role: "list",
|
|
33034
|
+
className: "plc-divide-y plc-divide-gray-200 plc-overflow-y-auto plc-max-h-checkout"
|
|
33035
|
+
}, items.map(item => {
|
|
33036
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
33037
|
+
key: item === null || item === void 0 ? void 0 : item.id,
|
|
33038
|
+
className: "plc-flex plc-space-x-6 plc-py-6"
|
|
33039
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
33040
|
+
alt: "order item image",
|
|
33041
|
+
src: item === null || item === void 0 ? void 0 : item.image,
|
|
33042
|
+
className: "plc-h-24 plc-w-24 plc-flex-none plc-rounded-md plc-bg-gray-100 plc-object-cover plc-object-center"
|
|
33043
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
33044
|
+
className: "plc-flex-auto"
|
|
33045
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33046
|
+
className: "plc-space-y-1 sm:plc-flex sm:plc-items-start sm:plc-justify-between sm:plc-space-x-6"
|
|
33047
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33048
|
+
className: "plc-flex-auto plc-space-y-1 plc-text-sm plc-font-medium"
|
|
33049
|
+
}, /*#__PURE__*/React__default.createElement("h3", {
|
|
33050
|
+
className: "plc-text-gray-900"
|
|
33051
|
+
}, item === null || item === void 0 ? void 0 : item.name), /*#__PURE__*/React__default.createElement("p", {
|
|
33052
|
+
className: "plc-hidden plc-text-gray-500 sm:plc-block"
|
|
33053
|
+
}, "quantity: ", item === null || item === void 0 ? void 0 : item.quantity)), /*#__PURE__*/React__default.createElement("div", {
|
|
33054
|
+
className: "plc-flex plc-flex-none plc-space-x-4"
|
|
33055
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
33056
|
+
className: "plc-text-gray-900"
|
|
33057
|
+
}, item && item.currency && calcAndFormatItemsTotal([item], item === null || item === void 0 ? void 0 : item.currency))))));
|
|
33058
|
+
})))), /*#__PURE__*/React__default.createElement("dl", {
|
|
33059
|
+
className: "plc-mt-6 plc-space-y-6 plc-text-sm plc-font-medium plc-text-gray-500"
|
|
33060
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33061
|
+
className: "plc-flex plc-justify-between plc-border-t plc-border-gray-200 plc-pt-6 plc-text-gray-900"
|
|
33062
|
+
}, /*#__PURE__*/React__default.createElement("dt", {
|
|
33063
|
+
className: "plc-text-base"
|
|
33064
|
+
}, "Total"), /*#__PURE__*/React__default.createElement("dd", {
|
|
33065
|
+
className: "plc-text-base"
|
|
33066
|
+
}, order && ((_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()))))));
|
|
33067
|
+
};
|
|
33068
|
+
|
|
33027
33069
|
const OrderCreateView = props => {
|
|
33028
|
-
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
33070
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _addresses$find, _addresses$find2;
|
|
33029
33071
|
|
|
33030
|
-
useTranslation("payment");
|
|
33031
33072
|
const {
|
|
33032
|
-
|
|
33073
|
+
t
|
|
33074
|
+
} = useTranslation("checkoutForm");
|
|
33075
|
+
const {
|
|
33076
|
+
order,
|
|
33077
|
+
selectedAddressId
|
|
33033
33078
|
} = usePelcro();
|
|
33034
33079
|
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;
|
|
33035
33080
|
const showOrderButton = skipPayment && ((order === null || order === void 0 ? void 0 : order.price) === 0 || (order === null || order === void 0 ? void 0 : order.length) > 0 && order.every(item => (item === null || item === void 0 ? void 0 : item.price) === 0));
|
|
33081
|
+
const {
|
|
33082
|
+
addresses
|
|
33083
|
+
} = (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro2 = _window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read()) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
33084
|
+
const user = (_window$Pelcro$user$r2 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : _window2$Pelcro$user.read()) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : [];
|
|
33085
|
+
const address = selectedAddressId ? (_addresses$find = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.id == selectedAddressId)) !== null && _addresses$find !== void 0 ? _addresses$find : null : (_addresses$find2 = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.type == "shipping" && address.is_default)) !== null && _addresses$find2 !== void 0 ? _addresses$find2 : null;
|
|
33036
33086
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33037
|
-
id: "pelcro-order-create-view"
|
|
33038
|
-
|
|
33087
|
+
id: "pelcro-order-create-view",
|
|
33088
|
+
className: "plc-grid plc-grid-cols-1 md:plc-grid-cols-2 plc-gap-20"
|
|
33089
|
+
}, /*#__PURE__*/React__default.createElement(OrderCreateSummary, {
|
|
33090
|
+
order: order
|
|
33091
|
+
}), /*#__PURE__*/React__default.createElement("form", {
|
|
33039
33092
|
action: "javascript:void(0);",
|
|
33040
33093
|
className: "plc-mt-2 pelcro-form"
|
|
33041
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
33094
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33095
|
+
className: "plc-flex plc-flex-row plc-justify-between plc-px-8 md:plc-px-0"
|
|
33096
|
+
}, address && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
33097
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
33098
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
33099
|
+
name: "address"
|
|
33100
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
33101
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
33102
|
+
}, t("labels.shippingAddress")), /*#__PURE__*/React__default.createElement("p", {
|
|
33103
|
+
className: "pelcro-address-company"
|
|
33104
|
+
}, address === null || address === void 0 ? void 0 : address.company), /*#__PURE__*/React__default.createElement("p", {
|
|
33105
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
33106
|
+
}, address === null || address === void 0 ? void 0 : address.first_name, " ", address === null || address === void 0 ? void 0 : address.last_name), /*#__PURE__*/React__default.createElement("p", {
|
|
33107
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
33108
|
+
}, address === null || address === void 0 ? void 0 : address.line1), /*#__PURE__*/React__default.createElement("p", {
|
|
33109
|
+
className: "pelcro-address-country plc-text-sm"
|
|
33110
|
+
}, address === null || address === void 0 ? void 0 : address.city, ", ", address === null || address === void 0 ? void 0 : address.state, " ", address === null || address === void 0 ? void 0 : address.postal_code, ", ", address === null || address === void 0 ? void 0 : address.country))), /*#__PURE__*/React__default.createElement("div", {
|
|
33111
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
33112
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
33113
|
+
name: "address"
|
|
33114
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
33115
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
33116
|
+
}, t("labels.contactDetails")), /*#__PURE__*/React__default.createElement("p", {
|
|
33117
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
33118
|
+
}, user.email), /*#__PURE__*/React__default.createElement("p", {
|
|
33119
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
33120
|
+
}, address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
33042
33121
|
type: "orderCreate",
|
|
33043
33122
|
showCoupon: true,
|
|
33044
33123
|
showExternalPaymentMethods: false,
|
|
@@ -33069,9 +33148,11 @@ const OrderCreateModal = ({
|
|
|
33069
33148
|
|
|
33070
33149
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
33071
33150
|
id: "pelcro-order-create-modal",
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
}, /*#__PURE__*/React__default.createElement(ModalHeader,
|
|
33151
|
+
className: "plc-max-w-7xl",
|
|
33152
|
+
onDisplay: onDisplay
|
|
33153
|
+
}, /*#__PURE__*/React__default.createElement(ModalHeader, {
|
|
33154
|
+
onCloseModal: onClose
|
|
33155
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33075
33156
|
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
33076
33157
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
33077
33158
|
className: "plc-text-xl plc-font-bold "
|
package/dist/pelcro.css
CHANGED
|
@@ -2326,6 +2326,10 @@ apple-pay-button {
|
|
|
2326
2326
|
display: inline-flex;
|
|
2327
2327
|
}
|
|
2328
2328
|
|
|
2329
|
+
.pelcro-root .plc-flow-root{
|
|
2330
|
+
display: flow-root;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2329
2333
|
.pelcro-root .plc-grid{
|
|
2330
2334
|
display: grid;
|
|
2331
2335
|
}
|
|
@@ -2382,6 +2386,10 @@ apple-pay-button {
|
|
|
2382
2386
|
height: 5rem;
|
|
2383
2387
|
}
|
|
2384
2388
|
|
|
2389
|
+
.pelcro-root .plc-h-24{
|
|
2390
|
+
height: 6rem;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2385
2393
|
.pelcro-root .plc-h-28{
|
|
2386
2394
|
height: 7rem;
|
|
2387
2395
|
}
|
|
@@ -2422,6 +2430,10 @@ apple-pay-button {
|
|
|
2422
2430
|
max-height: 20rem;
|
|
2423
2431
|
}
|
|
2424
2432
|
|
|
2433
|
+
.pelcro-root .plc-max-h-checkout{
|
|
2434
|
+
max-height: 35rem;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2425
2437
|
.pelcro-root .plc-max-h-full{
|
|
2426
2438
|
max-height: 100%;
|
|
2427
2439
|
}
|
|
@@ -2578,6 +2590,10 @@ apple-pay-button {
|
|
|
2578
2590
|
max-width: 48rem;
|
|
2579
2591
|
}
|
|
2580
2592
|
|
|
2593
|
+
.pelcro-root .plc-max-w-7xl{
|
|
2594
|
+
max-width: 80rem;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2581
2597
|
.pelcro-root .plc-max-w-50\%{
|
|
2582
2598
|
max-width: 50%;
|
|
2583
2599
|
}
|
|
@@ -2590,6 +2606,14 @@ apple-pay-button {
|
|
|
2590
2606
|
flex: 1 1 0%;
|
|
2591
2607
|
}
|
|
2592
2608
|
|
|
2609
|
+
.pelcro-root .plc-flex-auto{
|
|
2610
|
+
flex: 1 1 auto;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
.pelcro-root .plc-flex-none{
|
|
2614
|
+
flex: none;
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2593
2617
|
.pelcro-root .plc-flex-shrink-0{
|
|
2594
2618
|
flex-shrink: 0;
|
|
2595
2619
|
}
|
|
@@ -2805,6 +2829,10 @@ apple-pay-button {
|
|
|
2805
2829
|
gap: 1rem;
|
|
2806
2830
|
}
|
|
2807
2831
|
|
|
2832
|
+
.pelcro-root .plc-gap-20{
|
|
2833
|
+
gap: 5rem;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2808
2836
|
.pelcro-root .plc-gap-x-3{
|
|
2809
2837
|
column-gap: 0.75rem;
|
|
2810
2838
|
}
|
|
@@ -2835,6 +2863,24 @@ apple-pay-button {
|
|
|
2835
2863
|
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2836
2864
|
}
|
|
2837
2865
|
|
|
2866
|
+
.pelcro-root .plc-space-x-4 > :not([hidden]) ~ :not([hidden]){
|
|
2867
|
+
--tw-space-x-reverse: 0;
|
|
2868
|
+
margin-right: calc(1rem * var(--tw-space-x-reverse));
|
|
2869
|
+
margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
.pelcro-root .plc-space-x-6 > :not([hidden]) ~ :not([hidden]){
|
|
2873
|
+
--tw-space-x-reverse: 0;
|
|
2874
|
+
margin-right: calc(1.5rem * var(--tw-space-x-reverse));
|
|
2875
|
+
margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
.pelcro-root .plc-space-y-1 > :not([hidden]) ~ :not([hidden]){
|
|
2879
|
+
--tw-space-y-reverse: 0;
|
|
2880
|
+
margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2881
|
+
margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2838
2884
|
.pelcro-root .plc-space-y-2 > :not([hidden]) ~ :not([hidden]){
|
|
2839
2885
|
--tw-space-y-reverse: 0;
|
|
2840
2886
|
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -2853,6 +2899,23 @@ apple-pay-button {
|
|
|
2853
2899
|
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
|
2854
2900
|
}
|
|
2855
2901
|
|
|
2902
|
+
.pelcro-root .plc-space-y-6 > :not([hidden]) ~ :not([hidden]){
|
|
2903
|
+
--tw-space-y-reverse: 0;
|
|
2904
|
+
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2905
|
+
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
.pelcro-root .plc-divide-y > :not([hidden]) ~ :not([hidden]){
|
|
2909
|
+
--tw-divide-y-reverse: 0;
|
|
2910
|
+
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
2911
|
+
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
.pelcro-root .plc-divide-gray-200 > :not([hidden]) ~ :not([hidden]){
|
|
2915
|
+
--tw-divide-opacity: 1;
|
|
2916
|
+
border-color: rgba(229, 231, 235, var(--tw-divide-opacity));
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2856
2919
|
.pelcro-root .plc-overflow-auto{
|
|
2857
2920
|
overflow: auto;
|
|
2858
2921
|
}
|
|
@@ -3200,6 +3263,10 @@ apple-pay-button {
|
|
|
3200
3263
|
object-fit: contain;
|
|
3201
3264
|
}
|
|
3202
3265
|
|
|
3266
|
+
.pelcro-root .plc-object-cover{
|
|
3267
|
+
object-fit: cover;
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3203
3270
|
.pelcro-root .plc-object-center{
|
|
3204
3271
|
object-position: center;
|
|
3205
3272
|
}
|
|
@@ -3305,6 +3372,10 @@ apple-pay-button {
|
|
|
3305
3372
|
padding-top: 1.25rem;
|
|
3306
3373
|
}
|
|
3307
3374
|
|
|
3375
|
+
.pelcro-root .plc-pt-6{
|
|
3376
|
+
padding-top: 1.5rem;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3308
3379
|
.pelcro-root .plc-pr-1{
|
|
3309
3380
|
padding-right: 0.25rem;
|
|
3310
3381
|
}
|
|
@@ -3792,6 +3863,10 @@ apple-pay-button {
|
|
|
3792
3863
|
margin-left: 2rem;
|
|
3793
3864
|
}
|
|
3794
3865
|
|
|
3866
|
+
.pelcro-root .sm\:plc-block{
|
|
3867
|
+
display: block;
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3795
3870
|
.pelcro-root .sm\:plc-flex{
|
|
3796
3871
|
display: flex;
|
|
3797
3872
|
}
|
|
@@ -3824,12 +3899,26 @@ apple-pay-button {
|
|
|
3824
3899
|
flex-direction: row;
|
|
3825
3900
|
}
|
|
3826
3901
|
|
|
3902
|
+
.pelcro-root .sm\:plc-items-start{
|
|
3903
|
+
align-items: flex-start;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
.pelcro-root .sm\:plc-justify-between{
|
|
3907
|
+
justify-content: space-between;
|
|
3908
|
+
}
|
|
3909
|
+
|
|
3827
3910
|
.pelcro-root .sm\:plc-space-x-2 > :not([hidden]) ~ :not([hidden]){
|
|
3828
3911
|
--tw-space-x-reverse: 0;
|
|
3829
3912
|
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
|
|
3830
3913
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
3831
3914
|
}
|
|
3832
3915
|
|
|
3916
|
+
.pelcro-root .sm\:plc-space-x-6 > :not([hidden]) ~ :not([hidden]){
|
|
3917
|
+
--tw-space-x-reverse: 0;
|
|
3918
|
+
margin-right: calc(1.5rem * var(--tw-space-x-reverse));
|
|
3919
|
+
margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3833
3922
|
.pelcro-root .sm\:plc-space-y-0 > :not([hidden]) ~ :not([hidden]){
|
|
3834
3923
|
--tw-space-y-reverse: 0;
|
|
3835
3924
|
margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -3918,6 +4007,10 @@ apple-pay-button {
|
|
|
3918
4007
|
max-width: 80%;
|
|
3919
4008
|
}
|
|
3920
4009
|
|
|
4010
|
+
.pelcro-root .md\:plc-grid-cols-2{
|
|
4011
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
4012
|
+
}
|
|
4013
|
+
|
|
3921
4014
|
.pelcro-root .md\:plc-flex-row{
|
|
3922
4015
|
flex-direction: row;
|
|
3923
4016
|
}
|