@pelcro/react-pelcro-js 3.9.0-beta.2 → 3.9.0-beta.4
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 +166 -77
- package/dist/index.esm.js +166 -77
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3824,7 +3824,10 @@ var labels$F = {
|
|
|
3824
3824
|
interval: "{{count}} {{interval}}",
|
|
3825
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3826
3826
|
tax: "+ Tax",
|
|
3827
|
-
removeCoupon: "REMOVE"
|
|
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,
|
|
@@ -3851,7 +3854,10 @@ var labels$E = {
|
|
|
3851
3854
|
interval: "{{count}} {{interval}}",
|
|
3852
3855
|
interval_plural: "{{count}} {{interval}}s",
|
|
3853
3856
|
tax: "+ Taxe",
|
|
3854
|
-
removeCoupon: "RETIRER"
|
|
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,
|
|
@@ -3878,7 +3884,10 @@ var labels$D = {
|
|
|
3878
3884
|
interval: "{{count}} {{interval}}",
|
|
3879
3885
|
interval_plural: "{{count}} {{interval}}",
|
|
3880
3886
|
tax: "+ 세금",
|
|
3881
|
-
removeCoupon: "제거"
|
|
3887
|
+
removeCoupon: "제거",
|
|
3888
|
+
firstName: "이름",
|
|
3889
|
+
lastName: "성",
|
|
3890
|
+
phone: "핸드폰"
|
|
3882
3891
|
};
|
|
3883
3892
|
var checkoutForm_ko = {
|
|
3884
3893
|
messages: messages$G,
|
|
@@ -12277,32 +12286,25 @@ const RegisterButton = ({
|
|
|
12277
12286
|
className,
|
|
12278
12287
|
...otherProps
|
|
12279
12288
|
}) => {
|
|
12280
|
-
var _window$Pelcro$site$r
|
|
12289
|
+
var _window$Pelcro$site$r;
|
|
12281
12290
|
|
|
12282
12291
|
const {
|
|
12283
12292
|
state: {
|
|
12284
12293
|
emailError,
|
|
12285
12294
|
passwordError,
|
|
12286
|
-
firstNameError,
|
|
12287
|
-
lastNameError,
|
|
12288
|
-
phoneError,
|
|
12289
12295
|
email,
|
|
12290
12296
|
password,
|
|
12291
|
-
firstName,
|
|
12292
|
-
lastName,
|
|
12293
|
-
phone,
|
|
12294
12297
|
buttonDisabled
|
|
12295
12298
|
},
|
|
12296
12299
|
dispatch
|
|
12297
12300
|
} = 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
12301
|
const {
|
|
12300
12302
|
t
|
|
12301
12303
|
} = useTranslation("register");
|
|
12302
12304
|
const [isDisabled, setDisabled] = React.useState(true);
|
|
12303
12305
|
React.useEffect(() => {
|
|
12304
|
-
setDisabled(buttonDisabled || emailError || passwordError ||
|
|
12305
|
-
}, [buttonDisabled, emailError, passwordError,
|
|
12306
|
+
setDisabled(buttonDisabled || emailError || passwordError || !email.length || !password.length);
|
|
12307
|
+
}, [buttonDisabled, emailError, passwordError, email, password]);
|
|
12306
12308
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
12307
12309
|
onClick: () => {
|
|
12308
12310
|
dispatch({
|
|
@@ -12314,7 +12316,7 @@ const RegisterButton = ({
|
|
|
12314
12316
|
isLoading: buttonDisabled,
|
|
12315
12317
|
className: `${className} g-recaptcha`,
|
|
12316
12318
|
"data-action": "register",
|
|
12317
|
-
"data-sitekey": (_window$Pelcro$site$
|
|
12319
|
+
"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
12320
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12319
12321
|
};
|
|
12320
12322
|
|
|
@@ -12343,11 +12345,18 @@ function FirstName({
|
|
|
12343
12345
|
type: SET_FIRST_NAME,
|
|
12344
12346
|
payload: firstName
|
|
12345
12347
|
});
|
|
12346
|
-
} else
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12348
|
+
} else {
|
|
12349
|
+
if (finishedTyping && 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
|
+
}
|
|
12351
12360
|
}
|
|
12352
12361
|
}, [dispatch, firstName, finishedTyping]);
|
|
12353
12362
|
React.useEffect(() => {
|
|
@@ -12408,11 +12417,18 @@ function LastName({
|
|
|
12408
12417
|
type: SET_LAST_NAME,
|
|
12409
12418
|
payload: lastName
|
|
12410
12419
|
});
|
|
12411
|
-
} else
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12420
|
+
} else {
|
|
12421
|
+
if (finishedTyping && otherProps.required) {
|
|
12422
|
+
dispatch({
|
|
12423
|
+
type: SET_LAST_NAME_ERROR,
|
|
12424
|
+
payload: t("validation.enterLastName")
|
|
12425
|
+
});
|
|
12426
|
+
} else {
|
|
12427
|
+
dispatch({
|
|
12428
|
+
type: SET_LAST_NAME,
|
|
12429
|
+
payload: lastName
|
|
12430
|
+
});
|
|
12431
|
+
}
|
|
12416
12432
|
}
|
|
12417
12433
|
}, [dispatch, lastName, finishedTyping]);
|
|
12418
12434
|
React.useEffect(() => {
|
|
@@ -12473,11 +12489,18 @@ function Phone({
|
|
|
12473
12489
|
type: SET_PHONE,
|
|
12474
12490
|
payload: phone
|
|
12475
12491
|
});
|
|
12476
|
-
} else
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12492
|
+
} else {
|
|
12493
|
+
if (finishedTyping && otherProps.required) {
|
|
12494
|
+
dispatch({
|
|
12495
|
+
type: SET_PHONE_ERROR,
|
|
12496
|
+
payload: t("validation.enterPhone")
|
|
12497
|
+
});
|
|
12498
|
+
} else {
|
|
12499
|
+
dispatch({
|
|
12500
|
+
type: SET_PHONE,
|
|
12501
|
+
payload: phone
|
|
12502
|
+
});
|
|
12503
|
+
}
|
|
12481
12504
|
}
|
|
12482
12505
|
}, [dispatch, phone, finishedTyping]);
|
|
12483
12506
|
React.useEffect(() => {
|
|
@@ -12509,16 +12532,12 @@ function Phone({
|
|
|
12509
12532
|
}, otherProps));
|
|
12510
12533
|
}
|
|
12511
12534
|
|
|
12512
|
-
const RegisterPhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
12513
|
-
store: store$k
|
|
12514
|
-
}, props));
|
|
12515
|
-
|
|
12516
12535
|
/**
|
|
12517
12536
|
*
|
|
12518
12537
|
*/
|
|
12519
12538
|
|
|
12520
12539
|
function RegisterView(props) {
|
|
12521
|
-
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
|
|
12540
|
+
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;
|
|
12522
12541
|
|
|
12523
12542
|
const {
|
|
12524
12543
|
t
|
|
@@ -12530,7 +12549,6 @@ function RegisterView(props) {
|
|
|
12530
12549
|
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");
|
|
12531
12550
|
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);
|
|
12532
12551
|
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;
|
|
12533
|
-
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);
|
|
12534
12552
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12535
12553
|
id: "pelcro-register-view"
|
|
12536
12554
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -12540,25 +12558,18 @@ function RegisterView(props) {
|
|
|
12540
12558
|
}, title), /*#__PURE__*/React__default['default'].createElement("p", null, subtitle)), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
12541
12559
|
action: "javascript:void(0);",
|
|
12542
12560
|
className: "plc-mt-2 pelcro-form"
|
|
12543
|
-
}, /*#__PURE__*/React__default['default'].createElement(RegisterContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null),
|
|
12561
|
+
}, /*#__PURE__*/React__default['default'].createElement(RegisterContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), showNameFields && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12544
12562
|
className: "plc-flex plc-items-start"
|
|
12545
12563
|
}, /*#__PURE__*/React__default['default'].createElement(RegisterFirstName, {
|
|
12546
12564
|
id: "pelcro-input-first-name",
|
|
12547
12565
|
label: t("labels.firstName"),
|
|
12548
|
-
errorId: "pelcro-input-firstName-error"
|
|
12549
|
-
required: supportsTap ? true : false
|
|
12566
|
+
errorId: "pelcro-input-firstName-error"
|
|
12550
12567
|
}), /*#__PURE__*/React__default['default'].createElement(RegisterLastName, {
|
|
12551
12568
|
wrapperClassName: "plc-ml-3",
|
|
12552
12569
|
id: "pelcro-input-last-name",
|
|
12553
12570
|
label: t("labels.lastName"),
|
|
12554
|
-
errorId: "pelcro-input-lastName-error"
|
|
12555
|
-
|
|
12556
|
-
})), supportsTap && /*#__PURE__*/React__default['default'].createElement(RegisterPhone, {
|
|
12557
|
-
id: "pelcro-input-phone",
|
|
12558
|
-
errorId: "pelcro-input-phone-error",
|
|
12559
|
-
label: t("labels.phone"),
|
|
12560
|
-
required: supportsTap ? true : false
|
|
12561
|
-
}), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
12571
|
+
errorId: "pelcro-input-lastName-error"
|
|
12572
|
+
})), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
12562
12573
|
id: "pelcro-input-email",
|
|
12563
12574
|
errorId: "pelcro-input-email-error",
|
|
12564
12575
|
label: t("labels.email"),
|
|
@@ -12604,9 +12615,9 @@ function RegisterView(props) {
|
|
|
12604
12615
|
*/
|
|
12605
12616
|
|
|
12606
12617
|
function hasSecurityTokenEnabled() {
|
|
12607
|
-
var _window$Pelcro$site, _window$Pelcro$site$
|
|
12618
|
+
var _window$Pelcro$site, _window$Pelcro$site$r4;
|
|
12608
12619
|
|
|
12609
|
-
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$
|
|
12620
|
+
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);
|
|
12610
12621
|
}
|
|
12611
12622
|
|
|
12612
12623
|
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -15325,6 +15336,12 @@ const initialState$j = {
|
|
|
15325
15336
|
updatedPrice: null,
|
|
15326
15337
|
taxAmount: null,
|
|
15327
15338
|
currentPlan: null,
|
|
15339
|
+
firstName: "",
|
|
15340
|
+
lastName: "",
|
|
15341
|
+
phone: "",
|
|
15342
|
+
firstNameError: null,
|
|
15343
|
+
lastNameError: null,
|
|
15344
|
+
phoneError: null,
|
|
15328
15345
|
alert: {
|
|
15329
15346
|
type: "error",
|
|
15330
15347
|
content: ""
|
|
@@ -15443,6 +15460,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15443
15460
|
} else {
|
|
15444
15461
|
window.Pelcro.payment.authorize({
|
|
15445
15462
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
15463
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
15464
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
15465
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
15446
15466
|
site_id: window.Pelcro.siteid,
|
|
15447
15467
|
amount: totalAmount,
|
|
15448
15468
|
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,
|
|
@@ -16968,6 +16988,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16968
16988
|
percentOff: action.payload
|
|
16969
16989
|
});
|
|
16970
16990
|
|
|
16991
|
+
case SET_FIRST_NAME:
|
|
16992
|
+
return lib_7({ ...state,
|
|
16993
|
+
firstName: action.payload,
|
|
16994
|
+
firstNameError: null
|
|
16995
|
+
});
|
|
16996
|
+
|
|
16997
|
+
case SET_LAST_NAME:
|
|
16998
|
+
return lib_7({ ...state,
|
|
16999
|
+
lastName: action.payload,
|
|
17000
|
+
lastNameError: null
|
|
17001
|
+
});
|
|
17002
|
+
|
|
17003
|
+
case SET_PHONE:
|
|
17004
|
+
return lib_7({ ...state,
|
|
17005
|
+
phone: action.payload,
|
|
17006
|
+
phoneError: null
|
|
17007
|
+
});
|
|
17008
|
+
|
|
17009
|
+
case SET_FIRST_NAME_ERROR:
|
|
17010
|
+
return lib_7({ ...state,
|
|
17011
|
+
firstNameError: action.payload,
|
|
17012
|
+
firstName: ""
|
|
17013
|
+
});
|
|
17014
|
+
|
|
17015
|
+
case SET_LAST_NAME_ERROR:
|
|
17016
|
+
return lib_7({ ...state,
|
|
17017
|
+
lastNameError: action.payload,
|
|
17018
|
+
lastName: ""
|
|
17019
|
+
});
|
|
17020
|
+
|
|
17021
|
+
case SET_PHONE_ERROR:
|
|
17022
|
+
return lib_7({ ...state,
|
|
17023
|
+
phoneError: action.payload,
|
|
17024
|
+
phone: null
|
|
17025
|
+
});
|
|
17026
|
+
|
|
16971
17027
|
case SHOW_ALERT:
|
|
16972
17028
|
return lib_7({ ...state,
|
|
16973
17029
|
alert: action.payload
|
|
@@ -17182,7 +17238,7 @@ const SubmitPaymentMethod = ({
|
|
|
17182
17238
|
onClick,
|
|
17183
17239
|
...otherProps
|
|
17184
17240
|
}) => {
|
|
17185
|
-
var _plan$quantity;
|
|
17241
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
17186
17242
|
|
|
17187
17243
|
const {
|
|
17188
17244
|
plan
|
|
@@ -17193,6 +17249,12 @@ const SubmitPaymentMethod = ({
|
|
|
17193
17249
|
const {
|
|
17194
17250
|
dispatch,
|
|
17195
17251
|
state: {
|
|
17252
|
+
firstNameError,
|
|
17253
|
+
lastNameError,
|
|
17254
|
+
phoneError,
|
|
17255
|
+
firstName,
|
|
17256
|
+
lastName,
|
|
17257
|
+
phone,
|
|
17196
17258
|
disableSubmit,
|
|
17197
17259
|
isLoading,
|
|
17198
17260
|
updatedPrice
|
|
@@ -17201,6 +17263,18 @@ const SubmitPaymentMethod = ({
|
|
|
17201
17263
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17202
17264
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
17203
17265
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17266
|
+
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);
|
|
17267
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17268
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17269
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17270
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
17271
|
+
React.useEffect(() => {
|
|
17272
|
+
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
17273
|
+
setDisabled(disableSubmit);
|
|
17274
|
+
} else {
|
|
17275
|
+
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));
|
|
17276
|
+
}
|
|
17277
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
17204
17278
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
17205
17279
|
role: "submit",
|
|
17206
17280
|
className: "plc-w-full plc-py-3",
|
|
@@ -17212,7 +17286,7 @@ const SubmitPaymentMethod = ({
|
|
|
17212
17286
|
});
|
|
17213
17287
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17214
17288
|
},
|
|
17215
|
-
disabled:
|
|
17289
|
+
disabled: isDisabled
|
|
17216
17290
|
}, otherProps), plan ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
17217
17291
|
className: "plc-capitalize "
|
|
17218
17292
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17787,6 +17861,18 @@ const TaxAmount = () => {
|
|
|
17787
17861
|
return null;
|
|
17788
17862
|
};
|
|
17789
17863
|
|
|
17864
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
17865
|
+
store: store$j
|
|
17866
|
+
}, props));
|
|
17867
|
+
|
|
17868
|
+
const IncludeLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
17869
|
+
store: store$j
|
|
17870
|
+
}, props));
|
|
17871
|
+
|
|
17872
|
+
const IncludePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
17873
|
+
store: store$j
|
|
17874
|
+
}, props));
|
|
17875
|
+
|
|
17790
17876
|
/**
|
|
17791
17877
|
*
|
|
17792
17878
|
*/
|
|
@@ -17806,7 +17892,10 @@ function PaymentMethodView({
|
|
|
17806
17892
|
} = useTranslation("checkoutForm");
|
|
17807
17893
|
const cardProcessor = getSiteCardProcessor();
|
|
17808
17894
|
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);
|
|
17809
|
-
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);
|
|
17895
|
+
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);
|
|
17896
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17897
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17898
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17810
17899
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17811
17900
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17812
17901
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -17828,7 +17917,25 @@ function PaymentMethodView({
|
|
|
17828
17917
|
onFailure: onFailure
|
|
17829
17918
|
}, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
17830
17919
|
className: "plc-mb-2"
|
|
17831
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(
|
|
17920
|
+
}), /*#__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", {
|
|
17921
|
+
className: "plc-flex plc-items-start"
|
|
17922
|
+
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
17923
|
+
id: "pelcro-input-first-name",
|
|
17924
|
+
label: t("labels.firstName"),
|
|
17925
|
+
errorId: "pelcro-input-firstName-error",
|
|
17926
|
+
required: true
|
|
17927
|
+
}), /*#__PURE__*/React__default['default'].createElement(IncludeLastName, {
|
|
17928
|
+
wrapperClassName: "plc-ml-3",
|
|
17929
|
+
id: "pelcro-input-last-name",
|
|
17930
|
+
label: t("labels.lastName"),
|
|
17931
|
+
errorId: "pelcro-input-lastName-error",
|
|
17932
|
+
required: true
|
|
17933
|
+
})), /*#__PURE__*/React__default['default'].createElement(IncludePhone, {
|
|
17934
|
+
id: "pelcro-input-phone",
|
|
17935
|
+
errorId: "pelcro-input-phone-error",
|
|
17936
|
+
label: t("labels.phone"),
|
|
17937
|
+
required: true
|
|
17938
|
+
})), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17832
17939
|
className: "plc-mb-2"
|
|
17833
17940
|
}, /*#__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", {
|
|
17834
17941
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19582,30 +19689,16 @@ const UserUpdateButton = ({
|
|
|
19582
19689
|
onClick,
|
|
19583
19690
|
...otherProps
|
|
19584
19691
|
}) => {
|
|
19585
|
-
var _window$Pelcro$site$r;
|
|
19586
|
-
|
|
19587
19692
|
const {
|
|
19588
19693
|
state: {
|
|
19589
19694
|
buttonDisabled,
|
|
19590
|
-
|
|
19591
|
-
firstName,
|
|
19592
|
-
lastName,
|
|
19593
|
-
phone,
|
|
19594
|
-
emailError,
|
|
19595
|
-
firstNameError,
|
|
19596
|
-
lastNameError,
|
|
19597
|
-
phoneError
|
|
19695
|
+
emailError
|
|
19598
19696
|
},
|
|
19599
19697
|
dispatch
|
|
19600
19698
|
} = React.useContext(store$f);
|
|
19601
|
-
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);
|
|
19602
19699
|
const {
|
|
19603
19700
|
t
|
|
19604
19701
|
} = useTranslation("userEdit");
|
|
19605
|
-
const [isDisabled, setDisabled] = React.useState(true);
|
|
19606
|
-
React.useEffect(() => {
|
|
19607
|
-
setDisabled(buttonDisabled || emailError || firstNameError || lastNameError || phoneError || !(email !== null && email !== void 0 && email.length) || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
19608
|
-
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19609
19702
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
19610
19703
|
onClick: () => {
|
|
19611
19704
|
dispatch({
|
|
@@ -19613,7 +19706,7 @@ const UserUpdateButton = ({
|
|
|
19613
19706
|
});
|
|
19614
19707
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
19615
19708
|
},
|
|
19616
|
-
disabled:
|
|
19709
|
+
disabled: buttonDisabled || emailError,
|
|
19617
19710
|
isLoading: buttonDisabled && !emailError
|
|
19618
19711
|
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
19619
19712
|
};
|
|
@@ -19658,12 +19751,9 @@ const UserUpdateProfilePic = ({
|
|
|
19658
19751
|
};
|
|
19659
19752
|
|
|
19660
19753
|
const UserUpdateView = props => {
|
|
19661
|
-
var _window$Pelcro$site$r;
|
|
19662
|
-
|
|
19663
19754
|
const {
|
|
19664
19755
|
t
|
|
19665
19756
|
} = useTranslation("userEdit");
|
|
19666
|
-
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);
|
|
19667
19757
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19668
19758
|
id: "pelcro-user-update-view"
|
|
19669
19759
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -19682,22 +19772,19 @@ const UserUpdateView = props => {
|
|
|
19682
19772
|
id: "pelcro-input-first-name",
|
|
19683
19773
|
errorId: "pelcro-input-first-name-error",
|
|
19684
19774
|
label: t("labels.firstName"),
|
|
19685
|
-
autoFocus: true
|
|
19686
|
-
required: supportsTap ? true : false
|
|
19775
|
+
autoFocus: true
|
|
19687
19776
|
}), /*#__PURE__*/React__default['default'].createElement(UserUpdateLastName, {
|
|
19688
19777
|
wrapperClassName: "plc-ml-3",
|
|
19689
19778
|
autoComplete: "last-name",
|
|
19690
19779
|
id: "pelcro-input-last-name",
|
|
19691
19780
|
errorId: "pelcro-input-last-name-error",
|
|
19692
|
-
label: t("labels.lastName")
|
|
19693
|
-
required: supportsTap ? true : false
|
|
19781
|
+
label: t("labels.lastName")
|
|
19694
19782
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19695
19783
|
className: "plc-flex plc-items-start"
|
|
19696
19784
|
}, /*#__PURE__*/React__default['default'].createElement(UserUpdatePhone, {
|
|
19697
19785
|
id: "pelcro-input-phone",
|
|
19698
19786
|
errorId: "pelcro-input-phone-error",
|
|
19699
|
-
label: t("labels.phone")
|
|
19700
|
-
required: supportsTap ? true : false
|
|
19787
|
+
label: t("labels.phone")
|
|
19701
19788
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
19702
19789
|
role: "submit",
|
|
19703
19790
|
className: "plc-w-full plc-mt-2",
|
|
@@ -23002,10 +23089,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default['default'].createEl
|
|
|
23002
23089
|
}, props));
|
|
23003
23090
|
|
|
23004
23091
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
23092
|
+
initWithUserFirstName: false,
|
|
23005
23093
|
store: store$7
|
|
23006
23094
|
}, props));
|
|
23007
23095
|
|
|
23008
23096
|
const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
23097
|
+
initWithUserLastName: false,
|
|
23009
23098
|
store: store$7
|
|
23010
23099
|
}, props));
|
|
23011
23100
|
|
package/dist/index.esm.js
CHANGED
|
@@ -3794,7 +3794,10 @@ var labels$F = {
|
|
|
3794
3794
|
interval: "{{count}} {{interval}}",
|
|
3795
3795
|
interval_plural: "{{count}} {{interval}}s",
|
|
3796
3796
|
tax: "+ Tax",
|
|
3797
|
-
removeCoupon: "REMOVE"
|
|
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,
|
|
@@ -3821,7 +3824,10 @@ var labels$E = {
|
|
|
3821
3824
|
interval: "{{count}} {{interval}}",
|
|
3822
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3823
3826
|
tax: "+ Taxe",
|
|
3824
|
-
removeCoupon: "RETIRER"
|
|
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,
|
|
@@ -3848,7 +3854,10 @@ var labels$D = {
|
|
|
3848
3854
|
interval: "{{count}} {{interval}}",
|
|
3849
3855
|
interval_plural: "{{count}} {{interval}}",
|
|
3850
3856
|
tax: "+ 세금",
|
|
3851
|
-
removeCoupon: "제거"
|
|
3857
|
+
removeCoupon: "제거",
|
|
3858
|
+
firstName: "이름",
|
|
3859
|
+
lastName: "성",
|
|
3860
|
+
phone: "핸드폰"
|
|
3852
3861
|
};
|
|
3853
3862
|
var checkoutForm_ko = {
|
|
3854
3863
|
messages: messages$G,
|
|
@@ -12247,32 +12256,25 @@ const RegisterButton = ({
|
|
|
12247
12256
|
className,
|
|
12248
12257
|
...otherProps
|
|
12249
12258
|
}) => {
|
|
12250
|
-
var _window$Pelcro$site$r
|
|
12259
|
+
var _window$Pelcro$site$r;
|
|
12251
12260
|
|
|
12252
12261
|
const {
|
|
12253
12262
|
state: {
|
|
12254
12263
|
emailError,
|
|
12255
12264
|
passwordError,
|
|
12256
|
-
firstNameError,
|
|
12257
|
-
lastNameError,
|
|
12258
|
-
phoneError,
|
|
12259
12265
|
email,
|
|
12260
12266
|
password,
|
|
12261
|
-
firstName,
|
|
12262
|
-
lastName,
|
|
12263
|
-
phone,
|
|
12264
12267
|
buttonDisabled
|
|
12265
12268
|
},
|
|
12266
12269
|
dispatch
|
|
12267
12270
|
} = 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
12271
|
const {
|
|
12270
12272
|
t
|
|
12271
12273
|
} = useTranslation("register");
|
|
12272
12274
|
const [isDisabled, setDisabled] = useState(true);
|
|
12273
12275
|
useEffect(() => {
|
|
12274
|
-
setDisabled(buttonDisabled || emailError || passwordError ||
|
|
12275
|
-
}, [buttonDisabled, emailError, passwordError,
|
|
12276
|
+
setDisabled(buttonDisabled || emailError || passwordError || !email.length || !password.length);
|
|
12277
|
+
}, [buttonDisabled, emailError, passwordError, email, password]);
|
|
12276
12278
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
12277
12279
|
onClick: () => {
|
|
12278
12280
|
dispatch({
|
|
@@ -12284,7 +12286,7 @@ const RegisterButton = ({
|
|
|
12284
12286
|
isLoading: buttonDisabled,
|
|
12285
12287
|
className: `${className} g-recaptcha`,
|
|
12286
12288
|
"data-action": "register",
|
|
12287
|
-
"data-sitekey": (_window$Pelcro$site$
|
|
12289
|
+
"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
12290
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12289
12291
|
};
|
|
12290
12292
|
|
|
@@ -12313,11 +12315,18 @@ function FirstName({
|
|
|
12313
12315
|
type: SET_FIRST_NAME,
|
|
12314
12316
|
payload: firstName
|
|
12315
12317
|
});
|
|
12316
|
-
} else
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12318
|
+
} else {
|
|
12319
|
+
if (finishedTyping && 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
|
+
}
|
|
12321
12330
|
}
|
|
12322
12331
|
}, [dispatch, firstName, finishedTyping]);
|
|
12323
12332
|
useEffect(() => {
|
|
@@ -12378,11 +12387,18 @@ function LastName({
|
|
|
12378
12387
|
type: SET_LAST_NAME,
|
|
12379
12388
|
payload: lastName
|
|
12380
12389
|
});
|
|
12381
|
-
} else
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12390
|
+
} else {
|
|
12391
|
+
if (finishedTyping && otherProps.required) {
|
|
12392
|
+
dispatch({
|
|
12393
|
+
type: SET_LAST_NAME_ERROR,
|
|
12394
|
+
payload: t("validation.enterLastName")
|
|
12395
|
+
});
|
|
12396
|
+
} else {
|
|
12397
|
+
dispatch({
|
|
12398
|
+
type: SET_LAST_NAME,
|
|
12399
|
+
payload: lastName
|
|
12400
|
+
});
|
|
12401
|
+
}
|
|
12386
12402
|
}
|
|
12387
12403
|
}, [dispatch, lastName, finishedTyping]);
|
|
12388
12404
|
useEffect(() => {
|
|
@@ -12443,11 +12459,18 @@ function Phone({
|
|
|
12443
12459
|
type: SET_PHONE,
|
|
12444
12460
|
payload: phone
|
|
12445
12461
|
});
|
|
12446
|
-
} else
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12462
|
+
} else {
|
|
12463
|
+
if (finishedTyping && otherProps.required) {
|
|
12464
|
+
dispatch({
|
|
12465
|
+
type: SET_PHONE_ERROR,
|
|
12466
|
+
payload: t("validation.enterPhone")
|
|
12467
|
+
});
|
|
12468
|
+
} else {
|
|
12469
|
+
dispatch({
|
|
12470
|
+
type: SET_PHONE,
|
|
12471
|
+
payload: phone
|
|
12472
|
+
});
|
|
12473
|
+
}
|
|
12451
12474
|
}
|
|
12452
12475
|
}, [dispatch, phone, finishedTyping]);
|
|
12453
12476
|
useEffect(() => {
|
|
@@ -12479,16 +12502,12 @@ function Phone({
|
|
|
12479
12502
|
}, otherProps));
|
|
12480
12503
|
}
|
|
12481
12504
|
|
|
12482
|
-
const RegisterPhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
12483
|
-
store: store$k
|
|
12484
|
-
}, props));
|
|
12485
|
-
|
|
12486
12505
|
/**
|
|
12487
12506
|
*
|
|
12488
12507
|
*/
|
|
12489
12508
|
|
|
12490
12509
|
function RegisterView(props) {
|
|
12491
|
-
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
|
|
12510
|
+
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;
|
|
12492
12511
|
|
|
12493
12512
|
const {
|
|
12494
12513
|
t
|
|
@@ -12500,7 +12519,6 @@ function RegisterView(props) {
|
|
|
12500
12519
|
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");
|
|
12501
12520
|
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);
|
|
12502
12521
|
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;
|
|
12503
|
-
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);
|
|
12504
12522
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
12505
12523
|
id: "pelcro-register-view"
|
|
12506
12524
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -12510,25 +12528,18 @@ function RegisterView(props) {
|
|
|
12510
12528
|
}, title), /*#__PURE__*/React__default.createElement("p", null, subtitle)), /*#__PURE__*/React__default.createElement("form", {
|
|
12511
12529
|
action: "javascript:void(0);",
|
|
12512
12530
|
className: "plc-mt-2 pelcro-form"
|
|
12513
|
-
}, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null),
|
|
12531
|
+
}, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), showNameFields && /*#__PURE__*/React__default.createElement("div", {
|
|
12514
12532
|
className: "plc-flex plc-items-start"
|
|
12515
12533
|
}, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
|
|
12516
12534
|
id: "pelcro-input-first-name",
|
|
12517
12535
|
label: t("labels.firstName"),
|
|
12518
|
-
errorId: "pelcro-input-firstName-error"
|
|
12519
|
-
required: supportsTap ? true : false
|
|
12536
|
+
errorId: "pelcro-input-firstName-error"
|
|
12520
12537
|
}), /*#__PURE__*/React__default.createElement(RegisterLastName, {
|
|
12521
12538
|
wrapperClassName: "plc-ml-3",
|
|
12522
12539
|
id: "pelcro-input-last-name",
|
|
12523
12540
|
label: t("labels.lastName"),
|
|
12524
|
-
errorId: "pelcro-input-lastName-error"
|
|
12525
|
-
|
|
12526
|
-
})), supportsTap && /*#__PURE__*/React__default.createElement(RegisterPhone, {
|
|
12527
|
-
id: "pelcro-input-phone",
|
|
12528
|
-
errorId: "pelcro-input-phone-error",
|
|
12529
|
-
label: t("labels.phone"),
|
|
12530
|
-
required: supportsTap ? true : false
|
|
12531
|
-
}), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
12541
|
+
errorId: "pelcro-input-lastName-error"
|
|
12542
|
+
})), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
12532
12543
|
id: "pelcro-input-email",
|
|
12533
12544
|
errorId: "pelcro-input-email-error",
|
|
12534
12545
|
label: t("labels.email"),
|
|
@@ -12574,9 +12585,9 @@ function RegisterView(props) {
|
|
|
12574
12585
|
*/
|
|
12575
12586
|
|
|
12576
12587
|
function hasSecurityTokenEnabled() {
|
|
12577
|
-
var _window$Pelcro$site, _window$Pelcro$site$
|
|
12588
|
+
var _window$Pelcro$site, _window$Pelcro$site$r4;
|
|
12578
12589
|
|
|
12579
|
-
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$
|
|
12590
|
+
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);
|
|
12580
12591
|
}
|
|
12581
12592
|
|
|
12582
12593
|
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -15295,6 +15306,12 @@ const initialState$j = {
|
|
|
15295
15306
|
updatedPrice: null,
|
|
15296
15307
|
taxAmount: null,
|
|
15297
15308
|
currentPlan: null,
|
|
15309
|
+
firstName: "",
|
|
15310
|
+
lastName: "",
|
|
15311
|
+
phone: "",
|
|
15312
|
+
firstNameError: null,
|
|
15313
|
+
lastNameError: null,
|
|
15314
|
+
phoneError: null,
|
|
15298
15315
|
alert: {
|
|
15299
15316
|
type: "error",
|
|
15300
15317
|
content: ""
|
|
@@ -15413,6 +15430,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15413
15430
|
} else {
|
|
15414
15431
|
window.Pelcro.payment.authorize({
|
|
15415
15432
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
15433
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
15434
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
15435
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
15416
15436
|
site_id: window.Pelcro.siteid,
|
|
15417
15437
|
amount: totalAmount,
|
|
15418
15438
|
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,
|
|
@@ -16938,6 +16958,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16938
16958
|
percentOff: action.payload
|
|
16939
16959
|
});
|
|
16940
16960
|
|
|
16961
|
+
case SET_FIRST_NAME:
|
|
16962
|
+
return lib_7({ ...state,
|
|
16963
|
+
firstName: action.payload,
|
|
16964
|
+
firstNameError: null
|
|
16965
|
+
});
|
|
16966
|
+
|
|
16967
|
+
case SET_LAST_NAME:
|
|
16968
|
+
return lib_7({ ...state,
|
|
16969
|
+
lastName: action.payload,
|
|
16970
|
+
lastNameError: null
|
|
16971
|
+
});
|
|
16972
|
+
|
|
16973
|
+
case SET_PHONE:
|
|
16974
|
+
return lib_7({ ...state,
|
|
16975
|
+
phone: action.payload,
|
|
16976
|
+
phoneError: null
|
|
16977
|
+
});
|
|
16978
|
+
|
|
16979
|
+
case SET_FIRST_NAME_ERROR:
|
|
16980
|
+
return lib_7({ ...state,
|
|
16981
|
+
firstNameError: action.payload,
|
|
16982
|
+
firstName: ""
|
|
16983
|
+
});
|
|
16984
|
+
|
|
16985
|
+
case SET_LAST_NAME_ERROR:
|
|
16986
|
+
return lib_7({ ...state,
|
|
16987
|
+
lastNameError: action.payload,
|
|
16988
|
+
lastName: ""
|
|
16989
|
+
});
|
|
16990
|
+
|
|
16991
|
+
case SET_PHONE_ERROR:
|
|
16992
|
+
return lib_7({ ...state,
|
|
16993
|
+
phoneError: action.payload,
|
|
16994
|
+
phone: null
|
|
16995
|
+
});
|
|
16996
|
+
|
|
16941
16997
|
case SHOW_ALERT:
|
|
16942
16998
|
return lib_7({ ...state,
|
|
16943
16999
|
alert: action.payload
|
|
@@ -17152,7 +17208,7 @@ const SubmitPaymentMethod = ({
|
|
|
17152
17208
|
onClick,
|
|
17153
17209
|
...otherProps
|
|
17154
17210
|
}) => {
|
|
17155
|
-
var _plan$quantity;
|
|
17211
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
17156
17212
|
|
|
17157
17213
|
const {
|
|
17158
17214
|
plan
|
|
@@ -17163,6 +17219,12 @@ const SubmitPaymentMethod = ({
|
|
|
17163
17219
|
const {
|
|
17164
17220
|
dispatch,
|
|
17165
17221
|
state: {
|
|
17222
|
+
firstNameError,
|
|
17223
|
+
lastNameError,
|
|
17224
|
+
phoneError,
|
|
17225
|
+
firstName,
|
|
17226
|
+
lastName,
|
|
17227
|
+
phone,
|
|
17166
17228
|
disableSubmit,
|
|
17167
17229
|
isLoading,
|
|
17168
17230
|
updatedPrice
|
|
@@ -17171,6 +17233,18 @@ const SubmitPaymentMethod = ({
|
|
|
17171
17233
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17172
17234
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
17173
17235
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17236
|
+
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);
|
|
17237
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17238
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17239
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17240
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
17241
|
+
useEffect(() => {
|
|
17242
|
+
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
17243
|
+
setDisabled(disableSubmit);
|
|
17244
|
+
} else {
|
|
17245
|
+
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));
|
|
17246
|
+
}
|
|
17247
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
17174
17248
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
17175
17249
|
role: "submit",
|
|
17176
17250
|
className: "plc-w-full plc-py-3",
|
|
@@ -17182,7 +17256,7 @@ const SubmitPaymentMethod = ({
|
|
|
17182
17256
|
});
|
|
17183
17257
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17184
17258
|
},
|
|
17185
|
-
disabled:
|
|
17259
|
+
disabled: isDisabled
|
|
17186
17260
|
}, otherProps), plan ? /*#__PURE__*/React__default.createElement("span", {
|
|
17187
17261
|
className: "plc-capitalize "
|
|
17188
17262
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17757,6 +17831,18 @@ const TaxAmount = () => {
|
|
|
17757
17831
|
return null;
|
|
17758
17832
|
};
|
|
17759
17833
|
|
|
17834
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
17835
|
+
store: store$j
|
|
17836
|
+
}, props));
|
|
17837
|
+
|
|
17838
|
+
const IncludeLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
17839
|
+
store: store$j
|
|
17840
|
+
}, props));
|
|
17841
|
+
|
|
17842
|
+
const IncludePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
17843
|
+
store: store$j
|
|
17844
|
+
}, props));
|
|
17845
|
+
|
|
17760
17846
|
/**
|
|
17761
17847
|
*
|
|
17762
17848
|
*/
|
|
@@ -17776,7 +17862,10 @@ function PaymentMethodView({
|
|
|
17776
17862
|
} = useTranslation("checkoutForm");
|
|
17777
17863
|
const cardProcessor = getSiteCardProcessor();
|
|
17778
17864
|
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);
|
|
17779
|
-
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);
|
|
17865
|
+
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);
|
|
17866
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17867
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17868
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17780
17869
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17781
17870
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17782
17871
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -17798,7 +17887,25 @@ function PaymentMethodView({
|
|
|
17798
17887
|
onFailure: onFailure
|
|
17799
17888
|
}, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
17800
17889
|
className: "plc-mb-2"
|
|
17801
|
-
}), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default.createElement(
|
|
17890
|
+
}), /*#__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", {
|
|
17891
|
+
className: "plc-flex plc-items-start"
|
|
17892
|
+
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
17893
|
+
id: "pelcro-input-first-name",
|
|
17894
|
+
label: t("labels.firstName"),
|
|
17895
|
+
errorId: "pelcro-input-firstName-error",
|
|
17896
|
+
required: true
|
|
17897
|
+
}), /*#__PURE__*/React__default.createElement(IncludeLastName, {
|
|
17898
|
+
wrapperClassName: "plc-ml-3",
|
|
17899
|
+
id: "pelcro-input-last-name",
|
|
17900
|
+
label: t("labels.lastName"),
|
|
17901
|
+
errorId: "pelcro-input-lastName-error",
|
|
17902
|
+
required: true
|
|
17903
|
+
})), /*#__PURE__*/React__default.createElement(IncludePhone, {
|
|
17904
|
+
id: "pelcro-input-phone",
|
|
17905
|
+
errorId: "pelcro-input-phone-error",
|
|
17906
|
+
label: t("labels.phone"),
|
|
17907
|
+
required: true
|
|
17908
|
+
})), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
17802
17909
|
className: "plc-mb-2"
|
|
17803
17910
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
17804
17911
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19552,30 +19659,16 @@ const UserUpdateButton = ({
|
|
|
19552
19659
|
onClick,
|
|
19553
19660
|
...otherProps
|
|
19554
19661
|
}) => {
|
|
19555
|
-
var _window$Pelcro$site$r;
|
|
19556
|
-
|
|
19557
19662
|
const {
|
|
19558
19663
|
state: {
|
|
19559
19664
|
buttonDisabled,
|
|
19560
|
-
|
|
19561
|
-
firstName,
|
|
19562
|
-
lastName,
|
|
19563
|
-
phone,
|
|
19564
|
-
emailError,
|
|
19565
|
-
firstNameError,
|
|
19566
|
-
lastNameError,
|
|
19567
|
-
phoneError
|
|
19665
|
+
emailError
|
|
19568
19666
|
},
|
|
19569
19667
|
dispatch
|
|
19570
19668
|
} = useContext(store$f);
|
|
19571
|
-
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);
|
|
19572
19669
|
const {
|
|
19573
19670
|
t
|
|
19574
19671
|
} = useTranslation("userEdit");
|
|
19575
|
-
const [isDisabled, setDisabled] = useState(true);
|
|
19576
|
-
useEffect(() => {
|
|
19577
|
-
setDisabled(buttonDisabled || emailError || firstNameError || lastNameError || phoneError || !(email !== null && email !== void 0 && email.length) || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
19578
|
-
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19579
19672
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
19580
19673
|
onClick: () => {
|
|
19581
19674
|
dispatch({
|
|
@@ -19583,7 +19676,7 @@ const UserUpdateButton = ({
|
|
|
19583
19676
|
});
|
|
19584
19677
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
19585
19678
|
},
|
|
19586
|
-
disabled:
|
|
19679
|
+
disabled: buttonDisabled || emailError,
|
|
19587
19680
|
isLoading: buttonDisabled && !emailError
|
|
19588
19681
|
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
19589
19682
|
};
|
|
@@ -19628,12 +19721,9 @@ const UserUpdateProfilePic = ({
|
|
|
19628
19721
|
};
|
|
19629
19722
|
|
|
19630
19723
|
const UserUpdateView = props => {
|
|
19631
|
-
var _window$Pelcro$site$r;
|
|
19632
|
-
|
|
19633
19724
|
const {
|
|
19634
19725
|
t
|
|
19635
19726
|
} = useTranslation("userEdit");
|
|
19636
|
-
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);
|
|
19637
19727
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
19638
19728
|
id: "pelcro-user-update-view"
|
|
19639
19729
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -19652,22 +19742,19 @@ const UserUpdateView = props => {
|
|
|
19652
19742
|
id: "pelcro-input-first-name",
|
|
19653
19743
|
errorId: "pelcro-input-first-name-error",
|
|
19654
19744
|
label: t("labels.firstName"),
|
|
19655
|
-
autoFocus: true
|
|
19656
|
-
required: supportsTap ? true : false
|
|
19745
|
+
autoFocus: true
|
|
19657
19746
|
}), /*#__PURE__*/React__default.createElement(UserUpdateLastName, {
|
|
19658
19747
|
wrapperClassName: "plc-ml-3",
|
|
19659
19748
|
autoComplete: "last-name",
|
|
19660
19749
|
id: "pelcro-input-last-name",
|
|
19661
19750
|
errorId: "pelcro-input-last-name-error",
|
|
19662
|
-
label: t("labels.lastName")
|
|
19663
|
-
required: supportsTap ? true : false
|
|
19751
|
+
label: t("labels.lastName")
|
|
19664
19752
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
19665
19753
|
className: "plc-flex plc-items-start"
|
|
19666
19754
|
}, /*#__PURE__*/React__default.createElement(UserUpdatePhone, {
|
|
19667
19755
|
id: "pelcro-input-phone",
|
|
19668
19756
|
errorId: "pelcro-input-phone-error",
|
|
19669
|
-
label: t("labels.phone")
|
|
19670
|
-
required: supportsTap ? true : false
|
|
19757
|
+
label: t("labels.phone")
|
|
19671
19758
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
19672
19759
|
role: "submit",
|
|
19673
19760
|
className: "plc-w-full plc-mt-2",
|
|
@@ -22972,10 +23059,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email
|
|
|
22972
23059
|
}, props));
|
|
22973
23060
|
|
|
22974
23061
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
23062
|
+
initWithUserFirstName: false,
|
|
22975
23063
|
store: store$7
|
|
22976
23064
|
}, props));
|
|
22977
23065
|
|
|
22978
23066
|
const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
23067
|
+
initWithUserLastName: false,
|
|
22979
23068
|
store: store$7
|
|
22980
23069
|
}, props));
|
|
22981
23070
|
|