@box/unified-share-modal 0.45.2 → 0.46.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.
Files changed (47) hide show
  1. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +109 -100
  2. package/dist/esm/lib/hooks/use-form-validation.js +24 -22
  3. package/dist/esm/lib/hooks/use-link-settings-form.js +46 -48
  4. package/dist/esm/lib/hooks/use-sharing-action.js +12 -12
  5. package/dist/esm/lib/messages.js +16 -0
  6. package/dist/esm/lib/utils/index.js +23 -16
  7. package/dist/esm/lib/utils/validation.js +41 -3
  8. package/dist/i18n/bn-IN.js +4 -0
  9. package/dist/i18n/da-DK.js +4 -0
  10. package/dist/i18n/de-DE.js +4 -0
  11. package/dist/i18n/en-AU.js +4 -0
  12. package/dist/i18n/en-CA.js +4 -0
  13. package/dist/i18n/en-GB.js +4 -0
  14. package/dist/i18n/en-US.js +4 -0
  15. package/dist/i18n/en-US.properties +8 -0
  16. package/dist/i18n/en-x-pseudo.js +4 -0
  17. package/dist/i18n/es-419.js +4 -0
  18. package/dist/i18n/es-ES.js +4 -0
  19. package/dist/i18n/fi-FI.js +4 -0
  20. package/dist/i18n/fr-CA.js +4 -0
  21. package/dist/i18n/fr-FR.js +4 -0
  22. package/dist/i18n/hi-IN.js +4 -0
  23. package/dist/i18n/it-IT.js +4 -0
  24. package/dist/i18n/ja-JP.js +4 -0
  25. package/dist/i18n/json/src/lib/messages.json +1 -1
  26. package/dist/i18n/ko-KR.js +4 -0
  27. package/dist/i18n/nb-NO.js +4 -0
  28. package/dist/i18n/nl-NL.js +4 -0
  29. package/dist/i18n/pl-PL.js +4 -0
  30. package/dist/i18n/pt-BR.js +4 -0
  31. package/dist/i18n/ru-RU.js +4 -0
  32. package/dist/i18n/sv-SE.js +4 -0
  33. package/dist/i18n/tr-TR.js +4 -0
  34. package/dist/i18n/zh-CN.js +4 -0
  35. package/dist/i18n/zh-TW.js +4 -0
  36. package/dist/types/lib/components/remove-shared-link-modal/stories/shared.d.ts +0 -1
  37. package/dist/types/lib/components/shared-link-settings-modal/stories/shared.d.ts +0 -34
  38. package/dist/types/lib/components/unified-share-form-modal/stories/shared.d.ts +1 -14
  39. package/dist/types/lib/hooks/use-form-validation.d.ts +2 -0
  40. package/dist/types/lib/hooks/use-link-settings-form.d.ts +1 -0
  41. package/dist/types/lib/messages.d.ts +20 -0
  42. package/dist/types/lib/stories/shared.d.ts +13 -6
  43. package/dist/types/lib/types.d.ts +2 -2
  44. package/dist/types/lib/utils/validation.d.ts +19 -0
  45. package/package.json +5 -8
  46. package/dist/esm/lib/store.js +0 -30
  47. package/dist/types/lib/store.d.ts +0 -21
@@ -1,173 +1,182 @@
1
- import { useMemo as H } from "react";
2
- import { useIntl as O } from "react-intl";
3
- import { Modal as r, Text as C, Link as Y, Switch as d, DateI18nProvider as q, DatePicker as G, InlineNotice as E, TextInput as k } from "@box/blueprint-web";
1
+ import { useMemo as G } from "react";
2
+ import { useIntl as J } from "react-intl";
3
+ import { Modal as r, Text as C, Link as K, Switch as c, DateI18nProvider as Q, DatePicker as X, InlineNotice as k, TextInput as L } from "@box/blueprint-web";
4
4
  import e from "./messages.js";
