@box/unified-share-modal 2.11.14 → 2.12.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.
|
@@ -3,7 +3,7 @@ import { useIntl as b } from "react-intl";
|
|
|
3
3
|
import { useNotification as C } from "@box/blueprint-web";
|
|
4
4
|
import { useUnifiedShareModalContext as T } from "../contexts/unified-share-modal-context.js";
|
|
5
5
|
import { getNotificationArgs as a, getNotificationMessage as d } from "../utils/notification.js";
|
|
6
|
-
const v = (
|
|
6
|
+
const v = (r, t) => {
|
|
7
7
|
const {
|
|
8
8
|
formatMessage: e
|
|
9
9
|
} = b(), {
|
|
@@ -11,18 +11,18 @@ const v = (c, t) => {
|
|
|
11
11
|
} = C(), {
|
|
12
12
|
config: u,
|
|
13
13
|
item: g,
|
|
14
|
-
setIsLoading:
|
|
14
|
+
setIsLoading: c
|
|
15
15
|
} = T(), {
|
|
16
16
|
notifications: f
|
|
17
17
|
} = u, {
|
|
18
18
|
name: l
|
|
19
|
-
} = g,
|
|
19
|
+
} = g, n = x(() => f.includes(t), [t, f]);
|
|
20
20
|
return {
|
|
21
21
|
onAction: A(async (...h) => {
|
|
22
|
-
|
|
22
|
+
c(!0);
|
|
23
23
|
try {
|
|
24
|
-
if (
|
|
25
|
-
const s = await
|
|
24
|
+
if (r) {
|
|
25
|
+
const s = await r(...h), o = !!s && !!s.messages, N = n && !o;
|
|
26
26
|
o && s.messages.forEach(({
|
|
27
27
|
text: p,
|
|
28
28
|
type: y,
|
|
@@ -44,15 +44,15 @@ const v = (c, t) => {
|
|
|
44
44
|
}
|
|
45
45
|
} catch (s) {
|
|
46
46
|
const o = d(e, "error", t);
|
|
47
|
-
if (
|
|
47
|
+
if (n && o && i({
|
|
48
48
|
...a(e, "error"),
|
|
49
49
|
styledText: o
|
|
50
50
|
}), s?.fields && Object.values(s.fields).length)
|
|
51
51
|
throw s.fields;
|
|
52
52
|
} finally {
|
|
53
|
-
|
|
53
|
+
c(!1);
|
|
54
54
|
}
|
|
55
|
-
}, [
|
|
55
|
+
}, [r, i, e, n, l, t, c])
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
export {
|
|
@@ -463,13 +463,13 @@ export interface SharingService {
|
|
|
463
463
|
*
|
|
464
464
|
* Called when the user selects an access level for the shared link.
|
|
465
465
|
*/
|
|
466
|
-
changeSharedLinkAccess?: (access: AccessLevelType) => Promise<void>;
|
|
466
|
+
changeSharedLinkAccess?: (access: AccessLevelType) => Promise<SharingResponse | void>;
|
|
467
467
|
/**
|
|
468
468
|
* Function to change the permission level of the shared link.
|
|
469
469
|
*
|
|
470
470
|
* Called when the user selects a permission level for the shared link.
|
|
471
471
|
*/
|
|
472
|
-
changeSharedLinkPermission?: (permission: PermissionLevelType) => Promise<void>;
|
|
472
|
+
changeSharedLinkPermission?: (permission: PermissionLevelType) => Promise<SharingResponse | void>;
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
475
475
|
* Supported notice types for custom notifications.
|
|
@@ -682,6 +682,8 @@ export interface Configuration {
|
|
|
682
682
|
* Controls which notification types are displayed after sharing related actions.
|
|
683
683
|
*
|
|
684
684
|
* All notifications are enabled by default.
|
|
685
|
+
*
|
|
686
|
+
* NOTE: This does not affect custom messages provided in the sharing response.
|
|
685
687
|
*/
|
|
686
688
|
notifications?: NotificationType[];
|
|
687
689
|
/**
|