@strapi/plugin-users-permissions 5.0.0-rc.29 → 5.0.0-rc.30

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.
Files changed (27) hide show
  1. package/dist/_chunks/{index-DGDhLo7i.mjs → index-B1wSzgB4.mjs} +3 -3
  2. package/dist/_chunks/{index-DGDhLo7i.mjs.map → index-B1wSzgB4.mjs.map} +1 -1
  3. package/dist/_chunks/{index-RenwmD5e.mjs → index-B6lXg5Im.mjs} +2 -2
  4. package/dist/_chunks/{index-RenwmD5e.mjs.map → index-B6lXg5Im.mjs.map} +1 -1
  5. package/dist/_chunks/{index-Cre3HHrf.mjs → index-BYEKsz4T.mjs} +6 -6
  6. package/dist/_chunks/{index-Cre3HHrf.mjs.map → index-BYEKsz4T.mjs.map} +1 -1
  7. package/dist/_chunks/{index-ClnY6B29.js → index-Bg-96jT2.js} +7 -7
  8. package/dist/_chunks/{index-ClnY6B29.js.map → index-Bg-96jT2.js.map} +1 -1
  9. package/dist/_chunks/{index-CLXFE4Bs.js → index-BxNQF6oE.js} +2 -2
  10. package/dist/_chunks/{index-CLXFE4Bs.js.map → index-BxNQF6oE.js.map} +1 -1
  11. package/dist/_chunks/{index-DQuctGoY.js → index-C9tZ7JkM.js} +2 -2
  12. package/dist/_chunks/{index-DQuctGoY.js.map → index-C9tZ7JkM.js.map} +1 -1
  13. package/dist/_chunks/{index-HXQIST4l.mjs → index-CBI87Zyp.mjs} +3 -3
  14. package/dist/_chunks/{index-HXQIST4l.mjs.map → index-CBI87Zyp.mjs.map} +1 -1
  15. package/dist/_chunks/{index-YsbVwIhJ.mjs → index-Ct1Kzelc.mjs} +2 -2
  16. package/dist/_chunks/{index-YsbVwIhJ.mjs.map → index-Ct1Kzelc.mjs.map} +1 -1
  17. package/dist/_chunks/{index-BkyAT7uD.js → index-CtZDcpZ6.js} +6 -6
  18. package/dist/_chunks/{index-BkyAT7uD.js.map → index-CtZDcpZ6.js.map} +1 -1
  19. package/dist/_chunks/{index-BLyGGMMe.js → index-DGg8u92Q.js} +4 -4
  20. package/dist/_chunks/{index-BLyGGMMe.js.map → index-DGg8u92Q.js.map} +1 -1
  21. package/dist/_chunks/{index-VjqZIRPo-CEsLSvPR.mjs → index-ukxNzreH-BfJxOAzF.mjs} +29 -16
  22. package/dist/_chunks/{index-VjqZIRPo-CEsLSvPR.mjs.map → index-ukxNzreH-BfJxOAzF.mjs.map} +1 -1
  23. package/dist/_chunks/{index-VjqZIRPo-i1Vg0iah.js → index-ukxNzreH-QiBdpWEj.js} +29 -16
  24. package/dist/_chunks/{index-VjqZIRPo-i1Vg0iah.js.map → index-ukxNzreH-QiBdpWEj.js.map} +1 -1
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +1 -1
  27. package/package.json +4 -4
@@ -10636,13 +10636,20 @@ React__namespace.forwardRef(
10636
10636
  return () => clearTimeout(ref2);
10637
10637
  }, [state.errors]);
