@box/unified-share-modal 1.30.0 → 1.31.0

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 (50) hide show
  1. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +151 -109
  2. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +38 -2
  3. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.js +128 -0
  4. package/dist/esm/lib/contexts/unified-share-form-context.js +36 -29
  5. package/dist/esm/lib/hooks/use-collaboration-form.js +51 -50
  6. package/dist/esm/lib/hooks/use-form-validation.js +38 -27
  7. package/dist/esm/lib/messages.js +8 -0
  8. package/dist/esm/lib/unified-share-modal.js +57 -55
  9. package/dist/esm/lib/utils/collaborator.js +7 -6
  10. package/dist/esm/lib/utils/index.js +24 -23
  11. package/dist/i18n/bn-IN.js +11 -0
  12. package/dist/i18n/da-DK.js +11 -0
  13. package/dist/i18n/de-DE.js +11 -0
  14. package/dist/i18n/en-AU.js +11 -0
  15. package/dist/i18n/en-CA.js +11 -0
  16. package/dist/i18n/en-GB.js +11 -0
  17. package/dist/i18n/en-US.js +11 -0
  18. package/dist/i18n/en-US.properties +22 -0
  19. package/dist/i18n/en-x-pseudo.js +11 -0
  20. package/dist/i18n/es-419.js +11 -0
  21. package/dist/i18n/es-ES.js +11 -0
  22. package/dist/i18n/fi-FI.js +11 -0
  23. package/dist/i18n/fr-CA.js +11 -0
  24. package/dist/i18n/fr-FR.js +11 -0
  25. package/dist/i18n/hi-IN.js +11 -0
  26. package/dist/i18n/it-IT.js +11 -0
  27. package/dist/i18n/ja-JP.js +11 -0
  28. package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -1
  29. package/dist/i18n/json/src/lib/messages.json +1 -1
  30. package/dist/i18n/ko-KR.js +11 -0
  31. package/dist/i18n/nb-NO.js +11 -0
  32. package/dist/i18n/nl-NL.js +11 -0
  33. package/dist/i18n/pl-PL.js +11 -0
  34. package/dist/i18n/pt-BR.js +11 -0
  35. package/dist/i18n/ru-RU.js +11 -0
  36. package/dist/i18n/sv-SE.js +11 -0
  37. package/dist/i18n/tr-TR.js +11 -0
  38. package/dist/i18n/zh-CN.js +11 -0
  39. package/dist/i18n/zh-TW.js +11 -0
  40. package/dist/styles/shield-restriction-notice.css +1 -0
  41. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +45 -0
  42. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.d.ts +8 -0
  43. package/dist/types/lib/contexts/unified-share-form-context.d.ts +3 -1
  44. package/dist/types/lib/contexts/unified-share-modal-context.d.ts +2 -1
  45. package/dist/types/lib/hooks/use-form-validation.d.ts +1 -0
  46. package/dist/types/lib/messages.d.ts +10 -0
  47. package/dist/types/lib/types.d.ts +83 -7
  48. package/dist/types/lib/unified-share-modal.d.ts +2 -1
  49. package/dist/types/lib/utils/collaborator.d.ts +3 -1
  50. package/package.json +9 -9
