@burdenoff/microfe-semanticfed 2026.1109.7 → 2026.1109.9

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.
Files changed (30) hide show
  1. package/README.md +24 -0
  2. package/dist/semanticfed/api/clientAnalytics.d.ts +13 -0
  3. package/dist/semanticfed/api/clientAnalytics.js +53 -0
  4. package/dist/semanticfed/api/clientAnalytics.js.map +1 -0
  5. package/dist/semanticfed/api/scopedRequest.d.ts +12 -0
  6. package/dist/semanticfed/api/scopedRequest.js +36 -0
  7. package/dist/semanticfed/api/scopedRequest.js.map +1 -0
  8. package/dist/semanticfed/api/semanticfedGraphql.d.ts +2 -1
  9. package/dist/semanticfed/api/semanticfedGraphql.js +39 -20
  10. package/dist/semanticfed/api/semanticfedGraphql.js.map +1 -1
  11. package/dist/semanticfed/components/OnboardingChecklist.js +92 -84
  12. package/dist/semanticfed/components/OnboardingChecklist.js.map +1 -1
  13. package/dist/semanticfed/hooks/useClientAnalytics.d.ts +7 -0
  14. package/dist/semanticfed/hooks/useClientAnalytics.js +25 -0
  15. package/dist/semanticfed/hooks/useClientAnalytics.js.map +1 -0
  16. package/dist/semanticfed/hooks/useOnboarding.d.ts +8 -2
  17. package/dist/semanticfed/hooks/useOnboarding.js +40 -21
  18. package/dist/semanticfed/hooks/useOnboarding.js.map +1 -1
  19. package/dist/semanticfed/hooks/useQueryRuns.d.ts +4 -1
  20. package/dist/semanticfed/hooks/useQueryRuns.js +103 -86
  21. package/dist/semanticfed/hooks/useQueryRuns.js.map +1 -1
  22. package/dist/semanticfed/hooks/useSemRequest.d.ts +5 -0
  23. package/dist/semanticfed/hooks/useSemRequest.js +25 -0
  24. package/dist/semanticfed/hooks/useSemRequest.js.map +1 -0
  25. package/dist/semanticfed/hooks/useSqlConsole.js +35 -23
  26. package/dist/semanticfed/hooks/useSqlConsole.js.map +1 -1
  27. package/dist/semanticfed/providers/SemanticFedProvider.js +2 -1
  28. package/dist/semanticfed/providers/SemanticFedProvider.js.map +1 -1
  29. package/dist/semanticfed/types/index.d.ts +1 -0
  30. package/package.json +5 -4
package/README.md CHANGED
@@ -10,3 +10,27 @@ See `AGENTS.md` for development commands and architecture details.
10
10
  ## License
11
11
 
12
12
  Proprietary — Copyright Burdenoff Consultancy Services Pvt. Ltd.
