@pelcro/react-pelcro-js 3.22.0-beta.9 → 3.22.1
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 +771 -140
- package/dist/index.esm.js +771 -140
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3427,7 +3427,8 @@ var labels$10 = {
|
|
|
3427
3427
|
removeCoupon: "REMOVE",
|
|
3428
3428
|
firstName: "First name",
|
|
3429
3429
|
lastName: "Last name",
|
|
3430
|
-
phone: "Phone"
|
|
3430
|
+
phone: "Phone",
|
|
3431
|
+
freeItems: "Free Items"
|
|
3431
3432
|
};
|
|
3432
3433
|
var checkoutForm_en = {
|
|
3433
3434
|
messages: messages$14,
|
|
@@ -4368,7 +4369,8 @@ var labels$H = {
|
|
|
4368
4369
|
removeCoupon: "RETIRER",
|
|
4369
4370
|
firstName: "Prénom",
|
|
4370
4371
|
lastName: "Nom de famille",
|
|
4371
|
-
phone: "Téléphoner"
|
|
4372
|
+
phone: "Téléphoner",
|
|
4373
|
+
freeItems: "Articles gratuits"
|
|
4372
4374
|
};
|
|
4373
4375
|
var checkoutForm_fr = {
|
|
4374
4376
|
messages: messages$M,
|
|
@@ -5195,7 +5197,8 @@ var labels$s = {
|
|
|
5195
5197
|
removeCoupon: "제거",
|
|
5196
5198
|
firstName: "이름",
|
|
5197
5199
|
lastName: "성",
|
|
5198
|
-
phone: "핸드폰"
|
|
5200
|
+
phone: "핸드폰",
|
|
5201
|
+
freeItems: "무료 아이템"
|
|
5199
5202
|
};
|
|
5200
5203
|
var checkoutForm_ko = {
|
|
5201
5204
|
messages: messages$v,
|
|
@@ -6126,7 +6129,8 @@ var labels$d = {
|
|
|
6126
6129
|
removeCoupon: "ELIMINAR",
|
|
6127
6130
|
firstName: "Nombre",
|
|
6128
6131
|
lastName: "Apellido",
|
|
6129
|
-
phone: "Teléfono"
|
|
6132
|
+
phone: "Teléfono",
|
|
6133
|
+
freeItems: "Artículos gratis"
|
|
6130
6134
|
};
|
|
6131
6135
|
var checkoutForm_es = {
|
|
6132
6136
|
messages: messages$e,
|
|
@@ -10843,13 +10847,16 @@ const debounce = (func, waitTime) => {
|
|
|
10843
10847
|
};
|
|
10844
10848
|
};
|
|
10845
10849
|
function getSiteCardProcessor() {
|
|
10846
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10850
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
10847
10851
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
|
|
10848
10852
|
return "vantiv";
|
|
10849
10853
|
}
|
|
10850
10854
|
if ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r2 !== void 0 && _window$Pelcro$site$r2.tap_gateway_settings) {
|
|
10851
10855
|
return "tap";
|
|
10852
10856
|
}
|
|
10857
|
+
if ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r3 !== void 0 && _window$Pelcro$site$r3.cybersource_gateway_settings) {
|
|
10858
|
+
return "cybersource";
|
|
10859
|
+
}
|
|
10853
10860
|
return "stripe";
|
|
10854
10861
|
}
|
|
10855
10862
|
|
|
@@ -11710,6 +11717,8 @@ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
|
11710
11717
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
11711
11718
|
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
11712
11719
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
11720
|
+
const SET_MONTH = "SET_MONTH";
|
|
11721
|
+
const SET_YEAR = "SET_YEAR";
|
|
11713
11722
|
const SET_TOKEN = "SET_TOKEN";
|
|
11714
11723
|
const SET_GIFT_CODE = "SET_GIFT_CODE";
|
|
11715
11724
|
const RESET_LOGIN_FORM = "RESET_LOGIN_FORM";
|
|
@@ -14049,6 +14058,7 @@ class SelectModal extends Component {
|
|
|
14049
14058
|
});
|
|
14050
14059
|
});
|
|
14051
14060
|
});
|
|
14061
|
+
console.log("bugsnag Triggered");
|
|
14052
14062
|
}
|
|
14053
14063
|
});
|
|
14054
14064
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
@@ -15468,7 +15478,7 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
|
|
|
15468
15478
|
var _generateUserError = /*#__PURE__*/new WeakMap();
|
|
15469
15479
|
class Payment {
|
|
15470
15480
|
/**
|
|
15471
|
-
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway)} paymentGateway
|
|
15481
|
+
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway)} paymentGateway
|
|
15472
15482
|
*/
|
|
15473
15483
|
constructor(paymentGateway) {
|
|
15474
15484
|
_defineProperty$3(this, "execute", (options, callback) => {
|
|
@@ -15487,7 +15497,7 @@ class Payment {
|
|
|
15487
15497
|
_classPrivateFieldInitSpec$1(this, _isPaymentGatewayInvalid, {
|
|
15488
15498
|
writable: true,
|
|
15489
15499
|
value: gateway => {
|
|
15490
|
-
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway);
|
|
15500
|
+
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway || gateway instanceof CybersourceGateway);
|
|
15491
15501
|
}
|
|
15492
15502
|
});
|
|
15493
15503
|
_classPrivateFieldInitSpec$1(this, _generateUserError, {
|
|
@@ -15541,7 +15551,8 @@ const PAYMENT_GATEWAYS_ENUM = {
|
|
|
15541
15551
|
stripe: "stripe",
|
|
15542
15552
|
paypal: "braintree",
|
|
15543
15553
|
vantiv: "vantiv",
|
|
15544
|
-
tap: "tap"
|
|
15554
|
+
tap: "tap",
|
|
15555
|
+
cybersource: "cybersource"
|
|
15545
15556
|
};
|
|
15546
15557
|
|
|
15547
15558
|
/**
|
|
@@ -16263,6 +16274,222 @@ class TapGateway {
|
|
|
16263
16274
|
}
|
|
16264
16275
|
}
|
|
16265
16276
|
|
|
16277
|
+
/**
|
|
16278
|
+
* Cybersource gateway strategy
|
|
16279
|
+
*/
|
|
16280
|
+
var _paymentGateway5 = /*#__PURE__*/new WeakMap();
|
|
16281
|
+
var _createSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16282
|
+
var _renewSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16283
|
+
var _createGiftedSubscription5 = /*#__PURE__*/new WeakMap();
|
|
16284
|
+
var _renewGiftedSubscription4 = /*#__PURE__*/new WeakMap();
|
|
16285
|
+
var _purchaseEcommerceOrder4 = /*#__PURE__*/new WeakMap();
|
|
16286
|
+
var _payInvoice5 = /*#__PURE__*/new WeakMap();
|
|
16287
|
+
class CybersourceGateway {
|
|
16288
|
+
constructor() {
|
|
16289
|
+
_classPrivateFieldInitSpec$1(this, _paymentGateway5, {
|
|
16290
|
+
writable: true,
|
|
16291
|
+
value: PAYMENT_GATEWAYS_ENUM["cybersource"]
|
|
16292
|
+
});
|
|
16293
|
+
_defineProperty$3(this, "execute", (options, callback) => {
|
|
16294
|
+
const types = PAYMENT_TYPES;
|
|
16295
|
+
switch (options.type) {
|
|
16296
|
+
case types.CREATE_SUBSCRIPTION:
|
|
16297
|
+
return _classPrivateFieldGet(this, _createSubscription5).call(this, options, callback);
|
|
16298
|
+
case types.RENEW_SUBSCRIPTION:
|
|
16299
|
+
return _classPrivateFieldGet(this, _renewSubscription4).call(this, options, callback);
|
|
16300
|
+
case types.CREATE_GIFTED_SUBSCRIPTION:
|
|
16301
|
+
return _classPrivateFieldGet(this, _createGiftedSubscription5).call(this, options, callback);
|
|
16302
|
+
case types.RENEW_GIFTED_SUBSCRIPTION:
|
|
16303
|
+
return _classPrivateFieldGet(this, _renewGiftedSubscription4).call(this, options, callback);
|
|
16304
|
+
case types.PURCHASE_ECOMMERCE_ORDER:
|
|
16305
|
+
return _classPrivateFieldGet(this, _purchaseEcommerceOrder4).call(this, options, callback);
|
|
16306
|
+
case types.PAY_INVOICE:
|
|
16307
|
+
return _classPrivateFieldGet(this, _payInvoice5).call(this, options, callback);
|
|
16308
|
+
default:
|
|
16309
|
+
console.error("Unsupported payment method: cybersource Gateway");
|
|
16310
|
+
}
|
|
16311
|
+
});
|
|
16312
|
+
_classPrivateFieldInitSpec$1(this, _createSubscription5, {
|
|
16313
|
+
writable: true,
|
|
16314
|
+
value: (options, callback) => {
|
|
16315
|
+
const {
|
|
16316
|
+
token,
|
|
16317
|
+
plan,
|
|
16318
|
+
couponCode,
|
|
16319
|
+
product,
|
|
16320
|
+
quantity = 1,
|
|
16321
|
+
addressId,
|
|
16322
|
+
isExistingSource
|
|
16323
|
+
} = options;
|
|
16324
|
+
const params = isExistingSource ? {
|
|
16325
|
+
source_id: token
|
|
16326
|
+
} : {
|
|
16327
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16328
|
+
gateway_token: token
|
|
16329
|
+
};
|
|
16330
|
+
window.Pelcro.subscription.create({
|
|
16331
|
+
quantity,
|
|
16332
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16333
|
+
plan_id: plan.id,
|
|
16334
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16335
|
+
coupon_code: couponCode,
|
|
16336
|
+
address_id: product.address_required ? addressId : null,
|
|
16337
|
+
...params
|
|
16338
|
+
}, (err, res) => {
|
|
16339
|
+
callback(err, res);
|
|
16340
|
+
});
|
|
16341
|
+
}
|
|
16342
|
+
});
|
|
16343
|
+
_classPrivateFieldInitSpec$1(this, _renewSubscription4, {
|
|
16344
|
+
writable: true,
|
|
16345
|
+
value: (options, callback) => {
|
|
16346
|
+
const {
|
|
16347
|
+
subscriptionIdToRenew,
|
|
16348
|
+
token,
|
|
16349
|
+
plan,
|
|
16350
|
+
couponCode,
|
|
16351
|
+
product,
|
|
16352
|
+
addressId,
|
|
16353
|
+
isExistingSource
|
|
16354
|
+
} = options;
|
|
16355
|
+
const params = isExistingSource ? {
|
|
16356
|
+
source_id: token
|
|
16357
|
+
} : {
|
|
16358
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16359
|
+
gateway_token: token
|
|
16360
|
+
};
|
|
16361
|
+
window.Pelcro.subscription.renew({
|
|
16362
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16363
|
+
plan_id: plan.id,
|
|
16364
|
+
coupon_code: couponCode,
|
|
16365
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16366
|
+
subscription_id: subscriptionIdToRenew,
|
|
16367
|
+
address_id: product.address_required ? addressId : null,
|
|
16368
|
+
...params
|
|
16369
|
+
}, (err, res) => {
|
|
16370
|
+
callback(err, res);
|
|
16371
|
+
});
|
|
16372
|
+
}
|
|
16373
|
+
});
|
|
16374
|
+
_classPrivateFieldInitSpec$1(this, _createGiftedSubscription5, {
|
|
16375
|
+
writable: true,
|
|
16376
|
+
value: (options, callback) => {
|
|
16377
|
+
const {
|
|
16378
|
+
token,
|
|
16379
|
+
plan,
|
|
16380
|
+
couponCode,
|
|
16381
|
+
product,
|
|
16382
|
+
giftRecipient,
|
|
16383
|
+
quantity = 1,
|
|
16384
|
+
addressId,
|
|
16385
|
+
isExistingSource
|
|
16386
|
+
} = options;
|
|
16387
|
+
const params = isExistingSource ? {
|
|
16388
|
+
source_id: token
|
|
16389
|
+
} : {
|
|
16390
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16391
|
+
gateway_token: token
|
|
16392
|
+
};
|
|
16393
|
+
window.Pelcro.subscription.create({
|
|
16394
|
+
quantity,
|
|
16395
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16396
|
+
plan_id: plan.id,
|
|
16397
|
+
coupon_code: couponCode,
|
|
16398
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16399
|
+
gift_recipient_email: giftRecipient.email,
|
|
16400
|
+
gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
|
|
16401
|
+
gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
|
|
16402
|
+
gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
|
|
16403
|
+
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
16404
|
+
address_id: product.address_required ? addressId : null,
|
|
16405
|
+
...params
|
|
16406
|
+
}, (err, res) => {
|
|
16407
|
+
callback(err, res);
|
|
16408
|
+
});
|
|
16409
|
+
}
|
|
16410
|
+
});
|
|
16411
|
+
_classPrivateFieldInitSpec$1(this, _renewGiftedSubscription4, {
|
|
16412
|
+
writable: true,
|
|
16413
|
+
value: (options, callback) => {
|
|
16414
|
+
const {
|
|
16415
|
+
subscriptionIdToRenew,
|
|
16416
|
+
token,
|
|
16417
|
+
product,
|
|
16418
|
+
plan,
|
|
16419
|
+
couponCode,
|
|
16420
|
+
addressId,
|
|
16421
|
+
isExistingSource
|
|
16422
|
+
} = options;
|
|
16423
|
+
const params = isExistingSource ? {
|
|
16424
|
+
source_id: token
|
|
16425
|
+
} : {
|
|
16426
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16427
|
+
gateway_token: token
|
|
16428
|
+
};
|
|
16429
|
+
window.Pelcro.subscription.renewGift({
|
|
16430
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16431
|
+
plan_id: plan.id,
|
|
16432
|
+
coupon_code: couponCode,
|
|
16433
|
+
subscription_id: subscriptionIdToRenew,
|
|
16434
|
+
address_id: product.address_required ? addressId : null,
|
|
16435
|
+
...params
|
|
16436
|
+
}, (err, res) => {
|
|
16437
|
+
callback(err, res);
|
|
16438
|
+
});
|
|
16439
|
+
}
|
|
16440
|
+
});
|
|
16441
|
+
_classPrivateFieldInitSpec$1(this, _purchaseEcommerceOrder4, {
|
|
16442
|
+
writable: true,
|
|
16443
|
+
value: (options, callback) => {
|
|
16444
|
+
const {
|
|
16445
|
+
token,
|
|
16446
|
+
items,
|
|
16447
|
+
couponCode,
|
|
16448
|
+
addressId,
|
|
16449
|
+
isExistingSource
|
|
16450
|
+
} = options;
|
|
16451
|
+
const params = isExistingSource ? {
|
|
16452
|
+
source_id: token
|
|
16453
|
+
} : {
|
|
16454
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16455
|
+
gateway_token: token
|
|
16456
|
+
};
|
|
16457
|
+
window.Pelcro.ecommerce.order.create({
|
|
16458
|
+
items,
|
|
16459
|
+
coupon_code: couponCode,
|
|
16460
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
16461
|
+
...params,
|
|
16462
|
+
...(addressId && {
|
|
16463
|
+
address_id: addressId
|
|
16464
|
+
})
|
|
16465
|
+
}, (err, res) => {
|
|
16466
|
+
callback(err, res);
|
|
16467
|
+
});
|
|
16468
|
+
}
|
|
16469
|
+
});
|
|
16470
|
+
_classPrivateFieldInitSpec$1(this, _payInvoice5, {
|
|
16471
|
+
writable: true,
|
|
16472
|
+
value: (options, callback) => {
|
|
16473
|
+
const {
|
|
16474
|
+
token,
|
|
16475
|
+
invoiceId
|
|
16476
|
+
} = options;
|
|
16477
|
+
const params = options.isExistingSource ? {
|
|
16478
|
+
source_id: token,
|
|
16479
|
+
invoice_id: invoiceId
|
|
16480
|
+
} : {
|
|
16481
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway5),
|
|
16482
|
+
gateway_token: token,
|
|
16483
|
+
invoice_id: invoiceId
|
|
16484
|
+
};
|
|
16485
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
16486
|
+
callback(err, res);
|
|
16487
|
+
});
|
|
16488
|
+
}
|
|
16489
|
+
});
|
|
16490
|
+
}
|
|
16491
|
+
}
|
|
16492
|
+
|
|
16266
16493
|
/**
|
|
16267
16494
|
* @typedef {Object} PaymentStateType
|
|
16268
16495
|
* @property {boolean} disableSubmit
|
|
@@ -16302,6 +16529,8 @@ const initialState$k = {
|
|
|
16302
16529
|
firstNameError: null,
|
|
16303
16530
|
lastNameError: null,
|
|
16304
16531
|
phoneError: null,
|
|
16532
|
+
month: "",
|
|
16533
|
+
year: "",
|
|
16305
16534
|
alert: {
|
|
16306
16535
|
type: "error",
|
|
16307
16536
|
content: ""
|
|
@@ -16367,37 +16596,44 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16367
16596
|
updateTotalAmountWithTax();
|
|
16368
16597
|
}, []);
|
|
16369
16598
|
|
|
16370
|
-
/*====== Start
|
|
16371
|
-
const
|
|
16372
|
-
var
|
|
16599
|
+
/*====== Start Cybersource integration ========*/
|
|
16600
|
+
const cybersourceErrorHandle = err => {
|
|
16601
|
+
var _err$details, _err$details$response, _err$details$response2;
|
|
16602
|
+
if ((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$response2 = _err$details$response.details) === null || _err$details$response2 === void 0 ? void 0 : _err$details$response2.length) > 0) {
|
|
16603
|
+
var _err$details2, _err$details2$respons;
|
|
16604
|
+
const errorMessages = [];
|
|
16605
|
+
|
|
16606
|
+
// enumerable error (ex: validation errors)
|
|
16607
|
+
Object.values(err === null || err === void 0 ? void 0 : (_err$details2 = err.details) === null || _err$details2 === void 0 ? void 0 : (_err$details2$respons = _err$details2.responseStatus) === null || _err$details2$respons === void 0 ? void 0 : _err$details2$respons.details).forEach(_ref2 => {
|
|
16608
|
+
let {
|
|
16609
|
+
message
|
|
16610
|
+
} = _ref2;
|
|
16611
|
+
errorMessages.push(message);
|
|
16612
|
+
});
|
|
16613
|
+
|
|
16614
|
+
// convert to multiline string
|
|
16615
|
+
return errorMessages.join("\n");
|
|
16616
|
+
} else {
|
|
16617
|
+
var _err$details3;
|
|
16618
|
+
return getErrorMessages(err === null || err === void 0 ? void 0 : (_err$details3 = err.details) === null || _err$details3 === void 0 ? void 0 : _err$details3.responseStatus);
|
|
16619
|
+
}
|
|
16620
|
+
};
|
|
16621
|
+
const submitUsingCybersource = (state, dispatch) => {
|
|
16622
|
+
var _cybersourceInstanceR;
|
|
16373
16623
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16374
16624
|
if (isUsingExistingPaymentMethod) {
|
|
16375
|
-
// no need to create a new source using
|
|
16376
|
-
return
|
|
16625
|
+
// no need to create a new source using cybersrce
|
|
16626
|
+
return handleCybersourcePayment(null, state);
|
|
16377
16627
|
}
|
|
16378
|
-
if (!
|
|
16379
|
-
return console.error("
|
|
16628
|
+
if (!cybersourceInstanceRef.current) {
|
|
16629
|
+
return console.error("Cybersource sdk script wasn't loaded, you need to load Cybersource sdk before rendering the Cybersource payment flow");
|
|
16380
16630
|
}
|
|
16381
|
-
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
}
|
|
16385
|
-
const isQuickPurchase = !Array.isArray(order);
|
|
16386
|
-
if (isQuickPurchase) {
|
|
16387
|
-
return order.price * order.quantity;
|
|
16388
|
-
}
|
|
16389
|
-
if (order.length === 0) {
|
|
16390
|
-
return null;
|
|
16391
|
-
}
|
|
16392
|
-
return order.reduce((total, item) => {
|
|
16393
|
-
return total + item.price * item.quantity;
|
|
16394
|
-
}, 0);
|
|
16631
|
+
let options = {
|
|
16632
|
+
cardExpirationMonth: state.month,
|
|
16633
|
+
cardExpirationYear: state.year
|
|
16395
16634
|
};
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
if (result.error) {
|
|
16399
|
-
// Inform the user if there was an error
|
|
16400
|
-
onFailure(result.error);
|
|
16635
|
+
(_cybersourceInstanceR = cybersourceInstanceRef.current) === null || _cybersourceInstanceR === void 0 ? void 0 : _cybersourceInstanceR.createToken(options, function (err, response) {
|
|
16636
|
+
if (err) {
|
|
16401
16637
|
dispatch({
|
|
16402
16638
|
type: DISABLE_SUBMIT,
|
|
16403
16639
|
payload: false
|
|
@@ -16410,40 +16646,280 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16410
16646
|
type: SHOW_ALERT,
|
|
16411
16647
|
payload: {
|
|
16412
16648
|
type: "error",
|
|
16413
|
-
content:
|
|
16649
|
+
content: cybersourceErrorHandle(err)
|
|
16414
16650
|
}
|
|
16415
16651
|
});
|
|
16416
|
-
}
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16652
|
+
}
|
|
16653
|
+
handleCybersourcePayment(response.token, state);
|
|
16654
|
+
});
|
|
16655
|
+
};
|
|
16656
|
+
function handleCybersourcePayment(paymentRequest, state) {
|
|
16657
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16658
|
+
if (type === "createPayment") {
|
|
16659
|
+
handleCybersourceSubscription();
|
|
16660
|
+
} else if (type === "orderCreate") {
|
|
16661
|
+
purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
16662
|
+
} else if (type === "invoicePayment") {
|
|
16663
|
+
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
16664
|
+
} else if (type === "updatePaymentSource") {
|
|
16665
|
+
createNewCybersourceCard();
|
|
16666
|
+
}
|
|
16667
|
+
function createNewCybersourceCard() {
|
|
16668
|
+
window.Pelcro.source.create({
|
|
16669
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16670
|
+
token: paymentRequest,
|
|
16671
|
+
gateway: "cybersource"
|
|
16672
|
+
}, (err, res) => {
|
|
16673
|
+
dispatch({
|
|
16674
|
+
type: DISABLE_SUBMIT,
|
|
16675
|
+
payload: false
|
|
16676
|
+
});
|
|
16677
|
+
dispatch({
|
|
16678
|
+
type: LOADING,
|
|
16679
|
+
payload: false
|
|
16680
|
+
});
|
|
16681
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
16682
|
+
if (err) {
|
|
16683
|
+
onFailure(err);
|
|
16684
|
+
return dispatch({
|
|
16685
|
+
type: SHOW_ALERT,
|
|
16686
|
+
payload: {
|
|
16687
|
+
type: "error",
|
|
16688
|
+
content: getErrorMessages(err)
|
|
16689
|
+
}
|
|
16690
|
+
});
|
|
16691
|
+
}
|
|
16692
|
+
dispatch({
|
|
16693
|
+
type: SHOW_ALERT,
|
|
16694
|
+
payload: {
|
|
16695
|
+
type: "success",
|
|
16696
|
+
content: t("messages.sourceUpdated")
|
|
16697
|
+
}
|
|
16698
|
+
});
|
|
16699
|
+
onSuccess(res);
|
|
16700
|
+
} //
|
|
16701
|
+
);
|
|
16702
|
+
}
|
|
16703
|
+
|
|
16704
|
+
function handleCybersourceSubscription() {
|
|
16705
|
+
const payment = new Payment(new CybersourceGateway());
|
|
16706
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
16707
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16708
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16709
|
+
const renewGift = isRenewingGift;
|
|
16710
|
+
const {
|
|
16711
|
+
couponCode
|
|
16712
|
+
} = state;
|
|
16713
|
+
if (renewGift) {
|
|
16714
|
+
return payment.execute({
|
|
16715
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
16716
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16717
|
+
plan,
|
|
16718
|
+
couponCode,
|
|
16719
|
+
product,
|
|
16720
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16721
|
+
subscriptionIdToRenew,
|
|
16722
|
+
addressId: selectedAddressId
|
|
16723
|
+
}, (err, res) => {
|
|
16724
|
+
if (err) {
|
|
16725
|
+
return handlePaymentError(err);
|
|
16726
|
+
}
|
|
16727
|
+
onSuccess(res);
|
|
16728
|
+
});
|
|
16729
|
+
} else if (giftSubscriprition) {
|
|
16730
|
+
return payment.execute({
|
|
16731
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
16732
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16733
|
+
quantity: plan.quantity,
|
|
16734
|
+
plan,
|
|
16735
|
+
couponCode,
|
|
16736
|
+
product,
|
|
16737
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16738
|
+
giftRecipient,
|
|
16739
|
+
addressId: selectedAddressId
|
|
16740
|
+
}, (err, res) => {
|
|
16741
|
+
if (err) {
|
|
16742
|
+
return handlePaymentError(err);
|
|
16743
|
+
}
|
|
16744
|
+
onSuccess(res);
|
|
16745
|
+
});
|
|
16746
|
+
} else if (renewSubscription) {
|
|
16747
|
+
return payment.execute({
|
|
16748
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
16749
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16750
|
+
quantity: plan.quantity,
|
|
16751
|
+
plan,
|
|
16752
|
+
couponCode,
|
|
16753
|
+
product,
|
|
16754
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16755
|
+
subscriptionIdToRenew,
|
|
16756
|
+
addressId: selectedAddressId
|
|
16757
|
+
}, (err, res) => {
|
|
16758
|
+
if (err) {
|
|
16759
|
+
return handlePaymentError(err);
|
|
16760
|
+
}
|
|
16761
|
+
onSuccess(res);
|
|
16762
|
+
});
|
|
16763
|
+
} else if (createSubscription) {
|
|
16764
|
+
return payment.execute({
|
|
16765
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
16766
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16767
|
+
quantity: plan.quantity,
|
|
16768
|
+
plan,
|
|
16769
|
+
couponCode,
|
|
16770
|
+
product,
|
|
16771
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16772
|
+
addressId: selectedAddressId
|
|
16773
|
+
}, (err, res) => {
|
|
16774
|
+
if (err) {
|
|
16775
|
+
return handlePaymentError(err);
|
|
16776
|
+
}
|
|
16777
|
+
onSuccess(res);
|
|
16778
|
+
});
|
|
16779
|
+
}
|
|
16780
|
+
}
|
|
16781
|
+
}
|
|
16782
|
+
const tokenizeCard = (error, microformInstance) => {
|
|
16783
|
+
if (error) {
|
|
16784
|
+
return;
|
|
16785
|
+
}
|
|
16786
|
+
cybersourceInstanceRef.current = microformInstance;
|
|
16787
|
+
};
|
|
16788
|
+
const initCybersourceScript = () => {
|
|
16789
|
+
// jwk api call
|
|
16790
|
+
window.Pelcro.payment.getJWK({
|
|
16791
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16792
|
+
site_id: window.Pelcro.siteid
|
|
16793
|
+
}, (err, res) => {
|
|
16794
|
+
if (err) {
|
|
16795
|
+
onFailure(err);
|
|
16796
|
+
dispatch({
|
|
16797
|
+
type: DISABLE_SUBMIT,
|
|
16798
|
+
payload: false
|
|
16799
|
+
});
|
|
16800
|
+
dispatch({
|
|
16801
|
+
type: LOADING,
|
|
16802
|
+
payload: false
|
|
16803
|
+
});
|
|
16804
|
+
return dispatch({
|
|
16805
|
+
type: SHOW_ALERT,
|
|
16806
|
+
payload: {
|
|
16807
|
+
type: "error",
|
|
16808
|
+
content: getErrorMessages(err)
|
|
16809
|
+
}
|
|
16810
|
+
});
|
|
16811
|
+
}
|
|
16812
|
+
const {
|
|
16813
|
+
key: jwk
|
|
16814
|
+
} = res;
|
|
16815
|
+
// SETUP MICROFORM
|
|
16816
|
+
FLEX.microform({
|
|
16817
|
+
keyId: jwk.kid,
|
|
16818
|
+
keystore: jwk,
|
|
16819
|
+
container: "#cybersourceCardNumber",
|
|
16820
|
+
placeholder: "Card Number",
|
|
16821
|
+
styles: {
|
|
16822
|
+
input: {
|
|
16823
|
+
"font-size": "14px",
|
|
16824
|
+
"font-family": "helvetica, tahoma, calibri, sans-serif",
|
|
16825
|
+
color: "#555"
|
|
16826
|
+
},
|
|
16827
|
+
":focus": {
|
|
16828
|
+
color: "blue"
|
|
16829
|
+
},
|
|
16830
|
+
":disabled": {
|
|
16831
|
+
cursor: "not-allowed"
|
|
16832
|
+
},
|
|
16833
|
+
valid: {
|
|
16834
|
+
color: "#3c763d"
|
|
16835
|
+
},
|
|
16836
|
+
invalid: {
|
|
16837
|
+
color: "#a94442"
|
|
16838
|
+
}
|
|
16839
|
+
}
|
|
16840
|
+
}, tokenizeCard);
|
|
16841
|
+
});
|
|
16842
|
+
};
|
|
16843
|
+
|
|
16844
|
+
/*====== End Cybersource integration ========*/
|
|
16845
|
+
|
|
16846
|
+
/*====== Start Tap integration ========*/
|
|
16847
|
+
const submitUsingTap = state => {
|
|
16848
|
+
var _ref3, _ref4, _ref5, _state$updatedPrice;
|
|
16849
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16850
|
+
if (isUsingExistingPaymentMethod) {
|
|
16851
|
+
// no need to create a new source using tap
|
|
16852
|
+
return handleTapPayment(null, state);
|
|
16853
|
+
}
|
|
16854
|
+
if (!tapInstanceRef.current) {
|
|
16855
|
+
return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
|
|
16856
|
+
}
|
|
16857
|
+
const getOrderItemsTotal = () => {
|
|
16858
|
+
if (!order) {
|
|
16859
|
+
return null;
|
|
16860
|
+
}
|
|
16861
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
16862
|
+
if (isQuickPurchase) {
|
|
16863
|
+
return order.price * order.quantity;
|
|
16864
|
+
}
|
|
16865
|
+
if (order.length === 0) {
|
|
16866
|
+
return null;
|
|
16867
|
+
}
|
|
16868
|
+
return order.reduce((total, item) => {
|
|
16869
|
+
return total + item.price * item.quantity;
|
|
16870
|
+
}, 0);
|
|
16871
|
+
};
|
|
16872
|
+
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;
|
|
16873
|
+
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
16874
|
+
if (result.error) {
|
|
16875
|
+
// Inform the user if there was an error
|
|
16876
|
+
onFailure(result.error);
|
|
16877
|
+
dispatch({
|
|
16878
|
+
type: DISABLE_SUBMIT,
|
|
16879
|
+
payload: false
|
|
16880
|
+
});
|
|
16881
|
+
dispatch({
|
|
16882
|
+
type: LOADING,
|
|
16883
|
+
payload: false
|
|
16884
|
+
});
|
|
16885
|
+
return dispatch({
|
|
16886
|
+
type: SHOW_ALERT,
|
|
16887
|
+
payload: {
|
|
16888
|
+
type: "error",
|
|
16889
|
+
content: getErrorMessages(result.error)
|
|
16890
|
+
}
|
|
16891
|
+
});
|
|
16892
|
+
} else {
|
|
16893
|
+
window.Pelcro.payment.verify({
|
|
16894
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16895
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
16896
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
16897
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
16898
|
+
site_id: window.Pelcro.siteid,
|
|
16899
|
+
amount: totalAmount,
|
|
16900
|
+
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,
|
|
16901
|
+
tap_token: result.id,
|
|
16902
|
+
funding: result.card.funding,
|
|
16903
|
+
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}`
|
|
16904
|
+
}, (err, res) => {
|
|
16905
|
+
if (err) {
|
|
16906
|
+
// Inform the user if there was an error
|
|
16907
|
+
onFailure(err);
|
|
16908
|
+
dispatch({
|
|
16909
|
+
type: DISABLE_SUBMIT,
|
|
16910
|
+
payload: false
|
|
16911
|
+
});
|
|
16912
|
+
dispatch({
|
|
16913
|
+
type: LOADING,
|
|
16914
|
+
payload: false
|
|
16915
|
+
});
|
|
16916
|
+
return dispatch({
|
|
16917
|
+
type: SHOW_ALERT,
|
|
16918
|
+
payload: {
|
|
16919
|
+
type: "error",
|
|
16920
|
+
content: getErrorMessages(err)
|
|
16921
|
+
}
|
|
16922
|
+
});
|
|
16447
16923
|
} else {
|
|
16448
16924
|
toggleAuthenticationPendingView(true, res);
|
|
16449
16925
|
const listenFor3DSecureCompletionMessage = () => {
|
|
@@ -16658,7 +17134,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16658
17134
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16659
17135
|
if (isUsingExistingPaymentMethod) {
|
|
16660
17136
|
// no need to create a new source using vantiv
|
|
16661
|
-
return handleVantivPayment(null);
|
|
17137
|
+
return handleVantivPayment(null, state.couponCode);
|
|
16662
17138
|
}
|
|
16663
17139
|
if (!vantivInstanceRef.current) {
|
|
16664
17140
|
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
@@ -16810,8 +17286,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16810
17286
|
const vantivInstanceRef = React__default.useRef(null);
|
|
16811
17287
|
const tapInstanceRef = React__default.useRef(null);
|
|
16812
17288
|
const tapInstanceCard = React__default.useRef(null);
|
|
17289
|
+
const cybersourceInstanceRef = React__default.useRef(null);
|
|
16813
17290
|
useEffect(() => {
|
|
16814
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17291
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16815
17292
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
16816
17293
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
16817
17294
|
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;
|
|
@@ -16847,7 +17324,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16847
17324
|
}, [vantivPaymentRequest]);
|
|
16848
17325
|
useEffect(() => {
|
|
16849
17326
|
whenUserReady(() => {
|
|
16850
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17327
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16851
17328
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
16852
17329
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
16853
17330
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -16858,10 +17335,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16858
17335
|
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
16859
17336
|
initTapScript();
|
|
16860
17337
|
}
|
|
17338
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
|
|
17339
|
+
window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
|
|
17340
|
+
document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
|
|
17341
|
+
initCybersourceScript();
|
|
17342
|
+
});
|
|
17343
|
+
}
|
|
17344
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
|
|
17345
|
+
initCybersourceScript();
|
|
17346
|
+
}
|
|
16861
17347
|
});
|
|
16862
17348
|
}, [selectedPaymentMethodId]);
|
|
16863
17349
|
const initPaymentRequest = (state, dispatch) => {
|
|
16864
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17350
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16865
17351
|
try {
|
|
16866
17352
|
const paymentRequest = stripe.paymentRequest({
|
|
16867
17353
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16873,13 +17359,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16873
17359
|
});
|
|
16874
17360
|
|
|
16875
17361
|
// When Google pay / Apple pay source created
|
|
16876
|
-
paymentRequest.on("source",
|
|
17362
|
+
paymentRequest.on("source", _ref6 => {
|
|
16877
17363
|
var _source$card;
|
|
16878
17364
|
let {
|
|
16879
17365
|
complete,
|
|
16880
17366
|
source,
|
|
16881
17367
|
...data
|
|
16882
|
-
} =
|
|
17368
|
+
} = _ref6;
|
|
16883
17369
|
dispatch({
|
|
16884
17370
|
type: DISABLE_COUPON_BUTTON,
|
|
16885
17371
|
payload: true
|
|
@@ -16894,11 +17380,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16894
17380
|
});
|
|
16895
17381
|
complete("success");
|
|
16896
17382
|
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") {
|
|
16897
|
-
return generate3DSecureSource(source).then(
|
|
17383
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
16898
17384
|
let {
|
|
16899
17385
|
source,
|
|
16900
17386
|
error
|
|
16901
|
-
} =
|
|
17387
|
+
} = _ref7;
|
|
16902
17388
|
if (error) {
|
|
16903
17389
|
return handlePaymentError(error);
|
|
16904
17390
|
}
|
|
@@ -16930,7 +17416,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16930
17416
|
*/
|
|
16931
17417
|
const updateTotalAmountWithTax = () => {
|
|
16932
17418
|
var _window$Pelcro$site$r4;
|
|
16933
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17419
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16934
17420
|
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;
|
|
16935
17421
|
if (taxesEnabled && type === "createPayment") {
|
|
16936
17422
|
dispatch({
|
|
@@ -17205,6 +17691,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17205
17691
|
type: LOADING,
|
|
17206
17692
|
payload: false
|
|
17207
17693
|
});
|
|
17694
|
+
onFailure(error);
|
|
17208
17695
|
return dispatch({
|
|
17209
17696
|
type: SHOW_ALERT,
|
|
17210
17697
|
payload: {
|
|
@@ -17427,16 +17914,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17427
17914
|
items: mappedOrderItems,
|
|
17428
17915
|
addressId: selectedAddressId,
|
|
17429
17916
|
couponCode
|
|
17430
|
-
}, (err,
|
|
17431
|
-
|
|
17432
|
-
type: DISABLE_SUBMIT,
|
|
17433
|
-
payload: false
|
|
17434
|
-
});
|
|
17435
|
-
dispatch({
|
|
17436
|
-
type: LOADING,
|
|
17437
|
-
payload: false
|
|
17438
|
-
});
|
|
17917
|
+
}, (err, orderResponse) => {
|
|
17918
|
+
var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
|
|
17439
17919
|
if (err) {
|
|
17920
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17921
|
+
dispatch({
|
|
17922
|
+
type: DISABLE_SUBMIT,
|
|
17923
|
+
payload: false
|
|
17924
|
+
});
|
|
17925
|
+
dispatch({
|
|
17926
|
+
type: LOADING,
|
|
17927
|
+
payload: false
|
|
17928
|
+
});
|
|
17440
17929
|
onFailure(err);
|
|
17441
17930
|
return dispatch({
|
|
17442
17931
|
type: SHOW_ALERT,
|
|
@@ -17456,7 +17945,30 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17456
17945
|
cartItems: []
|
|
17457
17946
|
});
|
|
17458
17947
|
}
|
|
17459
|
-
|
|
17948
|
+
window.Pelcro.user.refresh({
|
|
17949
|
+
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
|
|
17950
|
+
}, (err, res) => {
|
|
17951
|
+
dispatch({
|
|
17952
|
+
type: DISABLE_SUBMIT,
|
|
17953
|
+
payload: false
|
|
17954
|
+
});
|
|
17955
|
+
dispatch({
|
|
17956
|
+
type: LOADING,
|
|
17957
|
+
payload: false
|
|
17958
|
+
});
|
|
17959
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17960
|
+
if (err) {
|
|
17961
|
+
onFailure(err);
|
|
17962
|
+
return dispatch({
|
|
17963
|
+
type: SHOW_ALERT,
|
|
17964
|
+
payload: {
|
|
17965
|
+
type: "error",
|
|
17966
|
+
content: getErrorMessages(err)
|
|
17967
|
+
}
|
|
17968
|
+
});
|
|
17969
|
+
}
|
|
17970
|
+
onSuccess(orderResponse);
|
|
17971
|
+
});
|
|
17460
17972
|
});
|
|
17461
17973
|
};
|
|
17462
17974
|
const payInvoice = (gatewayService, gatewayToken, dispatch) => {
|
|
@@ -17473,12 +17985,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17473
17985
|
const updatePaymentSource = (state, dispatch) => {
|
|
17474
17986
|
return stripe.createSource({
|
|
17475
17987
|
type: "card"
|
|
17476
|
-
}).then(
|
|
17988
|
+
}).then(_ref8 => {
|
|
17477
17989
|
var _source$card2;
|
|
17478
17990
|
let {
|
|
17479
17991
|
source,
|
|
17480
17992
|
error
|
|
17481
|
-
} =
|
|
17993
|
+
} = _ref8;
|
|
17482
17994
|
if (error) {
|
|
17483
17995
|
return handlePaymentError(error);
|
|
17484
17996
|
}
|
|
@@ -17534,7 +18046,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17534
18046
|
});
|
|
17535
18047
|
};
|
|
17536
18048
|
const submitPayment = (state, dispatch) => {
|
|
17537
|
-
if (skipPayment &&
|
|
18049
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17538
18050
|
const isQuickPurchase = !Array.isArray(order);
|
|
17539
18051
|
const mappedOrderItems = isQuickPurchase ? [{
|
|
17540
18052
|
sku_id: order.id,
|
|
@@ -17559,12 +18071,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17559
18071
|
}
|
|
17560
18072
|
stripe.createSource({
|
|
17561
18073
|
type: "card"
|
|
17562
|
-
}).then(
|
|
17563
|
-
var
|
|
18074
|
+
}).then(_ref9 => {
|
|
18075
|
+
var _ref10, _ref11, _state$updatedPrice2;
|
|
17564
18076
|
let {
|
|
17565
18077
|
source,
|
|
17566
18078
|
error
|
|
17567
|
-
} =
|
|
18079
|
+
} = _ref9;
|
|
17568
18080
|
if (error) {
|
|
17569
18081
|
return handlePaymentError(error);
|
|
17570
18082
|
}
|
|
@@ -17583,7 +18095,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17583
18095
|
return total + item.price * item.quantity;
|
|
17584
18096
|
}, 0);
|
|
17585
18097
|
};
|
|
17586
|
-
(
|
|
18098
|
+
(_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();
|
|
17587
18099
|
return handlePayment(source);
|
|
17588
18100
|
}).catch(error => {
|
|
17589
18101
|
return handlePaymentError(error);
|
|
@@ -17790,15 +18302,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17790
18302
|
disableSubmit: true,
|
|
17791
18303
|
isLoading: true
|
|
17792
18304
|
}, (state, dispatch) => {
|
|
17793
|
-
if (skipPayment &&
|
|
18305
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17794
18306
|
return submitPayment(state);
|
|
17795
18307
|
}
|
|
17796
18308
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17797
|
-
return submitUsingVantiv();
|
|
18309
|
+
return submitUsingVantiv(state);
|
|
17798
18310
|
}
|
|
17799
18311
|
if (getSiteCardProcessor() === "tap") {
|
|
17800
18312
|
return submitUsingTap(state);
|
|
17801
18313
|
}
|
|
18314
|
+
if (getSiteCardProcessor() === "cybersource") {
|
|
18315
|
+
return submitUsingCybersource(state, dispatch);
|
|
18316
|
+
}
|
|
17802
18317
|
if (selectedPaymentMethodId) {
|
|
17803
18318
|
// pay with selected method (source) if exists already
|
|
17804
18319
|
return handlePayment({
|
|
@@ -17866,6 +18381,16 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17866
18381
|
...state,
|
|
17867
18382
|
percentOff: action.payload
|
|
17868
18383
|
});
|
|
18384
|
+
case SET_MONTH:
|
|
18385
|
+
return lib_7({
|
|
18386
|
+
...state,
|
|
18387
|
+
month: action.payload
|
|
18388
|
+
});
|
|
18389
|
+
case SET_YEAR:
|
|
18390
|
+
return lib_7({
|
|
18391
|
+
...state,
|
|
18392
|
+
year: action.payload
|
|
18393
|
+
});
|
|
17869
18394
|
case SET_FIRST_NAME:
|
|
17870
18395
|
return lib_7({
|
|
17871
18396
|
...state,
|
|
@@ -17956,13 +18481,122 @@ const PaymentMethodContainer = props => {
|
|
|
17956
18481
|
}, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
|
|
17957
18482
|
store: store$k
|
|
17958
18483
|
}, props))));
|
|
17959
|
-
} else {
|
|
18484
|
+
} else if (cardProcessor !== "stripe") {
|
|
17960
18485
|
return /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
17961
18486
|
store: store$k
|
|
17962
18487
|
}, props));
|
|
17963
18488
|
}
|
|
18489
|
+
return null;
|
|
17964
18490
|
};
|
|
17965
18491
|
|
|
18492
|
+
function Select(_ref) {
|
|
18493
|
+
let {
|
|
18494
|
+
label = "",
|
|
18495
|
+
required,
|
|
18496
|
+
id,
|
|
18497
|
+
errorId,
|
|
18498
|
+
error = "",
|
|
18499
|
+
className = "",
|
|
18500
|
+
labelClassName = "",
|
|
18501
|
+
errorClassName = "",
|
|
18502
|
+
wrapperClassName = "",
|
|
18503
|
+
children,
|
|
18504
|
+
...otherProps
|
|
18505
|
+
} = _ref;
|
|
18506
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
18507
|
+
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
18508
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
18509
|
+
htmlFor: id,
|
|
18510
|
+
className: `pelcro-input-label ${labelClassName}`
|
|
18511
|
+
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default.createElement("select", Object.assign({
|
|
18512
|
+
id: id,
|
|
18513
|
+
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
18514
|
+
"aria-describedby": errorId,
|
|
18515
|
+
"aria-invalid": Boolean(error)
|
|
18516
|
+
}, otherProps), children), error && /*#__PURE__*/React__default.createElement("p", {
|
|
18517
|
+
id: errorId,
|
|
18518
|
+
"aria-live": "assertive",
|
|
18519
|
+
className: `pelcro-input-error ${errorClassName}`
|
|
18520
|
+
}, error));
|
|
18521
|
+
}
|
|
18522
|
+
|
|
18523
|
+
function MonthSelect(_ref) {
|
|
18524
|
+
let {
|
|
18525
|
+
placeholder,
|
|
18526
|
+
store,
|
|
18527
|
+
...otherProps
|
|
18528
|
+
} = _ref;
|
|
18529
|
+
const {
|
|
18530
|
+
dispatch,
|
|
18531
|
+
state: {
|
|
18532
|
+
month
|
|
18533
|
+
}
|
|
18534
|
+
} = useContext(store);
|
|
18535
|
+
const get2digits = num => num < 10 ? "0" + num.toString() : num.toString();
|
|
18536
|
+
const createMonthsItems = useMemo(() => {
|
|
18537
|
+
return [...Array.from({
|
|
18538
|
+
length: 12
|
|
18539
|
+
}, (_, i) => i + 1)].map(i => {
|
|
18540
|
+
return /*#__PURE__*/React__default.createElement("option", {
|
|
18541
|
+
key: i,
|
|
18542
|
+
value: get2digits(i)
|
|
18543
|
+
}, get2digits(i));
|
|
18544
|
+
});
|
|
18545
|
+
}, []);
|
|
18546
|
+
const handleInputChange = value => {
|
|
18547
|
+
dispatch({
|
|
18548
|
+
type: SET_MONTH,
|
|
18549
|
+
payload: value
|
|
18550
|
+
});
|
|
18551
|
+
};
|
|
18552
|
+
return /*#__PURE__*/React__default.createElement(Select, Object.assign({
|
|
18553
|
+
value: month,
|
|
18554
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18555
|
+
}, otherProps), /*#__PURE__*/React__default.createElement("option", {
|
|
18556
|
+
value: "",
|
|
18557
|
+
disabled: true,
|
|
18558
|
+
selected: true
|
|
18559
|
+
}, placeholder), createMonthsItems);
|
|
18560
|
+
}
|
|
18561
|
+
|
|
18562
|
+
function YearSelect(_ref) {
|
|
18563
|
+
let {
|
|
18564
|
+
placeholder,
|
|
18565
|
+
store,
|
|
18566
|
+
...otherProps
|
|
18567
|
+
} = _ref;
|
|
18568
|
+
const {
|
|
18569
|
+
dispatch,
|
|
18570
|
+
state: {
|
|
18571
|
+
year
|
|
18572
|
+
}
|
|
18573
|
+
} = useContext(store);
|
|
18574
|
+
const createYearsItems = useMemo(() => {
|
|
18575
|
+
return Array.from({
|
|
18576
|
+
length: 10
|
|
18577
|
+
}, (_, i) => i + new Date().getFullYear()).map(i => {
|
|
18578
|
+
return /*#__PURE__*/React__default.createElement("option", {
|
|
18579
|
+
key: i,
|
|
18580
|
+
value: i
|
|
18581
|
+
}, i);
|
|
18582
|
+
});
|
|
18583
|
+
}, []);
|
|
18584
|
+
const handleInputChange = value => {
|
|
18585
|
+
dispatch({
|
|
18586
|
+
type: SET_YEAR,
|
|
18587
|
+
payload: value
|
|
18588
|
+
});
|
|
18589
|
+
};
|
|
18590
|
+
return /*#__PURE__*/React__default.createElement(Select, Object.assign({
|
|
18591
|
+
value: year,
|
|
18592
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18593
|
+
}, otherProps), /*#__PURE__*/React__default.createElement("option", {
|
|
18594
|
+
value: "",
|
|
18595
|
+
disabled: true,
|
|
18596
|
+
selected: true
|
|
18597
|
+
}, placeholder), createYearsItems);
|
|
18598
|
+
}
|
|
18599
|
+
|
|
17966
18600
|
const StripeInputStyle = {
|
|
17967
18601
|
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",
|
|
17968
18602
|
focus: "plc-ring-2 plc-ring-primary-400",
|
|
@@ -18052,6 +18686,24 @@ const CheckoutForm = () => {
|
|
|
18052
18686
|
id: "tapPaymentIframe"
|
|
18053
18687
|
});
|
|
18054
18688
|
}
|
|
18689
|
+
if (cardProcessor === "cybersource") {
|
|
18690
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
18691
|
+
id: "cybersourceCardNumber",
|
|
18692
|
+
className: "pelcro-input-field plc-h-12"
|
|
18693
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
18694
|
+
className: "plc-flex plc-items-end plc-justify-between plc-my-2"
|
|
18695
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
18696
|
+
className: "plc-w-6/12 plc-pr-4"
|
|
18697
|
+
}, /*#__PURE__*/React__default.createElement(MonthSelect, {
|
|
18698
|
+
store: store$k,
|
|
18699
|
+
placeholder: "Exp Month *"
|
|
18700
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
18701
|
+
className: "plc-w-6/12"
|
|
18702
|
+
}, /*#__PURE__*/React__default.createElement(YearSelect, {
|
|
18703
|
+
store: store$k,
|
|
18704
|
+
placeholder: "Exp Year *"
|
|
18705
|
+
}))));
|
|
18706
|
+
}
|
|
18055
18707
|
if (cardProcessor === "stripe") {
|
|
18056
18708
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(PelcroCardNumber, {
|
|
18057
18709
|
autoFocus: true
|
|
@@ -18112,13 +18764,14 @@ const DiscountedPrice = props => {
|
|
|
18112
18764
|
};
|
|
18113
18765
|
|
|
18114
18766
|
const SubmitPaymentMethod = _ref => {
|
|
18115
|
-
var _plan$quantity, _window$Pelcro$site$r;
|
|
18767
|
+
var _plan$quantity, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
18116
18768
|
let {
|
|
18117
18769
|
onClick,
|
|
18118
18770
|
...otherProps
|
|
18119
18771
|
} = _ref;
|
|
18120
18772
|
const {
|
|
18121
|
-
plan
|
|
18773
|
+
plan,
|
|
18774
|
+
selectedPaymentMethodId
|
|
18122
18775
|
} = usePelcro();
|
|
18123
18776
|
const {
|
|
18124
18777
|
t
|
|
@@ -18134,13 +18787,16 @@ const SubmitPaymentMethod = _ref => {
|
|
|
18134
18787
|
phone,
|
|
18135
18788
|
disableSubmit,
|
|
18136
18789
|
isLoading,
|
|
18137
|
-
updatedPrice
|
|
18790
|
+
updatedPrice,
|
|
18791
|
+
month,
|
|
18792
|
+
year
|
|
18138
18793
|
}
|
|
18139
18794
|
} = useContext(store$k);
|
|
18140
18795
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
18141
18796
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
18142
18797
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
18143
18798
|
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
18799
|
+
const supportsCybersource = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.cybersource_gateway_settings);
|
|
18144
18800
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
18145
18801
|
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
18146
18802
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
@@ -18149,9 +18805,9 @@ const SubmitPaymentMethod = _ref => {
|
|
|
18149
18805
|
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
18150
18806
|
setDisabled(disableSubmit);
|
|
18151
18807
|
} else {
|
|
18152
|
-
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
18808
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || supportsCybersource && !selectedPaymentMethodId && !(month !== null && month !== void 0 && month.length) || supportsCybersource && !selectedPaymentMethodId && !(year !== null && year !== void 0 && year.length));
|
|
18153
18809
|
}
|
|
18154
|
-
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
18810
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, month, year]);
|
|
18155
18811
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
18156
18812
|
role: "submit",
|
|
18157
18813
|
className: "plc-w-full plc-py-3",
|
|
@@ -18790,7 +19446,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
18790
19446
|
*
|
|
18791
19447
|
*/
|
|
18792
19448
|
function PaymentMethodView(_ref) {
|
|
18793
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
19449
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _calcAndFormatItemsTo, _order$;
|
|
18794
19450
|
let {
|
|
18795
19451
|
onSuccess,
|
|
18796
19452
|
onGiftRenewalSuccess,
|
|
@@ -18808,6 +19464,7 @@ function PaymentMethodView(_ref) {
|
|
|
18808
19464
|
const cardProcessor = getSiteCardProcessor();
|
|
18809
19465
|
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);
|
|
18810
19466
|
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);
|
|
19467
|
+
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);
|
|
18811
19468
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
18812
19469
|
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
18813
19470
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
@@ -18817,11 +19474,13 @@ function PaymentMethodView(_ref) {
|
|
|
18817
19474
|
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"
|
|
18818
19475
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
18819
19476
|
className: "plc-text-gray-600"
|
|
18820
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
19477
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default.createElement("span", {
|
|
19478
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
19479
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default.createElement("span", {
|
|
18821
19480
|
className: "plc-tracking-wider plc-uppercase"
|
|
18822
|
-
},
|
|
19481
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
18823
19482
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18824
|
-
}, 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.createElement("div", {
|
|
19483
|
+
}, (_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.createElement("div", {
|
|
18825
19484
|
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"
|
|
18826
19485
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
18827
19486
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -18837,7 +19496,8 @@ function PaymentMethodView(_ref) {
|
|
|
18837
19496
|
type: type,
|
|
18838
19497
|
onSuccess: onSuccess,
|
|
18839
19498
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18840
|
-
onFailure: onFailure
|
|
19499
|
+
onFailure: onFailure,
|
|
19500
|
+
freeOrders: showOrderButton
|
|
18841
19501
|
}, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
18842
19502
|
className: "plc-mb-2"
|
|
18843
19503
|
}), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -18862,7 +19522,7 @@ function PaymentMethodView(_ref) {
|
|
|
18862
19522
|
className: "plc-mb-2"
|
|
18863
19523
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
18864
19524
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
18865
|
-
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null)))));
|
|
19525
|
+
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null)))));
|
|
18866
19526
|
}
|
|
18867
19527
|
|
|
18868
19528
|
const SubscriptionRenewView = _ref => {
|
|
@@ -21489,6 +22149,7 @@ const AddressCreateContainer = _ref => {
|
|
|
21489
22149
|
first_name: firstName,
|
|
21490
22150
|
last_name: lastName,
|
|
21491
22151
|
line1: line1,
|
|
22152
|
+
line2: line2,
|
|
21492
22153
|
city: city,
|
|
21493
22154
|
state: state,
|
|
21494
22155
|
country: country,
|
|
@@ -21883,37 +22544,6 @@ const AddressCreateSubmit = _ref => {
|
|
|
21883
22544
|
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
21884
22545
|
};
|
|
21885
22546
|
|
|
21886
|
-
function Select(_ref) {
|
|
21887
|
-
let {
|
|
21888
|
-
label = "",
|
|
21889
|
-
required,
|
|
21890
|
-
id,
|
|
21891
|
-
errorId,
|
|
21892
|
-
error = "",
|
|
21893
|
-
className = "",
|
|
21894
|
-
labelClassName = "",
|
|
21895
|
-
errorClassName = "",
|
|
21896
|
-
wrapperClassName = "",
|
|
21897
|
-
children,
|
|
21898
|
-
...otherProps
|
|
21899
|
-
} = _ref;
|
|
21900
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
21901
|
-
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
21902
|
-
}, /*#__PURE__*/React__default.createElement("label", {
|
|
21903
|
-
htmlFor: id,
|
|
21904
|
-
className: `pelcro-input-label ${labelClassName}`
|
|
21905
|
-
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default.createElement("select", Object.assign({
|
|
21906
|
-
id: id,
|
|
21907
|
-
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
21908
|
-
"aria-describedby": errorId,
|
|
21909
|
-
"aria-invalid": Boolean(error)
|
|
21910
|
-
}, otherProps), children), error && /*#__PURE__*/React__default.createElement("p", {
|
|
21911
|
-
id: errorId,
|
|
21912
|
-
"aria-live": "assertive",
|
|
21913
|
-
className: `pelcro-input-error ${errorClassName}`
|
|
21914
|
-
}, error));
|
|
21915
|
-
}
|
|
21916
|
-
|
|
21917
22547
|
function CountrySelect(_ref) {
|
|
21918
22548
|
let {
|
|
21919
22549
|
placeholder,
|
|
@@ -22316,6 +22946,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
22316
22946
|
first_name: firstName,
|
|
22317
22947
|
last_name: lastName,
|
|
22318
22948
|
line1: line1,
|
|
22949
|
+
line2: line2,
|
|
22319
22950
|
city: city,
|
|
22320
22951
|
state: state,
|
|
22321
22952
|
country: country,
|
|
@@ -24263,7 +24894,7 @@ const OrderCreateView = props => {
|
|
|
24263
24894
|
order
|
|
24264
24895
|
} = usePelcro();
|
|
24265
24896
|
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;
|
|
24266
|
-
const showOrderButton = skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0;
|
|
24897
|
+
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));
|
|
24267
24898
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
24268
24899
|
id: "pelcro-order-create-view"
|
|
24269
24900
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -27597,7 +28228,7 @@ const InvoicesItems = () => {
|
|
|
27597
28228
|
setInvoice,
|
|
27598
28229
|
switchView
|
|
27599
28230
|
} = usePelcro();
|
|
27600
|
-
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 : [];
|
|
28231
|
+
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 : [];
|
|
27601
28232
|
const showInvoiceDetails = event => {
|
|
27602
28233
|
if (setInvoice(event.target.dataset.id)) {
|
|
27603
28234
|
switchView("invoice-details");
|
|
@@ -28365,7 +28996,7 @@ class Dashboard extends Component {
|
|
|
28365
28996
|
}
|
|
28366
28997
|
function hasInvoices() {
|
|
28367
28998
|
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
28368
|
-
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 : [];
|
|
28999
|
+
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 : [];
|
|
28369
29000
|
return invoices.length > 0;
|
|
28370
29001
|
}
|
|
28371
29002
|
function hasDonationSubs() {
|