@vectoriox/iox-ui 5.179.0 → 5.181.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.
@@ -1,9 +1,15 @@
1
+ import { PopupRole } from '@vectoriox/iox-ui/composite-core';
2
+
1
3
  import { ComposedPlaceholder, ComposeIssue, ComposeIssueCode } from './compose-site';
4
+ import type { LayoutPhotoAddress } from './compose-site';
5
+ import type { LegalContext } from './legal';
2
6
  import { GenerationTier, SitePlan, SitePlanSource } from './site-plan.model';
3
7
  import { SitePlanIssueCode } from './validate-site-plan';
4
8
  import { planSells } from './shop-plan';
5
9
  import { importedPicturesOf } from './import-plan';
6
- import type { TypeLed } from './type-led';
10
+ import type { PictureSupply, TypeLed } from './type-led';
11
+ import { isPopupNode, POPUP_GLOBAL_ID } from './popup-plan';
12
+ import { SerializedNode, walkSerialized } from './serialized-node';
7
13
 
8
14
  /**
9
15
  * A site build's WIRE vocabulary (AI plan §3b, W2): what iox-cms's `site-builds` API answers and what every
@@ -211,6 +217,10 @@ export enum BuildNoticeCode {
211
217
  * or past the plan's picture or size limit) — the items show none in their place (never the old site's), said once,
212
218
  * so the owner adds them in the builder. */
213
219
  ImportPicturesLeft = 'import-pictures-left',
220
+ /** iox-ui#155 (popups PU3): Keep mine left the studio's own popup in the popup's place, so the popup the build made
221
+ * from the owner's news was not written — said once, so the owner knows the news is not on the site and where to
222
+ * show it (Replace, or the builder). */
223
+ PopupKept = 'popup-kept',
214
224
  }
215
225
 
216
226
  /** RD3-D3 (a): what a build does with a page an earlier Undo kept at an address its plan builds — the header and footer's
@@ -280,6 +290,43 @@ export interface BuildNotice {
280
290
  detail: string;
281
291
  }
282
292
 
293
+ /** The popup's words the owner reads (its title and body — never the mechanism's), for a notice's detail. */
294
+ function popupWordsOf(popup: SerializedNode): string {
295
+ const words: string[] = [];
296
+ walkSerialized(popup.children ?? [], n => {
297
+ const said = typeof n.props?.['content'] === 'string' ? n.props['content'].trim() : '';
298
+ if (said && (n.role === PopupRole.Title || n.role === PopupRole.Body)) words.push(said);
299
+ });
300
+ return words.join(' — ');
301
+ }
302
+
303
+ /**
304
+ * iox-ui#155: the build composed a popup (`POPUP_GLOBAL_ID`) and the owner chose Keep mine over the studio's own popup at
305
+ * that id — the composed one is not written (iox-cms `keptInPlace`), so the news it carried is not on the site. Said once
306
+ * (`BuildNoticeCode.PopupKept`) with the words that were not shown; the screen shows the code's own sentence. No composed
307
+ * popup, or nothing kept at its id (Replace, a first build): nothing said. Pure — the dry run and the run say the same.
308
+ */
309
+ export function popupKeptNotices(composedGlobals: ReadonlyArray<SerializedNode>, keptInPlace: ReadonlyArray<Pick<SerializedNode, 'id'>>): BuildNotice[] {
310
+ const composed = composedGlobals.find(g => g.id === POPUP_GLOBAL_ID && isPopupNode(g));
311
+ if (!composed || !keptInPlace.some(g => g.id === POPUP_GLOBAL_ID)) return [];
312
+ const words = popupWordsOf(composed);
313
+ return [{ code: BuildNoticeCode.PopupKept, detail: `the studio's own popup stays${words ? `, so "${words}" is not shown` : ''} — Replace puts the build's popup in its place` }];
314
+ }
315
+
316
+ /**
317
+ * What a run's decisions hold that its pages are composed with (the server's `BuildDecisions` carries more) — read by
318
+ * harness-core `runComposeContext`, the ONE context every compose of a run's plan takes: its steps, its checks, a
319
+ * redesign and Design ▸ Look's Re-fit in the builder (iox-cms-client#111).
320
+ */
321
+ export interface BuildComposeDecisions {
322
+ /** M8 gate 2: where a composed layout's photos are (id → address). */
323
+ layoutPhotos?: Readonly<Record<string, LayoutPhotoAddress>>;
324
+ /** AW1: the legal context the run's preflight read. */
325
+ legal?: LegalContext | null;
326
+ /** The reading's kind of business (harness-core id): calm (AW6), the footer's call word and what it never wears (AW12). */
327
+ businessType?: string | null;
328
+ }
329
+
283
330
  /** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
284
331
  export interface SiteBuildRun {
285
332
  _id: string;
@@ -306,6 +353,12 @@ export interface SiteBuildRun {
306
353
  startedAt: Date | string;
307
354
  finishedAt?: Date | string;
308
355
  undo?: UndoRecord;
356
+ /** What the run's pages are composed with (`BuildComposeDecisions` — the run holds more). */
357
+ decisions?: BuildComposeDecisions;
358
+ /** iox-ui#129: what fills the site's pictures, taken ONCE when the stock step placed them (the owner's, the made ones,
359
+ * stock) — every later compose of the run's plan takes it, so a section nothing fills stays type-led. Absent: the run
360
+ * had not reached its stock step (or predates #129) — composed as the plan says. */
361
+ pictures?: PictureSupply;
309
362
  }
310
363
 
311
364
  /** `GET …/site-builds/:id/undo`: what an Undo would remove and keep — never guessed in the browser. */
