@burdenoff/microfe-coolandlovely 2026.710.1 → 2026.713.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/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@
3
3
  * @module @burdenoff/microfe-coolandlovely
4
4
  */
5
5
  export * from './coolandlovely';
6
+ export { useSandboxAssistantTransport } from './services/createSandboxAssistantTransport';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC"}
package/dist/index.js CHANGED
@@ -4,4 +4,5 @@ import { formatDate as r, formatNumber as i, formatPrice as a, formatRelativeTim
4
4
  import { CoolAndLovelyRoot as c } from "./coolandlovely/CoolAndLovelyRoot.js";
5
5
  import { useCoolAndLovelyStore as l } from "./coolandlovely/store/coolandlovelyStore.js";
6
6
  import "./coolandlovely/index.js";
7
- export { e as CoolAndLovelyProvider, c as CoolAndLovelyRoot, n as cn, r as formatDate, i as formatNumber, a as formatPrice, o as formatRelativeTime, s as titleCase, t as useCoolAndLovely, l as useCoolAndLovelyStore };
7
+ import { useSandboxAssistantTransport as u } from "./services/createSandboxAssistantTransport.js";
8
+ export { e as CoolAndLovelyProvider, c as CoolAndLovelyRoot, n as cn, r as formatDate, i as formatNumber, a as formatPrice, o as formatRelativeTime, s as titleCase, t as useCoolAndLovely, l as useCoolAndLovelyStore, u as useSandboxAssistantTransport };
@@ -1,31 +1,13 @@
1
1
  /**
2
- * CoolAndLovely adapter for the shared fe-libs AssistantWidget.
2
+ * coolandlovely adapter for the shared fe-libs AssistantWidget transport.
3
3
  *
4
- * The floating widget (fe-libs, Layer 1) is backend-agnostic — it calls an
5
- * injected `AssistantTransport`. This hook builds a transport that reuses the
6
- * sandbox `api-calls` agent: it provisions/reuses a sandbox, opens a session,
7
- * dispatches the prompt async, then polls for the streamed answer. The agent
8
- * introspects the GraphQL schema and performs API calls on the user's behalf
9
- * using their workspace token, contextual to the current screen (via
10
- * `gatherPageContext`).
11
- *
12
- * This file is intentionally self-contained so the MFE can ship its transport
13
- * without depending on generated GraphQL operation files. All GraphQL
14
- * documents are declared inline with `gql` and executed through the workspace
15
- * Apollo client returned by `useGatewayClient('workspace')`.
16
- */
17
- /**
18
- * Locally-defined mirror of the fe-libs `AssistantTransport` contract.
19
- *
20
- * We intentionally do NOT import the type from `@burdenoff/fe-libs` here:
21
- * microfe's tsconfig maps `@burdenoff/fe-libs/*` to fe-libs *source*, so
22
- * vite-plugin-dts would rewrite a cross-package type used in this hook's
23
- * public signature to a broken source-relative path in the emitted `.d.ts`.
24
- * Structural typing makes this shape assignable to fe-libs' `AssistantTransport`
25
- * at the call site (coolandlovely-app's AppShell), which is where compatibility
26
- * is enforced — drift there fails the app type-check.
4
+ * The sandbox lifecycle + poll/stream loop now lives in
5
+ * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);
6
+ * this is a thin wrapper. The exported name/shape are unchanged so app-shell
7
+ * imports don't move. The public return type is a LOCALLY-declared structural
8
+ * mirror never re-export fe-libs types (vite-plugin-dts path rewriting).
27
9
  */
28
- export interface AssistantSendArgs {
10
+ interface AssistantSendArgs {
29
11
  prompt: string;
30
12
  onProgress: (partialText: string) => void;
31
13
  signal: AbortSignal;
@@ -34,11 +16,9 @@ export interface AssistantTransport {
34
16
  sendPrompt: (args: AssistantSendArgs) => Promise<{
35
17
  text: string;
36
18
  }>;
19
+ prewarm?: (level?: 'probe' | 'full') => void;
20
+ suspend?: () => void;
37
21
  }
38
- /**
39
- * Returns a memoized `AssistantTransport` wired to the CoolAndLovely sandbox
40
- * `api-calls` agent. The sandbox + session are cached in refs so follow-up
41
- * turns reuse the warm environment for the lifetime of the host shell.
42
- */
43
22
  export declare function useSandboxAssistantTransport(): AssistantTransport;
23
+ export {};
44
24
  //# sourceMappingURL=createSandboxAssistantTransport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../src/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAqjBD;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,kBAAkB,CA6GjE"}
1
+ {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../src/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,4BAA4B,IAAI,kBAAkB,CAMjE"}
@@ -0,0 +1,14 @@
1
+ import { gatherPageContext as e } from "../utils/pageContext.js";
2
+ import { useSandboxAssistantTransport as t } from "@burdenoff/fe-libs/shared/assistant";
3
+ //#region src/services/createSandboxAssistantTransport.ts
4
+ function n() {
5
+ return t({
6
+ product: "coolandlovely",
7
+ gatherPageContext: e,
8
+ enableCredits: !0
9
+ });
10
+ }
11
+ //#endregion
12
+ export { n as useSandboxAssistantTransport };
13
+
14
+ //# sourceMappingURL=createSandboxAssistantTransport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../src/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * coolandlovely adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\nimport { gatherPageContext } from '@/utils/pageContext';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'coolandlovely',\n gatherPageContext: gatherPageContext,\n enableCredits: true,\n });\n}\n"],"mappings":";;;AAyBA,SAAgB,IAAmD;AACjE,QAAO,EAAmB;EACxB,SAAS;EACU;EACnB,eAAe;EAChB,CAAC"}
@@ -0,0 +1,51 @@
1
+ //#region src/utils/pageContext.ts
2
+ function e() {
3
+ let e = window.location.href, t = window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home", r = n(window.location.pathname, window.location.search);
4
+ return {
5
+ currentUrl: e,
6
+ currentPage: t,
7
+ entityType: r.entityType,
8
+ entityId: r.entityId,
9
+ platform: "coolandlovely",
10
+ version: "2026.614.1",
11
+ viewportSize: `${window.innerWidth}x${window.innerHeight}`,
12
+ userAgent: navigator.userAgent,
13
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
14
+ };
15
+ }
16
+ function t(e, t) {
17
+ return t.match(e);
18
+ }
19
+ function n(e, n) {
20
+ let r = new URLSearchParams(n);
21
+ for (let [n, r] of [
22
+ [/^\/coolandlovely\/brands\/([^/]+)$/, "COOLANDLOVELY_BRAND"],
23
+ [/^\/coolandlovely\/collections\/([^/]+)$/, "COOLANDLOVELY_COLLECTION"],
24
+ [/^\/coolandlovely\/items\/([^/]+)$/, "COOLANDLOVELY_STYLE_ITEM"],
25
+ [/^\/coolandlovely\/looks\/([^/]+)$/, "COOLANDLOVELY_LOOK"],
26
+ [/^\/coolandlovely\/collaborations\/([^/]+)$/, "COOLANDLOVELY_COLLABORATION"],
27
+ [/^\/coolandlovely\/lookbooks\/([^/]+)$/, "COOLANDLOVELY_LOOKBOOK"]
28
+ ]) {
29
+ let i = t(n, e);
30
+ if (i) return {
31
+ entityType: r,
32
+ entityId: i[1],
33
+ metadata: { routePattern: n.source }
34
+ };
35
+ }
36
+ let i = r.get("tab") ?? (() => {
37
+ let t = e.split("/").filter(Boolean);
38
+ return t.length > 2 ? t[t.length - 1] : void 0;
39
+ })();
40
+ return {
41
+ activeTab: i ?? void 0,
42
+ metadata: {
43
+ ...i ? { activeTab: i } : {},
44
+ ...r.get("selectedCollectionId") ? { selectedCollectionId: r.get("selectedCollectionId") } : {}
45
+ }
46
+ };
47
+ }
48
+ //#endregion
49
+ export { e as gatherPageContext };
50
+
51
+ //# sourceMappingURL=pageContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageContext.js","names":[],"sources":["../../src/utils/pageContext.ts"],"sourcesContent":["/**\n * Page context gathering for the CoolAndLovely AI assistant.\n *\n * Captures the user's current browser context (URL, route, entity) so the\n * floating assistant can answer \"this page\" / \"current\" questions and run\n * operations scoped to the screen the user is looking at.\n */\n\nexport interface PageContext {\n currentUrl: string;\n currentPage: string;\n entityType?: string;\n entityId?: string;\n platform: string;\n version: string;\n viewportSize: string;\n userAgent: string;\n timestamp: string;\n}\n\ninterface ConversationContextShape {\n entityType?: string;\n entityId?: string;\n activeTab?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport function gatherPageContext(): PageContext {\n const url = window.location.href;\n const pathSegments = window.location.pathname.split('/').filter(Boolean);\n const currentPage = pathSegments.slice(0, 3).join('/') || 'home';\n const entity = resolveCoolAndLovelyConversationContext(\n window.location.pathname,\n window.location.search\n );\n\n return {\n currentUrl: url,\n currentPage,\n entityType: entity.entityType,\n entityId: entity.entityId,\n platform: 'coolandlovely',\n version: import.meta.env.VITE_APP_VERSION ?? '2026.614.1',\n viewportSize: `${window.innerWidth}x${window.innerHeight}`,\n userAgent: navigator.userAgent,\n timestamp: new Date().toISOString(),\n };\n}\n\nfunction matchPath(pattern: RegExp, pathname: string): RegExpMatchArray | null {\n return pathname.match(pattern);\n}\n\nexport function resolveCoolAndLovelyConversationContext(\n pathname: string,\n search: string\n): ConversationContextShape {\n const params = new URLSearchParams(search);\n\n const directMatches: Array<[RegExp, string]> = [\n [/^\\/coolandlovely\\/brands\\/([^/]+)$/, 'COOLANDLOVELY_BRAND'],\n [/^\\/coolandlovely\\/collections\\/([^/]+)$/, 'COOLANDLOVELY_COLLECTION'],\n [/^\\/coolandlovely\\/items\\/([^/]+)$/, 'COOLANDLOVELY_STYLE_ITEM'],\n [/^\\/coolandlovely\\/looks\\/([^/]+)$/, 'COOLANDLOVELY_LOOK'],\n [/^\\/coolandlovely\\/collaborations\\/([^/]+)$/, 'COOLANDLOVELY_COLLABORATION'],\n [/^\\/coolandlovely\\/lookbooks\\/([^/]+)$/, 'COOLANDLOVELY_LOOKBOOK'],\n ];\n\n for (const [pattern, entityType] of directMatches) {\n const match = matchPath(pattern, pathname);\n if (match) {\n return {\n entityType,\n entityId: match[1],\n metadata: { routePattern: pattern.source },\n };\n }\n }\n\n const activeTab =\n params.get('tab') ??\n (() => {\n const segments = pathname.split('/').filter(Boolean);\n return segments.length > 2 ? segments[segments.length - 1] : undefined;\n })();\n\n return {\n activeTab: activeTab ?? undefined,\n metadata: {\n ...(activeTab ? { activeTab } : {}),\n ...(params.get('selectedCollectionId')\n ? { selectedCollectionId: params.get('selectedCollectionId') }\n : {}),\n },\n };\n}\n"],"mappings":";AA2BA,SAAgB,IAAiC;CAC/C,IAAM,IAAM,OAAO,SAAS,MAEtB,IADe,OAAO,SAAS,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ,CACvC,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,IAAI,QACpD,IAAS,EACb,OAAO,SAAS,UAChB,OAAO,SAAS,OACjB;AAED,QAAO;EACL,YAAY;EACZ;EACA,YAAY,EAAO;EACnB,UAAU,EAAO;EACjB,UAAU;EACV,SAA6C;EAC7C,cAAc,GAAG,OAAO,WAAW,GAAG,OAAO;EAC7C,WAAW,UAAU;EACrB,4BAAW,IAAI,MAAM,EAAC,aAAa;EACpC;;AAGH,SAAS,EAAU,GAAiB,GAA2C;AAC7E,QAAO,EAAS,MAAM,EAAQ;;AAGhC,SAAgB,EACd,GACA,GAC0B;CAC1B,IAAM,IAAS,IAAI,gBAAgB,EAAO;AAW1C,MAAK,IAAM,CAAC,GAAS,MAT0B;EAC7C,CAAC,sCAAsC,sBAAsB;EAC7D,CAAC,2CAA2C,2BAA2B;EACvE,CAAC,qCAAqC,2BAA2B;EACjE,CAAC,qCAAqC,qBAAqB;EAC3D,CAAC,8CAA8C,8BAA8B;EAC7E,CAAC,yCAAyC,yBAAyB;EACpE,EAEkD;EACjD,IAAM,IAAQ,EAAU,GAAS,EAAS;AAC1C,MAAI,EACF,QAAO;GACL;GACA,UAAU,EAAM;GAChB,UAAU,EAAE,cAAc,EAAQ,QAAQ;GAC3C;;CAIL,IAAM,IACJ,EAAO,IAAI,MAAM,WACV;EACL,IAAM,IAAW,EAAS,MAAM,IAAI,CAAC,OAAO,QAAQ;AACpD,SAAO,EAAS,SAAS,IAAI,EAAS,EAAS,SAAS,KAAK,KAAA;KAC3D;AAEN,QAAO;EACL,WAAW,KAAa,KAAA;EACxB,UAAU;GACR,GAAI,IAAY,EAAE,cAAW,GAAG,EAAE;GAClC,GAAI,EAAO,IAAI,uBAAuB,GAClC,EAAE,sBAAsB,EAAO,IAAI,uBAAuB,EAAE,GAC5D,EAAE;GACP;EACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-coolandlovely",
3
- "version": "2026.710.1",
3
+ "version": "2026.713.1",
4
4
  "description": "Burdenoff CoolAndLovely Microfrontend",
5
5
  "type": "module",
6
6
  "files": [
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@apollo/client": "^4.0.11",
47
- "@burdenoff/fe-libs": "2026.625.5",
47
+ "@burdenoff/fe-libs": "2026.713.6",
48
48
  "@tanstack/react-query": "^5.90.16",
49
49
  "clsx": "^2.1.1",
50
50
  "graphql": "^16.12.0",
@@ -90,7 +90,7 @@
90
90
  "access": "restricted"
91
91
  },
92
92
  "overrides": {
93
- "@burdenoff/fe-libs": "2026.625.5",
93
+ "@burdenoff/fe-libs": "2026.713.6",
94
94
  "lodash": ">=4.17.21",
95
95
  "lodash-es": ">=4.17.21",
96
96
  "dompurify": ">=3.3.4",