@pelcro/react-pelcro-js 3.26.0-beta.12 → 3.26.0-beta.13
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 +18 -14
- package/dist/index.esm.js +18 -14
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9518,17 +9518,6 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
9518
9518
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
9519
9519
|
};
|
|
9520
9520
|
|
|
9521
|
-
/**
|
|
9522
|
-
* @param {object[]} items
|
|
9523
|
-
* @returns {number} the total order price
|
|
9524
|
-
*/
|
|
9525
|
-
const calcOrderAmount = items => {
|
|
9526
|
-
if (!Array.isArray(items)) return;
|
|
9527
|
-
return items.reduce((prevAmount, item) => {
|
|
9528
|
-
return prevAmount + item.price * item.quantity;
|
|
9529
|
-
}, 0);
|
|
9530
|
-
};
|
|
9531
|
-
|
|
9532
9521
|
/**
|
|
9533
9522
|
* returns true if the URL contains a supported view trigger URL
|
|
9534
9523
|
* @param {string} viewID
|
|
@@ -21202,7 +21191,7 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
|
|
|
21202
21191
|
* @return {JSX}
|
|
21203
21192
|
*/
|
|
21204
21193
|
const ApplePayButton = _ref => {
|
|
21205
|
-
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _state$updatedPrice, _props$plan;
|
|
21194
|
+
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan;
|
|
21206
21195
|
let {
|
|
21207
21196
|
onClick,
|
|
21208
21197
|
props,
|
|
@@ -21223,10 +21212,25 @@ const ApplePayButton = _ref => {
|
|
|
21223
21212
|
apple_pay_merchant_id: ApplePayMerchantId,
|
|
21224
21213
|
apple_pay_enabled: ApplePayEnabled
|
|
21225
21214
|
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
21226
|
-
const
|
|
21215
|
+
const getOrderItemsTotal = () => {
|
|
21216
|
+
if (!order) {
|
|
21217
|
+
return null;
|
|
21218
|
+
}
|
|
21219
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
21220
|
+
if (isQuickPurchase) {
|
|
21221
|
+
return order.price * order.quantity;
|
|
21222
|
+
}
|
|
21223
|
+
if (order.length === 0) {
|
|
21224
|
+
return null;
|
|
21225
|
+
}
|
|
21226
|
+
return order.reduce((total, item) => {
|
|
21227
|
+
return total + item.price * item.quantity;
|
|
21228
|
+
}, 0);
|
|
21229
|
+
};
|
|
21230
|
+
const orderPrice = getOrderItemsTotal();
|
|
21227
21231
|
const orderCurrency = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.currency : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
|
|
21228
21232
|
const orderLabel = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.name : "Order";
|
|
21229
|
-
const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null &&
|
|
21233
|
+
const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref5 !== void 0 ? _ref5 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref4 !== void 0 ? _ref4 : orderPrice) !== null && _ref3 !== void 0 ? _ref3 : invoice.amount_remaining) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
21230
21234
|
React.useEffect(() => {
|
|
21231
21235
|
if (window.ApplePaySession) {
|
|
21232
21236
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
package/dist/index.esm.js
CHANGED
|
@@ -9488,17 +9488,6 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
9488
9488
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
9489
9489
|
};
|
|
9490
9490
|
|
|
9491
|
-
/**
|
|
9492
|
-
* @param {object[]} items
|
|
9493
|
-
* @returns {number} the total order price
|
|
9494
|
-
*/
|
|
9495
|
-
const calcOrderAmount = items => {
|
|
9496
|
-
if (!Array.isArray(items)) return;
|
|
9497
|
-
return items.reduce((prevAmount, item) => {
|
|
9498
|
-
return prevAmount + item.price * item.quantity;
|
|
9499
|
-
}, 0);
|
|
9500
|
-
};
|
|
9501
|
-
|
|
9502
9491
|
/**
|
|
9503
9492
|
* returns true if the URL contains a supported view trigger URL
|
|
9504
9493
|
* @param {string} viewID
|
|
@@ -21172,7 +21161,7 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
|
|
|
21172
21161
|
* @return {JSX}
|
|
21173
21162
|
*/
|
|
21174
21163
|
const ApplePayButton = _ref => {
|
|
21175
|
-
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _state$updatedPrice, _props$plan;
|
|
21164
|
+
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan;
|
|
21176
21165
|
let {
|
|
21177
21166
|
onClick,
|
|
21178
21167
|
props,
|
|
@@ -21193,10 +21182,25 @@ const ApplePayButton = _ref => {
|
|
|
21193
21182
|
apple_pay_merchant_id: ApplePayMerchantId,
|
|
21194
21183
|
apple_pay_enabled: ApplePayEnabled
|
|
21195
21184
|
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
21196
|
-
const
|
|
21185
|
+
const getOrderItemsTotal = () => {
|
|
21186
|
+
if (!order) {
|
|
21187
|
+
return null;
|
|
21188
|
+
}
|
|
21189
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
21190
|
+
if (isQuickPurchase) {
|
|
21191
|
+
return order.price * order.quantity;
|
|
21192
|
+
}
|
|
21193
|
+
if (order.length === 0) {
|
|
21194
|
+
return null;
|
|
21195
|
+
}
|
|
21196
|
+
return order.reduce((total, item) => {
|
|
21197
|
+
return total + item.price * item.quantity;
|
|
21198
|
+
}, 0);
|
|
21199
|
+
};
|
|
21200
|
+
const orderPrice = getOrderItemsTotal();
|
|
21197
21201
|
const orderCurrency = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.currency : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
|
|
21198
21202
|
const orderLabel = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.name : "Order";
|
|
21199
|
-
const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null &&
|
|
21203
|
+
const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref5 !== void 0 ? _ref5 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref4 !== void 0 ? _ref4 : orderPrice) !== null && _ref3 !== void 0 ? _ref3 : invoice.amount_remaining) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
21200
21204
|
useEffect(() => {
|
|
21201
21205
|
if (window.ApplePaySession) {
|
|
21202
21206
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|