@endora-commerce/contracts 0.108.0 → 0.110.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 (309) hide show
  1. package/dist/actor.d.ts +16 -0
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/addresses.d.ts +35 -0
  4. package/dist/addresses.d.ts.map +1 -1
  5. package/dist/addresses.js +8 -1
  6. package/dist/addresses.js.map +1 -1
  7. package/dist/admin-actions.d.ts +12 -3
  8. package/dist/admin-actions.d.ts.map +1 -1
  9. package/dist/admin-actions.js +34 -3
  10. package/dist/admin-actions.js.map +1 -1
  11. package/dist/admin-contributions.d.ts +94 -10
  12. package/dist/admin-contributions.d.ts.map +1 -1
  13. package/dist/admin-contributions.js +65 -0
  14. package/dist/admin-contributions.js.map +1 -1
  15. package/dist/admin-notifications.d.ts +17 -1
  16. package/dist/admin-notifications.d.ts.map +1 -1
  17. package/dist/admin-preferences.d.ts +108 -0
  18. package/dist/admin-preferences.d.ts.map +1 -0
  19. package/dist/admin-preferences.js +133 -0
  20. package/dist/admin-preferences.js.map +1 -0
  21. package/dist/admin-roles.d.ts +8 -2
  22. package/dist/admin-roles.d.ts.map +1 -1
  23. package/dist/admin-roles.js.map +1 -1
  24. package/dist/admin-users.d.ts +9 -0
  25. package/dist/admin-users.d.ts.map +1 -1
  26. package/dist/admin.d.ts +92 -5
  27. package/dist/admin.d.ts.map +1 -1
  28. package/dist/admin.js +86 -3
  29. package/dist/admin.js.map +1 -1
  30. package/dist/assets-library.d.ts +123 -3
  31. package/dist/assets-library.d.ts.map +1 -1
  32. package/dist/assets-library.js +11 -3
  33. package/dist/assets-library.js.map +1 -1
  34. package/dist/audit-logs.d.ts +12 -0
  35. package/dist/audit-logs.d.ts.map +1 -1
  36. package/dist/audit-logs.js +12 -0
  37. package/dist/audit-logs.js.map +1 -1
  38. package/dist/blog.d.ts +431 -14
  39. package/dist/blog.d.ts.map +1 -1
  40. package/dist/blog.js +251 -7
  41. package/dist/blog.js.map +1 -1
  42. package/dist/carts.d.ts +507 -92
  43. package/dist/carts.d.ts.map +1 -1
  44. package/dist/carts.js +197 -21
  45. package/dist/carts.js.map +1 -1
  46. package/dist/catalog.d.ts +515 -144
  47. package/dist/catalog.d.ts.map +1 -1
  48. package/dist/catalog.js +356 -68
  49. package/dist/catalog.js.map +1 -1
  50. package/dist/cms-brand.d.ts +2233 -0
  51. package/dist/cms-brand.d.ts.map +1 -0
  52. package/dist/cms-brand.js +311 -0
  53. package/dist/cms-brand.js.map +1 -0
  54. package/dist/cms-contact-form.d.ts +55 -0
  55. package/dist/cms-contact-form.d.ts.map +1 -0
  56. package/dist/cms-contact-form.js +100 -0
  57. package/dist/cms-contact-form.js.map +1 -0
  58. package/dist/cms.d.ts +576 -17
  59. package/dist/cms.d.ts.map +1 -1
  60. package/dist/cms.js +251 -0
  61. package/dist/cms.js.map +1 -1
  62. package/dist/common.d.ts +23 -6
  63. package/dist/common.d.ts.map +1 -1
  64. package/dist/common.js +25 -2
  65. package/dist/common.js.map +1 -1
  66. package/dist/comparisons.d.ts +28 -21
  67. package/dist/comparisons.d.ts.map +1 -1
  68. package/dist/comparisons.js +2 -1
  69. package/dist/comparisons.js.map +1 -1
  70. package/dist/credit-limits.d.ts +1 -0
  71. package/dist/credit-limits.d.ts.map +1 -1
  72. package/dist/credit-limits.js +14 -0
  73. package/dist/credit-limits.js.map +1 -1
  74. package/dist/crm-rich-text.d.ts +10 -61
  75. package/dist/crm-rich-text.d.ts.map +1 -1
  76. package/dist/crm-rich-text.js +10 -300
  77. package/dist/crm-rich-text.js.map +1 -1
  78. package/dist/crm.d.ts +173 -115
  79. package/dist/crm.d.ts.map +1 -1
  80. package/dist/crm.js +35 -88
  81. package/dist/crm.js.map +1 -1
  82. package/dist/custom-fields.d.ts +54 -22
  83. package/dist/custom-fields.d.ts.map +1 -1
  84. package/dist/custom-fields.js +21 -1
  85. package/dist/custom-fields.js.map +1 -1
  86. package/dist/customer-accounts.d.ts +216 -22
  87. package/dist/customer-accounts.d.ts.map +1 -1
  88. package/dist/customer-accounts.js +70 -0
  89. package/dist/customer-accounts.js.map +1 -1
  90. package/dist/customers.d.ts +40 -73
  91. package/dist/customers.d.ts.map +1 -1
  92. package/dist/customers.js +45 -10
  93. package/dist/customers.js.map +1 -1
  94. package/dist/document-templates.d.ts +35 -23
  95. package/dist/document-templates.d.ts.map +1 -1
  96. package/dist/document-values.d.ts +8 -0
  97. package/dist/document-values.d.ts.map +1 -1
  98. package/dist/document-values.js +24 -6
  99. package/dist/document-values.js.map +1 -1
  100. package/dist/email.d.ts +5 -0
  101. package/dist/email.d.ts.map +1 -1
  102. package/dist/errors.d.ts +224 -1
  103. package/dist/errors.d.ts.map +1 -1
  104. package/dist/errors.js +269 -1
  105. package/dist/errors.js.map +1 -1
  106. package/dist/forms-logic.d.ts +79 -0
  107. package/dist/forms-logic.d.ts.map +1 -0
  108. package/dist/forms-logic.fixtures.d.ts +52 -0
  109. package/dist/forms-logic.fixtures.d.ts.map +1 -0
  110. package/dist/forms-logic.fixtures.js +610 -0
  111. package/dist/forms-logic.fixtures.js.map +1 -0
  112. package/dist/forms-logic.js +699 -0
  113. package/dist/forms-logic.js.map +1 -0
  114. package/dist/forms.d.ts +9833 -0
  115. package/dist/forms.d.ts.map +1 -0
  116. package/dist/forms.js +827 -0
  117. package/dist/forms.js.map +1 -0
  118. package/dist/import-export.d.ts +180 -0
  119. package/dist/import-export.d.ts.map +1 -1
  120. package/dist/import-export.js +60 -0
  121. package/dist/import-export.js.map +1 -1
  122. package/dist/index.d.ts +22 -1
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +45 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/inventory.d.ts +6 -6
  127. package/dist/invoice-ledger.d.ts +7 -7
  128. package/dist/invoices.d.ts +6 -2
  129. package/dist/invoices.d.ts.map +1 -1
  130. package/dist/invoices.js +7 -0
  131. package/dist/invoices.js.map +1 -1
  132. package/dist/megamenu.d.ts +674 -0
  133. package/dist/megamenu.d.ts.map +1 -1
  134. package/dist/megamenu.js +96 -3
  135. package/dist/megamenu.js.map +1 -1
  136. package/dist/mfa.d.ts +125 -4
  137. package/dist/mfa.d.ts.map +1 -1
  138. package/dist/mfa.js +54 -2
  139. package/dist/mfa.js.map +1 -1
  140. package/dist/modules.d.ts +44 -5
  141. package/dist/modules.d.ts.map +1 -1
  142. package/dist/modules.js +73 -0
  143. package/dist/modules.js.map +1 -1
  144. package/dist/money-decimal.d.ts +54 -0
  145. package/dist/money-decimal.d.ts.map +1 -1
  146. package/dist/money-decimal.js +95 -0
  147. package/dist/money-decimal.js.map +1 -1
  148. package/dist/newsletter.d.ts +7 -7
  149. package/dist/orders.d.ts +128 -10
  150. package/dist/orders.d.ts.map +1 -1
  151. package/dist/orders.js +74 -4
  152. package/dist/orders.js.map +1 -1
  153. package/dist/organization-registry-lookup.d.ts +362 -0
  154. package/dist/organization-registry-lookup.d.ts.map +1 -0
  155. package/dist/organization-registry-lookup.js +196 -0
  156. package/dist/organization-registry-lookup.js.map +1 -0
  157. package/dist/organization-roles.d.ts +340 -0
  158. package/dist/organization-roles.d.ts.map +1 -0
  159. package/dist/organization-roles.js +211 -0
  160. package/dist/organization-roles.js.map +1 -0
  161. package/dist/organizations.d.ts +123 -89
  162. package/dist/organizations.d.ts.map +1 -1
  163. package/dist/organizations.js +68 -24
  164. package/dist/organizations.js.map +1 -1
  165. package/dist/page-builder-props.d.ts +1401 -0
  166. package/dist/page-builder-props.d.ts.map +1 -0
  167. package/dist/page-builder-props.js +266 -0
  168. package/dist/page-builder-props.js.map +1 -0
  169. package/dist/page-builder-values.d.ts +95 -0
  170. package/dist/page-builder-values.d.ts.map +1 -0
  171. package/dist/page-builder-values.js +164 -0
  172. package/dist/page-builder-values.js.map +1 -0
  173. package/dist/pim-connector.d.ts +6 -2
  174. package/dist/pim-connector.d.ts.map +1 -1
  175. package/dist/pim-connector.js +6 -2
  176. package/dist/pim-connector.js.map +1 -1
  177. package/dist/pim-field-path.d.ts +5 -1
  178. package/dist/pim-field-path.d.ts.map +1 -1
  179. package/dist/pim-field-path.js +37 -81
  180. package/dist/pim-field-path.js.map +1 -1
  181. package/dist/pim-locale-mapping.d.ts +131 -0
  182. package/dist/pim-locale-mapping.d.ts.map +1 -0
  183. package/dist/pim-locale-mapping.js +193 -0
  184. package/dist/pim-locale-mapping.js.map +1 -0
  185. package/dist/platform-language.d.ts +9 -0
  186. package/dist/platform-language.d.ts.map +1 -1
  187. package/dist/platform-language.js +14 -0
  188. package/dist/platform-language.js.map +1 -1
  189. package/dist/price-books.d.ts +47 -43
  190. package/dist/price-books.d.ts.map +1 -1
  191. package/dist/price-books.js +6 -2
  192. package/dist/price-books.js.map +1 -1
  193. package/dist/price-lists.d.ts +48 -14
  194. package/dist/price-lists.d.ts.map +1 -1
  195. package/dist/price-lists.js +24 -1
  196. package/dist/price-lists.js.map +1 -1
  197. package/dist/product-feeds.d.ts +144 -84
  198. package/dist/product-feeds.d.ts.map +1 -1
  199. package/dist/product-feeds.js +23 -0
  200. package/dist/product-feeds.js.map +1 -1
  201. package/dist/product-scope-model.d.ts +161 -0
  202. package/dist/product-scope-model.d.ts.map +1 -0
  203. package/dist/product-scope-model.js +161 -0
  204. package/dist/product-scope-model.js.map +1 -0
  205. package/dist/product-scope-overrides.d.ts +0 -103
  206. package/dist/product-scope-overrides.d.ts.map +1 -1
  207. package/dist/product-scope-overrides.js +0 -54
  208. package/dist/product-scope-overrides.js.map +1 -1
  209. package/dist/product-scoped-values.d.ts +2610 -0
  210. package/dist/product-scoped-values.d.ts.map +1 -0
  211. package/dist/product-scoped-values.js +425 -0
  212. package/dist/product-scoped-values.js.map +1 -0
  213. package/dist/product-scopes.d.ts +746 -0
  214. package/dist/product-scopes.d.ts.map +1 -0
  215. package/dist/product-scopes.js +436 -0
  216. package/dist/product-scopes.js.map +1 -0
  217. package/dist/product-summary-text.d.ts +23 -0
  218. package/dist/product-summary-text.d.ts.map +1 -0
  219. package/dist/product-summary-text.js +64 -0
  220. package/dist/product-summary-text.js.map +1 -0
  221. package/dist/product-tax-rates.d.ts +38 -0
  222. package/dist/product-tax-rates.d.ts.map +1 -0
  223. package/dist/product-tax-rates.js +45 -0
  224. package/dist/product-tax-rates.js.map +1 -0
  225. package/dist/product-url-keys.d.ts +210 -0
  226. package/dist/product-url-keys.d.ts.map +1 -0
  227. package/dist/product-url-keys.js +200 -0
  228. package/dist/product-url-keys.js.map +1 -0
  229. package/dist/product-value-resolver.d.ts +37 -60
  230. package/dist/product-value-resolver.d.ts.map +1 -1
  231. package/dist/product-value-resolver.js +36 -96
  232. package/dist/product-value-resolver.js.map +1 -1
  233. package/dist/projects.d.ts +2370 -0
  234. package/dist/projects.d.ts.map +1 -0
  235. package/dist/projects.js +843 -0
  236. package/dist/projects.js.map +1 -0
  237. package/dist/promotions.d.ts +10 -10
  238. package/dist/prompt-actions.d.ts +19 -1
  239. package/dist/prompt-actions.d.ts.map +1 -1
  240. package/dist/prompt-actions.js +31 -2
  241. package/dist/prompt-actions.js.map +1 -1
  242. package/dist/pwa.d.ts +2 -2
  243. package/dist/quick-order.d.ts +150 -7
  244. package/dist/quick-order.d.ts.map +1 -1
  245. package/dist/quick-order.js +76 -2
  246. package/dist/quick-order.js.map +1 -1
  247. package/dist/quote-requests.d.ts +99 -13
  248. package/dist/quote-requests.d.ts.map +1 -1
  249. package/dist/quote-requests.js +66 -1
  250. package/dist/quote-requests.js.map +1 -1
  251. package/dist/record-references.d.ts +252 -0
  252. package/dist/record-references.d.ts.map +1 -0
  253. package/dist/record-references.js +178 -0
  254. package/dist/record-references.js.map +1 -0
  255. package/dist/record-rich-text.d.ts +66 -0
  256. package/dist/record-rich-text.d.ts.map +1 -0
  257. package/dist/record-rich-text.js +304 -0
  258. package/dist/record-rich-text.js.map +1 -0
  259. package/dist/returns.d.ts +234 -52
  260. package/dist/returns.d.ts.map +1 -1
  261. package/dist/returns.js +139 -26
  262. package/dist/returns.js.map +1 -1
  263. package/dist/sales-channels.d.ts +51 -7
  264. package/dist/sales-channels.d.ts.map +1 -1
  265. package/dist/sales-channels.js +38 -4
  266. package/dist/sales-channels.js.map +1 -1
  267. package/dist/saved-list-views.d.ts +56 -0
  268. package/dist/saved-list-views.d.ts.map +1 -1
  269. package/dist/saved-list-views.js +27 -1
  270. package/dist/saved-list-views.js.map +1 -1
  271. package/dist/scoped-write-encoding.d.ts +100 -0
  272. package/dist/scoped-write-encoding.d.ts.map +1 -0
  273. package/dist/scoped-write-encoding.js +135 -0
  274. package/dist/scoped-write-encoding.js.map +1 -0
  275. package/dist/search.d.ts +25 -15
  276. package/dist/search.d.ts.map +1 -1
  277. package/dist/seo.d.ts +127 -15
  278. package/dist/seo.d.ts.map +1 -1
  279. package/dist/seo.js +38 -4
  280. package/dist/seo.js.map +1 -1
  281. package/dist/settings.d.ts +161 -3
  282. package/dist/settings.d.ts.map +1 -1
  283. package/dist/settings.js +73 -3
  284. package/dist/settings.js.map +1 -1
  285. package/dist/shopping-lists.d.ts +24 -3
  286. package/dist/shopping-lists.d.ts.map +1 -1
  287. package/dist/shopping-lists.js +20 -0
  288. package/dist/shopping-lists.js.map +1 -1
  289. package/dist/storefront-cache-tags.d.ts +41 -0
  290. package/dist/storefront-cache-tags.d.ts.map +1 -1
  291. package/dist/storefront-cache-tags.js +36 -0
  292. package/dist/storefront-cache-tags.js.map +1 -1
  293. package/dist/storefront-language-path.d.ts +77 -0
  294. package/dist/storefront-language-path.d.ts.map +1 -0
  295. package/dist/storefront-language-path.js +123 -0
  296. package/dist/storefront-language-path.js.map +1 -0
  297. package/dist/storefront-value-overrides.d.ts +18 -56
  298. package/dist/storefront-value-overrides.d.ts.map +1 -1
  299. package/dist/storefront-value-overrides.js +11 -86
  300. package/dist/storefront-value-overrides.js.map +1 -1
  301. package/dist/tasks.d.ts +2842 -0
  302. package/dist/tasks.d.ts.map +1 -0
  303. package/dist/tasks.js +901 -0
  304. package/dist/tasks.js.map +1 -0
  305. package/dist/transactional-emails.d.ts +14 -11
  306. package/dist/transactional-emails.d.ts.map +1 -1
  307. package/dist/transactional-emails.js +13 -0
  308. package/dist/transactional-emails.js.map +1 -1
  309. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-scopes.d.ts","sourceRoot":"","sources":["../src/product-scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA2C,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAE7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE9F;;;;;;;;;;;;;GAaG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,2BAA8B,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzE,eAAO,MAAM,wBAAwB;;;EAAiC,CAAC;AAEvE,sFAAsF;AACtF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,sBAAsB,EAAE,MAAM,EAAE,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,qGAAqG;IACrG,MAAM,EAAE,iBAAiB,GAAG,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AAC;AACzE,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,436 @@
