@box/unified-share-modal 2.7.1 → 2.7.3

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.
@@ -1,74 +1,75 @@
1
- import { useRef as M, useCallback as N, useEffect as O } from "react";
2
- import { useIntl as R } from "react-intl";
3
- import { useNotification as U, Text as S, Tooltip as y, Focusable as z, Switch as K, Status as G, Link as V, Button as q } from "@box/blueprint-web";
4
- import { ClockBadge as H } from "@box/blueprint-web-assets/icons/Line";
5
- import { Mail as J, Globe as E } from "@box/blueprint-web-assets/icons/Medium";
6
- import { SurfaceStatusSurfaceRed as Q, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
- import { CopyInput as W } from "@box/copy-input";
8
- import { SharedLinkAccess as X } from "./shared-link-access.js";
9
- import { SharedLinkPermission as Y } from "./shared-link-permission.js";
1
+ import { useRef as O, useCallback as E, useEffect as R } from "react";
2
+ import { useIntl as U } from "react-intl";
3
+ import { useNotification as z, Text as S, Tooltip as y, Focusable as K, Switch as G, Status as V, Link as q, Button as H } from "@box/blueprint-web";
4
+ import { ClockBadge as J } from "@box/blueprint-web-assets/icons/Line";
5
+ import { Mail as Q, Globe as D } from "@box/blueprint-web-assets/icons/Medium";
6
+ import { SurfaceStatusSurfaceRed as W, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
+ import { CopyInput as X } from "@box/copy-input";
8
+ import { SharedLinkAccess as Y } from "./shared-link-access.js";
9
+ import { SharedLinkPermission as Z } from "./shared-link-permission.js";
10
10
  import t from "./messages.js";
11
11
  import { jsxs as d, jsx as i } from "react/jsx-runtime";
12
- import { useUnifiedShareFormContext as Z } from "../../../contexts/unified-share-form-context.js";
13
- import { useUnifiedShareModalContext as $ } from "../../../contexts/unified-share-modal-context.js";
14
- import { useSharingAction as ee } from "../../../hooks/use-sharing-action.js";
15
- import { getNotificationArgs as te } from "../../../utils/notification.js";
16
- import { formatDateFromTimestampToDateString as ie } from "../../../utils/date.js";
17
- import { callOnKeyboardEvent as ae } from "../../../utils/event.js";
18
- import '../../../../../styles/shared-link-section.css';const ne = "_container_j966c_1", oe = "_toggle_j966c_7", re = "_settings_j966c_13", se = "_copy_j966c_22", ce = "_access_j966c_30", le = "_icon_j966c_36", c = {
19
- container: ne,
20
- toggle: oe,
21
- settings: re,
22
- copy: se,
23
- access: ce,
24
- icon: le
12
+ import { useUnifiedShareFormContext as $ } from "../../../contexts/unified-share-form-context.js";
13
+ import { useUnifiedShareModalContext as ee } from "../../../contexts/unified-share-modal-context.js";
14
+ import { useSharingAction as te } from "../../../hooks/use-sharing-action.js";
15
+ import { getNotificationArgs as ie } from "../../../utils/notification.js";
16
+ import { formatDateFromTimestampToDateString as ae } from "../../../utils/date.js";
17
+ import { callOnKeyboardEvent as ne } from "../../../utils/event.js";
18
+ import '../../../../../styles/shared-link-section.css';const oe = "_container_j966c_1", re = "_toggle_j966c_7", se = "_settings_j966c_13", ce = "_copy_j966c_22", le = "_access_j966c_30", de = "_icon_j966c_36", c = {
19
+ container: oe,
20
+ toggle: re,
21
+ settings: se,
22
+ copy: ce,
23
+ access: le,
24
+ icon: de
25
25
  };
26
- function Ae() {
26
+ function Ne() {
27
27
  const {
28
28
  formatMessage: e
29
- } = R(), {
29
+ } = U(), {
30
30
  addNotification: C
31
- } = U(), f = M(null), {
31
+ } = z(), f = O(null), {
32
32
  isSharedLinkAutoCopied: k,
33
33
  isSharedLinkAutoCreated: r,
34
- setForm: D
35
- } = Z(), {
34
+ setForm: j
35
+ } = $(), {
36
36
  config: s,
37
37
  isFetching: v,
38
38
  isSubmitting: n,
39
- item: j,
39
+ item: w,
40
40
  setView: L,
41
41
  sharedLink: o,
42
- sharingService: w
43
- } = $(), {
42
+ sharingService: I
43
+ } = ee(), {
44
44
  permissions: x = {}
45
- } = j, {
46
- createSharedLink: _
47
45
  } = w, {
48
- sharedLinkAutoCopy: I,
49
- sharedLinkAutoCreate: T
50
- } = s, a = !!o.url, h = I && !k.current, A = T && !r.current, P = N(async () => {
46
+ createSharedLink: _
47
+ } = I, {
48
+ notifications: T,
49
+ sharedLinkAutoCopy: P,
50
+ sharedLinkAutoCreate: A
51
+ } = s, a = !!o.url, h = P && !k.current, N = A && !r.current, B = E(async () => {
51
52
  const l = await _();
52
53
  return h ? {
53
54
  messages: []
54
55
  } : l;
55
56
  }, [h, _]), {
56
57
  onAction: b
57
- } = ee(P, "create-shared-link");
58
- O(() => {
59
- (async () => v || n || ((h || A) && !a && (await b(), r.current = !0), h && a && f.current && (f.current.click(), k.current = !0)))();
60
- }, [a, h, A, v, k, r, n, b]);
61
- const B = N((l) => {
58
+ } = te(B, "create-shared-link");
59
+ R(() => {
60
+ (async () => v || n || ((h || N) && !a && (await b(), r.current = !0), h && a && f.current && (f.current.click(), k.current = !0)))();
61
+ }, [a, h, N, v, k, r, n, b]);
62
+ const F = E((l) => {
62
63
  let p;
63
- l instanceof Error ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && C({
64
- ...te(e, "success"),
64
+ typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && T.includes("auto-copy-shared-link") && C({
65
+ ...ie(e, "success"),
65
66
  styledText: p
66
67
  });
67
- }, [C, e, r]), F = async (l) => {
68
+ }, [C, e, r, T]), M = async (l) => {
68
69
  l || L("remove-shared-link"), l && await b();
69
70
  };
70
- let m, u = !1;
71
- return !a && !n && (m = e(t.sharedLinkToggleTooltip)), !a && !x.canShare && (m = e(t.createLinkDisabledTooltip), u = !0), a && !x.canSetShareAccess && (m = e(t.removeLinkDisabledTooltip), u = !0), /* @__PURE__ */ d("div", {
71
+ let u, m = !1;
72
+ return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !x.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !x.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
72
73
  className: c.container,
73
74
  children: [/* @__PURE__ */ i(S, {
74
75
  as: "label",
@@ -78,38 +79,38 @@ function Ae() {
78
79
  className: c.toggle,
79
80
  children: [/* @__PURE__ */ i(y, {
80
81
  align: "start",
81
- content: m,
82
+ content: u,
82
83
  "data-testid": "shared-link-tooltip",
83
- open: m ? void 0 : !1,
84
- children: /* @__PURE__ */ i(z, {
85
- focusable: u,
86
- children: /* @__PURE__ */ i(K.Item, {
84
+ open: u ? void 0 : !1,
85
+ children: /* @__PURE__ */ i(K, {
86
+ focusable: m,
87
+ children: /* @__PURE__ */ i(G.Item, {
87
88
  checked: a,
88
89
  "data-target-id": "Toggle-CreateSharedLink",
89
- disabled: u || n,
90
+ disabled: m || n,
90
91
  label: e(t.sharedLinkToggleLabel),
91
- onCheckedChange: F,
92
+ onCheckedChange: M,
92
93
  value: "shared-link"
93
94
  })
94
95
  })
95
96
  }), a && !!o.expiresAt && /* @__PURE__ */ i(y, {
96
97
  content: e(t.expirationIconTooltip, {
97
- expirationDate: ie(o.expiresAt)
98
+ expirationDate: ae(o.expiresAt)
98
99
  }),
99
100
  "data-testid": "expiration-date-tooltip",
100
- children: /* @__PURE__ */ i(G, {
101
- color: Q,
101
+ children: /* @__PURE__ */ i(V, {
102
+ color: W,
102
103
  hideText: !0,
103
- icon: H,
104
+ icon: J,
104
105
  text: e(t.expirationIconLabel)
105
106
  })
106
- }), a && s.sharedLinkSettings && /* @__PURE__ */ i(V, {
107
+ }), a && s.sharedLinkSettings && /* @__PURE__ */ i(q, {
107
108
  "aria-disabled": n,
108
109
  "aria-haspopup": "dialog",
109
110
  className: c.settings,
110
111
  "data-target-id": "PlainButton-SharedLinkSettings",
111
112
  onClick: () => L("shared-link-settings"),
112
- onKeyDown: ae(() => L("shared-link-settings"), {
113
+ onKeyDown: ne(() => L("shared-link-settings"), {
113
114
  canPreventDefault: !0
114
115
  }),
115
116
  role: "button",
@@ -119,33 +120,33 @@ function Ae() {
119
120
  })]
120
121
  }), a && /* @__PURE__ */ d("div", {
121
122
  className: c.copy,
122
- children: [/* @__PURE__ */ i(W, {
123
+ children: [/* @__PURE__ */ i(X, {
123
124
  ref: f,
124
- autoFocus: T && r.current,
125
+ autoFocus: A && r.current,
125
126
  "data-target-id": "Button-CopySharedLink",
126
127
  disabled: n,
127
128
  hideLabel: !0,
128
129
  label: e(t.sharedLinkUrlLabel),
129
- onCopy: B,
130
+ onCopy: F,
130
131
  value: o.url
131
132
  }), s.sharedLinkEmail && /* @__PURE__ */ i(y, {
132
133
  align: "end",
133
134
  content: e(t.sharedLinkEmailLabel),
134
- children: /* @__PURE__ */ i(q, {
135
+ children: /* @__PURE__ */ i(H, {
135
136
  "aria-label": e(t.sharedLinkEmailLabel),
136
137
  "data-target-id": "Button-SendSharedLink",
137
138
  disabled: n,
138
- icon: J,
139
- onClick: () => D("email"),
139
+ icon: Q,
140
+ onClick: () => j("email"),
140
141
  size: "large",
141
142
  variant: "secondary"
142
143
  })
143
144
  })]
144
145
  }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ d("div", {
145
146
  className: c.access,
146
- children: [s.sharedLinkAccess && /* @__PURE__ */ i(X, {}), s.sharedLinkPermission && /* @__PURE__ */ i(Y, {})]
147
+ children: [s.sharedLinkAccess && /* @__PURE__ */ i(Y, {}), s.sharedLinkPermission && /* @__PURE__ */ i(Z, {})]
147
148
  }), a && o.access === "open" && /* @__PURE__ */ d("div", {
148
- children: [/* @__PURE__ */ i(E, {
149
+ children: [/* @__PURE__ */ i(D, {
149
150
  className: c.icon,
150
151
  height: g,
151
152
  width: g
@@ -155,7 +156,7 @@ function Ae() {
155
156
  children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
156
157
  })]
157
158
  }), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
158
- children: [/* @__PURE__ */ i(E, {
159
+ children: [/* @__PURE__ */ i(D, {
159
160
  className: c.icon,
160
161
  height: g,
161
162
  width: g
@@ -168,5 +169,5 @@ function Ae() {
168
169
  });
169
170
  }
170
171
  export {
171
- Ae as SharedLinkSection
172
+ Ne as SharedLinkSection
172
173
  };
@@ -1,4 +1,4 @@
1
- const e = ["invite-collaborators", "remove-collaborator", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link"], r = {
1
+ const e = ["invite-collaborators", "remove-collaborator", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link", "auto-copy-shared-link"], r = {
2
2
  collaboration: !0,
3
3
  collaborationLimit: 100,
4
4
  collaborationMessage: !0,
@@ -29,7 +29,7 @@ export type FormType = 'default' | 'invite' | 'email' | 'collaborators';
29
29
  /**
30
30
  * Supported success and error notifications when the user performs sharing actions.
31
31
  */
32
- export type NotificationType = 'invite-collaborators' | 'remove-collaborator' | 'create-shared-link' | 'delete-shared-link' | 'update-shared-link' | 'email-shared-link';
32
+ export type NotificationType = 'invite-collaborators' | 'remove-collaborator' | 'create-shared-link' | 'delete-shared-link' | 'update-shared-link' | 'email-shared-link' | 'auto-copy-shared-link';
33
33
  /**
34
34
  * Supported roles for inviting a new collaborator. The available roles are dependent on the Enterprise settings.
35
35
  *
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^13.5.4",
7
- "@box/blueprint-web-assets": "^4.103.0",
8
- "@box/copy-input": "^1.39.9",
9
- "@box/user-selector": "^1.73.10",
6
+ "@box/blueprint-web": "^13.5.6",
7
+ "@box/blueprint-web-assets": "^4.104.1",
8
+ "@box/copy-input": "^1.39.11",
9
+ "@box/user-selector": "^1.73.12",
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.5.4",
17
- "@box/blueprint-web-assets": "^4.103.0",
18
- "@box/copy-input": "^1.39.9",
19
- "@box/storybook-utils": "0.16.60",
20
- "@box/eslint-plugin-blueprint": "1.1.1",
16
+ "@box/blueprint-web": "^13.5.6",
17
+ "@box/blueprint-web-assets": "^4.104.1",
18
+ "@box/copy-input": "^1.39.11",
19
+ "@box/storybook-utils": "0.16.62",
20
+ "@box/eslint-plugin-blueprint": "1.1.2",
21
21
  "react-intl": "^6.4.2"
22
22
  },
23
23
  "publishConfig": {