@pelcro/react-pelcro-js 3.26.0-sandbox.28 → 3.26.0-sandbox.30
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 +33 -11
- package/dist/index.esm.js +33 -11
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -11616,7 +11616,10 @@ const loadPaymentSDKs = () => {
|
|
|
11616
11616
|
window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
|
|
11617
11617
|
}
|
|
11618
11618
|
window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
|
|
11619
|
-
|
|
11619
|
+
const eProtectApi3PreLiveURL = "https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js";
|
|
11620
|
+
const eProtectApi3ProductionURL = "https://request.eprotect.vantivcnp.com/eProtect/eProtect-api3.js";
|
|
11621
|
+
const eProtectApi3scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? eProtectApi3ProductionURL : eProtectApi3PreLiveURL;
|
|
11622
|
+
window.Pelcro.helpers.loadSDK(eProtectApi3scriptUrlToUse, "vantiv-eprotect-api");
|
|
11620
11623
|
if (!window.EprotectIframeClient) {
|
|
11621
11624
|
const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
|
|
11622
11625
|
const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
|
|
@@ -20306,7 +20309,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
20306
20309
|
* @return {JSX}
|
|
20307
20310
|
*/
|
|
20308
20311
|
const ApplePayButton = _ref => {
|
|
20309
|
-
var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
20312
|
+
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan;
|
|
20310
20313
|
let {
|
|
20311
20314
|
onClick,
|
|
20312
20315
|
props,
|
|
@@ -20318,7 +20321,8 @@ const ApplePayButton = _ref => {
|
|
|
20318
20321
|
} = React.useContext(store$k);
|
|
20319
20322
|
const {
|
|
20320
20323
|
plan,
|
|
20321
|
-
invoice
|
|
20324
|
+
invoice,
|
|
20325
|
+
order
|
|
20322
20326
|
} = usePelcro();
|
|
20323
20327
|
const {
|
|
20324
20328
|
pay_page_id: payPageId,
|
|
@@ -20326,7 +20330,25 @@ const ApplePayButton = _ref => {
|
|
|
20326
20330
|
apple_pay_merchant_id: ApplePayMerchantId,
|
|
20327
20331
|
apple_pay_enabled: ApplePayEnabled
|
|
20328
20332
|
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
20329
|
-
const
|
|
20333
|
+
const getOrderItemsTotal = () => {
|
|
20334
|
+
if (!order) {
|
|
20335
|
+
return null;
|
|
20336
|
+
}
|
|
20337
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
20338
|
+
if (isQuickPurchase) {
|
|
20339
|
+
return order.price * order.quantity;
|
|
20340
|
+
}
|
|
20341
|
+
if (order.length === 0) {
|
|
20342
|
+
return null;
|
|
20343
|
+
}
|
|
20344
|
+
return order.reduce((total, item) => {
|
|
20345
|
+
return total + item.price * item.quantity;
|
|
20346
|
+
}, 0);
|
|
20347
|
+
};
|
|
20348
|
+
const orderPrice = getOrderItemsTotal();
|
|
20349
|
+
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;
|
|
20350
|
+
const orderLabel = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.name : "Order";
|
|
20351
|
+
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;
|
|
20330
20352
|
React.useEffect(() => {
|
|
20331
20353
|
if (window.ApplePaySession) {
|
|
20332
20354
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
|
@@ -20359,11 +20381,11 @@ const ApplePayButton = _ref => {
|
|
|
20359
20381
|
// @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
|
|
20360
20382
|
const ApplePayPaymentRequest = {
|
|
20361
20383
|
countryCode: ((_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$l = _window$Pelcro$user.location) === null || _window$Pelcro$user$l === void 0 ? void 0 : _window$Pelcro$user$l.countryCode) || "US",
|
|
20362
|
-
currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
|
|
20384
|
+
currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || orderCurrency.toUpperCase() || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
|
|
20363
20385
|
merchantCapabilities: ["supports3DS"],
|
|
20364
20386
|
supportedNetworks: ["visa", "masterCard", "amex", "discover"],
|
|
20365
20387
|
total: {
|
|
20366
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20388
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20367
20389
|
type: "final",
|
|
20368
20390
|
amount: updatedPrice / 100
|
|
20369
20391
|
}
|
|
@@ -20411,12 +20433,12 @@ const ApplePayButton = _ref => {
|
|
|
20411
20433
|
// Define ApplePayPaymentMethodUpdate based on the selected payment method.
|
|
20412
20434
|
// No updates or errors are needed, pass an empty object.
|
|
20413
20435
|
const newTotal = {
|
|
20414
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20436
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20415
20437
|
type: "final",
|
|
20416
20438
|
amount: updatedPrice / 100
|
|
20417
20439
|
};
|
|
20418
20440
|
const newLineItems = [{
|
|
20419
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20441
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20420
20442
|
type: "final",
|
|
20421
20443
|
amount: updatedPrice / 100
|
|
20422
20444
|
}];
|
|
@@ -20429,14 +20451,14 @@ const ApplePayButton = _ref => {
|
|
|
20429
20451
|
// // Define ApplePayShippingMethodUpdate based on the selected shipping method.
|
|
20430
20452
|
// // No updates or errors are needed, pass an empty object.
|
|
20431
20453
|
// const newTotal = {
|
|
20432
|
-
// label: plan?.nickname || `invoice #${invoice.id}`,
|
|
20454
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice.id}`,
|
|
20433
20455
|
// type: "final",
|
|
20434
20456
|
// amount: updatedPrice / 100
|
|
20435
20457
|
// };
|
|
20436
20458
|
|
|
20437
20459
|
// const newLineItems = [
|
|
20438
20460
|
// {
|
|
20439
|
-
// label: plan?.nickname || `invoice #${invoice.id}`,
|
|
20461
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice.id}`,
|
|
20440
20462
|
// type: "final",
|
|
20441
20463
|
// amount: updatedPrice / 100
|
|
20442
20464
|
// }
|
|
@@ -26125,7 +26147,7 @@ const OrderCreateView = props => {
|
|
|
26125
26147
|
type: "orderCreate",
|
|
26126
26148
|
showCoupon: true,
|
|
26127
26149
|
showExternalPaymentMethods: false,
|
|
26128
|
-
showApplePayButton:
|
|
26150
|
+
showApplePayButton: true,
|
|
26129
26151
|
showOrderButton: showOrderButton,
|
|
26130
26152
|
order: order
|
|
26131
26153
|
}, props))));
|
package/dist/index.esm.js
CHANGED
|
@@ -11586,7 +11586,10 @@ const loadPaymentSDKs = () => {
|
|
|
11586
11586
|
window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
|
|
11587
11587
|
}
|
|
11588
11588
|
window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
|
|
11589
|
-
|
|
11589
|
+
const eProtectApi3PreLiveURL = "https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js";
|
|
11590
|
+
const eProtectApi3ProductionURL = "https://request.eprotect.vantivcnp.com/eProtect/eProtect-api3.js";
|
|
11591
|
+
const eProtectApi3scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? eProtectApi3ProductionURL : eProtectApi3PreLiveURL;
|
|
11592
|
+
window.Pelcro.helpers.loadSDK(eProtectApi3scriptUrlToUse, "vantiv-eprotect-api");
|
|
11590
11593
|
if (!window.EprotectIframeClient) {
|
|
11591
11594
|
const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
|
|
11592
11595
|
const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
|
|
@@ -20276,7 +20279,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
20276
20279
|
* @return {JSX}
|
|
20277
20280
|
*/
|
|
20278
20281
|
const ApplePayButton = _ref => {
|
|
20279
|
-
var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
20282
|
+
var _window$Pelcro$site$r, _order$, _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan;
|
|
20280
20283
|
let {
|
|
20281
20284
|
onClick,
|
|
20282
20285
|
props,
|
|
@@ -20288,7 +20291,8 @@ const ApplePayButton = _ref => {
|
|
|
20288
20291
|
} = useContext(store$k);
|
|
20289
20292
|
const {
|
|
20290
20293
|
plan,
|
|
20291
|
-
invoice
|
|
20294
|
+
invoice,
|
|
20295
|
+
order
|
|
20292
20296
|
} = usePelcro();
|
|
20293
20297
|
const {
|
|
20294
20298
|
pay_page_id: payPageId,
|
|
@@ -20296,7 +20300,25 @@ const ApplePayButton = _ref => {
|
|
|
20296
20300
|
apple_pay_merchant_id: ApplePayMerchantId,
|
|
20297
20301
|
apple_pay_enabled: ApplePayEnabled
|
|
20298
20302
|
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
20299
|
-
const
|
|
20303
|
+
const getOrderItemsTotal = () => {
|
|
20304
|
+
if (!order) {
|
|
20305
|
+
return null;
|
|
20306
|
+
}
|
|
20307
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
20308
|
+
if (isQuickPurchase) {
|
|
20309
|
+
return order.price * order.quantity;
|
|
20310
|
+
}
|
|
20311
|
+
if (order.length === 0) {
|
|
20312
|
+
return null;
|
|
20313
|
+
}
|
|
20314
|
+
return order.reduce((total, item) => {
|
|
20315
|
+
return total + item.price * item.quantity;
|
|
20316
|
+
}, 0);
|
|
20317
|
+
};
|
|
20318
|
+
const orderPrice = getOrderItemsTotal();
|
|
20319
|
+
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;
|
|
20320
|
+
const orderLabel = !Array.isArray(order) ? order === null || order === void 0 ? void 0 : order.name : "Order";
|
|
20321
|
+
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;
|
|
20300
20322
|
useEffect(() => {
|
|
20301
20323
|
if (window.ApplePaySession) {
|
|
20302
20324
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
|
@@ -20329,11 +20351,11 @@ const ApplePayButton = _ref => {
|
|
|
20329
20351
|
// @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
|
|
20330
20352
|
const ApplePayPaymentRequest = {
|
|
20331
20353
|
countryCode: ((_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$l = _window$Pelcro$user.location) === null || _window$Pelcro$user$l === void 0 ? void 0 : _window$Pelcro$user$l.countryCode) || "US",
|
|
20332
|
-
currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
|
|
20354
|
+
currencyCode: (plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase()) || orderCurrency.toUpperCase() || (invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase()),
|
|
20333
20355
|
merchantCapabilities: ["supports3DS"],
|
|
20334
20356
|
supportedNetworks: ["visa", "masterCard", "amex", "discover"],
|
|
20335
20357
|
total: {
|
|
20336
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20358
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20337
20359
|
type: "final",
|
|
20338
20360
|
amount: updatedPrice / 100
|
|
20339
20361
|
}
|
|
@@ -20381,12 +20403,12 @@ const ApplePayButton = _ref => {
|
|
|
20381
20403
|
// Define ApplePayPaymentMethodUpdate based on the selected payment method.
|
|
20382
20404
|
// No updates or errors are needed, pass an empty object.
|
|
20383
20405
|
const newTotal = {
|
|
20384
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20406
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20385
20407
|
type: "final",
|
|
20386
20408
|
amount: updatedPrice / 100
|
|
20387
20409
|
};
|
|
20388
20410
|
const newLineItems = [{
|
|
20389
|
-
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
20411
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice.id}`,
|
|
20390
20412
|
type: "final",
|
|
20391
20413
|
amount: updatedPrice / 100
|
|
20392
20414
|
}];
|
|
@@ -20399,14 +20421,14 @@ const ApplePayButton = _ref => {
|
|
|
20399
20421
|
// // Define ApplePayShippingMethodUpdate based on the selected shipping method.
|
|
20400
20422
|
// // No updates or errors are needed, pass an empty object.
|
|
20401
20423
|
// const newTotal = {
|
|
20402
|
-
// label: plan?.nickname || `invoice #${invoice.id}`,
|
|
20424
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice.id}`,
|
|
20403
20425
|
// type: "final",
|
|
20404
20426
|
// amount: updatedPrice / 100
|
|
20405
20427
|
// };
|
|
20406
20428
|
|
|
20407
20429
|
// const newLineItems = [
|
|
20408
20430
|
// {
|
|
20409
|
-
// label: plan?.nickname || `invoice #${invoice.id}`,
|
|
20431
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice.id}`,
|
|
20410
20432
|
// type: "final",
|
|
20411
20433
|
// amount: updatedPrice / 100
|
|
20412
20434
|
// }
|
|
@@ -26095,7 +26117,7 @@ const OrderCreateView = props => {
|
|
|
26095
26117
|
type: "orderCreate",
|
|
26096
26118
|
showCoupon: true,
|
|
26097
26119
|
showExternalPaymentMethods: false,
|
|
26098
|
-
showApplePayButton:
|
|
26120
|
+
showApplePayButton: true,
|
|
26099
26121
|
showOrderButton: showOrderButton,
|
|
26100
26122
|
order: order
|
|
26101
26123
|
}, props))));
|