@arbidocs/blocks 0.5.4 → 0.5.5
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/connect/index.cjs +40 -5
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +40 -5
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/workspace-access/ConnectedRequestWorkspaceAccess.d.ts +4 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
package/dist/connect/index.js
CHANGED
|
@@ -27647,7 +27647,7 @@ function ConnectedGrantWorkspaceAccessDialog({
|
|
|
27647
27647
|
return;
|
|
27648
27648
|
}
|
|
27649
27649
|
}
|
|
27650
|
-
await addWorkspaceUsers.mutateAsync({
|
|
27650
|
+
const grantedMembers = await addWorkspaceUsers.mutateAsync({
|
|
27651
27651
|
emails: [requester.email],
|
|
27652
27652
|
role: selectedRole,
|
|
27653
27653
|
workspace_key: workspaceKey,
|
|
@@ -27657,8 +27657,11 @@ function ConnectedGrantWorkspaceAccessDialog({
|
|
|
27657
27657
|
});
|
|
27658
27658
|
const wsName = workspaces.find((w) => w.external_id === wsId)?.name ?? "the workspace";
|
|
27659
27659
|
const roleLabel = formatRole(selectedRole).toLowerCase();
|
|
27660
|
+
const expiresAt = Array.isArray(grantedMembers) ? grantedMembers.find((member) => member.user?.email === requester.email)?.access_expires_at : void 0;
|
|
27661
|
+
const expiryIso = expiresAt && !/(?:Z|[+-]\d{2}:\d{2})$/i.test(expiresAt) ? `${expiresAt}Z` : expiresAt;
|
|
27662
|
+
const expiryZone = expiryIso ? new Intl.DateTimeFormat(void 0, { timeZoneName: "short" }).formatToParts(new Date(expiryIso)).find((part) => part.type === "timeZoneName")?.value : void 0;
|
|
27660
27663
|
notify17(
|
|
27661
|
-
kind === "temporary" ? `
|
|
27664
|
+
kind === "temporary" ? `Access granted.${expiryIso ? ` Expires ${formatFriendlyDate(expiryIso)} ${expiryZone ?? ""}.` : ""}` : `Granted ${requesterName} ${roleLabel} access to ${wsName}`,
|
|
27662
27665
|
"success"
|
|
27663
27666
|
);
|
|
27664
27667
|
if (fromTask && kind === "temporary" && taskExtId) {
|
|
@@ -27779,8 +27782,7 @@ function ConnectedGrantWorkspaceAccessDialog({
|
|
|
27779
27782
|
/* @__PURE__ */ jsx(SelectItem, { value: "4", children: "4 hours" }),
|
|
27780
27783
|
/* @__PURE__ */ jsx(SelectItem, { value: "24", children: "24 hours" })
|
|
27781
27784
|
] })
|
|
27782
|
-
] })
|
|
27783
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "External access expires automatically. They can request access again." })
|
|
27785
|
+
] })
|
|
27784
27786
|
] }),
|
|
27785
27787
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end", children: [
|
|
27786
27788
|
/* @__PURE__ */ jsx(
|
|
@@ -27826,6 +27828,9 @@ function ConnectedGrantWorkspaceAccessDialog({
|
|
|
27826
27828
|
function ConnectedRequestWorkspaceAccess({
|
|
27827
27829
|
recipient,
|
|
27828
27830
|
workspaceExtId,
|
|
27831
|
+
workspaceName,
|
|
27832
|
+
triggerLabel = "Request access",
|
|
27833
|
+
onRequested,
|
|
27829
27834
|
knownWorkspaceIds = [],
|
|
27830
27835
|
variant = "outline",
|
|
27831
27836
|
size = "sm",
|
|
@@ -27834,6 +27839,7 @@ function ConnectedRequestWorkspaceAccess({
|
|
|
27834
27839
|
onOpenChange
|
|
27835
27840
|
}) {
|
|
27836
27841
|
const { notify: notify17 } = useBlocksEnvironment();
|
|
27842
|
+
const arbi = useArbi();
|
|
27837
27843
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
27838
27844
|
const isControlled = controlledOpen !== void 0;
|
|
27839
27845
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
@@ -27842,6 +27848,19 @@ function ConnectedRequestWorkspaceAccess({
|
|
|
27842
27848
|
const request = useRequestWorkspaceAccess();
|
|
27843
27849
|
const [selectedWorkspace, setSelectedWorkspace] = useState();
|
|
27844
27850
|
const targetWorkspace = selectedWorkspace ?? workspaceExtId ?? (knownWorkspaceIds.length === 1 ? knownWorkspaceIds[0] : void 0);
|
|
27851
|
+
const [resolvedName, setResolvedName] = useState();
|
|
27852
|
+
useEffect(() => {
|
|
27853
|
+
let current = true;
|
|
27854
|
+
setResolvedName(void 0);
|
|
27855
|
+
if (!isOpen || !targetWorkspace || workspaceName) return;
|
|
27856
|
+
void arbi.workspaces.accessStatus(targetWorkspace).then((status) => {
|
|
27857
|
+
if (current) setResolvedName(status.workspace_name);
|
|
27858
|
+
}).catch(() => {
|
|
27859
|
+
});
|
|
27860
|
+
return () => {
|
|
27861
|
+
current = false;
|
|
27862
|
+
};
|
|
27863
|
+
}, [arbi, isOpen, targetWorkspace, workspaceName]);
|
|
27845
27864
|
const name = [recipient.given_name, recipient.family_name].filter(Boolean).join(" ") || recipient.email || "this user";
|
|
27846
27865
|
const submit = async () => {
|
|
27847
27866
|
try {
|
|
@@ -27852,6 +27871,7 @@ function ConnectedRequestWorkspaceAccess({
|
|
|
27852
27871
|
notify17(`Requested workspace access from ${name}`, "success");
|
|
27853
27872
|
setNote("");
|
|
27854
27873
|
setOpen(false);
|
|
27874
|
+
onRequested?.();
|
|
27855
27875
|
} catch {
|
|
27856
27876
|
notify17("Could not send the access request", "error");
|
|
27857
27877
|
}
|
|
@@ -27866,7 +27886,7 @@ function ConnectedRequestWorkspaceAccess({
|
|
|
27866
27886
|
"data-testid": "request-workspace-access-button",
|
|
27867
27887
|
children: [
|
|
27868
27888
|
/* @__PURE__ */ jsx(KeyRound, { className: size === "icon" ? "h-4 w-4" : "mr-2 h-4 w-4" }),
|
|
27869
|
-
size === "icon" ? null :
|
|
27889
|
+
size === "icon" ? null : triggerLabel
|
|
27870
27890
|
]
|
|
27871
27891
|
}
|
|
27872
27892
|
) }),
|
|
@@ -27875,7 +27895,22 @@ function ConnectedRequestWorkspaceAccess({
|
|
|
27875
27895
|
/* @__PURE__ */ jsx(DialogTitle, { children: "Request workspace access" }),
|
|
27876
27896
|
/* @__PURE__ */ jsx(DialogDescription, { children: targetWorkspace ? `Ask ${name} to renew your access to this workspace.` : `Ask ${name} to give you access to one of their workspaces.` })
|
|
27877
27897
|
] }),
|
|
27898
|
+
/* @__PURE__ */ jsx("p", { className: "rounded-md border bg-muted/30 p-3 text-sm text-muted-foreground", children: "Sending a request does not grant or extend access. For temporary access, the owner chooses a duration of up to 24 hours. Your confirmation email will show the exact expiry." }),
|
|
27878
27899
|
/* @__PURE__ */ jsxs(ModalSection, { children: [
|
|
27900
|
+
targetWorkspace && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
27901
|
+
/* @__PURE__ */ jsx(ModalSectionTitle, { children: "Workspace being requested" }),
|
|
27902
|
+
/* @__PURE__ */ jsxs(
|
|
27903
|
+
"div",
|
|
27904
|
+
{
|
|
27905
|
+
className: "rounded-md border bg-muted/30 px-3 py-2",
|
|
27906
|
+
"data-testid": "request-access-workspace",
|
|
27907
|
+
children: [
|
|
27908
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium", children: workspaceName || resolvedName || targetWorkspace }),
|
|
27909
|
+
(workspaceName || resolvedName) && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: targetWorkspace })
|
|
27910
|
+
]
|
|
27911
|
+
}
|
|
27912
|
+
)
|
|
27913
|
+
] }),
|
|
27879
27914
|
knownWorkspaceIds.length > 1 && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
27880
27915
|
/* @__PURE__ */ jsx(ModalSectionTitle, { children: "Workspace" }),
|
|
27881
27916
|
/* @__PURE__ */ jsxs(
|