@@ -1,128 +1,170 @@
1
- import { useRef as X, useEffect as Y, useCallback as g } from "react";
2
- import { createPortal as Z } from "react-dom";
3
- import { useIntl as $ } from "react-intl";
4
- import { useUniqueId as ee, useLabelable as te, Tooltip as oe, Focusable as ae, Modal as m } from "@box/blueprint-web";
5
- import { UserSelectorContainer as ne } from "@box/user-selector";
6
- import { CollaborationRole as re } from "./collaboration-role.js";
7
- import { SharedWithAvatars as ie } from "./shared-with-avatars.js";
8
- import { TextAreaContainer as le } from "./text-area-container.js";
9
- import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as se } from "../../../constants.js";
10
- import t from "./messages.js";
11
- import { jsxs as u, jsx as o, Fragment as ce } from "react/jsx-runtime";
12
- import { useCollaborationForm as me } from "../../../hooks/use-collaboration-form.js";
13
- import { useUnifiedShareFormContext as ue } from "../../../contexts/unified-share-form-context.js";
14
- import { useUnifiedShareModalContext as de } from "../../../contexts/unified-share-modal-context.js";
15
- import '../../../../../styles/collaboration-section.css';const fe = "_container_1o05j_2", be = "_label_1o05j_8", B = {
16
- container: fe,
17
- label: be
1
+ import { useState as se, useRef as le, useEffect as T, useCallback as U } from "react";
2
+ import { createPortal as ce } from "react-dom";
3
+ import { useIntl as de } from "react-intl";
4
+ import { useNotification as ue, useUniqueId as me, useLabelable as fe, Tooltip as he, Focusable as pe, Modal as m } from "@box/blueprint-web";
5
+ import { UserSelectorContainer as be } from "@box/user-selector";
6
+ import { CollaborationRole as Ce } from "./collaboration-role.js";
7
+ import { SharedWithAvatars as ge } from "./shared-with-avatars.js";
8
+ import { ShieldRestrictionNotice as ve } from "./shield-restriction-notice.js";
9
+ import { TextAreaContainer as Se } from "./text-area-container.js";
10
+ import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as Le } from "../../../constants.js";
11
+ import o from "./messages.js";
12
+ import { jsxs as f, jsx as r, Fragment as Fe } from "react/jsx-runtime";
13
+ import { useFormValidation as Ue } from "../../../hooks/use-form-validation.js";
14
+ import { useCollaborationForm as Ae } from "../../../hooks/use-collaboration-form.js";
15
+ import { useUnifiedShareFormContext as Be } from "../../../contexts/unified-share-form-context.js";
16
+ import { useUnifiedShareModalContext as Ve } from "../../../contexts/unified-share-modal-context.js";
17
+ import '../../../../../styles/collaboration-section.css';const ye = "_container_1o05j_2", Ee = "_label_1o05j_8", x = {
18
+ container: ye,
19
+ label: Ee
18
20
  };