@@ -8971,26 +8971,52 @@ export const SPEC_SITE_LAYOUT = {
8971
8971
  {
8972
8972
  "text": "Book a table",
8973
8973
  "he": "הזמינו שולחן",
8974
+ "line": "Come hungry.",
8975
+ "lineHe": "בואו רעבים.",
8974
8976
  "types": [
8975
8977
  "restaurant",
8976
8978
  "bar-winery"
8977
8979
  ]
8978
8980
  },
8981
+ {
8982
+ "text": "Book a stay",
8983
+ "he": "הזמינו חדר",
8984
+ "line": "Stay a while.",
8985
+ "lineHe": "בואו להתארח אצלנו.",
8986
+ "types": [
8987
+ "hotel-bnb"
8988
+ ]
8989
+ },
8990
+ {
8991
+ "text": "Book a visit",
8992
+ "he": "קבעו תור",
8993
+ "line": "Make time for yourself.",
8994
+ "lineHe": "זמן לעצמך.",
8995
+ "types": [
8996
+ "salon",
8997
+ "spa",
8998
+ "yoga",
8999
+ "fitness"
9000
+ ]
9001
+ },
8979
9002
  {
8980
9003
  "text": "Visit us",
8981
9004
  "he": "בואו לבקר",
9005
+ "line": "Come and see us.",
9006
+ "lineHe": "נשמח לראות אתכם.",
8982
9007
  "types": [
8983
9008
  "cafe-bakery",
8984
9009
  "boutique",
8985
9010
  "florist",
8986
9011
  "home-goods",
8987
- "venue-events",
8988
- "hotel-bnb"
9012
+ "venue-events"
8989
9013
  ]
8990
9014
  },
8991
9015
  {
8992
9016
  "text": "Say hello",
8993
9017
  "he": "בואו נדבר",
9018
+ "line": "Let's make something.",
9019
+ "lineHe": "בואו ניצור משהו יחד.",
8994
9020
  "types": [
8995
9021
  "photographer",
8996
9022
  "interior-design",
@@ -9005,6 +9031,8 @@ export const SPEC_SITE_LAYOUT = {
9005
9031
  {
9006
9032
  "text": "Get in touch",
9007
9033
  "he": "צרו קשר",
9034
+ "line": "Let's talk.",
9035
+ "lineHe": "בואו נדבר.",
9008
9036
  "types": []
9009
9037
  }
9010
9038
  ],
@@ -26,3 +26,4 @@ export * from './starting-design';
26
26
  export * from './film-idea';
27
27
  export * from './popup-stance';
28
28
  export * from './site-audit-view';
29
+ export * from './run-compose-context';
@@ -0,0 +1,47 @@
1
+ import { BuildComposeDecisions, ComposeContext, composeContextOf, GenerationTier, PictureSupply } from '@vectoriox/iox-ui/generation-core';
2
+
3
+ import { businessTypeById } from './business-types';
4
+ import { isCalmBusinessType } from './motion';
5
+
6
+ /**
7
+ * What a site build's run holds that its compose context reads — the server's run and the builder's copy of it
8
+ * (`GET …/site-builds/:id`, `SiteBuildRun`) both are one.
9
+ */
10
+ export interface ComposeRun {
11
+ year: number;
12
+ tier?: `${GenerationTier}` | null;
13
+ decisions?: BuildComposeDecisions | null;
14
+ pictures?: PictureSupply | null;
15
+ }
16
+
17
+ /**
18
+ * What the composer takes from the reading's kind of business (award §7.1g, AW12):
19
+ * - `businessType` — the footer's call word follows it (AW12-D15, generation-core `footerCallWord`);
20
+ * - `footerNever` — what that kind of business's footer never wears (AW12-D10, harness FOOTER_NEVER), mended and said by
21
+ * `checkFooter` (`type-never`).
22
+ * An unknown or absent type gives nothing: the composer's defaults hold. (`calm` stays `composeContextOf`'s own argument.)
23
+ */
24
+ export function businessComposeContext(typeId: string | null | undefined): Pick<ComposeContext, 'businessType' | 'footerNever'> {
25
+ const type = typeId ? businessTypeById(typeId) : undefined;
26
+ if (!type) return {};
27
+ const never = type.footer;
28
+ const refuses = !!never && (never.closings.length > 0 || never.grounds.length > 0);
29
+ return { businessType: type.id, ...(refuses ? { footerNever: never } : {}) };
30
+ }
31
+
32
+ /**
33
+ * THE compose context of a build run (moved from iox-cms `site-builds.service`, iox-cms-client#111): its year, its
34
+ * layouts' photos, its tier, the legal context its preflight read (AW1), whether its business is calm (AW6 — the body
35
+ * takes no shaped edge), its kind of business for the footer (AW12), and — once the stock step has placed the pictures —
36
+ * what fills them (iox-ui#129: a section nothing fills is composed type-led, an empty photo on a composed page a ground
37
+ * plate). ONE reading, so every compose of a run's plan — each step, a resumed step, a redesign, the builder's Re-fit —
38
+ * composes the same site. Pure.
39
+ */
40
+ export function runComposeContext(run: ComposeRun): ComposeContext {
41
+ const decisions = run.decisions ?? undefined;
42
+ const context: ComposeContext = {
43
+ ...composeContextOf(run.year, decisions?.layoutPhotos, run.tier ?? undefined, decisions?.legal ?? null, isCalmBusinessType(decisions?.businessType)),
44
+ ...businessComposeContext(decisions?.businessType),
45
+ };
46
+ return run.pictures ? { ...context, pictures: run.pictures } : context;
47
+ }