@ai-matrx/sharing 0.1.3 → 0.1.4

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/react.cjs CHANGED
@@ -104,8 +104,26 @@ function DefaultCopyButtons(props) {
104
104
  }
105
105
  );
106
106
  }
107
+ var announced = /* @__PURE__ */ new Set();
108
+ function announceStandIn(port) {
109
+ if (announced.has(port)) return;
110
+ announced.add(port);
111
+ console.warn(
112
+ `[share] The share sheet is using its built-in stand-in for "${port}": the host did not pass it, so that part of the sheet is absent. Pass it with configureShareSheetUi({ ${port} }).`
113
+ );
114
+ }
115
+ function StandIn({ port }) {
116
+ (0, import_react.useEffect)(() => announceStandIn(port), [port]);
117
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { hidden: true, "data-share-sheet-host": "unconfigured", "data-share-sheet-port": port });
118
+ }
107
119
  function DefaultErrorMenu(_props) {
108
- return null;
120
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StandIn, { port: "ErrorAlchemyMenu" });
121
+ }
122
+ function DefaultPageCaptureButton(_props) {
123
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StandIn, { port: "PageCaptureButton" });
124
+ }
125
+ function DefaultEntityDoorControls(_props) {
126
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StandIn, { port: "EntityDoorControls" });
109
127
  }
110
128
  function DefaultInfoHint(props) {
111
129
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { title: String(props.text ?? ""), "aria-label": String(props.label ?? "More info"), className: "cursor-help text-muted-foreground", children: "\u24D8" });
@@ -215,14 +233,23 @@ var DEFAULTS = {
215
233
  useUserConnections: useDefaultConnections,
216
234
  confirm: (o) => (0, import_confirm_opener.confirm)(o),
217
235
  CopyButtons: DefaultCopyButtons,
218
- csvExportItem: () => null,
219
- jsonExportItem: () => null,
220
- usePageCapture: () => void 0,
236
+ csvExportItem: () => {
237
+ announceStandIn("csvExportItem");
238
+ return null;
239
+ },
240
+ jsonExportItem: () => {
241
+ announceStandIn("jsonExportItem");
242
+ return null;
243
+ },
244
+ usePageCapture: () => {
245
+ announceStandIn("usePageCapture");
246
+ return void 0;
247
+ },
221
248
  dialogCapture: (input) => input,
222
- PageCaptureButton: () => null,
249
+ PageCaptureButton: DefaultPageCaptureButton,
223
250
  ErrorAlchemyMenu: DefaultErrorMenu,
224
251
  InfoHint: DefaultInfoHint,
225
- EntityDoorControls: () => null,
252
+ EntityDoorControls: DefaultEntityDoorControls,
226
253
  EntityRef: DefaultEntityRef,
227
254
  UserAvatarDisplay: DefaultUserAvatar,
228
255
  ConnectionsReadNotice: DefaultConnectionsNotice,
@@ -241,7 +268,7 @@ function shareSheetUi() {
241
268
  function useToast() {
242
269
  return { toast: (o) => ui.toast(o) };
243
270
  }
244
- function copyNotify(message, kind) {
271
+ function shareCopyNotify(message, kind) {
245
272
  ui.toast({ title: message, ...kind === "error" ? { variant: "destructive" } : {} });
246
273
  }
247
274
  var confirm = (options) => ui.confirm(options);
@@ -255,10 +282,10 @@ var csvExportItem = (...args) => ui.csvExportItem(...args);
255
282
  var jsonExportItem = (...args) => ui.jsonExportItem(...args);
256
283
  var CopyButtons = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.CopyButtons, { ...p });
257
284
  var PageCaptureButton = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.PageCaptureButton, { ...p });
258
- var ErrorAlchemyMenu = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.ErrorAlchemyMenu, { ...p });
285
+ var ShareErrorAlchemyMenu = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.ErrorAlchemyMenu, { ...p });
259
286
  var InfoHint = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.InfoHint, { ...p });
