@oxvo/ai-live-assist 7.5.19 → 7.5.21

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 (99) hide show
  1. package/cjs/AiLiveAssist.d.ts +8 -1
  2. package/cjs/AiLiveAssist.js +113 -8
  3. package/cjs/client.d.ts +5 -3
  4. package/cjs/client.js +44 -5
  5. package/cjs/commerce/cartContracts.d.ts +158 -0
  6. package/cjs/commerce/cartContracts.js +228 -0
  7. package/cjs/commerce/cartSession.d.ts +86 -0
  8. package/cjs/commerce/cartSession.js +475 -0
  9. package/cjs/commerce/contracts.d.ts +152 -0
  10. package/cjs/commerce/contracts.js +322 -0
  11. package/cjs/commerce/pageContext.d.ts +50 -0
  12. package/cjs/commerce/pageContext.js +173 -0
  13. package/cjs/commerce/productPanel.d.ts +65 -0
  14. package/cjs/commerce/productPanel.js +662 -0
  15. package/cjs/commerce/realtimeCommerce.d.ts +73 -0
  16. package/cjs/commerce/realtimeCommerce.js +342 -0
  17. package/cjs/commerce/shopifyCart.d.ts +130 -0
  18. package/cjs/commerce/shopifyCart.js +1135 -0
  19. package/cjs/commerce/shopifyCartPresentation.d.ts +12 -0
  20. package/cjs/commerce/shopifyCartPresentation.js +379 -0
  21. package/cjs/commerce/shoppingNotes.d.ts +61 -0
  22. package/cjs/commerce/shoppingNotes.js +313 -0
  23. package/cjs/commerce/shoppingNotesView.d.ts +46 -0
  24. package/cjs/commerce/shoppingNotesView.js +269 -0
  25. package/cjs/control.d.ts +9 -1
  26. package/cjs/control.js +51 -1
  27. package/cjs/guideAdmission.d.ts +5 -2
  28. package/cjs/guideAdmission.js +21 -2
  29. package/cjs/guideInstaller.js +1 -1
  30. package/cjs/guideMeasurement.d.ts +5 -0
  31. package/cjs/guideMeasurement.js +29 -0
  32. package/cjs/guideSubjectStore.js +2 -0
  33. package/cjs/guideTypes.d.ts +18 -0
  34. package/cjs/liveControlChannel.d.ts +43 -1
  35. package/cjs/liveControlChannel.js +166 -14
  36. package/cjs/liveGuideAdmission.d.ts +3 -2
  37. package/cjs/liveGuideAdmission.js +10 -2
  38. package/cjs/liveGuideWidget.d.ts +18 -0
  39. package/cjs/liveGuideWidget.js +228 -23
  40. package/cjs/locales/resources.js +2240 -0
  41. package/cjs/messages.js +56 -0
  42. package/cjs/tabLock.d.ts +2 -0
  43. package/cjs/tabLock.js +11 -1
  44. package/cjs/types.d.ts +6 -2
  45. package/cjs/types.js +56 -0
  46. package/cjs/ui.d.ts +37 -0
  47. package/cjs/ui.js +261 -9
  48. package/cjs/version.d.ts +1 -1
  49. package/cjs/version.js +1 -1
  50. package/lib/AiLiveAssist.d.ts +8 -1
  51. package/lib/AiLiveAssist.js +113 -8
  52. package/lib/client.d.ts +5 -3
  53. package/lib/client.js +44 -5
  54. package/lib/commerce/cartContracts.d.ts +158 -0
  55. package/lib/commerce/cartContracts.js +221 -0
  56. package/lib/commerce/cartSession.d.ts +86 -0
  57. package/lib/commerce/cartSession.js +471 -0
  58. package/lib/commerce/contracts.d.ts +152 -0
  59. package/lib/commerce/contracts.js +300 -0
  60. package/lib/commerce/pageContext.d.ts +50 -0
  61. package/lib/commerce/pageContext.js +168 -0
  62. package/lib/commerce/productPanel.d.ts +65 -0
  63. package/lib/commerce/productPanel.js +657 -0
  64. package/lib/commerce/realtimeCommerce.d.ts +73 -0
  65. package/lib/commerce/realtimeCommerce.js +337 -0
  66. package/lib/commerce/shopifyCart.d.ts +130 -0
  67. package/lib/commerce/shopifyCart.js +1130 -0
  68. package/lib/commerce/shopifyCartPresentation.d.ts +12 -0
  69. package/lib/commerce/shopifyCartPresentation.js +376 -0
  70. package/lib/commerce/shoppingNotes.d.ts +61 -0
  71. package/lib/commerce/shoppingNotes.js +307 -0
  72. package/lib/commerce/shoppingNotesView.d.ts +46 -0
  73. package/lib/commerce/shoppingNotesView.js +265 -0
  74. package/lib/control.d.ts +9 -1
  75. package/lib/control.js +51 -1
  76. package/lib/guideAdmission.d.ts +5 -2
  77. package/lib/guideAdmission.js +21 -2
  78. package/lib/guideInstaller.js +1 -1
  79. package/lib/guideMeasurement.d.ts +5 -0
  80. package/lib/guideMeasurement.js +24 -0
  81. package/lib/guideSubjectStore.js +2 -0
  82. package/lib/guideTypes.d.ts +18 -0
  83. package/lib/liveControlChannel.d.ts +43 -1
  84. package/lib/liveControlChannel.js +166 -14
  85. package/lib/liveGuideAdmission.d.ts +3 -2
  86. package/lib/liveGuideAdmission.js +10 -2
  87. package/lib/liveGuideWidget.d.ts +18 -0
  88. package/lib/liveGuideWidget.js +228 -23
  89. package/lib/locales/resources.js +2240 -0
  90. package/lib/messages.js +56 -0
  91. package/lib/tabLock.d.ts +2 -0
  92. package/lib/tabLock.js +11 -1
  93. package/lib/types.d.ts +6 -2
  94. package/lib/types.js +56 -0
  95. package/lib/ui.d.ts +37 -0
  96. package/lib/ui.js +261 -9
  97. package/lib/version.d.ts +1 -1
  98. package/lib/version.js +1 -1
  99. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import { type PreparedShopifyCartAddition, type ShopifyCartAuthority, type ShopifyCartOutcome } from "./shopifyCart.js";