13
+
14
+ ## Client analytics and native context
15
+
16
+ Real SQL, saved-run and onboarding hooks use captured account/workspace authority
17
+ through the shared workspace preparation and pinned GraphQL transport. The host
18
+ must forward native organization, tenant and project context with the actor and
19
+ workspace. Mutations do not retry automatically; cached reads are invalidated on
20
+ settlement even when confirmation is lost after a committed operation. Quota
21
+ refusals retain the existing typed upgrade-prompt behavior.
22
+
23
+ Client facts use the shared event bus. Activation views describe the rendered
24
+ server-derived checklist; they do not claim first activation. Demo facts require
25
+ an acknowledged new demo creation, and saved-run request facts remain distinct
26
+ from backend terminal outcomes. SQL properties contain bounded row buckets or
27
+ fixed failure classes, never SQL, source endpoints, row contents or exception
28
+ messages. The app shell owns consent and external transport/site configuration.
29
+ A local bus emission does not establish external provider ingestion.
30
+
31
+ `bun run test:client-scope` runs the real installed endpoint resolver, captured
32
+ request/refusal/cache regressions, bounded event tests and actual React provider
33
+ commit tests with browser fetch disabled. Native context changes reset local
34
+ result/history/editor state and query data; ordinary bearer renewal in the same
35
+ context preserves that state. The tests are protocol and state fixtures, separate
36
+ from deployed doctor and Playwright acceptance. They are part of `sanity`.
@@ -0,0 +1,13 @@
1
+ import { EventBus } from '@burdenoff/fe-libs/shared/events';
2
+ /** Each committed mount/context owns one lease; old promises never reactivate it. */
3
+ export declare function createAnalyticsLease(): {
4
+ isActive: () => boolean;
5
+ activate: () => () => void;
6
+ };
7
+ export declare function createClientAnalytics(emit: EventBus['emit'], workspaceId: string | undefined, actorId: string | undefined, isCurrent: () => boolean): {
8
+ activationViewed: (completedCount: number, totalCount: number, demoDataPresent: boolean) => void;
9
+ demoSeeded: (created: boolean) => void;
10
+ runRequested: () => void;
11
+ sqlExecuted: (rowCount: number, truncated: boolean) => void;
12
+ sqlFailed: (error: unknown) => void;
13
+ };
@@ -0,0 +1,53 @@
1
+ // src/semanticfed/api/clientAnalytics.ts
2
+ function e() {
3
+ let e = !1;
4
+ return {
5
+ isActive: () => e,
6
+ activate: () => (e = !0, () => {
7
+ e = !1;
8
+ })
9
+ };
10
+ }
11
+ function t(e, t, n, r) {
12
+ let i = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, a = () => !!(t && n && i.test(t) && i.test(n) && r());
13
+ return {
14
+ activationViewed: (n, r, i) => {
15
+ !a() || !Number.isSafeInteger(n) || !Number.isSafeInteger(r) || r < 1 || r > 20 || n < 0 || n > r || e("semanticfed.activation.viewed", {
16
+ workspaceId: t,
17
+ completedCount: n,
18
+ totalCount: r,
19
+ demoDataPresent: i
20
+ });
21
+ },
22
+ demoSeeded: (n) => {
23
+ a() && n === !0 && e("semanticfed.activation.demo_seeded", {
24
+ workspaceId: t,
25
+ created: !0
26
+ });
27
+ },
28
+ runRequested: () => {
29
+ a() && e("semanticfed.query.run_requested", {
30
+ workspaceId: t,
31
+ surface: "query_console"
32
+ });
33
+ },
34
+ sqlExecuted: (n, r) => {
35
+ !a() || !Number.isSafeInteger(n) || n < 0 || typeof r != "boolean" || e("semanticfed.sql.executed", {
36
+ workspaceId: t,
37
+ rowCountBucket: n === 0 ? "empty" : n === 1 ? "one" : n <= 20 ? "few" : "many",
38
+ truncated: r
39
+ });
40
+ },
41
+ sqlFailed: (n) => {
42
+ if (!a()) return;
43
+ let r = n && typeof n == "object" && "code" in n ? n.code : void 0;
44
+ e("semanticfed.sql.failed", {
45
+ workspaceId: t,
46
+ failureClass: r === "BAD_USER_INPUT" || r === "GRAPHQL_VALIDATION_FAILED" ? "validation" : r === "FORBIDDEN" || r === "UNAUTHENTICATED" ? "authorization" : r === "NETWORK_ERROR" || r === "FETCH_FAILED" ? "transport" : r === "INTERNAL_SERVER_ERROR" || r === "TIMEOUT" || r === "QUERY_EXECUTION_FAILED" ? "execution" : "unknown"
47
+ });
48
+ }
49
+ };
50
+ }
51
+ export { e as createAnalyticsLease, t as createClientAnalytics };
52
+
53
+ //# sourceMappingURL=clientAnalytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientAnalytics.js","names":["createAnalyticsLease","active","createClientAnalytics","uuid","permitted","workspaceId","actorId","isCurrent","completedCount","totalCount","emit","created","rowCount","truncated","code","error"],"sources":["../../../src/semanticfed/api/clientAnalytics.ts"],"sourcesContent":["import type { EventBus } from '@burdenoff/fe-libs/shared/events';\n\n/** Each committed mount/context owns one lease; old promises never reactivate it. */\nexport function createAnalyticsLease() {\n let active = false;\n return {\n isActive: () => active,\n activate: () => {\n active = true;\n return () => {\n active = false;\n };\n },\n };\n}\n\nexport function createClientAnalytics(\n emit: EventBus['emit'],\n workspaceId: string | undefined,\n actorId: string | undefined,\n isCurrent: () => boolean\n) {\n const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n const permitted = () =>\n Boolean(workspaceId && actorId && uuid.test(workspaceId) && uuid.test(actorId) && isCurrent());\n return {\n activationViewed: (completedCount: number, totalCount: number, demoDataPresent: boolean) => {\n if (\n !permitted() ||\n !Number.isSafeInteger(completedCount) ||\n !Number.isSafeInteger(totalCount) ||\n totalCount < 1 ||\n totalCount > 20 ||\n completedCount < 0 ||\n completedCount > totalCount\n )\n return;\n emit('semanticfed.activation.viewed', {\n workspaceId,\n completedCount,\n totalCount,\n demoDataPresent,\n });\n },\n demoSeeded: (created: boolean) => {\n if (permitted() && created === true)\n emit('semanticfed.activation.demo_seeded', { workspaceId, created: true });\n },\n runRequested: () => {\n if (permitted())\n emit('semanticfed.query.run_requested', { workspaceId, surface: 'query_console' });\n },\n sqlExecuted: (rowCount: number, truncated: boolean) => {\n if (\n !permitted() ||\n !Number.isSafeInteger(rowCount) ||\n rowCount < 0 ||\n typeof truncated !== 'boolean'\n )\n return;\n const rowCountBucket =\n rowCount === 0 ? 'empty' : rowCount === 1 ? 'one' : rowCount <= 20 ? 'few' : 'many';\n emit('semanticfed.sql.executed', { workspaceId, rowCountBucket, truncated });\n },\n sqlFailed: (error: unknown) => {\n if (!permitted()) return;\n const code = error && typeof error === 'object' && 'code' in error ? error.code : undefined;\n const failureClass =\n code === 'BAD_USER_INPUT' || code === 'GRAPHQL_VALIDATION_FAILED'\n ? 'validation'\n : code === 'FORBIDDEN' || code === 'UNAUTHENTICATED'\n ? 'authorization'\n : code === 'NETWORK_ERROR' || code === 'FETCH_FAILED'\n ? 'transport'\n : code === 'INTERNAL_SERVER_ERROR' ||\n code === 'TIMEOUT' ||\n code === 'QUERY_EXECUTION_FAILED'\n ? 'execution'\n : 'unknown';\n emit('semanticfed.sql.failed', { workspaceId, failureClass });\n },\n };\n}\n"],"mappings":";AAGA,SAAgBA,IAAuB;CACrC,IAAIC,IAAS;CACb,OAAO;EACL,gBAAgBA;EAChB,iBACE,IAAS,UACI;GACX,IAAS;EACX;CAEJ;AACF;AAEA,SAAgBC,EACd,GACA,GACA,GACA,GACA;CACA,IAAMC,IAAO,mEACPC,UACJ,GAAQC,KAAeC,KAAWH,EAAK,KAAKE,CAAW,KAAKF,EAAK,KAAKG,CAAO,KAAKC,EAAU;CAC9F,OAAO;EACL,mBAAmB,GAAwB,GAAoB,MAA6B;GAC1F,AACE,CAACH,EAAU,KACX,CAAC,OAAO,cAAcI,CAAc,KACpC,CAAC,OAAO,cAAcC,CAAU,KAChCA,IAAa,KACbA,IAAa,MACbD,IAAiB,KACjBA,IAAiBC,KAGnBC,EAAK,iCAAiC;IACpC;IACA;IACA;IACA;GACF,CAAC;EACH;EACA,aAAa,MAAqB;GAChC,AAAIN,EAAU,KAAKO,MAAY,MAC7BD,EAAK,sCAAsC;IAAE;IAAa,SAAS;GAAK,CAAC;EAC7E;EACA,oBAAoB;GAClB,AAAIN,EAAU,KACZM,EAAK,mCAAmC;IAAE;IAAa,SAAS;GAAgB,CAAC;EACrF;EACA,cAAc,GAAkB,MAAuB;GACrD,AACE,CAACN,EAAU,KACX,CAAC,OAAO,cAAcQ,CAAQ,KAC9BA,IAAW,KACX,OAAOC,KAAc,aAKvBH,EAAK,4BAA4B;IAAE;IAAa,gBAD9CE,MAAa,IAAI,UAAUA,MAAa,IAAI,QAAQA,KAAY,KAAK,QAAQ;IACf;GAAU,CAAC;EAC7E;EACA,YAAY,MAAmB;GAC7B,IAAI,CAACR,EAAU,GAAG;GAClB,IAAMU,IAAOC,KAAS,OAAOA,KAAU,YAAY,UAAUA,IAAQA,EAAM,OAAO,KAAA;GAalF,EAAK,0BAA0B;IAAE;IAAa,cAX5CD,MAAS,oBAAoBA,MAAS,8BAClC,eACAA,MAAS,eAAeA,MAAS,oBAC/B,kBACAA,MAAS,mBAAmBA,MAAS,iBACnC,cACAA,MAAS,2BACPA,MAAS,aACTA,MAAS,2BACT,cACA;GAC+C,CAAC;EAC9D;CACF;AACF"}
@@ -0,0 +1,12 @@
1
+ /** Request-local authority; never persisted or included in query cache keys. */
2
+ export interface SemRequestScope {
3
+ apiGatewayUrl: string;
4
+ authToken: string;
5
+ actorId: string;
6
+ workspaceId: string;
7
+ tenantId?: string;
8
+ organizationId?: string;
9
+ projectId?: string;
10
+ workspaceToken?: string;
11
+ }
12
+ export declare function scopedSemResponse<T>(scope: SemRequestScope, query: string, variables: Record<string, unknown>, signal?: AbortSignal): Promise<import('@burdenoff/fe-libs/shared/graphql').GraphQLResponse<T>>;
@@ -0,0 +1,36 @@
1
+ import { getStoredOrganizationId as e, getStoredProjectId as t, graphqlFetchPinned as n, prepareWorkspaceRequest as r, resolveGatewayUrl as i } from "@burdenoff/fe-libs/shared/graphql";
2
+ // src/semanticfed/api/scopedRequest.ts
3
+ async function a(a, o, s, c) {
4
+ let l = { ...a }, u = () => {
5
+ if ((l.organizationId ?? null) !== (e() ?? null) || (l.projectId ?? null) !== (t() ?? null)) throw Error("The active context changed. Review the action again.");
6
+ };
7
+ u();
8
+ let d = await r({
9
+ url: i("workspace", l.apiGatewayUrl),
10
+ authToken: l.authToken,
11
+ actorId: l.actorId,
12
+ workspaceId: l.workspaceId,
13
+ tenantId: l.tenantId,
14
+ workspaceToken: l.workspaceToken,
15
+ currentQuery: o,
16
+ signal: c
17
+ });
18
+ u(), d.assertCurrent();
19
+ let f = await n({
20
+ gateway: "workspace",
21
+ baseUrl: l.apiGatewayUrl,
22
+ authToken: l.authToken,
23
+ workspaceToken: d.workspaceToken,
24
+ workspaceId: l.workspaceId,
25
+ organizationId: l.organizationId ?? !1,
26
+ tenantId: l.tenantId ?? !1,
27
+ projectId: l.projectId ?? !1,
28
+ query: o,
29
+ variables: s,
30
+ signal: c
31
+ });
32
+ return u(), d.assertCurrent(), f;
33
+ }
34
+ export { a as scopedSemResponse };
35
+
36
+ //# sourceMappingURL=scopedRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopedRequest.js","names":["scopedSemResponse","captured","scope","assertContext","getStoredOrganizationId","getStoredProjectId","prepared","prepareWorkspaceRequest","resolveGatewayUrl","query","response","graphqlFetchPinned"],"sources":["../../../src/semanticfed/api/scopedRequest.ts"],"sourcesContent":["import {\n getStoredOrganizationId,\n getStoredProjectId,\n graphqlFetchPinned,\n prepareWorkspaceRequest,\n resolveGatewayUrl,\n} from '@burdenoff/fe-libs/shared/graphql';\n\n/** Request-local authority; never persisted or included in query cache keys. */\nexport interface SemRequestScope {\n apiGatewayUrl: string;\n authToken: string;\n actorId: string;\n workspaceId: string;\n tenantId?: string;\n organizationId?: string;\n projectId?: string;\n workspaceToken?: string;\n}\n\nexport async function scopedSemResponse<T>(\n scope: SemRequestScope,\n query: string,\n variables: Record<string, unknown>,\n signal?: AbortSignal\n) {\n const captured = { ...scope };\n const assertContext = () => {\n if (\n (captured.organizationId ?? null) !== (getStoredOrganizationId() ?? null) ||\n (captured.projectId ?? null) !== (getStoredProjectId() ?? null)\n )\n throw new Error('The active context changed. Review the action again.');\n };\n assertContext();\n const prepared = await prepareWorkspaceRequest({\n url: resolveGatewayUrl('workspace', captured.apiGatewayUrl),\n authToken: captured.authToken,\n actorId: captured.actorId,\n workspaceId: captured.workspaceId,\n tenantId: captured.tenantId,\n workspaceToken: captured.workspaceToken,\n currentQuery: query,\n signal,\n });\n assertContext();\n prepared.assertCurrent();\n const response = await graphqlFetchPinned<T>({\n gateway: 'workspace',\n // The resolver above returns a full GraphQL endpoint; this option requires\n // the original host base, or the workspace path would be appended twice.\n baseUrl: captured.apiGatewayUrl,\n authToken: captured.authToken,\n workspaceToken: prepared.workspaceToken,\n workspaceId: captured.workspaceId,\n organizationId: captured.organizationId ?? false,\n tenantId: captured.tenantId ?? false,\n projectId: captured.projectId ?? false,\n query,\n variables,\n signal,\n });\n assertContext();\n prepared.assertCurrent();\n return response;\n}\n"],"mappings":";;AAoBA,eAAsBA,EACpB,GACA,GACA,GACA,GACA;CACA,IAAMC,IAAW,EAAE,GAAGC,EAAM,GACtBC,UAAsB;EAC1B,KACGF,EAAS,kBAAkB,WAAWG,EAAwB,KAAK,UACnEH,EAAS,aAAa,WAAWI,EAAmB,KAAK,OAE1D,MAAU,MAAM,sDAAsD;CAC1E;CACA,EAAc;CACd,IAAMC,IAAW,MAAMC,EAAwB;EAC7C,KAAKC,EAAkB,aAAaP,EAAS,aAAa;EAC1D,WAAWA,EAAS;EACpB,SAASA,EAAS;EAClB,aAAaA,EAAS;EACtB,UAAUA,EAAS;EACnB,gBAAgBA,EAAS;EACzB,cAAcQ;EACd;CACF,CAAC;CAED,AADAN,EAAc,GACdG,EAAS,cAAc;CACvB,IAAMI,IAAW,MAAMC,EAAsB;EAC3C,SAAS;EAGT,SAASV,EAAS;EAClB,WAAWA,EAAS;EACpB,gBAAgBK,EAAS;EACzB,aAAaL,EAAS;EACtB,gBAAgBA,EAAS,kBAAkB;EAC3C,UAAUA,EAAS,YAAY;EAC/B,WAAWA,EAAS,aAAa;EACjC;EACA;EACA;CACF,CAAC;CAGD,OAFAE,EAAc,GACdG,EAAS,cAAc,GAChBI;AACT"}
@@ -1,3 +1,4 @@
1
+ import { SemRequestScope } from './scopedRequest';
1
2
  export declare function clearGraphqlReadCaches(): void;
