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

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,51 @@ 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({
12325
12292
  store,
12326
12293
  ...otherProps
12327
12294
  }) {
12295
+ const {
12296
+ t
12297
+ } = useTranslation("common");
12328
12298
  const {
12329
12299
  dispatch,
12330
- state
12300
+ state: {
12301
+ firstName: stateFirstName,
12302
+ firstNameError
12303
+ }
12331
12304
  } = useContext(store);
12305
+ const [firstName, setFirstName] = useState(stateFirstName);
12306
+ const [finishedTyping, setFinishedTyping] = useState(false);
12307
+ const handleInputChange = useCallback(value => {
12308
+ setFirstName(value);
12332
12309
 
12333
- const handleInputChange = value => {
12334
- dispatch({
12335
- type: SET_FIRST_NAME,
12336
- payload: value
12337
- });
12338
- };
12339
-
12340
- if (state.loading) {
12341
- return /*#__PURE__*/React__default.createElement(Loader, null);
12342
- }
12343
-
12310
+ if (firstName !== null && firstName !== void 0 && firstName.length) {
12311
+ dispatch({
12312
+ type: SET_FIRST_NAME,
12313
+ payload: firstName
12314
+ });
12315
+ } else if (finishedTyping && otherProps.required) {
12316
+ dispatch({
12317
+ type: SET_FIRST_NAME_ERROR,
12318
+ payload: t("validation.enterFirstName")
12319
+ });
12320
+ }
12321
+ }, [dispatch, firstName, finishedTyping]);
12322
+ useEffect(() => {
12323
+ handleInputChange(firstName);
12324
+ }, [finishedTyping, firstName, handleInputChange]);
12344
12325
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12345
12326
  type: "text",
12346
- value: state.firstName,
12347
- onChange: e => handleInputChange(e.target.value)
12327
+ error: firstNameError,
12328
+ value: firstName,
12329
+ onChange: e => handleInputChange(e.target.value),
12330
+ onBlur: () => setFinishedTyping(true),
12331
+ onFocus: () => setFinishedTyping(false)
12348
12332
  }, otherProps));
12349
12333
  }
12350
12334
 
@@ -12356,26 +12340,43 @@ function LastName({
12356
12340
  store,
12357
12341
  ...otherProps
12358
12342
  }) {
12343
+ const {
12344
+ t
12345
+ } = useTranslation("common");
12359
12346
  const {
12360
12347
  dispatch,
12361
- state
12348
+ state: {
12349
+ lastName: stateLastName,
12350
+ lastNameError
12351
+ }
12362
12352
  } = useContext(store);
12353
+ const [lastName, setLastName] = useState(stateLastName);
12354
+ const [finishedTyping, setFinishedTyping] = useState(false);
12355
+ const handleInputChange = useCallback(value => {
12356
+ setLastName(value);
12363
12357
 
12364
- const handleInputChange = value => {
12365
- dispatch({
12366
- type: SET_LAST_NAME,
12367
- payload: value
12368
- });
12369
- };
12370
-
12371
- if (state.loading) {
12372
- return /*#__PURE__*/React__default.createElement(Loader, null);
12373
- }
12374
-
12358
+ if (lastName !== null && lastName !== void 0 && lastName.length) {
12359
+ dispatch({
12360
+ type: SET_LAST_NAME,
12361
+ payload: lastName
12362
+ });
12363
+ } else if (finishedTyping && otherProps.required) {
12364
+ dispatch({
12365
+ type: SET_LAST_NAME_ERROR,
12366
+ payload: t("validation.enterLastName")
12367
+ });
12368
+ }
12369
+ }, [dispatch, lastName, finishedTyping]);
12370
+ useEffect(() => {
12371
+ handleInputChange(lastName);
12372
+ }, [finishedTyping, lastName, handleInputChange]);
12375
12373
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12376
12374
  type: "text",
12377
- value: state.lastName,
12378
- onChange: e => handleInputChange(e.target.value)
12375
+ error: lastNameError,
12376
+ value: lastName,
12377
+ onChange: e => handleInputChange(e.target.value),
12378
+ onBlur: () => setFinishedTyping(true),
12379
+ onFocus: () => setFinishedTyping(false)
12379
12380
  }, otherProps));
12380
12381
  }
12381
12382
 
@@ -12383,12 +12384,60 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
12383
12384
  store: store$k
12384
12385
  }, props));
12385
12386
 
