@ai-matrx/sharing 0.0.0 → 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1
4
+
5
+ - **"Can't remove it" is a summon overlay (X3).** `offerOwnerChoices` / `ensureRemovable` open `CANT_REMOVE_DIALOG` (`"cantRemoveDialog"`) through the host's overlay doors and await summon's `requestOverlay`; new `requestCantRemove(request): Promise<"hidden" | "closed">` (one screen per record). Removed: `cantRemoveOpener` (kit opener), `CantRemoveDialogHostBody`, the `ensureDialogHosts` env field. New env field `overlays: { open(id, instanceId, data), close(id, instanceId) }`; new public module `./access/react/cantRemoveDialog.render`. **Consumer action:** pass `overlays` to `configureAccessUi` (dispatch summon open/close), register overlay `cantRemoveDialog` with that render; matrx-frontend's own copy (`features/access-gate/cant-remove/*`) then goes.
6
+ - **Reconciled with the web's copies (2026-10-21).** Ported the web's changes made after the sheet moved: `GuestBadge` (a person outside the thing's organization is marked Guest in the share list; `PermissionWithDetails.grantedToUser.isGuest` parsed from `get_resource_permissions`), `WhoCouldSeeOn` (a record owner asks who could see it at a past moment, `custom.who_could_see_on`) shown in the share dialog for records, and the registry's display labels (Sending mailbox, Applet, Flashcard Deck, Quiz session, Cloud document, Contact, Form, Google file).
7
+ - **New section `/access/react` (2026-10-17).** The access gate screens and hooks (`AccessGate`, `AccessDenied`, `SlugAccessGate`, `GovernedActionDialog`, `RequestAccess*`, `AccessRequestsSurface`, `HiddenByMe*`, `useAccessGate`, `configureAccessUi`, …) moved here verbatim from `@ai-matrx/data/access/react`, stamped `"use client"`. Runtime dependencies: `@ai-matrx/data`, `@ai-matrx/design-system`, `@ai-matrx/kit`, `@ai-matrx/auth`, `lucide-react`. Consumer action: import from `@ai-matrx/sharing/access/react`; keep calling `configureAccess` (from `@ai-matrx/data/access`) and `configureAccessUi` once at boot.
8
+
9
+ ## 0.1.0
10
+
11
+ Skeleton release: the name's sections exist (`/core`, `/react`) and export nothing yet. The frozen API lands with its Wave 1 unit (BUILD-BOOK §3.2).
12
+
13
+ ### Consumer action
14
+
15
+ None. Do not adopt until a unit ships the API.
16
+
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Matrix Engine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
1
  # @ai-matrx/sharing
2
2
 
3
- Name reservation only. No usable API; do not adopt this bootstrap. Real releases come from AI-Matrix-Engine/aidream.
3
+ Sharing for every AI Matrx entity: the permission doors, share links, and the share dialog.
4
+
5
+ **Status:** `/access/react` ships (the access gate screens, moved from `@ai-matrx/data`). `/core` and `/react` are reserved and export nothing yet; their API arrives with the Wave 1 unit of the Office build (`common-docs/projects/office-suite/BUILD-BOOK.md` §3.2).
6
+
7
+ ## Sections
8
+
9
+ - `@ai-matrx/sharing/core`
10
+ - `@ai-matrx/sharing/react`
11
+ - `@ai-matrx/sharing/access/react` — `"use client"`: request access, access denied, governed actions, hidden-by-me
12
+
13
+ ## `@ai-matrx/sharing/access/react` — the access gate screens
14
+
15
+ `"use client"` entry. Every screen and hook of the access gate: `AccessGate`, `AccessDenied` / `AccessDeniedView`,
16
+ `SlugAccessGate`, `SettingAccessGate`, `ForbiddenSurfaceView`, `RequestAccess`, `RequestAccessPanel`, `BlindAccessAsk`,
17
+ `UnresolvedEntityRef`, `ServerReadRecheck`, `GovernedActionDialog`, `HiddenByMeButton`, `HiddenFilter`,
18
+ `ResourceActionRequestButtons`, `SettingRequestActionButtons`, `AccessRequestsSurface`; hooks `useAccessGate`,
19
+ `useAccessStates`, `useHiddenByMe` (+ `useHiddenItems`, `useHideForMe`, `useRemovalRights`), `useRequestAccess`; and the
20
+ "can't remove it" opener (`ensureRemovable`, `offerOwnerChoices`, `cantRemoveOpener`, `CantRemoveDialogHostBody`).
21
+ Built on `@ai-matrx/design-system` and `lucide-react`; no `next/*`, no app imports.
22
+
23
+ **`configureAccessUi(env)`** (module-level, merges; `<AccessUiProvider env>` overrides a subtree; `useAccessUi()` reads the
24
+ merged result). The pure half's Supabase client / `ensureOrgId` / CMS tokens come from `configureAccess` in `@ai-matrx/data/access` — call both once at boot; the screens read the same `@ai-matrx/data/access` module the app configures.
25
+
26
+ | Field | Kind | Default when absent |
27
+ |---|---|---|
28
+ | `useLoginHref()`, `useCurrentUser()` `{id, displayName, email}`, `toast` `{success, error, warning, info?}` | REQUIRED | reading one throws an error naming `configureAccessUi({ field })` |
29
+ | `Link`, `router` `{push, back, refresh}`, `searchParam(name)`, `confirm(options)`, `Textarea`, `renderUserIdentity`, `renderEntityRef`, `renderErrorMenu`, `navItemClasses`, `manualRequestActionKey` | optional, working default | plain `<a>`, browser history/reload, kit `confirm()`, design-system `Textarea`, avatar + name, plain name (not a door), no error menu, app-shell nav CSS variables, `request_access.manual` |
30
+ | `entityRegistry.tryGetEntityInfo`, `trash.restore`, `recordUnavailableCapture.resolve`, `settingRequestActions.get`, `resourceActionRequests.get`, `cms.createAccessRequest`, `settingDoorHref`, `reportFeedback`, `presentOrganizationRefusal`, `overlays` | optional app feature | owners/records render as plain names; Restore, CMS asks, setting asks and platform-team asks FAIL VISIBLY naming the missing field; unknown request actions render without the primary action button; the rest are no-ops |
31
+
32
+ Hook-valued fields are called inside components: set them once at boot. `ForbiddenSurface` (async, reads `headers()` and the
33
+ session verdict) cannot live in a client entry, so the package ships `ForbiddenSurfaceView`; the app keeps a ~10-line server
34
+ wrapper in `forbidden.tsx` that reads the verdict and request path and renders it.
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/access/react/cantRemoveDialog.render.tsx
23
+ var cantRemoveDialog_render_exports = {};
24
+ __export(cantRemoveDialog_render_exports, {
25
+ default: () => render
26
+ });
27
+ module.exports = __toCommonJS(cantRemoveDialog_render_exports);
28
+ var import_react = require("@ai-matrx/summon/react");
29
+ var import_react2 = require("@ai-matrx/sharing/access/react");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function render({ data, close }) {
32
+ const { request, settle } = (0, import_react.useOverlayRequest)(data, close);
33
+ if (!request) return null;
34
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
35
+ import_react2.GovernedActionDialog,
36
+ {
37
+ open: true,
38
+ onOpenChange: (next) => {
39
+ if (!next) settle("closed");
40
+ },
41
+ resourceType: request.token,
42
+ resourceId: request.id,
43
+ itemName: request.itemName,
44
+ itemLabel: request.itemLabel,
45
+ action: request.action,
46
+ href: request.href ?? null,
47
+ onHidden: () => settle("hidden")
48
+ },
49
+ `${request.token}:${request.id}`
50
+ );
51
+ }
52
+ //# sourceMappingURL=access-react-cant-remove-dialog.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/access/react/cantRemoveDialog.render.tsx"],"sourcesContent":["\"use client\";\n/**\n * The `cantRemoveDialog` overlay's render (`CANT_REMOVE_DIALOG`): answers the pending `requestCantRemove`\n * request with `GovernedActionDialog`. A host registers the overlay id with this module as its render.\n * Imports the package by name so the dialog shares the host's one `configureAccessUi` environment.\n */\nimport { useOverlayRequest, type OverlayRenderProps } from \"@ai-matrx/summon/react\";\nimport { GovernedActionDialog, type CantRemoveOutcome, type CantRemoveRequest } from \"@ai-matrx/sharing/access/react\";\n\nexport default function render({ data, close }: OverlayRenderProps) {\n const { request, settle } = useOverlayRequest<CantRemoveRequest, CantRemoveOutcome>(data, close);\n if (!request) return null;\n return (\n <GovernedActionDialog\n key={`${request.token}:${request.id}`}\n open\n onOpenChange={(next) => {\n if (!next) settle(\"closed\");\n }}\n resourceType={request.token}\n resourceId={request.id}\n itemName={request.itemName}\n itemLabel={request.itemLabel}\n action={request.action}\n href={request.href ?? null}\n // The hidden-ids store refreshed inside the hide, so every list of this kind re-renders.\n onHidden={() => settle(\"hidden\")}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAA2D;AAC3D,IAAAA,gBAAqF;AAMjF;AAJW,SAAR,OAAwB,EAAE,MAAM,MAAM,GAAuB;AAClE,QAAM,EAAE,SAAS,OAAO,QAAI,gCAAwD,MAAM,KAAK;AAC/F,MAAI,CAAC,QAAS,QAAO;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,MAAI;AAAA,MACJ,cAAc,CAAC,SAAS;AACtB,YAAI,CAAC,KAAM,QAAO,QAAQ;AAAA,MAC5B;AAAA,MACA,cAAc,QAAQ;AAAA,MACtB,YAAY,QAAQ;AAAA,MACpB,UAAU,QAAQ;AAAA,MAClB,WAAW,QAAQ;AAAA,MACnB,QAAQ,QAAQ;AAAA,MAChB,MAAM,QAAQ,QAAQ;AAAA,MAEtB,UAAU,MAAM,OAAO,QAAQ;AAAA;AAAA,IAZ1B,GAAG,QAAQ,KAAK,IAAI,QAAQ,EAAE;AAAA,EAarC;AAEJ;","names":["import_react"]}
@@ -0,0 +1,6 @@
1
+ import * as react from 'react';
2
+ import { OverlayRenderProps } from '@ai-matrx/summon/react';
3
+
4
+ declare function render({ data, close }: OverlayRenderProps): react.JSX.Element | null;
5
+
6
+ export { render as default };
@@ -0,0 +1,6 @@
1
+ import * as react from 'react';
2
+ import { OverlayRenderProps } from '@ai-matrx/summon/react';
3
+
4
+ declare function render({ data, close }: OverlayRenderProps): react.JSX.Element | null;
5
+
6
+ export { render as default };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/access/react/cantRemoveDialog.render.tsx
5
+ import { useOverlayRequest } from "@ai-matrx/summon/react";
6
+ import { GovernedActionDialog } from "@ai-matrx/sharing/access/react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function render({ data, close }) {
9
+ const { request, settle } = useOverlayRequest(data, close);
10
+ if (!request) return null;
11
+ return /* @__PURE__ */ jsx(
12
+ GovernedActionDialog,
13
+ {
14
+ open: true,
15
+ onOpenChange: (next) => {
16
+ if (!next) settle("closed");
17
+ },
18
+ resourceType: request.token,
19
+ resourceId: request.id,
20
+ itemName: request.itemName,
21
+ itemLabel: request.itemLabel,
22
+ action: request.action,
23
+ href: request.href ?? null,
24
+ onHidden: () => settle("hidden")
25
+ },
26
+ `${request.token}:${request.id}`
27
+ );
28
+ }
29
+ export {
30
+ render as default
31
+ };
32
+ //# sourceMappingURL=access-react-cant-remove-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/access/react/cantRemoveDialog.render.tsx"],"sourcesContent":["\"use client\";\n/**\n * The `cantRemoveDialog` overlay's render (`CANT_REMOVE_DIALOG`): answers the pending `requestCantRemove`\n * request with `GovernedActionDialog`. A host registers the overlay id with this module as its render.\n * Imports the package by name so the dialog shares the host's one `configureAccessUi` environment.\n */\nimport { useOverlayRequest, type OverlayRenderProps } from \"@ai-matrx/summon/react\";\nimport { GovernedActionDialog, type CantRemoveOutcome, type CantRemoveRequest } from \"@ai-matrx/sharing/access/react\";\n\nexport default function render({ data, close }: OverlayRenderProps) {\n const { request, settle } = useOverlayRequest<CantRemoveRequest, CantRemoveOutcome>(data, close);\n if (!request) return null;\n return (\n <GovernedActionDialog\n key={`${request.token}:${request.id}`}\n open\n onOpenChange={(next) => {\n if (!next) settle(\"closed\");\n }}\n resourceType={request.token}\n resourceId={request.id}\n itemName={request.itemName}\n itemLabel={request.itemLabel}\n action={request.action}\n href={request.href ?? null}\n // The hidden-ids store refreshed inside the hide, so every list of this kind re-renders.\n onHidden={() => settle(\"hidden\")}\n />\n );\n}\n"],"mappings":";;;;AAMA,SAAS,yBAAkD;AAC3D,SAAS,4BAA4E;AAMjF;AAJW,SAAR,OAAwB,EAAE,MAAM,MAAM,GAAuB;AAClE,QAAM,EAAE,SAAS,OAAO,IAAI,kBAAwD,MAAM,KAAK;AAC/F,MAAI,CAAC,QAAS,QAAO;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,MAAI;AAAA,MACJ,cAAc,CAAC,SAAS;AACtB,YAAI,CAAC,KAAM,QAAO,QAAQ;AAAA,MAC5B;AAAA,MACA,cAAc,QAAQ;AAAA,MACtB,YAAY,QAAQ;AAAA,MACpB,UAAU,QAAQ;AAAA,MAClB,WAAW,QAAQ;AAAA,MACnB,QAAQ,QAAQ;AAAA,MAChB,MAAM,QAAQ,QAAQ;AAAA,MAEtB,UAAU,MAAM,OAAO,QAAQ;AAAA;AAAA,IAZ1B,GAAG,QAAQ,KAAK,IAAI,QAAQ,EAAE;AAAA,EAarC;AAEJ;","names":[]}