@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.js CHANGED
@@ -35,8 +35,26 @@ function DefaultCopyButtons(props) {
35
35
  }
36
36
  );
37
37
  }
38
+ var announced = /* @__PURE__ */ new Set();
39
+ function announceStandIn(port) {
40
+ if (announced.has(port)) return;
41
+ announced.add(port);
42
+ console.warn(
43
+ `[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} }).`
44
+ );
45
+ }
46
+ function StandIn({ port }) {
47
+ useEffect(() => announceStandIn(port), [port]);
48
+ return /* @__PURE__ */ jsx("span", { hidden: true, "data-share-sheet-host": "unconfigured", "data-share-sheet-port": port });
49
+ }
38
50
  function DefaultErrorMenu(_props) {
39
- return null;
51
+ return /* @__PURE__ */ jsx(StandIn, { port: "ErrorAlchemyMenu" });
52
+ }
53
+ function DefaultPageCaptureButton(_props) {
54
+ return /* @__PURE__ */ jsx(StandIn, { port: "PageCaptureButton" });
55
+ }
56
+ function DefaultEntityDoorControls(_props) {
57
+ return /* @__PURE__ */ jsx(StandIn, { port: "EntityDoorControls" });
40
58
  }
41
59
  function DefaultInfoHint(props) {
42
60
  return /* @__PURE__ */ jsx("span", { title: String(props.text ?? ""), "aria-label": String(props.label ?? "More info"), className: "cursor-help text-muted-foreground", children: "\u24D8" });
@@ -146,14 +164,23 @@ var DEFAULTS = {
146
164
  useUserConnections: useDefaultConnections,
147
165
  confirm: (o) => kitConfirm(o),
148
166
  CopyButtons: DefaultCopyButtons,
149
- csvExportItem: () => null,
150
- jsonExportItem: () => null,
151
- usePageCapture: () => void 0,
167
+ csvExportItem: () => {
168
+ announceStandIn("csvExportItem");
169
+ return null;
170
+ },
171
+ jsonExportItem: () => {
172
+ announceStandIn("jsonExportItem");
173
+ return null;
174
+ },
175
+ usePageCapture: () => {
176
+ announceStandIn("usePageCapture");
177
+ return void 0;
178
+ },
152
179
  dialogCapture: (input) => input,
153
- PageCaptureButton: () => null,
180
+ PageCaptureButton: DefaultPageCaptureButton,
154
181
  ErrorAlchemyMenu: DefaultErrorMenu,
155
182
  InfoHint: DefaultInfoHint,
156
- EntityDoorControls: () => null,
183
+ EntityDoorControls: DefaultEntityDoorControls,
157
184
  EntityRef: DefaultEntityRef,
158
185
  UserAvatarDisplay: DefaultUserAvatar,
159
186
  ConnectionsReadNotice: DefaultConnectionsNotice,
@@ -172,7 +199,7 @@ function shareSheetUi() {
172
199
  function useToast() {
173
200
  return { toast: (o) => ui.toast(o) };
174
201
  }
175
- function copyNotify(message, kind) {
202
+ function shareCopyNotify(message, kind) {
176
203
  ui.toast({ title: message, ...kind === "error" ? { variant: "destructive" } : {} });
177
204
  }
178
205
  var confirm = (options) => ui.confirm(options);
@@ -186,10 +213,10 @@ var csvExportItem = (...args) => ui.csvExportItem(...args);
186
213
  var jsonExportItem = (...args) => ui.jsonExportItem(...args);
187
214
  var CopyButtons = (p) => /* @__PURE__ */ jsx(ui.CopyButtons, { ...p });
188
215
  var PageCaptureButton = (p) => /* @__PURE__ */ jsx(ui.PageCaptureButton, { ...p });
189
- var ErrorAlchemyMenu = (p) => /* @__PURE__ */ jsx(ui.ErrorAlchemyMenu, { ...p });
216
+ var ShareErrorAlchemyMenu = (p) => /* @__PURE__ */ jsx(ui.ErrorAlchemyMenu, { ...p });
190
217
  var InfoHint = (p) => /* @__PURE__ */ jsx(ui.InfoHint, { ...p });
191
- var EntityDoorControls = (p) => /* @__PURE__ */ jsx(ui.EntityDoorControls, { ...p });
192
- var EntityRef = (p) => /* @__PURE__ */ jsx(ui.EntityRef, { ...p });
218
+ var ShareEntityDoorControls = (p) => /* @__PURE__ */ jsx(ui.EntityDoorControls, { ...p });
219
+ var ShareEntityRef = (p) => /* @__PURE__ */ jsx(ui.EntityRef, { ...p });
193
220
  var UserAvatarDisplay = (p) => /* @__PURE__ */ jsx(ui.UserAvatarDisplay, { ...p });
194
221
  var ConnectionsReadNotice = (p) => /* @__PURE__ */ jsx(ui.ConnectionsReadNotice, { ...p });
195
222
  var UserSearchField = (p) => /* @__PURE__ */ jsx(ui.UserSearchField, { ...p });
@@ -197,6 +224,7 @@ var defaultIdentity = null;
197
224
  var usePortalContainer = () => ui.usePortalContainer();
198
225
  var vaultIdentity = () => {
199
226
  if (ui.vaultIdentity) return ui.vaultIdentity;
227
+ announceStandIn("vaultIdentity");
200
228
  if (!defaultIdentity) {
201
229
  defaultIdentity = createSupabaseIdentity(shareClientForIdentity().auth, {
202
230
  redirectTo: () => window.location.href,
@@ -1220,7 +1248,7 @@ function PermissionsList({
1220
1248
  /* @__PURE__ */ jsx4("p", { className: "text-sm font-semibold truncate leading-none", children: getPermissionLabel(permission) }),
1221
1249
  permission.grantedToUser?.isGuest && !permission.isPublic ? /* @__PURE__ */ jsx4(GuestBadge, {}) : null,
1222
1250
  permission.grantedToOrganization && /* @__PURE__ */ jsx4(
1223
- EntityDoorControls,
1251
+ ShareEntityDoorControls,
1224
1252
  {
1225
1253
  token: "organization",
1226
1254
  id: permission.grantedToOrganization.id,
@@ -1517,7 +1545,7 @@ function AccessSummaryPanel({
1517
1545
  children: "Retry"
1518
1546
  }
1519
1547
  ),
1520
- /* @__PURE__ */ jsx5(ErrorAlchemyMenu, { error })
1548
+ /* @__PURE__ */ jsx5(ShareErrorAlchemyMenu, { error })
1521
1549
  ]
1522
1550
  }
1523
1551
  );
@@ -1872,14 +1900,14 @@ function AddEveryoneInOrg({
1872
1900
  orgLabel,
1873
1901
  " could not be listed: ",
1874
1902
  teamsError,
1875
- /* @__PURE__ */ jsx6(ErrorAlchemyMenu, { error: teamsError })
1903
+ /* @__PURE__ */ jsx6(ShareErrorAlchemyMenu, { error: teamsError })
1876
1904
  ] }) : null,
1877
1905
  orgId && loadError ? /* @__PURE__ */ jsxs5("p", { className: "type-secondary text-destructive", children: [
1878
1906
  "The people in ",
1879
1907
  orgName,
1880
1908
  " could not be listed: ",
1881
1909
  loadError,
1882
- /* @__PURE__ */ jsx6(ErrorAlchemyMenu, { error: loadError })
1910
+ /* @__PURE__ */ jsx6(ShareErrorAlchemyMenu, { error: loadError })
1883
1911
  ] }) : null,
1884
1912
  orgId && !loadError && members === null ? /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 type-secondary text-muted-foreground", children: [
1885
1913
  /* @__PURE__ */ jsx6(Loader23, { className: "w-3 h-3 animate-spin" }),
@@ -2516,7 +2544,7 @@ function OutsideSharePanel({
2516
2544
  /* @__PURE__ */ jsxs7("p", { className: "text-sm font-medium text-destructive", children: [
2517
2545
  "We could not check who outside this organization can see ",
2518
2546
  tableName,
2519
- /* @__PURE__ */ jsx8(ErrorAlchemyMenu, {})
2547
+ /* @__PURE__ */ jsx8(ShareErrorAlchemyMenu, {})
2520
2548
  ] }),
2521
2549
  /* @__PURE__ */ jsx8("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." }),
2522
2550
  /* @__PURE__ */ jsx8("p", { className: "mt-1 break-words text-xs text-muted-foreground", children: loadError })
@@ -2877,7 +2905,7 @@ import { ClipboardFallbackDialog } from "@ai-matrx/design-system";
2877
2905
  import { jsx as jsx13 } from "react/jsx-runtime";
2878
2906
  function useShare() {
2879
2907
  const { copyText: copyTextKit } = useClipboard({
2880
- notify: copyNotify
2908
+ notify: shareCopyNotify
2881
2909
  });
2882
2910
  const [copied, setCopied] = useState9(false);
2883
2911
  const [fallbackUrl, setFallbackUrl] = useState9(null);
@@ -3549,7 +3577,7 @@ function ShareLinkPanel({
3549
3577
  ]
3550
3578
  }
3551
3579
  ),
3552
- /* @__PURE__ */ jsx14(ErrorAlchemyMenu, { className: "ml-auto" })
3580
+ /* @__PURE__ */ jsx14(ShareErrorAlchemyMenu, { className: "ml-auto" })
3553
3581
  ]
3554
3582
  }
3555
3583
  ) : null,
@@ -3793,7 +3821,7 @@ function RowControls({
3793
3821
  onStopPublishing
3794
3822
  }) {
3795
3823
  const { copyText: copyText3 } = useClipboard2({
3796
- notify: copyNotify
3824
+ notify: shareCopyNotify
3797
3825
  });
3798
3826
  const { toast } = useToast();
3799
3827
  const [caps, setCaps] = useState13(null);
@@ -3819,7 +3847,7 @@ function RowControls({
3819
3847
  return /* @__PURE__ */ jsxs13("p", { className: "rounded-lg border border-destructive/20 bg-destructive/10 p-3 text-xs text-destructive-ink", children: [
3820
3848
  "Couldn't read this item's sharing options: ",
3821
3849
  capsError,
3822
- /* @__PURE__ */ jsx17(ErrorAlchemyMenu, { error: capsError })
3850
+ /* @__PURE__ */ jsx17(ShareErrorAlchemyMenu, { error: capsError })
3823
3851
  ] });
3824
3852
  }
3825
3853
  if (childRecord) return null;
@@ -4349,7 +4377,7 @@ function SecureLinkForm({ resourceType, resourceId, resourceName }) {
4349
4377
  ] }) : email.trim() !== "" ? /* @__PURE__ */ jsx19("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,
4350
4378
  optionsError ? /* @__PURE__ */ jsxs15("p", { className: "text-xs text-destructive", children: [
4351
4379
  optionsError,
4352
- /* @__PURE__ */ jsx19(ErrorAlchemyMenu, { error: optionsError, operation: "Load the secure-link options" })
4380
+ /* @__PURE__ */ jsx19(ShareErrorAlchemyMenu, { error: optionsError, operation: "Load the secure-link options" })
4353
4381
  ] }) : null,
4354
4382
  protectedFields.length > 0 ? /* @__PURE__ */ jsxs15("fieldset", { className: "space-y-2", children: [
4355
4383
  /* @__PURE__ */ jsxs15("legend", { className: "text-xs font-medium", children: [
@@ -4573,7 +4601,7 @@ function ShareModal({
4573
4601
  /* @__PURE__ */ jsxs16("p", { className: "text-xs text-destructive/80 mt-0.5", children: [
4574
4602
  ownerError,
4575
4603
  " ",
4576
- /* @__PURE__ */ jsx20(ErrorAlchemyMenu, { error: ownerError })
4604
+ /* @__PURE__ */ jsx20(ShareErrorAlchemyMenu, { error: ownerError })
4577
4605
  ] })
4578
4606
  ] })
4579
4607
  ] }) : /* @__PURE__ */ jsxs16("div", { className: "p-3 rounded-lg border bg-muted/30 flex items-start gap-2", children: [
@@ -4600,7 +4628,7 @@ function ShareModal({
4600
4628
  /* @__PURE__ */ jsx20(PageCaptureButton, { size: "xs" })
4601
4629
  ] }),
4602
4630
  /* @__PURE__ */ jsx20(DialogDescription, { asChild: true, children: /* @__PURE__ */ jsx20("div", { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ jsx20(
4603
- EntityRef,
4631
+ ShareEntityRef,
4604
4632
  {
4605
4633
  token: resourceType,
4606
4634
  id: resourceId,
@@ -4630,7 +4658,7 @@ function ShareModal({
4630
4658
  /* @__PURE__ */ jsx20("p", { className: "text-sm font-medium", children: "Sharing is unavailable" }),
4631
4659
  /* @__PURE__ */ jsxs16("p", { className: "text-xs text-muted-foreground max-w-sm", children: [
4632
4660
  configError,
4633
- /* @__PURE__ */ jsx20(ErrorAlchemyMenu, { error: configError })
4661
+ /* @__PURE__ */ jsx20(ShareErrorAlchemyMenu, { error: configError })
4634
4662
  ] })
4635
4663
  ] }),
4636
4664
  !configError && resolvingOwner && /* @__PURE__ */ jsxs16("div", { className: "flex-1 space-y-3 py-4", "aria-busy": "true", children: [
@@ -4796,7 +4824,7 @@ function ShareModal({
4796
4824
  ),
4797
4825
  error && /* @__PURE__ */ jsxs16("div", { className: "mt-3 p-2.5 bg-destructive/10 border border-destructive/20 rounded-md flex-shrink-0", children: [
4798
4826
  /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: error }),
4799
- /* @__PURE__ */ jsx20(ErrorAlchemyMenu, { error })
4827
+ /* @__PURE__ */ jsx20(ShareErrorAlchemyMenu, { error })
4800
4828
  ] })
4801
4829
  ] }) });
4802
4830
  }