create-kywi-app 0.12.0 → 0.13.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.
@@ -356,7 +356,7 @@ authored elsewhere in the admin).
356
356
 
357
357
  | `name` | Purpose |
358
358
  |---|---|
359
- | `variantContainer` | Module-level arms revealed client-side per audience read §8 first |
359
+ | ~~`variantContainer`~~ | **Retired in 0.13.0** — the raw-HTML module. Use the `moduleVariantContainer` NODE (§8) or `personalize_module`. Existing placements still render |
360
360
  | `personalizationBadge` | Optional inline status pill that opens the global transparency panel — not needed on ordinary pages (§8) |
361
361
  | `socialShare` | Share links for a URL/title across networks |
362
362
  | `map` | Embedded map at a lat/lng or address |
@@ -517,47 +517,62 @@ If no, skip it — the machinery is there when they grow into it.
517
517
 
518
518
  ### Variant containers: pick the right shape
519
519
 
520
- Two different things are called `variantContainer`, and they are not
521
- interchangeable.
522
-
523
- - **Section-level** — a *region* node, sibling of sections (`defaultSections` +
524
- `variants[].sections`). Resolved **on the server** from the visitor's audience
525
- or experiment arm, so the first paint is already correct: no flash, and the
526
- page is complete with JavaScript off. This is the default for anything the
527
- server can know rule-based audiences (UTM, referrer, the `kywi_audience`
528
- pin) and A/B experiments. Since 0.6.3 it also renders in the layout editor as
529
- a badged block with a **variant switcher** (internal editor code
530
- `activeArms`, the `VariantArm` type, `data-arm-id` still says "arm"; the
531
- persisted layout field is `variants`), each variant editable with the
532
- ordinary section/column/module tools, so server-resolution no longer costs
533
- the owner their editing surface. Since kywi-cms#119, the owner doesn't need
534
- an agent to hand-author this shape at all: the section chrome in the
535
- admin layout editor and in the in-place front-of-site overlay alike —
536
- offers **Personalize this section** / **A/B test** actions that wrap an
537
- ordinary section into a section-level variant container on the spot,
538
- seeding the default variant from the section's current content and
539
- opening straight into its config (audience/experiment picker included).
540
- An agent only needs to reach for `update_layout` when scripting bulk
541
- changes or building a container the UI can't reach.
542
- - **Module-level**the `variantContainer` *module*, placed in a column; its
543
- variants are HTML strings (`defaultContent`, `variants: [{audienceId, label,
544
- content}]`). Every variant ships in the HTML (default visible, the rest
545
- `display:none`) and the browser runtime reveals the matching one. Use it
546
- **only for signals the server cannot read at first paint** — in practice, a
547
- self-ID answer held in `localStorage`.
520
+ Three different things have been called `variantContainer`, and they are not
521
+ interchangeable. Two of them are current.
522
+
523
+ - **Section-level `variantContainer`** — a *region* node, sibling of sections
524
+ (`defaultSections` + `variants[].sections`). Resolved **on the server** from
525
+ the visitor's audience or experiment arm, so the first paint is already
526
+ correct: no flash, and the page is complete with JavaScript off. Reach for it
527
+ when a whole band varies. Since kywi-cms#119 the owner does not need an agent
528
+ to author it: the section chrome in the admin layout editor and the
529
+ front-of-site overlay alike offers **Personalize** / **A/B test** actions
530
+ that wrap the section on the spot, seeding the default variant from its
531
+ current content and opening straight into its config.
532
+ - **Module-level `moduleVariantContainer`** (kywi-cms#161) a *column* node,
533
+ sibling of modules (`defaultModule` + `variants[].module`, exactly one
534
+ module per arm; arm module types may differ, so an image arm can face a
535
+ text arm). Also resolved **entirely on the server** same no-flash,
536
+ JS-off-complete guarantee. Reach for it when ONE element varies inside a
537
+ section that otherwise stays put: a headline, a CTA, a pricing card. The
538
+ owner reaches it from the module's own hover chrome or its props rail (the
539
+ same two actions), and an agent reaches it with **`personalize_module`**
540
+ (kywi-cms#162), which does the read-modify-write wrap and hands back the
541
+ container and arm ids. It always seeds one variant arm — a detached copy of
542
+ the module's current content whether or not `audienceId` is passed: pass
543
+ it to bind the arm immediately, or omit it and the arm starts unbound
544
+ (`''`, serving nobody) until something binds it later.
545
+ - **The legacy `variantContainer` MODULE** retired in 0.13.0 (kywi-cms#163).
546
+ Its arms were raw HTML strings revealed client-side by `@kywi-software/js`.
547
+ It is gone from the palette and from `list_module_types`, and
548
+ `personalize_module` is what you want instead. **Existing placements keep
549
+ rendering and stay editable** — nothing was deleted and no migration is
550
+ forced — so a page that already has one is not broken, it is simply not the
551
+ shape to add more of.
552
+
553
+ **Neither container ever nests.** Not one inside the other, not one inside
554
+ itself. A module already sitting in a personalized section's arm cannot be
555
+ promoted — the editor withholds the action, `personalize_module` returns a
556
+ structured error saying why, and `update_layout` rejects the shape outright.
557
+
558
+ **`ab_test` mode needs its own `experimentId`, and it must be FRESH.** Both
559
+ container kinds refuse to validate without one, and both the editors and
560
+ `personalize_module` mint a new id per container. Copying an experiment id
561
+ between pages silently enrols a second page's container in the first page's run.
548
562
 
549
563
  Four traps, each of which fails silently:
550
564
 
551
- 1. **Use the layout module, not the React component.** `VariantContainer.tsx`
552
- (`core/src/components/personalization/`) has a loading branch that renders
553
- the skeleton and nothing else — a JS-off visitor gets an empty container —
554
- and its `ab_test` path draws a fresh `Math.random()` per render, so the same
555
- visitor sees a different arm on every refresh. The layout module
556
- (`VariantContainerModule`) always renders the default arm.
557
- 2. **Leave `skeleton` off.** With `skeleton: true` the container ships
558
- `aria-busy="true"` and only the client runtime clears it a JS-off visitor
559
- sits in a loading state forever.
560
- 3. **An audience match beats the experiment.** `resolveVariant` returns the
565
+ 1. **Don't reach for the retired `variantContainer` module, or the React
566
+ component.** `VariantContainer.tsx` (`core/src/components/personalization/`)
567
+ has a loading branch that renders the skeleton and nothing else — a JS-off
568
+ visitor gets an empty container — and its `ab_test` path draws a fresh
569
+ `Math.random()` per render, so the same visitor sees a different arm on
570
+ every refresh. The layout module (`VariantContainerModule`) always renders
571
+ the default arm.
572
+ 2. (Legacy module only.) **Leave `skeleton` off.** With `skeleton: true` the
573
+ container ships `aria-busy="true"` and only the client runtime clears it —
574
+ a JS-off visitor sits in a loading state forever.
575
+ 3. **An audience match beats the experiment.** `selectVariantArm` returns the
561
576
  audience arm first, so a visitor who matches an audience never enters the
562
577
  split. Don't run an experiment and an audience variant on the same container.
563
578
  4. **The client runtime needs `/kywi.js`.** Self-ID, behavioral re-evaluation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kywi-app",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Scaffold a new Kywi CMS project — npx create-kywi-app my-site",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Kywi-Software/kywi-cms#readme",