19
- function xe() {
21
+ function He() {
20
22
  const {
21
- formatMessage: e
22
- } = $(), {
23
- contactValue: I,
24
- container: d,
25
- onModalOpenChange: S,
26
- onShareViewChange: f,
27
- shareView: a,
28
- userContacts: F
23
+ formatMessage: t
24
+ } = de(), [h, A] = se(), {
25
+ addNotification: N
29
26
  } = ue(), {
30
- config: i,
31
- contactService: T,
32
- isFetching: _,
33
- isSubmitting: x,
34
- item: E,
35
- sharingService: P
36
- } = de(), {
37
- permissions: k = {},
38
- type: O
39
- } = E, {
40
- getContacts: b,
41
- getContactsAvatarUrls: h
42
- } = T, {
43
- sendInvitations: V,
44
- sendSharedLink: y
45
- } = P;
46
- let p, C;
47
- a === "invite" && (p = V, C = "invite-collaborators"), a === "email" && (p = y, C = "email-shared-link");
27
+ validateShieldRestriction: _
28
+ } = Ue(), {
29
+ contactValue: P,
30
+ container: p,
31
+ onModalOpenChange: B,
32
+ onShareViewChange: b,
33
+ setUserContacts: k,
34
+ shareView: i,
35
+ userContacts: n
36
+ } = Be(), {
37
+ collaborationNotices: M,
38
+ config: C,
39
+ contactService: O,
40
+ isFetching: w,
41
+ isSubmitting: j,
42
+ item: D,
43
+ sharingService: G
44
+ } = Ve(), {
45
+ permissions: W = {},
46
+ type: q
47
+ } = D, {
48
+ getContacts: g,
49
+ getContactsAvatarUrls: v
50
+ } = O, {
51
+ sendInvitations: H,
52
+ sendSharedLink: K
53
+ } = G;
54
+ let S, L;
55
+ i === "invite" && (S = H, L = "invite-collaborators"), i === "email" && (S = K, L = "email-shared-link");
48
56
  const {
49
- errors: M,
50
- handleFormReset: L,
51
- handleFormSubmit: R,
52
- handleSelectedUsersChange: N,
53
- handleUserSelectorBlur: w,
54
- isFormSubmitting: j,
55
- updateContactValue: D
56
- } = me(p, C), r = a === "default" || a === "invite", l = a === "invite" || a === "email", v = x ?? j, U = X(a === "email" ? "email" : "invite");
57
- Y(() => {
58
- U.current = a === "email" ? "email" : "invite";
59
- }, [a]);
60
- const W = g((n) => (n.stopPropagation(), !0), []), q = g((n) => b ? b(n, U.current) : Promise.resolve([]), [b]), G = g((n) => h ? h(n) : Promise.resolve({}), [h]), H = (n) => {
61
- l || f("invite"), D(n);
62
- }, K = () => {
63
- L(), f("default");
64
- }, z = async () => {
65
- await R() || (L(), S && S(!1), f("default"));
57
+ errors: $,
58
+ handleFormReset: V,
59
+ handleFormSubmit: z,
60
+ handleSelectedUsersChange: y,
61
+ handleUserSelectorBlur: J,
62
+ isFormSubmitting: Q,
63
+ updateContactValue: X
64
+ } = Ae(S, L), a = i === "default" || i === "invite", s = i === "invite" || i === "email", l = j ?? Q, E = le(i === "email" ? "email" : "invite");
65
+ T(() => {
66
+ E.current = i === "email" ? "email" : "invite";
67
+ }, [i]), T(() => {
68
+ (!n.length || !n.some((e) => e.chipVariant === "error")) && A(null);
69
+ }, [n]);
70
+ const Y = U((e) => (e.stopPropagation(), !0), []), Z = U((e) => g ? g(e, E.current) : Promise.resolve([]), [g]), ee = U((e) => v ? v(e) : Promise.resolve({}), [v]), te = (e) => {
71
+ s || b("invite"), X(e);
72
+ }, oe = () => {
73
+ V(), b("default");
74
+ }, re = async () => {
75
+ try {
76
+ if (h) {
77
+ const e = _(n);
78
+ if (e) {
79
+ N({
80
+ closeButtonAriaLabel: t(o.closeButton),
81
+ sensitivity: "foreground",
82
+ styledText: e,
83
+ typeIconAriaLabel: t(o.errorNoticeIconAriaLabel),
84
+ variant: "error"
85
+ });
86
+ return;
87
+ }
88
+ }
89
+ if (await z())
90
+ return;
91
+ V(), B && B(!1), b("default");
92
+ } catch (e) {
93
+ if (!e.shieldRestriction)
94
+ return;
95
+ const {
96
+ shieldRestriction: F
97
+ } = e, R = [...F.restrictedEmails ?? [], ...F.restrictedGroups ?? []], ae = n.map((u) => R.includes(u.email) || R.includes(`${u.id}`) ? {
98
+ ...u,
99
+ chipVariant: "error"
100
+ } : u);
101
+ A(F), k(ae);
102
+ }
66
103
  };
67
- let s, c = !1;
68
- r && !k.canInviteCollaborator && (s = e(t.inviteDisabledTooltip), c = !0), r && O === "web_link" && (s = e(t.inviteWebLinkDisabledTooltip), c = !0);
69
- const A = ee("user-contacts-"), J = e(r ? t.invitePeopleLabel : t.emailSharedLinkLabel), Q = te(J, A);
70
- return /* @__PURE__ */ u("form", {
71
- className: B.container,
72
- onSubmit: (n) => n.preventDefault(),
73
- children: [i.collaborationNotices, /* @__PURE__ */ u("div", {
74
- children: [r && i.collaborators && /* @__PURE__ */ o(ie, {}), /* @__PURE__ */ o(Q, {
75
- className: B.label
76
- }), /* @__PURE__ */ o(oe, {
77
- content: s,
104
+ let c, d = !1;
105
+ a && !W.canInviteCollaborator && (c = t(o.inviteDisabledTooltip), d = !0), a && q === "web_link" && (c = t(o.inviteWebLinkDisabledTooltip), d = !0);
106
+ const I = me("user-contacts-"), ie = t(a ? o.invitePeopleLabel : o.emailSharedLinkLabel), ne = fe(ie, I);
107
+ return /* @__PURE__ */ f("form", {
108
+ className: x.container,
109
+ onSubmit: (e) => e.preventDefault(),
110
+ children: [h && /* @__PURE__ */ r(ve, {
111
+ error: h,
112
+ isLoading: l,
113
+ onSelectedUsersChange: y
114
+ }), M, /* @__PURE__ */ f("div", {
115
+ children: [a && C.collaborators && /* @__PURE__ */ r(ge, {}), /* @__PURE__ */ r(ne, {
116
+ className: x.label
117
+ }), /* @__PURE__ */ r(he, {
118
+ content: c,
78
119
  "data-testid": "user-contacts-tooltip",
79
- open: s ? void 0 : !1,
120
+ open: c ? void 0 : !1,
80
121
  side: "bottom",
81
- children: /* @__PURE__ */ o(ae, {
82
- focusable: c,
83
- children: /* @__PURE__ */ o(ne, {
122
+ children: /* @__PURE__ */ r(pe, {
123
+ focusable: d,
124
+ children: /* @__PURE__ */ r(be, {
84
125
  className: "collaboration-user-selector",
85
- clearButtonAriaLabel: e(t.clearButton),
126
+ clearButtonAriaLabel: t(o.clearButton),
86
127
  clearOnBlur: !1,
87
- disabled: c || v,
88
- error: M["user-contact"],
89
- fetchAvatarUrls: G,
90
- fetchUsers: q,
91
- hideOnEscape: W,
92
- idForLabel: A,
93
- inputValue: I,
128
+ disabled: d || l,
129
+ displayChipVariant: (e) => e.chipVariant,
130
+ error: $["user-contact"],
131
+ fetchAvatarUrls: ee,
132
+ fetchUsers: Z,
133
+ hideOnEscape: Y,
134
+ idForLabel: I,
135
+ inputValue: P,
94
136
  label: null,
95
- onBlur: w,
96
- onInputValueChange: H,
97
- onSelectedUsersChange: N,
98
- placeholder: F.length ? "" : e(t.invitePeoplePlaceholder),
99
- portalElement: d,
100
- selectedUsers: F,
137
+ onBlur: J,
138
+ onInputValueChange: te,
139
+ onSelectedUsersChange: y,
140
+ placeholder: n.length ? "" : t(o.invitePeoplePlaceholder),
141
+ portalElement: p,
142
+ selectedUsers: n,
101
143
  selectOnEnterOrTab: !0,
102
- variant: l ? "textarea" : "input"
144
+ variant: s ? "textarea" : "input"
103
145
  })
104
146
  })
105
- }), r && i.collaborationRole && /* @__PURE__ */ o(re, {})]
106
- }), l && i.collaborationMessage && /* @__PURE__ */ o(le, {
107
- maxCount: se
108
- }), l && d && /* @__PURE__ */ Z(/* @__PURE__ */ u(ce, {
109
- children: [!_ && /* @__PURE__ */ u(m.Footer, {
110
- children: [/* @__PURE__ */ o(m.Footer.SecondaryButton, {
111
- disabled: v,
112
- onClick: K,
113
- children: e(t.cancelButton)
114
- }), /* @__PURE__ */ o(m.Footer.PrimaryButton, {
115
- loading: v,
116
- loadingAriaLabel: e(t.loadingLabel),
117
- onClick: z,
118
- children: e(t.sendButton)
147
+ }), a && C.collaborationRole && /* @__PURE__ */ r(Ce, {})]
148
+ }), s && C.collaborationMessage && /* @__PURE__ */ r(Se, {
149
+ maxCount: Le
150
+ }), s && p && /* @__PURE__ */ ce(/* @__PURE__ */ f(Fe, {
151
+ children: [!w && /* @__PURE__ */ f(m.Footer, {
152
+ children: [/* @__PURE__ */ r(m.Footer.SecondaryButton, {
153
+ disabled: l,
154
+ onClick: oe,
155
+ children: t(o.cancelButton)
156
+ }), /* @__PURE__ */ r(m.Footer.PrimaryButton, {
157
+ loading: l,
158
+ loadingAriaLabel: t(o.loadingLabel),
159
+ onClick: re,
160
+ children: t(o.sendButton)
119
161
  })]
120
- }), /* @__PURE__ */ o(m.Close, {
121
- "aria-label": e(t.closeButton)
162
+ }), /* @__PURE__ */ r(m.Close, {
163
+ "aria-label": t(o.closeButton)
122
164
  })]
123
- }), d)]
165
+ }), p)]
124
166
  });
125
167
  }
126
168
  export {
127
- xe as CollaborationSection
169
+ He as CollaborationSection
128
170
  };
@@ -1,5 +1,5 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- const o = e({
2
+ const a = e({
3
3
  cancelButton: {
4
4
  id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.cancelButton",
5
5
  defaultMessage: "Cancel"
@@ -91,8 +91,44 @@ const o = e({
91
91
  inviteWebLinkDisabledTooltip: {
92
92
  id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteWebLinkDisabledTooltip",
93
93
  defaultMessage: "Collaborators cannot be added to bookmarks"
94
+ },
95
+ justifiableContactRestrictionNotice: {
96
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.justifiableContactRestrictionNotice",
97
+ defaultMessage: "This content requires a business justification for {count, plural, one {{count} invitation} other {{count} invitations}}. Please select a business justification below. {justificationSelect} {removeLink}"
98
+ },
99
+ justifiableContactRestrictionRemoveButtonLabel: {
100
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.justifiableContactRestrictionRemoveButtonLabel",
101
+ defaultMessage: "Alternatively, remove to continue"
102
+ },
103
+ contactRestrictionNotice: {
104
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.contactRestrictionNotice",
105
+ defaultMessage: "{count, plural, one {{count} invitation} other {{count} invitations}} cannot be sent because external collaboration is restricted due to the applied security policy. {removeLink}"
106
+ },
107
+ contactRestrictionInformationBarrierNotice: {
108
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.contactRestrictionInformationBarrierNotice",
109
+ defaultMessage: "{count, plural, one {{count} invitation} other {{count} invitations}} cannot be sent due to a security policy. {removeLink}"
110
+ },
111
+ contactRestrictionRemoveButtonLabel: {
112
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.contactRestrictionRemoveButtonLabel",
113
+ defaultMessage: "Remove to continue"
114
+ },
115
+ justificationSelectPlaceholder: {
116
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.justificationSelectPlaceholder",
117
+ defaultMessage: "Select Justification"
118
+ },
119
+ loadingJustificationReasonsLabel: {
120
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.loadingJustificationReasonsLabel",
121
+ defaultMessage: "Loading justification reasons"
122
+ },
123
+ errorNoticeIconAriaLabel: {
124
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.errorNoticeIconAriaLabel",
125
+ defaultMessage: "Error"
126
+ },
127
+ businessJustification: {
128
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.businessJustification",
129
+ defaultMessage: "Business Justification"
94
130
  }
95
131
  });
96
132
  export {
97
- o as default
133
+ a as default
98
134
  };
@@ -0,0 +1,128 @@
1
+ import K from "lodash/partition";
2
+ import { useState as C, useEffect as S } from "react";
3
+ import { useIntl as O, FormattedMessage as P } from "react-intl";
4
+ import { LoadingIndicator as z, Select as m, Link as G, InlineNotice as T } from "@box/blueprint-web";
5
+ import t from "./messages.js";
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ import { isCollaboratorRestricted as V } from "../../../utils/collaborator.js";
8
+ import { useUnifiedShareFormContext as q } from "../../../contexts/unified-share-form-context.js";
9
+ import { useUnifiedShareModalContext as H } from "../../../contexts/unified-share-modal-context.js";
10
+ import { callOnKeyboardEvent as Q } from "../../../utils/event.js";
11
+ import '../../../../../styles/shield-restriction-notice.css';const W = "_select_27xpi_1", X = "_link_27xpi_5", k = {
12
+ select: W,
13
+ link: X
14
+ };
15
+ function ct({
16
+ error: L,
17
+ isLoading: d,
18
+ onSelectedUsersChange: J
19
+ }) {
20
+ const {
21
+ formatMessage: s
22
+ } = O(), [j, h] = C(!1), [a, I] = C([]), {
23
+ setShieldRestriction: o,
24
+ setUserContacts: N,
25
+ shieldRestriction: x,
26
+ userContacts: y
27
+ } = q(), {
28
+ eventService: _,
29
+ item: R,
30
+ contactService: w
31
+ } = H(), {
32
+ getJustificationReasons: r
33
+ } = w, {
34
+ onRestrictedUsersRemoveClick: g
35
+ } = _, {
36
+ isJustificationAllowed: c,
37
+ restrictionType: A,
38
+ restrictedEmails: v = [],
39
+ restrictedGroups: b = []
40
+ } = L, l = [...v, ...b];
41
+ S(() => (c && o({
42
+ isJustificationAllowed: !0
43
+ }), () => {
44
+ o({
45
+ isJustificationAllowed: !1
46
+ });
47
+ }), [c, o]), S(() => {
48
+ (async () => {
49
+ if (!(!r || a.length))
50
+ try {
51
+ h(!0);
52
+ const {
53
+ classificationId: n,
54
+ options: u
55
+ } = await r(R);
56
+ o({
57
+ classificationId: n
58
+ }), I(u);
59
+ } finally {
60
+ h(!1);
61
+ }
62
+ })();
63
+ }, [R, r, c, a, o]);
64
+ const B = c ? t.justifiableContactRestrictionRemoveButtonLabel : t.contactRestrictionRemoveButtonLabel, p = () => {
65
+ const [e, n] = K(y, (u) => V(u, v, b));
66
+ J(n), N(n), g && g(e);
67
+ }, F = (e) => {
68
+ o({
69
+ justificationReason: a.find((n) => n.id === e)
70
+ });
71
+ }, M = j ? /* @__PURE__ */ i(z, {
72
+ "aria-label": s(t.loadingJustificationReasonsLabel),
73
+ size: "small"
74
+ }) : /* @__PURE__ */ i(m, {
75
+ className: k.select,
76
+ hideLabel: !0,
77
+ label: s(t.businessJustification),
78
+ onValueChange: F,
79
+ placeholder: s(t.justificationSelectPlaceholder),
80
+ value: x.justificationReason?.id,
81
+ children: /* @__PURE__ */ i(m.Content, {
82
+ align: "start",
83
+ children: a.map((e) => /* @__PURE__ */ i(m.Option, {
84
+ text: e.title,
85
+ value: e.id
86
+ }, e.id))
87
+ })
88
+ }), f = /* @__PURE__ */ i(G, {
89
+ "aria-disabled": d,
90
+ className: k.link,
91
+ onClick: p,
92
+ onKeyDown: Q(p, {
93
+ canPreventDefault: !0
94
+ }),
95
+ role: "button",
96
+ tabIndex: d ? -1 : 0,
97
+ children: s(B)
98
+ }), U = () => A === "information_barrier" ? {
99
+ message: t.contactRestrictionInformationBarrierNotice,
100
+ count: l.length,
101
+ removeLink: f
102
+ } : c && a?.length > 0 ? {
103
+ message: t.justifiableContactRestrictionNotice,
104
+ count: l.length,
105
+ justificationSelect: M,
106
+ removeLink: f
107
+ } : {
108
+ message: t.contactRestrictionNotice,
109
+ count: l.length,
110
+ removeLink: f
111
+ }, {
112
+ message: E,
113
+ ...D
114
+ } = U();
115
+ return /* @__PURE__ */ i(T, {
116
+ icon: () => null,
117
+ role: "alert",
118
+ variant: "error",
119
+ variantIconAriaLabel: s(t.errorNoticeIconAriaLabel),
120
+ children: /* @__PURE__ */ i(P, {
121
+ ...E,
122
+ values: D
123
+ })
124
+ });
125
+ }
126
+ export {
127
+ ct as ShieldRestrictionNotice
128
+ };
@@ -1,41 +1,48 @@
1
- import { createContext as S, useContext as v, useState as e, useMemo as b } from "react";
2
- import { jsx as P } from "react/jsx-runtime";
3
- const l = /* @__PURE__ */ S({}), R = () => {
4
- const t = v(l);
5
- if (!t)
1
+ import { createContext as P, useContext as p, useState as t, useCallback as V, useMemo as j } from "react";
2
+ import { jsx as k } from "react/jsx-runtime";
3
+ const x = /* @__PURE__ */ P({}), q = () => {
4
+ const e = p(x);
5
+ if (!e)
6
6
  throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
7
- return t;
8
- }, V = ({
9
- children: t,
7
+ return e;
8
+ }, w = ({
9
+ children: e,
10
10
  container: o,
11
- initialContacts: x,
12
- onModalOpenChange: r,
13
- onModalViewChange: s,
11
+ initialContacts: f,
12
+ onModalOpenChange: s,
13
+ onModalViewChange: r,
14
14
  onShareViewChange: n,
15
- shareView: c
15
+ shareView: i
16
16
  }) => {
17
- const [u, f] = e(x), [a, d] = e(""), [i, C] = e(""), [m, U] = e(), F = b(() => ({
18
- collaborationRole: m,
17
+ const [c, h] = t(f), [a, C] = t(""), [l, S] = t(""), [u, R] = t(), [d, U] = t({}), m = V((b) => {
18
+ U((v) => ({
19
+ ...v,
20
+ ...b
21
+ }));
22
+ }, []), F = j(() => ({
23
+ collaborationRole: u,
19
24
  contactValue: a,
20
25
  container: o,
21
- messageValue: i,
22
- onModalOpenChange: r,
23
- onModalViewChange: s,
26
+ messageValue: l,
27
+ onModalOpenChange: s,
28
+ onModalViewChange: r,
24
29
  onShareViewChange: n,
25
- setCollaborationRole: U,
26
- setContactValue: d,
27
- setMessageValue: C,
28
- setUserContacts: f,
29
- shareView: c,
30
- userContacts: u
31
- }), [m, a, o, i, r, s, n, c, u]);
32
- return /* @__PURE__ */ P(l.Provider, {
30
+ setCollaborationRole: R,
31
+ setContactValue: C,
32
+ setMessageValue: S,
33
+ setShieldRestriction: m,
34
+ setUserContacts: h,
35
+ shareView: i,
36
+ shieldRestriction: d,
37
+ userContacts: c
38
+ }), [u, a, o, m, l, s, r, n, i, d, c]);
39
+ return /* @__PURE__ */ k(x.Provider, {
33
40
  value: F,
34
- children: t
41
+ children: e
35
42
  });
36
43
  };
37
44
  export {
38
- l as UnifiedShareFormContext,
39
- V as UnifiedShareFormProvider,
40
- R as useUnifiedShareFormContext
45
+ x as UnifiedShareFormContext,
46
+ w as UnifiedShareFormProvider,
47
+ q as useUnifiedShareFormContext
41
48
  };