@ai4b-team/fsaos-gateway-sdk 5.6.2 → 5.7.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/README.md +64 -0
- package/dist/iife/gateway.js +5 -5
- package/dist/iife/gateway.js.map +4 -4
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +234 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -15
- package/dist/index.d.ts +75 -15
- package/dist/index.js +233 -59
- package/dist/index.js.map +1 -1
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -74,6 +74,32 @@ Plain HTML can use the same contract without loading the SDK:
|
|
|
74
74
|
</form>
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Funnel file purchases
|
|
78
|
+
|
|
79
|
+
Published RevDev pages declare a `commerce.checkout` capability pointing to an
|
|
80
|
+
active file offer. Bind that action on a funnel page step and connect its
|
|
81
|
+
`purchase.ready` event to the next page. Publish the project before accepting
|
|
82
|
+
purchases. The server freezes the selected funnel, offer and next page on each
|
|
83
|
+
purchase; URL parameters cannot choose a price, seller connection or redirect.
|
|
84
|
+
|
|
85
|
+
For a public page, send the buyer to the host app for authentication and Space
|
|
86
|
+
selection with `funnelCheckoutLink`. Supply the host where this offer is sold:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const href = funnelCheckoutLink({
|
|
90
|
+
hostOrigin: 'https://app.example.com', productId,
|
|
91
|
+
capabilityId: 'buy', pageUrl: window.location.href,
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
A signed-in RevDev app can instead call `startFileCheckout` with the product
|
|
96
|
+
revision returned by `commerce-file-sale` action `offer`, an authorized
|
|
97
|
+
destination Space, a stable request key and its current published page/action.
|
|
98
|
+
Use `getFilePurchase` once on return and on the existing SDK item event; do not
|
|
99
|
+
poll. `filePurchaseNextUrl(receipt)` returns the saved next URL only after
|
|
100
|
+
verified payment and file delivery. Fulfillment happens on the server even if
|
|
101
|
+
the buyer closes the page. This API does not grant edit/resale rights.
|
|
102
|
+
|
|
77
103
|
### Shared Instances
|
|
78
104
|
- `supabase` — Shared Supabase client instance
|
|
79
105
|
- `queryClient` — Shared TanStack QueryClient instance
|
|
@@ -502,3 +528,41 @@ relevant edge/message changes and releases its watcher on close. It never polls.
|
|
|
502
528
|
`fetchNextPage()` is explicit, including when an authorization-filtered page is
|
|
503
529
|
empty but has another cursor. Mounting one reader per closed message is unnecessary:
|
|
504
530
|
use the already-loaded history's `reply_to` projection for summaries.
|
|
531
|
+
|
|
532
|
+
## Native item permission checks
|
|
533
|
+
|
|
534
|
+
`usePermission(action, item)` and `usePermissions(item, actions)` call the existing
|
|
535
|
+
FSAOS `check-item-access` method as the authenticated SDK session. Supported native
|
|
536
|
+
actions are `view`, `edit`, `delete`, and `admin`. Prefer an already-resolved item
|
|
537
|
+
UUID; an absolute VFS path uses one shared `read` to resolve its UUID first.
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
const { data, loading, error, refetch } = usePermissions(item.id, ['view', 'edit']);
|
|
541
|
+
// Or: usePermission('edit', item.id).data.allowed
|
|
542
|
+
if (loading) return <span>Checking access…</span>;
|
|
543
|
+
if (error) return <button onClick={() => void refetch()}>Retry access check</button>;
|
|
544
|
+
return <button disabled={!data.edit}>Edit</button>;
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
The host must initialize an authenticated SDK session and provide the shared
|
|
548
|
+
`QueryClientProvider`/`setQueryClient` instance. Missing/anonymous context, loading,
|
|
549
|
+
refreshing, errors and malformed responses never report allowed. Unsupported
|
|
550
|
+
actions or non-UUID/non-absolute-path targets report `PERMISSION_INPUT_INVALID`.
|
|
551
|
+
These hooks do not create an approval request or grant access. They check native
|
|
552
|
+
item access, not an action allowance, entitlement or every method-specific rule;
|
|
553
|
+
the actual kernel operation remains authoritative.
|
|
554
|
+
|
|
555
|
+
Each distinct visible item/action has one shared query. Identical consumers reuse
|
|
556
|
+
it, including consumers mixing the two hooks. There are no interval reads, retries,
|
|
557
|
+
focus reads or per-hook subscriptions. Existing workspace VFS/CCM events invalidate
|
|
558
|
+
matching checks; membership/sharing changes refresh the affected mounted scope.
|
|
559
|
+
Bursts coalesce, old grants disappear immediately, and stream resync refreshes
|
|
560
|
+
active checks. Closing the last observer discards the check, so reopening checks
|
|
561
|
+
again. A host using the SDK without workspace events must explicitly `refetch`
|
|
562
|
+
after its own permission changes. Calls are also eligible for the existing
|
|
563
|
+
`configureGatewayReads` concurrency and cancellation controls.
|
|
564
|
+
|
|
565
|
+
Tokenless `hostSession` frames do not have a seated identity of their own. Render
|
|
566
|
+
permission-dependent host controls in the authenticated host; these hooks remain
|
|
567
|
+
false in an unseated frame. Frame operations still use the host's governed gateway
|
|
568
|
+
calls. Do not invent a principal or copy a bearer into the frame to enable a UI.
|