@vectoriox/iox-ui 5.132.0 → 5.134.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 (81) hide show
  1. package/commerce-core/index.d.ts +12 -1
  2. package/composite-core/index.d.ts +44 -22
  3. package/design-core/index.d.ts +436 -35
  4. package/domain-core/index.d.ts +353 -0
  5. package/domain-core/package.json +3 -0
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
  7. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
  9. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
  11. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +118 -62
  13. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
  15. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  16. package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
  17. package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
  18. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +13974 -12036
  19. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  20. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
  21. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  22. package/fesm2022/vectoriox-iox-ui-mail-core.mjs +288 -2
  23. package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
  24. package/fesm2022/vectoriox-iox-ui.mjs +290 -16
  25. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  26. package/generation-core/index.d.ts +1419 -379
  27. package/harness-core/index.d.ts +6 -1
  28. package/index.d.ts +139 -10
  29. package/mail-core/index.d.ts +315 -39
  30. package/package.json +5 -1
  31. package/src/actions-core/element-actions.ts +2 -0
  32. package/src/assist-core/page-sections.ts +7 -37
  33. package/src/commerce-core/shop-display.ts +21 -0
  34. package/src/composite-core/consent.ts +6 -2
  35. package/src/composite-core/shop-runtime.ts +47 -3
  36. package/src/composite-core/shop.ts +76 -57
  37. package/src/design-core/design-settings.ts +16 -0
  38. package/src/design-core/design-token.model.ts +7 -1
  39. package/src/design-core/flavor-spec.generated.ts +374 -35
  40. package/src/design-core/flavor-tokens.ts +12 -1
  41. package/src/design-core/header-behaviour.ts +32 -0
  42. package/src/design-core/motion-language.ts +115 -0
  43. package/src/design-core/public-api.ts +1 -0
  44. package/src/design-core/style-presets.ts +3 -0
  45. package/src/domain-core/domain-vocabulary.ts +125 -0
  46. package/src/domain-core/domain-wire.ts +95 -0
  47. package/src/domain-core/org-path-redirect.ts +105 -0
  48. package/src/domain-core/public-api.ts +12 -0
  49. package/src/domain-core/web-domain.ts +251 -0
  50. package/src/generation-core/carry-fill.ts +36 -0
  51. package/src/generation-core/carry.ts +398 -0
  52. package/src/generation-core/check-carry.ts +216 -0
  53. package/src/generation-core/check-layout.ts +71 -5
  54. package/src/generation-core/compose-layout.ts +187 -28
  55. package/src/generation-core/compose-site.ts +154 -31
  56. package/src/generation-core/entrances.ts +66 -10
  57. package/src/generation-core/header-edit.ts +299 -0
  58. package/src/generation-core/header-mix.ts +64 -5
  59. package/src/generation-core/layout-fingerprint.ts +5 -1
  60. package/src/generation-core/layout-language.ts +20 -1
  61. package/src/generation-core/layout-space.ts +4 -4
  62. package/src/generation-core/layout-wire.ts +36 -1
  63. package/src/generation-core/node-baselines.generated.ts +1 -0
  64. package/src/generation-core/public-api.ts +7 -0
  65. package/src/generation-core/redesign-additions.ts +273 -0
  66. package/src/generation-core/redesign-run.ts +364 -0
  67. package/src/generation-core/refit-page.ts +151 -0
  68. package/src/generation-core/section-stamp.ts +4 -4
  69. package/src/generation-core/shop-plan.ts +15 -0
  70. package/src/generation-core/site-build-run.ts +20 -3
  71. package/src/generation-core/site-spec.generated.ts +194 -94
  72. package/src/generation-core/site-tree.ts +19 -5
  73. package/src/generation-core/validate-site-plan.ts +37 -3
  74. package/src/harness-core/motion.ts +13 -3
  75. package/src/harness-core/starting-design.ts +1 -1
  76. package/src/mail-core/mail-domain.ts +305 -0
  77. package/src/mail-core/mail-standing.ts +58 -0
  78. package/src/mail-core/mail-vocabulary.ts +3 -0
  79. package/src/mail-core/mail-wire.ts +70 -1
  80. package/src/mail-core/public-api.ts +6 -1
  81. package/styles/iox-design.css +44 -2
