@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.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,38 @@ 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;
|
|
16602
|
+
const errorMessages = [];
|
|
16603
|
+
|
|
16604
|
+
// enumerable error (ex: validation errors)
|
|
16605
|
+
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 => {
|
|
16606
|
+
let {
|
|
16607
|
+
message
|
|
16608
|
+
} = _ref2;
|
|
16609
|
+
errorMessages.push(message);
|
|
16610
|
+
});
|
|
16611
|
+
|
|
16612
|
+
// convert to multiline string
|
|
16613
|
+
return errorMessages.join("\n");
|
|
16614
|
+
};
|
|
16615
|
+
const submitUsingCybersource = (state, dispatch) => {
|
|
16616
|
+
var _cybersourceInstanceR;
|
|
16373
16617
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16374
16618
|
if (isUsingExistingPaymentMethod) {
|
|
16375
|
-
// no need to create a new source using
|
|
16376
|
-
return
|
|
16619
|
+
// no need to create a new source using cybersrce
|
|
16620
|
+
return handleCybersourcePayment(null, state);
|
|
16377
16621
|
}
|
|
16378
|
-
if (!
|
|
16379
|
-
return console.error("
|
|
16622
|
+
if (!cybersourceInstanceRef.current) {
|
|
16623
|
+
return console.error("Cybersource sdk script wasn't loaded, you need to load Cybersource sdk before rendering the Cybersource payment flow");
|
|
16380
16624
|
}
|
|
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);
|
|
16625
|
+
let options = {
|
|
16626
|
+
cardExpirationMonth: state.month,
|
|
16627
|
+
cardExpirationYear: state.year
|
|
16395
16628
|
};
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
if (result.error) {
|
|
16399
|
-
// Inform the user if there was an error
|
|
16400
|
-
onFailure(result.error);
|
|
16629
|
+
(_cybersourceInstanceR = cybersourceInstanceRef.current) === null || _cybersourceInstanceR === void 0 ? void 0 : _cybersourceInstanceR.createToken(options, function (err, response) {
|
|
16630
|
+
if (err) {
|
|
16401
16631
|
dispatch({
|
|
16402
16632
|
type: DISABLE_SUBMIT,
|
|
16403
16633
|
payload: false
|
|
@@ -16410,37 +16640,277 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16410
16640
|
type: SHOW_ALERT,
|
|
16411
16641
|
payload: {
|
|
16412
16642
|
type: "error",
|
|
16413
|
-
content:
|
|
16643
|
+
content: cybersourceErrorHandle(err)
|
|
16414
16644
|
}
|
|
16415
16645
|
});
|
|
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
|
-
|
|
16646
|
+
}
|
|
16647
|
+
handleCybersourcePayment(response.token, state);
|
|
16648
|
+
});
|
|
16649
|
+
};
|
|
16650
|
+
function handleCybersourcePayment(paymentRequest, state) {
|
|
16651
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16652
|
+
if (type === "createPayment") {
|
|
16653
|
+
handleCybersourceSubscription();
|
|
16654
|
+
} else if (type === "orderCreate") {
|
|
16655
|
+
purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
16656
|
+
} else if (type === "invoicePayment") {
|
|
16657
|
+
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
16658
|
+
} else if (type === "updatePaymentSource") {
|
|
16659
|
+
createNewCybersourceCard();
|
|
16660
|
+
}
|
|
16661
|
+
function createNewCybersourceCard() {
|
|
16662
|
+
window.Pelcro.source.create({
|
|
16663
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16664
|
+
token: paymentRequest,
|
|
16665
|
+
gateway: "cybersource"
|
|
16666
|
+
}, (err, res) => {
|
|
16667
|
+
dispatch({
|
|
16668
|
+
type: DISABLE_SUBMIT,
|
|
16669
|
+
payload: false
|
|
16670
|
+
});
|
|
16671
|
+
dispatch({
|
|
16672
|
+
type: LOADING,
|
|
16673
|
+
payload: false
|
|
16674
|
+
});
|
|
16675
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
16676
|
+
if (err) {
|
|
16677
|
+
onFailure(err);
|
|
16678
|
+
return dispatch({
|
|
16679
|
+
type: SHOW_ALERT,
|
|
16680
|
+
payload: {
|
|
16681
|
+
type: "error",
|
|
16682
|
+
content: getErrorMessages(err)
|
|
16683
|
+
}
|
|
16684
|
+
});
|
|
16685
|
+
}
|
|
16686
|
+
dispatch({
|
|
16687
|
+
type: SHOW_ALERT,
|
|
16688
|
+
payload: {
|
|
16689
|
+
type: "success",
|
|
16690
|
+
content: t("messages.sourceUpdated")
|
|
16691
|
+
}
|
|
16692
|
+
});
|
|
16693
|
+
onSuccess(res);
|
|
16694
|
+
} //
|
|
16695
|
+
);
|
|
16696
|
+
}
|
|
16697
|
+
|
|
16698
|
+
function handleCybersourceSubscription() {
|
|
16699
|
+
const payment = new Payment(new CybersourceGateway());
|
|
16700
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
16701
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16702
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16703
|
+
const renewGift = isRenewingGift;
|
|
16704
|
+
const {
|
|
16705
|
+
couponCode
|
|
16706
|
+
} = state;
|
|
16707
|
+
if (renewGift) {
|
|
16708
|
+
return payment.execute({
|
|
16709
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
16710
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16711
|
+
plan,
|
|
16712
|
+
couponCode,
|
|
16713
|
+
product,
|
|
16714
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16715
|
+
subscriptionIdToRenew,
|
|
16716
|
+
addressId: selectedAddressId
|
|
16717
|
+
}, (err, res) => {
|
|
16718
|
+
if (err) {
|
|
16719
|
+
return handlePaymentError(err);
|
|
16720
|
+
}
|
|
16721
|
+
onSuccess(res);
|
|
16722
|
+
});
|
|
16723
|
+
} else if (giftSubscriprition) {
|
|
16724
|
+
return payment.execute({
|
|
16725
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
16726
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16727
|
+
quantity: plan.quantity,
|
|
16728
|
+
plan,
|
|
16729
|
+
couponCode,
|
|
16730
|
+
product,
|
|
16731
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16732
|
+
giftRecipient,
|
|
16733
|
+
addressId: selectedAddressId
|
|
16734
|
+
}, (err, res) => {
|
|
16735
|
+
if (err) {
|
|
16736
|
+
return handlePaymentError(err);
|
|
16737
|
+
}
|
|
16738
|
+
onSuccess(res);
|
|
16739
|
+
});
|
|
16740
|
+
} else if (renewSubscription) {
|
|
16741
|
+
return payment.execute({
|
|
16742
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
16743
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16744
|
+
quantity: plan.quantity,
|
|
16745
|
+
plan,
|
|
16746
|
+
couponCode,
|
|
16747
|
+
product,
|
|
16748
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16749
|
+
subscriptionIdToRenew,
|
|
16750
|
+
addressId: selectedAddressId
|
|
16751
|
+
}, (err, res) => {
|
|
16752
|
+
if (err) {
|
|
16753
|
+
return handlePaymentError(err);
|
|
16754
|
+
}
|
|
16755
|
+
onSuccess(res);
|
|
16756
|
+
});
|
|
16757
|
+
} else if (createSubscription) {
|
|
16758
|
+
return payment.execute({
|
|
16759
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
16760
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
16761
|
+
quantity: plan.quantity,
|
|
16762
|
+
plan,
|
|
16763
|
+
couponCode,
|
|
16764
|
+
product,
|
|
16765
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
16766
|
+
addressId: selectedAddressId
|
|
16767
|
+
}, (err, res) => {
|
|
16768
|
+
if (err) {
|
|
16769
|
+
return handlePaymentError(err);
|
|
16770
|
+
}
|
|
16771
|
+
onSuccess(res);
|
|
16772
|
+
});
|
|
16773
|
+
}
|
|
16774
|
+
}
|
|
16775
|
+
}
|
|
16776
|
+
const tokenizeCard = (error, microformInstance) => {
|
|
16777
|
+
if (error) {
|
|
16778
|
+
return;
|
|
16779
|
+
}
|
|
16780
|
+
cybersourceInstanceRef.current = microformInstance;
|
|
16781
|
+
};
|
|
16782
|
+
const initCybersourceScript = () => {
|
|
16783
|
+
// jwk api call
|
|
16784
|
+
window.Pelcro.payment.getJWK({
|
|
16785
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16786
|
+
site_id: window.Pelcro.siteid
|
|
16787
|
+
}, (err, res) => {
|
|
16788
|
+
if (err) {
|
|
16789
|
+
onFailure(err);
|
|
16790
|
+
dispatch({
|
|
16791
|
+
type: DISABLE_SUBMIT,
|
|
16792
|
+
payload: false
|
|
16793
|
+
});
|
|
16794
|
+
dispatch({
|
|
16795
|
+
type: LOADING,
|
|
16796
|
+
payload: false
|
|
16797
|
+
});
|
|
16798
|
+
return dispatch({
|
|
16799
|
+
type: SHOW_ALERT,
|
|
16800
|
+
payload: {
|
|
16801
|
+
type: "error",
|
|
16802
|
+
content: getErrorMessages(err)
|
|
16803
|
+
}
|
|
16804
|
+
});
|
|
16805
|
+
}
|
|
16806
|
+
const {
|
|
16807
|
+
key: jwk
|
|
16808
|
+
} = res;
|
|
16809
|
+
// SETUP MICROFORM
|
|
16810
|
+
FLEX.microform({
|
|
16811
|
+
keyId: jwk.kid,
|
|
16812
|
+
keystore: jwk,
|
|
16813
|
+
container: "#cybersourceCardNumber",
|
|
16814
|
+
placeholder: "Card Number",
|
|
16815
|
+
styles: {
|
|
16816
|
+
input: {
|
|
16817
|
+
"font-size": "14px",
|
|
16818
|
+
"font-family": "helvetica, tahoma, calibri, sans-serif",
|
|
16819
|
+
color: "#555"
|
|
16820
|
+
},
|
|
16821
|
+
":focus": {
|
|
16822
|
+
color: "blue"
|
|
16823
|
+
},
|
|
16824
|
+
":disabled": {
|
|
16825
|
+
cursor: "not-allowed"
|
|
16826
|
+
},
|
|
16827
|
+
valid: {
|
|
16828
|
+
color: "#3c763d"
|
|
16829
|
+
},
|
|
16830
|
+
invalid: {
|
|
16831
|
+
color: "#a94442"
|
|
16832
|
+
}
|
|
16833
|
+
}
|
|
16834
|
+
}, tokenizeCard);
|
|
16835
|
+
});
|
|
16836
|
+
};
|
|
16837
|
+
|
|
16838
|
+
/*====== End Cybersource integration ========*/
|
|
16839
|
+
|
|
16840
|
+
/*====== Start Tap integration ========*/
|
|
16841
|
+
const submitUsingTap = state => {
|
|
16842
|
+
var _ref3, _ref4, _ref5, _state$updatedPrice;
|
|
16843
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16844
|
+
if (isUsingExistingPaymentMethod) {
|
|
16845
|
+
// no need to create a new source using tap
|
|
16846
|
+
return handleTapPayment(null, state);
|
|
16847
|
+
}
|
|
16848
|
+
if (!tapInstanceRef.current) {
|
|
16849
|
+
return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
|
|
16850
|
+
}
|
|
16851
|
+
const getOrderItemsTotal = () => {
|
|
16852
|
+
if (!order) {
|
|
16853
|
+
return null;
|
|
16854
|
+
}
|
|
16855
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
16856
|
+
if (isQuickPurchase) {
|
|
16857
|
+
return order.price * order.quantity;
|
|
16858
|
+
}
|
|
16859
|
+
if (order.length === 0) {
|
|
16860
|
+
return null;
|
|
16861
|
+
}
|
|
16862
|
+
return order.reduce((total, item) => {
|
|
16863
|
+
return total + item.price * item.quantity;
|
|
16864
|
+
}, 0);
|
|
16865
|
+
};
|
|
16866
|
+
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;
|
|
16867
|
+
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
16868
|
+
if (result.error) {
|
|
16869
|
+
// Inform the user if there was an error
|
|
16870
|
+
onFailure(result.error);
|
|
16871
|
+
dispatch({
|
|
16872
|
+
type: DISABLE_SUBMIT,
|
|
16873
|
+
payload: false
|
|
16874
|
+
});
|
|
16875
|
+
dispatch({
|
|
16876
|
+
type: LOADING,
|
|
16877
|
+
payload: false
|
|
16878
|
+
});
|
|
16879
|
+
return dispatch({
|
|
16880
|
+
type: SHOW_ALERT,
|
|
16881
|
+
payload: {
|
|
16882
|
+
type: "error",
|
|
16883
|
+
content: getErrorMessages(result.error)
|
|
16884
|
+
}
|
|
16885
|
+
});
|
|
16886
|
+
} else {
|
|
16887
|
+
window.Pelcro.payment.verify({
|
|
16888
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
16889
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
16890
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
16891
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
16892
|
+
site_id: window.Pelcro.siteid,
|
|
16893
|
+
amount: totalAmount,
|
|
16894
|
+
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,
|
|
16895
|
+
tap_token: result.id,
|
|
16896
|
+
funding: result.card.funding,
|
|
16897
|
+
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}`
|
|
16898
|
+
}, (err, res) => {
|
|
16899
|
+
if (err) {
|
|
16900
|
+
// Inform the user if there was an error
|
|
16901
|
+
onFailure(err);
|
|
16902
|
+
dispatch({
|
|
16903
|
+
type: DISABLE_SUBMIT,
|
|
16904
|
+
payload: false
|
|
16905
|
+
});
|
|
16906
|
+
dispatch({
|
|
16907
|
+
type: LOADING,
|
|
16908
|
+
payload: false
|
|
16909
|
+
});
|
|
16910
|
+
return dispatch({
|
|
16911
|
+
type: SHOW_ALERT,
|
|
16912
|
+
payload: {
|
|
16913
|
+
type: "error",
|
|
16444
16914
|
content: getErrorMessages(err)
|
|
16445
16915
|
}
|
|
16446
16916
|
});
|
|
@@ -16658,7 +17128,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16658
17128
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16659
17129
|
if (isUsingExistingPaymentMethod) {
|
|
16660
17130
|
// no need to create a new source using vantiv
|
|
16661
|
-
return handleVantivPayment(null);
|
|
17131
|
+
return handleVantivPayment(null, state.couponCode);
|
|
16662
17132
|
}
|
|
16663
17133
|
if (!vantivInstanceRef.current) {
|
|
16664
17134
|
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
@@ -16810,8 +17280,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16810
17280
|
const vantivInstanceRef = React__default.useRef(null);
|
|
16811
17281
|
const tapInstanceRef = React__default.useRef(null);
|
|
16812
17282
|
const tapInstanceCard = React__default.useRef(null);
|
|
17283
|
+
const cybersourceInstanceRef = React__default.useRef(null);
|
|
16813
17284
|
useEffect(() => {
|
|
16814
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17285
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16815
17286
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
16816
17287
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
16817
17288
|
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 +17318,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16847
17318
|
}, [vantivPaymentRequest]);
|
|
16848
17319
|
useEffect(() => {
|
|
16849
17320
|
whenUserReady(() => {
|
|
16850
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17321
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16851
17322
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
16852
17323
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
16853
17324
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -16858,10 +17329,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16858
17329
|
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
16859
17330
|
initTapScript();
|
|
16860
17331
|
}
|
|
17332
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
|
|
17333
|
+
window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
|
|
17334
|
+
document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
|
|
17335
|
+
initCybersourceScript();
|
|
17336
|
+
});
|
|
17337
|
+
}
|
|
17338
|
+
if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
|
|
17339
|
+
initCybersourceScript();
|
|
17340
|
+
}
|
|
16861
17341
|
});
|
|
16862
17342
|
}, [selectedPaymentMethodId]);
|
|
16863
17343
|
const initPaymentRequest = (state, dispatch) => {
|
|
16864
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17344
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16865
17345
|
try {
|
|
16866
17346
|
const paymentRequest = stripe.paymentRequest({
|
|
16867
17347
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16873,13 +17353,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16873
17353
|
});
|
|
16874
17354
|
|
|
16875
17355
|
// When Google pay / Apple pay source created
|
|
16876
|
-
paymentRequest.on("source",
|
|
17356
|
+
paymentRequest.on("source", _ref6 => {
|
|
16877
17357
|
var _source$card;
|
|
16878
17358
|
let {
|
|
16879
17359
|
complete,
|
|
16880
17360
|
source,
|
|
16881
17361
|
...data
|
|
16882
|
-
} =
|
|
17362
|
+
} = _ref6;
|
|
16883
17363
|
dispatch({
|
|
16884
17364
|
type: DISABLE_COUPON_BUTTON,
|
|
16885
17365
|
payload: true
|
|
@@ -16894,11 +17374,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16894
17374
|
});
|
|
16895
17375
|
complete("success");
|
|
16896
17376
|
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(
|
|
17377
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
16898
17378
|
let {
|
|
16899
17379
|
source,
|
|
16900
17380
|
error
|
|
16901
|
-
} =
|
|
17381
|
+
} = _ref7;
|
|
16902
17382
|
if (error) {
|
|
16903
17383
|
return handlePaymentError(error);
|
|
16904
17384
|
}
|
|
@@ -16930,7 +17410,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16930
17410
|
*/
|
|
16931
17411
|
const updateTotalAmountWithTax = () => {
|
|
16932
17412
|
var _window$Pelcro$site$r4;
|
|
16933
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 ||
|
|
17413
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16934
17414
|
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
17415
|
if (taxesEnabled && type === "createPayment") {
|
|
16936
17416
|
dispatch({
|
|
@@ -17205,6 +17685,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17205
17685
|
type: LOADING,
|
|
17206
17686
|
payload: false
|
|
17207
17687
|
});
|
|
17688
|
+
onFailure(error);
|
|
17208
17689
|
return dispatch({
|
|
17209
17690
|
type: SHOW_ALERT,
|
|
17210
17691
|
payload: {
|
|
@@ -17427,16 +17908,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17427
17908
|
items: mappedOrderItems,
|
|
17428
17909
|
addressId: selectedAddressId,
|
|
17429
17910
|
couponCode
|
|
17430
|
-
}, (err,
|
|
17431
|
-
|
|
17432
|
-
type: DISABLE_SUBMIT,
|
|
17433
|
-
payload: false
|
|
17434
|
-
});
|
|
17435
|
-
dispatch({
|
|
17436
|
-
type: LOADING,
|
|
17437
|
-
payload: false
|
|
17438
|
-
});
|
|
17911
|
+
}, (err, orderResponse) => {
|
|
17912
|
+
var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
|
|
17439
17913
|
if (err) {
|
|
17914
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17915
|
+
dispatch({
|
|
17916
|
+
type: DISABLE_SUBMIT,
|
|
17917
|
+
payload: false
|
|
17918
|
+
});
|
|
17919
|
+
dispatch({
|
|
17920
|
+
type: LOADING,
|
|
17921
|
+
payload: false
|
|
17922
|
+
});
|
|
17440
17923
|
onFailure(err);
|
|
17441
17924
|
return dispatch({
|
|
17442
17925
|
type: SHOW_ALERT,
|
|
@@ -17456,7 +17939,30 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17456
17939
|
cartItems: []
|
|
17457
17940
|
});
|
|
17458
17941
|
}
|
|
17459
|
-
|
|
17942
|
+
window.Pelcro.user.refresh({
|
|
17943
|
+
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
|
|
17944
|
+
}, (err, res) => {
|
|
17945
|
+
dispatch({
|
|
17946
|
+
type: DISABLE_SUBMIT,
|
|
17947
|
+
payload: false
|
|
17948
|
+
});
|
|
17949
|
+
dispatch({
|
|
17950
|
+
type: LOADING,
|
|
17951
|
+
payload: false
|
|
17952
|
+
});
|
|
17953
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17954
|
+
if (err) {
|
|
17955
|
+
onFailure(err);
|
|
17956
|
+
return dispatch({
|
|
17957
|
+
type: SHOW_ALERT,
|
|
17958
|
+
payload: {
|
|
17959
|
+
type: "error",
|
|
17960
|
+
content: getErrorMessages(err)
|
|
17961
|
+
}
|
|
17962
|
+
});
|
|
17963
|
+
}
|
|
17964
|
+
onSuccess(orderResponse);
|
|
17965
|
+
});
|
|
17460
17966
|
});
|
|
17461
17967
|
};
|
|
17462
17968
|
const payInvoice = (gatewayService, gatewayToken, dispatch) => {
|
|
@@ -17473,12 +17979,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17473
17979
|
const updatePaymentSource = (state, dispatch) => {
|
|
17474
17980
|
return stripe.createSource({
|
|
17475
17981
|
type: "card"
|
|
17476
|
-
}).then(
|
|
17982
|
+
}).then(_ref8 => {
|
|
17477
17983
|
var _source$card2;
|
|
17478
17984
|
let {
|
|
17479
17985
|
source,
|
|
17480
17986
|
error
|
|
17481
|
-
} =
|
|
17987
|
+
} = _ref8;
|
|
17482
17988
|
if (error) {
|
|
17483
17989
|
return handlePaymentError(error);
|
|
17484
17990
|
}
|
|
@@ -17534,7 +18040,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17534
18040
|
});
|
|
17535
18041
|
};
|
|
17536
18042
|
const submitPayment = (state, dispatch) => {
|
|
17537
|
-
if (skipPayment &&
|
|
18043
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17538
18044
|
const isQuickPurchase = !Array.isArray(order);
|
|
17539
18045
|
const mappedOrderItems = isQuickPurchase ? [{
|
|
17540
18046
|
sku_id: order.id,
|
|
@@ -17559,12 +18065,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17559
18065
|
}
|
|
17560
18066
|
stripe.createSource({
|
|
17561
18067
|
type: "card"
|
|
17562
|
-
}).then(
|
|
17563
|
-
var
|
|
18068
|
+
}).then(_ref9 => {
|
|
18069
|
+
var _ref10, _ref11, _state$updatedPrice2;
|
|
17564
18070
|
let {
|
|
17565
18071
|
source,
|
|
17566
18072
|
error
|
|
17567
|
-
} =
|
|
18073
|
+
} = _ref9;
|
|
17568
18074
|
if (error) {
|
|
17569
18075
|
return handlePaymentError(error);
|
|
17570
18076
|
}
|
|
@@ -17583,7 +18089,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17583
18089
|
return total + item.price * item.quantity;
|
|
17584
18090
|
}, 0);
|
|
17585
18091
|
};
|
|
17586
|
-
(
|
|
18092
|
+
(_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
18093
|
return handlePayment(source);
|
|
17588
18094
|
}).catch(error => {
|
|
17589
18095
|
return handlePaymentError(error);
|
|
@@ -17790,15 +18296,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17790
18296
|
disableSubmit: true,
|
|
17791
18297
|
isLoading: true
|
|
17792
18298
|
}, (state, dispatch) => {
|
|
17793
|
-
if (skipPayment &&
|
|
18299
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17794
18300
|
return submitPayment(state);
|
|
17795
18301
|
}
|
|
17796
18302
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17797
|
-
return submitUsingVantiv();
|
|
18303
|
+
return submitUsingVantiv(state);
|
|
17798
18304
|
}
|
|
17799
18305
|
if (getSiteCardProcessor() === "tap") {
|
|
17800
18306
|
return submitUsingTap(state);
|
|
17801
18307
|
}
|
|
18308
|
+
if (getSiteCardProcessor() === "cybersource") {
|
|
18309
|
+
return submitUsingCybersource(state, dispatch);
|
|
18310
|
+
}
|
|
17802
18311
|
if (selectedPaymentMethodId) {
|
|
17803
18312
|
// pay with selected method (source) if exists already
|
|
17804
18313
|
return handlePayment({
|
|
@@ -17866,6 +18375,16 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17866
18375
|
...state,
|
|
17867
18376
|
percentOff: action.payload
|
|
17868
18377
|
});
|
|
18378
|
+
case SET_MONTH:
|
|
18379
|
+
return lib_7({
|
|
18380
|
+
...state,
|
|
18381
|
+
month: action.payload
|
|
18382
|
+
});
|
|
18383
|
+
case SET_YEAR:
|
|
18384
|
+
return lib_7({
|
|
18385
|
+
...state,
|
|
18386
|
+
year: action.payload
|
|
18387
|
+
});
|
|
17869
18388
|
case SET_FIRST_NAME:
|
|
17870
18389
|
return lib_7({
|
|
17871
18390
|
...state,
|
|
@@ -17956,13 +18475,122 @@ const PaymentMethodContainer = props => {
|
|
|
17956
18475
|
}, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
|
|
17957
18476
|
store: store$k
|
|
17958
18477
|
}, props))));
|
|
17959
|
-
} else {
|
|
18478
|
+
} else if (cardProcessor !== "stripe") {
|
|
17960
18479
|
return /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
17961
18480
|
store: store$k
|
|
17962
18481
|
}, props));
|
|
17963
18482
|
}
|
|
18483
|
+
return null;
|
|
17964
18484
|
};
|
|
17965
18485
|
|
|
18486
|
+
function Select(_ref) {
|
|
18487
|
+
let {
|
|
18488
|
+
label = "",
|
|
18489
|
+
required,
|
|
18490
|
+
id,
|
|
18491
|
+
errorId,
|
|
18492
|
+
error = "",
|
|
18493
|
+
className = "",
|
|
18494
|
+
labelClassName = "",
|
|
18495
|
+
errorClassName = "",
|
|
18496
|
+
wrapperClassName = "",
|
|
18497
|
+
children,
|
|
18498
|
+
...otherProps
|
|
18499
|
+
} = _ref;
|
|
18500
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
18501
|
+
className: `pelcro-input-wrapper ${wrapperClassName}`
|
|
18502
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
18503
|
+
htmlFor: id,
|
|
18504
|
+
className: `pelcro-input-label ${labelClassName}`
|
|
18505
|
+
}, `${label}${required ? "*" : ""}`), /*#__PURE__*/React__default.createElement("select", Object.assign({
|
|
18506
|
+
id: id,
|
|
18507
|
+
className: `pelcro-input-field ${className} ${error ? "pelcro-input-invalid" : ""}`,
|
|
18508
|
+
"aria-describedby": errorId,
|
|
18509
|
+
"aria-invalid": Boolean(error)
|
|
18510
|
+
}, otherProps), children), error && /*#__PURE__*/React__default.createElement("p", {
|
|
18511
|
+
id: errorId,
|
|
18512
|
+
"aria-live": "assertive",
|
|
18513
|
+
className: `pelcro-input-error ${errorClassName}`
|
|
18514
|
+
}, error));
|
|
18515
|
+
}
|
|
18516
|
+
|
|
18517
|
+
function MonthSelect(_ref) {
|
|
18518
|
+
let {
|
|
18519
|
+
placeholder,
|
|
18520
|
+
store,
|
|
18521
|
+
...otherProps
|
|
18522
|
+
} = _ref;
|
|
18523
|
+
const {
|
|
18524
|
+
dispatch,
|
|
18525
|
+
state: {
|
|
18526
|
+
month
|
|
18527
|
+
}
|
|
18528
|
+
} = useContext(store);
|
|
18529
|
+
const get2digits = num => num < 10 ? "0" + num.toString() : num.toString();
|
|
18530
|
+
const createMonthsItems = useMemo(() => {
|
|
18531
|
+
return [...Array.from({
|
|
18532
|
+
length: 12
|
|
18533
|
+
}, (_, i) => i + 1)].map(i => {
|
|
18534
|
+
return /*#__PURE__*/React__default.createElement("option", {
|
|
18535
|
+
key: i,
|
|
18536
|
+
value: get2digits(i)
|
|
18537
|
+
}, get2digits(i));
|
|
18538
|
+
});
|
|
18539
|
+
}, []);
|
|
18540
|
+
const handleInputChange = value => {
|
|
18541
|
+
dispatch({
|
|
18542
|
+
type: SET_MONTH,
|
|
18543
|
+
payload: value
|
|
18544
|
+
});
|
|
18545
|
+
};
|
|
18546
|
+
return /*#__PURE__*/React__default.createElement(Select, Object.assign({
|
|
18547
|
+
value: month,
|
|
18548
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18549
|
+
}, otherProps), /*#__PURE__*/React__default.createElement("option", {
|
|
18550
|
+
value: "",
|
|
18551
|
+
disabled: true,
|
|
18552
|
+
selected: true
|
|
18553
|
+
}, placeholder), createMonthsItems);
|
|
18554
|
+
}
|
|
18555
|
+
|
|
18556
|
+
function YearSelect(_ref) {
|
|
18557
|
+
let {
|
|
18558
|
+
placeholder,
|
|
18559
|
+
store,
|
|
18560
|
+
...otherProps
|
|
18561
|
+
} = _ref;
|
|
18562
|
+
const {
|
|
18563
|
+
dispatch,
|
|
18564
|
+
state: {
|
|
18565
|
+
year
|
|
18566
|
+
}
|
|
18567
|
+
} = useContext(store);
|
|
18568
|
+
const createYearsItems = useMemo(() => {
|
|
18569
|
+
return Array.from({
|
|
18570
|
+
length: 10
|
|
18571
|
+
}, (_, i) => i + new Date().getFullYear()).map(i => {
|
|
18572
|
+
return /*#__PURE__*/React__default.createElement("option", {
|
|
18573
|
+
key: i,
|
|
18574
|
+
value: i
|
|
18575
|
+
}, i);
|
|
18576
|
+
});
|
|
18577
|
+
}, []);
|
|
18578
|
+
const handleInputChange = value => {
|
|
18579
|
+
dispatch({
|
|
18580
|
+
type: SET_YEAR,
|
|
18581
|
+
payload: value
|
|
18582
|
+
});
|
|
18583
|
+
};
|
|
18584
|
+
return /*#__PURE__*/React__default.createElement(Select, Object.assign({
|
|
18585
|
+
value: year,
|
|
18586
|
+
onChange: e => handleInputChange(e.target.value)
|
|
18587
|
+
}, otherProps), /*#__PURE__*/React__default.createElement("option", {
|
|
18588
|
+
value: "",
|
|
18589
|
+
disabled: true,
|
|
18590
|
+
selected: true
|
|
18591
|
+
}, placeholder), createYearsItems);
|
|
18592
|
+
}
|
|
18593
|
+
|
|
17966
18594
|
const StripeInputStyle = {
|
|
17967
18595
|
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
18596
|
focus: "plc-ring-2 plc-ring-primary-400",
|
|
@@ -18052,6 +18680,24 @@ const CheckoutForm = () => {
|
|
|
18052
18680
|
id: "tapPaymentIframe"
|
|
18053
18681
|
});
|
|
18054
18682
|
}
|
|
18683
|
+
if (cardProcessor === "cybersource") {
|
|
18684
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
18685
|
+
id: "cybersourceCardNumber",
|
|
18686
|
+
className: "pelcro-input-field plc-h-12"
|
|
18687
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
18688
|
+
className: "plc-flex plc-items-end plc-justify-between plc-my-2"
|
|
18689
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
18690
|
+
className: "plc-w-6/12 plc-pr-4"
|
|
18691
|
+
}, /*#__PURE__*/React__default.createElement(MonthSelect, {
|
|
18692
|
+
store: store$k,
|
|
18693
|
+
placeholder: "Exp Month"
|
|
18694
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
18695
|
+
className: "plc-w-6/12"
|
|
18696
|
+
}, /*#__PURE__*/React__default.createElement(YearSelect, {
|
|
18697
|
+
store: store$k,
|
|
18698
|
+
placeholder: "Exp Year"
|
|
18699
|
+
}))));
|
|
18700
|
+
}
|
|
18055
18701
|
if (cardProcessor === "stripe") {
|
|
18056
18702
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(PelcroCardNumber, {
|
|
18057
18703
|
autoFocus: true
|
|
@@ -18790,7 +19436,7 @@ const OrderCreateFreeButton = _ref => {
|
|
|
18790
19436
|
*
|
|
18791
19437
|
*/
|
|
18792
19438
|
function PaymentMethodView(_ref) {
|
|
18793
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
19439
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _calcAndFormatItemsTo, _order$;
|
|
18794
19440
|
let {
|
|
18795
19441
|
onSuccess,
|
|
18796
19442
|
onGiftRenewalSuccess,
|
|
@@ -18808,6 +19454,7 @@ function PaymentMethodView(_ref) {
|
|
|
18808
19454
|
const cardProcessor = getSiteCardProcessor();
|
|
18809
19455
|
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
19456
|
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);
|
|
19457
|
+
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
19458
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
18812
19459
|
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
18813
19460
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
@@ -18817,11 +19464,13 @@ function PaymentMethodView(_ref) {
|
|
|
18817
19464
|
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
19465
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
18819
19466
|
className: "plc-text-gray-600"
|
|
18820
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
19467
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default.createElement("span", {
|
|
19468
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
19469
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default.createElement("span", {
|
|
18821
19470
|
className: "plc-tracking-wider plc-uppercase"
|
|
18822
|
-
},
|
|
19471
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
18823
19472
|
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", {
|
|
19473
|
+
}, (_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
19474
|
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
19475
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
18827
19476
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -18837,7 +19486,8 @@ function PaymentMethodView(_ref) {
|
|
|
18837
19486
|
type: type,
|
|
18838
19487
|
onSuccess: onSuccess,
|
|
18839
19488
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18840
|
-
onFailure: onFailure
|
|
19489
|
+
onFailure: onFailure,
|
|
19490
|
+
freeOrders: showOrderButton
|
|
18841
19491
|
}, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
18842
19492
|
className: "plc-mb-2"
|
|
18843
19493
|
}), 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 +19512,7 @@ function PaymentMethodView(_ref) {
|
|
|
18862
19512
|
className: "plc-mb-2"
|
|
18863
19513
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
18864
19514
|
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)))));
|
|
19515
|
+
}, /*#__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
19516
|
}
|
|
18867
19517
|
|
|
18868
19518
|
const SubscriptionRenewView = _ref => {
|
|
@@ -21489,6 +22139,7 @@ const AddressCreateContainer = _ref => {
|
|
|
21489
22139
|
first_name: firstName,
|
|
21490
22140
|
last_name: lastName,
|
|
21491
22141
|
line1: line1,
|
|
22142
|
+
line2: line2,
|
|
21492
22143
|
city: city,
|
|
21493
22144
|
state: state,
|
|
21494
22145
|
country: country,
|
|
@@ -21883,37 +22534,6 @@ const AddressCreateSubmit = _ref => {
|
|
|
21883
22534
|
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
21884
22535
|
};
|
|
21885
22536
|
|
|
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
22537
|
function CountrySelect(_ref) {
|
|
21918
22538
|
let {
|
|
21919
22539
|
placeholder,
|
|
@@ -22316,6 +22936,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
22316
22936
|
first_name: firstName,
|
|
22317
22937
|
last_name: lastName,
|
|
22318
22938
|
line1: line1,
|
|
22939
|
+
line2: line2,
|
|
22319
22940
|
city: city,
|
|
22320
22941
|
state: state,
|
|
22321
22942
|
country: country,
|
|
@@ -24263,7 +24884,7 @@ const OrderCreateView = props => {
|
|
|
24263
24884
|
order
|
|
24264
24885
|
} = usePelcro();
|
|
24265
24886
|
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;
|
|
24887
|
+
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
24888
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
24268
24889
|
id: "pelcro-order-create-view"
|
|
24269
24890
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -27597,7 +28218,7 @@ const InvoicesItems = () => {
|
|
|
27597
28218
|
setInvoice,
|
|
27598
28219
|
switchView
|
|
27599
28220
|
} = 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 : [];
|
|
28221
|
+
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
28222
|
const showInvoiceDetails = event => {
|
|
27602
28223
|
if (setInvoice(event.target.dataset.id)) {
|
|
27603
28224
|
switchView("invoice-details");
|
|
@@ -28365,7 +28986,7 @@ class Dashboard extends Component {
|
|
|
28365
28986
|
}
|
|
28366
28987
|
function hasInvoices() {
|
|
28367
28988
|
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 : [];
|
|
28989
|
+
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
28990
|
return invoices.length > 0;
|
|
28370
28991
|
}
|
|
28371
28992
|
function hasDonationSubs() {
|