2
3
  /**
3
4
  * A GraphQL error returned by the gateway. `message` is the gateway's
@@ -11,4 +12,4 @@ export declare class SemRequestError extends Error {
11
12
  readonly detail: string | undefined;
12
13
  constructor(message: string, code: string | undefined, detail: string | undefined);
13
14
  }
14
- export declare function semRequest<TData>(query: string, variables?: Record<string, unknown>, baseUrl?: string): Promise<TData>;
15
+ export declare function semRequest<TData>(query: string, variables?: Record<string, unknown>, baseUrl?: string, scope?: SemRequestScope, signal?: AbortSignal): Promise<TData>;
@@ -1,34 +1,53 @@
1
- import { SemQuotaError as e, announceQuotaRefusal as t, findQuotaRefusal as n } from "./quotaRefusal.js";
2
- import { graphqlFetch as r } from "@burdenoff/fe-libs/shared/graphql";
1
+ import { scopedSemResponse as e } from "./scopedRequest.js";
2
+ import { SemQuotaError as t, announceQuotaRefusal as n, findQuotaRefusal as r } from "./quotaRefusal.js";
3
+ import { graphqlFetch as i } from "@burdenoff/fe-libs/shared/graphql";
3
4
  // src/semanticfed/api/semanticfedGraphql.ts
4
- function i() {
5
+ function a() {
5
6
  let e = globalThis;
6
7
  e.__graphqlFetchResponseCache?.clear(), e.__graphqlFetchPendingResponses?.clear(), e.__boffGraphQLResponseCache?.clear();
7
8
  }
8
- var a = class extends Error {
9
+ var o = class extends Error {
9
10
  code;
10
11
  detail;
11
12
  constructor(e, t, n) {
12
13
  super(e), this.name = "SemRequestError", this.code = t, this.detail = n;
13
14
  }
14
15
  };
15
- async function o(o, s = {}, c) {
16
- let l = await r({
17
- gateway: "workspace",
18
- baseUrl: c,
19
- query: o,
20
- variables: s,
21
- workspaceToken: !0
22
- });
23
- if (l.errors?.length) {
24
- let r = n(l.errors);
25
- if (r) throw t(r), new e(l.errors[0]?.message ?? "Plan limit reached", r);
26
- let i = l.errors[0], o = i && typeof i == "object" && "extensions" in i && i.extensions ? i.extensions : {};
27
- throw new a(i?.message ?? "GraphQL request failed", typeof o.code == "string" ? o.code : void 0, typeof o.technicalMessage == "string" ? o.technicalMessage : void 0);
16
+ function s(e) {
17
+ if (!e || typeof e != "object" || !("errors" in e) || !Array.isArray(e.errors)) return [];
18
+ let t = [], n = e.errors;
19
+ for (let e of n) {
20
+ if (!e || typeof e != "object") continue;
21
+ let n = {};
22
+ "message" in e && typeof e.message == "string" && (n.message = e.message), "extensions" in e && e.extensions && typeof e.extensions == "object" && !Array.isArray(e.extensions) && (n.extensions = Object.fromEntries(Object.entries(e.extensions))), t.push(n);
28
23
  }
29
- if (!l.data) throw Error("GraphQL response did not include data");
30
- return /^\s*mutation\b/.test(o) && i(), l.data;
24
+ return t;
31
25
  }
32
- export { a as SemRequestError, i as clearGraphqlReadCaches, o as semRequest };
26
+ function c(e) {
27
+ let i = r(e);
28
+ if (i) throw n(i), new t(e[0]?.message ?? "Plan limit reached", i);
29
+ let a = e[0];
30
+ throw new o(a?.message ?? "GraphQL request failed", typeof a?.extensions?.code == "string" ? a.extensions.code : void 0, typeof a?.extensions?.technicalMessage == "string" ? a.extensions.technicalMessage : void 0);
31
+ }
32
+ async function l(t, n = {}, r, o, l) {
33
+ try {
34
+ let a = o ? await e(o, t, n, l) : await i({
35
+ gateway: "workspace",
36
+ baseUrl: r,
37
+ query: t,
38
+ variables: n,
39
+ workspaceToken: !0,
40
+ signal: l
41
+ }), u = s(a);
42
+ if (u.length && c(u), !a.data) throw Error("GraphQL response did not include data");
43
+ return a.data;
44
+ } catch (e) {
45
+ let t = s(e);
46
+ throw t.length && c(t), e;
47
+ } finally {
48
+ /^\s*mutation\b/.test(t) && a();
49
+ }
50
+ }
51
+ export { o as SemRequestError, a as clearGraphqlReadCaches, l as semRequest };
33
52
 
34
53
  //# sourceMappingURL=semanticfedGraphql.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semanticfedGraphql.js","names":["clearGraphqlReadCaches","g","SemRequestError","message","code","detail","semRequest","response","graphqlFetch","refusal","findQuotaRefusal","announceQuotaRefusal","SemQuotaError","first","extensions","query"],"sources":["../../../src/semanticfed/api/semanticfedGraphql.ts"],"sourcesContent":["/**\n * SemanticFed GraphQL transport.\n *\n * Every call goes to the workspace gateway with a workspace-scoped token,\n * both supplied by the host shell (`graphqlFetch({ gateway: 'workspace',\n * workspaceToken: true })`). Operations are inline documents whose fields\n * match the `wspace-semanticfed-svc` subgraph schema exactly.\n */\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { announceQuotaRefusal, findQuotaRefusal, SemQuotaError } from './quotaRefusal';\n\n/**\n * fe-libs `graphqlFetch` coalesces query responses in short-lived in-memory\n * caches. A read issued right after a write would otherwise return the\n * pre-mutation response, so every mutation clears those caches.\n */\ntype GraphqlReadCacheGlobals = {\n __graphqlFetchResponseCache?: { clear: () => void };\n __graphqlFetchPendingResponses?: { clear: () => void };\n __boffGraphQLResponseCache?: { clear: () => void };\n};\n\nexport function clearGraphqlReadCaches(): void {\n const g = globalThis as GraphqlReadCacheGlobals;\n g.__graphqlFetchResponseCache?.clear();\n g.__graphqlFetchPendingResponses?.clear();\n g.__boffGraphQLResponseCache?.clear();\n}\n\n/**\n * A GraphQL error returned by the gateway. `message` is the gateway's\n * user-facing text, which it generalises for client errors (\"Please check the\n * information and try again.\"); `detail` carries the service's own\n * explanation (`extensions.technicalMessage`), which surfaces such as the SQL\n * console show because it names the exact problem (BOFF-4271).\n */\nexport class SemRequestError extends Error {\n readonly code: string | undefined;\n readonly detail: string | undefined;\n\n constructor(message: string, code: string | undefined, detail: string | undefined) {\n super(message);\n this.name = 'SemRequestError';\n this.code = code;\n this.detail = detail;\n }\n}\n\nexport async function semRequest<TData>(\n query: string,\n variables: Record<string, unknown> = {},\n baseUrl?: string\n): Promise<TData> {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n // A plan-limit refusal (BOFF-3172) opens the shell's upgrade prompt and\n // throws a typed error, so callers can tell it apart from a failure.\n const refusal = findQuotaRefusal(response.errors);\n if (refusal) {\n announceQuotaRefusal(refusal);\n throw new SemQuotaError(response.errors[0]?.message ?? 'Plan limit reached', refusal);\n }\n const first = response.errors[0];\n const extensions: Record<string, unknown> =\n first && typeof first === 'object' && 'extensions' in first && first.extensions\n ? (first.extensions as Record<string, unknown>)\n : {};\n throw new SemRequestError(\n first?.message ?? 'GraphQL request failed',\n typeof extensions.code === 'string' ? extensions.code : undefined,\n typeof extensions.technicalMessage === 'string' ? extensions.technicalMessage : undefined\n );\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlReadCaches();\n }\n return response.data;\n}\n"],"mappings":";;;AAuBA,SAAgBA,IAA+B;CAC7C,IAAMC,IAAI;CAGV,AAFAA,EAAE,6BAA6B,MAAM,GACrCA,EAAE,gCAAgC,MAAM,GACxCA,EAAE,4BAA4B,MAAM;AACtC;AASA,IAAaC,IAAb,cAAqC,MAAM;CACzC;CACA;CAEA,YAAY,GAAiB,GAA0B,GAA4B;EAIjF,AAHA,MAAMC,CAAO,GACb,KAAK,OAAO,mBACZ,KAAK,OAAOC,GACZ,KAAK,SAASC;CAChB;AACF;AAEA,eAAsBC,EACpB,GACA,IAAqC,CAAC,GACtC,GACgB;CAChB,IAAMC,IAAW,MAAMC,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;CAClB,CAAC;CAED,IAAID,EAAS,QAAQ,QAAQ;EAG3B,IAAME,IAAUC,EAAiBH,EAAS,MAAM;EAChD,IAAIE,GAEF,MADAE,EAAqBF,CAAO,GACtB,IAAIG,EAAcL,EAAS,OAAO,EAAE,EAAE,WAAW,sBAAsBE,CAAO;EAEtF,IAAMI,IAAQN,EAAS,OAAO,IACxBO,IACJD,KAAS,OAAOA,KAAU,YAAY,gBAAgBA,KAASA,EAAM,aAChEA,EAAM,aACP,CAAC;EACP,MAAM,IAAIX,EACRW,GAAO,WAAW,0BAClB,OAAOC,EAAW,QAAS,WAAWA,EAAW,OAAO,KAAA,GACxD,OAAOA,EAAW,oBAAqB,WAAWA,EAAW,mBAAmB,KAAA,CAClF;CACF;CACA,IAAI,CAACP,EAAS,MACZ,MAAU,MAAM,uCAAuC;CAKzD,OAHI,iBAAiB,KAAKQ,CAAK,KAC7Bf,EAAuB,GAElBO,EAAS;AAClB"}
1
+ {"version":3,"file":"semanticfedGraphql.js","names":["clearGraphqlReadCaches","g","SemRequestError","message","code","detail","requestErrors","value","result","rawErrors","raw","item","throwRequestErrors","refusal","findQuotaRefusal","errors","announceQuotaRefusal","SemQuotaError","first","semRequest","response","scope","scopedSemResponse","query","variables","signal","graphqlFetch","error"],"sources":["../../../src/semanticfed/api/semanticfedGraphql.ts"],"sourcesContent":["/**\n * SemanticFed GraphQL transport.\n *\n * Every call goes to the workspace gateway with a workspace-scoped token,\n * both supplied by the host shell (`graphqlFetch({ gateway: 'workspace',\n * workspaceToken: true })`). Operations are inline documents whose fields\n * match the `wspace-semanticfed-svc` subgraph schema exactly.\n */\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { scopedSemResponse, type SemRequestScope } from './scopedRequest';\n\nimport { announceQuotaRefusal, findQuotaRefusal, SemQuotaError } from './quotaRefusal';\n\n/**\n * fe-libs `graphqlFetch` coalesces query responses in short-lived in-memory\n * caches. A read issued right after a write would otherwise return the\n * pre-mutation response, so every mutation clears those caches.\n */\ntype GraphqlReadCacheGlobals = {\n __graphqlFetchResponseCache?: { clear: () => void };\n __graphqlFetchPendingResponses?: { clear: () => void };\n __boffGraphQLResponseCache?: { clear: () => void };\n};\n\nexport function clearGraphqlReadCaches(): void {\n const g = globalThis as GraphqlReadCacheGlobals;\n g.__graphqlFetchResponseCache?.clear();\n g.__graphqlFetchPendingResponses?.clear();\n g.__boffGraphQLResponseCache?.clear();\n}\n\n/**\n * A GraphQL error returned by the gateway. `message` is the gateway's\n * user-facing text, which it generalises for client errors (\"Please check the\n * information and try again.\"); `detail` carries the service's own\n * explanation (`extensions.technicalMessage`), which surfaces such as the SQL\n * console show because it names the exact problem (BOFF-4271).\n */\nexport class SemRequestError extends Error {\n readonly code: string | undefined;\n readonly detail: string | undefined;\n\n constructor(message: string, code: string | undefined, detail: string | undefined) {\n super(message);\n this.name = 'SemRequestError';\n this.code = code;\n this.detail = detail;\n }\n}\n\ninterface RequestErrorDetail {\n message?: string;\n extensions?: Record<string, unknown>;\n}\n\nfunction requestErrors(value: unknown): RequestErrorDetail[] {\n if (!value || typeof value !== 'object' || !('errors' in value) || !Array.isArray(value.errors))\n return [];\n const result: RequestErrorDetail[] = [];\n const rawErrors: readonly unknown[] = value.errors;\n for (const raw of rawErrors) {\n if (!raw || typeof raw !== 'object') continue;\n const item: RequestErrorDetail = {};\n if ('message' in raw && typeof raw.message === 'string') item.message = raw.message;\n if (\n 'extensions' in raw &&\n raw.extensions &&\n typeof raw.extensions === 'object' &&\n !Array.isArray(raw.extensions)\n )\n item.extensions = Object.fromEntries(Object.entries(raw.extensions));\n result.push(item);\n }\n return result;\n}\n\nfunction throwRequestErrors(errors: RequestErrorDetail[]): never {\n const refusal = findQuotaRefusal(errors);\n if (refusal) {\n announceQuotaRefusal(refusal);\n throw new SemQuotaError(errors[0]?.message ?? 'Plan limit reached', refusal);\n }\n const first = errors[0];\n throw new SemRequestError(\n first?.message ?? 'GraphQL request failed',\n typeof first?.extensions?.code === 'string' ? first.extensions.code : undefined,\n typeof first?.extensions?.technicalMessage === 'string'\n ? first.extensions.technicalMessage\n : undefined\n );\n}\n\nexport async function semRequest<TData>(\n query: string,\n variables: Record<string, unknown> = {},\n baseUrl?: string,\n scope?: SemRequestScope,\n signal?: AbortSignal\n): Promise<TData> {\n try {\n const response = scope\n ? await scopedSemResponse<TData>(scope, query, variables, signal)\n : await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n signal,\n });\n const errors = requestErrors(response);\n if (errors.length) throwRequestErrors(errors);\n if (!response.data) throw new Error('GraphQL response did not include data');\n return response.data;\n } catch (error: unknown) {\n // Pinned HTTP refusals can throw before returning a GraphQL envelope. Keep\n // the same quota upgrade prompt and technical error classification there.\n const errors = requestErrors(error);\n if (errors.length) throwRequestErrors(errors);\n throw error;\n } finally {\n // A lost response or context switch may follow a committed mutation. Clear\n // cached reads on every outcome, without retrying that mutation.\n if (/^\\s*mutation\\b/.test(query)) clearGraphqlReadCaches();\n }\n}\n"],"mappings":";;;;AAwBA,SAAgBA,IAA+B;CAC7C,IAAMC,IAAI;CAGV,AAFAA,EAAE,6BAA6B,MAAM,GACrCA,EAAE,gCAAgC,MAAM,GACxCA,EAAE,4BAA4B,MAAM;AACtC;AASA,IAAaC,IAAb,cAAqC,MAAM;CACzC;CACA;CAEA,YAAY,GAAiB,GAA0B,GAA4B;EAIjF,AAHA,MAAMC,CAAO,GACb,KAAK,OAAO,mBACZ,KAAK,OAAOC,GACZ,KAAK,SAASC;CAChB;AACF;AAOA,SAASC,EAAc,GAAsC;CAC3D,IAAI,CAACC,KAAS,OAAOA,KAAU,YAAY,EAAE,YAAYA,MAAU,CAAC,MAAM,QAAQA,EAAM,MAAM,GAC5F,OAAO,CAAC;CACV,IAAMC,IAA+B,CAAC,GAChCC,IAAgCF,EAAM;CAC5C,KAAK,IAAMG,KAAOD,GAAW;EAC3B,IAAI,CAACC,KAAO,OAAOA,KAAQ,UAAU;EACrC,IAAMC,IAA2B,CAAC;EASlC,AARI,aAAaD,KAAO,OAAOA,EAAI,WAAY,aAAU,EAAK,UAAUA,EAAI,UAE1E,gBAAgBA,KAChBA,EAAI,cACJ,OAAOA,EAAI,cAAe,YAC1B,CAAC,MAAM,QAAQA,EAAI,UAAU,MAE7B,EAAK,aAAa,OAAO,YAAY,OAAO,QAAQA,EAAI,UAAU,CAAC,IACrEF,EAAO,KAAKG,CAAI;CAClB;CACA,OAAOH;AACT;AAEA,SAASI,EAAmB,GAAqC;CAC/D,IAAMC,IAAUC,EAAiBC,CAAM;CACvC,IAAIF,GAEF,MADAG,EAAqBH,CAAO,GACtB,IAAII,EAAcF,EAAO,EAAE,EAAE,WAAW,sBAAsBF,CAAO;CAE7E,IAAMK,IAAQH,EAAO;CACrB,MAAM,IAAIb,EACRgB,GAAO,WAAW,0BAClB,OAAOA,GAAO,YAAY,QAAS,WAAWA,EAAM,WAAW,OAAO,KAAA,GACtE,OAAOA,GAAO,YAAY,oBAAqB,WAC3CA,EAAM,WAAW,mBACjB,KAAA,CACN;AACF;AAEA,eAAsBC,EACpB,GACA,IAAqC,CAAC,GACtC,GACA,GACA,GACgB;CAChB,IAAI;EACF,IAAMC,IAAWC,IACb,MAAMC,EAAyBD,GAAOE,GAAOC,GAAWC,CAAM,IAC9D,MAAMC,EAAoB;GACxB,SAAS;GACT;GACA;GACA;GACA,gBAAgB;GAChB;EACF,CAAC,GACCX,IAAST,EAAcc,CAAQ;EAErC,IADIL,EAAO,UAAQH,EAAmBG,CAAM,GACxC,CAACK,EAAS,MAAM,MAAU,MAAM,uCAAuC;EAC3E,OAAOA,EAAS;CAClB,SAASO,GAAgB;EAGvB,IAAMZ,IAAST,EAAcqB,CAAK;EAElC,MADIZ,EAAO,UAAQH,EAAmBG,CAAM,GACtCY;CACR,UAAU;EAGR,AAAI,iBAAiB,KAAKJ,CAAK,KAAGvB,EAAuB;CAC3D;AACF"}
@@ -1,16 +1,17 @@
1
- import { useTr as e } from "../hooks/useTr.js";
2
- import { useSemOnboardingProgress as t, useSemRemoveWorkspaceDemoData as n, useSemSeedWorkspaceDemoData as r } from "../hooks/useOnboarding.js";
3
- import { useState as i } from "react";
4
- import { BarChart3 as a, CheckCircle2 as o, ChevronDown as s, ChevronUp as c, Circle as l, Database as u, FileCode2 as d, Loader2 as f, Plug as p, Shield as m, Sparkles as h, Terminal as g, Trash2 as _ } from "lucide-react";
5
- import { Link as v } from "react-router-dom";
6
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
7
- import { Badge as x, Button as S, Card as C, CardContent as w, CardHeader as T, CardTitle as E } from "@burdenoff/fe-libs/ui";
1
+ import { useClientAnalytics as e } from "../hooks/useClientAnalytics.js";
2
+ import { useTr as t } from "../hooks/useTr.js";
3
+ import { useSemOnboardingProgress as n, useSemRemoveWorkspaceDemoData as r, useSemSeedWorkspaceDemoData as i } from "../hooks/useOnboarding.js";
4
+ import { useEffect as a, useRef as o, useState as s } from "react";
5
+ import { BarChart3 as c, CheckCircle2 as l, ChevronDown as u, ChevronUp as d, Circle as f, Database as p, FileCode2 as m, Loader2 as h, Plug as g, Shield as _, Sparkles as v, Terminal as y, Trash2 as b } from "lucide-react";
6
+ import { Link as x } from "react-router-dom";
7
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
+ import { Badge as w, Button as T, Card as E, CardContent as D, CardHeader as O, CardTitle as k } from "@burdenoff/fe-libs/ui";
8
9
  // src/semanticfed/components/OnboardingChecklist.tsx
9
- var D = [
10
+ var A = [
10
11
  {
11
12
  key: "REGISTER_CONNECTOR",
12
13
  path: "registry",
13
- icon: p,
14
+ icon: g,
14
15
  labelKey: "semanticfed.onboarding.steps.registerConnector.label",
15
16
  label: "Register a connector",
16
17
  descriptionKey: "semanticfed.onboarding.steps.registerConnector.description",
@@ -19,7 +20,7 @@ var D = [
19
20
  {
20
21
  key: "ADD_DATA_SOURCE",
21
22
  path: "topology",
22
- icon: u,
23
+ icon: p,
23
24
  labelKey: "semanticfed.onboarding.steps.addDataSource.label",
24
25
  label: "Add a data source",
25
26
  descriptionKey: "semanticfed.onboarding.steps.addDataSource.description",
@@ -28,7 +29,7 @@ var D = [
28
29
  {
29
30
  key: "CREATE_MODEL",
30
31
  path: "ontology",
31
- icon: d,
32
+ icon: m,
32
33
  labelKey: "semanticfed.onboarding.steps.createModel.label",
33
34
  label: "Create a semantic model",
34
35
  descriptionKey: "semanticfed.onboarding.steps.createModel.description",
@@ -37,7 +38,7 @@ var D = [
37
38
  {
38
39
  key: "DEFINE_METRIC",
39
40
  path: "ontology",
40
- icon: a,
41
+ icon: c,
41
42
  labelKey: "semanticfed.onboarding.steps.defineMetric.label",
42
43
  label: "Define a metric",
43
44
  descriptionKey: "semanticfed.onboarding.steps.defineMetric.description",
@@ -46,7 +47,7 @@ var D = [
46
47
  {
47
48
  key: "RUN_QUERY",
48
49
  path: "query-console",
49
- icon: g,
50
+ icon: y,
50
51
  labelKey: "semanticfed.onboarding.steps.runQuery.label",
51
52
  label: "Run a federated query",
52
53
  descriptionKey: "semanticfed.onboarding.steps.runQuery.description",
@@ -55,158 +56,165 @@ var D = [
55
56
  {
56
57
  key: "ADD_POLICY",
57
58
  path: "policies",
58
- icon: m,
59
+ icon: _,
59
60
  labelKey: "semanticfed.onboarding.steps.addPolicy.label",
60
61
  label: "Add an access policy",
61
62
  descriptionKey: "semanticfed.onboarding.steps.addPolicy.description",
62
63
  description: "Control who can read which rows, columns and entities on every query."
63
64
  }
64
- ], O = (e) => `semanticfed-onboarding-step-${e.toLowerCase().replace(/_/g, "-")}`, k = () => {
65
- let a = e(), u = t(), d = r(), p = n(), [m, g] = i(!1);
66
- if (u.fetchStatus === "idle" && u.status === "pending") return null;
67
- if (u.isPending) return /* @__PURE__ */ y(C, {
65
+ ], j = (e) => `semanticfed-onboarding-step-${e.toLowerCase().replace(/_/g, "-")}`, M = () => {
66
+ let c = t(), p = n(), m = i(), g = r(), [_, y] = s(!1), M = e(), N = o(null);
67
+ if (a(() => {
68
+ !p.data || p.isFetching || p.isError || N.current === M || (N.current = M, M.activationViewed(p.data.completedCount, p.data.totalCount, p.data.demoDataPresent));
69
+ }, [
70
+ M,
71
+ p.data,
72
+ p.isFetching,
73
+ p.isError
74
+ ]), p.fetchStatus === "idle" && p.status === "pending") return null;
75
+ if (p.isPending) return /* @__PURE__ */ S(E, {
68
76
  "data-tour": "semanticfed-onboarding-checklist",
69
77
  "aria-busy": "true",
70
- children: /* @__PURE__ */ b(w, {
78
+ children: /* @__PURE__ */ C(D, {
71
79
  className: "flex items-center gap-2 py-6 text-sm text-muted-foreground",
72
- children: [/* @__PURE__ */ y(f, { className: "h-4 w-4 animate-spin" }), a("semanticfed.onboarding.loading", "Loading your getting-started checklist…")]
80
+ children: [/* @__PURE__ */ S(h, { className: "h-4 w-4 animate-spin" }), c("semanticfed.onboarding.loading", "Loading your getting-started checklist…")]
73
81
  })
74
82
  });
75
- if (u.isError) return /* @__PURE__ */ y(C, {
83
+ if (p.isError) return /* @__PURE__ */ S(E, {
76
84
  "data-tour": "semanticfed-onboarding-checklist",
77
- children: /* @__PURE__ */ b(w, {
85
+ children: /* @__PURE__ */ C(D, {
78
86
  className: "flex flex-wrap items-center justify-between gap-3 py-6",
79
- children: [/* @__PURE__ */ y("p", {
87
+ children: [/* @__PURE__ */ S("p", {
80
88
  className: "text-sm text-muted-foreground",
81
- children: a("semanticfed.onboarding.loadError", "The getting-started checklist could not be loaded.")
82
- }), /* @__PURE__ */ y(S, {
89
+ children: c("semanticfed.onboarding.loadError", "The getting-started checklist could not be loaded.")
90
+ }), /* @__PURE__ */ S(T, {
83
91
  variant: "outline",
84
92
  size: "sm",
85
- onClick: () => void u.refetch(),
86
- children: a("semanticfed.onboarding.retry", "Try again")
93
+ onClick: () => void p.refetch(),
94
+ children: c("semanticfed.onboarding.retry", "Try again")
87
95
  })]
88
96
  })
89
97
  });
90
- let k = u.data, A = new Map(k.steps.map((e) => [e.key, e.completed])), j = k.totalCount > 0 ? Math.round(k.completedCount / k.totalCount * 100) : 0, M = k.completedCount === 0 && !k.demoDataPresent, N = d.isPending || p.isPending, P = d.error ?? p.error;
91
- return /* @__PURE__ */ b(C, {
98
+ let P = p.data, F = new Map(P.steps.map((e) => [e.key, e.completed])), I = P.totalCount > 0 ? Math.round(P.completedCount / P.totalCount * 100) : 0, L = P.completedCount === 0 && !P.demoDataPresent, R = m.isPending || g.isPending, z = m.error ?? g.error;
99
+ return /* @__PURE__ */ C(E, {
92
100
  "data-tour": "semanticfed-onboarding-checklist",
93
101
  "data-testid": "semanticfed-onboarding-checklist",
94
- children: [/* @__PURE__ */ b(T, {
102
+ children: [/* @__PURE__ */ C(O, {
95
103
  className: "flex flex-row items-start justify-between gap-4 space-y-0",
96
- children: [/* @__PURE__ */ b("div", {
104
+ children: [/* @__PURE__ */ C("div", {
97
105
  className: "space-y-1",
98
- children: [/* @__PURE__ */ y(E, {
106
+ children: [/* @__PURE__ */ S(k, {
99
107
  className: "text-base",
100
- children: k.isComplete ? a("semanticfed.onboarding.titleComplete", "You have completed getting started") : a("semanticfed.onboarding.title", "Get started with SemanticFed")
101
- }), /* @__PURE__ */ y("p", {
108
+ children: P.isComplete ? c("semanticfed.onboarding.titleComplete", "You have completed getting started") : c("semanticfed.onboarding.title", "Get started with SemanticFed")
109
+ }), /* @__PURE__ */ S("p", {
102
110
  className: "text-sm text-muted-foreground",
103
- children: M ? a("semanticfed.onboarding.emptyDescription", "Your workspace has no sources yet. Work through these steps, or load the demo workspace to explore first.") : a("semanticfed.onboarding.description", "{{completed}} of {{total}} steps done. Steps tick off automatically as you create things.", {
104
- completed: k.completedCount,
105
- total: k.totalCount
111
+ children: L ? c("semanticfed.onboarding.emptyDescription", "Your workspace has no sources yet. Work through these steps, or load the demo workspace to explore first.") : c("semanticfed.onboarding.description", "{{completed}} of {{total}} steps done. Steps tick off automatically as you create things.", {
112
+ completed: P.completedCount,
113
+ total: P.totalCount
106
114
  })
107
115
  })]
108
- }), /* @__PURE__ */ b("div", {
116
+ }), /* @__PURE__ */ C("div", {
109
117
  className: "flex items-center gap-2",
110
- children: [/* @__PURE__ */ y(x, {
111
- variant: k.isComplete ? "default" : "secondary",
112
- children: `${j}%`
113
- }), /* @__PURE__ */ b(S, {
118
+ children: [/* @__PURE__ */ S(w, {
119
+ variant: P.isComplete ? "default" : "secondary",
120
+ children: `${I}%`
121
+ }), /* @__PURE__ */ C(T, {
114
122
  variant: "ghost",
115
123
  size: "sm",
116
- "aria-expanded": !m,
124
+ "aria-expanded": !_,
117
125
  "aria-controls": "semanticfed-onboarding-body",
118
- onClick: () => g((e) => !e),
119
- children: [y(m ? s : c, { className: "h-4 w-4" }), /* @__PURE__ */ y("span", {
126
+ onClick: () => y((e) => !e),
127
+ children: [S(_ ? u : d, { className: "h-4 w-4" }), /* @__PURE__ */ S("span", {
120
128
  className: "sr-only",
121
- children: m ? a("semanticfed.onboarding.expand", "Show checklist") : a("semanticfed.onboarding.collapse", "Hide checklist")
129
+ children: _ ? c("semanticfed.onboarding.expand", "Show checklist") : c("semanticfed.onboarding.collapse", "Hide checklist")
122
130
  })]
123
131
  })]
124
132
  })]
125
- }), !m && /* @__PURE__ */ b(w, {
133
+ }), !_ && /* @__PURE__ */ C(D, {
126
134
  id: "semanticfed-onboarding-body",
127
135
  className: "space-y-4",
128
136
  children: [
129
- /* @__PURE__ */ y("div", {
137
+ /* @__PURE__ */ S("div", {
130
138
  className: "h-2 w-full overflow-hidden rounded-full bg-muted",
131
139
  role: "progressbar",
132
140
  "aria-valuemin": 0,
133
141
  "aria-valuemax": 100,
134
- "aria-valuenow": j,
135
- "aria-label": a("semanticfed.onboarding.progressLabel", "Getting-started progress"),
136
- children: /* @__PURE__ */ y("div", {
142
+ "aria-valuenow": I,
143
+ "aria-label": c("semanticfed.onboarding.progressLabel", "Getting-started progress"),
144
+ children: /* @__PURE__ */ S("div", {
137
145
  className: "h-full rounded-full bg-primary transition-all",
138
- style: { width: `${j}%` }
146
+ style: { width: `${I}%` }
139
147
  })
140
148
  }),
141
- /* @__PURE__ */ y("ol", {
149
+ /* @__PURE__ */ S("ol", {
142
150
  className: "grid gap-2 md:grid-cols-2",
143
151
  "data-tour": "semanticfed-onboarding-steps",
144
- children: D.map((e) => {
145
- let t = A.get(e.key) ?? !1, n = e.icon;
146
- return /* @__PURE__ */ y("li", {
147
- "data-tour": O(e.key),
148
- children: /* @__PURE__ */ b(v, {
152
+ children: A.map((e) => {
153
+ let t = F.get(e.key) ?? !1, n = e.icon;
154
+ return /* @__PURE__ */ S("li", {
155
+ "data-tour": j(e.key),
156
+ children: /* @__PURE__ */ C(x, {
149
157
  to: e.path,
150
158
  className: "flex h-full items-start gap-3 rounded-md border p-3 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
151
- "aria-label": `${a(e.labelKey, e.label)}${t ? ` — ${a("semanticfed.onboarding.stepDone", "done")}` : ""}`,
152
- children: [t ? /* @__PURE__ */ y(o, {
159
+ "aria-label": `${c(e.labelKey, e.label)}${t ? ` — ${c("semanticfed.onboarding.stepDone", "done")}` : ""}`,
160
+ children: [t ? /* @__PURE__ */ S(l, {
153
161
  className: "mt-0.5 h-5 w-5 shrink-0 text-primary",
154
162
  "aria-hidden": "true"
155
- }) : /* @__PURE__ */ y(l, {
163
+ }) : /* @__PURE__ */ S(f, {
156
164
  className: "mt-0.5 h-5 w-5 shrink-0 text-muted-foreground",
157
165
  "aria-hidden": "true"
158
- }), /* @__PURE__ */ b("span", {
166
+ }), /* @__PURE__ */ C("span", {
159
167
  className: "min-w-0 space-y-0.5",
160
- children: [/* @__PURE__ */ b("span", {
168
+ children: [/* @__PURE__ */ C("span", {
161
169
  className: "flex items-center gap-2 text-sm font-medium",
162
- children: [/* @__PURE__ */ y(n, {
170
+ children: [/* @__PURE__ */ S(n, {
163
171
  className: "h-4 w-4 text-muted-foreground",
164
172
  "aria-hidden": "true"
165
- }), /* @__PURE__ */ y("span", {
173
+ }), /* @__PURE__ */ S("span", {
166
174
  className: t ? "text-muted-foreground line-through" : void 0,
167
- children: a(e.labelKey, e.label)
175
+ children: c(e.labelKey, e.label)
168
176
  })]
169
- }), /* @__PURE__ */ y("span", {
177
+ }), /* @__PURE__ */ S("span", {
170
178
  className: "block text-xs text-muted-foreground",
171
- children: a(e.descriptionKey, e.description)
179
+ children: c(e.descriptionKey, e.description)
172
180
  })]
173
181
  })]
174
182
  })
175
183
  }, e.key);
176
184
  })
177
185
  }),
178
- /* @__PURE__ */ b("div", {
186
+ /* @__PURE__ */ C("div", {
179
187
  className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-dashed p-3",
180
188
  "data-tour": "semanticfed-onboarding-demo",
181
189
  children: [
182
- /* @__PURE__ */ b("div", {
190
+ /* @__PURE__ */ C("div", {
183
191
  className: "flex items-start gap-2",
184
- children: [/* @__PURE__ */ y(h, {
192
+ children: [/* @__PURE__ */ S(v, {
185
193
  className: "mt-0.5 h-4 w-4 shrink-0 text-primary",
186
194
  "aria-hidden": "true"
187
- }), /* @__PURE__ */ y("p", {
195
+ }), /* @__PURE__ */ S("p", {
188
196
  className: "text-sm text-muted-foreground",
189
- children: k.demoDataPresent ? a("semanticfed.onboarding.demo.present", "Demo data is loaded: a sample Postgres connector, a sales model and a saved query, all labelled \"Demo\". It does not count towards your checklist.") : a("semanticfed.onboarding.demo.absent", "Want to look around first? Load a small, clearly labelled demo workspace with a sample Postgres connector, a sales model and a saved query.")
197
+ children: P.demoDataPresent ? c("semanticfed.onboarding.demo.present", "Demo data is loaded: a sample Postgres connector, a sales model and a saved query, all labelled \"Demo\". It does not count towards your checklist.") : c("semanticfed.onboarding.demo.absent", "Want to look around first? Load a small, clearly labelled demo workspace with a sample Postgres connector, a sales model and a saved query.")
190
198
  })]
191
199
  }),
192
- k.demoDataPresent ? /* @__PURE__ */ b(S, {
200
+ P.demoDataPresent ? /* @__PURE__ */ C(T, {
193
201
  variant: "outline",
194
202
  size: "sm",
195
- disabled: N,
196
- onClick: () => p.mutate(),
203
+ disabled: R,
204
+ onClick: () => g.mutate(),
197
205
  "data-testid": "semanticfed-onboarding-remove-demo",
198
- children: [p.isPending ? /* @__PURE__ */ y(f, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ y(_, { className: "mr-2 h-4 w-4" }), a("semanticfed.onboarding.demo.remove", "Remove demo data")]
199
- }) : /* @__PURE__ */ b(S, {
206
+ children: [g.isPending ? /* @__PURE__ */ S(h, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(b, { className: "mr-2 h-4 w-4" }), c("semanticfed.onboarding.demo.remove", "Remove demo data")]
207
+ }) : /* @__PURE__ */ C(T, {
200
208
  size: "sm",
201
- disabled: N,
202
- onClick: () => d.mutate(),
209
+ disabled: R,
210
+ onClick: () => m.mutate(),
203
211
  "data-testid": "semanticfed-onboarding-seed-demo",
204
- children: [d.isPending ? /* @__PURE__ */ y(f, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ y(h, { className: "mr-2 h-4 w-4" }), a("semanticfed.onboarding.demo.load", "Load demo data")]
212
+ children: [m.isPending ? /* @__PURE__ */ S(h, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(v, { className: "mr-2 h-4 w-4" }), c("semanticfed.onboarding.demo.load", "Load demo data")]
205
213
  }),
206
- P && /* @__PURE__ */ y("p", {
214
+ z && /* @__PURE__ */ S("p", {
207
215
  className: "w-full text-sm text-destructive",
208
216
  role: "alert",
209
- children: a("semanticfed.onboarding.demo.error", "That did not work: {{message}}", { message: P.message })
217
+ children: c("semanticfed.onboarding.demo.error", "That did not work: {{message}}", { message: z.message })
210
218
  })
211
219
  ]
212
220
  })
@@ -214,6 +222,6 @@ var D = [
214
222
  })]
215
223
  });
216
224
  };
217
- export { k as OnboardingChecklist };
225
+ export { M as OnboardingChecklist };
218
226
 
219
227
  //# sourceMappingURL=OnboardingChecklist.js.map