@syntrologie/adapt-search 2.8.0-canary.568

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.
@@ -0,0 +1,140 @@
1
+ /**
2
+ * adaptive-search — `<syntro-search-surface>`
3
+ *
4
+ * The surface paints a layout skeleton the moment the shopper presses Enter,
5
+ * then fills each named region in place as content arrives. Nothing ever
6
+ * moves after the first paint: a shopper reading the first region must not
7
+ * have it slide out from under them when the second one resolves.
8
+ *
9
+ * Shadow DOM, deliberately. This element covers a merchant's whole viewport
10
+ * over their own markup, so their stylesheet must not reach in and ours must
11
+ * not leak out. The `--sc-*` theme tokens inherit through the boundary, which
12
+ * is how the surface ends up wearing the merchant's brand without this file
13
+ * naming a single colour.
14
+ *
15
+ * The tag must start with `syntro-`: the search interceptor bails on any
16
+ * element whose tag has that prefix, which is what keeps a shopper's Enter
17
+ * inside our own follow-up bar from re-triggering the takeover.
18
+ */
19
+ import { LitElement, nothing, type TemplateResult } from 'lit';
20
+ import { type SurfaceRegion, type SurfaceVariant } from './variants';
21
+ export declare const SEARCH_SURFACE_TAG = "syntro-search-surface";
22
+ export declare class SearchSurfaceElement extends LitElement {
23
+ static properties: {
24
+ _variant: {
25
+ state: boolean;
26
+ };
27
+ _query: {
28
+ state: boolean;
29
+ };
30
+ _filled: {
31
+ state: boolean;
32
+ };
33
+ _suppressed: {
34
+ state: boolean;
35
+ };
36
+ _dismissed: {
37
+ state: boolean;
38
+ };
39
+ _frozen: {
40
+ state: boolean;
41
+ };
42
+ _announcement: {
43
+ state: boolean;
44
+ };
45
+ };
46
+ private _variant;
47
+ private _query;
48
+ private _filled;
49
+ private _suppressed;
50
+ /**
51
+ * Handles the shopper hid, as a Set so the render path is a lookup rather
52
+ * than a scan of every tile. Replaced, never mutated in place: Lit's dirty
53
+ * check is identity-based and a mutated Set would not repaint.
54
+ */
55
+ private _dismissed;
56
+ private _frozen;
57
+ private _announcement;
58
+ constructor();
59
+ static styles: import("lit").CSSResult;
60
+ /**
61
+ * Paint the variant's skeleton. Ignored once the surface is frozen, because
62
+ * a server plan that lands after the first content has painted would
63
+ * otherwise throw away what the shopper is already reading.
64
+ */
65
+ showSkeleton(variant: SurfaceVariant, query: string): void;
66
+ /**
67
+ * Fill one region in place. The region keeps its position, so the page does
68
+ * not reflow around the shopper. A region id this variant does not own, or
69
+ * one already retired by `suppressRegion`, has nowhere to paint.
70
+ *
71
+ * Returns whether the region actually painted. The runtime needs that answer
72
+ * to tell "the plan filled a region" from "the plan addressed a variant this
73
+ * surface is not showing": a dropped fill counted as content would leave the
74
+ * shopper on a skeleton the SDK had already scored as a success.
75
+ */
76
+ fillRegion(region: SurfaceRegion): boolean;
77
+ /** Content this renderer can display, including payload validation and dismissals. */
78
+ getRegionContent(id: string): {
79
+ productCount: number;
80
+ hasAnswer: boolean;
81
+ };
82
+ /**
83
+ * Retire a slot the plan decided not to fill. The slot leaves the grid
84
+ * entirely — no skeleton, no `aria-busy`, nothing for the live region to
85
+ * count — and every other slot keeps its order. Left in place, a region that
86
+ * is never going to fill pulses beside real results for as long as the
87
+ * shopper reads them.
88
+ *
89
+ * Idempotent, ignored for an id this variant does not own, and allowed after
90
+ * the surface has frozen: suppression is not a repaint, it only removes a
91
+ * slot that was never going to say anything.
92
+ */
93
+ suppressRegion(id: string): void;
94
+ /**
95
+ * Hide one product, everywhere, for the rest of this surface.
96
+ *
97
+ * Optimistic on purpose: the shopper tapped the tile's own dismiss button,
98
+ * so the tile goes now rather than after a round trip that may legitimately
99
+ * come back with nothing to patch. And it OUTLIVES the payload it was tapped
100
+ * in — a later repaint of the same region, or a whole new plan on a surface
101
+ * with no server session, must not hand back the product just rejected.
102
+ */
103
+ dismissProduct(handle: string): void;
104
+ /**
105
+ * Drop one chip from the follow-up bar without waiting for a server repaint.
106
+ *
107
+ * Only reachable when the bar is showing server chips and the surface has no
108
+ * live session to patch — an expired one, in practice. With a session the
109
+ * server repaints the bar and this is never called.
110
+ */
111
+ removeChip(key: string): void;
112
+ /**
113
+ * The container a widget mounts into for this region, or `null` when the
114
+ * region paints no mountable module.
115
+ *
116
+ * The surface renders `search:chat` as an empty box and nothing else: the
117
+ * conversation here is the SDK's own chat widget, mounted by the runtime
118
+ * through its widget registry, never a second chat implementation living in
119
+ * this package. This is the whole affordance that makes that possible.
120
+ */
121
+ mountTarget(regionId: string): HTMLElement | null;
122
+ /** The query region as the plan filled it, if the plan filled it at all. */
123
+ private _filledQueryRegion;
124
+ /** Hold the current variant for the rest of this turn. */
125
+ freeze(): void;
126
+ /**
127
+ * Only ever called after a region has filled, so "nothing here" is a
128
+ * finished answer, not a loading state. The skeleton is what says "still
129
+ * loading", and it says it visually while the live region stays silent.
130
+ */
131
+ private _announce;
132
+ private _onSeeStoreResults;
133
+ private _renderQueryRegion;
134
+ private _renderRegion;
135
+ private _renderSkeleton;
136
+ render(): TemplateResult | typeof nothing;
137
+ }
138
+ /** Define `<syntro-search-surface>` once. Safe to call from every entry point. */
139
+ export declare function registerSearchSurfaceElement(): void;
140
+ //# sourceMappingURL=SearchSurfaceElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchSurfaceElement.d.ts","sourceRoot":"","sources":["../src/SearchSurfaceElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAa,UAAU,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAU1E,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAc1D,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;MAQxB;IAKF,QAAgB,QAAQ,CAAwB;IAChD,QAAgB,MAAM,CAAS;IAC/B,QAAgB,OAAO,CAAgC;IACvD,QAAgB,WAAW,CAAoB;IAC/C;;;;OAIG;IACH,QAAgB,UAAU,CAAsB;IAChD,QAAgB,OAAO,CAAU;IACjC,QAAgB,aAAa,CAAS;;IAatC,OAAgB,MAAM,0BA4RpB;IAEF;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAS1D;;;;;;;;;OASG;IACH,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAU1C,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE;IAU1E;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAYhC;;;;;;;;OAQG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOpC;;;;;;OAMG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAS7B;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAOjD,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB;IAU1B,0DAA0D;IAC1D,MAAM,IAAI,IAAI;IAId;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAgBjB,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,kBAAkB;IA+B1B,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,eAAe;IASd,MAAM,IAAI,cAAc,GAAG,OAAO,OAAO;CAiBnD;AAED,kFAAkF;AAClF,wBAAgB,4BAA4B,IAAI,IAAI,CAKnD"}
package/dist/cdn.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * CDN Entry Point for Adaptive Search
3
+ *
4
+ * Bundled for CDN delivery and loaded on demand by the host runtime's
5
+ * AppLoader when the search takeover is armed for a workspace. Mirrors
6
+ * adaptive-faq/src/cdn.ts: builds the manifest from the runtime export, then
7
+ * self-registers with the host's app registry on import.
8
+ *
9
+ * Without this entry, build-adaptives-only.js silently skips the package,
10
+ * `widgets.has('adaptive-search:surface')` is false forever, and the takeover
11
+ * never fires on a real storefront however green the tests are.
12
+ */
13
+ export declare const manifest: {
14
+ id: string;
15
+ version: string;
16
+ name: string;
17
+ description: string;
18
+ runtime: {
19
+ actions: {
20
+ kind: never;
21
+ executor: never;
22
+ }[];
23
+ widgets: {
24
+ id: string;
25
+ component: {
26
+ mount(container: HTMLElement, config?: (import("./schema").SearchSurfaceConfig & import("packages/sdk-contracts/dist").MountPlumbing) | null): () => void;
27
+ };
28
+ metadata: {
29
+ name: string;
30
+ description: string;
31
+ icon: string;
32
+ slots: string[];
33
+ };
34
+ }[];
35
+ notifyWatchers: unknown;
36
+ events: unknown;
37
+ };
38
+ metadata: {
39
+ isBuiltIn: boolean;
40
+ };
41
+ };
42
+ declare global {
43
+ interface Window {
44
+ SynOS?: {
45
+ appRegistry?: {
46
+ register?: (m: unknown) => void;
47
+ };
48
+ };
49
+ }
50
+ }
51
+ export default manifest;
52
+ //# sourceMappingURL=cdn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcpB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,KAAK,CAAC,EAAE;YACN,WAAW,CAAC,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;aACjC,CAAC;SACH,CAAC;KACH;CACF;AASD,eAAe,QAAQ,CAAC"}
package/dist/cdn.js ADDED
@@ -0,0 +1,33 @@
1
+ import {
2
+ runtime
3
+ } from "./chunk-3KPQ5AOG.js";
4
+ import "./chunk-NKOTQPVZ.js";
5
+
6
+ // src/cdn.ts
7
+ var manifest = {
8
+ id: runtime.id,
9
+ version: runtime.version,
10
+ name: runtime.name,
11
+ description: runtime.description,
12
+ runtime: {
13
+ actions: (runtime.executors ?? []).map(({ kind, executor }) => ({ kind, executor })),
14
+ widgets: runtime.widgets,
15
+ notifyWatchers: runtime.notifyWatchers,
16
+ events: runtime.eventHandlers
17
+ },
18
+ metadata: {
19
+ isBuiltIn: false
20
+ }
21
+ };
22
+ if (typeof window !== "undefined") {
23
+ const registry = window.SynOS?.appRegistry;
24
+ if (registry && typeof registry.register === "function") {
25
+ registry.register(manifest);
26
+ }
27
+ }
28
+ var cdn_default = manifest;
29
+ export {
30
+ cdn_default as default,
31
+ manifest
32
+ };
33
+ //# sourceMappingURL=cdn.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/cdn.ts"],
4
+ "sourcesContent": ["/**\n * CDN Entry Point for Adaptive Search\n *\n * Bundled for CDN delivery and loaded on demand by the host runtime's\n * AppLoader when the search takeover is armed for a workspace. Mirrors\n * adaptive-faq/src/cdn.ts: builds the manifest from the runtime export, then\n * self-registers with the host's app registry on import.\n *\n * Without this entry, build-adaptives-only.js silently skips the package,\n * `widgets.has('adaptive-search:surface')` is false forever, and the takeover\n * never fires on a real storefront however green the tests are.\n */\n\nimport { runtime } from './runtime';\n\nexport const manifest = {\n id: runtime.id,\n version: runtime.version,\n name: runtime.name,\n description: runtime.description,\n runtime: {\n actions: (runtime.executors ?? []).map(({ kind, executor }) => ({ kind, executor })),\n widgets: runtime.widgets,\n notifyWatchers: (runtime as { notifyWatchers?: unknown }).notifyWatchers,\n events: (runtime as { eventHandlers?: unknown }).eventHandlers,\n },\n metadata: {\n isBuiltIn: false,\n },\n};\n\ndeclare global {\n interface Window {\n SynOS?: {\n appRegistry?: {\n register?: (m: unknown) => void;\n };\n };\n }\n}\n\nif (typeof window !== 'undefined') {\n const registry = window.SynOS?.appRegistry;\n if (registry && typeof registry.register === 'function') {\n registry.register(manifest);\n }\n}\n\nexport default manifest;\n"],
5
+ "mappings": ";;;;;;AAeO,IAAM,WAAW;AAAA,EACtB,IAAI,QAAQ;AAAA,EACZ,SAAS,QAAQ;AAAA,EACjB,MAAM,QAAQ;AAAA,EACd,aAAa,QAAQ;AAAA,EACrB,SAAS;AAAA,IACP,UAAU,QAAQ,aAAa,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IACnF,SAAS,QAAQ;AAAA,IACjB,gBAAiB,QAAyC;AAAA,IAC1D,QAAS,QAAwC;AAAA,EACnD;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,EACb;AACF;AAYA,IAAI,OAAO,WAAW,aAAa;AACjC,QAAM,WAAW,OAAO,OAAO;AAC/B,MAAI,YAAY,OAAO,SAAS,aAAa,YAAY;AACvD,aAAS,SAAS,QAAQ;AAAA,EAC5B;AACF;AAEA,IAAO,cAAQ;",
6
+ "names": []
7
+ }