@box/unified-share-modal 1.33.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +120 -107
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +39 -39
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +107 -102
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +48 -39
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +66 -66
- package/dist/esm/lib/unified-share-modal.js +56 -54
- package/dist/styles/collaboration-role.css +1 -1
- package/dist/styles/collaboration-section.css +1 -1
- package/dist/styles/shared-link-section.css +1 -1
- package/dist/styles/shared-link-settings-modal.css +1 -1
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +1 -0
- package/dist/types/lib/types.d.ts +23 -4
- package/dist/types/lib/unified-share-modal.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,84 +1,86 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { createPortal as
|
|
1
|
+
import { useState as ce, useRef as de, useEffect as N, useCallback as F } from "react";
|
|
2
|
+
import { createPortal as me } from "react-dom";
|
|
3
3
|
import { useIntl as ue } from "react-intl";
|
|
4
|
-
import { useNotification as
|
|
4
|
+
import { useNotification as he, useUniqueId as fe, useLabelable as pe, Tooltip as be, Focusable as Ce, Text as ve, Modal as h } from "@box/blueprint-web";
|
|
5
5
|
import { Globe as ge } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
-
import { UserSelectorContainer as
|
|
7
|
-
import { CollaborationRole as
|
|
6
|
+
import { UserSelectorContainer as Se } from "@box/user-selector";
|
|
7
|
+
import { CollaborationRole as Ae } from "./collaboration-role.js";
|
|
8
8
|
import { SharedWithAvatars as Le } from "./shared-with-avatars.js";
|
|
9
9
|
import { ShieldRestrictionNotice as Ue } from "./shield-restriction-notice.js";
|
|
10
|
-
import { TextAreaContainer as
|
|
11
|
-
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as
|
|
10
|
+
import { TextAreaContainer as Fe } from "./text-area-container.js";
|
|
11
|
+
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as ye } from "../../../constants.js";
|
|
12
12
|
import o from "./messages.js";
|
|
13
|
-
import { jsxs as
|
|
14
|
-
import { useFormValidation as
|
|
15
|
-
import { useCollaborationForm as
|
|
13
|
+
import { jsxs as i, jsx as r, Fragment as Ie } from "react/jsx-runtime";
|
|
14
|
+
import { useFormValidation as _e } from "../../../hooks/use-form-validation.js";
|
|
15
|
+
import { useCollaborationForm as xe } from "../../../hooks/use-collaboration-form.js";
|
|
16
16
|
import { useUnifiedShareFormContext as Ee } from "../../../contexts/unified-share-form-context.js";
|
|
17
17
|
import { useUnifiedShareModalContext as Be } from "../../../contexts/unified-share-modal-context.js";
|
|
18
|
-
import '../../../../../styles/collaboration-section.css';const Ve = "
|
|
18
|
+
import '../../../../../styles/collaboration-section.css';const Ve = "_container_wmqot_2", Ne = "_label_wmqot_8", Re = "_securityIndicator_wmqot_23", Te = "_collaborationAccessContainer_wmqot_29", f = {
|
|
19
19
|
container: Ve,
|
|
20
|
-
label:
|
|
21
|
-
securityIndicator: Re
|
|
20
|
+
label: Ne,
|
|
21
|
+
securityIndicator: Re,
|
|
22
|
+
collaborationAccessContainer: Te
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
+
function Ye() {
|
|
24
25
|
const {
|
|
25
26
|
formatMessage: t
|
|
26
|
-
} = ue(), [
|
|
27
|
-
addNotification:
|
|
28
|
-
} =
|
|
29
|
-
validateShieldRestriction:
|
|
30
|
-
} =
|
|
31
|
-
contactValue:
|
|
32
|
-
container:
|
|
33
|
-
onModalOpenChange:
|
|
34
|
-
onShareViewChange:
|
|
35
|
-
setUserContacts:
|
|
36
|
-
shareView:
|
|
37
|
-
userContacts:
|
|
27
|
+
} = ue(), [p, y] = ce(), {
|
|
28
|
+
addNotification: R
|
|
29
|
+
} = he(), {
|
|
30
|
+
validateShieldRestriction: T
|
|
31
|
+
} = _e(), {
|
|
32
|
+
contactValue: w,
|
|
33
|
+
container: b,
|
|
34
|
+
onModalOpenChange: I,
|
|
35
|
+
onShareViewChange: C,
|
|
36
|
+
setUserContacts: O,
|
|
37
|
+
shareView: n,
|
|
38
|
+
userContacts: a
|
|
38
39
|
} = Ee(), {
|
|
40
|
+
collaborationAccess: P,
|
|
39
41
|
collaborationNotices: k,
|
|
40
|
-
config:
|
|
42
|
+
config: v,
|
|
41
43
|
contactService: M,
|
|
42
|
-
isFetching:
|
|
44
|
+
isFetching: q,
|
|
43
45
|
isSubmitting: D,
|
|
44
46
|
item: G,
|
|
45
47
|
sharingService: W
|
|
46
48
|
} = Be(), {
|
|
47
49
|
permissions: j = {},
|
|
48
|
-
type:
|
|
50
|
+
type: H
|
|
49
51
|
} = G, {
|
|
50
52
|
getContacts: g,
|
|
51
|
-
getContactsAvatarUrls:
|
|
53
|
+
getContactsAvatarUrls: S
|
|
52
54
|
} = M, {
|
|
53
|
-
sendInvitations:
|
|
54
|
-
sendSharedLink:
|
|
55
|
+
sendInvitations: K,
|
|
56
|
+
sendSharedLink: $
|
|
55
57
|
} = W;
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
+
let A, L;
|
|
59
|
+
n === "invite" && (A = K, L = "invite-collaborators"), n === "email" && (A = $, L = "email-shared-link");
|
|
58
60
|
const {
|
|
59
|
-
errors:
|
|
60
|
-
handleFormReset:
|
|
61
|
-
handleFormSubmit:
|
|
62
|
-
handleSelectedUsersChange:
|
|
63
|
-
handleUserSelectorBlur:
|
|
64
|
-
isFormSubmitting:
|
|
65
|
-
updateContactValue:
|
|
66
|
-
} =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
(!
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
61
|
+
errors: z,
|
|
62
|
+
handleFormReset: _,
|
|
63
|
+
handleFormSubmit: J,
|
|
64
|
+
handleSelectedUsersChange: x,
|
|
65
|
+
handleUserSelectorBlur: Q,
|
|
66
|
+
isFormSubmitting: X,
|
|
67
|
+
updateContactValue: Y
|
|
68
|
+
} = xe(A, L), s = n === "default" || n === "invite", l = n === "invite" || n === "email", c = D ?? X, Z = a.some((e) => e.isExternalUser), E = de(n === "email" ? "email" : "invite");
|
|
69
|
+
N(() => {
|
|
70
|
+
E.current = n === "email" ? "email" : "invite";
|
|
71
|
+
}, [n]), N(() => {
|
|
72
|
+
(!a.length || !a.some((e) => e.chipVariant === "error")) && y(null);
|
|
73
|
+
}, [a]);
|
|
74
|
+
const ee = F((e) => (e.stopPropagation(), !0), []), te = F((e) => g ? g(e, E.current) : Promise.resolve([]), [g]), oe = F((e) => S ? S(e) : Promise.resolve({}), [S]), re = (e) => {
|
|
75
|
+
l || C("invite"), Y(e);
|
|
76
|
+
}, ne = () => {
|
|
77
|
+
_(), C("default");
|
|
78
|
+
}, ae = async () => {
|
|
77
79
|
try {
|
|
78
|
-
if (
|
|
79
|
-
const e =
|
|
80
|
+
if (p) {
|
|
81
|
+
const e = T(a);
|
|
80
82
|
if (e) {
|
|
81
|
-
|
|
83
|
+
R({
|
|
82
84
|
closeButtonAriaLabel: t(o.closeButton),
|
|
83
85
|
sensitivity: "foreground",
|
|
84
86
|
styledText: e,
|
|
@@ -88,92 +90,95 @@ function Qe() {
|
|
|
88
90
|
return;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
if (await
|
|
93
|
+
if (await J())
|
|
92
94
|
return;
|
|
93
|
-
|
|
95
|
+
_(), I && I(!1), C("default");
|
|
94
96
|
} catch (e) {
|
|
95
97
|
if (!e.shieldRestriction)
|
|
96
98
|
return;
|
|
97
99
|
const {
|
|
98
100
|
shieldRestriction: U
|
|
99
|
-
} = e,
|
|
100
|
-
...
|
|
101
|
+
} = e, V = [...U.restrictedEmails ?? [], ...U.restrictedGroups ?? []], le = a.map((u) => V.includes(u.email) || V.includes(`${u.id}`) ? {
|
|
102
|
+
...u,
|
|
101
103
|
chipVariant: "error"
|
|
102
|
-
} :
|
|
103
|
-
y(U),
|
|
104
|
+
} : u);
|
|
105
|
+
y(U), O(le);
|
|
104
106
|
}
|
|
105
107
|
};
|
|
106
|
-
let d,
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
className:
|
|
108
|
+
let d, m = !1;
|
|
109
|
+
s && !j.canInviteCollaborator && (d = t(o.inviteDisabledTooltip), m = !0), s && H === "web_link" && (d = t(o.inviteWebLinkDisabledTooltip), m = !0);
|
|
110
|
+
const B = fe("user-contacts-"), ie = t(s ? o.invitePeopleLabel : o.emailSharedLinkLabel), se = pe(ie, B);
|
|
111
|
+
return /* @__PURE__ */ i("form", {
|
|
112
|
+
className: f.container,
|
|
111
113
|
onSubmit: (e) => e.preventDefault(),
|
|
112
|
-
children: [
|
|
113
|
-
error:
|
|
114
|
+
children: [p && /* @__PURE__ */ r(Ue, {
|
|
115
|
+
error: p,
|
|
114
116
|
isLoading: c,
|
|
115
|
-
onSelectedUsersChange:
|
|
116
|
-
}), k, /* @__PURE__ */
|
|
117
|
-
children: [
|
|
118
|
-
className:
|
|
119
|
-
}), /* @__PURE__ */ r(
|
|
117
|
+
onSelectedUsersChange: x
|
|
118
|
+
}), k, /* @__PURE__ */ i("div", {
|
|
119
|
+
children: [s && v.collaborators && /* @__PURE__ */ r(Le, {}), /* @__PURE__ */ r(se, {
|
|
120
|
+
className: f.label
|
|
121
|
+
}), /* @__PURE__ */ r(be, {
|
|
120
122
|
content: d,
|
|
121
123
|
"data-testid": "user-contacts-tooltip",
|
|
122
124
|
open: d ? void 0 : !1,
|
|
123
125
|
side: "bottom",
|
|
124
|
-
children: /* @__PURE__ */ r(
|
|
125
|
-
focusable:
|
|
126
|
-
children: /* @__PURE__ */ r(
|
|
126
|
+
children: /* @__PURE__ */ r(Ce, {
|
|
127
|
+
focusable: m,
|
|
128
|
+
children: /* @__PURE__ */ r(Se, {
|
|
127
129
|
className: "collaboration-user-selector",
|
|
128
130
|
clearButtonAriaLabel: t(o.clearButton),
|
|
129
131
|
clearOnBlur: !1,
|
|
130
|
-
disabled:
|
|
132
|
+
disabled: m || c,
|
|
131
133
|
displayChipVariant: (e) => e.chipVariant,
|
|
132
|
-
error:
|
|
133
|
-
fetchAvatarUrls:
|
|
134
|
-
fetchUsers:
|
|
135
|
-
hideOnEscape:
|
|
136
|
-
idForLabel:
|
|
137
|
-
inputValue:
|
|
134
|
+
error: z["user-contact"],
|
|
135
|
+
fetchAvatarUrls: oe,
|
|
136
|
+
fetchUsers: te,
|
|
137
|
+
hideOnEscape: ee,
|
|
138
|
+
idForLabel: B,
|
|
139
|
+
inputValue: w,
|
|
138
140
|
label: null,
|
|
139
|
-
onBlur:
|
|
140
|
-
onInputValueChange:
|
|
141
|
-
onSelectedUsersChange:
|
|
142
|
-
placeholder:
|
|
143
|
-
portalElement:
|
|
144
|
-
selectedUsers:
|
|
141
|
+
onBlur: Q,
|
|
142
|
+
onInputValueChange: re,
|
|
143
|
+
onSelectedUsersChange: x,
|
|
144
|
+
placeholder: a.length ? "" : t(o.invitePeoplePlaceholder),
|
|
145
|
+
portalElement: b,
|
|
146
|
+
selectedUsers: a,
|
|
145
147
|
selectOnEnterOrTab: !0,
|
|
146
|
-
variant:
|
|
148
|
+
variant: l ? "textarea" : "input"
|
|
147
149
|
})
|
|
148
150
|
})
|
|
149
|
-
}),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
}), s && /* @__PURE__ */ i("div", {
|
|
152
|
+
className: f.collaborationAccessContainer,
|
|
153
|
+
children: [v.collaborationRole && /* @__PURE__ */ r(Ae, {}), P]
|
|
154
|
+
})]
|
|
155
|
+
}), l && v.collaborationMessage && /* @__PURE__ */ r(Fe, {
|
|
156
|
+
maxCount: ye
|
|
157
|
+
}), l && Z && /* @__PURE__ */ i("div", {
|
|
158
|
+
className: f.securityIndicator,
|
|
159
|
+
children: [/* @__PURE__ */ r(ge, {}), /* @__PURE__ */ r(ve, {
|
|
155
160
|
as: "span",
|
|
156
161
|
color: "textOnLightSecondary",
|
|
157
162
|
children: t(o.contentSharedWithExternalCollaborators)
|
|
158
163
|
})]
|
|
159
|
-
}),
|
|
160
|
-
children: [!
|
|
164
|
+
}), l && b && /* @__PURE__ */ me(/* @__PURE__ */ i(Ie, {
|
|
165
|
+
children: [!q && /* @__PURE__ */ i(h.Footer, {
|
|
161
166
|
children: [/* @__PURE__ */ r(h.Footer.SecondaryButton, {
|
|
162
167
|
disabled: c,
|
|
163
|
-
onClick:
|
|
168
|
+
onClick: ne,
|
|
164
169
|
children: t(o.cancelButton)
|
|
165
170
|
}), /* @__PURE__ */ r(h.Footer.PrimaryButton, {
|
|
166
171
|
loading: c,
|
|
167
172
|
loadingAriaLabel: t(o.loadingLabel),
|
|
168
|
-
onClick:
|
|
173
|
+
onClick: ae,
|
|
169
174
|
children: t(o.sendButton)
|
|
170
175
|
})]
|
|
171
176
|
}), /* @__PURE__ */ r(h.Close, {
|
|
172
177
|
"aria-label": t(o.closeButton)
|
|
173
178
|
})]
|
|
174
|
-
}),
|
|
179
|
+
}), b)]
|
|
175
180
|
});
|
|
176
181
|
}
|
|
177
182
|
export {
|
|
178
|
-
|
|
183
|
+
Ye as CollaborationSection
|
|
179
184
|
};
|
|
@@ -1,58 +1,67 @@
|
|
|
1
|
-
import { useIntl as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Gray10 as
|
|
4
|
-
import { CollaboratorAvatar as
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import { callOnKeyboardEvent as
|
|
8
|
-
import { useUnifiedShareModalContext as
|
|
9
|
-
import { useUnifiedShareFormContext as
|
|
10
|
-
import '../../../../../styles/shared-with-avatars.css';const
|
|
11
|
-
container:
|
|
12
|
-
avatars:
|
|
13
|
-
},
|
|
14
|
-
function
|
|
1
|
+
import { useIntl as x } from "react-intl";
|
|
2
|
+
import { Text as C, Avatar as g } from "@box/blueprint-web";
|
|
3
|
+
import { Gray10 as A } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import { CollaboratorAvatar as S } from "../collaborators-view/collaborator-avatar.js";
|
|
5
|
+
import _ from "./messages.js";
|
|
6
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import { callOnKeyboardEvent as k } from "../../../utils/event.js";
|
|
8
|
+
import { useUnifiedShareModalContext as y } from "../../../contexts/unified-share-modal-context.js";
|
|
9
|
+
import { useUnifiedShareFormContext as I } from "../../../contexts/unified-share-form-context.js";
|
|
10
|
+
import '../../../../../styles/shared-with-avatars.css';const W = "_container_1ku5s_2", U = "_avatars_1ku5s_19", c = {
|
|
11
|
+
container: W,
|
|
12
|
+
avatars: U
|
|
13
|
+
}, m = 3;
|
|
14
|
+
function V() {
|
|
15
15
|
const {
|
|
16
|
-
formatMessage:
|
|
17
|
-
} =
|
|
18
|
-
collaborators:
|
|
19
|
-
currentUser:
|
|
16
|
+
formatMessage: d
|
|
17
|
+
} = x(), {
|
|
18
|
+
collaborators: f,
|
|
19
|
+
currentUser: h,
|
|
20
|
+
eventService: u,
|
|
20
21
|
isSubmitting: o
|
|
21
|
-
} =
|
|
22
|
-
onShareViewChange:
|
|
23
|
-
} =
|
|
24
|
-
|
|
25
|
-
} =
|
|
22
|
+
} = y(), {
|
|
23
|
+
onShareViewChange: v
|
|
24
|
+
} = I(), {
|
|
25
|
+
onCollaboratorsClick: a
|
|
26
|
+
} = u, {
|
|
27
|
+
id: n
|
|
28
|
+
} = h, t = f.filter(({
|
|
26
29
|
isCurrentUser: r,
|
|
27
|
-
userId:
|
|
28
|
-
}) => !(r ||
|
|
30
|
+
userId: b
|
|
31
|
+
}) => !(r || n && n === b));
|
|
29
32
|
if (!t.length)
|
|
30
33
|
return null;
|
|
31
|
-
const
|
|
32
|
-
|
|
34
|
+
const p = t.slice(0, m), s = t.length - m, i = () => {
|
|
35
|
+
if (a) {
|
|
36
|
+
a();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
v("collaborators");
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ l("div", {
|
|
33
42
|
"aria-disabled": o,
|
|
34
|
-
className:
|
|
35
|
-
onClick:
|
|
36
|
-
onKeyDown:
|
|
43
|
+
className: c.container,
|
|
44
|
+
onClick: i,
|
|
45
|
+
onKeyDown: k(i),
|
|
37
46
|
role: "button",
|
|
38
47
|
tabIndex: o ? -1 : 0,
|
|
39
|
-
children: [/* @__PURE__ */ e(
|
|
48
|
+
children: [/* @__PURE__ */ e(C, {
|
|
40
49
|
as: "span",
|
|
41
50
|
color: "textOnLightSecondary",
|
|
42
|
-
children:
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
-
className:
|
|
45
|
-
children: [
|
|
51
|
+
children: d(_.sharedWithLabel)
|
|
52
|
+
}), /* @__PURE__ */ l("div", {
|
|
53
|
+
className: c.avatars,
|
|
54
|
+
children: [p.map((r) => /* @__PURE__ */ e(S, {
|
|
46
55
|
collaborator: r,
|
|
47
56
|
size: "medium"
|
|
48
|
-
}, r.id)),
|
|
49
|
-
color:
|
|
57
|
+
}, r.id)), s > 0 && /* @__PURE__ */ e(g, {
|
|
58
|
+
color: A,
|
|
50
59
|
size: "medium",
|
|
51
|
-
text: `+${
|
|
60
|
+
text: `+${s}`
|
|
52
61
|
})]
|
|
53
62
|
})]
|
|
54
63
|
});
|
|
55
64
|
}
|
|
56
65
|
export {
|
|
57
|
-
|
|
66
|
+
V as SharedWithAvatars
|
|
58
67
|
};
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useRef as S, useState as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Text as x, Tooltip as _, Focusable as
|
|
1
|
+
import { useRef as S, useState as V, useCallback as v, useEffect as N } from "react";
|
|
2
|
+
import { useIntl as z } from "react-intl";
|
|
3
|
+
import { Text as x, Tooltip as _, Focusable as G, Switch as H, Status as J, Link as Q, Button as W } from "@box/blueprint-web";
|
|
4
4
|
import { ClockBadge as X } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
-
import { Mail as Y, Globe as
|
|
5
|
+
import { Mail as Y, Globe as P } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
6
|
import { SurfaceStatusSurfaceRed as Z } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
7
|
import { CopyInput as $ } from "@box/copy-input";
|
|
8
8
|
import { SharedLinkAccess as ee } from "./shared-link-access.js";
|
|
9
|
-
import { SharedLinkPermission as
|
|
10
|
-
import
|
|
11
|
-
import { jsxs as l, jsx as
|
|
12
|
-
import { useUnifiedShareFormContext as
|
|
9
|
+
import { SharedLinkPermission as te } from "./shared-link-permission.js";
|
|
10
|
+
import t from "./messages.js";
|
|
11
|
+
import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
12
|
+
import { useUnifiedShareFormContext as ie } from "../../../contexts/unified-share-form-context.js";
|
|
13
13
|
import { useUnifiedShareModalContext as ae } from "../../../contexts/unified-share-modal-context.js";
|
|
14
|
-
import { useSharingAction as
|
|
14
|
+
import { useSharingAction as D } from "../../../hooks/use-sharing-action.js";
|
|
15
15
|
import { formatDateFromTimestampToDateString as ne } from "../../../utils/date.js";
|
|
16
16
|
import { callOnKeyboardEvent as oe } from "../../../utils/event.js";
|
|
17
|
-
import '../../../../../styles/shared-link-section.css';const se = "
|
|
17
|
+
import '../../../../../styles/shared-link-section.css';const se = "_container_1b8qy_1", re = "_toggle_1b8qy_7", ce = "_settings_1b8qy_13", le = "_copy_1b8qy_22", de = "_access_1b8qy_30", he = "_securityIndicator_1b8qy_36", s = {
|
|
18
18
|
container: se,
|
|
19
19
|
toggle: re,
|
|
20
20
|
settings: ce,
|
|
@@ -22,149 +22,149 @@ import '../../../../../styles/shared-link-section.css';const se = "_container_1w
|
|
|
22
22
|
access: de,
|
|
23
23
|
securityIndicator: he
|
|
24
24
|
};
|
|
25
|
-
function
|
|
25
|
+
function Ie() {
|
|
26
26
|
const {
|
|
27
27
|
formatMessage: e
|
|
28
|
-
} =
|
|
29
|
-
onModalViewChange:
|
|
30
|
-
onShareViewChange:
|
|
31
|
-
} =
|
|
28
|
+
} = z(), g = S(!0), k = S(null), m = S(null), {
|
|
29
|
+
onModalViewChange: y,
|
|
30
|
+
onShareViewChange: w
|
|
31
|
+
} = ie(), {
|
|
32
32
|
config: o,
|
|
33
33
|
isFetching: A,
|
|
34
34
|
isSubmitting: F,
|
|
35
|
-
item:
|
|
35
|
+
item: q,
|
|
36
36
|
sharedLink: n,
|
|
37
|
-
sharingService:
|
|
37
|
+
sharingService: R
|
|
38
38
|
} = ae(), {
|
|
39
39
|
permissions: T = {}
|
|
40
|
+
} = q, {
|
|
41
|
+
createSharedLink: M
|
|
40
42
|
} = R, {
|
|
41
|
-
createSharedLink: B
|
|
42
|
-
} = M, {
|
|
43
43
|
sharedLinkAutoCopy: d,
|
|
44
|
-
sharedLinkAutoCreate:
|
|
44
|
+
sharedLinkAutoCreate: L
|
|
45
45
|
} = o;
|
|
46
|
-
let
|
|
47
|
-
d && (
|
|
46
|
+
let I = "create-shared-link";
|
|
47
|
+
d && (I = "auto-copy-shared-link");
|
|
48
48
|
const {
|
|
49
|
-
isLoading:
|
|
49
|
+
isLoading: B,
|
|
50
50
|
onAction: b
|
|
51
|
-
} =
|
|
52
|
-
a || (await b(),
|
|
53
|
-
}, [a, b]),
|
|
51
|
+
} = D(M, I), a = !!n.url, r = F ?? B, [C, O] = V(!1), p = v(async () => {
|
|
52
|
+
a || (await b(), O(!0));
|
|
53
|
+
}, [a, b]), U = v(async () => (p(), new Promise((c) => {
|
|
54
54
|
m.current = {
|
|
55
55
|
resolve: c
|
|
56
56
|
};
|
|
57
57
|
})), [p]), {
|
|
58
|
-
onAction:
|
|
59
|
-
} =
|
|
60
|
-
|
|
61
|
-
!g.current || A || (d ?
|
|
62
|
-
}, [A, g, d,
|
|
58
|
+
onAction: E
|
|
59
|
+
} = D(U, "auto-copy-shared-link");
|
|
60
|
+
N(() => {
|
|
61
|
+
!g.current || A || (d ? E() : L && p(), g.current = !1);
|
|
62
|
+
}, [A, g, d, L, p, E]), N(() => {
|
|
63
63
|
a && d && k.current && k.current.click();
|
|
64
64
|
}, [a, d]);
|
|
65
|
-
const
|
|
65
|
+
const j = v((u) => {
|
|
66
66
|
if (!m.current)
|
|
67
67
|
return;
|
|
68
68
|
let c;
|
|
69
|
-
u instanceof Error ? c = C ? e(
|
|
69
|
+
u instanceof Error ? c = C ? e(t.autoCreateCopyErrorNoticeText) : null : c = e(C ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), c && m.current.resolve({
|
|
70
70
|
messages: [{
|
|
71
71
|
text: c,
|
|
72
72
|
type: "success"
|
|
73
73
|
}]
|
|
74
74
|
}), m.current = null;
|
|
75
|
-
}, [e, C]),
|
|
76
|
-
u ||
|
|
75
|
+
}, [e, C]), K = async (u) => {
|
|
76
|
+
u || y("remove-shared-link"), u && await b();
|
|
77
77
|
};
|
|
78
78
|
let h, f = !1;
|
|
79
|
-
return !a && !r && (h = e(
|
|
79
|
+
return !a && !r && (h = e(t.sharedLinkToggleTooltip)), !a && !T.canShare && (h = e(t.createLinkDisabledTooltip), f = !0), a && !T.canSetShareAccess && (h = e(t.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
|
|
80
80
|
className: s.container,
|
|
81
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ i(x, {
|
|
82
82
|
as: "label",
|
|
83
83
|
variant: "bodyDefaultBold",
|
|
84
|
-
children: e(
|
|
84
|
+
children: e(t.shareLinkLabel)
|
|
85
85
|
}), /* @__PURE__ */ l("div", {
|
|
86
86
|
className: s.toggle,
|
|
87
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ i(_, {
|
|
88
88
|
align: "start",
|
|
89
89
|
content: h,
|
|
90
90
|
"data-testid": "shared-link-tooltip",
|
|
91
91
|
open: h ? void 0 : !1,
|
|
92
|
-
children: /* @__PURE__ */
|
|
92
|
+
children: /* @__PURE__ */ i(G, {
|
|
93
93
|
focusable: f,
|
|
94
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ i(H.Item, {
|
|
95
95
|
checked: a,
|
|
96
96
|
disabled: f || r,
|
|
97
|
-
label: e(
|
|
98
|
-
onCheckedChange:
|
|
97
|
+
label: e(t.sharedLinkToggleLabel),
|
|
98
|
+
onCheckedChange: K,
|
|
99
99
|
value: "shared-link"
|
|
100
100
|
})
|
|
101
101
|
})
|
|
102
|
-
}), a && !!n.expiresAt && /* @__PURE__ */
|
|
103
|
-
content: e(
|
|
102
|
+
}), a && !!n.expiresAt && /* @__PURE__ */ i(_, {
|
|
103
|
+
content: e(t.expirationIconTooltip, {
|
|
104
104
|
expirationDate: ne(n.expiresAt)
|
|
105
105
|
}),
|
|
106
106
|
"data-testid": "expiration-date-tooltip",
|
|
107
|
-
children: /* @__PURE__ */
|
|
107
|
+
children: /* @__PURE__ */ i(J, {
|
|
108
108
|
color: Z,
|
|
109
109
|
hideText: !0,
|
|
110
110
|
icon: X,
|
|
111
|
-
text: e(
|
|
111
|
+
text: e(t.expirationIconLabel)
|
|
112
112
|
})
|
|
113
|
-
}), a && o.sharedLinkSettings && /* @__PURE__ */
|
|
113
|
+
}), a && o.sharedLinkSettings && /* @__PURE__ */ i(Q, {
|
|
114
114
|
"aria-disabled": r,
|
|
115
115
|
"aria-haspopup": "dialog",
|
|
116
116
|
className: s.settings,
|
|
117
|
-
onClick: () =>
|
|
118
|
-
onKeyDown: oe(() =>
|
|
117
|
+
onClick: () => y("shared-link-settings"),
|
|
118
|
+
onKeyDown: oe(() => y("shared-link-settings"), {
|
|
119
119
|
canPreventDefault: !0
|
|
120
120
|
}),
|
|
121
121
|
role: "button",
|
|
122
122
|
tabIndex: r ? -1 : 0,
|
|
123
123
|
variant: "standalone",
|
|
124
|
-
children: e(
|
|
124
|
+
children: e(t.sharedLinkSettingsLabel)
|
|
125
125
|
})]
|
|
126
126
|
}), a && /* @__PURE__ */ l("div", {
|
|
127
127
|
className: s.copy,
|
|
128
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ i($, {
|
|
129
129
|
ref: k,
|
|
130
|
-
autoFocus:
|
|
130
|
+
autoFocus: L && a,
|
|
131
131
|
disabled: r,
|
|
132
132
|
hideLabel: !0,
|
|
133
|
-
label: e(
|
|
134
|
-
onCopy:
|
|
133
|
+
label: e(t.sharedLinkUrlLabel),
|
|
134
|
+
onCopy: j,
|
|
135
135
|
value: n.url
|
|
136
|
-
}), o.sharedLinkEmail && /* @__PURE__ */
|
|
136
|
+
}), o.sharedLinkEmail && /* @__PURE__ */ i(_, {
|
|
137
137
|
align: "end",
|
|
138
|
-
content: e(
|
|
139
|
-
children: /* @__PURE__ */
|
|
140
|
-
"aria-label": e(
|
|
138
|
+
content: e(t.sharedLinkEmailLabel),
|
|
139
|
+
children: /* @__PURE__ */ i(W, {
|
|
140
|
+
"aria-label": e(t.sharedLinkEmailLabel),
|
|
141
141
|
disabled: r,
|
|
142
142
|
icon: Y,
|
|
143
|
-
onClick: () =>
|
|
143
|
+
onClick: () => w("email"),
|
|
144
144
|
size: "large",
|
|
145
145
|
variant: "secondary"
|
|
146
146
|
})
|
|
147
147
|
})]
|
|
148
148
|
}), a && (o.sharedLinkAccess || o.sharedLinkPermission) && /* @__PURE__ */ l("div", {
|
|
149
149
|
className: s.access,
|
|
150
|
-
children: [o.sharedLinkAccess && /* @__PURE__ */
|
|
150
|
+
children: [o.sharedLinkAccess && /* @__PURE__ */ i(ee, {}), o.sharedLinkPermission && /* @__PURE__ */ i(te, {})]
|
|
151
151
|
}), a && n.access === "open" && /* @__PURE__ */ l("div", {
|
|
152
152
|
className: s.securityIndicator,
|
|
153
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ i(P, {}), /* @__PURE__ */ i(x, {
|
|
154
154
|
as: "span",
|
|
155
155
|
color: "textOnLightSecondary",
|
|
156
|
-
children: n.permission === "can_edit" ? e(
|
|
156
|
+
children: n.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
157
157
|
})]
|
|
158
158
|
}), a && n.access === "company" && n.permission === "can_edit" && /* @__PURE__ */ l("div", {
|
|
159
159
|
className: s.securityIndicator,
|
|
160
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ i(P, {}), /* @__PURE__ */ i(x, {
|
|
161
161
|
as: "span",
|
|
162
162
|
color: "textOnLightSecondary",
|
|
163
|
-
children: e(
|
|
163
|
+
children: e(t.sharedLinkElevatedEditableCompanyAvailable)
|
|
164
164
|
})]
|
|
165
165
|
})]
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
export {
|
|
169
|
-
|
|
169
|
+
Ie as SharedLinkSection
|
|
170
170
|
};
|