@vectoriox/iox-ui 5.161.0 → 5.163.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.
Files changed (43) hide show
  1. package/actions-core/index.d.ts +171 -3
  2. package/assist-core/index.d.ts +3 -2
  3. package/composite-core/index.d.ts +185 -2
  4. package/design-core/index.d.ts +130 -0
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +243 -2
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -5
  8. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +404 -163
  10. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-design-core.mjs +152 -1
  12. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +302 -10
  14. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  15. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +140 -1
  16. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  17. package/fesm2022/vectoriox-iox-ui-scene-core.mjs +306 -48
  18. package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
  19. package/fesm2022/vectoriox-iox-ui.mjs +383 -10
  20. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  21. package/generation-core/index.d.ts +243 -6
  22. package/harness-core/index.d.ts +132 -2
  23. package/index.d.ts +105 -3
  24. package/package.json +1 -1
  25. package/scene-core/index.d.ts +130 -10
  26. package/src/actions-core/popup-arrival.ts +328 -0
  27. package/src/actions-core/public-api.ts +1 -0
  28. package/src/assist-core/media-generate.ts +6 -5
  29. package/src/composite-core/popup.ts +285 -0
  30. package/src/composite-core/public-api.ts +1 -0
  31. package/src/design-core/flavor-spec.generated.ts +152 -1
  32. package/src/generation-core/ai-run.ts +65 -2
  33. package/src/generation-core/compose-layout.ts +11 -5
  34. package/src/generation-core/pictures.ts +4 -3
  35. package/src/generation-core/site-spec.generated.ts +235 -0
  36. package/src/harness-core/business-types.ts +2 -0
  37. package/src/harness-core/harness-spec.generated.ts +83 -0
  38. package/src/harness-core/popup-stance.ts +111 -0
  39. package/src/harness-core/public-api.ts +1 -0
  40. package/src/scene-core/scene-edit.ts +12 -8
  41. package/src/scene-core/scene.ts +131 -21
  42. package/src/scene-core/scroll-driver.ts +209 -23
  43. package/styles/iox-design.css +121 -2
@@ -1,6 +1,6 @@
1
1
  import { compositeOver, parseCssColour, relativeLuminance, Rgb, wcagContrastRatio } from '@vectoriox/iox-ui/design-core';
2
2
 
3
- import { AiStep, AiTokenPrice, creditsOfUsd, estimateStepCredits } from './ai-run';
3
+ import { AiStep, AiTokenPrice, creditsOfUsd, estimateStepCredits, typicalStepTokens } from './ai-run';
4
4
  import { ArtDirection, artDirectionPreamble } from './art-direction';
5
5
  import { ComposedSite } from './compose-site';
6
6
  import { jsonBoolean, jsonClosedObject, JsonSchema, jsonText } from './json-schema';
