@omni-commerce/sdk 0.13.0 → 0.18.0
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/README.md +159 -12
- package/dist/embed.cjs +7 -1
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.d.cts +5 -0
- package/dist/embed.d.ts +5 -0
- package/dist/embed.global.js +4 -4
- package/dist/embed.global.js.map +1 -1
- package/dist/embed.js +7 -1
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +768 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5156 -1262
- package/dist/index.d.ts +5156 -1262
- package/dist/index.js +768 -22
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +34 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +34 -6
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ The surface is a resource client with one request object per call, dual ESM/CJS
|
|
|
8
8
|
|
|
9
9
|
Application chat is available from `@omni-commerce/sdk/react` (`OmniProvider`, `OmniChat`) and `@omni-commerce/sdk/embed` (`createOmniApplicationChatEmbed`). With SDK 0.9.0, render `<OmniProvider><OmniChat /></OmniProvider>` to use the signed-in viewer's organization and assistant. No Storefront deployment is required. Optional `organizationId`, `agentId`, and `appId` select the application scope; authentication stays inside the hosted chat frame.
|
|
10
10
|
|
|
11
|
+
SDK 0.14.0 adds application `systemPrompt` and backend `tools` options. Set the app's role in `systemPrompt`; keep live page data in `application.getContext`. `tools` narrows the selected agent's permitted tools/toolkits; omit it to inherit, or use `tools={[]}` for an assistant with only the app's registered `frontendTools`. Omitting or clearing the prompt restores the selected agent's instructions. These options refresh before each turn without remounting chat and are unavailable to public Storefront hosts.
|
|
12
|
+
|
|
11
13
|
SDK 0.9.1 adds `<OmniProvider><OmniChatLayout>{applicationContent}</OmniChatLayout></OmniProvider>` for a full-height responsive application shell. Chat docks on the right at 960px and above; below 960px it collapses to a launcher that opens a full-height native modal. Opening, closing and resizing preserve one chat iframe. `OmniChat` remains the inline primitive for custom layouts.
|
|
12
14
|
|
|
13
15
|
Storefront chat continues to use `deploymentId` with `createOmniChatEmbed` or `createOmniChatWidget`. Widgets accept `presentation: "sidebar"` for a full-height drawer, or `"floating"` (the default), with `position: "left" | "right"`. On mobile (widths up to 640px, or touch devices with viewport heights up to 480px in landscape), both widget presentations open as full-screen modal chat, adapting to the on-screen keyboard and locking storefront scrolling until closed. Inline and React chat fill their host container. React is an optional peer dependency; REST and plain JavaScript consumers do not need it. See [chat integration](https://docs.omnicommerce.sg/sdk/chat) for multiple assistants and session handling.
|
|
@@ -53,6 +55,32 @@ const created = await client.jobs.wait({ jobId: job.jobId });
|
|
|
53
55
|
|
|
54
56
|
API keys are organization-scoped. Do not send `organizationId` on API-key requests.
|
|
55
57
|
|
|
58
|
+
Bulk imports can supply explicit SKU options and native marketplace attributes:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
await client.products.bulkImport({
|
|
62
|
+
products: [
|
|
63
|
+
{
|
|
64
|
+
sku: "BAG-1",
|
|
65
|
+
inventory: 3,
|
|
66
|
+
variationAttributes: { Size: "One Size" },
|
|
67
|
+
marketplaceAttributes: {
|
|
68
|
+
zalora: { sku_supplier_config: "BAG-1", sizesystembrand: "1816" },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
targetMarketplaces: ["zalora"],
|
|
73
|
+
marketplaceStoreSelections: { zalora: ["your-connected-store-id"] },
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Each row is a standalone SKU. Enrichment does not infer SKU options. At Zalora
|
|
78
|
+
publish time, a missing required Size defaults to One Size only when the selected
|
|
79
|
+
category and supplied size system support it. Explicit sizes are preserved; the
|
|
80
|
+
size system and other required options must still be supplied. No child variant
|
|
81
|
+
is created for this default.
|
|
82
|
+
See the [bulk import guide](https://docs.omnicommerce.sg/guides/bulk-product-import).
|
|
83
|
+
|
|
56
84
|
### Options
|
|
57
85
|
|
|
58
86
|
```ts
|
|
@@ -96,6 +124,94 @@ console.log(completed.result?.success, completed.result?.results);
|
|
|
96
124
|
|
|
97
125
|
Omit `gl` to compare all recorded listing markets; `gl: "sg"` restricts research to Singapore. Global Zalora prices stay separate by country/currency. An India Shopify store selling in SGD is researched in Singapore. Read each product's `markets` array for its price evidence, research, comparison, and errors. Missing published price evidence is an explicit failure; a catalog fallback is never a verified listing price. Client timeouts leave the durable job running. [Full comparison guide](https://docs.omnicommerce.sg/sdk/typescript#market-price-comparison).
|
|
98
126
|
|
|
127
|
+
## Order fulfillment and picking lists
|
|
128
|
+
|
|
129
|
+
Available in SDK 0.18.0. Check choices for an exact batch, submit the reviewed operations, then inspect every returned job. Use `ship`, `cancel`, `labels`, or `update_tracking`; one operation per order is allowed in a batch (1–50). Reading choices and submitting require `orders:write`; job status and picking lists require `orders:read`.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
const options = await client.orders.listBatchActionOptions({
|
|
133
|
+
orderIds,
|
|
134
|
+
action: "ship",
|
|
135
|
+
});
|
|
136
|
+
// Review options.data.results, choose payloads, and supply required fields.
|
|
137
|
+
// reviewedOperations: [{ orderId, action: "ship", payload: chosenPayload }]
|
|
138
|
+
const queued = await client.orders.processActions({
|
|
139
|
+
requestId: crypto.randomUUID(),
|
|
140
|
+
operations: reviewedOperations,
|
|
141
|
+
});
|
|
142
|
+
if (!queued.data) throw new Error("Missing order job results");
|
|
143
|
+
const progress = await client.orders.getActionJobs({
|
|
144
|
+
jobIds: queued.data.jobIds,
|
|
145
|
+
});
|
|
146
|
+
for (const job of progress.data?.results ?? []) {
|
|
147
|
+
for (const label of job.labels) console.log(label.url);
|
|
148
|
+
}
|
|
149
|
+
const picking = await client.orders.createPickingList(
|
|
150
|
+
{ orderIds, timeZone: "Asia/Singapore" },
|
|
151
|
+
{ timeoutInSeconds: 120 },
|
|
152
|
+
);
|
|
153
|
+
console.log(picking.data?.downloadUrl, picking.data?.expiresAt);
|
|
154
|
+
const returnRequests = await client.returns.listForOrders({ orderIds });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use a `labels` operation after shipment completes when the marketplace requires it. Label jobs provide files to download and print; no local printer is controlled. Poll all returned job IDs with backoff while `pendingCount` is positive. Submission success means accepted; job `data.success` means every requested job succeeded. Preserve requestId and unchanged operations for retries. Unsupported marketplace actions remain explicit per-order failures. Picking lists accept up to 500 orders and return a private PDF link valid for five minutes. Missing or inaccessible orders fail the entire picking list. See [Order fulfillment](https://docs.omnicommerce.sg/guides/order-fulfillment).
|
|
158
|
+
|
|
159
|
+
## Return processing
|
|
160
|
+
|
|
161
|
+
Available in SDK 0.18.0. Use one submission for a single return or up to 50 reviewed decisions. Checking and submitting require `orders:write`; job status requires `orders:read`.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
// returnIds are OmniCommerce return UUIDs, not order IDs.
|
|
165
|
+
const checked = await client.returns.listActions({ returnIds });
|
|
166
|
+
// selectedDecisions comes from your review UI: [{ returnId, actionId }].
|
|
167
|
+
const operations = selectedDecisions.map((selected) => {
|
|
168
|
+
const result = checked.data?.results.find(
|
|
169
|
+
(item) => item.returnId === selected.returnId,
|
|
170
|
+
);
|
|
171
|
+
if (
|
|
172
|
+
!result?.success ||
|
|
173
|
+
!result.actions.some((a) => a.id === selected.actionId)
|
|
174
|
+
) {
|
|
175
|
+
throw new Error("Refresh and review this return before processing it");
|
|
176
|
+
}
|
|
177
|
+
return { ...selected, version: result.version };
|
|
178
|
+
});
|
|
179
|
+
const queued = await client.returns.process({
|
|
180
|
+
requestId: crypto.randomUUID(), // retain this key for safe retries
|
|
181
|
+
operations,
|
|
182
|
+
});
|
|
183
|
+
if (!queued.data) throw new Error("Missing return job results");
|
|
184
|
+
const progress = await client.returns.getActionJobs({
|
|
185
|
+
jobIds: queued.data.jobIds,
|
|
186
|
+
});
|
|
187
|
+
console.log(progress.data);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
An empty actions array means no current seller decision, including completed or cancelled returns. Read `limitation` for unsupported marketplace operations. Keep the same request key and operations after a transport failure. Check **every** returned job ID with backoff until `pendingCount` is zero; only `data.success: true` confirms all selected decisions succeeded. `needs_review` requires checking marketplace state before another decision. A processed decision may still leave later steps in the buyer return lifecycle. See [Return processing](https://docs.omnicommerce.sg/guides/return-processing).
|
|
191
|
+
|
|
192
|
+
## Batch publish, delist, and update
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
const published = await client.products.batchPublish(
|
|
196
|
+
{
|
|
197
|
+
productIds: ["prod_123", "prod_456"],
|
|
198
|
+
visibility: "live",
|
|
199
|
+
},
|
|
200
|
+
{ concurrency: 3 },
|
|
201
|
+
);
|
|
202
|
+
const delisted = await client.products.batchDelist({
|
|
203
|
+
productIds: ["prod_123", "prod_456"],
|
|
204
|
+
});
|
|
205
|
+
const updated = await client.products.batchUpdate({
|
|
206
|
+
updates: [
|
|
207
|
+
{ productId: "prod_123", name: "Desk lamp" },
|
|
208
|
+
{ productId: "prod_456", price: 29.9, currency: "SGD" },
|
|
209
|
+
],
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Each helper processes 1–100 products through the existing single-product APIs, with concurrency 1–10 (default 3). Publish/delist trim and deduplicate IDs; updates reject duplicate product IDs. Results include ordered per-product responses/errors, success/failure counts, and every returned handle in `jobIds`. Await those jobs separately. All marketplaces and selected-field publish options are supported. `batchUpdate` edits the catalog; use `batchPublish` with `updateFields` to send saved fields to existing listings. Submission requires the SDK process to stay running; queued server jobs continue independently. [Batch guide](https://docs.omnicommerce.sg/sdk/typescript#batch-publish-delist-and-update).
|
|
214
|
+
|
|
99
215
|
## Publish selected fields
|
|
100
216
|
|
|
101
217
|
Choose marketplaces and publish only saved fields on existing listings, matching the publish popover:
|
|
@@ -110,20 +226,51 @@ const publish = await client.products.publish({
|
|
|
110
226
|
|
|
111
227
|
Omit marketplaces to use every enabled or listed marketplace; omit fields for full publishing. Selected-field updates preserve other fields and listing visibility. Inspect every target result for capability/connection errors and await every returned job ID and inventory correlation. See the [publishing guide](https://docs.omnicommerce.sg/sdk/typescript#publish-selected-fields).
|
|
112
228
|
|
|
229
|
+
## Product counts and resumable scans
|
|
230
|
+
|
|
231
|
+
Use `products.count()` for a total instead of downloading every product. It uses the Products page filters and counts catalog parent products once, including when multiple listings match. It does not count variants or verify live marketplace listing status. `status` selects the catalog lifecycle/derived view. All supported marketplaces are accepted; combine `marketplace` with `store`, or use exact `marketplace:country:storeId` keys in `storeKeys`.
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
const filters = {
|
|
235
|
+
marketplace: "lazada",
|
|
236
|
+
store: "actual store ID",
|
|
237
|
+
status: "active",
|
|
238
|
+
} as const;
|
|
239
|
+
const count = await client.products.count(filters);
|
|
240
|
+
console.log(count.count, count.unit); // catalog_products
|
|
241
|
+
|
|
242
|
+
// Download records only when needed. Each chunk defaults to one page (up to 50 rows).
|
|
243
|
+
const chunk = await client.products.scan(filters, {
|
|
244
|
+
maxPages: 1,
|
|
245
|
+
onProgress: async (progress, items) => {
|
|
246
|
+
// Persist items and progress.next together in your application's checkpoint.
|
|
247
|
+
console.log(progress.pagesRead, progress.itemsRead, progress.complete);
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
// A later invocation can resume with: client.products.scan(chunk.next!)
|
|
251
|
+
// Only resume when chunk.complete === false and chunk.next is present.
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`scan` makes sequential requests with `includeSummary: false`, avoiding repeated catalog summary classification. Its result contains `items`, `pagesRead`, `itemsRead`, `complete`, and `next`. Counts are per chunk. `maxPages` is bounded to 1–100; a capped chunk is explicitly incomplete. `onProgress` runs after each successful page with only that page's items, so you can save progress before a process stops. `ProductScanError.partial` retains completed items and the first unprocessed request; its `cause` retains the original error. Do not report a failed/capped scan as a complete dataset.
|
|
255
|
+
|
|
256
|
+
Continuation requests retain the original filters, use a server cursor when available, and otherwise use `nextOffset`. The cursor is bound to the credential organization and filter scope; resume under the same scope. Default `created_desc` order without search supports cursors. Other sorts use offsets and can shift if the catalog changes. Scans are not immutable database snapshots. Never persist API keys with a checkpoint. Per-request timeouts, retry settings and cancellation use the normal request options.
|
|
257
|
+
|
|
258
|
+
For manual paging, `products.list({ ...filters, includeSummary: false })` omits `summary` and returns `pagination.total: null`. Use `products.count(filters)` when a total is needed. The default list response keeps its summary and total.
|
|
259
|
+
|
|
113
260
|
## Resources
|
|
114
261
|
|
|
115
|
-
| Client | Examples
|
|
116
|
-
| ----------------------------- |
|
|
117
|
-
| `client.products` | `list`, `create`, `get`, `update`, `delete`, `publish`, `bulkImport`, `enrich` |
|
|
118
|
-
| `client.orders` | `list`, `create`, `get`, `update`
|
|
119
|
-
| `client.promotions` | `list`, `create`, `get`, `update`, `delete`, `sync`
|
|
120
|
-
| `client.priceBooks` | `list`, `create`, `get`, `update`, `delete`, `preview`
|
|
121
|
-
| `client.aop` | `create`, `execute`, `getConfig`, `updateConfig`, `retry`
|
|
122
|
-
| `client.jobs` | `get`, `cancel`, `wait`
|
|
123
|
-
| `client.webhooks` | `list`, `create`
|
|
124
|
-
| `client.checkoutSessions` | `create`, `get`, `update`, `complete`, `cancel`
|
|
125
|
-
| `client.ucp.checkoutSessions` | Universal Commerce Protocol checkout
|
|
126
|
-
| `client.oauth` | `token`, `revoke`
|
|
262
|
+
| Client | Examples |
|
|
263
|
+
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
264
|
+
| `client.products` | `list`, `create`, `get`, `update`, `delete`, `publish`, `delist`, `batchPublish`, `batchDelist`, `batchUpdate`, `bulkImport`, `enrich` |
|
|
265
|
+
| `client.orders` | `list`, `create`, `get`, `update` |
|
|
266
|
+
| `client.promotions` | `list`, `create`, `get`, `update`, `delete`, `sync` |
|
|
267
|
+
| `client.priceBooks` | `list`, `create`, `get`, `update`, `delete`, `preview` |
|
|
268
|
+
| `client.aop` | `create`, `execute`, `getConfig`, `updateConfig`, `retry` |
|
|
269
|
+
| `client.jobs` | `get`, `cancel`, `wait` |
|
|
270
|
+
| `client.webhooks` | `list`, `create` |
|
|
271
|
+
| `client.checkoutSessions` | `create`, `get`, `update`, `complete`, `cancel` |
|
|
272
|
+
| `client.ucp.checkoutSessions` | Universal Commerce Protocol checkout |
|
|
273
|
+
| `client.oauth` | `token`, `revoke` |
|
|
127
274
|
|
|
128
275
|
Every other documented tag (looks, returns, settlements, marketplaces, search, evaluate, monitor, sync, …) is exposed the same way.
|
|
129
276
|
|
package/dist/embed.cjs
CHANGED
|
@@ -24,6 +24,7 @@ function createApplicationMessageHandler(input) {
|
|
|
24
24
|
input.reply({
|
|
25
25
|
type: "omni-chat:application-response",
|
|
26
26
|
requestId: message.requestId,
|
|
27
|
+
...input.assistant ? { assistant: boundedJson(input.assistant(), 65536) } : {},
|
|
27
28
|
application: application ? boundedJson(
|
|
28
29
|
{
|
|
29
30
|
name: application.name,
|
|
@@ -125,6 +126,7 @@ function mountHostedChat(container, options, target) {
|
|
|
125
126
|
const controller = new AbortController();
|
|
126
127
|
const applicationMessage = createApplicationMessageHandler({
|
|
127
128
|
options,
|
|
129
|
+
assistant: target.assistant,
|
|
128
130
|
signal: controller.signal,
|
|
129
131
|
reply: (message) => {
|
|
130
132
|
if (!destroyed)
|
|
@@ -248,7 +250,11 @@ function createOmniApplicationChatEmbed(container, options) {
|
|
|
248
250
|
const chatId = host.crypto.randomUUID();
|
|
249
251
|
return mountHostedChat(container, options, {
|
|
250
252
|
url: getOmniApplicationChatUrl(options, host.location.origin, chatId),
|
|
251
|
-
scope: { chatId }
|
|
253
|
+
scope: { chatId },
|
|
254
|
+
assistant: () => ({
|
|
255
|
+
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
256
|
+
...options.tools !== void 0 ? { tools: options.tools } : {}
|
|
257
|
+
})
|
|
252
258
|
});
|
|
253
259
|
}
|
|
254
260
|
|
package/dist/embed.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/application.ts","../../../lib/assistant/application-chat/bridge-scope.ts","../src/hosted-chat.ts","../../../lib/assistant/hosted-chat-origin.ts","../src/chat-origin.ts","../src/application-embed.ts","../src/widget-chrome.ts","../src/widget-placement.ts","../src/widget-config.ts","../src/widget-panel.ts","../src/widget.ts","../src/embed-code.ts","../src/embed.ts"],"names":["chatOrigin"],"mappings":";;;;;;;AAqBA,SAAS,WAAA,CAAY,OAAgB,OAAA,EAA0B;AAC7D,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA;AACpC,EAAA,IACE,OAAO,OAAA,KAAY,QAAA,IACnB,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,OAAO,CAAA,CAAE,MAAA,GAAS,OAAA,IAC3C,6BAAA,CAA8B,KAAK,OAAO,CAAA;AAE1C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AACF,EAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAC3B;AAEO,SAAS,gCAAgC,KAAA,EAI7C;AAED,EAAA,MAAM,KAAA,uBAAY,GAAA,EAGhB;AACF,EAAA,OAAO,OAAO,OAAA,KAAqC;AACjD,IAAA,IAAI,OAAO,OAAA,CAAQ,SAAA,KAAc,QAAA,IAAY,OAAA,CAAQ,UAAU,MAAA,GAAS,GAAA;AACtE,MAAA;AACF,IAAA,IAAI;AACF,MAAA,IAAI,OAAA,CAAQ,SAAS,+BAAA,EAAiC;AACpD,QAAA,MAAM,WAAA,GAAc,MAAM,OAAA,CAAQ,WAAA;AAClC,QAAA,KAAA,CAAM,KAAA,CAAM;AAAA,UACV,IAAA,EAAM,gCAAA;AAAA,UACN,WAAW,OAAA,CAAQ,SAAA;AAAA,UACnB,aAAa,WAAA,GACT,WAAA;AAAA,YACE;AAAA,cACE,MAAM,WAAA,CAAY,IAAA;AAAA,cAClB,aAAa,WAAA,CAAY,WAAA;AAAA,cACzB,OAAA,EAA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A;AAAA,QAC1B,CAAA,EAAGA,WAAU,CAAA,WAAA,EAAc,OAAA,CAAQ,YAAY,CAAA,QAAA,CAAA;AAAA,QAC/C;AAAA,UACE,MAAA,EAAQ,MAAA;AAAA,UACR,WAAA,EAAa,SAAA;AAAA,UACb,MAAA;AAAA,UACA,OAAA,EAAS;AAAA,YACP,cAAA,EAAgB,kBAAA;AAAA,YAChB,GAAI,gBACA,EAAE,aAAA,EAAe,UAAU,aAAa,CAAA,CAAA,KACxC;AAAC,WACP;AAAA,UACA,MAAM,IAAA,CAAK,SAAA;AAAA,YACT,aACE,4EAAA,CAA6E,IAAA;AAAA,cAC3E;AAAA,aACF,GACE,EAAE,SAAA,EAAU,GACZ;AAAC;AACP;AACF,OACF;AACA,MAAA,MAAM,MAAA,GAAU,MAAM,QAAA,CAAS,IAAA,EAAK;AAGpC,MAAA,IAAI,CAAC,QAAA,CAAS,EAAA;AACZ,QAAA,MAAM,IAAI,gBAAA;AAAA,UACR,OAAO,KAAA,IAAS,kCAAA;AAAA,UAChB,QAAA,CAAS;AAAA,SACX;AACF,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACD,CAAA;AACH","file":"embed.cjs","sourcesContent":["/** Host-defined actions execute inside the application, never on the assistant server. */\nexport interface OmniFrontendTool {\n description: string;\n parameters: Record<string, unknown>;\n execute: (\n args: Record<string, unknown>,\n context: { toolCallId: string; abortSignal: AbortSignal },\n ) => unknown | Promise<unknown>;\n}\nexport interface OmniChatApplication {\n name: string;\n description: string;\n /** Return a small, explicitly selected snapshot. Do not include secrets. */\n getContext: () => unknown | Promise<unknown>;\n}\nexport interface OmniApplicationOptions {\n application?: OmniChatApplication;\n /** Names must start with app_; use array arguments for actions with multiple targets. */\n frontendTools?: Record<string, OmniFrontendTool>;\n}\n\nfunction boundedJson(value: unknown, maximum: number): unknown {\n const encoded = JSON.stringify(value);\n if (\n typeof encoded !== \"string\" ||\n new TextEncoder().encode(encoded).length > maximum ||\n /data:[^\"\\s]{0,100};base64,/i.test(encoded)\n )\n throw new Error(\n \"Application data must be bounded JSON without base64 payloads.\",\n );\n return JSON.parse(encoded);\n}\n\nexport function createApplicationMessageHandler(input: {\n options: OmniApplicationOptions;\n signal: AbortSignal;\n reply: (message: Record<string, unknown>) => void;\n}) {\n // A repeated parked call reuses its result instead of applying an action twice.\n const calls = new Map<\n string,\n { signature: string; result: Promise<unknown> }\n >();\n return async (message: Record<string, unknown>) => {\n if (typeof message.requestId !== \"string\" || message.requestId.length > 200)\n return;\n try {\n if (message.type === \"omni-chat:application-request\") {\n const application = input.options.application;\n input.reply({\n type: \"omni-chat:application-response\",\n requestId: message.requestId,\n application: application\n ? boundedJson(\n {\n name: application.name,\n description: application.description,\n context: (await application.getContext()) ?? null,\n tools: Object.entries(input.options.frontendTools ?? {}).map(\n ([name, definition]) => ({\n name,\n description: definition.description,\n parameters: definition.parameters,\n }),\n ),\n },\n 65536,\n )\n : undefined,\n });\n } else if (message.type === \"omni-chat:tool-request\") {\n const name = message.toolName;\n const toolCallId = message.toolCallId;\n if (\n typeof name !== \"string\" ||\n !/^app_[a-z][a-z0-9_]{0,59}$/.test(name) ||\n typeof toolCallId !== \"string\" ||\n !toolCallId ||\n toolCallId.length > 200\n )\n throw new Error(\"Invalid application tool request.\");\n const definition = Object.hasOwn(\n input.options.frontendTools ?? {},\n name,\n )\n ? input.options.frontendTools?.[name]\n : undefined;\n if (!input.options.application || !definition)\n throw new Error(\"This application action is unavailable.\");\n const args = message.args;\n if (!args || typeof args !== \"object\" || Array.isArray(args))\n throw new Error(\"Invalid application action arguments.\");\n const signature = JSON.stringify({ name, args });\n const prior = calls.get(toolCallId);\n if (prior && prior.signature !== signature)\n throw new Error(\"This tool call ID was already used.\");\n const result =\n prior?.result ??\n Promise.resolve().then(() =>\n definition.execute(args as Record<string, unknown>, {\n toolCallId,\n abortSignal: input.signal,\n }),\n );\n if (!prior) {\n if (calls.size >= 200)\n throw new Error(\"Start a new application chat.\");\n calls.set(toolCallId, { signature, result });\n }\n input.reply({\n type: \"omni-chat:tool-response\",\n requestId: message.requestId,\n toolCallId,\n result: boundedJson((await result) ?? null, 12000),\n });\n }\n } catch (error) {\n input.reply({\n type:\n message.type === \"omni-chat:application-request\"\n ? \"omni-chat:application-response\"\n : \"omni-chat:tool-response\",\n requestId: message.requestId,\n toolCallId: message.toolCallId,\n error:\n error instanceof Error\n ? error.message\n : \"The application action failed.\",\n });\n }\n };\n}\n","/** Scope each hosted frame independently; application chats have no deployment. */\nexport type HostedChatScope =\n | { deploymentId: string; chatId?: never }\n | { chatId: string; deploymentId?: never };\n\nexport function hostedChatId(scope: HostedChatScope) {\n return scope.deploymentId ?? scope.chatId;\n}\n\nexport function matchesHostedChatScope(\n message: Record<string, unknown> | null | undefined,\n scope: HostedChatScope,\n) {\n return scope.deploymentId !== undefined\n ? message?.deploymentId === scope.deploymentId &&\n message.chatId === undefined\n : message?.chatId === scope.chatId && message.deploymentId === undefined;\n}\n","import {\n createApplicationMessageHandler,\n type OmniApplicationOptions,\n} from \"./application\";\nimport {\n matchesHostedChatScope,\n type HostedChatScope,\n} from \"../../../lib/assistant/application-chat/bridge-scope\";\nimport type { OmniChatEmbed, OmniChatSession } from \"./embed\";\n\nexport interface OmniHostedChatOptions extends OmniApplicationOptions {\n baseUrl?: string;\n title?: string;\n onError?: (error: Error) => void;\n onRequestClose?: () => void;\n}\n\nexport class ChatSessionError extends Error {\n constructor(\n message: string,\n readonly status: number,\n ) {\n super(message);\n }\n}\n\n/** One frame broker for member application chat and published storefront chat. */\nexport function mountHostedChat(\n container: HTMLElement,\n options: OmniHostedChatOptions,\n target: {\n url: string;\n scope: HostedChatScope;\n mint?: (\n previousToken: string | undefined,\n visitorId: string | undefined,\n signal: AbortSignal,\n ) => Promise<OmniChatSession>;\n },\n): OmniChatEmbed {\n const document = container.ownerDocument;\n const host = document.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const iframe = document.createElement(\"iframe\");\n iframe.src = target.url;\n iframe.title = options.title ?? \"OmniCommerce assistant\";\n iframe.referrerPolicy = \"strict-origin-when-cross-origin\";\n iframe.setAttribute(\n \"sandbox\",\n \"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox\",\n );\n Object.assign(iframe.style, {\n width: \"100%\",\n height: \"100%\",\n minHeight: \"320px\",\n border: \"0\",\n display: \"block\",\n });\n const chatOrigin = new URL(iframe.src).origin;\n let destroyed = false;\n let pending: Promise<OmniChatSession> | undefined;\n let previousToken: string | undefined;\n const controller = new AbortController();\n\n const applicationMessage = createApplicationMessageHandler({\n options,\n signal: controller.signal,\n reply: (message) => {\n if (!destroyed)\n iframe.contentWindow?.postMessage(\n { ...message, ...target.scope },\n chatOrigin,\n );\n },\n });\n const receive = (event: MessageEvent) => {\n if (\n destroyed ||\n event.source !== iframe.contentWindow ||\n event.origin !== chatOrigin ||\n !matchesHostedChatScope(event.data, target.scope)\n )\n return;\n if (\n event.data.type === \"omni-chat:application-request\" ||\n event.data.type === \"omni-chat:tool-request\"\n ) {\n void applicationMessage(event.data);\n return;\n }\n if (event.data.type === \"omni-chat:close-request\") {\n options.onRequestClose?.();\n return;\n }\n if (event.data.type !== \"omni-chat:session-request\" || !target.mint) return;\n const visitorId =\n typeof event.data.visitorId === \"string\"\n ? event.data.visitorId\n : undefined;\n pending ??= target.mint(previousToken, visitorId, controller.signal);\n void pending\n .then((session) => {\n if (destroyed) return;\n if (\n typeof session?.token !== \"string\" ||\n !session.token ||\n session.token.length > 4096 ||\n typeof session.threadId !== \"string\" ||\n !session.threadId ||\n !Number.isFinite(session.expiresIn) ||\n session.expiresIn <= 0\n )\n throw new Error(\"Invalid chat session response.\");\n previousToken = session.token;\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:session\",\n ...target.scope,\n session,\n ...(options.application ? { applicationEnabled: true } : {}),\n },\n chatOrigin,\n );\n })\n .catch((error: unknown) => {\n if (destroyed) return;\n const failure =\n error instanceof Error ? error : new Error(\"Could not open chat.\");\n if (\n failure instanceof ChatSessionError &&\n [401, 403].includes(failure.status)\n )\n previousToken = undefined;\n options.onError?.(failure);\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:session-error\",\n ...target.scope,\n error: failure.message,\n ...(options.application ? { applicationEnabled: true } : {}),\n },\n chatOrigin,\n );\n })\n .finally(() => {\n pending = undefined;\n });\n };\n host.addEventListener(\"message\", receive);\n container.append(iframe);\n return {\n iframe,\n focus() {\n if (destroyed) return;\n iframe.focus();\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:focus-composer\",\n ...target.scope,\n },\n chatOrigin,\n );\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n controller.abort();\n previousToken = undefined;\n host.removeEventListener(\"message\", receive);\n iframe.remove();\n },\n };\n}\n","/** Exact hosted-chat origins, including trustworthy localhost development hosts. */\nexport function normalizeHostedChatOrigin(value: string): string {\n const url = new URL(value);\n const local =\n url.hostname === \"localhost\" ||\n url.hostname.endsWith(\".localhost\") ||\n url.hostname === \"127.0.0.1\";\n if (\n (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && local)) ||\n url.username ||\n url.password ||\n url.pathname !== \"/\" ||\n url.search ||\n url.hash\n )\n throw new Error(\"Use an HTTPS origin, or HTTP localhost for development.\");\n return url.origin;\n}\n","import { normalizeHostedChatOrigin } from \"../../../lib/assistant/hosted-chat-origin\";\n\nexport function chatOrigin(baseUrl?: string): string {\n return normalizeHostedChatOrigin(baseUrl ?? \"https://omnicommerce.sg\");\n}\n","import { chatOrigin } from \"./chat-origin\";\nimport { mountHostedChat, type OmniHostedChatOptions } from \"./hosted-chat\";\n\n/** Application chat authenticates the viewer; it never uses a storefront deployment. */\nexport interface OmniApplicationChatOptions extends OmniHostedChatOptions {\n deploymentId?: never;\n /** Omit to use the member's currently selected organization. */\n organizationId?: string;\n /** Omit to use the default native assistant. */\n agentId?: string;\n /** Groups this application's conversation history; defaults to its origin. */\n appId?: string;\n}\n\nexport function getOmniApplicationChatUrl(\n options: OmniApplicationChatOptions,\n parentOrigin: string,\n chatId: string,\n) {\n if (\n !/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/i.test(chatId)\n )\n throw new Error(\"A valid application chat ID is required.\");\n const url = new URL(\"/sdk/application-chat\", chatOrigin(options.baseUrl));\n const parent = chatOrigin(parentOrigin);\n url.searchParams.set(\"parentOrigin\", parent);\n url.searchParams.set(\"chatId\", chatId);\n const appId = options.appId?.trim() ?? parent;\n if (!appId || appId.length > 200)\n throw new Error(\"appId must contain 1–200 characters.\");\n url.searchParams.set(\"appId\", appId);\n for (const key of [\"organizationId\", \"agentId\"] as const) {\n if (options[key] === undefined) continue;\n const value = options[key].trim();\n if (!value || value.length > 120)\n throw new Error(`${key} must contain 1–120 characters.`);\n url.searchParams.set(key, value);\n }\n return url.toString();\n}\n\nexport function createOmniApplicationChatEmbed(\n container: HTMLElement,\n options: OmniApplicationChatOptions,\n) {\n const host = container.ownerDocument.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const chatId = host.crypto.randomUUID();\n return mountHostedChat(container, options, {\n url: getOmniApplicationChatUrl(options, host.location.origin, chatId),\n scope: { chatId },\n });\n}\n","const iconPaths = {\n chat: \"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5Z\",\n close: \"m6 6 12 12M6 18 18 6\",\n collapse: \"m6 9 6 6 6-6\",\n};\n\nexport function widgetIcon(document: Document, name: keyof typeof iconPaths) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.8\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", iconPaths[name]);\n svg.append(path);\n return svg;\n}\n\nexport const widgetMobileQuery =\n \"(max-width: 640px), (max-height: 480px) and (pointer: coarse)\";\n\n/** Shadow DOM keeps a store's button, font and dialog CSS out of the widget. */\nexport const widgetStyles = `\n :host {\n all: initial; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; color-scheme: light dark;\n --omni-active-bottom-offset: var(--omni-bottom-offset);\n --omni-active-side-offset: var(--omni-side-offset);\n --omni-side-safe-area: env(safe-area-inset-right, 0px);\n --omni-opposite-safe-area: env(safe-area-inset-left, 0px);\n /* Reserve 240px of panel height, the 66px launcher gap and 20px at the opposite edges. */\n --omni-effective-bottom-offset: clamp(0px, calc(var(--omni-active-bottom-offset) + env(safe-area-inset-bottom, 0px)), max(0px, calc(100dvh - 326px - env(safe-area-inset-top, 0px))));\n --omni-effective-side-offset: clamp(0px, calc(var(--omni-active-side-offset) + var(--omni-side-safe-area)), max(0px, calc(100vw - 260px - var(--omni-opposite-safe-area))));\n bottom: var(--omni-effective-bottom-offset); right: var(--omni-effective-side-offset);\n width: max-content; max-width: calc(100vw - var(--omni-effective-side-offset) - 20px - var(--omni-opposite-safe-area));\n }\n *, *::before, *::after { box-sizing: border-box; }\n button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }\n button:focus-visible { outline: 3px solid var(--omni-launcher-bg); outline-offset: 4px; }\n svg { display: block; width: 22px; height: 22px; flex: none; }\n .launcher {\n display: flex; align-items: center; justify-content: center; gap: 10px;\n height: 52px; padding: 0 20px; border: 1px solid rgba(255,255,255,.14);\n border-radius: 999px; background: var(--omni-launcher-bg); color: var(--omni-launcher-fg);\n font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: -.01em;\n box-shadow: 0 6px 24px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.08);\n transition: transform 160ms ease, box-shadow 160ms ease;\n margin-left: auto;\n max-width: 100%;\n }\n .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.2); }\n .launcher[hidden] { display: none; }\n .launcher[aria-expanded=\"true\"] { width: 52px; padding: 0; }\n .launcher[aria-expanded=\"true\"] .label { display: none; }\n .panel {\n position: absolute; top: auto; bottom: 66px; right: 0; left: auto; width: min(392px, calc(100vw - var(--omni-effective-side-offset) - 20px - var(--omni-opposite-safe-area)));\n margin: 0; padding: 0; max-width: none; max-height: none; color: var(--omni-panel-fg);\n overflow: hidden; border: 0; border-radius: 20px;\n background: var(--omni-panel-bg); box-shadow: 0 24px 80px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.06);\n animation: omni-chat-enter 180ms ease-out;\n }\n .panel[hidden] { display: none; }\n .panel::backdrop { background: transparent; }\n .frame { height: min(780px, calc(100dvh - var(--omni-effective-bottom-offset) - 92px - env(safe-area-inset-top, 0px))); min-height: 240px; }\n .close {\n position: absolute; z-index: 1; top: 18px; right: 14px;\n display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;\n border: 1px solid color-mix(in srgb, var(--omni-panel-fg) 10%, transparent); border-radius: 50%;\n background: var(--omni-panel-bg); color: var(--omni-panel-fg); transition: background 160ms ease;\n }\n .close svg { width: 17px; height: 17px; }\n .close:hover { background: color-mix(in srgb, var(--omni-panel-fg) 6%, var(--omni-panel-bg)); }\n :host([data-position=\"left\"]) {\n --omni-side-safe-area: env(safe-area-inset-left, 0px);\n --omni-opposite-safe-area: env(safe-area-inset-right, 0px);\n right: auto; left: var(--omni-effective-side-offset);\n }\n :host([data-position=\"left\"]) .panel { right: auto; left: 0; }\n :host([data-position=\"left\"]) .launcher { margin-left: 0; }\n :host([data-presentation=\"sidebar\"]) .panel {\n position: fixed; top: 0; bottom: 0; right: 0; left: auto;\n width: min(440px, 100vw); border-radius: 0;\n animation: omni-sidebar-enter 180ms ease-out;\n }\n :host([data-presentation=\"sidebar\"]) .frame { height: 100dvh; min-height: 0; }\n :host([data-presentation=\"sidebar\"][data-position=\"left\"]) .panel {\n right: auto; left: 0; animation-name: omni-sidebar-enter-left;\n }\n @keyframes omni-sidebar-enter { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: none; } }\n @keyframes omni-sidebar-enter-left { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: none; } }\n @keyframes omni-chat-enter { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }\n @keyframes omni-chat-mobile-enter { from { opacity: 0; } to { opacity: 1; } }\n @media ${widgetMobileQuery} {\n :host {\n --omni-active-bottom-offset: var(--omni-mobile-bottom-offset);\n --omni-active-side-offset: var(--omni-mobile-side-offset);\n /* Mobile panels fill the screen independently; only the closed pill needs to fit. */\n --omni-effective-bottom-offset: clamp(0px, calc(var(--omni-active-bottom-offset) + env(safe-area-inset-bottom, 0px)), max(0px, calc(100dvh - 72px - env(safe-area-inset-top, 0px))));\n --omni-effective-side-offset: clamp(0px, calc(var(--omni-active-side-offset) + var(--omni-side-safe-area)), max(0px, calc(100vw - 112px - var(--omni-opposite-safe-area))));\n }\n :host([data-presentation]) .panel {\n position: fixed; top: 0; right: 0; bottom: auto; left: 0;\n width: 100%; height: 100vh; height: var(--omni-viewport-height, 100dvh);\n transform: translateY(var(--omni-viewport-shift, 0px));\n transition: transform 180ms ease-out;\n border: 0; border-radius: 0; box-shadow: none; animation: omni-chat-mobile-enter 180ms ease-out;\n }\n :host([data-presentation]) .frame {\n height: 100%; min-height: 0;\n padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);\n }\n .launcher[aria-expanded=\"true\"] { display: none; }\n .close { top: calc(18px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }\n }\n @media (prefers-reduced-motion: reduce) { :host([data-presentation][data-position]) .panel { animation: none; transition: none; } .launcher { transition: none; } }\n`;\n","export const DEFAULT_WIDGET_OFFSET = 20;\nexport const MAX_WIDGET_OFFSET = 500;\n\nexport type OmniChatWidgetPlacement = {\n /** Desktop distance from the bottom edge, in pixels. */\n bottomOffset: number;\n /** Desktop distance from the selected side, in pixels. */\n sideOffset: number;\n /** Mobile distance from the bottom edge, in pixels. */\n mobileBottomOffset: number;\n /** Mobile distance from the selected side, in pixels. */\n mobileSideOffset: number;\n};\n\n/** Saved designs and SDK overrides use the same bounded pixel values. */\nexport function resolveWidgetPlacement(\n options: Partial<OmniChatWidgetPlacement>,\n): OmniChatWidgetPlacement {\n const offset = (value: number | undefined) => {\n if (value === undefined) return DEFAULT_WIDGET_OFFSET;\n if (!Number.isInteger(value) || value < 0 || value > MAX_WIDGET_OFFSET)\n throw new Error(\n `Chat spacing must be whole pixels between 0 and ${MAX_WIDGET_OFFSET}.`,\n );\n return value;\n };\n return {\n bottomOffset: offset(options.bottomOffset),\n sideOffset: offset(options.sideOffset),\n mobileBottomOffset: offset(options.mobileBottomOffset),\n mobileSideOffset: offset(options.mobileSideOffset),\n };\n}\n","import type { OmniChatWidgetOptions } from \"./widget\";\nimport { resolveWidgetPlacement } from \"./widget-placement\";\n\n/** Only public appearance is loaded here; agent settings remain on the server. */\nexport async function loadWidgetConfiguration(\n host: Window,\n origin: string,\n deploymentId: string,\n signal: AbortSignal,\n): Promise<OmniChatWidgetOptions> {\n const response = await host.fetch(`${origin}/api/embed/${deploymentId}`, {\n credentials: \"include\",\n cache: \"no-store\",\n signal,\n });\n const result = await response.json();\n if (!response.ok)\n throw new Error(result.error ?? \"Could not load the chat design.\");\n const design = result.design;\n const color = /^#[0-9a-f]{6}$/i;\n if (\n !design ||\n typeof design.title !== \"string\" ||\n !design.title.trim() ||\n design.title.length > 80 ||\n typeof design.launcherLabel !== \"string\" ||\n !design.launcherLabel.trim() ||\n design.launcherLabel.length > 60 ||\n ![\"left\", \"right\"].includes(design.position) ||\n ![\"floating\", \"sidebar\"].includes(design.presentation) ||\n !design.theme ||\n ![\n design.theme.primary,\n design.theme.primaryForeground,\n design.theme.background,\n design.theme.foreground,\n ].every((value) => typeof value === \"string\" && color.test(value))\n )\n throw new Error(\"Invalid chat design response.\");\n return {\n ...resolveWidgetPlacement(design),\n deploymentId,\n title: design.title,\n launcherLabel: design.launcherLabel,\n position: design.position,\n presentation: design.presentation,\n launcherBackground: design.theme.primary,\n launcherForeground: design.theme.primaryForeground,\n panelBackground: design.theme.background,\n panelForeground: design.theme.foreground,\n };\n}\n","import { widgetMobileQuery } from \"./widget-chrome\";\nconst scrollLocks = new WeakMap<Document, { count: number; release(): void }>();\n\nfunction lockScroll(document: Document) {\n let lock = scrollLocks.get(document);\n if (!lock) {\n const styles = [document.documentElement.style, document.body.style];\n const saved = styles.map((style) => ({\n value: style.getPropertyValue(\"overflow\"),\n priority: style.getPropertyPriority(\"overflow\"),\n }));\n styles.forEach((style) =>\n style.setProperty(\"overflow\", \"hidden\", \"important\"),\n );\n lock = {\n count: 0,\n release() {\n styles.forEach((style, index) => {\n const { value, priority } = saved[index]!;\n if (value) style.setProperty(\"overflow\", value, priority);\n else style.removeProperty(\"overflow\");\n });\n },\n };\n scrollLocks.set(document, lock);\n }\n lock.count++;\n return () => {\n if (--lock.count === 0) {\n lock.release();\n scrollLocks.delete(document);\n }\n };\n}\n\n/** Mobile modality and keyboard sizing belong to the host, outside the chat iframe. */\nexport function createWidgetPanel(\n root: HTMLElement,\n panel: HTMLDialogElement,\n onRequestClose: () => void,\n) {\n const host = root.ownerDocument.defaultView!;\n const mobile = host.matchMedia(widgetMobileQuery);\n const viewport = host.visualViewport;\n let modal = false;\n let releaseScroll: (() => void) | undefined;\n let viewportFrame: number | undefined;\n const cancelViewportFrame = () => {\n if (viewportFrame === undefined) return;\n host.cancelAnimationFrame(viewportFrame);\n viewportFrame = undefined;\n };\n const clearViewport = () => {\n root.style.removeProperty(\"--omni-viewport-shift\");\n root.style.removeProperty(\"--omni-viewport-height\");\n };\n const resize = () => {\n // Keep pinch zoom available; only position above the keyboard at normal scale.\n if (panel.hidden || !mobile.matches || !viewport || viewport.scale !== 1) {\n clearViewport();\n return;\n }\n // When the keyboard reduces the visual viewport, keep the iframe at the\n // layout height and move its bottom to the visible bottom edge.\n const document = root.ownerDocument;\n const viewportRoot =\n document.compatMode === \"CSS1Compat\"\n ? document.documentElement\n : document.body;\n const height = viewportRoot.clientHeight || host.innerHeight;\n // Safari can pan before reporting the keyboard's reduced height. Never\n // counteract that native upward movement with a downward translation.\n const shift = Math.min(0, viewport.offsetTop + viewport.height - height);\n root.style.setProperty(\"--omni-viewport-shift\", `${shift}px`);\n const heightValue = `${height}px`;\n if (root.style.getPropertyValue(\"--omni-viewport-height\") !== heightValue)\n root.style.setProperty(\"--omni-viewport-height\", heightValue);\n };\n const scheduleResize = () => {\n if (viewportFrame !== undefined) return;\n viewportFrame = host.requestAnimationFrame(() => {\n viewportFrame = undefined;\n resize();\n });\n };\n const show = () => {\n if (panel.hidden) return;\n let focused: HTMLElement | null = null;\n if (panel.open && modal !== mobile.matches) {\n focused = root.shadowRoot?.activeElement as HTMLElement | null;\n panel.close();\n }\n modal = mobile.matches;\n if (modal) releaseScroll ??= lockScroll(root.ownerDocument);\n else {\n releaseScroll?.();\n releaseScroll = undefined;\n }\n cancelViewportFrame();\n resize();\n if (!panel.open) {\n if (modal) panel.showModal();\n else panel.show();\n }\n if (focused && panel.contains(focused)) focused.focus();\n };\n const cancel = (event: Event) => {\n event.preventDefault();\n onRequestClose();\n };\n const close = () => {\n cancelViewportFrame();\n panel.hidden = true;\n if (panel.open) panel.close();\n releaseScroll?.();\n releaseScroll = undefined;\n clearViewport();\n };\n mobile.addEventListener(\"change\", show);\n viewport?.addEventListener(\"resize\", scheduleResize);\n viewport?.addEventListener(\"scroll\", scheduleResize);\n panel.addEventListener(\"cancel\", cancel);\n return {\n open() {\n panel.hidden = false;\n show();\n },\n close,\n destroy() {\n close();\n mobile.removeEventListener(\"change\", show);\n viewport?.removeEventListener(\"resize\", scheduleResize);\n viewport?.removeEventListener(\"scroll\", scheduleResize);\n panel.removeEventListener(\"cancel\", cancel);\n },\n };\n}\n","import {\n createOmniChatEmbed,\n getOmniChatEmbedUrl,\n type OmniChatEmbedOptions,\n type OmniChatEmbed,\n} from \"./embed\";\nimport { widgetIcon, widgetStyles } from \"./widget-chrome\";\nimport { loadWidgetConfiguration } from \"./widget-config\";\nimport { createWidgetPanel } from \"./widget-panel\";\nimport {\n resolveWidgetPlacement,\n type OmniChatWidgetPlacement,\n} from \"./widget-placement\";\n\nexport type OmniChatWidgetOptions = OmniChatEmbedOptions &\n Partial<OmniChatWidgetPlacement> & {\n /** Desktop layout; both presentations fill the viewport on mobile. */\n presentation?: \"floating\" | \"sidebar\";\n launcherLabel?: string;\n position?: \"left\" | \"right\";\n launcherBackground?: string;\n launcherForeground?: string;\n panelBackground?: string;\n panelForeground?: string;\n };\nlet widgetSequence = 0;\n/** Loads saved appearance by deployment ID. Explicit options override saved appearance. */\nexport function createOmniChatWidget(\n container: HTMLElement,\n options: OmniChatWidgetOptions,\n) {\n const origin = new URL(getOmniChatEmbedUrl(options)).origin;\n const document = container.ownerDocument;\n const host = document.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const controller = new AbortController();\n const root = document.createElement(\"div\");\n root.setAttribute(\"data-omni-chat-widget\", \"\");\n const shadow = root.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = widgetStyles;\n const launcher = document.createElement(\"button\");\n const panel = document.createElement(\"dialog\");\n const close = document.createElement(\"button\");\n const frame = document.createElement(\"div\");\n let embed: OmniChatEmbed | undefined;\n let destroyed = false;\n let loaded = false;\n let openRequested = false;\n let appearance = options;\n Object.assign(root.style, {\n position: \"fixed\",\n zIndex: \"2147483000\",\n });\n launcher.type = close.type = \"button\";\n launcher.className = \"launcher\";\n const label = document.createElement(\"span\");\n label.className = \"label\";\n label.textContent = options.launcherLabel ?? \"Chat with us\";\n launcher.append(widgetIcon(document, \"chat\"), label);\n launcher.setAttribute(\"aria-expanded\", \"false\");\n launcher.setAttribute(\"aria-label\", label.textContent);\n panel.hidden = true;\n panel.className = \"panel\";\n panel.setAttribute(\"aria-label\", options.title ?? \"Assistant chat\");\n panel.id = `omni-chat-widget-${++widgetSequence}`;\n launcher.setAttribute(\"aria-controls\", panel.id);\n frame.className = \"frame\";\n close.className = \"close\";\n close.setAttribute(\"aria-label\", \"Close chat\");\n close.title = \"Close chat\";\n close.append(widgetIcon(document, \"close\"));\n const closeChat = () => {\n if (destroyed) return;\n openRequested = false;\n panelController.close();\n launcher.hidden = false;\n launcher.setAttribute(\"aria-expanded\", \"false\");\n launcher.setAttribute(\"aria-label\", label.textContent!);\n launcher.querySelector(\"svg\")?.replaceWith(widgetIcon(document, \"chat\"));\n launcher.focus();\n };\n const panelController = createWidgetPanel(root, panel, closeChat);\n const openChat = () => {\n if (destroyed) return;\n if (!loaded) {\n openRequested = true;\n return;\n }\n embed ??= createOmniChatEmbed(frame, {\n ...appearance,\n onRequestClose: closeChat,\n });\n embed.iframe.style.minHeight = \"0\";\n panelController.open();\n launcher.hidden = appearance.presentation === \"sidebar\";\n launcher.setAttribute(\"aria-expanded\", \"true\");\n launcher.setAttribute(\"aria-label\", \"Close chat\");\n launcher\n .querySelector(\"svg\")\n ?.replaceWith(widgetIcon(document, \"collapse\"));\n embed.focus();\n };\n launcher.addEventListener(\"click\", () =>\n panel.hidden ? openChat() : closeChat(),\n );\n close.addEventListener(\"click\", closeChat);\n shadow.addEventListener(\"keydown\", (event) => {\n if ((event as KeyboardEvent).key === \"Escape\" && !panel.hidden) closeChat();\n });\n panel.append(close, frame);\n shadow.append(style, panel, launcher);\n const ready = loadWidgetConfiguration(\n host,\n origin,\n options.deploymentId,\n controller.signal,\n ).then((configuration) => {\n if (destroyed) return;\n appearance = Object.assign(\n configuration,\n Object.fromEntries(\n Object.entries(options).filter(([, value]) => value !== undefined),\n ),\n );\n root.dataset.position = appearance.position ?? \"right\";\n root.dataset.presentation = appearance.presentation ?? \"floating\";\n const placement = resolveWidgetPlacement(appearance);\n root.style.setProperty(\n \"--omni-bottom-offset\",\n `${placement.bottomOffset}px`,\n );\n root.style.setProperty(\"--omni-side-offset\", `${placement.sideOffset}px`);\n root.style.setProperty(\n \"--omni-mobile-bottom-offset\",\n `${placement.mobileBottomOffset}px`,\n );\n root.style.setProperty(\n \"--omni-mobile-side-offset\",\n `${placement.mobileSideOffset}px`,\n );\n root.style.setProperty(\n \"--omni-launcher-bg\",\n appearance.launcherBackground!,\n );\n root.style.setProperty(\n \"--omni-launcher-fg\",\n appearance.launcherForeground!,\n );\n root.style.setProperty(\"--omni-panel-bg\", appearance.panelBackground!);\n root.style.setProperty(\"--omni-panel-fg\", appearance.panelForeground!);\n label.textContent = appearance.launcherLabel!;\n launcher.setAttribute(\"aria-label\", label.textContent);\n panel.setAttribute(\"aria-label\", appearance.title!);\n loaded = true;\n container.append(root);\n if (openRequested) openChat();\n });\n void ready.catch((error: unknown) => {\n if (!destroyed)\n options.onError?.(\n error instanceof Error ? error : new Error(\"Could not load chat.\"),\n );\n });\n return {\n /** Resolves once saved appearance is loaded and the launcher is mounted. */\n ready,\n open: openChat,\n close: closeChat,\n destroy() {\n destroyed = true;\n controller.abort();\n panelController.destroy();\n embed?.destroy();\n root.remove();\n },\n };\n}\n","import { getOmniChatEmbedUrl, type OmniChatEmbedOptions } from \"./embed\";\nimport type { OmniChatWidgetOptions } from \"./widget\";\n\ntype EmbedCodeOptions = Pick<\n OmniChatEmbedOptions,\n \"baseUrl\" | \"deploymentId\" | \"title\"\n> &\n Pick<\n OmniChatWidgetOptions,\n | \"presentation\"\n | \"launcherLabel\"\n | \"position\"\n | \"bottomOffset\"\n | \"sideOffset\"\n | \"mobileBottomOffset\"\n | \"mobileSideOffset\"\n | \"launcherBackground\"\n | \"launcherForeground\"\n | \"panelBackground\"\n | \"panelForeground\"\n >;\nconst scriptJson = (value: unknown) =>\n JSON.stringify(value, null, 2).replace(\n /[<>&\\u2028\\u2029]/g,\n (character) =>\n `\\\\u${character.charCodeAt(0).toString(16).padStart(4, \"0\")}`,\n );\n\n/** Copyable integrations contain only public deployment configuration. */\nexport function getOmniChatEmbedCode(\n options: EmbedCodeOptions,\n mode: \"widget\" | \"inline\" = \"widget\",\n) {\n const baseUrl = new URL(getOmniChatEmbedUrl(options)).origin;\n const config = { ...options, baseUrl };\n const id = `omni-chat-${options.deploymentId}`;\n const mount =\n mode === \"widget\"\n ? `OmniCommerceChat.createOmniChatWidget(document.body, ${scriptJson(config)});`\n : `OmniCommerceChat.createOmniChatEmbed(document.getElementById(${scriptJson(id)}), ${scriptJson(config)});`;\n return `${mode === \"inline\" ? `<div id=\"${id}\" style=\"height:600px\"></div>\\n` : \"\"}<script src=\"${baseUrl}/sdk/embed.global.js\"></script>\\n<script>\\n ${mount.replace(/\\n/g, \"\\n \")}\\n</script>`;\n}\nexport function getOmniChatReactCode(options: EmbedCodeOptions) {\n const baseUrl = new URL(getOmniChatEmbedUrl(options)).origin;\n return `import { OmniProvider, OmniChat } from \"@omni-commerce/sdk/react\";\\n\\n<OmniProvider deploymentId={${scriptJson(options.deploymentId)}}\\n baseUrl={${scriptJson(baseUrl)}}${options.title ? `\\n title={${scriptJson(options.title)}}` : \"\"}>\\n <OmniChat style={{ height: 600 }} />\\n</OmniProvider>`;\n}\n","import { mountHostedChat, ChatSessionError } from \"./hosted-chat\";\nimport { chatOrigin } from \"./chat-origin\";\nimport { type OmniApplicationOptions } from \"./application\";\nexport type {\n OmniFrontendTool,\n OmniChatApplication,\n OmniApplicationOptions,\n} from \"./application\";\n/** A hosted chat session. Keep its short-lived token in memory, never in iframe URLs. */\nexport {\n createOmniApplicationChatEmbed,\n getOmniApplicationChatUrl,\n type OmniApplicationChatOptions,\n} from \"./application-embed\";\nexport { createOmniChatWidget, type OmniChatWidgetOptions } from \"./widget\";\nexport {\n DEFAULT_WIDGET_OFFSET,\n MAX_WIDGET_OFFSET,\n type OmniChatWidgetPlacement,\n} from \"./widget-placement\";\nexport { getOmniChatEmbedCode, getOmniChatReactCode } from \"./embed-code\";\nexport interface OmniChatSession {\n token: string;\n threadId: string;\n expiresIn: number;\n}\nexport interface OmniChatEmbedOptions extends OmniApplicationOptions {\n deploymentId: string;\n baseUrl?: string;\n /** Optional authenticated session mint on the host application's server. */\n getSession?: () => Promise<OmniChatSession>;\n title?: string;\n onError?: (error: Error) => void;\n /** Floating widgets use this to close on Escape from the hosted chat. */\n onRequestClose?: () => void;\n}\nexport interface OmniChatEmbed {\n iframe: HTMLIFrameElement;\n /** Focus the hosted composer, including when reopening a retained chat. */\n focus(): void;\n destroy(): void;\n}\n\nexport function getOmniChatEmbedUrl(\n options: Pick<OmniChatEmbedOptions, \"baseUrl\" | \"deploymentId\">,\n parentOrigin?: string,\n): string {\n if (\n !/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/i.test(\n options.deploymentId,\n )\n )\n throw new Error(\"A valid chat deployment ID is required.\");\n const base = chatOrigin(options.baseUrl);\n const url = new URL(`/embed/${options.deploymentId}`, base);\n if (parentOrigin)\n url.searchParams.set(\"parentOrigin\", new URL(parentOrigin).origin);\n return url.toString();\n}\n\n/** Browser-only mounting; importing this entry point is safe during SSR. */\nexport function createOmniChatEmbed(\n container: HTMLElement,\n options: OmniChatEmbedOptions,\n): OmniChatEmbed {\n const host = container.ownerDocument.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const url = getOmniChatEmbedUrl(options, host.location.origin);\n const chatOrigin = new URL(url).origin;\n return mountHostedChat(container, options, {\n url,\n scope: { deploymentId: options.deploymentId },\n mint: async (previousToken, visitorId, signal) => {\n if (options.getSession) return options.getSession();\n const response = await host.fetch(\n `${chatOrigin}/api/embed/${options.deploymentId}/session`,\n {\n method: \"POST\",\n credentials: \"include\",\n signal,\n headers: {\n \"Content-Type\": \"application/json\",\n ...(previousToken\n ? { Authorization: `Bearer ${previousToken}` }\n : {}),\n },\n body: JSON.stringify(\n visitorId &&\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(\n visitorId,\n )\n ? { visitorId }\n : {},\n ),\n },\n );\n const result = (await response.json()) as OmniChatSession & {\n error?: string;\n };\n if (!response.ok)\n throw new ChatSessionError(\n result.error ?? \"Could not open the chat session.\",\n response.status,\n );\n return result;\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/application.ts","../../../lib/assistant/application-chat/bridge-scope.ts","../src/hosted-chat.ts","../../../lib/assistant/hosted-chat-origin.ts","../src/chat-origin.ts","../src/application-embed.ts","../src/widget-chrome.ts","../src/widget-placement.ts","../src/widget-config.ts","../src/widget-panel.ts","../src/widget.ts","../src/embed-code.ts","../src/embed.ts"],"names":["chatOrigin"],"mappings":";;;;;;;AAqBA,SAAS,WAAA,CAAY,OAAgB,OAAA,EAA0B;AAC7D,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA;AACpC,EAAA,IACE,OAAO,OAAA,KAAY,QAAA,IACnB,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,OAAO,CAAA,CAAE,MAAA,GAAS,OAAA,IAC3C,6BAAA,CAA8B,KAAK,OAAO,CAAA;AAE1C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AACF,EAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAC3B;AAEO,SAAS,gCAAgC,KAAA,EAK7C;AAED,EAAA,MAAM,KAAA,uBAAY,GAAA,EAGhB;AACF,EAAA,OAAO,OAAO,OAAA,KAAqC;AACjD,IAAA,IAAI,OAAO,OAAA,CAAQ,SAAA,KAAc,QAAA,IAAY,OAAA,CAAQ,UA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AAA,EAAU,GACZ;AAAC;AACP;AACF,OACF;AACA,MAAA,MAAM,MAAA,GAAU,MAAM,QAAA,CAAS,IAAA,EAAK;AAGpC,MAAA,IAAI,CAAC,QAAA,CAAS,EAAA;AACZ,QAAA,MAAM,IAAI,gBAAA;AAAA,UACR,OAAO,KAAA,IAAS,kCAAA;AAAA,UAChB,QAAA,CAAS;AAAA,SACX;AACF,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACD,CAAA;AACH","file":"embed.cjs","sourcesContent":["/** Host-defined actions execute inside the application, never on the assistant server. */\nexport interface OmniFrontendTool {\n description: string;\n parameters: Record<string, unknown>;\n execute: (\n args: Record<string, unknown>,\n context: { toolCallId: string; abortSignal: AbortSignal },\n ) => unknown | Promise<unknown>;\n}\nexport interface OmniChatApplication {\n name: string;\n description: string;\n /** Return a small, explicitly selected snapshot. Do not include secrets. */\n getContext: () => unknown | Promise<unknown>;\n}\nexport interface OmniApplicationOptions {\n application?: OmniChatApplication;\n /** Names must start with app_; use array arguments for actions with multiple targets. */\n frontendTools?: Record<string, OmniFrontendTool>;\n}\n\nfunction boundedJson(value: unknown, maximum: number): unknown {\n const encoded = JSON.stringify(value);\n if (\n typeof encoded !== \"string\" ||\n new TextEncoder().encode(encoded).length > maximum ||\n /data:[^\"\\s]{0,100};base64,/i.test(encoded)\n )\n throw new Error(\n \"Application data must be bounded JSON without base64 payloads.\",\n );\n return JSON.parse(encoded);\n}\n\nexport function createApplicationMessageHandler(input: {\n options: OmniApplicationOptions;\n assistant?: () => { systemPrompt?: string; tools?: readonly string[] };\n signal: AbortSignal;\n reply: (message: Record<string, unknown>) => void;\n}) {\n // A repeated parked call reuses its result instead of applying an action twice.\n const calls = new Map<\n string,\n { signature: string; result: Promise<unknown> }\n >();\n return async (message: Record<string, unknown>) => {\n if (typeof message.requestId !== \"string\" || message.requestId.length > 200)\n return;\n try {\n if (message.type === \"omni-chat:application-request\") {\n const application = input.options.application;\n input.reply({\n type: \"omni-chat:application-response\",\n requestId: message.requestId,\n ...(input.assistant\n ? { assistant: boundedJson(input.assistant(), 65536) }\n : {}),\n application: application\n ? boundedJson(\n {\n name: application.name,\n description: application.description,\n context: (await application.getContext()) ?? null,\n tools: Object.entries(input.options.frontendTools ?? {}).map(\n ([name, definition]) => ({\n name,\n description: definition.description,\n parameters: definition.parameters,\n }),\n ),\n },\n 65536,\n )\n : undefined,\n });\n } else if (message.type === \"omni-chat:tool-request\") {\n const name = message.toolName;\n const toolCallId = message.toolCallId;\n if (\n typeof name !== \"string\" ||\n !/^app_[a-z][a-z0-9_]{0,59}$/.test(name) ||\n typeof toolCallId !== \"string\" ||\n !toolCallId ||\n toolCallId.length > 200\n )\n throw new Error(\"Invalid application tool request.\");\n const definition = Object.hasOwn(\n input.options.frontendTools ?? {},\n name,\n )\n ? input.options.frontendTools?.[name]\n : undefined;\n if (!input.options.application || !definition)\n throw new Error(\"This application action is unavailable.\");\n const args = message.args;\n if (!args || typeof args !== \"object\" || Array.isArray(args))\n throw new Error(\"Invalid application action arguments.\");\n const signature = JSON.stringify({ name, args });\n const prior = calls.get(toolCallId);\n if (prior && prior.signature !== signature)\n throw new Error(\"This tool call ID was already used.\");\n const result =\n prior?.result ??\n Promise.resolve().then(() =>\n definition.execute(args as Record<string, unknown>, {\n toolCallId,\n abortSignal: input.signal,\n }),\n );\n if (!prior) {\n if (calls.size >= 200)\n throw new Error(\"Start a new application chat.\");\n calls.set(toolCallId, { signature, result });\n }\n input.reply({\n type: \"omni-chat:tool-response\",\n requestId: message.requestId,\n toolCallId,\n result: boundedJson((await result) ?? null, 12000),\n });\n }\n } catch (error) {\n input.reply({\n type:\n message.type === \"omni-chat:application-request\"\n ? \"omni-chat:application-response\"\n : \"omni-chat:tool-response\",\n requestId: message.requestId,\n toolCallId: message.toolCallId,\n error:\n error instanceof Error\n ? error.message\n : \"The application action failed.\",\n });\n }\n };\n}\n","/** Scope each hosted frame independently; application chats have no deployment. */\nexport type HostedChatScope =\n | { deploymentId: string; chatId?: never }\n | { chatId: string; deploymentId?: never };\n\nexport function hostedChatId(scope: HostedChatScope) {\n return scope.deploymentId ?? scope.chatId;\n}\n\nexport function matchesHostedChatScope(\n message: Record<string, unknown> | null | undefined,\n scope: HostedChatScope,\n) {\n return scope.deploymentId !== undefined\n ? message?.deploymentId === scope.deploymentId &&\n message.chatId === undefined\n : message?.chatId === scope.chatId && message.deploymentId === undefined;\n}\n","import {\n createApplicationMessageHandler,\n type OmniApplicationOptions,\n} from \"./application\";\nimport {\n matchesHostedChatScope,\n type HostedChatScope,\n} from \"../../../lib/assistant/application-chat/bridge-scope\";\nimport type { OmniChatEmbed, OmniChatSession } from \"./embed\";\n\nexport interface OmniHostedChatOptions extends OmniApplicationOptions {\n baseUrl?: string;\n title?: string;\n onError?: (error: Error) => void;\n onRequestClose?: () => void;\n}\n\nexport class ChatSessionError extends Error {\n constructor(\n message: string,\n readonly status: number,\n ) {\n super(message);\n }\n}\n\n/** One frame broker for member application chat and published storefront chat. */\nexport function mountHostedChat(\n container: HTMLElement,\n options: OmniHostedChatOptions,\n target: {\n url: string;\n scope: HostedChatScope;\n assistant?: () => { systemPrompt?: string; tools?: readonly string[] };\n mint?: (\n previousToken: string | undefined,\n visitorId: string | undefined,\n signal: AbortSignal,\n ) => Promise<OmniChatSession>;\n },\n): OmniChatEmbed {\n const document = container.ownerDocument;\n const host = document.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const iframe = document.createElement(\"iframe\");\n iframe.src = target.url;\n iframe.title = options.title ?? \"OmniCommerce assistant\";\n iframe.referrerPolicy = \"strict-origin-when-cross-origin\";\n iframe.setAttribute(\n \"sandbox\",\n \"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox\",\n );\n Object.assign(iframe.style, {\n width: \"100%\",\n height: \"100%\",\n minHeight: \"320px\",\n border: \"0\",\n display: \"block\",\n });\n const chatOrigin = new URL(iframe.src).origin;\n let destroyed = false;\n let pending: Promise<OmniChatSession> | undefined;\n let previousToken: string | undefined;\n const controller = new AbortController();\n\n const applicationMessage = createApplicationMessageHandler({\n options,\n assistant: target.assistant,\n signal: controller.signal,\n reply: (message) => {\n if (!destroyed)\n iframe.contentWindow?.postMessage(\n { ...message, ...target.scope },\n chatOrigin,\n );\n },\n });\n const receive = (event: MessageEvent) => {\n if (\n destroyed ||\n event.source !== iframe.contentWindow ||\n event.origin !== chatOrigin ||\n !matchesHostedChatScope(event.data, target.scope)\n )\n return;\n if (\n event.data.type === \"omni-chat:application-request\" ||\n event.data.type === \"omni-chat:tool-request\"\n ) {\n void applicationMessage(event.data);\n return;\n }\n if (event.data.type === \"omni-chat:close-request\") {\n options.onRequestClose?.();\n return;\n }\n if (event.data.type !== \"omni-chat:session-request\" || !target.mint) return;\n const visitorId =\n typeof event.data.visitorId === \"string\"\n ? event.data.visitorId\n : undefined;\n pending ??= target.mint(previousToken, visitorId, controller.signal);\n void pending\n .then((session) => {\n if (destroyed) return;\n if (\n typeof session?.token !== \"string\" ||\n !session.token ||\n session.token.length > 4096 ||\n typeof session.threadId !== \"string\" ||\n !session.threadId ||\n !Number.isFinite(session.expiresIn) ||\n session.expiresIn <= 0\n )\n throw new Error(\"Invalid chat session response.\");\n previousToken = session.token;\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:session\",\n ...target.scope,\n session,\n ...(options.application ? { applicationEnabled: true } : {}),\n },\n chatOrigin,\n );\n })\n .catch((error: unknown) => {\n if (destroyed) return;\n const failure =\n error instanceof Error ? error : new Error(\"Could not open chat.\");\n if (\n failure instanceof ChatSessionError &&\n [401, 403].includes(failure.status)\n )\n previousToken = undefined;\n options.onError?.(failure);\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:session-error\",\n ...target.scope,\n error: failure.message,\n ...(options.application ? { applicationEnabled: true } : {}),\n },\n chatOrigin,\n );\n })\n .finally(() => {\n pending = undefined;\n });\n };\n host.addEventListener(\"message\", receive);\n container.append(iframe);\n return {\n iframe,\n focus() {\n if (destroyed) return;\n iframe.focus();\n iframe.contentWindow?.postMessage(\n {\n type: \"omni-chat:focus-composer\",\n ...target.scope,\n },\n chatOrigin,\n );\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n controller.abort();\n previousToken = undefined;\n host.removeEventListener(\"message\", receive);\n iframe.remove();\n },\n };\n}\n","/** Exact hosted-chat origins, including trustworthy localhost development hosts. */\nexport function normalizeHostedChatOrigin(value: string): string {\n const url = new URL(value);\n const local =\n url.hostname === \"localhost\" ||\n url.hostname.endsWith(\".localhost\") ||\n url.hostname === \"127.0.0.1\";\n if (\n (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && local)) ||\n url.username ||\n url.password ||\n url.pathname !== \"/\" ||\n url.search ||\n url.hash\n )\n throw new Error(\"Use an HTTPS origin, or HTTP localhost for development.\");\n return url.origin;\n}\n","import { normalizeHostedChatOrigin } from \"../../../lib/assistant/hosted-chat-origin\";\n\nexport function chatOrigin(baseUrl?: string): string {\n return normalizeHostedChatOrigin(baseUrl ?? \"https://omnicommerce.sg\");\n}\n","import { chatOrigin } from \"./chat-origin\";\nimport { mountHostedChat, type OmniHostedChatOptions } from \"./hosted-chat\";\n\n/** Application chat authenticates the viewer; it never uses a storefront deployment. */\nexport interface OmniApplicationChatOptions extends OmniHostedChatOptions {\n deploymentId?: never;\n /** Omit to use the member's currently selected organization. */\n organizationId?: string;\n /** Omit to use the default native assistant. */\n agentId?: string;\n /** Groups this application's conversation history; defaults to its origin. */\n appId?: string;\n /** Application role instructions. Omit or clear to use the selected agent's prompt. */\n systemPrompt?: string;\n /** Backend tool/toolkit allowlist within the selected agent's permissions.\n * Omit to inherit; [] allows only registered frontendTools. */\n tools?: readonly string[];\n}\n\nexport function getOmniApplicationChatUrl(\n options: OmniApplicationChatOptions,\n parentOrigin: string,\n chatId: string,\n) {\n if (\n !/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/i.test(chatId)\n )\n throw new Error(\"A valid application chat ID is required.\");\n const url = new URL(\"/sdk/application-chat\", chatOrigin(options.baseUrl));\n const parent = chatOrigin(parentOrigin);\n url.searchParams.set(\"parentOrigin\", parent);\n url.searchParams.set(\"chatId\", chatId);\n const appId = options.appId?.trim() ?? parent;\n if (!appId || appId.length > 200)\n throw new Error(\"appId must contain 1–200 characters.\");\n url.searchParams.set(\"appId\", appId);\n for (const key of [\"organizationId\", \"agentId\"] as const) {\n if (options[key] === undefined) continue;\n const value = options[key].trim();\n if (!value || value.length > 120)\n throw new Error(`${key} must contain 1–120 characters.`);\n url.searchParams.set(key, value);\n }\n return url.toString();\n}\n\nexport function createOmniApplicationChatEmbed(\n container: HTMLElement,\n options: OmniApplicationChatOptions,\n) {\n const host = container.ownerDocument.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const chatId = host.crypto.randomUUID();\n return mountHostedChat(container, options, {\n url: getOmniApplicationChatUrl(options, host.location.origin, chatId),\n scope: { chatId },\n assistant: () => ({\n ...(options.systemPrompt !== undefined\n ? { systemPrompt: options.systemPrompt }\n : {}),\n ...(options.tools !== undefined ? { tools: options.tools } : {}),\n }),\n });\n}\n","const iconPaths = {\n chat: \"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5Z\",\n close: \"m6 6 12 12M6 18 18 6\",\n collapse: \"m6 9 6 6 6-6\",\n};\n\nexport function widgetIcon(document: Document, name: keyof typeof iconPaths) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.8\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", iconPaths[name]);\n svg.append(path);\n return svg;\n}\n\nexport const widgetMobileQuery =\n \"(max-width: 640px), (max-height: 480px) and (pointer: coarse)\";\n\n/** Shadow DOM keeps a store's button, font and dialog CSS out of the widget. */\nexport const widgetStyles = `\n :host {\n all: initial; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; color-scheme: light dark;\n --omni-active-bottom-offset: var(--omni-bottom-offset);\n --omni-active-side-offset: var(--omni-side-offset);\n --omni-side-safe-area: env(safe-area-inset-right, 0px);\n --omni-opposite-safe-area: env(safe-area-inset-left, 0px);\n /* Reserve 240px of panel height, the 66px launcher gap and 20px at the opposite edges. */\n --omni-effective-bottom-offset: clamp(0px, calc(var(--omni-active-bottom-offset) + env(safe-area-inset-bottom, 0px)), max(0px, calc(100dvh - 326px - env(safe-area-inset-top, 0px))));\n --omni-effective-side-offset: clamp(0px, calc(var(--omni-active-side-offset) + var(--omni-side-safe-area)), max(0px, calc(100vw - 260px - var(--omni-opposite-safe-area))));\n bottom: var(--omni-effective-bottom-offset); right: var(--omni-effective-side-offset);\n width: max-content; max-width: calc(100vw - var(--omni-effective-side-offset) - 20px - var(--omni-opposite-safe-area));\n }\n *, *::before, *::after { box-sizing: border-box; }\n button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }\n button:focus-visible { outline: 3px solid var(--omni-launcher-bg); outline-offset: 4px; }\n svg { display: block; width: 22px; height: 22px; flex: none; }\n .launcher {\n display: flex; align-items: center; justify-content: center; gap: 10px;\n height: 52px; padding: 0 20px; border: 1px solid rgba(255,255,255,.14);\n border-radius: 999px; background: var(--omni-launcher-bg); color: var(--omni-launcher-fg);\n font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: -.01em;\n box-shadow: 0 6px 24px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.08);\n transition: transform 160ms ease, box-shadow 160ms ease;\n margin-left: auto;\n max-width: 100%;\n }\n .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.2); }\n .launcher[hidden] { display: none; }\n .launcher[aria-expanded=\"true\"] { width: 52px; padding: 0; }\n .launcher[aria-expanded=\"true\"] .label { display: none; }\n .panel {\n position: absolute; top: auto; bottom: 66px; right: 0; left: auto; width: min(392px, calc(100vw - var(--omni-effective-side-offset) - 20px - var(--omni-opposite-safe-area)));\n margin: 0; padding: 0; max-width: none; max-height: none; color: var(--omni-panel-fg);\n overflow: hidden; border: 0; border-radius: 20px;\n background: var(--omni-panel-bg); box-shadow: 0 24px 80px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.06);\n animation: omni-chat-enter 180ms ease-out;\n }\n .panel[hidden] { display: none; }\n .panel::backdrop { background: transparent; }\n .frame { height: min(780px, calc(100dvh - var(--omni-effective-bottom-offset) - 92px - env(safe-area-inset-top, 0px))); min-height: 240px; }\n .close {\n position: absolute; z-index: 1; top: 18px; right: 14px;\n display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;\n border: 1px solid color-mix(in srgb, var(--omni-panel-fg) 10%, transparent); border-radius: 50%;\n background: var(--omni-panel-bg); color: var(--omni-panel-fg); transition: background 160ms ease;\n }\n .close svg { width: 17px; height: 17px; }\n .close:hover { background: color-mix(in srgb, var(--omni-panel-fg) 6%, var(--omni-panel-bg)); }\n :host([data-position=\"left\"]) {\n --omni-side-safe-area: env(safe-area-inset-left, 0px);\n --omni-opposite-safe-area: env(safe-area-inset-right, 0px);\n right: auto; left: var(--omni-effective-side-offset);\n }\n :host([data-position=\"left\"]) .panel { right: auto; left: 0; }\n :host([data-position=\"left\"]) .launcher { margin-left: 0; }\n :host([data-presentation=\"sidebar\"]) .panel {\n position: fixed; top: 0; bottom: 0; right: 0; left: auto;\n width: min(440px, 100vw); border-radius: 0;\n animation: omni-sidebar-enter 180ms ease-out;\n }\n :host([data-presentation=\"sidebar\"]) .frame { height: 100dvh; min-height: 0; }\n :host([data-presentation=\"sidebar\"][data-position=\"left\"]) .panel {\n right: auto; left: 0; animation-name: omni-sidebar-enter-left;\n }\n @keyframes omni-sidebar-enter { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: none; } }\n @keyframes omni-sidebar-enter-left { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: none; } }\n @keyframes omni-chat-enter { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }\n @keyframes omni-chat-mobile-enter { from { opacity: 0; } to { opacity: 1; } }\n @media ${widgetMobileQuery} {\n :host {\n --omni-active-bottom-offset: var(--omni-mobile-bottom-offset);\n --omni-active-side-offset: var(--omni-mobile-side-offset);\n /* Mobile panels fill the screen independently; only the closed pill needs to fit. */\n --omni-effective-bottom-offset: clamp(0px, calc(var(--omni-active-bottom-offset) + env(safe-area-inset-bottom, 0px)), max(0px, calc(100dvh - 72px - env(safe-area-inset-top, 0px))));\n --omni-effective-side-offset: clamp(0px, calc(var(--omni-active-side-offset) + var(--omni-side-safe-area)), max(0px, calc(100vw - 112px - var(--omni-opposite-safe-area))));\n }\n :host([data-presentation]) .panel {\n position: fixed; top: 0; right: 0; bottom: auto; left: 0;\n width: 100%; height: 100vh; height: var(--omni-viewport-height, 100dvh);\n transform: translateY(var(--omni-viewport-shift, 0px));\n transition: transform 180ms ease-out;\n border: 0; border-radius: 0; box-shadow: none; animation: omni-chat-mobile-enter 180ms ease-out;\n }\n :host([data-presentation]) .frame {\n height: 100%; min-height: 0;\n padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);\n }\n .launcher[aria-expanded=\"true\"] { display: none; }\n .close { top: calc(18px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }\n }\n @media (prefers-reduced-motion: reduce) { :host([data-presentation][data-position]) .panel { animation: none; transition: none; } .launcher { transition: none; } }\n`;\n","export const DEFAULT_WIDGET_OFFSET = 20;\nexport const MAX_WIDGET_OFFSET = 500;\n\nexport type OmniChatWidgetPlacement = {\n /** Desktop distance from the bottom edge, in pixels. */\n bottomOffset: number;\n /** Desktop distance from the selected side, in pixels. */\n sideOffset: number;\n /** Mobile distance from the bottom edge, in pixels. */\n mobileBottomOffset: number;\n /** Mobile distance from the selected side, in pixels. */\n mobileSideOffset: number;\n};\n\n/** Saved designs and SDK overrides use the same bounded pixel values. */\nexport function resolveWidgetPlacement(\n options: Partial<OmniChatWidgetPlacement>,\n): OmniChatWidgetPlacement {\n const offset = (value: number | undefined) => {\n if (value === undefined) return DEFAULT_WIDGET_OFFSET;\n if (!Number.isInteger(value) || value < 0 || value > MAX_WIDGET_OFFSET)\n throw new Error(\n `Chat spacing must be whole pixels between 0 and ${MAX_WIDGET_OFFSET}.`,\n );\n return value;\n };\n return {\n bottomOffset: offset(options.bottomOffset),\n sideOffset: offset(options.sideOffset),\n mobileBottomOffset: offset(options.mobileBottomOffset),\n mobileSideOffset: offset(options.mobileSideOffset),\n };\n}\n","import type { OmniChatWidgetOptions } from \"./widget\";\nimport { resolveWidgetPlacement } from \"./widget-placement\";\n\n/** Only public appearance is loaded here; agent settings remain on the server. */\nexport async function loadWidgetConfiguration(\n host: Window,\n origin: string,\n deploymentId: string,\n signal: AbortSignal,\n): Promise<OmniChatWidgetOptions> {\n const response = await host.fetch(`${origin}/api/embed/${deploymentId}`, {\n credentials: \"include\",\n cache: \"no-store\",\n signal,\n });\n const result = await response.json();\n if (!response.ok)\n throw new Error(result.error ?? \"Could not load the chat design.\");\n const design = result.design;\n const color = /^#[0-9a-f]{6}$/i;\n if (\n !design ||\n typeof design.title !== \"string\" ||\n !design.title.trim() ||\n design.title.length > 80 ||\n typeof design.launcherLabel !== \"string\" ||\n !design.launcherLabel.trim() ||\n design.launcherLabel.length > 60 ||\n ![\"left\", \"right\"].includes(design.position) ||\n ![\"floating\", \"sidebar\"].includes(design.presentation) ||\n !design.theme ||\n ![\n design.theme.primary,\n design.theme.primaryForeground,\n design.theme.background,\n design.theme.foreground,\n ].every((value) => typeof value === \"string\" && color.test(value))\n )\n throw new Error(\"Invalid chat design response.\");\n return {\n ...resolveWidgetPlacement(design),\n deploymentId,\n title: design.title,\n launcherLabel: design.launcherLabel,\n position: design.position,\n presentation: design.presentation,\n launcherBackground: design.theme.primary,\n launcherForeground: design.theme.primaryForeground,\n panelBackground: design.theme.background,\n panelForeground: design.theme.foreground,\n };\n}\n","import { widgetMobileQuery } from \"./widget-chrome\";\nconst scrollLocks = new WeakMap<Document, { count: number; release(): void }>();\n\nfunction lockScroll(document: Document) {\n let lock = scrollLocks.get(document);\n if (!lock) {\n const styles = [document.documentElement.style, document.body.style];\n const saved = styles.map((style) => ({\n value: style.getPropertyValue(\"overflow\"),\n priority: style.getPropertyPriority(\"overflow\"),\n }));\n styles.forEach((style) =>\n style.setProperty(\"overflow\", \"hidden\", \"important\"),\n );\n lock = {\n count: 0,\n release() {\n styles.forEach((style, index) => {\n const { value, priority } = saved[index]!;\n if (value) style.setProperty(\"overflow\", value, priority);\n else style.removeProperty(\"overflow\");\n });\n },\n };\n scrollLocks.set(document, lock);\n }\n lock.count++;\n return () => {\n if (--lock.count === 0) {\n lock.release();\n scrollLocks.delete(document);\n }\n };\n}\n\n/** Mobile modality and keyboard sizing belong to the host, outside the chat iframe. */\nexport function createWidgetPanel(\n root: HTMLElement,\n panel: HTMLDialogElement,\n onRequestClose: () => void,\n) {\n const host = root.ownerDocument.defaultView!;\n const mobile = host.matchMedia(widgetMobileQuery);\n const viewport = host.visualViewport;\n let modal = false;\n let releaseScroll: (() => void) | undefined;\n let viewportFrame: number | undefined;\n const cancelViewportFrame = () => {\n if (viewportFrame === undefined) return;\n host.cancelAnimationFrame(viewportFrame);\n viewportFrame = undefined;\n };\n const clearViewport = () => {\n root.style.removeProperty(\"--omni-viewport-shift\");\n root.style.removeProperty(\"--omni-viewport-height\");\n };\n const resize = () => {\n // Keep pinch zoom available; only position above the keyboard at normal scale.\n if (panel.hidden || !mobile.matches || !viewport || viewport.scale !== 1) {\n clearViewport();\n return;\n }\n // When the keyboard reduces the visual viewport, keep the iframe at the\n // layout height and move its bottom to the visible bottom edge.\n const document = root.ownerDocument;\n const viewportRoot =\n document.compatMode === \"CSS1Compat\"\n ? document.documentElement\n : document.body;\n const height = viewportRoot.clientHeight || host.innerHeight;\n // Safari can pan before reporting the keyboard's reduced height. Never\n // counteract that native upward movement with a downward translation.\n const shift = Math.min(0, viewport.offsetTop + viewport.height - height);\n root.style.setProperty(\"--omni-viewport-shift\", `${shift}px`);\n const heightValue = `${height}px`;\n if (root.style.getPropertyValue(\"--omni-viewport-height\") !== heightValue)\n root.style.setProperty(\"--omni-viewport-height\", heightValue);\n };\n const scheduleResize = () => {\n if (viewportFrame !== undefined) return;\n viewportFrame = host.requestAnimationFrame(() => {\n viewportFrame = undefined;\n resize();\n });\n };\n const show = () => {\n if (panel.hidden) return;\n let focused: HTMLElement | null = null;\n if (panel.open && modal !== mobile.matches) {\n focused = root.shadowRoot?.activeElement as HTMLElement | null;\n panel.close();\n }\n modal = mobile.matches;\n if (modal) releaseScroll ??= lockScroll(root.ownerDocument);\n else {\n releaseScroll?.();\n releaseScroll = undefined;\n }\n cancelViewportFrame();\n resize();\n if (!panel.open) {\n if (modal) panel.showModal();\n else panel.show();\n }\n if (focused && panel.contains(focused)) focused.focus();\n };\n const cancel = (event: Event) => {\n event.preventDefault();\n onRequestClose();\n };\n const close = () => {\n cancelViewportFrame();\n panel.hidden = true;\n if (panel.open) panel.close();\n releaseScroll?.();\n releaseScroll = undefined;\n clearViewport();\n };\n mobile.addEventListener(\"change\", show);\n viewport?.addEventListener(\"resize\", scheduleResize);\n viewport?.addEventListener(\"scroll\", scheduleResize);\n panel.addEventListener(\"cancel\", cancel);\n return {\n open() {\n panel.hidden = false;\n show();\n },\n close,\n destroy() {\n close();\n mobile.removeEventListener(\"change\", show);\n viewport?.removeEventListener(\"resize\", scheduleResize);\n viewport?.removeEventListener(\"scroll\", scheduleResize);\n panel.removeEventListener(\"cancel\", cancel);\n },\n };\n}\n","import {\n createOmniChatEmbed,\n getOmniChatEmbedUrl,\n type OmniChatEmbedOptions,\n type OmniChatEmbed,\n} from \"./embed\";\nimport { widgetIcon, widgetStyles } from \"./widget-chrome\";\nimport { loadWidgetConfiguration } from \"./widget-config\";\nimport { createWidgetPanel } from \"./widget-panel\";\nimport {\n resolveWidgetPlacement,\n type OmniChatWidgetPlacement,\n} from \"./widget-placement\";\n\nexport type OmniChatWidgetOptions = OmniChatEmbedOptions &\n Partial<OmniChatWidgetPlacement> & {\n /** Desktop layout; both presentations fill the viewport on mobile. */\n presentation?: \"floating\" | \"sidebar\";\n launcherLabel?: string;\n position?: \"left\" | \"right\";\n launcherBackground?: string;\n launcherForeground?: string;\n panelBackground?: string;\n panelForeground?: string;\n };\nlet widgetSequence = 0;\n/** Loads saved appearance by deployment ID. Explicit options override saved appearance. */\nexport function createOmniChatWidget(\n container: HTMLElement,\n options: OmniChatWidgetOptions,\n) {\n const origin = new URL(getOmniChatEmbedUrl(options)).origin;\n const document = container.ownerDocument;\n const host = document.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const controller = new AbortController();\n const root = document.createElement(\"div\");\n root.setAttribute(\"data-omni-chat-widget\", \"\");\n const shadow = root.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = widgetStyles;\n const launcher = document.createElement(\"button\");\n const panel = document.createElement(\"dialog\");\n const close = document.createElement(\"button\");\n const frame = document.createElement(\"div\");\n let embed: OmniChatEmbed | undefined;\n let destroyed = false;\n let loaded = false;\n let openRequested = false;\n let appearance = options;\n Object.assign(root.style, {\n position: \"fixed\",\n zIndex: \"2147483000\",\n });\n launcher.type = close.type = \"button\";\n launcher.className = \"launcher\";\n const label = document.createElement(\"span\");\n label.className = \"label\";\n label.textContent = options.launcherLabel ?? \"Chat with us\";\n launcher.append(widgetIcon(document, \"chat\"), label);\n launcher.setAttribute(\"aria-expanded\", \"false\");\n launcher.setAttribute(\"aria-label\", label.textContent);\n panel.hidden = true;\n panel.className = \"panel\";\n panel.setAttribute(\"aria-label\", options.title ?? \"Assistant chat\");\n panel.id = `omni-chat-widget-${++widgetSequence}`;\n launcher.setAttribute(\"aria-controls\", panel.id);\n frame.className = \"frame\";\n close.className = \"close\";\n close.setAttribute(\"aria-label\", \"Close chat\");\n close.title = \"Close chat\";\n close.append(widgetIcon(document, \"close\"));\n const closeChat = () => {\n if (destroyed) return;\n openRequested = false;\n panelController.close();\n launcher.hidden = false;\n launcher.setAttribute(\"aria-expanded\", \"false\");\n launcher.setAttribute(\"aria-label\", label.textContent!);\n launcher.querySelector(\"svg\")?.replaceWith(widgetIcon(document, \"chat\"));\n launcher.focus();\n };\n const panelController = createWidgetPanel(root, panel, closeChat);\n const openChat = () => {\n if (destroyed) return;\n if (!loaded) {\n openRequested = true;\n return;\n }\n embed ??= createOmniChatEmbed(frame, {\n ...appearance,\n onRequestClose: closeChat,\n });\n embed.iframe.style.minHeight = \"0\";\n panelController.open();\n launcher.hidden = appearance.presentation === \"sidebar\";\n launcher.setAttribute(\"aria-expanded\", \"true\");\n launcher.setAttribute(\"aria-label\", \"Close chat\");\n launcher\n .querySelector(\"svg\")\n ?.replaceWith(widgetIcon(document, \"collapse\"));\n embed.focus();\n };\n launcher.addEventListener(\"click\", () =>\n panel.hidden ? openChat() : closeChat(),\n );\n close.addEventListener(\"click\", closeChat);\n shadow.addEventListener(\"keydown\", (event) => {\n if ((event as KeyboardEvent).key === \"Escape\" && !panel.hidden) closeChat();\n });\n panel.append(close, frame);\n shadow.append(style, panel, launcher);\n const ready = loadWidgetConfiguration(\n host,\n origin,\n options.deploymentId,\n controller.signal,\n ).then((configuration) => {\n if (destroyed) return;\n appearance = Object.assign(\n configuration,\n Object.fromEntries(\n Object.entries(options).filter(([, value]) => value !== undefined),\n ),\n );\n root.dataset.position = appearance.position ?? \"right\";\n root.dataset.presentation = appearance.presentation ?? \"floating\";\n const placement = resolveWidgetPlacement(appearance);\n root.style.setProperty(\n \"--omni-bottom-offset\",\n `${placement.bottomOffset}px`,\n );\n root.style.setProperty(\"--omni-side-offset\", `${placement.sideOffset}px`);\n root.style.setProperty(\n \"--omni-mobile-bottom-offset\",\n `${placement.mobileBottomOffset}px`,\n );\n root.style.setProperty(\n \"--omni-mobile-side-offset\",\n `${placement.mobileSideOffset}px`,\n );\n root.style.setProperty(\n \"--omni-launcher-bg\",\n appearance.launcherBackground!,\n );\n root.style.setProperty(\n \"--omni-launcher-fg\",\n appearance.launcherForeground!,\n );\n root.style.setProperty(\"--omni-panel-bg\", appearance.panelBackground!);\n root.style.setProperty(\"--omni-panel-fg\", appearance.panelForeground!);\n label.textContent = appearance.launcherLabel!;\n launcher.setAttribute(\"aria-label\", label.textContent);\n panel.setAttribute(\"aria-label\", appearance.title!);\n loaded = true;\n container.append(root);\n if (openRequested) openChat();\n });\n void ready.catch((error: unknown) => {\n if (!destroyed)\n options.onError?.(\n error instanceof Error ? error : new Error(\"Could not load chat.\"),\n );\n });\n return {\n /** Resolves once saved appearance is loaded and the launcher is mounted. */\n ready,\n open: openChat,\n close: closeChat,\n destroy() {\n destroyed = true;\n controller.abort();\n panelController.destroy();\n embed?.destroy();\n root.remove();\n },\n };\n}\n","import { getOmniChatEmbedUrl, type OmniChatEmbedOptions } from \"./embed\";\nimport type { OmniChatWidgetOptions } from \"./widget\";\n\ntype EmbedCodeOptions = Pick<\n OmniChatEmbedOptions,\n \"baseUrl\" | \"deploymentId\" | \"title\"\n> &\n Pick<\n OmniChatWidgetOptions,\n | \"presentation\"\n | \"launcherLabel\"\n | \"position\"\n | \"bottomOffset\"\n | \"sideOffset\"\n | \"mobileBottomOffset\"\n | \"mobileSideOffset\"\n | \"launcherBackground\"\n | \"launcherForeground\"\n | \"panelBackground\"\n | \"panelForeground\"\n >;\nconst scriptJson = (value: unknown) =>\n JSON.stringify(value, null, 2).replace(\n /[<>&\\u2028\\u2029]/g,\n (character) =>\n `\\\\u${character.charCodeAt(0).toString(16).padStart(4, \"0\")}`,\n );\n\n/** Copyable integrations contain only public deployment configuration. */\nexport function getOmniChatEmbedCode(\n options: EmbedCodeOptions,\n mode: \"widget\" | \"inline\" = \"widget\",\n) {\n const baseUrl = new URL(getOmniChatEmbedUrl(options)).origin;\n const config = { ...options, baseUrl };\n const id = `omni-chat-${options.deploymentId}`;\n const mount =\n mode === \"widget\"\n ? `OmniCommerceChat.createOmniChatWidget(document.body, ${scriptJson(config)});`\n : `OmniCommerceChat.createOmniChatEmbed(document.getElementById(${scriptJson(id)}), ${scriptJson(config)});`;\n return `${mode === \"inline\" ? `<div id=\"${id}\" style=\"height:600px\"></div>\\n` : \"\"}<script src=\"${baseUrl}/sdk/embed.global.js\"></script>\\n<script>\\n ${mount.replace(/\\n/g, \"\\n \")}\\n</script>`;\n}\nexport function getOmniChatReactCode(options: EmbedCodeOptions) {\n const baseUrl = new URL(getOmniChatEmbedUrl(options)).origin;\n return `import { OmniProvider, OmniChat } from \"@omni-commerce/sdk/react\";\\n\\n<OmniProvider deploymentId={${scriptJson(options.deploymentId)}}\\n baseUrl={${scriptJson(baseUrl)}}${options.title ? `\\n title={${scriptJson(options.title)}}` : \"\"}>\\n <OmniChat style={{ height: 600 }} />\\n</OmniProvider>`;\n}\n","import { mountHostedChat, ChatSessionError } from \"./hosted-chat\";\nimport { chatOrigin } from \"./chat-origin\";\nimport { type OmniApplicationOptions } from \"./application\";\nexport type {\n OmniFrontendTool,\n OmniChatApplication,\n OmniApplicationOptions,\n} from \"./application\";\n/** A hosted chat session. Keep its short-lived token in memory, never in iframe URLs. */\nexport {\n createOmniApplicationChatEmbed,\n getOmniApplicationChatUrl,\n type OmniApplicationChatOptions,\n} from \"./application-embed\";\nexport { createOmniChatWidget, type OmniChatWidgetOptions } from \"./widget\";\nexport {\n DEFAULT_WIDGET_OFFSET,\n MAX_WIDGET_OFFSET,\n type OmniChatWidgetPlacement,\n} from \"./widget-placement\";\nexport { getOmniChatEmbedCode, getOmniChatReactCode } from \"./embed-code\";\nexport interface OmniChatSession {\n token: string;\n threadId: string;\n expiresIn: number;\n}\nexport interface OmniChatEmbedOptions extends OmniApplicationOptions {\n deploymentId: string;\n baseUrl?: string;\n /** Optional authenticated session mint on the host application's server. */\n getSession?: () => Promise<OmniChatSession>;\n title?: string;\n onError?: (error: Error) => void;\n /** Floating widgets use this to close on Escape from the hosted chat. */\n onRequestClose?: () => void;\n}\nexport interface OmniChatEmbed {\n iframe: HTMLIFrameElement;\n /** Focus the hosted composer, including when reopening a retained chat. */\n focus(): void;\n destroy(): void;\n}\n\nexport function getOmniChatEmbedUrl(\n options: Pick<OmniChatEmbedOptions, \"baseUrl\" | \"deploymentId\">,\n parentOrigin?: string,\n): string {\n if (\n !/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/i.test(\n options.deploymentId,\n )\n )\n throw new Error(\"A valid chat deployment ID is required.\");\n const base = chatOrigin(options.baseUrl);\n const url = new URL(`/embed/${options.deploymentId}`, base);\n if (parentOrigin)\n url.searchParams.set(\"parentOrigin\", new URL(parentOrigin).origin);\n return url.toString();\n}\n\n/** Browser-only mounting; importing this entry point is safe during SSR. */\nexport function createOmniChatEmbed(\n container: HTMLElement,\n options: OmniChatEmbedOptions,\n): OmniChatEmbed {\n const host = container.ownerDocument.defaultView;\n if (!host) throw new Error(\"A browser document is required to mount chat.\");\n const url = getOmniChatEmbedUrl(options, host.location.origin);\n const chatOrigin = new URL(url).origin;\n return mountHostedChat(container, options, {\n url,\n scope: { deploymentId: options.deploymentId },\n mint: async (previousToken, visitorId, signal) => {\n if (options.getSession) return options.getSession();\n const response = await host.fetch(\n `${chatOrigin}/api/embed/${options.deploymentId}/session`,\n {\n method: \"POST\",\n credentials: \"include\",\n signal,\n headers: {\n \"Content-Type\": \"application/json\",\n ...(previousToken\n ? { Authorization: `Bearer ${previousToken}` }\n : {}),\n },\n body: JSON.stringify(\n visitorId &&\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(\n visitorId,\n )\n ? { visitorId }\n : {},\n ),\n },\n );\n const result = (await response.json()) as OmniChatSession & {\n error?: string;\n };\n if (!response.ok)\n throw new ChatSessionError(\n result.error ?? \"Could not open the chat session.\",\n response.status,\n );\n return result;\n },\n });\n}\n"]}
|
package/dist/embed.d.cts
CHANGED
|
@@ -35,6 +35,11 @@ interface OmniApplicationChatOptions extends OmniHostedChatOptions {
|
|
|
35
35
|
agentId?: string;
|
|
36
36
|
/** Groups this application's conversation history; defaults to its origin. */
|
|
37
37
|
appId?: string;
|
|
38
|
+
/** Application role instructions. Omit or clear to use the selected agent's prompt. */
|
|
39
|
+
systemPrompt?: string;
|
|
40
|
+
/** Backend tool/toolkit allowlist within the selected agent's permissions.
|
|
41
|
+
* Omit to inherit; [] allows only registered frontendTools. */
|
|
42
|
+
tools?: readonly string[];
|
|
38
43
|
}
|
|
39
44
|
declare function getOmniApplicationChatUrl(options: OmniApplicationChatOptions, parentOrigin: string, chatId: string): string;
|
|
40
45
|
declare function createOmniApplicationChatEmbed(container: HTMLElement, options: OmniApplicationChatOptions): OmniChatEmbed;
|
package/dist/embed.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ interface OmniApplicationChatOptions extends OmniHostedChatOptions {
|
|
|
35
35
|
agentId?: string;
|
|
36
36
|
/** Groups this application's conversation history; defaults to its origin. */
|
|
37
37
|
appId?: string;
|
|
38
|
+
/** Application role instructions. Omit or clear to use the selected agent's prompt. */
|
|
39
|
+
systemPrompt?: string;
|
|
40
|
+
/** Backend tool/toolkit allowlist within the selected agent's permissions.
|
|
41
|
+
* Omit to inherit; [] allows only registered frontendTools. */
|
|
42
|
+
tools?: readonly string[];
|
|
38
43
|
}
|
|
39
44
|
declare function getOmniApplicationChatUrl(options: OmniApplicationChatOptions, parentOrigin: string, chatId: string): string;
|
|
40
45
|
declare function createOmniApplicationChatEmbed(container: HTMLElement, options: OmniApplicationChatOptions): OmniChatEmbed;
|