@vectoriox/iox-ui 5.97.0 → 5.99.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 (37) hide show
  1. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1114 -223
  2. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  3. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +115 -42
  4. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-identity-core.mjs +535 -0
  6. package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -0
  7. package/generation-core/index.d.ts +515 -17
  8. package/harness-core/index.d.ts +66 -6
  9. package/identity-core/index.d.ts +364 -0
  10. package/identity-core/package.json +3 -0
  11. package/package.json +5 -1
  12. package/src/generation-core/audit-site.ts +8 -0
  13. package/src/generation-core/compose-site.ts +130 -4
  14. package/src/generation-core/nav-shape.ts +4 -2
  15. package/src/generation-core/patterns.ts +25 -1
  16. package/src/generation-core/pictures.ts +1 -1
  17. package/src/generation-core/plan-derived.ts +10 -5
  18. package/src/generation-core/plan-edits.ts +8 -7
  19. package/src/generation-core/plan-wire.ts +59 -10
  20. package/src/generation-core/plan-words.ts +18 -1
  21. package/src/generation-core/public-api.ts +1 -0
  22. package/src/generation-core/shop-plan.ts +165 -0
  23. package/src/generation-core/showcase.ts +29 -4
  24. package/src/generation-core/site-build-run.ts +25 -0
  25. package/src/generation-core/site-plan.model.ts +49 -1
  26. package/src/generation-core/site-spec.generated.ts +330 -2
  27. package/src/generation-core/stock-photos.ts +19 -2
  28. package/src/generation-core/validate-site-plan.ts +146 -8
  29. package/src/harness-core/business-types.ts +13 -0
  30. package/src/harness-core/harness-spec.generated.ts +69 -39
  31. package/src/harness-core/needs.ts +30 -1
  32. package/src/harness-core/site-reading.ts +8 -2
  33. package/src/identity-core/guards.ts +87 -0
  34. package/src/identity-core/public-api.ts +13 -0
  35. package/src/identity-core/sign-in.ts +223 -0
  36. package/src/identity-core/site-auth.ts +172 -0
  37. package/src/identity-core/words.ts +194 -0
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Who signs in, with what, and the broker's two faces (commerce plan §3c "The broker, step by step", C-D6, C-D22).
3
+ * The broker (iox-control-plane, `auth.iox.studio`) and the studios (iox-cms) speak THESE shapes; a provider is one
4
+ * adapter on the broker and one `customerIdentities.provider` value in a studio. Email codes never touch the broker.
5
+ */
6
+ /** Who the sign-in is for. */
7
+ declare enum SignInPurpose {
8
+ /** A buyer on a studio's site. */
9
+ Site = "site",
10
+ /** A studio's team member — existing users only (wave 2). */
11
+ Admin = "admin",
12
+ /** portal.iox.studio. */
13
+ Portal = "portal"
14
+ }
15
+ /** A provider the broker runs. Google is live; the rest join one adapter at a time (board 18). */
16
+ declare enum SignInProvider {
17
+ Google = "google",
18
+ Meta = "meta",
19
+ GitHub = "github",
20
+ LinkedIn = "linkedin"
21
+ }
22
+ /** How a provider answers (board 18): OpenID Connect gives a SIGNED ID token; OAuth 2 needs a profile call. */
23
+ declare enum SignInProtocol {
24
+ Oidc = "oidc",
25
+ OAuth2 = "oauth2"
26
+ }
27
+ interface SignInProviderSpec {
28
+ readonly protocol: SignInProtocol;
29
+ /** The answer is signed, so a studio can check it itself — the only kind an admin may sign in with (C-D6). */
30
+ readonly signedAnswer: boolean;
31
+ /** Running on the broker today. */
32
+ readonly live: boolean;
33
+ }
34
+ declare const SIGN_IN_PROVIDER_SPECS: Readonly<Record<SignInProvider, SignInProviderSpec>>;
35
+ declare function isSignInProvider(value: unknown): value is SignInProvider;
36
+ declare function isSignInPurpose(value: unknown): value is SignInPurpose;
37
+ /** May `provider` serve `purpose`? Buyers and the portal take any provider; a team member only a signed answer (C-D6). */
38
+ declare function providerServes(provider: SignInProvider, purpose: SignInPurpose): boolean;
39
+ /** The broker's public host (its own ingress; ops.iox.studio is unchanged). */
40
+ declare const BROKER_HOST = "auth.iox.studio";
41
+ declare const BROKER_ORIGIN = "https://auth.iox.studio";
42
+ /** A ticket lives 60 s and is used once; so does a hand-off code. */
43
+ declare const SIGN_IN_TICKET_TTL_SECONDS = 60;
44
+ declare const SIGN_IN_HANDOFF_TTL_SECONDS = 60;
45
+ /** The server-to-server routes on the control plane's API host (bearer: the studio's INSTANCE_TOKEN). */
46
+ declare enum BrokerApiRoute {
47
+ Tickets = "instances/me/sign-in/tickets",
48
+ Redeem = "instances/me/sign-in/redeem"
49
+ }
50
+ /** The browser's routes on `auth.iox.studio`, one pair per provider. */
51
+ declare enum BrokerBrowserRoute {
52
+ Start = "start",
53
+ Callback = "callback"
54
+ }
55
+ /** `/<route>` on the control plane's API host, root-relative. */
56
+ declare function brokerApiPath(route: BrokerApiRoute): string;
57
+ /** `https://auth.iox.studio/<provider>/<route>`. */
58
+ declare function brokerBrowserUrl(provider: SignInProvider, route: BrokerBrowserRoute, origin?: string): string;
59
+ /** Where the browser goes to begin: `https://auth.iox.studio/<provider>/start?ticket=<ticket>`. */
60
+ declare function brokerStartUrl(provider: SignInProvider, ticket: string, origin?: string): string;
61
+ /** The ONE address registered with each provider: `https://auth.iox.studio/<provider>/callback`. */
62
+ declare function brokerCallbackUrl(provider: SignInProvider, origin?: string): string;
63
+ declare const BROKER_TICKET_PARAM = "ticket";
64
+ /** `POST instances/me/sign-in/tickets` — body. */
65
+ interface SignInTicketRequest {
66
+ provider: SignInProvider;
67
+ purpose: SignInPurpose;
68
+ /** Where the broker sends the browser back; its host must be one of the asking tenant's. */
69
+ returnUrl: string;
70
+ }
71
+ /** 201 — `expiresAt` is an ISO date. */
72
+ interface SignInTicketAnswer {
73
+ ticket: string;
74
+ startUrl: string;
75
+ expiresAt: string;
76
+ }
77
+ /** `POST instances/me/sign-in/redeem` — body: the hand-off code the browser brought back. */
78
+ interface SignInRedeemRequest {
79
+ code: string;
80
+ }
81
+ /** 200 — the person the provider vouched for. Only the tenant (or the portal) that asked for the ticket gets it. */
82
+ interface SignInRedeemAnswer {
83
+ provider: SignInProvider;
84
+ purpose: SignInPurpose;
85
+ /** The provider's stable id for the person (`customerIdentities.subject`). */
86
+ subject: string;
87
+ email: string;
88
+ /** Link to an existing customer by email ONLY when true (board 18's one security rule). */
89
+ emailVerified: boolean;
90
+ name?: string;
91
+ picture?: string;
92
+ returnUrl: string;
93
+ }
94
+ /** What the broker refuses, in its answer body `{ code }`. */
95
+ declare enum BrokerRefusalCode {
96
+ /** 403 — the return address is not one of this tenant's hosts. */
97
+ ReturnHostRefused = "return-host-refused",
98
+ /** 400 */
99
+ UnknownProvider = "unknown-provider",
100
+ /** 503 — no client id/secret for the provider in the broker's environment. */
101
+ ProviderNotConfigured = "provider-not-configured",
102
+ /** 404 */
103
+ CodeUnknown = "code-unknown",
104
+ /** 410 */
105
+ CodeUsedOrExpired = "code-used-or-expired",
106
+ /** 403 — another tenant's code. */
107
+ NotYours = "not-yours"
108
+ }
109
+ declare const BROKER_REFUSAL_STATUS: Readonly<Record<BrokerRefusalCode, number>>;
110
+ declare function isBrokerRefusalCode(value: unknown): value is BrokerRefusalCode;
111
+ /** The hand-off code's query parameter on the return address. Never a name or an email in an address. */
112
+ declare const SIGN_IN_HANDOFF_PARAM = "iox_signin";
113
+ /** The failure's query parameter on the return address. */
114
+ declare const SIGN_IN_ERROR_PARAM = "iox_signin_error";
115
+ /** Why the browser came back without a person. */
116
+ declare enum SignInReturnError {
117
+ /** The person pressed Cancel on the provider's screen. */
118
+ Cancelled = "cancelled",
119
+ /** The provider's answer failed a check (issuer, audience, nonce, an unverified email). */
120
+ Refused = "refused",
121
+ /** The ticket or the provider's state had expired. */
122
+ Expired = "expired",
123
+ Failed = "failed"
124
+ }
125
+ declare function isSignInReturnError(value: unknown): value is SignInReturnError;
126
+ /** The return address with `?iox_signin=<code>` added (its own query, `next`, kept). */
127
+ declare function withSignInHandoff(returnUrl: string, code: string): string;
128
+ /** The return address with `?iox_signin_error=<error>` added. */
129
+ declare function withSignInError(returnUrl: string, error: SignInReturnError): string;
130
+ type SignInReturn = {
131
+ readonly code: string;
132
+ readonly error?: undefined;
133
+ } | {
134
+ readonly code?: undefined;
135
+ readonly error: SignInReturnError;
136
+ };
137
+ /**
138
+ * What came back on a return address's query (`?iox_signin=` or `?iox_signin_error=`), or null when neither did. An
139
+ * error wins over a code; an unknown error reads `failed`; an empty code is no code.
140
+ */
141
+ declare function readSignInReturn(search: string | URLSearchParams | null | undefined): SignInReturn | null;
142
+
143
+ /**
144
+ * The two address checks every sign-in step leans on. Both REFUSE when in doubt: a sign-in that sends a person to the
145
+ * wrong place is worse than one that sends them home.
146
+ */
147
+ /** Longer than any page path a site has; a longer `next` is refused. */
148
+ declare const NEXT_PATH_MAX_LENGTH = 2048;
149
+ /**
150
+ * True only for a path on THIS site — the `next` a sign-in returns to (the open-redirect guard). It must start with ONE
151
+ * `/`, hold no backslash and no control character (raw or percent-encoded), and stay on the origin when a browser
152
+ * resolves it. `//evil.com`, `/\evil.com`, `/%2F%2Fevil.com`, `https://evil.com`, `javascript:` — all refused.
153
+ */
154
+ declare function isSameOriginPath(next: unknown): next is string;
155
+ /** `next` when it is a same-origin path, else `fallback` (the site's home). */
156
+ declare function safeNextPath(next: unknown, fallback?: string): string;
157
+ declare function isLoopbackHost(hostname: string): boolean;
158
+ interface ReturnHostOptions {
159
+ /** Accept `http:` on a loopback host (tests and local stacks only — never in production). */
160
+ allowLoopbackHttp?: boolean;
161
+ }
162
+ /** A host as `URL` normalises it (lower case, punycode, the default port dropped), or null when it is not one. */
163
+ declare function normalizeHost(host: string): string | null;
164
+ /**
165
+ * True when `url` returns to one of `hosts` EXACTLY (the broker's return-host check, C-D22): `https:` only (`http:` on a
166
+ * loopback host when asked), no user or password in it, and its host — punycode, with any non-default port — equal to
167
+ * one allowed host. Never a suffix or a prefix: `evil.idos.iox.studio` and `idos.iox.studio.evil.com` are other hosts.
168
+ */
169
+ declare function isAllowedReturnHost(url: unknown, hosts: ReadonlyArray<string>, options?: ReturnHostOptions): boolean;
170
+
171
+ /**
172
+ * A buyer's sign-in on a studio's site (commerce plan §3c, C-D5): iox-cms's public routes under `api/site/:orgId/`, the
173
+ * session it issues, and the cookies it sets. A customer is not a user — its token has its OWN secret and audience and
174
+ * every admin route refuses it (trap T3).
175
+ */
176
+ declare enum SiteAuthRoute {
177
+ /** `POST { email }` → 202 always (never says whether the email is known). */
178
+ Code = "auth/code",
179
+ /** `POST { email, code }` → the session. */
180
+ CodeVerify = "auth/code/verify",
181
+ Refresh = "auth/refresh",
182
+ SignOut = "auth/signout",
183
+ /** `GET` → `{ customer }` (null when signed out). */
184
+ Me = "me",
185
+ MyOrders = "me/orders"
186
+ }
187
+ /** Every route a site's sign-in calls, by name (the provider pair is per provider — `siteProviderPath`). */
188
+ declare const SITE_AUTH_ROUTES: Readonly<Record<keyof typeof SiteAuthRoute, SiteAuthRoute>>;
189
+ /** A provider's two routes on the studio: start (`POST { returnPath }` → `{ startUrl }`) and return (the broker's GET). */
190
+ declare enum SiteProviderRoute {
191
+ Start = "start",
192
+ Return = "return"
193
+ }
194
+ /** A sign-in route of one org, ROOT-relative: `/api/site/<org>/<route>`. */
195
+ declare function siteAuthPath(orgId: string, route: SiteAuthRoute): string;
196
+ /** `/api/site/<org>/auth/<provider>/<start|return>`. */
197
+ declare function siteProviderPath(orgId: string, provider: SignInProvider, route: SiteProviderRoute): string;
198
+ /** The `next` query parameter of the return route — where the buyer lands after signing in. */
199
+ declare const SIGN_IN_NEXT_PARAM = "next";
200
+ /**
201
+ * The address the studio asks the broker to send the browser back to:
202
+ * `https://<host>/api/site/<org>/auth/<provider>/return?next=<path>`. `origin` is the studio's own (`https://<host>`);
203
+ * a `next` that is not a same-origin path becomes `/`.
204
+ */
205
+ declare function siteProviderReturnUrl(origin: string, orgId: string, provider: SignInProvider, next: string | null | undefined): string;
206
+ interface SiteProviderStartRequest {
207
+ /** The page to come back to (a same-origin path). */
208
+ returnPath: string;
209
+ }
210
+ interface SiteProviderStartAnswer {
211
+ startUrl: string;
212
+ }
213
+ interface SiteCodeRequest {
214
+ email: string;
215
+ }
216
+ interface SiteCodeVerifyRequest {
217
+ email: string;
218
+ code: string;
219
+ }
220
+ /** What a site may know about the signed-in buyer — nothing else (pages stay cacheable; personal parts fill in later). */
221
+ interface SiteCustomer {
222
+ id: string;
223
+ email: string;
224
+ name: string | null;
225
+ }
226
+ /** `GET me`, `POST auth/code/verify`, `POST auth/refresh`. */
227
+ interface SiteMeAnswer {
228
+ customer: SiteCustomer | null;
229
+ }
230
+ /** The buyer token's audience — never an admin token's. */
231
+ declare const SITE_AUDIENCE = "site";
232
+ /** The buyer session's JWT claims. */
233
+ interface SiteSessionClaims {
234
+ /** The customer id. */
235
+ sub: string;
236
+ aud: typeof SITE_AUDIENCE;
237
+ /** The org the customer belongs to — a session is good on ONE org's routes. */
238
+ org: string;
239
+ iat?: number;
240
+ exp?: number;
241
+ }
242
+ /** True when `claims` carry the site audience and both ids — the shape `CustomerGuard` accepts (it checks the signature). */
243
+ declare function isSiteSessionClaims(claims: unknown): claims is SiteSessionClaims;
244
+ /** True when a token's claims carry the site audience at all — what the admin guard refuses (T3). */
245
+ declare function hasSiteAudience(claims: unknown): boolean;
246
+ /** The buyer session: httpOnly, `Path=/` (the site's SSR reads it — the cart cookie's reason), SameSite=Lax. */
247
+ declare const CUSTOMER_COOKIE_PREFIX = "iox_c_";
248
+ /** A Google sign-in in flight: httpOnly, short, holds a hash binding the ticket — a forged return fails without it. */
249
+ declare const SIGN_IN_STATE_COOKIE_PREFIX = "iox_si_";
250
+ declare const SITE_COOKIE_PATH = "/";
251
+ /** Long enough for a person on the provider's screen; the ticket inside expires long before. */
252
+ declare const SIGN_IN_STATE_MAX_AGE_SECONDS = 600;
253
+ declare function customerCookieName(orgId: string): string;
254
+ declare function signInStateCookieName(orgId: string): string;
255
+ declare const EMAIL_CODE_LENGTH = 6;
256
+ declare const EMAIL_CODE_TTL_MINUTES = 10;
257
+ declare const EMAIL_CODE_TTL_MS: number;
258
+ /** Wrong codes before the code is spent and a new one must be sent. */
259
+ declare const EMAIL_CODE_MAX_TRIES = 5;
260
+ /** A typed or pasted code as digits only ("481 203", "481-203" → "481203"); anything else is kept, to be refused. */
261
+ declare function normalizeEmailCode(input: unknown): string;
262
+ /** Exactly six ASCII digits. */
263
+ declare function isEmailCodeShape(code: unknown): boolean;
264
+ /** An email as a studio keys its customers by (unique per org): trimmed, lower case. */
265
+ declare function normalizeSignInEmail(email: unknown): string;
266
+ /** Has the code outlived its ten minutes? `now` is the caller's — the core reads no clock. */
267
+ declare function emailCodeExpired(sentAt: number | Date, now: number | Date): boolean;
268
+ /** How many more codes may be tried after `wrongTries` wrong ones (0 = the code is spent). */
269
+ declare function emailCodeTriesLeft(wrongTries: number): number;
270
+
271
+ /**
272
+ * The sign-in dialog's words and its refusals, in English and Hebrew. A string-rendered site has no translation
273
+ * service, so the core carries both itself (commerce-core `CHECKOUT_WORDS` precedent); a host with its own translations
274
+ * may key them by the stable codes instead.
275
+ */
276
+ interface SignInLabel {
277
+ readonly en: string;
278
+ readonly he: string;
279
+ }
280
+ declare enum SignInLanguage {
281
+ En = "en",
282
+ He = "he"
283
+ }
284
+ declare function signInLanguage(lang: string | null | undefined): SignInLanguage;
285
+ declare enum SignInWord {
286
+ SignIn = "signIn",
287
+ SignInTo = "signInTo",
288
+ Why = "why",
289
+ ContinueWithGoogle = "continueWithGoogle",
290
+ Or = "or",
291
+ Email = "email",
292
+ EmailPlaceholder = "emailPlaceholder",
293
+ SendCode = "sendCode",
294
+ CodeSent = "codeSent",
295
+ Code = "code",
296
+ CodeValid = "codeValid",
297
+ SendAgain = "sendAgain",
298
+ Verify = "verify",
299
+ OtherEmail = "otherEmail",
300
+ Working = "working",
301
+ Close = "close",
302
+ SignOut = "signOut",
303
+ Account = "account",
304
+ YourOrders = "yourOrders",
305
+ Hello = "hello",
306
+ SignedIn = "signedIn",
307
+ SignedOut = "signedOut",
308
+ NoPassword = "noPassword"
309
+ }
310
+ /** `{site}`, `{email}`, `{name}`, `{minutes}` are filled by `signInWord`. */
311
+ declare const SIGN_IN_WORDS: Readonly<Record<SignInWord, SignInLabel>>;
312
+ declare function signInWord(word: SignInWord, lang: string | null | undefined, fill?: Readonly<Record<string, string | number>>): string;
313
+ /** Where in the sign-in dialog a refusal is said. */
314
+ declare enum SignInSlot {
315
+ Email = "email",
316
+ Code = "code",
317
+ /** Under "Continue with Google". */
318
+ Provider = "provider",
319
+ /** The dialog as a whole. */
320
+ Dialog = "dialog"
321
+ }
322
+ /**
323
+ * Every code a site's sign-in can hear: iox-cms's answers, the broker's return errors (`?iox_signin_error=`), and
324
+ * `network` for no answer at all.
325
+ */
326
+ declare enum SiteSignInRefusalCode {
327
+ InvalidEmail = "invalid-email",
328
+ CodeWrong = "code-wrong",
329
+ CodeExpired = "code-expired",
330
+ TooManyTries = "too-many-tries",
331
+ RateLimited = "rate-limited",
332
+ /** The broker cannot run the provider (down, not configured, the host refused). */
333
+ ProviderUnavailable = "provider-unavailable",
334
+ Cancelled = "cancelled",
335
+ Refused = "refused",
336
+ Expired = "expired",
337
+ Failed = "failed",
338
+ /** The return came back without this browser's sign-in cookie — a forged or stale return. */
339
+ StateMismatch = "state-mismatch",
340
+ Blocked = "blocked",
341
+ NotSignedIn = "not-signed-in",
342
+ Network = "network"
343
+ }
344
+ interface SignInRefusalRule {
345
+ readonly slot: SignInSlot;
346
+ readonly label: SignInLabel;
347
+ }
348
+ declare const SIGN_IN_REFUSALS: Readonly<Record<SiteSignInRefusalCode, SignInRefusalRule>>;
349
+ declare function isSiteSignInRefusalCode(code: unknown): code is SiteSignInRefusalCode;
350
+ /** Any code a sign-in heard, as the site's own: a site code as is, a broker code or a return error mapped, else `failed`. */
351
+ declare function siteSignInCodeOf(code: unknown): SiteSignInRefusalCode;
352
+ interface SignInRefusal {
353
+ code: SiteSignInRefusalCode;
354
+ slot: SignInSlot;
355
+ words: string;
356
+ }
357
+ /** One refusal, on its slot, in the visitor's words. */
358
+ declare function signInRefusal(code: unknown, lang: string | null | undefined): SignInRefusal;
359
+ /** A refused call's body (`{ code }`) — or nothing at all (`network`) — as one refusal. The body's `message` is a log
360
+ * line and is never shown. A 429 with no code is `rate-limited`. */
361
+ declare function signInRefusalOf(body: unknown, lang: string | null | undefined, status?: number | null): SignInRefusal;
362
+
363
+ export { BROKER_HOST, BROKER_ORIGIN, BROKER_REFUSAL_STATUS, BROKER_TICKET_PARAM, BrokerApiRoute, BrokerBrowserRoute, BrokerRefusalCode, CUSTOMER_COOKIE_PREFIX, EMAIL_CODE_LENGTH, EMAIL_CODE_MAX_TRIES, EMAIL_CODE_TTL_MINUTES, EMAIL_CODE_TTL_MS, NEXT_PATH_MAX_LENGTH, SIGN_IN_ERROR_PARAM, SIGN_IN_HANDOFF_PARAM, SIGN_IN_HANDOFF_TTL_SECONDS, SIGN_IN_NEXT_PARAM, SIGN_IN_PROVIDER_SPECS, SIGN_IN_REFUSALS, SIGN_IN_STATE_COOKIE_PREFIX, SIGN_IN_STATE_MAX_AGE_SECONDS, SIGN_IN_TICKET_TTL_SECONDS, SIGN_IN_WORDS, SITE_AUDIENCE, SITE_AUTH_ROUTES, SITE_COOKIE_PATH, SignInLanguage, SignInProtocol, SignInProvider, SignInPurpose, SignInReturnError, SignInSlot, SignInWord, SiteAuthRoute, SiteProviderRoute, SiteSignInRefusalCode, brokerApiPath, brokerBrowserUrl, brokerCallbackUrl, brokerStartUrl, customerCookieName, emailCodeExpired, emailCodeTriesLeft, hasSiteAudience, isAllowedReturnHost, isBrokerRefusalCode, isEmailCodeShape, isLoopbackHost, isSameOriginPath, isSignInProvider, isSignInPurpose, isSignInReturnError, isSiteSessionClaims, isSiteSignInRefusalCode, normalizeEmailCode, normalizeHost, normalizeSignInEmail, providerServes, readSignInReturn, safeNextPath, signInLanguage, signInRefusal, signInRefusalOf, signInStateCookieName, signInWord, siteAuthPath, siteProviderPath, siteProviderReturnUrl, siteSignInCodeOf, withSignInError, withSignInHandoff };
364
+ export type { ReturnHostOptions, SignInLabel, SignInProviderSpec, SignInRedeemAnswer, SignInRedeemRequest, SignInRefusal, SignInReturn, SignInTicketAnswer, SignInTicketRequest, SiteCodeRequest, SiteCodeVerifyRequest, SiteCustomer, SiteMeAnswer, SiteProviderStartAnswer, SiteProviderStartRequest, SiteSessionClaims };
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/vectoriox-iox-ui-identity-core.mjs"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.97.0",
3
+ "version": "5.99.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -55,6 +55,10 @@
55
55
  "types": "./harness-core/index.d.ts",