@@ -309,9 +309,10 @@ export interface PicturesEstimate {
309
309
  * The cost shown before the owner says yes (I-D4): each picture and its review at the vetted list's prices, plus one
310
310
  * second try (a picture and its review) for every `PICTURE_REROLL_EVERY` pictures. The run never spends past `total` —
311
311
  * a second try that would cross it is not made — so the shown cost is a ceiling met exactly when every try is used.
312
+ * `model` = the picture model: one picture is counted as its maker bills it at most (iox-ui#138); absent, the default's.
312
313
  */
313
- export function estimatePictures(count: number, prices: { image: AiTokenPrice; review: AiTokenPrice }): PicturesEstimate {
314
- const picture = estimateStepCredits(AiStep.MakePictures, prices.image);
314
+ export function estimatePictures(count: number, prices: { image: AiTokenPrice; review: AiTokenPrice }, model?: string | null): PicturesEstimate {
315
+ const picture = estimateStepCredits(AiStep.MakePictures, prices.image, typicalStepTokens(AiStep.MakePictures, undefined, model));
315
316
  const review = estimateStepCredits(AiStep.CheckPictures, prices.review);
316
317
  const rerolls = pictureRerolls(count);
317
318
  return { count, rerolls, picture, review, total: creditsOfUsd(((count + rerolls) * (picture + review)) / 100) };
@@ -10575,6 +10575,241 @@ export const SPEC_SITE_LAYOUT = {
10575
10575
  }
10576
10576
  ]
10577
10577
  },
10578
+ "popup": {
10579
+ "ingredients": {
10580
+ "kind": [
10581
+ "announcement",
10582
+ "offer",
10583
+ "newsletter"
10584
+ ],
10585
+ "form": [
10586
+ "corner",
10587
+ "bar",
10588
+ "centred"
10589
+ ],
10590
+ "arrive": [
10591
+ "scroll",
10592
+ "time",
10593
+ "scrollOrTime",
10594
+ "leaving",
10595
+ "button"
10596
+ ],
10597
+ "again": [
10598
+ "days",
10599
+ "visit",
10600
+ "once"
10601
+ ],
10602
+ "art": [
10603
+ "none",
10604
+ "picture"
10605
+ ]
10606
+ },
10607
+ "meanings": {
10608
+ "kind.announcement": "news the owner states: an opening, a new branch, holiday hours — one line and, if any, a link to the page that says more",
10609
+ "kind.offer": "an offer the owner states, in the owner's words — a picture, a short line and a link to the offer's page",
10610
+ "kind.newsletter": "an invitation to the owner's newsletter — a short line and the newsletter form",
10611
+ "form.corner": "a card at the bottom end corner (the start corner on a right-to-left site), 360–560 px wide; on a phone a bottom card at most 30% of the screen high",
10612
+ "form.bar": "a strip along the bottom edge, one line: at most 64 px high on a laptop, 88 px on a phone",
10613
+ "form.centred": "a centred card over the look's scrim — a newsletter on a laptop only; on a phone it shows as the corner card",
10614
+ "arrive.scroll": "once the visitor has scrolled half of the first screen — the visitor's own scroll, never a programmatic one",
10615
+ "arrive.time": "after a number of seconds on the page (at least 3), counted only while the tab is visible",
10616
+ "arrive.scrollOrTime": "whichever comes first: the scroll or the time",
10617
+ "arrive.leaving": "on a laptop, when a mouse leaves through the top of the window after 10 seconds on the page; a phone gets the time instead",
10618
+ "arrive.button": "never by itself — only when a button opens it",
10619
+ "again.days": "after the visitor closes it, not again for a number of days (30 unless the owner says otherwise)",
10620
+ "again.visit": "once per visit",
10621
+ "again.once": "once, ever — until the owner changes it",
10622
+ "art.none": "no picture",
10623
+ "art.picture": "the owner's picture at the start of the card"
10624
+ },
10625
+ "meaningsHe": {
10626
+ "kind.announcement": "חדשות שהבעלים מספרים: פתיחה, סניף חדש, שעות חג — שורה אחת, ואם יש, קישור לעמוד שמספר עוד",
10627
+ "kind.offer": "הצעה שהבעלים מספרים, במילים שלהם — תמונה, שורה קצרה וקישור לעמוד ההצעה",
10628
+ "kind.newsletter": "הזמנה לניוזלטר של העסק — שורה קצרה וטופס ההרשמה",
10629
+ "form.corner": "כרטיס בפינה התחתונה בסוף השורה (בפינת ההתחלה באתר מימין לשמאל), ברוחב 360–560 פיקסלים; בטלפון כרטיס תחתון בגובה של עד 30% מהמסך",
10630
+ "form.bar": "פס לאורך תחתית המסך, שורה אחת: עד 64 פיקסלים במחשב, 88 בטלפון",
10631
+ "form.centred": "כרטיס במרכז המסך מעל רקע מעומעם — רק לניוזלטר ורק במחשב; בטלפון הוא מוצג ככרטיס בפינה",
10632
+ "arrive.scroll": "אחרי שהמבקר גלל חצי מהמסך הראשון — גלילה של המבקר עצמו, אף פעם לא גלילה של הקוד",
10633
+ "arrive.time": "אחרי מספר שניות בעמוד (לפחות 3), נספרות רק כשהלשונית גלויה",
10634
+ "arrive.scrollOrTime": "המוקדם מבין השניים: הגלילה או הזמן",
10635
+ "arrive.leaving": "במחשב, כשהעכבר יוצא מראש החלון אחרי 10 שניות בעמוד; בטלפון — לפי זמן",
10636
+ "arrive.button": "אף פעם לא מעצמו — רק כשכפתור פותח אותו",
10637
+ "again.days": "אחרי שהמבקר סוגר אותו, לא שוב במשך מספר ימים (30, אלא אם הבעלים קובעים אחרת)",
10638
+ "again.visit": "פעם אחת בכל ביקור",
10639
+ "again.once": "פעם אחת בלבד — עד שהבעלים משנים אותו",
10640
+ "art.none": "בלי תמונה",
10641
+ "art.picture": "התמונה של העסק בתחילת הכרטיס"
10642
+ },
10643
+ "waits": {
10644
+ "arrive.leaving": {
10645
+ "phase": "PU2b",
10646
+ "drawnAs": "time"
10647
+ }
10648
+ },
10649
+ "defaults": {
10650
+ "kind": "offer",
10651
+ "form": "corner",
10652
+ "arrive": "scrollOrTime",
10653
+ "again": "days",
10654
+ "art": "picture"
10655
+ },
10656
+ "named": {
10657
+ "announcement": {
10658
+ "kind": "announcement",
10659
+ "form": "bar",
10660
+ "arrive": "scroll",
10661
+ "again": "visit",
10662
+ "art": "none"
10663
+ },
10664
+ "offer": {
10665
+ "kind": "offer",
10666
+ "form": "corner",
10667
+ "arrive": "scrollOrTime",
10668
+ "again": "days",
10669
+ "art": "picture"
10670
+ },
10671
+ "newsletter": {
10672
+ "kind": "newsletter",
10673
+ "form": "corner",
10674
+ "arrive": "scrollOrTime",
10675
+ "again": "days",
10676
+ "art": "none"
10677
+ }
10678
+ },
10679
+ "arrival": {
10680
+ "announcement": {
10681
+ "screens": 0.5
10682
+ },
10683
+ "offer": {
10684
+ "screens": 0.5,
10685
+ "seconds": 8
10686
+ },
10687
+ "newsletter": {
10688
+ "pageShare": 0.4,
10689
+ "seconds": 25
10690
+ }
10691
+ },
10692
+ "generatedForms": [
10693
+ "corner",
10694
+ "bar"
10695
+ ],
10696
+ "fingerprint": [
10697
+ "form"
10698
+ ],
10699
+ "refused": {
10700
+ "again.every-view": "every page view is the nag: the visitor closed it",
10701
+ "arrive.load": "at load it is an interstitial: the landing view is always the page (minimum 3 s or a real scroll)",
10702
+ "form.fullscreen": "a popup that covers the page hides the content the visitor came for",
10703
+ "kind.countdown": "a countdown is pressure, never news the owner stated (AW-D16)"
10704
+ },
10705
+ "rules": {
10706
+ "oneOverlay": true,
10707
+ "onePerPageView": true,
10708
+ "minSeconds": 3,
10709
+ "scrollScreens": 0.5,
10710
+ "timeSeconds": 8,
10711
+ "leavingLaptopOnly": true,
10712
+ "leavingAfterSeconds": 10,
10713
+ "phoneLeavingSeconds": 25,
10714
+ "phoneMaxHeight": 0.3,
10715
+ "barMaxPx": {
10716
+ "laptop": 64,
10717
+ "phone": 88
10718
+ },
10719
+ "cornerWidthPx": [
10720
+ 360,
10721
+ 560
10722
+ ],
10723
+ "centredNewsletterOnly": true,
10724
+ "centredLaptopOnly": true,
10725
+ "quietRoutes": [
10726
+ "checkout",
10727
+ "order",
10728
+ "account",
10729
+ "sign-in",
10730
+ "legal",
10731
+ "not-found",
10732
+ "recover",
10733
+ "unsubscribe"
10734
+ ],
10735
+ "memoryDays": 30,
10736
+ "neverAfterActed": true,
10737
+ "memoryCategory": "necessary",
10738
+ "endedLeftOut": true,
10739
+ "durationByAnimated": {
10740
+ "still": 200,
10741
+ "subtle": 350,
10742
+ "standard": 450,
10743
+ "lively": 550,
10744
+ "expressive": 600
10745
+ },
10746
+ "exitRatio": 0.55,
10747
+ "reducedFadeMs": 200,
10748
+ "phoneRisePx": 24,
10749
+ "phoneInsetMaxPx": 12,
10750
+ "closeTargetPx": 44,
10751
+ "focusStays": true,
10752
+ "noSnippet": true
10753
+ },
10754
+ "tiers": {
10755
+ "kind.announcement": "all",
10756
+ "kind.offer": "all",
10757
+ "kind.newsletter": "all",
10758
+ "form.corner": "all",
10759
+ "form.bar": "all",
10760
+ "form.centred": "all",
10761
+ "arrive.scroll": "all",
10762
+ "arrive.time": "all",
10763
+ "arrive.scrollOrTime": "all",
10764
+ "arrive.leaving": "all",
10765
+ "arrive.button": "all",
10766
+ "again.days": "all",
10767
+ "again.visit": "all",
10768
+ "again.once": "all",
10769
+ "art.none": "all",
10770
+ "art.picture": "all",
10771
+ "rules.oneOverlay": "all",
10772
+ "rules.onePerPageView": "all",
10773
+ "rules.minSeconds": "all",
10774
+ "rules.scrollScreens": "all",
10775
+ "rules.timeSeconds": "all",
10776
+ "rules.leavingLaptopOnly": "all",
10777
+ "rules.leavingAfterSeconds": "all",
10778
+ "rules.phoneLeavingSeconds": "all",
10779
+ "rules.phoneMaxHeight": "all",
10780
+ "rules.barMaxPx": "all",
10781
+ "rules.cornerWidthPx": "all",
10782
+ "rules.centredNewsletterOnly": "all",
10783
+ "rules.centredLaptopOnly": "all",
10784
+ "rules.quietRoutes": "all",
10785
+ "rules.memoryDays": "all",
10786
+ "rules.neverAfterActed": "all",
10787
+ "rules.memoryCategory": "all",
10788
+ "rules.endedLeftOut": "all",
10789
+ "rules.durationByAnimated": "all",
10790
+ "rules.exitRatio": "all",
10791
+ "rules.reducedFadeMs": "all",
10792
+ "rules.phoneRisePx": "all",
10793
+ "rules.phoneInsetMaxPx": "all",
10794
+ "rules.closeTargetPx": "all",
10795
+ "rules.focusStays": "all",
10796
+ "rules.noSnippet": "all"
10797
+ },
10798
+ "references": [
10799
+ {
10800
+ "id": "corner-offer-first-scroll",
10801
+ "after": "Doron pick 2026-11-24: vesuvio (popups-plan §1)",
10802
+ "added": "2026-11-24",
10803
+ "mix": {
10804
+ "kind": "offer",
10805
+ "form": "corner",
10806
+ "arrive": "scroll",
10807
+ "again": "days",
10808
+ "art": "picture"
10809
+ }
10810
+ }
10811
+ ]
10812
+ },
10578
10813
  "motion": {
10579
10814
  "ingredients": {
10580
10815
  "arrive": [
@@ -157,6 +157,8 @@ export interface BusinessType {
157
157
  readonly column: BusinessTypeColumn;
158
158
  /** Award §0b + §0b.7 (AW-D26…D32): how a film is suggested to this type, and what it may show (`filmIdeaFor`). */
159
159
  readonly film: BusinessTypeFilm;
160
+ /** Popups PU0 (popups-plan §10, PU-D11/PU-D12): offer · ifAsked · never — how a popup is suggested (`popupSuggestion`). */
161
+ readonly popup: string;
160
162
  readonly imagery: string;
161
163
  /** M7: the picture world a site's made pictures start in (generation-core `artDirectionFor`; contract site.pictureWorlds). */
162
164
  readonly world: `${PictureWorld}`;
@@ -236,6 +236,7 @@ export const SPEC_BUSINESS_TYPES = [
236
236
  ],
237
237
  "why": "a film is spectacle where trust or calm is the job"
238
238
  },
239
+ "popup": "offer",
239
240
  "world": "documentary",
240
241
  "imagery": "Your own photos only, large and uncropped; never stock.",
241
242
  "pages": [
@@ -369,6 +370,7 @@ export const SPEC_BUSINESS_TYPES = [
369
370
  ],
370
371
  "why": "the space is the product"
371
372
  },
373
+ "popup": "ifAsked",
372
374
  "world": "architectural",
373
375
  "imagery": "Wide, bright room shots; details of materials.",
374
376
  "pages": [
@@ -507,6 +509,7 @@ export const SPEC_BUSINESS_TYPES = [
507
509
  ],
508
510
  "why": "the space is the product"
509
511
  },
512
+ "popup": "ifAsked",
510
513
  "world": "architectural",
511
514
  "imagery": "Large project photos and drawings.",
512
515
  "pages": [
@@ -643,6 +646,7 @@ export const SPEC_BUSINESS_TYPES = [
643
646
  ],
644
647
  "why": "a film is spectacle where trust or calm is the job"
645
648
  },
649
+ "popup": "offer",
646
650
  "world": "hard-light",
647
651
  "imagery": "Case-study images of your own work.",
648
652
  "pages": [
@@ -771,6 +775,7 @@ export const SPEC_BUSINESS_TYPES = [
771
775
  ],
772
776
  "why": "the craft IS the story (Studio Alma)"
773
777
  },
778
+ "popup": "offer",
774
779
  "world": "drawing",
775
780
  "imagery": "Your pieces, photographed flat and true to colour.",
776
781
  "pages": [
@@ -905,6 +910,7 @@ export const SPEC_BUSINESS_TYPES = [
905
910
  ],
906
911
  "why": "the craft IS the story (Studio Alma)"
907
912
  },
913
+ "popup": "offer",
908
914
  "world": "macro",
909
915
  "imagery": "Your pieces and hands at work; natural light.",
910
916
  "pages": [
@@ -1031,6 +1037,7 @@ export const SPEC_BUSINESS_TYPES = [
1031
1037
  ],
1032
1038
  "why": "the craft IS the story (Studio Alma)"
1033
1039
  },
1040
+ "popup": "offer",
1034
1041
  "world": "macro",
1035
1042
  "imagery": "Close-ups on a plain ground.",
1036
1043
  "pages": [
@@ -1159,6 +1166,7 @@ export const SPEC_BUSINESS_TYPES = [
1159
1166
  ],
1160
1167
  "why": "a film is spectacle where trust or calm is the job"
1161
1168
  },
1169
+ "popup": "offer",
1162
1170
  "world": "low-key",
1163
1171
  "imagery": "Healed work, clean photos.",
1164
1172
  "pages": [
@@ -1306,6 +1314,7 @@ export const SPEC_BUSINESS_TYPES = [
1306
1314
  ],
1307
1315
  "why": "the room people come to, and its light"
1308
1316
  },
1317
+ "popup": "offer",
1309
1318
  "world": "high-key",
1310
1319
  "imagery": "Rooms, textures, hands; no faces needed.",
1311
1320
  "pages": [
@@ -1459,6 +1468,7 @@ export const SPEC_BUSINESS_TYPES = [
1459
1468
  ],
1460
1469
  "why": "the room people come to, and its light"
1461
1470
  },
1471
+ "popup": "offer",
1462
1472
  "world": "high-key",
1463
1473
  "imagery": "Your own before-and-after photos.",
1464
1474
  "pages": [
@@ -1595,6 +1605,7 @@ export const SPEC_BUSINESS_TYPES = [
1595
1605
  ],
1596
1606
  "why": "the room people come to, and its light"
1597
1607
  },
1608
+ "popup": "offer",
1598
1609
  "world": "high-key",
1599
1610
  "imagery": "The room, real classes, daylight.",
1600
1611
  "pages": [
@@ -1739,6 +1750,7 @@ export const SPEC_BUSINESS_TYPES = [
1739
1750
  ],
1740
1751
  "why": "the room people come to, and its light"
1741
1752
  },
1753
+ "popup": "offer",
1742
1754
  "world": "hard-light",
1743
1755
  "imagery": "Real people training; movement.",
1744
1756
  "pages": [
@@ -1908,6 +1920,7 @@ export const SPEC_BUSINESS_TYPES = [
1908
1920
  ],
1909
1921
  "why": "a film is spectacle where trust or calm is the job"
1910
1922
  },
1923
+ "popup": "ifAsked",
1911
1924
  "world": "documentary",
1912
1925
  "imagery": "A calm room, daylight; your portrait.",
1913
1926
  "pages": [
@@ -2085,6 +2098,7 @@ export const SPEC_BUSINESS_TYPES = [
2085
2098
  ],
2086
2099
  "why": "a film is spectacle where trust or calm is the job"
2087
2100
  },
2101
+ "popup": "ifAsked",
2088
2102
  "world": "high-key",
2089
2103
  "imagery": "Your team and rooms; no stock doctors.",
2090
2104
  "pages": [
@@ -2257,6 +2271,7 @@ export const SPEC_BUSINESS_TYPES = [
2257
2271
  ],
2258
2272
  "why": "a film is spectacle where trust or calm is the job"
2259
2273
  },
2274
+ "popup": "ifAsked",
2260
2275
  "world": "high-key",
2261
2276
  "imagery": "Your clinic and team.",
2262
2277
  "pages": [
@@ -2413,6 +2428,7 @@ export const SPEC_BUSINESS_TYPES = [
2413
2428
  ],
2414
2429
  "why": "a film is spectacle where trust or calm is the job"
2415
2430
  },
2431
+ "popup": "ifAsked",
2416
2432
  "world": "documentary",
2417
2433
  "imagery": "Real animals you treat (with permission).",
2418
2434
  "pages": [
@@ -2540,6 +2556,7 @@ export const SPEC_BUSINESS_TYPES = [
2540
2556
  ],
2541
2557
  "why": "the pour, the dough, the plate going out"
2542
2558
  },
2559
+ "popup": "offer",
2543
2560
  "world": "low-key",
2544
2561
  "imagery": "Your own food and room photos.",
2545
2562
  "pages": [
@@ -2684,6 +2701,7 @@ export const SPEC_BUSINESS_TYPES = [
2684
2701
  ],
2685
2702
  "why": "the pour, the dough, the plate going out"
2686
2703
  },
2704
+ "popup": "offer",
2687
2705
  "world": "documentary",
2688
2706
  "imagery": "Your bakes and drinks, close up.",
2689
2707
  "pages": [
@@ -2816,6 +2834,7 @@ export const SPEC_BUSINESS_TYPES = [
2816
2834
  ],
2817
2835
  "why": "the pour, the dough, the plate going out"
2818
2836
  },
2837
+ "popup": "offer",
2819
2838
  "world": "nocturne",
2820
2839
  "imagery": "The cellar, the bar, the bottle.",
2821
2840
  "pages": [
@@ -2948,6 +2967,7 @@ export const SPEC_BUSINESS_TYPES = [
2948
2967
  ],
2949
2968
  "why": "the piece, then what it is made of"
2950
2969
  },
2970
+ "popup": "offer",
2951
2971
  "world": "high-key",
2952
2972
  "imagery": "Product photos on plain grounds; real people wearing them.",
2953
2973
  "pages": [
@@ -3077,6 +3097,7 @@ export const SPEC_BUSINESS_TYPES = [
3077
3097
  ],
3078
3098
  "why": "the bouquet being tied, then the flowers themselves"
3079
3099
  },
3100
+ "popup": "offer",
3080
3101
  "world": "macro",
3081
3102
  "imagery": "Your own arrangements in daylight.",
3082
3103
  "pages": [
@@ -3202,6 +3223,7 @@ export const SPEC_BUSINESS_TYPES = [
3202
3223
  ],
3203
3224
  "why": "the piece, then what it is made of"
3204
3225
  },
3226
+ "popup": "offer",
3205
3227
  "world": "documentary",
3206
3228
  "imagery": "Pieces in real rooms and on plain grounds.",
3207
3229
  "pages": [
@@ -3351,6 +3373,7 @@ export const SPEC_BUSINESS_TYPES = [
3351
3373
  ],
3352
3374
  "why": "a film is spectacle where trust or calm is the job"
3353
3375
  },
3376
+ "popup": "ifAsked",
3354
3377
  "world": "architectural",
3355
3378
  "imagery": "Your portrait; diagrams over stock.",
3356
3379
  "pages": [
@@ -3505,6 +3528,7 @@ export const SPEC_BUSINESS_TYPES = [
3505
3528
  ],
3506
3529
  "why": "where the work happens; never a staged person"
3507
3530
  },
3531
+ "popup": "ifAsked",
3508
3532
  "world": "documentary",
3509
3533
  "imagery": "Your portrait, working with people.",
3510
3534
  "pages": [
@@ -3668,6 +3692,7 @@ export const SPEC_BUSINESS_TYPES = [
3668
3692
  ],
3669
3693
  "why": "a film is spectacle where trust or calm is the job"
3670
3694
  },
3695
+ "popup": "ifAsked",
3671
3696
  "world": "architectural",
3672
3697
  "imagery": "Your team; your office.",
3673
3698
  "pages": [
@@ -3812,6 +3837,7 @@ export const SPEC_BUSINESS_TYPES = [
3812
3837
  ],
3813
3838
  "why": "the space is the product"
3814
3839
  },
3840
+ "popup": "ifAsked",
3815
3841
  "world": "architectural",
3816
3842
  "imagery": "Your own property photos; never stock.",
3817
3843
  "pages": [
@@ -3970,6 +3996,7 @@ export const SPEC_BUSINESS_TYPES = [
3970
3996
  ],
3971
3997
  "why": "where the work happens; never a staged person"
3972
3998
  },
3999
+ "popup": "offer",
3973
4000
  "world": "documentary",
3974
4001
  "imagery": "Real people you help (with permission).",
3975
4002
  "pages": [
@@ -4091,6 +4118,7 @@ export const SPEC_BUSINESS_TYPES = [
4091
4118
  ],
4092
4119
  "why": "the space is the product"
4093
4120
  },
4121
+ "popup": "offer",
4094
4122
  "world": "nocturne",
4095
4123
  "imagery": "Real events at your venue.",
4096
4124
  "pages": [
@@ -4221,6 +4249,7 @@ export const SPEC_BUSINESS_TYPES = [
4221
4249
  ],
4222
4250
  "why": "the space is the product"
4223
4251
  },
4252
+ "popup": "offer",
4224
4253
  "world": "documentary",
4225
4254
  "imagery": "Rooms, views, breakfast; your own photos.",
4226
4255
  "pages": [
@@ -4363,6 +4392,7 @@ export const SPEC_BUSINESS_TYPES = [
4363
4392
  ],
4364
4393
  "why": "the room people come to, and its light"
4365
4394
  },
4395
+ "popup": "offer",
4366
4396
  "world": "documentary",
4367
4397
  "imagery": "Real classes (with permission).",
4368
4398
  "pages": [
@@ -4933,3 +4963,56 @@ export const SPEC_FILM_IDEAS = {
4933
4963
  "בנק"
4934
4964
  ]
4935
4965
  } as const;
4966
+
4967
+ export const SPEC_POPUP_STANCES = {
4968
+ "raise": [
4969
+ "popup",
4970
+ "pop-up",
4971
+ "pop up",
4972
+ "announcement",
4973
+ "newsletter",
4974
+ "mailing list",
4975
+ "פופאפ",
4976
+ "פופ-אפ",
4977
+ "חלון קופץ",
4978
+ "הודעה קופצת",
4979
+ "ניוזלטר",
4980
+ "רשימת תפוצה"
4981
+ ],
4982
+ "lower": [
4983
+ "calm",
4984
+ "quiet",
4985
+ "minimal",
4986
+ "formal",
4987
+ "serious",
4988
+ "רגוע",
4989
+ "שקט",
4990
+ "מינימלי",
4991
+ "רשמי",
4992
+ "רציני"
4993
+ ],
4994
+ "refusedBy": [
4995
+ "no popup",
4996
+ "no pop-up",
4997
+ "no pop up",
4998
+ "without popups",
4999
+ "without pop-ups",
5000
+ "בלי פופאפ",
5001
+ "בלי חלון קופץ",
5002
+ "בלי חלונות קופצים",
5003
+ "ללא פופאפ",
5004
+ "ללא חלונות קופצים"
5005
+ ]
5006
+ } as const;
5007
+
5008
+ export const SPEC_STATED_FACTS = {
5009
+ "news": {
5010
+ "label": {
5011
+ "en": "Your news",
5012
+ "he": "החדשות שלך"
5013
+ },
5014
+ "how": "only news the prompt states — an offer, an opening, a date (\"a November offer: transfer included\", \"our second shop opens on 1 December\"); never inferred",
5015
+ "reads": "PU3",
5016
+ "feeds": "popup"
5017
+ }
5018
+ } as const;
@@ -0,0 +1,111 @@
1
+ import { BusinessType, businessTypeById } from './business-types';
2
+ import { SPEC_POPUP_STANCES, SPEC_STATED_FACTS } from './harness-spec.generated';
3
+ import { keywordsIn } from './intake';
4
+
5
+ /**
6
+ * A popup, SUGGESTED (popups-plan.md §10, PU-D11 / PU-D12). The harness's answer, never the model's:
7
+ * - the STANCE — `offer` (hospitality, food, shops, events, studios), `ifAsked` (trust and care types), `never` — the
8
+ * type's default (contract `POPUP_STANCES`, on each type as `popup`) moved ONE step by the owner's words, as for the film;
9
+ * an owner who says "no popup" (`refusedBy`) makes it `never` whatever else they wrote.
10
+ * - the Plan step's two LINES — "Show your news in a popup" exists only when the owner STATED news (`news`, a stated fact:
11
+ * never inferred, never a placeholder) and the stance is offer, and starts ticked; "Invite visitors to your newsletter
12
+ * in a popup" is offered when the site has a newsletter form and the stance is not never, and is never ticked by itself.
13
+ * A generated site gets a popup only from one of these two lines. Pure: no transport, no clock.
14
+ */
15
+
16
+ /** How a popup is suggested. */
17
+ export enum PopupStance {
18
+ Offer = 'offer',
19
+ IfAsked = 'ifAsked',
20
+ Never = 'never',
21
+ }
22
+
23
+ /** What the owner's words did to the stance. */
24
+ export interface PopupWords {
25
+ /** Words asking for a popup or a newsletter. */
26
+ readonly raised: ReadonlyArray<string>;
27
+ /** Words asking for calm. */
28
+ readonly lowered: ReadonlyArray<string>;
29
+ /** The owner said no popup. */
30
+ readonly refused: ReadonlyArray<string>;
31
+ }
32
+
33
+ /** The words that move the stance (contract `POPUP_STANCES`). */
34
+ export const POPUP_WORDS = {
35
+ raise: SPEC_POPUP_STANCES.raise as ReadonlyArray<string>,
36
+ lower: SPEC_POPUP_STANCES.lower as ReadonlyArray<string>,
37
+ refusedBy: SPEC_POPUP_STANCES.refusedBy as ReadonlyArray<string>,
38
+ } as const;
39
+
40
+ /** A fact a reading takes ONLY as stated — never a placeholder, never a gap (contract `statedFacts`). */
41
+ export interface StatedFactDef {
42
+ readonly label: { readonly en: string; readonly he: string };
43
+ readonly how: string;
44
+ /** The phase that reads it. */
45
+ readonly reads: string;
46
+ /** What it makes. */
47
+ readonly feeds: string;
48
+ }
49
+
50
+ /** The stated facts, keyed (`news`). Kept apart from site.facts on purpose: a site.facts key is a placeholder. */
51
+ export const STATED_FACTS: Readonly<Record<keyof typeof SPEC_STATED_FACTS, StatedFactDef>> = SPEC_STATED_FACTS;
52
+ export type StatedFactKey = keyof typeof SPEC_STATED_FACTS;
53
+ export const STATED_FACT_KEYS = Object.keys(SPEC_STATED_FACTS) as ReadonlyArray<StatedFactKey>;
54
+
55
+ /** What the owner's words say about a popup (the ONE no-model word rule, `keywordsIn`). A refusal ("no popup") holds a
56
+ * raise word ("popup"); it is read first and the raise words it holds do not count. */
57
+ export function popupWordsIn(prompt: string | null | undefined): PopupWords {
58
+ const text = prompt ?? '';
59
+ const refused = keywordsIn(text, POPUP_WORDS.refusedBy);
60
+ const raised = refused.length ? [] : keywordsIn(text, POPUP_WORDS.raise);
61
+ return { raised, lowered: keywordsIn(text, POPUP_WORDS.lower), refused };
62
+ }
63
+
64
+ /** The stance for a business and the owner's words: the type's default moved ONE step (raise ifAsked → offer, lower
65
+ * offer → ifAsked, both cancel); `never` moves for no word; a refusal is never; an unknown type is never. */
66
+ export function popupStanceFor(type: BusinessType | undefined, words: PopupWords): PopupStance {
67
+ const base = (type?.popup ?? PopupStance.Never) as PopupStance;
68
+ if (base === PopupStance.Never || words.refused.length) return PopupStance.Never;
69
+ const raise = words.raised.length > 0, lower = words.lowered.length > 0;
70
+ if (raise && !lower) return PopupStance.Offer;
71
+ if (lower && !raise) return PopupStance.IfAsked;
72
+ return base;
73
+ }
74
+
75
+ export interface PopupSuggestionInput {
76
+ readonly businessType: string | null | undefined;
77
+ /** The owner's own words (the prompt). */
78
+ readonly prompt?: string | null;
79
+ /** The reading's stated `news` fact — its value and the words it came from; absent = no news was stated. */
80
+ readonly news?: { readonly value: string; readonly quote: string } | null;
81
+ /** The site carries a newsletter form. */
82
+ readonly newsletterForm: boolean;
83
+ }
84
+
85
+ /** One line of the Plan step. */
86
+ export interface PopupLine {
87
+ readonly shown: boolean;
88
+ /** Starts ticked (always the owner's to untick). */
89
+ readonly ticked: boolean;
90
+ }
91
+
92
+ export interface PopupSuggestion {
93
+ readonly stance: PopupStance;
94
+ /** "Show your news in a popup — '<news>'". */
95
+ readonly news: PopupLine;
96
+ /** "Invite visitors to your newsletter in a popup" — never ticked by itself. */
97
+ readonly newsletter: PopupLine;
98
+ readonly words: PopupWords;
99
+ }
100
+
101
+ const HIDDEN: PopupLine = { shown: false, ticked: false };
102
+
103
+ /** The Plan step's popup lines for a site (PU-D12). */
104
+ export function popupSuggestion(input: PopupSuggestionInput): PopupSuggestion {
105
+ const words = popupWordsIn(input.prompt);
106
+ const stance = popupStanceFor(businessTypeById(input.businessType), words);
107
+ const stated = !!(input.news?.value?.trim() && input.news?.quote?.trim());
108
+ const news: PopupLine = stated && stance === PopupStance.Offer ? { shown: true, ticked: true } : HIDDEN;
109
+ const newsletter: PopupLine = input.newsletterForm && stance !== PopupStance.Never ? { shown: true, ticked: false } : HIDDEN;
110
+ return { stance, news, newsletter, words };
111
+ }
@@ -24,4 +24,5 @@ export * from './site-reading';
24
24
  export * from './generation-view';
25
25
  export * from './starting-design';
26
26
  export * from './film-idea';
27
+ export * from './popup-stance';
27
28
  export * from './site-audit-view';