@box/unified-share-modal 2.8.14 → 2.8.16
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/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { useRef as G, useCallback as
|
|
1
|
+
import { useRef as G, useCallback as I, useEffect as V } from "react";
|
|
2
2
|
import { useIntl as q } from "react-intl";
|
|
3
|
-
import { useNotification as H, Text as
|
|
3
|
+
import { useNotification as H, Text as y, Tooltip as C, Focusable as J, Switch as Q, Status as W, Link as X, Button as Y } from "@box/blueprint-web";
|
|
4
4
|
import { ClockBadge as Z } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
-
import { Mail as $, Globe as
|
|
6
|
-
import { SurfaceStatusSurfaceRed as ee, bpSize040 as
|
|
5
|
+
import { Mail as $, Globe as P } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
+
import { SurfaceStatusSurfaceRed as ee, bpSize040 as k } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
7
|
import { CopyInput as te } from "@box/copy-input";
|
|
8
8
|
import { SharedLinkAccess as ie } from "./shared-link-access.js";
|
|
9
9
|
import { SharedLinkPermission as ae } from "./shared-link-permission.js";
|
|
10
10
|
import t from "./messages.js";
|
|
11
|
-
import { jsxs as
|
|
11
|
+
import { jsxs as h, jsx as i } from "react/jsx-runtime";
|
|
12
12
|
import { useUnifiedShareFormContext as ne } from "../../../contexts/unified-share-form-context.js";
|
|
13
13
|
import { useUnifiedShareModalContext as oe } from "../../../contexts/unified-share-modal-context.js";
|
|
14
14
|
import { useSharingAction as re } from "../../../hooks/use-sharing-action.js";
|
|
15
15
|
import { getNotificationArgs as se } from "../../../utils/notification.js";
|
|
16
16
|
import { formatDateFromTimestampToDateString as ce } from "../../../utils/date.js";
|
|
17
17
|
import { callOnKeyboardEvent as le } from "../../../utils/event.js";
|
|
18
|
-
import '../../../../../styles/shared-link-section.css';const de = "_container_j966c_1", he = "_toggle_j966c_7", ue = "_settings_j966c_13", me = "_copy_j966c_22", pe = "_access_j966c_30", ge = "_icon_j966c_36",
|
|
18
|
+
import '../../../../../styles/shared-link-section.css';const de = "_container_j966c_1", he = "_toggle_j966c_7", ue = "_settings_j966c_13", me = "_copy_j966c_22", pe = "_access_j966c_30", ge = "_icon_j966c_36", l = {
|
|
19
19
|
container: de,
|
|
20
20
|
toggle: he,
|
|
21
21
|
settings: ue,
|
|
@@ -27,90 +27,90 @@ function Ie() {
|
|
|
27
27
|
const {
|
|
28
28
|
formatMessage: e
|
|
29
29
|
} = q(), {
|
|
30
|
-
addNotification:
|
|
31
|
-
} = H(),
|
|
32
|
-
isInteracted:
|
|
33
|
-
isSharedLinkAutoCopied:
|
|
30
|
+
addNotification: v
|
|
31
|
+
} = H(), f = G(null), {
|
|
32
|
+
isInteracted: L,
|
|
33
|
+
isSharedLinkAutoCopied: m,
|
|
34
34
|
isSharedLinkAutoCreated: r,
|
|
35
|
-
setForm:
|
|
35
|
+
setForm: B
|
|
36
36
|
} = ne(), {
|
|
37
37
|
config: s,
|
|
38
|
-
eventService:
|
|
39
|
-
isFetching:
|
|
38
|
+
eventService: F,
|
|
39
|
+
isFetching: x,
|
|
40
40
|
isSubmitting: n,
|
|
41
|
-
item:
|
|
42
|
-
setView:
|
|
41
|
+
item: M,
|
|
42
|
+
setView: T,
|
|
43
43
|
sharedLink: o,
|
|
44
|
-
sharingService:
|
|
44
|
+
sharingService: O
|
|
45
45
|
} = oe(), {
|
|
46
|
-
permissions:
|
|
47
|
-
} = O, {
|
|
48
|
-
onSharedLinkCopy: S,
|
|
49
|
-
onSharedLinkSettingsClick: N
|
|
46
|
+
permissions: _ = {}
|
|
50
47
|
} = M, {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
onSharedLinkCopy: S,
|
|
49
|
+
onSharedLinkSettingsClick: A
|
|
50
|
+
} = F, {
|
|
51
|
+
createSharedLink: N
|
|
52
|
+
} = O, {
|
|
53
|
+
notifications: E,
|
|
54
|
+
sharedLinkAutoCopy: R,
|
|
55
|
+
sharedLinkAutoCreate: D
|
|
56
|
+
} = s, a = !!o.url, c = R && !m.current && !L, j = D && !r.current && !L, U = I(async () => {
|
|
57
|
+
const d = await N();
|
|
58
|
+
return c ? {
|
|
59
59
|
messages: []
|
|
60
|
-
} :
|
|
61
|
-
}, [
|
|
62
|
-
onAction:
|
|
60
|
+
} : d;
|
|
61
|
+
}, [c, N]), {
|
|
62
|
+
onAction: b
|
|
63
63
|
} = re(U, "create-shared-link");
|
|
64
64
|
V(() => {
|
|
65
|
-
(async () =>
|
|
66
|
-
}, [a,
|
|
67
|
-
const z =
|
|
68
|
-
if (S && S(
|
|
65
|
+
(async () => x || n || ((c || j) && !a && (await b(), r.current = !0), c && a && f.current && f.current.click()))();
|
|
66
|
+
}, [a, c, j, x, m, r, n, b]);
|
|
67
|
+
const z = I((d) => {
|
|
68
|
+
if (S && S(d), !c)
|
|
69
69
|
return;
|
|
70
|
-
let
|
|
71
|
-
typeof
|
|
70
|
+
let g;
|
|
71
|
+
typeof d != "string" ? g = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : g = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), g && E.includes("auto-copy-shared-link") && v({
|
|
72
72
|
...se(e, "success"),
|
|
73
|
-
styledText:
|
|
74
|
-
});
|
|
75
|
-
}, [
|
|
76
|
-
if (
|
|
77
|
-
await
|
|
73
|
+
styledText: g
|
|
74
|
+
}), m.current = !0;
|
|
75
|
+
}, [v, e, c, m, r, E, S]), K = async (d) => {
|
|
76
|
+
if (d) {
|
|
77
|
+
await b();
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
if (
|
|
83
|
-
|
|
80
|
+
T("remove-shared-link");
|
|
81
|
+
}, w = () => {
|
|
82
|
+
if (A) {
|
|
83
|
+
A();
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
T("shared-link-settings");
|
|
87
87
|
};
|
|
88
|
-
let u,
|
|
89
|
-
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !
|
|
90
|
-
className:
|
|
91
|
-
children: [/* @__PURE__ */ i(
|
|
88
|
+
let u, p = !1;
|
|
89
|
+
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !_.canShare && (u = e(t.createLinkDisabledTooltip), p = !0), a && !_.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), p = !0), /* @__PURE__ */ h("div", {
|
|
90
|
+
className: l.container,
|
|
91
|
+
children: [/* @__PURE__ */ i(y, {
|
|
92
92
|
as: "label",
|
|
93
93
|
variant: "bodyDefaultBold",
|
|
94
94
|
children: e(t.shareLinkLabel)
|
|
95
|
-
}), /* @__PURE__ */
|
|
96
|
-
className:
|
|
97
|
-
children: [/* @__PURE__ */ i(
|
|
95
|
+
}), /* @__PURE__ */ h("div", {
|
|
96
|
+
className: l.toggle,
|
|
97
|
+
children: [/* @__PURE__ */ i(C, {
|
|
98
98
|
align: "start",
|
|
99
99
|
content: u,
|
|
100
100
|
"data-testid": "shared-link-tooltip",
|
|
101
101
|
open: u ? void 0 : !1,
|
|
102
102
|
children: /* @__PURE__ */ i(J, {
|
|
103
|
-
focusable:
|
|
103
|
+
focusable: p,
|
|
104
104
|
children: /* @__PURE__ */ i(Q.Item, {
|
|
105
105
|
checked: a,
|
|
106
106
|
"data-target-id": "Toggle-CreateSharedLink",
|
|
107
|
-
disabled:
|
|
107
|
+
disabled: p || n,
|
|
108
108
|
label: e(t.sharedLinkToggleLabel),
|
|
109
109
|
onCheckedChange: K,
|
|
110
110
|
value: "shared-link"
|
|
111
111
|
})
|
|
112
112
|
})
|
|
113
|
-
}), a && !!o.expiresAt && /* @__PURE__ */ i(
|
|
113
|
+
}), a && !!o.expiresAt && /* @__PURE__ */ i(C, {
|
|
114
114
|
content: e(t.expirationIconTooltip, {
|
|
115
115
|
expirationDate: ce(o.expiresAt)
|
|
116
116
|
}),
|
|
@@ -124,10 +124,10 @@ function Ie() {
|
|
|
124
124
|
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(X, {
|
|
125
125
|
"aria-disabled": n,
|
|
126
126
|
"aria-haspopup": "dialog",
|
|
127
|
-
className:
|
|
127
|
+
className: l.settings,
|
|
128
128
|
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
129
|
-
onClick:
|
|
130
|
-
onKeyDown: le(
|
|
129
|
+
onClick: w,
|
|
130
|
+
onKeyDown: le(w, {
|
|
131
131
|
canPreventDefault: !0
|
|
132
132
|
}),
|
|
133
133
|
role: "button",
|
|
@@ -135,18 +135,18 @@ function Ie() {
|
|
|
135
135
|
variant: "standalone",
|
|
136
136
|
children: e(t.sharedLinkSettingsLabel)
|
|
137
137
|
})]
|
|
138
|
-
}), a && /* @__PURE__ */
|
|
139
|
-
className:
|
|
138
|
+
}), a && /* @__PURE__ */ h("div", {
|
|
139
|
+
className: l.copy,
|
|
140
140
|
children: [/* @__PURE__ */ i(te, {
|
|
141
|
-
ref:
|
|
142
|
-
autoFocus:
|
|
141
|
+
ref: f,
|
|
142
|
+
autoFocus: D && r.current && !L,
|
|
143
143
|
"data-target-id": "Button-CopySharedLink",
|
|
144
144
|
disabled: n,
|
|
145
145
|
hideLabel: !0,
|
|
146
146
|
label: e(t.sharedLinkUrlLabel),
|
|
147
147
|
onCopy: z,
|
|
148
148
|
value: o.url
|
|
149
|
-
}), s.sharedLinkEmail && /* @__PURE__ */ i(
|
|
149
|
+
}), s.sharedLinkEmail && /* @__PURE__ */ i(C, {
|
|
150
150
|
align: "end",
|
|
151
151
|
content: e(t.sharedLinkEmailLabel),
|
|
152
152
|
children: /* @__PURE__ */ i(Y, {
|
|
@@ -154,30 +154,30 @@ function Ie() {
|
|
|
154
154
|
"data-target-id": "Button-SendSharedLink",
|
|
155
155
|
disabled: n,
|
|
156
156
|
icon: $,
|
|
157
|
-
onClick: () =>
|
|
157
|
+
onClick: () => B("email"),
|
|
158
158
|
size: "large",
|
|
159
159
|
variant: "secondary"
|
|
160
160
|
})
|
|
161
161
|
})]
|
|
162
|
-
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */
|
|
163
|
-
className:
|
|
162
|
+
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ h("div", {
|
|
163
|
+
className: l.access,
|
|
164
164
|
children: [s.sharedLinkAccess && /* @__PURE__ */ i(ie, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ae, {})]
|
|
165
|
-
}), a && o.access === "open" && /* @__PURE__ */
|
|
166
|
-
children: [/* @__PURE__ */ i(
|
|
167
|
-
className:
|
|
168
|
-
height:
|
|
169
|
-
width:
|
|
170
|
-
}), /* @__PURE__ */ i(
|
|
165
|
+
}), a && o.access === "open" && /* @__PURE__ */ h("div", {
|
|
166
|
+
children: [/* @__PURE__ */ i(P, {
|
|
167
|
+
className: l.icon,
|
|
168
|
+
height: k,
|
|
169
|
+
width: k
|
|
170
|
+
}), /* @__PURE__ */ i(y, {
|
|
171
171
|
as: "span",
|
|
172
172
|
color: "textOnLightSecondary",
|
|
173
173
|
children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
174
174
|
})]
|
|
175
|
-
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */
|
|
176
|
-
children: [/* @__PURE__ */ i(
|
|
177
|
-
className:
|
|
178
|
-
height:
|
|
179
|
-
width:
|
|
180
|
-
}), /* @__PURE__ */ i(
|
|
175
|
+
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ h("div", {
|
|
176
|
+
children: [/* @__PURE__ */ i(P, {
|
|
177
|
+
className: l.icon,
|
|
178
|
+
height: k,
|
|
179
|
+
width: k
|
|
180
|
+
}), /* @__PURE__ */ i(y, {
|
|
181
181
|
as: "span",
|
|
182
182
|
color: "textOnLightSecondary",
|
|
183
183
|
children: e(t.sharedLinkElevatedEditableCompanyAvailable)
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.16",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^13.9.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.110.
|
|
8
|
-
"@box/copy-input": "^1.39.
|
|
9
|
-
"@box/user-selector": "^1.73.
|
|
6
|
+
"@box/blueprint-web": "^13.9.3",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.110.1",
|
|
8
|
+
"@box/copy-input": "^1.39.38",
|
|
9
|
+
"@box/user-selector": "^1.73.39",
|
|
10
10
|
"lodash": "^4.17.15",
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"react-dom": "^18.0.0",
|
|
13
13
|
"react-intl": "^6.4.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^13.9.
|
|
17
|
-
"@box/blueprint-web-assets": "^4.110.
|
|
18
|
-
"@box/copy-input": "^1.39.
|
|
19
|
-
"@box/storybook-utils": "0.16.
|
|
16
|
+
"@box/blueprint-web": "^13.9.3",
|
|
17
|
+
"@box/blueprint-web-assets": "^4.110.1",
|
|
18
|
+
"@box/copy-input": "^1.39.38",
|
|
19
|
+
"@box/storybook-utils": "0.16.87",
|
|
20
20
|
"@box/eslint-plugin-blueprint": "1.1.6",
|
|
21
21
|
"react-intl": "^6.4.2"
|
|
22
22
|
},
|