@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-commerce-core.mjs","sources":["../../../projects/iox-ui/src/commerce-core/money-error.ts","../../../projects/iox-ui/src/commerce-core/currency.ts","../../../projects/iox-ui/src/commerce-core/decimal.ts","../../../projects/iox-ui/src/commerce-core/money.ts","../../../projects/iox-ui/src/commerce-core/labels.ts","../../../projects/iox-ui/src/commerce-core/limits.ts","../../../projects/iox-ui/src/commerce-core/vat.ts","../../../projects/iox-ui/src/commerce-core/catalog.ts","../../../projects/iox-ui/src/commerce-core/text.ts","../../../projects/iox-ui/src/commerce-core/shipping.ts","../../../projects/iox-ui/src/commerce-core/cart.ts","../../../projects/iox-ui/src/commerce-core/payments.ts","../../../projects/iox-ui/src/commerce-core/orders.ts","../../../projects/iox-ui/src/commerce-core/checkout.ts","../../../projects/iox-ui/src/commerce-core/order-snapshot.ts","../../../projects/iox-ui/src/commerce-core/variants.ts","../../../projects/iox-ui/src/commerce-core/quantity.ts","../../../projects/iox-ui/src/commerce-core/cart-transport.ts","../../../projects/iox-ui/src/commerce-core/shop-display.ts","../../../projects/iox-ui/src/commerce-core/site-checkout.ts","../../../projects/iox-ui/src/commerce-core/public-api.ts","../../../projects/iox-ui/src/commerce-core/vectoriox-iox-ui-commerce-core.ts"],"sourcesContent":["export enum MoneyErrorCode {\n UnknownCurrency = 'unknown-currency',\n NotMoney = 'not-money',\n NotInteger = 'not-integer',\n NotANumber = 'not-a-number',\n TooManyDecimals = 'too-many-decimals',\n CurrencyMismatch = 'currency-mismatch',\n NotWhole = 'not-whole',\n Negative = 'negative',\n Overflow = 'overflow',\n OutOfRange = 'out-of-range',\n}\n\nexport class MoneyError extends Error {\n constructor(readonly code: MoneyErrorCode, message: string) {\n super(message);\n this.name = 'MoneyError';\n }\n}\n","import { MoneyError, MoneyErrorCode } from './money-error';\n\nexport enum CurrencyCode {\n ILS = 'ILS',\n USD = 'USD',\n EUR = 'EUR',\n GBP = 'GBP',\n CHF = 'CHF',\n CAD = 'CAD',\n AUD = 'AUD',\n NZD = 'NZD',\n SEK = 'SEK',\n NOK = 'NOK',\n DKK = 'DKK',\n PLN = 'PLN',\n CZK = 'CZK',\n HUF = 'HUF',\n RON = 'RON',\n TRY = 'TRY',\n AED = 'AED',\n SAR = 'SAR',\n QAR = 'QAR',\n EGP = 'EGP',\n MAD = 'MAD',\n ZAR = 'ZAR',\n INR = 'INR',\n CNY = 'CNY',\n HKD = 'HKD',\n SGD = 'SGD',\n THB = 'THB',\n MXN = 'MXN',\n BRL = 'BRL',\n JPY = 'JPY',\n KRW = 'KRW',\n VND = 'VND',\n CLP = 'CLP',\n ISK = 'ISK',\n BHD = 'BHD',\n KWD = 'KWD',\n JOD = 'JOD',\n OMR = 'OMR',\n TND = 'TND',\n}\n\n/** ISO-4217 minor units — our own table, never Intl's CLDR digits (they differ for some codes). */\nexport const CURRENCY_EXPONENTS: Readonly<Record<CurrencyCode, number>> = Object.freeze({\n [CurrencyCode.ILS]: 2,\n [CurrencyCode.USD]: 2,\n [CurrencyCode.EUR]: 2,\n [CurrencyCode.GBP]: 2,\n [CurrencyCode.CHF]: 2,\n [CurrencyCode.CAD]: 2,\n [CurrencyCode.AUD]: 2,\n [CurrencyCode.NZD]: 2,\n [CurrencyCode.SEK]: 2,\n [CurrencyCode.NOK]: 2,\n [CurrencyCode.DKK]: 2,\n [CurrencyCode.PLN]: 2,\n [CurrencyCode.CZK]: 2,\n [CurrencyCode.HUF]: 2,\n [CurrencyCode.RON]: 2,\n [CurrencyCode.TRY]: 2,\n [CurrencyCode.AED]: 2,\n [CurrencyCode.SAR]: 2,\n [CurrencyCode.QAR]: 2,\n [CurrencyCode.EGP]: 2,\n [CurrencyCode.MAD]: 2,\n [CurrencyCode.ZAR]: 2,\n [CurrencyCode.INR]: 2,\n [CurrencyCode.CNY]: 2,\n [CurrencyCode.HKD]: 2,\n [CurrencyCode.SGD]: 2,\n [CurrencyCode.THB]: 2,\n [CurrencyCode.MXN]: 2,\n [CurrencyCode.BRL]: 2,\n [CurrencyCode.JPY]: 0,\n [CurrencyCode.KRW]: 0,\n [CurrencyCode.VND]: 0,\n [CurrencyCode.CLP]: 0,\n [CurrencyCode.ISK]: 0,\n [CurrencyCode.BHD]: 3,\n [CurrencyCode.KWD]: 3,\n [CurrencyCode.JOD]: 3,\n [CurrencyCode.OMR]: 3,\n [CurrencyCode.TND]: 3,\n});\n\nexport const CURRENCY_CODES: readonly CurrencyCode[] = Object.freeze(Object.values(CurrencyCode));\n\nexport function isCurrencyCode(value: unknown): value is CurrencyCode {\n return typeof value === 'string' && Object.prototype.hasOwnProperty.call(CURRENCY_EXPONENTS, value);\n}\n\nexport function currencyExponent(currency: CurrencyCode): number {\n if (!isCurrencyCode(currency)) {\n throw new MoneyError(MoneyErrorCode.UnknownCurrency, `Unknown currency: ${String(currency)}`);\n }\n return CURRENCY_EXPONENTS[currency];\n}\n","import { MoneyError, MoneyErrorCode } from './money-error';\n\nexport interface DecimalDigits {\n negative: boolean;\n int: string;\n frac: string;\n}\n\nexport enum DecimalRounding {\n Exact = 'exact',\n HalfEven = 'half-even',\n}\n\nconst DECIMAL = /^([+-])?(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d{1,3}))?$/;\n\n/** Plain decimal text, or the e-notation `String(number)` produces below 1e-6 and from 1e21. */\nexport function parseDecimal(text: string): DecimalDigits | null {\n const match = DECIMAL.exec(text);\n if (!match) return null;\n const int = match[2] ?? '';\n const frac = match[3] ?? '';\n if (!int && !frac) return null;\n const digits = int + frac;\n const point = int.length + Number(match[4] ?? 0);\n const shiftedInt = point <= 0 ? '' : point >= digits.length ? digits + '0'.repeat(point - digits.length) : digits.slice(0, point);\n const shiftedFrac = point <= 0 ? '0'.repeat(-point) + digits : point >= digits.length ? '' : digits.slice(point);\n return {\n negative: match[1] === '-',\n int: shiftedInt.replace(/^0+/, ''),\n frac: shiftedFrac.replace(/0+$/, ''),\n };\n}\n\nfunction safeFromDigits(digits: string): number {\n const trimmed = digits.replace(/^0+/, '') || '0';\n const value = trimmed.length > 16 ? Infinity : Number(trimmed);\n if (!Number.isSafeInteger(value)) {\n throw new MoneyError(MoneyErrorCode.Overflow, `${digits} is beyond the safe integer range`);\n }\n return value;\n}\n\n/** Scales a parsed decimal by 10^exponent into an integer, without ever touching a float. */\nexport function decimalToScaledInteger(decimal: DecimalDigits, exponent: number, rounding: DecimalRounding): number {\n const kept = decimal.frac.slice(0, exponent);\n const rest = decimal.frac.slice(exponent);\n if (rest && rounding === DecimalRounding.Exact) {\n throw new MoneyError(MoneyErrorCode.TooManyDecimals, `More than ${exponent} decimal digits`);\n }\n let magnitude = safeFromDigits(decimal.int + kept.padEnd(exponent, '0'));\n if (rest) {\n const first = Number(rest[0]);\n const tie = first === 5 && /^5$/.test(rest);\n const up = first > 5 || (first === 5 && !tie) || (tie && magnitude % 2 === 1);\n if (up) magnitude += 1;\n if (!Number.isSafeInteger(magnitude)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Rounded value is beyond the safe integer range');\n }\n }\n return decimal.negative && magnitude !== 0 ? -magnitude : magnitude;\n}\n\n/** Integer division rounded half-to-even; numerator ≥ 0, denominator > 0, both safe integers. */\nexport function divideHalfEven(numerator: number, denominator: number): number {\n let quotient = Math.trunc(numerator / denominator);\n let remainder = numerator - quotient * denominator;\n while (remainder < 0) {\n quotient -= 1;\n remainder += denominator;\n }\n while (remainder >= denominator) {\n quotient += 1;\n remainder -= denominator;\n }\n const twice = remainder * 2;\n if (twice > denominator || (twice === denominator && quotient % 2 === 1)) quotient += 1;\n return quotient;\n}\n\n/** Integer division that never trusts the float quotient: trunc, then corrected by the remainder. */\nfunction divMod(numerator: number, denominator: number): [number, number] {\n let quotient = Math.trunc(numerator / denominator);\n let remainder = numerator - quotient * denominator;\n while (remainder < 0) {\n quotient -= 1;\n remainder += denominator;\n }\n while (remainder >= denominator) {\n quotient += 1;\n remainder -= denominator;\n }\n return [quotient, remainder];\n}\n\n/**\n * round-half-even(a × b / d) for a, b ≥ 0 and d > b, without forming a × b (it can pass 2^53): a = q·d + r, so\n * a·b/d = q·b + r·b/d, where q·b < a and r·b < d·b — callers keep d·b a safe integer.\n */\nexport function mulDivHalfEven(a: number, b: number, d: number): number {\n const [q, r] = divMod(a, d);\n const [f, rest] = divMod(r * b, d);\n let result = q * b + f;\n const twice = rest * 2;\n if (twice > d || (twice === d && result % 2 === 1)) result += 1;\n return result;\n}\n","import { CurrencyCode, currencyExponent, isCurrencyCode } from './currency';\nimport { DecimalRounding, decimalToScaledInteger, divideHalfEven, parseDecimal } from './decimal';\nimport { MoneyError, MoneyErrorCode } from './money-error';\n\nexport interface Money {\n /** Integer minor units (agorot, cents, fils…). */\n amount: number;\n currency: CurrencyCode;\n}\n\nconst MAX_PERCENT_DECIMALS = 6;\n\nexport function isMoney(value: unknown): value is Money {\n if (typeof value !== 'object' || value === null) return false;\n const record = value as Record<string, unknown>;\n return Number.isSafeInteger(record['amount']) && isCurrencyCode(record['currency']);\n}\n\nfunction assertWhole(amount: number, what: string): void {\n if (typeof amount !== 'number' || !Number.isSafeInteger(amount)) {\n throw new MoneyError(MoneyErrorCode.NotInteger, `${what} must be a whole number of minor units, got ${String(amount)}`);\n }\n}\n\nfunction assertMoney(value: Money): void {\n if (typeof value !== 'object' || value === null) {\n throw new MoneyError(MoneyErrorCode.NotMoney, `Not a Money value: ${String(value)}`);\n }\n currencyExponent(value.currency);\n assertWhole(value.amount, 'Money.amount');\n}\n\nfunction assertSameCurrency(a: Money, b: Money): void {\n assertMoney(a);\n assertMoney(b);\n if (a.currency !== b.currency) {\n throw new MoneyError(MoneyErrorCode.CurrencyMismatch, `Cannot combine ${a.currency} with ${b.currency}`);\n }\n}\n\nfunction safeResult(amount: number, currency: CurrencyCode): Money {\n if (!Number.isSafeInteger(amount)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Result is beyond the safe integer range');\n }\n return { amount: amount === 0 ? 0 : amount, currency };\n}\n\nexport function money(amount: number, currency: CurrencyCode): Money {\n currencyExponent(currency);\n assertWhole(amount, 'amount');\n return { amount: amount === 0 ? 0 : amount, currency };\n}\n\nfunction decimalText(value: number | string): string | null {\n if (typeof value === 'number') return Number.isFinite(value) ? String(value) : null;\n if (typeof value === 'string') return value.trim();\n return null;\n}\n\n/** Exact: `19.99` → 1999 by reading the digits, never `x * 100`; refuses digits the currency lacks. */\nexport function majorToMinor(major: number | string, currency: CurrencyCode): number {\n const exponent = currencyExponent(currency);\n const text = decimalText(major);\n const decimal = text === null ? null : parseDecimal(text);\n if (!decimal) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Not a decimal amount: ${String(major)}`);\n }\n return decimalToScaledInteger(decimal, exponent, DecimalRounding.Exact);\n}\n\nexport function minorToMajor(minor: number, currency: CurrencyCode): number {\n const exponent = currencyExponent(currency);\n assertWhole(minor, 'minor');\n return exponent === 0 ? minor : minor / 10 ** exponent;\n}\n\nexport function addMoney(a: Money, b: Money): Money {\n assertSameCurrency(a, b);\n return safeResult(a.amount + b.amount, a.currency);\n}\n\nexport function subtractMoney(a: Money, b: Money): Money {\n assertSameCurrency(a, b);\n return safeResult(a.amount - b.amount, a.currency);\n}\n\nexport function timesMoney(value: Money, quantity: number): Money {\n assertMoney(value);\n if (typeof quantity !== 'number' || !Number.isSafeInteger(quantity)) {\n throw new MoneyError(MoneyErrorCode.NotWhole, `Quantity must be a whole number, got ${String(quantity)}`);\n }\n if (quantity < 0) {\n throw new MoneyError(MoneyErrorCode.Negative, `Quantity cannot be negative, got ${quantity}`);\n }\n return safeResult(value.amount * quantity, value.currency);\n}\n\n/** `percent` of an amount, rounded ONCE to a minor unit, half-to-even (banker's). */\nexport function percentOf(value: Money, percent: number): Money {\n assertMoney(value);\n if (typeof percent !== 'number' || !Number.isFinite(percent)) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Percent must be a finite number, got ${String(percent)}`);\n }\n if (percent < 0) {\n throw new MoneyError(MoneyErrorCode.Negative, `Percent cannot be negative, got ${percent}`);\n }\n const decimal = parseDecimal(String(percent));\n if (!decimal) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Percent must be a finite number, got ${String(percent)}`);\n }\n if (decimal.frac.length > MAX_PERCENT_DECIMALS) {\n throw new MoneyError(MoneyErrorCode.TooManyDecimals, `Percent has more than ${MAX_PERCENT_DECIMALS} decimal digits`);\n }\n const scale = decimal.frac.length;\n const percentScaled = decimalToScaledInteger(decimal, scale, DecimalRounding.Exact);\n const numerator = Math.abs(value.amount) * percentScaled;\n if (!Number.isSafeInteger(numerator)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Percent of this amount is beyond the safe integer range');\n }\n const magnitude = divideHalfEven(numerator, 100 * 10 ** scale);\n return safeResult(value.amount < 0 ? -magnitude : magnitude, value.currency);\n}\n\nconst formatters = new Map<string, Intl.NumberFormat>();\n\nexport function formatMoney(value: Money, locale: string): string {\n assertMoney(value);\n const exponent = currencyExponent(value.currency);\n const key = `${locale}|${value.currency}`;\n let formatter = formatters.get(key);\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: value.currency,\n minimumFractionDigits: exponent,\n maximumFractionDigits: exponent,\n });\n formatters.set(key, formatter);\n }\n return formatter.format(minorToMajor(value.amount, value.currency));\n}\n\n/**\n * For the one boot migration of stored major-unit prices. A stored float may carry arithmetic noise\n * (19.990000000000002), so extra digits round half-to-even instead of refusing. No usable price\n * (null, '', NaN, text, a negative) → null; it never applies twice by itself — the caller marks rows.\n */\nexport function migrateMajorPrice(value: unknown, currency: CurrencyCode): number | null {\n const exponent = currencyExponent(currency);\n if (typeof value !== 'number' && typeof value !== 'string') return null;\n const text = decimalText(value);\n const decimal = text ? parseDecimal(text) : null;\n if (!decimal || (decimal.negative && (decimal.int || decimal.frac))) return null;\n try {\n return decimalToScaledInteger(decimal, exponent, DecimalRounding.HalfEven);\n } catch {\n return null;\n }\n}\n","/**\n * The words a refusal or a state is shown with. A string-rendered site and iox-cms's emails have no translation\n * service, so the core carries English and Hebrew itself (the `blurbHe` / `sentWord` precedent); a host with its\n * own translations may key them by the stable code instead.\n */\nexport enum CommerceLanguage {\n En = 'en',\n He = 'he',\n}\n\nexport interface CommerceLabel {\n readonly en: string;\n readonly he: string;\n}\n\nconst LANGUAGE_ALIASES: Readonly<Record<string, CommerceLanguage>> = Object.freeze({\n en: CommerceLanguage.En,\n he: CommerceLanguage.He,\n iw: CommerceLanguage.He,\n});\n\nexport function commerceLanguage(lang: string | null | undefined): CommerceLanguage {\n const primary = String(lang ?? '').trim().toLowerCase().split(/[-_]/)[0];\n return LANGUAGE_ALIASES[primary] ?? CommerceLanguage.En;\n}\n\nexport function labelIn(label: CommerceLabel, lang: string | null | undefined): string {\n return label[commerceLanguage(lang)];\n}\n","/** A cart holds at most this many distinct lines; more are dropped (`too-many-lines`). */\nexport const MAX_CART_LINES = 100;\n/** One line's quantity is capped here (`quantity-capped`), before stock. */\nexport const MAX_LINE_QUANTITY = 999;\n/**\n * The largest subtotal, shipping price or threshold, in minor units. Subtotal + shipping stays far below 2^53, and\n * the included-VAT arithmetic never forms a product past it.\n */\nexport const MAX_CART_AMOUNT = 10 ** 15;\n","import { currencyExponent } from './currency';\nimport { decimalToScaledInteger, DecimalRounding, mulDivHalfEven, parseDecimal } from './decimal';\nimport { Money } from './money';\nimport { MoneyError, MoneyErrorCode } from './money-error';\n\nexport const MAX_VAT_PERCENT = 100;\n/** 17, 18, 7.7, 8.1 — four decimals is more than any rate in force; it also keeps the arithmetic below 2^53. */\nexport const VAT_PERCENT_MAX_DECIMALS = 4;\n\nexport function isVatPercent(value: unknown): value is number {\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > MAX_VAT_PERCENT) return false;\n const decimal = parseDecimal(String(value));\n return !!decimal && decimal.frac.length <= VAT_PERCENT_MAX_DECIMALS;\n}\n\n/**\n * The VAT a VAT-INCLUSIVE amount already holds (C-D8): amount × v / (100 + v), rounded ONCE to a minor unit,\n * half-to-even. Exact: v is read as the integer R = v·10^s (s ≤ 4 decimals), so the share is\n * amount × R / (100·10^s + R) in whole numbers. 118.00 at 18 % → 18.00; 100.00 at 17 % → 14.53.\n */\nexport function includedVat(total: Money, vatPercent: number): Money {\n currencyExponent(total.currency);\n if (typeof total.amount !== 'number' || !Number.isSafeInteger(total.amount)) {\n throw new MoneyError(MoneyErrorCode.NotInteger, `total must be a whole number of minor units, got ${String(total.amount)}`);\n }\n if (!isVatPercent(vatPercent)) {\n throw new MoneyError(MoneyErrorCode.OutOfRange, `VAT must be 0–${MAX_VAT_PERCENT} with at most ${VAT_PERCENT_MAX_DECIMALS} decimals, got ${String(vatPercent)}`);\n }\n const decimal = parseDecimal(String(vatPercent))!;\n const scale = decimal.frac.length;\n const rate = decimalToScaledInteger(decimal, scale, DecimalRounding.Exact);\n const magnitude = Math.abs(total.amount);\n if (magnitude > Number.MAX_SAFE_INTEGER / 2) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Amount is beyond the range VAT is computed for');\n }\n const share = mulDivHalfEven(magnitude, rate, 100 * 10 ** scale + rate);\n return { amount: total.amount < 0 && share !== 0 ? -share : share, currency: total.currency };\n}\n","import { Money } from './money';\n\n/** The storefront's stock word (iox-cms `storefront-projection.ts` speaks the same values). */\nexport enum Availability {\n InStock = 'in_stock',\n Low = 'low',\n Out = 'out',\n}\n\n/**\n * One sellable unit as the seller knows it, in minor units: a product with no options is ONE entry with no\n * `variantId`; a product with options is one entry per variant. iox-cms builds it from the product row (with the\n * stock COUNT); the engine builds it from the storefront projection (with the availability WORD only).\n */\nexport interface CatalogEntry {\n productId: string;\n variantId?: string | null;\n title: string;\n variantName?: string | null;\n /** null = no price set yet (a sample's placeholder): never sold. */\n unitPrice: Money | null;\n compareAt?: Money | null;\n /** The count, where the caller knows it (iox-cms). Wins over `availability`. */\n stock?: number | null;\n /** The word, where only it is known (the engine). */\n availability?: Availability | null;\n /** A variant's switch; a product with no options is `true`. */\n enabled: boolean;\n published: boolean;\n /** false = a digital product: no delivery address, no shipping method. */\n requiresShipping: boolean;\n image?: string | null;\n}\n\n/** How many units may be sold: the count, else 0 for `out` or nothing known, else null = unbounded here (the server checks the count). */\nexport function sellableQuantity(entry: CatalogEntry): number | null {\n if (typeof entry.stock === 'number') return Number.isSafeInteger(entry.stock) && entry.stock > 0 ? entry.stock : 0;\n if (entry.availability === Availability.InStock || entry.availability === Availability.Low) return null;\n return 0;\n}\n\nexport const catalogKey = (productId: string, variantId?: string | null): string => `${productId}\\u0000${variantId ?? ''}`;\n","export const filled = (value: unknown): value is string => typeof value === 'string' && value.trim() !== '';\n\nexport const looksLikeEmail = (value: unknown): boolean => filled(value) && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value.trim());\n\nexport const digitsOf = (value: unknown): string => (typeof value === 'string' ? value.replace(/\\D/g, '') : '');\n\n/** A phone a person can be called on: 7–15 digits once spaces, dashes, brackets and a leading + are dropped. */\nexport const looksLikePhone = (value: unknown): boolean =>\n filled(value) && /^\\+?[\\d\\s\\-().]+$/.test(value.trim()) && digitsOf(value).length >= 7 && digitsOf(value).length <= 15;\n\n/** An Israeli mobile number (Bit sends to one): 05X-XXXXXXX, or +972 5X-XXXXXXX. */\nexport const looksLikeIsraeliMobile = (value: unknown): boolean =>\n filled(value) && /^\\+?[\\d\\s\\-().]+$/.test(value.trim()) && /^(?:9725|05)\\d{8}$/.test(digitsOf(value));\n","import { CurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { MAX_CART_AMOUNT } from './limits';\nimport { isMoney, money, Money, subtractMoney } from './money';\nimport { filled } from './text';\n\n/** Shipping v1 (C-D9): methods per studio, one country. Zones and weights come later. */\nexport enum ShippingMethodKind {\n Pickup = 'pickup',\n Flat = 'flat',\n /** A flat price that becomes free once the goods reach `freeOver`. */\n FreeOver = 'freeOver',\n /** No address, nothing shipped — offered only when nothing in the cart ships. */\n Digital = 'digital',\n}\n\n/** What an owner must fill for a method of a kind. */\nexport enum ShippingField {\n Price = 'price',\n FreeOver = 'freeOver',\n PickupAddress = 'pickupAddress',\n}\n\nexport interface ShippingMethod {\n id: string;\n kind: ShippingMethodKind;\n name: string;\n enabled: boolean;\n price?: Money | null;\n freeOver?: Money | null;\n pickupAddress?: string | null;\n pickupHours?: string | null;\n}\n\ninterface ShippingKindRule {\n readonly needsAddress: boolean;\n /** Offered for a cart where something ships (true) or for one where nothing does (false). */\n readonly forPhysical: boolean;\n readonly requires: readonly ShippingField[];\n readonly price: (method: ShippingMethod, goods: Money) => Money;\n readonly label: CommerceLabel;\n}\n\nconst zero = (goods: Money): Money => money(0, goods.currency);\n\nexport const SHIPPING_KINDS: Readonly<Record<ShippingMethodKind, ShippingKindRule>> = Object.freeze({\n [ShippingMethodKind.Pickup]: {\n needsAddress: false,\n forPhysical: true,\n requires: [ShippingField.PickupAddress],\n price: (_method: ShippingMethod, goods: Money) => zero(goods),\n label: { en: 'Pickup', he: 'איסוף עצמי' },\n },\n [ShippingMethodKind.Flat]: {\n needsAddress: true,\n forPhysical: true,\n requires: [ShippingField.Price],\n price: (method: ShippingMethod) => method.price as Money,\n label: { en: 'Flat-rate delivery', he: 'משלוח במחיר קבוע' },\n },\n [ShippingMethodKind.FreeOver]: {\n needsAddress: true,\n forPhysical: true,\n requires: [ShippingField.Price, ShippingField.FreeOver],\n price: (method: ShippingMethod, goods: Money) =>\n goods.amount >= (method.freeOver as Money).amount ? zero(goods) : (method.price as Money),\n label: { en: 'Delivery, free over an amount', he: 'משלוח, חינם מעל סכום' },\n },\n [ShippingMethodKind.Digital]: {\n needsAddress: false,\n forPhysical: false,\n requires: [],\n price: (_method: ShippingMethod, goods: Money) => zero(goods),\n label: { en: 'Digital — nothing shipped', he: 'דיגיטלי — ללא משלוח' },\n },\n});\n\nconst validAmount = (value: unknown, currency: CurrencyCode): boolean =>\n isMoney(value) && value.currency === currency && value.amount >= 0 && value.amount <= MAX_CART_AMOUNT;\n\nconst SHIPPING_FIELD_CHECKS: Readonly<Record<ShippingField, (method: ShippingMethod, currency: CurrencyCode) => boolean>> = Object.freeze({\n [ShippingField.Price]: (method: ShippingMethod, currency: CurrencyCode) => validAmount(method.price, currency),\n [ShippingField.FreeOver]: (method: ShippingMethod, currency: CurrencyCode) => validAmount(method.freeOver, currency),\n [ShippingField.PickupAddress]: (method: ShippingMethod) => filled(method.pickupAddress),\n});\n\nexport const isShippingMethodKind = (value: unknown): value is ShippingMethodKind =>\n typeof value === 'string' && Object.prototype.hasOwnProperty.call(SHIPPING_KINDS, value);\n\nexport function shippingNeedsAddress(kind: ShippingMethodKind): boolean {\n return isShippingMethodKind(kind) && SHIPPING_KINDS[kind].needsAddress;\n}\n\n/** The fields a method lacks (or holds in another currency) — empty = it can be offered. */\nexport function shippingMethodProblems(method: ShippingMethod, currency: CurrencyCode): ShippingField[] {\n if (!method || !isShippingMethodKind(method.kind)) return [ShippingField.Price];\n return SHIPPING_KINDS[method.kind].requires.filter(field => !SHIPPING_FIELD_CHECKS[field](method, currency));\n}\n\n/** Enabled, complete, with an id and a name: the ONE rule both the offer and the checkout gate read. */\nexport function shippingMethodReady(method: ShippingMethod, currency: CurrencyCode): boolean {\n return !!method && method.enabled === true && filled(method.id) && filled(method.name)\n && shippingMethodProblems(method, currency).length === 0;\n}\n\nexport interface ShippingQuote {\n methodId: string;\n kind: ShippingMethodKind;\n name: string;\n price: Money;\n /** A free-over method whose threshold the goods reached. */\n free: boolean;\n needsAddress: boolean;\n}\n\n/** What a quote reads of a cart. */\nexport interface ShippingGoods {\n currency: CurrencyCode;\n /** The goods after discounts — what a free-over threshold is compared with. */\n goods: Money;\n requiresShipping: boolean;\n lineCount: number;\n}\n\n/** The part of a `PricedCart` the offer reads. */\nexport interface ShippingCart {\n currency: CurrencyCode;\n subtotal: Money;\n discount: Money;\n requiresShipping: boolean;\n lines: readonly unknown[];\n}\n\nexport function quoteShipping(methods: readonly ShippingMethod[], cart: ShippingGoods): ShippingQuote[] {\n const list: readonly ShippingMethod[] = Array.isArray(methods) ? methods : [];\n if (!cart.lineCount) return [];\n const seen = new Set<string>();\n return list\n .filter(method => shippingMethodReady(method, cart.currency)\n && SHIPPING_KINDS[method.kind].forPhysical === cart.requiresShipping\n && !seen.has(method.id) && !!seen.add(method.id))\n .map(method => {\n const rule = SHIPPING_KINDS[method.kind];\n const price = rule.price(method, cart.goods);\n return {\n methodId: method.id,\n kind: method.kind,\n name: method.name,\n price: money(price.amount, price.currency),\n free: method.kind === ShippingMethodKind.FreeOver && price.amount === 0,\n needsAddress: rule.needsAddress,\n };\n });\n}\n\n/**\n * The methods a buyer may choose for this cart, each priced for it (free over: free when the goods after\n * discounts are AT or above the threshold). A cart where nothing ships is offered Digital methods only; a cart\n * where anything ships never is.\n */\nexport function availableShippingMethods(methods: readonly ShippingMethod[], pricedCart: ShippingCart): ShippingQuote[] {\n return quoteShipping(methods, {\n currency: pricedCart.currency,\n goods: subtractMoney(pricedCart.subtotal, pricedCart.discount),\n requiresShipping: pricedCart.requiresShipping,\n lineCount: pricedCart.lines.length,\n });\n}\n\n/**\n * What the goods still lack before a free-over method delivers free (the drawer's \"Add ₪X more for free delivery\"):\n * the smallest gap over the methods offered, null when nothing ships, when no method is free-over, or when one already\n * is free. `methods` are the ready ones (the checkout's options answer only those).\n */\nexport function freeShippingRemaining(\n methods: ReadonlyArray<Pick<ShippingMethod, 'kind'> & { freeOver?: Money | null }>,\n cart: Pick<ShippingCart, 'currency' | 'subtotal' | 'discount' | 'requiresShipping' | 'lines'>,\n): Money | null {\n if (!cart.lines.length || !cart.requiresShipping) return null;\n const goods = subtractMoney(cart.subtotal, cart.discount);\n let gap: Money | null = null;\n for (const method of Array.isArray(methods) ? methods : []) {\n const over = method.kind === ShippingMethodKind.FreeOver ? method.freeOver : null;\n if (!isMoney(over) || over.currency !== cart.currency) continue;\n const left = over.amount - goods.amount;\n if (left <= 0) return null;\n if (!gap || left < gap.amount) gap = money(left, cart.currency);\n }\n return gap;\n}\n","import { CatalogEntry, catalogKey, sellableQuantity } from './catalog';\nimport { CurrencyCode, currencyExponent } from './currency';\nimport { CommerceLabel } from './labels';\nimport { MAX_CART_AMOUNT, MAX_CART_LINES, MAX_LINE_QUANTITY } from './limits';\nimport { addMoney, isMoney, money, Money, subtractMoney, timesMoney } from './money';\nimport { quoteShipping, ShippingMethod, ShippingQuote } from './shipping';\nimport { includedVat, isVatPercent } from './vat';\n\n/** A cart names what and how many — never a price (C-D16, trap T1): every read prices it again. */\nexport interface CartLine {\n productId: string;\n variantId?: string | null;\n quantity: number;\n}\n\nexport interface Cart {\n lines: readonly CartLine[];\n}\n\nexport interface StudioCommerce {\n currency: CurrencyCode;\n /** Prices INCLUDE it (C-D8). */\n vatPercent: number;\n shippingMethods: readonly ShippingMethod[];\n}\n\nexport interface PricingChoice {\n shippingMethodId?: string | null;\n}\n\nexport enum CartIssueCode {\n /** Not a whole number ≥ 1: the line is dropped. */\n InvalidQuantity = 'invalid-quantity',\n /** The same product and variant twice: merged into the first. */\n DuplicateLine = 'duplicate-line',\n TooManyLines = 'too-many-lines',\n QuantityCapped = 'quantity-capped',\n UnknownProduct = 'unknown-product',\n /** The product exists, this variant does not (or the product needs a variant chosen). */\n UnknownVariant = 'unknown-variant',\n Unpublished = 'unpublished',\n VariantDisabled = 'variant-disabled',\n NoPrice = 'no-price',\n CurrencyMismatch = 'currency-mismatch',\n OutOfStock = 'out-of-stock',\n /** Fewer left than asked: the line keeps what is left. */\n QuantityClamped = 'quantity-clamped',\n /** The line would push the subtotal past `MAX_CART_AMOUNT`: dropped. */\n AmountTooLarge = 'amount-too-large',\n /** The chosen shipping method is not offered for this cart: no shipping is priced. */\n ShippingUnavailable = 'shipping-unavailable',\n /** The studio's VAT is not a usable rate: the VAT line reads 0. */\n VatInvalid = 'vat-invalid',\n}\n\nexport const CART_ISSUE_LABELS: Readonly<Record<CartIssueCode, CommerceLabel>> = Object.freeze({\n [CartIssueCode.InvalidQuantity]: { en: 'A quantity was not a whole number, so the item was removed.', he: 'כמות שאינה מספר שלם — הפריט הוסר.' },\n [CartIssueCode.DuplicateLine]: { en: 'The same item appeared twice and was combined.', he: 'אותו פריט הופיע פעמיים ואוחד.' },\n [CartIssueCode.TooManyLines]: { en: 'Your cart has too many different items; the last ones were removed.', he: 'יש בעגלה יותר מדי פריטים שונים; האחרונים הוסרו.' },\n [CartIssueCode.QuantityCapped]: { en: 'That is more than one order can hold; the quantity was lowered.', he: 'הכמות גדולה מהמותר בהזמנה אחת, והיא הוקטנה.' },\n [CartIssueCode.UnknownProduct]: { en: 'An item is no longer sold and was removed.', he: 'פריט כבר לא נמכר והוסר.' },\n [CartIssueCode.UnknownVariant]: { en: 'An option of an item is no longer sold and was removed.', he: 'אפשרות של פריט כבר לא נמכרת והוסרה.' },\n [CartIssueCode.Unpublished]: { en: 'An item is not on sale right now and was removed.', he: 'פריט אינו למכירה כרגע והוסר.' },\n [CartIssueCode.VariantDisabled]: { en: 'An option of an item is not available and was removed.', he: 'אפשרות של פריט אינה זמינה והוסרה.' },\n [CartIssueCode.NoPrice]: { en: 'An item has no price yet and was removed.', he: 'לפריט עדיין אין מחיר, והוא הוסר.' },\n [CartIssueCode.CurrencyMismatch]: { en: 'An item is priced in another currency and was removed.', he: 'פריט מתומחר במטבע אחר והוסר.' },\n [CartIssueCode.OutOfStock]: { en: 'An item is out of stock and was removed.', he: 'פריט אזל מהמלאי והוסר.' },\n [CartIssueCode.QuantityClamped]: { en: 'Fewer are left than you asked for; your cart holds what is left.', he: 'נשארו פחות ממה שביקשתם; בעגלה מה שנשאר.' },\n [CartIssueCode.AmountTooLarge]: { en: 'The order is too large; an item was removed.', he: 'ההזמנה גדולה מדי; פריט הוסר.' },\n [CartIssueCode.ShippingUnavailable]: { en: 'That delivery method is not available for this order. Choose another.', he: 'שיטת המשלוח הזו אינה זמינה להזמנה. בחרו אחרת.' },\n [CartIssueCode.VatInvalid]: { en: 'The shop\\'s VAT rate is not set correctly.', he: 'שיעור המע\"מ של החנות אינו מוגדר כראוי.' },\n});\n\nexport interface CartIssue {\n code: CartIssueCode;\n productId?: string;\n variantId?: string | null;\n /** What the cart asked for. */\n requested?: number;\n /** What the priced line holds now (clamped / capped). */\n quantity?: number;\n shippingMethodId?: string;\n}\n\nexport interface PricedLine {\n productId: string;\n variantId: string | null;\n title: string;\n variantName: string | null;\n quantity: number;\n unitPrice: Money;\n /** Shown struck through — only when it is above the price. */\n compareAt: Money | null;\n lineTotal: Money;\n requiresShipping: boolean;\n image: string | null;\n}\n\nexport interface PricedCart {\n currency: CurrencyCode;\n lines: PricedLine[];\n subtotal: Money;\n /** Zero until coupons (E4); `total` already subtracts it. */\n discount: Money;\n shipping: Money;\n shippingMethod: ShippingQuote | null;\n requiresShipping: boolean;\n /** subtotal − discount + shipping: what the buyer pays. VAT is INSIDE it. */\n total: Money;\n /** The VAT `total` includes: total × v / (100 + v), rounded once half-to-even (`includedVat`). */\n vat: Money;\n vatPercent: number;\n issues: CartIssue[];\n}\n\ninterface LineRefusal {\n readonly code: CartIssueCode;\n readonly refuses: (entry: CatalogEntry, currency: CurrencyCode) => boolean;\n}\n\n/** Checked in order; the first that refuses drops the line. */\nconst LINE_REFUSALS: readonly LineRefusal[] = Object.freeze([\n { code: CartIssueCode.Unpublished, refuses: (entry: CatalogEntry) => entry.published !== true },\n { code: CartIssueCode.VariantDisabled, refuses: (entry: CatalogEntry) => entry.enabled !== true },\n { code: CartIssueCode.NoPrice, refuses: (entry: CatalogEntry) => !isMoney(entry.unitPrice) || entry.unitPrice.amount < 0 },\n { code: CartIssueCode.CurrencyMismatch, refuses: (entry: CatalogEntry, currency: CurrencyCode) => (entry.unitPrice as Money).currency !== currency },\n { code: CartIssueCode.OutOfStock, refuses: (entry: CatalogEntry) => sellableQuantity(entry) === 0 },\n]);\n\nconst isText = (value: unknown): value is string => typeof value === 'string' && value !== '';\nconst variantOf = (line: CartLine): string | null => (isText(line.variantId) ? line.variantId : null);\nconst validQuantity = (quantity: unknown): quantity is number =>\n typeof quantity === 'number' && Number.isSafeInteger(quantity) && quantity >= 1;\n\ninterface WantedLine {\n productId: string;\n variantId: string | null;\n quantity: number;\n}\n\n/** Drops malformed lines, merges duplicates, keeps the first `MAX_CART_LINES` distinct ones. */\nfunction wantedLines(cart: Cart, issues: CartIssue[]): WantedLine[] {\n const lines: readonly CartLine[] = cart && Array.isArray(cart.lines) ? cart.lines : [];\n const byKey = new Map<string, WantedLine>();\n for (const line of lines) {\n const productId = line && isText(line.productId) ? line.productId : '';\n const variantId = line ? variantOf(line) : null;\n if (!productId) {\n issues.push({ code: CartIssueCode.UnknownProduct });\n continue;\n }\n if (!validQuantity(line.quantity)) {\n issues.push({ code: CartIssueCode.InvalidQuantity, productId, variantId });\n continue;\n }\n const key = catalogKey(productId, variantId);\n const same = byKey.get(key);\n if (same) {\n same.quantity = Math.min(same.quantity + line.quantity, Number.MAX_SAFE_INTEGER);\n issues.push({ code: CartIssueCode.DuplicateLine, productId, variantId });\n continue;\n }\n if (byKey.size >= MAX_CART_LINES) {\n issues.push({ code: CartIssueCode.TooManyLines, productId, variantId });\n continue;\n }\n byKey.set(key, { productId, variantId, quantity: line.quantity });\n }\n return [...byKey.values()];\n}\n\nfunction indexCatalog(catalog: readonly CatalogEntry[]): { entries: Map<string, CatalogEntry>; products: Set<string> } {\n const entries = new Map<string, CatalogEntry>();\n const products = new Set<string>();\n const list: readonly CatalogEntry[] = Array.isArray(catalog) ? catalog : [];\n for (const entry of list) {\n if (!entry || !isText(entry.productId)) continue;\n products.add(entry.productId);\n const key = catalogKey(entry.productId, isText(entry.variantId) ? entry.variantId : null);\n if (!entries.has(key)) entries.set(key, entry);\n }\n return { entries, products };\n}\n\nconst compareAtOf = (entry: CatalogEntry, unitPrice: Money): Money | null =>\n isMoney(entry.compareAt) && entry.compareAt.currency === unitPrice.currency && entry.compareAt.amount > unitPrice.amount\n ? money(entry.compareAt.amount, entry.compareAt.currency)\n : null;\n\nfunction lineTotalWithin(unitPrice: Money, quantity: number, subtotal: Money): Money | null {\n try {\n const lineTotal = timesMoney(unitPrice, quantity);\n return subtotal.amount + lineTotal.amount <= MAX_CART_AMOUNT ? lineTotal : null;\n } catch {\n return null;\n }\n}\n\n/**\n * THE pricing function (C-D7, trap T1): the engine shows its result, iox-cms recomputes it at checkout and at\n * payment. Prices come from the catalog only — a cart line carries no number but a quantity. Every money value\n * out is whole minor units in the studio currency. An unusable line is dropped or adjusted and SAID in `issues`.\n */\nexport function priceCart(cart: Cart, catalog: readonly CatalogEntry[], studio: StudioCommerce, choice?: PricingChoice | null): PricedCart {\n const currency = studio.currency;\n currencyExponent(currency);\n const issues: CartIssue[] = [];\n const { entries, products } = indexCatalog(catalog);\n const lines: PricedLine[] = [];\n let subtotal = money(0, currency);\n\n for (const wanted of wantedLines(cart, issues)) {\n const { productId, variantId } = wanted;\n const entry = entries.get(catalogKey(productId, variantId));\n if (!entry) {\n issues.push({ code: products.has(productId) ? CartIssueCode.UnknownVariant : CartIssueCode.UnknownProduct, productId, variantId });\n continue;\n }\n const refusal = LINE_REFUSALS.find(rule => rule.refuses(entry, currency));\n if (refusal) {\n issues.push({ code: refusal.code, productId, variantId, requested: wanted.quantity });\n continue;\n }\n let quantity = wanted.quantity;\n if (quantity > MAX_LINE_QUANTITY) {\n quantity = MAX_LINE_QUANTITY;\n issues.push({ code: CartIssueCode.QuantityCapped, productId, variantId, requested: wanted.quantity, quantity });\n }\n const left = sellableQuantity(entry);\n if (left !== null && quantity > left) {\n const requested = quantity;\n quantity = left;\n issues.push({ code: CartIssueCode.QuantityClamped, productId, variantId, requested, quantity });\n }\n const unitPrice = money((entry.unitPrice as Money).amount, currency);\n const lineTotal = lineTotalWithin(unitPrice, quantity, subtotal);\n if (!lineTotal) {\n issues.push({ code: CartIssueCode.AmountTooLarge, productId, variantId, requested: wanted.quantity });\n continue;\n }\n subtotal = addMoney(subtotal, lineTotal);\n lines.push({\n productId,\n variantId,\n title: String(entry.title ?? ''),\n variantName: isText(entry.variantName) ? entry.variantName : null,\n quantity,\n unitPrice,\n compareAt: compareAtOf(entry, unitPrice),\n lineTotal,\n requiresShipping: entry.requiresShipping !== false,\n image: isText(entry.image) ? entry.image : null,\n });\n }\n\n const discount = money(0, currency);\n const goods = subtractMoney(subtotal, discount);\n const requiresShipping = lines.some(line => line.requiresShipping);\n const chosenId = choice && isText(choice.shippingMethodId) ? choice.shippingMethodId : null;\n const quotes = chosenId ? quoteShipping(studio.shippingMethods, { currency, goods, requiresShipping, lineCount: lines.length }) : [];\n const shippingMethod = chosenId ? quotes.find(quote => quote.methodId === chosenId) ?? null : null;\n if (chosenId && !shippingMethod) issues.push({ code: CartIssueCode.ShippingUnavailable, shippingMethodId: chosenId });\n const shipping = shippingMethod ? shippingMethod.price : money(0, currency);\n const total = addMoney(goods, shipping);\n const vatUsable = isVatPercent(studio.vatPercent);\n if (!vatUsable) issues.push({ code: CartIssueCode.VatInvalid });\n\n return {\n currency,\n lines,\n subtotal,\n discount,\n shipping,\n shippingMethod,\n requiresShipping,\n total,\n vat: vatUsable ? includedVat(total, studio.vatPercent) : money(0, currency),\n vatPercent: vatUsable ? studio.vatPercent : 0,\n issues,\n };\n}\n\n/** The cart a priced cart stands for — what to store back once the buyer has seen the issues. */\nexport function cartOf(priced: PricedCart): Cart {\n return { lines: priced.lines.map(line => ({ productId: line.productId, variantId: line.variantId, quantity: line.quantity })) };\n}\n\n/** Sign-in merge (E3): b's lines join a's; the same product and variant add up. priceCart caps and clamps later. */\nexport function mergeCarts(a: Cart, b: Cart): Cart {\n const merged: CartLine[] = [];\n const byKey = new Map<string, CartLine>();\n const all: CartLine[] = [...(Array.isArray(a?.lines) ? a.lines : []), ...(Array.isArray(b?.lines) ? b.lines : [])];\n for (const line of all.filter(each => !!each && isText(each.productId))) {\n const key = catalogKey(line.productId, variantOf(line));\n const same = byKey.get(key);\n if (same && validQuantity(same.quantity) && validQuantity(line.quantity)) {\n same.quantity = Math.min(same.quantity + line.quantity, Number.MAX_SAFE_INTEGER);\n continue;\n }\n const copy = { productId: line.productId, variantId: variantOf(line), quantity: line.quantity };\n if (!same) byKey.set(key, copy);\n merged.push(copy);\n }\n return { lines: merged };\n}\n","import { CommerceLabel, CommerceLanguage, commerceLanguage, labelIn } from './labels';\nimport { formatMoney, Money } from './money';\nimport { isShippingMethodKind, ShippingMethodKind, SHIPPING_KINDS } from './shipping';\nimport { filled, looksLikeIsraeliMobile } from './text';\n\nexport enum PaymentChannel {\n /** The owner marks the order paid (C-D11). */\n Manual = 'manual',\n /** The studio's PSP; only its verified callback marks the order paid. */\n Online = 'online',\n}\n\nexport enum PaymentMethodKind {\n BankTransfer = 'bankTransfer',\n PayOnPickup = 'payOnPickup',\n CashOnDelivery = 'cashOnDelivery',\n Bit = 'bit',\n /** A PSP's hosted page (E2, Cardcom first) — typed now, not offered yet. */\n Online = 'online',\n}\n\nexport enum PaymentProvider {\n Cardcom = 'cardcom',\n}\n\n/** What an owner fills for a method. */\nexport enum PaymentField {\n AccountName = 'accountName',\n Bank = 'bank',\n Branch = 'branch',\n AccountNumber = 'accountNumber',\n BitPhone = 'bitPhone',\n Provider = 'provider',\n}\n\n/** Which deliveries a method can be used with. */\nexport enum DeliveryFit {\n Any = 'any',\n /** Paid at the counter: only with a pickup method. */\n PickupOnly = 'pickupOnly',\n /** Paid to the courier: only with a method that delivers to an address. */\n AddressOnly = 'addressOnly',\n}\n\ninterface PaymentMethodRule {\n readonly channel: PaymentChannel;\n /** false = typed for a later phase, never shown to a buyer. */\n readonly offered: boolean;\n readonly fields: readonly PaymentField[];\n readonly fit: DeliveryFit;\n readonly label: CommerceLabel;\n /** What the buyer reads after placing the order; `{total}`, `{orderNumber}` and the method's fields fill in. */\n readonly instructions: CommerceLabel;\n}\n\nexport const PAYMENT_METHODS: Readonly<Record<PaymentMethodKind, PaymentMethodRule>> = Object.freeze({\n [PaymentMethodKind.BankTransfer]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [PaymentField.AccountName, PaymentField.Bank, PaymentField.Branch, PaymentField.AccountNumber],\n fit: DeliveryFit.Any,\n label: { en: 'Bank transfer', he: 'העברה בנקאית' },\n instructions: {\n en: 'Transfer {total} to {accountName}, bank {bank}, branch {branch}, account {accountNumber}. Write order {orderNumber} in the transfer\\'s reference. We will confirm your order once the money arrives.',\n he: 'העבירו {total} לחשבון על שם {accountName}, בנק {bank}, סניף {branch}, חשבון {accountNumber}. ציינו את מספר ההזמנה {orderNumber} בפרטי ההעברה. נאשר את ההזמנה כשהכסף יגיע.',\n },\n },\n [PaymentMethodKind.PayOnPickup]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [],\n fit: DeliveryFit.PickupOnly,\n label: { en: 'Pay on pickup', he: 'תשלום באיסוף' },\n instructions: {\n en: 'Pay {total} when you pick up order {orderNumber}.',\n he: 'שלמו {total} כשאתם אוספים את הזמנה {orderNumber}.',\n },\n },\n [PaymentMethodKind.CashOnDelivery]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [],\n fit: DeliveryFit.AddressOnly,\n label: { en: 'Cash on delivery', he: 'מזומן במסירה' },\n instructions: {\n en: 'Pay {total} in cash when order {orderNumber} is delivered.',\n he: 'שלמו {total} במזומן כשהזמנה {orderNumber} נמסרת לכם.',\n },\n },\n [PaymentMethodKind.Bit]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [PaymentField.BitPhone],\n fit: DeliveryFit.Any,\n label: { en: 'Bit', he: 'ביט' },\n instructions: {\n en: 'Send {total} with Bit to {bitPhone}. Write order {orderNumber} in the note. We will confirm your order once the payment arrives.',\n he: 'שלחו {total} בביט למספר {bitPhone}. ציינו את מספר ההזמנה {orderNumber} בהערה. נאשר את ההזמנה כשהתשלום יגיע.',\n },\n },\n [PaymentMethodKind.Online]: {\n channel: PaymentChannel.Online,\n offered: false,\n fields: [PaymentField.Provider],\n fit: DeliveryFit.Any,\n label: { en: 'Card', he: 'כרטיס אשראי' },\n instructions: {\n en: 'You will pay {total} for order {orderNumber} on a secure payment page.',\n he: 'תשלמו {total} עבור הזמנה {orderNumber} בעמוד תשלום מאובטח.',\n },\n },\n});\n\nexport const PAYMENT_FIELD_LABELS: Readonly<Record<PaymentField, CommerceLabel>> = Object.freeze({\n [PaymentField.AccountName]: { en: 'Account holder', he: 'שם בעל החשבון' },\n [PaymentField.Bank]: { en: 'Bank', he: 'בנק' },\n [PaymentField.Branch]: { en: 'Branch', he: 'סניף' },\n [PaymentField.AccountNumber]: { en: 'Account number', he: 'מספר חשבון' },\n [PaymentField.BitPhone]: { en: 'Phone number for Bit', he: 'מספר טלפון לביט' },\n [PaymentField.Provider]: { en: 'Payment provider', he: 'ספק סליקה' },\n});\n\nconst isPaymentProvider = (value: unknown): boolean =>\n typeof value === 'string' && (Object.values(PaymentProvider) as string[]).includes(value);\n\nconst PAYMENT_FIELD_CHECKS: Readonly<Record<PaymentField, (value: unknown) => boolean>> = Object.freeze({\n [PaymentField.AccountName]: filled,\n [PaymentField.Bank]: filled,\n [PaymentField.Branch]: filled,\n [PaymentField.AccountNumber]: filled,\n [PaymentField.BitPhone]: looksLikeIsraeliMobile,\n [PaymentField.Provider]: isPaymentProvider,\n});\n\nconst DELIVERY_FITS: Readonly<Record<DeliveryFit, (kind: ShippingMethodKind | null) => boolean>> = Object.freeze({\n [DeliveryFit.Any]: () => true,\n [DeliveryFit.PickupOnly]: (kind: ShippingMethodKind | null) => kind === ShippingMethodKind.Pickup,\n [DeliveryFit.AddressOnly]: (kind: ShippingMethodKind | null) => !!kind && isShippingMethodKind(kind) && SHIPPING_KINDS[kind].needsAddress,\n});\n\nexport interface PaymentMethodConfig {\n kind: PaymentMethodKind;\n enabled: boolean;\n details?: Partial<Record<PaymentField, string>> | null;\n /** The owner's own words, shown after the instructions. */\n note?: string | null;\n}\n\nexport const isPaymentMethodKind = (value: unknown): value is PaymentMethodKind =>\n typeof value === 'string' && Object.prototype.hasOwnProperty.call(PAYMENT_METHODS, value);\n\nexport function paymentChannelOf(kind: PaymentMethodKind): PaymentChannel {\n return PAYMENT_METHODS[kind].channel;\n}\n\n/** The fields a method lacks or holds in a form it cannot be paid with. */\nexport function paymentMethodProblems(config: PaymentMethodConfig): PaymentField[] {\n if (!config || !isPaymentMethodKind(config.kind)) return [];\n const details = config.details ?? {};\n return PAYMENT_METHODS[config.kind].fields.filter(field => !PAYMENT_FIELD_CHECKS[field](details[field]));\n}\n\n/** Enabled, offered in this phase, complete: the ONE rule the checkout and its gate read. */\nexport function paymentMethodReady(config: PaymentMethodConfig): boolean {\n return !!config && isPaymentMethodKind(config.kind) && config.enabled === true\n && PAYMENT_METHODS[config.kind].offered && paymentMethodProblems(config).length === 0;\n}\n\n/** The methods a buyer may pick with this delivery (null = nothing ships). */\nexport function usablePaymentMethods(configs: readonly PaymentMethodConfig[], shippingKind?: ShippingMethodKind | null): PaymentMethodConfig[] {\n const seen = new Set<PaymentMethodKind>();\n const list: readonly PaymentMethodConfig[] = Array.isArray(configs) ? configs : [];\n return list.filter(config =>\n paymentMethodReady(config)\n && DELIVERY_FITS[PAYMENT_METHODS[config.kind].fit](shippingKind ?? null)\n && !seen.has(config.kind) && !!seen.add(config.kind));\n}\n\nconst LOCALES: Readonly<Record<CommerceLanguage, string>> = Object.freeze({ [CommerceLanguage.En]: 'en-US', [CommerceLanguage.He]: 'he-IL' });\n\n/** What the buyer is told to do, in their language: the method's sentence with the order, the amount and the owner's details, then the owner's note. */\nexport function paymentInstructions(\n config: PaymentMethodConfig,\n order: { orderNumber: string; total: Money },\n lang: string | null | undefined,\n locale?: string,\n): string {\n const rule = PAYMENT_METHODS[config.kind];\n const values: Record<string, string> = {\n ...(config.details ?? {}),\n orderNumber: order.orderNumber,\n total: formatMoney(order.total, locale ?? LOCALES[commerceLanguage(lang)]),\n };\n const sentence = labelIn(rule.instructions, lang).replace(/\\{(\\w+)\\}/g, (_match, name: string) => values[name] ?? '');\n return filled(config.note) ? `${sentence}\\n${config.note.trim()}` : sentence;\n}\n","import { CommerceLabel } from './labels';\nimport { PaymentChannel, paymentChannelOf, PaymentMethodKind } from './payments';\n\n/** C-D11 — the order's closed states. */\nexport enum OrderState {\n /** A manual method: waiting for the owner to see the money. */\n AwaitingPayment = 'awaiting_payment',\n /** An online method: the PSP's page is open. */\n PendingPayment = 'pending_payment',\n Paid = 'paid',\n Fulfilled = 'fulfilled',\n Delivered = 'delivered',\n Cancelled = 'cancelled',\n PaymentFailed = 'payment_failed',\n Refunded = 'refunded',\n PartiallyRefunded = 'partially_refunded',\n}\n\nexport enum OrderEvent {\n /** The buyer tries to pay again after a failure. */\n StartPayment = 'startPayment',\n /** The PSP's verified callback says paid. */\n ConfirmPayment = 'confirmPayment',\n FailPayment = 'failPayment',\n /** The owner saw the money of a manual method. */\n MarkPaid = 'markPaid',\n Fulfil = 'fulfil',\n Deliver = 'deliver',\n Cancel = 'cancel',\n /** Nobody paid in time (the jobs runner). */\n Expire = 'expire',\n Refund = 'refund',\n PartialRefund = 'partialRefund',\n}\n\nexport enum OrderActor {\n Buyer = 'buyer',\n Owner = 'owner',\n /** A VERIFIED payment callback (trap T2) — never the browser's return redirect. */\n PaymentCallback = 'paymentCallback',\n System = 'system',\n}\n\n/** What an order holds of the stock in a state (C-D10). */\nexport enum StockHold {\n None = 'none',\n /** Held for `STOCK_RESERVATION_MINUTES` while a PSP payment is open. */\n Reserved = 'reserved',\n /** Decremented: sold, or promised to a manual order. */\n Taken = 'taken',\n}\n\n/** What the server does to stock when an order moves — read from data, never decided per call site. */\nexport enum StockEffect {\n None = 'none',\n Reserve = 'reserve',\n CommitReservation = 'commitReservation',\n ReleaseReservation = 'releaseReservation',\n /** The conditional atomic decrement (E0's `takeStock`). */\n Take = 'take',\n GiveBack = 'giveBack',\n}\n\nexport enum OrderRefusal {\n /** The event does not apply in this state. */\n InvalidTransition = 'invalid-transition',\n /** It applies — but not from this actor (e.g. the owner marking an online payment paid). */\n ActorNotAllowed = 'actor-not-allowed',\n /** Cancelled and refunded orders move no more. */\n OrderFinal = 'order-final',\n}\n\nexport const STOCK_RESERVATION_MINUTES = 15;\n\nexport const ORDER_STOCK_HOLD: Readonly<Record<OrderState, StockHold>> = Object.freeze({\n [OrderState.AwaitingPayment]: StockHold.Taken,\n [OrderState.PendingPayment]: StockHold.Reserved,\n [OrderState.Paid]: StockHold.Taken,\n [OrderState.Fulfilled]: StockHold.Taken,\n [OrderState.Delivered]: StockHold.Taken,\n [OrderState.Cancelled]: StockHold.None,\n [OrderState.PaymentFailed]: StockHold.None,\n /** A refund never restocks by itself: whether the goods came back is the owner's to say. */\n [OrderState.Refunded]: StockHold.Taken,\n [OrderState.PartiallyRefunded]: StockHold.Taken,\n});\n\n/** from-hold → to-hold → effect. Taken → Reserved never happens (the transitions spec proves it). */\nexport const STOCK_EFFECTS: Readonly<Record<StockHold, Readonly<Record<StockHold, StockEffect>>>> = Object.freeze({\n [StockHold.None]: { [StockHold.None]: StockEffect.None, [StockHold.Reserved]: StockEffect.Reserve, [StockHold.Taken]: StockEffect.Take },\n [StockHold.Reserved]: { [StockHold.None]: StockEffect.ReleaseReservation, [StockHold.Reserved]: StockEffect.None, [StockHold.Taken]: StockEffect.CommitReservation },\n [StockHold.Taken]: { [StockHold.None]: StockEffect.GiveBack, [StockHold.Reserved]: StockEffect.None, [StockHold.Taken]: StockEffect.None },\n});\n\nexport const FINAL_ORDER_STATES: readonly OrderState[] = Object.freeze([OrderState.Cancelled, OrderState.Refunded]);\n\nexport interface OrderTransition {\n readonly from: OrderState;\n readonly event: OrderEvent;\n readonly to: OrderState;\n readonly actors: readonly OrderActor[];\n}\n\nconst OWNER = [OrderActor.Owner];\nconst CALLBACK = [OrderActor.PaymentCallback];\nconst SYSTEM = [OrderActor.System];\nconst REFUNDERS = [OrderActor.Owner, OrderActor.PaymentCallback];\nconst REFUNDABLE = [OrderState.Paid, OrderState.Fulfilled, OrderState.Delivered, OrderState.PartiallyRefunded];\n\n/** THE order state machine (C-D11). Anything not listed is refused. */\nexport const ORDER_TRANSITIONS: readonly OrderTransition[] = Object.freeze([\n { from: OrderState.AwaitingPayment, event: OrderEvent.MarkPaid, to: OrderState.Paid, actors: OWNER },\n { from: OrderState.AwaitingPayment, event: OrderEvent.Cancel, to: OrderState.Cancelled, actors: OWNER },\n { from: OrderState.AwaitingPayment, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.PendingPayment, event: OrderEvent.ConfirmPayment, to: OrderState.Paid, actors: CALLBACK },\n { from: OrderState.PendingPayment, event: OrderEvent.FailPayment, to: OrderState.PaymentFailed, actors: CALLBACK },\n { from: OrderState.PendingPayment, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.PaymentFailed, event: OrderEvent.StartPayment, to: OrderState.PendingPayment, actors: [OrderActor.Buyer] },\n { from: OrderState.PaymentFailed, event: OrderEvent.ConfirmPayment, to: OrderState.Paid, actors: CALLBACK },\n { from: OrderState.PaymentFailed, event: OrderEvent.Cancel, to: OrderState.Cancelled, actors: OWNER },\n { from: OrderState.PaymentFailed, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.Paid, event: OrderEvent.Fulfil, to: OrderState.Fulfilled, actors: OWNER },\n { from: OrderState.PartiallyRefunded, event: OrderEvent.Fulfil, to: OrderState.Fulfilled, actors: OWNER },\n { from: OrderState.Fulfilled, event: OrderEvent.Deliver, to: OrderState.Delivered, actors: OWNER },\n ...REFUNDABLE.map(from => ({ from, event: OrderEvent.Refund, to: OrderState.Refunded, actors: REFUNDERS })),\n ...REFUNDABLE.map(from => ({ from, event: OrderEvent.PartialRefund, to: OrderState.PartiallyRefunded, actors: REFUNDERS })),\n]);\n\nexport type OrderMove =\n | { ok: true; state: OrderState; stock: StockEffect }\n | { ok: false; refusal: OrderRefusal };\n\nexport function stockEffect(from: OrderState | null, to: OrderState): StockEffect {\n return STOCK_EFFECTS[from === null ? StockHold.None : ORDER_STOCK_HOLD[from]][ORDER_STOCK_HOLD[to]];\n}\n\n/** The ONE place an order moves: the next state and what to do to the stock, or why not. */\nexport function nextOrderState(state: OrderState, event: OrderEvent, actor: OrderActor): OrderMove {\n const transition = ORDER_TRANSITIONS.find(each => each.from === state && each.event === event);\n if (!transition) {\n return { ok: false, refusal: FINAL_ORDER_STATES.includes(state) ? OrderRefusal.OrderFinal : OrderRefusal.InvalidTransition };\n }\n if (!transition.actors.includes(actor)) return { ok: false, refusal: OrderRefusal.ActorNotAllowed };\n return { ok: true, state: transition.to, stock: stockEffect(state, transition.to) };\n}\n\nconst OPENING_STATE: Readonly<Record<PaymentChannel, OrderState>> = Object.freeze({\n [PaymentChannel.Manual]: OrderState.AwaitingPayment,\n [PaymentChannel.Online]: OrderState.PendingPayment,\n});\n\n/** A new order's state and stock effect: a manual order takes its stock at once, an online one reserves it. */\nexport function openingOrderState(kind: PaymentMethodKind): { state: OrderState; stock: StockEffect } {\n const state = OPENING_STATE[paymentChannelOf(kind)];\n return { state, stock: stockEffect(null, state) };\n}\n\nexport function reservationExpiresAt(now: Date): Date {\n return new Date(now.getTime() + STOCK_RESERVATION_MINUTES * 60000);\n}\n\nexport const ORDER_STATE_LABELS: Readonly<Record<OrderState, CommerceLabel>> = Object.freeze({\n [OrderState.AwaitingPayment]: { en: 'Awaiting payment', he: 'ממתינה לתשלום' },\n [OrderState.PendingPayment]: { en: 'Payment in progress', he: 'תשלום בתהליך' },\n [OrderState.Paid]: { en: 'Paid', he: 'שולמה' },\n [OrderState.Fulfilled]: { en: 'Fulfilled', he: 'טופלה' },\n [OrderState.Delivered]: { en: 'Delivered', he: 'נמסרה' },\n [OrderState.Cancelled]: { en: 'Cancelled', he: 'בוטלה' },\n [OrderState.PaymentFailed]: { en: 'Payment failed', he: 'התשלום נכשל' },\n [OrderState.Refunded]: { en: 'Refunded', he: 'זוכתה' },\n [OrderState.PartiallyRefunded]: { en: 'Partly refunded', he: 'זוכתה חלקית' },\n});\n","import { CurrencyCode, isCurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { paymentMethodReady, PaymentMethodConfig } from './payments';\nimport { ShippingMethod, shippingMethodReady, SHIPPING_KINDS } from './shipping';\nimport { filled, looksLikeEmail, looksLikePhone } from './text';\nimport { isVatPercent } from './vat';\n\n/** The fixed checkout's steps, in order (C-D3); a checkout keeps the FURTHEST it reached (the journey, §3g). */\nexport enum CheckoutStep {\n Contact = 'contact',\n Delivery = 'delivery',\n Payment = 'payment',\n Paid = 'paid',\n}\n\nexport const CHECKOUT_STEPS: readonly CheckoutStep[] = Object.freeze([\n CheckoutStep.Contact,\n CheckoutStep.Delivery,\n CheckoutStep.Payment,\n CheckoutStep.Paid,\n]);\n\nexport const CHECKOUT_STEP_LABELS: Readonly<Record<CheckoutStep, CommerceLabel>> = Object.freeze({\n [CheckoutStep.Contact]: { en: 'Contact', he: 'פרטי קשר' },\n [CheckoutStep.Delivery]: { en: 'Delivery', he: 'משלוח' },\n [CheckoutStep.Payment]: { en: 'Payment', he: 'תשלום' },\n [CheckoutStep.Paid]: { en: 'Paid', he: 'שולם' },\n});\n\nexport function furthestStep(a: CheckoutStep | null | undefined, b: CheckoutStep | null | undefined): CheckoutStep {\n const rank = (step: CheckoutStep | null | undefined) => (step ? CHECKOUT_STEPS.indexOf(step) : -1);\n const best = rank(a) >= rank(b) ? a : b;\n return best && CHECKOUT_STEPS.includes(best) ? best : CheckoutStep.Contact;\n}\n\n/** The pages the OWNER writes and links from checkout (§3k). IOX never writes their text (T14). */\nexport enum LegalPage {\n Terms = 'terms',\n Returns = 'returns',\n Shipping = 'shipping',\n Privacy = 'privacy',\n}\n\n/** Who sells, as Israel's Consumer Protection Law asks a distance seller to say (§3k). */\nexport interface BusinessIdentity {\n legalName?: string | null;\n /** עוסק מורשה / ח.פ / ת.ז */\n businessNumber?: string | null;\n address?: string | null;\n email?: string | null;\n phone?: string | null;\n}\n\nexport interface CheckoutGateFacts {\n currency: unknown;\n vatPercent: unknown;\n paymentMethods: readonly PaymentMethodConfig[];\n shippingMethods: readonly ShippingMethod[];\n /** Any product of the studio that is not digital. */\n anyProductShips: boolean;\n business: BusinessIdentity;\n /** Each page exists and checkout links it. */\n legalPages: Partial<Record<LegalPage, boolean>>;\n}\n\nexport enum CheckoutGateArea {\n Payment = 'payment',\n Money = 'money',\n Shipping = 'shipping',\n Business = 'business',\n LegalPages = 'legalPages',\n}\n\nexport enum CheckoutGateCode {\n NoPaymentMethod = 'no-payment-method',\n CurrencyNotSet = 'currency-not-set',\n VatNotSet = 'vat-not-set',\n NoShippingMethod = 'no-shipping-method',\n BusinessNameMissing = 'business-name-missing',\n BusinessNumberMissing = 'business-number-missing',\n BusinessAddressMissing = 'business-address-missing',\n BusinessEmailMissing = 'business-email-missing',\n BusinessPhoneMissing = 'business-phone-missing',\n TermsPageMissing = 'terms-page-missing',\n ReturnsPageMissing = 'returns-page-missing',\n ShippingPageMissing = 'shipping-page-missing',\n PrivacyPageMissing = 'privacy-page-missing',\n}\n\ninterface CheckoutGateRule {\n readonly code: CheckoutGateCode;\n readonly area: CheckoutGateArea;\n readonly refuses: (facts: CheckoutGateFacts) => boolean;\n readonly label: CommerceLabel;\n}\n\nconst ships = (facts: CheckoutGateFacts) => facts.anyProductShips === true;\nconst page = (facts: CheckoutGateFacts, which: LegalPage) => facts.legalPages?.[which] === true;\nconst business = (facts: CheckoutGateFacts): BusinessIdentity => facts.business ?? {};\n\n/** THE checkout gate (C-D19), in the order the owner fixes things. The server refuses with it; the admin shows the same rows. */\nexport const CHECKOUT_GATE_RULES: readonly CheckoutGateRule[] = Object.freeze([\n {\n code: CheckoutGateCode.NoPaymentMethod,\n area: CheckoutGateArea.Payment,\n refuses: (facts: CheckoutGateFacts) => !(facts.paymentMethods ?? []).some(paymentMethodReady),\n label: { en: 'Turn on a way to get paid', he: 'הפעילו אמצעי תשלום' },\n },\n {\n code: CheckoutGateCode.CurrencyNotSet,\n area: CheckoutGateArea.Money,\n refuses: (facts: CheckoutGateFacts) => !isCurrencyCode(facts.currency),\n label: { en: 'Set the shop\\'s currency', he: 'הגדירו את מטבע החנות' },\n },\n {\n code: CheckoutGateCode.VatNotSet,\n area: CheckoutGateArea.Money,\n refuses: (facts: CheckoutGateFacts) => !isVatPercent(facts.vatPercent),\n label: { en: 'Set the VAT rate', he: 'הגדירו את שיעור המע\"מ' },\n },\n {\n code: CheckoutGateCode.NoShippingMethod,\n area: CheckoutGateArea.Shipping,\n refuses: (facts: CheckoutGateFacts) => ships(facts) && !(isCurrencyCode(facts.currency)\n && (facts.shippingMethods ?? []).some(method => shippingMethodReady(method, facts.currency as CurrencyCode)\n && SHIPPING_KINDS[method.kind].forPhysical)),\n label: { en: 'Add a delivery or pickup method', he: 'הוסיפו שיטת משלוח או איסוף' },\n },\n {\n code: CheckoutGateCode.BusinessNameMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).legalName),\n label: { en: 'Add the business\\'s legal name', he: 'הוסיפו את השם הרשמי של העסק' },\n },\n {\n code: CheckoutGateCode.BusinessNumberMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).businessNumber),\n label: { en: 'Add the business number (company or VAT dealer number)', he: 'הוסיפו מספר עוסק או ח.פ' },\n },\n {\n code: CheckoutGateCode.BusinessAddressMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).address),\n label: { en: 'Add the business address', he: 'הוסיפו את כתובת העסק' },\n },\n {\n code: CheckoutGateCode.BusinessEmailMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !looksLikeEmail(business(facts).email),\n label: { en: 'Add an email buyers can write to', he: 'הוסיפו כתובת אימייל לפניות קונים' },\n },\n {\n code: CheckoutGateCode.BusinessPhoneMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !looksLikePhone(business(facts).phone),\n label: { en: 'Add a phone number buyers can call', he: 'הוסיפו מספר טלפון לפניות קונים' },\n },\n {\n code: CheckoutGateCode.TermsPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Terms),\n label: { en: 'Write your terms of sale page', he: 'כתבו עמוד תקנון ותנאי מכירה' },\n },\n {\n code: CheckoutGateCode.ReturnsPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Returns),\n label: { en: 'Write your returns and cancellation page', he: 'כתבו עמוד מדיניות החזרות וביטולים' },\n },\n {\n code: CheckoutGateCode.ShippingPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => ships(facts) && !page(facts, LegalPage.Shipping),\n label: { en: 'Write your shipping page', he: 'כתבו עמוד מדיניות משלוחים' },\n },\n {\n code: CheckoutGateCode.PrivacyPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Privacy),\n label: { en: 'Write your privacy page', he: 'כתבו עמוד מדיניות פרטיות' },\n },\n]);\n\nexport interface CheckoutGateRefusal {\n code: CheckoutGateCode;\n area: CheckoutGateArea;\n label: CommerceLabel;\n}\n\nexport interface CheckoutGateResult {\n open: boolean;\n refusals: CheckoutGateRefusal[];\n}\n\n/** Checkout opens only when no rule refuses (C-D19, trap T9: the server's, never a hidden button). */\nexport function checkoutGate(facts: CheckoutGateFacts): CheckoutGateResult {\n const refusals = CHECKOUT_GATE_RULES\n .filter(rule => rule.refuses(facts))\n .map(rule => ({ code: rule.code, area: rule.area, label: rule.label }));\n return { open: refusals.length === 0, refusals };\n}\n","import { PricedCart } from './cart';\nimport { CurrencyCode } from './currency';\nimport { Money, money } from './money';\nimport { PaymentChannel, paymentChannelOf, PaymentField, PaymentMethodConfig, PaymentMethodKind, usablePaymentMethods } from './payments';\nimport { ShippingMethodKind } from './shipping';\nimport { filled, looksLikeEmail } from './text';\n\nexport interface PostalAddress {\n line1: string;\n line2?: string | null;\n city: string;\n postalCode?: string | null;\n /** ISO 3166-1 alpha-2 — one country in v1 (C-D9). */\n country: string;\n}\n\nexport interface OrderBuyer {\n email: string;\n name: string;\n phone?: string | null;\n /** Needed when the delivery method delivers to an address. */\n address?: PostalAddress | null;\n}\n\nexport enum OrderSnapshotRefusal {\n EmptyCart = 'empty-cart',\n /** The priced cart has issues the buyer has not seen: show them the priced cart first. */\n CartChanged = 'cart-changed',\n ShippingNotChosen = 'shipping-not-chosen',\n AddressRequired = 'address-required',\n EmailRequired = 'email-required',\n NameRequired = 'name-required',\n /** Not enabled, not complete, not offered yet, or not usable with this delivery. */\n PaymentMethodUnusable = 'payment-method-unusable',\n}\n\nexport interface OrderSnapshotLine {\n readonly productId: string;\n readonly variantId: string | null;\n readonly title: string;\n readonly variantName: string | null;\n readonly quantity: number;\n readonly unitPrice: Money;\n readonly lineTotal: Money;\n readonly requiresShipping: boolean;\n}\n\n/** What an order stores: frozen, so a later price, name or bank-detail change never changes a placed order. */\nexport interface OrderSnapshot {\n readonly currency: CurrencyCode;\n readonly lines: readonly OrderSnapshotLine[];\n readonly subtotal: Money;\n readonly discount: Money;\n readonly shipping: Money;\n readonly delivery: { readonly methodId: string; readonly kind: ShippingMethodKind; readonly name: string } | null;\n readonly total: Money;\n readonly vat: { readonly percent: number; readonly amount: Money };\n readonly payment: {\n readonly kind: PaymentMethodKind;\n readonly channel: PaymentChannel;\n readonly details: Readonly<Partial<Record<PaymentField, string>>>;\n readonly note: string | null;\n };\n readonly buyer: Readonly<OrderBuyer>;\n}\n\nexport type OrderSnapshotResult =\n | { ok: true; snapshot: OrderSnapshot }\n | { ok: false; refusals: OrderSnapshotRefusal[] };\n\nfunction deepFreeze<T>(value: T): T {\n if (value && typeof value === 'object' && !Object.isFrozen(value)) {\n Object.freeze(value);\n for (const key of Object.keys(value as object)) deepFreeze((value as Record<string, unknown>)[key]);\n }\n return value;\n}\n\nconst copyMoney = (value: Money): Money => money(value.amount, value.currency);\nconst text = (value: unknown): string | null => (filled(value) ? value.trim() : null);\n\nfunction copyAddress(address: PostalAddress | null | undefined): PostalAddress | null {\n if (!address || !filled(address.line1) || !filled(address.city) || !filled(address.country)) return null;\n return {\n line1: address.line1.trim(),\n line2: text(address.line2),\n city: address.city.trim(),\n postalCode: text(address.postalCode),\n country: address.country.trim(),\n };\n}\n\ninterface SnapshotRule {\n readonly refusal: OrderSnapshotRefusal;\n readonly refuses: (priced: PricedCart, payment: PaymentMethodConfig, buyer: OrderBuyer) => boolean;\n}\n\nconst SNAPSHOT_RULES: readonly SnapshotRule[] = Object.freeze([\n { refusal: OrderSnapshotRefusal.EmptyCart, refuses: (priced: PricedCart) => !priced.lines.length },\n { refusal: OrderSnapshotRefusal.CartChanged, refuses: (priced: PricedCart) => priced.issues.length > 0 },\n { refusal: OrderSnapshotRefusal.ShippingNotChosen, refuses: (priced: PricedCart) => priced.requiresShipping && !priced.shippingMethod },\n {\n refusal: OrderSnapshotRefusal.AddressRequired,\n refuses: (priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !!priced.shippingMethod?.needsAddress && !copyAddress(buyer?.address),\n },\n { refusal: OrderSnapshotRefusal.EmailRequired, refuses: (_priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !looksLikeEmail(buyer?.email) },\n { refusal: OrderSnapshotRefusal.NameRequired, refuses: (_priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !filled(buyer?.name) },\n {\n refusal: OrderSnapshotRefusal.PaymentMethodUnusable,\n refuses: (priced: PricedCart, payment: PaymentMethodConfig) => usablePaymentMethods([payment], priced.shippingMethod?.kind ?? null).length === 0,\n },\n]);\n\n/** Freezes what an order stores (lines, unit prices, totals, VAT, currency, delivery, payment, buyer) — or says why it cannot. */\nexport function orderSnapshot(pricedCart: PricedCart, payment: PaymentMethodConfig, buyer: OrderBuyer): OrderSnapshotResult {\n const refusals = SNAPSHOT_RULES.filter(rule => rule.refuses(pricedCart, payment, buyer)).map(rule => rule.refusal);\n if (refusals.length) return { ok: false, refusals };\n const delivery = pricedCart.shippingMethod;\n const snapshot: OrderSnapshot = {\n currency: pricedCart.currency,\n lines: pricedCart.lines.map(line => ({\n productId: line.productId,\n variantId: line.variantId,\n title: line.title,\n variantName: line.variantName,\n quantity: line.quantity,\n unitPrice: copyMoney(line.unitPrice),\n lineTotal: copyMoney(line.lineTotal),\n requiresShipping: line.requiresShipping,\n })),\n subtotal: copyMoney(pricedCart.subtotal),\n discount: copyMoney(pricedCart.discount),\n shipping: copyMoney(pricedCart.shipping),\n delivery: delivery ? { methodId: delivery.methodId, kind: delivery.kind, name: delivery.name } : null,\n total: copyMoney(pricedCart.total),\n vat: { percent: pricedCart.vatPercent, amount: copyMoney(pricedCart.vat) },\n payment: {\n kind: payment.kind,\n channel: paymentChannelOf(payment.kind),\n details: { ...(payment.details ?? {}) },\n note: text(payment.note),\n },\n buyer: {\n email: buyer.email.trim(),\n name: buyer.name.trim(),\n phone: text(buyer.phone),\n address: delivery?.needsAddress ? copyAddress(buyer.address) : null,\n },\n };\n return { ok: true, snapshot: deepFreeze(snapshot) };\n}\n","import { Availability, CatalogEntry } from './catalog';\nimport { CurrencyCode, isCurrencyCode } from './currency';\nimport { isMoney, majorToMinor, migrateMajorPrice, money, Money } from './money';\n\n/**\n * A product's OPTIONS and its VARIANTS as the storefront serves them (iox-cms `storefront-projection.ts`), read into\n * what a product page needs (commerce plan §3i, trap T26): which values each option offers, which of them can still be\n * bought given what is already chosen, and the variant a full choice names.\n *\n * A stored variant has no option map, only a flat NAME — the option values in option order joined by `-` (the admin's\n * `product.component.ts` `generateCombinations`: \"Red-M\"). A name is matched against every combination of the options'\n * values, never split on `-`, so a value that holds a `-` (\"Off-white\") still reads.\n */\nexport const VARIANT_NAME_SEPARATOR = '-';\n/** The one variant row a product with no options keeps (iox-cms `DEFAULT_VARIANT_NAME`). */\nexport const DEFAULT_VARIANT_NAME = 'Default';\n\nexport interface ProductOption {\n name: string;\n values: string[];\n}\n\n/** One variant row as the storefront serves it: prices in MAJOR units of the product's `currency`. */\nexport interface StorefrontVariant {\n _id?: string;\n name?: string;\n enable?: boolean;\n image?: string | null;\n price?: number | string | null;\n compareat?: number | string | null;\n availability?: string | null;\n}\n\n/** A product as the storefront serves it (the allowlist in iox-cms `STOREFRONT_FIELDS`). */\nexport interface StorefrontProduct {\n _id?: string;\n title?: string;\n slug?: string;\n mainImage?: string | null;\n productVariants?: boolean;\n pricing?: { price?: number | string | null; compareat?: number | string | null } | null;\n options?: ReadonlyArray<{ name?: string; values?: ReadonlyArray<unknown> }> | null;\n variants?: ReadonlyArray<StorefrontVariant> | null;\n currency?: string | null;\n availability?: string | null;\n}\n\n/** Option name → the value chosen. */\nexport type VariantChoice = Readonly<Record<string, string>>;\n\n/** One variant, read: its id (null for a product with no variant row), its choice, its money and whether it sells. */\nexport interface ProductVariantView {\n variantId: string | null;\n name: string | null;\n choice: VariantChoice;\n price: Money | null;\n /** Only when it is above the price (shown struck through). */\n compareAt: Money | null;\n image: string | null;\n availability: Availability;\n /** The variant's own switch (a product with no options: true). */\n enabled: boolean;\n /** Can be put in a cart: switched on, priced, not `out`. */\n sellable: boolean;\n}\n\nexport interface OptionValueState {\n value: string;\n /** Some sellable variant has this value, given the choices of the options BEFORE this one. */\n available: boolean;\n selected: boolean;\n}\n\nexport interface OptionState {\n name: string;\n values: OptionValueState[];\n}\n\nconst isRecord = (value: unknown): value is Record<string, any> => !!value && typeof value === 'object' && !Array.isArray(value);\nconst text = (value: unknown): string => (typeof value === 'string' ? value.trim() : typeof value === 'number' && Number.isFinite(value) ? String(value) : '');\n\n/** True for something the storefront could have served as a product: a title and a price or variants. */\nexport function isStorefrontProduct(value: unknown): value is StorefrontProduct {\n return isRecord(value) && typeof value['title'] === 'string' && (isRecord(value['pricing']) || Array.isArray(value['variants']));\n}\n\n/** The product's currency, or null when it names none we know (a price is then never shown — never guessed). */\nexport function productCurrency(product: StorefrontProduct | null | undefined): CurrencyCode | null {\n const code = text(product?.currency).toUpperCase();\n return isCurrencyCode(code) ? code : null;\n}\n\n/** The options a product offers, cleaned: named, each value once, no empty value. None when it has no variants. */\nexport function productOptions(product: StorefrontProduct | null | undefined): ProductOption[] {\n if (!product?.productVariants || !Array.isArray(product.options)) return [];\n const out: ProductOption[] = [];\n for (const raw of product.options) {\n const name = text(raw?.name);\n if (!name || out.some(o => o.name === name)) continue;\n const values: string[] = [];\n for (const v of Array.isArray(raw?.values) ? raw!.values! : []) {\n const value = text(v);\n if (value && !values.includes(value)) values.push(value);\n }\n if (values.length) out.push({ name, values });\n }\n return out;\n}\n\n/** Every full choice of `options`, in the admin's order, with the variant name it writes. */\nfunction combinations(options: ReadonlyArray<ProductOption>): Array<{ name: string; choice: VariantChoice }> {\n let acc: Array<{ parts: string[]; choice: Record<string, string> }> = [{ parts: [], choice: {} }];\n for (const option of options) {\n const next: typeof acc = [];\n for (const partial of acc) {\n for (const value of option.values) next.push({ parts: [...partial.parts, value], choice: { ...partial.choice, [option.name]: value } });\n }\n acc = next;\n }\n return acc.map(c => ({ name: c.parts.join(VARIANT_NAME_SEPARATOR), choice: c.choice }));\n}\n\n/** The choice a stored variant's flat name stands for, or null when no combination of the options writes it. */\nexport function variantChoiceOf(variant: StorefrontVariant | null | undefined, options: ReadonlyArray<ProductOption>): VariantChoice | null {\n const name = text(variant?.name);\n if (!name || !options.length) return null;\n return combinations(options).find(c => c.name === name)?.choice ?? null;\n}\n\n/** A stored major-unit price as Money, or null (no price, a currency we do not know, a value that is no price). */\nexport function storefrontMoney(value: unknown, currency: CurrencyCode | null): Money | null {\n if (!currency) return null;\n if (isMoney(value)) return value.currency === currency ? value : null;\n if (typeof value !== 'number' && typeof value !== 'string') return null;\n if (typeof value === 'string' && value.trim() === '') return null;\n try {\n return money(majorToMinor(value, currency), currency);\n } catch {\n const minor = migrateMajorPrice(value, currency);\n return minor === null ? null : money(minor, currency);\n }\n}\n\nconst AVAILABILITIES = Object.values(Availability) as string[];\n\nfunction availabilityOf(value: unknown, enabled: boolean): Availability {\n if (!enabled) return Availability.Out;\n return AVAILABILITIES.includes(text(value)) ? text(value) as Availability : Availability.InStock;\n}\n\nfunction aboveOnly(compareAt: Money | null, price: Money | null): Money | null {\n return compareAt && price && compareAt.amount > price.amount ? compareAt : null;\n}\n\n/**\n * Every variant of a product, read. A product with no options is ONE view: its Default row's id (or null when it has\n * no row) and the product's own price. A variant whose name matches no combination of the options is left out — the\n * page cannot offer what it cannot name.\n */\nexport function productVariants(product: StorefrontProduct | null | undefined): ProductVariantView[] {\n if (!product) return [];\n const currency = productCurrency(product);\n const options = productOptions(product);\n const rows: StorefrontVariant[] = Array.isArray(product.variants) ? product.variants.filter(isRecord) as StorefrontVariant[] : [];\n const view = (row: StorefrontVariant | null, choice: VariantChoice, priceRaw: unknown, compareRaw: unknown, image: unknown, availability: unknown): ProductVariantView => {\n const enabled = row?.enable !== false;\n const price = storefrontMoney(priceRaw, currency);\n const state = availabilityOf(availability, enabled);\n return {\n variantId: text(row?._id) || null,\n name: text(row?.name) || null,\n choice,\n price,\n compareAt: aboveOnly(storefrontMoney(compareRaw, currency), price),\n image: text(image) || null,\n availability: state,\n enabled,\n sellable: enabled && !!price && state !== Availability.Out,\n };\n };\n if (!options.length) {\n const row = rows.find(r => r.name === DEFAULT_VARIANT_NAME) ?? (rows.length === 1 ? rows[0] : null);\n const pricing = product.pricing ?? {};\n return [view(row, {}, row?.price ?? pricing.price, row?.compareat ?? pricing.compareat, row?.image || product.mainImage,\n row?.availability ?? product.availability)];\n }\n const out: ProductVariantView[] = [];\n for (const row of rows) {\n const choice = variantChoiceOf(row, options);\n if (choice) out.push(view(row, choice, row.price, row.compareat, row.image || product.mainImage, row.availability));\n }\n return out;\n}\n\nconst matches = (variant: ProductVariantView, choice: VariantChoice, names: ReadonlyArray<string>): boolean =>\n names.every(name => choice[name] === undefined || variant.choice[name] === choice[name]);\n\n/** The variant a FULL choice names, or null (a choice that misses an option, or names no stored variant). */\nexport function findVariant(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice): ProductVariantView | null {\n if (!options.length) return variants[0] ?? null;\n if (options.some(o => !choice[o.name])) return null;\n return variants.find(v => options.every(o => v.choice[o.name] === choice[o.name])) ?? null;\n}\n\n/**\n * What each option offers now. Availability CASCADES in option order (the way a buyer reads the page, top to bottom):\n * a value of the first option is available when ANY sellable variant has it; a value of a later option, when a\n * sellable variant has it together with the values chosen for the options before it. So a buyer can always change an\n * earlier option and the later ones follow (`chooseValue`) — never stuck behind a combination that is sold out.\n */\nexport function optionValueStates(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice): OptionState[] {\n const sellable = variants.filter(v => v.sellable);\n return options.map((option, index) => {\n const before = options.slice(0, index).map(o => o.name);\n return {\n name: option.name,\n values: option.values.map(value => ({\n value,\n available: sellable.some(v => v.choice[option.name] === value && matches(v, choice, before)),\n selected: choice[option.name] === value,\n })),\n };\n });\n}\n\n/** The choice a page opens with: the first sellable variant's, else the first value of every option. */\nexport function defaultChoice(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>): VariantChoice {\n const first = variants.find(v => v.sellable && options.every(o => v.choice[o.name]));\n if (first) return { ...first.choice };\n return Object.fromEntries(options.map(o => [o.name, o.values[0]]));\n}\n\n/**\n * The buyer picks `value` for option `name`. The options AFTER it keep their value while it is still available after\n * the change, else move to their first available value (else keep it — the page then says the combination is sold out).\n * An unknown option or value changes nothing.\n */\nexport function chooseValue(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice,\n name: string, value: string): VariantChoice {\n const at = options.findIndex(o => o.name === name);\n if (at < 0 || !options[at].values.includes(value)) return choice;\n const next: Record<string, string> = { ...choice, [name]: value };\n for (let i = at + 1; i < options.length; i++) {\n const state = optionValueStates(options, variants, next)[i];\n const keeps = state.values.find(v => v.value === next[options[i].name])?.available;\n if (keeps) continue;\n const first = state.values.find(v => v.available);\n if (first) next[options[i].name] = first.value;\n }\n return next;\n}\n\n/** The catalog entries a storefront product sells (one per variant, or one for a product with no options) — what\n * `priceCart` reads where only the storefront is known (the builder canvas's simulated cart). iox-cms builds its own\n * from the stored row, with the stock COUNT. */\nexport function storefrontCatalog(product: StorefrontProduct | null | undefined): CatalogEntry[] {\n const productId = text(product?._id);\n if (!product || !productId) return [];\n const hasOptions = productOptions(product).length > 0;\n return productVariants(product).map(v => ({\n productId,\n variantId: hasOptions ? v.variantId : null,\n title: text(product.title),\n variantName: hasOptions ? Object.values(v.choice).join(' · ') : null,\n unitPrice: v.price,\n compareAt: v.compareAt,\n availability: v.availability,\n enabled: v.enabled,\n published: true,\n requiresShipping: true,\n image: v.image,\n }));\n}\n\n/** The words a chosen variant is shown with in a cart line (\"Sand · 32 cm\"). */\nexport function variantWords(choice: VariantChoice, options: ReadonlyArray<ProductOption>): string {\n return options.map(o => choice[o.name]).filter(Boolean).join(' · ');\n}\n\n// ── the product in scope ─────────────────────────────────────────────────────────────────────\n\n/** The data keys a product page's own item sits under (the route's item first — relative data sources). */\nconst ROUTE_KEYS: ReadonlyArray<string> = ['$current', '$route'];\n\n/**\n * The product an element is about, the SAME rule on the builder canvas and the live site: the repeated row it sits in\n * when that row is a product (a card in a product list), else the page's route item, else the first product the page's\n * data holds (a product page bound to one product). Null when the page has none.\n */\nexport function productInScope(rowItem: unknown, data: Readonly<Record<string, unknown>> | null | undefined): StorefrontProduct | null {\n if (isStorefrontProduct(rowItem)) return rowItem;\n const all = data ?? {};\n for (const key of ROUTE_KEYS) if (isStorefrontProduct(all[key])) return all[key] as StorefrontProduct;\n for (const value of Object.values(all)) if (isStorefrontProduct(value)) return value;\n return null;\n}\n\n/** What the `$variant` slot carries: the chosen variant, its product, its words and the quantity a buyer would add. */\nexport interface VariantSlot extends ProductVariantView {\n productId: string | undefined;\n words: string;\n quantity: number;\n}\n\n/**\n * The `$variant` slot for a product — the SAME value the shop runtime publishes on the canvas and the live site, and\n * the engine seeds during SSR (so the raw HTML already shows the price). `choice` defaults to the first sellable one.\n */\nexport function variantSlotOf(product: StorefrontProduct | null | undefined, choice?: VariantChoice | null, quantity = 1): VariantSlot | null {\n if (!product) return null;\n const options = productOptions(product);\n const views = productVariants(product);\n const pick = choice ?? defaultChoice(options, views);\n const variant = options.length ? findVariant(options, views, pick) : views[0] ?? null;\n return variant ? { ...variant, productId: product._id, words: variantWords(variant.choice, options), quantity } : null;\n}\n","import { Availability } from './catalog';\nimport { MAX_LINE_QUANTITY } from './limits';\n\n/**\n * The quantity a buyer may ask for — the stepper on a product page and on every cart line (commerce plan §3i). Whole\n * numbers only, the forms-core number rule: anything that is not a whole number reads as the least. The most is the\n * one-line cap (`MAX_LINE_QUANTITY`), lowered to the count when the count is known (iox-cms) — the storefront knows only\n * a word, so it caps at the line cap and the server clamps (`priceCart` QuantityClamped).\n */\nexport const MIN_LINE_QUANTITY = 1;\n\nexport interface QuantityBounds {\n min: number;\n /** Below `min` (0) when nothing can be bought: the stepper is off. */\n max: number;\n}\n\nexport enum QuantityStep {\n Down = -1,\n Up = 1,\n}\n\n/** What a stepper allows for a unit with this count / word. `out` (or a count of 0) allows nothing. */\nexport function quantityBounds(unit?: { stock?: number | null; availability?: string | null } | null): QuantityBounds {\n if (typeof unit?.stock === 'number') {\n const left = Number.isSafeInteger(unit.stock) && unit.stock > 0 ? unit.stock : 0;\n return { min: MIN_LINE_QUANTITY, max: Math.min(MAX_LINE_QUANTITY, left) };\n }\n if (unit?.availability === Availability.Out) return { min: MIN_LINE_QUANTITY, max: 0 };\n return { min: MIN_LINE_QUANTITY, max: MAX_LINE_QUANTITY };\n}\n\n/** True when the bounds allow buying at all. */\nexport function canBuy(bounds: QuantityBounds): boolean {\n return bounds.max >= bounds.min;\n}\n\n/** A quantity held within the bounds; not a whole number → the least. */\nexport function clampQuantity(value: unknown, bounds: QuantityBounds): number {\n const n = typeof value === 'number' ? value : typeof value === 'string' && value.trim() !== '' ? Number(value) : NaN;\n if (!Number.isSafeInteger(n)) return bounds.min;\n if (!canBuy(bounds)) return bounds.min;\n return Math.min(bounds.max, Math.max(bounds.min, n));\n}\n\n/** True when a step in `direction` stays within the bounds. */\nexport function canStep(value: number, direction: QuantityStep, bounds: QuantityBounds): boolean {\n if (!canBuy(bounds)) return false;\n const next = clampQuantity(value, bounds) + direction;\n return next >= bounds.min && next <= bounds.max;\n}\n\n/** One step, held within the bounds. */\nexport function stepQuantity(value: unknown, direction: QuantityStep, bounds: QuantityBounds): number {\n return clampQuantity(clampQuantity(value, bounds) + direction, bounds);\n}\n","import { CatalogEntry, catalogKey } from './catalog';\nimport { Cart, CART_ISSUE_LABELS, cartOf, CartIssue, PricedCart, PricedLine, priceCart, StudioCommerce } from './cart';\nimport { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { MAX_LINE_QUANTITY } from './limits';\nimport { Money } from './money';\nimport { quantityBounds } from './quantity';\n\n/**\n * The CART TRANSPORT CONTRACT (commerce plan §3d, C-D16) — what a host provides so the builder's shop parts can show and\n * change a visitor's cart. The parts own no HTTP, exactly like a form (forms-core `transport.ts`, the §6b lesson: a\n * part that emits and a host that never answers ships a dead button behind green tests):\n *\n * - the LIVE SITE (the engine, commerce E1d) implements it over iox-cms's hardened cart routes (`cartEndpointPath`): the\n * server prices every read with `priceCart` and the transport hands back its `CartView` — a browser never computes a\n * price it charges (trap T1);\n * - the BUILDER CANVAS uses `simulatedCartTransport`: an in-memory cart over sample data, never written anywhere\n * (trap T8: the canvas never writes a cart).\n *\n * Every method resolves with the WHOLE cart as it is now, or rejects with a `CartTransportError`.\n */\n\n/** One line of the cart a visitor sees: the server's priced line + the id its routes know it by + what it may hold. */\nexport interface CartViewLine extends PricedLine {\n lineId: string;\n /** The most this line may hold (the stepper's top). */\n maxQuantity: number;\n}\n\nexport interface CartView {\n /** null only for a cart that has never been priced (the no-transport stub). */\n currency: CurrencyCode | null;\n lines: CartViewLine[];\n /** How many units — the cart button's badge (`$cart.count`). */\n count: number;\n empty: boolean;\n subtotal: Money | null;\n total: Money | null;\n vat: Money | null;\n vatPercent: number;\n issues: CartIssue[];\n /** What is still missing for a free-delivery method, when the studio offers one (the drawer's note); else null. */\n freeShippingRemaining: Money | null;\n}\n\nexport interface AddToCartRequest {\n productId: string;\n variantId?: string | null;\n quantity: number;\n}\n\nexport interface CartTransport {\n read(): Promise<CartView>;\n add(request: AddToCartRequest): Promise<CartView>;\n setQuantity(lineId: string, quantity: number): Promise<CartView>;\n remove(lineId: string): Promise<CartView>;\n}\n\nexport enum CartTransportErrorCode {\n /** No cart on this host (the engine before E1d, a site with no shop). */\n Unavailable = 'unavailable',\n /** The server said no (a product no longer sold, a rate limit). */\n Refused = 'refused',\n /** The call never reached the server. */\n Network = 'network',\n}\n\nexport const CART_TRANSPORT_ERROR_LABELS: Readonly<Record<CartTransportErrorCode, CommerceLabel>> = Object.freeze({\n [CartTransportErrorCode.Unavailable]: { en: 'The shop is not open yet.', he: 'החנות עוד לא פתוחה.' },\n [CartTransportErrorCode.Refused]: { en: 'That could not be added to your bag.', he: 'לא ניתן היה להוסיף לסל.' },\n [CartTransportErrorCode.Network]: { en: 'We could not reach the shop. Try again.', he: 'לא הצלחנו להגיע לחנות. נסו שוב.' },\n});\n\nexport class CartTransportError extends Error {\n constructor(readonly code: CartTransportErrorCode, message?: string) {\n super(message ?? code);\n this.name = 'CartTransportError';\n }\n}\n\n/** A line's id when the host has none of its own: the product and the variant, URL-safe. */\nexport function cartLineId(productId: string, variantId?: string | null): string {\n return `${encodeURIComponent(productId)}~${encodeURIComponent(variantId ?? '')}`;\n}\n\n/** The public cart routes (§3d) — ROOT-relative, like the forms submit path (a relative path under the org's\n * `<base href>` reaches the engine, never iox-cms). `lineId` addresses one line. */\nexport function cartEndpointPath(orgId: string, lineId?: string | null): string {\n const base = `/api/site/${encodeURIComponent(orgId)}/cart`;\n return lineId ? `${base}/lines/${encodeURIComponent(lineId)}` : base;\n}\n\n/** The fixed checkout route (C-D3), relative to the site's `<base href=\"/<orgLabel>/\">`. */\nexport const CHECKOUT_PATH = 'checkout';\n\n/** The checkout's href: `/<orgLabel>/checkout` under a label, else `/checkout`. */\nexport function checkoutHref(orgLabel?: string | null): string {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n return label ? `/${encodeURIComponent(label)}/${CHECKOUT_PATH}` : `/${CHECKOUT_PATH}`;\n}\n\n/** A cart with nothing in it. */\nexport function emptyCartView(currency: CurrencyCode | null = null): CartView {\n return { currency, lines: [], count: 0, empty: true, subtotal: null, total: null, vat: null, vatPercent: 0, issues: [], freeShippingRemaining: null };\n}\n\n/** The view of a priced cart. `lineIdOf` names each line the way the host's routes do (default `cartLineId`);\n * `maxOf` says how many a line may hold (default the line cap). */\nexport function cartViewOf(priced: PricedCart, options: {\n lineIdOf?: (line: PricedLine) => string;\n maxOf?: (line: PricedLine) => number;\n freeShippingRemaining?: Money | null;\n} = {}): CartView {\n const lineIdOf = options.lineIdOf ?? (line => cartLineId(line.productId, line.variantId));\n const maxOf = options.maxOf ?? (() => MAX_LINE_QUANTITY);\n const lines = priced.lines.map(line => ({ ...line, lineId: lineIdOf(line), maxQuantity: Math.max(line.quantity, maxOf(line)) }));\n const count = lines.reduce((sum, line) => sum + line.quantity, 0);\n return {\n currency: priced.currency,\n lines,\n count,\n empty: lines.length === 0,\n subtotal: priced.subtotal,\n total: priced.total,\n vat: priced.vat,\n vatPercent: priced.vatPercent,\n issues: priced.issues,\n freeShippingRemaining: options.freeShippingRemaining ?? null,\n };\n}\n\n/** The cart iox-cms's public routes answer (E1b, `shop.md` \"The cart\"): the priced cart, each line under its own id\n * (`ln_…`), and the unit count. */\nexport interface SiteCartView extends PricedCart {\n lines: Array<PricedLine & { id: string }>;\n itemCount?: number;\n}\n\n/** iox-cms's answer as the view the parts paint — the server's line ids, its prices untouched. */\nexport function siteCartView(site: SiteCartView, freeShippingRemaining: Money | null = null): CartView {\n const ids = new Map(site.lines.map(line => [line, line.id]));\n return cartViewOf(site, { lineIdOf: line => ids.get(line as PricedLine & { id: string }) ?? cartLineId(line.productId, line.variantId), freeShippingRemaining });\n}\n\n/** How a refused cart call is said: no cart service (501, 503) or a shop off the plan (403) is Unavailable, a\n * status the server chose is Refused, anything that never got an answer is Network. */\nexport function cartTransportErrorFor(status: number | null | undefined): CartTransportError {\n if (!status) return new CartTransportError(CartTransportErrorCode.Network);\n if (status === 501 || status === 503 || status === 403) return new CartTransportError(CartTransportErrorCode.Unavailable, String(status));\n return new CartTransportError(CartTransportErrorCode.Refused, String(status));\n}\n\n/** The words a cart's issues are said with, once each. */\nexport function cartIssueWords(view: Pick<CartView, 'issues'>, lang: string | null | undefined): string[] {\n const codes = [...new Set(view.issues.map(i => i.code))];\n return codes.map(code => labelIn(CART_ISSUE_LABELS[code], lang));\n}\n\n/** The host with no cart yet (the engine until E1d binds its own): every read is an empty cart, every change refused. */\nexport const NO_CART_TRANSPORT: CartTransport = Object.freeze({\n read: () => Promise.resolve(emptyCartView()),\n add: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n setQuantity: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n remove: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n});\n\n/**\n * The builder canvas's cart: in memory, priced by the ONE `priceCart` over the catalog it is given (sample data, or the\n * product on the canvas), written nowhere. `initial` is what it starts holding (a sample line, so the drawer has one to\n * design). Every product the canvas adds must be in `catalog` — `addEntries` widens it.\n */\nexport interface SimulatedCartTransport extends CartTransport {\n /** Make more units known to the simulation (the product an Add to cart on the canvas names). */\n addEntries(entries: ReadonlyArray<CatalogEntry>): void;\n /** The cart as it stands, priced — no promise (the canvas paints it at once). */\n peek(): CartView;\n}\n\nexport function simulatedCartTransport(catalog: ReadonlyArray<CatalogEntry>, studio: StudioCommerce, initial: Cart = { lines: [] }): SimulatedCartTransport {\n const entries = new Map<string, CatalogEntry>();\n const known = (list: ReadonlyArray<CatalogEntry>) => list.forEach(e => entries.set(catalogKey(e.productId, e.variantId), e));\n known(catalog);\n let cart: Cart = { lines: [] };\n const maxOf = (line: PricedLine) => quantityBounds(entries.get(catalogKey(line.productId, line.variantId))).max;\n const price = (next: Cart): CartView => {\n const priced = priceCart(next, [...entries.values()], studio);\n cart = cartOf(priced);\n return cartViewOf(priced, { maxOf });\n };\n price(initial);\n const lineOf = (lineId: string) => cart.lines.find(l => cartLineId(l.productId, l.variantId) === lineId);\n return {\n addEntries: list => known(list),\n peek: () => price(cart),\n read: () => Promise.resolve(price(cart)),\n add: request => {\n if (!entries.has(catalogKey(request.productId, request.variantId))) return Promise.reject(new CartTransportError(CartTransportErrorCode.Refused));\n const same = cart.lines.find(l => l.productId === request.productId && (l.variantId ?? null) === (request.variantId ?? null));\n const lines = same\n ? cart.lines.map(l => (l === same ? { ...l, quantity: l.quantity + request.quantity } : l))\n : [...cart.lines, { productId: request.productId, variantId: request.variantId ?? null, quantity: request.quantity }];\n return Promise.resolve(price({ lines }));\n },\n setQuantity: (lineId, quantity) => {\n const line = lineOf(lineId);\n if (!line) return Promise.reject(new CartTransportError(CartTransportErrorCode.Refused));\n return Promise.resolve(price({ lines: cart.lines.map(l => (l === line ? { ...l, quantity } : l)) }));\n },\n remove: lineId => Promise.resolve(price({ lines: cart.lines.filter(l => l !== lineOf(lineId)) })),\n };\n}\n","import { CurrencyCode, isCurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { formatMoney, isMoney } from './money';\nimport { storefrontMoney, StorefrontProduct } from './variants';\n\n/**\n * How a price READS on a page — the `money` binding pipe (shop-aware plan A-D2, amended by C-D7) on the builder canvas,\n * the engine's SSR and its hydration: ONE function, so the three never disagree on a digit.\n *\n * - a `Money` (minor units + its currency — `$variant.price`, a cart's totals) is formatted as it is;\n * - a bare number or numeric string (`pricing.price` as the storefront serves it: MAJOR units) needs a currency — the\n * pipe's own argument, else the studio's (`PipeContext.currency`); with none it is left as it was, never guessed;\n * - nothing (null, undefined, '') reads as nothing.\n * The locale is the page's language (`en` when unsaid, so the canvas and the server agree).\n */\nexport const DEFAULT_MONEY_LOCALE = 'en';\n\nexport function formatMoneyValue(value: unknown, currency?: string | null, locale?: string | null): unknown {\n if (value === null || value === undefined || value === '') return '';\n const lang = locale || DEFAULT_MONEY_LOCALE;\n if (isMoney(value)) {\n try { return formatMoney(value, lang); } catch { return value; }\n }\n const code = String(currency ?? '').trim().toUpperCase();\n if (!isCurrencyCode(code)) return value;\n const amount = storefrontMoney(value, code as CurrencyCode);\n if (!amount) return value;\n try { return formatMoney(amount, lang); } catch { return value; }\n}\n\n/**\n * The two slots the shop parts write at runtime (the element-context channel — a slot is a `resolvedData` key written\n * at runtime, element-context-state plan): the variant the buyer has chosen (`$variant.price | money`) and the cart\n * (`$cart.count` on the cart button's badge). Written by the shop runtime through its host, read by ordinary bindings.\n */\nexport enum ShopSlot {\n Variant = '$variant',\n Cart = '$cart',\n}\n\nexport const SHOP_SLOTS: ReadonlyArray<string> = Object.freeze(Object.values(ShopSlot));\n\n// ── the shop parts' words (a string-rendered site has no translation service — the labels.ts rule) ──────────────\n\nexport enum ShopWord {\n Added = 'added',\n SoldOut = 'soldOut',\n ValueSoldOut = 'valueSoldOut',\n Decrease = 'decrease',\n Increase = 'increase',\n Remove = 'remove',\n Cart = 'cart',\n CartCount = 'cartCount',\n Quantity = 'quantity',\n FreeShippingGap = 'freeShippingGap',\n ChooseOption = 'chooseOption',\n}\n\n/** `{name}` / `{n}` / `{amount}` are filled by `shopWord`. */\nexport const SHOP_WORDS: Readonly<Record<ShopWord, CommerceLabel>> = Object.freeze({\n [ShopWord.Added]: { en: 'Added ✓', he: 'נוסף ✓' },\n [ShopWord.SoldOut]: { en: 'Sold out', he: 'אזל' },\n [ShopWord.ValueSoldOut]: { en: '{name} is sold out', he: '{name} אזל מהמלאי' },\n [ShopWord.Decrease]: { en: 'Decrease quantity', he: 'הפחתת כמות' },\n [ShopWord.Increase]: { en: 'Increase quantity', he: 'הגדלת כמות' },\n [ShopWord.Remove]: { en: 'Remove {name}', he: 'הסרת {name}' },\n [ShopWord.Cart]: { en: 'Bag', he: 'סל' },\n [ShopWord.CartCount]: { en: 'Bag, {n} items', he: 'סל, {n} פריטים' },\n [ShopWord.Quantity]: { en: 'Quantity', he: 'כמות' },\n [ShopWord.FreeShippingGap]: { en: 'Add {amount} more for free delivery', he: 'עוד {amount} למשלוח חינם' },\n [ShopWord.ChooseOption]: { en: 'Choose {name}', he: 'בחירת {name}' },\n});\n\nexport function shopWord(word: ShopWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n const primary = String(lang ?? '').toLowerCase().split(/[-_]/)[0];\n const label = SHOP_WORDS[word];\n const raw = primary === 'he' || primary === 'iw' ? label.he : label.en;\n return raw.replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n// ── the sample a canvas shows when no product is bound (commerce board 10, \"Studio Kadar\") ────────────────────────\n\n/** Board 10's tall speckled vase: Glaze (Sand · Ash · Charcoal — Charcoal sold out) × Size (24 · 32 · 40 cm — 40 sold\n * out), ₪240 against ₪280. Major units, as the storefront serves them. */\nexport const SAMPLE_PRODUCT: StorefrontProduct = Object.freeze({\n _id: 'sample-vase',\n title: 'Tall speckled vase',\n slug: 'tall-speckled-vase',\n mainImage: null,\n productVariants: true,\n currency: CurrencyCode.ILS,\n availability: 'in_stock',\n pricing: { price: 240, compareat: 280 },\n options: [\n { name: 'Glaze', values: ['Sand', 'Ash', 'Charcoal'] },\n { name: 'Size', values: ['24 cm', '32 cm', '40 cm'] },\n ],\n // Rows in the order a page opens on: Sand · 32 cm first (the first sellable row is the default choice).\n variants: ['Sand', 'Ash', 'Charcoal'].flatMap(glaze => ['32 cm', '24 cm', '40 cm'].map(size => ({\n _id: `sample-${glaze}-${size}`.toLowerCase().replace(/\\s+/g, ''),\n name: `${glaze}-${size}`,\n enable: true,\n image: null,\n price: size === '24 cm' ? 190 : 240,\n compareat: size === '32 cm' ? 280 : null,\n availability: glaze === 'Charcoal' || size === '40 cm' ? 'out' : 'in_stock',\n }))),\n});\n\n/** The colours board 10 draws its sample glazes with (a sample value has no colour of its own). */\nexport const SAMPLE_SWATCHES: Readonly<Record<string, string>> = Object.freeze({ Sand: '#D8C6A8', Ash: '#F3F1EC', Charcoal: '#3A3B3D' });\n\n/** The sample studio's money (VAT 18 %, ₪). */\nexport const SAMPLE_STUDIO = Object.freeze({ currency: CurrencyCode.ILS, vatPercent: 18, shippingMethods: [] as never[] });\n\n/** The cart the canvas starts with: one sample line, so the drawer has a line to design. */\nexport const SAMPLE_CART_LINE = Object.freeze({ productId: 'sample-vase', variantId: 'sample-sand-32cm', quantity: 1 });\n","import { SiteCartView } from './cart-transport';\nimport { BusinessIdentity, CheckoutStep, LegalPage } from './checkout';\nimport { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { Money } from './money';\nimport { OrderSnapshot, PostalAddress } from './order-snapshot';\nimport { OrderState } from './orders';\nimport { DeliveryFit, PaymentMethodKind } from './payments';\nimport { ShippingMethodKind, ShippingQuote } from './shipping';\n\n/**\n * The fixed checkout (C-D3) and the order page as a SITE reads them over iox-cms's public routes (`shop.md` \"E1 site\n * API\"): the routes, the answers' shapes, the words, and how a refusal's `code` becomes a sentence on the field it is\n * about. The engine renders; iox-cms prices (trap T1) — nothing here computes a total.\n */\n\nexport enum SiteCommerceRoute {\n Cart = 'cart',\n CartLines = 'cart/lines',\n CheckoutOptions = 'checkout/options',\n Checkout = 'checkout',\n CheckoutPlace = 'checkout/place',\n Order = 'order',\n}\n\n/** A public commerce route of one org, ROOT-relative (the same rule as `cartEndpointPath`). */\nexport function siteCommercePath(orgId: string, route: SiteCommerceRoute, id?: string | null): string {\n const base = `/api/site/${encodeURIComponent(orgId)}/${route}`;\n return id ? `${base}/${encodeURIComponent(id)}` : base;\n}\n\n/** The cart cookie iox-cms sets for one org (httpOnly — a site script never reads it; SSR forwards it). */\nexport const CART_COOKIE_PREFIX = 'iox_cart_';\n\nexport function cartCookieName(orgId: string): string {\n return `${CART_COOKIE_PREFIX}${orgId}`;\n}\n\n/** The order page under the checkout: `/<orgLabel>/checkout/order/<token>`. */\nexport const ORDER_PATH = 'order';\n\nexport function orderHref(orgLabel: string | null | undefined, token: string): string {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n const tail = `checkout/${ORDER_PATH}/${encodeURIComponent(token)}`;\n return label ? `/${encodeURIComponent(label)}/${tail}` : `/${tail}`;\n}\n\n// ── the answers ────────────────────────────────────────────────────────────────────────────────\n\nexport enum CheckoutFieldMode {\n Hidden = 'hidden',\n Optional = 'optional',\n Required = 'required',\n}\n\n/** The contact fields an owner may hide, offer or require. */\nexport enum CheckoutAskedField {\n Phone = 'phone',\n Company = 'company',\n Note = 'note',\n}\n\nexport type CheckoutFieldModes = Readonly<Partial<Record<CheckoutAskedField, CheckoutFieldMode>>>;\n\nexport interface SitePaymentOption {\n kind: PaymentMethodKind;\n label: CommerceLabel;\n fit: DeliveryFit;\n}\n\nexport interface SiteShippingMethod {\n id: string;\n kind: ShippingMethodKind;\n name: string;\n price: Money | null;\n freeOver: Money | null;\n pickupAddress: string | null;\n pickupHours: string | null;\n needsAddress: boolean;\n}\n\nexport interface SiteLegalLink {\n title: string;\n path: string;\n}\n\n/** `GET checkout/options` — what the page renders before anything is typed. */\nexport interface SiteCheckoutOptions {\n open: boolean;\n plan: string;\n refusals: string[];\n currency: CurrencyCode;\n vatPercent: number;\n country: string | null;\n shippingMethods: SiteShippingMethod[];\n paymentMethods: SitePaymentOption[];\n fields: CheckoutFieldModes;\n legalPages: Readonly<Partial<Record<LegalPage, SiteLegalLink | null>>>;\n business: BusinessIdentity;\n siteName: string | null;\n marketingWording: CommerceLabel;\n}\n\nexport interface SiteCheckoutContact {\n email: string;\n name: string | null;\n phone: string | null;\n company: string | null;\n}\n\nexport interface SiteShippingOption extends ShippingQuote {\n pickupAddress: string | null;\n pickupHours: string | null;\n}\n\n/** `GET|POST|PATCH checkout` — one checkout, priced by the server. */\nexport interface SiteCheckoutView {\n id: string;\n contact: SiteCheckoutContact;\n language: string;\n marketingConsent: { given: boolean; wording: string };\n delivery: { methodId: string; address: PostalAddress | null } | null;\n payment: { kind: PaymentMethodKind; label: string } | null;\n note: string | null;\n furthestStep: CheckoutStep;\n status: string;\n cart: SiteCartView;\n shippingOptions: SiteShippingOption[];\n paymentOptions: SitePaymentOption[];\n fields: CheckoutFieldModes;\n termsRequired: boolean;\n}\n\n/** `GET order/:token` — the buyer's own order (instructions only while it waits for the money). */\nexport interface SiteBuyerOrder {\n number: string | number;\n state: OrderState;\n stateLabel: string;\n placedAt: string;\n language: string;\n seller: { name: string; business: BusinessIdentity };\n snapshot: OrderSnapshot;\n paymentLabel: string;\n instructions: string | null;\n}\n\n/** `POST checkout/place` — 201. */\nexport interface SitePlacedOrder {\n order: SiteBuyerOrder;\n viewToken: string;\n}\n\n// ── the step a visitor is on ──────────────────────────────────────────────────────────────────\n\n/**\n * The step to SHOW: no checkout yet is Contact; then the first step still missing what it needs — a delivery chosen\n * (with an address when it delivers), then a payment. A step already passed stays open only when the buyer asks.\n */\nexport function currentCheckoutStep(view: Pick<SiteCheckoutView, 'delivery' | 'payment' | 'shippingOptions'> | null | undefined): CheckoutStep {\n if (!view) return CheckoutStep.Contact;\n const option = view.delivery ? view.shippingOptions.find(o => o.methodId === view.delivery!.methodId) : undefined;\n if (!option || (option.needsAddress && !view.delivery?.address)) return CheckoutStep.Delivery;\n return CheckoutStep.Payment;\n}\n\n/** The steps the stepper names (Paid is the order page, never a step a buyer fills). */\nexport const CHECKOUT_FORM_STEPS: readonly CheckoutStep[] = Object.freeze([CheckoutStep.Contact, CheckoutStep.Delivery, CheckoutStep.Payment]);\n\nexport function fieldAsked(fields: CheckoutFieldModes | null | undefined, field: CheckoutAskedField): boolean {\n return (fields?.[field] ?? CheckoutFieldMode.Hidden) !== CheckoutFieldMode.Hidden;\n}\n\nexport function fieldRequired(fields: CheckoutFieldModes | null | undefined, field: CheckoutAskedField): boolean {\n return fields?.[field] === CheckoutFieldMode.Required;\n}\n\n/** One line of a postal address as a buyer reads it. */\nexport function addressLine(address: PostalAddress | null | undefined): string {\n if (!address) return '';\n return [address.line1, address.line2, [address.postalCode, address.city].filter(Boolean).join(' ')].filter(part => !!part && String(part).trim()).join(', ');\n}\n\n// ── the words ─────────────────────────────────────────────────────────────────────────────────\n\nexport enum CheckoutWord {\n SecureCheckout = 'secureCheckout',\n Email = 'email',\n Name = 'name',\n Phone = 'phone',\n Company = 'company',\n Optional = 'optional',\n ContinueToDelivery = 'continueToDelivery',\n ContinueToPayment = 'continueToPayment',\n Change = 'change',\n Street = 'street',\n StreetMore = 'streetMore',\n City = 'city',\n PostalCode = 'postalCode',\n DeliverTo = 'deliverTo',\n PickupAt = 'pickupAt',\n Note = 'note',\n AcceptTerms = 'acceptTerms',\n PlaceOrder = 'placeOrder',\n PlaceNote = 'placeNote',\n OrderSummary = 'orderSummary',\n Subtotal = 'subtotal',\n Delivery = 'delivery',\n DeliveryLater = 'deliveryLater',\n Free = 'free',\n Total = 'total',\n IncludesVat = 'includesVat',\n Quantity = 'quantity',\n EmptyBag = 'emptyBag',\n BackToShop = 'backToShop',\n Closed = 'closed',\n ThankYou = 'thankYou',\n ThankYouNamed = 'thankYouNamed',\n OrderSent = 'orderSent',\n OrderNumber = 'orderNumber',\n HowToPay = 'howToPay',\n PaidWith = 'paidWith',\n BusinessNumber = 'businessNumber',\n Working = 'working',\n StepOf = 'stepOf',\n OrderMissing = 'orderMissing',\n Legal = 'legal',\n}\n\n/** `{name}`, `{n}`, `{of}`, `{amount}`, `{percent}`, `{number}`, `{email}`, `{total}`, `{place}` are filled by `checkoutWord`. */\nexport const CHECKOUT_WORDS: Readonly<Record<CheckoutWord, CommerceLabel>> = Object.freeze({\n [CheckoutWord.SecureCheckout]: { en: 'Secure checkout', he: 'תשלום מאובטח' },\n [CheckoutWord.Email]: { en: 'Email', he: 'אימייל' },\n [CheckoutWord.Name]: { en: 'Full name', he: 'שם מלא' },\n [CheckoutWord.Phone]: { en: 'Phone', he: 'טלפון' },\n [CheckoutWord.Company]: { en: 'Company', he: 'חברה' },\n [CheckoutWord.Optional]: { en: 'Optional', he: 'לא חובה' },\n [CheckoutWord.ContinueToDelivery]: { en: 'Continue to delivery', he: 'המשך למשלוח' },\n [CheckoutWord.ContinueToPayment]: { en: 'Continue to payment', he: 'המשך לתשלום' },\n [CheckoutWord.Change]: { en: 'Change', he: 'שינוי' },\n [CheckoutWord.Street]: { en: 'Street and number', he: 'רחוב ומספר' },\n [CheckoutWord.StreetMore]: { en: 'Apartment, floor', he: 'דירה, קומה' },\n [CheckoutWord.City]: { en: 'City', he: 'עיר' },\n [CheckoutWord.PostalCode]: { en: 'Postal code', he: 'מיקוד' },\n [CheckoutWord.DeliverTo]: { en: 'To {place}', he: 'אל {place}' },\n [CheckoutWord.PickupAt]: { en: 'Pickup at {place}', he: 'איסוף מ{place}' },\n [CheckoutWord.Note]: { en: 'A note for the seller', he: 'הערה למוכר' },\n [CheckoutWord.AcceptTerms]: { en: 'I accept the', he: 'אני מאשר/ת את' },\n [CheckoutWord.PlaceOrder]: { en: 'Place order · {total}', he: 'ביצוע הזמנה · {total}' },\n [CheckoutWord.PlaceNote]: { en: 'How to pay is on the next page.', he: 'פרטי התשלום יופיעו בעמוד הבא.' },\n [CheckoutWord.OrderSummary]: { en: 'Order summary', he: 'סיכום הזמנה' },\n [CheckoutWord.Subtotal]: { en: 'Subtotal', he: 'סכום ביניים' },\n [CheckoutWord.Delivery]: { en: 'Delivery', he: 'משלוח' },\n [CheckoutWord.DeliveryLater]: { en: 'Chosen next', he: 'ייבחר בהמשך' },\n [CheckoutWord.Free]: { en: 'Free', he: 'חינם' },\n [CheckoutWord.Total]: { en: 'Total', he: 'סה״כ' },\n [CheckoutWord.IncludesVat]: { en: 'Includes VAT {percent}% · {amount}', he: 'כולל מע״מ {percent}% · {amount}' },\n [CheckoutWord.Quantity]: { en: 'Qty {n}', he: 'כמות {n}' },\n [CheckoutWord.EmptyBag]: { en: 'Your bag is empty.', he: 'הסל שלך ריק.' },\n [CheckoutWord.BackToShop]: { en: 'Back to the shop', he: 'חזרה לחנות' },\n [CheckoutWord.Closed]: { en: 'The shop is not taking orders right now.', he: 'החנות לא מקבלת הזמנות כרגע.' },\n [CheckoutWord.ThankYou]: { en: 'Thank you! Your order is in.', he: 'תודה! ההזמנה התקבלה' },\n [CheckoutWord.ThankYouNamed]: { en: 'Thank you, {name}! Your order is in.', he: 'תודה, {name}! ההזמנה התקבלה' },\n [CheckoutWord.OrderSent]: { en: 'Order #{number} · a confirmation was sent to {email}', he: 'הזמנה #{number} · אישור נשלח ל־{email}' },\n [CheckoutWord.OrderNumber]: { en: 'Order #{number}', he: 'הזמנה #{number}' },\n [CheckoutWord.HowToPay]: { en: 'How to pay', he: 'איך משלמים' },\n [CheckoutWord.PaidWith]: { en: 'Payment', he: 'תשלום' },\n [CheckoutWord.BusinessNumber]: { en: 'Business no. {number}', he: 'ע.מ {number}' },\n [CheckoutWord.Working]: { en: 'One moment…', he: 'רגע…' },\n [CheckoutWord.StepOf]: { en: 'Step {n} of {of}', he: 'שלב {n} מתוך {of}' },\n [CheckoutWord.OrderMissing]: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' },\n [CheckoutWord.Legal]: { en: 'Policies', he: 'מדיניות' },\n});\n\nexport function checkoutWord(word: CheckoutWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return labelIn(CHECKOUT_WORDS[word], lang).replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n// ── a refusal, said on its field ─────────────────────────────────────────────────────────────\n\n/** Where on the checkout a refusal is said. */\nexport enum CheckoutSlot {\n Email = 'email',\n Name = 'name',\n Phone = 'phone',\n Company = 'company',\n Delivery = 'delivery',\n Address = 'address',\n Payment = 'payment',\n Terms = 'terms',\n /** The order summary: the bag itself changed. */\n Cart = 'cart',\n /** The whole page: closed, busy, unreachable. */\n Page = 'page',\n}\n\n/**\n * Every code a buyer's checkout can hear from iox-cms (`CommerceErrorCode`, the checkout's own refusals and\n * commerce-core's `OrderSnapshotRefusal`), plus `network` for no answer at all.\n */\nexport enum SiteRefusalCode {\n InvalidBody = 'invalid-body',\n InvalidEmail = 'invalid-email',\n EmailRequired = 'email-required',\n NameRequired = 'name-required',\n PhoneRequired = 'phone-required',\n CompanyRequired = 'company-required',\n InvalidAddress = 'invalid-address',\n AddressRequired = 'address-required',\n AddressCountry = 'address-country',\n UnknownShippingMethod = 'unknown-shipping-method',\n ShippingNotChosen = 'shipping-not-chosen',\n UnknownPaymentMethod = 'unknown-payment-method',\n PaymentNotChosen = 'payment-not-chosen',\n PaymentMethodUnusable = 'payment-method-unusable',\n TermsNotAccepted = 'terms-not-accepted',\n NoCart = 'no-cart',\n EmptyCart = 'empty-cart',\n NoCheckout = 'no-checkout',\n CartChanged = 'cart-changed',\n OutOfStock = 'out-of-stock',\n OrderChanged = 'order-changed',\n CheckoutClosed = 'checkout-closed',\n ShopNotInPlan = 'shop-not-in-plan',\n ShopPlanUnknown = 'shop-plan-unknown',\n RateLimited = 'rate-limited',\n Busy = 'busy',\n UnknownOrder = 'unknown-order',\n UnknownSite = 'unknown-site',\n Network = 'network',\n}\n\ninterface RefusalRule {\n readonly slot: CheckoutSlot;\n readonly label: CommerceLabel;\n}\n\nconst ENTER_EMAIL: CommerceLabel = { en: 'Enter an email address, like name@example.com.', he: 'הקלידו כתובת אימייל, למשל name@example.com.' };\nconst ENTER_ADDRESS: CommerceLabel = { en: 'Enter the street, the number and the city.', he: 'הקלידו רחוב, מספר ועיר.' };\nconst CHOOSE_DELIVERY: CommerceLabel = { en: 'Choose how to get your order.', he: 'בחרו איך לקבל את ההזמנה.' };\nconst CHOOSE_PAYMENT: CommerceLabel = { en: 'Choose how to pay.', he: 'בחרו איך לשלם.' };\nconst BAG_EMPTY: CommerceLabel = { en: 'Your bag is empty.', he: 'הסל שלך ריק.' };\nconst CLOSED: CommerceLabel = { en: 'The shop is not taking orders right now.', he: 'החנות לא מקבלת הזמנות כרגע.' };\nconst TRY_AGAIN: CommerceLabel = { en: 'The shop is busy. Try again in a moment.', he: 'החנות עמוסה. נסו שוב בעוד רגע.' };\n\nexport const SITE_REFUSALS: Readonly<Record<SiteRefusalCode, RefusalRule>> = Object.freeze({\n [SiteRefusalCode.InvalidBody]: { slot: CheckoutSlot.Page, label: { en: 'Check the details and try again.', he: 'בדקו את הפרטים ונסו שוב.' } },\n [SiteRefusalCode.InvalidEmail]: { slot: CheckoutSlot.Email, label: ENTER_EMAIL },\n [SiteRefusalCode.EmailRequired]: { slot: CheckoutSlot.Email, label: ENTER_EMAIL },\n [SiteRefusalCode.NameRequired]: { slot: CheckoutSlot.Name, label: { en: 'Enter your name.', he: 'הקלידו את שמכם.' } },\n [SiteRefusalCode.PhoneRequired]: { slot: CheckoutSlot.Phone, label: { en: 'Enter a phone number.', he: 'הקלידו מספר טלפון.' } },\n [SiteRefusalCode.CompanyRequired]: { slot: CheckoutSlot.Company, label: { en: 'Enter the company name.', he: 'הקלידו את שם החברה.' } },\n [SiteRefusalCode.InvalidAddress]: { slot: CheckoutSlot.Address, label: ENTER_ADDRESS },\n [SiteRefusalCode.AddressRequired]: { slot: CheckoutSlot.Address, label: ENTER_ADDRESS },\n [SiteRefusalCode.AddressCountry]: { slot: CheckoutSlot.Address, label: { en: 'We do not deliver to this country.', he: 'אנחנו לא שולחים למדינה הזו.' } },\n [SiteRefusalCode.UnknownShippingMethod]: { slot: CheckoutSlot.Delivery, label: CHOOSE_DELIVERY },\n [SiteRefusalCode.ShippingNotChosen]: { slot: CheckoutSlot.Delivery, label: CHOOSE_DELIVERY },\n [SiteRefusalCode.UnknownPaymentMethod]: { slot: CheckoutSlot.Payment, label: CHOOSE_PAYMENT },\n [SiteRefusalCode.PaymentNotChosen]: { slot: CheckoutSlot.Payment, label: CHOOSE_PAYMENT },\n [SiteRefusalCode.PaymentMethodUnusable]: { slot: CheckoutSlot.Payment, label: { en: 'This way to pay does not fit the delivery. Choose another.', he: 'אמצעי התשלום הזה לא מתאים למשלוח. בחרו אחר.' } },\n [SiteRefusalCode.TermsNotAccepted]: { slot: CheckoutSlot.Terms, label: { en: 'Accept the terms to place the order.', he: 'כדי להזמין יש לאשר את התנאים.' } },\n [SiteRefusalCode.NoCart]: { slot: CheckoutSlot.Cart, label: BAG_EMPTY },\n [SiteRefusalCode.EmptyCart]: { slot: CheckoutSlot.Cart, label: BAG_EMPTY },\n [SiteRefusalCode.NoCheckout]: { slot: CheckoutSlot.Email, label: { en: 'Start with your email.', he: 'התחילו באימייל.' } },\n [SiteRefusalCode.CartChanged]: { slot: CheckoutSlot.Cart, label: { en: 'Your bag changed. Check it, then place the order.', he: 'הסל השתנה. בדקו אותו ואז הזמינו.' } },\n [SiteRefusalCode.OutOfStock]: { slot: CheckoutSlot.Cart, label: { en: 'Something in your bag just sold out.', he: 'משהו בסל אזל הרגע מהמלאי.' } },\n [SiteRefusalCode.OrderChanged]: { slot: CheckoutSlot.Page, label: { en: 'This order was already placed.', he: 'ההזמנה הזו כבר בוצעה.' } },\n [SiteRefusalCode.CheckoutClosed]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.ShopNotInPlan]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.ShopPlanUnknown]: { slot: CheckoutSlot.Page, label: TRY_AGAIN },\n [SiteRefusalCode.RateLimited]: { slot: CheckoutSlot.Page, label: { en: 'Too many tries. Wait a minute and try again.', he: 'יותר מדי ניסיונות. המתינו דקה ונסו שוב.' } },\n [SiteRefusalCode.Busy]: { slot: CheckoutSlot.Page, label: TRY_AGAIN },\n [SiteRefusalCode.UnknownOrder]: { slot: CheckoutSlot.Page, label: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' } },\n [SiteRefusalCode.UnknownSite]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.Network]: { slot: CheckoutSlot.Page, label: { en: 'We could not reach the shop. Try again.', he: 'לא הצלחנו להגיע לחנות. נסו שוב.' } },\n});\n\n/** Each refusal of a failed call, on its slot, in the buyer's words. */\nexport interface SiteRefusal {\n code: string;\n slot: CheckoutSlot;\n words: string;\n}\n\nconst isRefusalCode = (code: unknown): code is SiteRefusalCode =>\n typeof code === 'string' && (Object.values(SiteRefusalCode) as string[]).includes(code);\n\nconst ORDER_REFUSED = 'order-refused';\n\nfunction refusalOf(code: unknown, lang: string | null | undefined): SiteRefusal {\n const known: SiteRefusalCode = isRefusalCode(code) ? code : SiteRefusalCode.InvalidBody;\n const rule = SITE_REFUSALS[known];\n return { code: isRefusalCode(code) ? code : String(code ?? known), slot: rule.slot, words: labelIn(rule.label, lang) };\n}\n\n/**\n * A refused call's body (`{ statusCode, code, message, refusals? }`) as sentences: `order-refused` says each of its\n * `refusals` on its own field; any other code is one sentence; no body at all is `network`. `message` is a log line\n * and is never shown. One sentence per slot (the first wins).\n */\nexport function siteRefusalsOf(body: unknown, lang: string | null | undefined): SiteRefusal[] {\n const answer = body && typeof body === 'object' ? body as { code?: unknown; refusals?: unknown } : null;\n if (!answer) return [refusalOf(SiteRefusalCode.Network, lang)];\n const codes = answer.code === ORDER_REFUSED && Array.isArray(answer.refusals) && answer.refusals.length ? answer.refusals : [answer.code];\n const seen = new Set<CheckoutSlot>();\n return codes.map(code => refusalOf(code, lang)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));\n}\n","/**\n * @vectoriox/iox-ui/commerce-core — the shared, FRAMEWORK-FREE core of selling (commerce plan C-D7…C-D11, C-D19).\n *\n * Money is integer minor units in one ISO-4217 currency, so the engine, the builder and iox-cms compute the same\n * totals (trap T6: never a float). E0 shipped Money; E1a adds the cart and its ONE pricing function, shipping v1,\n * manual payment methods, the order state machine, the checkout steps and gate, and the order snapshot. No clock is\n * read anywhere — a caller passes `now`.\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 './money-error';\nexport * from './currency';\nexport * from './money';\nexport * from './labels';\nexport * from './limits';\nexport * from './vat';\nexport * from './catalog';\nexport * from './shipping';\nexport * from './cart';\nexport * from './payments';\nexport * from './orders';\nexport * from './checkout';\nexport * from './order-snapshot';\nexport * from './variants';\nexport * from './quantity';\nexport * from './cart-transport';\nexport * from './shop-display';\nexport * from './site-checkout';\nexport { looksLikeEmail, looksLikePhone } from './text';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["text"],"mappings":"IAAY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACtB,IAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC;AACpC,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,aAA0B;AAC1B,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,cAA2B;AAC3B,IAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,mBAAqC;AACrC,IAAA,cAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC;AACtC,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,cAAA,CAAA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,IAAA,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;AAC1H;AAEA;;;;AAIG;AACG,SAAU,cAAc,CAAC,IAAa,EAAE,IAA+B,EAAA;AACzE,IAAA,MAAM,MAAM,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,GAAG,IAA8C,GAAG,IAAI;AACvG,IAAA,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC9D,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;AACzI,IAAA,MAAM,IAAI,GAAG,IAAI,GAAG,EAAgB;AACpC,IAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxG;;ACrZA;;;;;;;;;AASG;;ACTH;;AAEG;;;;"}
1
+ {"version":3,"file":"vectoriox-iox-ui-commerce-core.mjs","sources":["../../../projects/iox-ui/src/commerce-core/money-error.ts","../../../projects/iox-ui/src/commerce-core/currency.ts","../../../projects/iox-ui/src/commerce-core/decimal.ts","../../../projects/iox-ui/src/commerce-core/money.ts","../../../projects/iox-ui/src/commerce-core/labels.ts","../../../projects/iox-ui/src/commerce-core/limits.ts","../../../projects/iox-ui/src/commerce-core/vat.ts","../../../projects/iox-ui/src/commerce-core/catalog.ts","../../../projects/iox-ui/src/commerce-core/text.ts","../../../projects/iox-ui/src/commerce-core/shipping.ts","../../../projects/iox-ui/src/commerce-core/cart.ts","../../../projects/iox-ui/src/commerce-core/payments.ts","../../../projects/iox-ui/src/commerce-core/orders.ts","../../../projects/iox-ui/src/commerce-core/checkout.ts","../../../projects/iox-ui/src/commerce-core/order-snapshot.ts","../../../projects/iox-ui/src/commerce-core/variants.ts","../../../projects/iox-ui/src/commerce-core/quantity.ts","../../../projects/iox-ui/src/commerce-core/cart-transport.ts","../../../projects/iox-ui/src/commerce-core/shop-display.ts","../../../projects/iox-ui/src/commerce-core/site-checkout.ts","../../../projects/iox-ui/src/commerce-core/public-api.ts","../../../projects/iox-ui/src/commerce-core/vectoriox-iox-ui-commerce-core.ts"],"sourcesContent":["export enum MoneyErrorCode {\n UnknownCurrency = 'unknown-currency',\n NotMoney = 'not-money',\n NotInteger = 'not-integer',\n NotANumber = 'not-a-number',\n TooManyDecimals = 'too-many-decimals',\n CurrencyMismatch = 'currency-mismatch',\n NotWhole = 'not-whole',\n Negative = 'negative',\n Overflow = 'overflow',\n OutOfRange = 'out-of-range',\n}\n\nexport class MoneyError extends Error {\n constructor(readonly code: MoneyErrorCode, message: string) {\n super(message);\n this.name = 'MoneyError';\n }\n}\n","import { MoneyError, MoneyErrorCode } from './money-error';\n\nexport enum CurrencyCode {\n ILS = 'ILS',\n USD = 'USD',\n EUR = 'EUR',\n GBP = 'GBP',\n CHF = 'CHF',\n CAD = 'CAD',\n AUD = 'AUD',\n NZD = 'NZD',\n SEK = 'SEK',\n NOK = 'NOK',\n DKK = 'DKK',\n PLN = 'PLN',\n CZK = 'CZK',\n HUF = 'HUF',\n RON = 'RON',\n TRY = 'TRY',\n AED = 'AED',\n SAR = 'SAR',\n QAR = 'QAR',\n EGP = 'EGP',\n MAD = 'MAD',\n ZAR = 'ZAR',\n INR = 'INR',\n CNY = 'CNY',\n HKD = 'HKD',\n SGD = 'SGD',\n THB = 'THB',\n MXN = 'MXN',\n BRL = 'BRL',\n JPY = 'JPY',\n KRW = 'KRW',\n VND = 'VND',\n CLP = 'CLP',\n ISK = 'ISK',\n BHD = 'BHD',\n KWD = 'KWD',\n JOD = 'JOD',\n OMR = 'OMR',\n TND = 'TND',\n}\n\n/** ISO-4217 minor units — our own table, never Intl's CLDR digits (they differ for some codes). */\nexport const CURRENCY_EXPONENTS: Readonly<Record<CurrencyCode, number>> = Object.freeze({\n [CurrencyCode.ILS]: 2,\n [CurrencyCode.USD]: 2,\n [CurrencyCode.EUR]: 2,\n [CurrencyCode.GBP]: 2,\n [CurrencyCode.CHF]: 2,\n [CurrencyCode.CAD]: 2,\n [CurrencyCode.AUD]: 2,\n [CurrencyCode.NZD]: 2,\n [CurrencyCode.SEK]: 2,\n [CurrencyCode.NOK]: 2,\n [CurrencyCode.DKK]: 2,\n [CurrencyCode.PLN]: 2,\n [CurrencyCode.CZK]: 2,\n [CurrencyCode.HUF]: 2,\n [CurrencyCode.RON]: 2,\n [CurrencyCode.TRY]: 2,\n [CurrencyCode.AED]: 2,\n [CurrencyCode.SAR]: 2,\n [CurrencyCode.QAR]: 2,\n [CurrencyCode.EGP]: 2,\n [CurrencyCode.MAD]: 2,\n [CurrencyCode.ZAR]: 2,\n [CurrencyCode.INR]: 2,\n [CurrencyCode.CNY]: 2,\n [CurrencyCode.HKD]: 2,\n [CurrencyCode.SGD]: 2,\n [CurrencyCode.THB]: 2,\n [CurrencyCode.MXN]: 2,\n [CurrencyCode.BRL]: 2,\n [CurrencyCode.JPY]: 0,\n [CurrencyCode.KRW]: 0,\n [CurrencyCode.VND]: 0,\n [CurrencyCode.CLP]: 0,\n [CurrencyCode.ISK]: 0,\n [CurrencyCode.BHD]: 3,\n [CurrencyCode.KWD]: 3,\n [CurrencyCode.JOD]: 3,\n [CurrencyCode.OMR]: 3,\n [CurrencyCode.TND]: 3,\n});\n\nexport const CURRENCY_CODES: readonly CurrencyCode[] = Object.freeze(Object.values(CurrencyCode));\n\nexport function isCurrencyCode(value: unknown): value is CurrencyCode {\n return typeof value === 'string' && Object.prototype.hasOwnProperty.call(CURRENCY_EXPONENTS, value);\n}\n\nexport function currencyExponent(currency: CurrencyCode): number {\n if (!isCurrencyCode(currency)) {\n throw new MoneyError(MoneyErrorCode.UnknownCurrency, `Unknown currency: ${String(currency)}`);\n }\n return CURRENCY_EXPONENTS[currency];\n}\n","import { MoneyError, MoneyErrorCode } from './money-error';\n\nexport interface DecimalDigits {\n negative: boolean;\n int: string;\n frac: string;\n}\n\nexport enum DecimalRounding {\n Exact = 'exact',\n HalfEven = 'half-even',\n}\n\nconst DECIMAL = /^([+-])?(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d{1,3}))?$/;\n\n/** Plain decimal text, or the e-notation `String(number)` produces below 1e-6 and from 1e21. */\nexport function parseDecimal(text: string): DecimalDigits | null {\n const match = DECIMAL.exec(text);\n if (!match) return null;\n const int = match[2] ?? '';\n const frac = match[3] ?? '';\n if (!int && !frac) return null;\n const digits = int + frac;\n const point = int.length + Number(match[4] ?? 0);\n const shiftedInt = point <= 0 ? '' : point >= digits.length ? digits + '0'.repeat(point - digits.length) : digits.slice(0, point);\n const shiftedFrac = point <= 0 ? '0'.repeat(-point) + digits : point >= digits.length ? '' : digits.slice(point);\n return {\n negative: match[1] === '-',\n int: shiftedInt.replace(/^0+/, ''),\n frac: shiftedFrac.replace(/0+$/, ''),\n };\n}\n\nfunction safeFromDigits(digits: string): number {\n const trimmed = digits.replace(/^0+/, '') || '0';\n const value = trimmed.length > 16 ? Infinity : Number(trimmed);\n if (!Number.isSafeInteger(value)) {\n throw new MoneyError(MoneyErrorCode.Overflow, `${digits} is beyond the safe integer range`);\n }\n return value;\n}\n\n/** Scales a parsed decimal by 10^exponent into an integer, without ever touching a float. */\nexport function decimalToScaledInteger(decimal: DecimalDigits, exponent: number, rounding: DecimalRounding): number {\n const kept = decimal.frac.slice(0, exponent);\n const rest = decimal.frac.slice(exponent);\n if (rest && rounding === DecimalRounding.Exact) {\n throw new MoneyError(MoneyErrorCode.TooManyDecimals, `More than ${exponent} decimal digits`);\n }\n let magnitude = safeFromDigits(decimal.int + kept.padEnd(exponent, '0'));\n if (rest) {\n const first = Number(rest[0]);\n const tie = first === 5 && /^5$/.test(rest);\n const up = first > 5 || (first === 5 && !tie) || (tie && magnitude % 2 === 1);\n if (up) magnitude += 1;\n if (!Number.isSafeInteger(magnitude)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Rounded value is beyond the safe integer range');\n }\n }\n return decimal.negative && magnitude !== 0 ? -magnitude : magnitude;\n}\n\n/** Integer division rounded half-to-even; numerator ≥ 0, denominator > 0, both safe integers. */\nexport function divideHalfEven(numerator: number, denominator: number): number {\n let quotient = Math.trunc(numerator / denominator);\n let remainder = numerator - quotient * denominator;\n while (remainder < 0) {\n quotient -= 1;\n remainder += denominator;\n }\n while (remainder >= denominator) {\n quotient += 1;\n remainder -= denominator;\n }\n const twice = remainder * 2;\n if (twice > denominator || (twice === denominator && quotient % 2 === 1)) quotient += 1;\n return quotient;\n}\n\n/** Integer division that never trusts the float quotient: trunc, then corrected by the remainder. */\nfunction divMod(numerator: number, denominator: number): [number, number] {\n let quotient = Math.trunc(numerator / denominator);\n let remainder = numerator - quotient * denominator;\n while (remainder < 0) {\n quotient -= 1;\n remainder += denominator;\n }\n while (remainder >= denominator) {\n quotient += 1;\n remainder -= denominator;\n }\n return [quotient, remainder];\n}\n\n/**\n * round-half-even(a × b / d) for a, b ≥ 0 and d > b, without forming a × b (it can pass 2^53): a = q·d + r, so\n * a·b/d = q·b + r·b/d, where q·b < a and r·b < d·b — callers keep d·b a safe integer.\n */\nexport function mulDivHalfEven(a: number, b: number, d: number): number {\n const [q, r] = divMod(a, d);\n const [f, rest] = divMod(r * b, d);\n let result = q * b + f;\n const twice = rest * 2;\n if (twice > d || (twice === d && result % 2 === 1)) result += 1;\n return result;\n}\n","import { CurrencyCode, currencyExponent, isCurrencyCode } from './currency';\nimport { DecimalRounding, decimalToScaledInteger, divideHalfEven, parseDecimal } from './decimal';\nimport { MoneyError, MoneyErrorCode } from './money-error';\n\nexport interface Money {\n /** Integer minor units (agorot, cents, fils…). */\n amount: number;\n currency: CurrencyCode;\n}\n\nconst MAX_PERCENT_DECIMALS = 6;\n\nexport function isMoney(value: unknown): value is Money {\n if (typeof value !== 'object' || value === null) return false;\n const record = value as Record<string, unknown>;\n return Number.isSafeInteger(record['amount']) && isCurrencyCode(record['currency']);\n}\n\nfunction assertWhole(amount: number, what: string): void {\n if (typeof amount !== 'number' || !Number.isSafeInteger(amount)) {\n throw new MoneyError(MoneyErrorCode.NotInteger, `${what} must be a whole number of minor units, got ${String(amount)}`);\n }\n}\n\nfunction assertMoney(value: Money): void {\n if (typeof value !== 'object' || value === null) {\n throw new MoneyError(MoneyErrorCode.NotMoney, `Not a Money value: ${String(value)}`);\n }\n currencyExponent(value.currency);\n assertWhole(value.amount, 'Money.amount');\n}\n\nfunction assertSameCurrency(a: Money, b: Money): void {\n assertMoney(a);\n assertMoney(b);\n if (a.currency !== b.currency) {\n throw new MoneyError(MoneyErrorCode.CurrencyMismatch, `Cannot combine ${a.currency} with ${b.currency}`);\n }\n}\n\nfunction safeResult(amount: number, currency: CurrencyCode): Money {\n if (!Number.isSafeInteger(amount)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Result is beyond the safe integer range');\n }\n return { amount: amount === 0 ? 0 : amount, currency };\n}\n\nexport function money(amount: number, currency: CurrencyCode): Money {\n currencyExponent(currency);\n assertWhole(amount, 'amount');\n return { amount: amount === 0 ? 0 : amount, currency };\n}\n\nfunction decimalText(value: number | string): string | null {\n if (typeof value === 'number') return Number.isFinite(value) ? String(value) : null;\n if (typeof value === 'string') return value.trim();\n return null;\n}\n\n/** Exact: `19.99` → 1999 by reading the digits, never `x * 100`; refuses digits the currency lacks. */\nexport function majorToMinor(major: number | string, currency: CurrencyCode): number {\n const exponent = currencyExponent(currency);\n const text = decimalText(major);\n const decimal = text === null ? null : parseDecimal(text);\n if (!decimal) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Not a decimal amount: ${String(major)}`);\n }\n return decimalToScaledInteger(decimal, exponent, DecimalRounding.Exact);\n}\n\nexport function minorToMajor(minor: number, currency: CurrencyCode): number {\n const exponent = currencyExponent(currency);\n assertWhole(minor, 'minor');\n return exponent === 0 ? minor : minor / 10 ** exponent;\n}\n\nexport function addMoney(a: Money, b: Money): Money {\n assertSameCurrency(a, b);\n return safeResult(a.amount + b.amount, a.currency);\n}\n\nexport function subtractMoney(a: Money, b: Money): Money {\n assertSameCurrency(a, b);\n return safeResult(a.amount - b.amount, a.currency);\n}\n\nexport function timesMoney(value: Money, quantity: number): Money {\n assertMoney(value);\n if (typeof quantity !== 'number' || !Number.isSafeInteger(quantity)) {\n throw new MoneyError(MoneyErrorCode.NotWhole, `Quantity must be a whole number, got ${String(quantity)}`);\n }\n if (quantity < 0) {\n throw new MoneyError(MoneyErrorCode.Negative, `Quantity cannot be negative, got ${quantity}`);\n }\n return safeResult(value.amount * quantity, value.currency);\n}\n\n/** `percent` of an amount, rounded ONCE to a minor unit, half-to-even (banker's). */\nexport function percentOf(value: Money, percent: number): Money {\n assertMoney(value);\n if (typeof percent !== 'number' || !Number.isFinite(percent)) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Percent must be a finite number, got ${String(percent)}`);\n }\n if (percent < 0) {\n throw new MoneyError(MoneyErrorCode.Negative, `Percent cannot be negative, got ${percent}`);\n }\n const decimal = parseDecimal(String(percent));\n if (!decimal) {\n throw new MoneyError(MoneyErrorCode.NotANumber, `Percent must be a finite number, got ${String(percent)}`);\n }\n if (decimal.frac.length > MAX_PERCENT_DECIMALS) {\n throw new MoneyError(MoneyErrorCode.TooManyDecimals, `Percent has more than ${MAX_PERCENT_DECIMALS} decimal digits`);\n }\n const scale = decimal.frac.length;\n const percentScaled = decimalToScaledInteger(decimal, scale, DecimalRounding.Exact);\n const numerator = Math.abs(value.amount) * percentScaled;\n if (!Number.isSafeInteger(numerator)) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Percent of this amount is beyond the safe integer range');\n }\n const magnitude = divideHalfEven(numerator, 100 * 10 ** scale);\n return safeResult(value.amount < 0 ? -magnitude : magnitude, value.currency);\n}\n\nconst formatters = new Map<string, Intl.NumberFormat>();\n\nexport function formatMoney(value: Money, locale: string): string {\n assertMoney(value);\n const exponent = currencyExponent(value.currency);\n const key = `${locale}|${value.currency}`;\n let formatter = formatters.get(key);\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: value.currency,\n minimumFractionDigits: exponent,\n maximumFractionDigits: exponent,\n });\n formatters.set(key, formatter);\n }\n return formatter.format(minorToMajor(value.amount, value.currency));\n}\n\n/**\n * For the one boot migration of stored major-unit prices. A stored float may carry arithmetic noise\n * (19.990000000000002), so extra digits round half-to-even instead of refusing. No usable price\n * (null, '', NaN, text, a negative) → null; it never applies twice by itself — the caller marks rows.\n */\nexport function migrateMajorPrice(value: unknown, currency: CurrencyCode): number | null {\n const exponent = currencyExponent(currency);\n if (typeof value !== 'number' && typeof value !== 'string') return null;\n const text = decimalText(value);\n const decimal = text ? parseDecimal(text) : null;\n if (!decimal || (decimal.negative && (decimal.int || decimal.frac))) return null;\n try {\n return decimalToScaledInteger(decimal, exponent, DecimalRounding.HalfEven);\n } catch {\n return null;\n }\n}\n","/**\n * The words a refusal or a state is shown with. A string-rendered site and iox-cms's emails have no translation\n * service, so the core carries English and Hebrew itself (the `blurbHe` / `sentWord` precedent); a host with its\n * own translations may key them by the stable code instead.\n */\nexport enum CommerceLanguage {\n En = 'en',\n He = 'he',\n}\n\nexport interface CommerceLabel {\n readonly en: string;\n readonly he: string;\n}\n\nconst LANGUAGE_ALIASES: Readonly<Record<string, CommerceLanguage>> = Object.freeze({\n en: CommerceLanguage.En,\n he: CommerceLanguage.He,\n iw: CommerceLanguage.He,\n});\n\nexport function commerceLanguage(lang: string | null | undefined): CommerceLanguage {\n const primary = String(lang ?? '').trim().toLowerCase().split(/[-_]/)[0];\n return LANGUAGE_ALIASES[primary] ?? CommerceLanguage.En;\n}\n\nexport function labelIn(label: CommerceLabel, lang: string | null | undefined): string {\n return label[commerceLanguage(lang)];\n}\n","/** A cart holds at most this many distinct lines; more are dropped (`too-many-lines`). */\nexport const MAX_CART_LINES = 100;\n/** One line's quantity is capped here (`quantity-capped`), before stock. */\nexport const MAX_LINE_QUANTITY = 999;\n/**\n * The largest subtotal, shipping price or threshold, in minor units. Subtotal + shipping stays far below 2^53, and\n * the included-VAT arithmetic never forms a product past it.\n */\nexport const MAX_CART_AMOUNT = 10 ** 15;\n","import { currencyExponent } from './currency';\nimport { decimalToScaledInteger, DecimalRounding, mulDivHalfEven, parseDecimal } from './decimal';\nimport { Money } from './money';\nimport { MoneyError, MoneyErrorCode } from './money-error';\n\nexport const MAX_VAT_PERCENT = 100;\n/** 17, 18, 7.7, 8.1 — four decimals is more than any rate in force; it also keeps the arithmetic below 2^53. */\nexport const VAT_PERCENT_MAX_DECIMALS = 4;\n\nexport function isVatPercent(value: unknown): value is number {\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > MAX_VAT_PERCENT) return false;\n const decimal = parseDecimal(String(value));\n return !!decimal && decimal.frac.length <= VAT_PERCENT_MAX_DECIMALS;\n}\n\n/**\n * The VAT a VAT-INCLUSIVE amount already holds (C-D8): amount × v / (100 + v), rounded ONCE to a minor unit,\n * half-to-even. Exact: v is read as the integer R = v·10^s (s ≤ 4 decimals), so the share is\n * amount × R / (100·10^s + R) in whole numbers. 118.00 at 18 % → 18.00; 100.00 at 17 % → 14.53.\n */\nexport function includedVat(total: Money, vatPercent: number): Money {\n currencyExponent(total.currency);\n if (typeof total.amount !== 'number' || !Number.isSafeInteger(total.amount)) {\n throw new MoneyError(MoneyErrorCode.NotInteger, `total must be a whole number of minor units, got ${String(total.amount)}`);\n }\n if (!isVatPercent(vatPercent)) {\n throw new MoneyError(MoneyErrorCode.OutOfRange, `VAT must be 0–${MAX_VAT_PERCENT} with at most ${VAT_PERCENT_MAX_DECIMALS} decimals, got ${String(vatPercent)}`);\n }\n const decimal = parseDecimal(String(vatPercent))!;\n const scale = decimal.frac.length;\n const rate = decimalToScaledInteger(decimal, scale, DecimalRounding.Exact);\n const magnitude = Math.abs(total.amount);\n if (magnitude > Number.MAX_SAFE_INTEGER / 2) {\n throw new MoneyError(MoneyErrorCode.Overflow, 'Amount is beyond the range VAT is computed for');\n }\n const share = mulDivHalfEven(magnitude, rate, 100 * 10 ** scale + rate);\n return { amount: total.amount < 0 && share !== 0 ? -share : share, currency: total.currency };\n}\n","import { Money } from './money';\n\n/** The storefront's stock word (iox-cms `storefront-projection.ts` speaks the same values). */\nexport enum Availability {\n InStock = 'in_stock',\n Low = 'low',\n Out = 'out',\n}\n\n/**\n * One sellable unit as the seller knows it, in minor units: a product with no options is ONE entry with no\n * `variantId`; a product with options is one entry per variant. iox-cms builds it from the product row (with the\n * stock COUNT); the engine builds it from the storefront projection (with the availability WORD only).\n */\nexport interface CatalogEntry {\n productId: string;\n variantId?: string | null;\n title: string;\n variantName?: string | null;\n /** null = no price set yet (a sample's placeholder): never sold. */\n unitPrice: Money | null;\n compareAt?: Money | null;\n /** The count, where the caller knows it (iox-cms). Wins over `availability`. */\n stock?: number | null;\n /** The word, where only it is known (the engine). */\n availability?: Availability | null;\n /** A variant's switch; a product with no options is `true`. */\n enabled: boolean;\n published: boolean;\n /** false = a digital product: no delivery address, no shipping method. */\n requiresShipping: boolean;\n image?: string | null;\n}\n\n/** How many units may be sold: the count, else 0 for `out` or nothing known, else null = unbounded here (the server checks the count). */\nexport function sellableQuantity(entry: CatalogEntry): number | null {\n if (typeof entry.stock === 'number') return Number.isSafeInteger(entry.stock) && entry.stock > 0 ? entry.stock : 0;\n if (entry.availability === Availability.InStock || entry.availability === Availability.Low) return null;\n return 0;\n}\n\nexport const catalogKey = (productId: string, variantId?: string | null): string => `${productId}\\u0000${variantId ?? ''}`;\n","export const filled = (value: unknown): value is string => typeof value === 'string' && value.trim() !== '';\n\nexport const looksLikeEmail = (value: unknown): boolean => filled(value) && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value.trim());\n\nexport const digitsOf = (value: unknown): string => (typeof value === 'string' ? value.replace(/\\D/g, '') : '');\n\n/** A phone a person can be called on: 7–15 digits once spaces, dashes, brackets and a leading + are dropped. */\nexport const looksLikePhone = (value: unknown): boolean =>\n filled(value) && /^\\+?[\\d\\s\\-().]+$/.test(value.trim()) && digitsOf(value).length >= 7 && digitsOf(value).length <= 15;\n\n/** An Israeli mobile number (Bit sends to one): 05X-XXXXXXX, or +972 5X-XXXXXXX. */\nexport const looksLikeIsraeliMobile = (value: unknown): boolean =>\n filled(value) && /^\\+?[\\d\\s\\-().]+$/.test(value.trim()) && /^(?:9725|05)\\d{8}$/.test(digitsOf(value));\n","import { CurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { MAX_CART_AMOUNT } from './limits';\nimport { isMoney, money, Money, subtractMoney } from './money';\nimport { filled } from './text';\n\n/** Shipping v1 (C-D9): methods per studio, one country. Zones and weights come later. */\nexport enum ShippingMethodKind {\n Pickup = 'pickup',\n Flat = 'flat',\n /** A flat price that becomes free once the goods reach `freeOver`. */\n FreeOver = 'freeOver',\n /** No address, nothing shipped — offered only when nothing in the cart ships. */\n Digital = 'digital',\n}\n\n/** What an owner must fill for a method of a kind. */\nexport enum ShippingField {\n Price = 'price',\n FreeOver = 'freeOver',\n PickupAddress = 'pickupAddress',\n}\n\nexport interface ShippingMethod {\n id: string;\n kind: ShippingMethodKind;\n name: string;\n enabled: boolean;\n price?: Money | null;\n freeOver?: Money | null;\n pickupAddress?: string | null;\n pickupHours?: string | null;\n}\n\ninterface ShippingKindRule {\n readonly needsAddress: boolean;\n /** Offered for a cart where something ships (true) or for one where nothing does (false). */\n readonly forPhysical: boolean;\n readonly requires: readonly ShippingField[];\n readonly price: (method: ShippingMethod, goods: Money) => Money;\n readonly label: CommerceLabel;\n}\n\nconst zero = (goods: Money): Money => money(0, goods.currency);\n\nexport const SHIPPING_KINDS: Readonly<Record<ShippingMethodKind, ShippingKindRule>> = Object.freeze({\n [ShippingMethodKind.Pickup]: {\n needsAddress: false,\n forPhysical: true,\n requires: [ShippingField.PickupAddress],\n price: (_method: ShippingMethod, goods: Money) => zero(goods),\n label: { en: 'Pickup', he: 'איסוף עצמי' },\n },\n [ShippingMethodKind.Flat]: {\n needsAddress: true,\n forPhysical: true,\n requires: [ShippingField.Price],\n price: (method: ShippingMethod) => method.price as Money,\n label: { en: 'Flat-rate delivery', he: 'משלוח במחיר קבוע' },\n },\n [ShippingMethodKind.FreeOver]: {\n needsAddress: true,\n forPhysical: true,\n requires: [ShippingField.Price, ShippingField.FreeOver],\n price: (method: ShippingMethod, goods: Money) =>\n goods.amount >= (method.freeOver as Money).amount ? zero(goods) : (method.price as Money),\n label: { en: 'Delivery, free over an amount', he: 'משלוח, חינם מעל סכום' },\n },\n [ShippingMethodKind.Digital]: {\n needsAddress: false,\n forPhysical: false,\n requires: [],\n price: (_method: ShippingMethod, goods: Money) => zero(goods),\n label: { en: 'Digital — nothing shipped', he: 'דיגיטלי — ללא משלוח' },\n },\n});\n\nconst validAmount = (value: unknown, currency: CurrencyCode): boolean =>\n isMoney(value) && value.currency === currency && value.amount >= 0 && value.amount <= MAX_CART_AMOUNT;\n\nconst SHIPPING_FIELD_CHECKS: Readonly<Record<ShippingField, (method: ShippingMethod, currency: CurrencyCode) => boolean>> = Object.freeze({\n [ShippingField.Price]: (method: ShippingMethod, currency: CurrencyCode) => validAmount(method.price, currency),\n [ShippingField.FreeOver]: (method: ShippingMethod, currency: CurrencyCode) => validAmount(method.freeOver, currency),\n [ShippingField.PickupAddress]: (method: ShippingMethod) => filled(method.pickupAddress),\n});\n\nexport const isShippingMethodKind = (value: unknown): value is ShippingMethodKind =>\n typeof value === 'string' && Object.prototype.hasOwnProperty.call(SHIPPING_KINDS, value);\n\nexport function shippingNeedsAddress(kind: ShippingMethodKind): boolean {\n return isShippingMethodKind(kind) && SHIPPING_KINDS[kind].needsAddress;\n}\n\n/** The fields a method lacks (or holds in another currency) — empty = it can be offered. */\nexport function shippingMethodProblems(method: ShippingMethod, currency: CurrencyCode): ShippingField[] {\n if (!method || !isShippingMethodKind(method.kind)) return [ShippingField.Price];\n return SHIPPING_KINDS[method.kind].requires.filter(field => !SHIPPING_FIELD_CHECKS[field](method, currency));\n}\n\n/** Enabled, complete, with an id and a name: the ONE rule both the offer and the checkout gate read. */\nexport function shippingMethodReady(method: ShippingMethod, currency: CurrencyCode): boolean {\n return !!method && method.enabled === true && filled(method.id) && filled(method.name)\n && shippingMethodProblems(method, currency).length === 0;\n}\n\nexport interface ShippingQuote {\n methodId: string;\n kind: ShippingMethodKind;\n name: string;\n price: Money;\n /** A free-over method whose threshold the goods reached. */\n free: boolean;\n needsAddress: boolean;\n}\n\n/** What a quote reads of a cart. */\nexport interface ShippingGoods {\n currency: CurrencyCode;\n /** The goods after discounts — what a free-over threshold is compared with. */\n goods: Money;\n requiresShipping: boolean;\n lineCount: number;\n}\n\n/** The part of a `PricedCart` the offer reads. */\nexport interface ShippingCart {\n currency: CurrencyCode;\n subtotal: Money;\n discount: Money;\n requiresShipping: boolean;\n lines: readonly unknown[];\n}\n\nexport function quoteShipping(methods: readonly ShippingMethod[], cart: ShippingGoods): ShippingQuote[] {\n const list: readonly ShippingMethod[] = Array.isArray(methods) ? methods : [];\n if (!cart.lineCount) return [];\n const seen = new Set<string>();\n return list\n .filter(method => shippingMethodReady(method, cart.currency)\n && SHIPPING_KINDS[method.kind].forPhysical === cart.requiresShipping\n && !seen.has(method.id) && !!seen.add(method.id))\n .map(method => {\n const rule = SHIPPING_KINDS[method.kind];\n const price = rule.price(method, cart.goods);\n return {\n methodId: method.id,\n kind: method.kind,\n name: method.name,\n price: money(price.amount, price.currency),\n free: method.kind === ShippingMethodKind.FreeOver && price.amount === 0,\n needsAddress: rule.needsAddress,\n };\n });\n}\n\n/**\n * The methods a buyer may choose for this cart, each priced for it (free over: free when the goods after\n * discounts are AT or above the threshold). A cart where nothing ships is offered Digital methods only; a cart\n * where anything ships never is.\n */\nexport function availableShippingMethods(methods: readonly ShippingMethod[], pricedCart: ShippingCart): ShippingQuote[] {\n return quoteShipping(methods, {\n currency: pricedCart.currency,\n goods: subtractMoney(pricedCart.subtotal, pricedCart.discount),\n requiresShipping: pricedCart.requiresShipping,\n lineCount: pricedCart.lines.length,\n });\n}\n\n/**\n * What the goods still lack before a free-over method delivers free (the drawer's \"Add ₪X more for free delivery\"):\n * the smallest gap over the methods offered, null when nothing ships, when no method is free-over, or when one already\n * is free. `methods` are the ready ones (the checkout's options answer only those).\n */\nexport function freeShippingRemaining(\n methods: ReadonlyArray<Pick<ShippingMethod, 'kind'> & { freeOver?: Money | null }>,\n cart: Pick<ShippingCart, 'currency' | 'subtotal' | 'discount' | 'requiresShipping' | 'lines'>,\n): Money | null {\n if (!cart.lines.length || !cart.requiresShipping) return null;\n const goods = subtractMoney(cart.subtotal, cart.discount);\n let gap: Money | null = null;\n for (const method of Array.isArray(methods) ? methods : []) {\n const over = method.kind === ShippingMethodKind.FreeOver ? method.freeOver : null;\n if (!isMoney(over) || over.currency !== cart.currency) continue;\n const left = over.amount - goods.amount;\n if (left <= 0) return null;\n if (!gap || left < gap.amount) gap = money(left, cart.currency);\n }\n return gap;\n}\n","import { CatalogEntry, catalogKey, sellableQuantity } from './catalog';\nimport { CurrencyCode, currencyExponent } from './currency';\nimport { CommerceLabel } from './labels';\nimport { MAX_CART_AMOUNT, MAX_CART_LINES, MAX_LINE_QUANTITY } from './limits';\nimport { addMoney, isMoney, money, Money, subtractMoney, timesMoney } from './money';\nimport { quoteShipping, ShippingMethod, ShippingQuote } from './shipping';\nimport { includedVat, isVatPercent } from './vat';\n\n/** A cart names what and how many — never a price (C-D16, trap T1): every read prices it again. */\nexport interface CartLine {\n productId: string;\n variantId?: string | null;\n quantity: number;\n}\n\nexport interface Cart {\n lines: readonly CartLine[];\n}\n\nexport interface StudioCommerce {\n currency: CurrencyCode;\n /** Prices INCLUDE it (C-D8). */\n vatPercent: number;\n shippingMethods: readonly ShippingMethod[];\n}\n\nexport interface PricingChoice {\n shippingMethodId?: string | null;\n}\n\nexport enum CartIssueCode {\n /** Not a whole number ≥ 1: the line is dropped. */\n InvalidQuantity = 'invalid-quantity',\n /** The same product and variant twice: merged into the first. */\n DuplicateLine = 'duplicate-line',\n TooManyLines = 'too-many-lines',\n QuantityCapped = 'quantity-capped',\n UnknownProduct = 'unknown-product',\n /** The product exists, this variant does not (or the product needs a variant chosen). */\n UnknownVariant = 'unknown-variant',\n Unpublished = 'unpublished',\n VariantDisabled = 'variant-disabled',\n NoPrice = 'no-price',\n CurrencyMismatch = 'currency-mismatch',\n OutOfStock = 'out-of-stock',\n /** Fewer left than asked: the line keeps what is left. */\n QuantityClamped = 'quantity-clamped',\n /** The line would push the subtotal past `MAX_CART_AMOUNT`: dropped. */\n AmountTooLarge = 'amount-too-large',\n /** The chosen shipping method is not offered for this cart: no shipping is priced. */\n ShippingUnavailable = 'shipping-unavailable',\n /** The studio's VAT is not a usable rate: the VAT line reads 0. */\n VatInvalid = 'vat-invalid',\n}\n\nexport const CART_ISSUE_LABELS: Readonly<Record<CartIssueCode, CommerceLabel>> = Object.freeze({\n [CartIssueCode.InvalidQuantity]: { en: 'A quantity was not a whole number, so the item was removed.', he: 'כמות שאינה מספר שלם — הפריט הוסר.' },\n [CartIssueCode.DuplicateLine]: { en: 'The same item appeared twice and was combined.', he: 'אותו פריט הופיע פעמיים ואוחד.' },\n [CartIssueCode.TooManyLines]: { en: 'Your cart has too many different items; the last ones were removed.', he: 'יש בעגלה יותר מדי פריטים שונים; האחרונים הוסרו.' },\n [CartIssueCode.QuantityCapped]: { en: 'That is more than one order can hold; the quantity was lowered.', he: 'הכמות גדולה מהמותר בהזמנה אחת, והיא הוקטנה.' },\n [CartIssueCode.UnknownProduct]: { en: 'An item is no longer sold and was removed.', he: 'פריט כבר לא נמכר והוסר.' },\n [CartIssueCode.UnknownVariant]: { en: 'An option of an item is no longer sold and was removed.', he: 'אפשרות של פריט כבר לא נמכרת והוסרה.' },\n [CartIssueCode.Unpublished]: { en: 'An item is not on sale right now and was removed.', he: 'פריט אינו למכירה כרגע והוסר.' },\n [CartIssueCode.VariantDisabled]: { en: 'An option of an item is not available and was removed.', he: 'אפשרות של פריט אינה זמינה והוסרה.' },\n [CartIssueCode.NoPrice]: { en: 'An item has no price yet and was removed.', he: 'לפריט עדיין אין מחיר, והוא הוסר.' },\n [CartIssueCode.CurrencyMismatch]: { en: 'An item is priced in another currency and was removed.', he: 'פריט מתומחר במטבע אחר והוסר.' },\n [CartIssueCode.OutOfStock]: { en: 'An item is out of stock and was removed.', he: 'פריט אזל מהמלאי והוסר.' },\n [CartIssueCode.QuantityClamped]: { en: 'Fewer are left than you asked for; your cart holds what is left.', he: 'נשארו פחות ממה שביקשתם; בעגלה מה שנשאר.' },\n [CartIssueCode.AmountTooLarge]: { en: 'The order is too large; an item was removed.', he: 'ההזמנה גדולה מדי; פריט הוסר.' },\n [CartIssueCode.ShippingUnavailable]: { en: 'That delivery method is not available for this order. Choose another.', he: 'שיטת המשלוח הזו אינה זמינה להזמנה. בחרו אחרת.' },\n [CartIssueCode.VatInvalid]: { en: 'The shop\\'s VAT rate is not set correctly.', he: 'שיעור המע\"מ של החנות אינו מוגדר כראוי.' },\n});\n\nexport interface CartIssue {\n code: CartIssueCode;\n productId?: string;\n variantId?: string | null;\n /** What the cart asked for. */\n requested?: number;\n /** What the priced line holds now (clamped / capped). */\n quantity?: number;\n shippingMethodId?: string;\n}\n\nexport interface PricedLine {\n productId: string;\n variantId: string | null;\n title: string;\n variantName: string | null;\n quantity: number;\n unitPrice: Money;\n /** Shown struck through — only when it is above the price. */\n compareAt: Money | null;\n lineTotal: Money;\n requiresShipping: boolean;\n image: string | null;\n}\n\nexport interface PricedCart {\n currency: CurrencyCode;\n lines: PricedLine[];\n subtotal: Money;\n /** Zero until coupons (E4); `total` already subtracts it. */\n discount: Money;\n shipping: Money;\n shippingMethod: ShippingQuote | null;\n requiresShipping: boolean;\n /** subtotal − discount + shipping: what the buyer pays. VAT is INSIDE it. */\n total: Money;\n /** The VAT `total` includes: total × v / (100 + v), rounded once half-to-even (`includedVat`). */\n vat: Money;\n vatPercent: number;\n issues: CartIssue[];\n}\n\ninterface LineRefusal {\n readonly code: CartIssueCode;\n readonly refuses: (entry: CatalogEntry, currency: CurrencyCode) => boolean;\n}\n\n/** Checked in order; the first that refuses drops the line. */\nconst LINE_REFUSALS: readonly LineRefusal[] = Object.freeze([\n { code: CartIssueCode.Unpublished, refuses: (entry: CatalogEntry) => entry.published !== true },\n { code: CartIssueCode.VariantDisabled, refuses: (entry: CatalogEntry) => entry.enabled !== true },\n { code: CartIssueCode.NoPrice, refuses: (entry: CatalogEntry) => !isMoney(entry.unitPrice) || entry.unitPrice.amount < 0 },\n { code: CartIssueCode.CurrencyMismatch, refuses: (entry: CatalogEntry, currency: CurrencyCode) => (entry.unitPrice as Money).currency !== currency },\n { code: CartIssueCode.OutOfStock, refuses: (entry: CatalogEntry) => sellableQuantity(entry) === 0 },\n]);\n\nconst isText = (value: unknown): value is string => typeof value === 'string' && value !== '';\nconst variantOf = (line: CartLine): string | null => (isText(line.variantId) ? line.variantId : null);\nconst validQuantity = (quantity: unknown): quantity is number =>\n typeof quantity === 'number' && Number.isSafeInteger(quantity) && quantity >= 1;\n\ninterface WantedLine {\n productId: string;\n variantId: string | null;\n quantity: number;\n}\n\n/** Drops malformed lines, merges duplicates, keeps the first `MAX_CART_LINES` distinct ones. */\nfunction wantedLines(cart: Cart, issues: CartIssue[]): WantedLine[] {\n const lines: readonly CartLine[] = cart && Array.isArray(cart.lines) ? cart.lines : [];\n const byKey = new Map<string, WantedLine>();\n for (const line of lines) {\n const productId = line && isText(line.productId) ? line.productId : '';\n const variantId = line ? variantOf(line) : null;\n if (!productId) {\n issues.push({ code: CartIssueCode.UnknownProduct });\n continue;\n }\n if (!validQuantity(line.quantity)) {\n issues.push({ code: CartIssueCode.InvalidQuantity, productId, variantId });\n continue;\n }\n const key = catalogKey(productId, variantId);\n const same = byKey.get(key);\n if (same) {\n same.quantity = Math.min(same.quantity + line.quantity, Number.MAX_SAFE_INTEGER);\n issues.push({ code: CartIssueCode.DuplicateLine, productId, variantId });\n continue;\n }\n if (byKey.size >= MAX_CART_LINES) {\n issues.push({ code: CartIssueCode.TooManyLines, productId, variantId });\n continue;\n }\n byKey.set(key, { productId, variantId, quantity: line.quantity });\n }\n return [...byKey.values()];\n}\n\nfunction indexCatalog(catalog: readonly CatalogEntry[]): { entries: Map<string, CatalogEntry>; products: Set<string> } {\n const entries = new Map<string, CatalogEntry>();\n const products = new Set<string>();\n const list: readonly CatalogEntry[] = Array.isArray(catalog) ? catalog : [];\n for (const entry of list) {\n if (!entry || !isText(entry.productId)) continue;\n products.add(entry.productId);\n const key = catalogKey(entry.productId, isText(entry.variantId) ? entry.variantId : null);\n if (!entries.has(key)) entries.set(key, entry);\n }\n return { entries, products };\n}\n\nconst compareAtOf = (entry: CatalogEntry, unitPrice: Money): Money | null =>\n isMoney(entry.compareAt) && entry.compareAt.currency === unitPrice.currency && entry.compareAt.amount > unitPrice.amount\n ? money(entry.compareAt.amount, entry.compareAt.currency)\n : null;\n\nfunction lineTotalWithin(unitPrice: Money, quantity: number, subtotal: Money): Money | null {\n try {\n const lineTotal = timesMoney(unitPrice, quantity);\n return subtotal.amount + lineTotal.amount <= MAX_CART_AMOUNT ? lineTotal : null;\n } catch {\n return null;\n }\n}\n\n/**\n * THE pricing function (C-D7, trap T1): the engine shows its result, iox-cms recomputes it at checkout and at\n * payment. Prices come from the catalog only — a cart line carries no number but a quantity. Every money value\n * out is whole minor units in the studio currency. An unusable line is dropped or adjusted and SAID in `issues`.\n */\nexport function priceCart(cart: Cart, catalog: readonly CatalogEntry[], studio: StudioCommerce, choice?: PricingChoice | null): PricedCart {\n const currency = studio.currency;\n currencyExponent(currency);\n const issues: CartIssue[] = [];\n const { entries, products } = indexCatalog(catalog);\n const lines: PricedLine[] = [];\n let subtotal = money(0, currency);\n\n for (const wanted of wantedLines(cart, issues)) {\n const { productId, variantId } = wanted;\n const entry = entries.get(catalogKey(productId, variantId));\n if (!entry) {\n issues.push({ code: products.has(productId) ? CartIssueCode.UnknownVariant : CartIssueCode.UnknownProduct, productId, variantId });\n continue;\n }\n const refusal = LINE_REFUSALS.find(rule => rule.refuses(entry, currency));\n if (refusal) {\n issues.push({ code: refusal.code, productId, variantId, requested: wanted.quantity });\n continue;\n }\n let quantity = wanted.quantity;\n if (quantity > MAX_LINE_QUANTITY) {\n quantity = MAX_LINE_QUANTITY;\n issues.push({ code: CartIssueCode.QuantityCapped, productId, variantId, requested: wanted.quantity, quantity });\n }\n const left = sellableQuantity(entry);\n if (left !== null && quantity > left) {\n const requested = quantity;\n quantity = left;\n issues.push({ code: CartIssueCode.QuantityClamped, productId, variantId, requested, quantity });\n }\n const unitPrice = money((entry.unitPrice as Money).amount, currency);\n const lineTotal = lineTotalWithin(unitPrice, quantity, subtotal);\n if (!lineTotal) {\n issues.push({ code: CartIssueCode.AmountTooLarge, productId, variantId, requested: wanted.quantity });\n continue;\n }\n subtotal = addMoney(subtotal, lineTotal);\n lines.push({\n productId,\n variantId,\n title: String(entry.title ?? ''),\n variantName: isText(entry.variantName) ? entry.variantName : null,\n quantity,\n unitPrice,\n compareAt: compareAtOf(entry, unitPrice),\n lineTotal,\n requiresShipping: entry.requiresShipping !== false,\n image: isText(entry.image) ? entry.image : null,\n });\n }\n\n const discount = money(0, currency);\n const goods = subtractMoney(subtotal, discount);\n const requiresShipping = lines.some(line => line.requiresShipping);\n const chosenId = choice && isText(choice.shippingMethodId) ? choice.shippingMethodId : null;\n const quotes = chosenId ? quoteShipping(studio.shippingMethods, { currency, goods, requiresShipping, lineCount: lines.length }) : [];\n const shippingMethod = chosenId ? quotes.find(quote => quote.methodId === chosenId) ?? null : null;\n if (chosenId && !shippingMethod) issues.push({ code: CartIssueCode.ShippingUnavailable, shippingMethodId: chosenId });\n const shipping = shippingMethod ? shippingMethod.price : money(0, currency);\n const total = addMoney(goods, shipping);\n const vatUsable = isVatPercent(studio.vatPercent);\n if (!vatUsable) issues.push({ code: CartIssueCode.VatInvalid });\n\n return {\n currency,\n lines,\n subtotal,\n discount,\n shipping,\n shippingMethod,\n requiresShipping,\n total,\n vat: vatUsable ? includedVat(total, studio.vatPercent) : money(0, currency),\n vatPercent: vatUsable ? studio.vatPercent : 0,\n issues,\n };\n}\n\n/** The cart a priced cart stands for — what to store back once the buyer has seen the issues. */\nexport function cartOf(priced: PricedCart): Cart {\n return { lines: priced.lines.map(line => ({ productId: line.productId, variantId: line.variantId, quantity: line.quantity })) };\n}\n\n/** Sign-in merge (E3): b's lines join a's; the same product and variant add up. priceCart caps and clamps later. */\nexport function mergeCarts(a: Cart, b: Cart): Cart {\n const merged: CartLine[] = [];\n const byKey = new Map<string, CartLine>();\n const all: CartLine[] = [...(Array.isArray(a?.lines) ? a.lines : []), ...(Array.isArray(b?.lines) ? b.lines : [])];\n for (const line of all.filter(each => !!each && isText(each.productId))) {\n const key = catalogKey(line.productId, variantOf(line));\n const same = byKey.get(key);\n if (same && validQuantity(same.quantity) && validQuantity(line.quantity)) {\n same.quantity = Math.min(same.quantity + line.quantity, Number.MAX_SAFE_INTEGER);\n continue;\n }\n const copy = { productId: line.productId, variantId: variantOf(line), quantity: line.quantity };\n if (!same) byKey.set(key, copy);\n merged.push(copy);\n }\n return { lines: merged };\n}\n","import { CommerceLabel, CommerceLanguage, commerceLanguage, labelIn } from './labels';\nimport { formatMoney, Money } from './money';\nimport { isShippingMethodKind, ShippingMethodKind, SHIPPING_KINDS } from './shipping';\nimport { filled, looksLikeIsraeliMobile } from './text';\n\nexport enum PaymentChannel {\n /** The owner marks the order paid (C-D11). */\n Manual = 'manual',\n /** The studio's PSP; only its verified callback marks the order paid. */\n Online = 'online',\n}\n\nexport enum PaymentMethodKind {\n BankTransfer = 'bankTransfer',\n PayOnPickup = 'payOnPickup',\n CashOnDelivery = 'cashOnDelivery',\n Bit = 'bit',\n /** A PSP's hosted page (E2, Cardcom first) — typed now, not offered yet. */\n Online = 'online',\n}\n\nexport enum PaymentProvider {\n Cardcom = 'cardcom',\n}\n\n/** What an owner fills for a method. */\nexport enum PaymentField {\n AccountName = 'accountName',\n Bank = 'bank',\n Branch = 'branch',\n AccountNumber = 'accountNumber',\n BitPhone = 'bitPhone',\n Provider = 'provider',\n}\n\n/** Which deliveries a method can be used with. */\nexport enum DeliveryFit {\n Any = 'any',\n /** Paid at the counter: only with a pickup method. */\n PickupOnly = 'pickupOnly',\n /** Paid to the courier: only with a method that delivers to an address. */\n AddressOnly = 'addressOnly',\n}\n\ninterface PaymentMethodRule {\n readonly channel: PaymentChannel;\n /** false = typed for a later phase, never shown to a buyer. */\n readonly offered: boolean;\n readonly fields: readonly PaymentField[];\n readonly fit: DeliveryFit;\n readonly label: CommerceLabel;\n /** What the buyer reads after placing the order; `{total}`, `{orderNumber}` and the method's fields fill in. */\n readonly instructions: CommerceLabel;\n}\n\nexport const PAYMENT_METHODS: Readonly<Record<PaymentMethodKind, PaymentMethodRule>> = Object.freeze({\n [PaymentMethodKind.BankTransfer]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [PaymentField.AccountName, PaymentField.Bank, PaymentField.Branch, PaymentField.AccountNumber],\n fit: DeliveryFit.Any,\n label: { en: 'Bank transfer', he: 'העברה בנקאית' },\n instructions: {\n en: 'Transfer {total} to {accountName}, bank {bank}, branch {branch}, account {accountNumber}. Write order {orderNumber} in the transfer\\'s reference. We will confirm your order once the money arrives.',\n he: 'העבירו {total} לחשבון על שם {accountName}, בנק {bank}, סניף {branch}, חשבון {accountNumber}. ציינו את מספר ההזמנה {orderNumber} בפרטי ההעברה. נאשר את ההזמנה כשהכסף יגיע.',\n },\n },\n [PaymentMethodKind.PayOnPickup]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [],\n fit: DeliveryFit.PickupOnly,\n label: { en: 'Pay on pickup', he: 'תשלום באיסוף' },\n instructions: {\n en: 'Pay {total} when you pick up order {orderNumber}.',\n he: 'שלמו {total} כשאתם אוספים את הזמנה {orderNumber}.',\n },\n },\n [PaymentMethodKind.CashOnDelivery]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [],\n fit: DeliveryFit.AddressOnly,\n label: { en: 'Cash on delivery', he: 'מזומן במסירה' },\n instructions: {\n en: 'Pay {total} in cash when order {orderNumber} is delivered.',\n he: 'שלמו {total} במזומן כשהזמנה {orderNumber} נמסרת לכם.',\n },\n },\n [PaymentMethodKind.Bit]: {\n channel: PaymentChannel.Manual,\n offered: true,\n fields: [PaymentField.BitPhone],\n fit: DeliveryFit.Any,\n label: { en: 'Bit', he: 'ביט' },\n instructions: {\n en: 'Send {total} with Bit to {bitPhone}. Write order {orderNumber} in the note. We will confirm your order once the payment arrives.',\n he: 'שלחו {total} בביט למספר {bitPhone}. ציינו את מספר ההזמנה {orderNumber} בהערה. נאשר את ההזמנה כשהתשלום יגיע.',\n },\n },\n [PaymentMethodKind.Online]: {\n channel: PaymentChannel.Online,\n offered: false,\n fields: [PaymentField.Provider],\n fit: DeliveryFit.Any,\n label: { en: 'Card', he: 'כרטיס אשראי' },\n instructions: {\n en: 'You will pay {total} for order {orderNumber} on a secure payment page.',\n he: 'תשלמו {total} עבור הזמנה {orderNumber} בעמוד תשלום מאובטח.',\n },\n },\n});\n\nexport const PAYMENT_FIELD_LABELS: Readonly<Record<PaymentField, CommerceLabel>> = Object.freeze({\n [PaymentField.AccountName]: { en: 'Account holder', he: 'שם בעל החשבון' },\n [PaymentField.Bank]: { en: 'Bank', he: 'בנק' },\n [PaymentField.Branch]: { en: 'Branch', he: 'סניף' },\n [PaymentField.AccountNumber]: { en: 'Account number', he: 'מספר חשבון' },\n [PaymentField.BitPhone]: { en: 'Phone number for Bit', he: 'מספר טלפון לביט' },\n [PaymentField.Provider]: { en: 'Payment provider', he: 'ספק סליקה' },\n});\n\nconst isPaymentProvider = (value: unknown): boolean =>\n typeof value === 'string' && (Object.values(PaymentProvider) as string[]).includes(value);\n\nconst PAYMENT_FIELD_CHECKS: Readonly<Record<PaymentField, (value: unknown) => boolean>> = Object.freeze({\n [PaymentField.AccountName]: filled,\n [PaymentField.Bank]: filled,\n [PaymentField.Branch]: filled,\n [PaymentField.AccountNumber]: filled,\n [PaymentField.BitPhone]: looksLikeIsraeliMobile,\n [PaymentField.Provider]: isPaymentProvider,\n});\n\nconst DELIVERY_FITS: Readonly<Record<DeliveryFit, (kind: ShippingMethodKind | null) => boolean>> = Object.freeze({\n [DeliveryFit.Any]: () => true,\n [DeliveryFit.PickupOnly]: (kind: ShippingMethodKind | null) => kind === ShippingMethodKind.Pickup,\n [DeliveryFit.AddressOnly]: (kind: ShippingMethodKind | null) => !!kind && isShippingMethodKind(kind) && SHIPPING_KINDS[kind].needsAddress,\n});\n\nexport interface PaymentMethodConfig {\n kind: PaymentMethodKind;\n enabled: boolean;\n details?: Partial<Record<PaymentField, string>> | null;\n /** The owner's own words, shown after the instructions. */\n note?: string | null;\n}\n\nexport const isPaymentMethodKind = (value: unknown): value is PaymentMethodKind =>\n typeof value === 'string' && Object.prototype.hasOwnProperty.call(PAYMENT_METHODS, value);\n\nexport function paymentChannelOf(kind: PaymentMethodKind): PaymentChannel {\n return PAYMENT_METHODS[kind].channel;\n}\n\n/** The fields a method lacks or holds in a form it cannot be paid with. */\nexport function paymentMethodProblems(config: PaymentMethodConfig): PaymentField[] {\n if (!config || !isPaymentMethodKind(config.kind)) return [];\n const details = config.details ?? {};\n return PAYMENT_METHODS[config.kind].fields.filter(field => !PAYMENT_FIELD_CHECKS[field](details[field]));\n}\n\n/** Enabled, offered in this phase, complete: the ONE rule the checkout and its gate read. */\nexport function paymentMethodReady(config: PaymentMethodConfig): boolean {\n return !!config && isPaymentMethodKind(config.kind) && config.enabled === true\n && PAYMENT_METHODS[config.kind].offered && paymentMethodProblems(config).length === 0;\n}\n\n/** The methods a buyer may pick with this delivery (null = nothing ships). */\nexport function usablePaymentMethods(configs: readonly PaymentMethodConfig[], shippingKind?: ShippingMethodKind | null): PaymentMethodConfig[] {\n const seen = new Set<PaymentMethodKind>();\n const list: readonly PaymentMethodConfig[] = Array.isArray(configs) ? configs : [];\n return list.filter(config =>\n paymentMethodReady(config)\n && DELIVERY_FITS[PAYMENT_METHODS[config.kind].fit](shippingKind ?? null)\n && !seen.has(config.kind) && !!seen.add(config.kind));\n}\n\nconst LOCALES: Readonly<Record<CommerceLanguage, string>> = Object.freeze({ [CommerceLanguage.En]: 'en-US', [CommerceLanguage.He]: 'he-IL' });\n\n/** What the buyer is told to do, in their language: the method's sentence with the order, the amount and the owner's details, then the owner's note. */\nexport function paymentInstructions(\n config: PaymentMethodConfig,\n order: { orderNumber: string; total: Money },\n lang: string | null | undefined,\n locale?: string,\n): string {\n const rule = PAYMENT_METHODS[config.kind];\n const values: Record<string, string> = {\n ...(config.details ?? {}),\n orderNumber: order.orderNumber,\n total: formatMoney(order.total, locale ?? LOCALES[commerceLanguage(lang)]),\n };\n const sentence = labelIn(rule.instructions, lang).replace(/\\{(\\w+)\\}/g, (_match, name: string) => values[name] ?? '');\n return filled(config.note) ? `${sentence}\\n${config.note.trim()}` : sentence;\n}\n","import { CommerceLabel } from './labels';\nimport { PaymentChannel, paymentChannelOf, PaymentMethodKind } from './payments';\n\n/** C-D11 — the order's closed states. */\nexport enum OrderState {\n /** A manual method: waiting for the owner to see the money. */\n AwaitingPayment = 'awaiting_payment',\n /** An online method: the PSP's page is open. */\n PendingPayment = 'pending_payment',\n Paid = 'paid',\n Fulfilled = 'fulfilled',\n Delivered = 'delivered',\n Cancelled = 'cancelled',\n PaymentFailed = 'payment_failed',\n Refunded = 'refunded',\n PartiallyRefunded = 'partially_refunded',\n}\n\nexport enum OrderEvent {\n /** The buyer tries to pay again after a failure. */\n StartPayment = 'startPayment',\n /** The PSP's verified callback says paid. */\n ConfirmPayment = 'confirmPayment',\n FailPayment = 'failPayment',\n /** The owner saw the money of a manual method. */\n MarkPaid = 'markPaid',\n Fulfil = 'fulfil',\n Deliver = 'deliver',\n Cancel = 'cancel',\n /** Nobody paid in time (the jobs runner). */\n Expire = 'expire',\n Refund = 'refund',\n PartialRefund = 'partialRefund',\n}\n\nexport enum OrderActor {\n Buyer = 'buyer',\n Owner = 'owner',\n /** A VERIFIED payment callback (trap T2) — never the browser's return redirect. */\n PaymentCallback = 'paymentCallback',\n System = 'system',\n}\n\n/** What an order holds of the stock in a state (C-D10). */\nexport enum StockHold {\n None = 'none',\n /** Held for `STOCK_RESERVATION_MINUTES` while a PSP payment is open. */\n Reserved = 'reserved',\n /** Decremented: sold, or promised to a manual order. */\n Taken = 'taken',\n}\n\n/** What the server does to stock when an order moves — read from data, never decided per call site. */\nexport enum StockEffect {\n None = 'none',\n Reserve = 'reserve',\n CommitReservation = 'commitReservation',\n ReleaseReservation = 'releaseReservation',\n /** The conditional atomic decrement (E0's `takeStock`). */\n Take = 'take',\n GiveBack = 'giveBack',\n}\n\nexport enum OrderRefusal {\n /** The event does not apply in this state. */\n InvalidTransition = 'invalid-transition',\n /** It applies — but not from this actor (e.g. the owner marking an online payment paid). */\n ActorNotAllowed = 'actor-not-allowed',\n /** Cancelled and refunded orders move no more. */\n OrderFinal = 'order-final',\n}\n\nexport const STOCK_RESERVATION_MINUTES = 15;\n\nexport const ORDER_STOCK_HOLD: Readonly<Record<OrderState, StockHold>> = Object.freeze({\n [OrderState.AwaitingPayment]: StockHold.Taken,\n [OrderState.PendingPayment]: StockHold.Reserved,\n [OrderState.Paid]: StockHold.Taken,\n [OrderState.Fulfilled]: StockHold.Taken,\n [OrderState.Delivered]: StockHold.Taken,\n [OrderState.Cancelled]: StockHold.None,\n [OrderState.PaymentFailed]: StockHold.None,\n /** A refund never restocks by itself: whether the goods came back is the owner's to say. */\n [OrderState.Refunded]: StockHold.Taken,\n [OrderState.PartiallyRefunded]: StockHold.Taken,\n});\n\n/** from-hold → to-hold → effect. Taken → Reserved never happens (the transitions spec proves it). */\nexport const STOCK_EFFECTS: Readonly<Record<StockHold, Readonly<Record<StockHold, StockEffect>>>> = Object.freeze({\n [StockHold.None]: { [StockHold.None]: StockEffect.None, [StockHold.Reserved]: StockEffect.Reserve, [StockHold.Taken]: StockEffect.Take },\n [StockHold.Reserved]: { [StockHold.None]: StockEffect.ReleaseReservation, [StockHold.Reserved]: StockEffect.None, [StockHold.Taken]: StockEffect.CommitReservation },\n [StockHold.Taken]: { [StockHold.None]: StockEffect.GiveBack, [StockHold.Reserved]: StockEffect.None, [StockHold.Taken]: StockEffect.None },\n});\n\nexport const FINAL_ORDER_STATES: readonly OrderState[] = Object.freeze([OrderState.Cancelled, OrderState.Refunded]);\n\nexport interface OrderTransition {\n readonly from: OrderState;\n readonly event: OrderEvent;\n readonly to: OrderState;\n readonly actors: readonly OrderActor[];\n}\n\nconst OWNER = [OrderActor.Owner];\nconst CALLBACK = [OrderActor.PaymentCallback];\nconst SYSTEM = [OrderActor.System];\nconst REFUNDERS = [OrderActor.Owner, OrderActor.PaymentCallback];\nconst REFUNDABLE = [OrderState.Paid, OrderState.Fulfilled, OrderState.Delivered, OrderState.PartiallyRefunded];\n\n/** THE order state machine (C-D11). Anything not listed is refused. */\nexport const ORDER_TRANSITIONS: readonly OrderTransition[] = Object.freeze([\n { from: OrderState.AwaitingPayment, event: OrderEvent.MarkPaid, to: OrderState.Paid, actors: OWNER },\n { from: OrderState.AwaitingPayment, event: OrderEvent.Cancel, to: OrderState.Cancelled, actors: OWNER },\n { from: OrderState.AwaitingPayment, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.PendingPayment, event: OrderEvent.ConfirmPayment, to: OrderState.Paid, actors: CALLBACK },\n { from: OrderState.PendingPayment, event: OrderEvent.FailPayment, to: OrderState.PaymentFailed, actors: CALLBACK },\n { from: OrderState.PendingPayment, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.PaymentFailed, event: OrderEvent.StartPayment, to: OrderState.PendingPayment, actors: [OrderActor.Buyer] },\n { from: OrderState.PaymentFailed, event: OrderEvent.ConfirmPayment, to: OrderState.Paid, actors: CALLBACK },\n { from: OrderState.PaymentFailed, event: OrderEvent.Cancel, to: OrderState.Cancelled, actors: OWNER },\n { from: OrderState.PaymentFailed, event: OrderEvent.Expire, to: OrderState.Cancelled, actors: SYSTEM },\n { from: OrderState.Paid, event: OrderEvent.Fulfil, to: OrderState.Fulfilled, actors: OWNER },\n { from: OrderState.PartiallyRefunded, event: OrderEvent.Fulfil, to: OrderState.Fulfilled, actors: OWNER },\n { from: OrderState.Fulfilled, event: OrderEvent.Deliver, to: OrderState.Delivered, actors: OWNER },\n ...REFUNDABLE.map(from => ({ from, event: OrderEvent.Refund, to: OrderState.Refunded, actors: REFUNDERS })),\n ...REFUNDABLE.map(from => ({ from, event: OrderEvent.PartialRefund, to: OrderState.PartiallyRefunded, actors: REFUNDERS })),\n]);\n\nexport type OrderMove =\n | { ok: true; state: OrderState; stock: StockEffect }\n | { ok: false; refusal: OrderRefusal };\n\nexport function stockEffect(from: OrderState | null, to: OrderState): StockEffect {\n return STOCK_EFFECTS[from === null ? StockHold.None : ORDER_STOCK_HOLD[from]][ORDER_STOCK_HOLD[to]];\n}\n\n/** The ONE place an order moves: the next state and what to do to the stock, or why not. */\nexport function nextOrderState(state: OrderState, event: OrderEvent, actor: OrderActor): OrderMove {\n const transition = ORDER_TRANSITIONS.find(each => each.from === state && each.event === event);\n if (!transition) {\n return { ok: false, refusal: FINAL_ORDER_STATES.includes(state) ? OrderRefusal.OrderFinal : OrderRefusal.InvalidTransition };\n }\n if (!transition.actors.includes(actor)) return { ok: false, refusal: OrderRefusal.ActorNotAllowed };\n return { ok: true, state: transition.to, stock: stockEffect(state, transition.to) };\n}\n\nconst OPENING_STATE: Readonly<Record<PaymentChannel, OrderState>> = Object.freeze({\n [PaymentChannel.Manual]: OrderState.AwaitingPayment,\n [PaymentChannel.Online]: OrderState.PendingPayment,\n});\n\n/** A new order's state and stock effect: a manual order takes its stock at once, an online one reserves it. */\nexport function openingOrderState(kind: PaymentMethodKind): { state: OrderState; stock: StockEffect } {\n const state = OPENING_STATE[paymentChannelOf(kind)];\n return { state, stock: stockEffect(null, state) };\n}\n\nexport function reservationExpiresAt(now: Date): Date {\n return new Date(now.getTime() + STOCK_RESERVATION_MINUTES * 60000);\n}\n\nexport const ORDER_STATE_LABELS: Readonly<Record<OrderState, CommerceLabel>> = Object.freeze({\n [OrderState.AwaitingPayment]: { en: 'Awaiting payment', he: 'ממתינה לתשלום' },\n [OrderState.PendingPayment]: { en: 'Payment in progress', he: 'תשלום בתהליך' },\n [OrderState.Paid]: { en: 'Paid', he: 'שולמה' },\n [OrderState.Fulfilled]: { en: 'Fulfilled', he: 'טופלה' },\n [OrderState.Delivered]: { en: 'Delivered', he: 'נמסרה' },\n [OrderState.Cancelled]: { en: 'Cancelled', he: 'בוטלה' },\n [OrderState.PaymentFailed]: { en: 'Payment failed', he: 'התשלום נכשל' },\n [OrderState.Refunded]: { en: 'Refunded', he: 'זוכתה' },\n [OrderState.PartiallyRefunded]: { en: 'Partly refunded', he: 'זוכתה חלקית' },\n});\n","import { CurrencyCode, isCurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { paymentMethodReady, PaymentMethodConfig } from './payments';\nimport { ShippingMethod, shippingMethodReady, SHIPPING_KINDS } from './shipping';\nimport { filled, looksLikeEmail, looksLikePhone } from './text';\nimport { isVatPercent } from './vat';\n\n/** The fixed checkout's steps, in order (C-D3); a checkout keeps the FURTHEST it reached (the journey, §3g). */\nexport enum CheckoutStep {\n Contact = 'contact',\n Delivery = 'delivery',\n Payment = 'payment',\n Paid = 'paid',\n}\n\nexport const CHECKOUT_STEPS: readonly CheckoutStep[] = Object.freeze([\n CheckoutStep.Contact,\n CheckoutStep.Delivery,\n CheckoutStep.Payment,\n CheckoutStep.Paid,\n]);\n\nexport const CHECKOUT_STEP_LABELS: Readonly<Record<CheckoutStep, CommerceLabel>> = Object.freeze({\n [CheckoutStep.Contact]: { en: 'Contact', he: 'פרטי קשר' },\n [CheckoutStep.Delivery]: { en: 'Delivery', he: 'משלוח' },\n [CheckoutStep.Payment]: { en: 'Payment', he: 'תשלום' },\n [CheckoutStep.Paid]: { en: 'Paid', he: 'שולם' },\n});\n\nexport function furthestStep(a: CheckoutStep | null | undefined, b: CheckoutStep | null | undefined): CheckoutStep {\n const rank = (step: CheckoutStep | null | undefined) => (step ? CHECKOUT_STEPS.indexOf(step) : -1);\n const best = rank(a) >= rank(b) ? a : b;\n return best && CHECKOUT_STEPS.includes(best) ? best : CheckoutStep.Contact;\n}\n\n/** The pages the OWNER writes and links from checkout (§3k). IOX never writes their text (T14). */\nexport enum LegalPage {\n Terms = 'terms',\n Returns = 'returns',\n Shipping = 'shipping',\n Privacy = 'privacy',\n}\n\n/** Who sells, as Israel's Consumer Protection Law asks a distance seller to say (§3k). */\nexport interface BusinessIdentity {\n legalName?: string | null;\n /** עוסק מורשה / ח.פ / ת.ז */\n businessNumber?: string | null;\n address?: string | null;\n email?: string | null;\n phone?: string | null;\n}\n\nexport interface CheckoutGateFacts {\n currency: unknown;\n vatPercent: unknown;\n paymentMethods: readonly PaymentMethodConfig[];\n shippingMethods: readonly ShippingMethod[];\n /** Any product of the studio that is not digital. */\n anyProductShips: boolean;\n business: BusinessIdentity;\n /** Each page exists and checkout links it. */\n legalPages: Partial<Record<LegalPage, boolean>>;\n}\n\nexport enum CheckoutGateArea {\n Payment = 'payment',\n Money = 'money',\n Shipping = 'shipping',\n Business = 'business',\n LegalPages = 'legalPages',\n}\n\nexport enum CheckoutGateCode {\n NoPaymentMethod = 'no-payment-method',\n CurrencyNotSet = 'currency-not-set',\n VatNotSet = 'vat-not-set',\n NoShippingMethod = 'no-shipping-method',\n BusinessNameMissing = 'business-name-missing',\n BusinessNumberMissing = 'business-number-missing',\n BusinessAddressMissing = 'business-address-missing',\n BusinessEmailMissing = 'business-email-missing',\n BusinessPhoneMissing = 'business-phone-missing',\n TermsPageMissing = 'terms-page-missing',\n ReturnsPageMissing = 'returns-page-missing',\n ShippingPageMissing = 'shipping-page-missing',\n PrivacyPageMissing = 'privacy-page-missing',\n}\n\ninterface CheckoutGateRule {\n readonly code: CheckoutGateCode;\n readonly area: CheckoutGateArea;\n readonly refuses: (facts: CheckoutGateFacts) => boolean;\n readonly label: CommerceLabel;\n}\n\nconst ships = (facts: CheckoutGateFacts) => facts.anyProductShips === true;\nconst page = (facts: CheckoutGateFacts, which: LegalPage) => facts.legalPages?.[which] === true;\nconst business = (facts: CheckoutGateFacts): BusinessIdentity => facts.business ?? {};\n\n/** THE checkout gate (C-D19), in the order the owner fixes things. The server refuses with it; the admin shows the same rows. */\nexport const CHECKOUT_GATE_RULES: readonly CheckoutGateRule[] = Object.freeze([\n {\n code: CheckoutGateCode.NoPaymentMethod,\n area: CheckoutGateArea.Payment,\n refuses: (facts: CheckoutGateFacts) => !(facts.paymentMethods ?? []).some(paymentMethodReady),\n label: { en: 'Turn on a way to get paid', he: 'הפעילו אמצעי תשלום' },\n },\n {\n code: CheckoutGateCode.CurrencyNotSet,\n area: CheckoutGateArea.Money,\n refuses: (facts: CheckoutGateFacts) => !isCurrencyCode(facts.currency),\n label: { en: 'Set the shop\\'s currency', he: 'הגדירו את מטבע החנות' },\n },\n {\n code: CheckoutGateCode.VatNotSet,\n area: CheckoutGateArea.Money,\n refuses: (facts: CheckoutGateFacts) => !isVatPercent(facts.vatPercent),\n label: { en: 'Set the VAT rate', he: 'הגדירו את שיעור המע\"מ' },\n },\n {\n code: CheckoutGateCode.NoShippingMethod,\n area: CheckoutGateArea.Shipping,\n refuses: (facts: CheckoutGateFacts) => ships(facts) && !(isCurrencyCode(facts.currency)\n && (facts.shippingMethods ?? []).some(method => shippingMethodReady(method, facts.currency as CurrencyCode)\n && SHIPPING_KINDS[method.kind].forPhysical)),\n label: { en: 'Add a delivery or pickup method', he: 'הוסיפו שיטת משלוח או איסוף' },\n },\n {\n code: CheckoutGateCode.BusinessNameMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).legalName),\n label: { en: 'Add the business\\'s legal name', he: 'הוסיפו את השם הרשמי של העסק' },\n },\n {\n code: CheckoutGateCode.BusinessNumberMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).businessNumber),\n label: { en: 'Add the business number (company or VAT dealer number)', he: 'הוסיפו מספר עוסק או ח.פ' },\n },\n {\n code: CheckoutGateCode.BusinessAddressMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !filled(business(facts).address),\n label: { en: 'Add the business address', he: 'הוסיפו את כתובת העסק' },\n },\n {\n code: CheckoutGateCode.BusinessEmailMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !looksLikeEmail(business(facts).email),\n label: { en: 'Add an email buyers can write to', he: 'הוסיפו כתובת אימייל לפניות קונים' },\n },\n {\n code: CheckoutGateCode.BusinessPhoneMissing,\n area: CheckoutGateArea.Business,\n refuses: (facts: CheckoutGateFacts) => !looksLikePhone(business(facts).phone),\n label: { en: 'Add a phone number buyers can call', he: 'הוסיפו מספר טלפון לפניות קונים' },\n },\n {\n code: CheckoutGateCode.TermsPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Terms),\n label: { en: 'Write your terms of sale page', he: 'כתבו עמוד תקנון ותנאי מכירה' },\n },\n {\n code: CheckoutGateCode.ReturnsPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Returns),\n label: { en: 'Write your returns and cancellation page', he: 'כתבו עמוד מדיניות החזרות וביטולים' },\n },\n {\n code: CheckoutGateCode.ShippingPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => ships(facts) && !page(facts, LegalPage.Shipping),\n label: { en: 'Write your shipping page', he: 'כתבו עמוד מדיניות משלוחים' },\n },\n {\n code: CheckoutGateCode.PrivacyPageMissing,\n area: CheckoutGateArea.LegalPages,\n refuses: (facts: CheckoutGateFacts) => !page(facts, LegalPage.Privacy),\n label: { en: 'Write your privacy page', he: 'כתבו עמוד מדיניות פרטיות' },\n },\n]);\n\nexport interface CheckoutGateRefusal {\n code: CheckoutGateCode;\n area: CheckoutGateArea;\n label: CommerceLabel;\n}\n\nexport interface CheckoutGateResult {\n open: boolean;\n refusals: CheckoutGateRefusal[];\n}\n\n/** Checkout opens only when no rule refuses (C-D19, trap T9: the server's, never a hidden button). */\nexport function checkoutGate(facts: CheckoutGateFacts): CheckoutGateResult {\n const refusals = CHECKOUT_GATE_RULES\n .filter(rule => rule.refuses(facts))\n .map(rule => ({ code: rule.code, area: rule.area, label: rule.label }));\n return { open: refusals.length === 0, refusals };\n}\n","import { PricedCart } from './cart';\nimport { CurrencyCode } from './currency';\nimport { Money, money } from './money';\nimport { PaymentChannel, paymentChannelOf, PaymentField, PaymentMethodConfig, PaymentMethodKind, usablePaymentMethods } from './payments';\nimport { ShippingMethodKind } from './shipping';\nimport { filled, looksLikeEmail } from './text';\n\nexport interface PostalAddress {\n line1: string;\n line2?: string | null;\n city: string;\n postalCode?: string | null;\n /** ISO 3166-1 alpha-2 — one country in v1 (C-D9). */\n country: string;\n}\n\nexport interface OrderBuyer {\n email: string;\n name: string;\n phone?: string | null;\n /** Needed when the delivery method delivers to an address. */\n address?: PostalAddress | null;\n}\n\nexport enum OrderSnapshotRefusal {\n EmptyCart = 'empty-cart',\n /** The priced cart has issues the buyer has not seen: show them the priced cart first. */\n CartChanged = 'cart-changed',\n ShippingNotChosen = 'shipping-not-chosen',\n AddressRequired = 'address-required',\n EmailRequired = 'email-required',\n NameRequired = 'name-required',\n /** Not enabled, not complete, not offered yet, or not usable with this delivery. */\n PaymentMethodUnusable = 'payment-method-unusable',\n}\n\nexport interface OrderSnapshotLine {\n readonly productId: string;\n readonly variantId: string | null;\n readonly title: string;\n readonly variantName: string | null;\n readonly quantity: number;\n readonly unitPrice: Money;\n readonly lineTotal: Money;\n readonly requiresShipping: boolean;\n}\n\n/** What an order stores: frozen, so a later price, name or bank-detail change never changes a placed order. */\nexport interface OrderSnapshot {\n readonly currency: CurrencyCode;\n readonly lines: readonly OrderSnapshotLine[];\n readonly subtotal: Money;\n readonly discount: Money;\n readonly shipping: Money;\n readonly delivery: { readonly methodId: string; readonly kind: ShippingMethodKind; readonly name: string } | null;\n readonly total: Money;\n readonly vat: { readonly percent: number; readonly amount: Money };\n readonly payment: {\n readonly kind: PaymentMethodKind;\n readonly channel: PaymentChannel;\n readonly details: Readonly<Partial<Record<PaymentField, string>>>;\n readonly note: string | null;\n };\n readonly buyer: Readonly<OrderBuyer>;\n}\n\nexport type OrderSnapshotResult =\n | { ok: true; snapshot: OrderSnapshot }\n | { ok: false; refusals: OrderSnapshotRefusal[] };\n\nfunction deepFreeze<T>(value: T): T {\n if (value && typeof value === 'object' && !Object.isFrozen(value)) {\n Object.freeze(value);\n for (const key of Object.keys(value as object)) deepFreeze((value as Record<string, unknown>)[key]);\n }\n return value;\n}\n\nconst copyMoney = (value: Money): Money => money(value.amount, value.currency);\nconst text = (value: unknown): string | null => (filled(value) ? value.trim() : null);\n\nfunction copyAddress(address: PostalAddress | null | undefined): PostalAddress | null {\n if (!address || !filled(address.line1) || !filled(address.city) || !filled(address.country)) return null;\n return {\n line1: address.line1.trim(),\n line2: text(address.line2),\n city: address.city.trim(),\n postalCode: text(address.postalCode),\n country: address.country.trim(),\n };\n}\n\ninterface SnapshotRule {\n readonly refusal: OrderSnapshotRefusal;\n readonly refuses: (priced: PricedCart, payment: PaymentMethodConfig, buyer: OrderBuyer) => boolean;\n}\n\nconst SNAPSHOT_RULES: readonly SnapshotRule[] = Object.freeze([\n { refusal: OrderSnapshotRefusal.EmptyCart, refuses: (priced: PricedCart) => !priced.lines.length },\n { refusal: OrderSnapshotRefusal.CartChanged, refuses: (priced: PricedCart) => priced.issues.length > 0 },\n { refusal: OrderSnapshotRefusal.ShippingNotChosen, refuses: (priced: PricedCart) => priced.requiresShipping && !priced.shippingMethod },\n {\n refusal: OrderSnapshotRefusal.AddressRequired,\n refuses: (priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !!priced.shippingMethod?.needsAddress && !copyAddress(buyer?.address),\n },\n { refusal: OrderSnapshotRefusal.EmailRequired, refuses: (_priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !looksLikeEmail(buyer?.email) },\n { refusal: OrderSnapshotRefusal.NameRequired, refuses: (_priced: PricedCart, _payment: PaymentMethodConfig, buyer: OrderBuyer) => !filled(buyer?.name) },\n {\n refusal: OrderSnapshotRefusal.PaymentMethodUnusable,\n refuses: (priced: PricedCart, payment: PaymentMethodConfig) => usablePaymentMethods([payment], priced.shippingMethod?.kind ?? null).length === 0,\n },\n]);\n\n/** Freezes what an order stores (lines, unit prices, totals, VAT, currency, delivery, payment, buyer) — or says why it cannot. */\nexport function orderSnapshot(pricedCart: PricedCart, payment: PaymentMethodConfig, buyer: OrderBuyer): OrderSnapshotResult {\n const refusals = SNAPSHOT_RULES.filter(rule => rule.refuses(pricedCart, payment, buyer)).map(rule => rule.refusal);\n if (refusals.length) return { ok: false, refusals };\n const delivery = pricedCart.shippingMethod;\n const snapshot: OrderSnapshot = {\n currency: pricedCart.currency,\n lines: pricedCart.lines.map(line => ({\n productId: line.productId,\n variantId: line.variantId,\n title: line.title,\n variantName: line.variantName,\n quantity: line.quantity,\n unitPrice: copyMoney(line.unitPrice),\n lineTotal: copyMoney(line.lineTotal),\n requiresShipping: line.requiresShipping,\n })),\n subtotal: copyMoney(pricedCart.subtotal),\n discount: copyMoney(pricedCart.discount),\n shipping: copyMoney(pricedCart.shipping),\n delivery: delivery ? { methodId: delivery.methodId, kind: delivery.kind, name: delivery.name } : null,\n total: copyMoney(pricedCart.total),\n vat: { percent: pricedCart.vatPercent, amount: copyMoney(pricedCart.vat) },\n payment: {\n kind: payment.kind,\n channel: paymentChannelOf(payment.kind),\n details: { ...(payment.details ?? {}) },\n note: text(payment.note),\n },\n buyer: {\n email: buyer.email.trim(),\n name: buyer.name.trim(),\n phone: text(buyer.phone),\n address: delivery?.needsAddress ? copyAddress(buyer.address) : null,\n },\n };\n return { ok: true, snapshot: deepFreeze(snapshot) };\n}\n","import { Availability, CatalogEntry } from './catalog';\nimport { CurrencyCode, isCurrencyCode } from './currency';\nimport { isMoney, majorToMinor, migrateMajorPrice, money, Money } from './money';\n\n/**\n * A product's OPTIONS and its VARIANTS as the storefront serves them (iox-cms `storefront-projection.ts`), read into\n * what a product page needs (commerce plan §3i, trap T26): which values each option offers, which of them can still be\n * bought given what is already chosen, and the variant a full choice names.\n *\n * A stored variant has no option map, only a flat NAME — the option values in option order joined by `-` (the admin's\n * `product.component.ts` `generateCombinations`: \"Red-M\"). A name is matched against every combination of the options'\n * values, never split on `-`, so a value that holds a `-` (\"Off-white\") still reads.\n */\nexport const VARIANT_NAME_SEPARATOR = '-';\n/** The one variant row a product with no options keeps (iox-cms `DEFAULT_VARIANT_NAME`). */\nexport const DEFAULT_VARIANT_NAME = 'Default';\n\nexport interface ProductOption {\n name: string;\n values: string[];\n}\n\n/** One variant row as the storefront serves it: prices in MAJOR units of the product's `currency`. */\nexport interface StorefrontVariant {\n _id?: string;\n name?: string;\n enable?: boolean;\n image?: string | null;\n price?: number | string | null;\n compareat?: number | string | null;\n availability?: string | null;\n}\n\n/** A product as the storefront serves it (the allowlist in iox-cms `STOREFRONT_FIELDS`). */\nexport interface StorefrontProduct {\n _id?: string;\n title?: string;\n slug?: string;\n mainImage?: string | null;\n productVariants?: boolean;\n pricing?: { price?: number | string | null; compareat?: number | string | null } | null;\n options?: ReadonlyArray<{ name?: string; values?: ReadonlyArray<unknown> }> | null;\n variants?: ReadonlyArray<StorefrontVariant> | null;\n currency?: string | null;\n availability?: string | null;\n}\n\n/** Option name → the value chosen. */\nexport type VariantChoice = Readonly<Record<string, string>>;\n\n/** One variant, read: its id (null for a product with no variant row), its choice, its money and whether it sells. */\nexport interface ProductVariantView {\n variantId: string | null;\n name: string | null;\n choice: VariantChoice;\n price: Money | null;\n /** Only when it is above the price (shown struck through). */\n compareAt: Money | null;\n image: string | null;\n availability: Availability;\n /** The variant's own switch (a product with no options: true). */\n enabled: boolean;\n /** Can be put in a cart: switched on, priced, not `out`. */\n sellable: boolean;\n}\n\nexport interface OptionValueState {\n value: string;\n /** Some sellable variant has this value, given the choices of the options BEFORE this one. */\n available: boolean;\n selected: boolean;\n}\n\nexport interface OptionState {\n name: string;\n values: OptionValueState[];\n}\n\nconst isRecord = (value: unknown): value is Record<string, any> => !!value && typeof value === 'object' && !Array.isArray(value);\nconst text = (value: unknown): string => (typeof value === 'string' ? value.trim() : typeof value === 'number' && Number.isFinite(value) ? String(value) : '');\n\n/** True for something the storefront could have served as a product: a title and a price or variants. */\nexport function isStorefrontProduct(value: unknown): value is StorefrontProduct {\n return isRecord(value) && typeof value['title'] === 'string' && (isRecord(value['pricing']) || Array.isArray(value['variants']));\n}\n\n/** The product's currency, or null when it names none we know (a price is then never shown — never guessed). */\nexport function productCurrency(product: StorefrontProduct | null | undefined): CurrencyCode | null {\n const code = text(product?.currency).toUpperCase();\n return isCurrencyCode(code) ? code : null;\n}\n\n/** The options a product offers, cleaned: named, each value once, no empty value. None when it has no variants. */\nexport function productOptions(product: StorefrontProduct | null | undefined): ProductOption[] {\n if (!product?.productVariants || !Array.isArray(product.options)) return [];\n const out: ProductOption[] = [];\n for (const raw of product.options) {\n const name = text(raw?.name);\n if (!name || out.some(o => o.name === name)) continue;\n const values: string[] = [];\n for (const v of Array.isArray(raw?.values) ? raw!.values! : []) {\n const value = text(v);\n if (value && !values.includes(value)) values.push(value);\n }\n if (values.length) out.push({ name, values });\n }\n return out;\n}\n\n/** Every full choice of `options`, in the admin's order, with the variant name it writes. */\nfunction combinations(options: ReadonlyArray<ProductOption>): Array<{ name: string; choice: VariantChoice }> {\n let acc: Array<{ parts: string[]; choice: Record<string, string> }> = [{ parts: [], choice: {} }];\n for (const option of options) {\n const next: typeof acc = [];\n for (const partial of acc) {\n for (const value of option.values) next.push({ parts: [...partial.parts, value], choice: { ...partial.choice, [option.name]: value } });\n }\n acc = next;\n }\n return acc.map(c => ({ name: c.parts.join(VARIANT_NAME_SEPARATOR), choice: c.choice }));\n}\n\n/** The choice a stored variant's flat name stands for, or null when no combination of the options writes it. */\nexport function variantChoiceOf(variant: StorefrontVariant | null | undefined, options: ReadonlyArray<ProductOption>): VariantChoice | null {\n const name = text(variant?.name);\n if (!name || !options.length) return null;\n return combinations(options).find(c => c.name === name)?.choice ?? null;\n}\n\n/** A stored major-unit price as Money, or null (no price, a currency we do not know, a value that is no price). */\nexport function storefrontMoney(value: unknown, currency: CurrencyCode | null): Money | null {\n if (!currency) return null;\n if (isMoney(value)) return value.currency === currency ? value : null;\n if (typeof value !== 'number' && typeof value !== 'string') return null;\n if (typeof value === 'string' && value.trim() === '') return null;\n try {\n return money(majorToMinor(value, currency), currency);\n } catch {\n const minor = migrateMajorPrice(value, currency);\n return minor === null ? null : money(minor, currency);\n }\n}\n\nconst AVAILABILITIES = Object.values(Availability) as string[];\n\nfunction availabilityOf(value: unknown, enabled: boolean): Availability {\n if (!enabled) return Availability.Out;\n return AVAILABILITIES.includes(text(value)) ? text(value) as Availability : Availability.InStock;\n}\n\nfunction aboveOnly(compareAt: Money | null, price: Money | null): Money | null {\n return compareAt && price && compareAt.amount > price.amount ? compareAt : null;\n}\n\n/**\n * Every variant of a product, read. A product with no options is ONE view: its Default row's id (or null when it has\n * no row) and the product's own price. A variant whose name matches no combination of the options is left out — the\n * page cannot offer what it cannot name.\n */\nexport function productVariants(product: StorefrontProduct | null | undefined): ProductVariantView[] {\n if (!product) return [];\n const currency = productCurrency(product);\n const options = productOptions(product);\n const rows: StorefrontVariant[] = Array.isArray(product.variants) ? product.variants.filter(isRecord) as StorefrontVariant[] : [];\n const view = (row: StorefrontVariant | null, choice: VariantChoice, priceRaw: unknown, compareRaw: unknown, image: unknown, availability: unknown): ProductVariantView => {\n const enabled = row?.enable !== false;\n const price = storefrontMoney(priceRaw, currency);\n const state = availabilityOf(availability, enabled);\n return {\n variantId: text(row?._id) || null,\n name: text(row?.name) || null,\n choice,\n price,\n compareAt: aboveOnly(storefrontMoney(compareRaw, currency), price),\n image: text(image) || null,\n availability: state,\n enabled,\n sellable: enabled && !!price && state !== Availability.Out,\n };\n };\n if (!options.length) {\n const row = rows.find(r => r.name === DEFAULT_VARIANT_NAME) ?? (rows.length === 1 ? rows[0] : null);\n const pricing = product.pricing ?? {};\n return [view(row, {}, row?.price ?? pricing.price, row?.compareat ?? pricing.compareat, row?.image || product.mainImage,\n row?.availability ?? product.availability)];\n }\n const out: ProductVariantView[] = [];\n for (const row of rows) {\n const choice = variantChoiceOf(row, options);\n if (choice) out.push(view(row, choice, row.price, row.compareat, row.image || product.mainImage, row.availability));\n }\n return out;\n}\n\nconst matches = (variant: ProductVariantView, choice: VariantChoice, names: ReadonlyArray<string>): boolean =>\n names.every(name => choice[name] === undefined || variant.choice[name] === choice[name]);\n\n/** The variant a FULL choice names, or null (a choice that misses an option, or names no stored variant). */\nexport function findVariant(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice): ProductVariantView | null {\n if (!options.length) return variants[0] ?? null;\n if (options.some(o => !choice[o.name])) return null;\n return variants.find(v => options.every(o => v.choice[o.name] === choice[o.name])) ?? null;\n}\n\n/**\n * What each option offers now. Availability CASCADES in option order (the way a buyer reads the page, top to bottom):\n * a value of the first option is available when ANY sellable variant has it; a value of a later option, when a\n * sellable variant has it together with the values chosen for the options before it. So a buyer can always change an\n * earlier option and the later ones follow (`chooseValue`) — never stuck behind a combination that is sold out.\n */\nexport function optionValueStates(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice): OptionState[] {\n const sellable = variants.filter(v => v.sellable);\n return options.map((option, index) => {\n const before = options.slice(0, index).map(o => o.name);\n return {\n name: option.name,\n values: option.values.map(value => ({\n value,\n available: sellable.some(v => v.choice[option.name] === value && matches(v, choice, before)),\n selected: choice[option.name] === value,\n })),\n };\n });\n}\n\n/** The choice a page opens with: the first sellable variant's, else the first value of every option. */\nexport function defaultChoice(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>): VariantChoice {\n const first = variants.find(v => v.sellable && options.every(o => v.choice[o.name]));\n if (first) return { ...first.choice };\n return Object.fromEntries(options.map(o => [o.name, o.values[0]]));\n}\n\n/**\n * The buyer picks `value` for option `name`. The options AFTER it keep their value while it is still available after\n * the change, else move to their first available value (else keep it — the page then says the combination is sold out).\n * An unknown option or value changes nothing.\n */\nexport function chooseValue(options: ReadonlyArray<ProductOption>, variants: ReadonlyArray<ProductVariantView>, choice: VariantChoice,\n name: string, value: string): VariantChoice {\n const at = options.findIndex(o => o.name === name);\n if (at < 0 || !options[at].values.includes(value)) return choice;\n const next: Record<string, string> = { ...choice, [name]: value };\n for (let i = at + 1; i < options.length; i++) {\n const state = optionValueStates(options, variants, next)[i];\n const keeps = state.values.find(v => v.value === next[options[i].name])?.available;\n if (keeps) continue;\n const first = state.values.find(v => v.available);\n if (first) next[options[i].name] = first.value;\n }\n return next;\n}\n\n/** The catalog entries a storefront product sells (one per variant, or one for a product with no options) — what\n * `priceCart` reads where only the storefront is known (the builder canvas's simulated cart). iox-cms builds its own\n * from the stored row, with the stock COUNT. */\nexport function storefrontCatalog(product: StorefrontProduct | null | undefined): CatalogEntry[] {\n const productId = text(product?._id);\n if (!product || !productId) return [];\n const hasOptions = productOptions(product).length > 0;\n return productVariants(product).map(v => ({\n productId,\n variantId: hasOptions ? v.variantId : null,\n title: text(product.title),\n variantName: hasOptions ? Object.values(v.choice).join(' · ') : null,\n unitPrice: v.price,\n compareAt: v.compareAt,\n availability: v.availability,\n enabled: v.enabled,\n published: true,\n requiresShipping: true,\n image: v.image,\n }));\n}\n\n/** The words a chosen variant is shown with in a cart line (\"Sand · 32 cm\"). */\nexport function variantWords(choice: VariantChoice, options: ReadonlyArray<ProductOption>): string {\n return options.map(o => choice[o.name]).filter(Boolean).join(' · ');\n}\n\n// ── the product in scope ─────────────────────────────────────────────────────────────────────\n\n/** The data keys a product page's own item sits under (the route's item first — relative data sources). */\nconst ROUTE_KEYS: ReadonlyArray<string> = ['$current', '$route'];\n\n/**\n * The product an element is about, the SAME rule on the builder canvas and the live site: the repeated row it sits in\n * when that row is a product (a card in a product list), else the page's route item, else the first product the page's\n * data holds (a product page bound to one product). Null when the page has none.\n */\nexport function productInScope(rowItem: unknown, data: Readonly<Record<string, unknown>> | null | undefined): StorefrontProduct | null {\n if (isStorefrontProduct(rowItem)) return rowItem;\n const all = data ?? {};\n for (const key of ROUTE_KEYS) if (isStorefrontProduct(all[key])) return all[key] as StorefrontProduct;\n for (const value of Object.values(all)) if (isStorefrontProduct(value)) return value;\n return null;\n}\n\n/** What the `$variant` slot carries: the chosen variant, its product, its words and the quantity a buyer would add. */\nexport interface VariantSlot extends ProductVariantView {\n productId: string | undefined;\n words: string;\n quantity: number;\n}\n\n/**\n * The `$variant` slot for a product — the SAME value the shop runtime publishes on the canvas and the live site, and\n * the engine seeds during SSR (so the raw HTML already shows the price). `choice` defaults to the first sellable one.\n */\nexport function variantSlotOf(product: StorefrontProduct | null | undefined, choice?: VariantChoice | null, quantity = 1): VariantSlot | null {\n if (!product) return null;\n const options = productOptions(product);\n const views = productVariants(product);\n const pick = choice ?? defaultChoice(options, views);\n const variant = options.length ? findVariant(options, views, pick) : views[0] ?? null;\n return variant ? { ...variant, productId: product._id, words: variantWords(variant.choice, options), quantity } : null;\n}\n","import { Availability } from './catalog';\nimport { MAX_LINE_QUANTITY } from './limits';\n\n/**\n * The quantity a buyer may ask for — the stepper on a product page and on every cart line (commerce plan §3i). Whole\n * numbers only, the forms-core number rule: anything that is not a whole number reads as the least. The most is the\n * one-line cap (`MAX_LINE_QUANTITY`), lowered to the count when the count is known (iox-cms) — the storefront knows only\n * a word, so it caps at the line cap and the server clamps (`priceCart` QuantityClamped).\n */\nexport const MIN_LINE_QUANTITY = 1;\n\nexport interface QuantityBounds {\n min: number;\n /** Below `min` (0) when nothing can be bought: the stepper is off. */\n max: number;\n}\n\nexport enum QuantityStep {\n Down = -1,\n Up = 1,\n}\n\n/** What a stepper allows for a unit with this count / word. `out` (or a count of 0) allows nothing. */\nexport function quantityBounds(unit?: { stock?: number | null; availability?: string | null } | null): QuantityBounds {\n if (typeof unit?.stock === 'number') {\n const left = Number.isSafeInteger(unit.stock) && unit.stock > 0 ? unit.stock : 0;\n return { min: MIN_LINE_QUANTITY, max: Math.min(MAX_LINE_QUANTITY, left) };\n }\n if (unit?.availability === Availability.Out) return { min: MIN_LINE_QUANTITY, max: 0 };\n return { min: MIN_LINE_QUANTITY, max: MAX_LINE_QUANTITY };\n}\n\n/** True when the bounds allow buying at all. */\nexport function canBuy(bounds: QuantityBounds): boolean {\n return bounds.max >= bounds.min;\n}\n\n/** A quantity held within the bounds; not a whole number → the least. */\nexport function clampQuantity(value: unknown, bounds: QuantityBounds): number {\n const n = typeof value === 'number' ? value : typeof value === 'string' && value.trim() !== '' ? Number(value) : NaN;\n if (!Number.isSafeInteger(n)) return bounds.min;\n if (!canBuy(bounds)) return bounds.min;\n return Math.min(bounds.max, Math.max(bounds.min, n));\n}\n\n/** True when a step in `direction` stays within the bounds. */\nexport function canStep(value: number, direction: QuantityStep, bounds: QuantityBounds): boolean {\n if (!canBuy(bounds)) return false;\n const next = clampQuantity(value, bounds) + direction;\n return next >= bounds.min && next <= bounds.max;\n}\n\n/** One step, held within the bounds. */\nexport function stepQuantity(value: unknown, direction: QuantityStep, bounds: QuantityBounds): number {\n return clampQuantity(clampQuantity(value, bounds) + direction, bounds);\n}\n","import { CatalogEntry, catalogKey } from './catalog';\nimport { Cart, CART_ISSUE_LABELS, cartOf, CartIssue, PricedCart, PricedLine, priceCart, StudioCommerce } from './cart';\nimport { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { MAX_LINE_QUANTITY } from './limits';\nimport { Money } from './money';\nimport { quantityBounds } from './quantity';\n\n/**\n * The CART TRANSPORT CONTRACT (commerce plan §3d, C-D16) — what a host provides so the builder's shop parts can show and\n * change a visitor's cart. The parts own no HTTP, exactly like a form (forms-core `transport.ts`, the §6b lesson: a\n * part that emits and a host that never answers ships a dead button behind green tests):\n *\n * - the LIVE SITE (the engine, commerce E1d) implements it over iox-cms's hardened cart routes (`cartEndpointPath`): the\n * server prices every read with `priceCart` and the transport hands back its `CartView` — a browser never computes a\n * price it charges (trap T1);\n * - the BUILDER CANVAS uses `simulatedCartTransport`: an in-memory cart over sample data, never written anywhere\n * (trap T8: the canvas never writes a cart).\n *\n * Every method resolves with the WHOLE cart as it is now, or rejects with a `CartTransportError`.\n */\n\n/** One line of the cart a visitor sees: the server's priced line + the id its routes know it by + what it may hold. */\nexport interface CartViewLine extends PricedLine {\n lineId: string;\n /** The most this line may hold (the stepper's top). */\n maxQuantity: number;\n}\n\nexport interface CartView {\n /** null only for a cart that has never been priced (the no-transport stub). */\n currency: CurrencyCode | null;\n lines: CartViewLine[];\n /** How many units — the cart button's badge (`$cart.count`). */\n count: number;\n empty: boolean;\n subtotal: Money | null;\n total: Money | null;\n vat: Money | null;\n vatPercent: number;\n issues: CartIssue[];\n /** What is still missing for a free-delivery method, when the studio offers one (the drawer's note); else null. */\n freeShippingRemaining: Money | null;\n}\n\nexport interface AddToCartRequest {\n productId: string;\n variantId?: string | null;\n quantity: number;\n}\n\nexport interface CartTransport {\n read(): Promise<CartView>;\n add(request: AddToCartRequest): Promise<CartView>;\n setQuantity(lineId: string, quantity: number): Promise<CartView>;\n remove(lineId: string): Promise<CartView>;\n}\n\nexport enum CartTransportErrorCode {\n /** No cart on this host (the engine before E1d, a site with no shop). */\n Unavailable = 'unavailable',\n /** The server said no (a product no longer sold, a rate limit). */\n Refused = 'refused',\n /** The call never reached the server. */\n Network = 'network',\n}\n\nexport const CART_TRANSPORT_ERROR_LABELS: Readonly<Record<CartTransportErrorCode, CommerceLabel>> = Object.freeze({\n [CartTransportErrorCode.Unavailable]: { en: 'The shop is not open yet.', he: 'החנות עוד לא פתוחה.' },\n [CartTransportErrorCode.Refused]: { en: 'That could not be added to your bag.', he: 'לא ניתן היה להוסיף לסל.' },\n [CartTransportErrorCode.Network]: { en: 'We could not reach the shop. Try again.', he: 'לא הצלחנו להגיע לחנות. נסו שוב.' },\n});\n\nexport class CartTransportError extends Error {\n constructor(readonly code: CartTransportErrorCode, message?: string) {\n super(message ?? code);\n this.name = 'CartTransportError';\n }\n}\n\n/** A line's id when the host has none of its own: the product and the variant, URL-safe. */\nexport function cartLineId(productId: string, variantId?: string | null): string {\n return `${encodeURIComponent(productId)}~${encodeURIComponent(variantId ?? '')}`;\n}\n\n/** The public cart routes (§3d) — ROOT-relative, like the forms submit path (a relative path under the org's\n * `<base href>` reaches the engine, never iox-cms). `lineId` addresses one line. */\nexport function cartEndpointPath(orgId: string, lineId?: string | null): string {\n const base = `/api/site/${encodeURIComponent(orgId)}/cart`;\n return lineId ? `${base}/lines/${encodeURIComponent(lineId)}` : base;\n}\n\n/** The fixed checkout route (C-D3), relative to the site's `<base href=\"/<orgLabel>/\">`. */\nexport const CHECKOUT_PATH = 'checkout';\n\n/** The checkout's href: `/<orgLabel>/checkout` under a label, else `/checkout`. */\nexport function checkoutHref(orgLabel?: string | null): string {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n return label ? `/${encodeURIComponent(label)}/${CHECKOUT_PATH}` : `/${CHECKOUT_PATH}`;\n}\n\n/** A cart with nothing in it. */\nexport function emptyCartView(currency: CurrencyCode | null = null): CartView {\n return { currency, lines: [], count: 0, empty: true, subtotal: null, total: null, vat: null, vatPercent: 0, issues: [], freeShippingRemaining: null };\n}\n\n/** The view of a priced cart. `lineIdOf` names each line the way the host's routes do (default `cartLineId`);\n * `maxOf` says how many a line may hold (default the line cap). */\nexport function cartViewOf(priced: PricedCart, options: {\n lineIdOf?: (line: PricedLine) => string;\n maxOf?: (line: PricedLine) => number;\n freeShippingRemaining?: Money | null;\n} = {}): CartView {\n const lineIdOf = options.lineIdOf ?? (line => cartLineId(line.productId, line.variantId));\n const maxOf = options.maxOf ?? (() => MAX_LINE_QUANTITY);\n const lines = priced.lines.map(line => ({ ...line, lineId: lineIdOf(line), maxQuantity: Math.max(line.quantity, maxOf(line)) }));\n const count = lines.reduce((sum, line) => sum + line.quantity, 0);\n return {\n currency: priced.currency,\n lines,\n count,\n empty: lines.length === 0,\n subtotal: priced.subtotal,\n total: priced.total,\n vat: priced.vat,\n vatPercent: priced.vatPercent,\n issues: priced.issues,\n freeShippingRemaining: options.freeShippingRemaining ?? null,\n };\n}\n\n/** The cart iox-cms's public routes answer (E1b, `shop.md` \"The cart\"): the priced cart, each line under its own id\n * (`ln_…`), and the unit count. */\nexport interface SiteCartView extends PricedCart {\n lines: Array<PricedLine & { id: string }>;\n itemCount?: number;\n}\n\n/** iox-cms's answer as the view the parts paint — the server's line ids, its prices untouched. */\nexport function siteCartView(site: SiteCartView, freeShippingRemaining: Money | null = null): CartView {\n const ids = new Map(site.lines.map(line => [line, line.id]));\n return cartViewOf(site, { lineIdOf: line => ids.get(line as PricedLine & { id: string }) ?? cartLineId(line.productId, line.variantId), freeShippingRemaining });\n}\n\n/** How a refused cart call is said: no cart service (501, 503) or a shop off the plan (403) is Unavailable, a\n * status the server chose is Refused, anything that never got an answer is Network. */\nexport function cartTransportErrorFor(status: number | null | undefined): CartTransportError {\n if (!status) return new CartTransportError(CartTransportErrorCode.Network);\n if (status === 501 || status === 503 || status === 403) return new CartTransportError(CartTransportErrorCode.Unavailable, String(status));\n return new CartTransportError(CartTransportErrorCode.Refused, String(status));\n}\n\n/** The words a cart's issues are said with, once each. */\nexport function cartIssueWords(view: Pick<CartView, 'issues'>, lang: string | null | undefined): string[] {\n const codes = [...new Set(view.issues.map(i => i.code))];\n return codes.map(code => labelIn(CART_ISSUE_LABELS[code], lang));\n}\n\n/** The host with no cart yet (the engine until E1d binds its own): every read is an empty cart, every change refused. */\nexport const NO_CART_TRANSPORT: CartTransport = Object.freeze({\n read: () => Promise.resolve(emptyCartView()),\n add: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n setQuantity: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n remove: () => Promise.reject(new CartTransportError(CartTransportErrorCode.Unavailable)),\n});\n\n/**\n * The builder canvas's cart: in memory, priced by the ONE `priceCart` over the catalog it is given (sample data, or the\n * product on the canvas), written nowhere. `initial` is what it starts holding (a sample line, so the drawer has one to\n * design). Every product the canvas adds must be in `catalog` — `addEntries` widens it.\n */\nexport interface SimulatedCartTransport extends CartTransport {\n /** Make more units known to the simulation (the product an Add to cart on the canvas names). */\n addEntries(entries: ReadonlyArray<CatalogEntry>): void;\n /** The cart as it stands, priced — no promise (the canvas paints it at once). */\n peek(): CartView;\n}\n\nexport function simulatedCartTransport(catalog: ReadonlyArray<CatalogEntry>, studio: StudioCommerce, initial: Cart = { lines: [] }): SimulatedCartTransport {\n const entries = new Map<string, CatalogEntry>();\n const known = (list: ReadonlyArray<CatalogEntry>) => list.forEach(e => entries.set(catalogKey(e.productId, e.variantId), e));\n known(catalog);\n let cart: Cart = { lines: [] };\n const maxOf = (line: PricedLine) => quantityBounds(entries.get(catalogKey(line.productId, line.variantId))).max;\n const price = (next: Cart): CartView => {\n const priced = priceCart(next, [...entries.values()], studio);\n cart = cartOf(priced);\n return cartViewOf(priced, { maxOf });\n };\n price(initial);\n const lineOf = (lineId: string) => cart.lines.find(l => cartLineId(l.productId, l.variantId) === lineId);\n return {\n addEntries: list => known(list),\n peek: () => price(cart),\n read: () => Promise.resolve(price(cart)),\n add: request => {\n if (!entries.has(catalogKey(request.productId, request.variantId))) return Promise.reject(new CartTransportError(CartTransportErrorCode.Refused));\n const same = cart.lines.find(l => l.productId === request.productId && (l.variantId ?? null) === (request.variantId ?? null));\n const lines = same\n ? cart.lines.map(l => (l === same ? { ...l, quantity: l.quantity + request.quantity } : l))\n : [...cart.lines, { productId: request.productId, variantId: request.variantId ?? null, quantity: request.quantity }];\n return Promise.resolve(price({ lines }));\n },\n setQuantity: (lineId, quantity) => {\n const line = lineOf(lineId);\n if (!line) return Promise.reject(new CartTransportError(CartTransportErrorCode.Refused));\n return Promise.resolve(price({ lines: cart.lines.map(l => (l === line ? { ...l, quantity } : l)) }));\n },\n remove: lineId => Promise.resolve(price({ lines: cart.lines.filter(l => l !== lineOf(lineId)) })),\n };\n}\n","import { CurrencyCode, isCurrencyCode } from './currency';\nimport { CommerceLabel } from './labels';\nimport { formatMoney, isMoney } from './money';\nimport { storefrontMoney, StorefrontProduct } from './variants';\n\n/**\n * How a price READS on a page — the `money` binding pipe (shop-aware plan A-D2, amended by C-D7) on the builder canvas,\n * the engine's SSR and its hydration: ONE function, so the three never disagree on a digit.\n *\n * - a `Money` (minor units + its currency — `$variant.price`, a cart's totals) is formatted as it is;\n * - a bare number or numeric string (`pricing.price` as the storefront serves it: MAJOR units) needs a currency — the\n * pipe's own argument, else the studio's (`PipeContext.currency`); with none it is left as it was, never guessed;\n * - nothing (null, undefined, '') reads as nothing.\n * The locale is the page's language (`en` when unsaid, so the canvas and the server agree).\n */\nexport const DEFAULT_MONEY_LOCALE = 'en';\n\nexport function formatMoneyValue(value: unknown, currency?: string | null, locale?: string | null): unknown {\n if (value === null || value === undefined || value === '') return '';\n const lang = locale || DEFAULT_MONEY_LOCALE;\n if (isMoney(value)) {\n try { return formatMoney(value, lang); } catch { return value; }\n }\n const code = String(currency ?? '').trim().toUpperCase();\n if (!isCurrencyCode(code)) return value;\n const amount = storefrontMoney(value, code as CurrencyCode);\n if (!amount) return value;\n try { return formatMoney(amount, lang); } catch { return value; }\n}\n\n/**\n * The two slots the shop parts write at runtime (the element-context channel — a slot is a `resolvedData` key written\n * at runtime, element-context-state plan): the variant the buyer has chosen (`$variant.price | money`) and the cart\n * (`$cart.count` on the cart button's badge). Written by the shop runtime through its host, read by ordinary bindings.\n */\nexport enum ShopSlot {\n Variant = '$variant',\n Cart = '$cart',\n}\n\nexport const SHOP_SLOTS: ReadonlyArray<string> = Object.freeze(Object.values(ShopSlot));\n\n// ── the shop parts' words (a string-rendered site has no translation service — the labels.ts rule) ──────────────\n\nexport enum ShopWord {\n Added = 'added',\n SoldOut = 'soldOut',\n ValueSoldOut = 'valueSoldOut',\n Decrease = 'decrease',\n Increase = 'increase',\n Remove = 'remove',\n Cart = 'cart',\n CartCount = 'cartCount',\n Quantity = 'quantity',\n FreeShippingGap = 'freeShippingGap',\n ChooseOption = 'chooseOption',\n}\n\n/** `{name}` / `{n}` / `{amount}` are filled by `shopWord`. */\nexport const SHOP_WORDS: Readonly<Record<ShopWord, CommerceLabel>> = Object.freeze({\n [ShopWord.Added]: { en: 'Added ✓', he: 'נוסף ✓' },\n [ShopWord.SoldOut]: { en: 'Sold out', he: 'אזל' },\n [ShopWord.ValueSoldOut]: { en: '{name} is sold out', he: '{name} אזל מהמלאי' },\n [ShopWord.Decrease]: { en: 'Decrease quantity', he: 'הפחתת כמות' },\n [ShopWord.Increase]: { en: 'Increase quantity', he: 'הגדלת כמות' },\n [ShopWord.Remove]: { en: 'Remove {name}', he: 'הסרת {name}' },\n [ShopWord.Cart]: { en: 'Bag', he: 'סל' },\n [ShopWord.CartCount]: { en: 'Bag, {n} items', he: 'סל, {n} פריטים' },\n [ShopWord.Quantity]: { en: 'Quantity', he: 'כמות' },\n [ShopWord.FreeShippingGap]: { en: 'Add {amount} more for free delivery', he: 'עוד {amount} למשלוח חינם' },\n [ShopWord.ChooseOption]: { en: 'Choose {name}', he: 'בחירת {name}' },\n});\n\nexport function shopWord(word: ShopWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n const primary = String(lang ?? '').toLowerCase().split(/[-_]/)[0];\n const label = SHOP_WORDS[word];\n const raw = primary === 'he' || primary === 'iw' ? label.he : label.en;\n return raw.replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n// ── the sample a canvas shows when no product is bound (commerce board 10, \"Studio Kadar\") ────────────────────────\n\n/** Board 10's tall speckled vase: Glaze (Sand · Ash · Charcoal — Charcoal sold out) × Size (24 · 32 · 40 cm — 40 sold\n * out), ₪240 against ₪280. Major units, as the storefront serves them. */\nexport const SAMPLE_PRODUCT: StorefrontProduct = Object.freeze({\n _id: 'sample-vase',\n title: 'Tall speckled vase',\n slug: 'tall-speckled-vase',\n mainImage: null,\n productVariants: true,\n currency: CurrencyCode.ILS,\n availability: 'in_stock',\n pricing: { price: 240, compareat: 280 },\n options: [\n { name: 'Glaze', values: ['Sand', 'Ash', 'Charcoal'] },\n { name: 'Size', values: ['24 cm', '32 cm', '40 cm'] },\n ],\n // Rows in the order a page opens on: Sand · 32 cm first (the first sellable row is the default choice).\n variants: ['Sand', 'Ash', 'Charcoal'].flatMap(glaze => ['32 cm', '24 cm', '40 cm'].map(size => ({\n _id: `sample-${glaze}-${size}`.toLowerCase().replace(/\\s+/g, ''),\n name: `${glaze}-${size}`,\n enable: true,\n image: null,\n price: size === '24 cm' ? 190 : 240,\n compareat: size === '32 cm' ? 280 : null,\n availability: glaze === 'Charcoal' || size === '40 cm' ? 'out' : 'in_stock',\n }))),\n});\n\n/** The colours board 10 draws its sample glazes with (a sample value has no colour of its own). */\nexport const SAMPLE_SWATCHES: Readonly<Record<string, string>> = Object.freeze({ Sand: '#D8C6A8', Ash: '#F3F1EC', Charcoal: '#3A3B3D' });\n\n/** The sample studio's money (VAT 18 %, ₪). */\nexport const SAMPLE_STUDIO = Object.freeze({ currency: CurrencyCode.ILS, vatPercent: 18, shippingMethods: [] as never[] });\n\n/** The cart the canvas starts with: one sample line, so the drawer has a line to design. */\nexport const SAMPLE_CART_LINE = Object.freeze({ productId: 'sample-vase', variantId: 'sample-sand-32cm', quantity: 1 });\n","import { SiteCartView } from './cart-transport';\nimport { BusinessIdentity, CheckoutStep, LegalPage } from './checkout';\nimport { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { Money } from './money';\nimport { OrderSnapshot, PostalAddress } from './order-snapshot';\nimport { OrderState } from './orders';\nimport { DeliveryFit, PaymentMethodKind } from './payments';\nimport { ShippingMethodKind, ShippingQuote } from './shipping';\n\n/**\n * The fixed checkout (C-D3) and the order page as a SITE reads them over iox-cms's public routes (`shop.md` \"E1 site\n * API\"): the routes, the answers' shapes, the words, and how a refusal's `code` becomes a sentence on the field it is\n * about. The engine renders; iox-cms prices (trap T1) — nothing here computes a total.\n */\n\nexport enum SiteCommerceRoute {\n Cart = 'cart',\n CartLines = 'cart/lines',\n CheckoutOptions = 'checkout/options',\n Checkout = 'checkout',\n CheckoutPlace = 'checkout/place',\n Order = 'order',\n}\n\n/** A public commerce route of one org, ROOT-relative (the same rule as `cartEndpointPath`). */\nexport function siteCommercePath(orgId: string, route: SiteCommerceRoute, id?: string | null): string {\n const base = `/api/site/${encodeURIComponent(orgId)}/${route}`;\n return id ? `${base}/${encodeURIComponent(id)}` : base;\n}\n\n/** The cart cookie iox-cms sets for one org (httpOnly — a site script never reads it; SSR forwards it). */\nexport const CART_COOKIE_PREFIX = 'iox_cart_';\n\nexport function cartCookieName(orgId: string): string {\n return `${CART_COOKIE_PREFIX}${orgId}`;\n}\n\n/** The order page under the checkout: `/<orgLabel>/checkout/order/<token>`. */\nexport const ORDER_PATH = 'order';\n\nexport function orderHref(orgLabel: string | null | undefined, token: string): string {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n const tail = `checkout/${ORDER_PATH}/${encodeURIComponent(token)}`;\n return label ? `/${encodeURIComponent(label)}/${tail}` : `/${tail}`;\n}\n\n// ── the answers ────────────────────────────────────────────────────────────────────────────────\n\nexport enum CheckoutFieldMode {\n Hidden = 'hidden',\n Optional = 'optional',\n Required = 'required',\n}\n\n/** The contact fields an owner may hide, offer or require. */\nexport enum CheckoutAskedField {\n Phone = 'phone',\n Company = 'company',\n Note = 'note',\n}\n\nexport type CheckoutFieldModes = Readonly<Partial<Record<CheckoutAskedField, CheckoutFieldMode>>>;\n\nexport interface SitePaymentOption {\n kind: PaymentMethodKind;\n label: CommerceLabel;\n fit: DeliveryFit;\n}\n\nexport interface SiteShippingMethod {\n id: string;\n kind: ShippingMethodKind;\n name: string;\n price: Money | null;\n freeOver: Money | null;\n pickupAddress: string | null;\n pickupHours: string | null;\n needsAddress: boolean;\n}\n\nexport interface SiteLegalLink {\n title: string;\n path: string;\n}\n\n/** `GET checkout/options` — what the page renders before anything is typed. */\nexport interface SiteCheckoutOptions {\n open: boolean;\n plan: string;\n refusals: string[];\n currency: CurrencyCode;\n vatPercent: number;\n country: string | null;\n shippingMethods: SiteShippingMethod[];\n paymentMethods: SitePaymentOption[];\n fields: CheckoutFieldModes;\n legalPages: Readonly<Partial<Record<LegalPage, SiteLegalLink | null>>>;\n business: BusinessIdentity;\n siteName: string | null;\n marketingWording: CommerceLabel;\n}\n\nexport interface SiteCheckoutContact {\n email: string;\n name: string | null;\n phone: string | null;\n company: string | null;\n}\n\nexport interface SiteShippingOption extends ShippingQuote {\n pickupAddress: string | null;\n pickupHours: string | null;\n}\n\n/** `GET|POST|PATCH checkout` — one checkout, priced by the server. */\nexport interface SiteCheckoutView {\n id: string;\n contact: SiteCheckoutContact;\n language: string;\n marketingConsent: { given: boolean; wording: string };\n delivery: { methodId: string; address: PostalAddress | null } | null;\n payment: { kind: PaymentMethodKind; label: string } | null;\n note: string | null;\n furthestStep: CheckoutStep;\n status: string;\n cart: SiteCartView;\n shippingOptions: SiteShippingOption[];\n paymentOptions: SitePaymentOption[];\n fields: CheckoutFieldModes;\n termsRequired: boolean;\n}\n\n/** `GET order/:token` — the buyer's own order (instructions only while it waits for the money). */\nexport interface SiteBuyerOrder {\n number: string | number;\n state: OrderState;\n stateLabel: string;\n placedAt: string;\n language: string;\n seller: { name: string; business: BusinessIdentity };\n snapshot: OrderSnapshot;\n paymentLabel: string;\n instructions: string | null;\n}\n\n/** `POST checkout/place` — 201. */\nexport interface SitePlacedOrder {\n order: SiteBuyerOrder;\n viewToken: string;\n}\n\n// ── the step a visitor is on ──────────────────────────────────────────────────────────────────\n\n/**\n * The step to SHOW: no checkout yet is Contact; then the first step still missing what it needs — a delivery chosen\n * (with an address when it delivers), then a payment. A step already passed stays open only when the buyer asks.\n */\nexport function currentCheckoutStep(view: Pick<SiteCheckoutView, 'delivery' | 'payment' | 'shippingOptions'> | null | undefined): CheckoutStep {\n if (!view) return CheckoutStep.Contact;\n const option = view.delivery ? view.shippingOptions.find(o => o.methodId === view.delivery!.methodId) : undefined;\n if (!option || (option.needsAddress && !view.delivery?.address)) return CheckoutStep.Delivery;\n return CheckoutStep.Payment;\n}\n\n/** The steps the stepper names (Paid is the order page, never a step a buyer fills). */\nexport const CHECKOUT_FORM_STEPS: readonly CheckoutStep[] = Object.freeze([CheckoutStep.Contact, CheckoutStep.Delivery, CheckoutStep.Payment]);\n\nexport function fieldAsked(fields: CheckoutFieldModes | null | undefined, field: CheckoutAskedField): boolean {\n return (fields?.[field] ?? CheckoutFieldMode.Hidden) !== CheckoutFieldMode.Hidden;\n}\n\nexport function fieldRequired(fields: CheckoutFieldModes | null | undefined, field: CheckoutAskedField): boolean {\n return fields?.[field] === CheckoutFieldMode.Required;\n}\n\n/** One line of a postal address as a buyer reads it. */\nexport function addressLine(address: PostalAddress | null | undefined): string {\n if (!address) return '';\n return [address.line1, address.line2, [address.postalCode, address.city].filter(Boolean).join(' ')].filter(part => !!part && String(part).trim()).join(', ');\n}\n\n// ── the words ─────────────────────────────────────────────────────────────────────────────────\n\nexport enum CheckoutWord {\n SecureCheckout = 'secureCheckout',\n Email = 'email',\n Name = 'name',\n Phone = 'phone',\n Company = 'company',\n Optional = 'optional',\n ContinueToDelivery = 'continueToDelivery',\n ContinueToPayment = 'continueToPayment',\n Change = 'change',\n Street = 'street',\n StreetMore = 'streetMore',\n City = 'city',\n PostalCode = 'postalCode',\n DeliverTo = 'deliverTo',\n PickupAt = 'pickupAt',\n Note = 'note',\n AcceptTerms = 'acceptTerms',\n PlaceOrder = 'placeOrder',\n PlaceNote = 'placeNote',\n OrderSummary = 'orderSummary',\n Subtotal = 'subtotal',\n Delivery = 'delivery',\n DeliveryLater = 'deliveryLater',\n Free = 'free',\n Total = 'total',\n IncludesVat = 'includesVat',\n Quantity = 'quantity',\n EmptyBag = 'emptyBag',\n BackToShop = 'backToShop',\n Closed = 'closed',\n ThankYou = 'thankYou',\n ThankYouNamed = 'thankYouNamed',\n OrderSent = 'orderSent',\n OrderNumber = 'orderNumber',\n HowToPay = 'howToPay',\n PaidWith = 'paidWith',\n BusinessNumber = 'businessNumber',\n Working = 'working',\n StepOf = 'stepOf',\n OrderMissing = 'orderMissing',\n Legal = 'legal',\n}\n\n/** `{name}`, `{n}`, `{of}`, `{amount}`, `{percent}`, `{number}`, `{email}`, `{total}`, `{place}` are filled by `checkoutWord`. */\nexport const CHECKOUT_WORDS: Readonly<Record<CheckoutWord, CommerceLabel>> = Object.freeze({\n [CheckoutWord.SecureCheckout]: { en: 'Secure checkout', he: 'תשלום מאובטח' },\n [CheckoutWord.Email]: { en: 'Email', he: 'אימייל' },\n [CheckoutWord.Name]: { en: 'Full name', he: 'שם מלא' },\n [CheckoutWord.Phone]: { en: 'Phone', he: 'טלפון' },\n [CheckoutWord.Company]: { en: 'Company', he: 'חברה' },\n [CheckoutWord.Optional]: { en: 'Optional', he: 'לא חובה' },\n [CheckoutWord.ContinueToDelivery]: { en: 'Continue to delivery', he: 'המשך למשלוח' },\n [CheckoutWord.ContinueToPayment]: { en: 'Continue to payment', he: 'המשך לתשלום' },\n [CheckoutWord.Change]: { en: 'Change', he: 'שינוי' },\n [CheckoutWord.Street]: { en: 'Street and number', he: 'רחוב ומספר' },\n [CheckoutWord.StreetMore]: { en: 'Apartment, floor', he: 'דירה, קומה' },\n [CheckoutWord.City]: { en: 'City', he: 'עיר' },\n [CheckoutWord.PostalCode]: { en: 'Postal code', he: 'מיקוד' },\n [CheckoutWord.DeliverTo]: { en: 'To {place}', he: 'אל {place}' },\n [CheckoutWord.PickupAt]: { en: 'Pickup at {place}', he: 'איסוף מ{place}' },\n [CheckoutWord.Note]: { en: 'A note for the seller', he: 'הערה למוכר' },\n [CheckoutWord.AcceptTerms]: { en: 'I accept the', he: 'אני מאשר/ת את' },\n [CheckoutWord.PlaceOrder]: { en: 'Place order · {total}', he: 'ביצוע הזמנה · {total}' },\n [CheckoutWord.PlaceNote]: { en: 'How to pay is on the next page.', he: 'פרטי התשלום יופיעו בעמוד הבא.' },\n [CheckoutWord.OrderSummary]: { en: 'Order summary', he: 'סיכום הזמנה' },\n [CheckoutWord.Subtotal]: { en: 'Subtotal', he: 'סכום ביניים' },\n [CheckoutWord.Delivery]: { en: 'Delivery', he: 'משלוח' },\n [CheckoutWord.DeliveryLater]: { en: 'Chosen next', he: 'ייבחר בהמשך' },\n [CheckoutWord.Free]: { en: 'Free', he: 'חינם' },\n [CheckoutWord.Total]: { en: 'Total', he: 'סה״כ' },\n [CheckoutWord.IncludesVat]: { en: 'Includes VAT {percent}% · {amount}', he: 'כולל מע״מ {percent}% · {amount}' },\n [CheckoutWord.Quantity]: { en: 'Qty {n}', he: 'כמות {n}' },\n [CheckoutWord.EmptyBag]: { en: 'Your bag is empty.', he: 'הסל שלך ריק.' },\n [CheckoutWord.BackToShop]: { en: 'Back to the shop', he: 'חזרה לחנות' },\n [CheckoutWord.Closed]: { en: 'The shop is not taking orders right now.', he: 'החנות לא מקבלת הזמנות כרגע.' },\n [CheckoutWord.ThankYou]: { en: 'Thank you! Your order is in.', he: 'תודה! ההזמנה התקבלה' },\n [CheckoutWord.ThankYouNamed]: { en: 'Thank you, {name}! Your order is in.', he: 'תודה, {name}! ההזמנה התקבלה' },\n [CheckoutWord.OrderSent]: { en: 'Order #{number} · a confirmation was sent to {email}', he: 'הזמנה #{number} · אישור נשלח ל־{email}' },\n [CheckoutWord.OrderNumber]: { en: 'Order #{number}', he: 'הזמנה #{number}' },\n [CheckoutWord.HowToPay]: { en: 'How to pay', he: 'איך משלמים' },\n [CheckoutWord.PaidWith]: { en: 'Payment', he: 'תשלום' },\n [CheckoutWord.BusinessNumber]: { en: 'Business no. {number}', he: 'ע.מ {number}' },\n [CheckoutWord.Working]: { en: 'One moment…', he: 'רגע…' },\n [CheckoutWord.StepOf]: { en: 'Step {n} of {of}', he: 'שלב {n} מתוך {of}' },\n [CheckoutWord.OrderMissing]: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' },\n [CheckoutWord.Legal]: { en: 'Policies', he: 'מדיניות' },\n});\n\nexport function checkoutWord(word: CheckoutWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return labelIn(CHECKOUT_WORDS[word], lang).replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n// ── a refusal, said on its field ─────────────────────────────────────────────────────────────\n\n/** Where on the checkout a refusal is said. */\nexport enum CheckoutSlot {\n Email = 'email',\n Name = 'name',\n Phone = 'phone',\n Company = 'company',\n Delivery = 'delivery',\n Address = 'address',\n Payment = 'payment',\n Terms = 'terms',\n /** The order summary: the bag itself changed. */\n Cart = 'cart',\n /** The whole page: closed, busy, unreachable. */\n Page = 'page',\n}\n\n/**\n * Every code a buyer's checkout can hear from iox-cms (`CommerceErrorCode`, the checkout's own refusals and\n * commerce-core's `OrderSnapshotRefusal`), plus `network` for no answer at all.\n */\nexport enum SiteRefusalCode {\n InvalidBody = 'invalid-body',\n InvalidEmail = 'invalid-email',\n EmailRequired = 'email-required',\n NameRequired = 'name-required',\n PhoneRequired = 'phone-required',\n CompanyRequired = 'company-required',\n InvalidAddress = 'invalid-address',\n AddressRequired = 'address-required',\n AddressCountry = 'address-country',\n UnknownShippingMethod = 'unknown-shipping-method',\n ShippingNotChosen = 'shipping-not-chosen',\n UnknownPaymentMethod = 'unknown-payment-method',\n PaymentNotChosen = 'payment-not-chosen',\n PaymentMethodUnusable = 'payment-method-unusable',\n TermsNotAccepted = 'terms-not-accepted',\n NoCart = 'no-cart',\n EmptyCart = 'empty-cart',\n NoCheckout = 'no-checkout',\n CartChanged = 'cart-changed',\n OutOfStock = 'out-of-stock',\n OrderChanged = 'order-changed',\n CheckoutClosed = 'checkout-closed',\n ShopNotInPlan = 'shop-not-in-plan',\n ShopPlanUnknown = 'shop-plan-unknown',\n RateLimited = 'rate-limited',\n Busy = 'busy',\n UnknownOrder = 'unknown-order',\n UnknownSite = 'unknown-site',\n /** The owner blocked this buyer (commerce E3c): no checkout, no order. */\n CustomerBlocked = 'customer-blocked',\n Network = 'network',\n}\n\ninterface RefusalRule {\n readonly slot: CheckoutSlot;\n readonly label: CommerceLabel;\n}\n\nconst ENTER_EMAIL: CommerceLabel = { en: 'Enter an email address, like name@example.com.', he: 'הקלידו כתובת אימייל, למשל name@example.com.' };\nconst ENTER_ADDRESS: CommerceLabel = { en: 'Enter the street, the number and the city.', he: 'הקלידו רחוב, מספר ועיר.' };\nconst CHOOSE_DELIVERY: CommerceLabel = { en: 'Choose how to get your order.', he: 'בחרו איך לקבל את ההזמנה.' };\nconst CHOOSE_PAYMENT: CommerceLabel = { en: 'Choose how to pay.', he: 'בחרו איך לשלם.' };\nconst BAG_EMPTY: CommerceLabel = { en: 'Your bag is empty.', he: 'הסל שלך ריק.' };\nconst CLOSED: CommerceLabel = { en: 'The shop is not taking orders right now.', he: 'החנות לא מקבלת הזמנות כרגע.' };\nconst TRY_AGAIN: CommerceLabel = { en: 'The shop is busy. Try again in a moment.', he: 'החנות עמוסה. נסו שוב בעוד רגע.' };\n\nexport const SITE_REFUSALS: Readonly<Record<SiteRefusalCode, RefusalRule>> = Object.freeze({\n [SiteRefusalCode.InvalidBody]: { slot: CheckoutSlot.Page, label: { en: 'Check the details and try again.', he: 'בדקו את הפרטים ונסו שוב.' } },\n [SiteRefusalCode.InvalidEmail]: { slot: CheckoutSlot.Email, label: ENTER_EMAIL },\n [SiteRefusalCode.EmailRequired]: { slot: CheckoutSlot.Email, label: ENTER_EMAIL },\n [SiteRefusalCode.NameRequired]: { slot: CheckoutSlot.Name, label: { en: 'Enter your name.', he: 'הקלידו את שמכם.' } },\n [SiteRefusalCode.PhoneRequired]: { slot: CheckoutSlot.Phone, label: { en: 'Enter a phone number.', he: 'הקלידו מספר טלפון.' } },\n [SiteRefusalCode.CompanyRequired]: { slot: CheckoutSlot.Company, label: { en: 'Enter the company name.', he: 'הקלידו את שם החברה.' } },\n [SiteRefusalCode.InvalidAddress]: { slot: CheckoutSlot.Address, label: ENTER_ADDRESS },\n [SiteRefusalCode.AddressRequired]: { slot: CheckoutSlot.Address, label: ENTER_ADDRESS },\n [SiteRefusalCode.AddressCountry]: { slot: CheckoutSlot.Address, label: { en: 'We do not deliver to this country.', he: 'אנחנו לא שולחים למדינה הזו.' } },\n [SiteRefusalCode.UnknownShippingMethod]: { slot: CheckoutSlot.Delivery, label: CHOOSE_DELIVERY },\n [SiteRefusalCode.ShippingNotChosen]: { slot: CheckoutSlot.Delivery, label: CHOOSE_DELIVERY },\n [SiteRefusalCode.UnknownPaymentMethod]: { slot: CheckoutSlot.Payment, label: CHOOSE_PAYMENT },\n [SiteRefusalCode.PaymentNotChosen]: { slot: CheckoutSlot.Payment, label: CHOOSE_PAYMENT },\n [SiteRefusalCode.PaymentMethodUnusable]: { slot: CheckoutSlot.Payment, label: { en: 'This way to pay does not fit the delivery. Choose another.', he: 'אמצעי התשלום הזה לא מתאים למשלוח. בחרו אחר.' } },\n [SiteRefusalCode.TermsNotAccepted]: { slot: CheckoutSlot.Terms, label: { en: 'Accept the terms to place the order.', he: 'כדי להזמין יש לאשר את התנאים.' } },\n [SiteRefusalCode.NoCart]: { slot: CheckoutSlot.Cart, label: BAG_EMPTY },\n [SiteRefusalCode.EmptyCart]: { slot: CheckoutSlot.Cart, label: BAG_EMPTY },\n [SiteRefusalCode.NoCheckout]: { slot: CheckoutSlot.Email, label: { en: 'Start with your email.', he: 'התחילו באימייל.' } },\n [SiteRefusalCode.CartChanged]: { slot: CheckoutSlot.Cart, label: { en: 'Your bag changed. Check it, then place the order.', he: 'הסל השתנה. בדקו אותו ואז הזמינו.' } },\n [SiteRefusalCode.OutOfStock]: { slot: CheckoutSlot.Cart, label: { en: 'Something in your bag just sold out.', he: 'משהו בסל אזל הרגע מהמלאי.' } },\n [SiteRefusalCode.OrderChanged]: { slot: CheckoutSlot.Page, label: { en: 'This order was already placed.', he: 'ההזמנה הזו כבר בוצעה.' } },\n [SiteRefusalCode.CheckoutClosed]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.ShopNotInPlan]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.ShopPlanUnknown]: { slot: CheckoutSlot.Page, label: TRY_AGAIN },\n [SiteRefusalCode.RateLimited]: { slot: CheckoutSlot.Page, label: { en: 'Too many tries. Wait a minute and try again.', he: 'יותר מדי ניסיונות. המתינו דקה ונסו שוב.' } },\n [SiteRefusalCode.Busy]: { slot: CheckoutSlot.Page, label: TRY_AGAIN },\n [SiteRefusalCode.UnknownOrder]: { slot: CheckoutSlot.Page, label: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' } },\n [SiteRefusalCode.UnknownSite]: { slot: CheckoutSlot.Page, label: CLOSED },\n [SiteRefusalCode.CustomerBlocked]: { slot: CheckoutSlot.Page, label: { en: 'This account cannot place orders here. Contact the business.', he: 'החשבון הזה לא יכול לבצע הזמנות כאן. פנו לעסק.' } },\n [SiteRefusalCode.Network]: { slot: CheckoutSlot.Page, label: { en: 'We could not reach the shop. Try again.', he: 'לא הצלחנו להגיע לחנות. נסו שוב.' } },\n});\n\n/** Each refusal of a failed call, on its slot, in the buyer's words. */\nexport interface SiteRefusal {\n code: string;\n slot: CheckoutSlot;\n words: string;\n}\n\nconst isRefusalCode = (code: unknown): code is SiteRefusalCode =>\n typeof code === 'string' && (Object.values(SiteRefusalCode) as string[]).includes(code);\n\nconst ORDER_REFUSED = 'order-refused';\n\nfunction refusalOf(code: unknown, lang: string | null | undefined): SiteRefusal {\n const known: SiteRefusalCode = isRefusalCode(code) ? code : SiteRefusalCode.InvalidBody;\n const rule = SITE_REFUSALS[known];\n return { code: isRefusalCode(code) ? code : String(code ?? known), slot: rule.slot, words: labelIn(rule.label, lang) };\n}\n\n/**\n * A refused call's body (`{ statusCode, code, message, refusals? }`) as sentences: `order-refused` says each of its\n * `refusals` on its own field; any other code is one sentence; no body at all is `network`. `message` is a log line\n * and is never shown. One sentence per slot (the first wins).\n */\nexport function siteRefusalsOf(body: unknown, lang: string | null | undefined): SiteRefusal[] {\n const answer = body && typeof body === 'object' ? body as { code?: unknown; refusals?: unknown } : null;\n if (!answer) return [refusalOf(SiteRefusalCode.Network, lang)];\n const codes = answer.code === ORDER_REFUSED && Array.isArray(answer.refusals) && answer.refusals.length ? answer.refusals : [answer.code];\n const seen = new Set<CheckoutSlot>();\n return codes.map(code => refusalOf(code, lang)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));\n}\n","/**\n * @vectoriox/iox-ui/commerce-core — the shared, FRAMEWORK-FREE core of selling (commerce plan C-D7…C-D11, C-D19).\n *\n * Money is integer minor units in one ISO-4217 currency, so the engine, the builder and iox-cms compute the same\n * totals (trap T6: never a float). E0 shipped Money; E1a adds the cart and its ONE pricing function, shipping v1,\n * manual payment methods, the order state machine, the checkout steps and gate, and the order snapshot. No clock is\n * read anywhere — a caller passes `now`.\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 './money-error';\nexport * from './currency';\nexport * from './money';\nexport * from './labels';\nexport * from './limits';\nexport * from './vat';\nexport * from './catalog';\nexport * from './shipping';\nexport * from './cart';\nexport * from './payments';\nexport * from './orders';\nexport * from './checkout';\nexport * from './order-snapshot';\nexport * from './variants';\nexport * from './quantity';\nexport * from './cart-transport';\nexport * from './shop-display';\nexport * from './site-checkout';\nexport { looksLikeEmail, looksLikePhone } from './text';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["text"],"mappings":"IAAY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACtB,IAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC;AACpC,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,aAA0B;AAC1B,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,cAA2B;AAC3B,IAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,mBAAqC;AACrC,IAAA,cAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC;AACtC,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,cAA2B;AAC/B,CAAC,EAXW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;AAapB,MAAO,UAAW,SAAQ,KAAK,CAAA;IACjC,WAAA,CAAqB,IAAoB,EAAE,OAAe,EAAA;QACtD,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,IAAI,GAAJ,IAAI;AAErB,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY;IAC5B;AACH;;IChBW;AAAZ,CAAA,UAAY,YAAY,EAAA;AACpB,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,YAAA,CAAA,KAAA,CAAA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