@pelcro/react-pelcro-js 3.22.0-beta.9 → 3.22.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 +753 -132
- package/dist/index.esm.js +753 -132
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3457,7 +3457,8 @@ var labels$10 = {
|
|
|
3457
3457
|
removeCoupon: "REMOVE",
|
|
3458
3458
|
firstName: "First name",
|
|
3459
3459
|
lastName: "Last name",
|
|
3460
|
-
phone: "Phone"
|
|
3460
|
+
phone: "Phone",
|
|
3461
|
+
freeItems: "Free Items"
|
|
3461
3462
|
};
|
|
3462
3463
|
var checkoutForm_en = {
|
|
3463
3464
|
messages: messages$14,
|
|
@@ -4398,7 +4399,8 @@ var labels$H = {
|
|
|
4398
4399
|
removeCoupon: "RETIRER",
|
|
4399
4400
|
firstName: "Prénom",
|
|
4400
4401
|
lastName: "Nom de famille",
|
|
4401
|
-
phone: "Téléphoner"
|
|
4402
|
+
phone: "Téléphoner",
|
|
4403
|
+
freeItems: "Articles gratuits"
|
|
4402
4404
|
};
|
|
4403
4405
|
var checkoutForm_fr = {
|
|
4404
4406
|
messages: messages$M,
|
|
@@ -5225,7 +5227,8 @@ var labels$s = {
|
|
|
5225
5227
|
removeCoupon: "제거",
|
|
5226
5228
|
firstName: "이름",
|
|
5227
5229
|
lastName: "성",
|
|
5228
|
-
phone: "핸드폰"
|
|
5230
|
+
phone: "핸드폰",
|
|
5231
|
+
freeItems: "무료 아이템"
|
|
5229
5232
|
};
|
|
5230
5233
|
var checkoutForm_ko = {
|
|
5231
5234
|
messages: messages$v,
|
|
@@ -6156,7 +6159,8 @@ var labels$d = {
|
|
|
6156
6159
|
removeCoupon: "ELIMINAR",
|
|
6157
6160
|
firstName: "Nombre",
|
|
6158
6161
|
lastName: "Apellido",
|
|
6159
|
-
phone: "Teléfono"
|
|
6162
|
+
phone: "Teléfono",
|
|
6163
|
+
freeItems: "Artículos gratis"
|
|
6160
6164
|
};
|
|
6161
6165
|
var checkoutForm_es = {
|
|
6162
6166
|
messages: messages$e,
|
|
@@ -10873,13 +10877,16 @@ const debounce = (func, waitTime) => {
|
|
|
10873
10877
|
};
|
|
10874
10878
|
};
|
|
10875
10879
|
function getSiteCardProcessor() {
|
|
10876
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10880
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
10877
10881
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
|
|
10878
10882
|
return "vantiv";
|
|
10879
10883
|
}
|
|
10880
10884
|
if ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r2 !== void 0 && _window$Pelcro$site$r2.tap_gateway_settings) {
|
|
10881
10885
|
return "tap";
|
|
10882
10886
|
}
|
|
10887
|
+
if ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r3 !== void 0 && _window$Pelcro$site$r3.cybersource_gateway_settings) {
|
|
10888
|
+
return "cybersource";
|
|
10889
|
+
}
|
|
10883
10890
|
return "stripe";
|
|
10884
10891
|
}
|
|
10885
10892
|
|
|
@@ -11740,6 +11747,8 @@ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
|
11740
11747
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
11741
11748
|
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
11742
11749
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
11750
|
+
const SET_MONTH = "SET_MONTH";
|
|
11751
|
+
const SET_YEAR = "SET_YEAR";
|
|
11743
11752
|
const SET_TOKEN = "SET_TOKEN";
|
|
11744
11753
|
const SET_GIFT_CODE = "SET_GIFT_CODE";
|
|
11745
11754
|
const RESET_LOGIN_FORM = "RESET_LOGIN_FORM";
|
|
@@ -14079,6 +14088,7 @@ class SelectModal extends React.Component {
|
|
|
14079
14088
|
});
|
|
14080
14089
|
});
|
|
14081
14090
|
});
|
|
14091
|
+
console.log("bugsnag Triggered");
|
|
14082
14092
|
}
|
|
14083
14093
|
});
|
|
14084
14094
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
@@ -15498,7 +15508,7 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
|
|
|
15498
15508
|
var _generateUserError = /*#__PURE__*/new WeakMap();
|
|
15499
15509
|
class Payment {
|
|
15500
15510
|
/**
|
|
15501
|
-
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway)} paymentGateway
|
|
15511
|
+
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway)} paymentGateway
|
|
15502
15512
|
*/
|
|
15503
15513
|
constructor(paymentGateway) {
|
|
15504
15514
|
_defineProperty$3(this, "execute", (options, callback) => {
|
|
@@ -15517,7 +15527,7 @@ class Payment {
|
|
|
15517
15527
|
_classPrivateFieldInitSpec$1(this, _isPaymentGatewayInvalid, {
|
|
15518
15528
|
writable: true,
|
|
15519
15529
|
value: gateway => {
|
|
15520
|
-
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway);
|
|
15530
|
+
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway || gateway instanceof CybersourceGateway);
|
|
15521
15531
|
}
|
|
15522
15532
|
});
|
|
15523
15533
|
_classPrivateFieldInitSpec$1(this, _generateUserError, {
|
|
@@ -15571,7 +15581,8 @@ const PAYMENT_GATEWAYS_ENUM = {
|
|
|
15571
15581
|
stripe: "stripe",
|
|
15572
15582
|
paypal: "braintree",
|
|
15573
15583
|
vantiv: "vantiv",
|
|
15574
|
-
tap: "tap"
|
|
15584
|
+
tap: "tap",
|
|
15585
|
+
cybersource: "cybersource"
|
|
15575
15586
|
};
|
|
15576
15587
|
|
|
15577
15588
|
/**
|
|
@@ -16293,6 +16304,222 @@ class TapGateway {
|
|
|
16293
16304
|
}
|
|
16294
16305
|
}
|
|
16295
16306
|
|
|
16307
|
+
/**
|
|
16308
|
+
* Cybersource gateway strategy
|
|
16309
|
+
*/
|
|
16310
|
+
var _paymentGateway5 = /*#__PURE__*/new WeakMap();
|
|
16311
|
+
var _createSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16312
|
+
var _renewSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16313
|
+
var _createGiftedSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16314
|
+
var _renewGiftedSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16315
|
+
var _purchaseEcommerceOrder4 = /*#__PURE__*/new WeakMap();
|
|
16316
|
+
var _payInvoice5 = /*#__PURE__*/new WeakMap();
|
|
16317
|
+
class CybersourceGateway {
|
|
16318
|
+
constructor() {
|
|
16319
|
+
_classPrivateFieldInitSpec$1(this, _paymentGateway5, {
|
|
16320
|
+
writable: true,
|
|
16321
|
+
value: PAYMENT_GATEWAYS_ENUM["cybersource"]
|
|
16322
|
+
});
|
|
16323
|
+
_defineProperty$3(this, "execute", (options, callback) => {
|
|
16324
|
+
const types = PAYMENT_TYPES;
|
|
16325
|
+
switch (options.type) {
|
|
16326
|
+
case types.CREATE_SUBSCRIPTION:
|
|
16327
|
+
return _classPrivateFieldGet(this, _createSubscription5).call(this, options, callback);
|
|
16328
|
+
case types.RENEW_SUBSCRIPTION:
|
|
16329
|
+
return _classPrivateFieldGet(this, _renewSubscription4).call(this, options, callback);
|
|
16330
|
+
case types.CREATE_GIFTED_SUBSCRIPTION:
|
|
16331
|
+
return _classPrivateFieldGet(this, _createGiftedSubscription5).call(this, options, callback);
|
|
16332
|
+
case types.RENEW_GIFTED_SUBSCRIPTION:
|
|
16333
|
+
return _classPrivateFieldGet(this, _renewGiftedSubscription4).call(this, options, callback);
|
|
16334
|
+
case types.PURCHASE_ECOMMERCE_ORDER:
|
|
16335
|
+
return _classPrivateFieldGet(this, _purchaseEcommerceOrder4).call(this, options, callback);
|
|
16336
|
+
case types.PAY_INVOICE:
|
|
16337
|
+
return _classPrivateFieldGet(this, _payInvoice5).call(this, options, callback);
|
|
16338
|
+
default:
|
|
16339
|
+
console.error("Unsupported payment method: cybersource Gateway");
|
|
16340
|
+
}
|
|
16341
|
+
});
|
|
16342
|
+
_classPrivateFieldInitSpec$1(this, _createSubscription5, {
|
|
16343
|
+
writable: true,
|
|
16344
|
+
value: (options, callback) => {
|
|
16345
|
+
const {
|
|
16346
|
+
token,
|
|
16347
|
+
plan,
|
|
16348
|
+
couponCode,
|
|
16349
|
+
product,
|
|
16350
|
+
quantity = 1,
|
|
16351
|
+
addressId,
|
|
16352
|
+
isExistingSource
|
|
16353
|
+
} = options;
|
|
16354
|
+
const params = isExistingSource ? {
|
|
16355
|
+
source_id: token
|
|
16356
|
+
} : {
|
|
16357
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16358
|
+
gateway_token: token
|
|
16359
|
+
};
|
|
16360
|
+
window.Pelcro.subscription.create({
|
|
16361
|
+
quantity,
|
|
16362
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16363
|
+
plan_id: plan.id,
|
|
16364
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16365
|
+
coupon_code: couponCode,
|
|
16366
|
+
address_id: product.address_required ? addressId : null,
|
|
16367
|
+
...params
|
|
16368
|
+
}, (err, res) => {
|
|
16369
|
+
callback(err, res);
|
|
16370
|
+
});
|
|
16371
|
+
}
|
|
16372
|
+
});
|
|
16373
|
+
_classPrivateFieldInitSpec$1(this, _renewSubscription4, {
|
|
16374
|
+
writable: true,
|
|
16375
|
+
value: (options, callback) => {
|
|
16376
|
+
const {
|
|
16377
|
+
subscriptionIdToRenew,
|
|
16378
|
+
token,
|
|
16379
|
+
plan,
|
|
16380
|
+
couponCode,
|
|
16381
|
+
product,
|
|
16382
|
+
addressId,
|
|
16383
|
+
isExistingSource
|
|
16384
|
+
} = options;
|
|
16385
|
+
const params = isExistingSource ? {
|
|
16386
|
+
source_id: token
|
|
16387
|
+
} : {
|
|
16388
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16389
|
+
gateway_token: token
|
|
16390
|
+
};
|
|
16391
|
+
window.Pelcro.subscription.renew({
|
|
16392
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16393
|
+
plan_id: plan.id,
|
|
16394
|
+
coupon_code: couponCode,
|
|
16395
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16396
|
+
subscription_id: subscriptionIdToRenew,
|
|
16397
|
+
address_id: product.address_required ? addressId : null,
|
|
16398
|
+
...params
|
|
16399
|
+
}, (err, res) => {
|
|
16400
|
+
callback(err, res);
|
|
16401
|
+
});
|
|
16402
|
+
}
|
|
16403
|
+
});
|
|
16404
|
+
_classPrivateFieldInitSpec$1(this, _createGiftedSubscription5, {
|
|
16405
|
+
writable: true,
|
|
16406
|
+
value: (options, callback) => {
|
|
16407
|
+
const {
|
|
16408
|
+
token,
|
|
16409
|
+
plan,
|
|
16410
|
+
couponCode,
|
|
16411
|
+
product,
|
|
16412
|
+
giftRecipient,
|
|
16413
|
+
quantity = 1,
|
|
16414
|
+
addressId,
|
|
16415
|
+
isExistingSource
|
|
16416
|
+
} = options;
|
|
16417
|
+
const params = isExistingSource ? {
|
|
16418
|
+
source_id: token
|
|
16419
|
+
} : {
|
|
16420
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16421
|
+
gateway_token: token
|
|
16422
|
+
};
|
|
16423
|
+
window.Pelcro.subscription.create({
|
|
16424
|
+
quantity,
|
|
16425
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16426
|
+
plan_id: plan.id,
|
|
16427
|
+
coupon_code: couponCode,
|
|
16428
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16429
|
+
gift_recipient_email: giftRecipient.email,
|
|
16430
|
+
gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
|
|
16431
|
+
gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
|
|
16432
|
+
gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
|
|
16433
|
+
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
16434
|
+
address_id: product.address_required ? addressId : null,
|
|
16435
|
+
...params
|
|
16436
|
+
}, (err, res) => {
|
|
16437
|
+
callback(err, res);
|
|
16438
|
+
});
|
|
16439
|
+
}
|
|
16440
|
+
});
|
|
16441
|
+
_classPrivateFieldInitSpec$1(this, _renewGiftedSubscription4, {
|
|
16442
|
+
writable: true,
|
|
16443
|
+
value: (options, callback) => {
|
|
16444
|
+
const {
|
|
16445
|
+
subscriptionIdToRenew,
|
|
16446
|
+
token,
|
|
16447
|
+
product,
|
|
16448
|
+
plan,
|
|
16449
|
+
couponCode,
|
|
16450
|
+
addressId,
|
|
16451
|
+
isExistingSource
|
|
16452
|
+
} = options;
|
|
16453
|
+
const params = isExistingSource ? {
|
|
16454
|
+
source_id: token
|
|
16455
|
+
} : {
|
|
16456
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16457
|
+
gateway_token: token
|
|
16458
|
+
};
|
|
16459
|
+
window.Pelcro.subscription.renewGift({
|
|
16460
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16461
|
+
plan_id: plan.id,
|
|
16462
|
+
coupon_code: couponCode,
|
|
16463
|
+
subscription_id: subscriptionIdToRenew,
|
|
16464
|
+
address_id: product.address_required ? addressId : null,
|
|
16465
|
+
...params
|
|
16466
|
+
}, (err, res) => {
|
|
16467
|
+
callback(err, res);
|
|
16468
|
+
});
|
|
16469
|
+
}
|
|
16470
|
+
});
|
|
16471
|
+
_classPrivateFieldInitSpec$1(this, _purchaseEcommerceOrder4, {
|
|
16472
|
+
writable: true,
|
|
16473
|
+
value: (options, callback) => {
|
|
16474
|
+
const {
|
|
16475
|
+
token,
|
|
16476
|
+
items,
|
|
16477
|
+
couponCode,
|
|
16478
|
+
addressId,
|
|
16479
|
+
isExistingSource
|
|
16480
|
+
} = options;
|
|
16481
|
+
const params = isExistingSource ? {
|
|
16482
|
+
source_id: token
|
|
16483
|
+
} : {
|
|
16484
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16485
|
+
gateway_token: token
|
|
16486
|
+
};
|
|
16487
|
+
window.Pelcro.ecommerce.order.create({
|
|
16488
|
+
items,
|
|
16489
|
+
coupon_code: couponCode,
|
|
16490
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16491
|
+
...params,
|
|
16492
|
+
...(addressId && {
|
|
16493
|
+
address_id: addressId
|
|
16494
|
+
})
|
|
16495
|
+
}, (err, res) => {
|
|
16496
|
+
callback(err, res);
|
|
16497
|
+
});
|
|
16498
|
+
}
|
|
16499
|
+
});
|
|
16500
|
+
_classPrivateFieldInitSpec$1(this, _payInvoice5, {
|
|
16501
|
+
writable: true,
|
|
16502
|
+
value: (options, callback) => {
|
|
16503
|
+
const {
|
|
16504
|
+
token,
|
|
16505
|
+
invoiceId
|
|
16506
|
+
} = options;
|
|
16507
|
+
const params = options.isExistingSource ? {
|
|
16508
|
+
source_id: token,
|
|
16509
|
+
invoice_id: invoiceId
|
|
16510
|
+
} : {
|
|
16511
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16512
|
+
gateway_token: token,
|
|
16513
|
+
invoice_id: invoiceId
|
|
16514
|
+
};
|
|
16515
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
16516
|
+
callback(err, res);
|
|
16517
|
+
});
|
|
16518
|
+
}
|
|
16519
|
+
});
|
|
16520
|
+
}
|
|
16521
|
+
}
|
|
16522
|
+
|
|
16296
16523
|
/**
|
|
16297
16524
|
* @typedef {Object} PaymentStateType
|
|
16298
16525
|
* @property {boolean} disableSubmit
|
|
@@ -16332,6 +16559,8 @@ const initialState$k = {
|
|
|
16332
16559
|
firstNameError: null,
|
|
16333
16560
|
lastNameError: null,
|
|
16334
16561
|
phoneError: null,
|
|
16562
|
+
month: "",
|
|
16563
|
+
year: "",
|
|
16335
16564
|
alert: {
|
|
16336
16565
|
type: "error",
|
|
16337
16566
|
content: ""
|
|
@@ -16397,37 +16626,38 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16397
16626
|
updateTotalAmountWithTax();
|
|
16398
16627
|
}, []);
|
|
16399
16628
|
|
|
16400
|
-
/*====== Start
|
|
16401
|
-
const
|
|
16402
|
-
var
|
|
16629
|
+
/*====== Start Cybersource integration ========*/
|
|
16630
|
+
const cybersourceErrorHandle = err => {
|
|
16631
|
+
var _err$details, _err$details$response;
|
|
16632
|
+
const errorMessages = [];
|
|
16633
|
+
|
|
16634
|
+
// enumerable error (ex: validation errors)
|
|
16635
|
+
Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
|
|
16636
|
+
let {
|
|
16637
|
+
message
|
|
16638
|
+
} = _ref2;
|
|
16639
|
+
errorMessages.push(message);
|
|
16640
|
+
});
|
|
16641
|
+
|
|
16642
|
+
// convert to multiline string
|
|
16643
|
+
return errorMessages.join("\n");
|
|
16644
|
+
};
|
|
16645
|
+
const submitUsingCybersource = (state, dispatch) => {
|
|
16646
|
+
var _cybersourceInstanceR;
|
|
16403
16647
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16404
16648
|
if (isUsingExistingPaymentMethod) {
|
|
16405
|
-
// no need to create a new source using
|
|
16406
|
-
return
|
|
16649
|
+
// no need to create a new source using cybersrce
|
|
16650
|
+
return handleCybersourcePayment(null, state);
|
|
16407
16651
|
}
|
|
16408
|
-
if (!
|
|
16409
|
-
return console.error("
|
|
16652
|
+
if (!cybersourceInstanceRef.current) {
|
|
16653
|
+
return console.error("Cybersource sdk script wasn't loaded, you need to load Cybersource sdk before rendering the Cybersource payment flow");
|
|
16410
16654
|
}
|
|
16411
|
-
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
}
|
|
16415
|
-
const isQuickPurchase = !Array.isArray(order);
|
|
16416
|
-
if (isQuickPurchase) {
|
|
16417
|
-
return order.price * order.quantity;
|
|
16418
|
-
}
|
|
16419
|
-
if (order.length === 0) {
|
|
16420
|
-
return null;
|
|
16421
|
-
}
|
|
16422
|
-
return order.reduce((total, item) => {
|
|
16423
|
-
return total + item.price * item.quantity;
|
|
16424
|
-
}, 0);
|
|
16655
|
+
let options = {
|
|
16656
|
+
cardExpirationMonth: state.month,
|
|
16657
|
+
cardExpirationYear: state.year
|
|
16425
16658
|
};
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
if (result.error) {
|
|
16429
|
-
// Inform the user if there was an error
|
|
16430
|
-
onFailure(result.error);
|
|
16659
|
+
(_cybersourceInstanceR = cybersourceInstanceRef.current) === null || _cybersourceInstanceR === void 0 ? void 0 : _cybersourceInstanceR.createToken(options, function (err, response) {
|
|
16660
|
+
if (err) {
|
|
16431
16661
|
dispatch({
|
|
16432
16662
|
type: DISABLE_SUBMIT,
|
|
16433
16663
|
payload: false
|
|
@@ -16440,37 +16670,277 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16440
16670
|
type: SHOW_ALERT,
|
|
16441
16671
|
payload: {
|
|
16442
16672
|
type: "error",
|
|
16443
|
-
content:
|
|
16673
|
+
content: cybersourceErrorHandle(err)
|
|
16444
16674
|
}
|
|
16445
16675
|
});
|
|
16446
|
-
}
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16676
|
+
}
|
|
16677
|
+
handleCybersourcePayment(response.token, state);
|
|
16678
|
+
});
|
|
16679
|
+
};
|
|
16680
|
+
function handleCybersourcePayment(paymentRequest, state) {
|
|
16681
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16682
|
+
if (type === "createPayment") {
|
|
16683
|
+
handleCybersourceSubscription();
|
|
16684
|
+
} else if (type === "orderCreate") {
|
|
16685
|
+
purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
16686
|
+
} else if (type === "invoicePayment") {
|
|
16687
|
+
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
16688
|
+
} else if (type === "updatePaymentSource") {
|
|
16689
|
+
createNewCybersourceCard();
|
|
16690
|
+
}
|
|
16691
|
+
function createNewCybersourceCard() {
|
|
16692
|
+
window.Pelcro.source.create({
|
|
16693
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16694
|
+
token: paymentRequest,
|
|
16695
|
+
gateway: "cybersource"
|
|
16696
|
+
}, (err, res) => {
|
|
16697
|
+
dispatch({
|
|
16698
|
+
type: DISABLE_SUBMIT,
|
|
16699
|
+
payload: false
|
|
16700
|
+
});
|
|
16701
|
+
dispatch({
|
|
16702
|
+
type: LOADING,
|
|
16703
|
+
payload: false
|
|
16704
|
+
});
|
|
16705
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
16706
|
+
if (err) {
|
|
16707
|
+
onFailure(err);
|
|
16708
|
+
return dispatch({
|
|
16709
|
+
type: SHOW_ALERT,
|
|
16710
|
+
payload: {
|
|
16711
|
+
type: "error",
|
|
16712
|
+
content: getErrorMessages(err)
|
|
16713
|
+
}
|
|
16714
|
+
});
|
|
16715
|
+
}
|
|
16716
|
+
dispatch({
|
|
16717
|
+
type: SHOW_ALERT,
|
|
16718
|
+
payload: {
|
|
16719
|
+
type: "success",
|
|
16720
|
+
content: t("messages.sourceUpdated")
|
|
16721
|
+
}
|
|
16722
|
+
});
|
|
16723
|
+
onSuccess(res);
|
|
16724
|
+
} //
|
|
16725
|
+
);
|
|
16726
|
+
}
|
|
16727
|
+
|
|
16728
|
+
function handleCybersourceSubscription() {
|
|
16729
|
+
const payment = new Payment(new CybersourceGateway());
|
|
16730
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
16731
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16732
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16733
|
+
const renewGift = isRenewingGift;
|
|
16734
|
+
const {
|
|
16735
|
+
couponCode
|
|
16736
|
+
} = state;
|
|
16737
|
+
if (renewGift) {
|
|
16738
|
+
return payment.execute({
|
|
16739
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
16740
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16741
|
+
plan,
|
|
16742
|
+
couponCode,
|
|
16743
|
+
product,
|
|
16744
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16745
|
+
subscriptionIdToRenew,
|
|
16746
|
+
addressId: selectedAddressId
|
|
16747
|
+
}, (err, res) => {
|
|
16748
|
+
if (err) {
|
|
16749
|
+
return handlePaymentError(err);
|
|
16750
|
+
}
|
|
16751
|
+
onSuccess(res);
|
|
16752
|
+
});
|
|
16753
|
+
} else if (giftSubscriprition) {
|
|
16754
|
+
return payment.execute({
|
|
16755
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
16756
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16757
|
+
quantity: plan.quantity,
|
|
16758
|
+
plan,
|
|
16759
|
+
couponCode,
|
|
16760
|
+
product,
|
|
16761
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16762
|
+
giftRecipient,
|
|
16763
|
+
addressId: selectedAddressId
|
|
16764
|
+
}, (err, res) => {
|
|
16765
|
+
if (err) {
|
|
16766
|
+
return handlePaymentError(err);
|
|
16767
|
+
}
|
|
16768
|
+
onSuccess(res);
|
|
16769
|
+
});
|
|
16770
|
+
} else if (renewSubscription) {
|
|
16771
|
+
return payment.execute({
|
|
16772
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
16773
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16774
|
+
quantity: plan.quantity,
|
|
16775
|
+
plan,
|
|
16776
|
+
couponCode,
|
|
16777
|
+
product,
|
|
16778
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16779
|
+
subscriptionIdToRenew,
|
|
16780
|
+
addressId: selectedAddressId
|
|
16781
|
+
}, (err, res) => {
|
|
16782
|
+
if (err) {
|
|
16783
|
+
return handlePaymentError(err);
|
|
16784
|
+
}
|
|
16785
|
+
onSuccess(res);
|
|
16786
|
+
});
|
|
16787
|
+
} else if (createSubscription) {
|
|
16788
|
+
return payment.execute({
|
|
16789
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
16790
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16791
|
+
quantity: plan.quantity,
|
|
16792
|
+
plan,
|
|
16793
|
+
couponCode,
|
|
16794
|
+
product,
|
|
16795
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16796
|
+
addressId: selectedAddressId
|
|
16797
|
+
}, (err, res) => {
|
|
16798
|
+
if (err) {
|
|
16799
|
+
return handlePaymentError(err);
|
|
16800
|
+
}
|
|
16801
|
+
onSuccess(res);
|
|
16802
|
+
});
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16805
|
+
}
|
|
16806
|
+
const tokenizeCard = (error, microformInstance) => {
|
|
16807
|
+
if (error) {
|
|
16808
|
+
return;
|
|
16809
|
+
}
|
|
16810
|
+
cybersourceInstanceRef.current = microformInstance;
|
|
16811
|
+
};
|
|
16812
|
+
const initCybersourceScript = () => {
|
|
16813
|
+
// jwk api call
|
|
16814
|
+
window.Pelcro.payment.getJWK({
|
|
16815
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16816
|
+
site_id: window.Pelcro.siteid
|
|
16817
|
+
}, (err, res) => {
|
|
16818
|
+
if (err) {
|
|
16819
|
+
onFailure(err);
|
|
16820
|
+
dispatch({
|
|
16821
|
+
type: DISABLE_SUBMIT,
|
|
16822
|
+
payload: false
|
|
16823
|
+
});
|
|
16824
|
+
dispatch({
|
|
16825
|
+
type: LOADING,
|
|
16826
|
+
payload: false
|
|
16827
|
+
});
|
|
16828
|
+
return dispatch({
|
|
16829
|
+
type: SHOW_ALERT,
|
|
16830
|
+
payload: {
|
|
16831
|
+
type: "error",
|
|
16832
|
+
content: getErrorMessages(err)
|
|
16833
|
+
}
|
|
16834
|
+
});
|
|
16835
|
+
}
|
|
16836
|
+
const {
|
|
16837
|
+
key: jwk
|
|
16838
|
+
} = res;
|
|
16839
|
+
// SETUP MICROFORM
|
|
16840
|
+
FLEX.microform({
|
|
16841
|
+
keyId: jwk.kid,
|
|
16842
|
+
keystore: jwk,
|
|
16843
|
+
container: "#cybersourceCardNumber",
|
|
16844
|
+
placeholder: "Card Number",
|
|
16845
|
+
styles: {
|
|
16846
|
+
input: {
|
|
16847
|
+
"font-size": "14px",
|
|
16848
|
+
"font-family": "helvetica, tahoma, calibri, sans-serif",
|
|
16849
|
+
color: "#555"
|
|
16850
|
+
},
|
|
16851
|
+
":focus": {
|
|
16852
|
+
color: "blue"
|
|
16853
|
+
},
|
|
16854
|
+
":disabled": {
|
|
16855
|
+
cursor: "not-allowed"
|
|
16856
|
+
},
|
|
16857
|
+
valid: {
|
|
16858
|
+
color: "#3c763d"
|
|
16859
|
+
},
|
|
16860
|
+
invalid: {
|
|
16861
|
+
color: "#a94442"
|
|
16862
|
+
}
|
|
16863
|
+
}
|
|
16864
|
+
}, tokenizeCard);
|
|
16865
|
+
});
|
|
16866
|
+
};
|
|
16867
|
+
|
|
16868
|
+
/*====== End Cybersource integration ========*/
|
|
16869
|
+
|
|
16870
|
+
/*====== Start Tap integration ========*/
|
|
16871
|
+
const submitUsingTap = state => {
|
|
16872
|
+
var _ref3, _ref4, _ref5, _state$updatedPrice;
|
|
16873
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16874
|
+
if (isUsingExistingPaymentMethod) {
|
|
16875
|
+
// no need to create a new source using tap
|
|
16876
|
+
return handleTapPayment(null, state);
|
|
16877
|
+
}
|
|
16878
|
+
if (!tapInstanceRef.current) {
|
|
16879
|
+
return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
|
|
16880
|
+
}
|
|
16881
|
+
const getOrderItemsTotal = () => {
|
|
16882
|
+
if (!order) {
|
|
16883
|
+
return null;
|
|
16884
|
+
}
|
|
16885
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
16886
|
+
if (isQuickPurchase) {
|
|
16887
|
+
return order.price * order.quantity;
|
|
16888
|
+
}
|
|
16889
|
+
if (order.length === 0) {
|
|
16890
|
+
return null;
|
|
16891
|
+
}
|
|
16892
|
+
return order.reduce((total, item) => {
|
|
16893
|
+
return total + item.price * item.quantity;
|
|
16894
|
+
}, 0);
|
|
16895
|
+
};
|
|
16896
|
+
const totalAmount = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref5 !== void 0 ? _ref5 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref4 !== void 0 ? _ref4 : getOrderItemsTotal()) !== null && _ref3 !== void 0 ? _ref3 : 10;
|
|
16897
|
+
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
16898
|
+
if (result.error) {
|
|
16899
|
+
// Inform the user if there was an error
|
|
16900
|
+
onFailure(result.error);
|
|
16901
|
+
dispatch({
|
|
16902
|
+
type: DISABLE_SUBMIT,
|
|
16903
|
+
payload: false
|
|
16904
|
+
});
|
|
16905
|
+
dispatch({
|
|
16906
|
+
type: LOADING,
|
|
16907
|
+
payload: false
|
|
16908
|
+
});
|
|
16909
|
+
return dispatch({
|
|
16910
|
+
type: SHOW_ALERT,
|
|
16911
|
+
payload: {
|
|
16912
|
+
type: "error",
|
|
16913
|
+
content: getErrorMessages(result.error)
|
|
16914
|
+
}
|
|
16915
|
+
});
|
|
16916
|
+
} else {
|
|
16917
|
+
window.Pelcro.payment.verify({
|
|
16918
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16919
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
16920
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
16921
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
16922
|
+
site_id: window.Pelcro.siteid,
|
|
16923
|
+
amount: totalAmount,
|
|
16924
|
+
currency: (plan === null || plan === void 0 ? void 0 : plan.currency) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency) || window.Pelcro.site.read().default_currency,
|
|
16925
|
+
tap_token: result.id,
|
|
16926
|
+
funding: result.card.funding,
|
|
16927
|
+
redirect_url: `${window.Pelcro.environment.domain}/webhook/tap/callback/3dsecure?auth_token=${window.Pelcro.user.read().auth_token}&type=verify_card&site_id=${window.Pelcro.siteid}`
|
|
16928
|
+
}, (err, res) => {
|
|
16929
|
+
if (err) {
|
|
16930
|
+
// Inform the user if there was an error
|
|
16931
|
+
onFailure(err);
|
|
16932
|
+
dispatch({
|
|
16933
|
+
type: DISABLE_SUBMIT,
|
|
16934
|
+
payload: false
|
|
16935
|
+
});
|
|
16936
|
+
dispatch({
|
|
16937
|
+
type: LOADING,
|
|
16938
|
+
payload: false
|
|
16939
|
+
});
|
|
16940
|
+
return dispatch({
|
|
16941
|
+
type: SHOW_ALERT,
|
|
16942
|
+
payload: {
|
|
16943
|
+
type: "error",
|
|
16474
16944
|
content: getErrorMessages(err)
|
|
16475
16945
|
}
|
|
16476
16946
|
});
|
|
@@ -16688,7 +17158,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16688
17158
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16689
17159
|
if (isUsingExistingPaymentMethod) {
|
|
16690
17160
|
// no need to create a new source using vantiv
|
|
16691
|
-
return handleVantivPayment(null);
|
|
17161
|
+
return handleVantivPayment(null, state.couponCode);
|
|
16692
17162
|
}
|
|
16693
17163
|
if (!vantivInstanceRef.current) {
|
|
16694
17164
|
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
@@ -16840,8 +17310,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16840
17310
|
const vantivInstanceRef = React__default['default'].useRef(null);
|
|
16841
17311
|
const tapInstanceRef = React__default['default'].useRef(null);
|
|
16842
17312
|
const tapInstanceCard = React__default['default'].useRef(null);
|
|
17313
|
+
const cybersourceInstanceRef = React__default['default'].useRef(null);
|
|
16843
17314
|
React.useEffect(() => {
|
|
16844
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17315
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16845
17316
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
16846
17317
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
16847
17318
|
const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
|
|
@@ -16877,7 +17348,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16877
17348
|
}, [vantivPaymentRequest]);
|
|
16878
17349
|
React.useEffect(() => {
|
|
16879
17350
|
whenUserReady(() => {
|
|
16880
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17351
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16881
17352
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
16882
17353
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
16883
17354
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -16888,10 +17359,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16888
17359
|
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
16889
17360
|
initTapScript();
|
|
16890
17361
|
}
|
|
17362
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
|
|
17363
|
+
window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
|
|
17364
|
+
document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
|
|
17365
|
+
initCybersourceScript();
|
|
17366
|
+
});
|
|
17367
|
+
}
|
|
17368
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
|
|
17369
|
+
initCybersourceScript();
|
|
17370
|
+
}
|
|
16891
17371
|
});
|
|
16892
17372
|
}, [selectedPaymentMethodId]);
|
|
16893
17373
|
const initPaymentRequest = (state, dispatch) => {
|
|
16894
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17374
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16895
17375
|
try {
|
|
16896
17376
|
const paymentRequest = stripe.paymentRequest({
|
|
16897
17377
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16903,13 +17383,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16903
17383
|
});
|
|
16904
17384
|
|
|
16905
17385
|
// When Google pay / Apple pay source created
|
|
16906
|
-
paymentRequest.on("source",
|
|
17386
|
+
paymentRequest.on("source", _ref6 => {
|
|
16907
17387
|
var _source$card;
|
|
16908
17388
|
let {
|
|
16909
17389
|
complete,
|
|
16910
17390
|
source,
|
|
16911
17391
|
...data
|
|
16912
|
-
} =
|
|
17392
|
+
} = _ref6;
|
|
16913
17393
|
dispatch({
|
|
16914
17394
|
type: DISABLE_COUPON_BUTTON,
|
|
16915
17395
|
payload: true
|
|
@@ -16924,11 +17404,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16924
17404
|
});
|
|
16925
17405
|
complete("success");
|
|
16926
17406
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
16927
|
-
return generate3DSecureSource(source).then(
|
|
17407
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
16928
17408
|
let {
|
|
16929
17409
|
source,
|
|
16930
17410
|
error
|
|
16931
|
-
} =
|
|
17411
|
+
} = _ref7;
|
|
16932
17412
|
if (error) {
|
|
16933
17413
|
return handlePaymentError(error);
|
|
16934
17414
|
}
|
|
@@ -16960,7 +17440,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16960
17440
|
*/
|
|
16961
17441
|
const updateTotalAmountWithTax = () => {
|
|
16962
17442
|
var _window$Pelcro$site$r4;
|
|
16963
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17443
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16964
17444
|
const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
|
|
16965
17445
|
if (taxesEnabled && type === "createPayment") {
|
|
16966
17446
|
dispatch({
|
|
@@ -17235,6 +17715,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17235
17715
|
type: LOADING,
|
|
17236
17716
|
payload: false
|
|
17237
17717
|
});
|
|
17718
|
+
onFailure(error);
|
|
17238
17719
|
return dispatch({
|
|
17239
17720
|
type: SHOW_ALERT,
|
|
17240
17721
|
payload: {
|
|
@@ -17457,16 +17938,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17457
17938
|
items: mappedOrderItems,
|
|
17458
17939
|
addressId: selectedAddressId,
|
|
17459
17940
|
couponCode
|
|
17460
|
-
}, (err,
|
|
17461
|
-
|
|
17462
|
-
type: DISABLE_SUBMIT,
|
|
17463
|
-
payload: false
|
|
17464
|
-
});
|
|
17465
|
-
dispatch({
|
|
17466
|
-
type: LOADING,
|
|
17467
|
-
payload: false
|
|
17468
|
-
});
|
|
17941
|
+
}, (err, orderResponse) => {
|
|
17942
|
+
var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
|
|
17469
17943
|
if (err) {
|
|
17944
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17945
|
+
dispatch({
|
|
17946
|
+
type: DISABLE_SUBMIT,
|
|
17947
|
+
payload: false
|
|
17948
|
+
});
|
|
17949
|
+
dispatch({
|
|
17950
|
+
type: LOADING,
|
|
17951
|
+
payload: false
|
|
17952
|
+
});
|
|
17470
17953
|
onFailure(err);
|
|
17471
17954
|
return dispatch({
|
|
17472
17955
|
type: SHOW_ALERT,
|
|
@@ -17486,7 +17969,30 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17486
17969
|
cartItems: []
|
|
17487
17970
|
});
|
|
17488
17971
|
}
|
|
17489
|
-
|
|
17972
|
+
window.Pelcro.user.refresh({
|
|
17973
|
+
auth_token: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : _window$Pelcro2$user$.auth_token
|
|
17974
|
+
}, (err, res) => {
|
|
17975
|
+
dispatch({
|
|
17976
|
+
type: DISABLE_SUBMIT,
|
|
17977
|
+
payload: false
|
|
17978
|
+
});
|
|
17979
|
+
dispatch({
|
|
17980
|
+
type: LOADING,
|
|
17981
|
+
payload: false
|
|
17982
|
+
});
|
|
17983
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17984
|
+
if (err) {
|
|
17985
|
+
onFailure(err);
|
|
17986
|
+
return dispatch({
|
|
17987
|
+
type: SHOW_ALERT,
|
|
17988
|
+
payload: {
|
|
17989
|
+
type: "error",
|
|
17990
|
+
content: getErrorMessages(err)
|
|
17991
|
+
}
|
|
17992
|
+
});
|
|
17993
|
+
}
|
|
17994
|
+
onSuccess(orderResponse);
|
|
17995
|
+
});
|
|
17490
17996
|
});
|
|
17491
17997
|
};
|
|
17492
17998
|
const payInvoice = (gatewayService, gatewayToken, dispatch) => {
|
|
@@ -17503,12 +18009,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17503
18009
|
const updatePaymentSource = (state, dispatch) => {
|
|
17504
18010
|
return stripe.createSource({
|
|
17505
18011
|
type: "card"
|
|
17506
|
-
}).then(
|
|
18012
|
+
}).then(_ref8 => {
|
|
17507
18013
|
var _source$card2;
|
|
17508
18014
|
let {
|
|
17509
18015
|
source,
|
|
17510
18016
|
error
|
|
17511
|
-
} =
|
|
18017
|
+
} = _ref8;
|
|
17512
18018
|
if (error) {
|
|
17513
18019
|
return handlePaymentError(error);
|
|
17514
18020
|
}
|
|
@@ -17564,7 +18070,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17564
18070
|
});
|
|
17565
18071
|
};
|
|
17566
18072
|
const submitPayment = (state, dispatch) => {
|
|
17567
|
-
if (skipPayment &&
|
|
18073
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17568
18074
|
const isQuickPurchase = !Array.isArray(order);
|
|
17569
18075
|
const mappedOrderItems = isQuickPurchase ? [{
|
|
17570
18076
|
sku_id: order.id,
|
|
@@ -17589,12 +18095,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17589
18095
|
}
|
|
17590
18096
|
stripe.createSource({
|
|
17591
18097
|
type: "card"
|
|
17592
|
-
}).then(
|
|
17593
|
-
var
|
|
18098
|
+
}).then(_ref9 => {
|
|
18099
|
+
var _ref10, _ref11, _state$updatedPrice2;
|
|
17594
18100
|
let {
|
|
17595
18101
|
source,
|
|
17596
18102
|
error
|
|
17597
|
-
} =
|
|
18103
|
+
} = _ref9;
|
|
17598
18104
|
if (error) {
|
|
17599
18105
|
return handlePaymentError(error);
|
|
17600
18106
|
}
|
|
@@ -17613,7 +18119,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17613
18119
|
return total + item.price * item.quantity;
|
|
17614
18120
|
}, 0);
|
|
17615
18121
|
};
|
|
17616
|
-
(
|
|
18122
|
+
(_ref10 = (_ref11 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref11 !== void 0 ? _ref11 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref10 !== void 0 ? _ref10 : getOrderItemsTotal();
|
|
17617
18123
|
return handlePayment(source);
|
|
17618
18124
|
}).catch(error => {
|
|
17619
18125
|
return handlePaymentError(error);
|
|
@@ -17820,15 +18326,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17820
18326
|
disableSubmit: true,
|
|
17821
18327
|
isLoading: true
|
|
17822
18328
|
}, (state, dispatch) => {
|
|
17823
|
-
if (skipPayment &&
|
|
18329
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17824
18330
|
return submitPayment(state);
|
|
17825
18331
|
}
|
|
17826
18332
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17827
|
-
return submitUsingVantiv();
|
|
18333
|
+
return submitUsingVantiv(state);
|
|
17828
18334
|
}
|
|
17829
18335
|
if (getSiteCardProcessor() === "tap") {
|
|
17830
18336
|
return submitUsingTap(state);
|
|
17831
18337
|
}
|
|
18338
|
+
if (getSiteCardProcessor() === "cybersource") {
|
|
18339
|
+
return submitUsingCybersource(state, dispatch);
|
|
18340
|
+
}
|
|
17832
18341
|
if (selectedPaymentMethodId) {
|
|
17833
18342
|
// pay with selected method (source) if exists already
|
|
17834
18343
|
return handlePayment({
|
|
@@ -17896,6 +18405,16 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17896
18405
|
...state,
|
|
17897
18406
|
percentOff: action.payload
|
|
17898
18407
|
});
|
|
18408
|
+
case SET_MONTH:
|
|
18409
|
+
return lib_7({
|
|
18410
|
+
...state,
|
|
18411
|
+
month: action.payload
|
|
18412
|
+
});
|
|
18413
|
+
case SET_YEAR:
|
|
18414
|
+
return lib_7({
|
|
18415
|
+
...state,
|
|
18416
|
+
year: action.payload
|
|
18417
|
+
});
|
|
17899
18418
|
case SET_FIRST_NAME:
|
|
17900
18419
|
return lib_7({
|
|
17901
18420
|
...state,
|
|
@@ -17986,13 +18505,122 @@ const PaymentMethodContainer = props => {
|
|
|
17986
18505
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
17987
18506
|
store: store$k
|
|
17988
18507
|
}, props))));
|
|
17989
|
-
} else {
|
|
18508
|
+
} else if (cardProcessor !== "stripe") {
|
|
17990
18509
|
return /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
17991
18510
|
store: store$k
|
|
17992
18511
|
}, props));
|
|
17993
18512
|
}
|
|
18513
|
+
return null;
|
|
17994
18514
|
};
|
|
17995
18515
|
|
|
18516
|
+
function Select(_ref) {
|
|
18517
|
+
let {
|
|
18518
|
+
label = "",
|
|
18519
|
+
required,
|
|
18520
|
+
id,
|
|
18521
|
+
errorId,
|
|
18522
|
+
error = "",
|
|
18523
|
+
className = "",
|
|
18524
|
+
labelClassName = "",
|
|
18525
|
+
errorClassName = "",
|
|
18526
|
+
wrapperClassName = "",
|
|
18527
|
+
children,
|
|
18528
|
+
...otherProps
|
|
18529
|
+
} = _ref;
|
|
18530
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18531
|
+
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
18532
|
+
}, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
18533
|
+
htmlFor: id,
|
|
18534
|
+
className: `pelcro-input-label ${labelClassName}`
|
|
18535
|
+
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default['default'].createElement("select", Object.assign({
|
|
18536
|
+
id: id,
|
|
18537
|
+
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
18538
|
+
"aria-describedby": errorId,
|
|
18539
|
+
"aria-invalid": Boolean(error)
|
|
18540
|
+
}, otherProps), children), error && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18541
|
+
id: errorId,
|
|
18542
|
+
"aria-live": "assertive",
|
|
18543
|
+
className: `pelcro-input-error ${errorClassName}`
|
|
18544
|
+
}, error));
|
|
18545
|
+
}
|
|
18546
|
+
|
|
18547
|
+
function MonthSelect(_ref) {
|
|
18548
|
+
let {
|
|
18549
|
+
placeholder,
|
|
18550
|
+
store,
|
|
18551
|
+
...otherProps
|
|
18552
|
+
} = _ref;
|
|
18553
|
+
const {
|
|
18554
|
+
dispatch,
|
|
18555
|
+
state: {
|
|
18556
|
+
month
|
|
18557
|
+
}
|
|
18558
|
+
} = React.useContext(store);
|
|
18559
|
+
const get2digits = num => num < 10 ? "0" + num.toString() : num.toString();
|
|
18560
|
+
const createMonthsItems = React.useMemo(() => {
|
|
18561
|
+
return [...Array.from({
|
|
18562
|
+
length: 12
|
|
18563
|
+
}, (_, i) => i + 1)].map(i => {
|
|
18564
|
+
return /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18565
|
+
key: i,
|
|
18566
|
+
value: get2digits(i)
|
|
18567
|
+
}, get2digits(i));
|
|
18568
|
+
});
|
|
18569
|
+
}, []);
|
|
18570
|
+
const handleInputChange = value => {
|
|
18571
|
+
dispatch({
|
|
18572
|
+
type: SET_MONTH,
|
|
18573
|
+
payload: value
|
|
18574
|
+
});
|
|
18575
|
+
};
|
|
18576
|
+
return /*#__PURE__*/React__default['default'].createElement(Select, Object.assign({
|
|
18577
|
+
value: month,
|
|
18578
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18579
|
+
}, otherProps), /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18580
|
+
value: "",
|
|
18581
|
+
disabled: true,
|
|
18582
|
+
selected: true
|
|
18583
|
+
}, placeholder), createMonthsItems);
|
|
18584
|
+
}
|
|
18585
|
+
|
|
18586
|
+
function YearSelect(_ref) {
|
|
18587
|
+
let {
|
|
18588
|
+
placeholder,
|
|
18589
|
+
store,
|
|
18590
|
+
...otherProps
|
|
18591
|
+
} = _ref;
|
|
18592
|
+
const {
|
|
18593
|
+
dispatch,
|
|
18594
|
+
state: {
|
|
18595
|
+
year
|
|
18596
|
+
}
|
|
18597
|
+
} = React.useContext(store);
|
|
18598
|
+
const createYearsItems = React.useMemo(() => {
|
|
18599
|
+
return Array.from({
|
|
18600
|
+
length: 10
|
|
18601
|
+
}, (_, i) => i + new Date().getFullYear()).map(i => {
|
|
18602
|
+
return /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18603
|
+
key: i,
|
|
18604
|
+
value: i
|
|
18605
|
+
}, i);
|
|
18606
|
+
});
|
|
18607
|
+
}, []);
|
|
18608
|
+
const handleInputChange = value => {
|
|
18609
|
+
dispatch({
|
|
18610
|
+
type: SET_YEAR,
|
|
18611
|
+
payload: value
|
|
18612
|
+
});
|
|
18613
|
+
};
|
|
18614
|
+
return /*#__PURE__*/React__default['default'].createElement(Select, Object.assign({
|
|
18615
|
+
value: year,
|
|
18616
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18617
|
+
}, otherProps), /*#__PURE__*/React__default['default'].createElement("option", {
|
|
18618
|
+
value: "",
|
|
18619
|
+
disabled: true,
|
|
18620
|
+
selected: true
|
|
18621
|
+
}, placeholder), createYearsItems);
|
|
18622
|
+
}
|
|
18623
|
+
|
|
17996
18624
|
const StripeInputStyle = {
|
|
17997
18625
|
base: "plc-w-full plc-p-3 plc-border plc-border-gray-300 plc-appearance-none plc-outline-none plc-rounded-sm plc-bg-gray-50 pelcro-input-input",
|
|
17998
18626
|
focus: "plc-ring-2 plc-ring-primary-400",
|
|
@@ -18082,6 +18710,24 @@ const CheckoutForm = () => {
|
|
|
18082
18710
|
id: "tapPaymentIframe"
|
|
18083
18711
|
});
|
|
18084
18712
|
}
|
|
18713
|
+
if (cardProcessor === "cybersource") {
|
|
18714
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18715
|
+
id: "cybersourceCardNumber",
|
|
18716
|
+
className: "pelcro-input-field plc-h-12"
|
|
18717
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18718
|
+
className: "plc-flex plc-items-end plc-justify-between plc-my-2"
|
|
18719
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18720
|
+
className: "plc-w-6/12 plc-pr-4"
|
|
18721
|
+
}, /*#__PURE__*/React__default['default'].createElement(MonthSelect, {
|
|
18722
|
+
store: store$k,
|
|
18723
|
+
placeholder: "Exp Month"
|
|
18724
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18725
|
+
className: "plc-w-6/12"
|
|
18726
|
+
}, /*#__PURE__*/React__default['default'].createElement(YearSelect, {
|
|
18727
|
+
store: store$k,
|
|
18728
|
+
placeholder: "Exp Year"
|
|
18729
|
+
}))));
|
|
18730
|
+
}
|
|
18085
18731
|
if (cardProcessor === "stripe") {
|
|
18086
18732
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(PelcroCardNumber, {
|
|
18087
18733
|
autoFocus: true
|
|
@@ -18820,7 +19466,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
18820
19466
|
*
|
|
18821
19467
|
*/
|
|
18822
19468
|
function PaymentMethodView(_ref) {
|
|
18823
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
19469
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _calcAndFormatItemsTo, _order$;
|
|
18824
19470
|
let {
|
|
18825
19471
|
onSuccess,
|
|
18826
19472
|
onGiftRenewalSuccess,
|
|
@@ -18838,6 +19484,7 @@ function PaymentMethodView(_ref) {
|
|
|
18838
19484
|
const cardProcessor = getSiteCardProcessor();
|
|
18839
19485
|
const supportsVantiv = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings);
|
|
18840
19486
|
const supportsTap = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.tap_gateway_settings);
|
|
19487
|
+
const supportsCybersource = Boolean((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.cybersource_gateway_settings);
|
|
18841
19488
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
18842
19489
|
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
18843
19490
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
@@ -18847,11 +19494,13 @@ function PaymentMethodView(_ref) {
|
|
|
18847
19494
|
className: "plc-w-full plc-p-2 plc-mb-4 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
|
|
18848
19495
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18849
19496
|
className: "plc-text-gray-600"
|
|
18850
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19497
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19498
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
19499
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18851
19500
|
className: "plc-tracking-wider plc-uppercase"
|
|
18852
|
-
},
|
|
19501
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18853
19502
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18854
|
-
}, getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19503
|
+
}, (_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18855
19504
|
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
18856
19505
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
18857
19506
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -18867,7 +19516,8 @@ function PaymentMethodView(_ref) {
|
|
|
18867
19516
|
type: type,
|
|
18868
19517
|
onSuccess: onSuccess,
|
|
18869
19518
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18870
|
-
onFailure: onFailure
|
|
19519
|
+
onFailure: onFailure,
|
|
19520
|
+
freeOrders: showOrderButton
|
|
18871
19521
|
}, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
18872
19522
|
className: "plc-mb-2"
|
|
18873
19523
|
}), showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default['default'].createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -18892,7 +19542,7 @@ function PaymentMethodView(_ref) {
|
|
|
18892
19542
|
className: "plc-mb-2"
|
|
18893
19543
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18894
19544
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
18895
|
-
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null)))));
|
|
19545
|
+
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null)))));
|
|
18896
19546
|
}
|
|
18897
19547
|
|
|
18898
19548
|
const SubscriptionRenewView = _ref => {
|
|
@@ -21519,6 +22169,7 @@ const AddressCreateContainer = _ref => {
|
|
|
21519
22169
|
first_name: firstName,
|
|
21520
22170
|
last_name: lastName,
|
|
21521
22171
|
line1: line1,
|
|
22172
|
+
line2: line2,
|
|
21522
22173
|
city: city,
|
|
21523
22174
|
state: state,
|
|
21524
22175
|
country: country,
|
|
@@ -21913,37 +22564,6 @@ const AddressCreateSubmit = _ref => {
|
|
|
21913
22564
|
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
21914
22565
|
};
|
|
21915
22566
|
|
|
21916
|
-
function Select(_ref) {
|
|
21917
|
-
let {
|
|
21918
|
-
label = "",
|
|
21919
|
-
required,
|
|
21920
|
-
id,
|
|
21921
|
-
errorId,
|
|
21922
|
-
error = "",
|
|
21923
|
-
className = "",
|
|
21924
|
-
labelClassName = "",
|
|
21925
|
-
errorClassName = "",
|
|
21926
|
-
wrapperClassName = "",
|
|
21927
|
-
children,
|
|
21928
|
-
...otherProps
|
|
21929
|
-
} = _ref;
|
|
21930
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21931
|
-
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
21932
|
-
}, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
21933
|
-
htmlFor: id,
|
|
21934
|
-
className: `pelcro-input-label ${labelClassName}`
|
|
21935
|
-
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default['default'].createElement("select", Object.assign({
|
|
21936
|
-
id: id,
|
|
21937
|
-
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
21938
|
-
"aria-describedby": errorId,
|
|
21939
|
-
"aria-invalid": Boolean(error)
|
|
21940
|
-
}, otherProps), children), error && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
21941
|
-
id: errorId,
|
|
21942
|
-
"aria-live": "assertive",
|
|
21943
|
-
className: `pelcro-input-error ${errorClassName}`
|
|
21944
|
-
}, error));
|
|
21945
|
-
}
|
|
21946
|
-
|
|
21947
22567
|
function CountrySelect(_ref) {
|
|
21948
22568
|
let {
|
|
21949
22569
|
placeholder,
|
|
@@ -22346,6 +22966,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
22346
22966
|
first_name: firstName,
|
|
22347
22967
|
last_name: lastName,
|
|
22348
22968
|
line1: line1,
|
|
22969
|
+
line2: line2,
|
|
22349
22970
|
city: city,
|
|
22350
22971
|
state: state,
|
|
22351
22972
|
country: country,
|
|
@@ -24293,7 +24914,7 @@ const OrderCreateView = props => {
|
|
|
24293
24914
|
order
|
|
24294
24915
|
} = usePelcro();
|
|
24295
24916
|
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
24296
|
-
const showOrderButton = skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0;
|
|
24917
|
+
const showOrderButton = skipPayment && ((order === null || order === void 0 ? void 0 : order.price) === 0 || (order === null || order === void 0 ? void 0 : order.length) > 0 && order.every(item => (item === null || item === void 0 ? void 0 : item.price) === 0));
|
|
24297
24918
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24298
24919
|
id: "pelcro-order-create-view"
|
|
24299
24920
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -27627,7 +28248,7 @@ const InvoicesItems = () => {
|
|
|
27627
28248
|
setInvoice,
|
|
27628
28249
|
switchView
|
|
27629
28250
|
} = usePelcro();
|
|
27630
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28251
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
27631
28252
|
const showInvoiceDetails = event => {
|
|
27632
28253
|
if (setInvoice(event.target.dataset.id)) {
|
|
27633
28254
|
switchView("invoice-details");
|
|
@@ -28395,7 +29016,7 @@ class Dashboard extends React.Component {
|
|
|
28395
29016
|
}
|
|
28396
29017
|
function hasInvoices() {
|
|
28397
29018
|
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
28398
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
29019
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28399
29020
|
return invoices.length > 0;
|
|
28400
29021
|
}
|
|
28401
29022
|
function hasDonationSubs() {
|