@@ -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/storefront-fields.ts","../../../projects/iox-ui/src/commerce-core/text.ts","../../../projects/iox-ui/src/commerce-core/shipping.ts","../../../projects/iox-ui/src/commerce-core/coupons.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/payment-sessions.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/recovery.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","/**\n * What a VISITOR may see of a shop row (commerce plan F4, iox-cms#67) — the ONE allowlist, here so the server that\n * projects a row (iox-cms `storefront-projection.ts`) and the builder that offers its fields to bind (iox-cms-client#50)\n * read the same list. An ALLOWLIST: a field added to a shop schema stays private until it is named here — stock counts,\n * SKUs, the organization, the build bookkeeping and the sample mark never leave the server.\n */\n\n/** A top-level field the storefront serves: `true` as stored, or the sub-fields of each nested row it keeps. */\nexport type StorefrontFieldSpec = true | ReadonlyArray<string>;\n\n/** The shop collections a storefront reads (iox-cms `ShopCollection`, orders excluded — never public). */\nexport enum StorefrontCollection {\n Products = 'products',\n Categories = 'categories',\n SubCategories = 'subCategories',\n}\n\nconst PRODUCT_FIELDS: Readonly<Record<string, StorefrontFieldSpec>> = {\n _id: true,\n title: true,\n slug: true,\n description: true,\n category: true,\n subCategory: true,\n mainImage: true,\n media: true,\n productVariants: true,\n digital: true,\n pricing: ['price', 'compareat'],\n options: ['_id', 'name', 'values'],\n variants: ['_id', 'enable', 'name', 'image', 'price', 'compareat'],\n};\n\nconst CATEGORY_FIELDS: Readonly<Record<string, StorefrontFieldSpec>> = { _id: true, label: true, slug: true, color: true };\n\nexport const STOREFRONT_FIELDS: Readonly<Record<string, Readonly<Record<string, StorefrontFieldSpec>>>> = {\n [StorefrontCollection.Products]: PRODUCT_FIELDS,\n [StorefrontCollection.Categories]: CATEGORY_FIELDS,\n [StorefrontCollection.SubCategories]: { ...CATEGORY_FIELDS, categoryId: true },\n};\n\n/**\n * What the server ADDS to a projected row — never stored, so never sortable or filterable: a product's `currency` (ISO\n * 4217) and its stock as a WORD (`availability`, commerce-core `Availability`), also on each variant. A product card\n * binds `availability`, never a count.\n */\nexport const STOREFRONT_COMPUTED_FIELDS: Readonly<Record<string, ReadonlyArray<string>>> = {\n [StorefrontCollection.Products]: ['currency', 'availability', 'variants.availability'],\n};\n\n/**\n * True when `path` (`title`, `pricing.price`, `variants.name`) is a STORED field a visitor sees — what a storefront\n * query may filter or sort by. A computed field is not one; nor is anything deeper than one nested level.\n */\nexport function isStorefrontField(collection: string, path: string): boolean {\n const fields = STOREFRONT_FIELDS[collection];\n if (!fields || typeof path !== 'string') return false;\n const [root, sub, ...rest] = path.split('.');\n const spec = fields[root];\n if (!spec || rest.length) return false;\n return sub === undefined || (spec !== true && spec.includes(sub));\n}\n\n/**\n * The fields a page may BIND from a shop source: the stored paths a schema lists that a visitor sees, then the computed\n * ones — a stock count or a SKU in the schema is never offered, because the live site never has it.\n */\nexport function storefrontBindPaths(collection: string, schemaPaths: ReadonlyArray<string>): string[] {\n const stored = schemaPaths.filter(path => isStorefrontField(collection, path));\n const computed = (STOREFRONT_COMPUTED_FIELDS[collection] ?? []).filter(path => !stored.includes(path));\n return [...stored, ...computed];\n}\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 { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { isMoney, money, Money, percentOf } from './money';\n\n/**\n * Coupons v1 (commerce plan §3h, E4): a code, a percent or a fixed amount off the GOODS (never the delivery), an\n * optional minimum order, start and end, a uses limit; one per order. `priceCart` is the only place a coupon becomes\n * a discount — iox-cms recomputes it at checkout and when the order is placed (trap T1). Pure: the caller passes `now`.\n */\nexport enum CouponKind {\n Percent = 'percent',\n Fixed = 'fixed',\n}\n\nexport interface Coupon {\n code: string;\n kind: CouponKind;\n /** 1–100, at most two decimals — a Percent coupon's. */\n percent?: number | null;\n /** A Fixed coupon's amount, in the studio currency. */\n amount?: Money | null;\n /** The goods (after nothing else) must come to at least this. */\n minimumOrder?: Money | null;\n /** ISO dates; a missing one is open-ended. */\n startsAt?: string | null;\n expiresAt?: string | null;\n /** Orders it may be used on; null = no limit. */\n maxUses?: number | null;\n /** Orders placed with it so far. */\n uses?: number;\n enabled: boolean;\n}\n\n/** What a priced cart says about the coupon it applied (the summary's \"Discount · CODE\"). */\nexport interface AppliedCoupon {\n code: string;\n kind: CouponKind;\n percent: number | null;\n amount: Money | null;\n}\n\nexport const COUPON_CODE_MIN = 3;\nexport const COUPON_CODE_MAX = 32;\nconst COUPON_CODE = new RegExp(`^[A-Z0-9][A-Z0-9_-]{${COUPON_CODE_MIN - 1},${COUPON_CODE_MAX - 1}}$`);\nconst PERCENT_MAX = 100;\nconst PERCENT_DECIMALS = 2;\n\n/** A code as it is stored and compared: trimmed, upper-case. A buyer may type `back10` for `BACK10`. */\nexport function normalizeCouponCode(value: unknown): string {\n return typeof value === 'string' ? value.trim().toUpperCase() : '';\n}\n\nexport function isCouponCode(value: unknown): boolean {\n return COUPON_CODE.test(normalizeCouponCode(value));\n}\n\n/** What the owner must fix before a coupon may be saved. */\nexport enum CouponProblem {\n CodeInvalid = 'code-invalid',\n KindInvalid = 'kind-invalid',\n PercentInvalid = 'percent-invalid',\n AmountInvalid = 'amount-invalid',\n MinimumInvalid = 'minimum-invalid',\n DatesInvalid = 'dates-invalid',\n MaxUsesInvalid = 'max-uses-invalid',\n}\n\nconst dateOf = (value: unknown): number | null => {\n if (value === null || value === undefined || value === '') return null;\n const at = new Date(value as string).getTime();\n return Number.isFinite(at) ? at : NaN;\n};\n\nconst percentValid = (value: unknown): boolean => {\n if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0 || value > PERCENT_MAX) return false;\n const [, frac = ''] = String(value).split('.');\n return frac.length <= PERCENT_DECIMALS;\n};\n\nconst positiveMoneyIn = (value: unknown, currency: CurrencyCode): boolean =>\n isMoney(value) && value.currency === currency && value.amount > 0;\n\n/** Every reason this coupon cannot be saved for a studio selling in `currency` — empty when it can. */\nexport function couponProblems(coupon: Partial<Coupon> | null | undefined, currency: CurrencyCode): CouponProblem[] {\n const c = coupon ?? {};\n const problems: CouponProblem[] = [];\n if (!isCouponCode(c.code)) problems.push(CouponProblem.CodeInvalid);\n if (c.kind === CouponKind.Percent) {\n if (!percentValid(c.percent)) problems.push(CouponProblem.PercentInvalid);\n } else if (c.kind === CouponKind.Fixed) {\n if (!positiveMoneyIn(c.amount, currency)) problems.push(CouponProblem.AmountInvalid);\n } else {\n problems.push(CouponProblem.KindInvalid);\n }\n if (c.minimumOrder !== null && c.minimumOrder !== undefined && !(isMoney(c.minimumOrder) && c.minimumOrder.currency === currency && c.minimumOrder.amount >= 0)) {\n problems.push(CouponProblem.MinimumInvalid);\n }\n const starts = dateOf(c.startsAt);\n const ends = dateOf(c.expiresAt);\n if (Number.isNaN(starts) || Number.isNaN(ends) || (starts !== null && ends !== null && ends <= starts)) problems.push(CouponProblem.DatesInvalid);\n if (c.maxUses !== null && c.maxUses !== undefined && !(Number.isSafeInteger(c.maxUses) && c.maxUses >= 1)) problems.push(CouponProblem.MaxUsesInvalid);\n return problems;\n}\n\n/** Why a coupon gives no discount to this cart — each said to the buyer on the coupon field. */\nexport enum CouponRefusal {\n Unknown = 'coupon-unknown',\n Disabled = 'coupon-disabled',\n NotStarted = 'coupon-not-started',\n Expired = 'coupon-expired',\n UsedUp = 'coupon-used-up',\n MinimumNotMet = 'coupon-minimum-not-met',\n /** Another currency, or a coupon the owner would not be allowed to save now. */\n NotUsable = 'coupon-not-usable',\n}\n\n/** `{amount}` is the minimum order, filled by `couponRefusalWords`. */\nexport const COUPON_REFUSAL_LABELS: Readonly<Record<CouponRefusal, CommerceLabel>> = Object.freeze({\n [CouponRefusal.Unknown]: { en: 'This code does not exist. Check it and try again.', he: 'הקוד הזה לא קיים. בדקו אותו ונסו שוב.' },\n [CouponRefusal.Disabled]: { en: 'This code is not active.', he: 'הקוד הזה אינו פעיל.' },\n [CouponRefusal.NotStarted]: { en: 'This code cannot be used yet.', he: 'עדיין אי אפשר להשתמש בקוד הזה.' },\n [CouponRefusal.Expired]: { en: 'This code has expired.', he: 'תוקף הקוד הזה פג.' },\n [CouponRefusal.UsedUp]: { en: 'This code has been used up.', he: 'הקוד הזה נוצל עד תומו.' },\n [CouponRefusal.MinimumNotMet]: { en: 'This code is for orders of {amount} or more.', he: 'הקוד הזה תקף להזמנות של {amount} ומעלה.' },\n [CouponRefusal.NotUsable]: { en: 'This code cannot be used on this order.', he: 'אי אפשר להשתמש בקוד הזה בהזמנה הזו.' },\n});\n\nexport function couponRefusalWords(refusal: CouponRefusal, lang: string | null | undefined, fill: { amount?: string } = {}): string {\n return labelIn(COUPON_REFUSAL_LABELS[refusal], lang).replace('{amount}', fill.amount ?? '');\n}\n\nconst COUPON_OFFER_LABELS: Readonly<Record<CouponKind, CommerceLabel>> = Object.freeze({\n [CouponKind.Percent]: { en: '{percent}% off', he: '{percent}% הנחה' },\n [CouponKind.Fixed]: { en: '{amount} off', he: '{amount} הנחה' },\n});\n\n/** What a coupon gives, in words (\"10% off\", \"₪50.00 off\") — the reminder's offer and the admin's coupon list. */\nexport function couponOfferWords(coupon: Pick<Coupon, 'kind' | 'percent' | 'amount'>, lang: string | null | undefined, formatMoney: (value: Money) => string): string {\n const label = COUPON_OFFER_LABELS[coupon.kind];\n if (!label) return '';\n return labelIn(label, lang).replace('{percent}', String(coupon.percent ?? '')).replace('{amount}', coupon.amount ? formatMoney(coupon.amount) : '');\n}\n\nexport type CouponCheck =\n | { ok: true; discount: Money; applied: AppliedCoupon }\n | { ok: false; refusal: CouponRefusal };\n\ninterface CouponRule {\n readonly refusal: CouponRefusal;\n readonly refuses: (coupon: Coupon, goods: Money, now: number) => boolean;\n}\n\n/** Checked in order; the first that refuses is the one said. */\nconst COUPON_RULES: readonly CouponRule[] = Object.freeze([\n { refusal: CouponRefusal.Disabled, refuses: (c: Coupon) => c.enabled !== true },\n { refusal: CouponRefusal.NotUsable, refuses: (c: Coupon, goods: Money) => couponProblems(c, goods.currency).length > 0 },\n { refusal: CouponRefusal.NotStarted, refuses: (c: Coupon, _g: Money, now: number) => dateOf(c.startsAt) !== null && now < (dateOf(c.startsAt) as number) },\n { refusal: CouponRefusal.Expired, refuses: (c: Coupon, _g: Money, now: number) => dateOf(c.expiresAt) !== null && now >= (dateOf(c.expiresAt) as number) },\n { refusal: CouponRefusal.UsedUp, refuses: (c: Coupon) => typeof c.maxUses === 'number' && (c.uses ?? 0) >= c.maxUses },\n { refusal: CouponRefusal.MinimumNotMet, refuses: (c: Coupon, goods: Money) => !!c.minimumOrder && goods.amount < c.minimumOrder.amount },\n]);\n\n/**\n * The discount `coupon` gives goods worth `goods` at `now`: a percent of them (rounded once, half to even) or the\n * fixed amount, never more than the goods themselves. No clock is read: a missing `now` refuses a dated coupon.\n */\nexport function couponDiscount(coupon: Coupon | null | undefined, goods: Money, now: number | null | undefined): CouponCheck {\n if (!coupon) return { ok: false, refusal: CouponRefusal.Unknown };\n const at = typeof now === 'number' && Number.isFinite(now) ? now : NaN;\n const dated = dateOf(coupon.startsAt) !== null || dateOf(coupon.expiresAt) !== null;\n if (dated && Number.isNaN(at)) return { ok: false, refusal: CouponRefusal.NotUsable };\n const refused = COUPON_RULES.find(rule => rule.refuses(coupon, goods, at));\n if (refused) return { ok: false, refusal: refused.refusal };\n const raw = coupon.kind === CouponKind.Percent ? percentOf(goods, coupon.percent as number) : (coupon.amount as Money);\n const discount = money(Math.min(raw.amount, goods.amount), goods.currency);\n return {\n ok: true,\n discount,\n applied: {\n code: normalizeCouponCode(coupon.code),\n kind: coupon.kind,\n percent: coupon.kind === CouponKind.Percent ? (coupon.percent as number) : null,\n amount: coupon.kind === CouponKind.Fixed ? money((coupon.amount as Money).amount, goods.currency) : null,\n },\n };\n}\n","import { CatalogEntry, catalogKey, sellableQuantity } from './catalog';\nimport { AppliedCoupon, Coupon, couponDiscount, CouponRefusal, normalizeCouponCode } from './coupons';\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 /** The buyer's coupon (E4) — the caller looked it up; `priceCart` decides what it gives. */\n coupon?: Coupon | null;\n /** Epoch ms the coupon's dates are judged at (no clock is read here). */\n now?: number | 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 /** The coupon gives this cart nothing now (expired, used up, under its minimum…): no discount; `couponRefusal` says why. */\n CouponNotApplied = 'coupon-not-applied',\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 [CartIssueCode.CouponNotApplied]: { en: 'Your coupon no longer applies to this order and was removed.', 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 /** CouponNotApplied: the code and why. */\n coupon?: string;\n couponRefusal?: CouponRefusal;\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 /** The coupon's discount on the goods (E4); `total` already subtracts it. */\n discount: Money;\n /** The coupon that gave `discount`, or null. */\n coupon: AppliedCoupon | null;\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/** The coupon's discount on the goods — none, and an issue said, when the coupon gives this cart nothing now. */\nfunction discountOf(choice: PricingChoice | null | undefined, subtotal: Money, issues: CartIssue[]): { discount: Money; coupon: AppliedCoupon | null } {\n const none = { discount: money(0, subtotal.currency), coupon: null };\n if (!choice?.coupon) return none;\n const check = couponDiscount(choice.coupon, subtotal, choice.now);\n if (check.ok === false) {\n issues.push({ code: CartIssueCode.CouponNotApplied, coupon: normalizeCouponCode(choice.coupon.code), couponRefusal: check.refusal });\n return none;\n }\n return { discount: check.discount, coupon: check.applied };\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, coupon } = discountOf(choice, subtotal, issues);\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 coupon,\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): the buyer pays there, never on a card field of ours. */\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 /** Ready only while the studio's payment connector answers (E2): the server says so in `connected`. */\n readonly needsConnection: 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 needsConnection: false,\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 needsConnection: false,\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 needsConnection: false,\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 needsConnection: false,\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: true,\n needsConnection: true,\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 * A FACT the server adds, never stored: the studio's payment connector answered its last check (E2). Only a method\n * that `needsConnection` reads it — a card method whose terminal does not answer is not a way to get paid.\n */\n connected?: boolean | 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/** A method that needs no connection, or whose connection answered (E2). */\nexport function paymentMethodConnected(config: PaymentMethodConfig): boolean {\n return !!config && isPaymentMethodKind(config.kind) && (!PAYMENT_METHODS[config.kind].needsConnection || config.connected === true);\n}\n\n/** Enabled, offered in this phase, complete and — for a card method — connected: 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 && paymentMethodConnected(config);\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 { CommerceLabel } from './labels';\nimport { isMoney, Money } from './money';\nimport { OrderState, STOCK_RESERVATION_MINUTES } from './orders';\nimport { PaymentChannel } from './payments';\n\n/**\n * Card payments (commerce E2, C-D2, trap T2): what a payment provider's answer MEANS for an order. The provider's\n * adapter (iox-cms) asks the provider itself — never the buyer's browser, never a webhook's body — and normalises its\n * answer to a `PaymentResult`; `paymentVerdict` decides. Pure: no clock (the caller passes `now`), no provider names.\n */\n\nexport enum PaymentResultStatus {\n /** The provider took the money: a transaction exists. */\n Paid = 'paid',\n /** The page is open (the buyer has not paid yet, or a card was declined and the page still waits). */\n Pending = 'pending',\n /** The provider closed the session without a payment. */\n Failed = 'failed',\n /** The provider does not know the session (or did not answer): nothing is decided. */\n Unknown = 'unknown',\n}\n\n/** One provider answer about one session, as its adapter read it. */\nexport interface PaymentResult {\n status: PaymentResultStatus;\n /** The provider's session id, as the provider said it. */\n sessionId: string | null;\n /** Our reference, echoed back by the provider (what we sent when the session was made). */\n reference: string | null;\n /** The provider's transaction id — what a refund names. */\n transactionId: string | null;\n /** What was charged, in minor units of the charged currency. */\n amount: Money | null;\n /** The provider's words for the last declined try while the page still waits — shown to the buyer. */\n declined?: string | null;\n /** What the owner may read of the card that paid (never more than a brand and the last four digits). */\n card?: PaidCard | null;\n}\n\nexport interface PaidCard {\n brand: string | null;\n last4: string | null;\n}\n\n/** One time the buyer was sent to the provider's page for an order. */\nexport enum PaymentAttemptStatus {\n Open = 'open',\n Paid = 'paid',\n Failed = 'failed',\n /** The order expired or was cancelled while this page was open. */\n Closed = 'closed',\n}\n\nexport interface PaymentAttempt {\n /** Our reference: the provider echoes it, so a result for another order is refused. */\n reference: string;\n provider: string;\n sessionId: string;\n /** Where the buyer pays (the provider's hosted page). */\n url: string;\n status: PaymentAttemptStatus;\n createdAt: Date | string;\n}\n\nexport enum PaymentVerdictKind {\n /** Paid and every fact matches: the order moves to paid (the machine's `confirmPayment`). */\n Confirm = 'confirm',\n /** The provider closed the session unpaid: `failPayment`, the reservation released. */\n Fail = 'fail',\n /** Still open: show \"Confirming…\" and ask again. */\n Wait = 'wait',\n /** Nothing to do (an unknown session, a pending page of an order that moved on). */\n Ignore = 'ignore',\n /** The answer does not belong to this order or does not match it: nothing changes, the owner is told. */\n Refuse = 'refuse',\n /** The same transaction was already recorded: a replayed answer, a second webhook, the return racing the webhook. */\n AlreadyPaid = 'alreadyPaid',\n /** A SECOND transaction paid an order already paid (two tabs): kept for the owner to refund. */\n PaidTwice = 'paidTwice',\n /** Paid after the order was cancelled (the reservation ran out): kept for the owner to refund. */\n PaidAfterClose = 'paidAfterClose',\n}\n\nexport enum PaymentMismatch {\n Session = 'session-mismatch',\n Reference = 'reference-mismatch',\n Currency = 'currency-mismatch',\n Amount = 'amount-mismatch',\n NoTransaction = 'no-transaction',\n}\n\nexport interface PaymentVerdict {\n kind: PaymentVerdictKind;\n mismatches: PaymentMismatch[];\n}\n\nexport interface PaymentVerdictInput {\n state: OrderState;\n /** The order's total — what must have been charged. */\n total: Money;\n /** The attempt this answer is about (found by OUR records, never by the answer). */\n attempt: Pick<PaymentAttempt, 'reference' | 'sessionId'>;\n /** The transaction already recorded as paying this order, if any. */\n paidTransactionId: string | null;\n result: PaymentResult;\n}\n\nconst PAID_STATES: readonly OrderState[] = Object.freeze([\n OrderState.Paid, OrderState.Fulfilled, OrderState.Delivered, OrderState.PartiallyRefunded, OrderState.Refunded,\n]);\n\nconst OPEN_STATES: readonly OrderState[] = Object.freeze([OrderState.PendingPayment, OrderState.PaymentFailed]);\n\nconst verdict = (kind: PaymentVerdictKind, mismatches: PaymentMismatch[] = []): PaymentVerdict => ({ kind, mismatches });\n\n/** The mismatches that make an answer not this order's: another session, another reference. */\nfunction identityMismatches(input: PaymentVerdictInput): PaymentMismatch[] {\n const { result, attempt } = input;\n const found: PaymentMismatch[] = [];\n if (result.sessionId !== null && result.sessionId !== attempt.sessionId) found.push(PaymentMismatch.Session);\n if (result.reference !== attempt.reference) found.push(PaymentMismatch.Reference);\n return found;\n}\n\n/** A paid answer must name a transaction and have charged exactly the order's total, in its currency. */\nfunction moneyMismatches(input: PaymentVerdictInput): PaymentMismatch[] {\n const { result, total } = input;\n if (!result.transactionId) return [PaymentMismatch.NoTransaction];\n if (!isMoney(result.amount) || result.amount.currency !== total.currency) return [PaymentMismatch.Currency];\n return result.amount.amount === total.amount ? [] : [PaymentMismatch.Amount];\n}\n\n/** THE decision on a provider's answer (T2): only a paid answer for THIS attempt, of exactly this total, pays — once. */\nexport function paymentVerdict(input: PaymentVerdictInput): PaymentVerdict {\n const { result, state } = input;\n if (result.status === PaymentResultStatus.Unknown) return verdict(PaymentVerdictKind.Ignore);\n const identity = identityMismatches(input);\n if (identity.length) return verdict(PaymentVerdictKind.Refuse, identity);\n if (result.status === PaymentResultStatus.Paid) {\n const money = moneyMismatches(input);\n if (money.length) return verdict(PaymentVerdictKind.Refuse, money);\n if (input.paidTransactionId && input.paidTransactionId === result.transactionId) return verdict(PaymentVerdictKind.AlreadyPaid);\n if (OPEN_STATES.includes(state)) return verdict(PaymentVerdictKind.Confirm);\n if (PAID_STATES.includes(state)) return verdict(PaymentVerdictKind.PaidTwice);\n if (state === OrderState.Cancelled) return verdict(PaymentVerdictKind.PaidAfterClose);\n return verdict(PaymentVerdictKind.Ignore);\n }\n if (state !== OrderState.PendingPayment) return verdict(PaymentVerdictKind.Ignore);\n return verdict(result.status === PaymentResultStatus.Failed ? PaymentVerdictKind.Fail : PaymentVerdictKind.Wait);\n}\n\n/** A page made this recently is sent again instead of a new one (a double click, a second tab) — while the stock is held. */\nexport function reusableAttempt(attempts: readonly PaymentAttempt[] | null | undefined, now: number): PaymentAttempt | null {\n const open = (attempts ?? []).filter(attempt => attempt.status === PaymentAttemptStatus.Open);\n const last = open[open.length - 1];\n if (!last) return null;\n return now - new Date(last.createdAt).getTime() < STOCK_RESERVATION_MINUTES * 60000 ? last : null;\n}\n\n/** The reservation ran out: the payment sweep asks the provider one last time, then expires the order (C-D10). */\nexport function reservationDue(reservedUntil: Date | string | null | undefined, now: number): boolean {\n if (!reservedUntil) return false;\n const until = new Date(reservedUntil).getTime();\n return Number.isFinite(until) && until <= now;\n}\n\n/** What the buyer's order page shows about paying (the engine's \"Confirming your payment…\"). */\nexport enum BuyerPaymentStage {\n /** A manual method: how to pay. */\n Instructions = 'instructions',\n /** A card payment is open: confirming with the provider. */\n Confirming = 'confirming',\n Paid = 'paid',\n /** The card payment did not go through: the buyer may try again. */\n Failed = 'failed',\n /** Cancelled (by the owner, or not paid in time). */\n Closed = 'closed',\n}\n\nconst ONLINE_STAGES: Readonly<Record<OrderState, BuyerPaymentStage>> = Object.freeze({\n [OrderState.AwaitingPayment]: BuyerPaymentStage.Instructions,\n [OrderState.PendingPayment]: BuyerPaymentStage.Confirming,\n [OrderState.PaymentFailed]: BuyerPaymentStage.Failed,\n [OrderState.Paid]: BuyerPaymentStage.Paid,\n [OrderState.Fulfilled]: BuyerPaymentStage.Paid,\n [OrderState.Delivered]: BuyerPaymentStage.Paid,\n [OrderState.Refunded]: BuyerPaymentStage.Paid,\n [OrderState.PartiallyRefunded]: BuyerPaymentStage.Paid,\n [OrderState.Cancelled]: BuyerPaymentStage.Closed,\n});\n\nexport function buyerPaymentStage(state: OrderState, channel: PaymentChannel): BuyerPaymentStage {\n const stage = ONLINE_STAGES[state] ?? BuyerPaymentStage.Closed;\n if (channel === PaymentChannel.Manual && (stage === BuyerPaymentStage.Confirming || stage === BuyerPaymentStage.Failed)) return BuyerPaymentStage.Instructions;\n return stage;\n}\n\n/** The buyer may (re)open the payment page: still within the open states of a card order. */\nexport function buyerMayPay(state: OrderState, channel: PaymentChannel): boolean {\n return channel === PaymentChannel.Online && OPEN_STATES.includes(state);\n}\n\n/** What happened to a card payment, as the order's history and the admin say it. */\nexport const PAYMENT_VERDICT_LABELS: Readonly<Record<PaymentVerdictKind, CommerceLabel>> = Object.freeze({\n [PaymentVerdictKind.Confirm]: { en: 'Paid by card', he: 'שולם בכרטיס אשראי' },\n [PaymentVerdictKind.Fail]: { en: 'The card payment did not go through', he: 'התשלום בכרטיס לא עבר' },\n [PaymentVerdictKind.Wait]: { en: 'Waiting for the payment', he: 'ממתינים לתשלום' },\n [PaymentVerdictKind.Ignore]: { en: 'Nothing changed', he: 'לא השתנה דבר' },\n [PaymentVerdictKind.Refuse]: { en: 'A payment answer that does not match this order was refused', he: 'תשובת תשלום שלא תואמת להזמנה נדחתה' },\n [PaymentVerdictKind.AlreadyPaid]: { en: 'Already recorded', he: 'כבר נרשם' },\n [PaymentVerdictKind.PaidTwice]: { en: 'Paid a second time — refund the extra payment', he: 'שולם פעמיים — יש לזכות את התשלום הנוסף' },\n [PaymentVerdictKind.PaidAfterClose]: { en: 'Paid after the order was cancelled — refund it', 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 /** The coupon code the discount came from (E4), or null. */\n readonly coupon: { readonly code: string } | null;\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 coupon: pricedCart.coupon ? { code: pricedCart.coupon.code } : null,\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 { AppliedCoupon } from './coupons';\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 /** The coupon's discount (E4) — zero, or null on a cart never priced. */\n discount: Money | null;\n coupon: AppliedCoupon | 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, discount: null, coupon: 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 discount: priced.discount,\n coupon: priced.coupon ?? null,\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 { COUPON_REFUSAL_LABELS, CouponRefusal } from './coupons';\nimport { CommerceLabel, labelIn } from './labels';\nimport { isMoney, Money } from './money';\nimport { OrderSnapshot, PostalAddress } from './order-snapshot';\nimport { OrderState } from './orders';\nimport { BuyerPaymentStage } from './payment-sessions';\nimport { DeliveryFit, PaymentChannel, 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 /** `PUT {code}` applies a coupon to the open checkout; `DELETE` removes it (E4). */\n CheckoutCoupon = 'checkout/coupon',\n /** `POST /:token` — a reminder's link: the bag back under this browser's cookie, the checkout as it was (E4). */\n CheckoutRecover = 'checkout/recover',\n /** `GET|POST /:token` — the unsubscribe page's state, and the unsubscribe itself (E4). */\n Unsubscribe = 'marketing/unsubscribe',\n Order = 'order',\n}\n\n/** What the buyer does to a card order through its link (E2): `pay` opens (or re-opens) the provider's page. */\nexport enum SiteOrderAction {\n Pay = 'pay',\n}\n\n/** `POST /api/site/<org>/order/<token>/pay` — root-relative, like every site route. */\nexport function siteOrderActionPath(orgId: string, token: string, action: SiteOrderAction): string {\n return `${siteCommercePath(orgId, SiteCommerceRoute.Order, token)}/${action}`;\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/**\n * E2.1 — the card form sits in a frame on the order page; the provider sends THE FRAME back to the order page with\n * `?in=frame`. That address only says \"the buyer is back\": it is never read as a result (T2) — the page asks iox-cms.\n */\nexport const ORDER_FRAME_PARAM = 'in';\nexport const ORDER_FRAME_VALUE = 'frame';\n\nexport function orderFrameReturnHref(orgLabel: string | null | undefined, token: string): string {\n return `${orderHref(orgLabel, token)}?${ORDER_FRAME_PARAM}=${ORDER_FRAME_VALUE}`;\n}\n\n/** Whether a query (a search string, `URLSearchParams` or a parsed map) is the frame's return. */\nexport function isOrderFrameReturn(query: string | URLSearchParams | Readonly<Record<string, unknown>> | null | undefined): boolean {\n if (!query) return false;\n const value = typeof query === 'string' ? new URLSearchParams(query).get(ORDER_FRAME_PARAM)\n : query instanceof URLSearchParams ? query.get(ORDER_FRAME_PARAM)\n : query[ORDER_FRAME_PARAM];\n return (Array.isArray(value) ? value[0] : value) === ORDER_FRAME_VALUE;\n}\n\n/** What the frame's return page posts to its parent (same origin only). It carries NO status — only \"the buyer is back\". */\nexport const PAYMENT_RETURNED = 'payment-returned';\n\nexport function paymentReturnedMessage(): { iox: string } {\n return { iox: PAYMENT_RETURNED };\n}\n\nexport function isPaymentReturnedMessage(data: unknown): boolean {\n return !!data && typeof data === 'object' && (data as { iox?: unknown }).iox === PAYMENT_RETURNED;\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 /** How paying stands (E2): the stage the page shows, whether the buyer may open the payment page, a declined card's words. */\n payment: SiteOrderPayment;\n}\n\nexport interface SiteOrderPayment {\n channel: PaymentChannel;\n stage: BuyerPaymentStage;\n canPay: boolean;\n declined: string | null;\n /**\n * E2.1 — the studio's owner switch \"Apple Pay is on for my Cardcom terminal\" (Settings ▸ Payments, off by default).\n * Only the on/off is public. The order page draws \"Pay with Apple Pay\" only when this is true AND the device says\n * `ApplePaySession.canMakePayments()`. Absent = off.\n */\n applePay?: boolean;\n}\n\n/** Where to send the buyer to pay — a card order only (E2); `null` when the page could not be made (they try again from the order page). */\nexport interface SitePaymentRedirect {\n redirectUrl: string;\n}\n\n/** `POST checkout/place` — 201. */\nexport interface SitePlacedOrder {\n order: SiteBuyerOrder;\n viewToken: string;\n payment?: SitePaymentRedirect | null;\n}\n\n/** `POST order/:token/pay` — the order as it stands and where to pay. */\nexport interface SitePayAnswer {\n order: SiteBuyerOrder;\n payment: SitePaymentRedirect | null;\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 Coupon = 'coupon',\n ApplyCoupon = 'applyCoupon',\n RemoveCoupon = 'removeCoupon',\n Discount = 'discount',\n PayOrder = 'payOrder',\n PayNote = 'payNote',\n ToPaymentPage = 'toPaymentPage',\n ConfirmingPayment = 'confirmingPayment',\n ConfirmingSlow = 'confirmingSlow',\n PaymentConfirmed = 'paymentConfirmed',\n PaymentFailed = 'paymentFailed',\n PaymentDeclined = 'paymentDeclined',\n TryAgain = 'tryAgain',\n PayNow = 'payNow',\n OrderClosed = 'orderClosed',\n PayFrameTitle = 'payFrameTitle',\n OpenPaymentHere = 'openPaymentHere',\n PayFrameSlow = 'payFrameSlow',\n PayWithApplePay = 'payWithApplePay',\n OrderAwaitsPayment = 'orderAwaitsPayment',\n OrderAwaitsNote = 'orderAwaitsNote',\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 [CheckoutWord.Coupon]: { en: 'Coupon code', he: 'קוד קופון' },\n [CheckoutWord.ApplyCoupon]: { en: 'Apply', he: 'החלה' },\n [CheckoutWord.RemoveCoupon]: { en: 'Remove', he: 'הסרה' },\n [CheckoutWord.Discount]: { en: 'Discount · {code}', he: 'הנחה · {code}' },\n [CheckoutWord.PayOrder]: { en: 'Pay · {total}', he: 'לתשלום · {total}' },\n [CheckoutWord.PayNote]: { en: 'You pay on a secure payment page. We never see your card.', he: 'התשלום מתבצע בעמוד תשלום מאובטח. איננו רואים את פרטי הכרטיס.' },\n [CheckoutWord.ToPaymentPage]: { en: 'Taking you to the payment page…', he: 'מעבירים אותך לעמוד התשלום…' },\n [CheckoutWord.ConfirmingPayment]: { en: 'Confirming your payment…', he: 'מאשרים את התשלום…' },\n [CheckoutWord.ConfirmingSlow]: { en: 'This is taking longer than usual. You can close this page — we will email you once the payment is confirmed.', he: 'זה לוקח יותר זמן מהרגיל. אפשר לסגור את העמוד — נשלח אימייל כשהתשלום יאושר.' },\n [CheckoutWord.PaymentConfirmed]: { en: 'Payment confirmed', he: 'התשלום אושר' },\n [CheckoutWord.PaymentFailed]: { en: 'The payment did not go through. Nothing was charged.', he: 'התשלום לא עבר. לא חויבתם.' },\n [CheckoutWord.PaymentDeclined]: { en: 'The card was declined: {reason}', he: 'הכרטיס נדחה: {reason}' },\n [CheckoutWord.TryAgain]: { en: 'Try again', he: 'נסו שוב' },\n [CheckoutWord.PayNow]: { en: 'Pay now · {total}', he: 'לתשלום עכשיו · {total}' },\n [CheckoutWord.OrderClosed]: { en: 'This order was cancelled.', he: 'ההזמנה הזו בוטלה.' },\n [CheckoutWord.PayFrameTitle]: { en: 'Secure card payment', he: 'תשלום מאובטח בכרטיס אשראי' },\n [CheckoutWord.OpenPaymentHere]: { en: 'Open the secure page in this window', he: 'לפתוח את הדף המאובטח בחלון הזה' },\n [CheckoutWord.PayFrameSlow]: { en: 'The secure page is slow to load.', he: 'הדף המאובטח נטען לאט.' },\n [CheckoutWord.PayWithApplePay]: { en: 'Pay with Apple Pay', he: 'תשלום ב-Apple Pay' },\n [CheckoutWord.OrderAwaitsPayment]: { en: 'Order #{number} is waiting for payment', he: 'הזמנה #{number} ממתינה לתשלום' },\n [CheckoutWord.OrderAwaitsNote]: { en: 'Your bag is empty because the order was already placed.', 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 coupon field in the order summary (E4). */\n Coupon = 'coupon',\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 CouponUnknown = 'coupon-unknown',\n CouponDisabled = 'coupon-disabled',\n CouponNotStarted = 'coupon-not-started',\n CouponExpired = 'coupon-expired',\n CouponUsedUp = 'coupon-used-up',\n CouponMinimumNotMet = 'coupon-minimum-not-met',\n CouponNotUsable = 'coupon-not-usable',\n /** A reminder's link to a purchase that was completed (E4). */\n RecoveryDone = 'recovery-done',\n /** A reminder's link whose bag is gone, or a link that is not one. */\n RecoveryExpired = 'recovery-expired',\n /** The payment page could not be made right now (the provider did not answer) — the order stands; try again (E2). */\n PaymentUnavailable = 'payment-unavailable',\n /** This order cannot be paid any more (paid, or cancelled). */\n PaymentClosed = 'payment-closed',\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.CouponUnknown]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Unknown] },\n [SiteRefusalCode.CouponDisabled]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Disabled] },\n [SiteRefusalCode.CouponNotStarted]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotStarted] },\n [SiteRefusalCode.CouponExpired]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Expired] },\n [SiteRefusalCode.CouponUsedUp]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.UsedUp] },\n [SiteRefusalCode.CouponMinimumNotMet]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.MinimumNotMet] },\n [SiteRefusalCode.CouponNotUsable]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotUsable] },\n [SiteRefusalCode.RecoveryDone]: { slot: CheckoutSlot.Page, label: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' } },\n [SiteRefusalCode.RecoveryExpired]: { slot: CheckoutSlot.Page, label: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' } },\n [SiteRefusalCode.PaymentUnavailable]: { slot: CheckoutSlot.Page, label: { en: 'The payment page is not available right now. Your order is saved — try again in a moment.', he: 'עמוד התשלום לא זמין כרגע. ההזמנה נשמרה — נסו שוב בעוד רגע.' } },\n [SiteRefusalCode.PaymentClosed]: { slot: CheckoutSlot.Page, label: { en: 'This order cannot be paid any more.', 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, fill: Readonly<Record<string, string>> = {}): SiteRefusal {\n const known: SiteRefusalCode = isRefusalCode(code) ? code : SiteRefusalCode.InvalidBody;\n const rule = SITE_REFUSALS[known];\n const words = labelIn(rule.label, lang).replace(/\\{(\\w+)\\}/g, (all, key) => fill[key] ?? all);\n return { code: isRefusalCode(code) ? code : String(code ?? known), slot: rule.slot, words };\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, formatMoney?: (value: Money) => string): SiteRefusal[] {\n const answer = body && typeof body === 'object' ? body as { code?: unknown; refusals?: unknown; minimum?: 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 // A coupon's minimum is said as an amount (`{amount}`), in the host's money format.\n const fill: Record<string, string> = isMoney(answer.minimum) && formatMoney ? { amount: formatMoney(answer.minimum) } : {};\n const seen = new Set<CheckoutSlot>();\n return codes.map(code => refusalOf(code, lang, fill)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));\n}\n","import { CheckoutStep } from './checkout';\nimport { CommerceLabel, labelIn } from './labels';\n\n/**\n * The journey and recovery (commerce plan §3g, C-D13, C-D14 — E4): when a purchase counts as abandoned, the reminder\n * sequence (1 h · 24 h · 72 h, the last may carry a coupon), the ONE consent rule a reminder obeys, the funnel the owner\n * reads, the words of the reminder email and the unsubscribe page, and their site paths. Pure: no clock is read —\n * every caller passes `now` (epoch ms).\n */\n\nconst HOUR_MS = 60 * 60 * 1000;\n\n/** A purchase with an email and no payment for this long is abandoned — a lead the owner can follow up. */\nexport const ABANDONED_AFTER_MS = HOUR_MS;\n\n/** A reminder this late (a pod was down, reminders were just switched on) is passed over, never sent stale. */\nexport const REMINDER_LATE_MS = 12 * HOUR_MS;\n\nexport enum ReminderStep {\n First = 'first',\n Second = 'second',\n Third = 'third',\n}\n\nexport interface ReminderTiming {\n readonly step: ReminderStep;\n /** After the buyer's LAST activity on the checkout. */\n readonly afterMs: number;\n /** The owner's coupon rides this one, when there is one. */\n readonly carriesCoupon: boolean;\n}\n\n/** The sequence (board 9): 1 hour after leaving, after 24 hours, after 72 hours + a coupon. */\nexport const REMINDER_SEQUENCE: readonly ReminderTiming[] = Object.freeze([\n { step: ReminderStep.First, afterMs: HOUR_MS, carriesCoupon: false },\n { step: ReminderStep.Second, afterMs: 24 * HOUR_MS, carriesCoupon: false },\n { step: ReminderStep.Third, afterMs: 72 * HOUR_MS, carriesCoupon: true },\n]);\n\nexport const REMINDER_STEPS: readonly ReminderStep[] = Object.freeze(REMINDER_SEQUENCE.map(timing => timing.step));\n\n/** The owner's words for one reminder — blank keeps the default. */\nexport interface ReminderWords {\n subject?: string | null;\n lead?: string | null;\n}\n\nexport interface ReminderSettings {\n enabled: boolean;\n steps: Record<ReminderStep, boolean>;\n /** A coupon code of the studio's, offered in the reminder that carries one. */\n couponCode: string | null;\n words: Partial<Record<ReminderStep, ReminderWords>>;\n}\n\nexport const REMINDER_WORDS_MAX = 200;\n\n/** On, every step on, no coupon (board 9). Reminders still go ONLY to a buyer who ticked consent. */\nexport const DEFAULT_REMINDER_SETTINGS: Readonly<ReminderSettings> = Object.freeze({\n enabled: true,\n steps: Object.freeze({ [ReminderStep.First]: true, [ReminderStep.Second]: true, [ReminderStep.Third]: true }) as Record<ReminderStep, boolean>,\n couponCode: null,\n words: Object.freeze({}),\n});\n\nconst text = (value: unknown, max: number): string | null =>\n typeof value === 'string' && value.trim() ? value.trim().slice(0, max) : null;\n\n/** A stored (or sent) settings value read leniently: anything missing or malformed is the default. */\nexport function reminderSettingsOf(raw: unknown): ReminderSettings {\n const r = raw && typeof raw === 'object' ? raw as Partial<ReminderSettings> : {};\n const steps = { ...DEFAULT_REMINDER_SETTINGS.steps };\n const words: Partial<Record<ReminderStep, ReminderWords>> = {};\n for (const step of REMINDER_STEPS) {\n if (typeof r.steps?.[step] === 'boolean') steps[step] = r.steps[step];\n const w = r.words?.[step];\n const subject = text(w?.subject, REMINDER_WORDS_MAX);\n const lead = text(w?.lead, REMINDER_WORDS_MAX * 2);\n if (subject || lead) words[step] = { subject, lead };\n }\n return {\n enabled: typeof r.enabled === 'boolean' ? r.enabled : DEFAULT_REMINDER_SETTINGS.enabled,\n steps,\n couponCode: text(r.couponCode, 64)?.toUpperCase() ?? null,\n words,\n };\n}\n\n// ── consent (T7 — the marketing tick, never the cookie decision) ─────────────────────────────────────────\n\n/** One recorded decision about marketing: the checkout's tick, the customer's latest, an unsubscribe, the owner's stop. */\nexport interface ConsentDecision {\n given: boolean;\n at: string | number | Date | null | undefined;\n}\n\nconst timeOf = (at: ConsentDecision['at']): number => {\n if (at === null || at === undefined) return Number.NEGATIVE_INFINITY;\n const ms = at instanceof Date ? at.getTime() : new Date(at as string).getTime();\n return Number.isFinite(ms) ? ms : Number.NEGATIVE_INFINITY;\n};\n\n/**\n * THE consent gate of a marketing message (Israel's Communications Law §30A, the GDPR — C-D14): the LATEST decision\n * wins. A tick at a checkout allows; an unsubscribe or the owner's \"Stop reminders\" after it forbids; a new tick at a\n * later checkout allows again. No decision at all forbids — a reminder is never sent on silence. A tie forbids.\n */\nexport function marketingAllowed(...decisions: ReadonlyArray<ConsentDecision | null | undefined>): boolean {\n let latest: { given: boolean; at: number } | null = null;\n for (const d of decisions) {\n if (!d || typeof d.given !== 'boolean') continue;\n const at = timeOf(d.at);\n if (!latest || at > latest.at || (at === latest.at && !d.given)) latest = { given: d.given, at };\n }\n return latest?.given === true;\n}\n\n// ── the sequence ─────────────────────────────────────────────────────────────────────────────────────────\n\n/** Why a checkout gets no (more) reminders. */\nexport enum ReminderStop {\n /** The purchase was made. */\n Completed = 'completed',\n NoEmail = 'no-email',\n /** No tick, or the latest decision is a withdrawal. */\n NoConsent = 'no-consent',\n /** The owner marked the lead lost. */\n Lost = 'lost',\n /** The studio's reminders are off. */\n Off = 'off',\n /** Every reminder was sent, or its time has passed. */\n Done = 'done',\n}\n\nexport interface ReminderFacts {\n /** The checkout is still open (no order placed from it). */\n open: boolean;\n hasEmail: boolean;\n /** `marketingAllowed(...)` for this buyer. */\n consent: boolean;\n lost: boolean;\n /** Epoch ms of the buyer's last activity on the checkout. */\n lastActivityAt: number;\n /** Steps already sent, failed or passed over — never tried twice. */\n done: readonly ReminderStep[];\n settings: ReminderSettings;\n}\n\nexport type ReminderPlan =\n | { due: true; step: ReminderStep; dueAt: number; carriesCoupon: boolean }\n | { due: false; stop: ReminderStop };\n\nconst STOPS: ReadonlyArray<{ stop: ReminderStop; when: (f: ReminderFacts) => boolean }> = Object.freeze([\n { stop: ReminderStop.Completed, when: (f: ReminderFacts) => !f.open },\n { stop: ReminderStop.NoEmail, when: (f: ReminderFacts) => !f.hasEmail },\n { stop: ReminderStop.NoConsent, when: (f: ReminderFacts) => !f.consent },\n { stop: ReminderStop.Lost, when: (f: ReminderFacts) => f.lost },\n { stop: ReminderStop.Off, when: (f: ReminderFacts) => !f.settings.enabled },\n]);\n\n/**\n * The next reminder of a checkout at `now`: the first step that is switched on, not done yet, and not more than\n * `REMINDER_LATE_MS` past its time — due at `lastActivityAt + afterMs` (it may be in the future: the scheduler waits).\n * A buyer who comes back moves every later reminder with their activity. Steps too late are passed over silently.\n */\nexport function nextReminder(facts: ReminderFacts, now: number): ReminderPlan {\n const stopped = STOPS.find(rule => rule.when(facts));\n if (stopped) return { due: false, stop: stopped.stop };\n for (const timing of REMINDER_SEQUENCE) {\n if (facts.done.includes(timing.step) || facts.settings.steps[timing.step] !== true) continue;\n const dueAt = facts.lastActivityAt + timing.afterMs;\n if (now > dueAt + REMINDER_LATE_MS) continue;\n return { due: true, step: timing.step, dueAt, carriesCoupon: timing.carriesCoupon };\n }\n return { due: false, stop: ReminderStop.Done };\n}\n\n/** The step's number as the owner reads it (\"Reminder 2\"). */\nexport function reminderNumber(step: ReminderStep): number {\n return REMINDER_STEPS.indexOf(step) + 1;\n}\n\n/** What became of one reminder. */\nexport enum ReminderOutcome {\n Sent = 'sent',\n Failed = 'failed',\n /** Not sent, on purpose — `ReminderSkip` says why. */\n Skipped = 'skipped',\n}\n\nexport enum ReminderSkip {\n /** The studio's sender domain is not verified: it would land in spam (T13). */\n SenderUnverified = 'sender-unverified',\n NoMailer = 'no-mailer',\n /** The studio's public address is unknown, so there is no link to put in it. */\n NoSiteAddress = 'no-site-address',\n /** The bag is empty now: nothing to come back to. */\n EmptyBag = 'empty-bag',\n /** A send was started and the pod stopped before it was recorded: never sent twice. */\n Interrupted = 'interrupted',\n}\n\n/** Is a checkout an abandoned purchase at `now`: open, with an email, untouched for an hour. */\nexport function isAbandoned(c: { open: boolean; hasEmail: boolean; lastActivityAt: number }, now: number): boolean {\n return c.open && c.hasEmail && now - c.lastActivityAt >= ABANDONED_AFTER_MS;\n}\n\n/** Where a purchase stopped: the step after the furthest one the buyer completed (board 9's \"Stopped at\"). */\nexport function stoppedAt(furthest: CheckoutStep | null | undefined): CheckoutStep {\n if (furthest === CheckoutStep.Paid) return CheckoutStep.Paid;\n if (furthest === CheckoutStep.Delivery || furthest === CheckoutStep.Payment) return CheckoutStep.Payment;\n return CheckoutStep.Delivery;\n}\n\n// ── the funnel (Shop ▸ Sales journey) ─────────────────────────────────────────────────────────────────────\n\nexport enum FunnelStage {\n AddedToBag = 'added-to-bag',\n GaveEmail = 'gave-email',\n ChoseDelivery = 'chose-delivery',\n ReachedPayment = 'reached-payment',\n PlacedOrder = 'placed-order',\n Paid = 'paid',\n}\n\nexport const FUNNEL_STAGES: readonly FunnelStage[] = Object.freeze([\n FunnelStage.AddedToBag, FunnelStage.GaveEmail, FunnelStage.ChoseDelivery, FunnelStage.ReachedPayment, FunnelStage.PlacedOrder, FunnelStage.Paid,\n]);\n\nexport interface FunnelRow {\n stage: FunnelStage;\n count: number;\n /** Whole percent of the first stage. */\n share: number;\n /** Whole percent lost since the previous stage; null on the first. */\n drop: number | null;\n}\n\nconst count = (value: unknown): number => (typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0);\n\n/**\n * The funnel's rows. Each stage is a subset of the one before, so a count is raised to the next stage's when the\n * records disagree (a bag removed after 30 days while its checkout is kept) — a share never passes 100 %.\n */\nexport function funnelOf(counts: Partial<Record<FunnelStage, number>>): FunnelRow[] {\n const values = FUNNEL_STAGES.map(stage => count(counts[stage]));\n for (let i = values.length - 2; i >= 0; i--) values[i] = Math.max(values[i], values[i + 1]);\n const first = values[0];\n return FUNNEL_STAGES.map((stage, i) => ({\n stage,\n count: values[i],\n share: first ? Math.round((values[i] / first) * 100) : 0,\n drop: i === 0 ? null : values[i - 1] ? Math.round(((values[i - 1] - values[i]) / values[i - 1]) * 100) : 0,\n }));\n}\n\n/** The stage that loses the most buyers after `after` (board 9: \"After contact, the biggest drop is at delivery\"). */\nexport function biggestDrop(rows: readonly FunnelRow[], after: FunnelStage = FunnelStage.GaveEmail): FunnelStage | null {\n const from = rows.findIndex(row => row.stage === after);\n let best: FunnelRow | null = null;\n for (const row of rows.slice(from + 1)) if ((row.drop ?? 0) > 0 && (!best || (row.drop ?? 0) > (best.drop ?? 0))) best = row;\n return best?.stage ?? null;\n}\n\n/** The Sales journey's periods (board 9). */\nexport const JOURNEY_PERIODS_DAYS: readonly number[] = Object.freeze([7, 30, 90]);\nexport const DEFAULT_JOURNEY_DAYS = 30;\n\n// ── one purchase's journey (board 8) ──────────────────────────────────────────────────────────────────────\n\n/** What a timeline says happened — the purchase's own records, never browsing (C-D13). */\nexport enum JourneyEventKind {\n CheckoutStarted = 'checkout-started',\n DeliveryChosen = 'delivery-chosen',\n PaymentChosen = 'payment-chosen',\n ReminderSent = 'reminder-sent',\n ReminderFailed = 'reminder-failed',\n ReminderSkipped = 'reminder-skipped',\n ReminderScheduled = 'reminder-scheduled',\n CameBack = 'came-back',\n Unsubscribed = 'unsubscribed',\n MarkedLost = 'marked-lost',\n OrderPlaced = 'order-placed',\n}\n\n// ── the site paths ────────────────────────────────────────────────────────────────────────────────────────\n\n/** `/<orgLabel>/checkout/r/<token>` — the reminder's link: the bag restored, the step they left. */\nexport const RECOVERY_PATH = 'r';\n/** `/<orgLabel>/checkout/unsubscribe/<token>` — works without signing in. */\nexport const UNSUBSCRIBE_PATH = 'unsubscribe';\n\nconst checkoutTail = (orgLabel: string | null | undefined, tail: string): string => {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n const path = `checkout/${tail}`;\n return label ? `/${encodeURIComponent(label)}/${path}` : `/${path}`;\n};\n\nexport function recoveryHref(orgLabel: string | null | undefined, token: string): string {\n return checkoutTail(orgLabel, `${RECOVERY_PATH}/${encodeURIComponent(token)}`);\n}\n\nexport function unsubscribeHref(orgLabel: string | null | undefined, token: string): string {\n return checkoutTail(orgLabel, `${UNSUBSCRIBE_PATH}/${encodeURIComponent(token)}`);\n}\n\n/** `GET|POST api/site/:orgId/marketing/unsubscribe/:token` — the page's state. The email is masked. */\nexport interface SiteUnsubscribeState {\n subscribed: boolean;\n email: string;\n siteName: string | null;\n language: string;\n}\n\n/** `n•••@example.com` — enough for a person to recognise their address, not enough to harvest it. */\nexport function maskEmail(email: string | null | undefined): string {\n const value = String(email ?? '');\n const at = value.indexOf('@');\n if (at < 1) return '';\n return `${value[0]}•••${value.slice(at)}`;\n}\n\n// ── the words ─────────────────────────────────────────────────────────────────────────────────────────────\n\nexport enum RecoveryWord {\n SubjectFirst = 'subjectFirst',\n SubjectSecond = 'subjectSecond',\n SubjectThird = 'subjectThird',\n Heading = 'heading',\n Lead = 'lead',\n Return = 'return',\n KeptDetails = 'keptDetails',\n CouponOffer = 'couponOffer',\n Why = 'why',\n Unsubscribe = 'unsubscribe',\n UnsubscribeTitle = 'unsubscribeTitle',\n UnsubscribeAsk = 'unsubscribeAsk',\n UnsubscribeButton = 'unsubscribeButton',\n UnsubscribeDone = 'unsubscribeDone',\n UnsubscribeAlready = 'unsubscribeAlready',\n UnsubscribeUnknown = 'unsubscribeUnknown',\n UnsubscribeTransactional = 'unsubscribeTransactional',\n RecoveryDone = 'recoveryDone',\n RecoveryExpired = 'recoveryExpired',\n Restoring = 'restoring',\n}\n\n/** `{studio}`, `{code}`, `{offer}`, `{step}`, `{email}` are filled by `recoveryWord`. */\nexport const RECOVERY_WORDS: Readonly<Record<RecoveryWord, CommerceLabel>> = Object.freeze({\n [RecoveryWord.SubjectFirst]: { en: '{studio}: your bag is waiting', he: '{studio}: הסל שלך מחכה' },\n [RecoveryWord.SubjectSecond]: { en: '{studio}: still thinking it over?', he: '{studio}: עדיין מתלבטים?' },\n [RecoveryWord.SubjectThird]: { en: '{studio}: a little something to finish your order', he: '{studio}: משהו קטן כדי להשלים את ההזמנה' },\n [RecoveryWord.Heading]: { en: 'You left something in your bag', he: 'השארת משהו בסל' },\n [RecoveryWord.Lead]: { en: 'Your bag at {studio} is just as you left it.', he: 'הסל שלך ב{studio} בדיוק כפי שהשארת אותו.' },\n [RecoveryWord.Return]: { en: 'Return to checkout', he: 'חזרה לתשלום' },\n [RecoveryWord.KeptDetails]: { en: 'We kept your details — you will continue from {step}.', he: 'שמרנו את הפרטים שלך — ממשיכים מ{step}.' },\n [RecoveryWord.CouponOffer]: { en: 'Use the code {code} for {offer}.', he: 'השתמשו בקוד {code} לקבלת {offer}.' },\n [RecoveryWord.Why]: { en: 'You are getting this because you asked {studio} for reminders and offers.', he: 'המייל נשלח כי ביקשת מ{studio} תזכורות והצעות.' },\n [RecoveryWord.Unsubscribe]: { en: 'Unsubscribe', he: 'הסרה מרשימת התפוצה' },\n [RecoveryWord.UnsubscribeTitle]: { en: 'Reminders and offers from {studio}', he: 'תזכורות והצעות מ{studio}' },\n [RecoveryWord.UnsubscribeAsk]: { en: 'Stop sending reminders and offers to {email}?', he: 'להפסיק לשלוח תזכורות והצעות אל {email}?' },\n [RecoveryWord.UnsubscribeButton]: { en: 'Unsubscribe', he: 'הסירו אותי' },\n [RecoveryWord.UnsubscribeDone]: { en: 'Done. {studio} will send no more reminders or offers to {email}.', he: 'בוצע. {studio} לא ישלחו עוד תזכורות או הצעות אל {email}.' },\n [RecoveryWord.UnsubscribeAlready]: { en: '{email} gets no reminders or offers from {studio}.', he: '{email} לא מקבל/ת תזכורות או הצעות מ{studio}.' },\n [RecoveryWord.UnsubscribeUnknown]: { en: 'This link does not work any more. You will get no reminders or offers through it.', he: 'הקישור הזה כבר לא פעיל. לא יישלחו דרכו תזכורות או הצעות.' },\n [RecoveryWord.UnsubscribeTransactional]: { en: 'Emails about an order you place still arrive.', he: 'מיילים על הזמנה שתבצעו ימשיכו להגיע.' },\n [RecoveryWord.RecoveryDone]: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' },\n [RecoveryWord.RecoveryExpired]: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' },\n [RecoveryWord.Restoring]: { en: 'Opening your bag…', he: 'פותחים את הסל שלך…' },\n});\n\nexport function recoveryWord(word: RecoveryWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return labelIn(RECOVERY_WORDS[word], lang).replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n/** The default subject of each reminder. */\nexport const REMINDER_SUBJECT_WORDS: Readonly<Record<ReminderStep, RecoveryWord>> = Object.freeze({\n [ReminderStep.First]: RecoveryWord.SubjectFirst,\n [ReminderStep.Second]: RecoveryWord.SubjectSecond,\n [ReminderStep.Third]: RecoveryWord.SubjectThird,\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; E4 adds\n * coupons (one per order, priced by `priceCart`) and the journey: reminders, the consent gate, the funnel. 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 './storefront-fields';\nexport * from './shipping';\nexport * from './coupons';\nexport * from './cart';\nexport * from './payments';\nexport * from './payment-sessions';\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 * from './recovery';\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,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ce-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/storefront-fields.ts","../../../projects/iox-ui/src/commerce-core/text.ts","../../../projects/iox-ui/src/commerce-core/shipping.ts","../../../projects/iox-ui/src/commerce-core/coupons.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/payment-sessions.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/recovery.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","/**\n * What a VISITOR may see of a shop row (commerce plan F4, iox-cms#67) — the ONE allowlist, here so the server that\n * projects a row (iox-cms `storefront-projection.ts`) and the builder that offers its fields to bind (iox-cms-client#50)\n * read the same list. An ALLOWLIST: a field added to a shop schema stays private until it is named here — stock counts,\n * SKUs, the organization, the build bookkeeping and the sample mark never leave the server.\n */\n\n/** A top-level field the storefront serves: `true` as stored, or the sub-fields of each nested row it keeps. */\nexport type StorefrontFieldSpec = true | ReadonlyArray<string>;\n\n/** The shop collections a storefront reads (iox-cms `ShopCollection`, orders excluded — never public). */\nexport enum StorefrontCollection {\n Products = 'products',\n Categories = 'categories',\n SubCategories = 'subCategories',\n}\n\nconst PRODUCT_FIELDS: Readonly<Record<string, StorefrontFieldSpec>> = {\n _id: true,\n title: true,\n slug: true,\n description: true,\n category: true,\n subCategory: true,\n mainImage: true,\n media: true,\n productVariants: true,\n digital: true,\n pricing: ['price', 'compareat'],\n options: ['_id', 'name', 'values'],\n variants: ['_id', 'enable', 'name', 'image', 'price', 'compareat'],\n};\n\nconst CATEGORY_FIELDS: Readonly<Record<string, StorefrontFieldSpec>> = { _id: true, label: true, slug: true, color: true };\n\nexport const STOREFRONT_FIELDS: Readonly<Record<string, Readonly<Record<string, StorefrontFieldSpec>>>> = {\n [StorefrontCollection.Products]: PRODUCT_FIELDS,\n [StorefrontCollection.Categories]: CATEGORY_FIELDS,\n [StorefrontCollection.SubCategories]: { ...CATEGORY_FIELDS, categoryId: true },\n};\n\n/**\n * What the server ADDS to a projected row — never stored, so never sortable or filterable: a product's `currency` (ISO\n * 4217) and its stock as a WORD (`availability`, commerce-core `Availability`), also on each variant. A product card\n * binds `availability`, never a count.\n */\nexport const STOREFRONT_COMPUTED_FIELDS: Readonly<Record<string, ReadonlyArray<string>>> = {\n [StorefrontCollection.Products]: ['currency', 'availability', 'variants.availability'],\n};\n\n/**\n * True when `path` (`title`, `pricing.price`, `variants.name`) is a STORED field a visitor sees — what a storefront\n * query may filter or sort by. A computed field is not one; nor is anything deeper than one nested level.\n */\nexport function isStorefrontField(collection: string, path: string): boolean {\n const fields = STOREFRONT_FIELDS[collection];\n if (!fields || typeof path !== 'string') return false;\n const [root, sub, ...rest] = path.split('.');\n const spec = fields[root];\n if (!spec || rest.length) return false;\n return sub === undefined || (spec !== true && spec.includes(sub));\n}\n\n/**\n * The fields a page may BIND from a shop source: the stored paths a schema lists that a visitor sees, then the computed\n * ones — a stock count or a SKU in the schema is never offered, because the live site never has it.\n */\nexport function storefrontBindPaths(collection: string, schemaPaths: ReadonlyArray<string>): string[] {\n const stored = schemaPaths.filter(path => isStorefrontField(collection, path));\n const computed = (STOREFRONT_COMPUTED_FIELDS[collection] ?? []).filter(path => !stored.includes(path));\n return [...stored, ...computed];\n}\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 { CurrencyCode } from './currency';\nimport { CommerceLabel, labelIn } from './labels';\nimport { isMoney, money, Money, percentOf } from './money';\n\n/**\n * Coupons v1 (commerce plan §3h, E4): a code, a percent or a fixed amount off the GOODS (never the delivery), an\n * optional minimum order, start and end, a uses limit; one per order. `priceCart` is the only place a coupon becomes\n * a discount — iox-cms recomputes it at checkout and when the order is placed (trap T1). Pure: the caller passes `now`.\n */\nexport enum CouponKind {\n Percent = 'percent',\n Fixed = 'fixed',\n}\n\nexport interface Coupon {\n code: string;\n kind: CouponKind;\n /** 1–100, at most two decimals — a Percent coupon's. */\n percent?: number | null;\n /** A Fixed coupon's amount, in the studio currency. */\n amount?: Money | null;\n /** The goods (after nothing else) must come to at least this. */\n minimumOrder?: Money | null;\n /** ISO dates; a missing one is open-ended. */\n startsAt?: string | null;\n expiresAt?: string | null;\n /** Orders it may be used on; null = no limit. */\n maxUses?: number | null;\n /** Orders placed with it so far. */\n uses?: number;\n enabled: boolean;\n}\n\n/** What a priced cart says about the coupon it applied (the summary's \"Discount · CODE\"). */\nexport interface AppliedCoupon {\n code: string;\n kind: CouponKind;\n percent: number | null;\n amount: Money | null;\n}\n\nexport const COUPON_CODE_MIN = 3;\nexport const COUPON_CODE_MAX = 32;\nconst COUPON_CODE = new RegExp(`^[A-Z0-9][A-Z0-9_-]{${COUPON_CODE_MIN - 1},${COUPON_CODE_MAX - 1}}$`);\nconst PERCENT_MAX = 100;\nconst PERCENT_DECIMALS = 2;\n\n/** A code as it is stored and compared: trimmed, upper-case. A buyer may type `back10` for `BACK10`. */\nexport function normalizeCouponCode(value: unknown): string {\n return typeof value === 'string' ? value.trim().toUpperCase() : '';\n}\n\nexport function isCouponCode(value: unknown): boolean {\n return COUPON_CODE.test(normalizeCouponCode(value));\n}\n\n/** What the owner must fix before a coupon may be saved. */\nexport enum CouponProblem {\n CodeInvalid = 'code-invalid',\n KindInvalid = 'kind-invalid',\n PercentInvalid = 'percent-invalid',\n AmountInvalid = 'amount-invalid',\n MinimumInvalid = 'minimum-invalid',\n DatesInvalid = 'dates-invalid',\n MaxUsesInvalid = 'max-uses-invalid',\n}\n\nconst dateOf = (value: unknown): number | null => {\n if (value === null || value === undefined || value === '') return null;\n const at = new Date(value as string).getTime();\n return Number.isFinite(at) ? at : NaN;\n};\n\nconst percentValid = (value: unknown): boolean => {\n if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0 || value > PERCENT_MAX) return false;\n const [, frac = ''] = String(value).split('.');\n return frac.length <= PERCENT_DECIMALS;\n};\n\nconst positiveMoneyIn = (value: unknown, currency: CurrencyCode): boolean =>\n isMoney(value) && value.currency === currency && value.amount > 0;\n\n/** Every reason this coupon cannot be saved for a studio selling in `currency` — empty when it can. */\nexport function couponProblems(coupon: Partial<Coupon> | null | undefined, currency: CurrencyCode): CouponProblem[] {\n const c = coupon ?? {};\n const problems: CouponProblem[] = [];\n if (!isCouponCode(c.code)) problems.push(CouponProblem.CodeInvalid);\n if (c.kind === CouponKind.Percent) {\n if (!percentValid(c.percent)) problems.push(CouponProblem.PercentInvalid);\n } else if (c.kind === CouponKind.Fixed) {\n if (!positiveMoneyIn(c.amount, currency)) problems.push(CouponProblem.AmountInvalid);\n } else {\n problems.push(CouponProblem.KindInvalid);\n }\n if (c.minimumOrder !== null && c.minimumOrder !== undefined && !(isMoney(c.minimumOrder) && c.minimumOrder.currency === currency && c.minimumOrder.amount >= 0)) {\n problems.push(CouponProblem.MinimumInvalid);\n }\n const starts = dateOf(c.startsAt);\n const ends = dateOf(c.expiresAt);\n if (Number.isNaN(starts) || Number.isNaN(ends) || (starts !== null && ends !== null && ends <= starts)) problems.push(CouponProblem.DatesInvalid);\n if (c.maxUses !== null && c.maxUses !== undefined && !(Number.isSafeInteger(c.maxUses) && c.maxUses >= 1)) problems.push(CouponProblem.MaxUsesInvalid);\n return problems;\n}\n\n/** Why a coupon gives no discount to this cart — each said to the buyer on the coupon field. */\nexport enum CouponRefusal {\n Unknown = 'coupon-unknown',\n Disabled = 'coupon-disabled',\n NotStarted = 'coupon-not-started',\n Expired = 'coupon-expired',\n UsedUp = 'coupon-used-up',\n MinimumNotMet = 'coupon-minimum-not-met',\n /** Another currency, or a coupon the owner would not be allowed to save now. */\n NotUsable = 'coupon-not-usable',\n}\n\n/** `{amount}` is the minimum order, filled by `couponRefusalWords`. */\nexport const COUPON_REFUSAL_LABELS: Readonly<Record<CouponRefusal, CommerceLabel>> = Object.freeze({\n [CouponRefusal.Unknown]: { en: 'This code does not exist. Check it and try again.', he: 'הקוד הזה לא קיים. בדקו אותו ונסו שוב.' },\n [CouponRefusal.Disabled]: { en: 'This code is not active.', he: 'הקוד הזה אינו פעיל.' },\n [CouponRefusal.NotStarted]: { en: 'This code cannot be used yet.', he: 'עדיין אי אפשר להשתמש בקוד הזה.' },\n [CouponRefusal.Expired]: { en: 'This code has expired.', he: 'תוקף הקוד הזה פג.' },\n [CouponRefusal.UsedUp]: { en: 'This code has been used up.', he: 'הקוד הזה נוצל עד תומו.' },\n [CouponRefusal.MinimumNotMet]: { en: 'This code is for orders of {amount} or more.', he: 'הקוד הזה תקף להזמנות של {amount} ומעלה.' },\n [CouponRefusal.NotUsable]: { en: 'This code cannot be used on this order.', he: 'אי אפשר להשתמש בקוד הזה בהזמנה הזו.' },\n});\n\nexport function couponRefusalWords(refusal: CouponRefusal, lang: string | null | undefined, fill: { amount?: string } = {}): string {\n return labelIn(COUPON_REFUSAL_LABELS[refusal], lang).replace('{amount}', fill.amount ?? '');\n}\n\nconst COUPON_OFFER_LABELS: Readonly<Record<CouponKind, CommerceLabel>> = Object.freeze({\n [CouponKind.Percent]: { en: '{percent}% off', he: '{percent}% הנחה' },\n [CouponKind.Fixed]: { en: '{amount} off', he: '{amount} הנחה' },\n});\n\n/** What a coupon gives, in words (\"10% off\", \"₪50.00 off\") — the reminder's offer and the admin's coupon list. */\nexport function couponOfferWords(coupon: Pick<Coupon, 'kind' | 'percent' | 'amount'>, lang: string | null | undefined, formatMoney: (value: Money) => string): string {\n const label = COUPON_OFFER_LABELS[coupon.kind];\n if (!label) return '';\n return labelIn(label, lang).replace('{percent}', String(coupon.percent ?? '')).replace('{amount}', coupon.amount ? formatMoney(coupon.amount) : '');\n}\n\nexport type CouponCheck =\n | { ok: true; discount: Money; applied: AppliedCoupon }\n | { ok: false; refusal: CouponRefusal };\n\ninterface CouponRule {\n readonly refusal: CouponRefusal;\n readonly refuses: (coupon: Coupon, goods: Money, now: number) => boolean;\n}\n\n/** Checked in order; the first that refuses is the one said. */\nconst COUPON_RULES: readonly CouponRule[] = Object.freeze([\n { refusal: CouponRefusal.Disabled, refuses: (c: Coupon) => c.enabled !== true },\n { refusal: CouponRefusal.NotUsable, refuses: (c: Coupon, goods: Money) => couponProblems(c, goods.currency).length > 0 },\n { refusal: CouponRefusal.NotStarted, refuses: (c: Coupon, _g: Money, now: number) => dateOf(c.startsAt) !== null && now < (dateOf(c.startsAt) as number) },\n { refusal: CouponRefusal.Expired, refuses: (c: Coupon, _g: Money, now: number) => dateOf(c.expiresAt) !== null && now >= (dateOf(c.expiresAt) as number) },\n { refusal: CouponRefusal.UsedUp, refuses: (c: Coupon) => typeof c.maxUses === 'number' && (c.uses ?? 0) >= c.maxUses },\n { refusal: CouponRefusal.MinimumNotMet, refuses: (c: Coupon, goods: Money) => !!c.minimumOrder && goods.amount < c.minimumOrder.amount },\n]);\n\n/**\n * The discount `coupon` gives goods worth `goods` at `now`: a percent of them (rounded once, half to even) or the\n * fixed amount, never more than the goods themselves. No clock is read: a missing `now` refuses a dated coupon.\n */\nexport function couponDiscount(coupon: Coupon | null | undefined, goods: Money, now: number | null | undefined): CouponCheck {\n if (!coupon) return { ok: false, refusal: CouponRefusal.Unknown };\n const at = typeof now === 'number' && Number.isFinite(now) ? now : NaN;\n const dated = dateOf(coupon.startsAt) !== null || dateOf(coupon.expiresAt) !== null;\n if (dated && Number.isNaN(at)) return { ok: false, refusal: CouponRefusal.NotUsable };\n const refused = COUPON_RULES.find(rule => rule.refuses(coupon, goods, at));\n if (refused) return { ok: false, refusal: refused.refusal };\n const raw = coupon.kind === CouponKind.Percent ? percentOf(goods, coupon.percent as number) : (coupon.amount as Money);\n const discount = money(Math.min(raw.amount, goods.amount), goods.currency);\n return {\n ok: true,\n discount,\n applied: {\n code: normalizeCouponCode(coupon.code),\n kind: coupon.kind,\n percent: coupon.kind === CouponKind.Percent ? (coupon.percent as number) : null,\n amount: coupon.kind === CouponKind.Fixed ? money((coupon.amount as Money).amount, goods.currency) : null,\n },\n };\n}\n","import { CatalogEntry, catalogKey, sellableQuantity } from './catalog';\nimport { AppliedCoupon, Coupon, couponDiscount, CouponRefusal, normalizeCouponCode } from './coupons';\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 /** The buyer's coupon (E4) — the caller looked it up; `priceCart` decides what it gives. */\n coupon?: Coupon | null;\n /** Epoch ms the coupon's dates are judged at (no clock is read here). */\n now?: number | 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 /** The coupon gives this cart nothing now (expired, used up, under its minimum…): no discount; `couponRefusal` says why. */\n CouponNotApplied = 'coupon-not-applied',\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 [CartIssueCode.CouponNotApplied]: { en: 'Your coupon no longer applies to this order and was removed.', 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 /** CouponNotApplied: the code and why. */\n coupon?: string;\n couponRefusal?: CouponRefusal;\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 /** The coupon's discount on the goods (E4); `total` already subtracts it. */\n discount: Money;\n /** The coupon that gave `discount`, or null. */\n coupon: AppliedCoupon | null;\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/** The coupon's discount on the goods — none, and an issue said, when the coupon gives this cart nothing now. */\nfunction discountOf(choice: PricingChoice | null | undefined, subtotal: Money, issues: CartIssue[]): { discount: Money; coupon: AppliedCoupon | null } {\n const none = { discount: money(0, subtotal.currency), coupon: null };\n if (!choice?.coupon) return none;\n const check = couponDiscount(choice.coupon, subtotal, choice.now);\n if (check.ok === false) {\n issues.push({ code: CartIssueCode.CouponNotApplied, coupon: normalizeCouponCode(choice.coupon.code), couponRefusal: check.refusal });\n return none;\n }\n return { discount: check.discount, coupon: check.applied };\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, coupon } = discountOf(choice, subtotal, issues);\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 coupon,\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): the buyer pays there, never on a card field of ours. */\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 /** Ready only while the studio's payment connector answers (E2): the server says so in `connected`. */\n readonly needsConnection: 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 needsConnection: false,\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 needsConnection: false,\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 needsConnection: false,\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 needsConnection: false,\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: true,\n needsConnection: true,\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 * A FACT the server adds, never stored: the studio's payment connector answered its last check (E2). Only a method\n * that `needsConnection` reads it — a card method whose terminal does not answer is not a way to get paid.\n */\n connected?: boolean | 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/** A method that needs no connection, or whose connection answered (E2). */\nexport function paymentMethodConnected(config: PaymentMethodConfig): boolean {\n return !!config && isPaymentMethodKind(config.kind) && (!PAYMENT_METHODS[config.kind].needsConnection || config.connected === true);\n}\n\n/** Enabled, offered in this phase, complete and — for a card method — connected: 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 && paymentMethodConnected(config);\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 { CommerceLabel } from './labels';\nimport { isMoney, Money } from './money';\nimport { OrderState, STOCK_RESERVATION_MINUTES } from './orders';\nimport { PaymentChannel } from './payments';\n\n/**\n * Card payments (commerce E2, C-D2, trap T2): what a payment provider's answer MEANS for an order. The provider's\n * adapter (iox-cms) asks the provider itself — never the buyer's browser, never a webhook's body — and normalises its\n * answer to a `PaymentResult`; `paymentVerdict` decides. Pure: no clock (the caller passes `now`), no provider names.\n */\n\nexport enum PaymentResultStatus {\n /** The provider took the money: a transaction exists. */\n Paid = 'paid',\n /** The page is open (the buyer has not paid yet, or a card was declined and the page still waits). */\n Pending = 'pending',\n /** The provider closed the session without a payment. */\n Failed = 'failed',\n /** The provider does not know the session (or did not answer): nothing is decided. */\n Unknown = 'unknown',\n}\n\n/** One provider answer about one session, as its adapter read it. */\nexport interface PaymentResult {\n status: PaymentResultStatus;\n /** The provider's session id, as the provider said it. */\n sessionId: string | null;\n /** Our reference, echoed back by the provider (what we sent when the session was made). */\n reference: string | null;\n /** The provider's transaction id — what a refund names. */\n transactionId: string | null;\n /** What was charged, in minor units of the charged currency. */\n amount: Money | null;\n /** The provider's words for the last declined try while the page still waits — shown to the buyer. */\n declined?: string | null;\n /** What the owner may read of the card that paid (never more than a brand and the last four digits). */\n card?: PaidCard | null;\n}\n\nexport interface PaidCard {\n brand: string | null;\n last4: string | null;\n}\n\n/** One time the buyer was sent to the provider's page for an order. */\nexport enum PaymentAttemptStatus {\n Open = 'open',\n Paid = 'paid',\n Failed = 'failed',\n /** The order expired or was cancelled while this page was open. */\n Closed = 'closed',\n}\n\nexport interface PaymentAttempt {\n /** Our reference: the provider echoes it, so a result for another order is refused. */\n reference: string;\n provider: string;\n sessionId: string;\n /** Where the buyer pays (the provider's hosted page). */\n url: string;\n status: PaymentAttemptStatus;\n createdAt: Date | string;\n}\n\nexport enum PaymentVerdictKind {\n /** Paid and every fact matches: the order moves to paid (the machine's `confirmPayment`). */\n Confirm = 'confirm',\n /** The provider closed the session unpaid: `failPayment`, the reservation released. */\n Fail = 'fail',\n /** Still open: show \"Confirming…\" and ask again. */\n Wait = 'wait',\n /** Nothing to do (an unknown session, a pending page of an order that moved on). */\n Ignore = 'ignore',\n /** The answer does not belong to this order or does not match it: nothing changes, the owner is told. */\n Refuse = 'refuse',\n /** The same transaction was already recorded: a replayed answer, a second webhook, the return racing the webhook. */\n AlreadyPaid = 'alreadyPaid',\n /** A SECOND transaction paid an order already paid (two tabs): kept for the owner to refund. */\n PaidTwice = 'paidTwice',\n /** Paid after the order was cancelled (the reservation ran out): kept for the owner to refund. */\n PaidAfterClose = 'paidAfterClose',\n}\n\nexport enum PaymentMismatch {\n Session = 'session-mismatch',\n Reference = 'reference-mismatch',\n Currency = 'currency-mismatch',\n Amount = 'amount-mismatch',\n NoTransaction = 'no-transaction',\n}\n\nexport interface PaymentVerdict {\n kind: PaymentVerdictKind;\n mismatches: PaymentMismatch[];\n}\n\nexport interface PaymentVerdictInput {\n state: OrderState;\n /** The order's total — what must have been charged. */\n total: Money;\n /** The attempt this answer is about (found by OUR records, never by the answer). */\n attempt: Pick<PaymentAttempt, 'reference' | 'sessionId'>;\n /** The transaction already recorded as paying this order, if any. */\n paidTransactionId: string | null;\n result: PaymentResult;\n}\n\nconst PAID_STATES: readonly OrderState[] = Object.freeze([\n OrderState.Paid, OrderState.Fulfilled, OrderState.Delivered, OrderState.PartiallyRefunded, OrderState.Refunded,\n]);\n\nconst OPEN_STATES: readonly OrderState[] = Object.freeze([OrderState.PendingPayment, OrderState.PaymentFailed]);\n\nconst verdict = (kind: PaymentVerdictKind, mismatches: PaymentMismatch[] = []): PaymentVerdict => ({ kind, mismatches });\n\n/** The mismatches that make an answer not this order's: another session, another reference. */\nfunction identityMismatches(input: PaymentVerdictInput): PaymentMismatch[] {\n const { result, attempt } = input;\n const found: PaymentMismatch[] = [];\n if (result.sessionId !== null && result.sessionId !== attempt.sessionId) found.push(PaymentMismatch.Session);\n if (result.reference !== attempt.reference) found.push(PaymentMismatch.Reference);\n return found;\n}\n\n/** A paid answer must name a transaction and have charged exactly the order's total, in its currency. */\nfunction moneyMismatches(input: PaymentVerdictInput): PaymentMismatch[] {\n const { result, total } = input;\n if (!result.transactionId) return [PaymentMismatch.NoTransaction];\n if (!isMoney(result.amount) || result.amount.currency !== total.currency) return [PaymentMismatch.Currency];\n return result.amount.amount === total.amount ? [] : [PaymentMismatch.Amount];\n}\n\n/** THE decision on a provider's answer (T2): only a paid answer for THIS attempt, of exactly this total, pays — once. */\nexport function paymentVerdict(input: PaymentVerdictInput): PaymentVerdict {\n const { result, state } = input;\n if (result.status === PaymentResultStatus.Unknown) return verdict(PaymentVerdictKind.Ignore);\n const identity = identityMismatches(input);\n if (identity.length) return verdict(PaymentVerdictKind.Refuse, identity);\n if (result.status === PaymentResultStatus.Paid) {\n const money = moneyMismatches(input);\n if (money.length) return verdict(PaymentVerdictKind.Refuse, money);\n if (input.paidTransactionId && input.paidTransactionId === result.transactionId) return verdict(PaymentVerdictKind.AlreadyPaid);\n if (OPEN_STATES.includes(state)) return verdict(PaymentVerdictKind.Confirm);\n if (PAID_STATES.includes(state)) return verdict(PaymentVerdictKind.PaidTwice);\n if (state === OrderState.Cancelled) return verdict(PaymentVerdictKind.PaidAfterClose);\n return verdict(PaymentVerdictKind.Ignore);\n }\n if (state !== OrderState.PendingPayment) return verdict(PaymentVerdictKind.Ignore);\n return verdict(result.status === PaymentResultStatus.Failed ? PaymentVerdictKind.Fail : PaymentVerdictKind.Wait);\n}\n\n/** A page made this recently is sent again instead of a new one (a double click, a second tab) — while the stock is held. */\nexport function reusableAttempt(attempts: readonly PaymentAttempt[] | null | undefined, now: number): PaymentAttempt | null {\n const open = (attempts ?? []).filter(attempt => attempt.status === PaymentAttemptStatus.Open);\n const last = open[open.length - 1];\n if (!last) return null;\n return now - new Date(last.createdAt).getTime() < STOCK_RESERVATION_MINUTES * 60000 ? last : null;\n}\n\n/** The reservation ran out: the payment sweep asks the provider one last time, then expires the order (C-D10). */\nexport function reservationDue(reservedUntil: Date | string | null | undefined, now: number): boolean {\n if (!reservedUntil) return false;\n const until = new Date(reservedUntil).getTime();\n return Number.isFinite(until) && until <= now;\n}\n\n/** What the buyer's order page shows about paying (the engine's \"Confirming your payment…\"). */\nexport enum BuyerPaymentStage {\n /** A manual method: how to pay. */\n Instructions = 'instructions',\n /** A card payment is open: confirming with the provider. */\n Confirming = 'confirming',\n Paid = 'paid',\n /** The card payment did not go through: the buyer may try again. */\n Failed = 'failed',\n /** Cancelled (by the owner, or not paid in time). */\n Closed = 'closed',\n}\n\nconst ONLINE_STAGES: Readonly<Record<OrderState, BuyerPaymentStage>> = Object.freeze({\n [OrderState.AwaitingPayment]: BuyerPaymentStage.Instructions,\n [OrderState.PendingPayment]: BuyerPaymentStage.Confirming,\n [OrderState.PaymentFailed]: BuyerPaymentStage.Failed,\n [OrderState.Paid]: BuyerPaymentStage.Paid,\n [OrderState.Fulfilled]: BuyerPaymentStage.Paid,\n [OrderState.Delivered]: BuyerPaymentStage.Paid,\n [OrderState.Refunded]: BuyerPaymentStage.Paid,\n [OrderState.PartiallyRefunded]: BuyerPaymentStage.Paid,\n [OrderState.Cancelled]: BuyerPaymentStage.Closed,\n});\n\nexport function buyerPaymentStage(state: OrderState, channel: PaymentChannel): BuyerPaymentStage {\n const stage = ONLINE_STAGES[state] ?? BuyerPaymentStage.Closed;\n if (channel === PaymentChannel.Manual && (stage === BuyerPaymentStage.Confirming || stage === BuyerPaymentStage.Failed)) return BuyerPaymentStage.Instructions;\n return stage;\n}\n\n/** The buyer may (re)open the payment page: still within the open states of a card order. */\nexport function buyerMayPay(state: OrderState, channel: PaymentChannel): boolean {\n return channel === PaymentChannel.Online && OPEN_STATES.includes(state);\n}\n\n/** What happened to a card payment, as the order's history and the admin say it. */\nexport const PAYMENT_VERDICT_LABELS: Readonly<Record<PaymentVerdictKind, CommerceLabel>> = Object.freeze({\n [PaymentVerdictKind.Confirm]: { en: 'Paid by card', he: 'שולם בכרטיס אשראי' },\n [PaymentVerdictKind.Fail]: { en: 'The card payment did not go through', he: 'התשלום בכרטיס לא עבר' },\n [PaymentVerdictKind.Wait]: { en: 'Waiting for the payment', he: 'ממתינים לתשלום' },\n [PaymentVerdictKind.Ignore]: { en: 'Nothing changed', he: 'לא השתנה דבר' },\n [PaymentVerdictKind.Refuse]: { en: 'A payment answer that does not match this order was refused', he: 'תשובת תשלום שלא תואמת להזמנה נדחתה' },\n [PaymentVerdictKind.AlreadyPaid]: { en: 'Already recorded', he: 'כבר נרשם' },\n [PaymentVerdictKind.PaidTwice]: { en: 'Paid a second time — refund the extra payment', he: 'שולם פעמיים — יש לזכות את התשלום הנוסף' },\n [PaymentVerdictKind.PaidAfterClose]: { en: 'Paid after the order was cancelled — refund it', 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 /** The coupon code the discount came from (E4), or null. */\n readonly coupon: { readonly code: string } | null;\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 coupon: pricedCart.coupon ? { code: pricedCart.coupon.code } : null,\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 { AppliedCoupon } from './coupons';\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 /** The coupon's discount (E4) — zero, or null on a cart never priced. */\n discount: Money | null;\n coupon: AppliedCoupon | 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, discount: null, coupon: 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 discount: priced.discount,\n coupon: priced.coupon ?? null,\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 /** The shop parts' own words, stamped in the site's language (`shopRecipeWords` — vectoriox/iox-ui#100). */\n AddToCart = 'addToCart',\n BuyNow = 'buyNow',\n YourBag = 'yourBag',\n Close = 'close',\n RemoveLine = 'removeLine',\n EmptyBag = 'emptyBag',\n Subtotal = 'subtotal',\n VatNote = 'vatNote',\n CheckOut = 'checkOut',\n KeepShopping = 'keepShopping',\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 [ShopWord.AddToCart]: { en: 'Add to cart', he: 'הוספה לסל' },\n [ShopWord.BuyNow]: { en: 'Buy now', he: 'קנייה עכשיו' },\n [ShopWord.YourBag]: { en: 'Your bag', he: 'הסל שלך' },\n [ShopWord.Close]: { en: 'Close', he: 'סגירה' },\n [ShopWord.RemoveLine]: { en: 'Remove', he: 'הסרה' },\n [ShopWord.EmptyBag]: { en: 'Your bag is empty.', he: 'הסל שלך ריק.' },\n [ShopWord.Subtotal]: { en: 'Subtotal', he: 'סכום ביניים' },\n [ShopWord.VatNote]: { en: 'Includes VAT. Delivery is chosen at checkout.', he: 'כולל מע״מ. המשלוח נבחר בקופה.' },\n [ShopWord.CheckOut]: { en: 'Check out', he: 'לקופה' },\n [ShopWord.KeepShopping]: { en: 'Keep shopping', he: 'המשך בקניות' },\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 { COUPON_REFUSAL_LABELS, CouponRefusal } from './coupons';\nimport { CommerceLabel, labelIn } from './labels';\nimport { isMoney, Money } from './money';\nimport { OrderSnapshot, PostalAddress } from './order-snapshot';\nimport { OrderState } from './orders';\nimport { BuyerPaymentStage } from './payment-sessions';\nimport { DeliveryFit, PaymentChannel, 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 /** `PUT {code}` applies a coupon to the open checkout; `DELETE` removes it (E4). */\n CheckoutCoupon = 'checkout/coupon',\n /** `POST /:token` — a reminder's link: the bag back under this browser's cookie, the checkout as it was (E4). */\n CheckoutRecover = 'checkout/recover',\n /** `GET|POST /:token` — the unsubscribe page's state, and the unsubscribe itself (E4). */\n Unsubscribe = 'marketing/unsubscribe',\n Order = 'order',\n}\n\n/** What the buyer does to a card order through its link (E2): `pay` opens (or re-opens) the provider's page. */\nexport enum SiteOrderAction {\n Pay = 'pay',\n}\n\n/** `POST /api/site/<org>/order/<token>/pay` — root-relative, like every site route. */\nexport function siteOrderActionPath(orgId: string, token: string, action: SiteOrderAction): string {\n return `${siteCommercePath(orgId, SiteCommerceRoute.Order, token)}/${action}`;\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/**\n * E2.1 — the card form sits in a frame on the order page; the provider sends THE FRAME back to the order page with\n * `?in=frame`. That address only says \"the buyer is back\": it is never read as a result (T2) — the page asks iox-cms.\n */\nexport const ORDER_FRAME_PARAM = 'in';\nexport const ORDER_FRAME_VALUE = 'frame';\n\nexport function orderFrameReturnHref(orgLabel: string | null | undefined, token: string): string {\n return `${orderHref(orgLabel, token)}?${ORDER_FRAME_PARAM}=${ORDER_FRAME_VALUE}`;\n}\n\n/** Whether a query (a search string, `URLSearchParams` or a parsed map) is the frame's return. */\nexport function isOrderFrameReturn(query: string | URLSearchParams | Readonly<Record<string, unknown>> | null | undefined): boolean {\n if (!query) return false;\n const value = typeof query === 'string' ? new URLSearchParams(query).get(ORDER_FRAME_PARAM)\n : query instanceof URLSearchParams ? query.get(ORDER_FRAME_PARAM)\n : query[ORDER_FRAME_PARAM];\n return (Array.isArray(value) ? value[0] : value) === ORDER_FRAME_VALUE;\n}\n\n/** What the frame's return page posts to its parent (same origin only). It carries NO status — only \"the buyer is back\". */\nexport const PAYMENT_RETURNED = 'payment-returned';\n\nexport function paymentReturnedMessage(): { iox: string } {\n return { iox: PAYMENT_RETURNED };\n}\n\nexport function isPaymentReturnedMessage(data: unknown): boolean {\n return !!data && typeof data === 'object' && (data as { iox?: unknown }).iox === PAYMENT_RETURNED;\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 /** How paying stands (E2): the stage the page shows, whether the buyer may open the payment page, a declined card's words. */\n payment: SiteOrderPayment;\n}\n\nexport interface SiteOrderPayment {\n channel: PaymentChannel;\n stage: BuyerPaymentStage;\n canPay: boolean;\n declined: string | null;\n /**\n * E2.1 — the studio's owner switch \"Apple Pay is on for my Cardcom terminal\" (Settings ▸ Payments, off by default).\n * Only the on/off is public. The order page draws \"Pay with Apple Pay\" only when this is true AND the device says\n * `ApplePaySession.canMakePayments()`. Absent = off.\n */\n applePay?: boolean;\n}\n\n/** Where to send the buyer to pay — a card order only (E2); `null` when the page could not be made (they try again from the order page). */\nexport interface SitePaymentRedirect {\n redirectUrl: string;\n}\n\n/** `POST checkout/place` — 201. */\nexport interface SitePlacedOrder {\n order: SiteBuyerOrder;\n viewToken: string;\n payment?: SitePaymentRedirect | null;\n}\n\n/** `POST order/:token/pay` — the order as it stands and where to pay. */\nexport interface SitePayAnswer {\n order: SiteBuyerOrder;\n payment: SitePaymentRedirect | null;\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 Coupon = 'coupon',\n ApplyCoupon = 'applyCoupon',\n RemoveCoupon = 'removeCoupon',\n Discount = 'discount',\n PayOrder = 'payOrder',\n PayNote = 'payNote',\n ToPaymentPage = 'toPaymentPage',\n ConfirmingPayment = 'confirmingPayment',\n ConfirmingSlow = 'confirmingSlow',\n PaymentConfirmed = 'paymentConfirmed',\n PaymentFailed = 'paymentFailed',\n PaymentDeclined = 'paymentDeclined',\n TryAgain = 'tryAgain',\n PayNow = 'payNow',\n OrderClosed = 'orderClosed',\n PayFrameTitle = 'payFrameTitle',\n OpenPaymentHere = 'openPaymentHere',\n PayFrameSlow = 'payFrameSlow',\n PayWithApplePay = 'payWithApplePay',\n OrderAwaitsPayment = 'orderAwaitsPayment',\n OrderAwaitsNote = 'orderAwaitsNote',\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 [CheckoutWord.Coupon]: { en: 'Coupon code', he: 'קוד קופון' },\n [CheckoutWord.ApplyCoupon]: { en: 'Apply', he: 'החלה' },\n [CheckoutWord.RemoveCoupon]: { en: 'Remove', he: 'הסרה' },\n [CheckoutWord.Discount]: { en: 'Discount · {code}', he: 'הנחה · {code}' },\n [CheckoutWord.PayOrder]: { en: 'Pay · {total}', he: 'לתשלום · {total}' },\n [CheckoutWord.PayNote]: { en: 'You pay on a secure payment page. We never see your card.', he: 'התשלום מתבצע בעמוד תשלום מאובטח. איננו רואים את פרטי הכרטיס.' },\n [CheckoutWord.ToPaymentPage]: { en: 'Taking you to the payment page…', he: 'מעבירים אותך לעמוד התשלום…' },\n [CheckoutWord.ConfirmingPayment]: { en: 'Confirming your payment…', he: 'מאשרים את התשלום…' },\n [CheckoutWord.ConfirmingSlow]: { en: 'This is taking longer than usual. You can close this page — we will email you once the payment is confirmed.', he: 'זה לוקח יותר זמן מהרגיל. אפשר לסגור את העמוד — נשלח אימייל כשהתשלום יאושר.' },\n [CheckoutWord.PaymentConfirmed]: { en: 'Payment confirmed', he: 'התשלום אושר' },\n [CheckoutWord.PaymentFailed]: { en: 'The payment did not go through. Nothing was charged.', he: 'התשלום לא עבר. לא חויבתם.' },\n [CheckoutWord.PaymentDeclined]: { en: 'The card was declined: {reason}', he: 'הכרטיס נדחה: {reason}' },\n [CheckoutWord.TryAgain]: { en: 'Try again', he: 'נסו שוב' },\n [CheckoutWord.PayNow]: { en: 'Pay now · {total}', he: 'לתשלום עכשיו · {total}' },\n [CheckoutWord.OrderClosed]: { en: 'This order was cancelled.', he: 'ההזמנה הזו בוטלה.' },\n [CheckoutWord.PayFrameTitle]: { en: 'Secure card payment', he: 'תשלום מאובטח בכרטיס אשראי' },\n [CheckoutWord.OpenPaymentHere]: { en: 'Open the secure page in this window', he: 'לפתוח את הדף המאובטח בחלון הזה' },\n [CheckoutWord.PayFrameSlow]: { en: 'The secure page is slow to load.', he: 'הדף המאובטח נטען לאט.' },\n [CheckoutWord.PayWithApplePay]: { en: 'Pay with Apple Pay', he: 'תשלום ב-Apple Pay' },\n [CheckoutWord.OrderAwaitsPayment]: { en: 'Order #{number} is waiting for payment', he: 'הזמנה #{number} ממתינה לתשלום' },\n [CheckoutWord.OrderAwaitsNote]: { en: 'Your bag is empty because the order was already placed.', 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 coupon field in the order summary (E4). */\n Coupon = 'coupon',\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 CouponUnknown = 'coupon-unknown',\n CouponDisabled = 'coupon-disabled',\n CouponNotStarted = 'coupon-not-started',\n CouponExpired = 'coupon-expired',\n CouponUsedUp = 'coupon-used-up',\n CouponMinimumNotMet = 'coupon-minimum-not-met',\n CouponNotUsable = 'coupon-not-usable',\n /** A reminder's link to a purchase that was completed (E4). */\n RecoveryDone = 'recovery-done',\n /** A reminder's link whose bag is gone, or a link that is not one. */\n RecoveryExpired = 'recovery-expired',\n /** The payment page could not be made right now (the provider did not answer) — the order stands; try again (E2). */\n PaymentUnavailable = 'payment-unavailable',\n /** This order cannot be paid any more (paid, or cancelled). */\n PaymentClosed = 'payment-closed',\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.CouponUnknown]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Unknown] },\n [SiteRefusalCode.CouponDisabled]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Disabled] },\n [SiteRefusalCode.CouponNotStarted]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotStarted] },\n [SiteRefusalCode.CouponExpired]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Expired] },\n [SiteRefusalCode.CouponUsedUp]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.UsedUp] },\n [SiteRefusalCode.CouponMinimumNotMet]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.MinimumNotMet] },\n [SiteRefusalCode.CouponNotUsable]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotUsable] },\n [SiteRefusalCode.RecoveryDone]: { slot: CheckoutSlot.Page, label: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' } },\n [SiteRefusalCode.RecoveryExpired]: { slot: CheckoutSlot.Page, label: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' } },\n [SiteRefusalCode.PaymentUnavailable]: { slot: CheckoutSlot.Page, label: { en: 'The payment page is not available right now. Your order is saved — try again in a moment.', he: 'עמוד התשלום לא זמין כרגע. ההזמנה נשמרה — נסו שוב בעוד רגע.' } },\n [SiteRefusalCode.PaymentClosed]: { slot: CheckoutSlot.Page, label: { en: 'This order cannot be paid any more.', 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, fill: Readonly<Record<string, string>> = {}): SiteRefusal {\n const known: SiteRefusalCode = isRefusalCode(code) ? code : SiteRefusalCode.InvalidBody;\n const rule = SITE_REFUSALS[known];\n const words = labelIn(rule.label, lang).replace(/\\{(\\w+)\\}/g, (all, key) => fill[key] ?? all);\n return { code: isRefusalCode(code) ? code : String(code ?? known), slot: rule.slot, words };\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, formatMoney?: (value: Money) => string): SiteRefusal[] {\n const answer = body && typeof body === 'object' ? body as { code?: unknown; refusals?: unknown; minimum?: 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 // A coupon's minimum is said as an amount (`{amount}`), in the host's money format.\n const fill: Record<string, string> = isMoney(answer.minimum) && formatMoney ? { amount: formatMoney(answer.minimum) } : {};\n const seen = new Set<CheckoutSlot>();\n return codes.map(code => refusalOf(code, lang, fill)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));\n}\n","import { CheckoutStep } from './checkout';\nimport { CommerceLabel, labelIn } from './labels';\n\n/**\n * The journey and recovery (commerce plan §3g, C-D13, C-D14 — E4): when a purchase counts as abandoned, the reminder\n * sequence (1 h · 24 h · 72 h, the last may carry a coupon), the ONE consent rule a reminder obeys, the funnel the owner\n * reads, the words of the reminder email and the unsubscribe page, and their site paths. Pure: no clock is read —\n * every caller passes `now` (epoch ms).\n */\n\nconst HOUR_MS = 60 * 60 * 1000;\n\n/** A purchase with an email and no payment for this long is abandoned — a lead the owner can follow up. */\nexport const ABANDONED_AFTER_MS = HOUR_MS;\n\n/** A reminder this late (a pod was down, reminders were just switched on) is passed over, never sent stale. */\nexport const REMINDER_LATE_MS = 12 * HOUR_MS;\n\nexport enum ReminderStep {\n First = 'first',\n Second = 'second',\n Third = 'third',\n}\n\nexport interface ReminderTiming {\n readonly step: ReminderStep;\n /** After the buyer's LAST activity on the checkout. */\n readonly afterMs: number;\n /** The owner's coupon rides this one, when there is one. */\n readonly carriesCoupon: boolean;\n}\n\n/** The sequence (board 9): 1 hour after leaving, after 24 hours, after 72 hours + a coupon. */\nexport const REMINDER_SEQUENCE: readonly ReminderTiming[] = Object.freeze([\n { step: ReminderStep.First, afterMs: HOUR_MS, carriesCoupon: false },\n { step: ReminderStep.Second, afterMs: 24 * HOUR_MS, carriesCoupon: false },\n { step: ReminderStep.Third, afterMs: 72 * HOUR_MS, carriesCoupon: true },\n]);\n\nexport const REMINDER_STEPS: readonly ReminderStep[] = Object.freeze(REMINDER_SEQUENCE.map(timing => timing.step));\n\n/** The owner's words for one reminder — blank keeps the default. */\nexport interface ReminderWords {\n subject?: string | null;\n lead?: string | null;\n}\n\nexport interface ReminderSettings {\n enabled: boolean;\n steps: Record<ReminderStep, boolean>;\n /** A coupon code of the studio's, offered in the reminder that carries one. */\n couponCode: string | null;\n words: Partial<Record<ReminderStep, ReminderWords>>;\n}\n\nexport const REMINDER_WORDS_MAX = 200;\n\n/** On, every step on, no coupon (board 9). Reminders still go ONLY to a buyer who ticked consent. */\nexport const DEFAULT_REMINDER_SETTINGS: Readonly<ReminderSettings> = Object.freeze({\n enabled: true,\n steps: Object.freeze({ [ReminderStep.First]: true, [ReminderStep.Second]: true, [ReminderStep.Third]: true }) as Record<ReminderStep, boolean>,\n couponCode: null,\n words: Object.freeze({}),\n});\n\nconst text = (value: unknown, max: number): string | null =>\n typeof value === 'string' && value.trim() ? value.trim().slice(0, max) : null;\n\n/** A stored (or sent) settings value read leniently: anything missing or malformed is the default. */\nexport function reminderSettingsOf(raw: unknown): ReminderSettings {\n const r = raw && typeof raw === 'object' ? raw as Partial<ReminderSettings> : {};\n const steps = { ...DEFAULT_REMINDER_SETTINGS.steps };\n const words: Partial<Record<ReminderStep, ReminderWords>> = {};\n for (const step of REMINDER_STEPS) {\n if (typeof r.steps?.[step] === 'boolean') steps[step] = r.steps[step];\n const w = r.words?.[step];\n const subject = text(w?.subject, REMINDER_WORDS_MAX);\n const lead = text(w?.lead, REMINDER_WORDS_MAX * 2);\n if (subject || lead) words[step] = { subject, lead };\n }\n return {\n enabled: typeof r.enabled === 'boolean' ? r.enabled : DEFAULT_REMINDER_SETTINGS.enabled,\n steps,\n couponCode: text(r.couponCode, 64)?.toUpperCase() ?? null,\n words,\n };\n}\n\n// ── consent (T7 — the marketing tick, never the cookie decision) ─────────────────────────────────────────\n\n/** One recorded decision about marketing: the checkout's tick, the customer's latest, an unsubscribe, the owner's stop. */\nexport interface ConsentDecision {\n given: boolean;\n at: string | number | Date | null | undefined;\n}\n\nconst timeOf = (at: ConsentDecision['at']): number => {\n if (at === null || at === undefined) return Number.NEGATIVE_INFINITY;\n const ms = at instanceof Date ? at.getTime() : new Date(at as string).getTime();\n return Number.isFinite(ms) ? ms : Number.NEGATIVE_INFINITY;\n};\n\n/**\n * THE consent gate of a marketing message (Israel's Communications Law §30A, the GDPR — C-D14): the LATEST decision\n * wins. A tick at a checkout allows; an unsubscribe or the owner's \"Stop reminders\" after it forbids; a new tick at a\n * later checkout allows again. No decision at all forbids — a reminder is never sent on silence. A tie forbids.\n */\nexport function marketingAllowed(...decisions: ReadonlyArray<ConsentDecision | null | undefined>): boolean {\n let latest: { given: boolean; at: number } | null = null;\n for (const d of decisions) {\n if (!d || typeof d.given !== 'boolean') continue;\n const at = timeOf(d.at);\n if (!latest || at > latest.at || (at === latest.at && !d.given)) latest = { given: d.given, at };\n }\n return latest?.given === true;\n}\n\n// ── the sequence ─────────────────────────────────────────────────────────────────────────────────────────\n\n/** Why a checkout gets no (more) reminders. */\nexport enum ReminderStop {\n /** The purchase was made. */\n Completed = 'completed',\n NoEmail = 'no-email',\n /** No tick, or the latest decision is a withdrawal. */\n NoConsent = 'no-consent',\n /** The owner marked the lead lost. */\n Lost = 'lost',\n /** The studio's reminders are off. */\n Off = 'off',\n /** Every reminder was sent, or its time has passed. */\n Done = 'done',\n}\n\nexport interface ReminderFacts {\n /** The checkout is still open (no order placed from it). */\n open: boolean;\n hasEmail: boolean;\n /** `marketingAllowed(...)` for this buyer. */\n consent: boolean;\n lost: boolean;\n /** Epoch ms of the buyer's last activity on the checkout. */\n lastActivityAt: number;\n /** Steps already sent, failed or passed over — never tried twice. */\n done: readonly ReminderStep[];\n settings: ReminderSettings;\n}\n\nexport type ReminderPlan =\n | { due: true; step: ReminderStep; dueAt: number; carriesCoupon: boolean }\n | { due: false; stop: ReminderStop };\n\nconst STOPS: ReadonlyArray<{ stop: ReminderStop; when: (f: ReminderFacts) => boolean }> = Object.freeze([\n { stop: ReminderStop.Completed, when: (f: ReminderFacts) => !f.open },\n { stop: ReminderStop.NoEmail, when: (f: ReminderFacts) => !f.hasEmail },\n { stop: ReminderStop.NoConsent, when: (f: ReminderFacts) => !f.consent },\n { stop: ReminderStop.Lost, when: (f: ReminderFacts) => f.lost },\n { stop: ReminderStop.Off, when: (f: ReminderFacts) => !f.settings.enabled },\n]);\n\n/**\n * The next reminder of a checkout at `now`: the first step that is switched on, not done yet, and not more than\n * `REMINDER_LATE_MS` past its time — due at `lastActivityAt + afterMs` (it may be in the future: the scheduler waits).\n * A buyer who comes back moves every later reminder with their activity. Steps too late are passed over silently.\n */\nexport function nextReminder(facts: ReminderFacts, now: number): ReminderPlan {\n const stopped = STOPS.find(rule => rule.when(facts));\n if (stopped) return { due: false, stop: stopped.stop };\n for (const timing of REMINDER_SEQUENCE) {\n if (facts.done.includes(timing.step) || facts.settings.steps[timing.step] !== true) continue;\n const dueAt = facts.lastActivityAt + timing.afterMs;\n if (now > dueAt + REMINDER_LATE_MS) continue;\n return { due: true, step: timing.step, dueAt, carriesCoupon: timing.carriesCoupon };\n }\n return { due: false, stop: ReminderStop.Done };\n}\n\n/** The step's number as the owner reads it (\"Reminder 2\"). */\nexport function reminderNumber(step: ReminderStep): number {\n return REMINDER_STEPS.indexOf(step) + 1;\n}\n\n/** What became of one reminder. */\nexport enum ReminderOutcome {\n Sent = 'sent',\n Failed = 'failed',\n /** Not sent, on purpose — `ReminderSkip` says why. */\n Skipped = 'skipped',\n}\n\nexport enum ReminderSkip {\n /** The studio's sender domain is not verified: it would land in spam (T13). */\n SenderUnverified = 'sender-unverified',\n NoMailer = 'no-mailer',\n /** The studio's public address is unknown, so there is no link to put in it. */\n NoSiteAddress = 'no-site-address',\n /** The bag is empty now: nothing to come back to. */\n EmptyBag = 'empty-bag',\n /** A send was started and the pod stopped before it was recorded: never sent twice. */\n Interrupted = 'interrupted',\n}\n\n/** Is a checkout an abandoned purchase at `now`: open, with an email, untouched for an hour. */\nexport function isAbandoned(c: { open: boolean; hasEmail: boolean; lastActivityAt: number }, now: number): boolean {\n return c.open && c.hasEmail && now - c.lastActivityAt >= ABANDONED_AFTER_MS;\n}\n\n/** Where a purchase stopped: the step after the furthest one the buyer completed (board 9's \"Stopped at\"). */\nexport function stoppedAt(furthest: CheckoutStep | null | undefined): CheckoutStep {\n if (furthest === CheckoutStep.Paid) return CheckoutStep.Paid;\n if (furthest === CheckoutStep.Delivery || furthest === CheckoutStep.Payment) return CheckoutStep.Payment;\n return CheckoutStep.Delivery;\n}\n\n// ── the funnel (Shop ▸ Sales journey) ─────────────────────────────────────────────────────────────────────\n\nexport enum FunnelStage {\n AddedToBag = 'added-to-bag',\n GaveEmail = 'gave-email',\n ChoseDelivery = 'chose-delivery',\n ReachedPayment = 'reached-payment',\n PlacedOrder = 'placed-order',\n Paid = 'paid',\n}\n\nexport const FUNNEL_STAGES: readonly FunnelStage[] = Object.freeze([\n FunnelStage.AddedToBag, FunnelStage.GaveEmail, FunnelStage.ChoseDelivery, FunnelStage.ReachedPayment, FunnelStage.PlacedOrder, FunnelStage.Paid,\n]);\n\nexport interface FunnelRow {\n stage: FunnelStage;\n count: number;\n /** Whole percent of the first stage. */\n share: number;\n /** Whole percent lost since the previous stage; null on the first. */\n drop: number | null;\n}\n\nconst count = (value: unknown): number => (typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0);\n\n/**\n * The funnel's rows. Each stage is a subset of the one before, so a count is raised to the next stage's when the\n * records disagree (a bag removed after 30 days while its checkout is kept) — a share never passes 100 %.\n */\nexport function funnelOf(counts: Partial<Record<FunnelStage, number>>): FunnelRow[] {\n const values = FUNNEL_STAGES.map(stage => count(counts[stage]));\n for (let i = values.length - 2; i >= 0; i--) values[i] = Math.max(values[i], values[i + 1]);\n const first = values[0];\n return FUNNEL_STAGES.map((stage, i) => ({\n stage,\n count: values[i],\n share: first ? Math.round((values[i] / first) * 100) : 0,\n drop: i === 0 ? null : values[i - 1] ? Math.round(((values[i - 1] - values[i]) / values[i - 1]) * 100) : 0,\n }));\n}\n\n/** The stage that loses the most buyers after `after` (board 9: \"After contact, the biggest drop is at delivery\"). */\nexport function biggestDrop(rows: readonly FunnelRow[], after: FunnelStage = FunnelStage.GaveEmail): FunnelStage | null {\n const from = rows.findIndex(row => row.stage === after);\n let best: FunnelRow | null = null;\n for (const row of rows.slice(from + 1)) if ((row.drop ?? 0) > 0 && (!best || (row.drop ?? 0) > (best.drop ?? 0))) best = row;\n return best?.stage ?? null;\n}\n\n/** The Sales journey's periods (board 9). */\nexport const JOURNEY_PERIODS_DAYS: readonly number[] = Object.freeze([7, 30, 90]);\nexport const DEFAULT_JOURNEY_DAYS = 30;\n\n// ── one purchase's journey (board 8) ──────────────────────────────────────────────────────────────────────\n\n/** What a timeline says happened — the purchase's own records, never browsing (C-D13). */\nexport enum JourneyEventKind {\n CheckoutStarted = 'checkout-started',\n DeliveryChosen = 'delivery-chosen',\n PaymentChosen = 'payment-chosen',\n ReminderSent = 'reminder-sent',\n ReminderFailed = 'reminder-failed',\n ReminderSkipped = 'reminder-skipped',\n ReminderScheduled = 'reminder-scheduled',\n CameBack = 'came-back',\n Unsubscribed = 'unsubscribed',\n MarkedLost = 'marked-lost',\n OrderPlaced = 'order-placed',\n}\n\n// ── the site paths ────────────────────────────────────────────────────────────────────────────────────────\n\n/** `/<orgLabel>/checkout/r/<token>` — the reminder's link: the bag restored, the step they left. */\nexport const RECOVERY_PATH = 'r';\n/** `/<orgLabel>/checkout/unsubscribe/<token>` — works without signing in. */\nexport const UNSUBSCRIBE_PATH = 'unsubscribe';\n\nconst checkoutTail = (orgLabel: string | null | undefined, tail: string): string => {\n const label = String(orgLabel ?? '').replace(/^\\/+|\\/+$/g, '');\n const path = `checkout/${tail}`;\n return label ? `/${encodeURIComponent(label)}/${path}` : `/${path}`;\n};\n\nexport function recoveryHref(orgLabel: string | null | undefined, token: string): string {\n return checkoutTail(orgLabel, `${RECOVERY_PATH}/${encodeURIComponent(token)}`);\n}\n\nexport function unsubscribeHref(orgLabel: string | null | undefined, token: string): string {\n return checkoutTail(orgLabel, `${UNSUBSCRIBE_PATH}/${encodeURIComponent(token)}`);\n}\n\n/** `GET|POST api/site/:orgId/marketing/unsubscribe/:token` — the page's state. The email is masked. */\nexport interface SiteUnsubscribeState {\n subscribed: boolean;\n email: string;\n siteName: string | null;\n language: string;\n}\n\n/** `n•••@example.com` — enough for a person to recognise their address, not enough to harvest it. */\nexport function maskEmail(email: string | null | undefined): string {\n const value = String(email ?? '');\n const at = value.indexOf('@');\n if (at < 1) return '';\n return `${value[0]}•••${value.slice(at)}`;\n}\n\n// ── the words ─────────────────────────────────────────────────────────────────────────────────────────────\n\nexport enum RecoveryWord {\n SubjectFirst = 'subjectFirst',\n SubjectSecond = 'subjectSecond',\n SubjectThird = 'subjectThird',\n Heading = 'heading',\n Lead = 'lead',\n Return = 'return',\n KeptDetails = 'keptDetails',\n CouponOffer = 'couponOffer',\n Why = 'why',\n Unsubscribe = 'unsubscribe',\n UnsubscribeTitle = 'unsubscribeTitle',\n UnsubscribeAsk = 'unsubscribeAsk',\n UnsubscribeButton = 'unsubscribeButton',\n UnsubscribeDone = 'unsubscribeDone',\n UnsubscribeAlready = 'unsubscribeAlready',\n UnsubscribeUnknown = 'unsubscribeUnknown',\n UnsubscribeTransactional = 'unsubscribeTransactional',\n RecoveryDone = 'recoveryDone',\n RecoveryExpired = 'recoveryExpired',\n Restoring = 'restoring',\n}\n\n/** `{studio}`, `{code}`, `{offer}`, `{step}`, `{email}` are filled by `recoveryWord`. */\nexport const RECOVERY_WORDS: Readonly<Record<RecoveryWord, CommerceLabel>> = Object.freeze({\n [RecoveryWord.SubjectFirst]: { en: '{studio}: your bag is waiting', he: '{studio}: הסל שלך מחכה' },\n [RecoveryWord.SubjectSecond]: { en: '{studio}: still thinking it over?', he: '{studio}: עדיין מתלבטים?' },\n [RecoveryWord.SubjectThird]: { en: '{studio}: a little something to finish your order', he: '{studio}: משהו קטן כדי להשלים את ההזמנה' },\n [RecoveryWord.Heading]: { en: 'You left something in your bag', he: 'השארת משהו בסל' },\n [RecoveryWord.Lead]: { en: 'Your bag at {studio} is just as you left it.', he: 'הסל שלך ב{studio} בדיוק כפי שהשארת אותו.' },\n [RecoveryWord.Return]: { en: 'Return to checkout', he: 'חזרה לתשלום' },\n [RecoveryWord.KeptDetails]: { en: 'We kept your details — you will continue from {step}.', he: 'שמרנו את הפרטים שלך — ממשיכים מ{step}.' },\n [RecoveryWord.CouponOffer]: { en: 'Use the code {code} for {offer}.', he: 'השתמשו בקוד {code} לקבלת {offer}.' },\n [RecoveryWord.Why]: { en: 'You are getting this because you asked {studio} for reminders and offers.', he: 'המייל נשלח כי ביקשת מ{studio} תזכורות והצעות.' },\n [RecoveryWord.Unsubscribe]: { en: 'Unsubscribe', he: 'הסרה מרשימת התפוצה' },\n [RecoveryWord.UnsubscribeTitle]: { en: 'Reminders and offers from {studio}', he: 'תזכורות והצעות מ{studio}' },\n [RecoveryWord.UnsubscribeAsk]: { en: 'Stop sending reminders and offers to {email}?', he: 'להפסיק לשלוח תזכורות והצעות אל {email}?' },\n [RecoveryWord.UnsubscribeButton]: { en: 'Unsubscribe', he: 'הסירו אותי' },\n [RecoveryWord.UnsubscribeDone]: { en: 'Done. {studio} will send no more reminders or offers to {email}.', he: 'בוצע. {studio} לא ישלחו עוד תזכורות או הצעות אל {email}.' },\n [RecoveryWord.UnsubscribeAlready]: { en: '{email} gets no reminders or offers from {studio}.', he: '{email} לא מקבל/ת תזכורות או הצעות מ{studio}.' },\n [RecoveryWord.UnsubscribeUnknown]: { en: 'This link does not work any more. You will get no reminders or offers through it.', he: 'הקישור הזה כבר לא פעיל. לא יישלחו דרכו תזכורות או הצעות.' },\n [RecoveryWord.UnsubscribeTransactional]: { en: 'Emails about an order you place still arrive.', he: 'מיילים על הזמנה שתבצעו ימשיכו להגיע.' },\n [RecoveryWord.RecoveryDone]: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' },\n [RecoveryWord.RecoveryExpired]: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' },\n [RecoveryWord.Restoring]: { en: 'Opening your bag…', he: 'פותחים את הסל שלך…' },\n});\n\nexport function recoveryWord(word: RecoveryWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {\n return labelIn(RECOVERY_WORDS[word], lang).replace(/\\{(\\w+)\\}/g, (all, key) => (key in fill ? String(fill[key]) : all));\n}\n\n/** The default subject of each reminder. */\nexport const REMINDER_SUBJECT_WORDS: Readonly<Record<ReminderStep, RecoveryWord>> = Object.freeze({\n [ReminderStep.First]: RecoveryWord.SubjectFirst,\n [ReminderStep.Second]: RecoveryWord.SubjectSecond,\n [ReminderStep.Third]: RecoveryWord.SubjectThird,\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; E4 adds\n * coupons (one per order, priced by `priceCart`) and the journey: reminders, the consent gate, the funnel. 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 './storefront-fields';\nexport * from './shipping';\nexport * from './coupons';\nexport * from './cart';\nexport * from './payments';\nexport * from './payment-sessions';\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 * from './recovery';\nexport { looksLikeEmail, looksLikePhone } from './text';\n","/**\n * Generated bundle index. Do not edit.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