@pelcro/react-pelcro-js 3.21.7 → 3.21.8
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 +633 -49
- package/dist/index.esm.js +633 -49
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10877,13 +10877,16 @@ const debounce = (func, waitTime) => {
|
|
|
10877
10877
|
};
|
|
10878
10878
|
};
|
|
10879
10879
|
function getSiteCardProcessor() {
|
|
10880
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10880
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
10881
10881
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
|
|
10882
10882
|
return "vantiv";
|
|
10883
10883
|
}
|
|
10884
10884
|
if ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r2 !== void 0 && _window$Pelcro$site$r2.tap_gateway_settings) {
|
|
10885
10885
|
return "tap";
|
|
10886
10886
|
}
|
|
10887
|
+
if ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r3 !== void 0 && _window$Pelcro$site$r3.cybersource_gateway_settings) {
|
|
10888
|
+
return "cybersource";
|
|
10889
|
+
}
|
|
10887
10890
|
return "stripe";
|
|
10888
10891
|
}
|
|
10889
10892
|
|
|
@@ -11744,6 +11747,8 @@ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
|
11744
11747
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
11745
11748
|
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
11746
11749
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
11750
|
+
const SET_MONTH = "SET_MONTH";
|
|
11751
|
+
const SET_YEAR = "SET_YEAR";
|
|
11747
11752
|
const SET_TOKEN = "SET_TOKEN";
|
|
11748
11753
|
const SET_GIFT_CODE = "SET_GIFT_CODE";
|
|
11749
11754
|
const RESET_LOGIN_FORM = "RESET_LOGIN_FORM";
|
|
@@ -15503,7 +15508,7 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
|
|
|
15503
15508
|
var _generateUserError = /*#__PURE__*/new WeakMap();
|
|
15504
15509
|
class Payment {
|
|
15505
15510
|
/**
|
|
15506
|
-
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway)} paymentGateway
|
|
15511
|
+
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway)} paymentGateway
|
|
15507
15512
|
*/
|
|
15508
15513
|
constructor(paymentGateway) {
|
|
15509
15514
|
_defineProperty$3(this, "execute", (options, callback) => {
|
|
@@ -15522,7 +15527,7 @@ class Payment {
|
|
|
15522
15527
|
_classPrivateFieldInitSpec$1(this, _isPaymentGatewayInvalid, {
|
|
15523
15528
|
writable: true,
|
|
15524
15529
|
value: gateway => {
|
|
15525
|
-
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway);
|
|
15530
|
+
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway || gateway instanceof CybersourceGateway);
|
|
15526
15531
|
}
|
|
15527
15532
|
});
|
|
15528
15533
|
_classPrivateFieldInitSpec$1(this, _generateUserError, {
|
|
@@ -15576,7 +15581,8 @@ const PAYMENT_GATEWAYS_ENUM = {
|
|
|
15576
15581
|
stripe: "stripe",
|
|
15577
15582
|
paypal: "braintree",
|
|
15578
15583
|
vantiv: "vantiv",
|
|
15579
|
-
tap: "tap"
|
|
15584
|
+
tap: "tap",
|
|
15585
|
+
cybersource: "cybersource"
|
|
15580
15586
|
};
|
|
15581
15587
|
|
|
15582
15588
|
/**
|
|
@@ -16298,6 +16304,222 @@ class TapGateway {
|
|
|
16298
16304
|
}
|
|
16299
16305
|
}
|
|
16300
16306
|
|
|
16307
|
+
/**
|
|
16308
|
+
* Cybersource gateway strategy
|
|
16309
|
+
*/
|
|
16310
|
+
var _paymentGateway5 = /*#__PURE__*/new WeakMap();
|
|
16311
|
+
var _createSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16312
|
+
var _renewSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16313
|
+
var _createGiftedSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16314
|
+
var _renewGiftedSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16315
|
+
var _purchaseEcommerceOrder4 = /*#__PURE__*/new WeakMap();
|
|
16316
|
+
var _payInvoice5 = /*#__PURE__*/new WeakMap();
|
|
16317
|
+
class CybersourceGateway {
|
|
16318
|
+
constructor() {
|
|
16319
|
+
_classPrivateFieldInitSpec$1(this, _paymentGateway5, {
|
|
16320
|
+
writable: true,
|
|
16321
|
+
value: PAYMENT_GATEWAYS_ENUM["cybersource"]
|
|
16322
|
+
});
|
|
16323
|
+
_defineProperty$3(this, "execute", (options, callback) => {
|
|
16324
|
+
const types = PAYMENT_TYPES;
|
|
16325
|
+
switch (options.type) {
|
|
16326
|
+
case types.CREATE_SUBSCRIPTION:
|
|
16327
|
+
return _classPrivateFieldGet(this, _createSubscription5).call(this, options, callback);
|
|
16328
|
+
case types.RENEW_SUBSCRIPTION:
|
|
16329
|
+
return _classPrivateFieldGet(this, _renewSubscription4).call(this, options, callback);
|
|
16330
|
+
case types.CREATE_GIFTED_SUBSCRIPTION:
|
|
16331
|
+
return _classPrivateFieldGet(this, _createGiftedSubscription5).call(this, options, callback);
|
|
16332
|
+
case types.RENEW_GIFTED_SUBSCRIPTION:
|
|
16333
|
+
return _classPrivateFieldGet(this, _renewGiftedSubscription4).call(this, options, callback);
|
|
16334
|
+
case types.PURCHASE_ECOMMERCE_ORDER:
|
|
16335
|
+
return _classPrivateFieldGet(this, _purchaseEcommerceOrder4).call(this, options, callback);
|
|
16336
|
+
case types.PAY_INVOICE:
|
|
16337
|
+
return _classPrivateFieldGet(this, _payInvoice5).call(this, options, callback);
|
|
16338
|
+
default:
|
|
16339
|
+
console.error("Unsupported payment method: cybersource Gateway");
|
|
16340
|
+
}
|
|
16341
|
+
});
|
|
16342
|
+
_classPrivateFieldInitSpec$1(this, _createSubscription5, {
|
|
16343
|
+
writable: true,
|
|
16344
|
+
value: (options, callback) => {
|
|
16345
|
+
const {
|
|
16346
|
+
token,
|
|
16347
|
+
plan,
|
|
16348
|
+
couponCode,
|
|
16349
|
+
product,
|
|
16350
|
+
quantity = 1,
|
|
16351
|
+
addressId,
|
|
16352
|
+
isExistingSource
|
|
16353
|
+
} = options;
|
|
16354
|
+
const params = isExistingSource ? {
|
|
16355
|
+
source_id: token
|
|
16356
|
+
} : {
|
|
16357
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16358
|
+
gateway_token: token
|
|
16359
|
+
};
|
|
16360
|
+
window.Pelcro.subscription.create({
|
|
16361
|
+
quantity,
|
|
16362
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16363
|
+
plan_id: plan.id,
|
|
16364
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16365
|
+
coupon_code: couponCode,
|
|
16366
|
+
address_id: product.address_required ? addressId : null,
|
|
16367
|
+
...params
|
|
16368
|
+
}, (err, res) => {
|
|
16369
|
+
callback(err, res);
|
|
16370
|
+
});
|
|
16371
|
+
}
|
|
16372
|
+
});
|
|
16373
|
+
_classPrivateFieldInitSpec$1(this, _renewSubscription4, {
|
|
16374
|
+
writable: true,
|
|
16375
|
+
value: (options, callback) => {
|
|
16376
|
+
const {
|
|
16377
|
+
subscriptionIdToRenew,
|
|
16378
|
+
token,
|
|
16379
|
+
plan,
|
|
16380
|
+
couponCode,
|
|
16381
|
+
product,
|
|
16382
|
+
addressId,
|
|
16383
|
+
isExistingSource
|
|
16384
|
+
} = options;
|
|
16385
|
+
const params = isExistingSource ? {
|
|
16386
|
+
source_id: token
|
|
16387
|
+
} : {
|
|
16388
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16389
|
+
gateway_token: token
|
|
16390
|
+
};
|
|
16391
|
+
window.Pelcro.subscription.renew({
|
|
16392
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16393
|
+
plan_id: plan.id,
|
|
16394
|
+
coupon_code: couponCode,
|
|
16395
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16396
|
+
subscription_id: subscriptionIdToRenew,
|
|
16397
|
+
address_id: product.address_required ? addressId : null,
|
|
16398
|
+
...params
|
|
16399
|
+
}, (err, res) => {
|
|
16400
|
+
callback(err, res);
|
|
16401
|
+
});
|
|
16402
|
+
}
|
|
16403
|
+
});
|
|
16404
|
+
_classPrivateFieldInitSpec$1(this, _createGiftedSubscription5, {
|
|
16405
|
+
writable: true,
|
|
16406
|
+
value: (options, callback) => {
|
|
16407
|
+
const {
|
|
16408
|
+
token,
|
|
16409
|
+
plan,
|
|
16410
|
+
couponCode,
|
|
16411
|
+
product,
|
|
16412
|
+
giftRecipient,
|
|
16413
|
+
quantity = 1,
|
|
16414
|
+
addressId,
|
|
16415
|
+
isExistingSource
|
|
16416
|
+
} = options;
|
|
16417
|
+
const params = isExistingSource ? {
|
|
16418
|
+
source_id: token
|
|
16419
|
+
} : {
|
|
16420
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16421
|
+
gateway_token: token
|
|
16422
|
+
};
|
|
16423
|
+
window.Pelcro.subscription.create({
|
|
16424
|
+
quantity,
|
|
16425
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16426
|
+
plan_id: plan.id,
|
|
16427
|
+
coupon_code: couponCode,
|
|
16428
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16429
|
+
gift_recipient_email: giftRecipient.email,
|
|
16430
|
+
gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
|
|
16431
|
+
gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
|
|
16432
|
+
gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
|
|
16433
|
+
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
16434
|
+
address_id: product.address_required ? addressId : null,
|
|
16435
|
+
...params
|
|
16436
|
+
}, (err, res) => {
|
|
16437
|
+
callback(err, res);
|
|
16438
|
+
});
|
|
16439
|
+
}
|
|
16440
|
+
});
|
|
16441
|
+
_classPrivateFieldInitSpec$1(this, _renewGiftedSubscription4, {
|
|
16442
|
+
writable: true,
|
|
16443
|
+
value: (options, callback) => {
|
|
16444
|
+
const {
|
|
16445
|
+
subscriptionIdToRenew,
|
|
16446
|
+
token,
|
|
16447
|
+
product,
|
|
16448
|
+
plan,
|
|
16449
|
+
couponCode,
|
|
16450
|
+
addressId,
|
|
16451
|
+
isExistingSource
|
|
16452
|
+
} = options;
|
|
16453
|
+
const params = isExistingSource ? {
|
|
16454
|
+
source_id: token
|
|
16455
|
+
} : {
|
|
16456
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16457
|
+
gateway_token: token
|
|
16458
|
+
};
|
|
16459
|
+
window.Pelcro.subscription.renewGift({
|
|
16460
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16461
|
+
plan_id: plan.id,
|
|
16462
|
+
coupon_code: couponCode,
|
|
16463
|
+
subscription_id: subscriptionIdToRenew,
|
|
16464
|
+
address_id: product.address_required ? addressId : null,
|
|
16465
|
+
...params
|
|
16466
|
+
}, (err, res) => {
|
|
16467
|
+
callback(err, res);
|
|
16468
|
+
});
|
|
16469
|
+
}
|
|
16470
|
+
});
|
|
16471
|
+
_classPrivateFieldInitSpec$1(this, _purchaseEcommerceOrder4, {
|
|
16472
|
+
writable: true,
|
|
16473
|
+
value: (options, callback) => {
|
|
16474
|
+
const {
|
|
16475
|
+
token,
|
|
16476
|
+
items,
|
|
16477
|
+
couponCode,
|
|
16478
|
+
addressId,
|
|
16479
|
+
isExistingSource
|
|
16480
|
+
} = options;
|
|
16481
|
+
const params = isExistingSource ? {
|
|
16482
|
+
source_id: token
|
|
16483
|
+
} : {
|
|
16484
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16485
|
+
gateway_token: token
|
|
16486
|
+
};
|
|
16487
|
+
window.Pelcro.ecommerce.order.create({
|
|
16488
|
+
items,
|
|
16489
|
+
coupon_code: couponCode,
|
|
16490
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16491
|
+
...params,
|
|
16492
|
+
...(addressId && {
|
|
16493
|
+
address_id: addressId
|
|
16494
|
+
})
|
|
16495
|
+
}, (err, res) => {
|
|
16496
|
+
callback(err, res);
|
|
16497
|
+
});
|
|
16498
|
+
}
|
|
16499
|
+
});
|
|
16500
|
+
_classPrivateFieldInitSpec$1(this, _payInvoice5, {
|
|
16501
|
+
writable: true,
|
|
16502
|
+
value: (options, callback) => {
|
|
16503
|
+
const {
|
|
16504
|
+
token,
|
|
16505
|
+
invoiceId
|
|
16506
|
+
} = options;
|
|
16507
|
+
const params = options.isExistingSource ? {
|
|
16508
|
+
source_id: token,
|
|
16509
|
+
invoice_id: invoiceId
|
|
16510
|
+
} : {
|
|
16511
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16512
|
+
gateway_token: token,
|
|
16513
|
+
invoice_id: invoiceId
|
|
16514
|
+
};
|
|
16515
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
16516
|
+
callback(err, res);
|
|
16517
|
+
});
|
|
16518
|
+
}
|
|
16519
|
+
});
|
|
16520
|
+
}
|
|
16521
|
+
}
|
|
16522
|
+
|
|
16301
16523
|
/**
|
|
16302
16524
|
* @typedef {Object} PaymentStateType
|
|
16303
16525
|
* @property {boolean} disableSubmit
|
|
@@ -16337,6 +16559,8 @@ const initialState$k = {
|
|
|
16337
16559
|
firstNameError: null,
|
|
16338
16560
|
lastNameError: null,
|
|
16339
16561
|
phoneError: null,
|
|
16562
|
+
month: "",
|
|
16563
|
+
year: "",
|
|
16340
16564
|
alert: {
|
|
16341
16565
|
type: "error",
|
|
16342
16566
|
content: ""
|
|
@@ -16402,9 +16626,250 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16402
16626
|
updateTotalAmountWithTax();
|
|
16403
16627
|
}, []);
|
|
16404
16628
|
|
|
16629
|
+
/*====== Start Cybersource integration ========*/
|
|
16630
|
+
const cybersourceErrorHandle = err => {
|
|
16631
|
+
var _err$details, _err$details$response;
|
|
16632
|
+
const errorMessages = [];
|
|
16633
|
+
|
|
16634
|
+
// enumerable error (ex: validation errors)
|
|
16635
|
+
Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
|
|
16636
|
+
let {
|
|
16637
|
+
message
|
|
16638
|
+
} = _ref2;
|
|
16639
|
+
errorMessages.push(message);
|
|
16640
|
+
});
|
|
16641
|
+
|
|
16642
|
+
// convert to multiline string
|
|
16643
|
+
return errorMessages.join("\n");
|
|
16644
|
+
};
|
|
16645
|
+
const submitUsingCybersource = (state, dispatch) => {
|
|
16646
|
+
var _cybersourceInstanceR;
|
|
16647
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16648
|
+
if (isUsingExistingPaymentMethod) {
|
|
16649
|
+
// no need to create a new source using cybersrce
|
|
16650
|
+
return handleCybersourcePayment(null, state);
|
|
16651
|
+
}
|
|
16652
|
+
if (!cybersourceInstanceRef.current) {
|
|
16653
|
+
return console.error("Cybersource sdk script wasn't loaded, you need to load Cybersource sdk before rendering the Cybersource payment flow");
|
|
16654
|
+
}
|
|
16655
|
+
let options = {
|
|
16656
|
+
cardExpirationMonth: state.month,
|
|
16657
|
+
cardExpirationYear: state.year
|
|
16658
|
+
};
|
|
16659
|
+
(_cybersourceInstanceR = cybersourceInstanceRef.current) === null || _cybersourceInstanceR === void 0 ? void 0 : _cybersourceInstanceR.createToken(options, function (err, response) {
|
|
16660
|
+
if (err) {
|
|
16661
|
+
dispatch({
|
|
16662
|
+
type: DISABLE_SUBMIT,
|
|
16663
|
+
payload: false
|
|
16664
|
+
});
|
|
16665
|
+
dispatch({
|
|
16666
|
+
type: LOADING,
|
|
16667
|
+
payload: false
|
|
16668
|
+
});
|
|
16669
|
+
return dispatch({
|
|
16670
|
+
type: SHOW_ALERT,
|
|
16671
|
+
payload: {
|
|
16672
|
+
type: "error",
|
|
16673
|
+
content: cybersourceErrorHandle(err)
|
|
16674
|
+
}
|
|
16675
|
+
});
|
|
16676
|
+
}
|
|
16677
|
+
handleCybersourcePayment(response.token, state);
|
|
16678
|
+
});
|
|
16679
|
+
};
|
|
16680
|
+
function handleCybersourcePayment(paymentRequest, state) {
|
|
16681
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16682
|
+
if (type === "createPayment") {
|
|
16683
|
+
handleCybersourceSubscription();
|
|
16684
|
+
} else if (type === "orderCreate") {
|
|
16685
|
+
purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
16686
|
+
} else if (type === "invoicePayment") {
|
|
16687
|
+
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
16688
|
+
} else if (type === "updatePaymentSource") {
|
|
16689
|
+
createNewCybersourceCard();
|
|
16690
|
+
}
|
|
16691
|
+
function createNewCybersourceCard() {
|
|
16692
|
+
window.Pelcro.source.create({
|
|
16693
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16694
|
+
token: paymentRequest,
|
|
16695
|
+
gateway: "cybersource"
|
|
16696
|
+
}, (err, res) => {
|
|
16697
|
+
dispatch({
|
|
16698
|
+
type: DISABLE_SUBMIT,
|
|
16699
|
+
payload: false
|
|
16700
|
+
});
|
|
16701
|
+
dispatch({
|
|
16702
|
+
type: LOADING,
|
|
16703
|
+
payload: false
|
|
16704
|
+
});
|
|
16705
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
16706
|
+
if (err) {
|
|
16707
|
+
onFailure(err);
|
|
16708
|
+
return dispatch({
|
|
16709
|
+
type: SHOW_ALERT,
|
|
16710
|
+
payload: {
|
|
16711
|
+
type: "error",
|
|
16712
|
+
content: getErrorMessages(err)
|
|
16713
|
+
}
|
|
16714
|
+
});
|
|
16715
|
+
}
|
|
16716
|
+
dispatch({
|
|
16717
|
+
type: SHOW_ALERT,
|
|
16718
|
+
payload: {
|
|
16719
|
+
type: "success",
|
|
16720
|
+
content: t("messages.sourceUpdated")
|
|
16721
|
+
}
|
|
16722
|
+
});
|
|
16723
|
+
onSuccess(res);
|
|
16724
|
+
} //
|
|
16725
|
+
);
|
|
16726
|
+
}
|
|
16727
|
+
|
|
16728
|
+
function handleCybersourceSubscription() {
|
|
16729
|
+
const payment = new Payment(new CybersourceGateway());
|
|
16730
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
16731
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16732
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16733
|
+
const renewGift = isRenewingGift;
|
|
16734
|
+
const {
|
|
16735
|
+
couponCode
|
|
16736
|
+
} = state;
|
|
16737
|
+
if (renewGift) {
|
|
16738
|
+
return payment.execute({
|
|
16739
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
16740
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16741
|
+
plan,
|
|
16742
|
+
couponCode,
|
|
16743
|
+
product,
|
|
16744
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16745
|
+
subscriptionIdToRenew,
|
|
16746
|
+
addressId: selectedAddressId
|
|
16747
|
+
}, (err, res) => {
|
|
16748
|
+
if (err) {
|
|
16749
|
+
return handlePaymentError(err);
|
|
16750
|
+
}
|
|
16751
|
+
onSuccess(res);
|
|
16752
|
+
});
|
|
16753
|
+
} else if (giftSubscriprition) {
|
|
16754
|
+
return payment.execute({
|
|
16755
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
16756
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16757
|
+
quantity: plan.quantity,
|
|
16758
|
+
plan,
|
|
16759
|
+
couponCode,
|
|
16760
|
+
product,
|
|
16761
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16762
|
+
giftRecipient,
|
|
16763
|
+
addressId: selectedAddressId
|
|
16764
|
+
}, (err, res) => {
|
|
16765
|
+
if (err) {
|
|
16766
|
+
return handlePaymentError(err);
|
|
16767
|
+
}
|
|
16768
|
+
onSuccess(res);
|
|
16769
|
+
});
|
|
16770
|
+
} else if (renewSubscription) {
|
|
16771
|
+
return payment.execute({
|
|
16772
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
16773
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16774
|
+
quantity: plan.quantity,
|
|
16775
|
+
plan,
|
|
16776
|
+
couponCode,
|
|
16777
|
+
product,
|
|
16778
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16779
|
+
subscriptionIdToRenew,
|
|
16780
|
+
addressId: selectedAddressId
|
|
16781
|
+
}, (err, res) => {
|
|
16782
|
+
if (err) {
|
|
16783
|
+
return handlePaymentError(err);
|
|
16784
|
+
}
|
|
16785
|
+
onSuccess(res);
|
|
16786
|
+
});
|
|
16787
|
+
} else if (createSubscription) {
|
|
16788
|
+
return payment.execute({
|
|
16789
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
16790
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16791
|
+
quantity: plan.quantity,
|
|
16792
|
+
plan,
|
|
16793
|
+
couponCode,
|
|
16794
|
+
product,
|
|
16795
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16796
|
+
addressId: selectedAddressId
|
|
16797
|
+
}, (err, res) => {
|
|
16798
|
+
if (err) {
|
|
16799
|
+
return handlePaymentError(err);
|
|
16800
|
+
}
|
|
16801
|
+
onSuccess(res);
|
|
16802
|
+
});
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16805
|
+
}
|
|
16806
|
+
const tokenizeCard = (error, microformInstance) => {
|
|
16807
|
+
if (error) {
|
|
16808
|
+
return;
|
|
16809
|
+
}
|
|
16810
|
+
cybersourceInstanceRef.current = microformInstance;
|
|
16811
|
+
};
|
|
16812
|
+
const initCybersourceScript = () => {
|
|
16813
|
+
// jwk api call
|
|
16814
|
+
window.Pelcro.payment.getJWK({
|
|
16815
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16816
|
+
site_id: window.Pelcro.siteid
|
|
16817
|
+
}, (err, res) => {
|
|
16818
|
+
if (err) {
|
|
16819
|
+
onFailure(err);
|
|
16820
|
+
dispatch({
|
|
16821
|
+
type: DISABLE_SUBMIT,
|
|
16822
|
+
payload: false
|
|
16823
|
+
});
|
|
16824
|
+
dispatch({
|
|
16825
|
+
type: LOADING,
|
|
16826
|
+
payload: false
|
|
16827
|
+
});
|
|
16828
|
+
return dispatch({
|
|
16829
|
+
type: SHOW_ALERT,
|
|
16830
|
+
payload: {
|
|
16831
|
+
type: "error",
|
|
16832
|
+
content: getErrorMessages(err)
|
|
16833
|
+
}
|
|
16834
|
+
});
|
|
16835
|
+
}
|
|
16836
|
+
const {
|
|
16837
|
+
key: jwk
|
|
16838
|
+
} = res;
|
|
16839
|
+
// SETUP MICROFORM
|
|
16840
|
+
FLEX.microform({
|
|
16841
|
+
keyId: jwk.kid,
|
|
16842
|
+
keystore: jwk,
|
|
16843
|
+
container: "#cybersourceCardNumber",
|
|
16844
|
+
placeholder: "Card Number",
|
|
16845
|
+
styles: {
|
|
16846
|
+
input: {
|
|
16847
|
+
"font-size": "14px",
|
|
16848
|
+
"font-family": "helvetica, tahoma, calibri, sans-serif",
|
|
16849
|
+
color: "#555"
|
|
16850
|
+
},
|
|
16851
|
+
":focus": {
|
|
16852
|
+
color: "blue"
|
|
16853
|
+
},
|
|
16854
|
+
":disabled": {
|
|
16855
|
+
cursor: "not-allowed"
|
|
16856
|
+
},
|
|
16857
|
+
valid: {
|
|
16858
|
+
color: "#3c763d"
|
|
16859
|
+
},
|
|
16860
|
+
invalid: {
|
|
16861
|
+
color: "#a94442"
|
|
16862
|
+
}
|
|
16863
|
+
}
|
|
16864
|
+
}, tokenizeCard);
|
|
16865
|
+
});
|
|
16866
|
+
};
|
|
16867
|
+
|
|
16868
|
+
/*====== End Cybersource integration ========*/
|
|
16869
|
+
|
|
16405
16870
|
/*====== Start Tap integration ========*/
|
|
16406
16871
|
const submitUsingTap = state => {
|
|
16407
|
-
var
|
|
16872
|
+
var _ref3, _ref4, _ref5, _state$updatedPrice;
|
|
16408
16873
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16409
16874
|
if (isUsingExistingPaymentMethod) {
|
|
16410
16875
|
// no need to create a new source using tap
|
|
@@ -16428,7 +16893,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16428
16893
|
return total + item.price * item.quantity;
|
|
16429
16894
|
}, 0);
|
|
16430
16895
|
};
|
|
16431
|
-
const totalAmount = (
|
|
16896
|
+
const totalAmount = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref5 !== void 0 ? _ref5 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref4 !== void 0 ? _ref4 : getOrderItemsTotal()) !== null && _ref3 !== void 0 ? _ref3 : 10;
|
|
16432
16897
|
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
16433
16898
|
if (result.error) {
|
|
16434
16899
|
// Inform the user if there was an error
|
|
@@ -16845,6 +17310,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16845
17310
|
const vantivInstanceRef = React__default['default'].useRef(null);
|
|
16846
17311
|
const tapInstanceRef = React__default['default'].useRef(null);
|
|
16847
17312
|
const tapInstanceCard = React__default['default'].useRef(null);
|
|
17313
|
+
const cybersourceInstanceRef = React__default['default'].useRef(null);
|
|
16848
17314
|
React.useEffect(() => {
|
|
16849
17315
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16850
17316
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
@@ -16893,6 +17359,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16893
17359
|
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
16894
17360
|
initTapScript();
|
|
16895
17361
|
}
|
|
17362
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
|
|
17363
|
+
window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
|
|
17364
|
+
document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
|
|
17365
|
+
initCybersourceScript();
|
|
17366
|
+
});
|
|
17367
|
+
}
|
|
17368
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
|
|
17369
|
+
initCybersourceScript();
|
|
17370
|
+
}
|
|
16896
17371
|
});
|
|
16897
17372
|
}, [selectedPaymentMethodId]);
|
|
16898
17373
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -16908,13 +17383,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16908
17383
|
});
|
|
16909
17384
|
|
|
16910
17385
|
// When Google pay / Apple pay source created
|
|
16911
|
-
paymentRequest.on("source",
|
|
17386
|
+
paymentRequest.on("source", _ref6 => {
|
|
16912
17387
|
var _source$card;
|
|
16913
17388
|
let {
|
|
16914
17389
|
complete,
|
|
16915
17390
|
source,
|
|
16916
17391
|
...data
|
|
16917
|
-
} =
|
|
17392
|
+
} = _ref6;
|
|
16918
17393
|
dispatch({
|
|
16919
17394
|
type: DISABLE_COUPON_BUTTON,
|
|
16920
17395
|
payload: true
|
|
@@ -16929,11 +17404,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16929
17404
|
});
|
|
16930
17405
|
complete("success");
|
|
16931
17406
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
16932
|
-
return generate3DSecureSource(source).then(
|
|
17407
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
16933
17408
|
let {
|
|
16934
17409
|
source,
|
|
16935
17410
|
error
|
|
16936
|
-
} =
|
|
17411
|
+
} = _ref7;
|
|
16937
17412
|
if (error) {
|
|
16938
17413
|
return handlePaymentError(error);
|
|
16939
17414
|
}
|
|
@@ -17533,12 +18008,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17533
18008
|
const updatePaymentSource = (state, dispatch) => {
|
|
17534
18009
|
return stripe.createSource({
|
|
17535
18010
|
type: "card"
|
|
17536
|
-
}).then(
|
|
18011
|
+
}).then(_ref8 => {
|
|
17537
18012
|
var _source$card2;
|
|
17538
18013
|
let {
|
|
17539
18014
|
source,
|
|
17540
18015
|
error
|
|
17541
|
-
} =
|
|
18016
|
+
} = _ref8;
|
|
17542
18017
|
if (error) {
|
|
17543
18018
|
return handlePaymentError(error);
|
|
17544
18019
|
}
|
|
@@ -17619,12 +18094,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17619
18094
|
}
|
|
17620
18095
|
stripe.createSource({
|
|
17621
18096
|
type: "card"
|
|
17622
|
-
}).then(
|
|
17623
|
-
var
|
|
18097
|
+
}).then(_ref9 => {
|
|
18098
|
+
var _ref10, _ref11, _state$updatedPrice2;
|
|
17624
18099
|
let {
|
|
17625
18100
|
source,
|
|
17626
18101
|
error
|
|
17627
|
-
} =
|
|
18102
|
+
} = _ref9;
|
|
17628
18103
|
if (error) {
|
|
17629
18104
|
return handlePaymentError(error);
|
|
17630
18105
|
}
|
|
@@ -17643,7 +18118,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17643
18118
|
return total + item.price * item.quantity;
|
|
17644
18119
|
}, 0);
|
|
17645
18120
|
};
|
|
17646
|
-
(
|
|
18121
|
+
(_ref10 = (_ref11 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref11 !== void 0 ? _ref11 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref10 !== void 0 ? _ref10 : getOrderItemsTotal();
|
|
17647
18122
|
return handlePayment(source);
|
|
17648
18123
|
}).catch(error => {
|
|
17649
18124
|
return handlePaymentError(error);
|
|
@@ -17859,6 +18334,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17859
18334
|
if (getSiteCardProcessor() === "tap") {
|
|
17860
18335
|
return submitUsingTap(state);
|
|
17861
18336
|
}
|
|
18337
|
+
if (getSiteCardProcessor() === "cybersource") {
|
|
18338
|
+
return submitUsingCybersource(state, dispatch);
|
|
18339
|
+
}
|
|
17862
18340
|
if (selectedPaymentMethodId) {
|
|
17863
18341
|
// pay with selected method (source) if exists already
|
|
17864
18342
|
return handlePayment({
|
|
@@ -17926,6 +18404,16 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17926
18404
|
...state,
|
|
17927
18405
|
percentOff: action.payload
|
|
17928
18406
|
});
|
|
18407
|
+
case SET_MONTH:
|
|
18408
|
+
return lib_7({
|
|
18409
|
+
...state,
|
|
18410
|
+
month: action.payload
|
|
18411
|
+
});
|
|
18412
|
+
case SET_YEAR:
|
|
18413
|
+
return lib_7({
|
|
18414
|
+
...state,
|
|
18415
|
+
year: action.payload
|
|
18416
|
+
});
|
|
17929
18417
|
case SET_FIRST_NAME:
|
|
17930
18418
|
return lib_7({
|
|
17931
18419
|
...state,
|
|
@@ -18024,6 +18512,114 @@ const PaymentMethodContainer = props => {
|
|
|
18024
18512
|
return null;
|
|
18025
18513
|
};
|
|
18026
18514
|
|
|
18515
|
+
function Select(_ref) {
|
|
18516
|
+
let {
|
|
18517
|
+
label = "",
|
|
18518
|
+
required,
|
|
18519
|
+
id,
|
|
18520
|
+
errorId,
|
|
18521
|
+
error = "",
|
|
18522
|
+
className = "",
|
|
18523
|
+
labelClassName = "",
|
|
18524
|
+
errorClassName = "",
|
|
18525
|
+
wrapperClassName = "",
|
|
18526
|
+
children,
|
|
18527
|
+
...otherProps
|
|
18528
|
+
} = _ref;
|
|
18529
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18530
|
+
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
18531
|
+
}, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
18532
|
+
htmlFor: id,
|
|
18533
|
+
className: `pelcro-input-label ${labelClassName}`
|
|
18534
|
+
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default['default'].createElement("select", Object.assign({
|
|
18535
|
+
id: id,
|
|
18536
|
+
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
18537
|
+
"aria-describedby": errorId,
|
|
18538
|
+
"aria-invalid": Boolean(error)
|
|
18539
|
+
}, otherProps), children), error && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18540
|
+
id: errorId,
|
|
18541
|
+
"aria-live": "assertive",
|
|
18542
|
+
className: `pelcro-input-error ${errorClassName}`
|
|
18543
|
+
}, error));
|
|
18544
|
+
}
|
|
18545
|
+
|
|
18546
|
+
function MonthSelect(_ref) {
|
|
18547
|
+
let {
|
|
18548
|
+
placeholder,
|
|
18549
|
+
store,
|
|
18550
|
+
...otherProps
|
|
18551
|
+
} = _ref;
|
|
18552
|
+
const {
|
|
18553
|
+
dispatch,
|
|
18554
|
+
state: {
|
|
18555
|
+
month
|
|
18556
|
+
}
|
|
18557
|
+
} = React.useContext(store);
|
|
18558
|
+
const get2digits = num => num < 10 ? "0" + num.toString() : num.toString();
|
|
18559
|
+
const createMonthsItems = React.useMemo(() => {
|
|
18560
|
+
return [...Array.from({
|
|
18561
|
+
length: 12
|
|
18562
|
+
}, (_, i) => i + 1)].map(i => {
|
|
18563
|
+
return /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18564
|
+
key: i,
|
|
18565
|
+
value: get2digits(i)
|
|
18566
|
+
}, get2digits(i));
|
|
18567
|
+
});
|
|
18568
|
+
}, []);
|
|
18569
|
+
const handleInputChange = value => {
|
|
18570
|
+
dispatch({
|
|
18571
|
+
type: SET_MONTH,
|
|
18572
|
+
payload: value
|
|
18573
|
+
});
|
|
18574
|
+
};
|
|
18575
|
+
return /*#__PURE__*/React__default['default'].createElement(Select, Object.assign({
|
|
18576
|
+
value: month,
|
|
18577
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18578
|
+
}, otherProps), /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18579
|
+
value: "",
|
|
18580
|
+
disabled: true,
|
|
18581
|
+
selected: true
|
|
18582
|
+
}, placeholder), createMonthsItems);
|
|
18583
|
+
}
|
|
18584
|
+
|
|
18585
|
+
function YearSelect(_ref) {
|
|
18586
|
+
let {
|
|
18587
|
+
placeholder,
|
|
18588
|
+
store,
|
|
18589
|
+
...otherProps
|
|
18590
|
+
} = _ref;
|
|
18591
|
+
const {
|
|
18592
|
+
dispatch,
|
|
18593
|
+
state: {
|
|
18594
|
+
year
|
|
18595
|
+
}
|
|
18596
|
+
} = React.useContext(store);
|
|
18597
|
+
const createYearsItems = React.useMemo(() => {
|
|
18598
|
+
return Array.from({
|
|
18599
|
+
length: 10
|
|
18600
|
+
}, (_, i) => i + new Date().getFullYear()).map(i => {
|
|
18601
|
+
return /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18602
|
+
key: i,
|
|
18603
|
+
value: i
|
|
18604
|
+
}, i);
|
|
18605
|
+
});
|
|
18606
|
+
}, []);
|
|
18607
|
+
const handleInputChange = value => {
|
|
18608
|
+
dispatch({
|
|
18609
|
+
type: SET_YEAR,
|
|
18610
|
+
payload: value
|
|
18611
|
+
});
|
|
18612
|
+
};
|
|
18613
|
+
return /*#__PURE__*/React__default['default'].createElement(Select, Object.assign({
|
|
18614
|
+
value: year,
|
|
18615
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18616
|
+
}, otherProps), /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18617
|
+
value: "",
|
|
18618
|
+
disabled: true,
|
|
18619
|
+
selected: true
|
|
18620
|
+
}, placeholder), createYearsItems);
|
|
18621
|
+
}
|
|
18622
|
+
|
|
18027
18623
|
const StripeInputStyle = {
|
|
18028
18624
|
base: "plc-w-full plc-p-3 plc-border plc-border-gray-300 plc-appearance-none plc-outline-none plc-rounded-sm plc-bg-gray-50 pelcro-input-input",
|
|
18029
18625
|
focus: "plc-ring-2 plc-ring-primary-400",
|
|
@@ -18113,6 +18709,24 @@ const CheckoutForm = () => {
|
|
|
18113
18709
|
id: "tapPaymentIframe"
|
|
18114
18710
|
});
|
|
18115
18711
|
}
|
|
18712
|
+
if (cardProcessor === "cybersource") {
|
|
18713
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18714
|
+
id: "cybersourceCardNumber",
|
|
18715
|
+
className: "pelcro-input-field plc-h-12"
|
|
18716
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18717
|
+
className: "plc-flex plc-items-end plc-justify-between plc-my-2"
|
|
18718
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18719
|
+
className: "plc-w-6/12 plc-pr-4"
|
|
18720
|
+
}, /*#__PURE__*/React__default['default'].createElement(MonthSelect, {
|
|
18721
|
+
store: store$k,
|
|
18722
|
+
placeholder: "Exp Month"
|
|
18723
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18724
|
+
className: "plc-w-6/12"
|
|
18725
|
+
}, /*#__PURE__*/React__default['default'].createElement(YearSelect, {
|
|
18726
|
+
store: store$k,
|
|
18727
|
+
placeholder: "Exp Year"
|
|
18728
|
+
}))));
|
|
18729
|
+
}
|
|
18116
18730
|
if (cardProcessor === "stripe") {
|
|
18117
18731
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(PelcroCardNumber, {
|
|
18118
18732
|
autoFocus: true
|
|
@@ -18851,7 +19465,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
18851
19465
|
*
|
|
18852
19466
|
*/
|
|
18853
19467
|
function PaymentMethodView(_ref) {
|
|
18854
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _calcAndFormatItemsTo, _order$;
|
|
19468
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _calcAndFormatItemsTo, _order$;
|
|
18855
19469
|
let {
|
|
18856
19470
|
onSuccess,
|
|
18857
19471
|
onGiftRenewalSuccess,
|
|
@@ -18869,6 +19483,7 @@ function PaymentMethodView(_ref) {
|
|
|
18869
19483
|
const cardProcessor = getSiteCardProcessor();
|
|
18870
19484
|
const supportsVantiv = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings);
|
|
18871
19485
|
const supportsTap = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.tap_gateway_settings);
|
|
19486
|
+
const supportsCybersource = Boolean((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.cybersource_gateway_settings);
|
|
18872
19487
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
18873
19488
|
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
18874
19489
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
@@ -18926,7 +19541,7 @@ function PaymentMethodView(_ref) {
|
|
|
18926
19541
|
className: "plc-mb-2"
|
|
18927
19542
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18928
19543
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
18929
|
-
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null)))));
|
|
19544
|
+
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null)))));
|
|
18930
19545
|
}
|
|
18931
19546
|
|
|
18932
19547
|
const SubscriptionRenewView = _ref => {
|
|
@@ -21948,37 +22563,6 @@ const AddressCreateSubmit = _ref => {
|
|
|
21948
22563
|
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
21949
22564
|
};
|
|
21950
22565
|
|
|
21951
|
-
function Select(_ref) {
|
|
21952
|
-
let {
|
|
21953
|
-
label = "",
|
|
21954
|
-
required,
|
|
21955
|
-
id,
|
|
21956
|
-
errorId,
|
|
21957
|
-
error = "",
|
|
21958
|
-
className = "",
|
|
21959
|
-
labelClassName = "",
|
|
21960
|
-
errorClassName = "",
|
|
21961
|
-
wrapperClassName = "",
|
|
21962
|
-
children,
|
|
21963
|
-
...otherProps
|
|
21964
|
-
} = _ref;
|
|
21965
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21966
|
-
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
21967
|
-
}, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
21968
|
-
htmlFor: id,
|
|
21969
|
-
className: `pelcro-input-label ${labelClassName}`
|
|
21970
|
-
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default['default'].createElement("select", Object.assign({
|
|
21971
|
-
id: id,
|
|
21972
|
-
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
21973
|
-
"aria-describedby": errorId,
|
|
21974
|
-
"aria-invalid": Boolean(error)
|
|
21975
|
-
}, otherProps), children), error && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
21976
|
-
id: errorId,
|
|
21977
|
-
"aria-live": "assertive",
|
|
21978
|
-
className: `pelcro-input-error ${errorClassName}`
|
|
21979
|
-
}, error));
|
|
21980
|
-
}
|
|
21981
|
-
|
|
21982
22566
|
function CountrySelect(_ref) {
|
|
21983
22567
|
let {
|
|
21984
22568
|
placeholder,
|