260
- var EntityDoorControls = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.EntityDoorControls, { ...p });
261
- var EntityRef = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.EntityRef, { ...p });
287
+ var ShareEntityDoorControls = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.EntityDoorControls, { ...p });
288
+ var ShareEntityRef = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.EntityRef, { ...p });
262
289
  var UserAvatarDisplay = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.UserAvatarDisplay, { ...p });
263
290
  var ConnectionsReadNotice = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.ConnectionsReadNotice, { ...p });
264
291
  var UserSearchField = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ui.UserSearchField, { ...p });
@@ -266,6 +293,7 @@ var defaultIdentity = null;
266
293
  var usePortalContainer = () => ui.usePortalContainer();
267
294
  var vaultIdentity = () => {
268
295
  if (ui.vaultIdentity) return ui.vaultIdentity;
296
+ announceStandIn("vaultIdentity");
269
297
  if (!defaultIdentity) {
270
298
  defaultIdentity = (0, import_vault.createSupabaseIdentity)((0, import_core2.shareClient)().auth, {
271
299
  redirectTo: () => window.location.href,
@@ -1220,7 +1248,7 @@ function PermissionsList({
1220
1248
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm font-semibold truncate leading-none", children: getPermissionLabel(permission) }),
1221
1249
  permission.grantedToUser?.isGuest && !permission.isPublic ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GuestBadge, {}) : null,
1222
1250
  permission.grantedToOrganization && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1223
- EntityDoorControls,
1251
+ ShareEntityDoorControls,
1224
1252
  {
1225
1253
  token: "organization",
1226
1254
  id: permission.grantedToOrganization.id,
@@ -1497,7 +1525,7 @@ function AccessSummaryPanel({
1497
1525
  children: "Retry"
1498
1526
  }
1499
1527
  ),
1500
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorAlchemyMenu, { error })
1528
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ShareErrorAlchemyMenu, { error })
1501
1529
  ]
1502
1530
  }
1503
1531
  );
@@ -1836,14 +1864,14 @@ function AddEveryoneInOrg({
1836
1864
  orgLabel,
1837
1865
  " could not be listed: ",
1838
1866
  teamsError,
1839
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorAlchemyMenu, { error: teamsError })
1867
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShareErrorAlchemyMenu, { error: teamsError })
1840
1868
  ] }) : null,
1841
1869
  orgId && loadError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "type-secondary text-destructive", children: [
1842
1870
  "The people in ",
1843
1871
  orgName,
1844
1872
  " could not be listed: ",
1845
1873
  loadError,
1846
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorAlchemyMenu, { error: loadError })
1874
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShareErrorAlchemyMenu, { error: loadError })
1847
1875
  ] }) : null,
1848
1876
  orgId && !loadError && members === null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2 type-secondary text-muted-foreground", children: [
1849
1877
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className: "w-3 h-3 animate-spin" }),
@@ -2464,7 +2492,7 @@ function OutsideSharePanel({
2464
2492
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-sm font-medium text-destructive", children: [
2465
2493
  "We could not check who outside this organization can see ",
2466
2494
  tableName,
2467
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorAlchemyMenu, {})
2495
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ShareErrorAlchemyMenu, {})
2468
2496
  ] }),
2469
2497
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "mt-0.5 text-xs text-destructive/80", children: "Nobody was added or removed. This does not mean sharing outside is switched off \u2014 we simply could not look." }),
2470
2498
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "mt-1 break-words text-xs text-muted-foreground", children: loadError })
@@ -2799,7 +2827,7 @@ var import_design_system25 = require("@ai-matrx/design-system");
2799
2827
  var import_jsx_runtime13 = require("react/jsx-runtime");
2800
2828
  function useShare() {
2801
2829
  const { copyText: copyTextKit } = (0, import_clipboard3.useClipboard)({
2802
- notify: copyNotify
2830
+ notify: shareCopyNotify
2803
2831
  });
2804
2832
  const [copied, setCopied] = (0, import_react10.useState)(false);
2805
2833
  const [fallbackUrl, setFallbackUrl] = (0, import_react10.useState)(null);
@@ -3465,7 +3493,7 @@ function ShareLinkPanel({
3465
3493
  ]
3466
3494
  }
3467
3495
  ),
