@box/unified-share-modal 0.48.5 → 0.48.6
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/shared-link-settings-modal/shared-link-settings-modal.js +25 -25
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +81 -78
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +45 -43
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +45 -43
- package/dist/esm/lib/hooks/use-collaboration-form.js +45 -34
- package/dist/esm/lib/hooks/use-link-settings-form.js +47 -43
- package/dist/esm/lib/utils/date.js +4 -4
- package/dist/esm/lib/utils/form.js +16 -0
- package/dist/esm/lib/utils/index.js +16 -15
- package/dist/esm/lib/utils/validation.js +9 -41
- package/dist/types/lib/stories/shared.d.ts +3 -1
- package/dist/types/lib/types.d.ts +128 -8
- package/dist/types/lib/utils/form.d.ts +3 -0
- package/dist/types/lib/utils/index.d.ts +1 -0
- package/dist/types/lib/utils/validation.d.ts +0 -13
- package/package.json +3 -3
|
@@ -2,43 +2,43 @@ import { useMemo as G } from "react";
|
|
|
2
2
|
import { useIntl as J } from "react-intl";
|
|
3
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 d, Fragment as
|
|
5
|
+
import { jsx as n, jsxs as d, Fragment as N } from "react/jsx-runtime";
|
|
6
6
|
import { useAccessLevels as Z } from "../../hooks/use-access-levels.js";
|
|
7
7
|
import { formatDateFromTimestampToCalendarDate as aa, formatTomorrowDateToCalendarDate as ea } from "../../utils/date.js";
|
|
8
8
|
import { useLinkSettingsForm as na } from "../../hooks/use-link-settings-form.js";
|
|
9
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",
|
|
10
|
+
import '../../../../styles/shared-link-settings-modal.css';const oa = "_content_1wiic_1", ta = "_body_1wiic_5", S = {
|
|
11
11
|
content: oa,
|
|
12
12
|
body: ta
|
|
13
13
|
}, ra = "••••••••";
|
|
14
14
|
function ua({
|
|
15
|
-
isOpen:
|
|
16
|
-
onOpenChange:
|
|
15
|
+
isOpen: P,
|
|
16
|
+
onOpenChange: m
|
|
17
17
|
}) {
|
|
18
18
|
const {
|
|
19
19
|
formatMessage: a
|
|
20
20
|
} = J(), {
|
|
21
|
-
eventService:
|
|
21
|
+
eventService: D,
|
|
22
22
|
isSubmitting: T,
|
|
23
23
|
sharedLink: f
|
|
24
24
|
} = ia(), {
|
|
25
|
-
expiresAt:
|
|
25
|
+
expiresAt: w,
|
|
26
26
|
settings: i = {},
|
|
27
27
|
vanityDomain: A,
|
|
28
|
-
vanityName:
|
|
28
|
+
vanityName: h
|
|
29
29
|
} = f, {
|
|
30
|
-
onSharedLinkSettingsClose:
|
|
31
|
-
} =
|
|
32
|
-
selectedAccess:
|
|
33
|
-
} = Z(), b =
|
|
30
|
+
onSharedLinkSettingsClose: v
|
|
31
|
+
} = D, {
|
|
32
|
+
selectedAccess: g
|
|
33
|
+
} = Z(), b = w ? aa(w) : null, p = G(() => ({
|
|
34
34
|
expiration: b,
|
|
35
35
|
isDownloadEnabled: !!i.isDownloadEnabled,
|
|
36
36
|
isExpirationEnabled: !!b,
|
|
37
37
|
isPasswordEnabled: !!i.isPasswordEnabled,
|
|
38
|
-
|
|
38
|
+
isVanityNameEnabled: !!h,
|
|
39
39
|
password: "",
|
|
40
|
-
vanityName:
|
|
41
|
-
}), [b, i,
|
|
40
|
+
vanityName: h || ""
|
|
41
|
+
}), [b, i, h]), {
|
|
42
42
|
errors: u,
|
|
43
43
|
formData: t,
|
|
44
44
|
handleFormReset: y,
|
|
@@ -48,15 +48,15 @@ function ua({
|
|
|
48
48
|
setFieldValue: s,
|
|
49
49
|
validatePassword: V
|
|
50
50
|
} = na(p), B = () => {
|
|
51
|
-
y(),
|
|
51
|
+
y(), v && v(), m(!1);
|
|
52
52
|
}, M = async () => {
|
|
53
|
-
await I() || (y(),
|
|
53
|
+
await I() || (y(), m(!1));
|
|
54
54
|
}, _ = (o) => {
|
|
55
55
|
l("expiration", void 0), s("isExpirationEnabled", o);
|
|
56
56
|
}, U = (o) => {
|
|
57
57
|
l("expiration", void 0), s("expiration", o);
|
|
58
58
|
}, R = (o) => {
|
|
59
|
-
l("vanityName", void 0), s("
|
|
59
|
+
l("vanityName", void 0), s("isVanityNameEnabled", o);
|
|
60
60
|
}, W = (o) => {
|
|
61
61
|
l("vanityName", void 0), s("vanityName", o.target.value);
|
|
62
62
|
}, j = (o) => {
|
|
@@ -71,15 +71,15 @@ function ua({
|
|
|
71
71
|
p.isPasswordEnabled && !t.password || q || V(t.password);
|
|
72
72
|
}, H = i.canChangeVanityName && !!t.vanityName, Y = `${A || ""}${t.vanityName}`, x = T || F;
|
|
73
73
|
return /* @__PURE__ */ n(r, {
|
|
74
|
-
onOpenChange:
|
|
75
|
-
open:
|
|
74
|
+
onOpenChange: m,
|
|
75
|
+
open: P,
|
|
76
76
|
children: /* @__PURE__ */ d(r.Content, {
|
|
77
|
-
className:
|
|
77
|
+
className: S.content,
|
|
78
78
|
size: "medium",
|
|
79
79
|
children: [/* @__PURE__ */ n(r.Header, {
|
|
80
80
|
children: a(e.title)
|
|
81
81
|
}), /* @__PURE__ */ d(r.Body, {
|
|
82
|
-
className:
|
|
82
|
+
className: S.body,
|
|
83
83
|
children: [/* @__PURE__ */ n(C, {
|
|
84
84
|
as: "p",
|
|
85
85
|
color: "textOnLightSecondary",
|
|
@@ -114,13 +114,13 @@ function ua({
|
|
|
114
114
|
previousMonthAriaLabel: a(e.linkExpirationPreviousMonthAriaLabel),
|
|
115
115
|
value: t.expiration
|
|
116
116
|
})
|
|
117
|
-
}), i.isPasswordAvailable && (
|
|
117
|
+
}), i.isPasswordAvailable && (g == null ? void 0 : g.id) === "open" && /* @__PURE__ */ n(c.Item, {
|
|
118
118
|
checked: t.isPasswordEnabled,
|
|
119
119
|
disabled: !i.canChangePassword,
|
|
120
120
|
label: a(e.passwordToggleText),
|
|
121
121
|
onCheckedChange: j,
|
|
122
122
|
value: "password-settings"
|
|
123
|
-
}), t.isPasswordEnabled && /* @__PURE__ */ d(
|
|
123
|
+
}), t.isPasswordEnabled && /* @__PURE__ */ d(N, {
|
|
124
124
|
children: [i.canChangePassword && /* @__PURE__ */ n(k, {
|
|
125
125
|
variant: "warning",
|
|
126
126
|
variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
|
|
@@ -138,12 +138,12 @@ function ua({
|
|
|
138
138
|
value: t.password
|
|
139
139
|
})]
|
|
140
140
|
}), i.isVanityNameAvailable && /* @__PURE__ */ n(c.Item, {
|
|
141
|
-
checked: t.
|
|
141
|
+
checked: t.isVanityNameEnabled,
|
|
142
142
|
disabled: !i.canChangeVanityName,
|
|
143
143
|
label: a(e.vanityNameToggleText),
|
|
144
144
|
onCheckedChange: R,
|
|
145
145
|
value: "vanity-domain-settings"
|
|
146
|
-
}), t.
|
|
146
|
+
}), t.isVanityNameEnabled && /* @__PURE__ */ d(N, {
|
|
147
147
|
children: [i.canChangeVanityName && /* @__PURE__ */ n(k, {
|
|
148
148
|
variant: "warning",
|
|
149
149
|
variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
|
|
@@ -1,108 +1,111 @@
|
|
|
1
|
-
import { useCallback as C } from "react";
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { useUniqueId as
|
|
5
|
-
import { UserSelectorContainer as
|
|
6
|
-
import { CollaborationRole as
|
|
7
|
-
import { SharedWithAvatars as
|
|
8
|
-
import { TextAreaContainer as
|
|
9
|
-
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as
|
|
10
|
-
import
|
|
11
|
-
import { jsxs as s, jsx as
|
|
12
|
-
import { useCollaborationForm as
|
|
13
|
-
import { useUnifiedShareFormContext as
|
|
14
|
-
import { useUnifiedShareModalContext as
|
|
15
|
-
import '../../../../../styles/collaboration-section.css';const
|
|
16
|
-
container:
|
|
17
|
-
label:
|
|
1
|
+
import { useRef as H, useEffect as K, useCallback as C } from "react";
|
|
2
|
+
import { createPortal as W } from "react-dom";
|
|
3
|
+
import { useIntl as z } from "react-intl";
|
|
4
|
+
import { useUniqueId as J, useLabelable as Q, Modal as i } from "@box/blueprint-web";
|
|
5
|
+
import { UserSelectorContainer as X } from "@box/user-selector";
|
|
6
|
+
import { CollaborationRole as Y } from "./collaboration-role.js";
|
|
7
|
+
import { SharedWithAvatars as Z } from "./shared-with-avatars.js";
|
|
8
|
+
import { TextAreaContainer as $ } from "./text-area-container.js";
|
|
9
|
+
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as ee } from "../../../constants.js";
|
|
10
|
+
import a from "./messages.js";
|
|
11
|
+
import { jsxs as s, jsx as n, Fragment as te } from "react/jsx-runtime";
|
|
12
|
+
import { useCollaborationForm as oe } from "../../../hooks/use-collaboration-form.js";
|
|
13
|
+
import { useUnifiedShareFormContext as ae } from "../../../contexts/unified-share-form-context.js";
|
|
14
|
+
import { useUnifiedShareModalContext as ne } from "../../../contexts/unified-share-modal-context.js";
|
|
15
|
+
import '../../../../../styles/collaboration-section.css';const re = "_container_19jv3_1", le = "_label_19jv3_7", A = {
|
|
16
|
+
container: re,
|
|
17
|
+
label: le
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function Fe() {
|
|
20
20
|
const {
|
|
21
|
-
formatMessage:
|
|
22
|
-
} =
|
|
23
|
-
contactValue:
|
|
21
|
+
formatMessage: o
|
|
22
|
+
} = z(), {
|
|
23
|
+
contactValue: B,
|
|
24
24
|
container: c,
|
|
25
|
-
onModalOpenChange:
|
|
25
|
+
onModalOpenChange: v,
|
|
26
26
|
onShareViewChange: m,
|
|
27
|
-
shareView:
|
|
28
|
-
userContacts:
|
|
29
|
-
} =
|
|
30
|
-
config:
|
|
31
|
-
contactService:
|
|
32
|
-
isFetching:
|
|
27
|
+
shareView: e,
|
|
28
|
+
userContacts: g
|
|
29
|
+
} = ae(), {
|
|
30
|
+
config: r,
|
|
31
|
+
contactService: x,
|
|
32
|
+
isFetching: E,
|
|
33
33
|
isSubmitting: u,
|
|
34
34
|
sharingService: I
|
|
35
|
-
} =
|
|
35
|
+
} = ne(), {
|
|
36
36
|
getContacts: d,
|
|
37
|
-
getContactsAvatarUrls:
|
|
38
|
-
} =
|
|
39
|
-
|
|
37
|
+
getContactsAvatarUrls: f
|
|
38
|
+
} = x, {
|
|
39
|
+
sendInvitations: P,
|
|
40
40
|
sendSharedLink: _
|
|
41
|
-
} = I,
|
|
41
|
+
} = I, h = e === "default" || e === "invite", l = e === "invite" || e === "email", S = H(e === "email" ? "email" : "invite");
|
|
42
|
+
K(() => {
|
|
43
|
+
S.current = e === "email" ? "email" : "invite";
|
|
44
|
+
}, [e]);
|
|
42
45
|
let b, p;
|
|
43
|
-
|
|
46
|
+
e === "invite" && (b = P, p = "invite-collaborators"), e === "email" && (b = _, p = "email-shared-link");
|
|
44
47
|
const {
|
|
45
|
-
errors:
|
|
46
|
-
handleFormReset:
|
|
47
|
-
handleFormSubmit:
|
|
48
|
+
errors: O,
|
|
49
|
+
handleFormReset: F,
|
|
50
|
+
handleFormSubmit: V,
|
|
48
51
|
handleSelectedUsersChange: M,
|
|
49
|
-
handleUserSelectorBlur:
|
|
50
|
-
isFormSubmitting:
|
|
52
|
+
handleUserSelectorBlur: R,
|
|
53
|
+
isFormSubmitting: L,
|
|
51
54
|
updateContactValue: k
|
|
52
|
-
} =
|
|
53
|
-
l || m("invite"), k(
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
await
|
|
58
|
-
},
|
|
55
|
+
} = oe(b, p), N = C((t) => (t.stopPropagation(), !0), []), y = C((t) => d ? d(t, S.current) : Promise.resolve([]), [d]), T = C((t) => f ? f(t) : Promise.resolve({}), [f]), j = (t) => {
|
|
56
|
+
l || m("invite"), k(t);
|
|
57
|
+
}, w = () => {
|
|
58
|
+
F(), m("default");
|
|
59
|
+
}, q = async () => {
|
|
60
|
+
await V() || (F(), v && v(!1), m("default"));
|
|
61
|
+
}, U = J("user-contacts-"), D = o(h ? a.invitePeopleLabel : a.emailSharedLinkLabel), G = Q(D, U);
|
|
59
62
|
return /* @__PURE__ */ s("form", {
|
|
60
|
-
className:
|
|
61
|
-
onSubmit: (
|
|
62
|
-
children: [
|
|
63
|
-
children: [
|
|
64
|
-
className:
|
|
65
|
-
}), /* @__PURE__ */
|
|
63
|
+
className: A.container,
|
|
64
|
+
onSubmit: (t) => t.preventDefault(),
|
|
65
|
+
children: [r.collaborationNotices, /* @__PURE__ */ s("div", {
|
|
66
|
+
children: [h && r.collaborators && /* @__PURE__ */ n(Z, {}), /* @__PURE__ */ n(G, {
|
|
67
|
+
className: A.label
|
|
68
|
+
}), /* @__PURE__ */ n(X, {
|
|
66
69
|
className: "collaboration-user-selector",
|
|
67
|
-
clearButtonAriaLabel:
|
|
70
|
+
clearButtonAriaLabel: o(a.clearButton),
|
|
68
71
|
clearOnBlur: !1,
|
|
69
72
|
disabled: u,
|
|
70
|
-
error:
|
|
71
|
-
fetchAvatarUrls:
|
|
72
|
-
fetchUsers:
|
|
73
|
+
error: O["user-contact"],
|
|
74
|
+
fetchAvatarUrls: T,
|
|
75
|
+
fetchUsers: y,
|
|
73
76
|
hideOnEscape: N,
|
|
74
|
-
idForLabel:
|
|
75
|
-
inputValue:
|
|
77
|
+
idForLabel: U,
|
|
78
|
+
inputValue: B,
|
|
76
79
|
label: null,
|
|
77
|
-
onBlur:
|
|
78
|
-
onInputValueChange:
|
|
80
|
+
onBlur: R,
|
|
81
|
+
onInputValueChange: j,
|
|
79
82
|
onSelectedUsersChange: M,
|
|
80
|
-
placeholder:
|
|
83
|
+
placeholder: g.length ? "" : o(a.invitePeoplePlaceholder),
|
|
81
84
|
portalElement: c,
|
|
82
|
-
selectedUsers:
|
|
85
|
+
selectedUsers: g,
|
|
83
86
|
selectOnEnterOrTab: !0,
|
|
84
87
|
variant: l ? "textarea" : "input"
|
|
85
|
-
}),
|
|
86
|
-
}), l &&
|
|
87
|
-
maxCount:
|
|
88
|
-
}), l && c && /* @__PURE__ */
|
|
89
|
-
children: [!
|
|
90
|
-
children: [/* @__PURE__ */
|
|
91
|
-
disabled: u ??
|
|
92
|
-
onClick: j,
|
|
93
|
-
children: t(o.cancelButton)
|
|
94
|
-
}), /* @__PURE__ */ a(i.Footer.PrimaryButton, {
|
|
95
|
-
loading: u ?? F,
|
|
96
|
-
loadingAriaLabel: t(o.loadingLabel),
|
|
88
|
+
}), h && r.collaborationRole && /* @__PURE__ */ n(Y, {})]
|
|
89
|
+
}), l && r.collaborationMessage && /* @__PURE__ */ n($, {
|
|
90
|
+
maxCount: ee
|
|
91
|
+
}), l && c && /* @__PURE__ */ W(/* @__PURE__ */ s(te, {
|
|
92
|
+
children: [!E && /* @__PURE__ */ s(i.Footer, {
|
|
93
|
+
children: [/* @__PURE__ */ n(i.Footer.SecondaryButton, {
|
|
94
|
+
disabled: u ?? L,
|
|
97
95
|
onClick: w,
|
|
98
|
-
children:
|
|
96
|
+
children: o(a.cancelButton)
|
|
97
|
+
}), /* @__PURE__ */ n(i.Footer.PrimaryButton, {
|
|
98
|
+
loading: u ?? L,
|
|
99
|
+
loadingAriaLabel: o(a.loadingLabel),
|
|
100
|
+
onClick: q,
|
|
101
|
+
children: o(a.sendButton)
|
|
99
102
|
})]
|
|
100
|
-
}), /* @__PURE__ */
|
|
101
|
-
"aria-label":
|
|
103
|
+
}), /* @__PURE__ */ n(i.Close, {
|
|
104
|
+
"aria-label": o(a.closeButton)
|
|
102
105
|
})]
|
|
103
106
|
}), c)]
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
export {
|
|
107
|
-
|
|
110
|
+
Fe as CollaborationSection
|
|
108
111
|
};
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { DropdownMenu as n, TriggerButton as
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import { useUnifiedShareModalContext as
|
|
8
|
-
import { useSharingAction as
|
|
9
|
-
import { useAccessLevels as
|
|
10
|
-
import '../../../../../styles/shared-link-access.css';const
|
|
11
|
-
container:
|
|
12
|
-
overrides:
|
|
13
|
-
content:
|
|
1
|
+
import L from "clsx";
|
|
2
|
+
import { useState as k } from "react";
|
|
3
|
+
import { useIntl as A } from "react-intl";
|
|
4
|
+
import { DropdownMenu as n, TriggerButton as M, Tooltip as I, Focusable as z } from "@box/blueprint-web";
|
|
5
|
+
import T from "./messages.js";
|
|
6
|
+
import { jsxs as q, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import { useUnifiedShareModalContext as w } from "../../../contexts/unified-share-modal-context.js";
|
|
8
|
+
import { useSharingAction as O } from "../../../hooks/use-sharing-action.js";
|
|
9
|
+
import { useAccessLevels as j } from "../../../hooks/use-access-levels.js";
|
|
10
|
+
import '../../../../../styles/shared-link-access.css';const y = "_container_xhq4z_1", D = "_overrides_xhq4z_1", N = "_content_xhq4z_6", s = {
|
|
11
|
+
container: y,
|
|
12
|
+
overrides: D,
|
|
13
|
+
content: N
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function P() {
|
|
16
16
|
const {
|
|
17
17
|
formatMessage: d
|
|
18
|
-
} =
|
|
18
|
+
} = A(), [c, m] = k(!1), {
|
|
19
19
|
isSubmitting: h,
|
|
20
20
|
sharedLink: p,
|
|
21
21
|
sharingService: u
|
|
22
|
-
} =
|
|
23
|
-
access:
|
|
22
|
+
} = w(), {
|
|
23
|
+
access: f
|
|
24
24
|
} = p, {
|
|
25
|
-
changeSharedLinkAccess:
|
|
25
|
+
changeSharedLinkAccess: g
|
|
26
26
|
} = u, {
|
|
27
|
-
isLoading:
|
|
28
|
-
onAction:
|
|
29
|
-
} =
|
|
30
|
-
allowedLevels:
|
|
27
|
+
isLoading: b,
|
|
28
|
+
onAction: x
|
|
29
|
+
} = O(g), {
|
|
30
|
+
allowedLevels: r,
|
|
31
31
|
selectedAccess: i
|
|
32
|
-
} =
|
|
33
|
-
if (!
|
|
32
|
+
} = j();
|
|
33
|
+
if (!r.length || !i)
|
|
34
34
|
return null;
|
|
35
35
|
const {
|
|
36
|
-
label:
|
|
36
|
+
label: S
|
|
37
37
|
} = i;
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ q(n.Root, {
|
|
39
39
|
onOpenChange: m,
|
|
40
|
-
open:
|
|
40
|
+
open: c,
|
|
41
41
|
children: [/* @__PURE__ */ e(n.Trigger, {
|
|
42
|
-
children: /* @__PURE__ */ e(
|
|
43
|
-
caretDirection:
|
|
44
|
-
className:
|
|
45
|
-
disabled: h ??
|
|
46
|
-
label:
|
|
42
|
+
children: /* @__PURE__ */ e(M, {
|
|
43
|
+
caretDirection: c ? "up" : "down",
|
|
44
|
+
className: L(s.container, s.overrides),
|
|
45
|
+
disabled: h ?? b,
|
|
46
|
+
label: S,
|
|
47
47
|
size: "extraSmall",
|
|
48
48
|
variant: "tertiary"
|
|
49
49
|
})
|
|
50
50
|
}), /* @__PURE__ */ e(n.Content, {
|
|
51
51
|
align: "start",
|
|
52
|
-
className:
|
|
53
|
-
children:
|
|
52
|
+
className: s.content,
|
|
53
|
+
children: r.map((v) => {
|
|
54
54
|
const {
|
|
55
55
|
description: a,
|
|
56
|
-
disabledReason:
|
|
56
|
+
disabledReason: _,
|
|
57
57
|
id: t,
|
|
58
58
|
label: l
|
|
59
|
-
} = v
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
} = v, o = f === t, C = () => {
|
|
60
|
+
o || x(t);
|
|
61
|
+
};
|
|
62
|
+
return _ ? /* @__PURE__ */ e(I, {
|
|
63
|
+
content: d(T.disabledAccessLevelTooltip),
|
|
64
|
+
children: /* @__PURE__ */ e(z, {
|
|
63
65
|
children: /* @__PURE__ */ e(n.CheckboxItem, {
|
|
64
|
-
checked:
|
|
66
|
+
checked: o,
|
|
65
67
|
disabled: !0,
|
|
66
68
|
children: /* @__PURE__ */ e(n.Item.MainContent, {
|
|
67
69
|
caption: a,
|
|
@@ -70,8 +72,8 @@ function J() {
|
|
|
70
72
|
}, t)
|
|
71
73
|
})
|
|
72
74
|
}, t) : /* @__PURE__ */ e(n.CheckboxItem, {
|
|
73
|
-
checked:
|
|
74
|
-
onSelect:
|
|
75
|
+
checked: o,
|
|
76
|
+
onSelect: C,
|
|
75
77
|
children: /* @__PURE__ */ e(n.Item.MainContent, {
|
|
76
78
|
caption: a,
|
|
77
79
|
label: l
|
|
@@ -82,5 +84,5 @@ function J() {
|
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
P as SharedLinkAccess
|
|
86
88
|
};
|
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import { DropdownMenu as e, TriggerButton as
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { usePermissionLevels as
|
|
6
|
-
import { useUnifiedShareModalContext as
|
|
7
|
-
import { useSharingAction as
|
|
8
|
-
import '../../../../../styles/shared-link-access.css';const
|
|
9
|
-
container:
|
|
10
|
-
overrides:
|
|
11
|
-
content:
|
|
1
|
+
import L from "clsx";
|
|
2
|
+
import { useState as C } from "react";
|
|
3
|
+
import { DropdownMenu as e, TriggerButton as k } from "@box/blueprint-web";
|
|
4
|
+
import { jsxs as M, jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { usePermissionLevels as z } from "../../../hooks/use-permission-levels.js";
|
|
6
|
+
import { useUnifiedShareModalContext as P } from "../../../contexts/unified-share-modal-context.js";
|
|
7
|
+
import { useSharingAction as q } from "../../../hooks/use-sharing-action.js";
|
|
8
|
+
import '../../../../../styles/shared-link-access.css';const w = "_container_xhq4z_1", I = "_overrides_xhq4z_1", O = "_content_xhq4z_6", o = {
|
|
9
|
+
container: w,
|
|
10
|
+
overrides: I,
|
|
11
|
+
content: O
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
const [r,
|
|
15
|
-
isSubmitting:
|
|
16
|
-
sharedLink:
|
|
13
|
+
function R() {
|
|
14
|
+
const [r, a] = C(!1), {
|
|
15
|
+
isSubmitting: l,
|
|
16
|
+
sharedLink: d,
|
|
17
17
|
sharingService: m
|
|
18
|
-
} =
|
|
19
|
-
access:
|
|
20
|
-
permission:
|
|
21
|
-
} =
|
|
22
|
-
changeSharedLinkPermission:
|
|
18
|
+
} = P(), {
|
|
19
|
+
access: h,
|
|
20
|
+
permission: p
|
|
21
|
+
} = d, {
|
|
22
|
+
changeSharedLinkPermission: u
|
|
23
23
|
} = m, {
|
|
24
|
-
isLoading:
|
|
25
|
-
onAction:
|
|
26
|
-
} =
|
|
24
|
+
isLoading: g,
|
|
25
|
+
onAction: f
|
|
26
|
+
} = q(u), {
|
|
27
27
|
allowedLevels: i,
|
|
28
28
|
selectedPermission: s
|
|
29
|
-
} =
|
|
30
|
-
if (
|
|
29
|
+
} = z();
|
|
30
|
+
if (h === "collaborators" || !i.length || !s)
|
|
31
31
|
return null;
|
|
32
32
|
const {
|
|
33
|
-
label:
|
|
33
|
+
label: S
|
|
34
34
|
} = s;
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
onOpenChange:
|
|
35
|
+
return /* @__PURE__ */ M(e.Root, {
|
|
36
|
+
onOpenChange: a,
|
|
37
37
|
open: r,
|
|
38
38
|
children: [/* @__PURE__ */ n(e.Trigger, {
|
|
39
|
-
children: /* @__PURE__ */ n(
|
|
39
|
+
children: /* @__PURE__ */ n(k, {
|
|
40
40
|
caretDirection: r ? "up" : "down",
|
|
41
|
-
className:
|
|
42
|
-
disabled:
|
|
43
|
-
label:
|
|
41
|
+
className: L(o.container, o.overrides),
|
|
42
|
+
disabled: l ?? g,
|
|
43
|
+
label: S,
|
|
44
44
|
size: "extraSmall",
|
|
45
45
|
variant: "tertiary"
|
|
46
46
|
})
|
|
47
47
|
}), /* @__PURE__ */ n(e.Content, {
|
|
48
48
|
align: "start",
|
|
49
|
-
className:
|
|
49
|
+
className: o.content,
|
|
50
50
|
children: i.map((x) => {
|
|
51
51
|
const {
|
|
52
|
-
description:
|
|
53
|
-
id:
|
|
54
|
-
label:
|
|
55
|
-
} = x
|
|
52
|
+
description: _,
|
|
53
|
+
id: t,
|
|
54
|
+
label: b
|
|
55
|
+
} = x, c = p === t, v = () => {
|
|
56
|
+
c || f(t);
|
|
57
|
+
};
|
|
56
58
|
return /* @__PURE__ */ n(e.CheckboxItem, {
|
|
57
|
-
checked:
|
|
58
|
-
onSelect:
|
|
59
|
+
checked: c,
|
|
60
|
+
onSelect: v,
|
|
59
61
|
children: /* @__PURE__ */ n(e.Item.MainContent, {
|
|
60
|
-
caption:
|
|
61
|
-
label:
|
|
62
|
+
caption: _,
|
|
63
|
+
label: b
|
|
62
64
|
})
|
|
63
|
-
},
|
|
65
|
+
}, t);
|
|
64
66
|
})
|
|
65
67
|
})]
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
export {
|
|
69
|
-
|
|
71
|
+
R as SharedLinkPermission
|
|
70
72
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { useCallback as s } from "react";
|
|
2
|
-
import { useFormValidation as
|
|
3
|
-
import { useSharingAction as
|
|
4
|
-
import { useUnifiedShareFormContext as
|
|
5
|
-
import { useUnifiedShareModalContext as
|
|
6
|
-
const
|
|
2
|
+
import { useFormValidation as E } from "./use-form-validation.js";
|
|
3
|
+
import { useSharingAction as A } from "./use-sharing-action.js";
|
|
4
|
+
import { useUnifiedShareFormContext as M } from "../contexts/unified-share-form-context.js";
|
|
5
|
+
import { useUnifiedShareModalContext as O } from "../contexts/unified-share-modal-context.js";
|
|
6
|
+
const I = (p, v) => {
|
|
7
7
|
const {
|
|
8
8
|
errors: f,
|
|
9
|
-
setFieldError:
|
|
9
|
+
setFieldError: a,
|
|
10
10
|
validateUserContact: C,
|
|
11
11
|
validateUserSelector: i
|
|
12
|
-
} = V(), {
|
|
13
|
-
contactService: g
|
|
14
12
|
} = E(), {
|
|
13
|
+
contactService: h
|
|
14
|
+
} = O(), {
|
|
15
|
+
collaborationRole: F,
|
|
16
|
+
messageValue: b,
|
|
15
17
|
setContactValue: l,
|
|
16
|
-
setMessageValue:
|
|
17
|
-
setUserContacts:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
setMessageValue: U,
|
|
19
|
+
setUserContacts: r,
|
|
20
|
+
shareView: x,
|
|
21
|
+
userContacts: o
|
|
22
|
+
} = M(), {
|
|
23
|
+
isLoading: y,
|
|
24
|
+
onAction: V
|
|
25
|
+
} = A(p, v), {
|
|
23
26
|
getContactByEmail: u
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
}, [l,
|
|
27
|
+
} = h, S = () => {
|
|
28
|
+
r([]), l(""), U(""), a("user-contact", "");
|
|
29
|
+
}, w = s((t) => {
|
|
30
|
+
a("user-contact", ""), l(t);
|
|
31
|
+
}, [l, a]), g = s(async (t) => {
|
|
29
32
|
if (t.id)
|
|
30
33
|
return t;
|
|
31
34
|
if (u) {
|
|
@@ -41,29 +44,37 @@ const q = (v, F) => {
|
|
|
41
44
|
value: t.value
|
|
42
45
|
};
|
|
43
46
|
}, [u, C]), m = s(async (t) => {
|
|
44
|
-
if (
|
|
45
|
-
|
|
47
|
+
if (a("user-contact", ""), i(t), o.length >= t.length) {
|
|
48
|
+
r(t);
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
|
-
const [e, ...d] = [...t].reverse(),
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
var
|
|
52
|
-
const e = (
|
|
53
|
-
(c = document.querySelector('div[role="listbox"][aria-labelledby^="user-contacts"]')) != null && c.contains(t.relatedTarget) || e || m([...
|
|
51
|
+
const [e, ...d] = [...t].reverse(), n = await g(e), c = n ? [...d, n] : d;
|
|
52
|
+
r(c.filter(Boolean));
|
|
53
|
+
}, [g, a, r, i, o]), B = s((t) => {
|
|
54
|
+
var n, c;
|
|
55
|
+
const e = (n = t.relatedTarget) == null ? void 0 : n.closest(".collaboration-user-selector");
|
|
56
|
+
(c = document.querySelector('div[role="listbox"][aria-labelledby^="user-contacts"]')) != null && c.contains(t.relatedTarget) || e || m([...o, {
|
|
54
57
|
value: t.target.value
|
|
55
58
|
}]);
|
|
56
|
-
}, [m,
|
|
59
|
+
}, [m, o]);
|
|
57
60
|
return {
|
|
58
61
|
errors: f,
|
|
59
62
|
handleFormReset: S,
|
|
60
|
-
handleFormSubmit: async () =>
|
|
63
|
+
handleFormSubmit: async () => {
|
|
64
|
+
if (f["user-contact"] || i(o))
|
|
65
|
+
return !0;
|
|
66
|
+
const t = {
|
|
67
|
+
contacts: o,
|
|
68
|
+
message: b
|
|
69
|
+
};
|
|
70
|
+
return x === "invite" && (t.role = F.id), await V(t), S(), !1;
|
|
71
|
+
},
|
|
61
72
|
handleSelectedUsersChange: m,
|
|
62
|
-
handleUserSelectorBlur:
|
|
63
|
-
isFormSubmitting:
|
|
64
|
-
updateContactValue:
|
|
73
|
+
handleUserSelectorBlur: B,
|
|
74
|
+
isFormSubmitting: y,
|
|
75
|
+
updateContactValue: w
|
|
65
76
|
};
|
|
66
77
|
};
|
|
67
78
|
export {
|
|
68
|
-
|
|
79
|
+
I as useCollaborationForm
|
|
69
80
|
};
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useFormValidation as
|
|
3
|
-
import { useSharingAction as
|
|
4
|
-
import {
|
|
5
|
-
import { useUnifiedShareModalContext as
|
|
6
|
-
const
|
|
7
|
-
const [
|
|
8
|
-
errors:
|
|
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
9
|
setErrors: c,
|
|
10
10
|
setFieldError: s,
|
|
11
|
-
validateExpiration:
|
|
12
|
-
validatePassword:
|
|
13
|
-
validateVanityName:
|
|
14
|
-
} = b(), {
|
|
15
|
-
sharedLink: f,
|
|
16
|
-
sharingService: E
|
|
11
|
+
validateExpiration: m,
|
|
12
|
+
validatePassword: a,
|
|
13
|
+
validateVanityName: p
|
|
17
14
|
} = A(), {
|
|
18
|
-
|
|
19
|
-
} =
|
|
20
|
-
updateSharedLink:
|
|
21
|
-
} =
|
|
22
|
-
isLoading:
|
|
23
|
-
onAction:
|
|
24
|
-
} =
|
|
25
|
-
|
|
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) => {
|
|
22
|
+
o((i) => ({
|
|
26
23
|
...i,
|
|
27
|
-
[
|
|
24
|
+
[t]: n
|
|
28
25
|
}));
|
|
29
|
-
}, []),
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
}, []), g = d(() => {
|
|
27
|
+
o(r), c({});
|
|
28
|
+
}, [r, c, o]), b = d(async () => {
|
|
29
|
+
const t = j(e, r), {
|
|
30
|
+
expiration: n,
|
|
31
|
+
isExpirationEnabled: i,
|
|
32
|
+
isPasswordEnabled: x,
|
|
33
|
+
isVanityNameEnabled: y,
|
|
34
|
+
password: k,
|
|
35
|
+
vanityName: v
|
|
36
|
+
} = t, w = i && m(n), V = x && a(k), F = y && p(v);
|
|
37
|
+
if (w || V || F)
|
|
37
38
|
return !0;
|
|
38
39
|
try {
|
|
39
|
-
await
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
await u({
|
|
41
|
+
...r,
|
|
42
|
+
...t
|
|
43
|
+
});
|
|
44
|
+
} catch (L) {
|
|
45
|
+
return Object.entries(L).forEach(([N, U]) => s(N, U)), !0;
|
|
42
46
|
}
|
|
43
47
|
return !1;
|
|
44
|
-
}, [
|
|
48
|
+
}, [e, r, u, s, m, a, p]);
|
|
45
49
|
return {
|
|
46
|
-
errors:
|
|
47
|
-
formData:
|
|
48
|
-
handleFormReset:
|
|
49
|
-
handleFormSubmit:
|
|
50
|
-
isUpdating:
|
|
50
|
+
errors: h,
|
|
51
|
+
formData: e,
|
|
52
|
+
handleFormReset: g,
|
|
53
|
+
handleFormSubmit: b,
|
|
54
|
+
isUpdating: f,
|
|
51
55
|
setFieldError: s,
|
|
52
|
-
setFieldValue:
|
|
53
|
-
validatePassword:
|
|
56
|
+
setFieldValue: S,
|
|
57
|
+
validatePassword: a
|
|
54
58
|
};
|
|
55
59
|
};
|
|
56
60
|
export {
|
|
57
|
-
|
|
61
|
+
G as useLinkSettingsForm
|
|
58
62
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { toCalendarDate as e, fromAbsolute as o, getLocalTimeZone as a, DateFormatter as m } from "@box/blueprint-web";
|
|
2
|
-
const D = 1e3, c = 24 * 60 * 60 * D, s = (t) => e(o(t, a())),
|
|
2
|
+
const D = 1e3, c = 24 * 60 * 60 * D, s = (t) => e(o(t, a())), u = (t) => {
|
|
3
3
|
const r = navigator.language || "en-US", n = s(t).toDate(a());
|
|
4
4
|
return new m(r, {
|
|
5
5
|
day: "numeric",
|
|
6
6
|
month: "long",
|
|
7
7
|
year: "numeric"
|
|
8
8
|
}).format(n);
|
|
9
|
-
},
|
|
9
|
+
}, d = () => e(o(Date.now() + c, a()));
|
|
10
10
|
export {
|
|
11
11
|
s as formatDateFromTimestampToCalendarDate,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
u as formatDateFromTimestampToDateString,
|
|
13
|
+
d as formatTomorrowDateToCalendarDate
|
|
14
14
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const r = (b, i) => {
|
|
2
|
+
var E;
|
|
3
|
+
const {
|
|
4
|
+
expiration: a,
|
|
5
|
+
isDownloadEnabled: l,
|
|
6
|
+
isExpirationEnabled: s,
|
|
7
|
+
isPasswordEnabled: d,
|
|
8
|
+
isVanityNameEnabled: o,
|
|
9
|
+
password: t,
|
|
10
|
+
vanityName: e
|
|
11
|
+
} = b, n = {};
|
|
12
|
+
return l !== i.isDownloadEnabled && (n.isDownloadEnabled = l), (s !== i.isExpirationEnabled || (a == null ? void 0 : a.toString()) !== ((E = i.expiration) == null ? void 0 : E.toString())) && (n.isExpirationEnabled = s, n.expiration = s ? a : null), (d !== i.isPasswordEnabled || t !== i.password) && (n.isPasswordEnabled = d, n.password = d ? t : null), (o !== i.isVanityNameEnabled || e !== i.vanityName) && (n.isVanityNameEnabled = o, n.vanityName = o ? e : null), n;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
r as getUpdatedLinkSettingsFormData
|
|
16
|
+
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { getAvatarBadgeSize as a, getDefaultCollaborationRole as t, getFirstInitial as r, isCollaboratorRoleSupported as s, isInvitationRoleSupported as i } from "./collaborator.js";
|
|
2
2
|
import { formatDateFromTimestampToCalendarDate as d, formatDateFromTimestampToDateString as l, formatTomorrowDateToCalendarDate as m } from "./date.js";
|
|
3
|
-
import { callOnKeyboardEvent as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { callOnKeyboardEvent as C } from "./event.js";
|
|
4
|
+
import { getUpdatedLinkSettingsFormData as g } from "./form.js";
|
|
5
|
+
import { getAllowedAccessLevels as D, getAllowedPermissionLevels as x } from "./permission.js";
|
|
6
|
+
import { doesPasswordContainInvalidCharacter as v, doesPasswordContainLetter as S, doesPasswordContainMinCharacters as T, doesPasswordContainMixedCase as b, doesPasswordContainNumber as c, doesPasswordContainSymbol as u, isEmailValid as A, isVanityNameValid as F } from "./validation.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
C as callOnKeyboardEvent,
|
|
9
|
+
v as doesPasswordContainInvalidCharacter,
|
|
10
|
+
S as doesPasswordContainLetter,
|
|
11
|
+
T as doesPasswordContainMinCharacters,
|
|
12
|
+
b as doesPasswordContainMixedCase,
|
|
13
|
+
c as doesPasswordContainNumber,
|
|
14
|
+
u as doesPasswordContainSymbol,
|
|
14
15
|
d as formatDateFromTimestampToCalendarDate,
|
|
15
16
|
l as formatDateFromTimestampToDateString,
|
|
16
17
|
m as formatTomorrowDateToCalendarDate,
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
D as getAllowedAccessLevels,
|
|
19
|
+
x as getAllowedPermissionLevels,
|
|
19
20
|
a as getAvatarBadgeSize,
|
|
20
21
|
t as getDefaultCollaborationRole,
|
|
21
22
|
r as getFirstInitial,
|
|
22
|
-
|
|
23
|
+
g as getUpdatedLinkSettingsFormData,
|
|
23
24
|
s as isCollaboratorRoleSupported,
|
|
24
|
-
|
|
25
|
+
A as isEmailValid,
|
|
25
26
|
i as isInvitationRoleSupported,
|
|
26
|
-
|
|
27
|
+
F as isVanityNameValid
|
|
27
28
|
};
|
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
const {
|
|
3
|
-
expiration: l,
|
|
4
|
-
isDownloadEnabled: c,
|
|
5
|
-
isExpirationEnabled: n,
|
|
6
|
-
isPasswordEnabled: s,
|
|
7
|
-
isVanityEnabled: o,
|
|
8
|
-
password: i,
|
|
9
|
-
vanityName: u
|
|
10
|
-
} = d, {
|
|
11
|
-
canChangeDownload: p,
|
|
12
|
-
canChangeExpiration: w,
|
|
13
|
-
canChangeVanityName: E,
|
|
14
|
-
canChangePassword: m,
|
|
15
|
-
isDownloadAvailable: C,
|
|
16
|
-
isPasswordAvailable: b,
|
|
17
|
-
isVanityNameAvailable: A
|
|
18
|
-
} = a, e = {
|
|
19
|
-
updatedExpiration: n ? l : 0,
|
|
20
|
-
updatedPassword: s ? i : "",
|
|
21
|
-
updatedVanityName: o ? u : "",
|
|
22
|
-
updatedIsDownloadEnabled: c
|
|
23
|
-
}, t = {
|
|
24
|
-
expiration: !1,
|
|
25
|
-
password: !1,
|
|
26
|
-
vanityName: !1
|
|
27
|
-
};
|
|
28
|
-
return w ? n && (t.expiration = !0) : e.updatedExpiration = void 0, !b || !m || r.isPasswordEnabled && !i ? e.updatedPassword = void 0 : s && (t.password = !0), !A || !E ? e.updatedVanityName = void 0 : o && (t.vanityName = !0), (!C || !p) && (e.updatedIsDownloadEnabled = void 0), {
|
|
29
|
-
updatedFormData: e,
|
|
30
|
-
shouldValidate: t
|
|
31
|
-
};
|
|
32
|
-
};
|
|
1
|
+
const e = /^[a-zA-Z0-9-]{12,30}$/, s = /^[A-Z0-9._'%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, n = (t) => e.test(t), r = (t) => s.test(t), o = (t) => t.length >= 8, a = (t) => t.replace(/\D/g, "").length >= 1, i = (t) => t.replace(/\s/g, "").replace(/\w/g, "").length >= 1, c = (t) => /[a-zA-Z]/.test(t), d = (t) => /[a-z]/.test(t) && /[A-Z]/.test(t), l = (t) => /[\s<>]/.test(t);
|
|
33
2
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
h as isVanityNameValid
|
|
3
|
+
l as doesPasswordContainInvalidCharacter,
|
|
4
|
+
c as doesPasswordContainLetter,
|
|
5
|
+
o as doesPasswordContainMinCharacters,
|
|
6
|
+
d as doesPasswordContainMixedCase,
|
|
7
|
+
a as doesPasswordContainNumber,
|
|
8
|
+
i as doesPasswordContainSymbol,
|
|
9
|
+
r as isEmailValid,
|
|
10
|
+
n as isVanityNameValid
|
|
43
11
|
};
|
|
@@ -18,9 +18,11 @@ export declare const mockSharedLink: SharedLink;
|
|
|
18
18
|
export declare const useMockSharedLink: (sharedLinkArg: any) => {
|
|
19
19
|
sharedLink: SharedLink;
|
|
20
20
|
sharingService: {
|
|
21
|
+
sendInvitations: (formData: any) => Promise<void>;
|
|
22
|
+
sendSharedLink: (formData: any) => Promise<void>;
|
|
21
23
|
createSharedLink: () => Promise<void>;
|
|
22
24
|
deleteSharedLink: () => Promise<void>;
|
|
23
|
-
updateSharedLink: () => Promise<void>;
|
|
25
|
+
updateSharedLink: (formData: any) => Promise<void>;
|
|
24
26
|
changeSharedLinkAccess: (access: any) => Promise<void>;
|
|
25
27
|
changeSharedLinkPermission: (permission: any) => Promise<void>;
|
|
26
28
|
};
|
|
@@ -138,14 +138,41 @@ export interface SharedLink {
|
|
|
138
138
|
vanityName?: string;
|
|
139
139
|
}
|
|
140
140
|
export interface SharedLinkSettings {
|
|
141
|
+
/**
|
|
142
|
+
* When `true`, the user can update the download settings of the shared link.
|
|
143
|
+
*/
|
|
141
144
|
canChangeDownload?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* When `true`, the user can update the expiration settings of the shared link.
|
|
147
|
+
*/
|
|
142
148
|
canChangeExpiration?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* When `true`, the user can update the password settings of the shared link.
|
|
151
|
+
*/
|
|
143
152
|
canChangePassword?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* When `true`, the user can update the custom URL settings of the shared link.
|
|
155
|
+
*/
|
|
144
156
|
canChangeVanityName?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* When `true`, the download settings of the shared link are visible to the user.
|
|
159
|
+
*/
|
|
145
160
|
isDownloadAvailable?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* When `true`, users with the shared link can download the item.
|
|
163
|
+
*/
|
|
146
164
|
isDownloadEnabled?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* When `true`, the password settings of the shared link are visible to the user.
|
|
167
|
+
*/
|
|
147
168
|
isPasswordAvailable?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* When `true`, users with the shared link must enter a password to access the item.
|
|
171
|
+
*/
|
|
148
172
|
isPasswordEnabled?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* When `true`, the custom URL settings of the shared link are visible to the user.
|
|
175
|
+
*/
|
|
149
176
|
isVanityNameAvailable?: boolean;
|
|
150
177
|
}
|
|
151
178
|
export interface AccessLevel {
|
|
@@ -280,17 +307,67 @@ export interface EventService {
|
|
|
280
307
|
onSharedLinkSettingsLoad?: () => void;
|
|
281
308
|
}
|
|
282
309
|
export interface ContactService {
|
|
310
|
+
/**
|
|
311
|
+
* Function to retrieve a contact by email address.
|
|
312
|
+
*
|
|
313
|
+
* Called when the user enters a value that is not in the suggested contacts.
|
|
314
|
+
*/
|
|
283
315
|
getContactByEmail?: (email: string) => Promise<UserContactType | void>;
|
|
284
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Function to retrieve a list of suggested contacts.
|
|
318
|
+
*
|
|
319
|
+
* Called when the input value of the contact combobox is changed.
|
|
320
|
+
*/
|
|
321
|
+
getContacts?: (query: string, view: 'email' | 'invite') => Promise<UserContactType[]>;
|
|
322
|
+
/**
|
|
323
|
+
* Function to retrieve avatar URLs for a list of contacts.
|
|
324
|
+
*
|
|
325
|
+
* Called when the list of suggested contacts is updated.
|
|
326
|
+
*/
|
|
285
327
|
getContactsAvatarUrls?: (userContacts: UserContactType[]) => Promise<FetchedAvatarUrls>;
|
|
286
328
|
}
|
|
287
329
|
export interface SharingService {
|
|
288
|
-
|
|
289
|
-
|
|
330
|
+
/**
|
|
331
|
+
* Function to invite new collaborators to the item.
|
|
332
|
+
*
|
|
333
|
+
* Called when the user clicks "Send" on the invite view of the sharing form.
|
|
334
|
+
*/
|
|
335
|
+
sendInvitations?: (formData: CollaborationFormData) => Promise<SharingResponse | void>;
|
|
336
|
+
/**
|
|
337
|
+
* Function to email the shared link to the selected contacts.
|
|
338
|
+
*
|
|
339
|
+
* Called when the user clicks "Send" on the email view of the sharing form.
|
|
340
|
+
*/
|
|
341
|
+
sendSharedLink?: (formData: CollaborationFormData) => Promise<SharingResponse | void>;
|
|
342
|
+
/**
|
|
343
|
+
* Function to create a shared link for the item.
|
|
344
|
+
*
|
|
345
|
+
* Called when the user enables the "Share Link" toggle on the sharing form.
|
|
346
|
+
*/
|
|
290
347
|
createSharedLink?: () => Promise<SharingResponse | void>;
|
|
348
|
+
/**
|
|
349
|
+
* Function to delete the shared link for the item.
|
|
350
|
+
*
|
|
351
|
+
* Called when the user disables the "Share Link" toggle on the sharing form.
|
|
352
|
+
*/
|
|
291
353
|
deleteSharedLink?: () => Promise<SharingResponse | void>;
|
|
292
|
-
|
|
354
|
+
/**
|
|
355
|
+
* Function to update the shared link for the item.
|
|
356
|
+
*
|
|
357
|
+
* Called when the user saves changes to the shared link settings.
|
|
358
|
+
*/
|
|
359
|
+
updateSharedLink?: (formData: LinkSettingsFormData) => Promise<SharingResponse | void>;
|
|
360
|
+
/**
|
|
361
|
+
* Function to change the access level of the shared link.
|
|
362
|
+
*
|
|
363
|
+
* Called when the user selects an access level for the shared link.
|
|
364
|
+
*/
|
|
293
365
|
changeSharedLinkAccess?: (access: AccessLevelType) => Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Function to change the permission level of the shared link.
|
|
368
|
+
*
|
|
369
|
+
* Called when the user selects a permission level for the shared link.
|
|
370
|
+
*/
|
|
294
371
|
changeSharedLinkPermission?: (permission: PermissionLevelType) => Promise<void>;
|
|
295
372
|
}
|
|
296
373
|
/**
|
|
@@ -320,14 +397,57 @@ export interface SharingError {
|
|
|
320
397
|
[key: string]: string;
|
|
321
398
|
};
|
|
322
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Form data structure for the collaboration form in the Unified Share Modal.
|
|
402
|
+
*/
|
|
403
|
+
export interface CollaborationFormData {
|
|
404
|
+
/**
|
|
405
|
+
* The selected contacts to invite as collaborators or email the shared link.
|
|
406
|
+
*/
|
|
407
|
+
contacts: UserContactType[];
|
|
408
|
+
/**
|
|
409
|
+
* The message to send to collaborators or shared link recipients.
|
|
410
|
+
*/
|
|
411
|
+
message: string;
|
|
412
|
+
/**
|
|
413
|
+
* The selected collaboration role when inviting new collaborators.
|
|
414
|
+
*
|
|
415
|
+
* This property is omitted when emailing the shared link.
|
|
416
|
+
*/
|
|
417
|
+
role?: InvitationRole | string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Form data structure for the link settings form in the Unified Share Modal.
|
|
421
|
+
*/
|
|
323
422
|
export interface LinkSettingsFormData {
|
|
324
|
-
|
|
423
|
+
/**
|
|
424
|
+
* The selected calendar date when the item will be unshared.
|
|
425
|
+
*/
|
|
426
|
+
expiration: DateValue;
|
|
427
|
+
/**
|
|
428
|
+
* When `true`, users with the shared link can download the item.
|
|
429
|
+
*/
|
|
325
430
|
isDownloadEnabled: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* When `true`, the shared link will expire on a specific date.
|
|
433
|
+
*/
|
|
326
434
|
isExpirationEnabled: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* When `true`, users with the shared link must enter a password.
|
|
437
|
+
*/
|
|
327
438
|
isPasswordEnabled: boolean;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
439
|
+
/**
|
|
440
|
+
* When `true`, users can access the shared link with a custom URL.
|
|
441
|
+
*/
|
|
442
|
+
isVanityNameEnabled: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* The password required by users to access the shared link.
|
|
445
|
+
*/
|
|
446
|
+
password: string;
|
|
447
|
+
/**
|
|
448
|
+
* The path name for users to access the item through a non-private URL.
|
|
449
|
+
*/
|
|
450
|
+
vanityName: string;
|
|
331
451
|
}
|
|
332
452
|
/**
|
|
333
453
|
* Configuration options for configuring features in the Unified Share Modal.
|
|
@@ -6,16 +6,3 @@ export declare const doesPasswordContainSymbol: (password: string) => boolean;
|
|
|
6
6
|
export declare const doesPasswordContainLetter: (password: string) => boolean;
|
|
7
7
|
export declare const doesPasswordContainMixedCase: (password: string) => boolean;
|
|
8
8
|
export declare const doesPasswordContainInvalidCharacter: (password: string) => boolean;
|
|
9
|
-
export declare const getSharedLinkFormValidation: (settings: any, formData: any, initialFormData: any) => {
|
|
10
|
-
updatedFormData: {
|
|
11
|
-
updatedExpiration: any;
|
|
12
|
-
updatedPassword: any;
|
|
13
|
-
updatedVanityName: any;
|
|
14
|
-
updatedIsDownloadEnabled: any;
|
|
15
|
-
};
|
|
16
|
-
shouldValidate: {
|
|
17
|
-
expiration: boolean;
|
|
18
|
-
password: boolean;
|
|
19
|
-
vanityName: boolean;
|
|
20
|
-
};
|
|
21
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.6",
|
|
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.75.
|
|
16
|
+
"@box/blueprint-web": "^12.75.4",
|
|
17
17
|
"@box/blueprint-web-assets": "^4.67.0",
|
|
18
|
-
"@box/copy-input": "^0.22.
|
|
18
|
+
"@box/copy-input": "^0.22.10",
|
|
19
19
|
"@box/storybook-utils": "0.14.3",
|
|
20
20
|
"@box/eslint-plugin-blueprint": "1.0.4",
|
|
21
21
|
"react-intl": "^6.4.2"
|