@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.cjs.js
CHANGED
|
@@ -3245,7 +3245,10 @@ var validation$2 = {
|
|
|
3245
3245
|
validEmail: "le courriel n’est pas valide",
|
|
3246
3246
|
enterEmail: "Un courriel est requis.",
|
|
3247
3247
|
enterPassword: "Mot de passe requis.",
|
|
3248
|
-
confirmPassword: "Confirmer le mot de passe requis."
|
|
3248
|
+
confirmPassword: "Confirmer le mot de passe requis.",
|
|
3249
|
+
enterFirstName: "Le prénom est requis.",
|
|
3250
|
+
enterLastName: "Le nom de famille est requis.",
|
|
3251
|
+
enterPhone: "Le numéro de téléphone est requis."
|
|
3249
3252
|
};
|
|
3250
3253
|
var buttons$e = {
|
|
3251
3254
|
account: "Accès abonné(e)s",
|
|
@@ -3334,7 +3337,10 @@ var validation$1 = {
|
|
|
3334
3337
|
validEmail: "Email address is not valid.",
|
|
3335
3338
|
enterEmail: "Email address is required.",
|
|
3336
3339
|
enterPassword: "Password is required.",
|
|
3337
|
-
confirmPassword: "Confirm password is required."
|
|
3340
|
+
confirmPassword: "Confirm password is required.",
|
|
3341
|
+
enterFirstName: "First name is required.",
|
|
3342
|
+
enterLastName: "Last name is required.",
|
|
3343
|
+
enterPhone: "Phone number is required."
|
|
3338
3344
|
};
|
|
3339
3345
|
var buttons$d = {
|
|
3340
3346
|
account: "My account",
|
|
@@ -3422,7 +3428,10 @@ var common_en = {
|
|
|
3422
3428
|
var validation = {
|
|
3423
3429
|
validEmail: "이메일 주소가 유효하지 않습니다.",
|
|
3424
3430
|
enterEmail: "이메일 주소는 필수 항목입니다.",
|
|
3425
|
-
enterPassword: "비밀번호는 필수 항목입니다."
|
|
3431
|
+
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
3432
|
+
enterFirstName: "이름은 필수 항목입니다.",
|
|
3433
|
+
enterLastName: "성은 필수 항목입니다.",
|
|
3434
|
+
enterPhone: "전화번호는 필수 항목입니다."
|
|
3426
3435
|
};
|
|
3427
3436
|
var buttons$c = {
|
|
3428
3437
|
account: "내 계정",
|
|
@@ -3815,7 +3824,10 @@ var labels$F = {
|
|
|
3815
3824
|
interval: "{{count}} {{interval}}",
|
|
3816
3825
|
interval_plural: "{{count}} {{interval}}s",
|
|
3817
3826
|
tax: "+ Tax",
|
|
3818
|
-
removeCoupon: "REMOVE"
|
|
3827
|
+
removeCoupon: "REMOVE",
|
|
3828
|
+
firstName: "First name",
|
|
3829
|
+
lastName: "Last name",
|
|
3830
|
+
phone: "Phone"
|
|
3819
3831
|
};
|
|
3820
3832
|
var checkoutForm_en = {
|
|
3821
3833
|
messages: messages$I,
|
|
@@ -3842,7 +3854,10 @@ var labels$E = {
|
|
|
3842
3854
|
interval: "{{count}} {{interval}}",
|
|
3843
3855
|
interval_plural: "{{count}} {{interval}}s",
|
|
3844
3856
|
tax: "+ Taxe",
|
|
3845
|
-
removeCoupon: "RETIRER"
|
|
3857
|
+
removeCoupon: "RETIRER",
|
|
3858
|
+
firstName: "Prénom",
|
|
3859
|
+
lastName: "Nom de famille",
|
|
3860
|
+
phone: "Téléphoner"
|
|
3846
3861
|
};
|
|
3847
3862
|
var checkoutForm_fr = {
|
|
3848
3863
|
messages: messages$H,
|
|
@@ -3869,7 +3884,10 @@ var labels$D = {
|
|
|
3869
3884
|
interval: "{{count}} {{interval}}",
|
|
3870
3885
|
interval_plural: "{{count}} {{interval}}",
|
|
3871
3886
|
tax: "+ 세금",
|
|
3872
|
-
removeCoupon: "제거"
|
|
3887
|
+
removeCoupon: "제거",
|
|
3888
|
+
firstName: "이름",
|
|
3889
|
+
lastName: "성",
|
|
3890
|
+
phone: "핸드폰"
|
|
3873
3891
|
};
|
|
3874
3892
|
var checkoutForm_ko = {
|
|
3875
3893
|
messages: messages$G,
|
|
@@ -4083,7 +4101,8 @@ var labels$w = {
|
|
|
4083
4101
|
emailPlaceholder: "Enter email",
|
|
4084
4102
|
required: "required",
|
|
4085
4103
|
firstName: "First name",
|
|
4086
|
-
lastName: "Last name"
|
|
4104
|
+
lastName: "Last name",
|
|
4105
|
+
phone: "Phone"
|
|
4087
4106
|
};
|
|
4088
4107
|
var messages$z = {
|
|
4089
4108
|
alreadyHaveAccount: "Already have an account?",
|
|
@@ -4178,7 +4197,8 @@ var labels$v = {
|
|
|
4178
4197
|
emailPlaceholder: "Courriel",
|
|
4179
4198
|
required: "Champs obligatoires",
|
|
4180
4199
|
firstName: "Prénom",
|
|
4181
|
-
lastName: "Nom de famille"
|
|
4200
|
+
lastName: "Nom de famille",
|
|
4201
|
+
phone: "Téléphoner"
|
|
4182
4202
|
};
|
|
4183
4203
|
var messages$y = {
|
|
4184
4204
|
alreadyHaveAccount: "Vous avez déjà un compte?",
|
|
@@ -4274,7 +4294,8 @@ var labels$u = {
|
|
|
4274
4294
|
emailPlaceholder: "이메일 입력",
|
|
4275
4295
|
required: "필수 항목",
|
|
4276
4296
|
firstName: "이름",
|
|
4277
|
-
lastName: "성"
|
|
4297
|
+
lastName: "성",
|
|
4298
|
+
phone: "핸드폰"
|
|
4278
4299
|
};
|
|
4279
4300
|
var messages$x = {
|
|
4280
4301
|
alreadyHaveAccount: "이미 계정이 있습니까?",
|
|
@@ -7235,8 +7256,7 @@ class PelcroActions {
|
|
|
7235
7256
|
return this.set({
|
|
7236
7257
|
view: "login"
|
|
7237
7258
|
});
|
|
7238
|
-
}
|
|
7239
|
-
|
|
7259
|
+
}
|
|
7240
7260
|
|
|
7241
7261
|
if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
|
|
7242
7262
|
return this.set({
|
|
@@ -10808,6 +10828,9 @@ const SET_EMAIL = "SET_EMAIL";
|
|
|
10808
10828
|
const SET_PASSWORD = "SET_PASSWORD";
|
|
10809
10829
|
const SET_EMAIL_ERROR = "SET_EMAIL_ERROR";
|
|
10810
10830
|
const SET_PASSWORD_ERROR = "SET_PASSWORD_ERROR";
|
|
10831
|
+
const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
10832
|
+
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
10833
|
+
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
10811
10834
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
10812
10835
|
const SET_TOKEN = "SET_TOKEN";
|
|
10813
10836
|
const SET_GIFT_CODE = "SET_GIFT_CODE";
|
|
@@ -11440,14 +11463,18 @@ facebookLoginRenderProps.FacebookLogin;
|
|
|
11440
11463
|
const initialState$k = {
|
|
11441
11464
|
email: "",
|
|
11442
11465
|
password: "",
|
|
11466
|
+
firstName: "",
|
|
11467
|
+
lastName: "",
|
|
11468
|
+
phone: "",
|
|
11443
11469
|
emailError: null,
|
|
11444
11470
|
passwordError: null,
|
|
11445
11471
|
confirmPassword: "",
|
|
11446
11472
|
confirmPasswordError: null,
|
|
11447
11473
|
confirmPasswordUsed: false,
|
|
11448
11474
|
buttonDisabled: false,
|
|
11449
|
-
|
|
11450
|
-
|
|
11475
|
+
firstNameError: null,
|
|
11476
|
+
lastNameError: null,
|
|
11477
|
+
phoneError: null,
|
|
11451
11478
|
selectFields: {},
|
|
11452
11479
|
alert: {
|
|
11453
11480
|
type: "error",
|
|
@@ -11478,6 +11505,7 @@ const RegisterContainer = ({
|
|
|
11478
11505
|
password,
|
|
11479
11506
|
firstName,
|
|
11480
11507
|
lastName,
|
|
11508
|
+
phone,
|
|
11481
11509
|
organization,
|
|
11482
11510
|
jobTitle,
|
|
11483
11511
|
selectFields
|
|
@@ -11503,6 +11531,7 @@ const RegisterContainer = ({
|
|
|
11503
11531
|
password,
|
|
11504
11532
|
first_name: firstName,
|
|
11505
11533
|
last_name: lastName,
|
|
11534
|
+
phone: phone,
|
|
11506
11535
|
security_token: securityToken,
|
|
11507
11536
|
metadata: {
|
|
11508
11537
|
organization,
|
|
@@ -11592,12 +11621,20 @@ const RegisterContainer = ({
|
|
|
11592
11621
|
|
|
11593
11622
|
case SET_FIRST_NAME:
|
|
11594
11623
|
return lib_7({ ...state,
|
|
11595
|
-
firstName: action.payload
|
|
11624
|
+
firstName: action.payload,
|
|
11625
|
+
firstNameError: null
|
|
11596
11626
|
});
|
|
11597
11627
|
|
|
11598
11628
|
case SET_LAST_NAME:
|
|
11599
11629
|
return lib_7({ ...state,
|
|
11600
|
-
lastName: action.payload
|
|
11630
|
+
lastName: action.payload,
|
|
11631
|
+
lastNameError: null
|
|
11632
|
+
});
|
|
11633
|
+
|
|
11634
|
+
case SET_PHONE:
|
|
11635
|
+
return lib_7({ ...state,
|
|
11636
|
+
phone: action.payload,
|
|
11637
|
+
phoneError: null
|
|
11601
11638
|
});
|
|
11602
11639
|
|
|
11603
11640
|
case SET_TEXT_FIELD:
|
|
@@ -11623,6 +11660,24 @@ const RegisterContainer = ({
|
|
|
11623
11660
|
password: ""
|
|
11624
11661
|
});
|
|
11625
11662
|
|
|
11663
|
+
case SET_FIRST_NAME_ERROR:
|
|
11664
|
+
return lib_7({ ...state,
|
|
11665
|
+
firstNameError: action.payload,
|
|
11666
|
+
firstName: ""
|
|
11667
|
+
});
|
|
11668
|
+
|
|
11669
|
+
case SET_LAST_NAME_ERROR:
|
|
11670
|
+
return lib_7({ ...state,
|
|
11671
|
+
lastNameError: action.payload,
|
|
11672
|
+
lastName: ""
|
|
11673
|
+
});
|
|
11674
|
+
|
|
11675
|
+
case SET_PHONE_ERROR:
|
|
11676
|
+
return lib_7({ ...state,
|
|
11677
|
+
phoneError: action.payload,
|
|
11678
|
+
phone: null
|
|
11679
|
+
});
|
|
11680
|
+
|
|
11626
11681
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
11627
11682
|
return lib_7({ ...state,
|
|
11628
11683
|
confirmPasswordError: action.payload,
|
|
@@ -12264,117 +12319,77 @@ const RegisterButton = ({
|
|
|
12264
12319
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
12265
12320
|
};
|
|
12266
12321
|
|
|
12267
|
-
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12268
|
-
className: `pelcro-loader-wrapper ${props.className}`
|
|
12269
|
-
}, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
12270
|
-
width: props.width,
|
|
12271
|
-
height: props.height,
|
|
12272
|
-
viewBox: "0 0 120 30",
|
|
12273
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12274
|
-
fill: "currentColor",
|
|
12275
|
-
"aria-label": props.label
|
|
12276
|
-
}, /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12277
|
-
cx: "15",
|
|
12278
|
-
cy: "15",
|
|
12279
|
-
r: props.radius + 6
|
|
12280
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12281
|
-
attributeName: "r",
|
|
12282
|
-
from: "15",
|
|
12283
|
-
to: "15",
|
|
12284
|
-
begin: "0s",
|
|
12285
|
-
dur: "0.8s",
|
|
12286
|
-
values: "15;9;15",
|
|
12287
|
-
calcMode: "linear",
|
|
12288
|
-
repeatCount: "indefinite"
|
|
12289
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12290
|
-
attributeName: "fillOpacity",
|
|
12291
|
-
from: "1",
|
|
12292
|
-
to: "1",
|
|
12293
|
-
begin: "0s",
|
|
12294
|
-
dur: "0.8s",
|
|
12295
|
-
values: "1;.5;1",
|
|
12296
|
-
calcMode: "linear",
|
|
12297
|
-
repeatCount: "indefinite"
|
|
12298
|
-
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12299
|
-
cx: "60",
|
|
12300
|
-
cy: "15",
|
|
12301
|
-
r: props.radius,
|
|
12302
|
-
attributeName: "fillOpacity",
|
|
12303
|
-
from: "1",
|
|
12304
|
-
to: "0.3"
|
|
12305
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12306
|
-
attributeName: "r",
|
|
12307
|
-
from: "9",
|
|
12308
|
-
to: "9",
|
|
12309
|
-
begin: "0s",
|
|
12310
|
-
dur: "0.8s",
|
|
12311
|
-
values: "9;15;9",
|
|
12312
|
-
calcMode: "linear",
|
|
12313
|
-
repeatCount: "indefinite"
|
|
12314
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12315
|
-
attributeName: "fillOpacity",
|
|
12316
|
-
from: "0.5",
|
|
12317
|
-
to: "0.5",
|
|
12318
|
-
begin: "0s",
|
|
12319
|
-
dur: "0.8s",
|
|
12320
|
-
values: ".5;1;.5",
|
|
12321
|
-
calcMode: "linear",
|
|
12322
|
-
repeatCount: "indefinite"
|
|
12323
|
-
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12324
|
-
cx: "105",
|
|
12325
|
-
cy: "15",
|
|
12326
|
-
r: props.radius + 6
|
|
12327
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12328
|
-
attributeName: "r",
|
|
12329
|
-
from: "15",
|
|
12330
|
-
to: "15",
|
|
12331
|
-
begin: "0s",
|
|
12332
|
-
dur: "0.8s",
|
|
12333
|
-
values: "15;9;15",
|
|
12334
|
-
calcMode: "linear",
|
|
12335
|
-
repeatCount: "indefinite"
|
|
12336
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12337
|
-
attributeName: "fillOpacity",
|
|
12338
|
-
from: "1",
|
|
12339
|
-
to: "1",
|
|
12340
|
-
begin: "0s",
|
|
12341
|
-
dur: "0.8s",
|
|
12342
|
-
values: "1;.5;1",
|
|
12343
|
-
calcMode: "linear",
|
|
12344
|
-
repeatCount: "indefinite"
|
|
12345
|
-
}))));
|
|
12346
|
-
Loader.defaultProps = {
|
|
12347
|
-
height: 50,
|
|
12348
|
-
width: 35,
|
|
12349
|
-
color: "#32aea1",
|
|
12350
|
-
label: "Loading data..",
|
|
12351
|
-
radius: 9
|
|
12352
|
-
};
|
|
12353
|
-
|
|
12354
12322
|
function FirstName({
|
|
12323
|
+
initWithUserFirstName = true,
|
|
12355
12324
|
store,
|
|
12356
12325
|
...otherProps
|
|
12357
12326
|
}) {
|
|
12327
|
+
const {
|
|
12328
|
+
t
|
|
12329
|
+
} = useTranslation("common");
|
|
12358
12330
|
const {
|
|
12359
12331
|
dispatch,
|
|
12360
|
-
state
|
|
12332
|
+
state: {
|
|
12333
|
+
firstName: stateFirstName,
|
|
12334
|
+
firstNameError
|
|
12335
|
+
}
|
|
12361
12336
|
} = React.useContext(store);
|
|
12337
|
+
const [firstName, setFirstName] = React.useState(stateFirstName);
|
|
12338
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
12339
|
+
const handleInputChange = React.useCallback(value => {
|
|
12340
|
+
setFirstName(value);
|
|
12362
12341
|
|
|
12363
|
-
|
|
12342
|
+
if (finishedTyping) {
|
|
12343
|
+
if (firstName !== null && firstName !== void 0 && firstName.length) {
|
|
12344
|
+
dispatch({
|
|
12345
|
+
type: SET_FIRST_NAME,
|
|
12346
|
+
payload: firstName
|
|
12347
|
+
});
|
|
12348
|
+
} else {
|
|
12349
|
+
if (otherProps.required) {
|
|
12350
|
+
dispatch({
|
|
12351
|
+
type: SET_FIRST_NAME_ERROR,
|
|
12352
|
+
payload: t("validation.enterFirstName")
|
|
12353
|
+
});
|
|
12354
|
+
} else {
|
|
12355
|
+
dispatch({
|
|
12356
|
+
type: SET_FIRST_NAME,
|
|
12357
|
+
payload: firstName
|
|
12358
|
+
});
|
|
12359
|
+
}
|
|
12360
|
+
}
|
|
12361
|
+
}
|
|
12362
|
+
}, [dispatch, firstName, finishedTyping]);
|
|
12363
|
+
React.useEffect(() => {
|
|
12364
|
+
handleInputChange(firstName);
|
|
12365
|
+
}, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
|
|
12366
|
+
|
|
12367
|
+
const loadFirstNameIntoField = () => {
|
|
12368
|
+
handleInputChange(window.Pelcro.user.read().first_name);
|
|
12364
12369
|
dispatch({
|
|
12365
12370
|
type: SET_FIRST_NAME,
|
|
12366
|
-
payload:
|
|
12371
|
+
payload: window.Pelcro.user.read().first_name
|
|
12367
12372
|
});
|
|
12368
12373
|
};
|
|
12369
12374
|
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12375
|
+
React.useEffect(() => {
|
|
12376
|
+
if (initWithUserFirstName) {
|
|
12377
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12378
|
+
loadFirstNameIntoField();
|
|
12379
|
+
});
|
|
12380
|
+
loadFirstNameIntoField();
|
|
12381
|
+
return () => {
|
|
12382
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12383
|
+
};
|
|
12384
|
+
}
|
|
12385
|
+
}, []);
|
|
12374
12386
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12375
12387
|
type: "text",
|
|
12376
|
-
|
|
12377
|
-
|
|
12388
|
+
error: firstNameError,
|
|
12389
|
+
value: firstName,
|
|
12390
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12391
|
+
onBlur: () => setFinishedTyping(true),
|
|
12392
|
+
onFocus: () => setFinishedTyping(false)
|
|
12378
12393
|
}, otherProps));
|
|
12379
12394
|
}
|
|
12380
12395
|
|
|
@@ -12383,29 +12398,76 @@ const RegisterFirstName = props => /*#__PURE__*/React__default['default'].create
|
|
|
12383
12398
|
}, props));
|
|
12384
12399
|
|
|
12385
12400
|
function LastName({
|
|
12401
|
+
initWithUserLastName = true,
|
|
12386
12402
|
store,
|
|
12387
12403
|
...otherProps
|
|
12388
12404
|
}) {
|
|
12405
|
+
const {
|
|
12406
|
+
t
|
|
12407
|
+
} = useTranslation("common");
|
|
12389
12408
|
const {
|
|
12390
12409
|
dispatch,
|
|
12391
|
-
state
|
|
12410
|
+
state: {
|
|
12411
|
+
lastName: stateLastName,
|
|
12412
|
+
lastNameError
|
|
12413
|
+
}
|
|
12392
12414
|
} = React.useContext(store);
|
|
12415
|
+
const [lastName, setLastName] = React.useState(stateLastName);
|
|
12416
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
12417
|
+
const handleInputChange = React.useCallback(value => {
|
|
12418
|
+
setLastName(value);
|
|
12393
12419
|
|
|
12394
|
-
|
|
12420
|
+
if (finishedTyping) {
|
|
12421
|
+
if (lastName !== null && lastName !== void 0 && lastName.length) {
|
|
12422
|
+
dispatch({
|
|
12423
|
+
type: SET_LAST_NAME,
|
|
12424
|
+
payload: lastName
|
|
12425
|
+
});
|
|
12426
|
+
} else {
|
|
12427
|
+
if (otherProps.required) {
|
|
12428
|
+
dispatch({
|
|
12429
|
+
type: SET_LAST_NAME_ERROR,
|
|
12430
|
+
payload: t("validation.enterLastName")
|
|
12431
|
+
});
|
|
12432
|
+
} else {
|
|
12433
|
+
dispatch({
|
|
12434
|
+
type: SET_LAST_NAME,
|
|
12435
|
+
payload: lastName
|
|
12436
|
+
});
|
|
12437
|
+
}
|
|
12438
|
+
}
|
|
12439
|
+
}
|
|
12440
|
+
}, [dispatch, lastName, finishedTyping]);
|
|
12441
|
+
React.useEffect(() => {
|
|
12442
|
+
handleInputChange(lastName);
|
|
12443
|
+
}, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
|
|
12444
|
+
|
|
12445
|
+
const loadLastNameIntoField = () => {
|
|
12446
|
+
handleInputChange(window.Pelcro.user.read().last_name);
|
|
12395
12447
|
dispatch({
|
|
12396
12448
|
type: SET_LAST_NAME,
|
|
12397
|
-
payload:
|
|
12449
|
+
payload: window.Pelcro.user.read().last_name
|
|
12398
12450
|
});
|
|
12399
12451
|
};
|
|
12400
12452
|
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12453
|
+
React.useEffect(() => {
|
|
12454
|
+
if (initWithUserLastName) {
|
|
12455
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12456
|
+
loadLastNameIntoField();
|
|
12457
|
+
});
|
|
12458
|
+
loadLastNameIntoField();
|
|
12459
|
+
return () => {
|
|
12460
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12461
|
+
};
|
|
12462
|
+
}
|
|
12463
|
+
}, []);
|
|
12405
12464
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12406
12465
|
type: "text",
|
|
12407
|
-
|
|
12408
|
-
|
|
12466
|
+
error: lastNameError,
|
|
12467
|
+
value: lastName,
|
|
12468
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12469
|
+
onBlur: () => setFinishedTyping(true),
|
|
12470
|
+
onFocus: () => setFinishedTyping(false)
|
|
12409
12471
|
}, otherProps));
|
|
12410
12472
|
}
|
|
12411
12473
|
|
|
@@ -12413,6 +12475,80 @@ const RegisterLastName = props => /*#__PURE__*/React__default['default'].createE
|
|
|
12413
12475
|
store: store$k
|
|
12414
12476
|
}, props));
|
|
12415
12477
|
|
|
12478
|
+
function Phone({
|
|
12479
|
+
initWithUserPhone = true,
|
|
12480
|
+
store,
|
|
12481
|
+
...otherProps
|
|
12482
|
+
}) {
|
|
12483
|
+
const {
|
|
12484
|
+
t
|
|
12485
|
+
} = useTranslation("common");
|
|
12486
|
+
const {
|
|
12487
|
+
dispatch,
|
|
12488
|
+
state: {
|
|
12489
|
+
phone: statePhone,
|
|
12490
|
+
phoneError
|
|
12491
|
+
}
|
|
12492
|
+
} = React.useContext(store);
|
|
12493
|
+
const [phone, setPhone] = React.useState(statePhone);
|
|
12494
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
12495
|
+
const handleInputChange = React.useCallback(value => {
|
|
12496
|
+
setPhone(value);
|
|
12497
|
+
|
|
12498
|
+
if (finishedTyping) {
|
|
12499
|
+
if (phone !== null && phone !== void 0 && phone.length) {
|
|
12500
|
+
dispatch({
|
|
12501
|
+
type: SET_PHONE,
|
|
12502
|
+
payload: phone
|
|
12503
|
+
});
|
|
12504
|
+
} else {
|
|
12505
|
+
if (otherProps.required) {
|
|
12506
|
+
dispatch({
|
|
12507
|
+
type: SET_PHONE_ERROR,
|
|
12508
|
+
payload: t("validation.enterPhone")
|
|
12509
|
+
});
|
|
12510
|
+
} else {
|
|
12511
|
+
dispatch({
|
|
12512
|
+
type: SET_PHONE,
|
|
12513
|
+
payload: phone
|
|
12514
|
+
});
|
|
12515
|
+
}
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12518
|
+
}, [dispatch, phone, finishedTyping]);
|
|
12519
|
+
React.useEffect(() => {
|
|
12520
|
+
handleInputChange(phone);
|
|
12521
|
+
}, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
|
|
12522
|
+
|
|
12523
|
+
const loadPhoneIntoField = () => {
|
|
12524
|
+
handleInputChange(window.Pelcro.user.read().phone);
|
|
12525
|
+
dispatch({
|
|
12526
|
+
type: SET_PHONE,
|
|
12527
|
+
payload: window.Pelcro.user.read().phone
|
|
12528
|
+
});
|
|
12529
|
+
};
|
|
12530
|
+
|
|
12531
|
+
React.useEffect(() => {
|
|
12532
|
+
if (initWithUserPhone) {
|
|
12533
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
12534
|
+
loadPhoneIntoField();
|
|
12535
|
+
});
|
|
12536
|
+
loadPhoneIntoField();
|
|
12537
|
+
return () => {
|
|
12538
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
12539
|
+
};
|
|
12540
|
+
}
|
|
12541
|
+
}, []);
|
|
12542
|
+
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
12543
|
+
type: "tel",
|
|
12544
|
+
error: phoneError,
|
|
12545
|
+
value: phone,
|
|
12546
|
+
onChange: e => handleInputChange(e.target.value),
|
|
12547
|
+
onBlur: () => setFinishedTyping(true),
|
|
12548
|
+
onFocus: () => setFinishedTyping(false)
|
|
12549
|
+
}, otherProps));
|
|
12550
|
+
}
|
|
12551
|
+
|
|
12416
12552
|
/**
|
|
12417
12553
|
*
|
|
12418
12554
|
*/
|
|
@@ -12443,11 +12579,13 @@ function RegisterView(props) {
|
|
|
12443
12579
|
className: "plc-flex plc-items-start"
|
|
12444
12580
|
}, /*#__PURE__*/React__default['default'].createElement(RegisterFirstName, {
|
|
12445
12581
|
id: "pelcro-input-first-name",
|
|
12446
|
-
label: t("labels.firstName")
|
|
12582
|
+
label: t("labels.firstName"),
|
|
12583
|
+
errorId: "pelcro-input-firstName-error"
|
|
12447
12584
|
}), /*#__PURE__*/React__default['default'].createElement(RegisterLastName, {
|
|
12448
12585
|
wrapperClassName: "plc-ml-3",
|
|
12449
12586
|
id: "pelcro-input-last-name",
|
|
12450
|
-
label: t("labels.lastName")
|
|
12587
|
+
label: t("labels.lastName"),
|
|
12588
|
+
errorId: "pelcro-input-lastName-error"
|
|
12451
12589
|
})), /*#__PURE__*/React__default['default'].createElement(RegisterEmail, {
|
|
12452
12590
|
id: "pelcro-input-email",
|
|
12453
12591
|
errorId: "pelcro-input-email-error",
|
|
@@ -12499,6 +12637,93 @@ function hasSecurityTokenEnabled() {
|
|
|
12499
12637
|
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
|
|
12500
12638
|
}
|
|
12501
12639
|
|
|
12640
|
+
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12641
|
+
className: `pelcro-loader-wrapper ${props.className}`
|
|
12642
|
+
}, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
12643
|
+
width: props.width,
|
|
12644
|
+
height: props.height,
|
|
12645
|
+
viewBox: "0 0 120 30",
|
|
12646
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12647
|
+
fill: "currentColor",
|
|
12648
|
+
"aria-label": props.label
|
|
12649
|
+
}, /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12650
|
+
cx: "15",
|
|
12651
|
+
cy: "15",
|
|
12652
|
+
r: props.radius + 6
|
|
12653
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12654
|
+
attributeName: "r",
|
|
12655
|
+
from: "15",
|
|
12656
|
+
to: "15",
|
|
12657
|
+
begin: "0s",
|
|
12658
|
+
dur: "0.8s",
|
|
12659
|
+
values: "15;9;15",
|
|
12660
|
+
calcMode: "linear",
|
|
12661
|
+
repeatCount: "indefinite"
|
|
12662
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12663
|
+
attributeName: "fillOpacity",
|
|
12664
|
+
from: "1",
|
|
12665
|
+
to: "1",
|
|
12666
|
+
begin: "0s",
|
|
12667
|
+
dur: "0.8s",
|
|
12668
|
+
values: "1;.5;1",
|
|
12669
|
+
calcMode: "linear",
|
|
12670
|
+
repeatCount: "indefinite"
|
|
12671
|
+
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12672
|
+
cx: "60",
|
|
12673
|
+
cy: "15",
|
|
12674
|
+
r: props.radius,
|
|
12675
|
+
attributeName: "fillOpacity",
|
|
12676
|
+
from: "1",
|
|
12677
|
+
to: "0.3"
|
|
12678
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12679
|
+
attributeName: "r",
|
|
12680
|
+
from: "9",
|
|
12681
|
+
to: "9",
|
|
12682
|
+
begin: "0s",
|
|
12683
|
+
dur: "0.8s",
|
|
12684
|
+
values: "9;15;9",
|
|
12685
|
+
calcMode: "linear",
|
|
12686
|
+
repeatCount: "indefinite"
|
|
12687
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12688
|
+
attributeName: "fillOpacity",
|
|
12689
|
+
from: "0.5",
|
|
12690
|
+
to: "0.5",
|
|
12691
|
+
begin: "0s",
|
|
12692
|
+
dur: "0.8s",
|
|
12693
|
+
values: ".5;1;.5",
|
|
12694
|
+
calcMode: "linear",
|
|
12695
|
+
repeatCount: "indefinite"
|
|
12696
|
+
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
12697
|
+
cx: "105",
|
|
12698
|
+
cy: "15",
|
|
12699
|
+
r: props.radius + 6
|
|
12700
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12701
|
+
attributeName: "r",
|
|
12702
|
+
from: "15",
|
|
12703
|
+
to: "15",
|
|
12704
|
+
begin: "0s",
|
|
12705
|
+
dur: "0.8s",
|
|
12706
|
+
values: "15;9;15",
|
|
12707
|
+
calcMode: "linear",
|
|
12708
|
+
repeatCount: "indefinite"
|
|
12709
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
12710
|
+
attributeName: "fillOpacity",
|
|
12711
|
+
from: "1",
|
|
12712
|
+
to: "1",
|
|
12713
|
+
begin: "0s",
|
|
12714
|
+
dur: "0.8s",
|
|
12715
|
+
values: "1;.5;1",
|
|
12716
|
+
calcMode: "linear",
|
|
12717
|
+
repeatCount: "indefinite"
|
|
12718
|
+
}))));
|
|
12719
|
+
Loader.defaultProps = {
|
|
12720
|
+
height: 50,
|
|
12721
|
+
width: 35,
|
|
12722
|
+
color: "#32aea1",
|
|
12723
|
+
label: "Loading data..",
|
|
12724
|
+
radius: 9
|
|
12725
|
+
};
|
|
12726
|
+
|
|
12502
12727
|
function TextInput({
|
|
12503
12728
|
store,
|
|
12504
12729
|
fieldName,
|
|
@@ -15128,6 +15353,12 @@ const initialState$j = {
|
|
|
15128
15353
|
updatedPrice: null,
|
|
15129
15354
|
taxAmount: null,
|
|
15130
15355
|
currentPlan: null,
|
|
15356
|
+
firstName: "",
|
|
15357
|
+
lastName: "",
|
|
15358
|
+
phone: "",
|
|
15359
|
+
firstNameError: null,
|
|
15360
|
+
lastNameError: null,
|
|
15361
|
+
phoneError: null,
|
|
15131
15362
|
alert: {
|
|
15132
15363
|
type: "error",
|
|
15133
15364
|
content: ""
|
|
@@ -15246,6 +15477,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15246
15477
|
} else {
|
|
15247
15478
|
window.Pelcro.payment.authorize({
|
|
15248
15479
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
15480
|
+
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
15481
|
+
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
15482
|
+
phone: window.Pelcro.user.read().phone || state.phone,
|
|
15249
15483
|
site_id: window.Pelcro.siteid,
|
|
15250
15484
|
amount: totalAmount,
|
|
15251
15485
|
currency: (plan === null || plan === void 0 ? void 0 : plan.currency) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency) || window.Pelcro.site.read().default_currency,
|
|
@@ -16771,6 +17005,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16771
17005
|
percentOff: action.payload
|
|
16772
17006
|
});
|
|
16773
17007
|
|
|
17008
|
+
case SET_FIRST_NAME:
|
|
17009
|
+
return lib_7({ ...state,
|
|
17010
|
+
firstName: action.payload,
|
|
17011
|
+
firstNameError: null
|
|
17012
|
+
});
|
|
17013
|
+
|
|
17014
|
+
case SET_LAST_NAME:
|
|
17015
|
+
return lib_7({ ...state,
|
|
17016
|
+
lastName: action.payload,
|
|
17017
|
+
lastNameError: null
|
|
17018
|
+
});
|
|
17019
|
+
|
|
17020
|
+
case SET_PHONE:
|
|
17021
|
+
return lib_7({ ...state,
|
|
17022
|
+
phone: action.payload,
|
|
17023
|
+
phoneError: null
|
|
17024
|
+
});
|
|
17025
|
+
|
|
17026
|
+
case SET_FIRST_NAME_ERROR:
|
|
17027
|
+
return lib_7({ ...state,
|
|
17028
|
+
firstNameError: action.payload,
|
|
17029
|
+
firstName: ""
|
|
17030
|
+
});
|
|
17031
|
+
|
|
17032
|
+
case SET_LAST_NAME_ERROR:
|
|
17033
|
+
return lib_7({ ...state,
|
|
17034
|
+
lastNameError: action.payload,
|
|
17035
|
+
lastName: ""
|
|
17036
|
+
});
|
|
17037
|
+
|
|
17038
|
+
case SET_PHONE_ERROR:
|
|
17039
|
+
return lib_7({ ...state,
|
|
17040
|
+
phoneError: action.payload,
|
|
17041
|
+
phone: null
|
|
17042
|
+
});
|
|
17043
|
+
|
|
16774
17044
|
case SHOW_ALERT:
|
|
16775
17045
|
return lib_7({ ...state,
|
|
16776
17046
|
alert: action.payload
|
|
@@ -16985,7 +17255,7 @@ const SubmitPaymentMethod = ({
|
|
|
16985
17255
|
onClick,
|
|
16986
17256
|
...otherProps
|
|
16987
17257
|
}) => {
|
|
16988
|
-
var _plan$quantity;
|
|
17258
|
+
var _plan$quantity, _window$Pelcro$site$r;
|
|
16989
17259
|
|
|
16990
17260
|
const {
|
|
16991
17261
|
plan
|
|
@@ -16996,6 +17266,12 @@ const SubmitPaymentMethod = ({
|
|
|
16996
17266
|
const {
|
|
16997
17267
|
dispatch,
|
|
16998
17268
|
state: {
|
|
17269
|
+
firstNameError,
|
|
17270
|
+
lastNameError,
|
|
17271
|
+
phoneError,
|
|
17272
|
+
firstName,
|
|
17273
|
+
lastName,
|
|
17274
|
+
phone,
|
|
16999
17275
|
disableSubmit,
|
|
17000
17276
|
isLoading,
|
|
17001
17277
|
updatedPrice
|
|
@@ -17004,6 +17280,18 @@ const SubmitPaymentMethod = ({
|
|
|
17004
17280
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
17005
17281
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
17006
17282
|
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
17283
|
+
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
17284
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17285
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17286
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17287
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
17288
|
+
React.useEffect(() => {
|
|
17289
|
+
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
17290
|
+
setDisabled(disableSubmit);
|
|
17291
|
+
} else {
|
|
17292
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
|
|
17293
|
+
}
|
|
17294
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
|
|
17007
17295
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
17008
17296
|
role: "submit",
|
|
17009
17297
|
className: "plc-w-full plc-py-3",
|
|
@@ -17015,7 +17303,7 @@ const SubmitPaymentMethod = ({
|
|
|
17015
17303
|
});
|
|
17016
17304
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
17017
17305
|
},
|
|
17018
|
-
disabled:
|
|
17306
|
+
disabled: isDisabled
|
|
17019
17307
|
}, otherProps), plan ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
17020
17308
|
className: "plc-capitalize "
|
|
17021
17309
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
@@ -17590,6 +17878,18 @@ const TaxAmount = () => {
|
|
|
17590
17878
|
return null;
|
|
17591
17879
|
};
|
|
17592
17880
|
|
|
17881
|
+
const IncludeFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
17882
|
+
store: store$j
|
|
17883
|
+
}, props));
|
|
17884
|
+
|
|
17885
|
+
const IncludeLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
17886
|
+
store: store$j
|
|
17887
|
+
}, props));
|
|
17888
|
+
|
|
17889
|
+
const IncludePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
17890
|
+
store: store$j
|
|
17891
|
+
}, props));
|
|
17892
|
+
|
|
17593
17893
|
/**
|
|
17594
17894
|
*
|
|
17595
17895
|
*/
|
|
@@ -17609,7 +17909,10 @@ function PaymentMethodView({
|
|
|
17609
17909
|
} = useTranslation("checkoutForm");
|
|
17610
17910
|
const cardProcessor = getSiteCardProcessor();
|
|
17611
17911
|
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);
|
|
17612
|
-
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);
|
|
17912
|
+
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);
|
|
17913
|
+
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
17914
|
+
const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
|
|
17915
|
+
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
17613
17916
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17614
17917
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
17615
17918
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -17631,7 +17934,25 @@ function PaymentMethodView({
|
|
|
17631
17934
|
onFailure: onFailure
|
|
17632
17935
|
}, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
17633
17936
|
className: "plc-mb-2"
|
|
17634
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(
|
|
17937
|
+
}), /*#__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", {
|
|
17938
|
+
className: "plc-flex plc-items-start"
|
|
17939
|
+
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
17940
|
+
id: "pelcro-input-first-name",
|
|
17941
|
+
label: t("labels.firstName"),
|
|
17942
|
+
errorId: "pelcro-input-firstName-error",
|
|
17943
|
+
required: true
|
|
17944
|
+
}), /*#__PURE__*/React__default['default'].createElement(IncludeLastName, {
|
|
17945
|
+
wrapperClassName: "plc-ml-3",
|
|
17946
|
+
id: "pelcro-input-last-name",
|
|
17947
|
+
label: t("labels.lastName"),
|
|
17948
|
+
errorId: "pelcro-input-lastName-error",
|
|
17949
|
+
required: true
|
|
17950
|
+
})), /*#__PURE__*/React__default['default'].createElement(IncludePhone, {
|
|
17951
|
+
id: "pelcro-input-phone",
|
|
17952
|
+
errorId: "pelcro-input-phone-error",
|
|
17953
|
+
label: t("labels.phone"),
|
|
17954
|
+
required: true
|
|
17955
|
+
})), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17635
17956
|
className: "plc-mb-2"
|
|
17636
17957
|
}, /*#__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", {
|
|
17637
17958
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -19114,9 +19435,12 @@ const initialState$f = {
|
|
|
19114
19435
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19115
19436
|
emailError: null,
|
|
19116
19437
|
firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
|
|
19438
|
+
firstNameError: null,
|
|
19117
19439
|
lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
|
|
19440
|
+
lastNameError: null,
|
|
19118
19441
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
19119
19442
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19443
|
+
phoneError: null,
|
|
19120
19444
|
buttonDisabled: false,
|
|
19121
19445
|
textFields: {},
|
|
19122
19446
|
alert: {
|
|
@@ -19228,17 +19552,26 @@ const UserUpdateContainer = ({
|
|
|
19228
19552
|
|
|
19229
19553
|
case SET_EMAIL:
|
|
19230
19554
|
return lib_7({ ...state,
|
|
19231
|
-
email: action.payload
|
|
19555
|
+
email: action.payload,
|
|
19556
|
+
emailError: null
|
|
19232
19557
|
});
|
|
19233
19558
|
|
|
19234
19559
|
case SET_EMAIL_ERROR:
|
|
19235
19560
|
return lib_7({ ...state,
|
|
19236
|
-
emailError: action.payload
|
|
19561
|
+
emailError: action.payload,
|
|
19562
|
+
email: ""
|
|
19237
19563
|
});
|
|
19238
19564
|
|
|
19239
19565
|
case SET_FIRST_NAME:
|
|
19240
19566
|
return lib_7({ ...state,
|
|
19241
|
-
firstName: action.payload
|
|
19567
|
+
firstName: action.payload,
|
|
19568
|
+
firstNameError: null
|
|
19569
|
+
});
|
|
19570
|
+
|
|
19571
|
+
case SET_FIRST_NAME_ERROR:
|
|
19572
|
+
return lib_7({ ...state,
|
|
19573
|
+
firstNameError: action.payload,
|
|
19574
|
+
firstName: ""
|
|
19242
19575
|
});
|
|
19243
19576
|
|
|
19244
19577
|
case SET_DISPLAY_NAME:
|
|
@@ -19248,12 +19581,26 @@ const UserUpdateContainer = ({
|
|
|
19248
19581
|
|
|
19249
19582
|
case SET_LAST_NAME:
|
|
19250
19583
|
return lib_7({ ...state,
|
|
19251
|
-
lastName: action.payload
|
|
19584
|
+
lastName: action.payload,
|
|
19585
|
+
lastNameError: null
|
|
19586
|
+
});
|
|
19587
|
+
|
|
19588
|
+
case SET_LAST_NAME_ERROR:
|
|
19589
|
+
return lib_7({ ...state,
|
|
19590
|
+
lastNameError: action.payload,
|
|
19591
|
+
lastName: ""
|
|
19252
19592
|
});
|
|
19253
19593
|
|
|
19254
19594
|
case SET_PHONE:
|
|
19255
19595
|
return lib_7({ ...state,
|
|
19256
|
-
phone: action.payload
|
|
19596
|
+
phone: action.payload,
|
|
19597
|
+
phoneError: null
|
|
19598
|
+
});
|
|
19599
|
+
|
|
19600
|
+
case SET_PHONE_ERROR:
|
|
19601
|
+
return lib_7({ ...state,
|
|
19602
|
+
phoneError: action.payload,
|
|
19603
|
+
phone: ""
|
|
19257
19604
|
});
|
|
19258
19605
|
|
|
19259
19606
|
case SHOW_ALERT:
|
|
@@ -19359,16 +19706,30 @@ const UserUpdateButton = ({
|
|
|
19359
19706
|
onClick,
|
|
19360
19707
|
...otherProps
|
|
19361
19708
|
}) => {
|
|
19709
|
+
var _window$Pelcro$site$r;
|
|
19710
|
+
|
|
19362
19711
|
const {
|
|
19363
19712
|
state: {
|
|
19364
19713
|
buttonDisabled,
|
|
19365
|
-
|
|
19714
|
+
email,
|
|
19715
|
+
firstName,
|
|
19716
|
+
lastName,
|
|
19717
|
+
phone,
|
|
19718
|
+
emailError,
|
|
19719
|
+
firstNameError,
|
|
19720
|
+
lastNameError,
|
|
19721
|
+
phoneError
|
|
19366
19722
|
},
|
|
19367
19723
|
dispatch
|
|
19368
19724
|
} = React.useContext(store$f);
|
|
19725
|
+
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);
|
|
19369
19726
|
const {
|
|
19370
19727
|
t
|
|
19371
19728
|
} = useTranslation("userEdit");
|
|
19729
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
19730
|
+
React.useEffect(() => {
|
|
19731
|
+
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));
|
|
19732
|
+
}, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
|
|
19372
19733
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
19373
19734
|
onClick: () => {
|
|
19374
19735
|
dispatch({
|
|
@@ -19376,7 +19737,7 @@ const UserUpdateButton = ({
|
|
|
19376
19737
|
});
|
|
19377
19738
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
19378
19739
|
},
|
|
19379
|
-
disabled:
|
|
19740
|
+
disabled: isDisabled,
|
|
19380
19741
|
isLoading: buttonDisabled && !emailError
|
|
19381
19742
|
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
19382
19743
|
};
|
|
@@ -19389,31 +19750,6 @@ const UserUpdateLastName = props => /*#__PURE__*/React__default['default'].creat
|
|
|
19389
19750
|
store: store$f
|
|
19390
19751
|
}, props));
|
|
19391
19752
|
|
|
19392
|
-
function Phone({
|
|
19393
|
-
store,
|
|
19394
|
-
...otherProps
|
|
19395
|
-
}) {
|
|
19396
|
-
const {
|
|
19397
|
-
dispatch,
|
|
19398
|
-
state: {
|
|
19399
|
-
phone
|
|
19400
|
-
}
|
|
19401
|
-
} = React.useContext(store);
|
|
19402
|
-
|
|
19403
|
-
const handleInputChange = value => {
|
|
19404
|
-
dispatch({
|
|
19405
|
-
type: SET_PHONE,
|
|
19406
|
-
payload: value
|
|
19407
|
-
});
|
|
19408
|
-
};
|
|
19409
|
-
|
|
19410
|
-
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
19411
|
-
type: "tel",
|
|
19412
|
-
value: phone,
|
|
19413
|
-
onChange: e => handleInputChange(e.target.value)
|
|
19414
|
-
}, otherProps));
|
|
19415
|
-
}
|
|
19416
|
-
|
|
19417
19753
|
const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
|
|
19418
19754
|
store: store$f
|
|
19419
19755
|
}, props));
|
|
@@ -19446,9 +19782,12 @@ const UserUpdateProfilePic = ({
|
|
|
19446
19782
|
};
|
|
19447
19783
|
|
|
19448
19784
|
const UserUpdateView = props => {
|
|
19785
|
+
var _window$Pelcro$site$r;
|
|
19786
|
+
|
|
19449
19787
|
const {
|
|
19450
19788
|
t
|
|
19451
19789
|
} = useTranslation("userEdit");
|
|
19790
|
+
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);
|
|
19452
19791
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19453
19792
|
id: "pelcro-user-update-view"
|
|
19454
19793
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -19467,19 +19806,22 @@ const UserUpdateView = props => {
|
|
|
19467
19806
|
id: "pelcro-input-first-name",
|
|
19468
19807
|
errorId: "pelcro-input-first-name-error",
|
|
19469
19808
|
label: t("labels.firstName"),
|
|
19470
|
-
autoFocus: true
|
|
19809
|
+
autoFocus: true,
|
|
19810
|
+
required: supportsTap ? true : false
|
|
19471
19811
|
}), /*#__PURE__*/React__default['default'].createElement(UserUpdateLastName, {
|
|
19472
19812
|
wrapperClassName: "plc-ml-3",
|
|
19473
19813
|
autoComplete: "last-name",
|
|
19474
19814
|
id: "pelcro-input-last-name",
|
|
19475
19815
|
errorId: "pelcro-input-last-name-error",
|
|
19476
|
-
label: t("labels.lastName")
|
|
19816
|
+
label: t("labels.lastName"),
|
|
19817
|
+
required: supportsTap ? true : false
|
|
19477
19818
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19478
19819
|
className: "plc-flex plc-items-start"
|
|
19479
19820
|
}, /*#__PURE__*/React__default['default'].createElement(UserUpdatePhone, {
|
|
19480
19821
|
id: "pelcro-input-phone",
|
|
19481
19822
|
errorId: "pelcro-input-phone-error",
|
|
19482
|
-
label: t("labels.phone")
|
|
19823
|
+
label: t("labels.phone"),
|
|
19824
|
+
required: supportsTap ? true : false
|
|
19483
19825
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
19484
19826
|
role: "submit",
|
|
19485
19827
|
className: "plc-w-full plc-mt-2",
|
|
@@ -22784,10 +23126,12 @@ const GiftCreateEmail = props => /*#__PURE__*/React__default['default'].createEl
|
|
|
22784
23126
|
}, props));
|
|
22785
23127
|
|
|
22786
23128
|
const GiftCreateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
23129
|
+
initWithUserFirstName: false,
|
|
22787
23130
|
store: store$7
|
|
22788
23131
|
}, props));
|
|
22789
23132
|
|
|
22790
23133
|
const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
23134
|
+
initWithUserLastName: false,
|
|
22791
23135
|
store: store$7
|
|
22792
23136
|
}, props));
|
|
22793
23137
|
|
|
@@ -30554,6 +30898,9 @@ exports.GiftRedeemModal = GiftRedeemModal;
|
|
|
30554
30898
|
exports.GiftRedeemSubmitButton = GiftRedeemSubmitButton;
|
|
30555
30899
|
exports.GiftRedeemView = GiftRedeemView;
|
|
30556
30900
|
exports.GoogleLoginButton = GoogleLoginButton;
|
|
30901
|
+
exports.IncludeFirstName = IncludeFirstName;
|
|
30902
|
+
exports.IncludeLastName = IncludeLastName;
|
|
30903
|
+
exports.IncludePhone = IncludePhone;
|
|
30557
30904
|
exports.Input = Input;
|
|
30558
30905
|
exports.InvoiceDetailsContainer = InvoiceDetailsContainer;
|
|
30559
30906
|
exports.InvoiceDetailsDownloadButton = InvoiceDetailsDownloadButton;
|