@vectoriox/iox-ui 5.99.0 → 5.101.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 (47) hide show
  1. package/actions-core/index.d.ts +7 -4
  2. package/commerce-core/index.d.ts +2 -0
  3. package/composite-core/index.d.ts +238 -2
  4. package/design-core/index.d.ts +334 -1
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +16 -7
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +3 -0
  8. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +1005 -256
  10. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-design-core.mjs +416 -1
  12. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui-forms-core.mjs +3 -24
  14. package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
  15. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +23 -13
  16. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  17. package/fesm2022/vectoriox-iox-ui-identity-core.mjs +300 -22
  18. package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -1
  19. package/fesm2022/vectoriox-iox-ui.mjs +7 -61
  20. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  21. package/forms-core/index.d.ts +2 -23
  22. package/generation-core/index.d.ts +3 -1
  23. package/identity-core/index.d.ts +190 -14
  24. package/index.d.ts +0 -12
  25. package/package.json +1 -1
  26. package/src/actions-core/action.model.ts +1 -1
  27. package/src/actions-core/element-actions.ts +16 -6
  28. package/src/commerce-core/site-checkout.ts +3 -0
  29. package/src/composite-core/account-runtime.ts +461 -0
  30. package/src/composite-core/account.ts +309 -0
  31. package/src/composite-core/public-api.ts +2 -0
  32. package/src/composite-core/recipe-parts.ts +48 -0
  33. package/src/composite-core/shop.ts +6 -26
  34. package/src/design-core/field-classes.ts +65 -0
  35. package/src/design-core/flavor-spec.generated.ts +346 -0
  36. package/src/design-core/public-api.ts +1 -0
  37. package/src/forms-core/field-markup.ts +2 -22
  38. package/src/generation-core/compose-site.ts +19 -9
  39. package/src/generation-core/nav-shape.ts +4 -4
  40. package/src/identity-core/provider-marks.ts +60 -0
  41. package/src/identity-core/public-api.ts +3 -0
  42. package/src/identity-core/sign-in.ts +43 -6
  43. package/src/identity-core/site-auth-transport.ts +142 -0
  44. package/src/identity-core/site-auth.ts +36 -0
  45. package/src/identity-core/site-methods.ts +78 -0
  46. package/src/identity-core/words.ts +60 -17
  47. package/styles/iox-design.css +38 -0