3468
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorAlchemyMenu, { className: "ml-auto" })
3496
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ShareErrorAlchemyMenu, { className: "ml-auto" })
3469
3497
  ]
3470
3498
  }
3471
3499
  ) : null,
@@ -3709,7 +3737,7 @@ function RowControls({
3709
3737
  onStopPublishing
3710
3738
  }) {
3711
3739
  const { copyText: copyText3 } = (0, import_clipboard4.useClipboard)({
3712
- notify: copyNotify
3740
+ notify: shareCopyNotify
3713
3741
  });
3714
3742
  const { toast } = useToast();
3715
3743
  const [caps, setCaps] = (0, import_react14.useState)(null);
@@ -3735,7 +3763,7 @@ function RowControls({
3735
3763
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "rounded-lg border border-destructive/20 bg-destructive/10 p-3 text-xs text-destructive-ink", children: [
3736
3764
  "Couldn't read this item's sharing options: ",
3737
3765
  capsError,
3738
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorAlchemyMenu, { error: capsError })
3766
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ShareErrorAlchemyMenu, { error: capsError })
3739
3767
  ] });
3740
3768
  }
3741
3769
  if (childRecord) return null;
@@ -4258,7 +4286,7 @@ function SecureLinkForm({ resourceType, resourceId, resourceName }) {
4258
4286
  ] }) : email.trim() !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-amber-700 dark:text-amber-400", children: "Without a mobile number, the link and the code both go by email \u2014 anyone who can read that inbox could open it." }) : null,
4259
4287
  optionsError ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-xs text-destructive", children: [
4260
4288
  optionsError,
4261
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorAlchemyMenu, { error: optionsError, operation: "Load the secure-link options" })
4289
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ShareErrorAlchemyMenu, { error: optionsError, operation: "Load the secure-link options" })
4262
4290
  ] }) : null,
4263
4291
  protectedFields.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("fieldset", { className: "space-y-2", children: [
4264
4292
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("legend", { className: "text-xs font-medium", children: [
@@ -4482,7 +4510,7 @@ function ShareModal({
4482
4510
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-xs text-destructive/80 mt-0.5", children: [
4483
4511
  ownerError,
4484
4512
  " ",
4485
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorAlchemyMenu, { error: ownerError })
4513
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ShareErrorAlchemyMenu, { error: ownerError })
4486
4514
  ] })
4487
4515
  ] })
4488
4516
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3 rounded-lg border bg-muted/30 flex items-start gap-2", children: [
@@ -4509,7 +4537,7 @@ function ShareModal({
4509
4537
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PageCaptureButton, { size: "xs" })
4510
4538
  ] }),
4511
4539
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system2.DialogDescription, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4512
- EntityRef,
4540
+ ShareEntityRef,
4513
4541
  {
4514
4542
  token: resourceType,
4515
4543
  id: resourceId,
@@ -4539,7 +4567,7 @@ function ShareModal({
4539
4567
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm font-medium", children: "Sharing is unavailable" }),
4540
4568
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-xs text-muted-foreground max-w-sm", children: [
4541
4569
  configError,
4542
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorAlchemyMenu, { error: configError })
4570
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ShareErrorAlchemyMenu, { error: configError })
4543
4571
  ] })
4544
4572
  ] }),
4545
4573
  !configError && resolvingOwner && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 space-y-3 py-4", "aria-busy": "true", children: [
@@ -4705,7 +4733,7 @@ function ShareModal({
4705
4733
  ),
4706
4734
  error && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mt-3 p-2.5 bg-destructive/10 border border-destructive/20 rounded-md flex-shrink-0", children: [
4707
4735
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-destructive", children: error }),
4708
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorAlchemyMenu, { error })
4736
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ShareErrorAlchemyMenu, { error })
4709
4737
  ] })
4710
4738
  ] }) });
4711
4739
  }