@konfigure/sdk 0.2.0 → 0.3.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 CHANGED
@@ -8,6 +8,11 @@ the Konfigure instance, the UI is yours, the 3D is the product's own engine.
8
8
  enquiries and leads.
9
9
  - `@konfigure/sdk/view` — `mountView(element, configurator, options)`, the 3D
10
10
  view; it redraws on every change. Browser only — import it lazily.
11
+ - `@konfigure/sdk/showroom` — `mountShowroom(element, options)`, the
12
+ instance's virtual showroom (a show house with the products in its
13
+ openings): a still or drifting preview for a card, or a walk for a page of
14
+ its own. It shows the visitor's configuration where their product stands.
15
+ Browser only — import it lazily.
11
16
 
12
17
  The state is the product's own `ConfigurationState` JSON, so a configuration
13
18
  saved or enquired through the SDK opens in the dashboard, the share page and the
@@ -20,7 +25,7 @@ npm install @konfigure/sdk three
20
25
  npm install -D @types/three # for the /view entry's types
21
26
  ```
22
27
 
23
- `three` (0.181.x) is the only peer, and only the `/view` entry imports it. The
28
+ `three` (0.181.x) is the only peer, and only the `/view` and `/showroom` entries import it. The
24
29
  package is self-contained otherwise: no Vue, no Nuxt — it works in any bundler.
25
30
  If your project ends up with two copies of three.js, dedupe it (in Vite:
26
31
  `resolve: { dedupe: ['three'] }`).
@@ -308,6 +313,54 @@ Every error the SDK throws on purpose is a `KonfigureError` with a stable
308
313
  `code`; a `network` error from a browser usually means the website's origin is
309
314
  not on the instance's allowed origins.
310
315
 
316
+ ## Showroom
317
+
318
+ ```ts
319
+ const { mountShowroom } = await import('@konfigure/sdk/showroom')
320
+
321
+ const showroom = await mountShowroom(element, {
322
+ client, // or instance: 'https://example.konfigure.app'
323
+ configurator, // optional: its product line's openings show the visitor's state, live
324
+ mode: 'preview', // 'preview' (default) or 'walk'
325
+ view: 'street', // showroom.views() lists them
326
+ })
327
+ await showroom.whenReady() // every product stands
328
+ ```
329
+
330
+ `mountShowroom` resolves once the room is drawn; the products follow, the
331
+ ones nearest the camera first (`placed` events, `whenReady()`).
332
+
333
+ - **Preview** draws one view, at most 30 frames a second, with no input, and
334
+ drifts slowly from side to side (`drift: false` holds it still). It stops
335
+ drawing while the element is off screen or the tab is hidden
336
+ (`pauseOffscreen`).
337
+ - **Walk**: drag to look, click the floor to walk there, the wheel or WASD and
338
+ the arrow keys to walk. Clicking a product steps up to it and emits
339
+ `exhibit` with the product's `moduleId`, `productLineId` and `moduleCode`,
340
+ so you can open your configurator on it. `pointerLock: true` captures a
341
+ mouse to look, the way a game does; it then acts on the middle of the
342
+ picture, so draw your own aim dot.
343
+ - `setView(name, { seconds })` cuts (`seconds: 0`, the default in a preview)
344
+ or walks there through the doors (the default in a walk). `setMode`,
345
+ `setInput`, `setDrift`, `pause`, `resume`, `capture()` (a PNG data URL),
346
+ `stats()` and `dispose()` do what they say.
347
+ - **The visitor's configuration**: openings that hold the configurator's
348
+ product line (or the ones you name in `configuratorPlaces`) show its state.
349
+ Where the opening's module is a different one, the finishes, glass and
350
+ handle carry over slot by slot. A made-to-measure size is kept only where
351
+ it is the opening's own: the house is not rebuilt round a window.
352
+ - **Quality**: `preview` (the default for a preview: one pass at 1× pixels,
353
+ the room's light at half size), or the instance's own `low`/`high`; `auto`
354
+ (the default for a walk) picks by what the device says about itself.
355
+ `pixelRatio` caps the pixels, `fps` the frame rate.
356
+ - **Cost**: the house is one meshopt-compressed GLB of about 17 MB (about 14 MB
357
+ over brotli), plus its sky and the products. The files are served immutable,
358
+ so the next page that shows the showroom reads them from the browser's
359
+ cache.
360
+
361
+ The instance must have a showroom (otherwise `client.showroom()` and
362
+ `mountShowroom` fail with an `http` error, status 404).
363
+
311
364
  ## Limits
312
365
 
313
366
  - One module per configuration: modular lines (adding modules at connection