12387
+ function Phone({
12388
+ store,
12389
+ ...otherProps
12390
+ }) {
12391
+ const {
12392
+ t
12393
+ } = useTranslation("common");
12394
+ const {
12395
+ dispatch,
12396
+ state: {
12397
+ phone: statePhone,
12398
+ phoneError
12399
+ }
12400
+ } = useContext(store);
12401
+ const [phone, setPhone] = useState(statePhone);
12402
+ const [finishedTyping, setFinishedTyping] = useState(false);
12403
+ const handleInputChange = useCallback(value => {
12404
+ setPhone(value);
12405
+
12406
+ if (phone !== null && phone !== void 0 && phone.length) {
12407
+ dispatch({
12408
+ type: SET_PHONE,
12409
+ payload: phone
12410
+ });
12411
+ } else if (finishedTyping && otherProps.required) {
12412
+ dispatch({
12413
+ type: SET_PHONE_ERROR,
12414
+ payload: t("validation.enterPhone")
12415
+ });
12416
+ }
12417
+ }, [dispatch, phone, finishedTyping]);
12418
+ useEffect(() => {
12419
+ handleInputChange(phone);
12420
+ }, [finishedTyping, phone, handleInputChange]);
12421
+ return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12422
+ type: "tel",
12423
+ error: phoneError,
12424
+ value: phone,
12425
+ onChange: e => handleInputChange(e.target.value),
12426
+ onBlur: () => setFinishedTyping(true),
12427
+ onFocus: () => setFinishedTyping(false)
12428
+ }, otherProps));
12429
+ }
12430
+
12431
+ const RegisterPhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
12432
+ store: store$k
12433
+ }, props));
12434
+
12386
12435
  /**
12387
12436
  *
12388
12437
  */
12389
12438
 
12390
12439
  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;
12440
+ 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
12441
 