@@ -1 +1 @@
1
- {"version":3,"file":"vectoriox-iox-ui-identity-core.mjs","sources":["../../../projects/iox-ui/src/identity-core/sign-in.ts","../../../projects/iox-ui/src/identity-core/guards.ts","../../../projects/iox-ui/src/identity-core/site-auth.ts","../../../projects/iox-ui/src/identity-core/words.ts","../../../projects/iox-ui/src/identity-core/public-api.ts","../../../projects/iox-ui/src/identity-core/vectoriox-iox-ui-identity-core.ts"],"sourcesContent":["/**\n * Who signs in, with what, and the broker's two faces (commerce plan §3c \"The broker, step by step\", C-D6, C-D22).\n * The broker (iox-control-plane, `auth.iox.studio`) and the studios (iox-cms) speak THESE shapes; a provider is one\n * adapter on the broker and one `customerIdentities.provider` value in a studio. Email codes never touch the broker.\n */\n\n/** Who the sign-in is for. */\nexport enum SignInPurpose {\n /** A buyer on a studio's site. */\n Site = 'site',\n /** A studio's team member — existing users only (wave 2). */\n Admin = 'admin',\n /** portal.iox.studio. */\n Portal = 'portal',\n}\n\n/** A provider the broker runs. Google is live; the rest join one adapter at a time (board 18). */\nexport enum SignInProvider {\n Google = 'google',\n Meta = 'meta',\n GitHub = 'github',\n LinkedIn = 'linkedin',\n}\n\n/** How a provider answers (board 18): OpenID Connect gives a SIGNED ID token; OAuth 2 needs a profile call. */\nexport enum SignInProtocol {\n Oidc = 'oidc',\n OAuth2 = 'oauth2',\n}\n\nexport interface SignInProviderSpec {\n readonly protocol: SignInProtocol;\n /** The answer is signed, so a studio can check it itself — the only kind an admin may sign in with (C-D6). */\n readonly signedAnswer: boolean;\n /** Running on the broker today. */\n readonly live: boolean;\n}\n\nexport const SIGN_IN_PROVIDER_SPECS: Readonly<Record<SignInProvider, SignInProviderSpec>> = Object.freeze({\n [SignInProvider.Google]: { protocol: SignInProtocol.Oidc, signedAnswer: true, live: true },\n [SignInProvider.LinkedIn]: { protocol: SignInProtocol.Oidc, signedAnswer: true, live: false },\n [SignInProvider.Meta]: { protocol: SignInProtocol.OAuth2, signedAnswer: false, live: false },\n [SignInProvider.GitHub]: { protocol: SignInProtocol.OAuth2, signedAnswer: false, live: false },\n});\n\nexport function isSignInProvider(value: unknown): value is SignInProvider {\n return typeof value === 'string' && (Object.values(SignInProvider) as string[]).includes(value);\n}\n\nexport function isSignInPurpose(value: unknown): value is SignInPurpose {\n return typeof value === 'string' && (Object.values(SignInPurpose) as string[]).includes(value);\n}\n\n/** May `provider` serve `purpose`? Buyers and the portal take any provider; a team member only a signed answer (C-D6). */\nexport function providerServes(provider: SignInProvider, purpose: SignInPurpose): boolean {\n const spec = SIGN_IN_PROVIDER_SPECS[provider];\n if (!spec) return false;\n return purpose === SignInPurpose.Admin ? spec.signedAnswer : true;\n}\n\n// ── the broker ──────────────────────────────────────────────────────────────────────────────────\n\n/** The broker's public host (its own ingress; ops.iox.studio is unchanged). */\nexport const BROKER_HOST = 'auth.iox.studio';\nexport const BROKER_ORIGIN = `https://${BROKER_HOST}`;\n\n/** A ticket lives 60 s and is used once; so does a hand-off code. */\nexport const SIGN_IN_TICKET_TTL_SECONDS = 60;\nexport const SIGN_IN_HANDOFF_TTL_SECONDS = 60;\n\n/** The server-to-server routes on the control plane's API host (bearer: the studio's INSTANCE_TOKEN). */\nexport enum BrokerApiRoute {\n Tickets = 'instances/me/sign-in/tickets',\n Redeem = 'instances/me/sign-in/redeem',\n}\n\n/** The browser's routes on `auth.iox.studio`, one pair per provider. */\nexport enum BrokerBrowserRoute {\n Start = 'start',\n Callback = 'callback',\n}\n\n/** `/<route>` on the control plane's API host, root-relative. */\nexport function brokerApiPath(route: BrokerApiRoute): string {\n return `/${route}`;\n}\n\n/** `https://auth.iox.studio/<provider>/<route>`. */\nexport function brokerBrowserUrl(provider: SignInProvider, route: BrokerBrowserRoute, origin: string = BROKER_ORIGIN): string {\n return `${origin.replace(/\\/+$/, '')}/${encodeURIComponent(provider)}/${route}`;\n}\n\n/** Where the browser goes to begin: `https://auth.iox.studio/<provider>/start?ticket=<ticket>`. */\nexport function brokerStartUrl(provider: SignInProvider, ticket: string, origin: string = BROKER_ORIGIN): string {\n return `${brokerBrowserUrl(provider, BrokerBrowserRoute.Start, origin)}?${BROKER_TICKET_PARAM}=${encodeURIComponent(ticket)}`;\n}\n\n/** The ONE address registered with each provider: `https://auth.iox.studio/<provider>/callback`. */\nexport function brokerCallbackUrl(provider: SignInProvider, origin: string = BROKER_ORIGIN): string {\n return brokerBrowserUrl(provider, BrokerBrowserRoute.Callback, origin);\n}\n\nexport const BROKER_TICKET_PARAM = 'ticket';\n\n/** `POST instances/me/sign-in/tickets` — body. */\nexport interface SignInTicketRequest {\n provider: SignInProvider;\n purpose: SignInPurpose;\n /** Where the broker sends the browser back; its host must be one of the asking tenant's. */\n returnUrl: string;\n}\n\n/** 201 — `expiresAt` is an ISO date. */\nexport interface SignInTicketAnswer {\n ticket: string;\n startUrl: string;\n expiresAt: string;\n}\n\n/** `POST instances/me/sign-in/redeem` — body: the hand-off code the browser brought back. */\nexport interface SignInRedeemRequest {\n code: string;\n}\n\n/** 200 — the person the provider vouched for. Only the tenant (or the portal) that asked for the ticket gets it. */\nexport interface SignInRedeemAnswer {\n provider: SignInProvider;\n purpose: SignInPurpose;\n /** The provider's stable id for the person (`customerIdentities.subject`). */\n subject: string;\n email: string;\n /** Link to an existing customer by email ONLY when true (board 18's one security rule). */\n emailVerified: boolean;\n name?: string;\n picture?: string;\n returnUrl: string;\n}\n\n/** What the broker refuses, in its answer body `{ code }`. */\nexport enum BrokerRefusalCode {\n /** 403 — the return address is not one of this tenant's hosts. */\n ReturnHostRefused = 'return-host-refused',\n /** 400 */\n UnknownProvider = 'unknown-provider',\n /** 503 — no client id/secret for the provider in the broker's environment. */\n ProviderNotConfigured = 'provider-not-configured',\n /** 404 */\n CodeUnknown = 'code-unknown',\n /** 410 */\n CodeUsedOrExpired = 'code-used-or-expired',\n /** 403 — another tenant's code. */\n NotYours = 'not-yours',\n}\n\nexport const BROKER_REFUSAL_STATUS: Readonly<Record<BrokerRefusalCode, number>> = Object.freeze({\n [BrokerRefusalCode.ReturnHostRefused]: 403,\n [BrokerRefusalCode.UnknownProvider]: 400,\n [BrokerRefusalCode.ProviderNotConfigured]: 503,\n [BrokerRefusalCode.CodeUnknown]: 404,\n [BrokerRefusalCode.CodeUsedOrExpired]: 410,\n [BrokerRefusalCode.NotYours]: 403,\n});\n\nexport function isBrokerRefusalCode(value: unknown): value is BrokerRefusalCode {\n return typeof value === 'string' && (Object.values(BrokerRefusalCode) as string[]).includes(value);\n}\n\n// ── back from the broker ───────────────────────────────────────────────────────────────────────\n\n/** The hand-off code's query parameter on the return address. Never a name or an email in an address. */\nexport const SIGN_IN_HANDOFF_PARAM = 'iox_signin';\n/** The failure's query parameter on the return address. */\nexport const SIGN_IN_ERROR_PARAM = 'iox_signin_error';\n\n/** Why the browser came back without a person. */\nexport enum SignInReturnError {\n /** The person pressed Cancel on the provider's screen. */\n Cancelled = 'cancelled',\n /** The provider's answer failed a check (issuer, audience, nonce, an unverified email). */\n Refused = 'refused',\n /** The ticket or the provider's state had expired. */\n Expired = 'expired',\n Failed = 'failed',\n}\n\nexport function isSignInReturnError(value: unknown): value is SignInReturnError {\n return typeof value === 'string' && (Object.values(SignInReturnError) as string[]).includes(value);\n}\n\n/** The return address with `?iox_signin=<code>` added (its own query, `next`, kept). */\nexport function withSignInHandoff(returnUrl: string, code: string): string {\n return withParam(returnUrl, SIGN_IN_HANDOFF_PARAM, code);\n}\n\n/** The return address with `?iox_signin_error=<error>` added. */\nexport function withSignInError(returnUrl: string, error: SignInReturnError): string {\n return withParam(returnUrl, SIGN_IN_ERROR_PARAM, error);\n}\n\nfunction withParam(address: string, name: string, value: string): string {\n const url = new URL(address);\n url.searchParams.delete(SIGN_IN_HANDOFF_PARAM);\n url.searchParams.delete(SIGN_IN_ERROR_PARAM);\n url.searchParams.set(name, value);\n return url.toString();\n}\n\nexport type SignInReturn =\n | { readonly code: string; readonly error?: undefined }\n | { readonly code?: undefined; readonly error: SignInReturnError };\n\n/**\n * What came back on a return address's query (`?iox_signin=` or `?iox_signin_error=`), or null when neither did. An\n * error wins over a code; an unknown error reads `failed`; an empty code is no code.\n */\nexport function readSignInReturn(search: string | URLSearchParams | null | undefined): SignInReturn | null {\n const params = typeof search === 'string' ? new URLSearchParams(search.startsWith('?') ? search.slice(1) : search) : search;\n if (!params) return null;\n const error = params.get(SIGN_IN_ERROR_PARAM);\n if (error !== null) return { error: isSignInReturnError(error) ? error : SignInReturnError.Failed };\n const code = params.get(SIGN_IN_HANDOFF_PARAM)?.trim();\n return code ? { code } : null;\n}\n","/**\n * The two address checks every sign-in step leans on. Both REFUSE when in doubt: a sign-in that sends a person to the\n * wrong place is worse than one that sends them home.\n */\n\n/** Longer than any page path a site has; a longer `next` is refused. */\nexport const NEXT_PATH_MAX_LENGTH = 2048;\n\nconst PROBE_ORIGIN = 'https://same-origin.invalid';\n// Tab, newline and other control characters are stripped by browsers from a URL, so `/\\t/evil` becomes `//evil`.\nconst CONTROL = /[\\u0000-\\u001f\\u007f]/;\n\nfunction decodedOnce(value: string): string | null {\n try {\n return decodeURIComponent(value);\n } catch {\n return null;\n }\n}\n\n/**\n * True only for a path on THIS site — the `next` a sign-in returns to (the open-redirect guard). It must start with ONE\n * `/`, hold no backslash and no control character (raw or percent-encoded), and stay on the origin when a browser\n * resolves it. `//evil.com`, `/\\evil.com`, `/%2F%2Fevil.com`, `https://evil.com`, `javascript:` — all refused.\n */\nexport function isSameOriginPath(next: unknown): next is string {\n if (typeof next !== 'string' || !next || next.length > NEXT_PATH_MAX_LENGTH) return false;\n if (next[0] !== '/') return false;\n if (CONTROL.test(next) || next.includes('\\\\')) return false;\n const decoded = decodedOnce(next);\n if (decoded === null) return false;\n if (CONTROL.test(decoded) || decoded.includes('\\\\') || decoded.startsWith('//')) return false;\n if (next.startsWith('//')) return false;\n try {\n const url = new URL(next, PROBE_ORIGIN);\n return url.origin === PROBE_ORIGIN;\n } catch {\n return false;\n }\n}\n\n/** `next` when it is a same-origin path, else `fallback` (the site's home). */\nexport function safeNextPath(next: unknown, fallback = '/'): string {\n return isSameOriginPath(next) ? next : fallback;\n}\n\nconst LOOPBACK_HOSTS: ReadonlySet<string> = new Set(['localhost', '127.0.0.1', '[::1]']);\n\nexport function isLoopbackHost(hostname: string): boolean {\n return LOOPBACK_HOSTS.has(hostname.toLowerCase());\n}\n\nexport interface ReturnHostOptions {\n /** Accept `http:` on a loopback host (tests and local stacks only — never in production). */\n allowLoopbackHttp?: boolean;\n}\n\n/** A host as `URL` normalises it (lower case, punycode, the default port dropped), or null when it is not one. */\nexport function normalizeHost(host: string): string | null {\n const value = String(host ?? '').trim();\n if (!value || /[\\s/\\\\?#@]/.test(value)) return null;\n try {\n return new URL(`https://${value}`).host;\n } catch {\n return null;\n }\n}\n\n/**\n * True when `url` returns to one of `hosts` EXACTLY (the broker's return-host check, C-D22): `https:` only (`http:` on a\n * loopback host when asked), no user or password in it, and its host — punycode, with any non-default port — equal to\n * one allowed host. Never a suffix or a prefix: `evil.idos.iox.studio` and `idos.iox.studio.evil.com` are other hosts.\n */\nexport function isAllowedReturnHost(url: unknown, hosts: ReadonlyArray<string>, options: ReturnHostOptions = {}): boolean {\n if (typeof url !== 'string' || !url || CONTROL.test(url) || url.includes('\\\\')) return false;\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return false;\n }\n if (parsed.username || parsed.password) return false;\n const loopback = isLoopbackHost(parsed.hostname);\n if (parsed.protocol !== 'https:' && !(parsed.protocol === 'http:' && loopback && options.allowLoopbackHttp)) return false;\n const host = parsed.host.toLowerCase();\n return hosts.some(allowed => normalizeHost(allowed) === host);\n}\n","import { safeNextPath } from './guards';\nimport { SignInProvider } from './sign-in';\n\n/**\n * 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\n * session it issues, and the cookies it sets. A customer is not a user — its token has its OWN secret and audience and\n * every admin route refuses it (trap T3).\n */\n\nexport enum SiteAuthRoute {\n /** `POST { email }` → 202 always (never says whether the email is known). */\n Code = 'auth/code',\n /** `POST { email, code }` → the session. */\n CodeVerify = 'auth/code/verify',\n Refresh = 'auth/refresh',\n SignOut = 'auth/signout',\n /** `GET` → `{ customer }` (null when signed out). */\n Me = 'me',\n MyOrders = 'me/orders',\n}\n\n/** Every route a site's sign-in calls, by name (the provider pair is per provider — `siteProviderPath`). */\nexport const SITE_AUTH_ROUTES: Readonly<Record<keyof typeof SiteAuthRoute, SiteAuthRoute>> = Object.freeze({ ...SiteAuthRoute });\n\n/** A provider's two routes on the studio: start (`POST { returnPath }` → `{ startUrl }`) and return (the broker's GET). */\nexport enum SiteProviderRoute {\n Start = 'start',\n Return = 'return',\n}\n\nfunction siteBase(orgId: string): string {\n return `/api/site/${encodeURIComponent(orgId)}`;\n}\n\n/** A sign-in route of one org, ROOT-relative: `/api/site/<org>/<route>`. */\nexport function siteAuthPath(orgId: string, route: SiteAuthRoute): string {\n return `${siteBase(orgId)}/${route}`;\n}\n\n/** `/api/site/<org>/auth/<provider>/<start|return>`. */\nexport function siteProviderPath(orgId: string, provider: SignInProvider, route: SiteProviderRoute): string {\n return `${siteBase(orgId)}/auth/${encodeURIComponent(provider)}/${route}`;\n}\n\n/** The `next` query parameter of the return route — where the buyer lands after signing in. */\nexport const SIGN_IN_NEXT_PARAM = 'next';\n\n/**\n * The address the studio asks the broker to send the browser back to:\n * `https://<host>/api/site/<org>/auth/<provider>/return?next=<path>`. `origin` is the studio's own (`https://<host>`);\n * a `next` that is not a same-origin path becomes `/`.\n */\nexport function siteProviderReturnUrl(origin: string, orgId: string, provider: SignInProvider, next: string | null | undefined): string {\n const path = siteProviderPath(orgId, provider, SiteProviderRoute.Return);\n return `${origin.replace(/\\/+$/, '')}${path}?${SIGN_IN_NEXT_PARAM}=${encodeURIComponent(safeNextPath(next))}`;\n}\n\n// ── the requests and answers ───────────────────────────────────────────────────────────────────\n\nexport interface SiteProviderStartRequest {\n /** The page to come back to (a same-origin path). */\n returnPath: string;\n}\n\nexport interface SiteProviderStartAnswer {\n startUrl: string;\n}\n\nexport interface SiteCodeRequest {\n email: string;\n}\n\nexport interface SiteCodeVerifyRequest {\n email: string;\n code: string;\n}\n\n/** What a site may know about the signed-in buyer — nothing else (pages stay cacheable; personal parts fill in later). */\nexport interface SiteCustomer {\n id: string;\n email: string;\n name: string | null;\n}\n\n/** `GET me`, `POST auth/code/verify`, `POST auth/refresh`. */\nexport interface SiteMeAnswer {\n customer: SiteCustomer | null;\n}\n\n// ── the session ────────────────────────────────────────────────────────────────────────────────\n\n/** The buyer token's audience — never an admin token's. */\nexport const SITE_AUDIENCE = 'site';\n\n/** The buyer session's JWT claims. */\nexport interface SiteSessionClaims {\n /** The customer id. */\n sub: string;\n aud: typeof SITE_AUDIENCE;\n /** The org the customer belongs to — a session is good on ONE org's routes. */\n org: string;\n iat?: number;\n exp?: number;\n}\n\n/** True when `claims` carry the site audience and both ids — the shape `CustomerGuard` accepts (it checks the signature). */\nexport function isSiteSessionClaims(claims: unknown): claims is SiteSessionClaims {\n if (!claims || typeof claims !== 'object') return false;\n const c = claims as Record<string, unknown>;\n const aud = Array.isArray(c['aud']) ? c['aud'] : [c['aud']];\n return aud.includes(SITE_AUDIENCE) && typeof c['sub'] === 'string' && !!c['sub'] && typeof c['org'] === 'string' && !!c['org'];\n}\n\n/** True when a token's claims carry the site audience at all — what the admin guard refuses (T3). */\nexport function hasSiteAudience(claims: unknown): boolean {\n if (!claims || typeof claims !== 'object') return false;\n const aud = (claims as Record<string, unknown>)['aud'];\n return Array.isArray(aud) ? aud.includes(SITE_AUDIENCE) : aud === SITE_AUDIENCE;\n}\n\n// ── the cookies (per org: many orgs share one host — trap T10) ────────────────────────────────\n\n/** The buyer session: httpOnly, `Path=/` (the site's SSR reads it — the cart cookie's reason), SameSite=Lax. */\nexport const CUSTOMER_COOKIE_PREFIX = 'iox_c_';\n/** A Google sign-in in flight: httpOnly, short, holds a hash binding the ticket — a forged return fails without it. */\nexport const SIGN_IN_STATE_COOKIE_PREFIX = 'iox_si_';\nexport const SITE_COOKIE_PATH = '/';\n/** Long enough for a person on the provider's screen; the ticket inside expires long before. */\nexport const SIGN_IN_STATE_MAX_AGE_SECONDS = 600;\n\nexport function customerCookieName(orgId: string): string {\n return `${CUSTOMER_COOKIE_PREFIX}${orgId}`;\n}\n\nexport function signInStateCookieName(orgId: string): string {\n return `${SIGN_IN_STATE_COOKIE_PREFIX}${orgId}`;\n}\n\n// ── the email code ─────────────────────────────────────────────────────────────────────────────\n\nexport const EMAIL_CODE_LENGTH = 6;\nexport const EMAIL_CODE_TTL_MINUTES = 10;\nexport const EMAIL_CODE_TTL_MS = EMAIL_CODE_TTL_MINUTES * 60_000;\n/** Wrong codes before the code is spent and a new one must be sent. */\nexport const EMAIL_CODE_MAX_TRIES = 5;\n\nconst EMAIL_CODE = new RegExp(`^\\\\d{${EMAIL_CODE_LENGTH}}$`);\n\n/** A typed or pasted code as digits only (\"481 203\", \"481-203\" → \"481203\"); anything else is kept, to be refused. */\nexport function normalizeEmailCode(input: unknown): string {\n return String(input ?? '').replace(/[\\s-]/g, '');\n}\n\n/** Exactly six ASCII digits. */\nexport function isEmailCodeShape(code: unknown): boolean {\n return typeof code === 'string' && EMAIL_CODE.test(code);\n}\n\n/** An email as a studio keys its customers by (unique per org): trimmed, lower case. */\nexport function normalizeSignInEmail(email: unknown): string {\n return String(email ?? '').trim().toLowerCase();\n}\n\n/** Has the code outlived its ten minutes? `now` is the caller's — the core reads no clock. */\nexport function emailCodeExpired(sentAt: number | Date, now: number | Date): boolean {\n return +now - +sentAt >= EMAIL_CODE_TTL_MS;\n}\n\n/** How many more codes may be tried after `wrongTries` wrong ones (0 = the code is spent). */\nexport function emailCodeTriesLeft(wrongTries: number): number {\n return Math.max(0, EMAIL_CODE_MAX_TRIES - Math.max(0, Math.floor(wrongTries || 0)));\n}\n","import { BrokerRefusalCode, SignInReturnError } from './sign-in';\n\n/**\n * The sign-in dialog's words and its refusals, in English and Hebrew. A string-rendered site has no translation\n * service, so the core carries both itself (commerce-core `CHECKOUT_WORDS` precedent); a host with its own translations\n * may key them by the stable codes instead.\n */\n\nexport interface SignInLabel {\n readonly en: string;\n readonly he: string;\n}\n\nexport enum SignInLanguage {\n En = 'en',\n He = 'he',\n}\n\nexport function signInLanguage(lang: string | null | undefined): SignInLanguage {\n const primary = String(lang ?? '').trim().toLowerCase().split(/[-_]/)[0];\n return primary === 'he' || primary === 'iw' ? SignInLanguage.He : SignInLanguage.En;\n}\n\nfunction fillIn(words: string, fill: Readonly<Record<string, string | number>>): string {\n return words.replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\nexport enum SignInWord {\n SignIn = 'signIn',\n SignInTo = 'signInTo',\n Why = 'why',\n ContinueWithGoogle = 'continueWithGoogle',\n Or = 'or',\n Email = 'email',\n EmailPlaceholder = 'emailPlaceholder',\n SendCode = 'sendCode',\n CodeSent = 'codeSent',\n Code = 'code',\n CodeValid = 'codeValid',\n SendAgain = 'sendAgain',\n Verify = 'verify',\n OtherEmail = 'otherEmail',\n Working = 'working',\n Close = 'close',\n SignOut = 'signOut',\n Account = 'account',\n YourOrders = 'yourOrders',\n Hello = 'hello',\n SignedIn = 'signedIn',\n SignedOut = 'signedOut',\n NoPassword = 'noPassword',\n}\n\n/** `{site}`, `{email}`, `{name}`, `{minutes}` are filled by `signInWord`. */\nexport const SIGN_IN_WORDS: Readonly<Record<SignInWord, SignInLabel>> = Object.freeze({\n [SignInWord.SignIn]: { en: 'Sign in', he: 'התחברות' },\n [SignInWord.SignInTo]: { en: 'Sign in to {site}', he: 'התחברות ל־{site}' },\n [SignInWord.Why]: { en: 'See your orders and check out faster.', he: 'לראות את ההזמנות שלך ולשלם מהר יותר.' },\n [SignInWord.ContinueWithGoogle]: { en: 'Continue with Google', he: 'המשך עם Google' },\n [SignInWord.Or]: { en: 'or', he: 'או' },\n [SignInWord.Email]: { en: 'Email', he: 'אימייל' },\n [SignInWord.EmailPlaceholder]: { en: 'name@example.com', he: 'name@example.com' },\n [SignInWord.SendCode]: { en: 'Send me a code', he: 'שלחו לי קוד' },\n [SignInWord.CodeSent]: { en: 'We sent a 6-digit code to {email}', he: 'שלחנו קוד בן 6 ספרות אל {email}' },\n [SignInWord.Code]: { en: 'Code', he: 'קוד' },\n [SignInWord.CodeValid]: { en: 'Valid for {minutes} minutes', he: 'בתוקף ל־{minutes} דקות' },\n [SignInWord.SendAgain]: { en: 'Send again', he: 'שליחה חוזרת' },\n [SignInWord.Verify]: { en: 'Sign in', he: 'התחברות' },\n [SignInWord.OtherEmail]: { en: 'Use another email', he: 'אימייל אחר' },\n [SignInWord.Working]: { en: 'One moment…', he: 'רגע…' },\n [SignInWord.Close]: { en: 'Close', he: 'סגירה' },\n [SignInWord.SignOut]: { en: 'Sign out', he: 'התנתקות' },\n [SignInWord.Account]: { en: 'Account', he: 'החשבון שלי' },\n [SignInWord.YourOrders]: { en: 'Your orders', he: 'ההזמנות שלך' },\n [SignInWord.Hello]: { en: 'Hello, {name}', he: 'שלום, {name}' },\n [SignInWord.SignedIn]: { en: 'You are signed in.', he: 'התחברת.' },\n [SignInWord.SignedOut]: { en: 'You are signed out.', he: 'התנתקת.' },\n [SignInWord.NoPassword]: { en: 'No password — we email you a code.', he: 'בלי סיסמה — נשלח לך קוד במייל.' },\n});\n\nexport function signInWord(word: SignInWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return fillIn(SIGN_IN_WORDS[word][signInLanguage(lang)], fill);\n}\n\n// ── a refusal, said on its field ─────────────────────────────────────────────────────────────\n\n/** Where in the sign-in dialog a refusal is said. */\nexport enum SignInSlot {\n Email = 'email',\n Code = 'code',\n /** Under \"Continue with Google\". */\n Provider = 'provider',\n /** The dialog as a whole. */\n Dialog = 'dialog',\n}\n\n/**\n * Every code a site's sign-in can hear: iox-cms's answers, the broker's return errors (`?iox_signin_error=`), and\n * `network` for no answer at all.\n */\nexport enum SiteSignInRefusalCode {\n InvalidEmail = 'invalid-email',\n CodeWrong = 'code-wrong',\n CodeExpired = 'code-expired',\n TooManyTries = 'too-many-tries',\n RateLimited = 'rate-limited',\n /** The broker cannot run the provider (down, not configured, the host refused). */\n ProviderUnavailable = 'provider-unavailable',\n Cancelled = 'cancelled',\n Refused = 'refused',\n Expired = 'expired',\n Failed = 'failed',\n /** The return came back without this browser's sign-in cookie — a forged or stale return. */\n StateMismatch = 'state-mismatch',\n Blocked = 'blocked',\n NotSignedIn = 'not-signed-in',\n Network = 'network',\n}\n\ninterface SignInRefusalRule {\n readonly slot: SignInSlot;\n readonly label: SignInLabel;\n}\n\nconst TRY_GOOGLE_AGAIN: SignInLabel = { en: 'Google sign-in did not work. Try again, or use an email code.', he: 'ההתחברות עם Google לא הצליחה. נסו שוב, או התחברו עם קוד במייל.' };\nconst SEND_NEW_CODE: SignInLabel = { en: 'This code has expired. Send a new one.', he: 'תוקף הקוד פג. שלחו קוד חדש.' };\n\nexport const SIGN_IN_REFUSALS: Readonly<Record<SiteSignInRefusalCode, SignInRefusalRule>> = Object.freeze({\n [SiteSignInRefusalCode.InvalidEmail]: { slot: SignInSlot.Email, label: { en: 'Enter an email address, like name@example.com.', he: 'הקלידו כתובת אימייל, למשל name@example.com.' } },\n [SiteSignInRefusalCode.CodeWrong]: { slot: SignInSlot.Code, label: { en: 'That code is not right. Check it and try again.', he: 'הקוד לא נכון. בדקו ונסו שוב.' } },\n [SiteSignInRefusalCode.CodeExpired]: { slot: SignInSlot.Code, label: SEND_NEW_CODE },\n [SiteSignInRefusalCode.TooManyTries]: { slot: SignInSlot.Code, label: { en: 'Too many wrong codes. Send a new one.', he: 'יותר מדי קודים שגויים. שלחו קוד חדש.' } },\n [SiteSignInRefusalCode.RateLimited]: { slot: SignInSlot.Dialog, label: { en: 'Too many tries. Wait a minute and try again.', he: 'יותר מדי ניסיונות. המתינו דקה ונסו שוב.' } },\n [SiteSignInRefusalCode.ProviderUnavailable]: { slot: SignInSlot.Provider, label: { en: 'Google sign-in is not available right now. Use an email code.', he: 'ההתחברות עם Google לא זמינה כרגע. התחברו עם קוד במייל.' } },\n [SiteSignInRefusalCode.Cancelled]: { slot: SignInSlot.Provider, label: { en: 'Google sign-in was cancelled.', he: 'ההתחברות עם Google בוטלה.' } },\n [SiteSignInRefusalCode.Refused]: { slot: SignInSlot.Provider, label: { en: 'Google could not confirm this account. Use an email code.', he: 'Google לא אישר את החשבון הזה. התחברו עם קוד במייל.' } },\n [SiteSignInRefusalCode.Expired]: { slot: SignInSlot.Provider, label: { en: 'The sign-in took too long. Try again.', he: 'ההתחברות ארכה יותר מדי. נסו שוב.' } },\n [SiteSignInRefusalCode.Failed]: { slot: SignInSlot.Provider, label: TRY_GOOGLE_AGAIN },\n [SiteSignInRefusalCode.StateMismatch]: { slot: SignInSlot.Provider, label: TRY_GOOGLE_AGAIN },\n [SiteSignInRefusalCode.Blocked]: { slot: SignInSlot.Dialog, label: { en: 'This account cannot sign in here. Contact the business.', he: 'החשבון הזה לא יכול להתחבר כאן. פנו לעסק.' } },\n [SiteSignInRefusalCode.NotSignedIn]: { slot: SignInSlot.Dialog, label: { en: 'You are signed out. Sign in again.', he: 'התנתקת. התחברו שוב.' } },\n [SiteSignInRefusalCode.Network]: { slot: SignInSlot.Dialog, label: { en: 'We could not reach the site. Try again.', he: 'לא הצלחנו להגיע לאתר. נסו שוב.' } },\n});\n\nexport function isSiteSignInRefusalCode(code: unknown): code is SiteSignInRefusalCode {\n return typeof code === 'string' && (Object.values(SiteSignInRefusalCode) as string[]).includes(code);\n}\n\n/** A broker refusal as the site says it: a person never hears \"return-host-refused\". */\nconst FROM_BROKER: Readonly<Record<BrokerRefusalCode, SiteSignInRefusalCode>> = Object.freeze({\n [BrokerRefusalCode.ReturnHostRefused]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.UnknownProvider]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.ProviderNotConfigured]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.CodeUnknown]: SiteSignInRefusalCode.Expired,\n [BrokerRefusalCode.CodeUsedOrExpired]: SiteSignInRefusalCode.Expired,\n [BrokerRefusalCode.NotYours]: SiteSignInRefusalCode.Failed,\n});\n\nconst FROM_RETURN: Readonly<Record<SignInReturnError, SiteSignInRefusalCode>> = Object.freeze({\n [SignInReturnError.Cancelled]: SiteSignInRefusalCode.Cancelled,\n [SignInReturnError.Refused]: SiteSignInRefusalCode.Refused,\n [SignInReturnError.Expired]: SiteSignInRefusalCode.Expired,\n [SignInReturnError.Failed]: SiteSignInRefusalCode.Failed,\n});\n\n/** 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`. */\nexport function siteSignInCodeOf(code: unknown): SiteSignInRefusalCode {\n if (isSiteSignInRefusalCode(code)) return code;\n if (typeof code === 'string' && code in FROM_BROKER) return FROM_BROKER[code as BrokerRefusalCode];\n if (typeof code === 'string' && code in FROM_RETURN) return FROM_RETURN[code as SignInReturnError];\n return SiteSignInRefusalCode.Failed;\n}\n\nexport interface SignInRefusal {\n code: SiteSignInRefusalCode;\n slot: SignInSlot;\n words: string;\n}\n\n/** One refusal, on its slot, in the visitor's words. */\nexport function signInRefusal(code: unknown, lang: string | null | undefined): SignInRefusal {\n const known = siteSignInCodeOf(code);\n const rule = SIGN_IN_REFUSALS[known];\n return { code: known, slot: rule.slot, words: rule.label[signInLanguage(lang)] };\n}\n\n/** A refused call's body (`{ code }`) — or nothing at all (`network`) — as one refusal. The body's `message` is a log\n * line and is never shown. A 429 with no code is `rate-limited`. */\nexport function signInRefusalOf(body: unknown, lang: string | null | undefined, status?: number | null): SignInRefusal {\n const code = body && typeof body === 'object' ? (body as { code?: unknown }).code : undefined;\n if (code !== undefined) return signInRefusal(code, lang);\n if (status === 429) return signInRefusal(SiteSignInRefusalCode.RateLimited, lang);\n return signInRefusal(body === undefined || body === null ? SiteSignInRefusalCode.Network : SiteSignInRefusalCode.Failed, lang);\n}\n","/**\n * @vectoriox/iox-ui/identity-core — the shared, FRAMEWORK-FREE vocabulary of signing in (commerce plan §3c, C-D5,\n * C-D6, C-D22): who signs in and with what, the broker's ticket / redeem shapes and refusals, a studio's site sign-in\n * routes, session claims and cookies, the email-code rules, the two address guards (open redirect, return host) and\n * the sign-in dialog's words. The broker (iox-control-plane), the studios (iox-cms), the engine and the builder speak it.\n * It imports nothing — a consumer maps this one entry.\n * ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets,\n * jest moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.\n */\nexport * from './sign-in';\nexport * from './guards';\nexport * from './site-auth';\nexport * from './words';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;AAIG;AAEH;IACY;AAAZ,CAAA,UAAY,aAAa,EAAA;;AAErB,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;;AAEb,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe;;AAEf,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACrB,CAAC,EAPW,aAAa,KAAb,aAAa,GAAA,EAAA,CAAA,CAAA;AASzB;IACY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACtB,I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AI,EAAE,IAAI,CAAC;IACxD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,aAAa,CAAC,qBAAqB,CAAC,WAAW,EAAE,IAAI,CAAC;IACjF,OAAO,aAAa,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,GAAG,qBAAqB,CAAC,OAAO,GAAG,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;AAClI;;ACjMA;;;;;;;;AAQG;;ACRH;;AAEG;;;;"}
1
+ {"version":3,"file":"vectoriox-iox-ui-identity-core.mjs","sources":["../../../projects/iox-ui/src/identity-core/sign-in.ts","../../../projects/iox-ui/src/identity-core/guards.ts","../../../projects/iox-ui/src/identity-core/site-auth.ts","../../../projects/iox-ui/src/identity-core/provider-marks.ts","../../../projects/iox-ui/src/identity-core/words.ts","../../../projects/iox-ui/src/identity-core/site-methods.ts","../../../projects/iox-ui/src/identity-core/site-auth-transport.ts","../../../projects/iox-ui/src/identity-core/public-api.ts","../../../projects/iox-ui/src/identity-core/vectoriox-iox-ui-identity-core.ts"],"sourcesContent":["/**\n * Who signs in, with what, and the broker's two faces (commerce plan §3c \"The broker, step by step\", C-D6, C-D22).\n * The broker (iox-control-plane, `auth.iox.studio`) and the studios (iox-cms) speak THESE shapes; a provider is one\n * adapter on the broker and one `customerIdentities.provider` value in a studio. Email codes never touch the broker.\n */\n\n/** Who the sign-in is for. */\nexport enum SignInPurpose {\n /** A buyer on a studio's site. */\n Site = 'site',\n /** A studio's team member — existing users only (wave 2). */\n Admin = 'admin',\n /** portal.iox.studio. */\n Portal = 'portal',\n}\n\n/** A provider the broker runs (board 18). The enum's order is the order every sign-in shows them in. Each id is the path\n * segment of the ONE address registered with that provider: `https://auth.iox.studio/<id>/callback`. */\nexport enum SignInProvider {\n Google = 'google',\n Facebook = 'facebook',\n GitHub = 'github',\n LinkedIn = 'linkedin',\n}\n\n/** How a provider answers (board 18): OpenID Connect gives a SIGNED ID token; OAuth 2 needs a profile call. */\nexport enum SignInProtocol {\n Oidc = 'oidc',\n OAuth2 = 'oauth2',\n}\n\nexport interface SignInProviderSpec {\n readonly protocol: SignInProtocol;\n /** The answer is signed, so a studio can check it itself — the only kind an admin may sign in with (C-D6). */\n readonly signedAnswer: boolean;\n /** The broker has an adapter for it. Whether it is ON (both keys in the broker's env) is the broker's answer to\n * `BrokerApiRoute.Providers`, read at run time — never a release. */\n readonly live: boolean;\n}\n\nexport const SIGN_IN_PROVIDER_SPECS: Readonly<Record<SignInProvider, SignInProviderSpec>> = Object.freeze({\n [SignInProvider.Google]: { protocol: SignInProtocol.Oidc, signedAnswer: true, live: true },\n [SignInProvider.Facebook]: { protocol: SignInProtocol.OAuth2, signedAnswer: false, live: true },\n [SignInProvider.GitHub]: { protocol: SignInProtocol.OAuth2, signedAnswer: false, live: true },\n [SignInProvider.LinkedIn]: { protocol: SignInProtocol.Oidc, signedAnswer: true, live: true },\n});\n\n/** Every provider, in the order a sign-in shows them. */\nexport const SIGN_IN_PROVIDERS: ReadonlyArray<SignInProvider> = Object.freeze(Object.values(SignInProvider));\n\nexport function isSignInProvider(value: unknown): value is SignInProvider {\n return typeof value === 'string' && (Object.values(SignInProvider) as string[]).includes(value);\n}\n\nexport function isSignInPurpose(value: unknown): value is SignInPurpose {\n return typeof value === 'string' && (Object.values(SignInPurpose) as string[]).includes(value);\n}\n\n/** May `provider` serve `purpose`? Buyers and the portal take any provider; a team member only a signed answer (C-D6). */\nexport function providerServes(provider: SignInProvider, purpose: SignInPurpose): boolean {\n const spec = SIGN_IN_PROVIDER_SPECS[provider];\n if (!spec) return false;\n return purpose === SignInPurpose.Admin ? spec.signedAnswer : true;\n}\n\n// ── the broker ──────────────────────────────────────────────────────────────────────────────────\n\n/** The broker's public host (its own ingress; ops.iox.studio is unchanged). */\nexport const BROKER_HOST = 'auth.iox.studio';\nexport const BROKER_ORIGIN = `https://${BROKER_HOST}`;\n\n/** A ticket lives 60 s and is used once; so does a hand-off code. */\nexport const SIGN_IN_TICKET_TTL_SECONDS = 60;\nexport const SIGN_IN_HANDOFF_TTL_SECONDS = 60;\n\n/** The server-to-server routes on the control plane's API host (bearer: the studio's INSTANCE_TOKEN). */\nexport enum BrokerApiRoute {\n Tickets = 'instances/me/sign-in/tickets',\n Redeem = 'instances/me/sign-in/redeem',\n /** `GET` → only the providers that are ON: `{ \"google\": true }` (`SignInProvidersAnswer`). */\n Providers = 'instances/me/sign-in/providers',\n}\n\n/** `GET instances/me/sign-in/providers` — each provider that is ON, `true`; an off one is absent. */\nexport type SignInProvidersAnswer = Partial<Record<SignInProvider, true>>;\n\n/** The providers ON in a broker's answer, in the order a sign-in shows them; anything else in the body is ignored. */\nexport function providersOn(answer: unknown): SignInProvider[] {\n if (!answer || typeof answer !== 'object' || Array.isArray(answer)) return [];\n const on = answer as Record<string, unknown>;\n return SIGN_IN_PROVIDERS.filter(p => on[p] === true);\n}\n\n/** The providers ON at the broker that may serve `purpose` (C-D6: a team member only with a signed answer). */\nexport function providersServing(on: readonly SignInProvider[], purpose: SignInPurpose): SignInProvider[] {\n const set = new Set(on);\n return SIGN_IN_PROVIDERS.filter(p => set.has(p) && SIGN_IN_PROVIDER_SPECS[p].live && providerServes(p, purpose));\n}\n\n/** How long a studio or the portal may keep the broker's providers answer before asking again. */\nexport const SIGN_IN_PROVIDERS_CACHE_SECONDS = 60;\n\n/** The browser's routes on `auth.iox.studio`, one pair per provider. */\nexport enum BrokerBrowserRoute {\n Start = 'start',\n Callback = 'callback',\n}\n\n/** `/<route>` on the control plane's API host, root-relative. */\nexport function brokerApiPath(route: BrokerApiRoute): string {\n return `/${route}`;\n}\n\n/** `https://auth.iox.studio/<provider>/<route>`. */\nexport function brokerBrowserUrl(provider: SignInProvider, route: BrokerBrowserRoute, origin: string = BROKER_ORIGIN): string {\n return `${origin.replace(/\\/+$/, '')}/${encodeURIComponent(provider)}/${route}`;\n}\n\n/** Where the browser goes to begin: `https://auth.iox.studio/<provider>/start?ticket=<ticket>`. */\nexport function brokerStartUrl(provider: SignInProvider, ticket: string, origin: string = BROKER_ORIGIN): string {\n return `${brokerBrowserUrl(provider, BrokerBrowserRoute.Start, origin)}?${BROKER_TICKET_PARAM}=${encodeURIComponent(ticket)}`;\n}\n\n/** The ONE address registered with each provider: `https://auth.iox.studio/<provider>/callback`. */\nexport function brokerCallbackUrl(provider: SignInProvider, origin: string = BROKER_ORIGIN): string {\n return brokerBrowserUrl(provider, BrokerBrowserRoute.Callback, origin);\n}\n\nexport const BROKER_TICKET_PARAM = 'ticket';\n\n/** `POST instances/me/sign-in/tickets` — body. */\nexport interface SignInTicketRequest {\n provider: SignInProvider;\n purpose: SignInPurpose;\n /** Where the broker sends the browser back; its host must be one of the asking tenant's. */\n returnUrl: string;\n}\n\n/** 201 — `expiresAt` is an ISO date. */\nexport interface SignInTicketAnswer {\n ticket: string;\n startUrl: string;\n expiresAt: string;\n}\n\n/** `POST instances/me/sign-in/redeem` — body: the hand-off code the browser brought back. */\nexport interface SignInRedeemRequest {\n code: string;\n}\n\n/** 200 — the person the provider vouched for. Only the tenant (or the portal) that asked for the ticket gets it. */\nexport interface SignInRedeemAnswer {\n provider: SignInProvider;\n purpose: SignInPurpose;\n /** The provider's stable id for the person (`customerIdentities.subject`). */\n subject: string;\n email: string;\n /** Link to an existing customer by email ONLY when true (board 18's one security rule). */\n emailVerified: boolean;\n name?: string;\n picture?: string;\n returnUrl: string;\n}\n\n/** What the broker refuses, in its answer body `{ code }`. */\nexport enum BrokerRefusalCode {\n /** 403 — the return address is not one of this tenant's hosts. */\n ReturnHostRefused = 'return-host-refused',\n /** 400 */\n UnknownProvider = 'unknown-provider',\n /** 503 — no client id/secret for the provider in the broker's environment. */\n ProviderNotConfigured = 'provider-not-configured',\n /** 404 */\n CodeUnknown = 'code-unknown',\n /** 410 */\n CodeUsedOrExpired = 'code-used-or-expired',\n /** 403 — another tenant's code. */\n NotYours = 'not-yours',\n /** 400 — a purpose this asker may not use, or a provider that may not serve it (C-D6). */\n InvalidRequest = 'invalid-request',\n}\n\nexport const BROKER_REFUSAL_STATUS: Readonly<Record<BrokerRefusalCode, number>> = Object.freeze({\n [BrokerRefusalCode.ReturnHostRefused]: 403,\n [BrokerRefusalCode.UnknownProvider]: 400,\n [BrokerRefusalCode.ProviderNotConfigured]: 503,\n [BrokerRefusalCode.CodeUnknown]: 404,\n [BrokerRefusalCode.CodeUsedOrExpired]: 410,\n [BrokerRefusalCode.NotYours]: 403,\n [BrokerRefusalCode.InvalidRequest]: 400,\n});\n\nexport function isBrokerRefusalCode(value: unknown): value is BrokerRefusalCode {\n return typeof value === 'string' && (Object.values(BrokerRefusalCode) as string[]).includes(value);\n}\n\n// ── back from the broker ───────────────────────────────────────────────────────────────────────\n\n/** The hand-off code's query parameter on the return address. Never a name or an email in an address. */\nexport const SIGN_IN_HANDOFF_PARAM = 'iox_signin';\n/** The failure's query parameter on the return address. */\nexport const SIGN_IN_ERROR_PARAM = 'iox_signin_error';\n/** Beside a failure a studio sends back: the provider it was (`?iox_signin_via=github`), so the words can name it. */\nexport const SIGN_IN_VIA_PARAM = 'iox_signin_via';\n/**\n * The binding parameter on every return address a studio or the portal asks the broker for: `iox_sb=<sha256 of the\n * random value in the starting browser's httpOnly cookie>`. The redeemed `returnUrl` must carry THIS browser's hash — a\n * hand-off started in another browser is refused (login CSRF).\n */\nexport const SIGN_IN_BINDING_PARAM = 'iox_sb';\n\n/** Why the browser came back without a person. */\nexport enum SignInReturnError {\n /** The person pressed Cancel on the provider's screen. */\n Cancelled = 'cancelled',\n /** The provider's answer failed a check (issuer, audience, nonce, an unverified email). */\n Refused = 'refused',\n /** The ticket or the provider's state had expired. */\n Expired = 'expired',\n Failed = 'failed',\n}\n\nexport function isSignInReturnError(value: unknown): value is SignInReturnError {\n return typeof value === 'string' && (Object.values(SignInReturnError) as string[]).includes(value);\n}\n\n/** The return address with `?iox_signin=<code>` added (its own query, `next`, kept). */\nexport function withSignInHandoff(returnUrl: string, code: string): string {\n return withParam(returnUrl, SIGN_IN_HANDOFF_PARAM, code);\n}\n\n/** The return address with `?iox_signin_error=<error>` added. */\nexport function withSignInError(returnUrl: string, error: SignInReturnError): string {\n return withParam(returnUrl, SIGN_IN_ERROR_PARAM, error);\n}\n\nfunction withParam(address: string, name: string, value: string): string {\n const url = new URL(address);\n url.searchParams.delete(SIGN_IN_HANDOFF_PARAM);\n url.searchParams.delete(SIGN_IN_ERROR_PARAM);\n url.searchParams.set(name, value);\n return url.toString();\n}\n\nexport type SignInReturn =\n | { readonly code: string; readonly error?: undefined }\n | { readonly code?: undefined; readonly error: SignInReturnError };\n\n/**\n * What came back on a return address's query (`?iox_signin=` or `?iox_signin_error=`), or null when neither did. An\n * error wins over a code; an unknown error reads `failed`; an empty code is no code.\n */\nexport function readSignInReturn(search: string | URLSearchParams | null | undefined): SignInReturn | null {\n const params = typeof search === 'string' ? new URLSearchParams(search.startsWith('?') ? search.slice(1) : search) : search;\n if (!params) return null;\n const error = params.get(SIGN_IN_ERROR_PARAM);\n if (error !== null) return { error: isSignInReturnError(error) ? error : SignInReturnError.Failed };\n const code = params.get(SIGN_IN_HANDOFF_PARAM)?.trim();\n return code ? { code } : null;\n}\n","/**\n * The two address checks every sign-in step leans on. Both REFUSE when in doubt: a sign-in that sends a person to the\n * wrong place is worse than one that sends them home.\n */\n\n/** Longer than any page path a site has; a longer `next` is refused. */\nexport const NEXT_PATH_MAX_LENGTH = 2048;\n\nconst PROBE_ORIGIN = 'https://same-origin.invalid';\n// Tab, newline and other control characters are stripped by browsers from a URL, so `/\\t/evil` becomes `//evil`.\nconst CONTROL = /[\\u0000-\\u001f\\u007f]/;\n\nfunction decodedOnce(value: string): string | null {\n try {\n return decodeURIComponent(value);\n } catch {\n return null;\n }\n}\n\n/**\n * True only for a path on THIS site — the `next` a sign-in returns to (the open-redirect guard). It must start with ONE\n * `/`, hold no backslash and no control character (raw or percent-encoded), and stay on the origin when a browser\n * resolves it. `//evil.com`, `/\\evil.com`, `/%2F%2Fevil.com`, `https://evil.com`, `javascript:` — all refused.\n */\nexport function isSameOriginPath(next: unknown): next is string {\n if (typeof next !== 'string' || !next || next.length > NEXT_PATH_MAX_LENGTH) return false;\n if (next[0] !== '/') return false;\n if (CONTROL.test(next) || next.includes('\\\\')) return false;\n const decoded = decodedOnce(next);\n if (decoded === null) return false;\n if (CONTROL.test(decoded) || decoded.includes('\\\\') || decoded.startsWith('//')) return false;\n if (next.startsWith('//')) return false;\n try {\n const url = new URL(next, PROBE_ORIGIN);\n return url.origin === PROBE_ORIGIN;\n } catch {\n return false;\n }\n}\n\n/** `next` when it is a same-origin path, else `fallback` (the site's home). */\nexport function safeNextPath(next: unknown, fallback = '/'): string {\n return isSameOriginPath(next) ? next : fallback;\n}\n\nconst LOOPBACK_HOSTS: ReadonlySet<string> = new Set(['localhost', '127.0.0.1', '[::1]']);\n\nexport function isLoopbackHost(hostname: string): boolean {\n return LOOPBACK_HOSTS.has(hostname.toLowerCase());\n}\n\nexport interface ReturnHostOptions {\n /** Accept `http:` on a loopback host (tests and local stacks only — never in production). */\n allowLoopbackHttp?: boolean;\n}\n\n/** A host as `URL` normalises it (lower case, punycode, the default port dropped), or null when it is not one. */\nexport function normalizeHost(host: string): string | null {\n const value = String(host ?? '').trim();\n if (!value || /[\\s/\\\\?#@]/.test(value)) return null;\n try {\n return new URL(`https://${value}`).host;\n } catch {\n return null;\n }\n}\n\n/**\n * True when `url` returns to one of `hosts` EXACTLY (the broker's return-host check, C-D22): `https:` only (`http:` on a\n * loopback host when asked), no user or password in it, and its host — punycode, with any non-default port — equal to\n * one allowed host. Never a suffix or a prefix: `evil.idos.iox.studio` and `idos.iox.studio.evil.com` are other hosts.\n */\nexport function isAllowedReturnHost(url: unknown, hosts: ReadonlyArray<string>, options: ReturnHostOptions = {}): boolean {\n if (typeof url !== 'string' || !url || CONTROL.test(url) || url.includes('\\\\')) return false;\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return false;\n }\n if (parsed.username || parsed.password) return false;\n const loopback = isLoopbackHost(parsed.hostname);\n if (parsed.protocol !== 'https:' && !(parsed.protocol === 'http:' && loopback && options.allowLoopbackHttp)) return false;\n const host = parsed.host.toLowerCase();\n return hosts.some(allowed => normalizeHost(allowed) === host);\n}\n","import { safeNextPath } from './guards';\nimport { SignInProvider } from './sign-in';\n\n/**\n * 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\n * session it issues, and the cookies it sets. A customer is not a user — its token has its OWN secret and audience and\n * every admin route refuses it (trap T3).\n */\n\nexport enum SiteAuthRoute {\n /** `POST { email }` → 202 always (never says whether the email is known). */\n Code = 'auth/code',\n /** `POST { email, code }` → the session. */\n CodeVerify = 'auth/code/verify',\n Refresh = 'auth/refresh',\n SignOut = 'auth/signout',\n /** `GET` → `{ customer }` (null when signed out). */\n Me = 'me',\n MyOrders = 'me/orders',\n /** `GET` → `{ methods }` — the ways this site lets a buyer sign in right now (`siteSignInMethods`). Public. */\n Methods = 'auth/methods',\n}\n\n/** Every route a site's sign-in calls, by name (the provider pair is per provider — `siteProviderPath`). */\nexport const SITE_AUTH_ROUTES: Readonly<Record<keyof typeof SiteAuthRoute, SiteAuthRoute>> = Object.freeze({ ...SiteAuthRoute });\n\n/** A provider's two routes on the studio: start (`POST { returnPath }` → `{ startUrl }`) and return (the broker's GET). */\nexport enum SiteProviderRoute {\n Start = 'start',\n Return = 'return',\n}\n\nfunction siteBase(orgId: string): string {\n return `/api/site/${encodeURIComponent(orgId)}`;\n}\n\n/** A sign-in route of one org, ROOT-relative: `/api/site/<org>/<route>`. */\nexport function siteAuthPath(orgId: string, route: SiteAuthRoute): string {\n return `${siteBase(orgId)}/${route}`;\n}\n\n/** `/api/site/<org>/auth/<provider>/<start|return>`. */\nexport function siteProviderPath(orgId: string, provider: SignInProvider, route: SiteProviderRoute): string {\n return `${siteBase(orgId)}/auth/${encodeURIComponent(provider)}/${route}`;\n}\n\n/** The `next` query parameter of the return route — where the buyer lands after signing in. */\nexport const SIGN_IN_NEXT_PARAM = 'next';\n\n/**\n * The address the studio asks the broker to send the browser back to:\n * `https://<host>/api/site/<org>/auth/<provider>/return?next=<path>`. `origin` is the studio's own (`https://<host>`);\n * a `next` that is not a same-origin path becomes `/`.\n */\nexport function siteProviderReturnUrl(origin: string, orgId: string, provider: SignInProvider, next: string | null | undefined): string {\n const path = siteProviderPath(orgId, provider, SiteProviderRoute.Return);\n return `${origin.replace(/\\/+$/, '')}${path}?${SIGN_IN_NEXT_PARAM}=${encodeURIComponent(safeNextPath(next))}`;\n}\n\n// ── the requests and answers ───────────────────────────────────────────────────────────────────\n\nexport interface SiteProviderStartRequest {\n /** The page to come back to (a same-origin path). */\n returnPath: string;\n}\n\nexport interface SiteProviderStartAnswer {\n startUrl: string;\n}\n\nexport interface SiteCodeRequest {\n email: string;\n}\n\nexport interface SiteCodeVerifyRequest {\n email: string;\n code: string;\n}\n\n/** What a site may know about the signed-in buyer — nothing else (pages stay cacheable; personal parts fill in later). */\nexport interface SiteCustomer {\n id: string;\n email: string;\n name: string | null;\n}\n\n/** `GET me`, `POST auth/code/verify`, `POST auth/refresh`. */\nexport interface SiteMeAnswer {\n customer: SiteCustomer | null;\n}\n\n// ── the session ────────────────────────────────────────────────────────────────────────────────\n\n/** The buyer token's audience — never an admin token's. */\nexport const SITE_AUDIENCE = 'site';\n\n/** The buyer session's JWT claims. */\nexport interface SiteSessionClaims {\n /** The customer id. */\n sub: string;\n aud: typeof SITE_AUDIENCE;\n /** The org the customer belongs to — a session is good on ONE org's routes. */\n org: string;\n iat?: number;\n exp?: number;\n}\n\n/** True when `claims` carry the site audience and both ids — the shape `CustomerGuard` accepts (it checks the signature). */\nexport function isSiteSessionClaims(claims: unknown): claims is SiteSessionClaims {\n if (!claims || typeof claims !== 'object') return false;\n const c = claims as Record<string, unknown>;\n const aud = Array.isArray(c['aud']) ? c['aud'] : [c['aud']];\n return aud.includes(SITE_AUDIENCE) && typeof c['sub'] === 'string' && !!c['sub'] && typeof c['org'] === 'string' && !!c['org'];\n}\n\n/** True when a token's claims carry the site audience at all — what the admin guard refuses (T3). */\nexport function hasSiteAudience(claims: unknown): boolean {\n if (!claims || typeof claims !== 'object') return false;\n const aud = (claims as Record<string, unknown>)['aud'];\n return Array.isArray(aud) ? aud.includes(SITE_AUDIENCE) : aud === SITE_AUDIENCE;\n}\n\n// ── the cookies (per org: many orgs share one host — trap T10) ────────────────────────────────\n\n/** The buyer session: httpOnly, `Path=/` (the site's SSR reads it — the cart cookie's reason), SameSite=Lax. */\nexport const CUSTOMER_COOKIE_PREFIX = 'iox_c_';\n/** A Google sign-in in flight: httpOnly, short, holds a hash binding the ticket — a forged return fails without it. */\nexport const SIGN_IN_STATE_COOKIE_PREFIX = 'iox_si_';\nexport const SITE_COOKIE_PATH = '/';\n/** Long enough for a person on the provider's screen; the ticket inside expires long before. */\nexport const SIGN_IN_STATE_MAX_AGE_SECONDS = 600;\n\nexport function customerCookieName(orgId: string): string {\n return `${CUSTOMER_COOKIE_PREFIX}${orgId}`;\n}\n\nexport function signInStateCookieName(orgId: string): string {\n return `${SIGN_IN_STATE_COOKIE_PREFIX}${orgId}`;\n}\n\n/**\n * A cookie no sibling host can plant (vectoriox/iox-cms#73 — cookie tossing from another `*.iox.studio`): over https the\n * name takes the `__Host-` prefix, which a browser accepts only `Secure`, with `Path=/` and no `Domain`. A server that\n * sets one with this name must set exactly those; plain http (local development) keeps the bare name.\n */\nexport const HOST_ONLY_COOKIE_PREFIX = '__Host-';\n\nexport function hostOnlyCookieName(name: string, secure: boolean): string {\n return secure ? `${HOST_ONLY_COOKIE_PREFIX}${name}` : name;\n}\n\n// ── the email code ─────────────────────────────────────────────────────────────────────────────\n\nexport const EMAIL_CODE_LENGTH = 6;\nexport const EMAIL_CODE_TTL_MINUTES = 10;\nexport const EMAIL_CODE_TTL_MS = EMAIL_CODE_TTL_MINUTES * 60_000;\n/** Wrong codes before the code is spent and a new one must be sent. */\nexport const EMAIL_CODE_MAX_TRIES = 5;\n\nconst EMAIL_CODE = new RegExp(`^\\\\d{${EMAIL_CODE_LENGTH}}$`);\n\n/** A typed or pasted code as digits only (\"481 203\", \"481-203\" → \"481203\"); anything else is kept, to be refused. */\nexport function normalizeEmailCode(input: unknown): string {\n return String(input ?? '').replace(/[\\s-]/g, '');\n}\n\n/** Exactly six ASCII digits. */\nexport function isEmailCodeShape(code: unknown): boolean {\n return typeof code === 'string' && EMAIL_CODE.test(code);\n}\n\n/** An email as a studio keys its customers by (unique per org): trimmed, lower case. */\nexport function normalizeSignInEmail(email: unknown): string {\n return String(email ?? '').trim().toLowerCase();\n}\n\n/** Has the code outlived its ten minutes? `now` is the caller's — the core reads no clock. */\nexport function emailCodeExpired(sentAt: number | Date, now: number | Date): boolean {\n return +now - +sentAt >= EMAIL_CODE_TTL_MS;\n}\n\n/** How many more codes may be tried after `wrongTries` wrong ones (0 = the code is spent). */\nexport function emailCodeTriesLeft(wrongTries: number): number {\n return Math.max(0, EMAIL_CODE_MAX_TRIES - Math.max(0, Math.floor(wrongTries || 0)));\n}\n\n// ── the fixed account page (C-D3: fixed like checkout, the look's dress) ────────────────────────\n\nexport const ACCOUNT_PATH = 'account';\n\n/** The buyer's account page — their orders: `/<orgLabel>/account` (the engine answers it on every studio). */\nexport function accountHref(orgLabel?: string | null): string {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n return label ? `/${encodeURIComponent(label)}/${ACCOUNT_PATH}` : `/${ACCOUNT_PATH}`;\n}\n\n/** The account page's segment for one order: `/<orgLabel>/account/orders/<number>`. */\nexport const ACCOUNT_ORDERS_SEGMENT = 'orders';\n\n/** One of the signed-in buyer's own orders, under the account page — read by the session, never by a link token. */\nexport function accountOrderHref(orgLabel: string | null | undefined, orderNumber: string | number): string {\n return `${accountHref(orgLabel)}/${ACCOUNT_ORDERS_SEGMENT}/${encodeURIComponent(String(orderNumber))}`;\n}\n\n/** `GET /api/site/<org>/me/orders/<number>` — one order of the signed-in buyer (404 for anyone else's). */\nexport function siteMyOrderPath(orgId: string, orderNumber: string | number): string {\n return `${siteAuthPath(orgId, SiteAuthRoute.MyOrders)}/${encodeURIComponent(String(orderNumber))}`;\n}\n","import { SignInProvider } from './sign-in';\n\n/**\n * How each provider's button presents it — ONE copy for every IOX sign-in (the site's dialog, the admin login, the\n * portal). Each brand's button guidelines: its own name, never translated (\"Continue with GitHub\" / \"המשך עם GitHub\"),\n * and its official mark in its own colours, unaltered — Google's four-colour G, LinkedIn's \"in\" on its blue, Facebook's\n * white f on its blue circle; GitHub's mark is single-colour by its rules, so it takes the button's ink (`currentColor`).\n */\nexport interface SignInProviderBrand {\n /** The brand's name, as the brand writes it. */\n readonly name: string;\n /** The mark as one inline SVG (a square `viewBox`, no size — the button sizes it). */\n readonly mark: string;\n /** The mark for an `<img>`, where `currentColor` means nothing — when it differs from `mark`. */\n readonly imageMark?: string;\n}\n\nconst SVG = (viewBox: string, body: string) => `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"${viewBox}\" aria-hidden=\"true\" focusable=\"false\">${body}</svg>`;\n\nconst GITHUB_PATH = 'M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z';\n\nexport const SIGN_IN_PROVIDER_BRANDS: Readonly<Record<SignInProvider, SignInProviderBrand>> = Object.freeze({\n [SignInProvider.Google]: {\n name: 'Google',\n mark: SVG('0 0 48 48',\n '<path fill=\"#EA4335\" d=\"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z\"/>'\n + '<path fill=\"#4285F4\" d=\"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z\"/>'\n + '<path fill=\"#FBBC05\" d=\"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z\"/>'\n + '<path fill=\"#34A853\" d=\"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z\"/>'),\n },\n [SignInProvider.Facebook]: {\n name: 'Facebook',\n mark: SVG('0 0 24 24',\n '<circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"#0866FF\"/>'\n + '<path fill=\"#FFFFFF\" d=\"M16.671 15.469 17.203 12h-3.328V9.749c0-.949.465-1.874 1.956-1.874h1.513V4.922s-1.374-.234-2.686-.234c-2.741 0-4.533 1.66-4.533 4.668V12H7.078v3.469h3.047v8.385a12.09 12.09 0 0 0 3.75 0v-8.385h2.796Z\"/>'),\n },\n [SignInProvider.GitHub]: {\n name: 'GitHub',\n mark: SVG('0 0 16 16', `<path fill=\"currentColor\" d=\"${GITHUB_PATH}\"/>`),\n // Black or white only (GitHub's rule): the black mark on its own white disc reads on any button.\n imageMark: SVG('0 0 16 16', `<circle cx=\"8\" cy=\"8\" r=\"7.5\" fill=\"#FFFFFF\"/><path fill=\"#1F2328\" d=\"${GITHUB_PATH}\"/>`),\n },\n [SignInProvider.LinkedIn]: {\n name: 'LinkedIn',\n mark: SVG('0 0 24 24',\n '<rect width=\"24\" height=\"24\" rx=\"3\" fill=\"#0A66C2\"/>'\n + '<path fill=\"#FFFFFF\" d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 1 1 0-4.125 2.062 2.062 0 0 1 0 4.125zm1.782 13.019H3.555V9h3.564v11.452z\"/>'),\n },\n});\n\n/** The provider's name as its brand writes it. */\nexport function signInProviderName(provider: SignInProvider | null | undefined): string {\n return (provider && SIGN_IN_PROVIDER_BRANDS[provider]?.name) || '';\n}\n\n/** The mark as a `data:` address — for an `<img>` (a builder Image part, an admin button). */\nexport function signInProviderMarkUri(provider: SignInProvider): string {\n const brand = SIGN_IN_PROVIDER_BRANDS[provider];\n return `data:image/svg+xml,${encodeURIComponent(brand.imageMark ?? brand.mark)}`;\n}\n","import { signInProviderName } from './provider-marks';\nimport { BrokerRefusalCode, isSignInProvider, readSignInReturn, SIGN_IN_ERROR_PARAM, SIGN_IN_VIA_PARAM, SignInProvider, SignInReturnError } from './sign-in';\n\n/**\n * The sign-in dialog's words and its refusals, in English and Hebrew. A string-rendered site has no translation\n * service, so the core carries both itself (commerce-core `CHECKOUT_WORDS` precedent); a host with its own translations\n * may key them by the stable codes instead.\n */\n\nexport interface SignInLabel {\n readonly en: string;\n readonly he: string;\n}\n\nexport enum SignInLanguage {\n En = 'en',\n He = 'he',\n}\n\nexport function signInLanguage(lang: string | null | undefined): SignInLanguage {\n const primary = String(lang ?? '').trim().toLowerCase().split(/[-_]/)[0];\n return primary === 'he' || primary === 'iw' ? SignInLanguage.He : SignInLanguage.En;\n}\n\nfunction fillIn(words: string, fill: Readonly<Record<string, string | number>>): string {\n return words.replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\nexport enum SignInWord {\n SignIn = 'signIn',\n SignInTo = 'signInTo',\n Why = 'why',\n /** `{provider}` = the brand's own name (`signInProviderName`), never translated. */\n ContinueWith = 'continueWith',\n Or = 'or',\n Email = 'email',\n EmailPlaceholder = 'emailPlaceholder',\n SendCode = 'sendCode',\n CodeSent = 'codeSent',\n Code = 'code',\n CodeValid = 'codeValid',\n SendAgain = 'sendAgain',\n Verify = 'verify',\n OtherEmail = 'otherEmail',\n Working = 'working',\n Close = 'close',\n SignOut = 'signOut',\n Account = 'account',\n YourOrders = 'yourOrders',\n Hello = 'hello',\n SignedIn = 'signedIn',\n SignedOut = 'signedOut',\n NoPassword = 'noPassword',\n /** Before the checkout's \"Sign in\". */\n HaveAccount = 'haveAccount',\n /** The account page with no orders. */\n NoOrders = 'noOrders',\n /** An order row on the account page: `{date}`. */\n PlacedOn = 'placedOn',\n}\n\n/** `{site}`, `{email}`, `{name}`, `{minutes}` are filled by `signInWord`. */\nexport const SIGN_IN_WORDS: Readonly<Record<SignInWord, SignInLabel>> = Object.freeze({\n [SignInWord.SignIn]: { en: 'Sign in', he: 'התחברות' },\n [SignInWord.SignInTo]: { en: 'Sign in to {site}', he: 'התחברות ל־{site}' },\n [SignInWord.Why]: { en: 'See your orders and check out faster.', he: 'לראות את ההזמנות שלך ולשלם מהר יותר.' },\n [SignInWord.ContinueWith]: { en: 'Continue with {provider}', he: 'המשך עם {provider}' },\n [SignInWord.Or]: { en: 'or', he: 'או' },\n [SignInWord.Email]: { en: 'Email', he: 'אימייל' },\n [SignInWord.EmailPlaceholder]: { en: 'name@example.com', he: 'name@example.com' },\n [SignInWord.SendCode]: { en: 'Send me a code', he: 'שלחו לי קוד' },\n [SignInWord.CodeSent]: { en: 'We sent a 6-digit code to {email}', he: 'שלחנו קוד בן 6 ספרות אל {email}' },\n [SignInWord.Code]: { en: 'Code', he: 'קוד' },\n [SignInWord.CodeValid]: { en: 'Valid for {minutes} minutes', he: 'בתוקף ל־{minutes} דקות' },\n [SignInWord.SendAgain]: { en: 'Send again', he: 'שליחה חוזרת' },\n [SignInWord.Verify]: { en: 'Sign in', he: 'התחברות' },\n [SignInWord.OtherEmail]: { en: 'Use another email', he: 'אימייל אחר' },\n [SignInWord.Working]: { en: 'One moment…', he: 'רגע…' },\n [SignInWord.Close]: { en: 'Close', he: 'סגירה' },\n [SignInWord.SignOut]: { en: 'Sign out', he: 'התנתקות' },\n [SignInWord.Account]: { en: 'Account', he: 'החשבון שלי' },\n [SignInWord.YourOrders]: { en: 'Your orders', he: 'ההזמנות שלך' },\n [SignInWord.Hello]: { en: 'Hello, {name}', he: 'שלום, {name}' },\n [SignInWord.SignedIn]: { en: 'You are signed in.', he: 'התחברת.' },\n [SignInWord.SignedOut]: { en: 'You are signed out.', he: 'התנתקת.' },\n [SignInWord.NoPassword]: { en: 'No password — we email you a code.', he: 'בלי סיסמה — נשלח לך קוד במייל.' },\n [SignInWord.HaveAccount]: { en: 'Have an account?', he: 'יש לך חשבון?' },\n [SignInWord.NoOrders]: { en: 'No orders yet.', he: 'עדיין אין הזמנות.' },\n [SignInWord.PlacedOn]: { en: 'Placed {date}', he: 'בוצעה ב־{date}' },\n});\n\nexport function signInWord(word: SignInWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return fillIn(SIGN_IN_WORDS[word][signInLanguage(lang)], fill);\n}\n\n// ── a refusal, said on its field ─────────────────────────────────────────────────────────────\n\n/** Where in the sign-in dialog a refusal is said. */\nexport enum SignInSlot {\n Email = 'email',\n Code = 'code',\n /** Under the provider buttons (\"Continue with Google\"). */\n Provider = 'provider',\n /** The dialog as a whole. */\n Dialog = 'dialog',\n}\n\n/**\n * Every code a site's sign-in can hear: iox-cms's answers, the broker's return errors (`?iox_signin_error=`), and\n * `network` for no answer at all.\n */\nexport enum SiteSignInRefusalCode {\n InvalidEmail = 'invalid-email',\n CodeWrong = 'code-wrong',\n CodeExpired = 'code-expired',\n TooManyTries = 'too-many-tries',\n RateLimited = 'rate-limited',\n /** The broker cannot run the provider (down, not configured, the host refused). */\n ProviderUnavailable = 'provider-unavailable',\n Cancelled = 'cancelled',\n Refused = 'refused',\n Expired = 'expired',\n Failed = 'failed',\n /** The return came back without this browser's sign-in cookie — a forged or stale return. */\n StateMismatch = 'state-mismatch',\n Blocked = 'blocked',\n NotSignedIn = 'not-signed-in',\n /** The studio has no working mailer, so it cannot send a code (it never says whether the email is known). */\n EmailUnavailable = 'email-unavailable',\n Network = 'network',\n}\n\ninterface SignInRefusalRule {\n readonly slot: SignInSlot;\n readonly label: SignInLabel;\n}\n\n/** `{provider}` is the brand's name (`signInRefusal`'s `provider`), else a neutral word. */\nconst TRY_PROVIDER_AGAIN: SignInLabel = { en: 'Signing in with {provider} did not work. Try again, or use an email code.', he: 'ההתחברות עם {provider} לא הצליחה. נסו שוב, או התחברו עם קוד במייל.' };\nconst SEND_NEW_CODE: SignInLabel = { en: 'This code has expired. Send a new one.', he: 'תוקף הקוד פג. שלחו קוד חדש.' };\n\nexport const SIGN_IN_REFUSALS: Readonly<Record<SiteSignInRefusalCode, SignInRefusalRule>> = Object.freeze({\n [SiteSignInRefusalCode.InvalidEmail]: { slot: SignInSlot.Email, label: { en: 'Enter an email address, like name@example.com.', he: 'הקלידו כתובת אימייל, למשל name@example.com.' } },\n [SiteSignInRefusalCode.CodeWrong]: { slot: SignInSlot.Code, label: { en: 'That code is not right. Check it and try again.', he: 'הקוד לא נכון. בדקו ונסו שוב.' } },\n [SiteSignInRefusalCode.CodeExpired]: { slot: SignInSlot.Code, label: SEND_NEW_CODE },\n [SiteSignInRefusalCode.TooManyTries]: { slot: SignInSlot.Code, label: { en: 'Too many wrong codes. Send a new one.', he: 'יותר מדי קודים שגויים. שלחו קוד חדש.' } },\n [SiteSignInRefusalCode.RateLimited]: { slot: SignInSlot.Dialog, label: { en: 'Too many tries. Wait a minute and try again.', he: 'יותר מדי ניסיונות. המתינו דקה ונסו שוב.' } },\n [SiteSignInRefusalCode.ProviderUnavailable]: { slot: SignInSlot.Provider, label: { en: 'Signing in with {provider} is not available right now. Use an email code.', he: 'ההתחברות עם {provider} לא זמינה כרגע. התחברו עם קוד במייל.' } },\n [SiteSignInRefusalCode.Cancelled]: { slot: SignInSlot.Provider, label: { en: 'Signing in with {provider} was cancelled.', he: 'ההתחברות עם {provider} בוטלה.' } },\n [SiteSignInRefusalCode.Refused]: { slot: SignInSlot.Provider, label: { en: '{provider} could not confirm this account. Use an email code.', he: '{provider} לא אישר את החשבון הזה. התחברו עם קוד במייל.' } },\n [SiteSignInRefusalCode.Expired]: { slot: SignInSlot.Provider, label: { en: 'The sign-in took too long. Try again.', he: 'ההתחברות ארכה יותר מדי. נסו שוב.' } },\n [SiteSignInRefusalCode.Failed]: { slot: SignInSlot.Provider, label: TRY_PROVIDER_AGAIN },\n [SiteSignInRefusalCode.StateMismatch]: { slot: SignInSlot.Provider, label: TRY_PROVIDER_AGAIN },\n [SiteSignInRefusalCode.Blocked]: { slot: SignInSlot.Dialog, label: { en: 'This account cannot sign in here. Contact the business.', he: 'החשבון הזה לא יכול להתחבר כאן. פנו לעסק.' } },\n [SiteSignInRefusalCode.NotSignedIn]: { slot: SignInSlot.Dialog, label: { en: 'You are signed out. Sign in again.', he: 'התנתקת. התחברו שוב.' } },\n [SiteSignInRefusalCode.EmailUnavailable]: { slot: SignInSlot.Email, label: { en: 'This site cannot send sign-in codes right now. Try again later.', he: 'האתר לא יכול לשלוח קודי התחברות כרגע. נסו שוב מאוחר יותר.' } },\n [SiteSignInRefusalCode.Network]: { slot: SignInSlot.Dialog, label: { en: 'We could not reach the site. Try again.', he: 'לא הצלחנו להגיע לאתר. נסו שוב.' } },\n});\n\nexport function isSiteSignInRefusalCode(code: unknown): code is SiteSignInRefusalCode {\n return typeof code === 'string' && (Object.values(SiteSignInRefusalCode) as string[]).includes(code);\n}\n\n/** A broker refusal as the site says it: a person never hears \"return-host-refused\". */\nconst FROM_BROKER: Readonly<Record<BrokerRefusalCode, SiteSignInRefusalCode>> = Object.freeze({\n [BrokerRefusalCode.ReturnHostRefused]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.UnknownProvider]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.ProviderNotConfigured]: SiteSignInRefusalCode.ProviderUnavailable,\n [BrokerRefusalCode.CodeUnknown]: SiteSignInRefusalCode.Expired,\n [BrokerRefusalCode.CodeUsedOrExpired]: SiteSignInRefusalCode.Expired,\n [BrokerRefusalCode.NotYours]: SiteSignInRefusalCode.Failed,\n [BrokerRefusalCode.InvalidRequest]: SiteSignInRefusalCode.ProviderUnavailable,\n});\n\nconst FROM_RETURN: Readonly<Record<SignInReturnError, SiteSignInRefusalCode>> = Object.freeze({\n [SignInReturnError.Cancelled]: SiteSignInRefusalCode.Cancelled,\n [SignInReturnError.Refused]: SiteSignInRefusalCode.Refused,\n [SignInReturnError.Expired]: SiteSignInRefusalCode.Expired,\n [SignInReturnError.Failed]: SiteSignInRefusalCode.Failed,\n});\n\n/** 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`. */\nexport function siteSignInCodeOf(code: unknown): SiteSignInRefusalCode {\n if (isSiteSignInRefusalCode(code)) return code;\n if (typeof code === 'string' && code in FROM_BROKER) return FROM_BROKER[code as BrokerRefusalCode];\n if (typeof code === 'string' && code in FROM_RETURN) return FROM_RETURN[code as SignInReturnError];\n return SiteSignInRefusalCode.Failed;\n}\n\nexport interface SignInRefusal {\n code: SiteSignInRefusalCode;\n slot: SignInSlot;\n words: string;\n}\n\n/** A provider refusal names no brand when the provider is not known. */\nconst ANY_PROVIDER: SignInLabel = { en: 'this account', he: 'החשבון' };\nconst NO_PROVIDER_LABEL: Partial<Record<SiteSignInRefusalCode, SignInLabel>> = {\n [SiteSignInRefusalCode.Refused]: { en: 'The provider could not confirm this account. Use an email code.', he: 'הספק לא אישר את החשבון הזה. התחברו עם קוד במייל.' },\n};\n\n/** One refusal, on its slot, in the visitor's words; a provider's refusal names it (`provider`). */\nexport function signInRefusal(code: unknown, lang: string | null | undefined, provider?: SignInProvider | null): SignInRefusal {\n const known = siteSignInCodeOf(code);\n const rule = SIGN_IN_REFUSALS[known];\n const language = signInLanguage(lang);\n const name = signInProviderName(provider);\n const label = !name && NO_PROVIDER_LABEL[known] ? NO_PROVIDER_LABEL[known]! : rule.label;\n return { code: known, slot: rule.slot, words: fillIn(label[language], { provider: name || ANY_PROVIDER[language] }) };\n}\n\n/** A refused call's body (`{ code }`) — or nothing at all (`network`) — as one refusal. The body's `message` is a log\n * line and is never shown. A 429 with no code is `rate-limited`. */\nexport function signInRefusalOf(body: unknown, lang: string | null | undefined, status?: number | null,\n provider?: SignInProvider | null): SignInRefusal {\n const code = body && typeof body === 'object' ? (body as { code?: unknown }).code : undefined;\n if (code !== undefined) return signInRefusal(code, lang, provider);\n if (status === 429) return signInRefusal(SiteSignInRefusalCode.RateLimited, lang, provider);\n return signInRefusal(body === undefined || body === null ? SiteSignInRefusalCode.Network : SiteSignInRefusalCode.Failed, lang, provider);\n}\n\n/** A provider sign-in that came back refused to a site's page: the site's own code (a studio's `blocked`,\n * `state-mismatch`… kept; a broker return error mapped) and the provider it was (`?iox_signin_via=`), or null. */\nexport interface SiteSignInReturnRefusal {\n code: SiteSignInRefusalCode;\n provider: SignInProvider | null;\n}\n\nexport function siteSignInReturnRefusal(search: string | URLSearchParams | null | undefined): SiteSignInReturnRefusal | null {\n const params = typeof search === 'string' ? new URLSearchParams(search.startsWith('?') ? search.slice(1) : search) : search;\n if (!params) return null;\n const raw = params.get(SIGN_IN_ERROR_PARAM);\n if (raw === null) return null;\n const via = params.get(SIGN_IN_VIA_PARAM);\n const code = isSiteSignInRefusalCode(raw) ? raw : siteSignInCodeOf(readSignInReturn(params)?.error);\n return { code, provider: isSignInProvider(via) ? via : null };\n}\n","import { providersServing, SIGN_IN_PROVIDERS, SignInProvider, SignInPurpose } from './sign-in';\n\n/**\n * Which ways a studio's SITE lets a buyer sign in (Settings ▸ Sign-in, board 18): the email code always, and each\n * provider the owner switched on — while the broker has it ON and it may serve a buyer (C-D6). ONE rule for the studio\n * that enforces it (iox-cms), the site that shows it (the engine, the canvas) and the screen that sets it (cms-client).\n */\n\n/** The email code — a `customerIdentities.provider` value beside the broker's providers; it never touches the broker. */\nexport const EMAIL_CODE_PROVIDER = 'email-code' as const;\nexport type EmailCodeProvider = typeof EMAIL_CODE_PROVIDER;\n\n/** A way a buyer signs in, and the `customerIdentities.provider` it is stored as. */\nexport type SiteSignInMethod = EmailCodeProvider | SignInProvider;\n\n/** Every method, in the order a sign-in shows them. */\nexport const SITE_SIGN_IN_METHODS: ReadonlyArray<SiteSignInMethod> = Object.freeze([EMAIL_CODE_PROVIDER, ...SIGN_IN_PROVIDERS]);\n\nexport function isSiteSignInMethod(value: unknown): value is SiteSignInMethod {\n return typeof value === 'string' && (SITE_SIGN_IN_METHODS as readonly string[]).includes(value);\n}\n\n/** The settings type a studio's org stores its choice under (`settings` collection, one row per org). */\nexport const SITE_SIGN_IN_SETTINGS_TYPE = 'signIn';\n\n/** What the owner chose: each provider on or off for buyers. The email code is not a choice — it is always on. */\nexport interface SiteSignInSettings {\n providers: Record<SignInProvider, boolean>;\n}\n\n/** A studio that never chose: Google on (C-D6 — \"Google on by default, the others as owner switches\"). */\nexport const DEFAULT_SITE_SIGN_IN_SETTINGS: Readonly<SiteSignInSettings> = Object.freeze({\n providers: Object.freeze({\n [SignInProvider.Google]: true,\n [SignInProvider.Facebook]: false,\n [SignInProvider.GitHub]: false,\n [SignInProvider.LinkedIn]: false,\n }) as Record<SignInProvider, boolean>,\n});\n\n/** Any stored or posted value as a whole setting: every provider present, booleans only, unknown keys dropped. */\nexport function normalizeSiteSignInSettings(raw: unknown): SiteSignInSettings {\n const given = raw && typeof raw === 'object' ? (raw as { providers?: unknown }).providers : undefined;\n const map = given && typeof given === 'object' && !Array.isArray(given) ? given as Record<string, unknown> : {};\n const providers = {} as Record<SignInProvider, boolean>;\n for (const p of SIGN_IN_PROVIDERS) providers[p] = typeof map[p] === 'boolean' ? map[p] as boolean : DEFAULT_SITE_SIGN_IN_SETTINGS.providers[p];\n return { providers };\n}\n\n/** The methods a site offers right now: the email code, then every provider the owner switched on that the broker has\n * ON (`brokerOn`) and that may serve a buyer. */\nexport function siteSignInMethods(settings: unknown, brokerOn: readonly SignInProvider[]): SiteSignInMethod[] {\n const chosen = normalizeSiteSignInSettings(settings).providers;\n return [EMAIL_CODE_PROVIDER, ...providersServing(brokerOn, SignInPurpose.Site).filter(p => chosen[p])];\n}\n\n/** May a buyer start `provider` on this site right now? */\nexport function siteOffersProvider(settings: unknown, brokerOn: readonly SignInProvider[], provider: SignInProvider): boolean {\n return siteSignInMethods(settings, brokerOn).includes(provider);\n}\n\n/** `GET api/site/<org>/auth/methods` — public, cacheable. */\nexport interface SiteSignInMethodsAnswer {\n methods: SiteSignInMethod[];\n}\n\n/** The methods in an answer (unknown values dropped, in the shown order); the email code is always one of them. */\nexport function siteSignInMethodsOf(answer: unknown): SiteSignInMethod[] {\n const listed = answer && typeof answer === 'object' ? (answer as { methods?: unknown }).methods : undefined;\n const set = new Set(Array.isArray(listed) ? listed.filter(isSiteSignInMethod) : []);\n set.add(EMAIL_CODE_PROVIDER);\n return SITE_SIGN_IN_METHODS.filter(m => set.has(m));\n}\n\n/** The providers among a site's methods. */\nexport function siteSignInProviders(methods: readonly SiteSignInMethod[]): SignInProvider[] {\n return SIGN_IN_PROVIDERS.filter(p => methods.includes(p));\n}\n","import { isSameOriginPath } from './guards';\nimport { isEmailCodeShape, normalizeEmailCode, normalizeSignInEmail, SiteCustomer } from './site-auth';\nimport { brokerStartUrl, SIGN_IN_PROVIDERS, SignInProvider } from './sign-in';\nimport { EMAIL_CODE_PROVIDER, SITE_SIGN_IN_METHODS, SiteSignInMethod } from './site-methods';\nimport { SiteSignInRefusalCode, siteSignInCodeOf } from './words';\n\n/**\n * THE TRANSPORT a site's sign-in parts speak (commerce E3a, the `CartTransport` rule): the parts own no HTTP. The engine\n * implements it over iox-cms's site routes (`siteAuthPath`, `siteProviderPath`, the cookie carried by the browser); the\n * builder canvas uses `simulatedSiteAuthTransport` — the ADMIN's browser is never a buyer, so nothing is sent and no\n * session exists.\n */\nexport interface SiteAuthTransport {\n /** The signed-in buyer, or null. */\n me(): Promise<SiteCustomer | null>;\n /** Ask the studio to start a provider's sign-in; the answer is the address the browser goes to next. */\n startProvider(provider: SignInProvider, returnPath: string): Promise<{ startUrl: string }>;\n /** Send a code to `email` (the studio always accepts — it never says whether the email is known). */\n sendCode(email: string): Promise<void>;\n /** Check the code; the signed-in buyer. */\n verifyCode(email: string, code: string): Promise<SiteCustomer>;\n signOut(): Promise<void>;\n /** The ways this site lets a buyer sign in (`SiteAuthRoute.Methods`). Absent = the parts hide nothing. */\n methods?(): Promise<SiteSignInMethod[]>;\n}\n\n/** A refused transport call, carrying the code the visitor's words come from (`signInRefusal`). */\nexport class SiteAuthError extends Error {\n readonly code: SiteSignInRefusalCode;\n\n constructor(code: unknown) {\n const known = siteSignInCodeOf(code);\n super(known);\n this.name = 'SiteAuthError';\n this.code = known;\n }\n}\n\n/** The code any thrown value carries: a `SiteAuthError`'s own, else `network` (the call never answered). */\nexport function siteAuthErrorCode(error: unknown): SiteSignInRefusalCode {\n return error instanceof SiteAuthError ? error.code : SiteSignInRefusalCode.Network;\n}\n\n/** The sample buyer the canvas signs in as. */\nexport const SAMPLE_CUSTOMER: Readonly<SiteCustomer> = Object.freeze({ id: 'sample-customer', email: 'noa.levi@example.com', name: 'Noa Levi' });\n\n/** The one code the simulated transport accepts (any other six digits are \"not right\" — so the error can be designed). */\nexport const SIMULATED_SIGN_IN_CODE = '123456';\n\nexport interface SimulatedSiteAuthTransport extends SiteAuthTransport {\n /** Who is signed in on the canvas right now. */\n readonly customer: SiteCustomer | null;\n setCustomer(customer: SiteCustomer | null): void;\n}\n\n/**\n * The canvas' transport: in memory, nothing sent. A code is \"sent\" to any well-formed email; `123456` signs in as the\n * sample buyer under the typed email, any other six digits are `code-wrong`; a provider's start answers the broker's\n * address with a sample ticket (the canvas host never follows it).\n */\nexport function simulatedSiteAuthTransport(start: SiteCustomer | null = null,\n methods: readonly SiteSignInMethod[] = SITE_SIGN_IN_METHODS): SimulatedSiteAuthTransport {\n let customer: SiteCustomer | null = start;\n const sentTo = new Set<string>();\n return {\n get customer() {\n return customer;\n },\n setCustomer(next) {\n customer = next;\n },\n async me() {\n return customer;\n },\n async startProvider(provider, returnPath) {\n if (!isSameOriginPath(returnPath)) throw new SiteAuthError(SiteSignInRefusalCode.Failed);\n return { startUrl: brokerStartUrl(provider, 'sample-ticket') };\n },\n async sendCode(email) {\n const key = normalizeSignInEmail(email);\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(key)) throw new SiteAuthError(SiteSignInRefusalCode.InvalidEmail);\n sentTo.add(key);\n },\n async verifyCode(email, code) {\n const key = normalizeSignInEmail(email);\n const digits = normalizeEmailCode(code);\n if (!sentTo.has(key) || !isEmailCodeShape(digits)) throw new SiteAuthError(SiteSignInRefusalCode.CodeWrong);\n if (digits !== SIMULATED_SIGN_IN_CODE) throw new SiteAuthError(SiteSignInRefusalCode.CodeWrong);\n customer = { ...SAMPLE_CUSTOMER, email: key };\n return customer;\n },\n async signOut() {\n customer = null;\n },\n async methods() {\n return [EMAIL_CODE_PROVIDER, ...SIGN_IN_PROVIDERS.filter(p => methods.includes(p))];\n },\n };\n}\n\n/** A transport that has nothing to reach: `me` is null, every change refused as `network`. */\nexport const NO_SITE_AUTH_TRANSPORT: SiteAuthTransport = Object.freeze({\n me: async () => null,\n startProvider: async () => { throw new SiteAuthError(SiteSignInRefusalCode.ProviderUnavailable); },\n sendCode: async () => { throw new SiteAuthError(SiteSignInRefusalCode.Network); },\n verifyCode: async () => { throw new SiteAuthError(SiteSignInRefusalCode.Network); },\n signOut: async () => undefined,\n methods: async () => [EMAIL_CODE_PROVIDER],\n});\n\n// ── what a page shows of the buyer ───────────────────────────────────────────────────────────\n\n/** The context slot the account parts bind to (`$customer.initial`, `$customer.name`). */\nexport const CUSTOMER_SLOT = '$customer';\n\n/** `$customer` — what a page may show of the buyer: never the id. */\nexport interface CustomerSlot {\n signedIn: boolean;\n name: string;\n /** The first letter of the name, else of the email; '' when signed out. */\n initial: string;\n email: string;\n}\n\n/** The first visible letter of a name or an email, upper-cased where the script has case. */\nexport function customerInitial(customer: Pick<SiteCustomer, 'name' | 'email'> | null | undefined): string {\n const source = (customer?.name ?? '').trim() || (customer?.email ?? '').trim();\n const first = Array.from(source)[0] ?? '';\n return first.toLocaleUpperCase();\n}\n\n/** The name a page greets with: the buyer's own, else the email's local part. */\nexport function customerDisplayName(customer: Pick<SiteCustomer, 'name' | 'email'> | null | undefined): string {\n const name = (customer?.name ?? '').trim();\n if (name) return name;\n return (customer?.email ?? '').split('@')[0] ?? '';\n}\n\nexport function customerSlotOf(customer: SiteCustomer | null | undefined): CustomerSlot {\n if (!customer) return { signedIn: false, name: '', initial: '', email: '' };\n return { signedIn: true, name: customerDisplayName(customer), initial: customerInitial(customer), email: customer.email };\n}\n","/**\n * @vectoriox/iox-ui/identity-core — the shared, FRAMEWORK-FREE vocabulary of signing in (commerce plan §3c, C-D5,\n * C-D6, C-D22): who signs in and with what, the broker's ticket / redeem shapes and refusals, a studio's site sign-in\n * routes, session claims and cookies, the email-code rules, the two address guards (open redirect, return host) and\n * the sign-in dialog's words. The broker (iox-control-plane), the studios (iox-cms), the engine and the builder speak it.\n * It imports nothing — a consumer maps this one entry.\n * ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets,\n * jest moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.\n */\nexport * from './sign-in';\nexport * from './guards';\nexport * from './site-auth';\nexport * from './words';\nexport * from './site-auth-transport';\nexport * from './provider-marks';\nexport * from './site-methods';\n","/**\n * Generated bundle index. Do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,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,EAAE,IAAI,EAAE;AAC9E,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;AACzC,IAAA,OAAO,KAAK,CAAC,iBAAiB,EAAE;AACpC;AAEA;AACM,SAAU,mBAAmB,CAAC,QAAiE,EAAA;AACjG,IAAA,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;AAC1C,IAAA,IAAI,IAAI;AAAE,QAAA,OAAO,IAAI;AACrB,IAAA,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;AACtD;AAEM,SAAU,cAAc,CAAC,QAAyC,EAAA;AACpE,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE;AAC7H;;AC7IA;;;;;;;;AAQG;;ACRH;;AAEG;;;;"}
@@ -6,7 +6,7 @@ import { Subject, fromEvent } from 'rxjs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import * as i1 from '@angular/common';
8
8
  import { CommonModule, isPlatformBrowser } from '@angular/common';
9
- import { SPEC_AXES, resolveDesignMotion, HeaderAttribute, HeaderBehaviour, headerAttributes, HeaderTrait } from '@vectoriox/iox-ui/design-core';
9
+ import { SPEC_AXES, resolveDesignMotion, FieldClass, HeaderAttribute, HeaderBehaviour, headerAttributes, HeaderTrait, writeFieldError } from '@vectoriox/iox-ui/design-core';
10
10
  export * from '@vectoriox/iox-ui/design-core';
11
11
  import Lenis from 'lenis';
12
12
  import { SLIDER_WORDS, sliderPartElement, SliderRole, sliderWords, attachCarouselA11y, attachSliderBar, isSliderPart, MARQUEE_NODE_ATTRIBUTES, SLIDE_TYPE, SLIDE_CAPTION_TRAIT, marqueeRootAttributes, MarqueeRole } from '@vectoriox/iox-ui/composite-core';
@@ -18,6 +18,7 @@ export { SCROLL_PROGRESS_TRIGGER } from '@vectoriox/iox-ui/actions-core';
18
18
  import { VideoKind, planVideo, videoRootAttributes, videoInnerHtml, videoWords, VideoAttribute, attachVideoAt, VideoClass } from '@vectoriox/iox-ui/media-core';
19
19
  import * as i1$1 from '@angular/platform-browser';
20
20
  import { formatMoneyValue, CURRENCY_CODES, SHOP_SLOTS } from '@vectoriox/iox-ui/commerce-core';
21
+ import { CUSTOMER_SLOT } from '@vectoriox/iox-ui/identity-core';
21
22
 
22
23
  class ViewPositionDirective {
23
24
  constructor(_elr) {
@@ -5446,29 +5447,6 @@ function channelOpensNewTab(kind) {
5446
5447
  *
5447
5448
  * Framework-free, like the rest of forms-core: `escape` is the caller's.
5448
5449
  */
5449
- /** The classes the markup carries — the runtimes and the shared CSS key on these, never on a literal. */
5450
- var FieldClass;
5451
- (function (FieldClass) {
5452
- FieldClass["Root"] = "iox-field";
5453
- FieldClass["Label"] = "iox-field__label";
5454
- FieldClass["LabelHidden"] = "iox-field__label--hidden";
5455
- FieldClass["Required"] = "iox-field__required";
5456
- FieldClass["Control"] = "iox-field__control";
5457
- FieldClass["Help"] = "iox-field__help";
5458
- FieldClass["Error"] = "iox-field__error";
5459
- FieldClass["Group"] = "iox-field__group";
5460
- FieldClass["Option"] = "iox-field__option";
5461
- FieldClass["Choices"] = "iox-field__choices";
5462
- FieldClass["ChoicesChips"] = "iox-field__choices--chips";
5463
- FieldClass["ChoicesList"] = "iox-field__choices--list";
5464
- FieldClass["Chips"] = "iox-field__chips";
5465
- FieldClass["Chip"] = "iox-field__chip";
5466
- FieldClass["ChipInput"] = "iox-field__control--chip";
5467
- FieldClass["DateButton"] = "iox-field__control--date";
5468
- FieldClass["DateValue"] = "iox-field__date-value";
5469
- FieldClass["DateIcon"] = "iox-field__date-icon";
5470
- FieldClass["DateInput"] = "iox-field__date-input";
5471
- })(FieldClass || (FieldClass = {}));
5472
5450
  /** On the date button: the raw Earliest / Latest (`'0'`, an ISO day), resolved by the visitor's own today. */
5473
5451
  const DATE_MIN_ATTRIBUTE = 'data-iox-date-min';
5474
5452
  const DATE_MAX_ATTRIBUTE = 'data-iox-date-max';
@@ -11322,6 +11300,9 @@ function contextActionEffect(action, pass = 'forward') {
11322
11300
  * Union of declared + in-use, so a declared-but-unused slot still seeds its default, and a slot used
11323
11301
  * by a symbol dropped onto a page that never declared it still works (it just has no default).
11324
11302
  */
11303
+ /** Slots a runtime writes, never an action, so reading one is enough to make it live: the shop parts' (commerce E1c,
11304
+ * the shop runtime) and `$customer` (commerce E3, the account runtime's `publish`). */
11305
+ const RUNTIME_WRITTEN = new Set([...SHOP_SLOTS, CUSTOMER_SLOT]);
11325
11306
  function collectContextSlotKeys(nodes,
11326
11307
  /** Declared VARIABLES — page resources of `type: 'variable'`, or legacy slot declarations. */
11327
11308
  declared = []) {
@@ -11330,9 +11311,8 @@ declared = []) {
11330
11311
  walk(nodes, written, read);
11331
11312
  // A binding only names a SLOT if something writes that key; otherwise it names a data source.
11332
11313
  const keys = new Set(written);
11333
- // The shop parts' slots (commerce E1c) are written by the shop runtime, never by an action: read = live.
11334
11314
  for (const key of read)
11335
- if (written.has(key) || SHOP_SLOTS.includes(key))
11315
+ if (written.has(key) || RUNTIME_WRITTEN.has(key))
11336
11316
  keys.add(key);
11337
11317
  for (const decl of declared) {
11338
11318
  // A declared variable (a data source of type 'variable') or a legacy IoxContextSlot.
@@ -11879,9 +11859,6 @@ function playDualLayerTransition(resolved, layers) {
11879
11859
 
11880
11860
  const FIELD_ATTRIBUTE = 'data-iox-field';
11881
11861
  const CONTROL_CLASS = 'iox-field__control';
11882
- const ERROR_CLASS = 'iox-field__error';
11883
- const HELP_CLASS = 'iox-field__help';
11884
- const INVALID_CLASS = 'iox-invalid';
11885
11862
  const BOOTED = '__ioxStringForm';
11886
11863
  /**
11887
11864
  * A form the SSR engine's string renderer wrote — every header / footer global, every string-rendered page —
@@ -12062,38 +12039,7 @@ class StringFormRuntime {
12062
12039
  const error = this.state.errors[field.name];
12063
12040
  const shown = !!error && shouldShowError(field.name, this.state, this.spec.feedback);
12064
12041
  const text = shown ? this.messages(error.messageKey, error.params) : '';
12065
- el.classList.toggle(INVALID_CLASS, shown && !!text);
12066
- this.renderError(el, shown ? text : '');
12067
- }
12068
- }
12069
- renderError(field, text) {
12070
- const controls = this.controlsOf(field);
12071
- const id = (controls[0]?.id || `iox-field-${field.getAttribute(FIELD_ATTRIBUTE)}`) + '-error';
12072
- let p = field.querySelector(`.${ERROR_CLASS}`);
12073
- if (text) {
12074
- if (!p) {
12075
- p = field.ownerDocument.createElement('p');
12076
- p.className = ERROR_CLASS;
12077
- p.id = id;
12078
- p.setAttribute('role', 'alert');
12079
- field.appendChild(p);
12080
- }
12081
- p.textContent = text;
12082
- }
12083
- else {
12084
- p?.remove();
12085
- }
12086
- const helpId = field.querySelector(`.${HELP_CLASS}`)?.id;
12087
- const describedBy = [helpId, text ? id : ''].filter(Boolean).join(' ');
12088
- for (const control of controls) {
12089
- if (text)
12090
- control.setAttribute('aria-invalid', 'true');
12091
- else
12092
- control.removeAttribute('aria-invalid');
12093
- if (describedBy)
12094
- control.setAttribute('aria-describedby', describedBy);
12095
- else
12096
- control.removeAttribute('aria-describedby');
12042
+ writeFieldError(el, shown ? text : '');
12097
12043
  }
12098
12044
  }
12099
12045
  announce(errors) {