@box/unified-share-modal 1.5.0 → 1.5.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.
@@ -1,62 +1,66 @@
1
- import { useState as P, useCallback as d } from "react";
2
- import { useFormValidation as A } from "./use-form-validation.js";
3
- import { useSharingAction as C } from "./use-sharing-action.js";
4
- import { getUpdatedLinkSettingsFormData as j } from "../utils/form.js";
5
- import { useUnifiedShareModalContext as M } from "../contexts/unified-share-modal-context.js";
6
- const G = (r) => {
7
- const [e, o] = P(r), {
8
- errors: h,
9
- setErrors: c,
10
- setFieldError: s,
11
- validateExpiration: m,
1
+ import { useState as A, useEffect as C, useCallback as c } from "react";
2
+ import { useFormValidation as F } from "./use-form-validation.js";
3
+ import { useSharingAction as j } from "./use-sharing-action.js";
4
+ import { getUpdatedLinkSettingsFormData as M } from "../utils/form.js";
5
+ import { useUnifiedShareModalContext as O } from "../contexts/unified-share-modal-context.js";
6
+ const H = (r) => {
7
+ const [s, o] = A(r), {
8
+ errors: E,
9
+ setErrors: e,
10
+ setFieldError: n,
11
+ validateExpiration: u,
12
12
  validatePassword: a,
13
13
  validateVanityName: p
14
- } = A(), {
15
- sharingService: l
16
- } = M(), {
17
- updateSharedLink: E
18
- } = l, {
19
- isLoading: f,
20
- onAction: u
21
- } = C(E, "update-shared-link"), S = d((t, n) => {
14
+ } = F(), {
15
+ sharingService: f
16
+ } = O(), {
17
+ updateSharedLink: h
18
+ } = f, {
19
+ isLoading: l,
20
+ onAction: m
21
+ } = j(h, "update-shared-link");
22
+ C(() => {
23
+ o(r), e({});
24
+ }, [r, e]);
25
+ const S = c((t, d) => {
22
26
  o((i) => ({
23
27
  ...i,
24
- [t]: n
28
+ [t]: d
25
29
  }));
26
- }, []), g = d(() => {
27
- o(r), c({});
28
- }, [r, c, o]), b = d(async () => {
29
- const t = j(e, r), {
30
- expiration: n,
30
+ }, []), g = c(() => {
31
+ o(r), e({});
32
+ }, [r, e]), b = c(async () => {
33
+ const t = M(s, r), {
34
+ expiration: d,
31
35
  isExpirationEnabled: i,
32
36
  isPasswordEnabled: x,
33
37
  isVanityNameEnabled: y,
34
38
  password: k,
35
39
  vanityName: v
36
- } = t, w = i && m(n), V = x && a(k), F = y && p(v);
37
- if (w || V || F)
40
+ } = t, w = i && u(d), V = x && a(k), L = y && p(v);
41
+ if (w || V || L)
38
42
  return !0;
39
43
  try {
40
- await u({
44
+ await m({
41
45
  ...r,
42
46
  ...t
43
47
  });
44
- } catch (L) {
45
- return Object.entries(L).forEach(([N, U]) => s(N, U)), !0;
48
+ } catch (N) {
49
+ return Object.entries(N).forEach(([U, P]) => n(U, P)), !0;
46
50
  }
47
51
  return !1;
48
- }, [e, r, u, s, m, a, p]);
52
+ }, [s, r, m, n, u, a, p]);
49
53
  return {
50
- errors: h,
51
- formData: e,
54
+ errors: E,
55
+ formData: s,
52
56
  handleFormReset: g,
53
57
  handleFormSubmit: b,
54
- isUpdating: f,
55
- setFieldError: s,
58
+ isUpdating: l,
59
+ setFieldError: n,
56
60
  setFieldValue: S,
57
61
  validatePassword: a
58
62
  };
59
63
  };
60
64
  export {
61
- G as useLinkSettingsForm
65
+ H as useLinkSettingsForm
62
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^9.18.13",
@@ -13,9 +13,9 @@
13
13
  "react-intl": "^6.4.2"
14
14
  },
15
15
  "devDependencies": {
16
- "@box/blueprint-web": "^12.90.0",
16
+ "@box/blueprint-web": "^12.91.0",
17
17
  "@box/blueprint-web-assets": "^4.75.0",
18
- "@box/copy-input": "^1.4.0",
18
+ "@box/copy-input": "^1.4.2",
19
19
  "@box/storybook-utils": "0.14.11",
20
20
  "@box/eslint-plugin-blueprint": "1.0.5",
21
21
  "react-intl": "^6.4.2"