@pelcro/react-pelcro-js 3.9.0-beta.1 → 3.9.0-beta.11
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 +260 -79
- package/dist/index.esm.js +258 -80
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3823,8 +3823,11 @@ var labels$F = {
|
|
|
3823
3823
|
"for": "for",
|
|
3824
3824
|
interval: "{{count}} {{interval}}",
|
|
3825
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3826
|
-
tax: "
|
|
3827
|
-
removeCoupon: "REMOVE"
|
|
3826
|
+
tax: "Tax",
|
|
3827
|
+
removeCoupon: "REMOVE",
|
|
3828
|
+
firstName: "First name",
|
|
3829
|
+
lastName: "Last name",
|
|
3830
|
+
phone: "Phone"
|
|
3828
3831
|
};
|
|
3829
3832
|
var checkoutForm_en = {
|
|
3830
3833
|
messages: messages$I,
|
|
@@ -3850,8 +3853,11 @@ var labels$E = {
|
|
|
3850
3853
|
"for": "pour",
|
|
3851
3854
|
interval: "{{count}} {{interval}}",
|
|
3852
3855
|
interval_plural: "{{count}} {{interval}}s",
|
|
3853
|
-
tax: "
|
|
3854
|
-
removeCoupon: "RETIRER"
|
|
3856
|
+
tax: "Taxe",
|
|
3857
|
+
removeCoupon: "RETIRER",
|
|
3858
|
+
firstName: "Prénom",
|
|
3859
|
+
lastName: "Nom de famille",
|
|
3860
|
+
phone: "Téléphoner"
|
|
3855
3861
|
};
|
|
3856
3862
|
var checkoutForm_fr = {
|
|
3857
3863
|
messages: messages$H,
|
|
@@ -3877,8 +3883,11 @@ var labels$D = {
|
|
|
3877
3883
|
"for": "관련",
|
|
3878
3884
|
interval: "{{count}} {{interval}}",
|
|
3879
3885
|
interval_plural: "{{count}} {{interval}}",
|
|
3880
|
-
tax: "
|
|
3881
|
-
removeCoupon: "제거"
|
|
3886
|
+
tax: "세금",
|
|
3887
|
+
removeCoupon: "제거",
|
|
3888
|
+
firstName: "이름",
|
|
3889
|
+
lastName: "성",
|
|
3890
|
+
phone: "핸드폰"
|
|
3882
3891
|
};
|
|
3883
3892
|
var checkoutForm_ko = {
|
|
3884
3893
|
messages: messages$G,
|
|
@@ -7247,8 +7256,7 @@ class PelcroActions {
|
|
|
7247
7256
|
return this.set({
|
|
7248
7257
|
view: "login"
|
|
7249
7258
|
});
|
|
7250
|
-
}
|
|
7251
|
-
|
|
7259
|
+
}
|
|
7252
7260
|
|
|
7253
7261
|
if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
|
|
7254
7262
|
return this.set({
|
|
@@ -12277,32 +12285,25 @@ const RegisterButton = ({
|
|
|
12277
12285
|
className,
|
|
12278
12286
|
...otherProps
|
|
12279
12287
|
}) => {
|
|
12280
|
-
var _window$Pelcro$site$r
|
|
12288
|
+
var _window$Pelcro$site$r;
|
|
12281
12289
|
|
|
12282
12290
|
const {
|
|
12283
12291
|
state: {
|
|
12284
12292
|
emailError,
|
|
12285
12293
|
passwordError,
|
|
12286
|
-
firstNameError,
|
|
12287
|
-
lastNameError,
|
|
12288
|
-
phoneError,
|
|
12289
12294
|
email,
|
|
12290
12295
|
password,
|
|
12291
|
-
firstName,
|
|
12292
|
-
lastName,
|
|
12293
|
-
phone,
|
|
12294
12296
|
buttonDisabled
|
|
12295
12297
|
},
|
|
12296
12298
|
dispatch
|
|
12297
12299
|
} = React.useContext(store$k);
|
|
12298
|
-
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
12299
12300
|
const {
|
|
12300
12301
|
t
|
|
12301
12302
|
} = useTranslation("register");
|
|
12302
12303
|
const [isDisabled, setDisabled] = React.useState(true);
|
|
12303
12304
|
React.useEffect(() => {
|
|
12304
|
-
setDisabled(buttonDisabled || emailError || passwordError ||
|
|
12305
|
-
}, [buttonDisabled, emailError, passwordError,
|
|
12305
|
+
setDisabled(buttonDisabled || emailError || passwordError || !email.length || !password.length);
|
|
12306
|
+
}, [buttonDisabled, emailError, passwordError, email, password]);
|
|
12306
12307
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
12307
12308
|
onClick: () => {
|
|
12308
12309
|
dispatch({
|
|
@@ -12314,11 +12315,12 @@ const RegisterButton = ({
|
|
|
12314
12315
|
isLoading: buttonDisabled,
|
|
12315
12316
|
className: `${className} g-recaptcha`,
|
|
12316
12317
|
"data-action": "register",
|
|
12317
|
-
"data-sitekey": (_window$Pelcro$site$
|
|
12318
|
+
"data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
|
|
12318
12319
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12319
12320
|
};
|
|
12320
12321
|
|
|
12321
12322
|
function FirstName({
|
|
12323
|
+
initWithUserFirstName = true,
|
|
12322
12324
|
store,
|
|
12323
12325
|
...otherProps
|
|
12324
12326
|
}) {
|
|
@@ -12337,21 +12339,50 @@ function FirstName({
|
|
|
12337
12339
|
const handleInputChange = React.useCallback(value => {
|
|
12338
12340
|
setFirstName(value);
|
|
12339
12341
|
|
|
12340
|
-
if (
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12342
|
+
if (finishedTyping) {
|
|
12343
|
+
if (firstName !== null && firstName !== void 0 && firstName.length) {
|
|
12344
|
+
dispatch({
|
|
12345
|
+
type: SET_FIRST_NAME,
|
|
12346
|
+
payload: firstName
|
|
12347
|
+
});
|
|
12348
|
+
} else {
|
|
12349
|
+
if (otherProps.required) {
|
|
12350
|
+
dispatch({
|
|
12351
|
+
type: SET_FIRST_NAME_ERROR,
|
|
12352
|
+
payload: t("validation.enterFirstName")
|
|
12353
|
+
});
|
|
12354
|
+
} else {
|
|
12355
|
+
dispatch({
|
|
12356
|
+
type: SET_FIRST_NAME,
|
|
12357
|
+
payload: firstName
|
|
12358
|
+
});
|
|
12359
|
+
}
|
|
12360
|
+
}
|
|
12350
12361
|
}
|
|
12351
12362
|
}, [dispatch, firstName, finishedTyping]);
|
|
12352
12363
|
React.useEffect(() => {
|
|
12353
12364
|
handleInputChange(firstName);
|
|
12354
|
-
}, [finishedTyping, firstName, handleInputChange]);
|
|
12365
|
+
}, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
|
|
12366
|
+
|
|
12367
|
+
const loadFirstNameIntoField = () => {
|
|
12368
|
+
handleInputChange(window.Pelcro.user.read().first_name);
|
|
12369
|
+
dispatch({
|
|
12370
|
+
type: SET_FIRST_NAME,
|
|
12371
|
+
payload: window.Pelcro.user.read().first_name
|
|
12372
|
+
});
|
|
12373
|
+
};
|
|
12374
|
+
|
|
12375
|
+
React.useEffect(() => {
|
|
12376
|
+
if (initWithUserFirstName) {
|
|
12377
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12378
|
+
loadFirstNameIntoField();
|
|
12379
|
+
});
|
|
12380
|
+
loadFirstNameIntoField();
|
|
12381
|
+
return () => {
|
|
12382
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12383
|
+
};
|
|
12384
|
+
}
|
|
12385
|
+
}, []);
|
|
12355
12386
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12356
12387
|
type: "text",
|
|
12357
12388
|
error: firstNameError,
|
|
@@ -12367,6 +12398,7 @@ const RegisterFirstName = props => /*#__PURE__*/React__default['default'].create
|
|
|
12367
12398
|
}, props));
|
|
12368
12399
|
|
|
12369
12400
|
function LastName({
|
|
12401
|
+
initWithUserLastName = true,
|
|
12370
12402
|
store,
|
|
12371
12403
|
...otherProps
|
|
12372
12404
|
}) {
|
|
@@ -12385,21 +12417,50 @@ function LastName({
|
|
|
12385
12417
|
const handleInputChange = React.useCallback(value => {
|
|
12386
12418
|
setLastName(value);
|
|
12387
12419
|
|
|
12388
|
-
if (
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12420
|
+
if (finishedTyping) {
|
|
12421
|
+
if (lastName !== null && lastName !== void 0 && lastName.length) {
|
|
12422
|
+
dispatch({
|
|
12423
|
+
type: SET_LAST_NAME,
|
|
12424
|
+
payload: lastName
|
|
12425
|
+
});
|
|
12426
|
+
} else {
|
|
12427
|
+
if (otherProps.required) {
|
|
12428
|
+
dispatch({
|
|
12429
|
+
type: SET_LAST_NAME_ERROR,
|
|
12430
|
+
payload: t("validation.enterLastName")
|
|
12431
|
+
});
|
|
12432
|
+
} else {
|
|
12433
|
+
dispatch({
|
|
12434
|
+
type: SET_LAST_NAME,
|
|
12435
|
+
payload: lastName
|
|
12436
|
+
});
|
|
12437
|
+
}
|
|
12438
|
+
}
|
|
12398
12439
|
}
|
|
12399
12440
|
}, [dispatch, lastName, finishedTyping]);
|
|
12400
12441
|
React.useEffect(() => {
|
|
12401
12442
|
handleInputChange(lastName);
|
|
12402
|
-
}, [finishedTyping, lastName, handleInputChange]);
|
|
12443
|
+
}, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
|
|
12444
|
+
|
|
12445
|
+
const loadLastNameIntoField = () => {
|
|
12446
|
+
handleInputChange(window.Pelcro.user.read().last_name);
|
|
12447
|
+
dispatch({
|
|
12448
|
+
type: SET_LAST_NAME,
|
|
12449
|
+
payload: window.Pelcro.user.read().last_name
|
|
12450
|
+
});
|
|
12451
|
+
};
|
|
12452
|
+
|
|
12453
|
+
React.useEffect(() => {
|
|
12454
|
+
if (initWithUserLastName) {
|
|
12455
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12456
|
+
loadLastNameIntoField();
|
|
12457
|
+
});
|
|
12458
|
+
loadLastNameIntoField();
|
|
12459
|
+
return () => {
|
|
12460
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12461
|
+
};
|
|
12462
|
+
}
|
|
12463
|
+
}, []);
|
|
12403
12464
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12404
12465
|
type: "text",
|
|
12405
12466
|
error: lastNameError,
|
|
@@ -12415,6 +12476,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default['default'].createE
|
|
|
12415
12476
|
}, props));
|
|
12416
12477
|
|
|
12417
12478
|
function Phone({
|
|
12479
|
+
initWithUserPhone = true,
|
|
12418
12480
|
store,
|
|
12419
12481
|
...otherProps
|
|
12420
12482
|
}) {
|
|
@@ -12433,21 +12495,50 @@ function Phone({
|
|
|
12433
12495
|
const handleInputChange = React.useCallback(value => {
|
|
12434
12496
|
setPhone(value);
|
|
12435
12497
|
|
|
12436
|
-
if (
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12498
|
+
if (finishedTyping) {
|
|
12499
|
+
if (phone !== null && phone !== void 0 && phone.length) {
|
|
12500
|
+
dispatch({
|
|
12501
|
+
type: SET_PHONE,
|
|
12502
|
+
payload: phone
|
|
12503
|
+
});
|
|
12504
|
+
} else {
|
|
12505
|
+
if (otherProps.required) {
|
|
12506
|
+
dispatch({
|
|
12507
|
+
type: SET_PHONE_ERROR,
|
|
12508
|
+
payload: t("validation.enterPhone")
|
|
12509
|
+
});
|
|
12510
|
+
} else {
|
|
12511
|
+
dispatch({
|
|
12512
|
+
type: SET_PHONE,
|
|
12513
|
+
payload: phone
|
|
12514
|
+
});
|
|
12515
|
+
}
|
|
12516
|
+
}
|
|
12446
12517
|
}
|
|
12447
12518
|
}, [dispatch, phone, finishedTyping]);
|
|
12448
12519
|
React.useEffect(() => {
|
|
12449
12520
|
handleInputChange(phone);
|
|
12450
|
-
}, [finishedTyping, phone, handleInputChange]);
|
|
12521
|
+
}, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
|
|
12522
|
+
|
|
12523
|
+
const loadPhoneIntoField = () => {
|
|
12524
|
+
handleInputChange(window.Pelcro.user.read().phone);
|
|
12525
|
+
dispatch({
|
|
12526
|
+
type: SET_PHONE,
|
|
12527
|
+
payload: window.Pelcro.user.read().phone
|
|
12528
|
+
});
|
|
12529
|
+
};
|
|
12530
|
+
|
|
12531
|
+
React.useEffect(() => {
|
|
12532
|
+
if (initWithUserPhone) {
|
|
12533
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12534
|
+
loadPhoneIntoField();
|
|
12535
|
+
});
|
|
12536
|
+
loadPhoneIntoField();
|
|
12537
|
+
return () => {
|
|
12538
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12539
|
+
};
|
|
12540
|
+
}
|
|
12541
|
+
}, []);
|
|
12451
12542
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12452
12543
|
type: "tel",
|
|
12453
12544
|
error: phoneError,
|
|
@@ -12458,16 +12549,12 @@ function Phone({
|
|
|
12458
12549
|
}, otherProps));
|
|
12459
12550
|
}
|
|
12460
12551
|
|
|
12461
|
-
const RegisterPhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
12462
|
-
store: store$k
|
|
12463
|
-
}, props));
|
|
12464
|
-
|
|
12465
12552
|
/**
|
|
12466
12553
|
*
|
|
12467
12554
|
*/
|
|
12468
12555
|
|
|
12469
12556
|
function RegisterView(props) {
|
|
12470
|
-
var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett
|
|
12557
|
+
var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12471
12558
|
|
|
12472
12559
|
const {
|
|
12473
12560
|
t
|
|
@@ -12479,7 +12566,6 @@ function RegisterView(props) {
|
|
|
12479
12566
|
const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
|
|
12480
12567
|
const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
|
|
12481
12568
|
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;
|
|
12482
|
-
const supportsTap = Boolean((_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.tap_gateway_settings);
|
|
12483
12569
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12484
12570
|
id: "pelcro-register-view"
|
|
12485
12571
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -12489,25 +12575,18 @@ function RegisterView(props) {
|
|
|
12489
12575
|
}, title), /*#__PURE__*/React__default['default'].createElement("p", null, subtitle)), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
12490
12576
|
action: "javascript:void(0);",
|
|
12491
12577
|
className: "plc-mt-2 pelcro-form"
|
|
12492
|
-
}, /*#__PURE__*/React__default['default'].createElement(RegisterContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null),
|
|
12578
|
+
}, /*#__PURE__*/React__default['default'].createElement(RegisterContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), showNameFields && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12493
12579
|
className: "plc-flex plc-items-start"
|
|
12494
12580
|
}, /*#__PURE__*/React__default['default'].createElement(RegisterFirstName, {
|
|
12495
12581
|
id: "pelcro-input-first-name",
|
|
12496
12582
|
label: t("labels.firstName"),
|
|
12497
|
-
errorId: "pelcro-input-firstName-error"
|
|
12498
|
-
required: supportsTap ? true : false
|
|
12583
|
+
errorId: "pelcro-input-firstName-error"
|
|
12499
12584
|
}), /*#__PURE__*/React__default['default'].createElement(RegisterLastName, {
|
|
12500
12585
|
wrapperClassName: "plc-ml-3",
|
|
12501
12586
|
id: "pelcro-input-last-name",
|
|
12502
12587
|
label: t("labels.lastName"),
|
|
12503
|
-
errorId: "pelcro-input-lastName-error"
|
|
12504
|
-
|
|
12505
|
-
})), supportsTap && /*#__PURE__*/React__default['default'].createElement(RegisterPhone, {
|
|
12506
|
-
id: "pelcro-input-phone",
|
|
12507
|
-
errorId: "pelcro-input-phone-error",
|
|
12508
|
-
label: t("labels.phone"),
|
|
12509
|
-
required: supportsTap ? true : false
|
|
12510
|
-
}), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
12588
|
+
errorId: "pelcro-input-lastName-error"
|
|
12589
|
+
})), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
12511
12590
|
id: "pelcro-input-email",
|
|
12512
12591
|
errorId: "pelcro-input-email-error",
|
|
12513
12592
|
label: t("labels.email"),
|
|
@@ -12553,9 +12632,9 @@ function RegisterView(props) {
|
|
|
12553
12632
|
*/
|
|
12554
12633
|
|
|
12555
12634
|
function hasSecurityTokenEnabled() {
|
|
12556
|
-
var _window$Pelcro$site, _window$Pelcro$site$
|
|
12635
|
+
var _window$Pelcro$site, _window$Pelcro$site$r4;
|
|
12557
12636
|
|
|
12558
|
-
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$
|
|
12637
|
+
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
|
|
12559
12638
|
}
|
|
12560
12639
|
|
|
12561
12640
|
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -15274,6 +15353,12 @@ const initialState$j = {
|
|
|
15274
15353
|
updatedPrice: null,
|
|
15275
15354
|
taxAmount: null,
|
|
15276
15355
|
currentPlan: null,
|
|
15356
|
+
firstName: "",
|
|
15357
|
+
lastName: "",
|
|
15358
|
+
phone: "",
|
|
15359
|
+
firstNameError: null,
|
|
15360
|
+
lastNameError: null,
|
|
15361
|
+
phoneError: null,
|
|
15277
15362
|
alert: {
|
|
15278
15363
|
type: "error",
|
|
15279
15364
|
content: ""
|
|
@@ -15392,6 +15477,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15392
15477
|
} else {
|
|
15393
15478
|
window.Pelcro.payment.authorize({
|
|
15394
15479
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
15480
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
15481
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
15482
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
15395
15483
|
site_id: window.Pelcro.siteid,
|
|
15396
15484
|
amount: totalAmount,
|
|
15397
15485
|
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,
|
|
@@ -16917,6 +17005,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16917
17005
|
percentOff: action.payload
|
|
16918
17006
|
});
|
|
16919
17007
|
|
|
17008
|
+
case SET_FIRST_NAME:
|
|
17009
|
+
return lib_7({ ...state,
|
|
17010
|
+
firstName: action.payload,
|
|
17011
|
+
firstNameError: null
|
|
17012
|
+
});
|
|
17013
|
+
|
|
17014
|
+
case SET_LAST_NAME:
|
|
17015
|
+
return lib_7({ ...state,
|
|
17016
|
+
lastName: action.payload,
|
|
17017
|
+
lastNameError: null
|
|
17018
|
+
});
|
|
17019
|
+
|
|
17020
|
+
case SET_PHONE:
|
|
17021
|
+
return lib_7({ ...state,
|
|
17022
|
+
phone: action.payload,
|
|
17023
|
+
phoneError: null
|
|
17024
|
+
});
|
|
17025
|
+
|
|
17026
|
+
case SET_FIRST_NAME_ERROR:
|
|
17027
|
+
return lib_7({ ...state,
|
|
17028
|
+
firstNameError: action.payload,
|
|
17029
|
+
firstName: ""
|
|
17030
|
+
});
|
|
17031
|
+
|
|
17032
|
+
case SET_LAST_NAME_ERROR:
|
|
17033
|
+
return lib_7({ ...state,
|
|
17034
|
+
lastNameError: action.payload,
|
|
17035
|
+
lastName: ""
|
|
17036
|
+
});
|
|
17037
|
+
|
|
17038
|
+
case SET_PHONE_ERROR:
|
|
17039
|
+
return lib_7({ ...state,
|
|
17040
|
+
phoneError: action.payload,
|
|
17041
|
+
phone: null
|
|
17042
|
+
});
|
|
17043
|
+
|
|
16920
17044
|
case SHOW_ALERT:
|
|
16921
17045
|
return lib_7({ ...state,
|
|
16922
17046
|
alert: action.payload
|
|
@@ -17131,7 +17255,7 @@ const SubmitPaymentMethod = ({
|
|
|
17131
17255
|
onClick,
|
|
17132
17256
|
...otherProps
|
|
17133
17257
|
}) => {
|
|
17134
|
-
var _plan$quantity;
|
|
17258
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
17135
17259
|
|
|
17136
17260
|
const {
|
|
17137
17261
|
plan
|
|
@@ -17142,6 +17266,12 @@ const SubmitPaymentMethod = ({
|
|
|
17142
17266
|
const {
|
|
17143
17267
|
dispatch,
|
|
17144
17268
|
state: {
|
|
17269
|
+
firstNameError,
|
|
17270
|
+
lastNameError,
|
|
17271
|
+
phoneError,
|
|
17272
|
+
firstName,
|
|
17273
|
+
lastName,
|
|
17274
|
+
phone,
|
|
17145
17275
|
disableSubmit,
|
|
17146
17276
|
isLoading,
|
|
17147
17277
|
updatedPrice
|
|
@@ -17150,6 +17280,18 @@ const SubmitPaymentMethod = ({
|
|
|
17150
17280
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17151
17281
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
17152
17282
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17283
|
+
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
17284
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17285
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17286
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17287
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
17288
|
+
React.useEffect(() => {
|
|
17289
|
+
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
17290
|
+
setDisabled(disableSubmit);
|
|
17291
|
+
} else {
|
|
17292
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
17293
|
+
}
|
|
17294
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
17153
17295
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
17154
17296
|
role: "submit",
|
|
17155
17297
|
className: "plc-w-full plc-py-3",
|
|
@@ -17161,7 +17303,7 @@ const SubmitPaymentMethod = ({
|
|
|
17161
17303
|
});
|
|
17162
17304
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17163
17305
|
},
|
|
17164
|
-
disabled:
|
|
17306
|
+
disabled: isDisabled
|
|
17165
17307
|
}, otherProps), plan ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
17166
17308
|
className: "plc-capitalize "
|
|
17167
17309
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17709,7 +17851,7 @@ const SelectedPaymentMethod = () => {
|
|
|
17709
17851
|
};
|
|
17710
17852
|
|
|
17711
17853
|
const TaxAmount = () => {
|
|
17712
|
-
var _plan$quantity;
|
|
17854
|
+
var _plan$quantity, _window$Pelcro$site, _window$Pelcro$site$r;
|
|
17713
17855
|
|
|
17714
17856
|
const {
|
|
17715
17857
|
t
|
|
@@ -17724,18 +17866,31 @@ const TaxAmount = () => {
|
|
|
17724
17866
|
} = usePelcro();
|
|
17725
17867
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17726
17868
|
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17869
|
+
const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
|
|
17727
17870
|
|
|
17728
17871
|
if (taxAmount) {
|
|
17729
17872
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17730
17873
|
className: "plc-text-center pelcro-tax-amount"
|
|
17731
|
-
}, t("labels.tax")
|
|
17874
|
+
}, isTaxInclusive && "(", isTaxInclusive ? `Includes ${t("labels.tax")}` : `+ ${t("labels.tax")}`, " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
17732
17875
|
className: "plc-font-bold"
|
|
17733
|
-
}, priceFormatted));
|
|
17876
|
+
}, priceFormatted), isTaxInclusive && ")");
|
|
17734
17877
|
}
|
|
17735
17878
|
|
|
17736
17879
|
return null;
|
|
17737
17880
|
};
|
|
17738
17881
|
|
|
17882
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
17883
|
+
store: store$j
|
|
17884
|
+
}, props));
|
|
17885
|
+
|
|
17886
|
+
const IncludeLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
17887
|
+
store: store$j
|
|
17888
|
+
}, props));
|
|
17889
|
+
|
|
17890
|
+
const IncludePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
17891
|
+
store: store$j
|
|
17892
|
+
}, props));
|
|
17893
|
+
|
|
17739
17894
|
/**
|
|
17740
17895
|
*
|
|
17741
17896
|
*/
|
|
@@ -17755,7 +17910,10 @@ function PaymentMethodView({
|
|
|
17755
17910
|
} = useTranslation("checkoutForm");
|
|
17756
17911
|
const cardProcessor = getSiteCardProcessor();
|
|
17757
17912
|
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);
|
|
17758
|
-
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);
|
|
17913
|
+
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);
|
|
17914
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17915
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17916
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17759
17917
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17760
17918
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17761
17919
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -17777,7 +17935,25 @@ function PaymentMethodView({
|
|
|
17777
17935
|
onFailure: onFailure
|
|
17778
17936
|
}, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
17779
17937
|
className: "plc-mb-2"
|
|
17780
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(
|
|
17938
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17939
|
+
className: "plc-flex plc-items-start"
|
|
17940
|
+
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
17941
|
+
id: "pelcro-input-first-name",
|
|
17942
|
+
label: t("labels.firstName"),
|
|
17943
|
+
errorId: "pelcro-input-firstName-error",
|
|
17944
|
+
required: true
|
|
17945
|
+
}), /*#__PURE__*/React__default['default'].createElement(IncludeLastName, {
|
|
17946
|
+
wrapperClassName: "plc-ml-3",
|
|
17947
|
+
id: "pelcro-input-last-name",
|
|
17948
|
+
label: t("labels.lastName"),
|
|
17949
|
+
errorId: "pelcro-input-lastName-error",
|
|
17950
|
+
required: true
|
|
17951
|
+
})), /*#__PURE__*/React__default['default'].createElement(IncludePhone, {
|
|
17952
|
+
id: "pelcro-input-phone",
|
|
17953
|
+
errorId: "pelcro-input-phone-error",
|
|
17954
|
+
label: t("labels.phone"),
|
|
17955
|
+
required: true
|
|
17956
|
+
})), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17781
17957
|
className: "plc-mb-2"
|
|
17782
17958
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17783
17959
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19553,7 +19729,7 @@ const UserUpdateButton = ({
|
|
|
19553
19729
|
} = useTranslation("userEdit");
|
|
19554
19730
|
const [isDisabled, setDisabled] = React.useState(true);
|
|
19555
19731
|
React.useEffect(() => {
|
|
19556
|
-
setDisabled(buttonDisabled || emailError ||
|
|
19732
|
+
setDisabled(buttonDisabled || emailError || !(email !== null && email !== void 0 && email.length) || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
19557
19733
|
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19558
19734
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
19559
19735
|
onClick: () => {
|
|
@@ -22951,10 +23127,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default['default'].createEl
|
|
|
22951
23127
|
}, props));
|
|
22952
23128
|
|
|
22953
23129
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
23130
|
+
initWithUserFirstName: false,
|
|
22954
23131
|
store: store$7
|
|
22955
23132
|
}, props));
|
|
22956
23133
|
|
|
22957
23134
|
const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
23135
|
+
initWithUserLastName: false,
|
|
22958
23136
|
store: store$7
|
|
22959
23137
|
}, props));
|
|
22960
23138
|
|
|
@@ -30721,6 +30899,9 @@ exports.GiftRedeemModal = GiftRedeemModal;
|
|
|
30721
30899
|
exports.GiftRedeemSubmitButton = GiftRedeemSubmitButton;
|
|
30722
30900
|
exports.GiftRedeemView = GiftRedeemView;
|
|
30723
30901
|
exports.GoogleLoginButton = GoogleLoginButton;
|
|
30902
|
+
exports.IncludeFirstName = IncludeFirstName;
|
|
30903
|
+
exports.IncludeLastName = IncludeLastName;
|
|
30904
|
+
exports.IncludePhone = IncludePhone;
|
|
30724
30905
|
exports.Input = Input;
|
|
30725
30906
|
exports.InvoiceDetailsContainer = InvoiceDetailsContainer;
|
|
30726
30907
|
exports.InvoiceDetailsDownloadButton = InvoiceDetailsDownloadButton;
|
package/dist/index.esm.js
CHANGED
|
@@ -3793,8 +3793,11 @@ var labels$F = {
|
|
|
3793
3793
|
"for": "for",
|
|
3794
3794
|
interval: "{{count}} {{interval}}",
|
|
3795
3795
|
interval_plural: "{{count}} {{interval}}s",
|
|
3796
|
-
tax: "
|
|
3797
|
-
removeCoupon: "REMOVE"
|
|
3796
|
+
tax: "Tax",
|
|
3797
|
+
removeCoupon: "REMOVE",
|
|
3798
|
+
firstName: "First name",
|
|
3799
|
+
lastName: "Last name",
|
|
3800
|
+
phone: "Phone"
|
|
3798
3801
|
};
|
|
3799
3802
|
var checkoutForm_en = {
|
|
3800
3803
|
messages: messages$I,
|
|
@@ -3820,8 +3823,11 @@ var labels$E = {
|
|
|
3820
3823
|
"for": "pour",
|
|
3821
3824
|
interval: "{{count}} {{interval}}",
|
|
3822
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3823
|
-
tax: "
|
|
3824
|
-
removeCoupon: "RETIRER"
|
|
3826
|
+
tax: "Taxe",
|
|
3827
|
+
removeCoupon: "RETIRER",
|
|
3828
|
+
firstName: "Prénom",
|
|
3829
|
+
lastName: "Nom de famille",
|
|
3830
|
+
phone: "Téléphoner"
|
|
3825
3831
|
};
|
|
3826
3832
|
var checkoutForm_fr = {
|
|
3827
3833
|
messages: messages$H,
|
|
@@ -3847,8 +3853,11 @@ var labels$D = {
|
|
|
3847
3853
|
"for": "관련",
|
|
3848
3854
|
interval: "{{count}} {{interval}}",
|
|
3849
3855
|
interval_plural: "{{count}} {{interval}}",
|
|
3850
|
-
tax: "
|
|
3851
|
-
removeCoupon: "제거"
|
|
3856
|
+
tax: "세금",
|
|
3857
|
+
removeCoupon: "제거",
|
|
3858
|
+
firstName: "이름",
|
|
3859
|
+
lastName: "성",
|
|
3860
|
+
phone: "핸드폰"
|
|
3852
3861
|
};
|
|
3853
3862
|
var checkoutForm_ko = {
|
|
3854
3863
|
messages: messages$G,
|
|
@@ -7217,8 +7226,7 @@ class PelcroActions {
|
|
|
7217
7226
|
return this.set({
|
|
7218
7227
|
view: "login"
|
|
7219
7228
|
});
|
|
7220
|
-
}
|
|
7221
|
-
|
|
7229
|
+
}
|
|
7222
7230
|
|
|
7223
7231
|
if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
|
|
7224
7232
|
return this.set({
|
|
@@ -12247,32 +12255,25 @@ const RegisterButton = ({
|
|
|
12247
12255
|
className,
|
|
12248
12256
|
...otherProps
|
|
12249
12257
|
}) => {
|
|
12250
|
-
var _window$Pelcro$site$r
|
|
12258
|
+
var _window$Pelcro$site$r;
|
|
12251
12259
|
|
|
12252
12260
|
const {
|
|
12253
12261
|
state: {
|
|
12254
12262
|
emailError,
|
|
12255
12263
|
passwordError,
|
|
12256
|
-
firstNameError,
|
|
12257
|
-
lastNameError,
|
|
12258
|
-
phoneError,
|
|
12259
12264
|
email,
|
|
12260
12265
|
password,
|
|
12261
|
-
firstName,
|
|
12262
|
-
lastName,
|
|
12263
|
-
phone,
|
|
12264
12266
|
buttonDisabled
|
|
12265
12267
|
},
|
|
12266
12268
|
dispatch
|
|
12267
12269
|
} = useContext(store$k);
|
|
12268
|
-
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
12269
12270
|
const {
|
|
12270
12271
|
t
|
|
12271
12272
|
} = useTranslation("register");
|
|
12272
12273
|
const [isDisabled, setDisabled] = useState(true);
|
|
12273
12274
|
useEffect(() => {
|
|
12274
|
-
setDisabled(buttonDisabled || emailError || passwordError ||
|
|
12275
|
-
}, [buttonDisabled, emailError, passwordError,
|
|
12275
|
+
setDisabled(buttonDisabled || emailError || passwordError || !email.length || !password.length);
|
|
12276
|
+
}, [buttonDisabled, emailError, passwordError, email, password]);
|
|
12276
12277
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
12277
12278
|
onClick: () => {
|
|
12278
12279
|
dispatch({
|
|
@@ -12284,11 +12285,12 @@ const RegisterButton = ({
|
|
|
12284
12285
|
isLoading: buttonDisabled,
|
|
12285
12286
|
className: `${className} g-recaptcha`,
|
|
12286
12287
|
"data-action": "register",
|
|
12287
|
-
"data-sitekey": (_window$Pelcro$site$
|
|
12288
|
+
"data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
|
|
12288
12289
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12289
12290
|
};
|
|
12290
12291
|
|
|
12291
12292
|
function FirstName({
|
|
12293
|
+
initWithUserFirstName = true,
|
|
12292
12294
|
store,
|
|
12293
12295
|
...otherProps
|
|
12294
12296
|
}) {
|
|
@@ -12307,21 +12309,50 @@ function FirstName({
|
|
|
12307
12309
|
const handleInputChange = useCallback(value => {
|
|
12308
12310
|
setFirstName(value);
|
|
12309
12311
|
|
|
12310
|
-
if (
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12312
|
+
if (finishedTyping) {
|
|
12313
|
+
if (firstName !== null && firstName !== void 0 && firstName.length) {
|
|
12314
|
+
dispatch({
|
|
12315
|
+
type: SET_FIRST_NAME,
|
|
12316
|
+
payload: firstName
|
|
12317
|
+
});
|
|
12318
|
+
} else {
|
|
12319
|
+
if (otherProps.required) {
|
|
12320
|
+
dispatch({
|
|
12321
|
+
type: SET_FIRST_NAME_ERROR,
|
|
12322
|
+
payload: t("validation.enterFirstName")
|
|
12323
|
+
});
|
|
12324
|
+
} else {
|
|
12325
|
+
dispatch({
|
|
12326
|
+
type: SET_FIRST_NAME,
|
|
12327
|
+
payload: firstName
|
|
12328
|
+
});
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12320
12331
|
}
|
|
12321
12332
|
}, [dispatch, firstName, finishedTyping]);
|
|
12322
12333
|
useEffect(() => {
|
|
12323
12334
|
handleInputChange(firstName);
|
|
12324
|
-
}, [finishedTyping, firstName, handleInputChange]);
|
|
12335
|
+
}, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
|
|
12336
|
+
|
|
12337
|
+
const loadFirstNameIntoField = () => {
|
|
12338
|
+
handleInputChange(window.Pelcro.user.read().first_name);
|
|
12339
|
+
dispatch({
|
|
12340
|
+
type: SET_FIRST_NAME,
|
|
12341
|
+
payload: window.Pelcro.user.read().first_name
|
|
12342
|
+
});
|
|
12343
|
+
};
|
|
12344
|
+
|
|
12345
|
+
useEffect(() => {
|
|
12346
|
+
if (initWithUserFirstName) {
|
|
12347
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12348
|
+
loadFirstNameIntoField();
|
|
12349
|
+
});
|
|
12350
|
+
loadFirstNameIntoField();
|
|
12351
|
+
return () => {
|
|
12352
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12353
|
+
};
|
|
12354
|
+
}
|
|
12355
|
+
}, []);
|
|
12325
12356
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12326
12357
|
type: "text",
|
|
12327
12358
|
error: firstNameError,
|
|
@@ -12337,6 +12368,7 @@ const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(Fir
|
|
|
12337
12368
|
}, props));
|
|
12338
12369
|
|
|
12339
12370
|
function LastName({
|
|
12371
|
+
initWithUserLastName = true,
|
|
12340
12372
|
store,
|
|
12341
12373
|
...otherProps
|
|
12342
12374
|
}) {
|
|
@@ -12355,21 +12387,50 @@ function LastName({
|
|
|
12355
12387
|
const handleInputChange = useCallback(value => {
|
|
12356
12388
|
setLastName(value);
|
|
12357
12389
|
|
|
12358
|
-
if (
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12390
|
+
if (finishedTyping) {
|
|
12391
|
+
if (lastName !== null && lastName !== void 0 && lastName.length) {
|
|
12392
|
+
dispatch({
|
|
12393
|
+
type: SET_LAST_NAME,
|
|
12394
|
+
payload: lastName
|
|
12395
|
+
});
|
|
12396
|
+
} else {
|
|
12397
|
+
if (otherProps.required) {
|
|
12398
|
+
dispatch({
|
|
12399
|
+
type: SET_LAST_NAME_ERROR,
|
|
12400
|
+
payload: t("validation.enterLastName")
|
|
12401
|
+
});
|
|
12402
|
+
} else {
|
|
12403
|
+
dispatch({
|
|
12404
|
+
type: SET_LAST_NAME,
|
|
12405
|
+
payload: lastName
|
|
12406
|
+
});
|
|
12407
|
+
}
|
|
12408
|
+
}
|
|
12368
12409
|
}
|
|
12369
12410
|
}, [dispatch, lastName, finishedTyping]);
|
|
12370
12411
|
useEffect(() => {
|
|
12371
12412
|
handleInputChange(lastName);
|
|
12372
|
-
}, [finishedTyping, lastName, handleInputChange]);
|
|
12413
|
+
}, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
|
|
12414
|
+
|
|
12415
|
+
const loadLastNameIntoField = () => {
|
|
12416
|
+
handleInputChange(window.Pelcro.user.read().last_name);
|
|
12417
|
+
dispatch({
|
|
12418
|
+
type: SET_LAST_NAME,
|
|
12419
|
+
payload: window.Pelcro.user.read().last_name
|
|
12420
|
+
});
|
|
12421
|
+
};
|
|
12422
|
+
|
|
12423
|
+
useEffect(() => {
|
|
12424
|
+
if (initWithUserLastName) {
|
|
12425
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12426
|
+
loadLastNameIntoField();
|
|
12427
|
+
});
|
|
12428
|
+
loadLastNameIntoField();
|
|
12429
|
+
return () => {
|
|
12430
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12431
|
+
};
|
|
12432
|
+
}
|
|
12433
|
+
}, []);
|
|
12373
12434
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12374
12435
|
type: "text",
|
|
12375
12436
|
error: lastNameError,
|
|
@@ -12385,6 +12446,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
|
|
|
12385
12446
|
}, props));
|
|
12386
12447
|
|
|
12387
12448
|
function Phone({
|
|
12449
|
+
initWithUserPhone = true,
|
|
12388
12450
|
store,
|
|
12389
12451
|
...otherProps
|
|
12390
12452
|
}) {
|
|
@@ -12403,21 +12465,50 @@ function Phone({
|
|
|
12403
12465
|
const handleInputChange = useCallback(value => {
|
|
12404
12466
|
setPhone(value);
|
|
12405
12467
|
|
|
12406
|
-
if (
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12468
|
+
if (finishedTyping) {
|
|
12469
|
+
if (phone !== null && phone !== void 0 && phone.length) {
|
|
12470
|
+
dispatch({
|
|
12471
|
+
type: SET_PHONE,
|
|
12472
|
+
payload: phone
|
|
12473
|
+
});
|
|
12474
|
+
} else {
|
|
12475
|
+
if (otherProps.required) {
|
|
12476
|
+
dispatch({
|
|
12477
|
+
type: SET_PHONE_ERROR,
|
|
12478
|
+
payload: t("validation.enterPhone")
|
|
12479
|
+
});
|
|
12480
|
+
} else {
|
|
12481
|
+
dispatch({
|
|
12482
|
+
type: SET_PHONE,
|
|
12483
|
+
payload: phone
|
|
12484
|
+
});
|
|
12485
|
+
}
|
|
12486
|
+
}
|
|
12416
12487
|
}
|
|
12417
12488
|
}, [dispatch, phone, finishedTyping]);
|
|
12418
12489
|
useEffect(() => {
|
|
12419
12490
|
handleInputChange(phone);
|
|
12420
|
-
}, [finishedTyping, phone, handleInputChange]);
|
|
12491
|
+
}, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
|
|
12492
|
+
|
|
12493
|
+
const loadPhoneIntoField = () => {
|
|
12494
|
+
handleInputChange(window.Pelcro.user.read().phone);
|
|
12495
|
+
dispatch({
|
|
12496
|
+
type: SET_PHONE,
|
|
12497
|
+
payload: window.Pelcro.user.read().phone
|
|
12498
|
+
});
|
|
12499
|
+
};
|
|
12500
|
+
|
|
12501
|
+
useEffect(() => {
|
|
12502
|
+
if (initWithUserPhone) {
|
|
12503
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12504
|
+
loadPhoneIntoField();
|
|
12505
|
+
});
|
|
12506
|
+
loadPhoneIntoField();
|
|
12507
|
+
return () => {
|
|
12508
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12509
|
+
};
|
|
12510
|
+
}
|
|
12511
|
+
}, []);
|
|
12421
12512
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12422
12513
|
type: "tel",
|
|
12423
12514
|
error: phoneError,
|
|
@@ -12428,16 +12519,12 @@ function Phone({
|
|
|
12428
12519
|
}, otherProps));
|
|
12429
12520
|
}
|
|
12430
12521
|
|
|
12431
|
-
const RegisterPhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
12432
|
-
store: store$k
|
|
12433
|
-
}, props));
|
|
12434
|
-
|
|
12435
12522
|
/**
|
|
12436
12523
|
*
|
|
12437
12524
|
*/
|
|
12438
12525
|
|
|
12439
12526
|
function RegisterView(props) {
|
|
12440
|
-
var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett
|
|
12527
|
+
var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12441
12528
|
|
|
12442
12529
|
const {
|
|
12443
12530
|
t
|
|
@@ -12449,7 +12536,6 @@ function RegisterView(props) {
|
|
|
12449
12536
|
const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
|
|
12450
12537
|
const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
|
|
12451
12538
|
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;
|
|
12452
|
-
const supportsTap = Boolean((_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.tap_gateway_settings);
|
|
12453
12539
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
12454
12540
|
id: "pelcro-register-view"
|
|
12455
12541
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -12459,25 +12545,18 @@ function RegisterView(props) {
|
|
|
12459
12545
|
}, title), /*#__PURE__*/React__default.createElement("p", null, subtitle)), /*#__PURE__*/React__default.createElement("form", {
|
|
12460
12546
|
action: "javascript:void(0);",
|
|
12461
12547
|
className: "plc-mt-2 pelcro-form"
|
|
12462
|
-
}, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null),
|
|
12548
|
+
}, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), showNameFields && /*#__PURE__*/React__default.createElement("div", {
|
|
12463
12549
|
className: "plc-flex plc-items-start"
|
|
12464
12550
|
}, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
|
|
12465
12551
|
id: "pelcro-input-first-name",
|
|
12466
12552
|
label: t("labels.firstName"),
|
|
12467
|
-
errorId: "pelcro-input-firstName-error"
|
|
12468
|
-
required: supportsTap ? true : false
|
|
12553
|
+
errorId: "pelcro-input-firstName-error"
|
|
12469
12554
|
}), /*#__PURE__*/React__default.createElement(RegisterLastName, {
|
|
12470
12555
|
wrapperClassName: "plc-ml-3",
|
|
12471
12556
|
id: "pelcro-input-last-name",
|
|
12472
12557
|
label: t("labels.lastName"),
|
|
12473
|
-
errorId: "pelcro-input-lastName-error"
|
|
12474
|
-
|
|
12475
|
-
})), supportsTap && /*#__PURE__*/React__default.createElement(RegisterPhone, {
|
|
12476
|
-
id: "pelcro-input-phone",
|
|
12477
|
-
errorId: "pelcro-input-phone-error",
|
|
12478
|
-
label: t("labels.phone"),
|
|
12479
|
-
required: supportsTap ? true : false
|
|
12480
|
-
}), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
12558
|
+
errorId: "pelcro-input-lastName-error"
|
|
12559
|
+
})), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
12481
12560
|
id: "pelcro-input-email",
|
|
12482
12561
|
errorId: "pelcro-input-email-error",
|
|
12483
12562
|
label: t("labels.email"),
|
|
@@ -12523,9 +12602,9 @@ function RegisterView(props) {
|
|
|
12523
12602
|
*/
|
|
12524
12603
|
|
|
12525
12604
|
function hasSecurityTokenEnabled() {
|
|
12526
|
-
var _window$Pelcro$site, _window$Pelcro$site$
|
|
12605
|
+
var _window$Pelcro$site, _window$Pelcro$site$r4;
|
|
12527
12606
|
|
|
12528
|
-
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$
|
|
12607
|
+
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
|
|
12529
12608
|
}
|
|
12530
12609
|
|
|
12531
12610
|
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -15244,6 +15323,12 @@ const initialState$j = {
|
|
|
15244
15323
|
updatedPrice: null,
|
|
15245
15324
|
taxAmount: null,
|
|
15246
15325
|
currentPlan: null,
|
|
15326
|
+
firstName: "",
|
|
15327
|
+
lastName: "",
|
|
15328
|
+
phone: "",
|
|
15329
|
+
firstNameError: null,
|
|
15330
|
+
lastNameError: null,
|
|
15331
|
+
phoneError: null,
|
|
15247
15332
|
alert: {
|
|
15248
15333
|
type: "error",
|
|
15249
15334
|
content: ""
|
|
@@ -15362,6 +15447,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15362
15447
|
} else {
|
|
15363
15448
|
window.Pelcro.payment.authorize({
|
|
15364
15449
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
15450
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
15451
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
15452
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
15365
15453
|
site_id: window.Pelcro.siteid,
|
|
15366
15454
|
amount: totalAmount,
|
|
15367
15455
|
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,
|
|
@@ -16887,6 +16975,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16887
16975
|
percentOff: action.payload
|
|
16888
16976
|
});
|
|
16889
16977
|
|
|
16978
|
+
case SET_FIRST_NAME:
|
|
16979
|
+
return lib_7({ ...state,
|
|
16980
|
+
firstName: action.payload,
|
|
16981
|
+
firstNameError: null
|
|
16982
|
+
});
|
|
16983
|
+
|
|
16984
|
+
case SET_LAST_NAME:
|
|
16985
|
+
return lib_7({ ...state,
|
|
16986
|
+
lastName: action.payload,
|
|
16987
|
+
lastNameError: null
|
|
16988
|
+
});
|
|
16989
|
+
|
|
16990
|
+
case SET_PHONE:
|
|
16991
|
+
return lib_7({ ...state,
|
|
16992
|
+
phone: action.payload,
|
|
16993
|
+
phoneError: null
|
|
16994
|
+
});
|
|
16995
|
+
|
|
16996
|
+
case SET_FIRST_NAME_ERROR:
|
|
16997
|
+
return lib_7({ ...state,
|
|
16998
|
+
firstNameError: action.payload,
|
|
16999
|
+
firstName: ""
|
|
17000
|
+
});
|
|
17001
|
+
|
|
17002
|
+
case SET_LAST_NAME_ERROR:
|
|
17003
|
+
return lib_7({ ...state,
|
|
17004
|
+
lastNameError: action.payload,
|
|
17005
|
+
lastName: ""
|
|
17006
|
+
});
|
|
17007
|
+
|
|
17008
|
+
case SET_PHONE_ERROR:
|
|
17009
|
+
return lib_7({ ...state,
|
|
17010
|
+
phoneError: action.payload,
|
|
17011
|
+
phone: null
|
|
17012
|
+
});
|
|
17013
|
+
|
|
16890
17014
|
case SHOW_ALERT:
|
|
16891
17015
|
return lib_7({ ...state,
|
|
16892
17016
|
alert: action.payload
|
|
@@ -17101,7 +17225,7 @@ const SubmitPaymentMethod = ({
|
|
|
17101
17225
|
onClick,
|
|
17102
17226
|
...otherProps
|
|
17103
17227
|
}) => {
|
|
17104
|
-
var _plan$quantity;
|
|
17228
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
17105
17229
|
|
|
17106
17230
|
const {
|
|
17107
17231
|
plan
|
|
@@ -17112,6 +17236,12 @@ const SubmitPaymentMethod = ({
|
|
|
17112
17236
|
const {
|
|
17113
17237
|
dispatch,
|
|
17114
17238
|
state: {
|
|
17239
|
+
firstNameError,
|
|
17240
|
+
lastNameError,
|
|
17241
|
+
phoneError,
|
|
17242
|
+
firstName,
|
|
17243
|
+
lastName,
|
|
17244
|
+
phone,
|
|
17115
17245
|
disableSubmit,
|
|
17116
17246
|
isLoading,
|
|
17117
17247
|
updatedPrice
|
|
@@ -17120,6 +17250,18 @@ const SubmitPaymentMethod = ({
|
|
|
17120
17250
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17121
17251
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
17122
17252
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17253
|
+
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
17254
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17255
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17256
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17257
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
17258
|
+
useEffect(() => {
|
|
17259
|
+
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
17260
|
+
setDisabled(disableSubmit);
|
|
17261
|
+
} else {
|
|
17262
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
17263
|
+
}
|
|
17264
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
17123
17265
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
17124
17266
|
role: "submit",
|
|
17125
17267
|
className: "plc-w-full plc-py-3",
|
|
@@ -17131,7 +17273,7 @@ const SubmitPaymentMethod = ({
|
|
|
17131
17273
|
});
|
|
17132
17274
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17133
17275
|
},
|
|
17134
|
-
disabled:
|
|
17276
|
+
disabled: isDisabled
|
|
17135
17277
|
}, otherProps), plan ? /*#__PURE__*/React__default.createElement("span", {
|
|
17136
17278
|
className: "plc-capitalize "
|
|
17137
17279
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17679,7 +17821,7 @@ const SelectedPaymentMethod = () => {
|
|
|
17679
17821
|
};
|
|
17680
17822
|
|
|
17681
17823
|
const TaxAmount = () => {
|
|
17682
|
-
var _plan$quantity;
|
|
17824
|
+
var _plan$quantity, _window$Pelcro$site, _window$Pelcro$site$r;
|
|
17683
17825
|
|
|
17684
17826
|
const {
|
|
17685
17827
|
t
|
|
@@ -17694,18 +17836,31 @@ const TaxAmount = () => {
|
|
|
17694
17836
|
} = usePelcro();
|
|
17695
17837
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17696
17838
|
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17839
|
+
const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
|
|
17697
17840
|
|
|
17698
17841
|
if (taxAmount) {
|
|
17699
17842
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17700
17843
|
className: "plc-text-center pelcro-tax-amount"
|
|
17701
|
-
}, t("labels.tax")
|
|
17844
|
+
}, isTaxInclusive && "(", isTaxInclusive ? `Includes ${t("labels.tax")}` : `+ ${t("labels.tax")}`, " ", /*#__PURE__*/React__default.createElement("span", {
|
|
17702
17845
|
className: "plc-font-bold"
|
|
17703
|
-
}, priceFormatted));
|
|
17846
|
+
}, priceFormatted), isTaxInclusive && ")");
|
|
17704
17847
|
}
|
|
17705
17848
|
|
|
17706
17849
|
return null;
|
|
17707
17850
|
};
|
|
17708
17851
|
|
|
17852
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
17853
|
+
store: store$j
|
|
17854
|
+
}, props));
|
|
17855
|
+
|
|
17856
|
+
const IncludeLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
17857
|
+
store: store$j
|
|
17858
|
+
}, props));
|
|
17859
|
+
|
|
17860
|
+
const IncludePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
17861
|
+
store: store$j
|
|
17862
|
+
}, props));
|
|
17863
|
+
|
|
17709
17864
|
/**
|
|
17710
17865
|
*
|
|
17711
17866
|
*/
|
|
@@ -17725,7 +17880,10 @@ function PaymentMethodView({
|
|
|
17725
17880
|
} = useTranslation("checkoutForm");
|
|
17726
17881
|
const cardProcessor = getSiteCardProcessor();
|
|
17727
17882
|
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);
|
|
17728
|
-
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);
|
|
17883
|
+
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);
|
|
17884
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17885
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17886
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17729
17887
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17730
17888
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17731
17889
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -17747,7 +17905,25 @@ function PaymentMethodView({
|
|
|
17747
17905
|
onFailure: onFailure
|
|
17748
17906
|
}, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
17749
17907
|
className: "plc-mb-2"
|
|
17750
|
-
}), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default.createElement(
|
|
17908
|
+
}), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
17909
|
+
className: "plc-flex plc-items-start"
|
|
17910
|
+
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
17911
|
+
id: "pelcro-input-first-name",
|
|
17912
|
+
label: t("labels.firstName"),
|
|
17913
|
+
errorId: "pelcro-input-firstName-error",
|
|
17914
|
+
required: true
|
|
17915
|
+
}), /*#__PURE__*/React__default.createElement(IncludeLastName, {
|
|
17916
|
+
wrapperClassName: "plc-ml-3",
|
|
17917
|
+
id: "pelcro-input-last-name",
|
|
17918
|
+
label: t("labels.lastName"),
|
|
17919
|
+
errorId: "pelcro-input-lastName-error",
|
|
17920
|
+
required: true
|
|
17921
|
+
})), /*#__PURE__*/React__default.createElement(IncludePhone, {
|
|
17922
|
+
id: "pelcro-input-phone",
|
|
17923
|
+
errorId: "pelcro-input-phone-error",
|
|
17924
|
+
label: t("labels.phone"),
|
|
17925
|
+
required: true
|
|
17926
|
+
})), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
17751
17927
|
className: "plc-mb-2"
|
|
17752
17928
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
17753
17929
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19523,7 +19699,7 @@ const UserUpdateButton = ({
|
|
|
19523
19699
|
} = useTranslation("userEdit");
|
|
19524
19700
|
const [isDisabled, setDisabled] = useState(true);
|
|
19525
19701
|
useEffect(() => {
|
|
19526
|
-
setDisabled(buttonDisabled || emailError ||
|
|
19702
|
+
setDisabled(buttonDisabled || emailError || !(email !== null && email !== void 0 && email.length) || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
19527
19703
|
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19528
19704
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
19529
19705
|
onClick: () => {
|
|
@@ -22921,10 +23097,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email
|
|
|
22921
23097
|
}, props));
|
|
22922
23098
|
|
|
22923
23099
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
23100
|
+
initWithUserFirstName: false,
|
|
22924
23101
|
store: store$7
|
|
22925
23102
|
}, props));
|
|
22926
23103
|
|
|
22927
23104
|
const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
23105
|
+
initWithUserLastName: false,
|
|
22928
23106
|
store: store$7
|
|
22929
23107
|
}, props));
|
|
22930
23108
|
|
|
@@ -30615,4 +30793,4 @@ const QrCodeModal = ({
|
|
|
30615
30793
|
};
|
|
30616
30794
|
QrCodeModal.viewId = "qrcode";
|
|
30617
30795
|
|
|
30618
|
-
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|
|
30796
|
+
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|