@gengage/assistant-fe 0.1.7 → 0.1.8

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 CHANGED
@@ -56,14 +56,20 @@ npm install @gengage/assistant-fe
56
56
  import { GengageChat, GengageQNA, GengageSimRel, bootstrapSession, wireQNAToChat } from '@gengage/assistant-fe';
57
57
 
58
58
  const sessionId = bootstrapSession();
59
+ const middlewareUrl = 'https://YOUR_MIDDLEWARE_URL';
59
60
 
60
61
  const chat = new GengageChat();
61
- await chat.init({ accountId: 'mystore', session: { sessionId } });
62
+ await chat.init({
63
+ accountId: 'mystore',
64
+ middlewareUrl,
65
+ session: { sessionId },
66
+ });
62
67
 
63
68
  // On PDP pages — mount QNA buttons and similar products
64
69
  const qna = new GengageQNA();
65
70
  await qna.init({
66
71
  accountId: 'mystore',
72
+ middlewareUrl,
67
73
  mountTarget: '#qna-section',
68
74
  pageContext: { pageType: 'pdp', sku: currentSku },
69
75
  session: { sessionId },
@@ -72,6 +78,7 @@ await qna.init({
72
78
  const simrel = new GengageSimRel();
73
79
  await simrel.init({
74
80
  accountId: 'mystore',
81
+ middlewareUrl,
75
82
  sku: currentSku,
76
83
  mountTarget: '#similar-section',
77
84
  session: { sessionId },
@@ -236,7 +243,7 @@ gengage-assistant-fe/
236
243
  │ └── native/ # Mobile WebView overlay
237
244
  ├── catalog/ # Visual component catalog (no backend needed)
238
245
  │ ├── index.html # SPA shell
239
- │ ├── vite.config.ts # Resolves @gengage/assistant-fe → dist/
246
+ │ ├── vite.config.ts # Resolves @gengage/assistant-fe → src/
240
247
  │ └── src/ # Router, layout, mock data, sections
241
248
  ├── scripts/
242
249
  │ └── dev.ts # Dev server entry point (npm run dev)
@@ -254,13 +261,16 @@ gengage-assistant-fe/
254
261
 
255
262
  | Command | Description |
256
263
  |---------|-------------|
257
- | `npm run dev -- <accountId> <sku>` | Start local dev server in PDP mode for an account + SKU |
264
+ | `npm run dev -- <demo> [--sku=SKU] [--port=3000] [--backend-url=URL]` | Start local dev server for any demo |
265
+ | `npm run dev -- --client=<demo> [--sku=SKU] [--port=3000] [--backend-url=URL]` | Same as above, using named demo flag |
258
266
  | `npm run kill` | Kill zombie listeners on ports 3000-3010 |
259
- | `npm run prerequisites:check` | Validate kickoff prerequisites (docs/config/schema/action routing) |
267
+ | `npm run format` | Prettier + ESLint fix + `typecheck` + `typecheck:catalog` |
260
268
  | `npm run dev -- koctascomtr --sku=1000465056` | Example: Koçtaş PDP with SKU 1000465056 |
261
269
  | `npm run dev -- n11com --sku=ABC123 --port=3005` | Custom port |
270
+ | `npm run dev -- --client=yatasbeddingcomtr --sku=1066800 --backend-url=https://staging.example.com` | Demo alias + backend override |
262
271
  | `npm run build` | Build all widgets to `dist/` |
263
272
  | `npm run typecheck` | TypeScript strict check (no emit) |
273
+ | `npm run typecheck:catalog` | TypeScript check for `catalog/` |
264
274
  | `npm run lint` | ESLint `src/` |
265
275
  | `npm run test` | Vitest unit tests |
266
276
  | `npm run test:e2e` | Playwright smoke tests |
@@ -269,21 +279,16 @@ gengage-assistant-fe/
269
279
 
270
280
  ### `npm run dev` — Local Widget Test Server
271
281
 
272
- The dev server spins up an account-aware PDP host shell with all three widgets initialised
273
- for the given account and SKU. Every invocation generates fresh UUIDs printed to the console:
274
-
275
- Current focus is PDP mode (`product details`) with a concrete SKU.
276
- PLP mode (`category / sku-list`) is planned and will be added as a separate harness flow.
282
+ The dev server serves `demos/<demo>/index.html` with HMR and supports optional query
283
+ injection via CLI flags (`--sku`, `--backend-url`). It also supports `--client=<demo>`
284
+ as an alias for the positional demo argument.
277
285
 
278
286
  ```
279
287
  ── Gengage Dev Server ──────────────────────────────
280
- Account: koctascomtr
288
+ Demo: koctascomtr
281
289
  SKU: 1234567
282
- Page type: pdp
283
- Session ID: 550e8400-e29b-41d4-a716-446655440000
284
- User ID: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
285
- View ID: 6ba7b811-9dad-11d1-80b4-00c04fd430c8
286
- URL: http://localhost:3000
290
+ Backend: https://staging.example.com
291
+ URL: http://localhost:3000?sku=1234567&middlewareUrl=https%3A%2F%2Fstaging.example.com
287
292
  ────────────────────────────────────────────────────
288
293
  ```
289
294
 
@@ -296,16 +301,16 @@ The page shows:
296
301
 
297
302
  HMR is active — editing `src/` files updates the page without a full reload.
298
303
 
299
- > The dev server serves the account's demo page from `demos/<accountId>/index.html`,
300
- > generating fresh session/user/view IDs on each start.
304
+ > The dev server serves the selected demo page from `demos/<demo>/index.html`,
305
+ > and keeps query options sticky if you open `/` directly.
301
306
 
302
307
  ### Component Catalog (`npm run catalog`)
303
308
 
304
309
  A visual catalog that renders every component with mock data — no backend needed.
305
- Imports from `dist/` (validates the npm package as consumers would see it).
310
+ `npm run catalog` already runs `npm run build` first.
306
311
 
307
312
  ```bash
308
- npm run build && npm run catalog # Build first, then serve at :3002
313
+ npm run catalog # Serves at :3002 (and builds first)
309
314
  ```
310
315
 
311
316
  Open `http://localhost:3002` to see:
@@ -319,7 +324,7 @@ Open `http://localhost:3002` to see:
319
324
  - **Theme Comparison** — same component rendered across all 12 merchant themes
320
325
  - **Responsive Preview** — mobile / tablet / desktop viewport frames
321
326
 
322
- The catalog lives in `catalog/` and is excluded from npm publish (`files: ["dist/"]`).
327
+ The catalog lives in `catalog/` and is excluded from npm publish (`files` publishes `dist/`, `README.md`, and `LICENSE`).
323
328
 
324
329
  ---
325
330
 
package/dist/chat.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./schemas-DHzfUzwA.cjs");const e=require("./index-1yPxOqAw.cjs");require("./quantity-stepper-UbAp53Ow.cjs");exports.GengageChat=e.GengageChat;exports.chatCatalog=e.chatCatalog;exports.createChatWidget=e.createChatWidget;exports.createDefaultChatUISpecRegistry=e.createDefaultChatUISpecRegistry;exports.defaultChatUnknownUISpecRenderer=e.defaultChatUnknownUISpecRenderer;exports.renderUISpec=e.renderUISpec;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./schemas-DHzfUzwA.cjs");const e=require("./index-DZ3Mi5xF.cjs");require("./quantity-stepper-UbAp53Ow.cjs");exports.GengageChat=e.GengageChat;exports.chatCatalog=e.chatCatalog;exports.createChatWidget=e.createChatWidget;exports.createDefaultChatUISpecRegistry=e.createDefaultChatUISpecRegistry;exports.defaultChatUnknownUISpecRenderer=e.defaultChatUnknownUISpecRenderer;exports.renderUISpec=e.renderUISpec;
2
2
  //# sourceMappingURL=chat.cjs.map