@box/unified-share-modal 1.43.0 → 1.44.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.
@@ -1,8 +1,8 @@
1
- import { useRef as x, useState as V, useCallback as v, useEffect as w } from "react";
1
+ import { useRef as v, useState as V, useCallback as _, useEffect as D } from "react";
2
2
  import { useIntl as G } from "react-intl";
3
- import { Text as _, Tooltip as A, Focusable as H, Switch as J, Status as Q, Link as W, Button as X } from "@box/blueprint-web";
3
+ import { Text as A, Tooltip as T, Focusable as H, Switch as J, Status as Q, Link as W, Button as X } from "@box/blueprint-web";
4
4
  import { ClockBadge as Y } from "@box/blueprint-web-assets/icons/Line";
5
- import { Mail as Z, Globe as D } from "@box/blueprint-web-assets/icons/Medium";
5
+ import { Mail as Z, Globe as I } from "@box/blueprint-web-assets/icons/Medium";
6
6
  import { SurfaceStatusSurfaceRed as $, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
7
  import { CopyInput as ee } from "@box/copy-input";
8
8
  import { SharedLinkAccess as ie } from "./shared-link-access.js";
@@ -11,7 +11,7 @@ import i from "./messages.js";
11
11
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
12
12
  import { useUnifiedShareFormContext as ne } from "../../../contexts/unified-share-form-context.js";
13
13
  import { useUnifiedShareModalContext as ae } from "../../../contexts/unified-share-modal-context.js";
14
- import { useSharingAction as I } from "../../../hooks/use-sharing-action.js";
14
+ import { useSharingAction as F } from "../../../hooks/use-sharing-action.js";
15
15
  import { formatDateFromTimestampToDateString as oe } from "../../../utils/date.js";
16
16
  import { callOnKeyboardEvent as se } from "../../../utils/event.js";
17
17
  import '../../../../../styles/shared-link-section.css';const re = "_container_qn1ax_1", ce = "_toggle_qn1ax_7", le = "_settings_qn1ax_13", de = "_copy_qn1ax_22", he = "_access_qn1ax_30", me = "_icon_qn1ax_36", s = {
@@ -25,66 +25,66 @@ import '../../../../../styles/shared-link-section.css';const re = "_container_qn
25
25
  function Ne() {
26
26
  const {
27
27
  formatMessage: e
28
- } = G(), k = x(!0), L = x(null), p = x(null), {
28
+ } = G(), k = v(!0), L = v(null), p = v(null), {
29
29
  onModalViewChange: b,
30
- onShareViewChange: F
30
+ onShareViewChange: q
31
31
  } = ne(), {
32
32
  config: o,
33
- isFetching: T,
34
- isSubmitting: q,
35
- item: R,
33
+ isFetching: E,
34
+ isSubmitting: R,
35
+ item: M,
36
36
  sharedLink: a,
37
- sharingService: M
37
+ sharingService: B
38
38
  } = ae(), {
39
- permissions: E = {}
40
- } = R, {
41
- createSharedLink: B
39
+ permissions: N = {}
42
40
  } = M, {
41
+ createSharedLink: O
42
+ } = B, {
43
43
  sharedLinkAutoCopy: d,
44
44
  sharedLinkAutoCreate: y
45
45
  } = o;
46
- let N = "create-shared-link";
47
- d && (N = "auto-copy-shared-link");
46
+ let P = "create-shared-link";
47
+ d && (P = "auto-copy-shared-link");
48
48
  const {
49
- isLoading: O,
50
- onAction: C
51
- } = I(B, N), n = !!a.url, r = q ?? O, [S, U] = V(!1), u = v(async () => {
52
- n || (await C(), U(!0));
53
- }, [n, C]), j = v(async () => (u(), new Promise((c) => {
49
+ isLoading: C,
50
+ onAction: S
51
+ } = F(O, P), n = !!a.url, r = R ?? C, [x, U] = V(!1), u = _(async () => {
52
+ n || (await S(), U(!0));
53
+ }, [n, S]), j = _(async () => (u(), new Promise((c) => {
54
54
  p.current = {
55
55
  resolve: c
56
56
  };
57
57
  })), [u]), {
58
- onAction: P
59
- } = I(j, "auto-copy-shared-link");
60
- w(() => {
61
- !k.current || T || (d ? P() : y && u(), k.current = !1);
62
- }, [T, k, d, y, u, P]), w(() => {
63
- n && d && L.current && L.current.click();
64
- }, [n, d]);
65
- const z = v((m) => {
58
+ onAction: w
59
+ } = F(j, "auto-copy-shared-link");
60
+ D(() => {
61
+ !k.current || E || (d ? w() : y && u(), k.current = !1);
62
+ }, [E, k, d, y, u, w]), D(() => {
63
+ n && d && !C && L.current && L.current.click();
64
+ }, [n, d, C]);
65
+ const z = _((m) => {
66
66
  if (!p.current)
67
67
  return;
68
68
  let c;
69
- m instanceof Error ? c = S ? e(i.autoCreateCopyErrorNoticeText) : null : c = e(S ? i.autoCreateCopySuccessNoticeText : i.autoCopySuccessNoticeText), c && p.current.resolve({
69
+ m instanceof Error ? c = x ? e(i.autoCreateCopyErrorNoticeText) : null : c = e(x ? i.autoCreateCopySuccessNoticeText : i.autoCopySuccessNoticeText), c && p.current.resolve({
70
70
  messages: [{
71
71
  text: c,
72
72
  type: "success"
73
73
  }]
74
74
  }), p.current = null;
75
- }, [e, S]), K = async (m) => {
76
- m || b("remove-shared-link"), m && await C();
75
+ }, [e, x]), K = async (m) => {
76
+ m || b("remove-shared-link"), m && await S();
77
77
  };
78
78
  let h, f = !1;
79
- return !n && !r && (h = e(i.sharedLinkToggleTooltip)), !n && !E.canShare && (h = e(i.createLinkDisabledTooltip), f = !0), n && !E.canSetShareAccess && (h = e(i.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
79
+ return !n && !r && (h = e(i.sharedLinkToggleTooltip)), !n && !N.canShare && (h = e(i.createLinkDisabledTooltip), f = !0), n && !N.canSetShareAccess && (h = e(i.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
80
80
  className: s.container,
81
- children: [/* @__PURE__ */ t(_, {
81
+ children: [/* @__PURE__ */ t(A, {
82
82
  as: "label",
83
83
  variant: "bodyDefaultBold",
84
84
  children: e(i.shareLinkLabel)
85
85
  }), /* @__PURE__ */ l("div", {
86
86
  className: s.toggle,
87
- children: [/* @__PURE__ */ t(A, {
87
+ children: [/* @__PURE__ */ t(T, {
88
88
  align: "start",
89
89
  content: h,
90
90
  "data-testid": "shared-link-tooltip",
@@ -99,7 +99,7 @@ function Ne() {
99
99
  value: "shared-link"
100
100
  })
101
101
  })
102
- }), n && !!a.expiresAt && /* @__PURE__ */ t(A, {
102
+ }), n && !!a.expiresAt && /* @__PURE__ */ t(T, {
103
103
  content: e(i.expirationIconTooltip, {
104
104
  expirationDate: oe(a.expiresAt)
105
105
  }),
@@ -133,14 +133,14 @@ function Ne() {
133
133
  label: e(i.sharedLinkUrlLabel),
134
134
  onCopy: z,
135
135
  value: a.url
136
- }), o.sharedLinkEmail && /* @__PURE__ */ t(A, {
136
+ }), o.sharedLinkEmail && /* @__PURE__ */ t(T, {
137
137
  align: "end",
138
138
  content: e(i.sharedLinkEmailLabel),
139
139
  children: /* @__PURE__ */ t(X, {
140
140
  "aria-label": e(i.sharedLinkEmailLabel),
141
141
  disabled: r,
142
142
  icon: Z,
143
- onClick: () => F("email"),
143
+ onClick: () => q("email"),
144
144
  size: "large",
145
145
  variant: "secondary"
146
146
  })
@@ -149,21 +149,21 @@ function Ne() {
149
149
  className: s.access,
150
150
  children: [o.sharedLinkAccess && /* @__PURE__ */ t(ie, {}), o.sharedLinkPermission && /* @__PURE__ */ t(te, {})]
151
151
  }), n && a.access === "open" && /* @__PURE__ */ l("div", {
152
- children: [/* @__PURE__ */ t(D, {
152
+ children: [/* @__PURE__ */ t(I, {
153
153
  className: s.icon,
154
154
  height: g,
155
155
  width: g
156
- }), /* @__PURE__ */ t(_, {
156
+ }), /* @__PURE__ */ t(A, {
157
157
  as: "span",
158
158
  color: "textOnLightSecondary",
159
159
  children: a.permission === "can_edit" ? e(i.sharedLinkEditablePubliclyAvailable) : e(i.sharedLinkPubliclyAvailable)
160
160
  })]
161
161
  }), n && a.access === "company" && a.permission === "can_edit" && /* @__PURE__ */ l("div", {
162
- children: [/* @__PURE__ */ t(D, {
162
+ children: [/* @__PURE__ */ t(I, {
163
163
  className: s.icon,
164
164
  height: g,
165
165
  width: g
166
- }), /* @__PURE__ */ t(_, {
166
+ }), /* @__PURE__ */ t(A, {
167
167
  as: "span",
168
168
  color: "textOnLightSecondary",
169
169
  children: e(i.sharedLinkElevatedEditableCompanyAvailable)
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = সরাস
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = শেয়ার করা লিঙ্ক সহ ব্যবহারকারীদের এই আইটেমটি ডাউনলোড করার অনুমতি দিন
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = পাসওয়ার্ড লুকান
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = শেয়ার করা লিঙ্ক সেটিংস সম্পর্কে আরও জানুন।
87
89
  # Aria label for the calendar in the link expiration settings
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = Direkte link
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = Tillad brugere med det delt link at downloade dette element
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = Skjul adgangskode
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = Få mere at vide om delt link-indstillinger.
87
89
  # Aria label for the calendar in the link expiration settings
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = Direktverknüp
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = Benutzern mit dem Freigabe-Link das Herunterladen dieses Elements gestatten
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = Kennwort verbergen
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = Erfahren Sie mehr über die Einstellungen für Freigabe-Links.
87
89
  # Aria label for the calendar in the link expiration settings
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = Direct link
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = Allow users with the shared link to download this item
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = Hide password
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = Learn more about shared link settings.
87
89
  # Aria label for the calendar in the link expiration settings
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = Direct link
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = Allow users with the shared link to download this item
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = Hide password
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = Learn more about shared link settings.
87
89
  # Aria label for the calendar in the link expiration settings
@@ -82,6 +82,8 @@ groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel = Direct link
82
82
  groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText = Allow users with the shared link to download this item
83
83
  # Aria label for button to hide password
84
84
  groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel = Hide password
85
+ # Notice shown at top of modal when one or more settings are unavailable due to permission settings
86
+ groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice = Certain settings may not be available for this item due to permissions.
85
87
  # Link to learn more about shared link settings
86
88
  groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink = Learn more about shared link settings.
87
89
  # Aria label for the calendar in the link expiration settings