@pelcro/react-pelcro-js 3.13.0-beta.4 → 3.13.0-beta.6
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 +105 -6
- package/dist/index.esm.js +104 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3243,7 +3243,9 @@ function withTranslation(ns) {
|
|
|
3243
3243
|
|
|
3244
3244
|
var validation$2 = {
|
|
3245
3245
|
validEmail: "le courriel n’est pas valide",
|
|
3246
|
+
validUsername: "Le nom d'utilisateur n'est pas valide.",
|
|
3246
3247
|
enterEmail: "Un courriel est requis.",
|
|
3248
|
+
enterUsername: "Nom d'utilisateur est nécessaire.",
|
|
3247
3249
|
enterPassword: "Mot de passe requis.",
|
|
3248
3250
|
confirmPassword: "Confirmer le mot de passe requis.",
|
|
3249
3251
|
enterFirstName: "Le prénom est requis.",
|
|
@@ -3336,7 +3338,9 @@ var common_fr = {
|
|
|
3336
3338
|
|
|
3337
3339
|
var validation$1 = {
|
|
3338
3340
|
validEmail: "Email address is not valid.",
|
|
3341
|
+
validUsername: "User name is not valid.",
|
|
3339
3342
|
enterEmail: "Email address is required.",
|
|
3343
|
+
enterUsername: "User name is required.",
|
|
3340
3344
|
enterPassword: "Password is required.",
|
|
3341
3345
|
confirmPassword: "Confirm password is required.",
|
|
3342
3346
|
enterFirstName: "First name is required.",
|
|
@@ -3429,7 +3433,9 @@ var common_en = {
|
|
|
3429
3433
|
|
|
3430
3434
|
var validation = {
|
|
3431
3435
|
validEmail: "이메일 주소가 유효하지 않습니다.",
|
|
3436
|
+
validUsername: "사용자 이름이 유효하지 않습니다.",
|
|
3432
3437
|
enterEmail: "이메일 주소는 필수 항목입니다.",
|
|
3438
|
+
enterUsername: "사용자 이름이 필요합니다.",
|
|
3433
3439
|
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
3434
3440
|
enterFirstName: "이름은 필수 항목입니다.",
|
|
3435
3441
|
enterLastName: "성은 필수 항목입니다.",
|
|
@@ -3959,6 +3965,7 @@ var messages_ko = {
|
|
|
3959
3965
|
|
|
3960
3966
|
var labels$C = {
|
|
3961
3967
|
email: "Enter email",
|
|
3968
|
+
username: "Enter username",
|
|
3962
3969
|
password: "Enter password",
|
|
3963
3970
|
required: "required",
|
|
3964
3971
|
emailPlaceholder: "Email",
|
|
@@ -3991,6 +3998,7 @@ var login_en = {
|
|
|
3991
3998
|
|
|
3992
3999
|
var labels$B = {
|
|
3993
4000
|
email: "Entrez votre adresse courriel",
|
|
4001
|
+
username: "Saisissez votre nom d'utilisateur",
|
|
3994
4002
|
password: "Entrez votre mot de passe",
|
|
3995
4003
|
required: "Champs obligatoires",
|
|
3996
4004
|
emailPlaceholder: "Adresse courriel",
|
|
@@ -4023,6 +4031,7 @@ var login_fr = {
|
|
|
4023
4031
|
|
|
4024
4032
|
var labels$A = {
|
|
4025
4033
|
email: "이메일 입력",
|
|
4034
|
+
username: "사용자 이름 입력",
|
|
4026
4035
|
password: "비밀번호 입력",
|
|
4027
4036
|
required: "필수 항목",
|
|
4028
4037
|
emailPlaceholder: "이메일",
|
|
@@ -10845,8 +10854,10 @@ var lib_7 = lib$1.Update;
|
|
|
10845
10854
|
lib$1.NO_UPDATE_SYMBOL;
|
|
10846
10855
|
|
|
10847
10856
|
const SET_EMAIL = "SET_EMAIL";
|
|
10857
|
+
const SET_USERNAME = "SET_USERNAME";
|
|
10848
10858
|
const SET_PASSWORD = "SET_PASSWORD";
|
|
10849
10859
|
const SET_EMAIL_ERROR = "SET_EMAIL_ERROR";
|
|
10860
|
+
const SET_USERNAME_ERROR = "SET_USERNAME_ERROR";
|
|
10850
10861
|
const SET_PASSWORD_ERROR = "SET_PASSWORD_ERROR";
|
|
10851
10862
|
const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
10852
10863
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
@@ -10929,8 +10940,10 @@ const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
|
10929
10940
|
|
|
10930
10941
|
const initialState$l = {
|
|
10931
10942
|
email: "",
|
|
10943
|
+
username: "",
|
|
10932
10944
|
password: "",
|
|
10933
10945
|
emailError: null,
|
|
10946
|
+
usernameError: null,
|
|
10934
10947
|
passwordError: null,
|
|
10935
10948
|
buttonDisabled: false,
|
|
10936
10949
|
alert: {
|
|
@@ -10952,10 +10965,15 @@ const LoginContainer = ({
|
|
|
10952
10965
|
}) => {
|
|
10953
10966
|
const handleLogin = ({
|
|
10954
10967
|
email,
|
|
10968
|
+
username,
|
|
10955
10969
|
password
|
|
10956
10970
|
}, dispatch) => {
|
|
10957
|
-
window.Pelcro.user.login({
|
|
10958
|
-
|
|
10971
|
+
window.Pelcro.user.login({ ...(email && {
|
|
10972
|
+
email
|
|
10973
|
+
}),
|
|
10974
|
+
...(username && {
|
|
10975
|
+
username
|
|
10976
|
+
}),
|
|
10959
10977
|
password
|
|
10960
10978
|
}, (err, res) => {
|
|
10961
10979
|
dispatch({
|
|
@@ -11024,6 +11042,12 @@ const LoginContainer = ({
|
|
|
11024
11042
|
emailError: null
|
|
11025
11043
|
});
|
|
11026
11044
|
|
|
11045
|
+
case SET_USERNAME:
|
|
11046
|
+
return lib_7({ ...state,
|
|
11047
|
+
username: action.payload,
|
|
11048
|
+
usernameError: null
|
|
11049
|
+
});
|
|
11050
|
+
|
|
11027
11051
|
case SET_PASSWORD:
|
|
11028
11052
|
return lib_7({ ...state,
|
|
11029
11053
|
password: action.payload,
|
|
@@ -11036,6 +11060,12 @@ const LoginContainer = ({
|
|
|
11036
11060
|
email: ""
|
|
11037
11061
|
});
|
|
11038
11062
|
|
|
11063
|
+
case SET_USERNAME_ERROR:
|
|
11064
|
+
return lib_7({ ...state,
|
|
11065
|
+
usernameError: action.payload,
|
|
11066
|
+
username: ""
|
|
11067
|
+
});
|
|
11068
|
+
|
|
11039
11069
|
case SET_PASSWORD_ERROR:
|
|
11040
11070
|
return lib_7({ ...state,
|
|
11041
11071
|
passwordError: action.payload,
|
|
@@ -11212,6 +11242,52 @@ function Email({
|
|
|
11212
11242
|
}, otherProps));
|
|
11213
11243
|
}
|
|
11214
11244
|
|
|
11245
|
+
function UserNameInput({
|
|
11246
|
+
initWithUserName = true,
|
|
11247
|
+
store,
|
|
11248
|
+
enableUsernameEdit,
|
|
11249
|
+
...otherProps
|
|
11250
|
+
}) {
|
|
11251
|
+
const {
|
|
11252
|
+
t
|
|
11253
|
+
} = useTranslation("common");
|
|
11254
|
+
const {
|
|
11255
|
+
dispatch,
|
|
11256
|
+
state: {
|
|
11257
|
+
username: stateUsername,
|
|
11258
|
+
usernameError
|
|
11259
|
+
}
|
|
11260
|
+
} = React.useContext(store);
|
|
11261
|
+
const [username, setUsername] = React.useState(stateUsername);
|
|
11262
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
11263
|
+
const handleInputChange = React.useCallback(value => {
|
|
11264
|
+
setUsername(value);
|
|
11265
|
+
|
|
11266
|
+
if (username !== null && username !== void 0 && username.length) {
|
|
11267
|
+
dispatch({
|
|
11268
|
+
type: SET_USERNAME,
|
|
11269
|
+
payload: username
|
|
11270
|
+
});
|
|
11271
|
+
} else if (finishedTyping) {
|
|
11272
|
+
dispatch({
|
|
11273
|
+
type: SET_USERNAME_ERROR,
|
|
11274
|
+
payload: t("validation.enterUsername")
|
|
11275
|
+
});
|
|
11276
|
+
}
|
|
11277
|
+
}, [dispatch, username, finishedTyping]);
|
|
11278
|
+
React.useEffect(() => {
|
|
11279
|
+
handleInputChange(username);
|
|
11280
|
+
}, [finishedTyping, username, handleInputChange]);
|
|
11281
|
+
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
11282
|
+
type: "text",
|
|
11283
|
+
error: usernameError,
|
|
11284
|
+
value: username !== null && username !== void 0 ? username : "",
|
|
11285
|
+
onChange: e => handleInputChange(e.target.value),
|
|
11286
|
+
onBlur: () => setFinishedTyping(true),
|
|
11287
|
+
onFocus: () => setFinishedTyping(false)
|
|
11288
|
+
}, otherProps));
|
|
11289
|
+
}
|
|
11290
|
+
|
|
11215
11291
|
function Password({
|
|
11216
11292
|
store,
|
|
11217
11293
|
...otherProps
|
|
@@ -11337,8 +11413,10 @@ const LoginButton = ({
|
|
|
11337
11413
|
state: {
|
|
11338
11414
|
emailError,
|
|
11339
11415
|
passwordError,
|
|
11416
|
+
usernameError,
|
|
11340
11417
|
email,
|
|
11341
11418
|
password,
|
|
11419
|
+
username,
|
|
11342
11420
|
buttonDisabled
|
|
11343
11421
|
},
|
|
11344
11422
|
dispatch
|
|
@@ -11348,8 +11426,8 @@ const LoginButton = ({
|
|
|
11348
11426
|
} = useTranslation("login");
|
|
11349
11427
|
const [isDisabled, setDisabled] = React.useState(true);
|
|
11350
11428
|
React.useEffect(() => {
|
|
11351
|
-
setDisabled(emailError || passwordError || !email.length || !password.length || buttonDisabled);
|
|
11352
|
-
}, [emailError, passwordError, email, password, buttonDisabled]);
|
|
11429
|
+
setDisabled(emailError || passwordError || usernameError || (!email.length || !username.length) && !password.length || buttonDisabled);
|
|
11430
|
+
}, [emailError, passwordError, usernameError, email, password, username, buttonDisabled]);
|
|
11353
11431
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
11354
11432
|
onClick: () => {
|
|
11355
11433
|
dispatch({
|
|
@@ -11403,6 +11481,10 @@ const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement
|
|
|
11403
11481
|
store: store$l
|
|
11404
11482
|
}, props));
|
|
11405
11483
|
|
|
11484
|
+
const LoginUsername = props => /*#__PURE__*/React__default['default'].createElement(UserNameInput, Object.assign({
|
|
11485
|
+
store: store$l
|
|
11486
|
+
}, props));
|
|
11487
|
+
|
|
11406
11488
|
const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
11407
11489
|
store: store$l
|
|
11408
11490
|
}, props));
|
|
@@ -11566,6 +11648,14 @@ const RegisterContainer = ({
|
|
|
11566
11648
|
});
|
|
11567
11649
|
|
|
11568
11650
|
if (err) {
|
|
11651
|
+
var _err$response, _err$response$data;
|
|
11652
|
+
|
|
11653
|
+
let {
|
|
11654
|
+
registered_on_other_sites,
|
|
11655
|
+
...errors
|
|
11656
|
+
} = err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.errors;
|
|
11657
|
+
err.response.data.errors = { ...errors
|
|
11658
|
+
};
|
|
11569
11659
|
dispatch({
|
|
11570
11660
|
type: SHOW_ALERT,
|
|
11571
11661
|
payload: {
|
|
@@ -12163,13 +12253,14 @@ const Auth0LoginButton = ({
|
|
|
12163
12253
|
*/
|
|
12164
12254
|
|
|
12165
12255
|
function LoginView(props) {
|
|
12166
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
|
|
12256
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12167
12257
|
|
|
12168
12258
|
const {
|
|
12169
12259
|
t
|
|
12170
12260
|
} = useTranslation("login");
|
|
12171
12261
|
const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
|
|
12172
12262
|
const passwordlessEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.passwordless_enabled;
|
|
12263
|
+
const enableLoginWithUsername = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableLoginWithUsername;
|
|
12173
12264
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
12174
12265
|
id: "pelcro-login-view"
|
|
12175
12266
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -12177,7 +12268,13 @@ function LoginView(props) {
|
|
|
12177
12268
|
}, /*#__PURE__*/React__default['default'].createElement("h4", null, t("messages.loginTo"))), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
12178
12269
|
action: "javascript:void(0);",
|
|
12179
12270
|
className: "plc-mt-2 pelcro-form"
|
|
12180
|
-
}, /*#__PURE__*/React__default['default'].createElement(LoginContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement(
|
|
12271
|
+
}, /*#__PURE__*/React__default['default'].createElement(LoginContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), enableLoginWithUsername ? /*#__PURE__*/React__default['default'].createElement(LoginUsername, {
|
|
12272
|
+
id: "pelcro-input-username",
|
|
12273
|
+
errorId: "pelcro-input-username-error",
|
|
12274
|
+
required: true,
|
|
12275
|
+
label: t("labels.username"),
|
|
12276
|
+
autoFocus: true
|
|
12277
|
+
}) : /*#__PURE__*/React__default['default'].createElement(LoginEmail, {
|
|
12181
12278
|
id: "pelcro-input-email",
|
|
12182
12279
|
errorId: "pelcro-input-email-error",
|
|
12183
12280
|
required: true,
|
|
@@ -31187,6 +31284,7 @@ exports.LoginEmail = LoginEmail;
|
|
|
31187
31284
|
exports.LoginModal = LoginModal;
|
|
31188
31285
|
exports.LoginPassword = LoginPassword;
|
|
31189
31286
|
exports.LoginRequestLoginToken = LoginRequestLoginToken;
|
|
31287
|
+
exports.LoginUsername = LoginUsername;
|
|
31190
31288
|
exports.LoginView = LoginView;
|
|
31191
31289
|
exports.Logout = Logout;
|
|
31192
31290
|
exports.MeterModal = MeterModal;
|
|
@@ -31293,6 +31391,7 @@ exports.SubscriptionSuspendView = SubscriptionSuspendView;
|
|
|
31293
31391
|
exports.TaxAmount = TaxAmount;
|
|
31294
31392
|
exports.TextArea = TextArea;
|
|
31295
31393
|
exports.Tooltip = Tooltip;
|
|
31394
|
+
exports.UserNameInput = UserNameInput;
|
|
31296
31395
|
exports.UserUpdateButton = UserUpdateButton;
|
|
31297
31396
|
exports.UserUpdateContainer = UserUpdateContainer;
|
|
31298
31397
|
exports.UserUpdateDisplayName = UserUpdateDisplayName;
|
package/dist/index.esm.js
CHANGED
|
@@ -3213,7 +3213,9 @@ function withTranslation(ns) {
|
|
|
3213
3213
|
|
|
3214
3214
|
var validation$2 = {
|
|
3215
3215
|
validEmail: "le courriel n’est pas valide",
|
|
3216
|
+
validUsername: "Le nom d'utilisateur n'est pas valide.",
|
|
3216
3217
|
enterEmail: "Un courriel est requis.",
|
|
3218
|
+
enterUsername: "Nom d'utilisateur est nécessaire.",
|
|
3217
3219
|
enterPassword: "Mot de passe requis.",
|
|
3218
3220
|
confirmPassword: "Confirmer le mot de passe requis.",
|
|
3219
3221
|
enterFirstName: "Le prénom est requis.",
|
|
@@ -3306,7 +3308,9 @@ var common_fr = {
|
|
|
3306
3308
|
|
|
3307
3309
|
var validation$1 = {
|
|
3308
3310
|
validEmail: "Email address is not valid.",
|
|
3311
|
+
validUsername: "User name is not valid.",
|
|
3309
3312
|
enterEmail: "Email address is required.",
|
|
3313
|
+
enterUsername: "User name is required.",
|
|
3310
3314
|
enterPassword: "Password is required.",
|
|
3311
3315
|
confirmPassword: "Confirm password is required.",
|
|
3312
3316
|
enterFirstName: "First name is required.",
|
|
@@ -3399,7 +3403,9 @@ var common_en = {
|
|
|
3399
3403
|
|
|
3400
3404
|
var validation = {
|
|
3401
3405
|
validEmail: "이메일 주소가 유효하지 않습니다.",
|
|
3406
|
+
validUsername: "사용자 이름이 유효하지 않습니다.",
|
|
3402
3407
|
enterEmail: "이메일 주소는 필수 항목입니다.",
|
|
3408
|
+
enterUsername: "사용자 이름이 필요합니다.",
|
|
3403
3409
|
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
3404
3410
|
enterFirstName: "이름은 필수 항목입니다.",
|
|
3405
3411
|
enterLastName: "성은 필수 항목입니다.",
|
|
@@ -3929,6 +3935,7 @@ var messages_ko = {
|
|
|
3929
3935
|
|
|
3930
3936
|
var labels$C = {
|
|
3931
3937
|
email: "Enter email",
|
|
3938
|
+
username: "Enter username",
|
|
3932
3939
|
password: "Enter password",
|
|
3933
3940
|
required: "required",
|
|
3934
3941
|
emailPlaceholder: "Email",
|
|
@@ -3961,6 +3968,7 @@ var login_en = {
|
|
|
3961
3968
|
|
|
3962
3969
|
var labels$B = {
|
|
3963
3970
|
email: "Entrez votre adresse courriel",
|
|
3971
|
+
username: "Saisissez votre nom d'utilisateur",
|
|
3964
3972
|
password: "Entrez votre mot de passe",
|
|
3965
3973
|
required: "Champs obligatoires",
|
|
3966
3974
|
emailPlaceholder: "Adresse courriel",
|
|
@@ -3993,6 +4001,7 @@ var login_fr = {
|
|
|
3993
4001
|
|
|
3994
4002
|
var labels$A = {
|
|
3995
4003
|
email: "이메일 입력",
|
|
4004
|
+
username: "사용자 이름 입력",
|
|
3996
4005
|
password: "비밀번호 입력",
|
|
3997
4006
|
required: "필수 항목",
|
|
3998
4007
|
emailPlaceholder: "이메일",
|
|
@@ -10815,8 +10824,10 @@ var lib_7 = lib$1.Update;
|
|
|
10815
10824
|
lib$1.NO_UPDATE_SYMBOL;
|
|
10816
10825
|
|
|
10817
10826
|
const SET_EMAIL = "SET_EMAIL";
|
|
10827
|
+
const SET_USERNAME = "SET_USERNAME";
|
|
10818
10828
|
const SET_PASSWORD = "SET_PASSWORD";
|
|
10819
10829
|
const SET_EMAIL_ERROR = "SET_EMAIL_ERROR";
|
|
10830
|
+
const SET_USERNAME_ERROR = "SET_USERNAME_ERROR";
|
|
10820
10831
|
const SET_PASSWORD_ERROR = "SET_PASSWORD_ERROR";
|
|
10821
10832
|
const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
10822
10833
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
@@ -10899,8 +10910,10 @@ const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
|
10899
10910
|
|
|
10900
10911
|
const initialState$l = {
|
|
10901
10912
|
email: "",
|
|
10913
|
+
username: "",
|
|
10902
10914
|
password: "",
|
|
10903
10915
|
emailError: null,
|
|
10916
|
+
usernameError: null,
|
|
10904
10917
|
passwordError: null,
|
|
10905
10918
|
buttonDisabled: false,
|
|
10906
10919
|
alert: {
|
|
@@ -10922,10 +10935,15 @@ const LoginContainer = ({
|
|
|
10922
10935
|
}) => {
|
|
10923
10936
|
const handleLogin = ({
|
|
10924
10937
|
email,
|
|
10938
|
+
username,
|
|
10925
10939
|
password
|
|
10926
10940
|
}, dispatch) => {
|
|
10927
|
-
window.Pelcro.user.login({
|
|
10928
|
-
|
|
10941
|
+
window.Pelcro.user.login({ ...(email && {
|
|
10942
|
+
email
|
|
10943
|
+
}),
|
|
10944
|
+
...(username && {
|
|
10945
|
+
username
|
|
10946
|
+
}),
|
|
10929
10947
|
password
|
|
10930
10948
|
}, (err, res) => {
|
|
10931
10949
|
dispatch({
|
|
@@ -10994,6 +11012,12 @@ const LoginContainer = ({
|
|
|
10994
11012
|
emailError: null
|
|
10995
11013
|
});
|
|
10996
11014
|
|
|
11015
|
+
case SET_USERNAME:
|
|
11016
|
+
return lib_7({ ...state,
|
|
11017
|
+
username: action.payload,
|
|
11018
|
+
usernameError: null
|
|
11019
|
+
});
|
|
11020
|
+
|
|
10997
11021
|
case SET_PASSWORD:
|
|
10998
11022
|
return lib_7({ ...state,
|
|
10999
11023
|
password: action.payload,
|
|
@@ -11006,6 +11030,12 @@ const LoginContainer = ({
|
|
|
11006
11030
|
email: ""
|
|
11007
11031
|
});
|
|
11008
11032
|
|
|
11033
|
+
case SET_USERNAME_ERROR:
|
|
11034
|
+
return lib_7({ ...state,
|
|
11035
|
+
usernameError: action.payload,
|
|
11036
|
+
username: ""
|
|
11037
|
+
});
|
|
11038
|
+
|
|
11009
11039
|
case SET_PASSWORD_ERROR:
|
|
11010
11040
|
return lib_7({ ...state,
|
|
11011
11041
|
passwordError: action.payload,
|
|
@@ -11182,6 +11212,52 @@ function Email({
|
|
|
11182
11212
|
}, otherProps));
|
|
11183
11213
|
}
|
|
11184
11214
|
|
|
11215
|
+
function UserNameInput({
|
|
11216
|
+
initWithUserName = true,
|
|
11217
|
+
store,
|
|
11218
|
+
enableUsernameEdit,
|
|
11219
|
+
...otherProps
|
|
11220
|
+
}) {
|
|
11221
|
+
const {
|
|
11222
|
+
t
|
|
11223
|
+
} = useTranslation("common");
|
|
11224
|
+
const {
|
|
11225
|
+
dispatch,
|
|
11226
|
+
state: {
|
|
11227
|
+
username: stateUsername,
|
|
11228
|
+
usernameError
|
|
11229
|
+
}
|
|
11230
|
+
} = useContext(store);
|
|
11231
|
+
const [username, setUsername] = useState(stateUsername);
|
|
11232
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
11233
|
+
const handleInputChange = useCallback(value => {
|
|
11234
|
+
setUsername(value);
|
|
11235
|
+
|
|
11236
|
+
if (username !== null && username !== void 0 && username.length) {
|
|
11237
|
+
dispatch({
|
|
11238
|
+
type: SET_USERNAME,
|
|
11239
|
+
payload: username
|
|
11240
|
+
});
|
|
11241
|
+
} else if (finishedTyping) {
|
|
11242
|
+
dispatch({
|
|
11243
|
+
type: SET_USERNAME_ERROR,
|
|
11244
|
+
payload: t("validation.enterUsername")
|
|
11245
|
+
});
|
|
11246
|
+
}
|
|
11247
|
+
}, [dispatch, username, finishedTyping]);
|
|
11248
|
+
useEffect(() => {
|
|
11249
|
+
handleInputChange(username);
|
|
11250
|
+
}, [finishedTyping, username, handleInputChange]);
|
|
11251
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
11252
|
+
type: "text",
|
|
11253
|
+
error: usernameError,
|
|
11254
|
+
value: username !== null && username !== void 0 ? username : "",
|
|
11255
|
+
onChange: e => handleInputChange(e.target.value),
|
|
11256
|
+
onBlur: () => setFinishedTyping(true),
|
|
11257
|
+
onFocus: () => setFinishedTyping(false)
|
|
11258
|
+
}, otherProps));
|
|
11259
|
+
}
|
|
11260
|
+
|
|
11185
11261
|
function Password({
|
|
11186
11262
|
store,
|
|
11187
11263
|
...otherProps
|
|
@@ -11307,8 +11383,10 @@ const LoginButton = ({
|
|
|
11307
11383
|
state: {
|
|
11308
11384
|
emailError,
|
|
11309
11385
|
passwordError,
|
|
11386
|
+
usernameError,
|
|
11310
11387
|
email,
|
|
11311
11388
|
password,
|
|
11389
|
+
username,
|
|
11312
11390
|
buttonDisabled
|
|
11313
11391
|
},
|
|
11314
11392
|
dispatch
|
|
@@ -11318,8 +11396,8 @@ const LoginButton = ({
|
|
|
11318
11396
|
} = useTranslation("login");
|
|
11319
11397
|
const [isDisabled, setDisabled] = useState(true);
|
|
11320
11398
|
useEffect(() => {
|
|
11321
|
-
setDisabled(emailError || passwordError || !email.length || !password.length || buttonDisabled);
|
|
11322
|
-
}, [emailError, passwordError, email, password, buttonDisabled]);
|
|
11399
|
+
setDisabled(emailError || passwordError || usernameError || (!email.length || !username.length) && !password.length || buttonDisabled);
|
|
11400
|
+
}, [emailError, passwordError, usernameError, email, password, username, buttonDisabled]);
|
|
11323
11401
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
11324
11402
|
onClick: () => {
|
|
11325
11403
|
dispatch({
|
|
@@ -11373,6 +11451,10 @@ const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Obj
|
|
|
11373
11451
|
store: store$l
|
|
11374
11452
|
}, props));
|
|
11375
11453
|
|
|
11454
|
+
const LoginUsername = props => /*#__PURE__*/React__default.createElement(UserNameInput, Object.assign({
|
|
11455
|
+
store: store$l
|
|
11456
|
+
}, props));
|
|
11457
|
+
|
|
11376
11458
|
const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
|
|
11377
11459
|
store: store$l
|
|
11378
11460
|
}, props));
|
|
@@ -11536,6 +11618,14 @@ const RegisterContainer = ({
|
|
|
11536
11618
|
});
|
|
11537
11619
|
|
|
11538
11620
|
if (err) {
|
|
11621
|
+
var _err$response, _err$response$data;
|
|
11622
|
+
|
|
11623
|
+
let {
|
|
11624
|
+
registered_on_other_sites,
|
|
11625
|
+
...errors
|
|
11626
|
+
} = err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.errors;
|
|
11627
|
+
err.response.data.errors = { ...errors
|
|
11628
|
+
};
|
|
11539
11629
|
dispatch({
|
|
11540
11630
|
type: SHOW_ALERT,
|
|
11541
11631
|
payload: {
|
|
@@ -12133,13 +12223,14 @@ const Auth0LoginButton = ({
|
|
|
12133
12223
|
*/
|
|
12134
12224
|
|
|
12135
12225
|
function LoginView(props) {
|
|
12136
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
|
|
12226
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12137
12227
|
|
|
12138
12228
|
const {
|
|
12139
12229
|
t
|
|
12140
12230
|
} = useTranslation("login");
|
|
12141
12231
|
const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
|
|
12142
12232
|
const passwordlessEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.passwordless_enabled;
|
|
12233
|
+
const enableLoginWithUsername = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableLoginWithUsername;
|
|
12143
12234
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
12144
12235
|
id: "pelcro-login-view"
|
|
12145
12236
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -12147,7 +12238,13 @@ function LoginView(props) {
|
|
|
12147
12238
|
}, /*#__PURE__*/React__default.createElement("h4", null, t("messages.loginTo"))), /*#__PURE__*/React__default.createElement("form", {
|
|
12148
12239
|
action: "javascript:void(0);",
|
|
12149
12240
|
className: "plc-mt-2 pelcro-form"
|
|
12150
|
-
}, /*#__PURE__*/React__default.createElement(LoginContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(
|
|
12241
|
+
}, /*#__PURE__*/React__default.createElement(LoginContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), enableLoginWithUsername ? /*#__PURE__*/React__default.createElement(LoginUsername, {
|
|
12242
|
+
id: "pelcro-input-username",
|
|
12243
|
+
errorId: "pelcro-input-username-error",
|
|
12244
|
+
required: true,
|
|
12245
|
+
label: t("labels.username"),
|
|
12246
|
+
autoFocus: true
|
|
12247
|
+
}) : /*#__PURE__*/React__default.createElement(LoginEmail, {
|
|
12151
12248
|
id: "pelcro-input-email",
|
|
12152
12249
|
errorId: "pelcro-input-email-error",
|
|
12153
12250
|
required: true,
|
|
@@ -31061,4 +31158,4 @@ const QrCodeModal = ({
|
|
|
31061
31158
|
};
|
|
31062
31159
|
QrCodeModal.viewId = "qrcode";
|
|
31063
31160
|
|
|
31064
|
-
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, BankAuthenticationSuccess, 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, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|
|
31161
|
+
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, BankAuthenticationSuccess, 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, LoginUsername, 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, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|