5
- import { jsx as n, jsxs as s, Fragment as L } from "react/jsx-runtime";
6
- import { useAccessLevels as J } from "../../hooks/use-access-levels.js";
7
- import { formatDateFromTimestampToCalendarDate as K, formatTomorrowDateToCalendarDate as Q } from "../../utils/date.js";
8
- import { useLinkSettingsForm as X } from "../../hooks/use-link-settings-form.js";
9
- import { useUnifiedShareModalContext as Z } from "../../contexts/unified-share-modal-context.js";
10
- import '../../../../styles/shared-link-settings-modal.css';const aa = "_content_1wiic_1", ea = "_body_1wiic_5", D = {
11
- content: aa,
12
- body: ea
13
- }, na = "••••••••";
14
- function ga({
15
- isOpen: P,
16
- onOpenChange: c
5
+ import { jsx as n, jsxs as d, Fragment as S } from "react/jsx-runtime";
6
+ import { useAccessLevels as Z } from "../../hooks/use-access-levels.js";
7
+ import { formatDateFromTimestampToCalendarDate as aa, formatTomorrowDateToCalendarDate as ea } from "../../utils/date.js";
8
+ import { useLinkSettingsForm as na } from "../../hooks/use-link-settings-form.js";
9
+ import { useUnifiedShareModalContext as ia } from "../../contexts/unified-share-modal-context.js";
10
+ import '../../../../styles/shared-link-settings-modal.css';const oa = "_content_1wiic_1", ta = "_body_1wiic_5", P = {
11
+ content: oa,
12
+ body: ta
13
+ }, ra = "••••••••";
14
+ function ua({
15
+ isOpen: D,
16
+ onOpenChange: h
17
17
  }) {
18
18
  const {
19
19
  formatMessage: a
20
- } = O(), {
21
- eventService: f,
22
- isSubmitting: N,
23
- sharedLink: S
24
- } = Z(), {
25
- expiresAt: p,
20
+ } = J(), {
21
+ eventService: N,
22
+ isSubmitting: T,
23
+ sharedLink: f
24
+ } = ia(), {
25
+ expiresAt: v,
26
26
  permissions: i = {},
27
- vanityDomain: T,
28
- vanityName: h
29
- } = S, {
30
- onSharedLinkSettingsClose: v
27
+ vanityDomain: A,
28
+ vanityName: m
31
29
  } = f, {
30
+ onSharedLinkSettingsClose: w
31
+ } = N, {
32
32
  selectedAccess: g
33
- } = J(), b = p ? K(p) : void 0, w = H(() => ({
33
+ } = Z(), b = v ? aa(v) : void 0, p = G(() => ({
34
34
  expiration: b,
35
- isDownloadEnabled: i.isDownloadEnabled ?? !1,
35
+ isDownloadEnabled: !!i.isDownloadEnabled,
36
36
  isExpirationEnabled: !!b,
37
- isPasswordEnabled: i.isPasswordEnabled ?? !1,
38
- isVanityEnabled: !!h,
37
+ isPasswordEnabled: !!i.isPasswordEnabled,
38
+ isVanityEnabled: !!m,
39
39
  password: "",
40
- vanityName: h || ""
41
- }), [b, i, h]), {
40
+ vanityName: m || ""
41
+ }), [b, i, m]), {
42
42
  errors: u,
43
- formData: o,
44
- handleFormReset: x,
45
- handleFormSubmit: A,
46
- isUpdating: I,
47
- setFieldError: m,
48
- setFieldValue: l
49
- } = X(w), V = () => {
50
- x(), v && v(), c(!1);
51
- }, F = async () => {
52
- await A() || (x(), c(!1));
53
- }, M = (t) => {
54
- l("isExpirationEnabled", t);
55
- }, _ = (t) => {
56
- m("expiration", void 0), l("expiration", t);
57
- }, B = (t) => {
58
- l("isVanityEnabled", t);
59
- }, U = (t) => {
60
- m("vanityName", void 0), l("vanityName", t.target.value);
61
- }, R = (t) => {
62
- l("isPasswordEnabled", t);
63
- }, W = (t) => {
64
- m("password", void 0), l("password", t.target.value);
65
- }, j = (t) => {
66
- l("isDownloadEnabled", t);
67
- }, $ = i.canChangeVanityName && !!o.vanityName, z = `${T || ""}${o.vanityName}`, y = N || I;
43
+ formData: t,
44
+ handleFormReset: y,
45
+ handleFormSubmit: I,
46
+ isUpdating: F,
47
+ setFieldError: l,
48
+ setFieldValue: s,
49
+ validatePassword: V
50
+ } = na(p), B = () => {
51
+ y(), w && w(), h(!1);
52
+ }, M = async () => {
53
+ await I() || (y(), h(!1));
54
+ }, _ = (o) => {
55
+ l("expiration", void 0), s("isExpirationEnabled", o);
56
+ }, U = (o) => {
57
+ l("expiration", void 0), s("expiration", o);
58
+ }, R = (o) => {
59
+ l("vanityName", void 0), s("isVanityEnabled", o);
60
+ }, W = (o) => {
61
+ l("vanityName", void 0), s("vanityName", o.target.value);
62
+ }, j = (o) => {
63
+ l("password", void 0), s("isPasswordEnabled", o);
64
+ }, O = (o) => {
65
+ l("password", void 0), s("password", o.target.value);
66
+ }, $ = (o) => {
67
+ s("isDownloadEnabled", o);
68
+ }, z = (o) => {
69
+ var E;
70
+ const q = (E = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")) == null ? void 0 : E.contains(o.relatedTarget);
71
+ p.isPasswordEnabled && !t.password || q || V(t.password);
72
+ }, H = i.canChangeVanityName && !!t.vanityName, Y = `${A || ""}${t.vanityName}`, x = T || F;
68
73
  return /* @__PURE__ */ n(r, {
69
- onOpenChange: c,
70
- open: P,
71
- children: /* @__PURE__ */ s(r.Content, {
72
- className: D.content,
74
+ onOpenChange: h,
75
+ open: D,
76
+ children: /* @__PURE__ */ d(r.Content, {
77
+ className: P.content,
73
78
  size: "medium",
74
79
  children: [/* @__PURE__ */ n(r.Header, {
75
80
  children: a(e.title)
76
- }), /* @__PURE__ */ s(r.Body, {
77
- className: D.body,
81
+ }), /* @__PURE__ */ d(r.Body, {
82
+ className: P.body,
78
83
  children: [/* @__PURE__ */ n(C, {
79
84
  as: "p",
80
85
  color: "textOnLightSecondary",
81
86
  children: a(e.subtitle, {
82
- learnSharedLinkSettingsLink: /* @__PURE__ */ n(Y, {
87
+ learnSharedLinkSettingsLink: /* @__PURE__ */ n(K, {
83
88
  href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
84
89
  rel: "noreferrer",
85
90
  target: "_blank",
86
91
  children: a(e.learnSharedLinkSettingsLink)
87
92
  })
88
93
  })
89
- }), /* @__PURE__ */ n(d.Item, {
90
- checked: o.isExpirationEnabled,
94
+ }), /* @__PURE__ */ n(c.Item, {
95
+ checked: t.isExpirationEnabled,
91
96
  disabled: !i.canChangeExpiration,
92
97
  label: a(e.linkExpirationToggleText),
93
- onCheckedChange: M,
98
+ onCheckedChange: _,
94
99
  value: "link-expiration-settings"
95
- }), o.isExpirationEnabled && // Get the locale from the user's operating system settings
96
- /* @__PURE__ */ n(q, {
100
+ }), t.isExpirationEnabled && // Get the locale from the user's operating system settings
101
+ /* @__PURE__ */ n(Q, {
97
102
  locale: navigator.language || "en-US",
98
- children: /* @__PURE__ */ n(G, {
103
+ children: /* @__PURE__ */ n(X, {
99
104
  calendarAriaLabel: a(e.linkExpirationCalendarAriaLabel),
100
105
  clearDatePickerAriaLabel: a(e.linkExpirationClearDatePickerAriaLabel),
101
106
  error: u.expiration,
102
107
  hideLabel: !0,
103
108
  isDisabled: !i.canChangeExpiration,
104
109
  label: a(e.linkExpirationDatePickerLabel),
105
- minValue: Q(),
110
+ minValue: ea(),
106
111
  nextMonthAriaLabel: a(e.linkExpirationNextMonthAriaLabel),
107
- onChange: _,
112
+ onChange: U,
108
113
  openCalendarDropdownAriaLabel: a(e.linkExpirationOpenCalendarDropdownAriaLabel),
109
114
  previousMonthAriaLabel: a(e.linkExpirationPreviousMonthAriaLabel),
110
- value: o.expiration
115
+ value: t.expiration
111
116
  })
112
- }), i.isPasswordAvailable && (g == null ? void 0 : g.id) === "open" && /* @__PURE__ */ n(d.Item, {
113
- checked: o.isPasswordEnabled,
117
+ }), i.isPasswordAvailable && (g == null ? void 0 : g.id) === "open" && /* @__PURE__ */ n(c.Item, {
118
+ checked: t.isPasswordEnabled,
114
119
  disabled: !i.canChangePassword,
115
120
  label: a(e.passwordToggleText),
116
- onCheckedChange: R,
121
+ onCheckedChange: j,
117
122
  value: "password-settings"
118
- }), o.isPasswordEnabled && /* @__PURE__ */ s(L, {
119
- children: [i.canChangePassword && /* @__PURE__ */ n(E, {
123
+ }), t.isPasswordEnabled && /* @__PURE__ */ d(S, {
124
+ children: [i.canChangePassword && /* @__PURE__ */ n(k, {
120
125
  variant: "warning",
121
126
  variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
122
127
  children: a(e.passwordWarningText)
123
- }), /* @__PURE__ */ n(k, {
128
+ }), /* @__PURE__ */ n(L, {
124
129
  disabled: !i.canChangePassword,
130
+ error: u.password,
125
131
  hideLabel: !0,
126
132
  label: a(e.passwordToggleText),
127
- onChange: W,
128
- placeholder: w.isPasswordEnabled ? na : a(e.passwordInputPlaceholder),
133
+ onBlur: z,
134
+ onChange: O,
135
+ onFocus: () => l("password", void 0),
136
+ placeholder: p.isPasswordEnabled ? ra : a(e.passwordInputPlaceholder),
129
137
  type: "password",
130
- value: o.password
138
+ value: t.password
131
139
  })]
132
- }), i.isVanityNameAvailable && /* @__PURE__ */ n(d.Item, {
133
- checked: o.isVanityEnabled,
140
+ }), i.isVanityNameAvailable && /* @__PURE__ */ n(c.Item, {
141
+ checked: t.isVanityEnabled,
134
142
  disabled: !i.canChangeVanityName,
135
143
  label: a(e.vanityNameToggleText),
136
- onCheckedChange: B,
144
+ onCheckedChange: R,
137
145
  value: "vanity-domain-settings"
138
- }), o.isVanityEnabled && /* @__PURE__ */ s(L, {
139
- children: [i.canChangeVanityName && /* @__PURE__ */ n(E, {
146
+ }), t.isVanityEnabled && /* @__PURE__ */ d(S, {
147
+ children: [i.canChangeVanityName && /* @__PURE__ */ n(k, {
140
148
  variant: "warning",
141
149
  variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
142
150
  children: a(e.vanityDomainSettingsWarningText)
143
- }), /* @__PURE__ */ n(k, {
151
+ }), /* @__PURE__ */ n(L, {
144
152
  disabled: !i.canChangeVanityName,
145
153
  error: u.vanityName,
146
154
  hideLabel: !0,
147
155
  label: a(e.vanityNameInputLabel),
148
- onChange: U,
156
+ onChange: W,
149
157
  placeholder: a(e.vanityNameInputPlaceholder),
150
- value: o.vanityName
151
- }), $ && /* @__PURE__ */ n(C, {
158
+ value: t.vanityName
159
+ }), H && /* @__PURE__ */ n(C, {
152
160
  as: "p",
153
- children: z
161
+ children: Y
154
162
  })]
155
- }), i.isDownloadAvailable && /* @__PURE__ */ n(d.Item, {
156
- checked: o.isDownloadEnabled,
163
+ }), i.isDownloadAvailable && /* @__PURE__ */ n(c.Item, {
164
+ checked: t.isDownloadEnabled,
157
165
  disabled: !i.canChangeDownload,
158
166
  label: a(e.downloadSettingsToggleText),
159
- onCheckedChange: j,
167
+ onCheckedChange: $,
160
168
  value: "download-link-settings"
161
169
  })]
162
- }), /* @__PURE__ */ s(r.Footer, {
170
+ }), /* @__PURE__ */ d(r.Footer, {
163
171
  children: [/* @__PURE__ */ n(r.Footer.SecondaryButton, {
164
- disabled: y,
165
- onClick: V,
172
+ disabled: x,
173
+ onClick: B,
166
174
  children: a(e.cancelButton)
167
175
  }), /* @__PURE__ */ n(r.Footer.PrimaryButton, {
168
- loading: y,
176
+ id: "usm-SharedLinkSettingsModal-primaryButton",
177
+ loading: x,
169
178
  loadingAriaLabel: a(e.loadingLabel),
170
- onClick: F,
179
+ onClick: M,
171
180
  children: a(e.saveButton)
172
181
  })]
173
182
  }), /* @__PURE__ */ n(r.Close, {
@@ -177,5 +186,5 @@ function ga({
177
186
  });
178
187
  }
179
188
  export {
180
- ga as SharedLinkSettingsModal
189
+ ua as SharedLinkSettingsModal
181
190
  };
@@ -1,31 +1,33 @@
1
- import { useState as d, useCallback as o } from "react";
2
- import { useIntl as p } from "react-intl";
1
+ import { useState as g, useCallback as o } from "react";
2
+ import { useIntl as v } from "react-intl";
3
3
  import a from "../messages.js";
4
- import { formatTomorrowDateToCalendarDate as E } from "../utils/date.js";
5
- import { isVanityNameValid as g, isEmailValid as v } from "../utils/validation.js";
6
- const q = () => {
4
+ import { formatTomorrowDateToCalendarDate as p } from "../utils/date.js";
5
+ import { isVanityNameValid as w, isEmailValid as y, doesPasswordContainMinCharacters as N, doesPasswordContainInvalidCharacter as P, isPasswordMixedCase as x, doesPasswordContainLetter as n, doesPasswordContainNumber as u, doesPasswordContainSymbol as d } from "../utils/validation.js";
6
+ const R = () => {
7
7
  const {
8
8
  formatMessage: t
9
- } = p(), [s, n] = d({}), r = o((e, i) => {
10
- n((f) => ({
11
- ...f,
12
- [e]: i
9
+ } = v(), [l, i] = g({}), e = o((r, s) => {
10
+ i((M) => ({
11
+ ...M,
12
+ [r]: s
13
13
  }));
14
- }, []), u = o((e) => {
15
- if (!e)
16
- return r("expiration", t(a.expirationRequiredErrorMessage)), !0;
17
- const i = E();
18
- return e.compare(i) < 0 ? (r("expiration", t(a.expirationFutureDateRequiredErrorMessage)), !0) : !1;
19
- }, [t, r]), m = o((e) => e ? g(e) ? !1 : (r("vanityName", t(a.vanityNameInvalidErrorMessage)), !0) : (r("vanityName", t(a.vanityNameRequiredErrorMessage)), !0), [t, r]), l = o((e) => e.length ? !1 : (r("user-contact", t(a.emailRequiredErrorMessage)), !0), [t, r]), c = o((e) => v(e) ? !1 : (r("user-contact", t(a.invalidEmailErrorMessage)), !0), [t, r]);
14
+ }, []), m = o((r) => {
15
+ if (!r)
16
+ return e("expiration", t(a.expirationRequiredErrorMessage)), !0;
17
+ const s = p();
18
+ return r.compare(s) < 0 ? (e("expiration", t(a.expirationFutureDateRequiredErrorMessage)), !0) : !1;
19
+ }, [t, e]), c = o((r) => r ? w(r) ? !1 : (e("vanityName", t(a.vanityNameInvalidErrorMessage)), !0) : (e("vanityName", t(a.vanityNameRequiredErrorMessage)), !0), [t, e]), f = o((r) => r.length ? !1 : (e("user-contact", t(a.emailRequiredErrorMessage)), !0), [t, e]), C = o((r) => y(r) ? !1 : (e("user-contact", t(a.invalidEmailErrorMessage)), !0), [t, e]), E = o((r) => N(r) ? P(r) ? (e("password", t(a.passwordContainInvalidCharacterErrorMessage)), !0) : !x(r) && !(n(r) && u(r)) && !(n(r) && d(r)) && !(u(r) && d(r)) ? (e("password", t(a.passwordContainLetterNumberOrSymbolErrorMessage)), !0) : !1 : (e("password", t(a.passwordContainMinCharactersErrorMessage)), !0), [t, e]);
20
20
  return {
21
- errors: s,
22
- validateExpiration: u,
23
- validateVanityName: m,
24
- validateUserContact: c,
25
- validateUserSelector: l,
26
- setFieldError: r
21
+ errors: l,
22
+ validateExpiration: m,
23
+ validatePassword: E,
24
+ validateVanityName: c,
25
+ validateUserContact: C,
26
+ validateUserSelector: f,
27
+ setErrors: i,
28
+ setFieldError: e
27
29
  };
28
30
  };
29
31
  export {
30
- q as useFormValidation
32
+ R as useFormValidation
31
33
  };
@@ -1,60 +1,58 @@
1
- import { useState as V, useCallback as d } from "react";
2
- import { useFormValidation as L } from "./use-form-validation.js";
3
- import { useSharingAction as U } from "./use-sharing-action.js";
4
- import { useUnifiedShareModalContext as w } from "../contexts/unified-share-modal-context.js";
5
- const j = (r) => {
6
- const [a, o] = V(r), {
7
- errors: p,
8
- setFieldError: n,
9
- validateExpiration: c,
10
- validateVanityName: u
11
- } = L(), {
1
+ import { useState as L, useCallback as d } from "react";
2
+ import { useFormValidation as N } from "./use-form-validation.js";
3
+ import { useSharingAction as b } from "./use-sharing-action.js";
4
+ import { getSharedLinkFormValidation as P } from "../utils/validation.js";
5
+ import { useUnifiedShareModalContext as U } from "../contexts/unified-share-modal-context.js";
6
+ const R = (t) => {
7
+ const [o, a] = L(t), {
8
+ errors: l,
9
+ setErrors: c,
10
+ setFieldError: s,
11
+ validateExpiration: u,
12
+ validatePassword: n,
13
+ validateVanityName: m
14
+ } = N(), {
15
+ sharedLink: {
16
+ permissions: p
17
+ },
12
18
  sharingService: f
13
- } = w(), {
14
- updateSharedLink: h
19
+ } = U(), {
20
+ updateSharedLink: E
15
21
  } = f, {
16
- isLoading: E,
17
- onAction: l
18
- } = U(h, "update-shared-link"), S = d((t, i) => {
19
- o((s) => ({
20
- ...s,
21
- [t]: i
22
+ isLoading: S,
23
+ onAction: h
24
+ } = b(E, "update-shared-link"), V = d((r, e) => {
25
+ a((i) => ({
26
+ ...i,
27
+ [r]: e
22
28
  }));
23
- }, []), b = d(() => {
24
- o(r);
25
- }, [r, o]), F = d(async () => {
29
+ }, []), g = d(() => {
30
+ a(t), c({});
31
+ }, [t, c, a]), k = d(async () => {
26
32
  const {
27
- expiration: t,
28
- isDownloadEnabled: i,
29
- isExpirationEnabled: s,
30
- isVanityEnabled: g,
31
- vanityName: m
32
- } = a;
33
- let e = !1;
34
- if (s && c(t) && (e = !0), g && u(m) && (e = !0), e)
35
- return e;
36
- const x = {
37
- expiration: t,
38
- isDownloadEnabled: i,
39
- vanityName: m
40
- };
33
+ updatedFormData: r,
34
+ shouldValidate: e
35
+ } = P(p, o, t), i = e.expiration && u(r.updatedExpiration), x = e.password && n(r.updatedPassword), y = e.vanityName && m(r.updatedVanityName);
36
+ if (i || x || y)
37
+ return !0;
41
38
  try {
42
- await l(x);
43
- } catch (y) {
44
- return Object.entries(y).forEach(([k, v]) => n(k, v)), !0;
39
+ await h(r);
40
+ } catch (v) {
41
+ return Object.entries(v).forEach(([w, F]) => s(w, F)), !0;
45
42
  }
46
43
  return !1;
47
- }, [a, l, n, c, u]);
44
+ }, [o, t, p, h, s, u, n, m]);
48
45
  return {
49
- errors: p,
50
- formData: a,
51
- handleFormReset: b,
52
- handleFormSubmit: F,
53
- isUpdating: E,
54
- setFieldError: n,
55
- setFieldValue: S
46
+ errors: l,
47
+ formData: o,
48
+ handleFormReset: g,
49
+ handleFormSubmit: k,
50
+ isUpdating: S,
51
+ setFieldError: s,
52
+ setFieldValue: V,
53
+ validatePassword: n
56
54
  };
57
55
  };
58
56
  export {
59
- j as useLinkSettingsForm
57
+ R as useLinkSettingsForm
60
58
  };
@@ -9,16 +9,16 @@ const f = (s, e) => ({
9
9
  sensitivity: "foreground",
10
10
  typeIconAriaLabel: s(e === "success" ? i.successNoticeIcon : i.errorNoticeIcon),
11
11
  variant: e
12
- }), N = (s, e, t, r) => {
12
+ }), N = (s, e, t, c) => {
13
13
  if (!t)
14
14
  return "";
15
15
  const l = b(t), n = i[`${l}${e === "success" ? "Success" : "Error"}NoticeText`];
16
- return n ? s(n, r) : e === "error" ? s(i.defaultErrorNoticeText) : "";
16
+ return n ? s(n, c) : e === "error" ? s(i.defaultErrorNoticeText) : "";
17
17
  }, O = (s, e) => {
18
18
  const {
19
19
  formatMessage: t
20
20
  } = E(), {
21
- addNotification: r
21
+ addNotification: c
22
22
  } = S(), [l, u] = C(!1), {
23
23
  config: n,
24
24
  item: h
@@ -32,13 +32,13 @@ const f = (s, e) => ({
32
32
  u(!0);
33
33
  try {
34
34
  if (s) {
35
- const o = await s(...p), c = a && !!o && !!o.messages, y = a && !c;
36
- c && o.messages.forEach(({
35
+ const o = await s(...p), r = a && !!o && !!o.messages, y = a && !r;
36
+ r && o.messages.forEach(({
37
37
  text: x,
38
38
  type: A,
39
39
  ...T
40
40
  }) => {
41
- r({
41
+ c({
42
42
  ...f(t, A),
43
43
  styledText: x,
44
44
  ...T
@@ -47,22 +47,22 @@ const f = (s, e) => ({
47
47
  const g = N(t, "success", e, {
48
48
  itemName: d
49
49
  });
50
- y && g && r({
50
+ y && g && c({
51
51
  ...f(t, "success"),
52
52
  styledText: g
53
53
  });
54
54
  }
55
55
  } catch (o) {
56
- const c = N(t, "error", e);
57
- if (a && c && r({
56
+ const r = N(t, "error", e);
57
+ if (a && r && c({
58
58
  ...f(t, "error"),
59
- styledText: c
60
- }), o.fields && Object.values(o.fields).length)
59
+ styledText: r
60
+ }), o != null && o.fields && Object.values(o.fields).length)
61
61
  throw o.fields;
62
62
  } finally {
63
63
  u(!1);
64
64
  }
65
- }, [s, r, t, a, d, e]),
65
+ }, [s, c, t, a, d, e]),
66
66
  isLoading: l
67
67
  };
68
68
  };
@@ -63,6 +63,22 @@ const a = e({
63
63
  emailRequiredErrorMessage: {
64
64
  id: "groupSharedFeatures.usm.emailRequiredErrorMessage",
65
65
  defaultMessage: "Enter at least one valid email"
66
+ },
67
+ passwordRequiredErrorMessage: {
68
+ id: "groupSharedFeatures.usm.passwordRequiredErrorMessage",
69
+ defaultMessage: "Please enter a password"
70
+ },
71
+ passwordContainMinCharactersErrorMessage: {
72
+ id: "groupSharedFeatures.usm.passwordContainMinCharactersErrorMessage",
73
+ defaultMessage: "Password should contain at least 8 characters"
74
+ },
75
+ passwordContainInvalidCharacterErrorMessage: {
76
+ id: "groupSharedFeatures.usm.passwordContainInvalidCharacterErrorMessage",
77
+ defaultMessage: 'Your password cannot contain a space, "<" or ">"'
78
+ },
79
+ passwordContainLetterNumberOrSymbolErrorMessage: {
80
+ id: "groupSharedFeatures.usm.passwordContainLetterNumberOrSymbolErrorMessage",
81
+ defaultMessage: "Your password should contain at least one upper case letter, number, or special character."
66
82
  }
67
83
  });
68
84
  export {
@@ -1,19 +1,26 @@
1
- import { getAvatarBadgeSize as t, getDefaultCollaborationRole as a, getFirstInitial as r, isCollaboratorRoleSupported as l, isInvitationRoleSupported as i } from "./collaborator.js";
2
- import { formatDateFromTimestampToCalendarDate as p, formatDateFromTimestampToDateString as n, formatTomorrowDateToCalendarDate as s } from "./date.js";
3
- import { callOnKeyboardEvent as f } from "./event.js";
4
- import { getAllowedAccessLevels as g } from "./permission.js";
5
- import { isEmailValid as x, isVanityNameValid as v } from "./validation.js";
1
+ import { getAvatarBadgeSize as e, getDefaultCollaborationRole as t, getFirstInitial as r, isCollaboratorRoleSupported as i, isInvitationRoleSupported as s } from "./collaborator.js";
2
+ import { formatDateFromTimestampToCalendarDate as n, formatDateFromTimestampToDateString as l, formatTomorrowDateToCalendarDate as m } from "./date.js";
3
+ import { callOnKeyboardEvent as p } from "./event.js";
4
+ import { getAllowedAccessLevels as w } from "./permission.js";
5
+ import { doesPasswordContainInvalidCharacter as D, doesPasswordContainLetter as x, doesPasswordContainMinCharacters as P, doesPasswordContainNumber as S, doesPasswordContainSymbol as T, getSharedLinkFormValidation as b, isEmailValid as c, isPasswordMixedCase as v, isVanityNameValid as u } from "./validation.js";
6
6
  export {
7
- f as callOnKeyboardEvent,
8
- p as formatDateFromTimestampToCalendarDate,
9
- n as formatDateFromTimestampToDateString,
10
- s as formatTomorrowDateToCalendarDate,
11
- g as getAllowedAccessLevels,
12
- t as getAvatarBadgeSize,
13
- a as getDefaultCollaborationRole,
7
+ p as callOnKeyboardEvent,
8
+ D as doesPasswordContainInvalidCharacter,
9
+ x as doesPasswordContainLetter,
10
+ P as doesPasswordContainMinCharacters,
11
+ S as doesPasswordContainNumber,
12
+ T as doesPasswordContainSymbol,
13
+ n as formatDateFromTimestampToCalendarDate,
14
+ l as formatDateFromTimestampToDateString,
15
+ m as formatTomorrowDateToCalendarDate,
16
+ w as getAllowedAccessLevels,
17
+ e as getAvatarBadgeSize,
18
+ t as getDefaultCollaborationRole,
14
19
  r as getFirstInitial,
15
- l as isCollaboratorRoleSupported,
16
- x as isEmailValid,
17
- i as isInvitationRoleSupported,
18
- v as isVanityNameValid
20
+ b as getSharedLinkFormValidation,
21
+ i as isCollaboratorRoleSupported,
22
+ c as isEmailValid,
23
+ s as isInvitationRoleSupported,
24
+ v as isPasswordMixedCase,
25
+ u as isVanityNameValid
19
26
  };
@@ -1,5 +1,43 @@
1
- const n = /^[a-zA-Z0-9-]{12,30}$/, e = /^[A-Z0-9._'%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, r = (t) => n.test(t), s = (t) => t.length === 0 ? !0 : e.test(t);
1
+ const A = /^[a-zA-Z0-9-]{12,30}$/, C = /^[A-Z0-9._'%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, P = (a) => A.test(a), f = (a) => a.length === 0 ? !0 : C.test(a), v = (a) => a.length >= 8, N = (a) => a.replace(/\D/g, "").length >= 1, V = (a) => a.replace(/\s/g, "").replace(/\w/g, "").length >= 1, y = (a) => /[a-zA-Z]/.test(a), x = (a) => /[a-z]/.test(a) && /[A-Z]/.test(a), D = (a) => /[\s<>]/.test(a), Z = (a, d, r) => {
2
+ const {
3
+ expiration: l,
4
+ isDownloadEnabled: u,
5
+ isExpirationEnabled: n,
6
+ isPasswordEnabled: s,
7
+ isVanityEnabled: o,
8
+ password: i,
9
+ vanityName: c
10
+ } = d, {
11
+ canChangeDownload: p,
12
+ canChangeExpiration: w,
13
+ canChangeVanityName: E,
14
+ canChangePassword: b,
15
+ isDownloadAvailable: g,
16
+ isPasswordAvailable: h,
17
+ isVanityNameAvailable: m
18
+ } = a, e = {
19
+ updatedExpiration: n ? l : 0,
20
+ updatedPassword: s ? i : "",
21
+ updatedVanityName: o ? c : "",
22
+ updatedIsDownloadEnabled: u
23
+ }, t = {
24
+ expiration: !1,
25
+ password: !1,
26
+ vanityName: !1
27
+ };
28
+ return w ? n && (t.expiration = !0) : e.updatedExpiration = void 0, !h || !b || r.isPasswordEnabled && !i ? e.updatedPassword = void 0 : s && (t.password = !0), !m || !E ? e.updatedVanityName = void 0 : o && (t.vanityName = !0), (!g || !p) && (e.updatedIsDownloadEnabled = void 0), {
29
+ updatedFormData: e,
30
+ shouldValidate: t
31
+ };
32
+ };
2
33
  export {
3
- s as isEmailValid,
4
- r as isVanityNameValid
34
+ D as doesPasswordContainInvalidCharacter,
35
+ y as doesPasswordContainLetter,
36
+ v as doesPasswordContainMinCharacters,
37
+ N as doesPasswordContainNumber,
38
+ V as doesPasswordContainSymbol,
39
+ Z as getSharedLinkFormValidation,
40
+ f as isEmailValid,
41
+ x as isPasswordMixedCase,
42
+ P as isVanityNameValid
5
43
  };