@pelcro/react-pelcro-js 3.8.1 → 3.9.0-beta.10
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 +508 -161
- package/dist/index.esm.js +506 -162
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3215,7 +3215,10 @@ var validation$2 = {
|
|
|
3215
3215
|
validEmail: "le courriel n’est pas valide",
|
|
3216
3216
|
enterEmail: "Un courriel est requis.",
|
|
3217
3217
|
enterPassword: "Mot de passe requis.",
|
|
3218
|
-
confirmPassword: "Confirmer le mot de passe requis."
|
|
3218
|
+
confirmPassword: "Confirmer le mot de passe requis.",
|
|
3219
|
+
enterFirstName: "Le prénom est requis.",
|
|
3220
|
+
enterLastName: "Le nom de famille est requis.",
|
|
3221
|
+
enterPhone: "Le numéro de téléphone est requis."
|
|
3219
3222
|
};
|
|
3220
3223
|
var buttons$e = {
|
|
3221
3224
|
account: "Accès abonné(e)s",
|
|
@@ -3304,7 +3307,10 @@ var validation$1 = {
|
|
|
3304
3307
|
validEmail: "Email address is not valid.",
|
|
3305
3308
|
enterEmail: "Email address is required.",
|
|
3306
3309
|
enterPassword: "Password is required.",
|
|
3307
|
-
confirmPassword: "Confirm password is required."
|
|
3310
|
+
confirmPassword: "Confirm password is required.",
|
|
3311
|
+
enterFirstName: "First name is required.",
|
|
3312
|
+
enterLastName: "Last name is required.",
|
|
3313
|
+
enterPhone: "Phone number is required."
|
|
3308
3314
|
};
|
|
3309
3315
|
var buttons$d = {
|
|
3310
3316
|
account: "My account",
|
|
@@ -3392,7 +3398,10 @@ var common_en = {
|
|
|
3392
3398
|
var validation = {
|
|
3393
3399
|
validEmail: "이메일 주소가 유효하지 않습니다.",
|
|
3394
3400
|
enterEmail: "이메일 주소는 필수 항목입니다.",
|
|
3395
|
-
enterPassword: "비밀번호는 필수 항목입니다."
|
|
3401
|
+
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
3402
|
+
enterFirstName: "이름은 필수 항목입니다.",
|
|
3403
|
+
enterLastName: "성은 필수 항목입니다.",
|
|
3404
|
+
enterPhone: "전화번호는 필수 항목입니다."
|
|
3396
3405
|
};
|
|
3397
3406
|
var buttons$c = {
|
|
3398
3407
|
account: "내 계정",
|
|
@@ -3785,7 +3794,10 @@ var labels$F = {
|
|
|
3785
3794
|
interval: "{{count}} {{interval}}",
|
|
3786
3795
|
interval_plural: "{{count}} {{interval}}s",
|
|
3787
3796
|
tax: "+ Tax",
|
|
3788
|
-
removeCoupon: "REMOVE"
|
|
3797
|
+
removeCoupon: "REMOVE",
|
|
3798
|
+
firstName: "First name",
|
|
3799
|
+
lastName: "Last name",
|
|
3800
|
+
phone: "Phone"
|
|
3789
3801
|
};
|
|
3790
3802
|
var checkoutForm_en = {
|
|
3791
3803
|
messages: messages$I,
|
|
@@ -3812,7 +3824,10 @@ var labels$E = {
|
|
|
3812
3824
|
interval: "{{count}} {{interval}}",
|
|
3813
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3814
3826
|
tax: "+ Taxe",
|
|
3815
|
-
removeCoupon: "RETIRER"
|
|
3827
|
+
removeCoupon: "RETIRER",
|
|
3828
|
+
firstName: "Prénom",
|
|
3829
|
+
lastName: "Nom de famille",
|
|
3830
|
+
phone: "Téléphoner"
|
|
3816
3831
|
};
|
|
3817
3832
|
var checkoutForm_fr = {
|
|
3818
3833
|
messages: messages$H,
|
|
@@ -3839,7 +3854,10 @@ var labels$D = {
|
|
|
3839
3854
|
interval: "{{count}} {{interval}}",
|
|
3840
3855
|
interval_plural: "{{count}} {{interval}}",
|
|
3841
3856
|
tax: "+ 세금",
|
|
3842
|
-
removeCoupon: "제거"
|
|
3857
|
+
removeCoupon: "제거",
|
|
3858
|
+
firstName: "이름",
|
|
3859
|
+
lastName: "성",
|
|
3860
|
+
phone: "핸드폰"
|
|
3843
3861
|
};
|
|
3844
3862
|
var checkoutForm_ko = {
|
|
3845
3863
|
messages: messages$G,
|
|
@@ -4053,7 +4071,8 @@ var labels$w = {
|
|
|
4053
4071
|
emailPlaceholder: "Enter email",
|
|
4054
4072
|
required: "required",
|
|
4055
4073
|
firstName: "First name",
|
|
4056
|
-
lastName: "Last name"
|
|
4074
|
+
lastName: "Last name",
|
|
4075
|
+
phone: "Phone"
|
|
4057
4076
|
};
|
|
4058
4077
|
var messages$z = {
|
|
4059
4078
|
alreadyHaveAccount: "Already have an account?",
|
|
@@ -4148,7 +4167,8 @@ var labels$v = {
|
|
|
4148
4167
|
emailPlaceholder: "Courriel",
|
|
4149
4168
|
required: "Champs obligatoires",
|
|
4150
4169
|
firstName: "Prénom",
|
|
4151
|
-
lastName: "Nom de famille"
|
|
4170
|
+
lastName: "Nom de famille",
|
|
4171
|
+
phone: "Téléphoner"
|
|
4152
4172
|
};
|
|
4153
4173
|
var messages$y = {
|
|
4154
4174
|
alreadyHaveAccount: "Vous avez déjà un compte?",
|
|
@@ -4244,7 +4264,8 @@ var labels$u = {
|
|
|
4244
4264
|
emailPlaceholder: "이메일 입력",
|
|
4245
4265
|
required: "필수 항목",
|
|
4246
4266
|
firstName: "이름",
|
|
4247
|
-
lastName: "성"
|
|
4267
|
+
lastName: "성",
|
|
4268
|
+
phone: "핸드폰"
|
|
4248
4269
|
};
|
|
4249
4270
|
var messages$x = {
|
|
4250
4271
|
alreadyHaveAccount: "이미 계정이 있습니까?",
|
|
@@ -7205,8 +7226,7 @@ class PelcroActions {
|
|
|
7205
7226
|
return this.set({
|
|
7206
7227
|
view: "login"
|
|
7207
7228
|
});
|
|
7208
|
-
}
|
|
7209
|
-
|
|
7229
|
+
}
|
|
7210
7230
|
|
|
7211
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))) {
|
|
7212
7232
|
return this.set({
|
|
@@ -10778,6 +10798,9 @@ const SET_EMAIL = "SET_EMAIL";
|
|
|
10778
10798
|
const SET_PASSWORD = "SET_PASSWORD";
|
|
10779
10799
|
const SET_EMAIL_ERROR = "SET_EMAIL_ERROR";
|
|
10780
10800
|
const SET_PASSWORD_ERROR = "SET_PASSWORD_ERROR";
|
|
10801
|
+
const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
10802
|
+
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
10803
|
+
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
10781
10804
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
10782
10805
|
const SET_TOKEN = "SET_TOKEN";
|
|
10783
10806
|
const SET_GIFT_CODE = "SET_GIFT_CODE";
|
|
@@ -11410,14 +11433,18 @@ facebookLoginRenderProps.FacebookLogin;
|
|
|
11410
11433
|
const initialState$k = {
|
|
11411
11434
|
email: "",
|
|
11412
11435
|
password: "",
|
|
11436
|
+
firstName: "",
|
|
11437
|
+
lastName: "",
|
|
11438
|
+
phone: "",
|
|
11413
11439
|
emailError: null,
|
|
11414
11440
|
passwordError: null,
|
|
11415
11441
|
confirmPassword: "",
|
|
11416
11442
|
confirmPasswordError: null,
|
|
11417
11443
|
confirmPasswordUsed: false,
|
|
11418
11444
|
buttonDisabled: false,
|
|
11419
|
-
|
|
11420
|
-
|
|
11445
|
+
firstNameError: null,
|
|
11446
|
+
lastNameError: null,
|
|
11447
|
+
phoneError: null,
|
|
11421
11448
|
selectFields: {},
|
|
11422
11449
|
alert: {
|
|
11423
11450
|
type: "error",
|
|
@@ -11448,6 +11475,7 @@ const RegisterContainer = ({
|
|
|
11448
11475
|
password,
|
|
11449
11476
|
firstName,
|
|
11450
11477
|
lastName,
|
|
11478
|
+
phone,
|
|
11451
11479
|
organization,
|
|
11452
11480
|
jobTitle,
|
|
11453
11481
|
selectFields
|
|
@@ -11473,6 +11501,7 @@ const RegisterContainer = ({
|
|
|
11473
11501
|
password,
|
|
11474
11502
|
first_name: firstName,
|
|
11475
11503
|
last_name: lastName,
|
|
11504
|
+
phone: phone,
|
|
11476
11505
|
security_token: securityToken,
|
|
11477
11506
|
metadata: {
|
|
11478
11507
|
organization,
|
|
@@ -11562,12 +11591,20 @@ const RegisterContainer = ({
|
|
|
11562
11591
|
|
|
11563
11592
|
case SET_FIRST_NAME:
|
|
11564
11593
|
return lib_7({ ...state,
|
|
11565
|
-
firstName: action.payload
|
|
11594
|
+
firstName: action.payload,
|
|
11595
|
+
firstNameError: null
|
|
11566
11596
|
});
|
|
11567
11597
|
|
|
11568
11598
|
case SET_LAST_NAME:
|
|
11569
11599
|
return lib_7({ ...state,
|
|
11570
|
-
lastName: action.payload
|
|
11600
|
+
lastName: action.payload,
|
|
11601
|
+
lastNameError: null
|
|
11602
|
+
});
|
|
11603
|
+
|
|
11604
|
+
case SET_PHONE:
|
|
11605
|
+
return lib_7({ ...state,
|
|
11606
|
+
phone: action.payload,
|
|
11607
|
+
phoneError: null
|
|
11571
11608
|
});
|
|
11572
11609
|
|
|
11573
11610
|
case SET_TEXT_FIELD:
|
|
@@ -11593,6 +11630,24 @@ const RegisterContainer = ({
|
|
|
11593
11630
|
password: ""
|
|
11594
11631
|
});
|
|
11595
11632
|
|
|
11633
|
+
case SET_FIRST_NAME_ERROR:
|
|
11634
|
+
return lib_7({ ...state,
|
|
11635
|
+
firstNameError: action.payload,
|
|
11636
|
+
firstName: ""
|
|
11637
|
+
});
|
|
11638
|
+
|
|
11639
|
+
case SET_LAST_NAME_ERROR:
|
|
11640
|
+
return lib_7({ ...state,
|
|
11641
|
+
lastNameError: action.payload,
|
|
11642
|
+
lastName: ""
|
|
11643
|
+
});
|
|
11644
|
+
|
|
11645
|
+
case SET_PHONE_ERROR:
|
|
11646
|
+
return lib_7({ ...state,
|
|
11647
|
+
phoneError: action.payload,
|
|
11648
|
+
phone: null
|
|
11649
|
+
});
|
|
11650
|
+
|
|
11596
11651
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
11597
11652
|
return lib_7({ ...state,
|
|
11598
11653
|
confirmPasswordError: action.payload,
|
|
@@ -12234,117 +12289,77 @@ const RegisterButton = ({
|
|
|
12234
12289
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12235
12290
|
};
|
|
12236
12291
|
|
|
12237
|
-
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
12238
|
-
className: `pelcro-loader-wrapper ${props.className}`
|
|
12239
|
-
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
12240
|
-
width: props.width,
|
|
12241
|
-
height: props.height,
|
|
12242
|
-
viewBox: "0 0 120 30",
|
|
12243
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12244
|
-
fill: "currentColor",
|
|
12245
|
-
"aria-label": props.label
|
|
12246
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
12247
|
-
cx: "15",
|
|
12248
|
-
cy: "15",
|
|
12249
|
-
r: props.radius + 6
|
|
12250
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12251
|
-
attributeName: "r",
|
|
12252
|
-
from: "15",
|
|
12253
|
-
to: "15",
|
|
12254
|
-
begin: "0s",
|
|
12255
|
-
dur: "0.8s",
|
|
12256
|
-
values: "15;9;15",
|
|
12257
|
-
calcMode: "linear",
|
|
12258
|
-
repeatCount: "indefinite"
|
|
12259
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12260
|
-
attributeName: "fillOpacity",
|
|
12261
|
-
from: "1",
|
|
12262
|
-
to: "1",
|
|
12263
|
-
begin: "0s",
|
|
12264
|
-
dur: "0.8s",
|
|
12265
|
-
values: "1;.5;1",
|
|
12266
|
-
calcMode: "linear",
|
|
12267
|
-
repeatCount: "indefinite"
|
|
12268
|
-
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
12269
|
-
cx: "60",
|
|
12270
|
-
cy: "15",
|
|
12271
|
-
r: props.radius,
|
|
12272
|
-
attributeName: "fillOpacity",
|
|
12273
|
-
from: "1",
|
|
12274
|
-
to: "0.3"
|
|
12275
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12276
|
-
attributeName: "r",
|
|
12277
|
-
from: "9",
|
|
12278
|
-
to: "9",
|
|
12279
|
-
begin: "0s",
|
|
12280
|
-
dur: "0.8s",
|
|
12281
|
-
values: "9;15;9",
|
|
12282
|
-
calcMode: "linear",
|
|
12283
|
-
repeatCount: "indefinite"
|
|
12284
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12285
|
-
attributeName: "fillOpacity",
|
|
12286
|
-
from: "0.5",
|
|
12287
|
-
to: "0.5",
|
|
12288
|
-
begin: "0s",
|
|
12289
|
-
dur: "0.8s",
|
|
12290
|
-
values: ".5;1;.5",
|
|
12291
|
-
calcMode: "linear",
|
|
12292
|
-
repeatCount: "indefinite"
|
|
12293
|
-
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
12294
|
-
cx: "105",
|
|
12295
|
-
cy: "15",
|
|
12296
|
-
r: props.radius + 6
|
|
12297
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12298
|
-
attributeName: "r",
|
|
12299
|
-
from: "15",
|
|
12300
|
-
to: "15",
|
|
12301
|
-
begin: "0s",
|
|
12302
|
-
dur: "0.8s",
|
|
12303
|
-
values: "15;9;15",
|
|
12304
|
-
calcMode: "linear",
|
|
12305
|
-
repeatCount: "indefinite"
|
|
12306
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12307
|
-
attributeName: "fillOpacity",
|
|
12308
|
-
from: "1",
|
|
12309
|
-
to: "1",
|
|
12310
|
-
begin: "0s",
|
|
12311
|
-
dur: "0.8s",
|
|
12312
|
-
values: "1;.5;1",
|
|
12313
|
-
calcMode: "linear",
|
|
12314
|
-
repeatCount: "indefinite"
|
|
12315
|
-
}))));
|
|
12316
|
-
Loader.defaultProps = {
|
|
12317
|
-
height: 50,
|
|
12318
|
-
width: 35,
|
|
12319
|
-
color: "#32aea1",
|
|
12320
|
-
label: "Loading data..",
|
|
12321
|
-
radius: 9
|
|
12322
|
-
};
|
|
12323
|
-
|
|
12324
12292
|
function FirstName({
|
|
12293
|
+
initWithUserFirstName = true,
|
|
12325
12294
|
store,
|
|
12326
12295
|
...otherProps
|
|
12327
12296
|
}) {
|
|
12297
|
+
const {
|
|
12298
|
+
t
|
|
12299
|
+
} = useTranslation("common");
|
|
12328
12300
|
const {
|
|
12329
12301
|
dispatch,
|
|
12330
|
-
state
|
|
12302
|
+
state: {
|
|
12303
|
+
firstName: stateFirstName,
|
|
12304
|
+
firstNameError
|
|
12305
|
+
}
|
|
12331
12306
|
} = useContext(store);
|
|
12307
|
+
const [firstName, setFirstName] = useState(stateFirstName);
|
|
12308
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
12309
|
+
const handleInputChange = useCallback(value => {
|
|
12310
|
+
setFirstName(value);
|
|
12332
12311
|
|
|
12333
|
-
|
|
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
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
}, [dispatch, firstName, finishedTyping]);
|
|
12333
|
+
useEffect(() => {
|
|
12334
|
+
handleInputChange(firstName);
|
|
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);
|
|
12334
12339
|
dispatch({
|
|
12335
12340
|
type: SET_FIRST_NAME,
|
|
12336
|
-
payload:
|
|
12341
|
+
payload: window.Pelcro.user.read().first_name
|
|
12337
12342
|
});
|
|
12338
12343
|
};
|
|
12339
12344
|
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12345
|
+
useEffect(() => {
|
|
12346
|
+
if (initWithUserFirstName) {
|
|
12347
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12348
|
+
loadFirstNameIntoField();
|
|
12349
|
+
});
|
|
12350
|
+
loadFirstNameIntoField();
|
|
12351
|
+
return () => {
|
|
12352
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12353
|
+
};
|
|
12354
|
+
}
|
|
12355
|
+
}, []);
|
|
12344
12356
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12345
12357
|
type: "text",
|
|
12346
|
-
|
|
12347
|
-
|
|
12358
|
+
error: firstNameError,
|
|
12359
|
+
value: firstName,
|
|
12360
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12361
|
+
onBlur: () => setFinishedTyping(true),
|
|
12362
|
+
onFocus: () => setFinishedTyping(false)
|
|
12348
12363
|
}, otherProps));
|
|
12349
12364
|
}
|
|
12350
12365
|
|
|
@@ -12353,29 +12368,76 @@ const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(Fir
|
|
|
12353
12368
|
}, props));
|
|
12354
12369
|
|
|
12355
12370
|
function LastName({
|
|
12371
|
+
initWithUserLastName = true,
|
|
12356
12372
|
store,
|
|
12357
12373
|
...otherProps
|
|
12358
12374
|
}) {
|
|
12375
|
+
const {
|
|
12376
|
+
t
|
|
12377
|
+
} = useTranslation("common");
|
|
12359
12378
|
const {
|
|
12360
12379
|
dispatch,
|
|
12361
|
-
state
|
|
12380
|
+
state: {
|
|
12381
|
+
lastName: stateLastName,
|
|
12382
|
+
lastNameError
|
|
12383
|
+
}
|
|
12362
12384
|
} = useContext(store);
|
|
12385
|
+
const [lastName, setLastName] = useState(stateLastName);
|
|
12386
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
12387
|
+
const handleInputChange = useCallback(value => {
|
|
12388
|
+
setLastName(value);
|
|
12363
12389
|
|
|
12364
|
-
|
|
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
|
+
}
|
|
12409
|
+
}
|
|
12410
|
+
}, [dispatch, lastName, finishedTyping]);
|
|
12411
|
+
useEffect(() => {
|
|
12412
|
+
handleInputChange(lastName);
|
|
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);
|
|
12365
12417
|
dispatch({
|
|
12366
12418
|
type: SET_LAST_NAME,
|
|
12367
|
-
payload:
|
|
12419
|
+
payload: window.Pelcro.user.read().last_name
|
|
12368
12420
|
});
|
|
12369
12421
|
};
|
|
12370
12422
|
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
|
|
12423
|
+
useEffect(() => {
|
|
12424
|
+
if (initWithUserLastName) {
|
|
12425
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12426
|
+
loadLastNameIntoField();
|
|
12427
|
+
});
|
|
12428
|
+
loadLastNameIntoField();
|
|
12429
|
+
return () => {
|
|
12430
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12431
|
+
};
|
|
12432
|
+
}
|
|
12433
|
+
}, []);
|
|
12375
12434
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12376
12435
|
type: "text",
|
|
12377
|
-
|
|
12378
|
-
|
|
12436
|
+
error: lastNameError,
|
|
12437
|
+
value: lastName,
|
|
12438
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12439
|
+
onBlur: () => setFinishedTyping(true),
|
|
12440
|
+
onFocus: () => setFinishedTyping(false)
|
|
12379
12441
|
}, otherProps));
|
|
12380
12442
|
}
|
|
12381
12443
|
|
|
@@ -12383,6 +12445,80 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
|
|
|
12383
12445
|
store: store$k
|
|
12384
12446
|
}, props));
|
|
12385
12447
|
|
|
12448
|
+
function Phone({
|
|
12449
|
+
initWithUserPhone = true,
|
|
12450
|
+
store,
|
|
12451
|
+
...otherProps
|
|
12452
|
+
}) {
|
|
12453
|
+
const {
|
|
12454
|
+
t
|
|
12455
|
+
} = useTranslation("common");
|
|
12456
|
+
const {
|
|
12457
|
+
dispatch,
|
|
12458
|
+
state: {
|
|
12459
|
+
phone: statePhone,
|
|
12460
|
+
phoneError
|
|
12461
|
+
}
|
|
12462
|
+
} = useContext(store);
|
|
12463
|
+
const [phone, setPhone] = useState(statePhone);
|
|
12464
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
12465
|
+
const handleInputChange = useCallback(value => {
|
|
12466
|
+
setPhone(value);
|
|
12467
|
+
|
|
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
|
+
}
|
|
12487
|
+
}
|
|
12488
|
+
}, [dispatch, phone, finishedTyping]);
|
|
12489
|
+
useEffect(() => {
|
|
12490
|
+
handleInputChange(phone);
|
|
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
|
+
}, []);
|
|
12512
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
12513
|
+
type: "tel",
|
|
12514
|
+
error: phoneError,
|
|
12515
|
+
value: phone,
|
|
12516
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12517
|
+
onBlur: () => setFinishedTyping(true),
|
|
12518
|
+
onFocus: () => setFinishedTyping(false)
|
|
12519
|
+
}, otherProps));
|
|
12520
|
+
}
|
|
12521
|
+
|
|
12386
12522
|
/**
|
|
12387
12523
|
*
|
|
12388
12524
|
*/
|
|
@@ -12413,11 +12549,13 @@ function RegisterView(props) {
|
|
|
12413
12549
|
className: "plc-flex plc-items-start"
|
|
12414
12550
|
}, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
|
|
12415
12551
|
id: "pelcro-input-first-name",
|
|
12416
|
-
label: t("labels.firstName")
|
|
12552
|
+
label: t("labels.firstName"),
|
|
12553
|
+
errorId: "pelcro-input-firstName-error"
|
|
12417
12554
|
}), /*#__PURE__*/React__default.createElement(RegisterLastName, {
|
|
12418
12555
|
wrapperClassName: "plc-ml-3",
|
|
12419
12556
|
id: "pelcro-input-last-name",
|
|
12420
|
-
label: t("labels.lastName")
|
|
12557
|
+
label: t("labels.lastName"),
|
|
12558
|
+
errorId: "pelcro-input-lastName-error"
|
|
12421
12559
|
})), /*#__PURE__*/React__default.createElement(RegisterEmail, {
|
|
12422
12560
|
id: "pelcro-input-email",
|
|
12423
12561
|
errorId: "pelcro-input-email-error",
|
|
@@ -12469,6 +12607,93 @@ function hasSecurityTokenEnabled() {
|
|
|
12469
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);
|
|
12470
12608
|
}
|
|
12471
12609
|
|
|
12610
|
+
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
12611
|
+
className: `pelcro-loader-wrapper ${props.className}`
|
|
12612
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
12613
|
+
width: props.width,
|
|
12614
|
+
height: props.height,
|
|
12615
|
+
viewBox: "0 0 120 30",
|
|
12616
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12617
|
+
fill: "currentColor",
|
|
12618
|
+
"aria-label": props.label
|
|
12619
|
+
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
12620
|
+
cx: "15",
|
|
12621
|
+
cy: "15",
|
|
12622
|
+
r: props.radius + 6
|
|
12623
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12624
|
+
attributeName: "r",
|
|
12625
|
+
from: "15",
|
|
12626
|
+
to: "15",
|
|
12627
|
+
begin: "0s",
|
|
12628
|
+
dur: "0.8s",
|
|
12629
|
+
values: "15;9;15",
|
|
12630
|
+
calcMode: "linear",
|
|
12631
|
+
repeatCount: "indefinite"
|
|
12632
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12633
|
+
attributeName: "fillOpacity",
|
|
12634
|
+
from: "1",
|
|
12635
|
+
to: "1",
|
|
12636
|
+
begin: "0s",
|
|
12637
|
+
dur: "0.8s",
|
|
12638
|
+
values: "1;.5;1",
|
|
12639
|
+
calcMode: "linear",
|
|
12640
|
+
repeatCount: "indefinite"
|
|
12641
|
+
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
12642
|
+
cx: "60",
|
|
12643
|
+
cy: "15",
|
|
12644
|
+
r: props.radius,
|
|
12645
|
+
attributeName: "fillOpacity",
|
|
12646
|
+
from: "1",
|
|
12647
|
+
to: "0.3"
|
|
12648
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12649
|
+
attributeName: "r",
|
|
12650
|
+
from: "9",
|
|
12651
|
+
to: "9",
|
|
12652
|
+
begin: "0s",
|
|
12653
|
+
dur: "0.8s",
|
|
12654
|
+
values: "9;15;9",
|
|
12655
|
+
calcMode: "linear",
|
|
12656
|
+
repeatCount: "indefinite"
|
|
12657
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12658
|
+
attributeName: "fillOpacity",
|
|
12659
|
+
from: "0.5",
|
|
12660
|
+
to: "0.5",
|
|
12661
|
+
begin: "0s",
|
|
12662
|
+
dur: "0.8s",
|
|
12663
|
+
values: ".5;1;.5",
|
|
12664
|
+
calcMode: "linear",
|
|
12665
|
+
repeatCount: "indefinite"
|
|
12666
|
+
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
12667
|
+
cx: "105",
|
|
12668
|
+
cy: "15",
|
|
12669
|
+
r: props.radius + 6
|
|
12670
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
12671
|
+
attributeName: "r",
|
|
12672
|
+
from: "15",
|
|
12673
|
+
to: "15",
|
|
12674
|
+
begin: "0s",
|
|
12675
|
+
dur: "0.8s",
|
|
12676
|
+
values: "15;9;15",
|
|
12677
|
+
calcMode: "linear",
|
|
12678
|
+
repeatCount: "indefinite"
|
|
12679
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
12680
|
+
attributeName: "fillOpacity",
|
|
12681
|
+
from: "1",
|
|
12682
|
+
to: "1",
|
|
12683
|
+
begin: "0s",
|
|
12684
|
+
dur: "0.8s",
|
|
12685
|
+
values: "1;.5;1",
|
|
12686
|
+
calcMode: "linear",
|
|
12687
|
+
repeatCount: "indefinite"
|
|
12688
|
+
}))));
|
|
12689
|
+
Loader.defaultProps = {
|
|
12690
|
+
height: 50,
|
|
12691
|
+
width: 35,
|
|
12692
|
+
color: "#32aea1",
|
|
12693
|
+
label: "Loading data..",
|
|
12694
|
+
radius: 9
|
|
12695
|
+
};
|
|
12696
|
+
|
|
12472
12697
|
function TextInput({
|
|
12473
12698
|
store,
|
|
12474
12699
|
fieldName,
|
|
@@ -15098,6 +15323,12 @@ const initialState$j = {
|
|
|
15098
15323
|
updatedPrice: null,
|
|
15099
15324
|
taxAmount: null,
|
|
15100
15325
|
currentPlan: null,
|
|
15326
|
+
firstName: "",
|
|
15327
|
+
lastName: "",
|
|
15328
|
+
phone: "",
|
|
15329
|
+
firstNameError: null,
|
|
15330
|
+
lastNameError: null,
|
|
15331
|
+
phoneError: null,
|
|
15101
15332
|
alert: {
|
|
15102
15333
|
type: "error",
|
|
15103
15334
|
content: ""
|
|
@@ -15216,6 +15447,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15216
15447
|
} else {
|
|
15217
15448
|
window.Pelcro.payment.authorize({
|
|
15218
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,
|
|
15219
15453
|
site_id: window.Pelcro.siteid,
|
|
15220
15454
|
amount: totalAmount,
|
|
15221
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,
|
|
@@ -16741,6 +16975,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16741
16975
|
percentOff: action.payload
|
|
16742
16976
|
});
|
|
16743
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
|
+
|
|
16744
17014
|
case SHOW_ALERT:
|
|
16745
17015
|
return lib_7({ ...state,
|
|
16746
17016
|
alert: action.payload
|
|
@@ -16955,7 +17225,7 @@ const SubmitPaymentMethod = ({
|
|
|
16955
17225
|
onClick,
|
|
16956
17226
|
...otherProps
|
|
16957
17227
|
}) => {
|
|
16958
|
-
var _plan$quantity;
|
|
17228
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
16959
17229
|
|
|
16960
17230
|
const {
|
|
16961
17231
|
plan
|
|
@@ -16966,6 +17236,12 @@ const SubmitPaymentMethod = ({
|
|
|
16966
17236
|
const {
|
|
16967
17237
|
dispatch,
|
|
16968
17238
|
state: {
|
|
17239
|
+
firstNameError,
|
|
17240
|
+
lastNameError,
|
|
17241
|
+
phoneError,
|
|
17242
|
+
firstName,
|
|
17243
|
+
lastName,
|
|
17244
|
+
phone,
|
|
16969
17245
|
disableSubmit,
|
|
16970
17246
|
isLoading,
|
|
16971
17247
|
updatedPrice
|
|
@@ -16974,6 +17250,18 @@ const SubmitPaymentMethod = ({
|
|
|
16974
17250
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
16975
17251
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
16976
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]);
|
|
16977
17265
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
16978
17266
|
role: "submit",
|
|
16979
17267
|
className: "plc-w-full plc-py-3",
|
|
@@ -16985,7 +17273,7 @@ const SubmitPaymentMethod = ({
|
|
|
16985
17273
|
});
|
|
16986
17274
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
16987
17275
|
},
|
|
16988
|
-
disabled:
|
|
17276
|
+
disabled: isDisabled
|
|
16989
17277
|
}, otherProps), plan ? /*#__PURE__*/React__default.createElement("span", {
|
|
16990
17278
|
className: "plc-capitalize "
|
|
16991
17279
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17560,6 +17848,18 @@ const TaxAmount = () => {
|
|
|
17560
17848
|
return null;
|
|
17561
17849
|
};
|
|
17562
17850
|
|
|
17851
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
17852
|
+
store: store$j
|
|
17853
|
+
}, props));
|
|
17854
|
+
|
|
17855
|
+
const IncludeLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
17856
|
+
store: store$j
|
|
17857
|
+
}, props));
|
|
17858
|
+
|
|
17859
|
+
const IncludePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
17860
|
+
store: store$j
|
|
17861
|
+
}, props));
|
|
17862
|
+
|
|
17563
17863
|
/**
|
|
17564
17864
|
*
|
|
17565
17865
|
*/
|
|
@@ -17579,7 +17879,10 @@ function PaymentMethodView({
|
|
|
17579
17879
|
} = useTranslation("checkoutForm");
|
|
17580
17880
|
const cardProcessor = getSiteCardProcessor();
|
|
17581
17881
|
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);
|
|
17582
|
-
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);
|
|
17882
|
+
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);
|
|
17883
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17884
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17885
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17583
17886
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17584
17887
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17585
17888
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -17601,7 +17904,25 @@ function PaymentMethodView({
|
|
|
17601
17904
|
onFailure: onFailure
|
|
17602
17905
|
}, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
17603
17906
|
className: "plc-mb-2"
|
|
17604
|
-
}), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default.createElement(
|
|
17907
|
+
}), /*#__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", {
|
|
17908
|
+
className: "plc-flex plc-items-start"
|
|
17909
|
+
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
17910
|
+
id: "pelcro-input-first-name",
|
|
17911
|
+
label: t("labels.firstName"),
|
|
17912
|
+
errorId: "pelcro-input-firstName-error",
|
|
17913
|
+
required: true
|
|
17914
|
+
}), /*#__PURE__*/React__default.createElement(IncludeLastName, {
|
|
17915
|
+
wrapperClassName: "plc-ml-3",
|
|
17916
|
+
id: "pelcro-input-last-name",
|
|
17917
|
+
label: t("labels.lastName"),
|
|
17918
|
+
errorId: "pelcro-input-lastName-error",
|
|
17919
|
+
required: true
|
|
17920
|
+
})), /*#__PURE__*/React__default.createElement(IncludePhone, {
|
|
17921
|
+
id: "pelcro-input-phone",
|
|
17922
|
+
errorId: "pelcro-input-phone-error",
|
|
17923
|
+
label: t("labels.phone"),
|
|
17924
|
+
required: true
|
|
17925
|
+
})), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
17605
17926
|
className: "plc-mb-2"
|
|
17606
17927
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
17607
17928
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19084,9 +19405,12 @@ const initialState$f = {
|
|
|
19084
19405
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19085
19406
|
emailError: null,
|
|
19086
19407
|
firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
|
|
19408
|
+
firstNameError: null,
|
|
19087
19409
|
lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
|
|
19410
|
+
lastNameError: null,
|
|
19088
19411
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
19089
19412
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19413
|
+
phoneError: null,
|
|
19090
19414
|
buttonDisabled: false,
|
|
19091
19415
|
textFields: {},
|
|
19092
19416
|
alert: {
|
|
@@ -19198,17 +19522,26 @@ const UserUpdateContainer = ({
|
|
|
19198
19522
|
|
|
19199
19523
|
case SET_EMAIL:
|
|
19200
19524
|
return lib_7({ ...state,
|
|
19201
|
-
email: action.payload
|
|
19525
|
+
email: action.payload,
|
|
19526
|
+
emailError: null
|
|
19202
19527
|
});
|
|
19203
19528
|
|
|
19204
19529
|
case SET_EMAIL_ERROR:
|
|
19205
19530
|
return lib_7({ ...state,
|
|
19206
|
-
emailError: action.payload
|
|
19531
|
+
emailError: action.payload,
|
|
19532
|
+
email: ""
|
|
19207
19533
|
});
|
|
19208
19534
|
|
|
19209
19535
|
case SET_FIRST_NAME:
|
|
19210
19536
|
return lib_7({ ...state,
|
|
19211
|
-
firstName: action.payload
|
|
19537
|
+
firstName: action.payload,
|
|
19538
|
+
firstNameError: null
|
|
19539
|
+
});
|
|
19540
|
+
|
|
19541
|
+
case SET_FIRST_NAME_ERROR:
|
|
19542
|
+
return lib_7({ ...state,
|
|
19543
|
+
firstNameError: action.payload,
|
|
19544
|
+
firstName: ""
|
|
19212
19545
|
});
|
|
19213
19546
|
|
|
19214
19547
|
case SET_DISPLAY_NAME:
|
|
@@ -19218,12 +19551,26 @@ const UserUpdateContainer = ({
|
|
|
19218
19551
|
|
|
19219
19552
|
case SET_LAST_NAME:
|
|
19220
19553
|
return lib_7({ ...state,
|
|
19221
|
-
lastName: action.payload
|
|
19554
|
+
lastName: action.payload,
|
|
19555
|
+
lastNameError: null
|
|
19556
|
+
});
|
|
19557
|
+
|
|
19558
|
+
case SET_LAST_NAME_ERROR:
|
|
19559
|
+
return lib_7({ ...state,
|
|
19560
|
+
lastNameError: action.payload,
|
|
19561
|
+
lastName: ""
|
|
19222
19562
|
});
|
|
19223
19563
|
|
|
19224
19564
|
case SET_PHONE:
|
|
19225
19565
|
return lib_7({ ...state,
|
|
19226
|
-
phone: action.payload
|
|
19566
|
+
phone: action.payload,
|
|
19567
|
+
phoneError: null
|
|
19568
|
+
});
|
|
19569
|
+
|
|
19570
|
+
case SET_PHONE_ERROR:
|
|
19571
|
+
return lib_7({ ...state,
|
|
19572
|
+
phoneError: action.payload,
|
|
19573
|
+
phone: ""
|
|
19227
19574
|
});
|
|
19228
19575
|
|
|
19229
19576
|
case SHOW_ALERT:
|
|
@@ -19329,16 +19676,30 @@ const UserUpdateButton = ({
|
|
|
19329
19676
|
onClick,
|
|
19330
19677
|
...otherProps
|
|
19331
19678
|
}) => {
|
|
19679
|
+
var _window$Pelcro$site$r;
|
|
19680
|
+
|
|
19332
19681
|
const {
|
|
19333
19682
|
state: {
|
|
19334
19683
|
buttonDisabled,
|
|
19335
|
-
|
|
19684
|
+
email,
|
|
19685
|
+
firstName,
|
|
19686
|
+
lastName,
|
|
19687
|
+
phone,
|
|
19688
|
+
emailError,
|
|
19689
|
+
firstNameError,
|
|
19690
|
+
lastNameError,
|
|
19691
|
+
phoneError
|
|
19336
19692
|
},
|
|
19337
19693
|
dispatch
|
|
19338
19694
|
} = useContext(store$f);
|
|
19695
|
+
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);
|
|
19339
19696
|
const {
|
|
19340
19697
|
t
|
|
19341
19698
|
} = useTranslation("userEdit");
|
|
19699
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
19700
|
+
useEffect(() => {
|
|
19701
|
+
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));
|
|
19702
|
+
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19342
19703
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
19343
19704
|
onClick: () => {
|
|
19344
19705
|
dispatch({
|
|
@@ -19346,7 +19707,7 @@ const UserUpdateButton = ({
|
|
|
19346
19707
|
});
|
|
19347
19708
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
19348
19709
|
},
|
|
19349
|
-
disabled:
|
|
19710
|
+
disabled: isDisabled,
|
|
19350
19711
|
isLoading: buttonDisabled && !emailError
|
|
19351
19712
|
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
19352
19713
|
};
|
|
@@ -19359,31 +19720,6 @@ const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(La
|
|
|
19359
19720
|
store: store$f
|
|
19360
19721
|
}, props));
|
|
19361
19722
|
|
|
19362
|
-
function Phone({
|
|
19363
|
-
store,
|
|
19364
|
-
...otherProps
|
|
19365
|
-
}) {
|
|
19366
|
-
const {
|
|
19367
|
-
dispatch,
|
|
19368
|
-
state: {
|
|
19369
|
-
phone
|
|
19370
|
-
}
|
|
19371
|
-
} = useContext(store);
|
|
19372
|
-
|
|
19373
|
-
const handleInputChange = value => {
|
|
19374
|
-
dispatch({
|
|
19375
|
-
type: SET_PHONE,
|
|
19376
|
-
payload: value
|
|
19377
|
-
});
|
|
19378
|
-
};
|
|
19379
|
-
|
|
19380
|
-
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
19381
|
-
type: "tel",
|
|
19382
|
-
value: phone,
|
|
19383
|
-
onChange: e => handleInputChange(e.target.value)
|
|
19384
|
-
}, otherProps));
|
|
19385
|
-
}
|
|
19386
|
-
|
|
19387
19723
|
const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
|
|
19388
19724
|
store: store$f
|
|
19389
19725
|
}, props));
|
|
@@ -19416,9 +19752,12 @@ const UserUpdateProfilePic = ({
|
|
|
19416
19752
|
};
|
|
19417
19753
|
|
|
19418
19754
|
const UserUpdateView = props => {
|
|
19755
|
+
var _window$Pelcro$site$r;
|
|
19756
|
+
|
|
19419
19757
|
const {
|
|
19420
19758
|
t
|
|
19421
19759
|
} = useTranslation("userEdit");
|
|
19760
|
+
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);
|
|
19422
19761
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
19423
19762
|
id: "pelcro-user-update-view"
|
|
19424
19763
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -19437,19 +19776,22 @@ const UserUpdateView = props => {
|
|
|
19437
19776
|
id: "pelcro-input-first-name",
|
|
19438
19777
|
errorId: "pelcro-input-first-name-error",
|
|
19439
19778
|
label: t("labels.firstName"),
|
|
19440
|
-
autoFocus: true
|
|
19779
|
+
autoFocus: true,
|
|
19780
|
+
required: supportsTap ? true : false
|
|
19441
19781
|
}), /*#__PURE__*/React__default.createElement(UserUpdateLastName, {
|
|
19442
19782
|
wrapperClassName: "plc-ml-3",
|
|
19443
19783
|
autoComplete: "last-name",
|
|
19444
19784
|
id: "pelcro-input-last-name",
|
|
19445
19785
|
errorId: "pelcro-input-last-name-error",
|
|
19446
|
-
label: t("labels.lastName")
|
|
19786
|
+
label: t("labels.lastName"),
|
|
19787
|
+
required: supportsTap ? true : false
|
|
19447
19788
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
19448
19789
|
className: "plc-flex plc-items-start"
|
|
19449
19790
|
}, /*#__PURE__*/React__default.createElement(UserUpdatePhone, {
|
|
19450
19791
|
id: "pelcro-input-phone",
|
|
19451
19792
|
errorId: "pelcro-input-phone-error",
|
|
19452
|
-
label: t("labels.phone")
|
|
19793
|
+
label: t("labels.phone"),
|
|
19794
|
+
required: supportsTap ? true : false
|
|
19453
19795
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
19454
19796
|
role: "submit",
|
|
19455
19797
|
className: "plc-w-full plc-mt-2",
|
|
@@ -22754,10 +23096,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email
|
|
|
22754
23096
|
}, props));
|
|
22755
23097
|
|
|
22756
23098
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
|
|
23099
|
+
initWithUserFirstName: false,
|
|
22757
23100
|
store: store$7
|
|
22758
23101
|
}, props));
|
|
22759
23102
|
|
|
22760
23103
|
const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
|
|
23104
|
+
initWithUserLastName: false,
|
|
22761
23105
|
store: store$7
|
|
22762
23106
|
}, props));
|
|
22763
23107
|
|
|
@@ -30448,4 +30792,4 @@ const QrCodeModal = ({
|
|
|
30448
30792
|
};
|
|
30449
30793
|
QrCodeModal.viewId = "qrcode";
|
|
30450
30794
|
|
|
30451
|
-
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 };
|
|
30795
|
+
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 };
|