10638
10638
  const validate = React__namespace.useCallback(
10639
- async (shouldSetErrors = true) => {
10639
+ async (shouldSetErrors = true, options = {}) => {
10640
10640
  setErrors({});
10641
- if (!props.validationSchema) {
10641
+ if (!props.validationSchema && !props.validate) {
10642
10642
  return { data: state.values };
10643
10643
  }
10644
10644
  try {
10645
- const data = await props.validationSchema.validate(state.values, { abortEarly: false });
10645
+ let data;
10646
+ if (props.validationSchema) {
10647
+ data = await props.validationSchema.validate(state.values, { abortEarly: false });
10648
+ } else if (props.validate) {
10649
+ data = await props.validate(state.values, options);
10650
+ } else {
10651
+ throw new Error("No validation schema or validate function provided");
10652
+ }
10646
10653
  return { data };
10647
10654
  } catch (err) {
10648
10655
  if (isErrorYupValidationError(err)) {
@@ -10728,7 +10735,11 @@ React__namespace.forwardRef(
10728
10735
  } else if (options && multiple) {
10729
10736
  val = Array.from(options).filter((el) => el.selected).map((el) => el.value);
10730
10737
  } else {
10731
- val = value;
10738
+ if (value === "") {
10739
+ val = null;
10740
+ } else {
10741
+ val = value;
10742
+ }
10732
10743
  }
10733
10744
  if (field) {
10734
10745
  dispatch({
@@ -10931,6 +10942,7 @@ const useField = (path) => {
10931
10942
  (state) => getIn(state.values, path)
10932
10943
  );
10933
10944
  const handleChange = useForm("useField", (state) => state.onChange);
10945
+ const rawError = useForm("useField", (state) => getIn(state.errors, path));
10934
10946
  const error = useForm("useField", (state) => {
10935
10947
  const error2 = getIn(state.errors, path);
10936
10948
  if (isErrorMessageDescriptor(error2)) {
@@ -10945,6 +10957,7 @@ const useField = (path) => {
10945
10957
  * Errors can be a string, or a MessageDescriptor, so we need to handle both cases.
10946
10958
  * If it's anything else, we don't return it.
10947
10959
  */
10960
+ rawError,
10948
10961
  error: isErrorMessageDescriptor(error) ? formatMessage(
10949
10962
  {
10950
10963
  id: error.id,
@@ -11423,11 +11436,11 @@ const errorsTrads = {
11423
11436
  }
11424
11437
  };
11425
11438
  yup__namespace.object().shape({
11426
- email: yup__namespace.string().email({
11439
+ email: yup__namespace.string().nullable().email({
11427
11440
  id: errorsTrads.email.id,
11428
11441
  defaultMessage: "Not a valid email"
11429
11442
  }).required(errorsTrads.required),
11430
- password: yup__namespace.string().required(errorsTrads.required),
11443
+ password: yup__namespace.string().required(errorsTrads.required).nullable(),
11431
11444
  rememberMe: yup__namespace.bool().nullable()
11432
11445
  });
11433
11446
  styledComponents.styled(designSystem.Field.Root)`
@@ -11466,7 +11479,7 @@ styledComponents.styled(designSystem.Field.Root)`
11466
11479
  `;
11467
11480
  [...Array(11).keys()];
11468
11481
  yup__namespace.object().shape({
11469
- firstname: yup__namespace.string().trim().required(errorsTrads.required),
11482
+ firstname: yup__namespace.string().trim().required(errorsTrads.required).nullable(),
11470
11483
  lastname: yup__namespace.string().nullable(),
11471
11484
  password: yup__namespace.string().min(8, {
11472
11485
  id: errorsTrads.minLength.id,
@@ -11490,14 +11503,14 @@ yup__namespace.object().shape({
11490
11503
  }).required({
11491
11504
  id: errorsTrads.required.id,
11492
11505
  defaultMessage: "Password is required"
11493
- }),
11506
+ }).nullable(),
11494
11507
  confirmPassword: yup__namespace.string().required({
11495
11508
  id: errorsTrads.required.id,
11496
11509
  defaultMessage: "Confirm password is required"
11497
11510
  }).oneOf([yup__namespace.ref("password"), null], {
11498
11511
  id: "components.Input.error.password.noMatch",
11499
11512
  defaultMessage: "Passwords must match"
11500
- }),
11513
+ }).nullable(),
11501
11514
  registrationToken: yup__namespace.string().required({
11502
11515
  id: errorsTrads.required.id,
11503
11516
  defaultMessage: "Registration token is required"
@@ -11507,7 +11520,7 @@ yup__namespace.object().shape({
11507
11520
  firstname: yup__namespace.string().trim().required({
11508
11521
  id: errorsTrads.required.id,
11509
11522
  defaultMessage: "Firstname is required"
11510
- }),
11523
+ }).nullable(),
11511
11524
  lastname: yup__namespace.string().nullable(),
11512
11525
  password: yup__namespace.string().min(8, {
11513
11526
  id: errorsTrads.minLength.id,
@@ -11531,11 +11544,11 @@ yup__namespace.object().shape({
11531
11544
  }).required({
11532
11545
  id: errorsTrads.required.id,
11533
11546
  defaultMessage: "Password is required"
11534
- }),
11547
+ }).nullable(),
11535
11548
  confirmPassword: yup__namespace.string().required({
11536
11549
  id: errorsTrads.required,
11537
11550
  defaultMessage: "Confirm password is required"
11538
- }).oneOf([yup__namespace.ref("password"), null], {
11551
+ }).nullable().oneOf([yup__namespace.ref("password"), null], {
11539
11552
  id: "components.Input.error.password.noMatch",
11540
11553
  defaultMessage: "Passwords must match"
11541
11554
  }),
@@ -11548,7 +11561,7 @@ yup__namespace.object().shape({
11548
11561
  }).required({
11549
11562
  id: errorsTrads.required.id,
11550
11563
  defaultMessage: "Email is required"
11551
- })
11564
+ }).nullable()
11552
11565
  });
11553
11566
  styledComponents.styled.a`
11554
11567
  color: ${({ theme }) => theme.colors.primary600};
@@ -11576,14 +11589,14 @@ yup__namespace.object().shape({
11576
11589
  }).required({
11577
11590
  id: errorsTrads.required.id,
11578
11591
  defaultMessage: "Password is required"
11579
- }),
11592
+ }).nullable(),
11580
11593
  confirmPassword: yup__namespace.string().required({
11581
11594
  id: errorsTrads.required.id,
11582
11595
  defaultMessage: "Confirm password is required"
11583
11596
  }).oneOf([yup__namespace.ref("password"), null], {
11584
11597
  id: "components.Input.error.password.noMatch",
11585
11598
  defaultMessage: "Passwords must match"
11586
- })
11599
+ }).nullable()
11587
11600
  });
11588
11601
  ({
11589
11602
  [adminApi.reducerPath]: adminApi.reducer,
@@ -11853,4 +11866,4 @@ adminApi.enhanceEndpoints({
11853
11866
  });
11854
11867
  exports.Layouts = Layouts;
11855
11868
  exports.useTracking = useTracking;
11856
- //# sourceMappingURL=index-VjqZIRPo-i1Vg0iah.js.map
11869
+ //# sourceMappingURL=index-ukxNzreH-QiBdpWEj.js.map