@pelcro/react-pelcro-js 3.36.0 → 3.38.0
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 +1176 -239
- package/dist/index.esm.js +1177 -239
- package/dist/pelcro.css +24 -9
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3333,12 +3333,19 @@ var paymentMethod_en = {
|
|
|
3333
3333
|
select: select$6,
|
|
3334
3334
|
"delete": {
|
|
3335
3335
|
title: "Delete payment method",
|
|
3336
|
-
subtitle: "
|
|
3336
|
+
subtitle: "Are you sure you want to delete the selected payment method?",
|
|
3337
|
+
details: "Payment method details",
|
|
3338
|
+
message: "This action is irreversible and will permanently remove the payment method from the system. Please ensure that there are no pending transactions or subscriptions associated with this payment method.",
|
|
3339
|
+
buttons: {
|
|
3340
|
+
"delete": "Delete payment method",
|
|
3341
|
+
back: "Go back"
|
|
3342
|
+
},
|
|
3337
3343
|
options: {
|
|
3338
|
-
select: "Select
|
|
3344
|
+
select: "Select a payment method to be the default",
|
|
3339
3345
|
add: "Add a new payment method"
|
|
3340
3346
|
},
|
|
3341
|
-
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced"
|
|
3347
|
+
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced",
|
|
3348
|
+
deletedSuccessfully: "Payment Method Successfully Deleted"
|
|
3342
3349
|
},
|
|
3343
3350
|
create: create$5
|
|
3344
3351
|
};
|
|
@@ -9559,6 +9566,17 @@ const getPaymentCardIcon$1 = name => {
|
|
|
9559
9566
|
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9560
9567
|
fill: "#FFF",
|
|
9561
9568
|
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
9569
|
+
})),
|
|
9570
|
+
amex: /*#__PURE__*/React__default.createElement("svg", {
|
|
9571
|
+
className: "plc-w-16",
|
|
9572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9573
|
+
viewBox: "0 0 48 48"
|
|
9574
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9575
|
+
fill: "#1976D2",
|
|
9576
|
+
d: "M45,35c0,2.209-1.791,4-4,4H7c-2.209,0-4-1.791-4-4V13c0-2.209,1.791-4,4-4h34c2.209,0,4,1.791,4,4V35z"
|
|
9577
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9578
|
+
fill: "#FFF",
|
|
9579
|
+
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
9562
9580
|
}))
|
|
9563
9581
|
};
|
|
9564
9582
|
return name ? icons[name.toLowerCase()] : /*#__PURE__*/React__default.createElement("svg", {
|
|
@@ -9610,6 +9628,19 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9610
9628
|
}
|
|
9611
9629
|
callback();
|
|
9612
9630
|
}
|
|
9631
|
+
const refreshUser = () => {
|
|
9632
|
+
var _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro6$user$;
|
|
9633
|
+
window.Pelcro.user.refresh({
|
|
9634
|
+
auth_token: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : (_window$Pelcro6$user$ = _window$Pelcro6$user.read()) === null || _window$Pelcro6$user$ === void 0 ? void 0 : _window$Pelcro6$user$.auth_token
|
|
9635
|
+
}, (err, res) => {
|
|
9636
|
+
if (err) {
|
|
9637
|
+
console.error(err);
|
|
9638
|
+
}
|
|
9639
|
+
if (res) {
|
|
9640
|
+
return res.data;
|
|
9641
|
+
}
|
|
9642
|
+
});
|
|
9643
|
+
};
|
|
9613
9644
|
|
|
9614
9645
|
const resources = {
|
|
9615
9646
|
en: {
|
|
@@ -11575,7 +11606,7 @@ const debounce = (func, waitTime) => {
|
|
|
11575
11606
|
};
|
|
11576
11607
|
};
|
|
11577
11608
|
function getSiteCardProcessor() {
|
|
11578
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
11609
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
|
|
11579
11610
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
|
|
11580
11611
|
return "vantiv";
|
|
11581
11612
|
}
|
|
@@ -11585,6 +11616,9 @@ function getSiteCardProcessor() {
|
|
|
11585
11616
|
if ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r3 !== void 0 && _window$Pelcro$site$r3.cybersource_gateway_settings) {
|
|
11586
11617
|
return "cybersource";
|
|
11587
11618
|
}
|
|
11619
|
+
if ((_window$Pelcro$site$r4 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r4 !== void 0 && _window$Pelcro$site$r4.braintree_gateway_settings) {
|
|
11620
|
+
return "braintree";
|
|
11621
|
+
}
|
|
11588
11622
|
return "stripe";
|
|
11589
11623
|
}
|
|
11590
11624
|
function getFourDigitYear(lastTwoDigits) {
|
|
@@ -11687,6 +11721,7 @@ const loadPaymentSDKs = () => {
|
|
|
11687
11721
|
} = usePelcro.getStore();
|
|
11688
11722
|
const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
|
|
11689
11723
|
const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
|
|
11724
|
+
const supportsBraintree = Boolean(window.Pelcro.site.read().braintree_gateway_settings);
|
|
11690
11725
|
whenUserReady(() => {
|
|
11691
11726
|
if (!window.Stripe && !supportsVantiv && !supportsTap) {
|
|
11692
11727
|
pure_1(window.Pelcro.environment.stripe);
|
|
@@ -11696,9 +11731,15 @@ const loadPaymentSDKs = () => {
|
|
|
11696
11731
|
|
|
11697
11732
|
// Load PayPal SDKs
|
|
11698
11733
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
11734
|
+
if (supportsPaypal || supportsBraintree) {
|
|
11735
|
+
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/client.min.js", "braintree-sdk");
|
|
11736
|
+
}
|
|
11699
11737
|
if (supportsPaypal) {
|
|
11700
|
-
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.
|
|
11701
|
-
|
|
11738
|
+
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
|
|
11739
|
+
}
|
|
11740
|
+
if (supportsBraintree) {
|
|
11741
|
+
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/three-d-secure.min.js", "braintree-3D-secure-sdk");
|
|
11742
|
+
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/hosted-fields.min.js", "braintree-hosted-fields-sdk");
|
|
11702
11743
|
}
|
|
11703
11744
|
|
|
11704
11745
|
// Load Vantiv SDKs
|
|
@@ -12580,8 +12621,8 @@ const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
|
12580
12621
|
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12581
12622
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12582
12623
|
const SET_IS_DEFAULT_PAYMENT_METHOD = "SET_IS_DEFAULT_PAYMENT_METHOD";
|
|
12583
|
-
const SET_DELETE_PAYMENT_METHOD_OPTION = "SET_DELETE_PAYMENT_METHOD_OPTION";
|
|
12584
12624
|
const SET_PAYMENT_METHODS = "SET_PAYMENT_METHODS";
|
|
12625
|
+
const SHOW_PAYMENT_METHOD_SELECT = "SHOW_PAYMENT_METHOD_SELECT";
|
|
12585
12626
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12586
12627
|
const SET_EMAILS = "SET_EMAILS";
|
|
12587
12628
|
const SET_EMAILS_ERROR = "SET_EMAILS_ERROR";
|
|
@@ -16334,7 +16375,7 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
|
|
|
16334
16375
|
var _generateUserError = /*#__PURE__*/new WeakMap();
|
|
16335
16376
|
class Payment {
|
|
16336
16377
|
/**
|
|
16337
|
-
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway)} paymentGateway
|
|
16378
|
+
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway|BraintreeGateway)} paymentGateway
|
|
16338
16379
|
*/
|
|
16339
16380
|
constructor(paymentGateway) {
|
|
16340
16381
|
_defineProperty$3(this, "execute", (options, callback) => {
|
|
@@ -16353,7 +16394,7 @@ class Payment {
|
|
|
16353
16394
|
_classPrivateFieldInitSpec$1(this, _isPaymentGatewayInvalid, {
|
|
16354
16395
|
writable: true,
|
|
16355
16396
|
value: gateway => {
|
|
16356
|
-
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway || gateway instanceof CybersourceGateway);
|
|
16397
|
+
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway || gateway instanceof CybersourceGateway || gateway instanceof BraintreeGateway);
|
|
16357
16398
|
}
|
|
16358
16399
|
});
|
|
16359
16400
|
_classPrivateFieldInitSpec$1(this, _generateUserError, {
|
|
@@ -16408,7 +16449,8 @@ const PAYMENT_GATEWAYS_ENUM = {
|
|
|
16408
16449
|
paypal: "braintree",
|
|
16409
16450
|
vantiv: "vantiv",
|
|
16410
16451
|
tap: "tap",
|
|
16411
|
-
cybersource: "cybersource"
|
|
16452
|
+
cybersource: "cybersource",
|
|
16453
|
+
braintree: "braintree"
|
|
16412
16454
|
};
|
|
16413
16455
|
|
|
16414
16456
|
/**
|
|
@@ -17347,6 +17389,218 @@ class CybersourceGateway {
|
|
|
17347
17389
|
});
|
|
17348
17390
|
}
|
|
17349
17391
|
}
|
|
17392
|
+
var _paymentGateway6 = /*#__PURE__*/new WeakMap();
|
|
17393
|
+
var _createSubscription6 = /*#__PURE__*/new WeakMap();
|
|
17394
|
+
var _renewSubscription5 = /*#__PURE__*/new WeakMap();
|
|
17395
|
+
var _createGiftedSubscription6 = /*#__PURE__*/new WeakMap();
|
|
17396
|
+
var _renewGiftedSubscription5 = /*#__PURE__*/new WeakMap();
|
|
17397
|
+
var _purchaseEcommerceOrder5 = /*#__PURE__*/new WeakMap();
|
|
17398
|
+
var _payInvoice6 = /*#__PURE__*/new WeakMap();
|
|
17399
|
+
class BraintreeGateway {
|
|
17400
|
+
constructor() {
|
|
17401
|
+
_classPrivateFieldInitSpec$1(this, _paymentGateway6, {
|
|
17402
|
+
writable: true,
|
|
17403
|
+
value: PAYMENT_GATEWAYS_ENUM["braintree"]
|
|
17404
|
+
});
|
|
17405
|
+
_defineProperty$3(this, "execute", (options, callback) => {
|
|
17406
|
+
const types = PAYMENT_TYPES;
|
|
17407
|
+
switch (options.type) {
|
|
17408
|
+
case types.CREATE_SUBSCRIPTION:
|
|
17409
|
+
return _classPrivateFieldGet(this, _createSubscription6).call(this, options, callback);
|
|
17410
|
+
case types.RENEW_SUBSCRIPTION:
|
|
17411
|
+
return _classPrivateFieldGet(this, _renewSubscription5).call(this, options, callback);
|
|
17412
|
+
case types.CREATE_GIFTED_SUBSCRIPTION:
|
|
17413
|
+
return _classPrivateFieldGet(this, _createGiftedSubscription6).call(this, options, callback);
|
|
17414
|
+
case types.RENEW_GIFTED_SUBSCRIPTION:
|
|
17415
|
+
return _classPrivateFieldGet(this, _renewGiftedSubscription5).call(this, options, callback);
|
|
17416
|
+
case types.PURCHASE_ECOMMERCE_ORDER:
|
|
17417
|
+
return _classPrivateFieldGet(this, _purchaseEcommerceOrder5).call(this, options, callback);
|
|
17418
|
+
case types.PAY_INVOICE:
|
|
17419
|
+
return _classPrivateFieldGet(this, _payInvoice6).call(this, options, callback);
|
|
17420
|
+
default:
|
|
17421
|
+
console.error("Unsupported payment method: braintree Gateway");
|
|
17422
|
+
}
|
|
17423
|
+
});
|
|
17424
|
+
_classPrivateFieldInitSpec$1(this, _createSubscription6, {
|
|
17425
|
+
writable: true,
|
|
17426
|
+
value: (options, callback) => {
|
|
17427
|
+
const {
|
|
17428
|
+
token,
|
|
17429
|
+
plan,
|
|
17430
|
+
couponCode,
|
|
17431
|
+
product,
|
|
17432
|
+
quantity = 1,
|
|
17433
|
+
addressId,
|
|
17434
|
+
isExistingSource
|
|
17435
|
+
} = options;
|
|
17436
|
+
const params = isExistingSource ? {
|
|
17437
|
+
source_id: token
|
|
17438
|
+
} : {
|
|
17439
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17440
|
+
gateway_token: token
|
|
17441
|
+
};
|
|
17442
|
+
window.Pelcro.subscription.create({
|
|
17443
|
+
quantity,
|
|
17444
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
17445
|
+
plan_id: plan.id,
|
|
17446
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17447
|
+
coupon_code: couponCode,
|
|
17448
|
+
address_id: product.address_required ? addressId : null,
|
|
17449
|
+
...params
|
|
17450
|
+
}, (err, res) => {
|
|
17451
|
+
callback(err, res);
|
|
17452
|
+
});
|
|
17453
|
+
}
|
|
17454
|
+
});
|
|
17455
|
+
_classPrivateFieldInitSpec$1(this, _renewSubscription5, {
|
|
17456
|
+
writable: true,
|
|
17457
|
+
value: (options, callback) => {
|
|
17458
|
+
const {
|
|
17459
|
+
subscriptionIdToRenew,
|
|
17460
|
+
token,
|
|
17461
|
+
plan,
|
|
17462
|
+
couponCode,
|
|
17463
|
+
product,
|
|
17464
|
+
addressId,
|
|
17465
|
+
isExistingSource
|
|
17466
|
+
} = options;
|
|
17467
|
+
const params = isExistingSource ? {
|
|
17468
|
+
source_id: token
|
|
17469
|
+
} : {
|
|
17470
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17471
|
+
gateway_token: token
|
|
17472
|
+
};
|
|
17473
|
+
window.Pelcro.subscription.renew({
|
|
17474
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
17475
|
+
plan_id: plan.id,
|
|
17476
|
+
coupon_code: couponCode,
|
|
17477
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17478
|
+
subscription_id: subscriptionIdToRenew,
|
|
17479
|
+
address_id: product.address_required ? addressId : null,
|
|
17480
|
+
...params
|
|
17481
|
+
}, (err, res) => {
|
|
17482
|
+
callback(err, res);
|
|
17483
|
+
});
|
|
17484
|
+
}
|
|
17485
|
+
});
|
|
17486
|
+
_classPrivateFieldInitSpec$1(this, _createGiftedSubscription6, {
|
|
17487
|
+
writable: true,
|
|
17488
|
+
value: (options, callback) => {
|
|
17489
|
+
const {
|
|
17490
|
+
token,
|
|
17491
|
+
plan,
|
|
17492
|
+
couponCode,
|
|
17493
|
+
product,
|
|
17494
|
+
giftRecipient,
|
|
17495
|
+
quantity = 1,
|
|
17496
|
+
addressId,
|
|
17497
|
+
isExistingSource
|
|
17498
|
+
} = options;
|
|
17499
|
+
const params = isExistingSource ? {
|
|
17500
|
+
source_id: token
|
|
17501
|
+
} : {
|
|
17502
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17503
|
+
gateway_token: token
|
|
17504
|
+
};
|
|
17505
|
+
window.Pelcro.subscription.create({
|
|
17506
|
+
quantity,
|
|
17507
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
17508
|
+
plan_id: plan.id,
|
|
17509
|
+
coupon_code: couponCode,
|
|
17510
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17511
|
+
gift_recipient_email: giftRecipient.email,
|
|
17512
|
+
gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
|
|
17513
|
+
gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
|
|
17514
|
+
gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
|
|
17515
|
+
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
17516
|
+
address_id: product.address_required ? addressId : null,
|
|
17517
|
+
...params
|
|
17518
|
+
}, (err, res) => {
|
|
17519
|
+
callback(err, res);
|
|
17520
|
+
});
|
|
17521
|
+
}
|
|
17522
|
+
});
|
|
17523
|
+
_classPrivateFieldInitSpec$1(this, _renewGiftedSubscription5, {
|
|
17524
|
+
writable: true,
|
|
17525
|
+
value: (options, callback) => {
|
|
17526
|
+
const {
|
|
17527
|
+
subscriptionIdToRenew,
|
|
17528
|
+
token,
|
|
17529
|
+
product,
|
|
17530
|
+
plan,
|
|
17531
|
+
couponCode,
|
|
17532
|
+
addressId,
|
|
17533
|
+
isExistingSource
|
|
17534
|
+
} = options;
|
|
17535
|
+
const params = isExistingSource ? {
|
|
17536
|
+
source_id: token
|
|
17537
|
+
} : {
|
|
17538
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17539
|
+
gateway_token: token
|
|
17540
|
+
};
|
|
17541
|
+
window.Pelcro.subscription.renewGift({
|
|
17542
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
17543
|
+
plan_id: plan.id,
|
|
17544
|
+
coupon_code: couponCode,
|
|
17545
|
+
subscription_id: subscriptionIdToRenew,
|
|
17546
|
+
address_id: product.address_required ? addressId : null,
|
|
17547
|
+
...params
|
|
17548
|
+
}, (err, res) => {
|
|
17549
|
+
callback(err, res);
|
|
17550
|
+
});
|
|
17551
|
+
}
|
|
17552
|
+
});
|
|
17553
|
+
_classPrivateFieldInitSpec$1(this, _purchaseEcommerceOrder5, {
|
|
17554
|
+
writable: true,
|
|
17555
|
+
value: (options, callback) => {
|
|
17556
|
+
const {
|
|
17557
|
+
token,
|
|
17558
|
+
items,
|
|
17559
|
+
couponCode,
|
|
17560
|
+
addressId,
|
|
17561
|
+
isExistingSource
|
|
17562
|
+
} = options;
|
|
17563
|
+
const params = isExistingSource ? {
|
|
17564
|
+
source_id: token
|
|
17565
|
+
} : {
|
|
17566
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17567
|
+
gateway_token: token
|
|
17568
|
+
};
|
|
17569
|
+
window.Pelcro.ecommerce.order.create({
|
|
17570
|
+
items,
|
|
17571
|
+
coupon_code: couponCode,
|
|
17572
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17573
|
+
...params,
|
|
17574
|
+
...(addressId && {
|
|
17575
|
+
address_id: addressId
|
|
17576
|
+
})
|
|
17577
|
+
}, (err, res) => {
|
|
17578
|
+
callback(err, res);
|
|
17579
|
+
});
|
|
17580
|
+
}
|
|
17581
|
+
});
|
|
17582
|
+
_classPrivateFieldInitSpec$1(this, _payInvoice6, {
|
|
17583
|
+
writable: true,
|
|
17584
|
+
value: (options, callback) => {
|
|
17585
|
+
const {
|
|
17586
|
+
token,
|
|
17587
|
+
invoiceId
|
|
17588
|
+
} = options;
|
|
17589
|
+
const params = options.isExistingSource ? {
|
|
17590
|
+
source_id: token,
|
|
17591
|
+
invoice_id: invoiceId
|
|
17592
|
+
} : {
|
|
17593
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway6),
|
|
17594
|
+
gateway_token: token,
|
|
17595
|
+
invoice_id: invoiceId
|
|
17596
|
+
};
|
|
17597
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
17598
|
+
callback(err, res);
|
|
17599
|
+
});
|
|
17600
|
+
}
|
|
17601
|
+
});
|
|
17602
|
+
}
|
|
17603
|
+
}
|
|
17350
17604
|
|
|
17351
17605
|
/**
|
|
17352
17606
|
* @typedef {Object} PaymentStateType
|
|
@@ -17370,6 +17624,7 @@ class CybersourceGateway {
|
|
|
17370
17624
|
const initialState$l = {
|
|
17371
17625
|
disableSubmit: false,
|
|
17372
17626
|
isLoading: false,
|
|
17627
|
+
isSkeletonLoaded: false,
|
|
17373
17628
|
disableCouponButton: false,
|
|
17374
17629
|
couponObject: null,
|
|
17375
17630
|
couponCode: "",
|
|
@@ -18016,52 +18271,620 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18016
18271
|
};
|
|
18017
18272
|
/* ====== End Tap integration ======== */
|
|
18018
18273
|
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
id: orderId,
|
|
18034
|
-
orderId: orderId
|
|
18035
|
-
});
|
|
18036
|
-
};
|
|
18037
|
-
function handleVantivPayment(paymentRequest, couponCode) {
|
|
18038
|
-
if (paymentRequest) {
|
|
18039
|
-
const SUCCESS_STATUS = "870";
|
|
18040
|
-
if (paymentRequest.response !== SUCCESS_STATUS) {
|
|
18041
|
-
switch (paymentRequest.response) {
|
|
18042
|
-
case "871":
|
|
18043
|
-
return handlePaymentError({
|
|
18044
|
-
error: new Error("Invalid account number")
|
|
18045
|
-
});
|
|
18046
|
-
default:
|
|
18047
|
-
return handlePaymentError({
|
|
18048
|
-
error: new Error(paymentRequest.message)
|
|
18049
|
-
});
|
|
18274
|
+
/* ====== Start Braintree integration ======== */
|
|
18275
|
+
const braintreeInstanceRef = React__default.useRef(null);
|
|
18276
|
+
const braintree3DSecureInstanceRef = React__default.useRef(null);
|
|
18277
|
+
function getClientToken() {
|
|
18278
|
+
return new Promise((resolve, reject) => {
|
|
18279
|
+
window.Pelcro.payment.generateClientToken({
|
|
18280
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18281
|
+
site_id: window.Pelcro.siteid
|
|
18282
|
+
}, (error, response) => {
|
|
18283
|
+
if (error) {
|
|
18284
|
+
reject(error);
|
|
18285
|
+
}
|
|
18286
|
+
if (response) {
|
|
18287
|
+
resolve(response.client_token);
|
|
18050
18288
|
}
|
|
18289
|
+
});
|
|
18290
|
+
});
|
|
18291
|
+
}
|
|
18292
|
+
async function initializeBraintree() {
|
|
18293
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
18294
|
+
if (cardProcessor === "braintree" && !selectedPaymentMethodId) {
|
|
18295
|
+
const braintreeToken = await getClientToken();
|
|
18296
|
+
const isBraintreeEnabled = Boolean(braintreeToken);
|
|
18297
|
+
if (!isBraintreeEnabled) {
|
|
18298
|
+
console.error("Braintree integration is currently not enabled on this site's config");
|
|
18299
|
+
return;
|
|
18051
18300
|
}
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18301
|
+
if (type !== "updatePaymentSource") {
|
|
18302
|
+
braintreeInstanceRef.current = new window.braintree.client.create({
|
|
18303
|
+
authorization: braintreeToken
|
|
18304
|
+
}).then(clientInstance => {
|
|
18305
|
+
const options = {
|
|
18306
|
+
authorization: braintreeToken,
|
|
18307
|
+
styles: {
|
|
18308
|
+
input: {
|
|
18309
|
+
"font-size": "14px"
|
|
18310
|
+
},
|
|
18311
|
+
"input.invalid": {
|
|
18312
|
+
color: "red"
|
|
18313
|
+
},
|
|
18314
|
+
"input.valid": {
|
|
18315
|
+
color: "green"
|
|
18316
|
+
}
|
|
18317
|
+
},
|
|
18318
|
+
fields: {
|
|
18319
|
+
number: {
|
|
18320
|
+
container: "#card-number",
|
|
18321
|
+
placeholder: "4111 1111 1111 1111"
|
|
18322
|
+
},
|
|
18323
|
+
cvv: {
|
|
18324
|
+
container: "#cvv",
|
|
18325
|
+
placeholder: "123"
|
|
18326
|
+
},
|
|
18327
|
+
expirationDate: {
|
|
18328
|
+
container: "#expiration-date",
|
|
18329
|
+
placeholder: "10/2022"
|
|
18330
|
+
}
|
|
18331
|
+
}
|
|
18332
|
+
};
|
|
18333
|
+
dispatch({
|
|
18334
|
+
type: SKELETON_LOADER,
|
|
18335
|
+
payload: true
|
|
18336
|
+
});
|
|
18337
|
+
braintree3DSecureInstanceRef.current = new window.braintree.threeDSecure.create({
|
|
18338
|
+
version: 2,
|
|
18339
|
+
authorization: braintreeToken
|
|
18340
|
+
}).then(threeDSecureInstance => {
|
|
18341
|
+
return threeDSecureInstance;
|
|
18342
|
+
});
|
|
18343
|
+
return window.braintree.hostedFields.create(options);
|
|
18344
|
+
});
|
|
18345
|
+
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
18346
|
+
hostedFieldInstance.on("notEmpty", function (event) {
|
|
18347
|
+
const field = event.fields[event.emittedBy];
|
|
18348
|
+
if (field.isPotentiallyValid) {
|
|
18349
|
+
field.container.classList.remove("pelcro-input-invalid");
|
|
18350
|
+
}
|
|
18351
|
+
});
|
|
18352
|
+
hostedFieldInstance.on("validityChange", function (event) {
|
|
18353
|
+
const field = event.fields[event.emittedBy];
|
|
18354
|
+
|
|
18355
|
+
// Remove any previously applied error or warning classes
|
|
18356
|
+
field.container.classList.remove("is-valid");
|
|
18357
|
+
field.container.classList.remove("pelcro-input-invalid");
|
|
18358
|
+
if (field.isValid) {
|
|
18359
|
+
field.container.classList.add("is-valid");
|
|
18360
|
+
} else if (field.isPotentiallyValid) ; else {
|
|
18361
|
+
field.container.classList.add("pelcro-input-invalid");
|
|
18362
|
+
}
|
|
18363
|
+
});
|
|
18364
|
+
});
|
|
18365
|
+
} else if (type == "updatePaymentSource" && paymentMethodToEdit) {
|
|
18366
|
+
const {
|
|
18367
|
+
properties
|
|
18368
|
+
} = paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 ? paymentMethodToEdit : {};
|
|
18369
|
+
const {
|
|
18370
|
+
exp_month: expMonth,
|
|
18371
|
+
exp_year: expYear
|
|
18372
|
+
} = properties !== null && properties !== void 0 ? properties : {};
|
|
18373
|
+
braintreeInstanceRef.current = new window.braintree.client.create({
|
|
18374
|
+
authorization: braintreeToken
|
|
18375
|
+
}).then(clientInstance => {
|
|
18376
|
+
const options = {
|
|
18377
|
+
client: clientInstance,
|
|
18378
|
+
styles: {
|
|
18379
|
+
input: {
|
|
18380
|
+
"font-size": "14px"
|
|
18381
|
+
},
|
|
18382
|
+
"input.invalid": {
|
|
18383
|
+
color: "red"
|
|
18384
|
+
},
|
|
18385
|
+
"input.valid": {
|
|
18386
|
+
color: "green"
|
|
18387
|
+
}
|
|
18388
|
+
},
|
|
18389
|
+
fields: {
|
|
18390
|
+
expirationMonth: {
|
|
18391
|
+
container: "#expiration-month",
|
|
18392
|
+
prefill: expMonth
|
|
18393
|
+
},
|
|
18394
|
+
expirationYear: {
|
|
18395
|
+
container: "#expiration-year",
|
|
18396
|
+
prefill: expYear
|
|
18397
|
+
}
|
|
18398
|
+
}
|
|
18399
|
+
};
|
|
18400
|
+
dispatch({
|
|
18401
|
+
type: SKELETON_LOADER,
|
|
18402
|
+
payload: true
|
|
18403
|
+
});
|
|
18404
|
+
return window.braintree.hostedFields.create(options);
|
|
18405
|
+
});
|
|
18406
|
+
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
18407
|
+
hostedFieldInstance.on("notEmpty", function (event) {
|
|
18408
|
+
const field = event.fields[event.emittedBy];
|
|
18409
|
+
if (field.isPotentiallyValid) {
|
|
18410
|
+
field.container.classList.remove("pelcro-input-invalid");
|
|
18411
|
+
}
|
|
18412
|
+
});
|
|
18413
|
+
hostedFieldInstance.on("validityChange", function (event) {
|
|
18414
|
+
const field = event.fields[event.emittedBy];
|
|
18415
|
+
|
|
18416
|
+
// Remove any previously applied error or warning classes
|
|
18417
|
+
field.container.classList.remove("is-valid");
|
|
18418
|
+
field.container.classList.remove("pelcro-input-invalid");
|
|
18419
|
+
if (field.isValid) {
|
|
18420
|
+
field.container.classList.add("is-valid");
|
|
18421
|
+
} else if (field.isPotentiallyValid) ; else {
|
|
18422
|
+
field.container.classList.add("pelcro-input-invalid");
|
|
18423
|
+
}
|
|
18424
|
+
});
|
|
18425
|
+
});
|
|
18426
|
+
}
|
|
18427
|
+
}
|
|
18428
|
+
}
|
|
18429
|
+
useEffect(() => {
|
|
18430
|
+
initializeBraintree();
|
|
18431
|
+
}, [selectedPaymentMethodId, paymentMethodToEdit]);
|
|
18432
|
+
const braintreeErrorHandler = tokenizeErr => {
|
|
18433
|
+
var _tokenizeErr$details, _tokenizeErr$details2;
|
|
18434
|
+
const cardNumber = document.querySelector("#card-number");
|
|
18435
|
+
const expirationDate = document.querySelector("#expiration-date");
|
|
18436
|
+
const cvv = document.querySelector("#cvv");
|
|
18437
|
+
const fields = tokenizeErr !== null && tokenizeErr !== void 0 && (_tokenizeErr$details = tokenizeErr.details) !== null && _tokenizeErr$details !== void 0 && _tokenizeErr$details.invalidFields ? Object.values(tokenizeErr === null || tokenizeErr === void 0 ? void 0 : (_tokenizeErr$details2 = tokenizeErr.details) === null || _tokenizeErr$details2 === void 0 ? void 0 : _tokenizeErr$details2.invalidFields) : null;
|
|
18438
|
+
switch (tokenizeErr.code) {
|
|
18439
|
+
case "HOSTED_FIELDS_FIELDS_EMPTY":
|
|
18440
|
+
// occurs when none of the fields are filled in
|
|
18441
|
+
cardNumber.classList.add("pelcro-input-invalid");
|
|
18442
|
+
expirationDate.classList.add("pelcro-input-invalid");
|
|
18443
|
+
cvv.classList.add("pelcro-input-invalid");
|
|
18444
|
+
return "All fields are empty! Please fill out the form.";
|
|
18445
|
+
// break;
|
|
18446
|
+
case "HOSTED_FIELDS_FIELDS_INVALID":
|
|
18447
|
+
// occurs when certain fields do not pass client side validation
|
|
18448
|
+
console.error("Some fields are invalid:", tokenizeErr.details.invalidFieldKeys.toString());
|
|
18449
|
+
|
|
18450
|
+
// you can also programmatically access the field containers for the invalid fields
|
|
18451
|
+
// tokenizeErr.details.invalidFields.forEach(function (
|
|
18452
|
+
// fieldContainer
|
|
18453
|
+
// ) {
|
|
18454
|
+
// fieldContainer.className = "invalid";
|
|
18455
|
+
// });
|
|
18456
|
+
fields.forEach(field => {
|
|
18457
|
+
field.classList.add("pelcro-input-invalid");
|
|
18458
|
+
});
|
|
18459
|
+
return `Some fields are invalid: ${tokenizeErr.details.invalidFieldKeys.toString()}`;
|
|
18460
|
+
case "HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE":
|
|
18461
|
+
// occurs when:
|
|
18462
|
+
// * the client token used for client authorization was generated
|
|
18463
|
+
// with a customer ID and the fail on duplicate payment method
|
|
18464
|
+
// option is set to true
|
|
18465
|
+
// * the card being tokenized has previously been vaulted (with any customer)
|
|
18466
|
+
// See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.fail_on_duplicate_payment_method
|
|
18467
|
+
return "This payment method already exists in your vault.";
|
|
18468
|
+
case "HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED":
|
|
18469
|
+
// occurs when:
|
|
18470
|
+
// * the client token used for client authorization was generated
|
|
18471
|
+
// with a customer ID and the verify card option is set to true
|
|
18472
|
+
// and you have credit card verification turned on in the Braintree
|
|
18473
|
+
// control panel
|
|
18474
|
+
// * the cvv does not pass verification (https://developer.paypal.com/braintree/docs/reference/general/testing#avs-and-cvv/cid-responses)
|
|
18475
|
+
// See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.verify_card
|
|
18476
|
+
return "CVV did not pass verification";
|
|
18477
|
+
case "HOSTED_FIELDS_FAILED_TOKENIZATION":
|
|
18478
|
+
// occurs for any other tokenization error on the server
|
|
18479
|
+
return "Tokenization failed server side. Is the card valid?";
|
|
18480
|
+
case "HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR":
|
|
18481
|
+
// occurs when the Braintree gateway cannot be contacted
|
|
18482
|
+
return "Network error occurred when tokenizing.";
|
|
18483
|
+
default:
|
|
18484
|
+
console.error("Something bad happened!", tokenizeErr);
|
|
18485
|
+
return "Something bad happened!";
|
|
18486
|
+
}
|
|
18487
|
+
};
|
|
18488
|
+
const submitUsingBraintree = (state, dispatch) => {
|
|
18489
|
+
var _ref6, _ref7, _state$updatedPrice2;
|
|
18490
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18491
|
+
if (isUsingExistingPaymentMethod) {
|
|
18492
|
+
// no need to create a new source using braintree
|
|
18493
|
+
return handleBraintreePayment(null, state.couponCode);
|
|
18494
|
+
}
|
|
18495
|
+
if (!braintreeInstanceRef.current) {
|
|
18496
|
+
return console.error("Braintree sdk script wasn't loaded, you need to load braintree sdk before rendering the braintree payment flow");
|
|
18497
|
+
}
|
|
18498
|
+
const getOrderItemsTotal = () => {
|
|
18499
|
+
if (!order) {
|
|
18500
|
+
return null;
|
|
18501
|
+
}
|
|
18502
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
18503
|
+
if (isQuickPurchase) {
|
|
18504
|
+
return order.price * order.quantity;
|
|
18505
|
+
}
|
|
18506
|
+
if (order.length === 0) {
|
|
18507
|
+
return null;
|
|
18508
|
+
}
|
|
18509
|
+
return order.reduce((total, item) => {
|
|
18510
|
+
return total + item.price * item.quantity;
|
|
18511
|
+
}, 0);
|
|
18512
|
+
};
|
|
18513
|
+
const totalAmount = (_ref6 = (_ref7 = (_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 && _ref7 !== void 0 ? _ref7 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref6 !== void 0 ? _ref6 : getOrderItemsTotal();
|
|
18514
|
+
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
18515
|
+
hostedFieldInstance.tokenize((tokenizeErr, payload) => {
|
|
18516
|
+
if (tokenizeErr) {
|
|
18517
|
+
dispatch({
|
|
18518
|
+
type: DISABLE_SUBMIT,
|
|
18519
|
+
payload: false
|
|
18520
|
+
});
|
|
18521
|
+
dispatch({
|
|
18522
|
+
type: LOADING,
|
|
18523
|
+
payload: false
|
|
18524
|
+
});
|
|
18525
|
+
return dispatch({
|
|
18526
|
+
type: SHOW_ALERT,
|
|
18527
|
+
payload: {
|
|
18528
|
+
type: "error",
|
|
18529
|
+
content: braintreeErrorHandler(tokenizeErr)
|
|
18530
|
+
}
|
|
18531
|
+
});
|
|
18532
|
+
}
|
|
18533
|
+
if (type == "updatePaymentSource" || type == "deletePaymentSource") {
|
|
18534
|
+
handleBraintreePayment(payload, state.couponCode);
|
|
18535
|
+
} else {
|
|
18536
|
+
braintree3DSecureInstanceRef.current.then(threeDSecureInstance => {
|
|
18537
|
+
threeDSecureInstance.verifyCard({
|
|
18538
|
+
onLookupComplete: function (data, next) {
|
|
18539
|
+
next();
|
|
18540
|
+
},
|
|
18541
|
+
amount: totalAmount !== null && totalAmount !== void 0 ? totalAmount : "0.00",
|
|
18542
|
+
nonce: payload.nonce,
|
|
18543
|
+
bin: payload.details.bin
|
|
18544
|
+
}).then(payload => {
|
|
18545
|
+
if (payload.liabilityShifted) {
|
|
18546
|
+
handleBraintreePayment(payload, state.couponCode);
|
|
18547
|
+
} else if (payload.liabilityShiftPossible) {
|
|
18548
|
+
dispatch({
|
|
18549
|
+
type: DISABLE_SUBMIT,
|
|
18550
|
+
payload: false
|
|
18551
|
+
});
|
|
18552
|
+
dispatch({
|
|
18553
|
+
type: LOADING,
|
|
18554
|
+
payload: false
|
|
18555
|
+
});
|
|
18556
|
+
return dispatch({
|
|
18557
|
+
type: SHOW_ALERT,
|
|
18558
|
+
payload: {
|
|
18559
|
+
type: "error",
|
|
18560
|
+
content: "We encountered an issue verifying your transaction with 3D Secure, please try again."
|
|
18561
|
+
}
|
|
18562
|
+
});
|
|
18563
|
+
} else {
|
|
18564
|
+
// Liability has not shifted and will not shift
|
|
18565
|
+
dispatch({
|
|
18566
|
+
type: DISABLE_SUBMIT,
|
|
18567
|
+
payload: false
|
|
18568
|
+
});
|
|
18569
|
+
dispatch({
|
|
18570
|
+
type: LOADING,
|
|
18571
|
+
payload: false
|
|
18572
|
+
});
|
|
18573
|
+
return dispatch({
|
|
18574
|
+
type: SHOW_ALERT,
|
|
18575
|
+
payload: {
|
|
18576
|
+
type: "error",
|
|
18577
|
+
content: "We encountered an issue verifying your transaction with 3D Secure, please try another payment method."
|
|
18578
|
+
}
|
|
18579
|
+
});
|
|
18580
|
+
}
|
|
18581
|
+
}).catch(error => {
|
|
18582
|
+
console.error(error);
|
|
18583
|
+
dispatch({
|
|
18584
|
+
type: DISABLE_SUBMIT,
|
|
18585
|
+
payload: false
|
|
18586
|
+
});
|
|
18587
|
+
dispatch({
|
|
18588
|
+
type: LOADING,
|
|
18589
|
+
payload: false
|
|
18590
|
+
});
|
|
18591
|
+
return dispatch({
|
|
18592
|
+
type: SHOW_ALERT,
|
|
18593
|
+
payload: {
|
|
18594
|
+
type: "error",
|
|
18595
|
+
content: "There was a problem with your request."
|
|
18596
|
+
}
|
|
18597
|
+
});
|
|
18598
|
+
});
|
|
18599
|
+
});
|
|
18600
|
+
}
|
|
18601
|
+
});
|
|
18602
|
+
}).catch(error => {
|
|
18603
|
+
if (error) {
|
|
18604
|
+
console.error(error);
|
|
18605
|
+
return;
|
|
18606
|
+
}
|
|
18607
|
+
});
|
|
18608
|
+
};
|
|
18609
|
+
const handleBraintreePayment = (braintreePaymentRequest, couponCode) => {
|
|
18610
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18611
|
+
const braintreeNonce = braintreePaymentRequest === null || braintreePaymentRequest === void 0 ? void 0 : braintreePaymentRequest.nonce;
|
|
18612
|
+
if (type === "createPayment") {
|
|
18613
|
+
handleBraintreeSubscription();
|
|
18614
|
+
} else if (type === "orderCreate") {
|
|
18615
|
+
purchase(new BraintreeGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce, state, dispatch);
|
|
18616
|
+
} else if (type === "invoicePayment") {
|
|
18617
|
+
payInvoice(new BraintreeGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce);
|
|
18618
|
+
} else if (type === "createPaymentSource") {
|
|
18619
|
+
createNewBraintreeCard();
|
|
18620
|
+
} else if (type === "updatePaymentSource") {
|
|
18621
|
+
updateBraintreeCard();
|
|
18622
|
+
} else if (type === "deletePaymentSource") {
|
|
18623
|
+
replaceBraintreeCard();
|
|
18624
|
+
}
|
|
18625
|
+
function createNewBraintreeCard() {
|
|
18626
|
+
window.Pelcro.paymentMethods.create({
|
|
18627
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18628
|
+
token: braintreeNonce,
|
|
18629
|
+
gateway: "braintree"
|
|
18630
|
+
}, (err, res) => {
|
|
18631
|
+
dispatch({
|
|
18632
|
+
type: DISABLE_SUBMIT,
|
|
18633
|
+
payload: false
|
|
18634
|
+
});
|
|
18635
|
+
dispatch({
|
|
18636
|
+
type: LOADING,
|
|
18637
|
+
payload: false
|
|
18638
|
+
});
|
|
18639
|
+
if (err) {
|
|
18640
|
+
onFailure(err);
|
|
18641
|
+
return dispatch({
|
|
18642
|
+
type: SHOW_ALERT,
|
|
18643
|
+
payload: {
|
|
18644
|
+
type: "error",
|
|
18645
|
+
content: getErrorMessages(err)
|
|
18646
|
+
}
|
|
18647
|
+
});
|
|
18648
|
+
}
|
|
18649
|
+
dispatch({
|
|
18650
|
+
type: SHOW_ALERT,
|
|
18651
|
+
payload: {
|
|
18652
|
+
type: "success",
|
|
18653
|
+
content: t("messages.sourceCreated")
|
|
18654
|
+
}
|
|
18655
|
+
});
|
|
18656
|
+
onSuccess(res);
|
|
18657
|
+
});
|
|
18658
|
+
}
|
|
18659
|
+
function replaceBraintreeCard() {
|
|
18660
|
+
const {
|
|
18661
|
+
id: paymentMethodId
|
|
18662
|
+
} = paymentMethodToDelete;
|
|
18663
|
+
window.Pelcro.paymentMethods.create({
|
|
18664
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18665
|
+
token: braintreeNonce,
|
|
18666
|
+
gateway: "braintree"
|
|
18667
|
+
}, (err, res) => {
|
|
18668
|
+
if (err) {
|
|
18669
|
+
dispatch({
|
|
18670
|
+
type: DISABLE_SUBMIT,
|
|
18671
|
+
payload: false
|
|
18672
|
+
});
|
|
18673
|
+
dispatch({
|
|
18674
|
+
type: LOADING,
|
|
18675
|
+
payload: false
|
|
18676
|
+
});
|
|
18677
|
+
onFailure(err);
|
|
18678
|
+
return dispatch({
|
|
18679
|
+
type: SHOW_ALERT,
|
|
18680
|
+
payload: {
|
|
18681
|
+
type: "error",
|
|
18682
|
+
content: getErrorMessages(err)
|
|
18683
|
+
}
|
|
18684
|
+
});
|
|
18685
|
+
}
|
|
18686
|
+
if (res) {
|
|
18687
|
+
setTimeout(() => {
|
|
18688
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
18689
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18690
|
+
payment_method_id: paymentMethodId
|
|
18691
|
+
}, (err, res) => {
|
|
18692
|
+
dispatch({
|
|
18693
|
+
type: DISABLE_SUBMIT,
|
|
18694
|
+
payload: false
|
|
18695
|
+
});
|
|
18696
|
+
dispatch({
|
|
18697
|
+
type: LOADING,
|
|
18698
|
+
payload: false
|
|
18699
|
+
});
|
|
18700
|
+
if (err) {
|
|
18701
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
18702
|
+
return dispatch({
|
|
18703
|
+
type: SHOW_ALERT,
|
|
18704
|
+
payload: {
|
|
18705
|
+
type: "error",
|
|
18706
|
+
content: getErrorMessages(err)
|
|
18707
|
+
}
|
|
18708
|
+
});
|
|
18709
|
+
}
|
|
18710
|
+
onSuccess(res);
|
|
18711
|
+
});
|
|
18712
|
+
}, 2000);
|
|
18713
|
+
}
|
|
18714
|
+
});
|
|
18715
|
+
}
|
|
18716
|
+
function updateBraintreeCard() {
|
|
18717
|
+
const {
|
|
18718
|
+
id: paymentMethodId
|
|
18719
|
+
} = paymentMethodToEdit;
|
|
18720
|
+
const {
|
|
18721
|
+
expirationMonth,
|
|
18722
|
+
expirationYear
|
|
18723
|
+
} = braintreePaymentRequest === null || braintreePaymentRequest === void 0 ? void 0 : braintreePaymentRequest.details;
|
|
18724
|
+
const {
|
|
18725
|
+
isDefault
|
|
18726
|
+
} = state;
|
|
18727
|
+
window.Pelcro.paymentMethods.update({
|
|
18728
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18729
|
+
payment_method_id: paymentMethodId,
|
|
18730
|
+
token: braintreeNonce,
|
|
18731
|
+
gateway: "braintree",
|
|
18732
|
+
exp_month: expirationMonth,
|
|
18733
|
+
exp_year: expirationYear,
|
|
18734
|
+
is_default: isDefault
|
|
18735
|
+
}, (err, res) => {
|
|
18736
|
+
dispatch({
|
|
18737
|
+
type: DISABLE_SUBMIT,
|
|
18738
|
+
payload: false
|
|
18739
|
+
});
|
|
18740
|
+
dispatch({
|
|
18741
|
+
type: LOADING,
|
|
18742
|
+
payload: false
|
|
18743
|
+
});
|
|
18744
|
+
if (err) {
|
|
18745
|
+
onFailure(err);
|
|
18746
|
+
return dispatch({
|
|
18747
|
+
type: SHOW_ALERT,
|
|
18748
|
+
payload: {
|
|
18749
|
+
type: "error",
|
|
18750
|
+
content: getErrorMessages(err)
|
|
18751
|
+
}
|
|
18752
|
+
});
|
|
18753
|
+
}
|
|
18754
|
+
dispatch({
|
|
18755
|
+
type: SHOW_ALERT,
|
|
18756
|
+
payload: {
|
|
18757
|
+
type: "success",
|
|
18758
|
+
content: t("messages.sourceUpdated")
|
|
18759
|
+
}
|
|
18760
|
+
});
|
|
18761
|
+
onSuccess(res);
|
|
18762
|
+
});
|
|
18763
|
+
}
|
|
18764
|
+
function handleBraintreeSubscription() {
|
|
18765
|
+
const payment = new Payment(new BraintreeGateway());
|
|
18766
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
18767
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
18768
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
18769
|
+
const renewGift = isRenewingGift;
|
|
18770
|
+
if (renewGift) {
|
|
18771
|
+
return payment.execute({
|
|
18772
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
18773
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce,
|
|
18774
|
+
plan,
|
|
18775
|
+
couponCode,
|
|
18776
|
+
product,
|
|
18777
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
18778
|
+
subscriptionIdToRenew,
|
|
18779
|
+
addressId: selectedAddressId
|
|
18780
|
+
}, (err, res) => {
|
|
18781
|
+
if (err) {
|
|
18782
|
+
return handlePaymentError(err);
|
|
18783
|
+
}
|
|
18784
|
+
onSuccess(res);
|
|
18785
|
+
});
|
|
18786
|
+
} else if (giftSubscriprition) {
|
|
18787
|
+
return payment.execute({
|
|
18788
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
18789
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce,
|
|
18790
|
+
quantity: plan.quantity,
|
|
18791
|
+
plan,
|
|
18792
|
+
couponCode,
|
|
18793
|
+
product,
|
|
18794
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
18795
|
+
giftRecipient,
|
|
18796
|
+
addressId: selectedAddressId
|
|
18797
|
+
}, (err, res) => {
|
|
18798
|
+
if (err) {
|
|
18799
|
+
return handlePaymentError(err);
|
|
18800
|
+
}
|
|
18801
|
+
onSuccess(res);
|
|
18802
|
+
});
|
|
18803
|
+
} else if (renewSubscription) {
|
|
18804
|
+
return payment.execute({
|
|
18805
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
18806
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce,
|
|
18807
|
+
quantity: plan.quantity,
|
|
18808
|
+
plan,
|
|
18809
|
+
couponCode,
|
|
18810
|
+
product,
|
|
18811
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
18812
|
+
subscriptionIdToRenew,
|
|
18813
|
+
addressId: selectedAddressId
|
|
18814
|
+
}, (err, res) => {
|
|
18815
|
+
if (err) {
|
|
18816
|
+
return handlePaymentError(err);
|
|
18817
|
+
}
|
|
18818
|
+
onSuccess(res);
|
|
18819
|
+
});
|
|
18820
|
+
} else if (createSubscription) {
|
|
18821
|
+
return payment.execute({
|
|
18822
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
18823
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : braintreeNonce,
|
|
18824
|
+
quantity: plan.quantity,
|
|
18825
|
+
plan,
|
|
18826
|
+
couponCode,
|
|
18827
|
+
product,
|
|
18828
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
18829
|
+
addressId: selectedAddressId
|
|
18830
|
+
}, (err, res) => {
|
|
18831
|
+
if (err) {
|
|
18832
|
+
return handlePaymentError(err);
|
|
18833
|
+
}
|
|
18834
|
+
onSuccess(res);
|
|
18835
|
+
});
|
|
18836
|
+
}
|
|
18837
|
+
}
|
|
18838
|
+
};
|
|
18839
|
+
|
|
18840
|
+
/* ====== End Braintree integration ======== */
|
|
18841
|
+
|
|
18842
|
+
const submitUsingVantiv = state => {
|
|
18843
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18844
|
+
if (isUsingExistingPaymentMethod) {
|
|
18845
|
+
// no need to create a new source using vantiv
|
|
18846
|
+
return handleVantivPayment(null, state.couponCode);
|
|
18847
|
+
}
|
|
18848
|
+
if (!vantivInstanceRef.current) {
|
|
18849
|
+
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
18850
|
+
}
|
|
18851
|
+
const orderId = `pelcro-${new Date().getTime()}`;
|
|
18852
|
+
/*
|
|
18853
|
+
calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
|
|
18854
|
+
*/
|
|
18855
|
+
vantivInstanceRef.current.getPaypageRegistrationId({
|
|
18856
|
+
id: orderId,
|
|
18857
|
+
orderId: orderId
|
|
18858
|
+
});
|
|
18859
|
+
};
|
|
18860
|
+
function handleVantivPayment(paymentRequest, couponCode) {
|
|
18861
|
+
if (paymentRequest) {
|
|
18862
|
+
const SUCCESS_STATUS = "870";
|
|
18863
|
+
if (paymentRequest.response !== SUCCESS_STATUS) {
|
|
18864
|
+
switch (paymentRequest.response) {
|
|
18865
|
+
case "871":
|
|
18866
|
+
return handlePaymentError({
|
|
18867
|
+
error: new Error("Invalid account number")
|
|
18868
|
+
});
|
|
18869
|
+
default:
|
|
18870
|
+
return handlePaymentError({
|
|
18871
|
+
error: new Error(paymentRequest.message)
|
|
18872
|
+
});
|
|
18873
|
+
}
|
|
18874
|
+
}
|
|
18875
|
+
}
|
|
18876
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18877
|
+
if (type === "createPayment") {
|
|
18878
|
+
handleVantivSubscription();
|
|
18879
|
+
} else if (type === "orderCreate") {
|
|
18880
|
+
purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
18881
|
+
} else if (type === "invoicePayment") {
|
|
18882
|
+
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
18883
|
+
} else if (type === "createPaymentSource") {
|
|
18884
|
+
createNewVantivCard();
|
|
18885
|
+
} else if (type === "updatePaymentSource") {
|
|
18886
|
+
updateVantivCard();
|
|
18887
|
+
} else if (type === "deletePaymentSource") {
|
|
18065
18888
|
replaceVantivCard();
|
|
18066
18889
|
}
|
|
18067
18890
|
function createNewVantivCard() {
|
|
@@ -18095,6 +18918,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18095
18918
|
content: t("messages.sourceCreated")
|
|
18096
18919
|
}
|
|
18097
18920
|
});
|
|
18921
|
+
refreshUser();
|
|
18098
18922
|
onSuccess(res);
|
|
18099
18923
|
});
|
|
18100
18924
|
}
|
|
@@ -18149,6 +18973,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18149
18973
|
}
|
|
18150
18974
|
});
|
|
18151
18975
|
}
|
|
18976
|
+
refreshUser();
|
|
18152
18977
|
onSuccess(res);
|
|
18153
18978
|
});
|
|
18154
18979
|
}, 2000);
|
|
@@ -18210,6 +19035,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18210
19035
|
content: t("messages.sourceUpdated")
|
|
18211
19036
|
}
|
|
18212
19037
|
});
|
|
19038
|
+
refreshUser();
|
|
18213
19039
|
onSuccess(res);
|
|
18214
19040
|
});
|
|
18215
19041
|
}
|
|
@@ -18367,13 +19193,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18367
19193
|
});
|
|
18368
19194
|
|
|
18369
19195
|
// When Google pay / Apple pay source created
|
|
18370
|
-
paymentRequest.on("source",
|
|
19196
|
+
paymentRequest.on("source", _ref8 => {
|
|
18371
19197
|
var _source$card;
|
|
18372
19198
|
let {
|
|
18373
19199
|
complete,
|
|
18374
19200
|
source,
|
|
18375
19201
|
...data
|
|
18376
|
-
} =
|
|
19202
|
+
} = _ref8;
|
|
18377
19203
|
dispatch({
|
|
18378
19204
|
type: DISABLE_COUPON_BUTTON,
|
|
18379
19205
|
payload: true
|
|
@@ -18388,11 +19214,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18388
19214
|
});
|
|
18389
19215
|
complete("success");
|
|
18390
19216
|
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") {
|
|
18391
|
-
return generate3DSecureSource(source).then(
|
|
19217
|
+
return generate3DSecureSource(source).then(_ref9 => {
|
|
18392
19218
|
let {
|
|
18393
19219
|
source,
|
|
18394
19220
|
error
|
|
18395
|
-
} =
|
|
19221
|
+
} = _ref9;
|
|
18396
19222
|
if (error) {
|
|
18397
19223
|
return handlePaymentError(error);
|
|
18398
19224
|
}
|
|
@@ -18768,6 +19594,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18768
19594
|
type: LOADING,
|
|
18769
19595
|
payload: false
|
|
18770
19596
|
});
|
|
19597
|
+
refreshUser();
|
|
18771
19598
|
onSuccess(res);
|
|
18772
19599
|
return;
|
|
18773
19600
|
}
|
|
@@ -18783,6 +19610,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18783
19610
|
content: t("messages.sourceCreated")
|
|
18784
19611
|
}
|
|
18785
19612
|
});
|
|
19613
|
+
refreshUser();
|
|
18786
19614
|
onSuccess(res);
|
|
18787
19615
|
return;
|
|
18788
19616
|
}
|
|
@@ -18802,6 +19630,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18802
19630
|
content: t("messages.sourceUpdated")
|
|
18803
19631
|
}
|
|
18804
19632
|
});
|
|
19633
|
+
refreshUser();
|
|
18805
19634
|
onSuccess(res);
|
|
18806
19635
|
return;
|
|
18807
19636
|
}
|
|
@@ -18829,6 +19658,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18829
19658
|
}
|
|
18830
19659
|
});
|
|
18831
19660
|
}
|
|
19661
|
+
refreshUser();
|
|
18832
19662
|
onSuccess(res);
|
|
18833
19663
|
});
|
|
18834
19664
|
}, 2000);
|
|
@@ -18860,7 +19690,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18860
19690
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
18861
19691
|
address_id: product.address_required ? selectedAddressId : null
|
|
18862
19692
|
}, (err, res) => {
|
|
18863
|
-
|
|
19693
|
+
var _res$data;
|
|
19694
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
18864
19695
|
return confirmStripeIntentSetup(res, "subCreate");
|
|
18865
19696
|
}
|
|
18866
19697
|
confirmStripeCardPayment(res, err, true);
|
|
@@ -19104,11 +19935,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19104
19935
|
const createPaymentSource = (state, dispatch) => {
|
|
19105
19936
|
return stripe.createSource({
|
|
19106
19937
|
type: "card"
|
|
19107
|
-
}).then(
|
|
19938
|
+
}).then(_ref10 => {
|
|
19108
19939
|
let {
|
|
19109
19940
|
source,
|
|
19110
19941
|
error
|
|
19111
|
-
} =
|
|
19942
|
+
} = _ref10;
|
|
19112
19943
|
if (error) {
|
|
19113
19944
|
return handlePaymentError(error);
|
|
19114
19945
|
}
|
|
@@ -19126,7 +19957,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19126
19957
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19127
19958
|
token: source.id
|
|
19128
19959
|
}, (err, res) => {
|
|
19129
|
-
var _res$
|
|
19960
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
19130
19961
|
if (err) {
|
|
19131
19962
|
dispatch({
|
|
19132
19963
|
type: DISABLE_SUBMIT,
|
|
@@ -19145,7 +19976,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19145
19976
|
}
|
|
19146
19977
|
});
|
|
19147
19978
|
}
|
|
19148
|
-
if (((_res$
|
|
19979
|
+
if (((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_action" || ((_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : (_res$data3$setup_inte = _res$data3.setup_intent) === null || _res$data3$setup_inte === void 0 ? void 0 : _res$data3$setup_inte.status) === "requires_confirmation") {
|
|
19149
19980
|
confirmStripeIntentSetup(res, "create");
|
|
19150
19981
|
} else {
|
|
19151
19982
|
dispatch({
|
|
@@ -19159,6 +19990,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19159
19990
|
content: t("messages.sourceCreated")
|
|
19160
19991
|
}
|
|
19161
19992
|
});
|
|
19993
|
+
refreshUser();
|
|
19162
19994
|
onSuccess(res);
|
|
19163
19995
|
}
|
|
19164
19996
|
});
|
|
@@ -19181,7 +20013,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19181
20013
|
exp_year: year,
|
|
19182
20014
|
is_default: isDefault
|
|
19183
20015
|
}, (err, res) => {
|
|
19184
|
-
var _res$
|
|
20016
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
19185
20017
|
dispatch({
|
|
19186
20018
|
type: DISABLE_SUBMIT,
|
|
19187
20019
|
payload: false
|
|
@@ -19200,7 +20032,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19200
20032
|
}
|
|
19201
20033
|
});
|
|
19202
20034
|
}
|
|
19203
|
-
if (((_res$
|
|
20035
|
+
if (((_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$setup_inte = _res$data4.setup_intent) === null || _res$data4$setup_inte === void 0 ? void 0 : _res$data4$setup_inte.status) === "requires_action" || ((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_confirmation") {
|
|
19204
20036
|
confirmStripeIntentSetup(res, "update");
|
|
19205
20037
|
} else {
|
|
19206
20038
|
dispatch({
|
|
@@ -19210,6 +20042,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19210
20042
|
content: t("messages.sourceUpdated")
|
|
19211
20043
|
}
|
|
19212
20044
|
});
|
|
20045
|
+
refreshUser();
|
|
19213
20046
|
onSuccess(res);
|
|
19214
20047
|
}
|
|
19215
20048
|
});
|
|
@@ -19220,11 +20053,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19220
20053
|
} = paymentMethodToDelete;
|
|
19221
20054
|
return stripe.createSource({
|
|
19222
20055
|
type: "card"
|
|
19223
|
-
}).then(
|
|
20056
|
+
}).then(_ref11 => {
|
|
19224
20057
|
let {
|
|
19225
20058
|
source,
|
|
19226
20059
|
error
|
|
19227
|
-
} =
|
|
20060
|
+
} = _ref11;
|
|
19228
20061
|
if (error) {
|
|
19229
20062
|
return handlePaymentError(error);
|
|
19230
20063
|
}
|
|
@@ -19242,7 +20075,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19242
20075
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19243
20076
|
token: source.id
|
|
19244
20077
|
}, (err, res) => {
|
|
19245
|
-
var _res$
|
|
20078
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
19246
20079
|
if (err) {
|
|
19247
20080
|
onFailure(err);
|
|
19248
20081
|
return dispatch({
|
|
@@ -19253,7 +20086,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19253
20086
|
}
|
|
19254
20087
|
});
|
|
19255
20088
|
}
|
|
19256
|
-
if (((_res$
|
|
20089
|
+
if (((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_action" || ((_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : (_res$data7$setup_inte = _res$data7.setup_intent) === null || _res$data7$setup_inte === void 0 ? void 0 : _res$data7$setup_inte.status) === "requires_confirmation") {
|
|
19257
20090
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
19258
20091
|
} else {
|
|
19259
20092
|
setTimeout(() => {
|
|
@@ -19279,6 +20112,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19279
20112
|
}
|
|
19280
20113
|
});
|
|
19281
20114
|
}
|
|
20115
|
+
refreshUser();
|
|
19282
20116
|
onSuccess(res);
|
|
19283
20117
|
});
|
|
19284
20118
|
}, 2000);
|
|
@@ -19321,12 +20155,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19321
20155
|
}
|
|
19322
20156
|
stripe.createSource({
|
|
19323
20157
|
type: "card"
|
|
19324
|
-
}).then(
|
|
19325
|
-
var
|
|
20158
|
+
}).then(_ref12 => {
|
|
20159
|
+
var _ref13, _ref14, _state$updatedPrice3;
|
|
19326
20160
|
let {
|
|
19327
20161
|
source,
|
|
19328
20162
|
error
|
|
19329
|
-
} =
|
|
20163
|
+
} = _ref12;
|
|
19330
20164
|
if (error) {
|
|
19331
20165
|
return handlePaymentError(error);
|
|
19332
20166
|
}
|
|
@@ -19345,7 +20179,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19345
20179
|
return total + item.price * item.quantity;
|
|
19346
20180
|
}, 0);
|
|
19347
20181
|
};
|
|
19348
|
-
(
|
|
20182
|
+
(_ref13 = (_ref14 = (_state$updatedPrice3 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice3 !== void 0 ? _state$updatedPrice3 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref14 !== void 0 ? _ref14 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref13 !== void 0 ? _ref13 : getOrderItemsTotal();
|
|
19349
20183
|
return handlePayment(source);
|
|
19350
20184
|
}).catch(error => {
|
|
19351
20185
|
return handlePaymentError(error);
|
|
@@ -19374,12 +20208,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19374
20208
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
19375
20209
|
address_id: selectedAddressId
|
|
19376
20210
|
}, (error, res) => {
|
|
19377
|
-
var _res$
|
|
20211
|
+
var _res$data8, _res$data9;
|
|
19378
20212
|
if (error) {
|
|
19379
20213
|
return reject(error);
|
|
19380
20214
|
}
|
|
19381
|
-
const taxAmount = (_res$
|
|
19382
|
-
const totalAmountWithTax = (_res$
|
|
20215
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
20216
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
19383
20217
|
resolve({
|
|
19384
20218
|
totalAmountWithTax,
|
|
19385
20219
|
taxAmount
|
|
@@ -19527,6 +20361,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19527
20361
|
...state,
|
|
19528
20362
|
isLoading: action.payload
|
|
19529
20363
|
});
|
|
20364
|
+
case SKELETON_LOADER:
|
|
20365
|
+
return lib_7({
|
|
20366
|
+
...state,
|
|
20367
|
+
isSkeletonLoaded: action.payload
|
|
20368
|
+
});
|
|
19530
20369
|
case SHOW_COUPON_FIELD:
|
|
19531
20370
|
return lib_7({
|
|
19532
20371
|
...state,
|
|
@@ -19564,6 +20403,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19564
20403
|
if (getSiteCardProcessor() === "cybersource") {
|
|
19565
20404
|
return submitUsingCybersource(state, dispatch);
|
|
19566
20405
|
}
|
|
20406
|
+
if (getSiteCardProcessor() === "braintree") {
|
|
20407
|
+
return submitUsingBraintree(state, dispatch);
|
|
20408
|
+
}
|
|
19567
20409
|
if (selectedPaymentMethodId) {
|
|
19568
20410
|
// pay with selected method (source) if exists already
|
|
19569
20411
|
return handlePayment({
|
|
@@ -19952,6 +20794,11 @@ const CheckoutForm = _ref => {
|
|
|
19952
20794
|
paymentMethodToEdit
|
|
19953
20795
|
} = usePelcro();
|
|
19954
20796
|
const cardProcessor = getSiteCardProcessor();
|
|
20797
|
+
const {
|
|
20798
|
+
state: {
|
|
20799
|
+
isSkeletonLoaded
|
|
20800
|
+
}
|
|
20801
|
+
} = useContext(store$l);
|
|
19955
20802
|
if (selectedPaymentMethodId) {
|
|
19956
20803
|
return null;
|
|
19957
20804
|
}
|
|
@@ -19983,12 +20830,61 @@ const CheckoutForm = _ref => {
|
|
|
19983
20830
|
placeholder: "Exp Year *"
|
|
19984
20831
|
}))));
|
|
19985
20832
|
}
|
|
19986
|
-
if (cardProcessor === "
|
|
20833
|
+
if (cardProcessor === "braintree") {
|
|
19987
20834
|
if (type === "updatePaymentSource") {
|
|
19988
20835
|
var _paymentMethodToEdit$;
|
|
20836
|
+
return /*#__PURE__*/React__default.createElement("div", null, isSkeletonLoaded && paymentMethodToEdit ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("label", {
|
|
20837
|
+
htmlFor: "card-number"
|
|
20838
|
+
}, "Card Number *"), /*#__PURE__*/React__default.createElement(Input, {
|
|
20839
|
+
id: "card-number",
|
|
20840
|
+
className: "plc-tracking-widest plc-flex-grow plc-h-12 plc-text-center",
|
|
20841
|
+
value: `•••• •••• •••• ${paymentMethodToEdit === null || paymentMethodToEdit === void 0 ? void 0 : (_paymentMethodToEdit$ = paymentMethodToEdit.properties) === null || _paymentMethodToEdit$ === void 0 ? void 0 : _paymentMethodToEdit$.last4}`,
|
|
20842
|
+
disabled: true
|
|
20843
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
20844
|
+
className: "plc-flex plc-items-start plc-space-x-8 plc-my-6"
|
|
20845
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("label", {
|
|
20846
|
+
htmlFor: "expiration-month"
|
|
20847
|
+
}, "Expiration Month *"), /*#__PURE__*/React__default.createElement("div", {
|
|
20848
|
+
id: "expiration-month",
|
|
20849
|
+
className: "pelcro-input-field plc-h-12 plc-bg-white"
|
|
20850
|
+
})), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("label", {
|
|
20851
|
+
htmlFor: "expiration-year"
|
|
20852
|
+
}, "Expiration Year *"), /*#__PURE__*/React__default.createElement("div", {
|
|
20853
|
+
id: "expiration-year",
|
|
20854
|
+
className: "pelcro-input-field plc-h-12 plc-bg-white"
|
|
20855
|
+
})))) : /*#__PURE__*/React__default.createElement("div", {
|
|
20856
|
+
className: "plc-w-full plc-h-40 plc-bg-gray-300 plc-rounded plc-animate-pulse"
|
|
20857
|
+
}));
|
|
20858
|
+
}
|
|
20859
|
+
return /*#__PURE__*/React__default.createElement("div", null, isSkeletonLoaded ? /*#__PURE__*/React__default.createElement("div", {
|
|
20860
|
+
className: "plc-max-w-[50em]"
|
|
20861
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
20862
|
+
htmlFor: "card-number"
|
|
20863
|
+
}, "Card Number *"), /*#__PURE__*/React__default.createElement("div", {
|
|
20864
|
+
id: "card-number",
|
|
20865
|
+
className: "pelcro-input-field plc-h-12 plc-bg-white"
|
|
20866
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
20867
|
+
className: "plc-flex plc-items-start plc-space-x-8 plc-my-6"
|
|
20868
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("label", {
|
|
20869
|
+
htmlFor: "expiration-date"
|
|
20870
|
+
}, "Expiration Date *"), /*#__PURE__*/React__default.createElement("div", {
|
|
20871
|
+
id: "expiration-date",
|
|
20872
|
+
className: "pelcro-input-field plc-h-12 plc-bg-white"
|
|
20873
|
+
})), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("label", {
|
|
20874
|
+
htmlFor: "cvv"
|
|
20875
|
+
}, "CVC *"), /*#__PURE__*/React__default.createElement("div", {
|
|
20876
|
+
id: "cvv",
|
|
20877
|
+
className: "pelcro-input-field plc-h-12 plc-bg-white"
|
|
20878
|
+
})))) : /*#__PURE__*/React__default.createElement("div", {
|
|
20879
|
+
className: "plc-w-full plc-h-40 plc-bg-gray-300 plc-rounded plc-animate-pulse"
|
|
20880
|
+
}));
|
|
20881
|
+
}
|
|
20882
|
+
if (cardProcessor === "stripe") {
|
|
20883
|
+
if (type === "updatePaymentSource") {
|
|
20884
|
+
var _paymentMethodToEdit$2;
|
|
19989
20885
|
return /*#__PURE__*/React__default.createElement("div", null, paymentMethodToEdit ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Input, {
|
|
19990
20886
|
className: "plc-tracking-widest plc-flex-grow plc-text-center",
|
|
19991
|
-
value: `•••• •••• •••• ${paymentMethodToEdit === null || paymentMethodToEdit === void 0 ? void 0 : (_paymentMethodToEdit$ = paymentMethodToEdit.properties) === null || _paymentMethodToEdit$ === void 0 ? void 0 : _paymentMethodToEdit
|
|
20887
|
+
value: `•••• •••• •••• ${paymentMethodToEdit === null || paymentMethodToEdit === void 0 ? void 0 : (_paymentMethodToEdit$2 = paymentMethodToEdit.properties) === null || _paymentMethodToEdit$2 === void 0 ? void 0 : _paymentMethodToEdit$2.last4}`,
|
|
19992
20888
|
disabled: true
|
|
19993
20889
|
})) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Input, {
|
|
19994
20890
|
className: "plc-bg-gray-300 plc-animate-pulse"
|
|
@@ -25305,7 +26201,8 @@ const PasswordResetContainer = _ref => {
|
|
|
25305
26201
|
email,
|
|
25306
26202
|
password,
|
|
25307
26203
|
password_confirmation: confirmPassword,
|
|
25308
|
-
token
|
|
26204
|
+
token,
|
|
26205
|
+
referer: window.location.origin
|
|
25309
26206
|
}, (err, res) => {
|
|
25310
26207
|
dispatch({
|
|
25311
26208
|
type: DISABLE_SUBMIT,
|
|
@@ -25537,7 +26434,8 @@ const PasswordForgotContainer = _ref => {
|
|
|
25537
26434
|
email
|
|
25538
26435
|
} = _ref2;
|
|
25539
26436
|
window.Pelcro.password.forgot({
|
|
25540
|
-
email
|
|
26437
|
+
email,
|
|
26438
|
+
referer: window.location.origin
|
|
25541
26439
|
}, (err, res) => {
|
|
25542
26440
|
dispatch({
|
|
25543
26441
|
type: DISABLE_SUBMIT,
|
|
@@ -27662,17 +28560,21 @@ const AddressSelectModal = _ref => {
|
|
|
27662
28560
|
AddressSelectModal.viewId = "address-select";
|
|
27663
28561
|
|
|
27664
28562
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
27665
|
-
|
|
27666
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
28563
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
27667
28564
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
27668
28565
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
27669
28566
|
return paymentMethodsWithoutDefault;
|
|
27670
28567
|
}
|
|
27671
28568
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
27672
28569
|
};
|
|
28570
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
28571
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
28572
|
+
return defaultPaymentMethod;
|
|
28573
|
+
};
|
|
27673
28574
|
const initialState$5 = {
|
|
27674
28575
|
paymentMethods: [],
|
|
27675
28576
|
selectedPaymentMethodId: null,
|
|
28577
|
+
skeletonLoader: true,
|
|
27676
28578
|
isSubmitting: false,
|
|
27677
28579
|
alert: {
|
|
27678
28580
|
type: "error",
|
|
@@ -27703,12 +28605,11 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27703
28605
|
});
|
|
27704
28606
|
return onSuccess(selectedPaymentMethodId);
|
|
27705
28607
|
};
|
|
27706
|
-
const getInitialSelectedMethodId =
|
|
27707
|
-
var _window$Pelcro$user$r2;
|
|
28608
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
27708
28609
|
if (selectedPaymentMethodIdFromStore) {
|
|
27709
28610
|
return selectedPaymentMethodIdFromStore;
|
|
27710
28611
|
}
|
|
27711
|
-
const defaultMethod = (
|
|
28612
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
27712
28613
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
27713
28614
|
return String(defaultMethod.id);
|
|
27714
28615
|
}
|
|
@@ -27725,7 +28626,12 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27725
28626
|
return lib_7({
|
|
27726
28627
|
...state,
|
|
27727
28628
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
27728
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
28629
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
28630
|
+
});
|
|
28631
|
+
case SKELETON_LOADER:
|
|
28632
|
+
return lib_7({
|
|
28633
|
+
...state,
|
|
28634
|
+
skeletonLoader: action.payload
|
|
27729
28635
|
});
|
|
27730
28636
|
case HANDLE_SUBMIT:
|
|
27731
28637
|
return lib_5({
|
|
@@ -27737,10 +28643,23 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27737
28643
|
}
|
|
27738
28644
|
}, initialState$5);
|
|
27739
28645
|
useEffect(() => {
|
|
27740
|
-
|
|
27741
|
-
|
|
27742
|
-
|
|
27743
|
-
|
|
28646
|
+
window.Pelcro.paymentMethods.list({
|
|
28647
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
28648
|
+
}, (err, res) => {
|
|
28649
|
+
if (err) {
|
|
28650
|
+
return console.error(err);
|
|
28651
|
+
}
|
|
28652
|
+
if (res) {
|
|
28653
|
+
var _res$data;
|
|
28654
|
+
dispatch({
|
|
28655
|
+
type: LOAD_PAYMENT_METHODS,
|
|
28656
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
28657
|
+
});
|
|
28658
|
+
dispatch({
|
|
28659
|
+
type: SKELETON_LOADER,
|
|
28660
|
+
payload: false
|
|
28661
|
+
});
|
|
28662
|
+
}
|
|
27744
28663
|
});
|
|
27745
28664
|
}, []);
|
|
27746
28665
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -27769,7 +28688,8 @@ const PaymentMethodSelectList = () => {
|
|
|
27769
28688
|
dispatch,
|
|
27770
28689
|
state: {
|
|
27771
28690
|
paymentMethods,
|
|
27772
|
-
selectedPaymentMethodId
|
|
28691
|
+
selectedPaymentMethodId,
|
|
28692
|
+
skeletonLoader
|
|
27773
28693
|
}
|
|
27774
28694
|
} = useContext(store$5);
|
|
27775
28695
|
const handlePaymentMethodSelect = event => {
|
|
@@ -27778,7 +28698,9 @@ const PaymentMethodSelectList = () => {
|
|
|
27778
28698
|
payload: event.target.value
|
|
27779
28699
|
});
|
|
27780
28700
|
};
|
|
27781
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
28701
|
+
return /*#__PURE__*/React__default.createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
28702
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
28703
|
+
}) : /*#__PURE__*/React__default.createElement("div", {
|
|
27782
28704
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
27783
28705
|
}, paymentMethods.map(paymentMethod => {
|
|
27784
28706
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
@@ -27801,7 +28723,7 @@ const PaymentMethodSelectList = () => {
|
|
|
27801
28723
|
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default.createElement("p", {
|
|
27802
28724
|
className: "plc-text-sm plc-text-gray-500"
|
|
27803
28725
|
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
27804
|
-
}));
|
|
28726
|
+
})));
|
|
27805
28727
|
};
|
|
27806
28728
|
|
|
27807
28729
|
const PaymentMethodSelectSubmit = _ref => {
|
|
@@ -27903,10 +28825,10 @@ const initialState$4 = {
|
|
|
27903
28825
|
paymentMethods: [],
|
|
27904
28826
|
selectedPaymentMethodId: null,
|
|
27905
28827
|
isSubmitting: false,
|
|
27906
|
-
|
|
27907
|
-
disableSubmit: false,
|
|
28828
|
+
disableSubmit: true,
|
|
27908
28829
|
isLoading: false,
|
|
27909
28830
|
skeletonLoader: true,
|
|
28831
|
+
showPaymentMethodSelect: false,
|
|
27910
28832
|
alert: {
|
|
27911
28833
|
type: "error",
|
|
27912
28834
|
content: ""
|
|
@@ -27943,20 +28865,19 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
27943
28865
|
type: SKELETON_LOADER,
|
|
27944
28866
|
payload: false
|
|
27945
28867
|
});
|
|
27946
|
-
if (res.data.length !== 1) {
|
|
27947
|
-
dispatch({
|
|
27948
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
27949
|
-
payload: "select"
|
|
27950
|
-
});
|
|
27951
|
-
} else {
|
|
28868
|
+
if (res.data.length !== 1 && paymentMethodToDelete.is_default && paymentMethodToDelete.deletable) {
|
|
27952
28869
|
dispatch({
|
|
27953
|
-
type:
|
|
27954
|
-
payload:
|
|
28870
|
+
type: SHOW_PAYMENT_METHOD_SELECT,
|
|
28871
|
+
payload: true
|
|
27955
28872
|
});
|
|
27956
28873
|
}
|
|
28874
|
+
dispatch({
|
|
28875
|
+
type: DISABLE_SUBMIT,
|
|
28876
|
+
payload: false
|
|
28877
|
+
});
|
|
27957
28878
|
}
|
|
27958
28879
|
});
|
|
27959
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28880
|
+
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
27960
28881
|
|
|
27961
28882
|
const setDefaultPaymentMethod = () => {
|
|
27962
28883
|
const {
|
|
@@ -27968,6 +28889,15 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
27968
28889
|
is_default: true
|
|
27969
28890
|
}, (err, res) => {
|
|
27970
28891
|
if (err) {
|
|
28892
|
+
dispatch({
|
|
28893
|
+
type: DISABLE_SUBMIT,
|
|
28894
|
+
payload: false
|
|
28895
|
+
});
|
|
28896
|
+
dispatch({
|
|
28897
|
+
type: LOADING,
|
|
28898
|
+
payload: false
|
|
28899
|
+
});
|
|
28900
|
+
console.log(err);
|
|
27971
28901
|
onFailure(err);
|
|
27972
28902
|
return dispatch({
|
|
27973
28903
|
type: SHOW_ALERT,
|
|
@@ -27990,6 +28920,14 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
27990
28920
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
27991
28921
|
payment_method_id: paymentMethodId
|
|
27992
28922
|
}, (err, res) => {
|
|
28923
|
+
dispatch({
|
|
28924
|
+
type: DISABLE_SUBMIT,
|
|
28925
|
+
payload: false
|
|
28926
|
+
});
|
|
28927
|
+
dispatch({
|
|
28928
|
+
type: LOADING,
|
|
28929
|
+
payload: false
|
|
28930
|
+
});
|
|
27993
28931
|
if (err) {
|
|
27994
28932
|
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
27995
28933
|
return dispatch({
|
|
@@ -28000,14 +28938,6 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28000
28938
|
}
|
|
28001
28939
|
});
|
|
28002
28940
|
}
|
|
28003
|
-
dispatch({
|
|
28004
|
-
type: DISABLE_SUBMIT,
|
|
28005
|
-
payload: false
|
|
28006
|
-
});
|
|
28007
|
-
dispatch({
|
|
28008
|
-
type: LOADING,
|
|
28009
|
-
payload: false
|
|
28010
|
-
});
|
|
28011
28941
|
onSuccess(res);
|
|
28012
28942
|
});
|
|
28013
28943
|
};
|
|
@@ -28023,11 +28953,12 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28023
28953
|
...state,
|
|
28024
28954
|
disableSubmit: true,
|
|
28025
28955
|
isLoading: true
|
|
28026
|
-
}, (state, dispatch) =>
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28030
|
-
|
|
28956
|
+
}, (state, dispatch) => {
|
|
28957
|
+
if (state.showPaymentMethodSelect) {
|
|
28958
|
+
setDefaultPaymentMethod();
|
|
28959
|
+
} else {
|
|
28960
|
+
deletePaymentMethod();
|
|
28961
|
+
}
|
|
28031
28962
|
});
|
|
28032
28963
|
case SET_PAYMENT_METHODS:
|
|
28033
28964
|
return lib_7({
|
|
@@ -28054,6 +28985,11 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28054
28985
|
...state,
|
|
28055
28986
|
skeletonLoader: action.payload
|
|
28056
28987
|
});
|
|
28988
|
+
case SHOW_PAYMENT_METHOD_SELECT:
|
|
28989
|
+
return lib_7({
|
|
28990
|
+
...state,
|
|
28991
|
+
showPaymentMethodSelect: action.payload
|
|
28992
|
+
});
|
|
28057
28993
|
default:
|
|
28058
28994
|
return state;
|
|
28059
28995
|
}
|
|
@@ -28076,6 +29012,91 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28076
29012
|
})));
|
|
28077
29013
|
};
|
|
28078
29014
|
|
|
29015
|
+
const PaymentMethodDeleteList = props => {
|
|
29016
|
+
const {
|
|
29017
|
+
t
|
|
29018
|
+
} = useTranslation("paymentMethod");
|
|
29019
|
+
const {
|
|
29020
|
+
dispatch,
|
|
29021
|
+
state: {
|
|
29022
|
+
selectedPaymentMethodId,
|
|
29023
|
+
paymentMethods,
|
|
29024
|
+
skeletonLoader,
|
|
29025
|
+
showPaymentMethodSelect
|
|
29026
|
+
}
|
|
29027
|
+
} = useContext(store$4);
|
|
29028
|
+
const {
|
|
29029
|
+
paymentMethodToDelete
|
|
29030
|
+
} = usePelcro();
|
|
29031
|
+
const createPaymentMethodItems = () => {
|
|
29032
|
+
if (paymentMethods.length) {
|
|
29033
|
+
return paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => /*#__PURE__*/React__default.createElement("option", {
|
|
29034
|
+
key: paymentMethod.id,
|
|
29035
|
+
value: paymentMethod.id
|
|
29036
|
+
}, paymentMethod.properties.brand, " -", " ", paymentMethod.properties.last4, " -", " ", paymentMethod.properties.exp_month, " /", paymentMethod.properties.exp_year));
|
|
29037
|
+
}
|
|
29038
|
+
};
|
|
29039
|
+
const handlePaymentMethodSelect = event => {
|
|
29040
|
+
dispatch({
|
|
29041
|
+
type: SELECT_PAYMENT_METHOD,
|
|
29042
|
+
payload: event.target.value
|
|
29043
|
+
});
|
|
29044
|
+
};
|
|
29045
|
+
if (showPaymentMethodSelect) {
|
|
29046
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
29047
|
+
className: "plc-w-full plc-h-8 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
29048
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethods && /*#__PURE__*/React__default.createElement("div", {
|
|
29049
|
+
className: "plc-mt-4"
|
|
29050
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
29051
|
+
label: t("delete.options.select"),
|
|
29052
|
+
name: "default-payment-method",
|
|
29053
|
+
onChange: handlePaymentMethodSelect,
|
|
29054
|
+
value: selectedPaymentMethodId
|
|
29055
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
29056
|
+
value: "",
|
|
29057
|
+
disabled: true,
|
|
29058
|
+
selected: true
|
|
29059
|
+
}), createPaymentMethodItems()))));
|
|
29060
|
+
} else {
|
|
29061
|
+
return null;
|
|
29062
|
+
}
|
|
29063
|
+
};
|
|
29064
|
+
|
|
29065
|
+
const PaymentMethodDetails = () => {
|
|
29066
|
+
var _paymentMethodToDelet, _paymentMethodToDelet2, _paymentMethodToDelet3, _paymentMethodToDelet4;
|
|
29067
|
+
const {
|
|
29068
|
+
state: {
|
|
29069
|
+
skeletonLoader
|
|
29070
|
+
}
|
|
29071
|
+
} = useContext(store$4);
|
|
29072
|
+
const {
|
|
29073
|
+
t
|
|
29074
|
+
} = useTranslation("paymentMethod");
|
|
29075
|
+
const {
|
|
29076
|
+
paymentMethodToDelete
|
|
29077
|
+
} = usePelcro();
|
|
29078
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
29079
|
+
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
29080
|
+
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
29081
|
+
className: "plc-mb-2"
|
|
29082
|
+
}, t("delete.details")), skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
29083
|
+
className: "plc-w-full plc-h-16 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
29084
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethodToDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
29085
|
+
key: paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id,
|
|
29086
|
+
className: `plc-p-2 plc-pl-4 plc-shadow-md_dark plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
29087
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
29088
|
+
className: "plc-flex plc-items-center plc-space-x-2 plc-w-full pelcro-select-payment-method-radio",
|
|
29089
|
+
id: `pelcro-payment-method-select-${paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id}`,
|
|
29090
|
+
name: "paymentMethod"
|
|
29091
|
+
}, getPaymentCardIcon$1((_paymentMethodToDelet = paymentMethodToDelete.properties) === null || _paymentMethodToDelet === void 0 ? void 0 : _paymentMethodToDelet.brand), /*#__PURE__*/React__default.createElement("div", {
|
|
29092
|
+
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
29093
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
29094
|
+
className: "plc-font-semibold"
|
|
29095
|
+
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022", " ", (_paymentMethodToDelet2 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet2 === void 0 ? void 0 : _paymentMethodToDelet2.last4), /*#__PURE__*/React__default.createElement("p", {
|
|
29096
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
29097
|
+
}, t("select.expires"), " ", (_paymentMethodToDelet3 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet3 === void 0 ? void 0 : _paymentMethodToDelet3.exp_month, "/", (_paymentMethodToDelet4 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet4 === void 0 ? void 0 : _paymentMethodToDelet4.exp_year))))));
|
|
29098
|
+
};
|
|
29099
|
+
|
|
28079
29100
|
const PaymentMethodDeleteSubmit = _ref => {
|
|
28080
29101
|
let {
|
|
28081
29102
|
name,
|
|
@@ -28089,7 +29110,9 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
28089
29110
|
dispatch,
|
|
28090
29111
|
state: {
|
|
28091
29112
|
isLoading,
|
|
28092
|
-
|
|
29113
|
+
disableSubmit,
|
|
29114
|
+
showPaymentMethodSelect,
|
|
29115
|
+
selectedPaymentMethodId
|
|
28093
29116
|
}
|
|
28094
29117
|
} = useContext(store$4);
|
|
28095
29118
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
@@ -28099,116 +29122,38 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
28099
29122
|
});
|
|
28100
29123
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
28101
29124
|
},
|
|
28102
|
-
disabled:
|
|
29125
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
28103
29126
|
isLoading: isLoading,
|
|
28104
29127
|
className: "plc-w-full"
|
|
28105
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("
|
|
29128
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|
|
28106
29129
|
};
|
|
28107
29130
|
|
|
28108
|
-
const
|
|
29131
|
+
const PaymentMethodDeleteBack = _ref => {
|
|
29132
|
+
let {
|
|
29133
|
+
name,
|
|
29134
|
+
onClick,
|
|
29135
|
+
...otherProps
|
|
29136
|
+
} = _ref;
|
|
28109
29137
|
const {
|
|
28110
29138
|
t
|
|
28111
29139
|
} = useTranslation("paymentMethod");
|
|
28112
29140
|
const {
|
|
28113
|
-
|
|
28114
|
-
state: {
|
|
28115
|
-
deleteOption,
|
|
28116
|
-
selectedPaymentMethodId,
|
|
28117
|
-
paymentMethods,
|
|
28118
|
-
skeletonLoader
|
|
28119
|
-
}
|
|
28120
|
-
} = useContext(store$4);
|
|
28121
|
-
const {
|
|
28122
|
-
paymentMethodToDelete
|
|
29141
|
+
switchView
|
|
28123
29142
|
} = usePelcro();
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
|
|
28132
|
-
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethods && deleteOption === "select" && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
28133
|
-
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll no-scrollbar plc-max-h-80 pelcro-payment-method-select-wrapper plc-mb-4"
|
|
28134
|
-
}, paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => {
|
|
28135
|
-
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
28136
|
-
const isSelected = selectedPaymentMethodId === String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id);
|
|
28137
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
28138
|
-
key: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
28139
|
-
className: `plc-p-2 plc-pl-4 plc-shadow-md plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
28140
|
-
}, /*#__PURE__*/React__default.createElement(Radio, {
|
|
28141
|
-
className: "plc-flex plc-items-center pelcro-select-payment-method-radio",
|
|
28142
|
-
labelClassName: "plc-flex plc-items-center plc-space-x-2 plc-cursor-pointer plc-w-full",
|
|
28143
|
-
id: `pelcro-payment-method-select-${paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id}`,
|
|
28144
|
-
name: "paymentMethod",
|
|
28145
|
-
checked: isSelected,
|
|
28146
|
-
value: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
28147
|
-
onChange: handlePaymentMethodSelect
|
|
28148
|
-
}, getPaymentCardIcon$1((_paymentMethod$proper = paymentMethod.properties) === null || _paymentMethod$proper === void 0 ? void 0 : _paymentMethod$proper.brand), /*#__PURE__*/React__default.createElement("div", {
|
|
28149
|
-
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
28150
|
-
}, /*#__PURE__*/React__default.createElement("p", {
|
|
28151
|
-
className: "plc-font-semibold"
|
|
28152
|
-
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022", " ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default.createElement("p", {
|
|
28153
|
-
className: "plc-text-sm plc-text-gray-500"
|
|
28154
|
-
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
28155
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
28156
|
-
className: "plc-px-3"
|
|
28157
|
-
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteSubmit, null))), deleteOption === "add" && /*#__PURE__*/React__default.createElement(PaymentMethodView, {
|
|
28158
|
-
type: "deletePaymentSource",
|
|
28159
|
-
showCoupon: false,
|
|
28160
|
-
showExternalPaymentMethods: false,
|
|
28161
|
-
showApplePayButton: false,
|
|
28162
|
-
onDisplay: props.onDisplay,
|
|
28163
|
-
onFailure: props.onFailure,
|
|
28164
|
-
onSuccess: props.onSuccess,
|
|
28165
|
-
setAsDefault: true
|
|
28166
|
-
})));
|
|
29143
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
29144
|
+
variant: "outline",
|
|
29145
|
+
onClick: () => {
|
|
29146
|
+
switchView("dashboard");
|
|
29147
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
29148
|
+
},
|
|
29149
|
+
className: "plc-w-full"
|
|
29150
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.back"));
|
|
28167
29151
|
};
|
|
28168
29152
|
|
|
28169
|
-
|
|
28170
|
-
const {
|
|
28171
|
-
state: {
|
|
28172
|
-
deleteOption,
|
|
28173
|
-
paymentMethods,
|
|
28174
|
-
skeletonLoader
|
|
28175
|
-
},
|
|
28176
|
-
dispatch
|
|
28177
|
-
} = useContext(store$4);
|
|
29153
|
+
function PaymentMethodDeleteView(props) {
|
|
28178
29154
|
const {
|
|
28179
29155
|
t
|
|
28180
29156
|
} = useTranslation("paymentMethod");
|
|
28181
|
-
const handleOptionSelect = event => {
|
|
28182
|
-
dispatch({
|
|
28183
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
28184
|
-
payload: event.target.value
|
|
28185
|
-
});
|
|
28186
|
-
};
|
|
28187
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
28188
|
-
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
28189
|
-
}, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
28190
|
-
className: "plc-flex plc-flex-col plc-space-y-3"
|
|
28191
|
-
}, /*#__PURE__*/React__default.createElement(Radio, {
|
|
28192
|
-
className: "plc-animate-puls"
|
|
28193
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
28194
|
-
className: "plc-w-36 plc-bg-gray-300 plc-h-4 plc-rounded-md plc-animate-pulse"
|
|
28195
|
-
})), /*#__PURE__*/React__default.createElement(Radio, {
|
|
28196
|
-
className: "plc-animate-pulse"
|
|
28197
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
28198
|
-
className: "plc-w-36 plc-bg-gray-300 plc-h-4 plc-rounded-md plc-animate-pulse"
|
|
28199
|
-
}))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethods && paymentMethods.length !== 1 && /*#__PURE__*/React__default.createElement(Radio, {
|
|
28200
|
-
onChange: handleOptionSelect,
|
|
28201
|
-
checked: deleteOption === "select",
|
|
28202
|
-
value: "select"
|
|
28203
|
-
}, t("delete.options.select")), /*#__PURE__*/React__default.createElement(Radio, {
|
|
28204
|
-
onChange: handleOptionSelect,
|
|
28205
|
-
checked: deleteOption === "add",
|
|
28206
|
-
value: "add"
|
|
28207
|
-
}, t("delete.options.add"))));
|
|
28208
|
-
};
|
|
28209
|
-
|
|
28210
|
-
function PaymentMethodDeleteView(props) {
|
|
28211
|
-
const [t] = useTranslation("paymentMethod");
|
|
28212
29157
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
28213
29158
|
id: "pelcro-payment-method-delete-view"
|
|
28214
29159
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -28216,12 +29161,12 @@ function PaymentMethodDeleteView(props) {
|
|
|
28216
29161
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
28217
29162
|
className: "plc-text-2xl plc-font-semibold plc-mb-2"
|
|
28218
29163
|
}, t("delete.title")), /*#__PURE__*/React__default.createElement("p", {
|
|
28219
|
-
className: ""
|
|
28220
|
-
}, t("delete.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
28221
|
-
className: "plc-
|
|
28222
|
-
}
|
|
28223
|
-
|
|
28224
|
-
})));
|
|
29164
|
+
className: "plc-text-sm"
|
|
29165
|
+
}, t("delete.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(PaymentMethodDetails, null), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteList, null), /*#__PURE__*/React__default.createElement("p", {
|
|
29166
|
+
className: "plc-text-sm plc-text-justify"
|
|
29167
|
+
}, t("delete.message")), /*#__PURE__*/React__default.createElement("div", {
|
|
29168
|
+
className: "plc-space-x-0 plc-space-y-3 plc-w-full plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
29169
|
+
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteSubmit, null), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteBack, null))));
|
|
28225
29170
|
}
|
|
28226
29171
|
|
|
28227
29172
|
const PaymentMethodDeleteModal = props => {
|
|
@@ -28248,7 +29193,7 @@ const PaymentMethodDeleteModal = props => {
|
|
|
28248
29193
|
nonInteraction: true
|
|
28249
29194
|
});
|
|
28250
29195
|
}
|
|
28251
|
-
notify$1.success(t("delete.
|
|
29196
|
+
notify$1.success(t("delete.deletedSuccessfully"));
|
|
28252
29197
|
resetView();
|
|
28253
29198
|
};
|
|
28254
29199
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
@@ -29434,6 +30379,14 @@ const getPaymentCardIcon = name => {
|
|
|
29434
30379
|
viewBox: "0 0 50 50"
|
|
29435
30380
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
29436
30381
|
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 8.5625 19.90625 L 4.84375 28.40625 L 7.0625 28.40625 L 7.875 26.5 L 12.0625 26.5 L 12.875 28.40625 L 17.09375 28.40625 L 17.09375 22.09375 L 19.90625 28.40625 L 21.8125 28.40625 L 24.65625 22.1875 L 24.65625 28.40625 L 26.75 28.40625 L 26.75 19.90625 L 23.40625 19.90625 L 20.84375 25.625 L 18.28125 19.90625 L 15 19.90625 L 15 28.09375 L 11.34375 19.90625 Z M 29.5 19.90625 L 29.5 28.4375 L 37.5 28.4375 L 40 25.59375 L 42.46875 28.4375 L 45.125 28.4375 L 41.375 24.0625 L 45.125 19.90625 L 42.46875 19.90625 L 40.0625 22.5625 L 37.75 19.90625 Z M 9.90625 21.6875 L 11.21875 24.6875 L 8.65625 24.6875 Z M 31.5625 21.71875 L 36.65625 21.75 L 38.6875 24.0625 L 36.40625 26.625 L 31.5625 26.625 L 31.5625 24.9375 L 36.1875 24.9375 L 36.1875 23.3125 L 31.5625 23.3125 Z"
|
|
30382
|
+
})),
|
|
30383
|
+
amex: /*#__PURE__*/React__default.createElement("svg", {
|
|
30384
|
+
className: "plc-w-12",
|
|
30385
|
+
fill: "#ffffff",
|
|
30386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
30387
|
+
viewBox: "0 0 50 50"
|
|
30388
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
30389
|
+
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 8.5625 19.90625 L 4.84375 28.40625 L 7.0625 28.40625 L 7.875 26.5 L 12.0625 26.5 L 12.875 28.40625 L 17.09375 28.40625 L 17.09375 22.09375 L 19.90625 28.40625 L 21.8125 28.40625 L 24.65625 22.1875 L 24.65625 28.40625 L 26.75 28.40625 L 26.75 19.90625 L 23.40625 19.90625 L 20.84375 25.625 L 18.28125 19.90625 L 15 19.90625 L 15 28.09375 L 11.34375 19.90625 Z M 29.5 19.90625 L 29.5 28.4375 L 37.5 28.4375 L 40 25.59375 L 42.46875 28.4375 L 45.125 28.4375 L 41.375 24.0625 L 45.125 19.90625 L 42.46875 19.90625 L 40.0625 22.5625 L 37.75 19.90625 Z M 9.90625 21.6875 L 11.21875 24.6875 L 8.65625 24.6875 Z M 31.5625 21.71875 L 36.65625 21.75 L 38.6875 24.0625 L 36.40625 26.625 L 31.5625 26.625 L 31.5625 24.9375 L 36.1875 24.9375 L 36.1875 23.3125 L 31.5625 23.3125 Z"
|
|
29437
30390
|
}))
|
|
29438
30391
|
};
|
|
29439
30392
|
return (_icons$name$toLowerCa = icons[name === null || name === void 0 ? void 0 : name.toLowerCase()]) !== null && _icons$name$toLowerCa !== void 0 ? _icons$name$toLowerCa : /*#__PURE__*/React__default.createElement("svg", {
|
|
@@ -30760,23 +31713,8 @@ class Dashboard extends Component {
|
|
|
30760
31713
|
});
|
|
30761
31714
|
});
|
|
30762
31715
|
_defineProperty$3(this, "onDeletePaymentMethodClick", source => {
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
this.props.onClose();
|
|
30766
|
-
notify$1.confirm((onSuccess, onFailure) => {
|
|
30767
|
-
this.deletePaymentMethod(source.id, onSuccess, onFailure);
|
|
30768
|
-
}, {
|
|
30769
|
-
confirmMessage: this.locale("messages.paymentMethodDeletion.isSureToDelete"),
|
|
30770
|
-
loadingMessage: this.locale("messages.paymentMethodDeletion.loading"),
|
|
30771
|
-
successMessage: this.locale("messages.paymentMethodDeletion.success"),
|
|
30772
|
-
errorMessage: this.locale("messages.paymentMethodDeletion.error")
|
|
30773
|
-
}, {
|
|
30774
|
-
closeButtonLabel: this.locale("labels.subCancellation.goBack")
|
|
30775
|
-
});
|
|
30776
|
-
} else {
|
|
30777
|
-
this.props.setPaymentMethodToDelete(source.id);
|
|
30778
|
-
return this.props.setView("payment-method-delete");
|
|
30779
|
-
}
|
|
31716
|
+
this.props.setPaymentMethodToDelete(source.id);
|
|
31717
|
+
return this.props.setView("payment-method-delete");
|
|
30780
31718
|
});
|
|
30781
31719
|
_defineProperty$3(this, "displayRedeem", () => {
|
|
30782
31720
|
return this.props.setView("gift-redeem");
|
|
@@ -35121,4 +36059,4 @@ const QrCodeModal = _ref => {
|
|
|
35121
36059
|
};
|
|
35122
36060
|
QrCodeModal.viewId = "qrcode";
|
|
35123
36061
|
|
|
35124
|
-
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal,
|
|
36062
|
+
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro };
|