56
56
  "default": "./fesm2022/vectoriox-iox-ui-harness-core.mjs"
57
57
  },
58
+ "./identity-core": {
59
+ "types": "./identity-core/index.d.ts",
60
+ "default": "./fesm2022/vectoriox-iox-ui-identity-core.mjs"
61
+ },
58
62
  "./media-core": {
59
63
  "types": "./media-core/index.d.ts",
60
64
  "default": "./fesm2022/vectoriox-iox-ui-media-core.mjs"
@@ -50,6 +50,9 @@ export enum SiteFindingCode {
50
50
  UnfilledFact = 'unfilled-fact',
51
51
  CopyPlaceholder = 'copy-placeholder',
52
52
  SampleItems = 'sample-items',
53
+ /** Commerce G1 (shop-aware §3i): a sample product the build added still has no price — a price is a fact a buyer is
54
+ * held to, so the owner sets it (or removes the sample) before the store goes live. */
55
+ SamplePrice = 'sample-price',
53
56
  StockPhoto = 'stock-photo',
54
57
  /** M7: a picture made with AI for the site still stands where one of the studio's own could. */
55
58
  MadePicture = 'made-picture',
@@ -79,6 +82,7 @@ export const FINDING_SEVERITY: Readonly<Record<SiteFindingCode, CheckSeverity>>
79
82
  [SiteFindingCode.UnfilledFact]: CheckSeverity.Block,
80
83
  [SiteFindingCode.CopyPlaceholder]: CheckSeverity.Ask,
81
84
  [SiteFindingCode.SampleItems]: CheckSeverity.Ask,
85
+ [SiteFindingCode.SamplePrice]: CheckSeverity.Block,
82
86
  [SiteFindingCode.StockPhoto]: CheckSeverity.Ask,
83
87
  [SiteFindingCode.MadePicture]: CheckSeverity.Ask,
84
88
  [SiteFindingCode.PictureMissing]: CheckSeverity.Warn,
@@ -105,6 +109,7 @@ const CHECK_OF: Readonly<Record<SiteFindingCode, SiteCheckId>> = {
105
109
  [SiteFindingCode.UnfilledFact]: SiteCheckId.Facts,
106
110
  [SiteFindingCode.CopyPlaceholder]: SiteCheckId.Facts,
107
111
  [SiteFindingCode.SampleItems]: SiteCheckId.Facts,
112
+ [SiteFindingCode.SamplePrice]: SiteCheckId.Facts,
108
113
  [SiteFindingCode.StockPhoto]: SiteCheckId.Facts,
109
114
  [SiteFindingCode.MadePicture]: SiteCheckId.Facts,
110
115
  [SiteFindingCode.PictureMissing]: SiteCheckId.Facts,
@@ -170,6 +175,8 @@ export interface SiteAuditSnapshot {
170
175
  placeholders?: ReadonlyArray<AuditPlaceholder>;
171
176
  /** Sample items still in the site (`isSample`). */
172
177
  samples?: ReadonlyArray<{ contentType: string; id: string; label?: string }>;
178
+ /** Commerce G1: sample products (`isSample`) whose price is still not set. */
179
+ unpricedSamples?: ReadonlyArray<{ id: string; label?: string }>;
173
180
  /** Stock photos a build placed that are still on the page. */
174
181
  stock?: ReadonlyArray<{ nodeId: string; pageId?: string; owner?: string }>;
175
182
  /** M7: pictures made with AI that are still on the page. */
@@ -291,6 +298,7 @@ function checkFacts(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<
291
298
  else if (p.kind === PlaceholderKind.Copy) add(ctx, SiteFindingCode.CopyPlaceholder, 'Some words are still the template\'s.', where);
292
299
  }
293
300
  for (const s of snapshot.samples ?? []) add(ctx, SiteFindingCode.SampleItems, `"${s.label ?? s.id}" is a sample — replace or remove it.`, { nodeId: s.id });
301
+ for (const s of snapshot.unpricedSamples ?? []) add(ctx, SiteFindingCode.SamplePrice, `"${s.label ?? s.id}" has no price yet — set yours, or remove the sample.`, { nodeId: s.id });
294
302
  for (const s of (snapshot.stock ?? []).filter(inScope)) add(ctx, SiteFindingCode.StockPhoto, 'A stock photo stands in for one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
295
303
  for (const s of (snapshot.made ?? []).filter(inScope)) add(ctx, SiteFindingCode.MadePicture, 'A picture made with AI stands in for one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
296
304
  for (const s of (snapshot.missing ?? []).filter(inScope)) add(ctx, SiteFindingCode.PictureMissing, 'A picture could not be made for this spot — add one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
@@ -9,15 +9,17 @@ import {
9
9
  AccordionAutoBinds, CompositeNodeSpec, findByRole, LIGHTBOX_LABEL, SLIDE_TO_ROW, SLIDE_TYPE, buildTabsRecipe, tabLabelNodeOf,
10
10
  tabPanelImageOf, tabPanelTextOf, tabsListOf, tabsPanels, tabsPanelsOf, tabsTriggers, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP,
11
11
  TABS_TEXT_BIND_PROP, TABS_WORDS, TabsAutoBinds, BadgeTone, BADGE_TONES, buildSegmentedRecipe, CardWords, ITEM_OPEN_STATE, segmentedOptions,
12
- setHeaderBehaviour,
12
+ setHeaderBehaviour, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
13
13
  } from '@vectoriox/iox-ui/composite-core';
14
14
 
15
15
  import { EntranceMark, EntrancePart, planEntrances } from './entrances';
16
16
  import { filmOfPlan } from './film';
17
17
  import { NODE_BASELINES } from './node-baselines.generated';
18
18
  import {
19
- BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack, SitePattern, patternById,
19
+ BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternGlobalPosition, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack,
20
+ PriceBindTarget, SitePattern, patternById,
20
21
  } from './patterns';
22
+ import { planSells, shopCategoriesOf, shopContentType, variantNamesOf } from './shop-plan';
21
23
  import { recipeListBinds } from './recipe-fields';
22
24
  import { assertStyleSlots, ComposeError, createSerializedNode, SerializedBinding, SerializedNode, setStyleProps, walkSerialized } from './serialized-node';
23
25
  import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
@@ -25,7 +27,7 @@ import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
25
27
  PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, SITE_FACT_LABELS, SiteBusiness,
26
28
  } from './site-plan.model';
27
29
  import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
28
- import { NavShape, planNavShape } from './nav-shape';
30
+ import { NavRole, NavShape, planNavShape } from './nav-shape';
29
31
  import { composeLayout, LayoutColourMode, layoutBandScheme } from './compose-layout';
30
32
  import { LayoutGalleryList, LayoutPage, LayoutPhotoShape, LayoutPhotoSource, LayoutSite, parseLayoutPhotoId } from './layout-language';
31
33
  import { layoutMotionOf, layoutPresetOf } from './layout-look';
@@ -190,6 +192,31 @@ export interface ComposedSite {
190
192
  routes: ComposedRoute[];
191
193
  placeholders: ComposedPlaceholder[];
192
194
  issues: ComposeIssue[];
195
+ /** Commerce C-D21: what the build writes into the studio's SHOP (never a content type) — null when it sells nothing. */
196
+ shop: ComposedShop | null;
197
+ }
198
+
199
+ /** A sample product as the build writes it through the shop's own write path (its slug made there, from its title). */
200
+ export interface ComposedProduct {
201
+ title: string;
202
+ /** The category's label (the build writes the categories first and links each product to its own). */
203
+ category: string;
204
+ description: string;
205
+ options: Array<{ name: string; values: string[] }>;
206
+ /** Whether it varies, and its variants by name (one per combination; sold, no price, no stock — the owner's). */
207
+ productVariants: boolean;
208
+ variants: Array<{ name: string; enable: true }>;
209
+ /** Never a number (shop-aware §3i, T4): the price is the owner's — a sample's blocks Publish until it is set. */
210
+ pricing: { price: null; compareat: null };
211
+ /** Its picture, once the build placed one (a stock photo, the owner's, a made one) — absent until then. */
212
+ mainImage?: string;
213
+ isSample: true;
214
+ isPublished: true;
215
+ }
216
+
217
+ export interface ComposedShop {
218
+ categories: Array<{ label: string }>;
219
+ products: ComposedProduct[];
193
220
  }
194
221
 
195
222
  /** `{sampleImage:k}` — a bundled abstract sample image, never a stock photo (plan §6b). */
@@ -413,7 +440,7 @@ function detailLinkOf(scope: string, repeater: RepeaterScope | null, ctx: Ctx, n
413
440
  const type = typeSource ? contentTypeOfSource(typeSource, ctx.plan) : undefined;
414
441
  const page = type ? ctx.plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
415
442
  const byRoute = page ? ctx.plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
416
- const filter = byRoute && byRoute.type === PlanDataSourceType.Cms ? byRoute.filterByRouteParam : undefined;
443
+ const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
417
444
  const [param] = page ? routeParams(page.route) : [];
418
445
  if (!page || !filter || !param) return null;
419
446
  return { route: page.route, param, binding: resolveScoped(`${scope}.${filter.field}`, repeater, ctx, nodeId) };
@@ -434,6 +461,7 @@ export function contentTypeOfSource(alias: string, plan: SitePlan): ContentTypeP
434
461
  const ds = plan.dataSources.find(d => d.alias === alias);
435
462
  if (!ds) return undefined;
436
463
  if (ds.type === PlanDataSourceType.Relative) return contentTypeOfSource(ds.within, plan);
464
+ if (ds.type === PlanDataSourceType.Shop) return shopContentType(ds.resource);
437
465
  return plan.contentTypes.find(t => t.name === ds.contentType);
438
466
  }
439
467
 
@@ -752,6 +780,11 @@ function composeNode(given: PatternNode, id: string, repeater: RepeaterScope | n
752
780
  throw new ComposeError(`${id}: "alt" belongs on a bound Image`);
753
781
  }
754
782
 
783
+ if (pn.limit !== undefined) {
784
+ if (type !== REPEATER) throw new ComposeError(`${id}: "limit" belongs on a Repeater`);
785
+ setProp(node, 'limit', pn.limit);
786
+ }
787
+
755
788
  // Layout.
756
789
  applyLayout(node, pn);
757
790
  if (pn.shownWhen) hideUntilOn(node, pn, ctx);
@@ -834,6 +867,7 @@ const CARD_BINDS: Readonly<Record<CardBindTarget, { role: CardRole; prop: string
834
867
  * through its title (`href` + `param`, the stretched link). Ids derive from the recipe's keys.
835
868
  */
836
869
  function composeRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | null, ctx: Ctx): SerializedNode {
870
+ if (SHOP_PATTERN_RECIPES.has(pn.recipe as PatternRecipe)) return composeShopRecipe(pn, id, repeater, ctx);
837
871
  if (pn.recipe === PatternRecipe.Accordion) return composeAccordion(pn, id, ctx);
838
872
  if (pn.recipe === PatternRecipe.Tabs) return composeTabs(pn, id, ctx);
839
873
  if (pn.recipe === PatternRecipe.Carousel) return composeCarousel(pn, id, ctx);
@@ -1040,6 +1074,90 @@ function composeTabs(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
1040
1074
  }
1041
1075
 
1042
1076
  /** A recipe's node factory for this composer: ids derive from the recipe's keys (`<id>-<key>`, the root `<id>`). */
1077
+ /** Commerce G1: a pattern's shop recipes, each E1c's `SHOP_RECIPES` entry and the key its root is built with. */
1078
+ const SHOP_PATTERN_RECIPES: ReadonlyMap<PatternRecipe, { recipe: ShopRecipe; rootKey: string }> = new Map([
1079
+ [PatternRecipe.Price, { recipe: ShopRecipe.Price, rootKey: 'price' }],
1080
+ [PatternRecipe.Variants, { recipe: ShopRecipe.Variants, rootKey: 'variants' }],
1081
+ [PatternRecipe.Quantity, { recipe: ShopRecipe.Quantity, rootKey: 'quantity' }],
1082
+ [PatternRecipe.Add, { recipe: ShopRecipe.Add, rootKey: 'add' }],
1083
+ [PatternRecipe.BuyNow, { recipe: ShopRecipe.BuyNow, rootKey: 'buy-now' }],
1084
+ ]);
1085
+
1086
+ const PRICE_BINDS: Readonly<Record<PriceBindTarget, ShopBindTarget>> = {
1087
+ [PriceBindTarget.Price]: ShopBindTarget.Price,
1088
+ [PriceBindTarget.CompareAt]: ShopBindTarget.CompareAt,
1089
+ };
1090
+
1091
+ /** E1c's root keys of the recipes a site holds outside its sections — the header's bag and the one cart drawer. */
1092
+ const CART_BUTTON_KEY = 'cart-button';
1093
+ const CART_DRAWER_KEY = 'cart-drawer';
1094
+ /** The ids the composer gives them (the header's bag; the drawer, a global after the page). */
1095
+ export const SHOP_CART_BUTTON_ID = 'header-cart';
1096
+ export const SHOP_CART_DRAWER_ID = 'cart';
1097
+
1098
+ /**
1099
+ * Commerce G1: a shop part stamped whole from E1c's recipe (`SHOP_RECIPES`) — the product page's own reading the page's
1100
+ * product (`$variant`, the runtime's), a list's price re-bound to its ROW (`binds`: `item.@price` → `pricing.price`,
1101
+ * through `bindShopPart`, the money pipe kept). A compare-at the row's type cannot show is left out. Never an entrance.
1102
+ */
1103
+ function composeShopRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | null, ctx: Ctx): SerializedNode {
1104
+ const spec = SHOP_PATTERN_RECIPES.get(pn.recipe as PatternRecipe)!;
1105
+ const root = SHOP_RECIPES[spec.recipe](recipeFactory(id, spec.rootKey)) as SerializedNode;
1106
+ if (root.id !== id) throw new ComposeError(`${id}: the ${pn.recipe} recipe's root is not "${spec.rootKey}"`);
1107
+ for (const [key, path] of Object.entries(pn.binds ?? {})) {
1108
+ const target = PRICE_BINDS[key as PriceBindTarget];
1109
+ if (spec.recipe !== ShopRecipe.Price || !target) throw new ComposeError(`${id}: a ${pn.recipe} cannot bind "${key}"`);
1110
+ const scoped = resolveScopedPath(path, repeater, ctx, id);
1111
+ if (scoped) {
1112
+ bindShopPart(root as CompositeNode, target, scoped.source, scoped.path);
1113
+ continue;
1114
+ }
1115
+ if (target === ShopBindTarget.Price) throw new ComposeError(`${id}: a price cannot be left out`);
1116
+ root.children = (root.children ?? []).filter(c => c.role !== ShopRole.PriceCompare);
1117
+ }
1118
+ if (pn.lay) setStyleProps(root, pn.lay);
1119
+ return root;
1120
+ }
1121
+
1122
+ /**
1123
+ * Commerce G1 (C-D21): a selling site is a whole store on every page — the header holds the bag (before the menu
1124
+ * button; the brand takes the row's free space, so the bag sits at the end on every width, either direction), and the
1125
+ * site holds the ONE cart drawer as a global after the page (`SHOP_GLOBAL_RECIPES`), which every bag opens. Check out
1126
+ * is the drawer's own (the fixed checkout). Pure: new globals.
1127
+ */
1128
+ function withStore(globals: SerializedNode[]): SerializedNode[] {
1129
+ const out = [...globals];
1130
+ const header = out.find(g => g.id === GlobalSlot.Header);
1131
+ if (header) {
1132
+ const kids = header.children ?? (header.children = []);
1133
+ const bag = SHOP_RECIPES[ShopRecipe.CartButton](recipeFactory(SHOP_CART_BUTTON_ID, CART_BUTTON_KEY)) as SerializedNode;
1134
+ const menu = kids.findIndex(k => k.role === NavRole.MenuButton);
1135
+ kids.splice(menu >= 0 ? menu : kids.length, 0, bag);
1136
+ const brand = kids.find(k => k.role === NavRole.Brand);
1137
+ if (brand) setStyleProps(brand, { flexGrow: '1' });
1138
+ }
1139
+ const drawer = SHOP_RECIPES[ShopRecipe.CartDrawer](recipeFactory(SHOP_CART_DRAWER_ID, CART_DRAWER_KEY)) as SerializedNode;
1140
+ drawer.isGlobal = true;
1141
+ drawer.globalPosition = PatternGlobalPosition.After;
1142
+ out.push(drawer);
1143
+ return out;
1144
+ }
1145
+
1146
+ /** The plan's products as the build writes them — samples, published, each with no price (the owner's to set). */
1147
+ function composeShop(plan: SitePlan): ComposedShop | null {
1148
+ if (!planSells(plan) || !plan.shop) return null;
1149
+ return {
1150
+ categories: shopCategoriesOf(plan.shop.products).map(label => ({ label })),
1151
+ products: plan.shop.products.map(p => ({
1152
+ title: p.name.trim(), category: p.category.trim(), description: p.description.trim(),
1153
+ options: p.options.map(o => ({ name: o.name.trim(), values: o.values.map(v => v.trim()) })),
1154
+ productVariants: variantNamesOf(p.options).length > 0,
1155
+ variants: variantNamesOf(p.options.map(o => ({ values: o.values.map(v => v.trim()) }))).map(name => ({ name, enable: true as const })),
1156
+ pricing: { price: null, compareat: null }, isSample: true, isPublished: true,
1157
+ })),
1158
+ };
1159
+ }
1160
+
1043
1161
  function recipeFactory(id: string, rootKey: string): (spec: CompositeNodeSpec) => CompositeNode {
1044
1162
  return spec => create(spec.key === rootKey ? id : `${id}-${spec.key}`, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
1045
1163
  }
@@ -1181,6 +1299,12 @@ function composeDataSource(ds: DataSourcePlan): ComposedDataSource {
1181
1299
  if (ds.filterByRouteParam) cms['filterByRouteParam'] = { ...ds.filterByRouteParam };
1182
1300
  return { id, alias: ds.alias, type: PlanDataSourceType.Cms, mode: ds.mode, request: { cms } };
1183
1301
  }
1302
+ if (ds.type === PlanDataSourceType.Shop) {
1303
+ const shop: Record<string, unknown> = { contentType: ds.resource };
1304
+ if (ds.limit !== undefined) shop['limit'] = ds.limit;
1305
+ if (ds.filterByRouteParam) shop['filterByRouteParam'] = { ...ds.filterByRouteParam };
1306
+ return { id, alias: ds.alias, type: PlanDataSourceType.Shop, mode: ds.mode, request: { shop } };
1307
+ }
1184
1308
  const pick = ds.op === RelativeOp.SiblingsNext ? 'next' : 'prev';
1185
1309
  return {
1186
1310
  id, alias: ds.alias, type: PlanDataSourceType.Relative, mode: PlanDataSourceMode.Single,
@@ -1357,6 +1481,7 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
1357
1481
  const root = header ? globals.find(g => g.id === slot) : null;
1358
1482
  if (header && root) setHeaderBehaviour(root as unknown as CompositeNode, header.behaviour, header.edge ?? null);
1359
1483
  }
1484
+ if (planSells(plan)) globals = withStore(globals);
1360
1485
 
1361
1486
  return {
1362
1487
  source: clone(plan.source),
@@ -1370,6 +1495,7 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
1370
1495
  routes: plan.pages.map(p => ({ key: p.key, path: p.route, isHome: p.isHome === true })),
1371
1496
  placeholders,
1372
1497
  issues,
1498
+ shop: composeShop(plan),
1373
1499
  };
1374
1500
  }
1375
1501