@pelcro/react-pelcro-js 3.26.0-beta.22 → 3.26.0-beta.23
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 +39 -4
- package/dist/index.esm.js +39 -4
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9517,6 +9517,43 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
9517
9517
|
}
|
|
9518
9518
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
9519
9519
|
};
|
|
9520
|
+
const getOrderInfo = order => {
|
|
9521
|
+
if (!order) {
|
|
9522
|
+
return {
|
|
9523
|
+
price: null,
|
|
9524
|
+
currency: null,
|
|
9525
|
+
label: null
|
|
9526
|
+
};
|
|
9527
|
+
}
|
|
9528
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
9529
|
+
if (isQuickPurchase) {
|
|
9530
|
+
return {
|
|
9531
|
+
price: order.price * order.quantity,
|
|
9532
|
+
currency: order.currency,
|
|
9533
|
+
label: order.name
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9536
|
+
if (order.length === 0) {
|
|
9537
|
+
return {
|
|
9538
|
+
price: null,
|
|
9539
|
+
currency: null,
|
|
9540
|
+
label: null
|
|
9541
|
+
};
|
|
9542
|
+
}
|
|
9543
|
+
if (order.length === 1) {
|
|
9544
|
+
return {
|
|
9545
|
+
price: order[0].price * order[0].quantity,
|
|
9546
|
+
currency: order[0].currency,
|
|
9547
|
+
label: order[0].name
|
|
9548
|
+
};
|
|
9549
|
+
}
|
|
9550
|
+
const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
9551
|
+
return {
|
|
9552
|
+
price,
|
|
9553
|
+
currency: order[0].currency,
|
|
9554
|
+
label: price === 0 ? "Free Items" : "Order"
|
|
9555
|
+
};
|
|
9556
|
+
};
|
|
9520
9557
|
|
|
9521
9558
|
/**
|
|
9522
9559
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -21547,11 +21584,9 @@ function PaymentMethodView(_ref) {
|
|
|
21547
21584
|
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"
|
|
21548
21585
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
21549
21586
|
className: "plc-text-gray-600"
|
|
21550
|
-
},
|
|
21551
|
-
className: "plc-tracking-wider plc-uppercase"
|
|
21552
|
-
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21587
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21553
21588
|
className: "plc-tracking-wider plc-uppercase"
|
|
21554
|
-
},
|
|
21589
|
+
}, getOrderInfo(order).label), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21555
21590
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
21556
21591
|
}, (_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", {
|
|
21557
21592
|
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"
|
package/dist/index.esm.js
CHANGED
|
@@ -9487,6 +9487,43 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
9487
9487
|
}
|
|
9488
9488
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
9489
9489
|
};
|
|
9490
|
+
const getOrderInfo = order => {
|
|
9491
|
+
if (!order) {
|
|
9492
|
+
return {
|
|
9493
|
+
price: null,
|
|
9494
|
+
currency: null,
|
|
9495
|
+
label: null
|
|
9496
|
+
};
|
|
9497
|
+
}
|
|
9498
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
9499
|
+
if (isQuickPurchase) {
|
|
9500
|
+
return {
|
|
9501
|
+
price: order.price * order.quantity,
|
|
9502
|
+
currency: order.currency,
|
|
9503
|
+
label: order.name
|
|
9504
|
+
};
|
|
9505
|
+
}
|
|
9506
|
+
if (order.length === 0) {
|
|
9507
|
+
return {
|
|
9508
|
+
price: null,
|
|
9509
|
+
currency: null,
|
|
9510
|
+
label: null
|
|
9511
|
+
};
|
|
9512
|
+
}
|
|
9513
|
+
if (order.length === 1) {
|
|
9514
|
+
return {
|
|
9515
|
+
price: order[0].price * order[0].quantity,
|
|
9516
|
+
currency: order[0].currency,
|
|
9517
|
+
label: order[0].name
|
|
9518
|
+
};
|
|
9519
|
+
}
|
|
9520
|
+
const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
9521
|
+
return {
|
|
9522
|
+
price,
|
|
9523
|
+
currency: order[0].currency,
|
|
9524
|
+
label: price === 0 ? "Free Items" : "Order"
|
|
9525
|
+
};
|
|
9526
|
+
};
|
|
9490
9527
|
|
|
9491
9528
|
/**
|
|
9492
9529
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -21517,11 +21554,9 @@ function PaymentMethodView(_ref) {
|
|
|
21517
21554
|
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"
|
|
21518
21555
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
21519
21556
|
className: "plc-text-gray-600"
|
|
21520
|
-
},
|
|
21521
|
-
className: "plc-tracking-wider plc-uppercase"
|
|
21522
|
-
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default.createElement("span", {
|
|
21557
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
21523
21558
|
className: "plc-tracking-wider plc-uppercase"
|
|
21524
|
-
},
|
|
21559
|
+
}, getOrderInfo(order).label), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
21525
21560
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
21526
21561
|
}, (_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", {
|
|
21527
21562
|
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"
|