12393
12442
  const {
12394
12443
  t
@@ -12400,6 +12449,7 @@ function RegisterView(props) {
12400
12449
  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
12450
  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
12451
  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;
12452
+ 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
12453
  return /*#__PURE__*/React__default.createElement("div", {
12404
12454
  id: "pelcro-register-view"
12405
12455
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -12409,16 +12459,25 @@ function RegisterView(props) {
12409
12459
  }, title), /*#__PURE__*/React__default.createElement("p", null, subtitle)), /*#__PURE__*/React__default.createElement("form", {
12410
12460
  action: "javascript:void(0);",
12411
12461
  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", {
12462
+ }, /*#__PURE__*/React__default.createElement(RegisterContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), (showNameFields || supportsTap) && /*#__PURE__*/React__default.createElement("div", {
12413
12463
  className: "plc-flex plc-items-start"
12414
12464
  }, /*#__PURE__*/React__default.createElement(RegisterFirstName, {
12415
12465
  id: "pelcro-input-first-name",
12416
- label: t("labels.firstName")
12466
+ label: t("labels.firstName"),
12467
+ errorId: "pelcro-input-firstName-error",
12468
+ required: supportsTap ? true : false
12417
12469
  }), /*#__PURE__*/React__default.createElement(RegisterLastName, {
12418
12470
  wrapperClassName: "plc-ml-3",
12419
12471
  id: "pelcro-input-last-name",
12420
- label: t("labels.lastName")
12421
- })), /*#__PURE__*/React__default.createElement(RegisterEmail, {
12472
+ label: t("labels.lastName"),
12473
+ errorId: "pelcro-input-lastName-error",
12474
+ required: supportsTap ? true : false
12475
+ })), supportsTap && /*#__PURE__*/React__default.createElement(RegisterPhone, {
12476
+ id: "pelcro-input-phone",
12477
+ errorId: "pelcro-input-phone-error",
12478
+ label: t("labels.phone"),
12479
+ required: supportsTap ? true : false
12480
+ }), /*#__PURE__*/React__default.createElement(RegisterEmail, {
12422
12481
  id: "pelcro-input-email",
12423
12482
  errorId: "pelcro-input-email-error",
12424
12483
  label: t("labels.email"),
@@ -12464,11 +12523,98 @@ function RegisterView(props) {
12464
12523
  */
12465
12524
 
12466
12525
  function hasSecurityTokenEnabled() {
12467
- var _window$Pelcro$site, _window$Pelcro$site$r4;
12526
+ var _window$Pelcro$site, _window$Pelcro$site$r5;
12468
12527
 
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);
12528
+ 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
12529
  }
12471
12530
 
12531
+ const Loader = props => /*#__PURE__*/React__default.createElement("div", {
12532
+ className: `pelcro-loader-wrapper ${props.className}`
12533
+ }, /*#__PURE__*/React__default.createElement("svg", {
12534
+ width: props.width,
12535
+ height: props.height,
12536
+ viewBox: "0 0 120 30",
12537
+ xmlns: "http://www.w3.org/2000/svg",
12538
+ fill: "currentColor",
12539
+ "aria-label": props.label
12540
+ }, /*#__PURE__*/React__default.createElement("circle", {
12541
+ cx: "15",
12542
+ cy: "15",
12543
+ r: props.radius + 6
12544
+ }, /*#__PURE__*/React__default.createElement("animate", {
12545
+ attributeName: "r",
12546
+ from: "15",
12547
+ to: "15",
12548
+ begin: "0s",
12549
+ dur: "0.8s",
12550
+ values: "15;9;15",
12551
+ calcMode: "linear",
12552
+ repeatCount: "indefinite"
12553
+ }), /*#__PURE__*/React__default.createElement("animate", {
12554
+ attributeName: "fillOpacity",
12555
+ from: "1",
12556
+ to: "1",
12557
+ begin: "0s",
12558
+ dur: "0.8s",
12559
+ values: "1;.5;1",
12560
+ calcMode: "linear",
12561
+ repeatCount: "indefinite"
12562
+ })), /*#__PURE__*/React__default.createElement("circle", {
12563
+ cx: "60",
12564
+ cy: "15",
12565
+ r: props.radius,
12566
+ attributeName: "fillOpacity",
12567
+ from: "1",
12568
+ to: "0.3"
12569
+ }, /*#__PURE__*/React__default.createElement("animate", {
12570
+ attributeName: "r",
12571
+ from: "9",
12572
+ to: "9",
12573
+ begin: "0s",
12574
+ dur: "0.8s",
12575
+ values: "9;15;9",
12576
+ calcMode: "linear",
12577
+ repeatCount: "indefinite"
12578
+ }), /*#__PURE__*/React__default.createElement("animate", {
12579
+ attributeName: "fillOpacity",
12580
+ from: "0.5",
12581
+ to: "0.5",
12582
+ begin: "0s",
12583
+ dur: "0.8s",
12584
+ values: ".5;1;.5",
12585
+ calcMode: "linear",
12586
+ repeatCount: "indefinite"
12587
+ })), /*#__PURE__*/React__default.createElement("circle", {
12588
+ cx: "105",
12589
+ cy: "15",
12590
+ r: props.radius + 6
12591
+ }, /*#__PURE__*/React__default.createElement("animate", {
12592
+ attributeName: "r",
12593
+ from: "15",
12594
+ to: "15",
12595
+ begin: "0s",
12596
+ dur: "0.8s",
12597
+ values: "15;9;15",
12598
+ calcMode: "linear",
12599
+ repeatCount: "indefinite"
12600
+ }), /*#__PURE__*/React__default.createElement("animate", {
12601
+ attributeName: "fillOpacity",
12602
+ from: "1",
12603
+ to: "1",
12604
+ begin: "0s",
12605
+ dur: "0.8s",
12606
+ values: "1;.5;1",
12607
+ calcMode: "linear",
12608
+ repeatCount: "indefinite"
12609
+ }))));
12610
+ Loader.defaultProps = {
12611
+ height: 50,
12612
+ width: 35,
12613
+ color: "#32aea1",
12614
+ label: "Loading data..",
12615
+ radius: 9
12616
+ };
12617
+
12472
12618
  function TextInput({
12473
12619
  store,
12474
12620
  fieldName,
@@ -19084,9 +19230,12 @@ const initialState$f = {
19084
19230
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
19085
19231
  emailError: null,
19086
19232
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
19233
+ firstNameError: null,
19087
19234
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
19235
+ lastNameError: null,
19088
19236
  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
19237
  phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
19238
+ phoneError: null,
19090
19239
  buttonDisabled: false,
19091
19240
  textFields: {},
19092
19241
  alert: {
@@ -19198,17 +19347,26 @@ const UserUpdateContainer = ({
19198
19347
 
19199
19348
  case SET_EMAIL:
19200
19349
  return lib_7({ ...state,
19201
- email: action.payload
19350
+ email: action.payload,
19351
+ emailError: null
19202
19352
  });
19203
19353
 
19204
19354
  case SET_EMAIL_ERROR:
19205
19355
  return lib_7({ ...state,
19206
- emailError: action.payload
19356
+ emailError: action.payload,
19357
+ email: ""
19207
19358
  });
19208
19359
 
19209
19360
  case SET_FIRST_NAME:
19210
19361
  return lib_7({ ...state,
19211
- firstName: action.payload
19362
+ firstName: action.payload,
19363
+ firstNameError: null
19364
+ });
19365
+
19366
+ case SET_FIRST_NAME_ERROR:
19367
+ return lib_7({ ...state,
19368
+ firstNameError: action.payload,
19369
+ firstName: ""
19212
19370
  });
19213
19371
 
19214
19372
  case SET_DISPLAY_NAME:
@@ -19218,12 +19376,26 @@ const UserUpdateContainer = ({
19218
19376
 
19219
19377
  case SET_LAST_NAME:
19220
19378
  return lib_7({ ...state,
19221
- lastName: action.payload
19379
+ lastName: action.payload,
19380
+ lastNameError: null
19381
+ });
19382
+
19383
+ case SET_LAST_NAME_ERROR:
19384
+ return lib_7({ ...state,
19385
+ lastNameError: action.payload,
19386
+ lastName: ""
19222
19387
  });
19223
19388
 
19224
19389
  case SET_PHONE:
19225
19390
  return lib_7({ ...state,
19226
- phone: action.payload
19391
+ phone: action.payload,
19392
+ phoneError: null
19393
+ });
19394
+
19395
+ case SET_PHONE_ERROR:
19396
+ return lib_7({ ...state,
19397
+ phoneError: action.payload,
19398
+ phone: ""
19227
19399
  });
19228
19400
 
19229
19401
  case SHOW_ALERT:
@@ -19329,16 +19501,30 @@ const UserUpdateButton = ({
19329
19501
  onClick,
19330
19502
  ...otherProps
19331
19503
  }) => {
19504
+ var _window$Pelcro$site$r;
19505
+
19332
19506
  const {
19333
19507
  state: {
19334
19508
  buttonDisabled,
19335
- emailError
19509
+ email,
19510
+ firstName,
19511
+ lastName,
19512
+ phone,
19513
+ emailError,
19514
+ firstNameError,
19515
+ lastNameError,
19516
+ phoneError
19336
19517
  },
19337
19518
  dispatch
19338
19519
  } = useContext(store$f);
19520
+ 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
19521
  const {
19340
19522
  t
19341
19523
  } = useTranslation("userEdit");
19524
+ const [isDisabled, setDisabled] = useState(true);
19525
+ useEffect(() => {
19526
+ 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));
19527
+ }, [email, firstName, lastName, phone, buttonDisabled, emailError, firstNameError, lastNameError, phoneError]);
19342
19528
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
19343
19529
  onClick: () => {
19344
19530
  dispatch({
@@ -19346,7 +19532,7 @@ const UserUpdateButton = ({
19346
19532
  });
19347
19533
  onClick === null || onClick === void 0 ? void 0 : onClick();
19348
19534
  },
19349
- disabled: buttonDisabled || emailError,
19535
+ disabled: isDisabled,
19350
19536
  isLoading: buttonDisabled && !emailError
19351
19537
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
19352
19538
  };
@@ -19359,31 +19545,6 @@ const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(La
19359
19545
  store: store$f
19360
19546
  }, props));
19361
19547
 
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
19548
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
19388
19549
  store: store$f
19389
19550
  }, props));
@@ -19416,9 +19577,12 @@ const UserUpdateProfilePic = ({
19416
19577
  };
19417
19578
 
19418
19579
  const UserUpdateView = props => {
19580
+ var _window$Pelcro$site$r;
19581
+
19419
19582
  const {
19420
19583
  t
19421
19584
  } = useTranslation("userEdit");
19585
+ 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
19586
  return /*#__PURE__*/React__default.createElement("div", {
19423
19587
  id: "pelcro-user-update-view"
19424
19588
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -19437,19 +19601,22 @@ const UserUpdateView = props => {
19437
19601
  id: "pelcro-input-first-name",
19438
19602
  errorId: "pelcro-input-first-name-error",
19439
19603
  label: t("labels.firstName"),
19440
- autoFocus: true
19604
+ autoFocus: true,
19605
+ required: supportsTap ? true : false
19441
19606
  }), /*#__PURE__*/React__default.createElement(UserUpdateLastName, {
19442
19607
  wrapperClassName: "plc-ml-3",
19443
19608
  autoComplete: "last-name",
19444
19609
  id: "pelcro-input-last-name",
19445
19610
  errorId: "pelcro-input-last-name-error",
19446
- label: t("labels.lastName")
19611
+ label: t("labels.lastName"),
19612
+ required: supportsTap ? true : false
19447
19613
  })), /*#__PURE__*/React__default.createElement("div", {
19448
19614
  className: "plc-flex plc-items-start"
19449
19615
  }, /*#__PURE__*/React__default.createElement(UserUpdatePhone, {
19450
19616
  id: "pelcro-input-phone",
19451
19617
  errorId: "pelcro-input-phone-error",
19452
- label: t("labels.phone")
19618
+ label: t("labels.phone"),
19619
+ required: supportsTap ? true : false
19453
19620
  })), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
19454
19621
  role: "submit",
19455
19622
  className: "plc-w-full plc-mt-2",