@pelcro/react-pelcro-js 3.8.1 → 3.9.0-beta.2

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.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: "내 계정",
@@ -4053,7 +4062,8 @@ var labels$w = {
4053
4062
  emailPlaceholder: "Enter email",
4054
4063
  required: "required",
4055
4064
  firstName: "First name",
4056
- lastName: "Last name"
4065
+ lastName: "Last name",
4066
+ phone: "Phone"
4057
4067
  };
4058
4068
  var messages$z = {
4059
4069
  alreadyHaveAccount: "Already have an account?",
@@ -4148,7 +4158,8 @@ var labels$v = {
4148
4158
  emailPlaceholder: "Courriel",
4149
4159
  required: "Champs obligatoires",
4150
4160
  firstName: "Prénom",
4151
- lastName: "Nom de famille"
4161
+ lastName: "Nom de famille",
4162
+ phone: "Téléphoner"
4152
4163
  };
4153
4164
  var messages$y = {
4154
4165
  alreadyHaveAccount: "Vous avez déjà un compte?",
@@ -4244,7 +4255,8 @@ var labels$u = {
4244
4255
  emailPlaceholder: "이메일 입력",
4245
4256
  required: "필수 항목",
4246
4257
  firstName: "이름",
4247
- lastName: "성"
4258
+ lastName: "성",
4259
+ phone: "핸드폰"
4248
4260
  };
4249
4261
  var messages$x = {
4250
4262
  alreadyHaveAccount: "이미 계정이 있습니까?",
@@ -10778,6 +10790,9 @@ const SET_EMAIL = "SET_EMAIL";
10778
10790
  const SET_PASSWORD = "SET_PASSWORD";
10779
10791
  const SET_EMAIL_ERROR = "SET_EMAIL_ERROR";
10780
10792
  const SET_PASSWORD_ERROR = "SET_PASSWORD_ERROR";
10793
+ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
10794
+ const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
10795
+ const SET_PHONE_ERROR = "SET_PHONE_ERROR";
10781
10796
  const SET_TEXT_FIELD = "SET_TEXT_FIELD";
10782
10797
  const SET_TOKEN = "SET_TOKEN";
10783
10798
  const SET_GIFT_CODE = "SET_GIFT_CODE";
@@ -11410,14 +11425,18 @@ facebookLoginRenderProps.FacebookLogin;
11410
11425
  const initialState$k = {
11411
11426
  email: "",
11412
11427
  password: "",
11428
+ firstName: "",
11429
+ lastName: "",
11430
+ phone: "",
11413
11431
  emailError: null,
11414
11432
  passwordError: null,
11415
11433
  confirmPassword: "",
11416
11434
  confirmPasswordError: null,
11417
11435
  confirmPasswordUsed: false,
11418
11436
  buttonDisabled: false,
11419
- firstName: null,
11420
- lastName: null,
11437
+ firstNameError: null,
11438
+ lastNameError: null,
11439
+ phoneError: null,
11421
11440
  selectFields: {},
11422
11441
  alert: {
11423
11442
  type: "error",
@@ -11448,6 +11467,7 @@ const RegisterContainer = ({
11448
11467
  password,
11449
11468
  firstName,
11450
11469
  lastName,
11470
+ phone,
11451
11471
  organization,
11452
11472
  jobTitle,
11453
11473
  selectFields
@@ -11473,6 +11493,7 @@ const RegisterContainer = ({
11473
11493
  password,
11474
11494
  first_name: firstName,
11475
11495
  last_name: lastName,
11496
+ phone: phone,
11476
11497
  security_token: securityToken,
11477
11498
  metadata: {
11478
11499
  organization,
@@ -11562,12 +11583,20 @@ const RegisterContainer = ({
11562
11583
 
11563
11584
  case SET_FIRST_NAME:
11564
11585
  return lib_7({ ...state,
11565
- firstName: action.payload
11586
+ firstName: action.payload,
11587
+ firstNameError: null
11566
11588
  });
11567
11589
 
11568
11590
  case SET_LAST_NAME:
11569
11591
  return lib_7({ ...state,
11570
- lastName: action.payload
11592
+ lastName: action.payload,
11593
+ lastNameError: null
11594
+ });
11595
+
11596
+ case SET_PHONE:
11597
+ return lib_7({ ...state,
11598
+ phone: action.payload,
11599
+ phoneError: null
11571
11600
  });
11572
11601
 
11573
11602
  case SET_TEXT_FIELD:
@@ -11593,6 +11622,24 @@ const RegisterContainer = ({
11593
11622
  password: ""
11594
11623
  });
11595
11624
 
11625
+ case SET_FIRST_NAME_ERROR:
11626
+ return lib_7({ ...state,
11627
+ firstNameError: action.payload,
11628
+ firstName: ""
11629
+ });
11630
+
11631
+ case SET_LAST_NAME_ERROR:
11632
+ return lib_7({ ...state,
11633
+ lastNameError: action.payload,
11634
+ lastName: ""
11635
+ });
11636
+
11637
+ case SET_PHONE_ERROR:
11638
+ return lib_7({ ...state,
11639
+ phoneError: action.payload,
11640
+ phone: null
11641
+ });
11642
+
11596
11643
  case SET_CONFIRM_PASSWORD_ERROR:
11597
11644
  return lib_7({ ...state,
11598
11645
  confirmPasswordError: action.payload,
@@ -12200,25 +12247,32 @@ const RegisterButton = ({
12200
12247
  className,
12201
12248
  ...otherProps
12202
12249
  }) => {
12203
- var _window$Pelcro$site$r;
12250
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
12204
12251
 
12205
12252
  const {
12206
12253
  state: {
12207
12254
  emailError,
12208
12255
  passwordError,
12256
+ firstNameError,
12257
+ lastNameError,
12258
+ phoneError,
12209
12259
  email,
12210
12260
  password,
12261
+ firstName,
12262
+ lastName,
12263
+ phone,
12211
12264
  buttonDisabled
12212
12265
  },
12213
12266
  dispatch
12214
12267
  } = useContext(store$k);
12268
+ const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
12215
12269
  const {
12216
12270
  t
12217
12271
  } = useTranslation("register");
12218
12272
  const [isDisabled, setDisabled] = useState(true);
12219
12273
  useEffect(() => {
12220
- setDisabled(buttonDisabled || emailError || passwordError || !email.length || !password.length);
12221
- }, [buttonDisabled, emailError, passwordError, email, password]);
12274
+ setDisabled(buttonDisabled || emailError || passwordError || firstNameError || lastNameError || phoneError || !email.length || !password.length || supportsTap && !firstName.length || supportsTap && !lastName.length || supportsTap && !phone.length);
12275
+ }, [buttonDisabled, emailError, passwordError, firstNameError, lastNameError, phoneError, email, password, firstName, lastName, phone]);
12222
12276
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
12223
12277
  onClick: () => {
12224
12278
  dispatch({
@@ -12230,121 +12284,68 @@ const RegisterButton = ({
12230
12284
  isLoading: buttonDisabled,
12231
12285
  className: `${className} g-recaptcha`,
12232
12286
  "data-action": "register",
12233
- "data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
12287
+ "data-sitekey": (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key
12234
12288
  }, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
12235
12289
  };
12236
12290
 
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
12291
  function FirstName({
12292
+ initWithUserFirstName = true,
12325
12293
  store,
12326
12294
  ...otherProps
12327
12295
  }) {
12296
+ const {
12297
+ t
12298
+ } = useTranslation("common");
12328
12299
  const {
12329
12300
  dispatch,
12330
- state
12301
+ state: {
12302
+ firstName: stateFirstName,
12303
+ firstNameError
12304
+ }
12331
12305
  } = useContext(store);
12306
+ const [firstName, setFirstName] = useState(stateFirstName);
12307
+ const [finishedTyping, setFinishedTyping] = useState(false);
12308
+ const handleInputChange = useCallback(value => {
12309
+ setFirstName(value);
12332
12310
 
12333
- const handleInputChange = value => {
12334
- dispatch({
12335
- type: SET_FIRST_NAME,
12336
- payload: value
12337
- });
12338
- };
12311
+ if (firstName !== null && firstName !== void 0 && firstName.length) {
12312
+ dispatch({
12313
+ type: SET_FIRST_NAME,
12314
+ payload: firstName
12315
+ });
12316
+ } else if (finishedTyping && otherProps.required) {
12317
+ dispatch({
12318
+ type: SET_FIRST_NAME_ERROR,
12319
+ payload: t("validation.enterFirstName")
12320
+ });
12321
+ }
12322
+ }, [dispatch, firstName, finishedTyping]);
12323
+ useEffect(() => {
12324
+ handleInputChange(firstName);
12325
+ }, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
12339
12326
 
12340
- if (state.loading) {
12341
- return /*#__PURE__*/React__default.createElement(Loader, null);
12342
- }
12327
+ const loadFirstNameIntoField = () => {
12328
+ handleInputChange(window.Pelcro.user.read().first_name);
12329
+ };
12343
12330
 
12331
+ useEffect(() => {
12332
+ if (initWithUserFirstName) {
12333
+ document.addEventListener("PelcroUserLoaded", () => {
12334
+ loadFirstNameIntoField();
12335
+ });
12336
+ loadFirstNameIntoField();
12337
+ return () => {
12338
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12339
+ };
12340
+ }
12341
+ }, []);
12344
12342
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12345
12343
  type: "text",
12346
- value: state.firstName,
12347
- onChange: e => handleInputChange(e.target.value)
12344
+ error: firstNameError,
12345
+ value: firstName,
12346
+ onChange: e => handleInputChange(e.target.value),
12347
+ onBlur: () => setFinishedTyping(true),
12348
+ onFocus: () => setFinishedTyping(false)
12348
12349
  }, otherProps));
12349
12350
  }
12350
12351
 
@@ -12353,29 +12354,63 @@ const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(Fir
12353
12354
  }, props));
12354
12355
 
12355
12356
  function LastName({
12357
+ initWithUserLastName = true,
12356
12358
  store,
12357
12359
  ...otherProps
12358
12360
  }) {
12361
+ const {
12362
+ t
12363
+ } = useTranslation("common");
12359
12364
  const {
12360
12365
  dispatch,
12361
- state
12366
+ state: {
12367
+ lastName: stateLastName,
12368
+ lastNameError
12369
+ }
12362
12370
  } = useContext(store);
12371
+ const [lastName, setLastName] = useState(stateLastName);
12372
+ const [finishedTyping, setFinishedTyping] = useState(false);
12373
+ const handleInputChange = useCallback(value => {
12374
+ setLastName(value);
12363
12375
 
12364
- const handleInputChange = value => {
12365
- dispatch({
12366
- type: SET_LAST_NAME,
12367
- payload: value
12368
- });
12369
- };
12376
+ if (lastName !== null && lastName !== void 0 && lastName.length) {
12377
+ dispatch({
12378
+ type: SET_LAST_NAME,
12379
+ payload: lastName
12380
+ });
12381
+ } else if (finishedTyping && otherProps.required) {
12382
+ dispatch({
12383
+ type: SET_LAST_NAME_ERROR,
12384
+ payload: t("validation.enterLastName")
12385
+ });
12386
+ }
12387
+ }, [dispatch, lastName, finishedTyping]);
12388
+ useEffect(() => {
12389
+ handleInputChange(lastName);
12390
+ }, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
12370
12391
 
12371
- if (state.loading) {
12372
- return /*#__PURE__*/React__default.createElement(Loader, null);
12373
- }
12392
+ const loadLastNameIntoField = () => {
12393
+ handleInputChange(window.Pelcro.user.read().last_name);
12394
+ };
12374
12395
 
12396
+ useEffect(() => {
12397
+ if (initWithUserLastName) {
12398
+ document.addEventListener("PelcroUserLoaded", () => {
12399
+ loadLastNameIntoField();
12400
+ });
12401
+ loadLastNameIntoField();
12402
+ return () => {
12403
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12404
+ };
12405
+ }
12406
+ }, []);
12375
12407
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12376
12408
  type: "text",
12377
- value: state.lastName,
12378
- onChange: e => handleInputChange(e.target.value)
12409
+ error: lastNameError,
12410
+ value: lastName,
12411
+ onChange: e => handleInputChange(e.target.value),
12412
+ onBlur: () => setFinishedTyping(true),
12413
+ onFocus: () => setFinishedTyping(false)
12379
12414
  }, otherProps));
12380
12415
  }
12381
12416
 
@@ -12383,12 +12418,77 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
12383
12418
  store: store$k
12384
12419
  }, props));
12385
12420
 
12421
+ function Phone({
12422
+ initWithUserPhone = true,
12423
+ store,
12424
+ ...otherProps
12425
+ }) {
12426
+ const {
12427
+ t
12428
+ } = useTranslation("common");
12429
+ const {
12430
+ dispatch,
12431
+ state: {
12432
+ phone: statePhone,
12433
+ phoneError
12434
+ }
12435
+ } = useContext(store);
12436
+ const [phone, setPhone] = useState(statePhone);
12437
+ const [finishedTyping, setFinishedTyping] = useState(false);
12438
+ const handleInputChange = useCallback(value => {
12439
+ setPhone(value);
12440
+
12441
+ if (phone !== null && phone !== void 0 && phone.length) {
12442
+ dispatch({
12443
+ type: SET_PHONE,
12444
+ payload: phone
12445
+ });
12446
+ } else if (finishedTyping && otherProps.required) {
12447
+ dispatch({
12448
+ type: SET_PHONE_ERROR,
12449
+ payload: t("validation.enterPhone")
12450
+ });
12451
+ }
12452
+ }, [dispatch, phone, finishedTyping]);
12453
+ useEffect(() => {
12454
+ handleInputChange(phone);
12455
+ }, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
12456
+
12457
+ const loadPhoneIntoField = () => {
12458
+ handleInputChange(window.Pelcro.user.read().phone);
12459
+ };
12460
+
12461
+ useEffect(() => {
12462
+ if (initWithUserPhone) {
12463
+ document.addEventListener("PelcroUserLoaded", () => {
12464
+ loadPhoneIntoField();
12465
+ });
12466
+ loadPhoneIntoField();
12467
+ return () => {
12468
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12469
+ };
12470
+ }
12471
+ }, []);
12472
+ return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12473
+ type: "tel",
12474
+ error: phoneError,
12475
+ value: phone,
12476
+ onChange: e => handleInputChange(e.target.value),
12477
+ onBlur: () => setFinishedTyping(true),
12478
+ onFocus: () => setFinishedTyping(false)
12479
+ }, otherProps));
12480
+ }
12481
+
12482
+ const RegisterPhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
12483
+ store: store$k
12484
+ }, props));
12485
+
12386
12486
  /**
12387
12487
  *
12388
12488
  */
12389
12489
 
12390
12490
  function RegisterView(props) {
12391
- var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
12491
+ var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$site$r4;
12392
12492
 
12393
12493
  const {
12394
12494
  t
@@ -12400,6 +12500,7 @@ function RegisterView(props) {
12400
12500
  const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
12401
12501
  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);
12402
12502
  const showNameFields = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableNameFieldsInRegister;
12503
+ const supportsTap = Boolean((_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.tap_gateway_settings);
12403
12504
  return /*#__PURE__*/React__default.createElement("div", {
12404
12505
  id: "pelcro-register-view"
12405
12506
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -12409,16 +12510,25 @@ function RegisterView(props) {
12409
12510
  }, title), /*#__PURE__*/React__default.createElement("p", null, subtitle)), /*#__PURE__*/React__default.createElement("form", {
12410
12511
  action: "javascript:void(0);",
12411
12512
  className: "plc-mt-2 pelcro-form"
12412
- }, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), showNameFields && /*#__PURE__*/React__default.createElement("div", {
12513
+ }, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), (showNameFields || supportsTap) && /*#__PURE__*/React__default.createElement("div", {
12413
12514
  className: "plc-flex plc-items-start"
12414
12515
  }, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
12415
12516
  id: "pelcro-input-first-name",
12416
- label: t("labels.firstName")
12517
+ label: t("labels.firstName"),
12518
+ errorId: "pelcro-input-firstName-error",
12519
+ required: supportsTap ? true : false
12417
12520
  }), /*#__PURE__*/React__default.createElement(RegisterLastName, {
12418
12521
  wrapperClassName: "plc-ml-3",
12419
12522
  id: "pelcro-input-last-name",
12420
- label: t("labels.lastName")
12421
- })), /*#__PURE__*/React__default.createElement(RegisterEmail, {
12523
+ label: t("labels.lastName"),
12524
+ errorId: "pelcro-input-lastName-error",
12525
+ required: supportsTap ? true : false
12526
+ })), supportsTap && /*#__PURE__*/React__default.createElement(RegisterPhone, {
12527
+ id: "pelcro-input-phone",
12528
+ errorId: "pelcro-input-phone-error",
12529
+ label: t("labels.phone"),
12530
+ required: supportsTap ? true : false
12531
+ }), /*#__PURE__*/React__default.createElement(RegisterEmail, {
12422
12532
  id: "pelcro-input-email",
12423
12533
  errorId: "pelcro-input-email-error",
12424
12534
  label: t("labels.email"),
@@ -12464,11 +12574,98 @@ function RegisterView(props) {
12464
12574
  */
12465
12575
 
12466
12576
  function hasSecurityTokenEnabled() {
12467
- var _window$Pelcro$site, _window$Pelcro$site$r4;
12577
+ var _window$Pelcro$site, _window$Pelcro$site$r5;
12468
12578
 
12469
- 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);
12579
+ return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r5 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.security_key);
12470
12580
  }
12471
12581
 
12582
+ const Loader = props => /*#__PURE__*/React__default.createElement("div", {
12583
+ className: `pelcro-loader-wrapper ${props.className}`
12584
+ }, /*#__PURE__*/React__default.createElement("svg", {
12585
+ width: props.width,
12586
+ height: props.height,
12587
+ viewBox: "0 0 120 30",
12588
+ xmlns: "http://www.w3.org/2000/svg",
12589
+ fill: "currentColor",
12590
+ "aria-label": props.label
12591
+ }, /*#__PURE__*/React__default.createElement("circle", {
12592
+ cx: "15",
12593
+ cy: "15",
12594
+ r: props.radius + 6
12595
+ }, /*#__PURE__*/React__default.createElement("animate", {
12596
+ attributeName: "r",
12597
+ from: "15",
12598
+ to: "15",
12599
+ begin: "0s",
12600
+ dur: "0.8s",
12601
+ values: "15;9;15",
12602
+ calcMode: "linear",
12603
+ repeatCount: "indefinite"
12604
+ }), /*#__PURE__*/React__default.createElement("animate", {
12605
+ attributeName: "fillOpacity",
12606
+ from: "1",
12607
+ to: "1",
12608
+ begin: "0s",
12609
+ dur: "0.8s",
12610
+ values: "1;.5;1",
12611
+ calcMode: "linear",
12612
+ repeatCount: "indefinite"
12613
+ })), /*#__PURE__*/React__default.createElement("circle", {
12614
+ cx: "60",
12615
+ cy: "15",
12616
+ r: props.radius,
12617
+ attributeName: "fillOpacity",
12618
+ from: "1",
12619
+ to: "0.3"
12620
+ }, /*#__PURE__*/React__default.createElement("animate", {
12621
+ attributeName: "r",
12622
+ from: "9",
12623
+ to: "9",
12624
+ begin: "0s",
12625
+ dur: "0.8s",
12626
+ values: "9;15;9",
12627
+ calcMode: "linear",
12628
+ repeatCount: "indefinite"
12629
+ }), /*#__PURE__*/React__default.createElement("animate", {
12630
+ attributeName: "fillOpacity",
12631
+ from: "0.5",
12632
+ to: "0.5",
12633
+ begin: "0s",
12634
+ dur: "0.8s",
12635
+ values: ".5;1;.5",
12636
+ calcMode: "linear",
12637
+ repeatCount: "indefinite"
12638
+ })), /*#__PURE__*/React__default.createElement("circle", {
12639
+ cx: "105",
12640
+ cy: "15",
12641
+ r: props.radius + 6
12642
+ }, /*#__PURE__*/React__default.createElement("animate", {
12643
+ attributeName: "r",
12644
+ from: "15",
12645
+ to: "15",
12646
+ begin: "0s",
12647
+ dur: "0.8s",
12648
+ values: "15;9;15",
12649
+ calcMode: "linear",
12650
+ repeatCount: "indefinite"
12651
+ }), /*#__PURE__*/React__default.createElement("animate", {
12652
+ attributeName: "fillOpacity",
12653
+ from: "1",
12654
+ to: "1",
12655
+ begin: "0s",
12656
+ dur: "0.8s",
12657
+ values: "1;.5;1",
12658
+ calcMode: "linear",
12659
+ repeatCount: "indefinite"
12660
+ }))));
12661
+ Loader.defaultProps = {
12662
+ height: 50,
12663
+ width: 35,
12664
+ color: "#32aea1",
12665
+ label: "Loading data..",
12666
+ radius: 9
12667
+ };
12668
+
12472
12669
  function TextInput({
12473
12670
  store,
12474
12671
  fieldName,
@@ -19084,9 +19281,12 @@ const initialState$f = {
19084
19281
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
19085
19282
  emailError: null,
19086
19283
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
19284
+ firstNameError: null,
19087
19285
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
19286
+ lastNameError: null,
19088
19287
  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
19288
  phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
19289
+ phoneError: null,
19090
19290
  buttonDisabled: false,
19091
19291
  textFields: {},
19092
19292
  alert: {
@@ -19198,17 +19398,26 @@ const UserUpdateContainer = ({
19198
19398
 
19199
19399
  case SET_EMAIL:
19200
19400
  return lib_7({ ...state,
19201
- email: action.payload
19401
+ email: action.payload,
19402
+ emailError: null
19202
19403
  });
19203
19404
 
19204
19405
  case SET_EMAIL_ERROR:
19205
19406
  return lib_7({ ...state,
19206
- emailError: action.payload
19407
+ emailError: action.payload,
19408
+ email: ""
19207
19409
  });
19208
19410
 
19209
19411
  case SET_FIRST_NAME:
19210
19412
  return lib_7({ ...state,
19211
- firstName: action.payload
19413
+ firstName: action.payload,
19414
+ firstNameError: null
19415
+ });
19416
+
19417
+ case SET_FIRST_NAME_ERROR:
19418
+ return lib_7({ ...state,
19419
+ firstNameError: action.payload,
19420
+ firstName: ""
19212
19421
  });
19213
19422
 
19214
19423
  case SET_DISPLAY_NAME:
@@ -19218,12 +19427,26 @@ const UserUpdateContainer = ({
19218
19427
 
19219
19428
  case SET_LAST_NAME:
19220
19429
  return lib_7({ ...state,
19221
- lastName: action.payload
19430
+ lastName: action.payload,
19431
+ lastNameError: null
19432
+ });
19433
+
19434
+ case SET_LAST_NAME_ERROR:
19435
+ return lib_7({ ...state,
19436
+ lastNameError: action.payload,
19437
+ lastName: ""
19222
19438
  });
19223
19439
 
19224
19440
  case SET_PHONE:
19225
19441
  return lib_7({ ...state,
19226
- phone: action.payload
19442
+ phone: action.payload,
19443
+ phoneError: null
19444
+ });
19445
+
19446
+ case SET_PHONE_ERROR:
19447
+ return lib_7({ ...state,
19448
+ phoneError: action.payload,
19449
+ phone: ""
19227
19450
  });
19228
19451
 
19229
19452
  case SHOW_ALERT:
@@ -19329,16 +19552,30 @@ const UserUpdateButton = ({
19329
19552
  onClick,
19330
19553
  ...otherProps
19331
19554
  }) => {
19555
+ var _window$Pelcro$site$r;
19556
+
19332
19557
  const {
19333
19558
  state: {
19334
19559
  buttonDisabled,
19335
- emailError
19560
+ email,
19561
+ firstName,
19562
+ lastName,
19563
+ phone,
19564
+ emailError,
19565
+ firstNameError,
19566
+ lastNameError,
19567
+ phoneError
19336
19568
  },
19337
19569
  dispatch
19338
19570
  } = useContext(store$f);
19571
+ const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19339
19572
  const {
19340
19573
  t
19341
19574
  } = useTranslation("userEdit");
19575
+ const [isDisabled, setDisabled] = useState(true);
19576
+ useEffect(() => {
19577
+ setDisabled(buttonDisabled || emailError || firstNameError || lastNameError || phoneError || !(email !== null && email !== void 0 && email.length) || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
19578
+ }, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
19342
19579
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
19343
19580
  onClick: () => {
19344
19581
  dispatch({
@@ -19346,7 +19583,7 @@ const UserUpdateButton = ({
19346
19583
  });
19347
19584
  onClick === null || onClick === void 0 ? void 0 : onClick();
19348
19585
  },
19349
- disabled: buttonDisabled || emailError,
19586
+ disabled: isDisabled,
19350
19587
  isLoading: buttonDisabled && !emailError
19351
19588
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
19352
19589
  };
@@ -19359,31 +19596,6 @@ const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(La
19359
19596
  store: store$f
19360
19597
  }, props));
19361
19598
 
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
19599
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
19388
19600
  store: store$f
19389
19601
  }, props));
@@ -19416,9 +19628,12 @@ const UserUpdateProfilePic = ({
19416
19628
  };
19417
19629
 
19418
19630
  const UserUpdateView = props => {
19631
+ var _window$Pelcro$site$r;
19632
+
19419
19633
  const {
19420
19634
  t
19421
19635
  } = useTranslation("userEdit");
19636
+ const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19422
19637
  return /*#__PURE__*/React__default.createElement("div", {
19423
19638
  id: "pelcro-user-update-view"
19424
19639
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -19437,19 +19652,22 @@ const UserUpdateView = props => {
19437
19652
  id: "pelcro-input-first-name",
19438
19653
  errorId: "pelcro-input-first-name-error",
19439
19654
  label: t("labels.firstName"),
19440
- autoFocus: true
19655
+ autoFocus: true,
19656
+ required: supportsTap ? true : false
19441
19657
  }), /*#__PURE__*/React__default.createElement(UserUpdateLastName, {
19442
19658
  wrapperClassName: "plc-ml-3",
19443
19659
  autoComplete: "last-name",
19444
19660
  id: "pelcro-input-last-name",
19445
19661
  errorId: "pelcro-input-last-name-error",
19446
- label: t("labels.lastName")
19662
+ label: t("labels.lastName"),
19663
+ required: supportsTap ? true : false
19447
19664
  })), /*#__PURE__*/React__default.createElement("div", {
19448
19665
  className: "plc-flex plc-items-start"
19449
19666
  }, /*#__PURE__*/React__default.createElement(UserUpdatePhone, {
19450
19667
  id: "pelcro-input-phone",
19451
19668
  errorId: "pelcro-input-phone-error",
19452
- label: t("labels.phone")
19669
+ label: t("labels.phone"),
19670
+ required: supportsTap ? true : false
19453
19671
  })), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
19454
19672
  role: "submit",
19455
19673
  className: "plc-w-full plc-mt-2",