@box/unified-share-modal 0.45.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.
- package/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/lib/components/index.js +8 -0
- package/dist/esm/lib/components/remove-shared-link-modal/index.js +4 -0
- package/dist/esm/lib/components/remove-shared-link-modal/messages.js +30 -0
- package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +59 -0
- package/dist/esm/lib/components/shared-link-settings-modal/index.js +4 -0
- package/dist/esm/lib/components/shared-link-settings-modal/messages.js +106 -0
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +181 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +89 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +108 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +90 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +58 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +58 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.js +65 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.js +64 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.js +85 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/messages.js +38 -0
- package/dist/esm/lib/components/unified-share-form-modal/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/messages.js +50 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +98 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +86 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +19 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +144 -0
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +72 -0
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +29 -0
- package/dist/esm/lib/constants.js +25 -0
- package/dist/esm/lib/contexts/index.js +9 -0
- package/dist/esm/lib/contexts/unified-share-form-context.js +40 -0
- package/dist/esm/lib/contexts/unified-share-modal-context.js +11 -0
- package/dist/esm/lib/hooks/index.js +12 -0
- package/dist/esm/lib/hooks/use-access-levels.js +51 -0
- package/dist/esm/lib/hooks/use-collaboration-form.js +70 -0
- package/dist/esm/lib/hooks/use-form-validation.js +31 -0
- package/dist/esm/lib/hooks/use-link-settings-form.js +60 -0
- package/dist/esm/lib/hooks/use-sharing-action.js +71 -0
- package/dist/esm/lib/messages.js +70 -0
- package/dist/esm/lib/store.js +30 -0
- package/dist/esm/lib/unified-share-modal.js +65 -0
- package/dist/esm/lib/utils/collaborator.js +26 -0
- package/dist/esm/lib/utils/date.js +14 -0
- package/dist/esm/lib/utils/event.js +14 -0
- package/dist/esm/lib/utils/index.js +19 -0
- package/dist/esm/lib/utils/permission.js +14 -0
- package/dist/esm/lib/utils/validation.js +5 -0
- package/dist/i18n/bn-IN.js +157 -0
- package/dist/i18n/bn-IN.properties +290 -0
- package/dist/i18n/da-DK.js +157 -0
- package/dist/i18n/da-DK.properties +290 -0
- package/dist/i18n/de-DE.js +157 -0
- package/dist/i18n/de-DE.properties +290 -0
- package/dist/i18n/en-AU.js +157 -0
- package/dist/i18n/en-AU.properties +290 -0
- package/dist/i18n/en-CA.js +157 -0
- package/dist/i18n/en-CA.properties +290 -0
- package/dist/i18n/en-GB.js +157 -0
- package/dist/i18n/en-GB.properties +290 -0
- package/dist/i18n/en-US.js +111 -0
- package/dist/i18n/en-US.properties +218 -0
- package/dist/i18n/en-x-pseudo.js +157 -0
- package/dist/i18n/en-x-pseudo.properties +290 -0
- package/dist/i18n/es-419.js +157 -0
- package/dist/i18n/es-419.properties +290 -0
- package/dist/i18n/es-ES.js +157 -0
- package/dist/i18n/es-ES.properties +290 -0
- package/dist/i18n/fi-FI.js +157 -0
- package/dist/i18n/fi-FI.properties +290 -0
- package/dist/i18n/fr-CA.js +157 -0
- package/dist/i18n/fr-CA.properties +290 -0
- package/dist/i18n/fr-FR.js +157 -0
- package/dist/i18n/fr-FR.properties +290 -0
- package/dist/i18n/hi-IN.js +157 -0
- package/dist/i18n/hi-IN.properties +290 -0
- package/dist/i18n/it-IT.js +157 -0
- package/dist/i18n/it-IT.properties +290 -0
- package/dist/i18n/ja-JP.js +157 -0
- package/dist/i18n/ja-JP.properties +290 -0
- package/dist/i18n/json/src/lib/components/remove-shared-link-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/shared-link-settings-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaborators-view/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -0
- package/dist/i18n/json/src/lib/messages.json +1 -0
- package/dist/i18n/ko-KR.js +157 -0
- package/dist/i18n/ko-KR.properties +290 -0
- package/dist/i18n/nb-NO.js +157 -0
- package/dist/i18n/nb-NO.properties +290 -0
- package/dist/i18n/nl-NL.js +157 -0
- package/dist/i18n/nl-NL.properties +290 -0
- package/dist/i18n/pl-PL.js +157 -0
- package/dist/i18n/pl-PL.properties +290 -0
- package/dist/i18n/pt-BR.js +157 -0
- package/dist/i18n/pt-BR.properties +290 -0
- package/dist/i18n/ru-RU.js +157 -0
- package/dist/i18n/ru-RU.properties +290 -0
- package/dist/i18n/sv-SE.js +157 -0
- package/dist/i18n/sv-SE.properties +290 -0
- package/dist/i18n/tr-TR.js +157 -0
- package/dist/i18n/tr-TR.properties +290 -0
- package/dist/i18n/zh-CN.js +157 -0
- package/dist/i18n/zh-CN.properties +290 -0
- package/dist/i18n/zh-TW.js +157 -0
- package/dist/i18n/zh-TW.properties +290 -0
- package/dist/styles/collaboration-role.css +1 -0
- package/dist/styles/collaboration-section.css +1 -0
- package/dist/styles/collaborator-avatar.css +1 -0
- package/dist/styles/collaborator-list-item.css +1 -0
- package/dist/styles/collaborators-view.css +1 -0
- package/dist/styles/remove-shared-link-modal.css +1 -0
- package/dist/styles/shared-link-access.css +1 -0
- package/dist/styles/shared-link-permission.css +1 -0
- package/dist/styles/shared-link-section.css +1 -0
- package/dist/styles/shared-link-settings-modal.css +1 -0
- package/dist/styles/shared-with-avatars.css +1 -0
- package/dist/styles/text-area-container.css +1 -0
- package/dist/styles/unified-share-form-modal.css +1 -0
- package/dist/styles/unified-share-form.css +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/components/index.d.ts +3 -0
- package/dist/types/lib/components/remove-shared-link-modal/index.d.ts +1 -0
- package/dist/types/lib/components/remove-shared-link-modal/messages.d.ts +33 -0
- package/dist/types/lib/components/remove-shared-link-modal/remove-shared-link-modal.d.ts +5 -0
- package/dist/types/lib/components/remove-shared-link-modal/stories/shared.d.ts +3 -0
- package/dist/types/lib/components/shared-link-settings-modal/index.d.ts +1 -0
- package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +123 -0
- package/dist/types/lib/components/shared-link-settings-modal/shared-link-settings-modal.d.ts +5 -0
- package/dist/types/lib/components/shared-link-settings-modal/stories/shared.d.ts +36 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +108 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/text-area-container.d.ts +3 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.d.ts +8 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.d.ts +5 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/messages.d.ts +43 -0
- package/dist/types/lib/components/unified-share-form-modal/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/messages.d.ts +58 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +118 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/stories/shared.d.ts +15 -0
- package/dist/types/lib/components/unified-share-form-modal/unified-share-form-modal.d.ts +9 -0
- package/dist/types/lib/components/unified-share-form-modal/unified-share-form.d.ts +1 -0
- package/dist/types/lib/constants.d.ts +7 -0
- package/dist/types/lib/contexts/index.d.ts +2 -0
- package/dist/types/lib/contexts/unified-share-form-context.d.ts +25 -0
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +16 -0
- package/dist/types/lib/hooks/index.d.ts +5 -0
- package/dist/types/lib/hooks/use-access-levels.d.ts +6 -0
- package/dist/types/lib/hooks/use-collaboration-form.d.ts +10 -0
- package/dist/types/lib/hooks/use-form-validation.d.ts +18 -0
- package/dist/types/lib/hooks/use-link-settings-form.d.ts +10 -0
- package/dist/types/lib/hooks/use-sharing-action.d.ts +7 -0
- package/dist/types/lib/messages.d.ts +83 -0
- package/dist/types/lib/store.d.ts +21 -0
- package/dist/types/lib/stories/shared.d.ts +22 -0
- package/dist/types/lib/types.d.ts +387 -0
- package/dist/types/lib/unified-share-modal.d.ts +20 -0
- package/dist/types/lib/utils/collaborator.d.ts +8 -0
- package/dist/types/lib/utils/date.d.ts +3 -0
- package/dist/types/lib/utils/event.d.ts +13 -0
- package/dist/types/lib/utils/index.d.ts +5 -0
- package/dist/types/lib/utils/permission.d.ts +3 -0
- package/dist/types/lib/utils/validation.d.ts +2 -0
- package/package.json +54 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Divider as c } from "@box/blueprint-web";
|
|
2
|
+
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { CollaboratorsView as d } from "./collaborators-view/collaborators-view.js";
|
|
4
|
+
import { CollaborationSection as m } from "./collaboration-section/collaboration-section.js";
|
|
5
|
+
import { SharedLinkSection as f } from "./shared-link-section/shared-link-section.js";
|
|
6
|
+
import { useUnifiedShareModalContext as h } from "../../contexts/unified-share-modal-context.js";
|
|
7
|
+
import { useUnifiedShareFormContext as p } from "../../contexts/unified-share-form-context.js";
|
|
8
|
+
import '../../../../styles/unified-share-form.css';const b = "_container_14pjb_1", S = "_divider_14pjb_5", n = {
|
|
9
|
+
container: b,
|
|
10
|
+
divider: S
|
|
11
|
+
};
|
|
12
|
+
function w() {
|
|
13
|
+
const {
|
|
14
|
+
config: i,
|
|
15
|
+
isFetching: a
|
|
16
|
+
} = h(), {
|
|
17
|
+
shareView: r
|
|
18
|
+
} = p(), s = r === "collaborators", t = r !== "collaborators" && i.collaboration, e = r === "default" && i.sharedLink;
|
|
19
|
+
return s ? /* @__PURE__ */ o(d, {}) : /* @__PURE__ */ l("div", {
|
|
20
|
+
className: n.container,
|
|
21
|
+
inert: a ? "" : null,
|
|
22
|
+
children: [t && /* @__PURE__ */ o(m, {}), t && e && /* @__PURE__ */ o(c, {
|
|
23
|
+
className: n.divider
|
|
24
|
+
}), e && /* @__PURE__ */ o(f, {})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
w as UnifiedShareForm
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const e = ["invite-collaborators", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link", "auto-copy-shared-link"], r = {
|
|
2
|
+
collaboration: !0,
|
|
3
|
+
collaborationLimit: 100,
|
|
4
|
+
collaborationMessage: !0,
|
|
5
|
+
collaborationRole: !0,
|
|
6
|
+
collaborators: !0,
|
|
7
|
+
collaboratorsLimit: 100,
|
|
8
|
+
collaboratorsManagement: !0,
|
|
9
|
+
notifications: e,
|
|
10
|
+
sharedLink: !0,
|
|
11
|
+
sharedLinkAccess: !0,
|
|
12
|
+
sharedLinkAutoCopy: !1,
|
|
13
|
+
sharedLinkAutoCreate: !1,
|
|
14
|
+
sharedLinkEmail: !0,
|
|
15
|
+
sharedLinkPermission: !0,
|
|
16
|
+
sharedLinkSettings: !0
|
|
17
|
+
}, o = ["co_owner", "editor", "previewer", "previewer_uploader", "uploader", "viewer", "viewer_uploader"], a = ["owner", ...o], t = ["open", "company", "collaborators"], i = 256;
|
|
18
|
+
export {
|
|
19
|
+
i as COLLABORATION_MESSAGE_CHARACTER_LIMIT,
|
|
20
|
+
r as DEFAULT_CONFIGURATION,
|
|
21
|
+
e as DEFAULT_NOTIFICATIONS,
|
|
22
|
+
t as SUPPORTED_ACCESS_LEVELS,
|
|
23
|
+
a as SUPPORTED_COLLABORATOR_ROLES,
|
|
24
|
+
o as SUPPORTED_INVITATION_ROLES
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UnifiedShareFormContext as r, UnifiedShareFormProvider as i, useUnifiedShareFormContext as t } from "./unified-share-form-context.js";
|
|
2
|
+
import { UnifiedShareModalContext as d, useUnifiedShareModalContext as a } from "./unified-share-modal-context.js";
|
|
3
|
+
export {
|
|
4
|
+
r as UnifiedShareFormContext,
|
|
5
|
+
i as UnifiedShareFormProvider,
|
|
6
|
+
d as UnifiedShareModalContext,
|
|
7
|
+
t as useUnifiedShareFormContext,
|
|
8
|
+
a as useUnifiedShareModalContext
|
|
9
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createContext as F, useContext as S, useState as e, useMemo as v } from "react";
|
|
2
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
+
const l = /* @__PURE__ */ F({}), p = () => {
|
|
4
|
+
const t = S(l);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
|
|
7
|
+
return t;
|
|
8
|
+
}, R = ({
|
|
9
|
+
children: t,
|
|
10
|
+
container: o,
|
|
11
|
+
onModalOpenChange: r,
|
|
12
|
+
onModalViewChange: s,
|
|
13
|
+
onShareViewChange: n,
|
|
14
|
+
shareView: c
|
|
15
|
+
}) => {
|
|
16
|
+
const [u, x] = e([]), [a, f] = e(""), [i, d] = e(""), [m, C] = e(), U = v(() => ({
|
|
17
|
+
collaborationRole: m,
|
|
18
|
+
contactValue: a,
|
|
19
|
+
container: o,
|
|
20
|
+
messageValue: i,
|
|
21
|
+
onModalOpenChange: r,
|
|
22
|
+
onModalViewChange: s,
|
|
23
|
+
onShareViewChange: n,
|
|
24
|
+
setCollaborationRole: C,
|
|
25
|
+
setContactValue: f,
|
|
26
|
+
setMessageValue: d,
|
|
27
|
+
setUserContacts: x,
|
|
28
|
+
shareView: c,
|
|
29
|
+
userContacts: u
|
|
30
|
+
}), [m, a, o, i, r, s, n, c, u]);
|
|
31
|
+
return /* @__PURE__ */ b(l.Provider, {
|
|
32
|
+
value: U,
|
|
33
|
+
children: t
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
l as UnifiedShareFormContext,
|
|
38
|
+
R as UnifiedShareFormProvider,
|
|
39
|
+
p as useUnifiedShareFormContext
|
|
40
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as t, useContext as o } from "react";
|
|
2
|
+
const n = /* @__PURE__ */ t({}), i = () => {
|
|
3
|
+
const e = o(n);
|
|
4
|
+
if (!e)
|
|
5
|
+
throw new Error("useUnifiedShareModalContext must be used with UnifiedShareModalContext.Provider");
|
|
6
|
+
return e;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
n as UnifiedShareModalContext,
|
|
10
|
+
i as useUnifiedShareModalContext
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useAccessLevels as e } from "./use-access-levels.js";
|
|
2
|
+
import { useCollaborationForm as s } from "./use-collaboration-form.js";
|
|
3
|
+
import { useFormValidation as i } from "./use-form-validation.js";
|
|
4
|
+
import { useLinkSettingsForm as a } from "./use-link-settings-form.js";
|
|
5
|
+
import { useSharingAction as p } from "./use-sharing-action.js";
|
|
6
|
+
export {
|
|
7
|
+
e as useAccessLevels,
|
|
8
|
+
s as useCollaborationForm,
|
|
9
|
+
i as useFormValidation,
|
|
10
|
+
a as useLinkSettingsForm,
|
|
11
|
+
p as useSharingAction
|
|
12
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useMemo as a } from "react";
|
|
2
|
+
import { useIntl as x } from "react-intl";
|
|
3
|
+
import o from "../components/unified-share-form-modal/shared-link-section/messages.js";
|
|
4
|
+
import { useUnifiedShareModalContext as y } from "../contexts/unified-share-modal-context.js";
|
|
5
|
+
import { getAllowedAccessLevels as M } from "../utils/permission.js";
|
|
6
|
+
const U = () => {
|
|
7
|
+
const {
|
|
8
|
+
formatMessage: e
|
|
9
|
+
} = x(), {
|
|
10
|
+
currentUser: p,
|
|
11
|
+
item: d,
|
|
12
|
+
sharedLink: f
|
|
13
|
+
} = y(), {
|
|
14
|
+
enterprise: u = {}
|
|
15
|
+
} = p, {
|
|
16
|
+
name: s
|
|
17
|
+
} = u, {
|
|
18
|
+
type: n
|
|
19
|
+
} = d, {
|
|
20
|
+
access: i,
|
|
21
|
+
accessLevels: m
|
|
22
|
+
} = f, r = a(() => M(m).map((t) => {
|
|
23
|
+
const {
|
|
24
|
+
description: A,
|
|
25
|
+
id: l,
|
|
26
|
+
label: v
|
|
27
|
+
} = t;
|
|
28
|
+
let c = l;
|
|
29
|
+
l === "company" && s && (c = "enterprise");
|
|
30
|
+
const b = e(o[`${c}AccessLevelLabel`], {
|
|
31
|
+
enterprise: s
|
|
32
|
+
}), g = e(o[`${c}AccessLevelDescription`], {
|
|
33
|
+
enterprise: s,
|
|
34
|
+
item: e(o[`${n}AccessLevelItem`])
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
...t,
|
|
38
|
+
description: A ?? g,
|
|
39
|
+
label: v ?? b
|
|
40
|
+
};
|
|
41
|
+
}), [m, s, e, n]), L = a(() => r.find(({
|
|
42
|
+
id: t
|
|
43
|
+
}) => i === t), [i, r]);
|
|
44
|
+
return {
|
|
45
|
+
allowedLevels: r,
|
|
46
|
+
selectedAccess: L
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
U as useAccessLevels
|
|
51
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useCallback as i } from "react";
|
|
2
|
+
import { useFormValidation as w } from "./use-form-validation.js";
|
|
3
|
+
import { useSharingAction as B } from "./use-sharing-action.js";
|
|
4
|
+
import { useUnifiedShareFormContext as E } from "../contexts/unified-share-form-context.js";
|
|
5
|
+
import { useUnifiedShareModalContext as A } from "../contexts/unified-share-modal-context.js";
|
|
6
|
+
const N = (g, h) => {
|
|
7
|
+
const {
|
|
8
|
+
errors: p,
|
|
9
|
+
setFieldError: o,
|
|
10
|
+
validateUserContact: n,
|
|
11
|
+
validateUserSelector: u
|
|
12
|
+
} = w(), {
|
|
13
|
+
contactService: v
|
|
14
|
+
} = A(), {
|
|
15
|
+
setContactValue: m,
|
|
16
|
+
setMessageValue: F,
|
|
17
|
+
setUserContacts: r,
|
|
18
|
+
userContacts: a
|
|
19
|
+
} = E(), {
|
|
20
|
+
isLoading: b,
|
|
21
|
+
onAction: U
|
|
22
|
+
} = B(g, h), {
|
|
23
|
+
getContactByEmail: d
|
|
24
|
+
} = v, f = () => {
|
|
25
|
+
r([]), m(""), F(""), o("user-contact", "");
|
|
26
|
+
}, x = i((t) => {
|
|
27
|
+
o("user-contact", ""), m(t);
|
|
28
|
+
}, [m, o]), y = i((t) => {
|
|
29
|
+
var l, S;
|
|
30
|
+
const e = (l = document.querySelector('div[role="listbox"][aria-labelledby^="user-contacts"]')) == null ? void 0 : l.contains(t.relatedTarget), c = (S = t.relatedTarget) == null ? void 0 : S.closest(".collaboration-user-selector");
|
|
31
|
+
if (e || c)
|
|
32
|
+
return;
|
|
33
|
+
const s = t.target.value;
|
|
34
|
+
n(s);
|
|
35
|
+
}, [n]), C = i(async (t) => {
|
|
36
|
+
if (t.id)
|
|
37
|
+
return t;
|
|
38
|
+
if (d) {
|
|
39
|
+
const e = await d(t.value);
|
|
40
|
+
if (e && e.id)
|
|
41
|
+
return e;
|
|
42
|
+
}
|
|
43
|
+
return n(t.value) ? null : {
|
|
44
|
+
email: t.value,
|
|
45
|
+
id: 0,
|
|
46
|
+
isExternalUser: !0,
|
|
47
|
+
name: t.value,
|
|
48
|
+
value: t.value
|
|
49
|
+
};
|
|
50
|
+
}, [d, n]), V = i(async (t) => {
|
|
51
|
+
if (o("user-contact", ""), u(t), a.length >= t.length) {
|
|
52
|
+
r(t);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const [e, ...c] = [...t].reverse(), s = await C(e), l = s ? [...c, s] : c;
|
|
56
|
+
r(l.filter(Boolean));
|
|
57
|
+
}, [C, o, r, u, a]);
|
|
58
|
+
return {
|
|
59
|
+
errors: p,
|
|
60
|
+
handleFormReset: f,
|
|
61
|
+
handleFormSubmit: async () => u(a) || n(a[a.length - 1].value) ? !0 : (await U({}), f(), !1),
|
|
62
|
+
handleSelectedUsersChange: V,
|
|
63
|
+
handleUserSelectorBlur: y,
|
|
64
|
+
isFormSubmitting: b,
|
|
65
|
+
updateContactValue: x
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
N as useCollaborationForm
|
|
70
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState as d, useCallback as o } from "react";
|
|
2
|
+
import { useIntl as p } from "react-intl";
|
|
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 = () => {
|
|
7
|
+
const {
|
|
8
|
+
formatMessage: t
|
|
9
|
+
} = p(), [s, n] = d({}), r = o((e, i) => {
|
|
10
|
+
n((f) => ({
|
|
11
|
+
...f,
|
|
12
|
+
[e]: i
|
|
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]);
|
|
20
|
+
return {
|
|
21
|
+
errors: s,
|
|
22
|
+
validateExpiration: u,
|
|
23
|
+
validateVanityName: m,
|
|
24
|
+
validateUserContact: c,
|
|
25
|
+
validateUserSelector: l,
|
|
26
|
+
setFieldError: r
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
q as useFormValidation
|
|
31
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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(), {
|
|
12
|
+
sharingService: f
|
|
13
|
+
} = w(), {
|
|
14
|
+
updateSharedLink: h
|
|
15
|
+
} = 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
|
+
}));
|
|
23
|
+
}, []), b = d(() => {
|
|
24
|
+
o(r);
|
|
25
|
+
}, [r, o]), F = d(async () => {
|
|
26
|
+
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
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
await l(x);
|
|
43
|
+
} catch (y) {
|
|
44
|
+
return Object.entries(y).forEach(([k, v]) => n(k, v)), !0;
|
|
45
|
+
}
|
|
46
|
+
return !1;
|
|
47
|
+
}, [a, l, n, c, u]);
|
|
48
|
+
return {
|
|
49
|
+
errors: p,
|
|
50
|
+
formData: a,
|
|
51
|
+
handleFormReset: b,
|
|
52
|
+
handleFormSubmit: F,
|
|
53
|
+
isUpdating: E,
|
|
54
|
+
setFieldError: n,
|
|
55
|
+
setFieldValue: S
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
j as useLinkSettingsForm
|
|
60
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import b from "lodash/camelCase";
|
|
2
|
+
import { useState as C, useMemo as I, useCallback as L } from "react";
|
|
3
|
+
import { useIntl as E } from "react-intl";
|
|
4
|
+
import { useNotification as S } from "@box/blueprint-web";
|
|
5
|
+
import i from "../messages.js";
|
|
6
|
+
import { useUnifiedShareModalContext as v } from "../contexts/unified-share-modal-context.js";
|
|
7
|
+
const f = (s, e) => ({
|
|
8
|
+
closeButtonAriaLabel: s(i.noticeCloseLabel),
|
|
9
|
+
sensitivity: "foreground",
|
|
10
|
+
typeIconAriaLabel: s(e === "success" ? i.successNoticeIcon : i.errorNoticeIcon),
|
|
11
|
+
variant: e
|
|
12
|
+
}), N = (s, e, t, r) => {
|
|
13
|
+
if (!t)
|
|
14
|
+
return "";
|
|
15
|
+
const l = b(t), n = i[`${l}${e === "success" ? "Success" : "Error"}NoticeText`];
|
|
16
|
+
return n ? s(n, r) : e === "error" ? s(i.defaultErrorNoticeText) : "";
|
|
17
|
+
}, O = (s, e) => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage: t
|
|
20
|
+
} = E(), {
|
|
21
|
+
addNotification: r
|
|
22
|
+
} = S(), [l, u] = C(!1), {
|
|
23
|
+
config: n,
|
|
24
|
+
item: h
|
|
25
|
+
} = v(), {
|
|
26
|
+
notifications: m
|
|
27
|
+
} = n, {
|
|
28
|
+
name: d
|
|
29
|
+
} = h, a = I(() => m.includes(e), [e, m]);
|
|
30
|
+
return {
|
|
31
|
+
onAction: L(async (...p) => {
|
|
32
|
+
u(!0);
|
|
33
|
+
try {
|
|
34
|
+
if (s) {
|
|
35
|
+
const o = await s(...p), c = a && !!o && !!o.messages, y = a && !c;
|
|
36
|
+
c && o.messages.forEach(({
|
|
37
|
+
text: x,
|
|
38
|
+
type: A,
|
|
39
|
+
...T
|
|
40
|
+
}) => {
|
|
41
|
+
r({
|
|
42
|
+
...f(t, A),
|
|
43
|
+
styledText: x,
|
|
44
|
+
...T
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
const g = N(t, "success", e, {
|
|
48
|
+
itemName: d
|
|
49
|
+
});
|
|
50
|
+
y && g && r({
|
|
51
|
+
...f(t, "success"),
|
|
52
|
+
styledText: g
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
} catch (o) {
|
|
56
|
+
const c = N(t, "error", e);
|
|
57
|
+
if (a && c && r({
|
|
58
|
+
...f(t, "error"),
|
|
59
|
+
styledText: c
|
|
60
|
+
}), o.fields && Object.values(o.fields).length)
|
|
61
|
+
throw o.fields;
|
|
62
|
+
} finally {
|
|
63
|
+
u(!1);
|
|
64
|
+
}
|
|
65
|
+
}, [s, r, t, a, d, e]),
|
|
66
|
+
isLoading: l
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
O as useSharingAction
|
|
71
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
const a = e({
|
|
3
|
+
noticeCloseLabel: {
|
|
4
|
+
id: "groupSharedFeatures.usm.noticeCloseLabel",
|
|
5
|
+
defaultMessage: "Close"
|
|
6
|
+
},
|
|
7
|
+
successNoticeIcon: {
|
|
8
|
+
id: "groupSharedFeatures.usm.successNoticeIcon",
|
|
9
|
+
defaultMessage: "Success"
|
|
10
|
+
},
|
|
11
|
+
errorNoticeIcon: {
|
|
12
|
+
id: "groupSharedFeatures.usm.errorNoticeIcon",
|
|
13
|
+
defaultMessage: "Error"
|
|
14
|
+
},
|
|
15
|
+
defaultErrorNoticeText: {
|
|
16
|
+
id: "groupSharedFeatures.usm.defaultErrorNoticeText",
|
|
17
|
+
defaultMessage: "Something went wrong. Please try again later."
|
|
18
|
+
},
|
|
19
|
+
deleteSharedLinkSuccessNoticeText: {
|
|
20
|
+
id: "groupSharedFeatures.usm.deleteSharedLinkSuccessNoticeText",
|
|
21
|
+
defaultMessage: "The shared link for “{itemName}” has been removed successfully."
|
|
22
|
+
},
|
|
23
|
+
deleteSharedLinkErrorNoticeText: {
|
|
24
|
+
id: "groupSharedFeatures.usm.deleteSharedLinkErrorNoticeText",
|
|
25
|
+
defaultMessage: "Unable to remove the shared link. Please try again later."
|
|
26
|
+
},
|
|
27
|
+
updateSharedLinkSuccessNoticeText: {
|
|
28
|
+
id: "groupSharedFeatures.usm.updateSharedLinkSuccessNoticeText",
|
|
29
|
+
defaultMessage: "Your settings were saved successfully."
|
|
30
|
+
},
|
|
31
|
+
createSharedLinkSuccessNoticeText: {
|
|
32
|
+
id: "groupSharedFeatures.usm.createSharedLinkSuccessNoticeText",
|
|
33
|
+
defaultMessage: "Shared link created."
|
|
34
|
+
},
|
|
35
|
+
createSharedLinkErrorNoticeText: {
|
|
36
|
+
id: "groupSharedFeatures.usm.createSharedLinkErrorNoticeText",
|
|
37
|
+
defaultMessage: "Unable to create a shared link. Please try again later."
|
|
38
|
+
},
|
|
39
|
+
autoCopySharedLinkErrorNoticeText: {
|
|
40
|
+
id: "groupSharedFeatures.usm.autoCopySharedLinkErrorNoticeText",
|
|
41
|
+
defaultMessage: "Unable to create a shared link. Please try again later."
|
|
42
|
+
},
|
|
43
|
+
vanityNameInvalidErrorMessage: {
|
|
44
|
+
id: "groupSharedFeatures.usm.vanityNameInvalidErrorMessage",
|
|
45
|
+
defaultMessage: "Custom URLs should be between 12-30 characters, and can include letters, numbers, and hyphens."
|
|
46
|
+
},
|
|
47
|
+
vanityNameRequiredErrorMessage: {
|
|
48
|
+
id: "groupSharedFeatures.usm.vanityNameRequiredErrorMessage",
|
|
49
|
+
defaultMessage: "Please enter a custom URL"
|
|
50
|
+
},
|
|
51
|
+
expirationRequiredErrorMessage: {
|
|
52
|
+
id: "groupSharedFeatures.usm.expirationRequiredErrorMessage",
|
|
53
|
+
defaultMessage: "Please select a date"
|
|
54
|
+
},
|
|
55
|
+
expirationFutureDateRequiredErrorMessage: {
|
|
56
|
+
id: "groupSharedFeatures.usm.expirationFutureDateRequiredErrorMessage",
|
|
57
|
+
defaultMessage: "The expiration date must be in the future"
|
|
58
|
+
},
|
|
59
|
+
invalidEmailErrorMessage: {
|
|
60
|
+
id: "groupSharedFeatures.usm.invalidEmailErrorMessage",
|
|
61
|
+
defaultMessage: "Invalid email address"
|
|
62
|
+
},
|
|
63
|
+
emailRequiredErrorMessage: {
|
|
64
|
+
id: "groupSharedFeatures.usm.emailRequiredErrorMessage",
|
|
65
|
+
defaultMessage: "Enter at least one valid email"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
a as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createStore as o } from "@xstate/store";
|
|
2
|
+
const l = o({
|
|
3
|
+
// Initial context
|
|
4
|
+
context: {
|
|
5
|
+
currentView: "default",
|
|
6
|
+
collaborators: [],
|
|
7
|
+
emailMessage: ""
|
|
8
|
+
},
|
|
9
|
+
// Transitions
|
|
10
|
+
on: {
|
|
11
|
+
// Transition to a new view
|
|
12
|
+
changeView: (a, e) => ({
|
|
13
|
+
...a,
|
|
14
|
+
collaborators: e.view === "default" ? [] : a.collaborators,
|
|
15
|
+
currentView: e.view,
|
|
16
|
+
emailMessage: e.view === "default" ? "" : a.emailMessage
|
|
17
|
+
}),
|
|
18
|
+
changeCollaborators: (a, e) => ({
|
|
19
|
+
...a,
|
|
20
|
+
collaborators: e.collaborators
|
|
21
|
+
}),
|
|
22
|
+
changeEmailMessage: (a, e) => ({
|
|
23
|
+
...a,
|
|
24
|
+
emailMessage: e.emailMessage
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
l as store
|
|
30
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useState as a, useEffect as k, useMemo as F } from "react";
|
|
2
|
+
import { DEFAULT_CONFIGURATION as L } from "./constants.js";
|
|
3
|
+
import { jsxs as T, jsx as t } from "react/jsx-runtime";
|
|
4
|
+
import { UnifiedShareModalContext as j } from "./contexts/unified-share-modal-context.js";
|
|
5
|
+
import { UnifiedShareFormModal as A } from "./components/unified-share-form-modal/unified-share-form-modal.js";
|
|
6
|
+
import { SharedLinkSettingsModal as E } from "./components/shared-link-settings-modal/shared-link-settings-modal.js";
|
|
7
|
+
import { RemoveSharedLinkModal as N } from "./components/remove-shared-link-modal/remove-shared-link-modal.js";
|
|
8
|
+
function z({
|
|
9
|
+
children: f,
|
|
10
|
+
collaborationRoles: m,
|
|
11
|
+
collaborators: d,
|
|
12
|
+
config: h,
|
|
13
|
+
contactService: l,
|
|
14
|
+
currentUser: p,
|
|
15
|
+
eventService: c,
|
|
16
|
+
isFetching: u,
|
|
17
|
+
isOpen: e,
|
|
18
|
+
isSubmitting: g,
|
|
19
|
+
item: M,
|
|
20
|
+
onLoad: r,
|
|
21
|
+
onOpenChange: U,
|
|
22
|
+
sharedLink: O,
|
|
23
|
+
sharingService: C
|
|
24
|
+
}) {
|
|
25
|
+
const v = !!f, [i, S] = a(e ?? !v), [x, w] = a(!!r), [n, s] = a("unified-share-form");
|
|
26
|
+
k(() => S((o) => e ?? o), [e]), k(() => {
|
|
27
|
+
(async () => (r && await r(), w(!1)))();
|
|
28
|
+
}, []);
|
|
29
|
+
const I = (o) => {
|
|
30
|
+
S(e ?? o), U && U(o);
|
|
31
|
+
}, V = F(() => ({
|
|
32
|
+
collaborationRoles: m ?? [],
|
|
33
|
+
collaborators: d ?? [],
|
|
34
|
+
config: {
|
|
35
|
+
...L,
|
|
36
|
+
...h
|
|
37
|
+
},
|
|
38
|
+
contactService: l ?? {},
|
|
39
|
+
currentUser: p ?? {},
|
|
40
|
+
eventService: c ?? {},
|
|
41
|
+
isFetching: u ?? x,
|
|
42
|
+
isSubmitting: g,
|
|
43
|
+
item: M,
|
|
44
|
+
sharedLink: O ?? {},
|
|
45
|
+
sharingService: C ?? {}
|
|
46
|
+
}), [m, d, h, l, p, c, u, x, g, M, O, C]);
|
|
47
|
+
return /* @__PURE__ */ T(j.Provider, {
|
|
48
|
+
value: V,
|
|
49
|
+
children: [/* @__PURE__ */ t(A, {
|
|
50
|
+
isOpen: i && n === "unified-share-form",
|
|
51
|
+
onModalViewChange: s,
|
|
52
|
+
onOpenChange: I,
|
|
53
|
+
children: f
|
|
54
|
+
}), /* @__PURE__ */ t(E, {
|
|
55
|
+
isOpen: i && n === "shared-link-settings",
|
|
56
|
+
onOpenChange: () => s("unified-share-form")
|
|
57
|
+
}), /* @__PURE__ */ t(N, {
|
|
58
|
+
isOpen: i && n === "remove-shared-link",
|
|
59
|
+
onOpenChange: () => s("unified-share-form")
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
z as UnifiedShareModal
|
|
65
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SUPPORTED_COLLABORATOR_ROLES as t, SUPPORTED_INVITATION_ROLES as a } from "../constants.js";
|
|
2
|
+
const l = (e) => {
|
|
3
|
+
switch (e) {
|
|
4
|
+
case "small":
|
|
5
|
+
return "small";
|
|
6
|
+
case "medium":
|
|
7
|
+
return "medium";
|
|
8
|
+
case "large":
|
|
9
|
+
return "medium";
|
|
10
|
+
case "xlarge":
|
|
11
|
+
return "large";
|
|
12
|
+
case "xxlarge":
|
|
13
|
+
return "xlarge";
|
|
14
|
+
default:
|
|
15
|
+
return "medium";
|
|
16
|
+
}
|
|
17
|
+
}, s = (e = []) => e.find(({
|
|
18
|
+
isDefault: r
|
|
19
|
+
}) => r) || e[0], u = (e) => e.trim().slice(0, 1).toUpperCase(), i = (e) => t.includes(e), o = (e) => a.includes(e);
|
|
20
|
+
export {
|
|
21
|
+
l as getAvatarBadgeSize,
|
|
22
|
+
s as getDefaultCollaborationRole,
|
|
23
|
+
u as getFirstInitial,
|
|
24
|
+
i as isCollaboratorRoleSupported,
|
|
25
|
+
o as isInvitationRoleSupported
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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())), d = (t) => {
|
|
3
|
+
const r = navigator.language || "en-US", n = s(t).toDate(a());
|
|
4
|
+
return new m(r, {
|
|
5
|
+
day: "numeric",
|
|
6
|
+
month: "long",
|
|
7
|
+
year: "numeric"
|
|
8
|
+
}).format(n);
|
|
9
|
+
}, u = () => e(o(Date.now() + c, a()));
|
|
10
|
+
export {
|
|
11
|
+
s as formatDateFromTimestampToCalendarDate,
|
|
12
|
+
d as formatDateFromTimestampToDateString,
|
|
13
|
+
u as formatTomorrowDateToCalendarDate
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const f = (e, t = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
args: n = [],
|
|
4
|
+
canPreventDefault: o = !1,
|
|
5
|
+
canStopPropagation: r = !1,
|
|
6
|
+
keys: s = ["Enter", " "]
|
|
7
|
+
} = t;
|
|
8
|
+
return (a) => {
|
|
9
|
+
s.includes(a.key) && (o && a.preventDefault(), r && a.stopPropagation(), e(...n));
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
f as callOnKeyboardEvent
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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";
|
|
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,
|
|
14
|
+
r as getFirstInitial,
|
|
15
|
+
l as isCollaboratorRoleSupported,
|
|
16
|
+
x as isEmailValid,
|
|
17
|
+
i as isInvitationRoleSupported,
|
|
18
|
+
v as isVanityNameValid
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import o from "lodash/keyBy";
|
|
2
|
+
import { SUPPORTED_ACCESS_LEVELS as i } from "../constants.js";
|
|
3
|
+
const d = (t = []) => {
|
|
4
|
+
const s = t.map((r) => typeof r == "string" ? {
|
|
5
|
+
id: r
|
|
6
|
+
} : r), c = o(s, "id");
|
|
7
|
+
return i.reduce((r, n) => {
|
|
8
|
+
const e = c[n];
|
|
9
|
+
return e ? [...r, e] : r;
|
|
10
|
+
}, []);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
d as getAllowedAccessLevels
|
|
14
|
+
};
|