@ai-matrx/sharing 0.1.1 → 0.1.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.
- package/CHANGELOG.md +12 -0
- package/dist/access-react.cjs +3 -1
- package/dist/access-react.cjs.map +1 -1
- package/dist/access-react.js +5 -1
- package/dist/access-react.js.map +1 -1
- package/dist/core.cjs +29 -26
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +6 -6
- package/dist/core.d.ts +6 -6
- package/dist/core.js +29 -26
- package/dist/core.js.map +1 -1
- package/dist/react.cjs +224 -86
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +24 -3
- package/dist/react.d.ts +24 -3
- package/dist/react.js +225 -86
- package/dist/react.js.map +1 -1
- package/package.json +4 -4
package/dist/react.cjs
CHANGED
|
@@ -1942,7 +1942,7 @@ var SOURCE_LABELS = {
|
|
|
1942
1942
|
};
|
|
1943
1943
|
var EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1944
1944
|
async function lookupConnectionByEmail(typed) {
|
|
1945
|
-
const { data } = await (0, import_core17.createClient)().rpc("lookup_user_by_email", { lookup_email: typed });
|
|
1945
|
+
const { data } = await (0, import_core17.createClient)().schema("users").rpc("lookup_user_by_email", { lookup_email: typed });
|
|
1946
1946
|
const row = data?.[0];
|
|
1947
1947
|
return row ? {
|
|
1948
1948
|
user_id: row.user_id,
|
|
@@ -2069,7 +2069,7 @@ function ShareWithUserTab({
|
|
|
2069
2069
|
targetUserId = selectedContact.user_id;
|
|
2070
2070
|
} else {
|
|
2071
2071
|
const client = (0, import_core17.createClient)();
|
|
2072
|
-
const { data: lookupData, error: lookupError } = await client.rpc(
|
|
2072
|
+
const { data: lookupData, error: lookupError } = await client.schema("users").rpc(
|
|
2073
2073
|
"lookup_user_by_email",
|
|
2074
2074
|
{ lookup_email: trimmedEmail }
|
|
2075
2075
|
);
|
|
@@ -2779,6 +2779,8 @@ var import_lucide_react10 = require("lucide-react");
|
|
|
2779
2779
|
var import_react11 = require("react");
|
|
2780
2780
|
var import_design_system26 = require("@ai-matrx/design-system");
|
|
2781
2781
|
var import_controls9 = require("@ai-matrx/design-system/controls");
|
|
2782
|
+
var import_outbound_react = require("@ai-matrx/kit/outbound-react");
|
|
2783
|
+
var import_format2 = require("@ai-matrx/kit/format");
|
|
2782
2784
|
var import_lucide_react9 = require("lucide-react");
|
|
2783
2785
|
var import_core21 = require("@ai-matrx/sharing/core");
|
|
2784
2786
|
|
|
@@ -2875,8 +2877,23 @@ function ShareLinkPanel({
|
|
|
2875
2877
|
resourceType,
|
|
2876
2878
|
resourceId,
|
|
2877
2879
|
isOwner,
|
|
2878
|
-
enabled = true
|
|
2880
|
+
enabled = true,
|
|
2881
|
+
linkSettings = false,
|
|
2882
|
+
showLinkDetails = false,
|
|
2883
|
+
showOpenLink = false,
|
|
2884
|
+
extraUrls,
|
|
2885
|
+
appOrigin,
|
|
2886
|
+
onLinksChange
|
|
2879
2887
|
}) {
|
|
2888
|
+
const [permissionLevel, setPermissionLevel] = (0, import_react11.useState)("viewer");
|
|
2889
|
+
const [expiresAt, setExpiresAt] = (0, import_react11.useState)("");
|
|
2890
|
+
const [maxUses, setMaxUses] = (0, import_react11.useState)("");
|
|
2891
|
+
const onLinksChangeRef = (0, import_react11.useRef)(onLinksChange);
|
|
2892
|
+
onLinksChangeRef.current = onLinksChange;
|
|
2893
|
+
const urlFor = (0, import_react11.useCallback)(
|
|
2894
|
+
(link) => (0, import_core21.shareUrlForLink)(link, appOrigin),
|
|
2895
|
+
[appOrigin]
|
|
2896
|
+
);
|
|
2880
2897
|
const { toast } = useToast();
|
|
2881
2898
|
const [links, setLinks] = (0, import_react11.useState)([]);
|
|
2882
2899
|
const [loading, setLoading] = (0, import_react11.useState)(true);
|
|
@@ -2892,10 +2909,11 @@ function ShareLinkPanel({
|
|
|
2892
2909
|
const [handoffBusy, setHandoffBusy] = (0, import_react11.useState)(false);
|
|
2893
2910
|
const { share, copy: copyMessage, fallbackDialog } = useShare();
|
|
2894
2911
|
const resourceKey = `${resourceType}\0${resourceId}`;
|
|
2895
|
-
const fetchLinks = (0, import_react11.useCallback)(
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2912
|
+
const fetchLinks = (0, import_react11.useCallback)(async () => {
|
|
2913
|
+
const fresh = await (0, import_core21.listShareLinks)(resourceType, resourceId);
|
|
2914
|
+
onLinksChangeRef.current?.(fresh);
|
|
2915
|
+
return fresh;
|
|
2916
|
+
}, [resourceType, resourceId]);
|
|
2899
2917
|
const refresh = (0, import_react11.useCallback)(async () => {
|
|
2900
2918
|
setLoading(true);
|
|
2901
2919
|
setShareError(null);
|
|
@@ -2968,7 +2986,7 @@ function ShareLinkPanel({
|
|
|
2968
2986
|
});
|
|
2969
2987
|
return;
|
|
2970
2988
|
}
|
|
2971
|
-
const outcome = await copyMessage((
|
|
2989
|
+
const outcome = await copyMessage(urlFor(currentLink), {
|
|
2972
2990
|
title: "Copy link",
|
|
2973
2991
|
description: "Copy this link and send it to the person you want to share with."
|
|
2974
2992
|
});
|
|
@@ -2981,11 +2999,36 @@ function ShareLinkPanel({
|
|
|
2981
2999
|
});
|
|
2982
3000
|
}
|
|
2983
3001
|
},
|
|
2984
|
-
[copyMessage, refresh, toast]
|
|
3002
|
+
[copyMessage, refresh, toast, urlFor]
|
|
3003
|
+
);
|
|
3004
|
+
const copyExtraUrl = (0, import_react11.useCallback)(
|
|
3005
|
+
async (key, url) => {
|
|
3006
|
+
const outcome = await copyMessage(url, {
|
|
3007
|
+
title: "Copy link",
|
|
3008
|
+
description: "Copy this link and send it to the person you want to share with."
|
|
3009
|
+
});
|
|
3010
|
+
if (outcome === "copied") {
|
|
3011
|
+
setCopiedId(key);
|
|
3012
|
+
setTimeout(() => setCopiedId((k) => k === key ? null : k), 2e3);
|
|
3013
|
+
}
|
|
3014
|
+
},
|
|
3015
|
+
[copyMessage]
|
|
2985
3016
|
);
|
|
2986
3017
|
const createLinkOnce = (0, import_react11.useCallback)(async () => {
|
|
2987
|
-
const result = await (0, import_core21.createShareLink)(
|
|
3018
|
+
const result = await (0, import_core21.createShareLink)(
|
|
3019
|
+
linkSettings ? {
|
|
3020
|
+
resourceType,
|
|
3021
|
+
resourceId,
|
|
3022
|
+
permissionLevel,
|
|
3023
|
+
expiresAt: expiresAt ? new Date(expiresAt).toISOString() : null,
|
|
3024
|
+
maxUses: maxUses ? Number(maxUses) : null
|
|
3025
|
+
} : { resourceType, resourceId }
|
|
3026
|
+
);
|
|
2988
3027
|
if (result.success && result.url) {
|
|
3028
|
+
if (linkSettings) {
|
|
3029
|
+
setExpiresAt("");
|
|
3030
|
+
setMaxUses("");
|
|
3031
|
+
}
|
|
2989
3032
|
const freshLinks = await refresh();
|
|
2990
3033
|
const createdLink = result.token && freshLinks ? freshLinks.find((link) => link.token === result.token) : void 0;
|
|
2991
3034
|
if (!createdLink || !freshLinks) {
|
|
@@ -3004,7 +3047,17 @@ function ShareLinkPanel({
|
|
|
3004
3047
|
variant: "destructive"
|
|
3005
3048
|
});
|
|
3006
3049
|
}
|
|
3007
|
-
}, [
|
|
3050
|
+
}, [
|
|
3051
|
+
resourceType,
|
|
3052
|
+
resourceId,
|
|
3053
|
+
refresh,
|
|
3054
|
+
copyLink,
|
|
3055
|
+
toast,
|
|
3056
|
+
linkSettings,
|
|
3057
|
+
permissionLevel,
|
|
3058
|
+
expiresAt,
|
|
3059
|
+
maxUses
|
|
3060
|
+
]);
|
|
3008
3061
|
const creatingRef = (0, import_react11.useRef)(false);
|
|
3009
3062
|
const handleCreate = (0, import_react11.useCallback)(async () => {
|
|
3010
3063
|
if (creatingRef.current) return;
|
|
@@ -3115,7 +3168,7 @@ function ShareLinkPanel({
|
|
|
3115
3168
|
});
|
|
3116
3169
|
return;
|
|
3117
3170
|
}
|
|
3118
|
-
const message = (0, import_core22.createSafeShareMessage)((
|
|
3171
|
+
const message = (0, import_core22.createSafeShareMessage)(urlFor(currentLink));
|
|
3119
3172
|
const outcome = await share({
|
|
3120
3173
|
title: "AI Matrx share",
|
|
3121
3174
|
text: message,
|
|
@@ -3140,7 +3193,7 @@ function ShareLinkPanel({
|
|
|
3140
3193
|
} finally {
|
|
3141
3194
|
setHandoffBusy(false);
|
|
3142
3195
|
}
|
|
3143
|
-
}, [shareTarget, refresh, share, toast]);
|
|
3196
|
+
}, [shareTarget, refresh, share, toast, urlFor]);
|
|
3144
3197
|
const handleCopyReviewedMessage = (0, import_react11.useCallback)(async () => {
|
|
3145
3198
|
if (!shareTarget) return;
|
|
3146
3199
|
setHandoffBusy(true);
|
|
@@ -3183,7 +3236,7 @@ function ShareLinkPanel({
|
|
|
3183
3236
|
});
|
|
3184
3237
|
return;
|
|
3185
3238
|
}
|
|
3186
|
-
const message = (0, import_core22.createSafeShareMessage)((
|
|
3239
|
+
const message = (0, import_core22.createSafeShareMessage)(urlFor(currentLink));
|
|
3187
3240
|
const outcome = await copyMessage(message, {
|
|
3188
3241
|
title: "Copy message",
|
|
3189
3242
|
description: "Copy the reviewed message below and paste it into your messaging app."
|
|
@@ -3198,7 +3251,7 @@ function ShareLinkPanel({
|
|
|
3198
3251
|
} finally {
|
|
3199
3252
|
setHandoffBusy(false);
|
|
3200
3253
|
}
|
|
3201
|
-
}, [shareTarget, refresh, copyMessage, toast]);
|
|
3254
|
+
}, [shareTarget, refresh, copyMessage, toast, urlFor]);
|
|
3202
3255
|
if (!isOwner) return null;
|
|
3203
3256
|
if (!enabled) {
|
|
3204
3257
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start gap-2 p-3 bg-muted/30 rounded-lg border", children: [
|
|
@@ -3232,79 +3285,164 @@ function ShareLinkPanel({
|
|
|
3232
3285
|
}
|
|
3233
3286
|
)
|
|
3234
3287
|
] }),
|
|
3288
|
+
linkSettings ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-3", children: [
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted-foreground", children: "Permission" }),
|
|
3291
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3292
|
+
import_controls9.Select,
|
|
3293
|
+
{
|
|
3294
|
+
value: permissionLevel,
|
|
3295
|
+
onValueChange: setPermissionLevel,
|
|
3296
|
+
"aria-label": "Link permission",
|
|
3297
|
+
options: [
|
|
3298
|
+
{ value: "viewer", label: "Read only" },
|
|
3299
|
+
{ value: "editor", label: "Read + write" }
|
|
3300
|
+
]
|
|
3301
|
+
}
|
|
3302
|
+
)
|
|
3303
|
+
] }),
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
3305
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted-foreground", children: "Expires" }),
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_controls9.DateTimeField, { value: expiresAt, onValueChange: (v) => setExpiresAt(v ?? "") })
|
|
3307
|
+
] }),
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted-foreground", children: "Max uses" }),
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3311
|
+
import_controls9.Input,
|
|
3312
|
+
{
|
|
3313
|
+
type: "number",
|
|
3314
|
+
min: 1,
|
|
3315
|
+
"aria-label": "Max uses",
|
|
3316
|
+
value: maxUses,
|
|
3317
|
+
onChange: (e) => setMaxUses(e.target.value)
|
|
3318
|
+
}
|
|
3319
|
+
)
|
|
3320
|
+
] })
|
|
3321
|
+
] }) : null,
|
|
3235
3322
|
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-center py-3 text-xs text-muted-foreground", children: [
|
|
3236
3323
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Loader2, { className: "w-3.5 h-3.5 animate-spin mr-2" }),
|
|
3237
3324
|
"Loading links\u2026"
|
|
3238
3325
|
] }) : activeLinks.length === 0 && !shareError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-muted-foreground py-1", children: "No share links yet. Create one to share this with anyone." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-1.5", children: activeLinks.map((link) => {
|
|
3239
3326
|
const unavailableReason = (0, import_core22.shareLinkUnavailableReason)(link);
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
children:
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
className: "
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3327
|
+
const linkUrl = urlFor(link);
|
|
3328
|
+
const extras = extraUrls?.(link) ?? [];
|
|
3329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", children: [
|
|
3330
|
+
showLinkDetails ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 px-0.5 text-[11px] text-muted-foreground", children: [
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "rounded bg-muted px-1.5 py-0.5 font-medium text-foreground", children: link.permissionLevel === "viewer" ? "Read only" : "Read + write" }),
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: link.expiresAt ? `Expires ${(0, import_format2.formatAbsoluteDate)(link.expiresAt)}` : "No expiry" }),
|
|
3333
|
+
link.maxUses ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: `${link.useCount}/${link.maxUses} uses` }) : null
|
|
3334
|
+
] }) : null,
|
|
3335
|
+
extras.map((extra) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3336
|
+
"div",
|
|
3337
|
+
{
|
|
3338
|
+
className: extra.primary ? "flex items-center gap-1.5 rounded-md border border-primary/30 bg-primary/5 p-1.5" : "flex items-center gap-1.5 rounded-md border bg-background p-1.5",
|
|
3339
|
+
children: [
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col px-1", children: [
|
|
3341
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: [
|
|
3342
|
+
extra.label,
|
|
3343
|
+
extra.sublabel ? ` \xB7 ${extra.sublabel}` : ""
|
|
3344
|
+
] }),
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate font-mono text-xs", title: extra.url, children: extra.url })
|
|
3346
|
+
] }),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3348
|
+
import_outbound_react.OutboundLink,
|
|
3349
|
+
{
|
|
3350
|
+
href: extra.url,
|
|
3351
|
+
"aria-label": `Open ${extra.label}`,
|
|
3352
|
+
title: "Open in new tab",
|
|
3353
|
+
className: "flex h-11 w-11 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground sm:h-8 sm:w-8",
|
|
3354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ExternalLink, { className: "w-4 h-4" })
|
|
3355
|
+
}
|
|
3356
|
+
),
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3358
|
+
import_design_system26.Button,
|
|
3359
|
+
{
|
|
3360
|
+
variant: "ghost",
|
|
3361
|
+
size: "icon",
|
|
3362
|
+
className: "h-11 w-11 flex-shrink-0 sm:h-8 sm:w-8",
|
|
3363
|
+
onClick: () => copyExtraUrl(`${link.id}:${extra.key}`, extra.url),
|
|
3364
|
+
disabled: !!unavailableReason,
|
|
3365
|
+
title: unavailableReason ?? "Copy",
|
|
3366
|
+
"aria-label": `Copy ${extra.label}`,
|
|
3367
|
+
children: copiedId === `${link.id}:${extra.key}` ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Check, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Copy, { className: "w-4 h-4" })
|
|
3368
|
+
}
|
|
3369
|
+
)
|
|
3370
|
+
]
|
|
3371
|
+
},
|
|
3372
|
+
extra.key
|
|
3373
|
+
)),
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5 rounded-md border bg-background p-1.5", children: [
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3376
|
+
import_controls9.Input,
|
|
3377
|
+
{
|
|
3378
|
+
mono: true,
|
|
3379
|
+
readOnly: true,
|
|
3380
|
+
value: linkUrl,
|
|
3381
|
+
className: "min-w-0 flex-1",
|
|
3382
|
+
onFocus: (e) => e.currentTarget.select()
|
|
3383
|
+
}
|
|
3384
|
+
),
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3386
|
+
"span",
|
|
3387
|
+
{
|
|
3388
|
+
className: "flex items-center gap-1 text-[10px] text-muted-foreground px-1",
|
|
3389
|
+
title: `${link.useCount} view${link.useCount === 1 ? "" : "s"}`,
|
|
3390
|
+
children: [
|
|
3391
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Eye, { className: "w-3 h-3" }),
|
|
3392
|
+
link.useCount
|
|
3393
|
+
]
|
|
3394
|
+
}
|
|
3395
|
+
),
|
|
3396
|
+
showOpenLink ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3397
|
+
import_outbound_react.OutboundLink,
|
|
3398
|
+
{
|
|
3399
|
+
href: linkUrl,
|
|
3400
|
+
"aria-label": "Open share link",
|
|
3401
|
+
title: "Open in new tab",
|
|
3402
|
+
className: "flex h-11 w-11 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground sm:h-8 sm:w-8",
|
|
3403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ExternalLink, { className: "w-4 h-4" })
|
|
3404
|
+
}
|
|
3405
|
+
) : null,
|
|
3406
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3407
|
+
import_design_system26.Button,
|
|
3408
|
+
{
|
|
3409
|
+
variant: "ghost",
|
|
3410
|
+
size: "icon",
|
|
3411
|
+
className: "h-11 w-11 flex-shrink-0 sm:h-8 sm:w-8",
|
|
3412
|
+
onClick: () => copyLink(link),
|
|
3413
|
+
disabled: !!unavailableReason,
|
|
3414
|
+
title: unavailableReason ?? "Copy link",
|
|
3415
|
+
"aria-label": "Copy share link",
|
|
3416
|
+
children: copiedId === link.id ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Check, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Copy, { className: "w-4 h-4" })
|
|
3417
|
+
}
|
|
3418
|
+
),
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3420
|
+
import_design_system26.Button,
|
|
3421
|
+
{
|
|
3422
|
+
variant: "ghost",
|
|
3423
|
+
size: "icon",
|
|
3424
|
+
className: "h-11 w-11 flex-shrink-0 sm:h-8 sm:w-8",
|
|
3425
|
+
onClick: () => prepareTextShare(link.id),
|
|
3426
|
+
disabled: !!unavailableReason || refreshing,
|
|
3427
|
+
title: unavailableReason ?? "Review before sharing by text",
|
|
3428
|
+
"aria-label": "Share by text",
|
|
3429
|
+
children: refreshing ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Loader2, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.MessageSquareText, { className: "w-4 h-4" })
|
|
3430
|
+
}
|
|
3431
|
+
),
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3433
|
+
import_design_system26.Button,
|
|
3434
|
+
{
|
|
3435
|
+
variant: "ghost",
|
|
3436
|
+
size: "icon",
|
|
3437
|
+
className: "h-11 w-11 flex-shrink-0 text-destructive sm:h-8 sm:w-8",
|
|
3438
|
+
onClick: () => setRevokeTarget(link),
|
|
3439
|
+
title: "Turn off link",
|
|
3440
|
+
"aria-label": "Turn off share link",
|
|
3441
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.Trash2, { className: "w-4 h-4" })
|
|
3442
|
+
}
|
|
3443
|
+
)
|
|
3444
|
+
] })
|
|
3445
|
+
] }, link.id);
|
|
3308
3446
|
}) }),
|
|
3309
3447
|
shareError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3310
3448
|
"div",
|
|
@@ -3356,7 +3494,7 @@ function ShareLinkPanel({
|
|
|
3356
3494
|
] }),
|
|
3357
3495
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", children: [
|
|
3358
3496
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs font-medium", children: "Message preview" }),
|
|
3359
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "rounded-md border bg-muted/30 p-3 break-words", children: (0, import_core22.createSafeShareMessage)((
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "rounded-md border bg-muted/30 p-3 break-words", children: (0, import_core22.createSafeShareMessage)(urlFor(shareTarget)) })
|
|
3360
3498
|
] }),
|
|
3361
3499
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3362
3500
|
import_design_system26.Button,
|
|
@@ -3919,7 +4057,7 @@ var import_design_system31 = require("@ai-matrx/design-system");
|
|
|
3919
4057
|
var import_design_system32 = require("@ai-matrx/design-system");
|
|
3920
4058
|
var import_vault2 = require("@ai-matrx/vault");
|
|
3921
4059
|
var import_core33 = require("@ai-matrx/sharing/core");
|
|
3922
|
-
var
|
|
4060
|
+
var import_format3 = require("@ai-matrx/kit/format");
|
|
3923
4061
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3924
4062
|
var STATUS_WORDS = {
|
|
3925
4063
|
pending: "Waiting to be opened",
|
|
@@ -4053,7 +4191,7 @@ function SecureLinkForm({ resourceType, resourceId, resourceName }) {
|
|
|
4053
4191
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ShieldCheck, { className: "mt-0.5 h-4 w-4 flex-shrink-0 text-primary" }),
|
|
4054
4192
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
4055
4193
|
"They get a link that opens once, and a code on a separate channel. No account needed.",
|
|
4056
|
-
options ? ` The link works for ${(0,
|
|
4194
|
+
options ? ` The link works for ${(0, import_format3.formatDurationMinutes)(options.link_ttl_minutes, { style: "long" })}.` : ""
|
|
4057
4195
|
] })
|
|
4058
4196
|
] }),
|
|
4059
4197
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|