@box/unified-share-modal 2.6.7 → 2.6.9
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/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +3 -2
- package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +3 -2
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +3 -2
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +3 -2
- package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +7 -6
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +105 -112
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +3 -2
- package/dist/esm/lib/constants.js +1 -1
- package/dist/esm/lib/contexts/unified-share-form-context.js +27 -25
- package/dist/esm/lib/hooks/use-sharing-action.js +45 -56
- package/dist/esm/lib/messages.js +0 -4
- package/dist/esm/lib/utils/index.js +25 -22
- package/dist/esm/lib/utils/notification.js +17 -0
- package/dist/i18n/bn-IN.js +2 -2
- package/dist/i18n/da-DK.js +2 -2
- package/dist/i18n/de-DE.js +2 -2
- package/dist/i18n/en-AU.js +2 -2
- package/dist/i18n/en-CA.js +2 -2
- package/dist/i18n/en-GB.js +2 -2
- package/dist/i18n/en-US.js +0 -1
- package/dist/i18n/en-US.properties +0 -2
- package/dist/i18n/en-x-pseudo.js +2 -2
- package/dist/i18n/es-419.js +2 -2
- package/dist/i18n/es-ES.js +2 -2
- package/dist/i18n/fi-FI.js +2 -2
- package/dist/i18n/fr-CA.js +2 -2
- package/dist/i18n/fr-FR.js +2 -2
- package/dist/i18n/hi-IN.js +2 -2
- package/dist/i18n/it-IT.js +2 -2
- package/dist/i18n/ja-JP.js +2 -2
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +2 -2
- package/dist/i18n/nb-NO.js +2 -2
- package/dist/i18n/nl-NL.js +2 -2
- package/dist/i18n/pl-PL.js +2 -2
- package/dist/i18n/pt-BR.js +2 -2
- package/dist/i18n/ru-RU.js +2 -2
- package/dist/i18n/sv-SE.js +2 -2
- package/dist/i18n/tr-TR.js +2 -2
- package/dist/i18n/zh-CN.js +2 -2
- package/dist/i18n/zh-TW.js +2 -2
- package/dist/types/lib/contexts/unified-share-form-context.d.ts +2 -0
- package/dist/types/lib/messages.d.ts +0 -5
- package/dist/types/lib/types.d.ts +1 -1
- package/dist/types/lib/utils/index.d.ts +1 -0
- package/dist/types/lib/utils/notification.d.ts +9 -0
- package/package.json +9 -9
|
@@ -71,8 +71,9 @@ function q({
|
|
|
71
71
|
onClick: _,
|
|
72
72
|
children: t(n.okayButton)
|
|
73
73
|
})]
|
|
74
|
-
}), !
|
|
75
|
-
"aria-label": t(n.closeButton)
|
|
74
|
+
}), !a && /* @__PURE__ */ e(o.Close, {
|
|
75
|
+
"aria-label": t(n.closeButton),
|
|
76
|
+
disabled: r
|
|
76
77
|
})]
|
|
77
78
|
})
|
|
78
79
|
});
|
|
@@ -59,8 +59,9 @@ function z({
|
|
|
59
59
|
onClick: h,
|
|
60
60
|
children: t(n.okayButton)
|
|
61
61
|
})]
|
|
62
|
-
}), !
|
|
63
|
-
"aria-label": t(n.closeButton)
|
|
62
|
+
}), !l && /* @__PURE__ */ o(e.Close, {
|
|
63
|
+
"aria-label": t(n.closeButton),
|
|
64
|
+
disabled: i
|
|
64
65
|
})]
|
|
65
66
|
})
|
|
66
67
|
});
|
|
@@ -191,8 +191,9 @@ function lt() {
|
|
|
191
191
|
onClick: ce,
|
|
192
192
|
children: t(o.sendButton)
|
|
193
193
|
})]
|
|
194
|
-
}), !
|
|
195
|
-
"aria-label": t(o.closeButton)
|
|
194
|
+
}), !te && /* @__PURE__ */ r(v.Close, {
|
|
195
|
+
"aria-label": t(o.closeButton),
|
|
196
|
+
disabled: m
|
|
196
197
|
})]
|
|
197
198
|
}), U)]
|
|
198
199
|
});
|
package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js
CHANGED
|
@@ -19,9 +19,9 @@ function Z() {
|
|
|
19
19
|
const {
|
|
20
20
|
formatMessage: o
|
|
21
21
|
} = S(), l = x() === z.Small, {
|
|
22
|
-
collaborators:
|
|
22
|
+
collaborators: b,
|
|
23
23
|
config: s,
|
|
24
|
-
eventService:
|
|
24
|
+
eventService: f,
|
|
25
25
|
isFetching: _,
|
|
26
26
|
isSubmitting: k,
|
|
27
27
|
item: v,
|
|
@@ -31,7 +31,7 @@ function Z() {
|
|
|
31
31
|
type: y
|
|
32
32
|
} = v, {
|
|
33
33
|
onCollaboratorsManagementClick: n
|
|
34
|
-
} =
|
|
34
|
+
} = f, c = C === "desktop", {
|
|
35
35
|
containerRef: d,
|
|
36
36
|
previousForm: m,
|
|
37
37
|
setForm: F
|
|
@@ -77,7 +77,7 @@ function Z() {
|
|
|
77
77
|
children: o(r.roleColumn)
|
|
78
78
|
})]
|
|
79
79
|
}), /* @__PURE__ */ e(D, {
|
|
80
|
-
children:
|
|
80
|
+
children: b.slice(0, s.collaboratorsLimit).map((h) => /* @__PURE__ */ e(H, {
|
|
81
81
|
collaborator: h,
|
|
82
82
|
isSmall: l
|
|
83
83
|
}, h.id))
|
|
@@ -90,8 +90,9 @@ function Z() {
|
|
|
90
90
|
onClick: () => F(m === "invite" ? m : "default"),
|
|
91
91
|
children: o(r.doneButton)
|
|
92
92
|
})
|
|
93
|
-
}), !
|
|
94
|
-
"aria-label": o(r.closeButton)
|
|
93
|
+
}), !c && /* @__PURE__ */ e(i.Close, {
|
|
94
|
+
"aria-label": o(r.closeButton),
|
|
95
|
+
disabled: k
|
|
95
96
|
})]
|
|
96
97
|
}), d)]
|
|
97
98
|
});
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,122 +1,115 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { ClockBadge as
|
|
5
|
-
import { Mail as
|
|
6
|
-
import { SurfaceStatusSurfaceRed as
|
|
7
|
-
import { CopyInput as
|
|
8
|
-
import { SharedLinkAccess as
|
|
9
|
-
import { SharedLinkPermission as
|
|
1
|
+
import { useRef as M, useCallback as N, useEffect as O } from "react";
|
|
2
|
+
import { useIntl as R } from "react-intl";
|
|
3
|
+
import { useNotification as U, Text as S, Tooltip as y, Focusable as z, Switch as K, Status as G, Link as V, Button as q } from "@box/blueprint-web";
|
|
4
|
+
import { ClockBadge as H } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
+
import { Mail as J, Globe as E } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
+
import { SurfaceStatusSurfaceRed as Q, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
|
+
import { CopyInput as W } from "@box/copy-input";
|
|
8
|
+
import { SharedLinkAccess as X } from "./shared-link-access.js";
|
|
9
|
+
import { SharedLinkPermission as Y } from "./shared-link-permission.js";
|
|
10
10
|
import t from "./messages.js";
|
|
11
|
-
import { jsxs as
|
|
12
|
-
import { useUnifiedShareFormContext as
|
|
13
|
-
import { useUnifiedShareModalContext as
|
|
14
|
-
import { useSharingAction as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
12
|
+
import { useUnifiedShareFormContext as Z } from "../../../contexts/unified-share-form-context.js";
|
|
13
|
+
import { useUnifiedShareModalContext as $ } from "../../../contexts/unified-share-modal-context.js";
|
|
14
|
+
import { useSharingAction as ee } from "../../../hooks/use-sharing-action.js";
|
|
15
|
+
import { getNotificationArgs as te } from "../../../utils/notification.js";
|
|
16
|
+
import { formatDateFromTimestampToDateString as ie } from "../../../utils/date.js";
|
|
17
|
+
import { callOnKeyboardEvent as ae } from "../../../utils/event.js";
|
|
18
|
+
import '../../../../../styles/shared-link-section.css';const ne = "_container_j966c_1", oe = "_toggle_j966c_7", re = "_settings_j966c_13", se = "_copy_j966c_22", ce = "_access_j966c_30", le = "_icon_j966c_36", c = {
|
|
19
|
+
container: ne,
|
|
20
|
+
toggle: oe,
|
|
20
21
|
settings: re,
|
|
21
|
-
copy:
|
|
22
|
-
access:
|
|
23
|
-
icon:
|
|
22
|
+
copy: se,
|
|
23
|
+
access: ce,
|
|
24
|
+
icon: le
|
|
24
25
|
};
|
|
25
|
-
function
|
|
26
|
+
function Ae() {
|
|
26
27
|
const {
|
|
27
28
|
formatMessage: e
|
|
28
|
-
} =
|
|
29
|
-
|
|
30
|
-
} =
|
|
29
|
+
} = R(), {
|
|
30
|
+
addNotification: C
|
|
31
|
+
} = U(), f = M(null), {
|
|
32
|
+
isSharedLinkAutoCopied: k,
|
|
33
|
+
isSharedLinkAutoCreated: r,
|
|
34
|
+
setForm: D
|
|
35
|
+
} = Z(), {
|
|
31
36
|
config: s,
|
|
32
|
-
isFetching:
|
|
37
|
+
isFetching: v,
|
|
33
38
|
isSubmitting: n,
|
|
34
|
-
item:
|
|
35
|
-
setView:
|
|
39
|
+
item: j,
|
|
40
|
+
setView: L,
|
|
36
41
|
sharedLink: o,
|
|
37
|
-
sharingService:
|
|
38
|
-
} =
|
|
39
|
-
permissions:
|
|
40
|
-
} =
|
|
41
|
-
createSharedLink:
|
|
42
|
-
} =
|
|
43
|
-
sharedLinkAutoCopy:
|
|
44
|
-
sharedLinkAutoCreate:
|
|
45
|
-
} = s
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const U = x((u) => {
|
|
65
|
-
if (!m.current)
|
|
66
|
-
return;
|
|
67
|
-
let c;
|
|
68
|
-
u instanceof Error ? c = C ? e(t.autoCreateCopyErrorNoticeText) : null : c = e(C ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), c && m.current.resolve({
|
|
69
|
-
messages: [{
|
|
70
|
-
text: c,
|
|
71
|
-
type: "success"
|
|
72
|
-
}]
|
|
73
|
-
}), m.current = null;
|
|
74
|
-
}, [e, C]), z = async (u) => {
|
|
75
|
-
u || b("remove-shared-link"), u && await S();
|
|
42
|
+
sharingService: w
|
|
43
|
+
} = $(), {
|
|
44
|
+
permissions: x = {}
|
|
45
|
+
} = j, {
|
|
46
|
+
createSharedLink: _
|
|
47
|
+
} = w, {
|
|
48
|
+
sharedLinkAutoCopy: I,
|
|
49
|
+
sharedLinkAutoCreate: T
|
|
50
|
+
} = s, a = !!o.url, h = I && !k.current, A = T && !r.current, P = N(async () => {
|
|
51
|
+
const l = await _();
|
|
52
|
+
return h ? {
|
|
53
|
+
messages: []
|
|
54
|
+
} : l;
|
|
55
|
+
}, [h, _]), {
|
|
56
|
+
onAction: b
|
|
57
|
+
} = ee(P, "create-shared-link");
|
|
58
|
+
O(() => {
|
|
59
|
+
(async () => v || n || ((h || A) && !a && (await b(), r.current = !0), h && a && f.current && (f.current.click(), k.current = !0)))();
|
|
60
|
+
}, [a, h, A, v, k, r, n, b]);
|
|
61
|
+
const B = N((l) => {
|
|
62
|
+
let p;
|
|
63
|
+
l instanceof Error ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && C({
|
|
64
|
+
...te(e, "success"),
|
|
65
|
+
styledText: p
|
|
66
|
+
});
|
|
67
|
+
}, [C, e, r]), F = async (l) => {
|
|
68
|
+
l || L("remove-shared-link"), l && await b();
|
|
76
69
|
};
|
|
77
|
-
let
|
|
78
|
-
return !a && !n && (
|
|
79
|
-
className:
|
|
80
|
-
children: [/* @__PURE__ */ i(
|
|
70
|
+
let m, u = !1;
|
|
71
|
+
return !a && !n && (m = e(t.sharedLinkToggleTooltip)), !a && !x.canShare && (m = e(t.createLinkDisabledTooltip), u = !0), a && !x.canSetShareAccess && (m = e(t.removeLinkDisabledTooltip), u = !0), /* @__PURE__ */ d("div", {
|
|
72
|
+
className: c.container,
|
|
73
|
+
children: [/* @__PURE__ */ i(S, {
|
|
81
74
|
as: "label",
|
|
82
75
|
variant: "bodyDefaultBold",
|
|
83
76
|
children: e(t.shareLinkLabel)
|
|
84
|
-
}), /* @__PURE__ */
|
|
85
|
-
className:
|
|
86
|
-
children: [/* @__PURE__ */ i(
|
|
77
|
+
}), /* @__PURE__ */ d("div", {
|
|
78
|
+
className: c.toggle,
|
|
79
|
+
children: [/* @__PURE__ */ i(y, {
|
|
87
80
|
align: "start",
|
|
88
|
-
content:
|
|
81
|
+
content: m,
|
|
89
82
|
"data-testid": "shared-link-tooltip",
|
|
90
|
-
open:
|
|
91
|
-
children: /* @__PURE__ */ i(
|
|
92
|
-
focusable:
|
|
93
|
-
children: /* @__PURE__ */ i(
|
|
83
|
+
open: m ? void 0 : !1,
|
|
84
|
+
children: /* @__PURE__ */ i(z, {
|
|
85
|
+
focusable: u,
|
|
86
|
+
children: /* @__PURE__ */ i(K.Item, {
|
|
94
87
|
checked: a,
|
|
95
88
|
"data-target-id": "Toggle-CreateSharedLink",
|
|
96
|
-
disabled:
|
|
89
|
+
disabled: u || n,
|
|
97
90
|
label: e(t.sharedLinkToggleLabel),
|
|
98
|
-
onCheckedChange:
|
|
91
|
+
onCheckedChange: F,
|
|
99
92
|
value: "shared-link"
|
|
100
93
|
})
|
|
101
94
|
})
|
|
102
|
-
}), a && !!o.expiresAt && /* @__PURE__ */ i(
|
|
95
|
+
}), a && !!o.expiresAt && /* @__PURE__ */ i(y, {
|
|
103
96
|
content: e(t.expirationIconTooltip, {
|
|
104
|
-
expirationDate:
|
|
97
|
+
expirationDate: ie(o.expiresAt)
|
|
105
98
|
}),
|
|
106
99
|
"data-testid": "expiration-date-tooltip",
|
|
107
|
-
children: /* @__PURE__ */ i(
|
|
108
|
-
color:
|
|
100
|
+
children: /* @__PURE__ */ i(G, {
|
|
101
|
+
color: Q,
|
|
109
102
|
hideText: !0,
|
|
110
|
-
icon:
|
|
103
|
+
icon: H,
|
|
111
104
|
text: e(t.expirationIconLabel)
|
|
112
105
|
})
|
|
113
|
-
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(
|
|
106
|
+
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(V, {
|
|
114
107
|
"aria-disabled": n,
|
|
115
108
|
"aria-haspopup": "dialog",
|
|
116
|
-
className:
|
|
109
|
+
className: c.settings,
|
|
117
110
|
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
118
|
-
onClick: () =>
|
|
119
|
-
onKeyDown:
|
|
111
|
+
onClick: () => L("shared-link-settings"),
|
|
112
|
+
onKeyDown: ae(() => L("shared-link-settings"), {
|
|
120
113
|
canPreventDefault: !0
|
|
121
114
|
}),
|
|
122
115
|
role: "button",
|
|
@@ -124,49 +117,49 @@ function Te() {
|
|
|
124
117
|
variant: "standalone",
|
|
125
118
|
children: e(t.sharedLinkSettingsLabel)
|
|
126
119
|
})]
|
|
127
|
-
}), a && /* @__PURE__ */
|
|
128
|
-
className:
|
|
129
|
-
children: [/* @__PURE__ */ i(
|
|
130
|
-
ref:
|
|
131
|
-
autoFocus:
|
|
120
|
+
}), a && /* @__PURE__ */ d("div", {
|
|
121
|
+
className: c.copy,
|
|
122
|
+
children: [/* @__PURE__ */ i(W, {
|
|
123
|
+
ref: f,
|
|
124
|
+
autoFocus: T && r.current,
|
|
132
125
|
"data-target-id": "Button-CopySharedLink",
|
|
133
126
|
disabled: n,
|
|
134
127
|
hideLabel: !0,
|
|
135
128
|
label: e(t.sharedLinkUrlLabel),
|
|
136
|
-
onCopy:
|
|
129
|
+
onCopy: B,
|
|
137
130
|
value: o.url
|
|
138
|
-
}), s.sharedLinkEmail && /* @__PURE__ */ i(
|
|
131
|
+
}), s.sharedLinkEmail && /* @__PURE__ */ i(y, {
|
|
139
132
|
align: "end",
|
|
140
133
|
content: e(t.sharedLinkEmailLabel),
|
|
141
|
-
children: /* @__PURE__ */ i(
|
|
134
|
+
children: /* @__PURE__ */ i(q, {
|
|
142
135
|
"aria-label": e(t.sharedLinkEmailLabel),
|
|
143
136
|
"data-target-id": "Button-SendSharedLink",
|
|
144
137
|
disabled: n,
|
|
145
|
-
icon:
|
|
146
|
-
onClick: () =>
|
|
138
|
+
icon: J,
|
|
139
|
+
onClick: () => D("email"),
|
|
147
140
|
size: "large",
|
|
148
141
|
variant: "secondary"
|
|
149
142
|
})
|
|
150
143
|
})]
|
|
151
|
-
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */
|
|
152
|
-
className:
|
|
153
|
-
children: [s.sharedLinkAccess && /* @__PURE__ */ i(
|
|
154
|
-
}), a && o.access === "open" && /* @__PURE__ */
|
|
155
|
-
children: [/* @__PURE__ */ i(
|
|
156
|
-
className:
|
|
144
|
+
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ d("div", {
|
|
145
|
+
className: c.access,
|
|
146
|
+
children: [s.sharedLinkAccess && /* @__PURE__ */ i(X, {}), s.sharedLinkPermission && /* @__PURE__ */ i(Y, {})]
|
|
147
|
+
}), a && o.access === "open" && /* @__PURE__ */ d("div", {
|
|
148
|
+
children: [/* @__PURE__ */ i(E, {
|
|
149
|
+
className: c.icon,
|
|
157
150
|
height: g,
|
|
158
151
|
width: g
|
|
159
|
-
}), /* @__PURE__ */ i(
|
|
152
|
+
}), /* @__PURE__ */ i(S, {
|
|
160
153
|
as: "span",
|
|
161
154
|
color: "textOnLightSecondary",
|
|
162
155
|
children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
163
156
|
})]
|
|
164
|
-
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */
|
|
165
|
-
children: [/* @__PURE__ */ i(
|
|
166
|
-
className:
|
|
157
|
+
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
|
|
158
|
+
children: [/* @__PURE__ */ i(E, {
|
|
159
|
+
className: c.icon,
|
|
167
160
|
height: g,
|
|
168
161
|
width: g
|
|
169
|
-
}), /* @__PURE__ */ i(
|
|
162
|
+
}), /* @__PURE__ */ i(S, {
|
|
170
163
|
as: "span",
|
|
171
164
|
color: "textOnLightSecondary",
|
|
172
165
|
children: e(t.sharedLinkElevatedEditableCompanyAvailable)
|
|
@@ -175,5 +168,5 @@ function Te() {
|
|
|
175
168
|
});
|
|
176
169
|
}
|
|
177
170
|
export {
|
|
178
|
-
|
|
171
|
+
Ae as SharedLinkSection
|
|
179
172
|
};
|
|
@@ -72,8 +72,9 @@ function X({
|
|
|
72
72
|
className: a(t.form, f && t.isLoading),
|
|
73
73
|
children: u === "collaborators" ? /* @__PURE__ */ o(M, {}) : /* @__PURE__ */ o(D, {})
|
|
74
74
|
})]
|
|
75
|
-
}), !
|
|
76
|
-
"aria-label": n(l.closeButton)
|
|
75
|
+
}), !_ && g && /* @__PURE__ */ o(e.Close, {
|
|
76
|
+
"aria-label": n(l.closeButton),
|
|
77
|
+
disabled: s
|
|
77
78
|
})]
|
|
78
79
|
})]
|
|
79
80
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = ["invite-collaborators", "remove-collaborator", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link"
|
|
1
|
+
const e = ["invite-collaborators", "remove-collaborator", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link"], r = {
|
|
2
2
|
collaboration: !0,
|
|
3
3
|
collaborationLimit: 100,
|
|
4
4
|
collaborationMessage: !0,
|
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
import { createContext as
|
|
1
|
+
import { createContext as w, useContext as M, useState as e, useRef as U, useCallback as A, useEffect as E, useMemo as L } from "react";
|
|
2
2
|
import { useUnifiedShareModalContext as j } from "./unified-share-modal-context.js";
|
|
3
|
-
import { jsx as
|
|
4
|
-
const
|
|
5
|
-
const t =
|
|
3
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
4
|
+
const V = /* @__PURE__ */ w(null), B = () => {
|
|
5
|
+
const t = M(V);
|
|
6
6
|
if (!t)
|
|
7
7
|
throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
|
|
8
8
|
return t;
|
|
9
|
-
},
|
|
9
|
+
}, D = ({
|
|
10
10
|
children: t
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
initialContacts: o,
|
|
14
|
-
isOpen:
|
|
15
|
-
} = j(), [
|
|
16
|
-
|
|
17
|
-
...
|
|
18
|
-
...
|
|
14
|
+
isOpen: s
|
|
15
|
+
} = j(), [n, r] = e("default"), [i, a] = e("default"), [c, b] = e(null), [l, u] = e(o), [d, f] = e(""), [m, h] = e(""), [C, S] = e(), [x, R] = e({}), F = U(!1), p = U(!1), v = A((g) => {
|
|
16
|
+
R((k) => ({
|
|
17
|
+
...k,
|
|
18
|
+
...g
|
|
19
19
|
}));
|
|
20
20
|
}, []);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, [o,
|
|
24
|
-
const
|
|
21
|
+
E(() => {
|
|
22
|
+
s || (r("default"), a("default"), u(o), f(""), h(""), S(void 0), R({}), F.current = !1, p.current = !1);
|
|
23
|
+
}, [o, s]);
|
|
24
|
+
const P = L(() => ({
|
|
25
25
|
collaborationRole: C,
|
|
26
26
|
contactValue: d,
|
|
27
27
|
containerRef: c,
|
|
28
|
-
form:
|
|
28
|
+
form: n,
|
|
29
|
+
isSharedLinkAutoCopied: F,
|
|
30
|
+
isSharedLinkAutoCreated: p,
|
|
29
31
|
messageValue: m,
|
|
30
32
|
previousForm: i,
|
|
31
|
-
setCollaborationRole:
|
|
33
|
+
setCollaborationRole: S,
|
|
32
34
|
setContactValue: f,
|
|
33
|
-
setContainerRef:
|
|
35
|
+
setContainerRef: b,
|
|
34
36
|
setForm: r,
|
|
35
37
|
setMessageValue: h,
|
|
36
38
|
setPreviousForm: a,
|
|
37
|
-
setShieldRestriction:
|
|
39
|
+
setShieldRestriction: v,
|
|
38
40
|
setUserContacts: u,
|
|
39
|
-
shieldRestriction:
|
|
41
|
+
shieldRestriction: x,
|
|
40
42
|
userContacts: l
|
|
41
|
-
}), [C, d, c,
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
value:
|
|
43
|
+
}), [C, d, c, n, v, m, i, x, l]);
|
|
44
|
+
return /* @__PURE__ */ O(V.Provider, {
|
|
45
|
+
value: P,
|
|
44
46
|
children: t
|
|
45
47
|
});
|
|
46
48
|
};
|
|
47
49
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
V as UnifiedShareFormContext,
|
|
51
|
+
D as UnifiedShareFormProvider,
|
|
52
|
+
B as useUnifiedShareFormContext
|
|
51
53
|
};
|
|
@@ -1,71 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const u = (s, e) => ({
|
|
8
|
-
closeButtonAriaLabel: s(n.noticeCloseLabel),
|
|
9
|
-
sensitivity: "foreground",
|
|
10
|
-
typeIconAriaLabel: s(e === "success" ? n.successNoticeIcon : n.errorNoticeIcon),
|
|
11
|
-
variant: e
|
|
12
|
-
}), N = (s, e, t, r) => {
|
|
13
|
-
if (!t)
|
|
14
|
-
return "";
|
|
15
|
-
const l = T(t), c = n[`${l}${e === "success" ? "Success" : "Error"}NoticeText`];
|
|
16
|
-
return c ? s(c, r) : e === "error" ? s(n.defaultErrorNoticeText) : "";
|
|
17
|
-
}, B = (s, e) => {
|
|
1
|
+
import { useMemo as x, useCallback as A } from "react";
|
|
2
|
+
import { useIntl as b } from "react-intl";
|
|
3
|
+
import { useNotification as C } from "@box/blueprint-web";
|
|
4
|
+
import { useUnifiedShareModalContext as T } from "../contexts/unified-share-modal-context.js";
|
|
5
|
+
import { getNotificationArgs as a, getNotificationMessage as d } from "../utils/notification.js";
|
|
6
|
+
const v = (c, t) => {
|
|
18
7
|
const {
|
|
19
|
-
formatMessage:
|
|
20
|
-
} =
|
|
21
|
-
addNotification:
|
|
22
|
-
} =
|
|
23
|
-
config:
|
|
24
|
-
item:
|
|
25
|
-
setIsLoading:
|
|
26
|
-
} =
|
|
27
|
-
notifications:
|
|
28
|
-
} =
|
|
29
|
-
name:
|
|
30
|
-
} =
|
|
8
|
+
formatMessage: e
|
|
9
|
+
} = b(), {
|
|
10
|
+
addNotification: i
|
|
11
|
+
} = C(), {
|
|
12
|
+
config: u,
|
|
13
|
+
item: g,
|
|
14
|
+
setIsLoading: n
|
|
15
|
+
} = T(), {
|
|
16
|
+
notifications: f
|
|
17
|
+
} = u, {
|
|
18
|
+
name: l
|
|
19
|
+
} = g, r = x(() => f.includes(t), [t, f]);
|
|
31
20
|
return {
|
|
32
|
-
onAction:
|
|
33
|
-
|
|
21
|
+
onAction: A(async (...h) => {
|
|
22
|
+
n(!0);
|
|
34
23
|
try {
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
text:
|
|
39
|
-
type:
|
|
40
|
-
...
|
|
24
|
+
if (c) {
|
|
25
|
+
const s = await c(...h), o = r && !!s && !!s.messages, N = r && !o;
|
|
26
|
+
o && s.messages.forEach(({
|
|
27
|
+
text: p,
|
|
28
|
+
type: y,
|
|
29
|
+
...M
|
|
41
30
|
}) => {
|
|
42
|
-
|
|
43
|
-
...
|
|
44
|
-
styledText:
|
|
45
|
-
...
|
|
31
|
+
i({
|
|
32
|
+
...a(e, y),
|
|
33
|
+
styledText: p,
|
|
34
|
+
...M
|
|
46
35
|
});
|
|
47
36
|
});
|
|
48
|
-
const
|
|
49
|
-
itemName:
|
|
37
|
+
const m = d(e, "success", t, {
|
|
38
|
+
itemName: l
|
|
50
39
|
});
|
|
51
|
-
|
|
52
|
-
...
|
|
53
|
-
styledText:
|
|
40
|
+
N && m && i({
|
|
41
|
+
...a(e, "success"),
|
|
42
|
+
styledText: m
|
|
54
43
|
});
|
|
55
44
|
}
|
|
56
|
-
} catch (
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
...
|
|
60
|
-
styledText:
|
|
61
|
-
}),
|
|
62
|
-
throw
|
|
45
|
+
} catch (s) {
|
|
46
|
+
const o = d(e, "error", t);
|
|
47
|
+
if (r && o && i({
|
|
48
|
+
...a(e, "error"),
|
|
49
|
+
styledText: o
|
|
50
|
+
}), s?.fields && Object.values(s.fields).length)
|
|
51
|
+
throw s.fields;
|
|
63
52
|
} finally {
|
|
64
|
-
|
|
53
|
+
n(!1);
|
|
65
54
|
}
|
|
66
|
-
}, [
|
|
55
|
+
}, [c, i, e, r, l, t, n])
|
|
67
56
|
};
|
|
68
57
|
};
|
|
69
58
|
export {
|
|
70
|
-
|
|
59
|
+
v as useSharingAction
|
|
71
60
|
};
|
package/dist/esm/lib/messages.js
CHANGED
|
@@ -48,10 +48,6 @@ const a = e({
|
|
|
48
48
|
id: "groupSharedFeatures.usm.emailSharedLinkSuccessNoticeText",
|
|
49
49
|
defaultMessage: "The shared link for “{itemName}” was sent successfully."
|
|
50
50
|
},
|
|
51
|
-
autoCopySharedLinkErrorNoticeText: {
|
|
52
|
-
id: "groupSharedFeatures.usm.autoCopySharedLinkErrorNoticeText",
|
|
53
|
-
defaultMessage: "Unable to create a shared link. Please try again later."
|
|
54
|
-
},
|
|
55
51
|
vanityNameInvalidErrorMessage: {
|
|
56
52
|
id: "groupSharedFeatures.usm.vanityNameInvalidErrorMessage",
|
|
57
53
|
defaultMessage: "Custom URLs must be between 12-30 characters, and can include letters, numbers, and hyphens"
|