2
+ export interface ShopifyCartPresentationResult {
3
+ status: "updated" | "deferred" | "unsupported" | "unavailable";
4
+ headerUpdated: boolean;
5
+ drawerUpdated: boolean;
6
+ }
7
+ /** Refresh presentation after an actual cart observation. This function never writes a cart,
8
+ * opens a drawer, moves focus, dispatches theme events, or invents a count from local state.
9
+ * Deferred callers must fetch again later; old section HTML is never replayed.
10
+ * https://shopify.dev/docs/api/ajax/section-rendering
11
+ */
12
+ export declare function refreshShopifyCartPresentation(prepared: PreparedShopifyCartAddition, outcome: ShopifyCartOutcome, authority: Pick<ShopifyCartAuthority, "assertCurrent">): Promise<ShopifyCartPresentationResult>;
@@ -0,0 +1,376 @@
1
+ import { getShopifyCartUrl, } from "./shopifyCart.js";
2
+ const SECTIONS = ["cart-drawer", "cart-icon-bubble"];
3
+ const MAX_BYTES = 512000;
4
+ const REQUEST_MS = 5000;
5
+ const generations = new WeakMap();
6
+ const result = (status) => ({
7
+ status,
8
+ headerUpdated: false,
9
+ drawerUpdated: false,
10
+ });
11
+ const unique = (root, selector) => {
12
+ const matches = root.querySelectorAll(selector);
13
+ return matches.length === 1 ? matches[0] : null;
14
+ };
15
+ /** This schema/component pair was inspected on the owned development store.
16
+ * A similarly named selector on another theme does not establish compatibility.
17
+ */
18
+ function targets() {
19
+ const theme = window.Shopify?.theme;
20
+ if (theme?.schema_name !== "Generated Data Theme" ||
21
+ theme.schema_version !== "1.0.0" ||
22
+ !Number.isSafeInteger(theme.id) ||
23
+ Number(theme.id) <= 0 ||
24
+ !customElements.get("cart-drawer"))
25
+ return null;
26
+ const drawer = unique(document, "cart-drawer");
27
+ const root = unique(document, "#CartDrawer");
28
+ const overlay = unique(document, "#CartDrawer-Overlay");
29
+ const inner = drawer && unique(drawer, ".drawer__inner");
30
+ const header = unique(document, "a#cart-icon-bubble");
31
+ if (!drawer ||
32
+ !root ||
33
+ !overlay ||
34
+ !inner ||
35
+ !header ||
36
+ root.parentElement !== drawer ||
37
+ overlay.parentElement !== root ||
38
+ inner.parentElement !== root ||
39
+ inner.getAttribute("role") !== "dialog" ||
40
+ inner.getAttribute("aria-modal") !== "true" ||
41
+ header.getAttribute("aria-haspopup") !== "dialog" ||
42
+ typeof drawer.close !== "function" ||
43
+ typeof drawer.getSectionsToRender !== "function")
44
+ return null;
45
+ try {
46
+ if (JSON.stringify(drawer.getSectionsToRender()) !==
47
+ JSON.stringify([
48
+ { id: "cart-drawer", selector: "#CartDrawer" },
49
+ { id: "cart-icon-bubble" },
50
+ ]))
51
+ return null;
52
+ }
53
+ catch {
54
+ return null;
55
+ }
56
+ return { drawer, root, overlay, inner, header, themeId: Number(theme.id) };
57
+ }
58
+ function hasReceipt(prepared, outcome) {
59
+ const receipt = outcome.receipt;
60
+ const observedAt = Date.parse(receipt?.observedAt ?? "");
61
+ return (!!receipt &&
62
+ !!outcome.execution &&
63
+ receipt.operationId === prepared.operationId &&
64
+ receipt.guideId === prepared.guideId &&
65
+ receipt.storeRef === prepared.store.storeRef &&
66
+ receipt.productRef === prepared.productRef &&
67
+ receipt.variantRef === prepared.variantRef &&
68
+ receipt.currency === prepared.market.currency &&
69
+ receipt.cartDigest === outcome.execution.cartDigest &&
70
+ receipt.executionId === outcome.execution.executionId &&
71
+ /^[a-f0-9]{64}$/u.test(receipt.cartDigest) &&
72
+ observedAt <= Date.now() + 1000 &&
73
+ observedAt >= Date.now() - 30000);
74
+ }
75
+ async function readSections(url) {
76
+ const controller = new AbortController();
77
+ let timer;
78
+ const deadline = new Promise((_resolve, reject) => {
79
+ timer = setTimeout(() => {
80
+ controller.abort();
81
+ reject(new Error("Section timeout"));
82
+ }, REQUEST_MS);
83
+ });
84
+ const task = (async () => {
85
+ const response = await fetch(url, {
86
+ method: "GET",
87
+ mode: "same-origin",
88
+ credentials: "same-origin",
89
+ redirect: "error",
90
+ cache: "no-store",
91
+ headers: { Accept: "application/json" },
92
+ signal: controller.signal,
93
+ });
94
+ if (response.status !== 200 ||
95
+ response.redirected ||
96
+ !/^application\/json(?:;|$)/iu.test(response.headers.get("content-type") ?? "") ||
97
+ Number(response.headers.get("content-length") ?? "0") > MAX_BYTES ||
98
+ !response.body)
99
+ throw new Error("Invalid sections");
100
+ const reader = response.body.getReader();
101
+ const decoder = new TextDecoder("utf-8", { fatal: true });
102
+ let bytes = 0;
103
+ let text = "";
104
+ try {
105
+ while (true) {
106
+ const chunk = await reader.read();
107
+ if (chunk.done)
108
+ break;
109
+ bytes += chunk.value.byteLength;
110
+ if (bytes > MAX_BYTES)
111
+ throw new Error("Sections too large");
112
+ text += decoder.decode(chunk.value, { stream: true });
113
+ }
114
+ return JSON.parse(text + decoder.decode());
115
+ }
116
+ finally {
117
+ void reader.cancel().catch(() => undefined);
118
+ }
119
+ })();
120
+ try {
121
+ return await Promise.race([task, deadline]);
122
+ }
123
+ finally {
124
+ clearTimeout(timer);
125
+ controller.abort();
126
+ }
127
+ }
128
+ function parseSections(value) {
129
+ if (!value ||
130
+ typeof value !== "object" ||
131
+ Array.isArray(value) ||
132
+ Object.keys(value).length !== SECTIONS.length ||
133
+ !SECTIONS.every((key) => Object.prototype.hasOwnProperty.call(value, key)))
134
+ return null;
135
+ const sections = value;
136
+ if (typeof sections["cart-icon-bubble"] !== "string" ||
137
+ sections["cart-icon-bubble"].length > 16000 ||
138
+ typeof sections["cart-drawer"] !== "string" ||
139
+ sections["cart-drawer"].length > 400000)
140
+ return null;
141
+ const parser = new DOMParser();
142
+ const headerDoc = parser.parseFromString(sections["cart-icon-bubble"], "text/html");
143
+ const drawerDoc = parser.parseFromString(sections["cart-drawer"], "text/html");
144
+ const header = unique(headerDoc, "#shopify-section-cart-icon-bubble.shopify-section");
145
+ const drawer = unique(drawerDoc, "cart-drawer");
146
+ const root = unique(drawerDoc, "#CartDrawer");
147
+ const overlay = unique(drawerDoc, "#CartDrawer-Overlay");
148
+ const inner = drawer && unique(drawer, ".drawer__inner");
149
+ if (!header ||
150
+ !drawer ||
151
+ !root ||
152
+ !overlay ||
153
+ !inner ||
154
+ root.parentElement !== drawer ||
155
+ overlay.parentElement !== root ||
156
+ inner.parentElement !== root ||
157
+ inner.getAttribute("role") !== "dialog" ||
158
+ inner.getAttribute("aria-modal") !== "true" ||
159
+ !unique(inner, "cart-drawer-items") ||
160
+ !unique(inner, "#CartDrawer-Form") ||
161
+ !unique(inner, "#CartDrawer-CartItems") ||
162
+ !unique(inner, "#CartDrawer-LineItemStatus") ||
163
+ !inner.querySelector('button.drawer__close[type="button"]') ||
164
+ Array.from(inner.querySelectorAll("button.drawer__close")).some((button) => button.type !== "button") ||
165
+ !passiveContents(header, false) ||
166
+ !passiveContents(inner, true))
167
+ return null;
168
+ return { header, inner, empty: drawer.classList.contains("is-empty") };
169
+ }
170
+ /** Keep the verified theme markup, but never import scripts or unknown inline actions.
171
+ * The observed close button is rebound explicitly; its source is not evaluated.
172
+ */
173
+ function passiveContents(root, drawer) {
174
+ for (const element of root.querySelectorAll("*")) {
175
+ if ([
176
+ "script",
177
+ "style",
178
+ "iframe",
179
+ "object",
180
+ "embed",
181
+ "base",
182
+ "link",
183
+ "meta",
184
+ ].includes(element.localName) ||
185
+ (element.localName.includes("-") &&
186
+ ![
187
+ "cart-drawer-items",
188
+ "quantity-input",
189
+ "cart-remove-button",
190
+ "cart-note",
191
+ ].includes(element.localName)))
192
+ return false;
193
+ for (const attribute of Array.from(element.attributes)) {
194
+ if (/^on/iu.test(attribute.name)) {
195
+ if (drawer &&
196
+ element.matches('button.drawer__close[type="button"]') &&
197
+ attribute.name === "onclick" &&
198
+ attribute.value === "this.closest('cart-drawer').close()")
199
+ element.removeAttribute(attribute.name);
200
+ else
201
+ return false;
202
+ }
203
+ if (["href", "src", "action", "formaction", "xlink:href"].includes(attribute.name)) {
204
+ try {
205
+ const url = new URL(attribute.value, location.origin);
206
+ if (url.protocol !== "https:")
207
+ return false;
208
+ }
209
+ catch {
210
+ return false;
211
+ }
212
+ }
213
+ if (attribute.name === "autofocus" || attribute.name === "srcdoc")
214
+ return false;
215
+ }
216
+ }
217
+ return true;
218
+ }
219
+ const controlValues = (root) => JSON.stringify(Array.from(root.querySelectorAll("input,textarea,select")).map((input) => [
220
+ input.name,
221
+ input.value,
222
+ input instanceof HTMLInputElement ? input.checked : null,
223
+ ]));
224
+ // Theme quantity/note writes are debounced. Dirty controls may predate this
225
+ // refresh and remain pending even after the shopper closes the drawer.
226
+ function dirtyControls(root) {
227
+ for (const input of root.querySelectorAll("input,textarea,select")) {
228
+ if (input instanceof HTMLInputElement) {
229
+ if (["checkbox", "radio"].includes(input.type)) {
230
+ if (input.checked !== input.defaultChecked)
231
+ return true;
232
+ }
233
+ else if (!["hidden", "submit", "reset", "button", "image"].includes(input.type) &&
234
+ input.value !== input.defaultValue)
235
+ return true;
236
+ }
237
+ else if (input instanceof HTMLTextAreaElement) {
238
+ if (input.value !== input.defaultValue)
239
+ return true;
240
+ }
241
+ else {
242
+ const options = Array.from(input.options);
243
+ const defaults = options
244
+ .map((option, index) => (option.defaultSelected ? index : -1))
245
+ .filter((index) => index >= 0);
246
+ const selected = input.multiple
247
+ ? defaults
248
+ : defaults.length
249
+ ? [defaults[defaults.length - 1]]
250
+ : [
251
+ options.findIndex((option) => !option.disabled &&
252
+ !(option.parentElement instanceof HTMLOptGroupElement &&
253
+ option.parentElement.disabled)),
254
+ ];
255
+ if (options.some((option, index) => option.selected !== selected.includes(index)))
256
+ return true;
257
+ }
258
+ }
259
+ return false;
260
+ }
261
+ const busyDrawer = ({ drawer, inner }) => drawer.classList.contains("active") ||
262
+ drawer.contains(document.activeElement) ||
263
+ inner.querySelector('.cart__items--disabled,[aria-busy="true"]') !== null ||
264
+ dirtyControls(inner);
265
+ const sameTargets = (before, after) => !!after &&
266
+ ["drawer", "root", "overlay", "inner", "header", "themeId"].every((key) => before[key] === after[key]);
267
+ /** Refresh presentation after an actual cart observation. This function never writes a cart,
268
+ * opens a drawer, moves focus, dispatches theme events, or invents a count from local state.
269
+ * Deferred callers must fetch again later; old section HTML is never replayed.
270
+ * https://shopify.dev/docs/api/ajax/section-rendering
271
+ */
272
+ export async function refreshShopifyCartPresentation(prepared, outcome, authority) {
273
+ const current = async () => {
274
+ try {
275
+ return (await authority.assertCurrent(prepared)) === true;
276
+ }
277
+ catch {
278
+ return false;
279
+ }
280
+ };
281
+ const cartUrl = getShopifyCartUrl(prepared);
282
+ if (!cartUrl || !hasReceipt(prepared, outcome))
283
+ return result("unavailable");
284
+ const generation = (generations.get(document) ?? 0) + 1;
285
+ generations.set(document, generation);
286
+ if (!(await current()))
287
+ return result("unavailable");
288
+ if (generations.get(document) !== generation)
289
+ return result("deferred");
290
+ const live = targets();
291
+ if (!live)
292
+ return result("unsupported");
293
+ const url = new URL(cartUrl);
294
+ url.pathname = url.pathname.slice(0, -"cart".length);
295
+ url.searchParams.set("sections", SECTIONS.join(","));
296
+ let drawerChanged = busyDrawer(live);
297
+ let headerChanged = live.header !== document.activeElement &&
298
+ live.header.contains(document.activeElement);
299
+ const values = controlValues(live.inner);
300
+ const onInteraction = (event) => {
301
+ if (event.target instanceof Node && live.drawer.contains(event.target))
302
+ drawerChanged = true;
303
+ if (event.target instanceof Node &&
304
+ live.header.contains(event.target) &&
305
+ event.target !== live.header)
306
+ headerChanged = true;
307
+ };
308
+ const observer = new MutationObserver((records) => {
309
+ for (const record of records) {
310
+ if (live.inner.contains(record.target))
311
+ drawerChanged = true;
312
+ if (live.header.contains(record.target))
313
+ headerChanged = true;
314
+ }
315
+ });
316
+ observer.observe(live.inner, {
317
+ subtree: true,
318
+ childList: true,
319
+ attributes: true,
320
+ characterData: true,
321
+ });
322
+ observer.observe(live.header, {
323
+ subtree: true,
324
+ childList: true,
325
+ attributes: true,
326
+ characterData: true,
327
+ });
328
+ const events = ["pointerdown", "input", "change", "focusin"];
329
+ for (const event of events)
330
+ document.addEventListener(event, onInteraction, true);
331
+ try {
332
+ const sections = parseSections(await readSections(url.href));
333
+ if (!sections)
334
+ return result("unsupported");
335
+ if (!(await current()) ||
336
+ getShopifyCartUrl(prepared) !== cartUrl ||
337
+ !hasReceipt(prepared, outcome))
338
+ return result("unavailable");
339
+ if (generations.get(document) !== generation ||
340
+ !sameTargets(live, targets()))
341
+ return result("deferred");
342
+ for (const record of observer.takeRecords()) {
343
+ if (live.inner.contains(record.target))
344
+ drawerChanged = true;
345
+ if (live.header.contains(record.target))
346
+ headerChanged = true;
347
+ }
348
+ drawerChanged || (drawerChanged = busyDrawer(live) || controlValues(live.inner) !== values);
349
+ headerChanged || (headerChanged = live.header !== document.activeElement &&
350
+ live.header.contains(document.activeElement));
351
+ observer.disconnect();
352
+ if (!headerChanged)
353
+ live.header.replaceChildren(...Array.from(sections.header.childNodes));
354
+ if (!drawerChanged) {
355
+ live.inner.replaceChildren(...Array.from(sections.inner.childNodes));
356
+ live.drawer.classList.toggle("is-empty", sections.empty);
357
+ live.inner.classList.toggle("is-empty", sections.inner.classList.contains("is-empty"));
358
+ for (const button of live.inner.querySelectorAll("button.drawer__close")) {
359
+ button.addEventListener("click", () => live.drawer.close());
360
+ }
361
+ }
362
+ return {
363
+ status: drawerChanged || headerChanged ? "deferred" : "updated",
364
+ headerUpdated: !headerChanged,
365
+ drawerUpdated: !drawerChanged,
366
+ };
367
+ }
368
+ catch {
369
+ return result("unavailable");
370
+ }
371
+ finally {
372
+ observer.disconnect();
373
+ for (const event of events)
374
+ document.removeEventListener(event, onInteraction, true);
375
+ }
376
+ }
@@ -0,0 +1,61 @@
1
+ import type { BootstrapConfig } from "../types.js";
2
+ import { type CommerceOption, type CommerceStore } from "./contracts.js";
3
+ export declare const SHOPPING_NOTES_STORAGE_KEY = "__oxvo_guide_shopping_notes_v1";
4
+ export declare const SHOPPING_NOTES_MAX_BYTES = 4096;
5
+ export declare const SHOPPING_NOTES_TTL_MS: number;
6
+ export declare const SHOPPING_NOTES_QUESTION_MAX_LENGTH = 4000;
7
+ export interface ShoppingNotesScope {
8
+ origin: string;
9
+ installKey: string;
10
+ projectId: number;
11
+ guideId: string;
12
+ store: CommerceStore;
13
+ }
14
+ export interface ShoppingNotesProduct {
15
+ productRef: string;
16
+ variantRef: string | null;
17
+ selectedOptions: CommerceOption[];
18
+ label?: string;
19
+ }
20
+ export interface ShoppingNotesDraft {
21
+ /** Shopper-authored text; never a transcript or a model-produced summary. */
22
+ needs: string;
23
+ /** Explicitly saved references, not catalog receipts or permission to add. */
24
+ products: ShoppingNotesProduct[];
25
+ }
26
+ export interface ShoppingNotesRecord {
27
+ schemaVersion: 1;
28
+ scope: ShoppingNotesScope;
29
+ savedAt: number;
30
+ expiresAt: number;
31
+ draft: ShoppingNotesDraft;
32
+ }
33
+ export type ShoppingNotesSaveResult = {
34
+ ok: true;
35
+ record: ShoppingNotesRecord;
36
+ } | {
37
+ ok: false;
38
+ reason: "invalid" | "empty" | "too_large" | "storage_unavailable";
39
+ };
40
+ export type ShoppingNotesQuestionResult = {
41
+ ok: true;
42
+ initialQuestion: string;
43
+ } | {
44
+ ok: false;
45
+ reason: "invalid" | "empty" | "too_long";
46
+ };
47
+ /** Only validated current bootstrap identity supplies the scope; notes never supply it. */
48
+ export declare function createShoppingNotesScope(config: BootstrapConfig, origin?: string): ShoppingNotesScope | null;
49
+ /** Builds the entire text for shopper review. No truncation, launch, text send or permission restoration. */
50
+ export declare function buildShoppingNotesQuestion(reviewedDraft: ShoppingNotesDraft): ShoppingNotesQuestionResult;
51
+ /** Optional per-tab convenience. Constructing or reading this cannot start any Guide or restore authority. */
52
+ export declare class ShoppingNotesStore {
53
+ private readonly scope;
54
+ constructor(scope: ShoppingNotesScope);
55
+ private currentScope;
56
+ read(): ShoppingNotesRecord | null;
57
+ /** Called only by the explicit shopper Save control. Saving starts one new fixed expiry interval. */
58
+ save(draft: ShoppingNotesDraft): ShoppingNotesSaveResult;
59
+ /** Only our own scoped notes are removed; launch and unresolved-cart stores are never accessed. */
60
+ clear(): boolean;
61
+ }