@pelcro/react-pelcro-js 4.0.0-alpha.117 → 4.0.0-alpha.119
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 +297 -37
- package/dist/index.esm.js +297 -37
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -14406,7 +14406,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default['default'].createE
|
|
|
14406
14406
|
*
|
|
14407
14407
|
*/
|
|
14408
14408
|
function RegisterView(props) {
|
|
14409
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
|
|
14409
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
14410
14410
|
const {
|
|
14411
14411
|
t
|
|
14412
14412
|
} = useTranslation("register");
|
|
@@ -14414,6 +14414,7 @@ function RegisterView(props) {
|
|
|
14414
14414
|
const auth0LoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.auth0_client_id;
|
|
14415
14415
|
const socialLoginEnabled = ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.facebook_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.google_app_id) || auth0LoginEnabled;
|
|
14416
14416
|
const showNameFields = (_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.enableNameFieldsInRegister;
|
|
14417
|
+
const nameFieldsRequired = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.requireNameFieldsInRegister;
|
|
14417
14418
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14418
14419
|
id: "pelcro-register-view"
|
|
14419
14420
|
}, /*#__PURE__*/React__default['default'].createElement("form", {
|
|
@@ -14441,11 +14442,15 @@ function RegisterView(props) {
|
|
|
14441
14442
|
className: "plc-flex plc-items-start"
|
|
14442
14443
|
}, /*#__PURE__*/React__default['default'].createElement(RegisterFirstName, {
|
|
14443
14444
|
id: "pelcro-input-first-name",
|
|
14444
|
-
label: t("labels.firstName")
|
|
14445
|
+
label: `${t("labels.firstName")}${nameFieldsRequired ? " *" : ""}`,
|
|
14446
|
+
errorId: "pelcro-input-firstName-error",
|
|
14447
|
+
required: nameFieldsRequired
|
|
14445
14448
|
}), /*#__PURE__*/React__default['default'].createElement(RegisterLastName, {
|
|
14446
14449
|
wrapperClassName: "plc-ml-3",
|
|
14447
14450
|
id: "pelcro-input-last-name",
|
|
14448
|
-
label: t("labels.lastName")
|
|
14451
|
+
label: `${t("labels.lastName")}${nameFieldsRequired ? " *" : ""}`,
|
|
14452
|
+
errorId: "pelcro-input-lastName-error",
|
|
14453
|
+
required: nameFieldsRequired
|
|
14449
14454
|
})), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
14450
14455
|
id: "pelcro-input-email",
|
|
14451
14456
|
errorId: "pelcro-input-email-error",
|
|
@@ -46423,7 +46428,10 @@ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormDat
|
|
|
46423
46428
|
|
|
46424
46429
|
axios.default = axios;
|
|
46425
46430
|
|
|
46426
|
-
const OrderCreateView =
|
|
46431
|
+
const OrderCreateView = ({
|
|
46432
|
+
showExternalPaymentMethods = false,
|
|
46433
|
+
...props
|
|
46434
|
+
}) => {
|
|
46427
46435
|
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _addresses$find, _addresses$find2;
|
|
46428
46436
|
const {
|
|
46429
46437
|
t
|
|
@@ -46512,7 +46520,7 @@ const OrderCreateView = props => {
|
|
|
46512
46520
|
}, address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
46513
46521
|
type: "orderCreate",
|
|
46514
46522
|
showCoupon: true,
|
|
46515
|
-
showExternalPaymentMethods:
|
|
46523
|
+
showExternalPaymentMethods: showExternalPaymentMethods,
|
|
46516
46524
|
showApplePayButton: true,
|
|
46517
46525
|
showOrderButton: showOrderButton,
|
|
46518
46526
|
order: order,
|
|
@@ -49281,57 +49289,306 @@ function YearSelect({
|
|
|
49281
49289
|
}, placeholder), createYearsItems);
|
|
49282
49290
|
}
|
|
49283
49291
|
|
|
49284
|
-
const PelcroPaymentRequestButton =
|
|
49292
|
+
const PelcroPaymentRequestButton = ({
|
|
49293
|
+
type,
|
|
49294
|
+
onSuccess,
|
|
49295
|
+
onFailure,
|
|
49296
|
+
...props
|
|
49297
|
+
}) => {
|
|
49298
|
+
const stripe = useStripe();
|
|
49299
|
+
const [isInitializing, setIsInitializing] = React.useState(true);
|
|
49300
|
+
const [localPaymentRequest, setLocalPaymentRequest] = React.useState(null);
|
|
49285
49301
|
const {
|
|
49286
|
-
state
|
|
49287
|
-
|
|
49288
|
-
paymentRequest,
|
|
49289
|
-
currentPlan,
|
|
49290
|
-
updatedPrice
|
|
49291
|
-
}
|
|
49302
|
+
state,
|
|
49303
|
+
dispatch
|
|
49292
49304
|
} = React.useContext(store$m);
|
|
49293
|
-
const
|
|
49294
|
-
|
|
49295
|
-
|
|
49296
|
-
|
|
49297
|
-
|
|
49298
|
-
|
|
49305
|
+
const {
|
|
49306
|
+
canMakePayment,
|
|
49307
|
+
currentPlan,
|
|
49308
|
+
updatedPrice
|
|
49309
|
+
} = state;
|
|
49310
|
+
const {
|
|
49311
|
+
order,
|
|
49312
|
+
set,
|
|
49313
|
+
selectedPaymentMethodId
|
|
49314
|
+
} = usePelcro();
|
|
49315
|
+
const getOrderInfo = () => {
|
|
49316
|
+
if (!order) {
|
|
49317
|
+
return {
|
|
49318
|
+
price: null,
|
|
49319
|
+
currency: null,
|
|
49320
|
+
label: null
|
|
49321
|
+
};
|
|
49322
|
+
}
|
|
49323
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
49324
|
+
if (isQuickPurchase) {
|
|
49325
|
+
return {
|
|
49326
|
+
price: order.price * order.quantity,
|
|
49327
|
+
currency: order.currency,
|
|
49328
|
+
label: order.name
|
|
49329
|
+
};
|
|
49330
|
+
}
|
|
49331
|
+
if (order.length === 0) {
|
|
49332
|
+
return {
|
|
49333
|
+
price: null,
|
|
49334
|
+
currency: null,
|
|
49335
|
+
label: null
|
|
49336
|
+
};
|
|
49337
|
+
}
|
|
49338
|
+
const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
49339
|
+
return {
|
|
49340
|
+
price,
|
|
49341
|
+
currency: order[0].currency,
|
|
49342
|
+
label: "Order"
|
|
49343
|
+
};
|
|
49344
|
+
};
|
|
49345
|
+
const orderPrice = getOrderInfo().price;
|
|
49346
|
+
const orderCurrency = getOrderInfo().currency;
|
|
49347
|
+
const orderLabel = getOrderInfo().label;
|
|
49348
|
+
const purchase = (gatewayService, gatewayToken, state, dispatch) => {
|
|
49349
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
49350
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
49351
|
+
sku_id: order.id,
|
|
49352
|
+
quantity: order.quantity
|
|
49353
|
+
}] : order.map(item => ({
|
|
49354
|
+
sku_id: item.id,
|
|
49355
|
+
quantity: item.quantity
|
|
49356
|
+
}));
|
|
49357
|
+
const {
|
|
49358
|
+
couponCode
|
|
49359
|
+
} = state;
|
|
49360
|
+
const payment = new Payment(gatewayService);
|
|
49361
|
+
payment.execute({
|
|
49362
|
+
type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
|
|
49363
|
+
token: gatewayToken,
|
|
49364
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
49365
|
+
items: mappedOrderItems,
|
|
49366
|
+
addressId: state.selectedAddressId,
|
|
49367
|
+
couponCode
|
|
49368
|
+
}, (err, orderResponse) => {
|
|
49369
|
+
var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
|
|
49370
|
+
if (err) {
|
|
49371
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
49372
|
+
dispatch({
|
|
49373
|
+
type: DISABLE_SUBMIT,
|
|
49374
|
+
payload: false
|
|
49375
|
+
});
|
|
49376
|
+
dispatch({
|
|
49377
|
+
type: LOADING,
|
|
49378
|
+
payload: false
|
|
49379
|
+
});
|
|
49380
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
49381
|
+
return dispatch({
|
|
49382
|
+
type: SHOW_ALERT,
|
|
49383
|
+
payload: {
|
|
49384
|
+
type: "error",
|
|
49385
|
+
content: getErrorMessages(err)
|
|
49386
|
+
}
|
|
49387
|
+
});
|
|
49299
49388
|
}
|
|
49389
|
+
if (isQuickPurchase) {
|
|
49390
|
+
set({
|
|
49391
|
+
order: null
|
|
49392
|
+
});
|
|
49393
|
+
} else {
|
|
49394
|
+
set({
|
|
49395
|
+
order: null,
|
|
49396
|
+
cartItems: []
|
|
49397
|
+
});
|
|
49398
|
+
}
|
|
49399
|
+
window.Pelcro.user.refresh({
|
|
49400
|
+
auth_token: (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.auth_token
|
|
49401
|
+
}, (err, res) => {
|
|
49402
|
+
dispatch({
|
|
49403
|
+
type: DISABLE_SUBMIT,
|
|
49404
|
+
payload: false
|
|
49405
|
+
});
|
|
49406
|
+
dispatch({
|
|
49407
|
+
type: LOADING,
|
|
49408
|
+
payload: false
|
|
49409
|
+
});
|
|
49410
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
49411
|
+
if (err) {
|
|
49412
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
49413
|
+
return dispatch({
|
|
49414
|
+
type: SHOW_ALERT,
|
|
49415
|
+
payload: {
|
|
49416
|
+
type: "error",
|
|
49417
|
+
content: getErrorMessages(err)
|
|
49418
|
+
}
|
|
49419
|
+
});
|
|
49420
|
+
}
|
|
49421
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(orderResponse);
|
|
49422
|
+
});
|
|
49300
49423
|
});
|
|
49301
49424
|
};
|
|
49302
|
-
|
|
49303
|
-
|
|
49304
|
-
|
|
49305
|
-
|
|
49306
|
-
|
|
49425
|
+
React.useEffect(() => {
|
|
49426
|
+
if (!stripe) {
|
|
49427
|
+
setIsInitializing(false);
|
|
49428
|
+
return;
|
|
49429
|
+
}
|
|
49430
|
+
let mounted = true;
|
|
49431
|
+
const initializePaymentRequest = async () => {
|
|
49432
|
+
try {
|
|
49433
|
+
var _ref;
|
|
49434
|
+
const pr = stripe.paymentRequest({
|
|
49435
|
+
country: window.Pelcro.user.location.countryCode || "US",
|
|
49436
|
+
currency: ((currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.currency) || orderCurrency).toLowerCase(),
|
|
49437
|
+
total: {
|
|
49438
|
+
label: (currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.nickname) || (currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.description) || orderLabel || "Payment",
|
|
49439
|
+
amount: (_ref = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.amount) !== null && _ref !== void 0 ? _ref : orderPrice,
|
|
49440
|
+
pending: false
|
|
49441
|
+
},
|
|
49442
|
+
requestPayerEmail: false,
|
|
49443
|
+
requestPayerName: false,
|
|
49444
|
+
requestShipping: false
|
|
49445
|
+
});
|
|
49446
|
+
pr.on("source", async event => {
|
|
49447
|
+
try {
|
|
49448
|
+
var _event$source, _event$source$card;
|
|
49449
|
+
dispatch({
|
|
49450
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49451
|
+
payload: true
|
|
49452
|
+
});
|
|
49453
|
+
dispatch({
|
|
49454
|
+
type: DISABLE_SUBMIT,
|
|
49455
|
+
payload: true
|
|
49456
|
+
});
|
|
49457
|
+
dispatch({
|
|
49458
|
+
type: LOADING,
|
|
49459
|
+
payload: true
|
|
49460
|
+
});
|
|
49461
|
+
event.complete("success");
|
|
49462
|
+
if (((_event$source = event.source) === null || _event$source === void 0 ? void 0 : (_event$source$card = _event$source.card) === null || _event$source$card === void 0 ? void 0 : _event$source$card.three_d_secure) === "required") {
|
|
49463
|
+
return generate3DSecureSource(event.source).then(({
|
|
49464
|
+
source,
|
|
49465
|
+
error
|
|
49466
|
+
}) => {
|
|
49467
|
+
if (error) {
|
|
49468
|
+
return handlePaymentError(error);
|
|
49469
|
+
}
|
|
49470
|
+
toggleAuthenticationPendingView(true, source);
|
|
49471
|
+
});
|
|
49472
|
+
}
|
|
49473
|
+
|
|
49474
|
+
// Handle different payment types
|
|
49475
|
+
if (type === "orderCreate") {
|
|
49476
|
+
purchase(new StripeGateway(), event.source.id, state, dispatch);
|
|
49477
|
+
} else {
|
|
49478
|
+
dispatch({
|
|
49479
|
+
type: SUBSCRIBE,
|
|
49480
|
+
payload: {
|
|
49481
|
+
id: event.source.id,
|
|
49482
|
+
isExistingSource: false
|
|
49483
|
+
}
|
|
49484
|
+
});
|
|
49485
|
+
}
|
|
49486
|
+
} catch (error) {
|
|
49487
|
+
dispatch({
|
|
49488
|
+
type: SHOW_ALERT,
|
|
49489
|
+
payload: {
|
|
49490
|
+
type: "error",
|
|
49491
|
+
content: error.message || "Payment failed. Please try again."
|
|
49492
|
+
}
|
|
49493
|
+
});
|
|
49494
|
+
event.complete("fail");
|
|
49495
|
+
dispatch({
|
|
49496
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49497
|
+
payload: false
|
|
49498
|
+
});
|
|
49499
|
+
dispatch({
|
|
49500
|
+
type: DISABLE_SUBMIT,
|
|
49501
|
+
payload: false
|
|
49502
|
+
});
|
|
49503
|
+
dispatch({
|
|
49504
|
+
type: LOADING,
|
|
49505
|
+
payload: false
|
|
49506
|
+
});
|
|
49507
|
+
}
|
|
49508
|
+
});
|
|
49509
|
+
pr.on("cancel", () => {
|
|
49510
|
+
dispatch({
|
|
49511
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49512
|
+
payload: false
|
|
49513
|
+
});
|
|
49514
|
+
dispatch({
|
|
49515
|
+
type: DISABLE_SUBMIT,
|
|
49516
|
+
payload: false
|
|
49517
|
+
});
|
|
49518
|
+
dispatch({
|
|
49519
|
+
type: LOADING,
|
|
49520
|
+
payload: false
|
|
49521
|
+
});
|
|
49522
|
+
});
|
|
49523
|
+
const result = await pr.canMakePayment();
|
|
49524
|
+
if (mounted && result) {
|
|
49525
|
+
setLocalPaymentRequest(pr);
|
|
49526
|
+
dispatch({
|
|
49527
|
+
type: SET_PAYMENT_REQUEST,
|
|
49528
|
+
payload: pr
|
|
49529
|
+
});
|
|
49530
|
+
dispatch({
|
|
49531
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49532
|
+
payload: true
|
|
49533
|
+
});
|
|
49534
|
+
} else if (mounted) {
|
|
49535
|
+
dispatch({
|
|
49536
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49537
|
+
payload: false
|
|
49538
|
+
});
|
|
49539
|
+
}
|
|
49540
|
+
} catch (error) {
|
|
49541
|
+
if (mounted) {
|
|
49542
|
+
dispatch({
|
|
49543
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49544
|
+
payload: false
|
|
49545
|
+
});
|
|
49546
|
+
}
|
|
49547
|
+
} finally {
|
|
49548
|
+
if (mounted) {
|
|
49549
|
+
setIsInitializing(false);
|
|
49550
|
+
}
|
|
49551
|
+
}
|
|
49552
|
+
};
|
|
49553
|
+
initializePaymentRequest();
|
|
49554
|
+
return () => {
|
|
49555
|
+
mounted = false;
|
|
49556
|
+
};
|
|
49557
|
+
}, [stripe, currentPlan, updatedPrice, dispatch, order, type]);
|
|
49558
|
+
if (isInitializing || !canMakePayment || !localPaymentRequest) {
|
|
49559
|
+
return null;
|
|
49560
|
+
}
|
|
49561
|
+
return /*#__PURE__*/React__default['default'].createElement(PaymentRequestButtonElement, Object.assign({
|
|
49562
|
+
className: "StripeElement stripe-payment-request-btn",
|
|
49563
|
+
options: {
|
|
49564
|
+
paymentRequest: localPaymentRequest,
|
|
49307
49565
|
style: {
|
|
49308
49566
|
paymentRequestButton: {
|
|
49309
49567
|
theme: "dark",
|
|
49310
|
-
height: "40px"
|
|
49568
|
+
height: "40px",
|
|
49569
|
+
buttonType: "plain"
|
|
49311
49570
|
}
|
|
49312
49571
|
}
|
|
49313
|
-
}
|
|
49314
|
-
}
|
|
49315
|
-
return null;
|
|
49572
|
+
}
|
|
49573
|
+
}, props));
|
|
49316
49574
|
};
|
|
49317
49575
|
const CheckoutForm = ({
|
|
49318
49576
|
type
|
|
49319
49577
|
}) => {
|
|
49320
|
-
var _window, _window$
|
|
49578
|
+
var _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$, _window2, _window2$Pelcro, _window2$Pelcro$user, _window2$Pelcro$user$, _window3, _window3$Pelcro, _window3$Pelcro$user, _window3$Pelcro$user$;
|
|
49321
49579
|
const {
|
|
49322
49580
|
selectedPaymentMethodId,
|
|
49323
49581
|
paymentMethodToEdit
|
|
49324
49582
|
} = usePelcro();
|
|
49325
49583
|
const cardProcessor = getSiteCardProcessor();
|
|
49326
49584
|
const billingDetails = {
|
|
49327
|
-
name: (_window = window) === null || _window === void 0 ? void 0 : (_window$
|
|
49585
|
+
name: (_window = window) === null || _window === void 0 ? void 0 : (_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$.name,
|
|
49328
49586
|
email: (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : (_window2$Pelcro$user$ = _window2$Pelcro$user.read()) === null || _window2$Pelcro$user$ === void 0 ? void 0 : _window2$Pelcro$user$.email,
|
|
49329
49587
|
phone: (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Pelcro = _window3.Pelcro) === null || _window3$Pelcro === void 0 ? void 0 : (_window3$Pelcro$user = _window3$Pelcro.user) === null || _window3$Pelcro$user === void 0 ? void 0 : (_window3$Pelcro$user$ = _window3$Pelcro$user.read()) === null || _window3$Pelcro$user$ === void 0 ? void 0 : _window3$Pelcro$user$.phone
|
|
49330
49588
|
};
|
|
49331
49589
|
const paymentElementOptions = {
|
|
49332
49590
|
layout: {
|
|
49333
49591
|
type: "tabs",
|
|
49334
|
-
// or accordion
|
|
49335
49592
|
defaultCollapsed: false
|
|
49336
49593
|
},
|
|
49337
49594
|
defaultValues: {
|
|
@@ -49345,11 +49602,8 @@ const CheckoutForm = ({
|
|
|
49345
49602
|
address: "never"
|
|
49346
49603
|
}
|
|
49347
49604
|
},
|
|
49348
|
-
|
|
49349
|
-
applePay: "never"
|
|
49350
|
-
card: "never",
|
|
49351
|
-
googlePay: "never",
|
|
49352
|
-
paypal: "never"
|
|
49605
|
+
wallets: {
|
|
49606
|
+
applePay: "never"
|
|
49353
49607
|
}
|
|
49354
49608
|
};
|
|
49355
49609
|
if (selectedPaymentMethodId) {
|
|
@@ -50722,7 +50976,11 @@ function PaymentMethodView({
|
|
|
50722
50976
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
50723
50977
|
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, {
|
|
50724
50978
|
isSubmitDisabled: isSubmitDisabled
|
|
50725
|
-
}), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton,
|
|
50979
|
+
}), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, {
|
|
50980
|
+
type: type,
|
|
50981
|
+
onSuccess: onSuccess,
|
|
50982
|
+
onFailure: onFailure
|
|
50983
|
+
}), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ApplePayButton, null)) : null)))));
|
|
50726
50984
|
}
|
|
50727
50985
|
|
|
50728
50986
|
const SubscriptionRenewView = ({
|
|
@@ -56565,6 +56823,7 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default['default'].cre
|
|
|
56565
56823
|
const OrderCreateModal = ({
|
|
56566
56824
|
onDisplay,
|
|
56567
56825
|
onClose,
|
|
56826
|
+
showExternalPaymentMethods = false,
|
|
56568
56827
|
...otherProps
|
|
56569
56828
|
}) => {
|
|
56570
56829
|
const {
|
|
@@ -56618,7 +56877,8 @@ const OrderCreateModal = ({
|
|
|
56618
56877
|
}, /*#__PURE__*/React__default['default'].createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
56619
56878
|
className: "plc-text-xl plc-font-bold plc-text-center"
|
|
56620
56879
|
}, t("labels.checkout.title")))), /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(OrderCreateView, Object.assign({}, otherProps, {
|
|
56621
|
-
onSuccess: onSuccess
|
|
56880
|
+
onSuccess: onSuccess,
|
|
56881
|
+
showExternalPaymentMethods: showExternalPaymentMethods
|
|
56622
56882
|
}))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null));
|
|
56623
56883
|
};
|
|
56624
56884
|
OrderCreateModal.viewId = "order-create";
|
package/dist/index.esm.js
CHANGED
|
@@ -14364,7 +14364,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
|
|
|
14364
14364
|
*
|
|
14365
14365
|
*/
|
|
14366
14366
|
function RegisterView(props) {
|
|
14367
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
|
|
14367
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
14368
14368
|
const {
|
|
14369
14369
|
t
|
|
14370
14370
|
} = useTranslation("register");
|
|
@@ -14372,6 +14372,7 @@ function RegisterView(props) {
|
|
|
14372
14372
|
const auth0LoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.auth0_client_id;
|
|
14373
14373
|
const socialLoginEnabled = ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.facebook_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.google_app_id) || auth0LoginEnabled;
|
|
14374
14374
|
const showNameFields = (_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.enableNameFieldsInRegister;
|
|
14375
|
+
const nameFieldsRequired = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.requireNameFieldsInRegister;
|
|
14375
14376
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
14376
14377
|
id: "pelcro-register-view"
|
|
14377
14378
|
}, /*#__PURE__*/React__default.createElement("form", {
|
|
@@ -14399,11 +14400,15 @@ function RegisterView(props) {
|
|
|
14399
14400
|
className: "plc-flex plc-items-start"
|
|
14400
14401
|
}, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
|
|
14401
14402
|
id: "pelcro-input-first-name",
|
|
14402
|
-
label: t("labels.firstName")
|
|
14403
|
+
label: `${t("labels.firstName")}${nameFieldsRequired ? " *" : ""}`,
|
|
14404
|
+
errorId: "pelcro-input-firstName-error",
|
|
14405
|
+
required: nameFieldsRequired
|
|
14403
14406
|
}), /*#__PURE__*/React__default.createElement(RegisterLastName, {
|
|
14404
14407
|
wrapperClassName: "plc-ml-3",
|
|
14405
14408
|
id: "pelcro-input-last-name",
|
|
14406
|
-
label: t("labels.lastName")
|
|
14409
|
+
label: `${t("labels.lastName")}${nameFieldsRequired ? " *" : ""}`,
|
|
14410
|
+
errorId: "pelcro-input-lastName-error",
|
|
14411
|
+
required: nameFieldsRequired
|
|
14407
14412
|
})), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
14408
14413
|
id: "pelcro-input-email",
|
|
14409
14414
|
errorId: "pelcro-input-email-error",
|
|
@@ -46381,7 +46386,10 @@ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormDat
|
|
|
46381
46386
|
|
|
46382
46387
|
axios.default = axios;
|
|
46383
46388
|
|
|
46384
|
-
const OrderCreateView =
|
|
46389
|
+
const OrderCreateView = ({
|
|
46390
|
+
showExternalPaymentMethods = false,
|
|
46391
|
+
...props
|
|
46392
|
+
}) => {
|
|
46385
46393
|
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _addresses$find, _addresses$find2;
|
|
46386
46394
|
const {
|
|
46387
46395
|
t
|
|
@@ -46470,7 +46478,7 @@ const OrderCreateView = props => {
|
|
|
46470
46478
|
}, address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
46471
46479
|
type: "orderCreate",
|
|
46472
46480
|
showCoupon: true,
|
|
46473
|
-
showExternalPaymentMethods:
|
|
46481
|
+
showExternalPaymentMethods: showExternalPaymentMethods,
|
|
46474
46482
|
showApplePayButton: true,
|
|
46475
46483
|
showOrderButton: showOrderButton,
|
|
46476
46484
|
order: order,
|
|
@@ -49239,57 +49247,306 @@ function YearSelect({
|
|
|
49239
49247
|
}, placeholder), createYearsItems);
|
|
49240
49248
|
}
|
|
49241
49249
|
|
|
49242
|
-
const PelcroPaymentRequestButton =
|
|
49250
|
+
const PelcroPaymentRequestButton = ({
|
|
49251
|
+
type,
|
|
49252
|
+
onSuccess,
|
|
49253
|
+
onFailure,
|
|
49254
|
+
...props
|
|
49255
|
+
}) => {
|
|
49256
|
+
const stripe = useStripe();
|
|
49257
|
+
const [isInitializing, setIsInitializing] = useState(true);
|
|
49258
|
+
const [localPaymentRequest, setLocalPaymentRequest] = useState(null);
|
|
49243
49259
|
const {
|
|
49244
|
-
state
|
|
49245
|
-
|
|
49246
|
-
paymentRequest,
|
|
49247
|
-
currentPlan,
|
|
49248
|
-
updatedPrice
|
|
49249
|
-
}
|
|
49260
|
+
state,
|
|
49261
|
+
dispatch
|
|
49250
49262
|
} = useContext(store$m);
|
|
49251
|
-
const
|
|
49252
|
-
|
|
49253
|
-
|
|
49254
|
-
|
|
49255
|
-
|
|
49256
|
-
|
|
49263
|
+
const {
|
|
49264
|
+
canMakePayment,
|
|
49265
|
+
currentPlan,
|
|
49266
|
+
updatedPrice
|
|
49267
|
+
} = state;
|
|
49268
|
+
const {
|
|
49269
|
+
order,
|
|
49270
|
+
set,
|
|
49271
|
+
selectedPaymentMethodId
|
|
49272
|
+
} = usePelcro();
|
|
49273
|
+
const getOrderInfo = () => {
|
|
49274
|
+
if (!order) {
|
|
49275
|
+
return {
|
|
49276
|
+
price: null,
|
|
49277
|
+
currency: null,
|
|
49278
|
+
label: null
|
|
49279
|
+
};
|
|
49280
|
+
}
|
|
49281
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
49282
|
+
if (isQuickPurchase) {
|
|
49283
|
+
return {
|
|
49284
|
+
price: order.price * order.quantity,
|
|
49285
|
+
currency: order.currency,
|
|
49286
|
+
label: order.name
|
|
49287
|
+
};
|
|
49288
|
+
}
|
|
49289
|
+
if (order.length === 0) {
|
|
49290
|
+
return {
|
|
49291
|
+
price: null,
|
|
49292
|
+
currency: null,
|
|
49293
|
+
label: null
|
|
49294
|
+
};
|
|
49295
|
+
}
|
|
49296
|
+
const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
49297
|
+
return {
|
|
49298
|
+
price,
|
|
49299
|
+
currency: order[0].currency,
|
|
49300
|
+
label: "Order"
|
|
49301
|
+
};
|
|
49302
|
+
};
|
|
49303
|
+
const orderPrice = getOrderInfo().price;
|
|
49304
|
+
const orderCurrency = getOrderInfo().currency;
|
|
49305
|
+
const orderLabel = getOrderInfo().label;
|
|
49306
|
+
const purchase = (gatewayService, gatewayToken, state, dispatch) => {
|
|
49307
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
49308
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
49309
|
+
sku_id: order.id,
|
|
49310
|
+
quantity: order.quantity
|
|
49311
|
+
}] : order.map(item => ({
|
|
49312
|
+
sku_id: item.id,
|
|
49313
|
+
quantity: item.quantity
|
|
49314
|
+
}));
|
|
49315
|
+
const {
|
|
49316
|
+
couponCode
|
|
49317
|
+
} = state;
|
|
49318
|
+
const payment = new Payment(gatewayService);
|
|
49319
|
+
payment.execute({
|
|
49320
|
+
type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
|
|
49321
|
+
token: gatewayToken,
|
|
49322
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
49323
|
+
items: mappedOrderItems,
|
|
49324
|
+
addressId: state.selectedAddressId,
|
|
49325
|
+
couponCode
|
|
49326
|
+
}, (err, orderResponse) => {
|
|
49327
|
+
var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
|
|
49328
|
+
if (err) {
|
|
49329
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
49330
|
+
dispatch({
|
|
49331
|
+
type: DISABLE_SUBMIT,
|
|
49332
|
+
payload: false
|
|
49333
|
+
});
|
|
49334
|
+
dispatch({
|
|
49335
|
+
type: LOADING,
|
|
49336
|
+
payload: false
|
|
49337
|
+
});
|
|
49338
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
49339
|
+
return dispatch({
|
|
49340
|
+
type: SHOW_ALERT,
|
|
49341
|
+
payload: {
|
|
49342
|
+
type: "error",
|
|
49343
|
+
content: getErrorMessages(err)
|
|
49344
|
+
}
|
|
49345
|
+
});
|
|
49257
49346
|
}
|
|
49347
|
+
if (isQuickPurchase) {
|
|
49348
|
+
set({
|
|
49349
|
+
order: null
|
|
49350
|
+
});
|
|
49351
|
+
} else {
|
|
49352
|
+
set({
|
|
49353
|
+
order: null,
|
|
49354
|
+
cartItems: []
|
|
49355
|
+
});
|
|
49356
|
+
}
|
|
49357
|
+
window.Pelcro.user.refresh({
|
|
49358
|
+
auth_token: (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.auth_token
|
|
49359
|
+
}, (err, res) => {
|
|
49360
|
+
dispatch({
|
|
49361
|
+
type: DISABLE_SUBMIT,
|
|
49362
|
+
payload: false
|
|
49363
|
+
});
|
|
49364
|
+
dispatch({
|
|
49365
|
+
type: LOADING,
|
|
49366
|
+
payload: false
|
|
49367
|
+
});
|
|
49368
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
49369
|
+
if (err) {
|
|
49370
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
49371
|
+
return dispatch({
|
|
49372
|
+
type: SHOW_ALERT,
|
|
49373
|
+
payload: {
|
|
49374
|
+
type: "error",
|
|
49375
|
+
content: getErrorMessages(err)
|
|
49376
|
+
}
|
|
49377
|
+
});
|
|
49378
|
+
}
|
|
49379
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(orderResponse);
|
|
49380
|
+
});
|
|
49258
49381
|
});
|
|
49259
49382
|
};
|
|
49260
|
-
|
|
49261
|
-
|
|
49262
|
-
|
|
49263
|
-
|
|
49264
|
-
|
|
49383
|
+
useEffect(() => {
|
|
49384
|
+
if (!stripe) {
|
|
49385
|
+
setIsInitializing(false);
|
|
49386
|
+
return;
|
|
49387
|
+
}
|
|
49388
|
+
let mounted = true;
|
|
49389
|
+
const initializePaymentRequest = async () => {
|
|
49390
|
+
try {
|
|
49391
|
+
var _ref;
|
|
49392
|
+
const pr = stripe.paymentRequest({
|
|
49393
|
+
country: window.Pelcro.user.location.countryCode || "US",
|
|
49394
|
+
currency: ((currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.currency) || orderCurrency).toLowerCase(),
|
|
49395
|
+
total: {
|
|
49396
|
+
label: (currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.nickname) || (currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.description) || orderLabel || "Payment",
|
|
49397
|
+
amount: (_ref = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.amount) !== null && _ref !== void 0 ? _ref : orderPrice,
|
|
49398
|
+
pending: false
|
|
49399
|
+
},
|
|
49400
|
+
requestPayerEmail: false,
|
|
49401
|
+
requestPayerName: false,
|
|
49402
|
+
requestShipping: false
|
|
49403
|
+
});
|
|
49404
|
+
pr.on("source", async event => {
|
|
49405
|
+
try {
|
|
49406
|
+
var _event$source, _event$source$card;
|
|
49407
|
+
dispatch({
|
|
49408
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49409
|
+
payload: true
|
|
49410
|
+
});
|
|
49411
|
+
dispatch({
|
|
49412
|
+
type: DISABLE_SUBMIT,
|
|
49413
|
+
payload: true
|
|
49414
|
+
});
|
|
49415
|
+
dispatch({
|
|
49416
|
+
type: LOADING,
|
|
49417
|
+
payload: true
|
|
49418
|
+
});
|
|
49419
|
+
event.complete("success");
|
|
49420
|
+
if (((_event$source = event.source) === null || _event$source === void 0 ? void 0 : (_event$source$card = _event$source.card) === null || _event$source$card === void 0 ? void 0 : _event$source$card.three_d_secure) === "required") {
|
|
49421
|
+
return generate3DSecureSource(event.source).then(({
|
|
49422
|
+
source,
|
|
49423
|
+
error
|
|
49424
|
+
}) => {
|
|
49425
|
+
if (error) {
|
|
49426
|
+
return handlePaymentError(error);
|
|
49427
|
+
}
|
|
49428
|
+
toggleAuthenticationPendingView(true, source);
|
|
49429
|
+
});
|
|
49430
|
+
}
|
|
49431
|
+
|
|
49432
|
+
// Handle different payment types
|
|
49433
|
+
if (type === "orderCreate") {
|
|
49434
|
+
purchase(new StripeGateway(), event.source.id, state, dispatch);
|
|
49435
|
+
} else {
|
|
49436
|
+
dispatch({
|
|
49437
|
+
type: SUBSCRIBE,
|
|
49438
|
+
payload: {
|
|
49439
|
+
id: event.source.id,
|
|
49440
|
+
isExistingSource: false
|
|
49441
|
+
}
|
|
49442
|
+
});
|
|
49443
|
+
}
|
|
49444
|
+
} catch (error) {
|
|
49445
|
+
dispatch({
|
|
49446
|
+
type: SHOW_ALERT,
|
|
49447
|
+
payload: {
|
|
49448
|
+
type: "error",
|
|
49449
|
+
content: error.message || "Payment failed. Please try again."
|
|
49450
|
+
}
|
|
49451
|
+
});
|
|
49452
|
+
event.complete("fail");
|
|
49453
|
+
dispatch({
|
|
49454
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49455
|
+
payload: false
|
|
49456
|
+
});
|
|
49457
|
+
dispatch({
|
|
49458
|
+
type: DISABLE_SUBMIT,
|
|
49459
|
+
payload: false
|
|
49460
|
+
});
|
|
49461
|
+
dispatch({
|
|
49462
|
+
type: LOADING,
|
|
49463
|
+
payload: false
|
|
49464
|
+
});
|
|
49465
|
+
}
|
|
49466
|
+
});
|
|
49467
|
+
pr.on("cancel", () => {
|
|
49468
|
+
dispatch({
|
|
49469
|
+
type: DISABLE_COUPON_BUTTON,
|
|
49470
|
+
payload: false
|
|
49471
|
+
});
|
|
49472
|
+
dispatch({
|
|
49473
|
+
type: DISABLE_SUBMIT,
|
|
49474
|
+
payload: false
|
|
49475
|
+
});
|
|
49476
|
+
dispatch({
|
|
49477
|
+
type: LOADING,
|
|
49478
|
+
payload: false
|
|
49479
|
+
});
|
|
49480
|
+
});
|
|
49481
|
+
const result = await pr.canMakePayment();
|
|
49482
|
+
if (mounted && result) {
|
|
49483
|
+
setLocalPaymentRequest(pr);
|
|
49484
|
+
dispatch({
|
|
49485
|
+
type: SET_PAYMENT_REQUEST,
|
|
49486
|
+
payload: pr
|
|
49487
|
+
});
|
|
49488
|
+
dispatch({
|
|
49489
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49490
|
+
payload: true
|
|
49491
|
+
});
|
|
49492
|
+
} else if (mounted) {
|
|
49493
|
+
dispatch({
|
|
49494
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49495
|
+
payload: false
|
|
49496
|
+
});
|
|
49497
|
+
}
|
|
49498
|
+
} catch (error) {
|
|
49499
|
+
if (mounted) {
|
|
49500
|
+
dispatch({
|
|
49501
|
+
type: SET_CAN_MAKE_PAYMENT,
|
|
49502
|
+
payload: false
|
|
49503
|
+
});
|
|
49504
|
+
}
|
|
49505
|
+
} finally {
|
|
49506
|
+
if (mounted) {
|
|
49507
|
+
setIsInitializing(false);
|
|
49508
|
+
}
|
|
49509
|
+
}
|
|
49510
|
+
};
|
|
49511
|
+
initializePaymentRequest();
|
|
49512
|
+
return () => {
|
|
49513
|
+
mounted = false;
|
|
49514
|
+
};
|
|
49515
|
+
}, [stripe, currentPlan, updatedPrice, dispatch, order, type]);
|
|
49516
|
+
if (isInitializing || !canMakePayment || !localPaymentRequest) {
|
|
49517
|
+
return null;
|
|
49518
|
+
}
|
|
49519
|
+
return /*#__PURE__*/React__default.createElement(PaymentRequestButtonElement, Object.assign({
|
|
49520
|
+
className: "StripeElement stripe-payment-request-btn",
|
|
49521
|
+
options: {
|
|
49522
|
+
paymentRequest: localPaymentRequest,
|
|
49265
49523
|
style: {
|
|
49266
49524
|
paymentRequestButton: {
|
|
49267
49525
|
theme: "dark",
|
|
49268
|
-
height: "40px"
|
|
49526
|
+
height: "40px",
|
|
49527
|
+
buttonType: "plain"
|
|
49269
49528
|
}
|
|
49270
49529
|
}
|
|
49271
|
-
}
|
|
49272
|
-
}
|
|
49273
|
-
return null;
|
|
49530
|
+
}
|
|
49531
|
+
}, props));
|
|
49274
49532
|
};
|
|
49275
49533
|
const CheckoutForm = ({
|
|
49276
49534
|
type
|
|
49277
49535
|
}) => {
|
|
49278
|
-
var _window, _window$
|
|
49536
|
+
var _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$, _window2, _window2$Pelcro, _window2$Pelcro$user, _window2$Pelcro$user$, _window3, _window3$Pelcro, _window3$Pelcro$user, _window3$Pelcro$user$;
|
|
49279
49537
|
const {
|
|
49280
49538
|
selectedPaymentMethodId,
|
|
49281
49539
|
paymentMethodToEdit
|
|
49282
49540
|
} = usePelcro();
|
|
49283
49541
|
const cardProcessor = getSiteCardProcessor();
|
|
49284
49542
|
const billingDetails = {
|
|
49285
|
-
name: (_window = window) === null || _window === void 0 ? void 0 : (_window$
|
|
49543
|
+
name: (_window = window) === null || _window === void 0 ? void 0 : (_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$.name,
|
|
49286
49544
|
email: (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : (_window2$Pelcro$user$ = _window2$Pelcro$user.read()) === null || _window2$Pelcro$user$ === void 0 ? void 0 : _window2$Pelcro$user$.email,
|
|
49287
49545
|
phone: (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Pelcro = _window3.Pelcro) === null || _window3$Pelcro === void 0 ? void 0 : (_window3$Pelcro$user = _window3$Pelcro.user) === null || _window3$Pelcro$user === void 0 ? void 0 : (_window3$Pelcro$user$ = _window3$Pelcro$user.read()) === null || _window3$Pelcro$user$ === void 0 ? void 0 : _window3$Pelcro$user$.phone
|
|
49288
49546
|
};
|
|
49289
49547
|
const paymentElementOptions = {
|
|
49290
49548
|
layout: {
|
|
49291
49549
|
type: "tabs",
|
|
49292
|
-
// or accordion
|
|
49293
49550
|
defaultCollapsed: false
|
|
49294
49551
|
},
|
|
49295
49552
|
defaultValues: {
|
|
@@ -49303,11 +49560,8 @@ const CheckoutForm = ({
|
|
|
49303
49560
|
address: "never"
|
|
49304
49561
|
}
|
|
49305
49562
|
},
|
|
49306
|
-
|
|
49307
|
-
applePay: "never"
|
|
49308
|
-
card: "never",
|
|
49309
|
-
googlePay: "never",
|
|
49310
|
-
paypal: "never"
|
|
49563
|
+
wallets: {
|
|
49564
|
+
applePay: "never"
|
|
49311
49565
|
}
|
|
49312
49566
|
};
|
|
49313
49567
|
if (selectedPaymentMethodId) {
|
|
@@ -50680,7 +50934,11 @@ function PaymentMethodView({
|
|
|
50680
50934
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
50681
50935
|
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, {
|
|
50682
50936
|
isSubmitDisabled: isSubmitDisabled
|
|
50683
|
-
}), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton,
|
|
50937
|
+
}), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, {
|
|
50938
|
+
type: type,
|
|
50939
|
+
onSuccess: onSuccess,
|
|
50940
|
+
onFailure: onFailure
|
|
50941
|
+
}), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ApplePayButton, null)) : null)))));
|
|
50684
50942
|
}
|
|
50685
50943
|
|
|
50686
50944
|
const SubscriptionRenewView = ({
|
|
@@ -56523,6 +56781,7 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default.createElement(
|
|
|
56523
56781
|
const OrderCreateModal = ({
|
|
56524
56782
|
onDisplay,
|
|
56525
56783
|
onClose,
|
|
56784
|
+
showExternalPaymentMethods = false,
|
|
56526
56785
|
...otherProps
|
|
56527
56786
|
}) => {
|
|
56528
56787
|
const {
|
|
@@ -56576,7 +56835,8 @@ const OrderCreateModal = ({
|
|
|
56576
56835
|
}, /*#__PURE__*/React__default.createElement(SvgArrowLeft, null)), /*#__PURE__*/React__default.createElement("h4", {
|
|
56577
56836
|
className: "plc-text-xl plc-font-bold plc-text-center"
|
|
56578
56837
|
}, t("labels.checkout.title")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(OrderCreateView, Object.assign({}, otherProps, {
|
|
56579
|
-
onSuccess: onSuccess
|
|
56838
|
+
onSuccess: onSuccess,
|
|
56839
|
+
showExternalPaymentMethods: showExternalPaymentMethods
|
|
56580
56840
|
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null));
|
|
56581
56841
|
};
|
|
56582
56842
|
OrderCreateModal.viewId = "order-create";
|