1
+ import { z } from 'zod';
2
+ import { isoDateTimeSchema, multilingualStringSchema, productVisibilitySchema, UUID_SHAPE_PATTERN, uuidSchema, } from './common.js';
3
+ import { isProductVisibleTo, productStatusSchema } from './catalog.js';
4
+ import { ORDER_MINIMUM_MAX } from './order-minimums.js';
5
+ import { scopeFromRequest } from './product-scope-model.js';
6
+ import { scopedWrite, toScopedWriteOp } from './scoped-write-encoding.js';
7
+ /**
8
+ * Feature 163 (`specs/163-product-data-scopes/`) — product data scopes per sales
9
+ * channel and language: the one rule of effective availability, its admin shapes and
10
+ * the ports other modules ask through (`contracts/product-scopes.md`,
11
+ * `contracts/admin-scopes-api.md`, research R1–R7, R18).
12
+ *
13
+ * Scopes, from widest to narrowest: **global** (the `products` row), **channel**
14
+ * (`product_channel_scopes`, one row per product × channel) and **channel × language**
15
+ * (`product_channel_language_scopes`, status only). An override that is absent —
16
+ * `null` on a channel row, no row at all — inherits from the scope above it.
17
+ *
18
+ * Import direction: this file imports from `catalog.ts`, never the reverse, so either
19
+ * may be loaded first without meeting the other half-evaluated.
20
+ */
21
+ // --- 1. Constants and types ----------------------------------------------------
22
+ /**
23
+ * The scoped status values (FR-010, R3). The same set as the global product status,
24
+ * and derived from it so there is one list. Every predicate tests `=== 'active'`
25
+ * through {@link isOn} and never enumerates the off values, which is what keeps a
26
+ * later change of this set (owner question Q1) a data migration rather than a rewrite.
27
+ */
28
+ export const PRODUCT_SCOPE_STATUSES = productStatusSchema.options;
29
+ export const productScopeStatusSchema = z.enum(PRODUCT_SCOPE_STATUSES);
30
+ // --- 2. The pure rule (one definition, FR-002) -----------------------------------
31
+ /** `status === 'active'` — the only test of a status value anywhere. */
32
+ export function isOn(status) {
33
+ return status === 'active';
34
+ }
35
+ /** `cl.status ?? c.status ?? global.status`. */
36
+ export function effectiveStatus(global, channelRow, clRow) {
37
+ return clRow?.status ?? channelRow?.status ?? global.status;
38
+ }
39
+ /** The channel's window when it overrides one, else the global window — as a pair (R4). */
40
+ export function effectiveWindow(global, channelRow) {
41
+ return channelRow?.window ?? global.window;
42
+ }
43
+ /** `from ≤ now ≤ until`, to the millisecond; a `null` bound is open (K4). */
44
+ export function isInsideWindow(window, now) {
45
+ const at = now.getTime();
46
+ if (window.from !== null && window.from.getTime() > at)
47
+ return false;
48
+ if (window.until !== null && at > window.until.getTime())
49
+ return false;
50
+ return true;
51
+ }
52
+ /** The channel's rule when it overrides one, else the global rule — replaced whole, never merged (C4). */
53
+ export function effectiveAudience(global, channelRow) {
54
+ return (channelRow?.audience ?? {
55
+ visibility: global.visibility,
56
+ allowedOrganizationIds: global.allowedOrganizationIds,
57
+ });
58
+ }
59
+ /** Minimum order quantity and the returnable flag in a channel (FR-100). */
60
+ export function effectiveOrderRules(global, channelRow) {
61
+ return {
62
+ minOrderQuantity: channelRow?.minOrderQuantityOverridden ? channelRow.minOrderQuantity : global.minOrderQuantity,
63
+ returnable: channelRow?.returnable ?? global.returnable,
64
+ };
65
+ }
66
+ /**
67
+ * FR-100, research R26 — `records` with the channel's effective minimum order quantity
68
+ * and returnable flag (`rules`, from `catalogProductAvailabilityPort.effectiveOrderRules`)
69
+ * in place of the global ones, for a seam that judges a basket, an order or a quote
70
+ * line in that channel: the order-minimum rule and the returnable stamp. A record the
71
+ * rules do not name is returned as it is; the input is never mutated. The port's own
72
+ * records keep meaning "global".
73
+ */
74
+ export function withChannelOrderRules(records, rules) {
75
+ return records.map((record) => {
76
+ const rule = rules.get(record.id);
77
+ return rule === undefined ? record : { ...record, minOrderQuantity: rule.minOrderQuantity, returnable: rule.returnable };
78
+ });
79
+ }
80
+ /**
81
+ * FR-001 — is the product effectively available at (channel, language) to this
82
+ * audience, now? Not deleted, not archived, a member of the channel, the language
83
+ * offered by the channel, effectively on there, inside its effective window, and
84
+ * admitted by its effective audience rule.
85
+ *
86
+ * Membership and the channel's languages are tested **before** any override is read,
87
+ * which is how orphaned overrides are ignored (FR-015). A row naming another channel
88
+ * or another language is ignored too.
89
+ *
90
+ * Its SQL restatement is `availabilityCondition` in catalog's
91
+ * `product-availability.sql.ts`; a parity test holds the two equal.
92
+ */
93
+ export function isProductEffectivelyAvailable(input) {
94
+ const { global, channel, languageCode } = input;
95
+ if (global.deletedAt !== null || global.archivedAt !== null)
96
+ return false;
97
+ if (!input.isMember)
98
+ return false;
99
+ if (!channel.languages.includes(languageCode))
100
+ return false;
101
+ const channelRow = input.channelRow?.channelId === channel.id ? input.channelRow : undefined;
102
+ const clRow = input.clRow?.channelId === channel.id && input.clRow.languageCode === languageCode ? input.clRow : undefined;
103
+ if (!isOn(effectiveStatus(global, channelRow, clRow)))
104
+ return false;
105
+ if (!isInsideWindow(effectiveWindow(global, channelRow), input.now))
106
+ return false;
107
+ return isProductVisibleTo(effectiveAudience(global, channelRow), input.audience);
108
+ }
109
+ /**
110
+ * The (channel, language) pairs an edit turns on — the completeness gate's subject
111
+ * (R18, N3).
112
+ *
113
+ * **Status only (owner decision M3 → A, 2026-10-22; FR-060).** A pair is returned
114
+ * when the product's effective status there goes from off to on; the window, the
115
+ * audience and archiving are not compared. `channels` is the product's member
116
+ * channels with their languages *after* the write and serves both snapshots, so
117
+ * neither a membership change nor a channel gaining a language produces a pair on
118
+ * its own. Archiving is not a status (spec Session 2026-10-25): setting an archived
119
+ * product `active` turns its pairs on, and a Restore — `archivedAt` alone moving —
120
+ * turns nothing on.
121
+ */
122
+ export function pairsTurningOn(before, after, channels) {
123
+ const pairs = [];
124
+ for (const channel of channels) {
125
+ for (const languageCode of channel.languages) {
126
+ if (!statusOnAt(before, channel.id, languageCode) && statusOnAt(after, channel.id, languageCode)) {
127
+ pairs.push({ channelId: channel.id, languageCode });
128
+ }
129
+ }
130
+ }
131
+ return pairs;
132
+ }
133
+ function statusOnAt(snapshot, channelId, languageCode) {
134
+ const { global } = snapshot;
135
+ if (global.deletedAt !== null)
136
+ return false;
137
+ const channelRow = snapshot.channelRows.find((row) => row.channelId === channelId);
138
+ const clRow = snapshot.languageRows.find((row) => row.channelId === channelId && row.languageCode === languageCode);
139
+ return isOn(effectiveStatus(global, channelRow, clRow));
140
+ }
141
+ /**
142
+ * Which content language "L" a request is in (R7, A-3): the channel's language
143
+ * matching the requested tag case-insensitively, else the first channel language
144
+ * sharing its base language (`pl` ↔ `pl-PL`), else the channel's default. The answer
145
+ * is always spelled as the channel spells it.
146
+ *
147
+ * Not the platform's prose-language resolver: channel content languages are free
148
+ * BCP-47 codes, while the prose resolver normalises to the platform's UI languages.
149
+ */
150
+ export function resolveScopeLanguage(channel, requestedTag) {
151
+ // An `Accept-Language` pick may carry its quality parameter (`de;q=0.9`).
152
+ const tag = requestedTag?.split(';')[0]?.trim().toLowerCase() ?? '';
153
+ if (tag === '')
154
+ return channel.defaultLanguage;
155
+ const exact = channel.languages.find((language) => language.toLowerCase() === tag);
156
+ if (exact !== undefined)
157
+ return exact;
158
+ const base = baseLanguage(tag);
159
+ const sameBase = channel.languages.find((language) => baseLanguage(language.toLowerCase()) === base);
160
+ return sameBase ?? channel.defaultLanguage;
161
+ }
162
+ export { sameLanguage } from './product-scope-model.js';
163
+ /**
164
+ * A channel record as the scope rule reads it. The default language is always
165
+ * one of the languages: a channel whose list is empty, or omits its own
166
+ * default, still offers that default — the language every request on it falls
167
+ * back to. The one home of that normalisation (catalog's availability service
168
+ * and every consumer seam read it from here).
169
+ */
170
+ export function toScopeChannel(channel) {
171
+ const languages = [...(channel.languages ?? [])];
172
+ if (!languages.includes(channel.defaultLanguage))
173
+ languages.unshift(channel.defaultLanguage);
174
+ return { id: channel.id, languages, defaultLanguage: channel.defaultLanguage };
175
+ }
176
+ /**
177
+ * {@link resolveScopeLanguage} over a channel record as a resolver holds it —
178
+ * the scope language L of a buyer request on `channel` that asked in
179
+ * `requestedTag` (the first `Accept-Language` tag, see {@link firstLanguageTag}).
180
+ */
181
+ export function scopeLanguageOf(channel, requestedTag) {
182
+ return resolveScopeLanguage(toScopeChannel(channel), requestedTag);
183
+ }
184
+ /**
185
+ * The first tag of an `Accept-Language` header, without its quality parameter,
186
+ * or `undefined` when the header is absent or empty.
187
+ */
188
+ export function firstLanguageTag(header) {
189
+ const value = Array.isArray(header) ? header[0] : header;
190
+ if (typeof value !== 'string')
191
+ return undefined;
192
+ const first = value.split(',')[0]?.split(';')[0]?.trim();
193
+ return first ? first : undefined;
194
+ }
195
+ function baseLanguage(tag) {
196
+ const dash = tag.indexOf('-');
197
+ return dash === -1 ? tag : tag.slice(0, dash);
198
+ }
199
+ /** The most cells one call of the scope write port carries (R13a). */
200
+ export const PRODUCT_SCOPED_WRITE_CELLS_MAX = 2000;
201
+ /** The subject uuid of a field path: the shared shape, lowercase only (issue #781). */
202
+ const LOWERCASE_UUID = UUID_SHAPE_PATTERN.replaceAll('a-fA-F', 'a-f');
203
+ /**
204
+ * The field paths of data-model §9, as a grammar: a family, a subject uuid where the family has
205
+ * one, an attribute key. Global-only fields are not paths.
206
+ */
207
+ export const fieldPathSchema = z
208
+ .string()
209
+ .max(128)
210
+ .regex(new RegExp(`^(name|description|status|window|audience|minOrderQuantity|returnable|urlKey|seo:(title|description|ogTitle|ogDescription|ogImageUrl)|attribute:[a-z0-9_]{1,64}|gallery:${LOWERCASE_UUID}:(altText|hidden)|galleryRole:(base_image|small_image|thumbnail)|attachment:${LOWERCASE_UUID}:(name|description|hidden)|packagingUnit:${LOWERCASE_UUID}:name)$`), 'field path')
211
+ .transform((path) => path);
212
+ /** A scope as a request names it (`scoped-values-api.md` §1): neither → G, channel → C, both → C×L. */
213
+ export const scopeRequestSchema = z
214
+ .object({
215
+ channelId: uuidSchema.optional(),
216
+ languageCode: z.string().max(16).regex(/^[a-z]{2,3}(-[a-z]{2})?$/i, 'BCP-47 language tag').optional(),
217
+ })
218
+ .strict();
219
+ /** The wire form of {@link ProductScopedWriteInput}: `value` in the write encoding. */
220
+ export const productScopedWriteInputSchema = z
221
+ .object({
222
+ cells: z
223
+ .array(z
224
+ .object({
225
+ scope: scopeRequestSchema,
226
+ field: fieldPathSchema,
227
+ value: scopedWrite(z.unknown().refine((value) => value !== undefined)),
228
+ })
229
+ .strict())
230
+ .max(PRODUCT_SCOPED_WRITE_CELLS_MAX),
231
+ })
232
+ .strict()
233
+ .superRefine((input, ctx) => {
234
+ const seen = new Set();
235
+ input.cells.forEach((cell, index) => {
236
+ if (!scopeFromRequest(cell.scope).ok) {
237
+ ctx.addIssue({ code: 'custom', path: ['cells', index, 'scope'], message: 'A language needs a channel.' });
238
+ }
239
+ const key = `${cell.field}@${cell.scope.channelId ?? ''}/${cell.scope.languageCode?.toLowerCase() ?? ''}`;
240
+ if (seen.has(key))
241
+ ctx.addIssue({ code: 'custom', path: ['cells', index], message: 'Duplicate (field, scope) cell.' });
242
+ seen.add(key);
243
+ });
244
+ })
245
+ .transform((input) => ({
246
+ cells: input.cells.map((cell) => {
247
+ const resolved = scopeFromRequest(cell.scope);
248
+ return {
249
+ scope: resolved.ok ? resolved.scope : { level: 'global' },
250
+ field: cell.field,
251
+ op: toScopedWriteOp(cell.value),
252
+ };
253
+ }),
254
+ }));
255
+ /**
256
+ * R13a (plan decision Q6) — whether an integration (a PIM connector, the products import) may
257
+ * write `field` at all: `name`, `description`, `attribute:<key>`, `gallery:<id>:altText`,
258
+ * `attachment:<id>:name|description`, `packagingUnit:<id>:name`, `urlKey`, `status`, `window`.
259
+ * Every other family — `audience`, `product.*`, `seo:*`, `galleryRole:*`, `*:hidden`,
260
+ * `minOrderQuantity`, `returnable` — is `not_supported`. Pure; the port applies it per cell.
261
+ */
262
+ export function integrationWritableField(field) {
263
+ return /^(name|description|urlKey|status|window|attribute:[a-z0-9_]{1,64}|gallery:[0-9a-f-]{36}:altText|attachment:[0-9a-f-]{36}:(name|description)|packagingUnit:[0-9a-f-]{36}:name)$/.test(field);
264
+ }
265
+ // --- 4. Admin shapes (admin-scopes-api.md) -----------------------------------------
266
+ /**
267
+ * A channel content language as a request names it: the BCP-47 shape the dictionary
268
+ * and i18n contracts use (`pl`, `pl-PL`), matched case-insensitively because the
269
+ * write resolves it to the channel's own spelling (`de-de` → `de-DE`).
270
+ */
271
+ const languageCodeSchema = z
272
+ .string()
273
+ .max(16)
274
+ .regex(/^[a-z]{2,3}(-[a-z]{2})?$/i, 'BCP-47 language tag');
275
+ /** The most organizations one channel audience override names (security review, 163 Block A). */
276
+ const SCOPE_AUDIENCE_ORGANIZATIONS_MAX = 1000;
277
+ /** The most language statuses one channel entry of a scopes PATCH carries. */
278
+ const SCOPE_LANGUAGE_STATUSES_MAX = 64;
279
+ /**
280
+ * What the completeness gate reports missing at a (channel, language) — one
281
+ * vocabulary for the save warning, the `SCOPE_INCOMPLETE` refusal and the scope
282
+ * overview's cells, so they cannot disagree (FR-041, FR-060).
283
+ */
284
+ export const scopeMissingValueSchema = z.union([
285
+ z.literal('name'),
286
+ z.literal('urlKey'),
287
+ z.templateLiteral(['attribute:', z.string().min(1)]),
288
+ ]);
289
+ /**
290
+ * A channel audience override. Capped: the only writer is the scopes PATCH, so the
291
+ * read shape carries the same bound. The global rule in §1 is deliberately not capped:
292
+ * the product update writes it without a bound (`catalog.ts`), so a cap on the read
293
+ * shape would describe products the platform already holds as invalid.
294
+ */
295
+ const audienceRuleSchema = z.object({
296
+ visibility: productVisibilitySchema,
297
+ allowedOrganizationIds: z.array(uuidSchema).max(SCOPE_AUDIENCE_ORGANIZATIONS_MAX),
298
+ });
299
+ const orderMinimumSchema = z.number().int().min(1).max(ORDER_MINIMUM_MAX);
300
+ /** §1 — `GET /api/v1/admin/catalog/products/:id/scopes`. */
301
+ export const productScopesSchema = z.object({
302
+ global: z.object({
303
+ status: productScopeStatusSchema,
304
+ publishFrom: isoDateTimeSchema.nullable(),
305
+ publishUntil: isoDateTimeSchema.nullable(),
306
+ visibility: productVisibilitySchema,
307
+ allowedOrganizationIds: z.array(uuidSchema),
308
+ minOrderQuantity: z.number().int().nullable(),
309
+ returnable: z.boolean(),
310
+ }),
311
+ channels: z.array(z.object({
312
+ channelId: uuidSchema,
313
+ isMember: z.boolean(),
314
+ /** The channel's current content languages. */
315
+ languages: z.array(z.string()),
316
+ status: productScopeStatusSchema.nullable(),
317
+ window: z.object({ from: isoDateTimeSchema.nullable(), until: isoDateTimeSchema.nullable() }).nullable(),
318
+ audience: audienceRuleSchema
319
+ .extend({
320
+ /** Organizations the override names that are not members of the channel (C4 warning). */
321
+ nonMemberOrganizationIds: z.array(uuidSchema),
322
+ })
323
+ .nullable(),
324
+ /** Feature 174 — whether the channel overrides the minimum; then `minOrderQuantity` `null` = none here. */
325
+ minOrderQuantityOverridden: z.boolean(),
326
+ minOrderQuantity: z.number().int().nullable(),
327
+ returnable: z.boolean().nullable(),
328
+ languageStatuses: z.array(z.object({ languageCode: z.string(), status: productScopeStatusSchema, orphaned: z.boolean() })),
329
+ /** The product is not a member of this channel any more (FR-015). */
330
+ orphaned: z.boolean(),
331
+ })),
332
+ /**
333
+ * Owner decision U1 — the names of the organizations the channel audience rules name
334
+ * (non-members included), resolved by the server so an operator without
335
+ * `customers:read` can read them. The global rule's are not named: it is uncapped. An organization that cannot be read (deleted,
336
+ * or `organizations` not answering) is absent: the consumer shows its id.
337
+ */
338
+ organizations: z.array(z.object({ id: uuidSchema, name: z.string() })),
339
+ });
340
+ export const productScopesResponseSchema = z.object({ data: productScopesSchema });
341
+ /**
342
+ * §2 — `PATCH /api/v1/admin/catalog/products/:id/scopes`, in the one write encoding
343
+ * (feature 174, `contracts/write-encoding.md` §5, FR-116): absent or `""` = no change,
344
+ * `{ inherit: true }` = use inherited (deletes the override), `null` = the empty override
345
+ * where the field takes one — `minOrderQuantity: null` = no minimum in this channel,
346
+ * `window: null` = an open window override; `status`, `audience` and `returnable` refuse
347
+ * `null` (`SCOPED_VALUE_INVALID`, `not_emptyable`, from the service). A window whose
348
+ * `from` is not before its `until` is refused with `VALIDATION_FAILED`,
349
+ * `details.field = 'window'`.
350
+ */
351
+ export const patchProductScopesRequestSchema = z.object({
352
+ channels: z
353
+ .array(z.object({
354
+ channelId: uuidSchema,
355
+ status: scopedWrite(productScopeStatusSchema),
356
+ window: scopedWrite(z.object({ from: isoDateTimeSchema.nullable(), until: isoDateTimeSchema.nullable() }).strict()),
357
+ audience: scopedWrite(audienceRuleSchema.strict()),
358
+ minOrderQuantity: scopedWrite(orderMinimumSchema),
359
+ returnable: scopedWrite(z.boolean()),
360
+ languageStatuses: z
361
+ .array(z.object({ languageCode: languageCodeSchema, status: scopedWrite(productScopeStatusSchema) }))
362
+ .max(SCOPE_LANGUAGE_STATUSES_MAX)
363
+ .optional(),
364
+ }))
365
+ .max(64),
366
+ global: z
367
+ .object({ publishFrom: isoDateTimeSchema.nullable(), publishUntil: isoDateTimeSchema.nullable() })
368
+ .partial()
369
+ .optional(),
370
+ });
371
+ export const scopeWarningSchema = z.discriminatedUnion('kind', [
372
+ z.object({
373
+ kind: z.literal('completeness'),
374
+ channelId: uuidSchema,
375
+ languageCode: z.string(),
376
+ missing: z.array(scopeMissingValueSchema),
377
+ }),
378
+ z.object({ kind: z.literal('audience_non_members'), channelId: uuidSchema, organizationIds: z.array(uuidSchema) }),
379
+ ]);
380
+ export const patchProductScopesResponseSchema = z.object({
381
+ data: productScopesSchema,
382
+ warnings: z.array(scopeWarningSchema),
383
+ });
384
+ /** `422 SCOPE_INVALID` details (FR-014). */
385
+ export const scopeInvalidDetailsSchema = z.object({
386
+ channelId: uuidSchema,
387
+ languageCode: z.string().optional(),
388
+ reason: z.enum(['not_a_member', 'language_not_offered']),
389
+ });
390
+ /** `422 SCOPE_INCOMPLETE` details (FR-060). */
391
+ export const scopeIncompleteDetailsSchema = z.object({
392
+ pairs: z.array(z.object({ channelId: uuidSchema, languageCode: z.string(), missing: z.array(scopeMissingValueSchema) })),
393
+ });
394
+ /** Feature 174 (FR-010) — there is no Language scope: an override sits at C or C×L. */
395
+ export const scopeLevelSchema = z.enum(['channel_language', 'channel']);
396
+ /** §3 — `GET /api/v1/admin/catalog/products/:id/scope-overview`. */
397
+ export const scopeOverviewResponseSchema = z.object({
398
+ data: z.object({
399
+ channels: z.array(z.object({
400
+ channelId: uuidSchema,
401
+ name: multilingualStringSchema,
402
+ isMember: z.boolean(),
403
+ languages: z.array(z.string()),
404
+ })),
405
+ /** The union of the channels' languages, or every active platform language when there is no channel. */
406
+ languages: z.array(z.string()),
407
+ cells: z.array(z.object({
408
+ channelId: uuidSchema,
409
+ languageCode: z.string(),
410
+ /** Member, language offered, on and inside the window now; audience is shown as the rule, not evaluated. */
411
+ available: z.boolean(),
412
+ effectiveStatus: productScopeStatusSchema,
413
+ statusSource: z.enum(['channel_language', 'channel', 'global']),
414
+ overriddenFields: z.array(z.object({ field: z.string(), level: scopeLevelSchema })),
415
+ /** FR-041 — what the gate would report here; `[]` = complete; absent = not evaluable. */
416
+ missing: z.array(scopeMissingValueSchema).optional(),
417
+ })),
418
+ channelRows: z.array(z.object({ channelId: uuidSchema, overriddenFields: z.array(z.string()) })),
419
+ orphans: z.array(z.object({
420
+ field: z.string(),
421
+ channelId: uuidSchema.nullable(),
422
+ languageCode: z.string().nullable(),
423
+ reason: z.enum(['not_a_member', 'language_not_offered', 'attribute_scope_changed']),
424
+ })),
425
+ }),
426
+ });
427
+ /** §6 — `GET /api/v1/admin/catalog/attributes/:idOrKey/scope-change-preview`. */
428
+ export const attributeScopeChangePreviewResponseSchema = z.object({
429
+ data: z.object({
430
+ orphanedOverrides: z.number().int().nonnegative(),
431
+ byChannel: z.array(z.object({ channelId: uuidSchema, count: z.number().int().nonnegative() })),
432
+ }),
433
+ });
434
+ /** §5 — the completeness gate's mode (`catalog.scope_completeness_gate`). */
435
+ export const SCOPE_COMPLETENESS_GATE_MODES = ['warn', 'refuse'];
436
+ //# sourceMappingURL=product-scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-scopes.js","sourceRoot":"","sources":["../src/product-scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAA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CAAC;QACb,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACjD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;KAC/F,CAAC;CACH,CAAC,CAAC;AAGH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The product card's short description (`specs/163-page-builder-marketing-pages/`
3
+ * research R-16, FR-027, owner ruling Q3): derived from the product's own
4
+ * description rather than stored, so the catalogue's schema does not change.
5
+ *
6
+ * Pure and synchronous on purpose: the catalogue's listing calls it on the
7
+ * description it already holds, so a summary costs no query per product.
8
+ *
9
+ * It lives here rather than in `catalog` (T196) because a second reader needs
10
+ * the same answer: the page editor's preview of a product listing (`cms`'
11
+ * admin), which reads the admin product payload — the description, not a
12
+ * summary — and must show the line the storefront shows. A module may not
13
+ * import another's internals; both may import this.
14
+ */
15
+ /** The longest summary, ellipsis included. */
16
+ export declare const PRODUCT_SUMMARY_MAX_LENGTH = 160;
17
+ /**
18
+ * The summary of a description: plain text of at most
19
+ * {@link PRODUCT_SUMMARY_MAX_LENGTH} characters, cut at the last word boundary
20
+ * that fits and marked with an ellipsis; `null` when nothing is left.
21
+ */
22
+ export declare function productSummaryText(description: string | null | undefined): string | null;
23
+ //# sourceMappingURL=product-summary-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-summary-text.d.ts","sourceRoot":"","sources":["../src/product-summary-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAkC9C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAUxF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The product card's short description (`specs/163-page-builder-marketing-pages/`
3
+ * research R-16, FR-027, owner ruling Q3): derived from the product's own
4
+ * description rather than stored, so the catalogue's schema does not change.
5
+ *
6
+ * Pure and synchronous on purpose: the catalogue's listing calls it on the
7
+ * description it already holds, so a summary costs no query per product.
8
+ *
9
+ * It lives here rather than in `catalog` (T196) because a second reader needs
10
+ * the same answer: the page editor's preview of a product listing (`cms`'
11
+ * admin), which reads the admin product payload — the description, not a
12
+ * summary — and must show the line the storefront shows. A module may not
13
+ * import another's internals; both may import this.
14
+ */
15
+ /** The longest summary, ellipsis included. */
16
+ export const PRODUCT_SUMMARY_MAX_LENGTH = 160;
17
+ const ELLIPSIS = '…';
18
+ const NAMED_ENTITIES = {
19
+ amp: '&',
20
+ lt: '<',
21
+ gt: '>',
22
+ quot: '"',
23
+ apos: "'",
24
+ nbsp: ' ',
25
+ };
26
+ function decodeEntities(text) {
27
+ return text.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi, (match, entity) => {
28
+ if (entity.startsWith('#x') || entity.startsWith('#X')) {
29
+ const code = Number.parseInt(entity.slice(2), 16);
30
+ return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : match;
31
+ }
32
+ if (entity.startsWith('#')) {
33
+ const code = Number.parseInt(entity.slice(1), 10);
34
+ return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : match;
35
+ }
36
+ return NAMED_ENTITIES[entity.toLowerCase()] ?? match;
37
+ });
38
+ }
39
+ /** A description (plain text or HTML) as one line of plain text. */
40
+ function toPlainText(description) {
41
+ const withoutCode = description.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, ' ');
42
+ const withoutTags = withoutCode.replace(/<[^>]*>/g, ' ');
43
+ return decodeEntities(withoutTags).replace(/\s+/g, ' ').trim();
44
+ }
45
+ /**
46
+ * The summary of a description: plain text of at most
47
+ * {@link PRODUCT_SUMMARY_MAX_LENGTH} characters, cut at the last word boundary
48
+ * that fits and marked with an ellipsis; `null` when nothing is left.
49
+ */
50
+ export function productSummaryText(description) {
51
+ if (typeof description !== 'string')
52
+ return null;
53
+ const text = toPlainText(description);
54
+ if (text === '')
55
+ return null;
56
+ if (text.length <= PRODUCT_SUMMARY_MAX_LENGTH)
57
+ return text;
58
+ const room = PRODUCT_SUMMARY_MAX_LENGTH - ELLIPSIS.length;
59
+ const head = text.slice(0, room + 1);
60
+ const boundary = head.lastIndexOf(' ');
61
+ const cut = boundary > 0 ? head.slice(0, boundary) : text.slice(0, room);
62
+ return `${cut.replace(/[\s,;:–—-]+$/u, '')}${ELLIPSIS}`;
63
+ }
64
+ //# sourceMappingURL=product-summary-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-summary-text.js","sourceRoot":"","sources":["../src/product-summary-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,MAAM,cAAc,GAAqC;IACvD,GAAG,EAAE,GAAG;IACR,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;QAChF,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ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IAAI,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC7B,IAAI,IAAI,CAAC,MAAM,IAAI,0BAA0B;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,IAAI,GAAG,0BAA0B,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACzE,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ProductType } from './catalog.js';
2
+ import type { OrganizationTaxProfilePort } from './organizations.js';
3
+ import type { TaxServicePort } from './taxes.js';
4
+ /**
5
+ * The VAT rate of each product tax class a buyer is charged, as a fraction —
6
+ * issue #436 (the cart) and issue #852 (the catalogue). A product's class is
7
+ * its `type`.
8
+ */
9
+ export type ProductTaxRateResolver = (input: {
10
+ organizationId: string | null;
11
+ productTypes: readonly ProductType[];
12
+ }) => Promise<Map<ProductType, number>>;
13
+ /**
14
+ * Resolves a buyer's rates the way placement resolves an order's
15
+ * (`OrderService.computeMonetaryTotals`): the product's class against the
16
+ * Organization's VAT status and country, a VAT-exempt or reverse-charge
17
+ * Organization at 0, and a deployment holding no rule that applies — the
18
+ * resolver's `none` — at 0. The checkout preview's defaults stand for what a
19
+ * read before checkout cannot know yet: a buyer with no Organization is a VAT
20
+ * payer, and the country is the Organization's registered one, `PL` without
21
+ * one; placement prefers the billing address chosen at checkout.
22
+ *
23
+ * **One rule, two readers.** It was `carts`' own (`cart-tax-rates.ts`, issue
24
+ * #436) until the catalogue needed the same answer for a product's gross price
25
+ * (issue #852). A second copy in `catalog` would be a second chance to answer
26
+ * the same buyer two rates for the same product, so the rule lives here, over
27
+ * the two contract ports both modules already resolve, and each module wires
28
+ * it with its own `lazyPort`s — no module imports the other.
29
+ *
30
+ * No `catch` (issue #84): the only errors that reach here are a failing
31
+ * database and a switched-off owner, and a rate invented for either would be a
32
+ * VAT figure no rule supports. The caller decides what a failure means.
33
+ */
34
+ export declare function createProductTaxRateResolver(ports: {
35
+ taxProfiles: OrganizationTaxProfilePort;
36
+ taxes: TaxServicePort;
37
+ }): ProductTaxRateResolver;
38
+ //# sourceMappingURL=product-tax-rates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-tax-rates.d.ts","sourceRoot":"","sources":["../src/product-tax-rates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE;IAC3C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;CACtC,KAAK,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,WAAW,EAAE,0BAA0B,CAAC;IACxC,KAAK,EAAE,cAAc,CAAC;CACvB,GAAG,sBAAsB,CAqBzB"}