@apotech-os/ui-sdk 3.0.0 → 3.0.2
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/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,15 @@ interface AppContextValue {
|
|
|
21
21
|
* letting the user discover the 403 at save time.
|
|
22
22
|
*/
|
|
23
23
|
role?: 'VIEWER' | 'EDITOR' | 'ADMIN';
|
|
24
|
+
/**
|
|
25
|
+
* The current user's role on the PLATFORM context, when the shell knows it.
|
|
26
|
+
* A different axis from `role`: some platform primitives a page may reach
|
|
27
|
+
* (prompt promotion, quality writes) have a company-wide blast radius and
|
|
28
|
+
* are gated server-side on platform EDITOR+, not on any one app's grant.
|
|
29
|
+
* Undefined means "the shell did not say" — treat that as no authority and
|
|
30
|
+
* hide the control, never as permission.
|
|
31
|
+
*/
|
|
32
|
+
platformRole?: 'VIEWER' | 'EDITOR' | 'ADMIN';
|
|
24
33
|
}
|
|
25
34
|
declare const AppContextProvider: React.Provider<AppContextValue | null>;
|
|
26
35
|
/** Returns context info for the current app page (appSlug, pagePath, spaceId). */
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ interface AppContextValue {
|
|
|
21
21
|
* letting the user discover the 403 at save time.
|
|
22
22
|
*/
|
|
23
23
|
role?: 'VIEWER' | 'EDITOR' | 'ADMIN';
|
|
24
|
+
/**
|
|
25
|
+
* The current user's role on the PLATFORM context, when the shell knows it.
|
|
26
|
+
* A different axis from `role`: some platform primitives a page may reach
|
|
27
|
+
* (prompt promotion, quality writes) have a company-wide blast radius and
|
|
28
|
+
* are gated server-side on platform EDITOR+, not on any one app's grant.
|
|
29
|
+
* Undefined means "the shell did not say" — treat that as no authority and
|
|
30
|
+
* hide the control, never as permission.
|
|
31
|
+
*/
|
|
32
|
+
platformRole?: 'VIEWER' | 'EDITOR' | 'ADMIN';
|
|
24
33
|
}
|
|
25
34
|
declare const AppContextProvider: React.Provider<AppContextValue | null>;
|
|
26
35
|
/** Returns context info for the current app page (appSlug, pagePath, spaceId). */
|
package/dist/index.js
CHANGED
|
@@ -139,12 +139,14 @@ function useAppRun(runId, opts = {}) {
|
|
|
139
139
|
const requestId = ++requestIdRef.current;
|
|
140
140
|
try {
|
|
141
141
|
const loaded = await clientRef.current.get(path);
|
|
142
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
142
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
143
|
+
return { kind: "superseded" };
|
|
143
144
|
setRun(loaded);
|
|
144
145
|
setError(void 0);
|
|
145
146
|
return { kind: "success", run: loaded };
|
|
146
147
|
} catch (err) {
|
|
147
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
148
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
149
|
+
return { kind: "superseded" };
|
|
148
150
|
setError(err);
|
|
149
151
|
return { kind: "error", err };
|
|
150
152
|
}
|
|
@@ -233,12 +235,14 @@ function useAppRuns(opts) {
|
|
|
233
235
|
path,
|
|
234
236
|
JSON.parse(paramsKey)
|
|
235
237
|
);
|
|
236
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
238
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
239
|
+
return { kind: "superseded" };
|
|
237
240
|
setRuns(page.items);
|
|
238
241
|
setError(void 0);
|
|
239
242
|
return { kind: "success", items: page.items };
|
|
240
243
|
} catch (err) {
|
|
241
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
244
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current)
|
|
245
|
+
return { kind: "superseded" };
|
|
242
246
|
setError(err);
|
|
243
247
|
return { kind: "error", err };
|
|
244
248
|
} finally {
|