@endora-commerce/contracts 0.109.0 → 0.111.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 (385) hide show
  1. package/dist/accept-language.d.ts +31 -0
  2. package/dist/accept-language.js +64 -0
  3. package/dist/actor.d.ts +16 -0
  4. package/dist/addresses.d.ts +35 -0
  5. package/dist/addresses.js +8 -1
  6. package/dist/admin-actions.d.ts +2 -0
  7. package/dist/admin-actions.js +18 -0
  8. package/dist/admin-contributions.d.ts +99 -12
  9. package/dist/admin-contributions.js +36 -10
  10. package/dist/admin-roles.d.ts +17 -2
  11. package/dist/admin-users.d.ts +9 -0
  12. package/dist/admin.d.ts +114 -4
  13. package/dist/admin.js +98 -3
  14. package/dist/api-keys.d.ts +22 -0
  15. package/dist/api-keys.js +4 -0
  16. package/dist/assets-library.d.ts +45 -0
  17. package/dist/assets-library.js +20 -3
  18. package/dist/audit-logs.d.ts +12 -0
  19. package/dist/audit-logs.js +12 -0
  20. package/dist/auth.d.ts +9 -0
  21. package/dist/auth.js +9 -0
  22. package/dist/blog.d.ts +382 -22
  23. package/dist/blog.js +199 -17
  24. package/dist/carts.d.ts +423 -36
  25. package/dist/carts.js +150 -12
  26. package/dist/catalog.d.ts +379 -208
  27. package/dist/catalog.js +241 -163
  28. package/dist/cms-brand.d.ts +14 -14
  29. package/dist/cms.d.ts +71 -16
  30. package/dist/cms.js +15 -0
  31. package/dist/command-hooks.d.ts +301 -0
  32. package/dist/command-hooks.js +248 -0
  33. package/dist/common.d.ts +23 -6
  34. package/dist/common.js +25 -2
  35. package/dist/comparisons.d.ts +21 -14
  36. package/dist/comparisons.js +2 -1
  37. package/dist/credit-limits.d.ts +22 -0
  38. package/dist/credit-limits.js +35 -0
  39. package/dist/crm.d.ts +134 -78
  40. package/dist/crm.js +21 -5
  41. package/dist/custom-fields.d.ts +417 -49
  42. package/dist/custom-fields.js +142 -1
  43. package/dist/customer-accounts.d.ts +324 -22
  44. package/dist/customer-accounts.js +43 -0
  45. package/dist/customer-notifications.d.ts +143 -0
  46. package/dist/customer-notifications.js +41 -0
  47. package/dist/customers.d.ts +92 -73
  48. package/dist/customers.js +98 -10
  49. package/dist/dictionary.d.ts +53 -0
  50. package/dist/dictionary.js +25 -0
  51. package/dist/document-templates.d.ts +12 -12
  52. package/dist/email.d.ts +34 -0
  53. package/dist/email.js +6 -0
  54. package/dist/errors.d.ts +431 -3
  55. package/dist/errors.js +523 -3
  56. package/dist/forms-logic.d.ts +79 -0
  57. package/dist/forms-logic.fixtures.d.ts +52 -0
  58. package/dist/forms-logic.fixtures.js +610 -0
  59. package/dist/forms-logic.js +699 -0
  60. package/dist/forms.d.ts +9833 -0
  61. package/dist/forms.js +827 -0
  62. package/dist/i18n.d.ts +34 -0
  63. package/dist/i18n.js +15 -0
  64. package/dist/import-export.d.ts +180 -0
  65. package/dist/import-export.js +60 -0
  66. package/dist/index.d.ts +16 -1
  67. package/dist/index.js +30 -1
  68. package/dist/inventory.d.ts +9 -9
  69. package/dist/invoice-ledger.d.ts +13 -13
  70. package/dist/invoices.d.ts +126 -0
  71. package/dist/invoices.js +53 -0
  72. package/dist/line-bounds.d.ts +53 -0
  73. package/dist/line-bounds.js +65 -0
  74. package/dist/megamenu.d.ts +27 -27
  75. package/dist/mfa.d.ts +210 -4
  76. package/dist/mfa.js +136 -0
  77. package/dist/modules.d.ts +56 -8
  78. package/dist/modules.js +128 -3
  79. package/dist/money-decimal.d.ts +54 -0
  80. package/dist/money-decimal.js +95 -0
  81. package/dist/newsletter.d.ts +4 -4
  82. package/dist/orders.d.ts +246 -12
  83. package/dist/orders.js +140 -7
  84. package/dist/organization-hooks.d.ts +99 -0
  85. package/dist/organization-hooks.js +22 -0
  86. package/dist/organization-registry-lookup.d.ts +362 -0
  87. package/dist/organization-registry-lookup.js +196 -0
  88. package/dist/organization-roles.d.ts +341 -0
  89. package/dist/organization-roles.js +218 -0
  90. package/dist/organizations.d.ts +1074 -103
  91. package/dist/organizations.js +293 -28
  92. package/dist/page-builder-props.d.ts +56 -56
  93. package/dist/pim-connector.d.ts +7 -3
  94. package/dist/pim-connector.js +6 -2
  95. package/dist/pim-field-path.d.ts +5 -1
  96. package/dist/pim-field-path.js +37 -81
  97. package/dist/pim-locale-mapping.d.ts +131 -0
  98. package/dist/pim-locale-mapping.js +193 -0
  99. package/dist/price-books.d.ts +215 -63
  100. package/dist/price-books.js +47 -2
  101. package/dist/price-lists.d.ts +13 -10
  102. package/dist/product-feeds.d.ts +249 -100
  103. package/dist/product-feeds.js +46 -2
  104. package/dist/product-scope-model.d.ts +161 -0
  105. package/dist/product-scope-model.js +161 -0
  106. package/dist/product-scope-overrides.d.ts +0 -103
  107. package/dist/product-scope-overrides.js +0 -54
  108. package/dist/product-scoped-values.d.ts +2610 -0
  109. package/dist/product-scoped-values.js +425 -0
  110. package/dist/product-scopes.d.ts +199 -64
  111. package/dist/product-scopes.js +120 -23
  112. package/dist/product-tax-rates.d.ts +38 -0
  113. package/dist/product-tax-rates.js +45 -0
  114. package/dist/product-url-keys.d.ts +51 -45
  115. package/dist/product-url-keys.js +73 -39
  116. package/dist/product-value-resolver.d.ts +37 -60
  117. package/dist/product-value-resolver.js +36 -96
  118. package/dist/projects.d.ts +76 -28
  119. package/dist/projects.js +53 -9
  120. package/dist/promotions.d.ts +163 -11
  121. package/dist/promotions.js +23 -1
  122. package/dist/pwa.d.ts +41 -2
  123. package/dist/quick-order.d.ts +159 -9
  124. package/dist/quick-order.js +79 -4
  125. package/dist/quote-requests.d.ts +231 -17
  126. package/dist/quote-requests.js +111 -9
  127. package/dist/record-references.d.ts +15 -15
  128. package/dist/record-references.js +2 -3
  129. package/dist/record-rich-text.js +2 -1
  130. package/dist/returns.d.ts +214 -52
  131. package/dist/returns.js +143 -28
  132. package/dist/sales-channels.d.ts +34 -3
  133. package/dist/sales-channels.js +16 -1
  134. package/dist/saved-list-views.d.ts +28 -0
  135. package/dist/saved-list-views.js +14 -1
  136. package/dist/schema-extensions.d.ts +36 -0
  137. package/dist/schema-extensions.js +29 -0
  138. package/dist/scoped-write-encoding.d.ts +100 -0
  139. package/dist/scoped-write-encoding.js +135 -0
  140. package/dist/search.d.ts +18 -16
  141. package/dist/seo.d.ts +83 -30
  142. package/dist/seo.js +8 -1
  143. package/dist/settings.d.ts +173 -2
  144. package/dist/settings.js +53 -2
  145. package/dist/shopping-lists.d.ts +63 -4
  146. package/dist/shopping-lists.js +57 -3
  147. package/dist/storefront-cache-tags.d.ts +22 -0
  148. package/dist/storefront-cache-tags.js +12 -0
  149. package/dist/storefront-value-overrides.d.ts +18 -56
  150. package/dist/storefront-value-overrides.js +11 -86
  151. package/dist/tasks.d.ts +27 -27
  152. package/dist/taxes.d.ts +27 -0
  153. package/dist/taxes.js +4 -0
  154. package/dist/transactional-emails.d.ts +48 -22
  155. package/dist/webhooks.d.ts +75 -0
  156. package/dist/webhooks.js +24 -0
  157. package/package.json +5 -3
  158. package/dist/actor.d.ts.map +0 -1
  159. package/dist/actor.js.map +0 -1
  160. package/dist/addresses.d.ts.map +0 -1
  161. package/dist/addresses.js.map +0 -1
  162. package/dist/admin-actions.d.ts.map +0 -1
  163. package/dist/admin-actions.js.map +0 -1
  164. package/dist/admin-contributions.d.ts.map +0 -1
  165. package/dist/admin-contributions.js.map +0 -1
  166. package/dist/admin-feedback.d.ts.map +0 -1
  167. package/dist/admin-feedback.js.map +0 -1
  168. package/dist/admin-i18n.d.ts.map +0 -1
  169. package/dist/admin-i18n.js.map +0 -1
  170. package/dist/admin-name.d.ts.map +0 -1
  171. package/dist/admin-name.js.map +0 -1
  172. package/dist/admin-notifications.d.ts.map +0 -1
  173. package/dist/admin-notifications.js.map +0 -1
  174. package/dist/admin-preferences.d.ts.map +0 -1
  175. package/dist/admin-preferences.js.map +0 -1
  176. package/dist/admin-roles.d.ts.map +0 -1
  177. package/dist/admin-roles.js.map +0 -1
  178. package/dist/admin-search.d.ts.map +0 -1
  179. package/dist/admin-search.js.map +0 -1
  180. package/dist/admin-users.d.ts.map +0 -1
  181. package/dist/admin-users.js.map +0 -1
  182. package/dist/admin.d.ts.map +0 -1
  183. package/dist/admin.js.map +0 -1
  184. package/dist/analytics.d.ts.map +0 -1
  185. package/dist/analytics.js.map +0 -1
  186. package/dist/api-keys.d.ts.map +0 -1
  187. package/dist/api-keys.js.map +0 -1
  188. package/dist/assets-library.d.ts.map +0 -1
  189. package/dist/assets-library.js.map +0 -1
  190. package/dist/audit-logs.d.ts.map +0 -1
  191. package/dist/audit-logs.js.map +0 -1
  192. package/dist/auth.d.ts.map +0 -1
  193. package/dist/auth.js.map +0 -1
  194. package/dist/blog.d.ts.map +0 -1
  195. package/dist/blog.js.map +0 -1
  196. package/dist/capabilities.d.ts.map +0 -1
  197. package/dist/capabilities.js.map +0 -1
  198. package/dist/carts.d.ts.map +0 -1
  199. package/dist/carts.js.map +0 -1
  200. package/dist/catalog.d.ts.map +0 -1
  201. package/dist/catalog.js.map +0 -1
  202. package/dist/cms-brand.d.ts.map +0 -1
  203. package/dist/cms-brand.js.map +0 -1
  204. package/dist/cms-contact-form.d.ts.map +0 -1
  205. package/dist/cms-contact-form.js.map +0 -1
  206. package/dist/cms.d.ts.map +0 -1
  207. package/dist/cms.js.map +0 -1
  208. package/dist/common.d.ts.map +0 -1
  209. package/dist/common.js.map +0 -1
  210. package/dist/comparisons.d.ts.map +0 -1
  211. package/dist/comparisons.js.map +0 -1
  212. package/dist/credentials.d.ts.map +0 -1
  213. package/dist/credentials.js.map +0 -1
  214. package/dist/credit-limits.d.ts.map +0 -1
  215. package/dist/credit-limits.js.map +0 -1
  216. package/dist/crm-rich-text.d.ts.map +0 -1
  217. package/dist/crm-rich-text.js.map +0 -1
  218. package/dist/crm.d.ts.map +0 -1
  219. package/dist/crm.js.map +0 -1
  220. package/dist/currencies.d.ts.map +0 -1
  221. package/dist/currencies.js.map +0 -1
  222. package/dist/custom-fields.d.ts.map +0 -1
  223. package/dist/custom-fields.js.map +0 -1
  224. package/dist/customer-accounts.d.ts.map +0 -1
  225. package/dist/customer-accounts.js.map +0 -1
  226. package/dist/customers.d.ts.map +0 -1
  227. package/dist/customers.js.map +0 -1
  228. package/dist/dictionary.d.ts.map +0 -1
  229. package/dist/dictionary.js.map +0 -1
  230. package/dist/document-templates.d.ts.map +0 -1
  231. package/dist/document-templates.js.map +0 -1
  232. package/dist/document-values.d.ts.map +0 -1
  233. package/dist/document-values.js.map +0 -1
  234. package/dist/email-address.d.ts.map +0 -1
  235. package/dist/email-address.js.map +0 -1
  236. package/dist/email.d.ts.map +0 -1
  237. package/dist/email.js.map +0 -1
  238. package/dist/envelopes.d.ts.map +0 -1
  239. package/dist/envelopes.js.map +0 -1
  240. package/dist/environment-inputs.d.ts.map +0 -1
  241. package/dist/environment-inputs.js.map +0 -1
  242. package/dist/erp-connector.d.ts.map +0 -1
  243. package/dist/erp-connector.js.map +0 -1
  244. package/dist/errors.d.ts.map +0 -1
  245. package/dist/errors.js.map +0 -1
  246. package/dist/google-analytics.d.ts.map +0 -1
  247. package/dist/google-analytics.js.map +0 -1
  248. package/dist/google-tag-manager.d.ts.map +0 -1
  249. package/dist/google-tag-manager.js.map +0 -1
  250. package/dist/i18n.d.ts.map +0 -1
  251. package/dist/i18n.js.map +0 -1
  252. package/dist/import-export.d.ts.map +0 -1
  253. package/dist/import-export.js.map +0 -1
  254. package/dist/index.d.ts.map +0 -1
  255. package/dist/index.js.map +0 -1
  256. package/dist/inventory.d.ts.map +0 -1
  257. package/dist/inventory.js.map +0 -1
  258. package/dist/invoice-ledger.d.ts.map +0 -1
  259. package/dist/invoice-ledger.js.map +0 -1
  260. package/dist/invoices.d.ts.map +0 -1
  261. package/dist/invoices.js.map +0 -1
  262. package/dist/kernel.d.ts.map +0 -1
  263. package/dist/kernel.js.map +0 -1
  264. package/dist/languages.d.ts.map +0 -1
  265. package/dist/languages.js.map +0 -1
  266. package/dist/line-groups.d.ts.map +0 -1
  267. package/dist/line-groups.js.map +0 -1
  268. package/dist/linkedin-ads.d.ts.map +0 -1
  269. package/dist/linkedin-ads.js.map +0 -1
  270. package/dist/localized-name.d.ts.map +0 -1
  271. package/dist/localized-name.js.map +0 -1
  272. package/dist/megamenu.d.ts.map +0 -1
  273. package/dist/megamenu.js.map +0 -1
  274. package/dist/meta-ads.d.ts.map +0 -1
  275. package/dist/meta-ads.js.map +0 -1
  276. package/dist/mfa.d.ts.map +0 -1
  277. package/dist/mfa.js.map +0 -1
  278. package/dist/modules.d.ts.map +0 -1
  279. package/dist/modules.js.map +0 -1
  280. package/dist/money-decimal.d.ts.map +0 -1
  281. package/dist/money-decimal.js.map +0 -1
  282. package/dist/money-input.d.ts.map +0 -1
  283. package/dist/money-input.js.map +0 -1
  284. package/dist/newsletter.d.ts.map +0 -1
  285. package/dist/newsletter.js.map +0 -1
  286. package/dist/order-minimums.d.ts.map +0 -1
  287. package/dist/order-minimums.js.map +0 -1
  288. package/dist/orders.d.ts.map +0 -1
  289. package/dist/orders.js.map +0 -1
  290. package/dist/organizations.d.ts.map +0 -1
  291. package/dist/organizations.js.map +0 -1
  292. package/dist/page-builder-props.d.ts.map +0 -1
  293. package/dist/page-builder-props.js.map +0 -1
  294. package/dist/page-builder-values.d.ts.map +0 -1
  295. package/dist/page-builder-values.js.map +0 -1
  296. package/dist/pagination.d.ts.map +0 -1
  297. package/dist/pagination.js.map +0 -1
  298. package/dist/payment-methods.d.ts.map +0 -1
  299. package/dist/payment-methods.js.map +0 -1
  300. package/dist/payment-return-url.d.ts.map +0 -1
  301. package/dist/payment-return-url.js.map +0 -1
  302. package/dist/payments.d.ts.map +0 -1
  303. package/dist/payments.js.map +0 -1
  304. package/dist/pim-connector.d.ts.map +0 -1
  305. package/dist/pim-connector.js.map +0 -1
  306. package/dist/pim-field-path.d.ts.map +0 -1
  307. package/dist/pim-field-path.js.map +0 -1
  308. package/dist/platform-info.d.ts.map +0 -1
  309. package/dist/platform-info.js.map +0 -1
  310. package/dist/platform-language.d.ts.map +0 -1
  311. package/dist/platform-language.js.map +0 -1
  312. package/dist/price-book-decimal.d.ts.map +0 -1
  313. package/dist/price-book-decimal.js.map +0 -1
  314. package/dist/price-books.d.ts.map +0 -1
  315. package/dist/price-books.js.map +0 -1
  316. package/dist/price-lists.d.ts.map +0 -1
  317. package/dist/price-lists.js.map +0 -1
  318. package/dist/product-feeds.d.ts.map +0 -1
  319. package/dist/product-feeds.js.map +0 -1
  320. package/dist/product-scope-overrides.d.ts.map +0 -1
  321. package/dist/product-scope-overrides.js.map +0 -1
  322. package/dist/product-scopes.d.ts.map +0 -1
  323. package/dist/product-scopes.js.map +0 -1
  324. package/dist/product-summary-text.d.ts.map +0 -1
  325. package/dist/product-summary-text.js.map +0 -1
  326. package/dist/product-url-keys.d.ts.map +0 -1
  327. package/dist/product-url-keys.js.map +0 -1
  328. package/dist/product-value-resolver.d.ts.map +0 -1
  329. package/dist/product-value-resolver.js.map +0 -1
  330. package/dist/projects.d.ts.map +0 -1
  331. package/dist/projects.js.map +0 -1
  332. package/dist/promotions.d.ts.map +0 -1
  333. package/dist/promotions.js.map +0 -1
  334. package/dist/prompt-actions.d.ts.map +0 -1
  335. package/dist/prompt-actions.js.map +0 -1
  336. package/dist/pwa.d.ts.map +0 -1
  337. package/dist/pwa.js.map +0 -1
  338. package/dist/quick-order.d.ts.map +0 -1
  339. package/dist/quick-order.js.map +0 -1
  340. package/dist/quote-requests.d.ts.map +0 -1
  341. package/dist/quote-requests.js.map +0 -1
  342. package/dist/record-references.d.ts.map +0 -1
  343. package/dist/record-references.js.map +0 -1
  344. package/dist/record-rich-text.d.ts.map +0 -1
  345. package/dist/record-rich-text.js.map +0 -1
  346. package/dist/returns.d.ts.map +0 -1
  347. package/dist/returns.js.map +0 -1
  348. package/dist/sales-channels.d.ts.map +0 -1
  349. package/dist/sales-channels.js.map +0 -1
  350. package/dist/saved-list-views.d.ts.map +0 -1
  351. package/dist/saved-list-views.js.map +0 -1
  352. package/dist/scope-notice.d.ts.map +0 -1
  353. package/dist/scope-notice.js.map +0 -1
  354. package/dist/scoped-translations.d.ts +0 -48
  355. package/dist/scoped-translations.d.ts.map +0 -1
  356. package/dist/scoped-translations.js +0 -78
  357. package/dist/scoped-translations.js.map +0 -1
  358. package/dist/search.d.ts.map +0 -1
  359. package/dist/search.js.map +0 -1
  360. package/dist/seo.d.ts.map +0 -1
  361. package/dist/seo.js.map +0 -1
  362. package/dist/settings.d.ts.map +0 -1
  363. package/dist/settings.js.map +0 -1
  364. package/dist/shipments.d.ts.map +0 -1
  365. package/dist/shipments.js.map +0 -1
  366. package/dist/shipping-methods.d.ts.map +0 -1
  367. package/dist/shipping-methods.js.map +0 -1
  368. package/dist/shopping-lists.d.ts.map +0 -1
  369. package/dist/shopping-lists.js.map +0 -1
  370. package/dist/storefront-cache-tags.d.ts.map +0 -1
  371. package/dist/storefront-cache-tags.js.map +0 -1
  372. package/dist/storefront-language-path.d.ts.map +0 -1
  373. package/dist/storefront-language-path.js.map +0 -1
  374. package/dist/storefront-value-overrides.d.ts.map +0 -1
  375. package/dist/storefront-value-overrides.js.map +0 -1
  376. package/dist/tasks.d.ts.map +0 -1
  377. package/dist/tasks.js.map +0 -1
  378. package/dist/taxes.d.ts.map +0 -1
  379. package/dist/taxes.js.map +0 -1
  380. package/dist/text-normalization.d.ts.map +0 -1
  381. package/dist/text-normalization.js.map +0 -1
  382. package/dist/transactional-emails.d.ts.map +0 -1
  383. package/dist/transactional-emails.js.map +0 -1
  384. package/dist/webhooks.d.ts.map +0 -1
  385. package/dist/webhooks.js.map +0 -1
@@ -0,0 +1,610 @@
1
+ /** A definition with the neutral behaviour and restrictions; only the sections vary. */
2
+ export function fixtureDefinition(sections, texts = {}) {
3
+ return {
4
+ schemaVersion: 1,
5
+ sections: [...sections],
6
+ behaviour: {
7
+ confirmation: { type: 'message' },
8
+ captchaRequired: false,
9
+ confirmationEmail: { enabled: false, includeSummary: false },
10
+ },
11
+ restrictions: { maxEntries: null, availableFrom: null, availableUntil: null, signedInOnly: false },
12
+ texts,
13
+ };
14
+ }
15
+ const ADDRESS_PARTS = {
16
+ street: { enabled: true, required: true },
17
+ line2: { enabled: false, required: false },
18
+ postalCode: { enabled: true, required: false },
19
+ city: { enabled: true, required: true },
20
+ country: { enabled: true, required: false },
21
+ };
22
+ /** `(a = x ∧ b = y) ∨ (a = z)` on `c` — the `and` connective inside groups, `or` between them. */
23
+ const AND_DEFINITION = fixtureDefinition([
24
+ {
25
+ id: 's1',
26
+ columns: 1,
27
+ fields: [
28
+ { id: 'fa', type: 'text', key: 'a' },
29
+ { id: 'fb', type: 'text', key: 'b' },
30
+ {
31
+ id: 'fc',
32
+ type: 'text',
33
+ key: 'c',
34
+ visibility: {
35
+ connective: 'and',
36
+ groups: [
37
+ [
38
+ { fieldId: 'fa', operator: 'equals', value: 'x' },
39
+ { fieldId: 'fb', operator: 'equals', value: 'y' },
40
+ ],
41
+ [{ fieldId: 'fa', operator: 'equals', value: 'z' }],
42
+ ],
43
+ },
44
+ },
45
+ ],
46
+ },
47
+ ]);
48
+ /** `(a = x ∨ n > 5) ∧ (n < 100)` on `c` — the `or` connective inside groups, `and` between them. */
49
+ const OR_DEFINITION = fixtureDefinition([
50
+ {
51
+ id: 's1',
52
+ columns: 1,
53
+ fields: [
54
+ { id: 'fa', type: 'text', key: 'a' },
55
+ { id: 'fn', type: 'number', key: 'n' },
56
+ {
57
+ id: 'fc',
58
+ type: 'text',
59
+ key: 'c',
60
+ visibility: {
61
+ connective: 'or',
62
+ groups: [
63
+ [
64
+ { fieldId: 'fa', operator: 'equals', value: 'x' },
65
+ { fieldId: 'fn', operator: 'greater_than', value: 5 },
66
+ ],
67
+ [{ fieldId: 'fn', operator: 'less_than', value: 100 }],
68
+ ],
69
+ },
70
+ },
71
+ ],
72
+ },
73
+ ]);
74
+ /** A section shown only when `a` is `show`; its fields go with it. */
75
+ const SECTION_RULE_DEFINITION = fixtureDefinition([
76
+ { id: 's1', columns: 1, fields: [{ id: 'fa', type: 'radio', key: 'a', options: [
77
+ { id: 'o1', value: 'show' },
78
+ { id: 'o2', value: 'hide' },
79
+ ] }] },
80
+ {
81
+ id: 's2',
82
+ columns: 2,
83
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fa', operator: 'equals', value: 'show' }]] },
84
+ fields: [
85
+ { id: 'fd', type: 'text', key: 'd' },
86
+ { id: 'fe', type: 'email', key: 'e' },
87
+ ],
88
+ },
89
+ ]);
90
+ /** `b` shown when `a` is `x`; `c` shown when `b` is empty; `g` shown when `b` is not `filled`. */
91
+ const HIDDEN_AS_EMPTY_FIELDS = [
92
+ { id: 'fa', type: 'text', key: 'a' },
93
+ {
94
+ id: 'fb',
95
+ type: 'text',
96
+ key: 'b',
97
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fa', operator: 'equals', value: 'x' }]] },
98
+ },
99
+ {
100
+ id: 'fc',
101
+ type: 'text',
102
+ key: 'c',
103
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fb', operator: 'is_empty' }]] },
104
+ },
105
+ {
106
+ id: 'fg',
107
+ type: 'text',
108
+ key: 'g',
109
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fb', operator: 'not_equals', value: 'filled' }]] },
110
+ },
111
+ ];
112
+ const HIDDEN_AS_EMPTY_DEFINITION = fixtureDefinition([
113
+ { id: 's1', columns: 1, fields: [...HIDDEN_AS_EMPTY_FIELDS] },
114
+ ]);
115
+ /** The same rules with the dependants written **before** what they depend on (B4). */
116
+ const HIDDEN_AS_EMPTY_REVERSED = fixtureDefinition([
117
+ { id: 's1', columns: 1, fields: [...HIDDEN_AS_EMPTY_FIELDS].reverse() },
118
+ ]);
119
+ /** `a` and `b` each shown only when the other is filled — a cycle `definitionIssues` refuses. */
120
+ const CYCLE_DEFINITION = fixtureDefinition([
121
+ {
122
+ id: 's1',
123
+ columns: 1,
124
+ fields: [
125
+ {
126
+ id: 'fa',
127
+ type: 'text',
128
+ key: 'a',
129
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fb', operator: 'is_not_empty' }]] },
130
+ },
131
+ {
132
+ id: 'fb',
133
+ type: 'text',
134
+ key: 'b',
135
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fa', operator: 'is_not_empty' }]] },
136
+ },
137
+ { id: 'fz', type: 'text', key: 'z' },
138
+ ],
139
+ },
140
+ ]);
141
+ /** A checkbox group, a single checkbox and a date, each driving a field. */
142
+ const TYPED_CONDITIONS_DEFINITION = fixtureDefinition([
143
+ {
144
+ id: 's1',
145
+ columns: 1,
146
+ fields: [
147
+ {
148
+ id: 'ftopics',
149
+ type: 'checkboxes',
150
+ key: 'topics',
151
+ options: [
152
+ { id: 'o1', value: 'sales' },
153
+ { id: 'o2', value: 'support' },
154
+ ],
155
+ },
156
+ {
157
+ id: 'fsupport',
158
+ type: 'textarea',
159
+ key: 'support_detail',
160
+ visibility: {
161
+ connective: 'and',
162
+ groups: [[{ fieldId: 'ftopics', operator: 'contains', value: 'support' }]],
163
+ },
164
+ },
165
+ { id: 'fagree', type: 'checkbox', key: 'company' },
166
+ {
167
+ id: 'fvat',
168
+ type: 'text',
169
+ key: 'vat',
170
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fagree', operator: 'equals', value: 'true' }]] },
171
+ },
172
+ { id: 'fdate', type: 'datetime', key: 'visit', mode: 'date' },
173
+ {
174
+ id: 'flate',
175
+ type: 'text',
176
+ key: 'late_reason',
177
+ visibility: {
178
+ connective: 'and',
179
+ groups: [[{ fieldId: 'fdate', operator: 'greater_than', value: '2026-12-01' }]],
180
+ },
181
+ },
182
+ ],
183
+ },
184
+ ]);
185
+ export const FORMS_VISIBILITY_FIXTURES = [
186
+ {
187
+ name: 'and inside a group, or between groups: first group holds',
188
+ behaviour: 'FR-030',
189
+ definition: AND_DEFINITION,
190
+ answers: { a: 'x', b: 'y' },
191
+ expected: { sections: ['s1'], fields: ['fa', 'fb', 'fc'] },
192
+ },
193
+ {
194
+ name: 'and inside a group, or between groups: half of the first group holds',
195
+ behaviour: 'FR-030',
196
+ definition: AND_DEFINITION,
197
+ answers: { a: 'x', b: 'n' },
198
+ expected: { sections: ['s1'], fields: ['fa', 'fb'] },
199
+ },
200
+ {
201
+ name: 'and inside a group, or between groups: the second group holds alone',
202
+ behaviour: 'FR-030',
203
+ definition: AND_DEFINITION,
204
+ answers: { a: 'z' },
205
+ expected: { sections: ['s1'], fields: ['fa', 'fb', 'fc'] },
206
+ },
207
+ {
208
+ name: 'or inside a group, and between groups: a coerced number satisfies both groups',
209
+ behaviour: 'FR-030, B2',
210
+ definition: OR_DEFINITION,
211
+ answers: { a: 'no', n: '10' },
212
+ expected: { sections: ['s1'], fields: ['fa', 'fn', 'fc'] },
213
+ },
214
+ {
215
+ name: 'or inside a group, and between groups: the second group fails',
216
+ behaviour: 'FR-030, B2',
217
+ definition: OR_DEFINITION,
218
+ answers: { a: 'x', n: '150' },
219
+ expected: { sections: ['s1'], fields: ['fa', 'fn'] },
220
+ },
221
+ {
222
+ name: 'or inside a group: a comma decimal is a number',
223
+ behaviour: 'B2, B5',
224
+ definition: OR_DEFINITION,
225
+ answers: { a: 'no', n: '5,5' },
226
+ expected: { sections: ['s1'], fields: ['fa', 'fn', 'fc'] },
227
+ },
228
+ {
229
+ name: 'a section rule shows the section and its fields',
230
+ behaviour: 'US3-2',
231
+ definition: SECTION_RULE_DEFINITION,
232
+ answers: { a: 'show' },
233
+ expected: { sections: ['s1', 's2'], fields: ['fa', 'fd', 'fe'] },
234
+ },
235
+ {
236
+ name: 'a section rule hides the section and every field in it',
237
+ behaviour: 'US3-2',
238
+ definition: SECTION_RULE_DEFINITION,
239
+ answers: { a: 'hide', d: 'typed anyway' },
240
+ expected: { sections: ['s1'], fields: ['fa'] },
241
+ },
242
+ {
243
+ name: 'a hidden field counts as empty in a dependent condition',
244
+ behaviour: 'B3, US3-6',
245
+ definition: HIDDEN_AS_EMPTY_DEFINITION,
246
+ answers: { a: 'no', b: 'filled' },
247
+ expected: { sections: ['s1'], fields: ['fa', 'fc', 'fg'] },
248
+ },
249
+ {
250
+ name: 'a visible filled field is not empty',
251
+ behaviour: 'B3',
252
+ definition: HIDDEN_AS_EMPTY_DEFINITION,
253
+ answers: { a: 'x', b: 'filled' },
254
+ expected: { sections: ['s1'], fields: ['fa', 'fb'] },
255
+ },
256
+ {
257
+ name: 'order independence: dependants written first evaluate the same',
258
+ behaviour: 'B4',
259
+ definition: HIDDEN_AS_EMPTY_REVERSED,
260
+ answers: { a: 'no', b: 'filled' },
261
+ expected: { sections: ['s1'], fields: ['fa', 'fc', 'fg'] },
262
+ },
263
+ {
264
+ name: 'a cycle evaluates as hidden, defensively',
265
+ behaviour: 'B4',
266
+ definition: CYCLE_DEFINITION,
267
+ answers: { a: 'one', b: 'two' },
268
+ expected: { sections: ['s1'], fields: ['fz'] },
269
+ },
270
+ {
271
+ name: 'contains on a checkbox group, equals true on a checkbox, greater than on a date',
272
+ behaviour: 'R-6',
273
+ definition: TYPED_CONDITIONS_DEFINITION,
274
+ answers: { topics: ['support'], company: 'on', visit: '2026-12-24' },
275
+ expected: { sections: ['s1'], fields: ['ftopics', 'fsupport', 'fagree', 'fvat', 'fdate', 'flate'] },
276
+ },
277
+ {
278
+ name: 'an unticked checkbox and an earlier date hide their dependants',
279
+ behaviour: 'R-6',
280
+ definition: TYPED_CONDITIONS_DEFINITION,
281
+ answers: { topics: ['sales'], visit: '2026-11-15' },
282
+ expected: { sections: ['s1'], fields: ['ftopics', 'fagree', 'fdate'] },
283
+ },
284
+ ];
285
+ /** One field of every input type that validates, for the submission cases. */
286
+ const EVERY_TYPE_DEFINITION = fixtureDefinition([
287
+ {
288
+ id: 's1',
289
+ columns: 3,
290
+ fields: [
291
+ { id: 'f1', type: 'text', key: 'name', required: true, minLength: 2, maxLength: 40 },
292
+ { id: 'f2', type: 'email', key: 'email', required: true, submitterEmail: true },
293
+ { id: 'f3', type: 'phone', key: 'phone' },
294
+ { id: 'f4', type: 'number', key: 'quantity', min: 1, max: 10, step: 0.5 },
295
+ { id: 'f5', type: 'textarea', key: 'message', maxLength: 200 },
296
+ {
297
+ id: 'f6',
298
+ type: 'select',
299
+ key: 'topic',
300
+ options: [
301
+ { id: 'o1', value: 'sales' },
302
+ { id: 'o2', value: 'support' },
303
+ ],
304
+ },
305
+ {
306
+ id: 'f7',
307
+ type: 'radio',
308
+ key: 'contact_by',
309
+ options: [
310
+ { id: 'o1', value: 'email' },
311
+ { id: 'o2', value: 'phone' },
312
+ ],
313
+ },
314
+ {
315
+ id: 'f8',
316
+ type: 'checkboxes',
317
+ key: 'interests',
318
+ minSelected: 1,
319
+ maxSelected: 2,
320
+ options: [
321
+ { id: 'o1', value: 'doors' },
322
+ { id: 'o2', value: 'windows' },
323
+ { id: 'o3', value: 'gates' },
324
+ ],
325
+ },
326
+ { id: 'f9', type: 'checkbox', key: 'company' },
327
+ { id: 'f10', type: 'datetime', key: 'visit', mode: 'date', earliest: '2026-01-01', latest: '2026-12-31' },
328
+ { id: 'f11', type: 'country', key: 'country', allowedCountries: ['PL', 'DE'] },
329
+ { id: 'f12', type: 'address', key: 'address', parts: ADDRESS_PARTS },
330
+ { id: 'f13', type: 'hidden', key: 'campaign', source: 'query_param', paramName: 'utm_campaign' },
331
+ { id: 'f14', type: 'privacy_consent', key: 'privacy', required: true },
332
+ { id: 'f15', type: 'marketing_consent', key: 'marketing' },
333
+ { id: 'f16', type: 'terms', key: 'terms', required: true },
334
+ { id: 'f17', type: 'content' },
335
+ { id: 'f18', type: 'section_break' },
336
+ ],
337
+ },
338
+ ]);
339
+ const EVERY_TYPE_VALID_RAW = {
340
+ name: ' Ann Smith ',
341
+ email: ' Ann@Example.COM ',
342
+ phone: '+48 600 100 200',
343
+ quantity: '2,5',
344
+ message: 'Line one\nLine two',
345
+ topic: 'support',
346
+ contact_by: 'email',
347
+ interests: ['doors', 'gates'],
348
+ company: 'on',
349
+ visit: '2026-06-30',
350
+ country: 'pl',
351
+ 'address.street': 'Main 1',
352
+ 'address.postalCode': '00-001',
353
+ 'address.city': 'Warsaw',
354
+ 'address.country': 'PL',
355
+ campaign: 'autumn',
356
+ privacy: 'on',
357
+ terms: 'true',
358
+ };
359
+ /** The patterns, and a hidden value over the cap. */
360
+ const PATTERN_DEFINITION = fixtureDefinition([
361
+ {
362
+ id: 's1',
363
+ columns: 1,
364
+ fields: [
365
+ { id: 'p1', type: 'text', key: 'digits', pattern: 'digits' },
366
+ { id: 'p2', type: 'text', key: 'letters', pattern: 'letters' },
367
+ { id: 'p3', type: 'text', key: 'alnum', pattern: 'alphanumeric' },
368
+ { id: 'p4', type: 'text', key: 'site', pattern: 'url' },
369
+ { id: 'p5', type: 'hidden', key: 'page', source: 'page_url' },
370
+ ],
371
+ },
372
+ ]);
373
+ /** A required field behind a rule, for B2/B3 at the server. */
374
+ const CONDITIONAL_REQUIRED_DEFINITION = fixtureDefinition([
375
+ {
376
+ id: 's1',
377
+ columns: 1,
378
+ fields: [
379
+ {
380
+ id: 'fa',
381
+ type: 'radio',
382
+ key: 'kind',
383
+ required: true,
384
+ options: [
385
+ { id: 'o1', value: 'person' },
386
+ { id: 'o2', value: 'company' },
387
+ ],
388
+ },
389
+ {
390
+ id: 'fb',
391
+ type: 'text',
392
+ key: 'company_name',
393
+ required: true,
394
+ visibility: { connective: 'and', groups: [[{ fieldId: 'fa', operator: 'equals', value: 'company' }]] },
395
+ },
396
+ ],
397
+ },
398
+ ]);
399
+ export const FORMS_SUBMISSION_FIXTURES = [
400
+ {
401
+ name: 'every input type, valid, normalised',
402
+ behaviour: 'B1, B5, B10, B11',
403
+ definition: EVERY_TYPE_DEFINITION,
404
+ raw: { ...EVERY_TYPE_VALID_RAW, bogus: 'ignored' },
405
+ knownCountries: ['PL', 'DE', 'FR'],
406
+ expected: {
407
+ ok: true,
408
+ answers: {
409
+ name: 'Ann Smith',
410
+ email: 'ann@example.com',
411
+ phone: '+48 600 100 200',
412
+ quantity: 2.5,
413
+ message: 'Line one\nLine two',
414
+ topic: 'support',
415
+ contact_by: 'email',
416
+ interests: ['doors', 'gates'],
417
+ company: true,
418
+ visit: '2026-06-30',
419
+ country: 'PL',
420
+ address: { street: 'Main 1', postalCode: '00-001', city: 'Warsaw', country: 'PL' },
421
+ campaign: 'autumn',
422
+ privacy: true,
423
+ marketing: false,
424
+ terms: true,
425
+ },
426
+ consents: [
427
+ { fieldKey: 'privacy', kind: 'privacy', given: true },
428
+ { fieldKey: 'marketing', kind: 'marketing', given: false },
429
+ { fieldKey: 'terms', kind: 'terms', given: true },
430
+ ],
431
+ },
432
+ },
433
+ {
434
+ // An empty optional field skips every check (`minSelected` included); an optional address with
435
+ // no part typed is skipped as a whole — its parts' `required` binds once any part is typed.
436
+ name: 'empty optional fields are not stored; required ones and the consents are refused',
437
+ behaviour: 'B6',
438
+ definition: EVERY_TYPE_DEFINITION,
439
+ raw: { name: ' ', email: '' },
440
+ knownCountries: ['PL'],
441
+ expected: {
442
+ ok: false,
443
+ errors: [
444
+ { fieldKey: 'name', code: 'required' },
445
+ { fieldKey: 'email', code: 'required' },
446
+ { fieldKey: 'privacy', code: 'consent_required' },
447
+ { fieldKey: 'terms', code: 'consent_required' },
448
+ ],
449
+ },
450
+ },
451
+ {
452
+ name: 'coercion and limits refuse each malformed value with its own code',
453
+ behaviour: 'B5, B7, B8, B10',
454
+ definition: EVERY_TYPE_DEFINITION,
455
+ raw: {
456
+ ...EVERY_TYPE_VALID_RAW,
457
+ name: 'A',
458
+ email: 'not-an-address',
459
+ phone: '12',
460
+ quantity: '1,2',
461
+ message: 'x'.repeat(201),
462
+ topic: 'billing',
463
+ contact_by: 'fax',
464
+ interests: ['doors', 'windows', 'gates'],
465
+ visit: '2026-02-31',
466
+ country: 'FR',
467
+ 'address.country': 'XX',
468
+ },
469
+ knownCountries: ['PL', 'DE', 'FR'],
470
+ expected: {
471
+ ok: false,
472
+ errors: [
473
+ { fieldKey: 'name', code: 'too_short' },
474
+ { fieldKey: 'email', code: 'invalid_email' },
475
+ { fieldKey: 'phone', code: 'invalid_phone' },
476
+ { fieldKey: 'quantity', code: 'step_mismatch' },
477
+ { fieldKey: 'message', code: 'too_long' },
478
+ { fieldKey: 'topic', code: 'unknown_option' },
479
+ { fieldKey: 'contact_by', code: 'unknown_option' },
480
+ { fieldKey: 'interests', code: 'too_many' },
481
+ { fieldKey: 'visit', code: 'invalid_date' },
482
+ { fieldKey: 'country', code: 'invalid_country' },
483
+ { fieldKey: 'address.country', code: 'invalid_country' },
484
+ ],
485
+ },
486
+ },
487
+ {
488
+ name: 'bounds: below the minimum, above the maximum, too early, a line break in a single line',
489
+ behaviour: 'B5, B7',
490
+ definition: EVERY_TYPE_DEFINITION,
491
+ raw: {
492
+ ...EVERY_TYPE_VALID_RAW,
493
+ name: 'Ann\nSmith',
494
+ quantity: '0.5',
495
+ visit: '2025-12-31',
496
+ country: 'DE',
497
+ },
498
+ knownCountries: ['PL'],
499
+ expected: {
500
+ ok: false,
501
+ errors: [
502
+ { fieldKey: 'name', code: 'single_line' },
503
+ { fieldKey: 'quantity', code: 'below_min' },
504
+ { fieldKey: 'visit', code: 'too_early' },
505
+ { fieldKey: 'country', code: 'invalid_country' },
506
+ ],
507
+ },
508
+ },
509
+ {
510
+ name: 'above the maximum, too late, not a number',
511
+ behaviour: 'B5, B7',
512
+ definition: EVERY_TYPE_DEFINITION,
513
+ raw: { ...EVERY_TYPE_VALID_RAW, quantity: '11', visit: '2027-01-01', phone: 'call me' },
514
+ knownCountries: ['PL', 'DE'],
515
+ expected: {
516
+ ok: false,
517
+ errors: [
518
+ { fieldKey: 'phone', code: 'invalid_phone' },
519
+ { fieldKey: 'quantity', code: 'above_max' },
520
+ { fieldKey: 'visit', code: 'too_late' },
521
+ ],
522
+ },
523
+ },
524
+ {
525
+ name: 'an address with one part typed requires its required parts',
526
+ behaviour: 'B6',
527
+ definition: EVERY_TYPE_DEFINITION,
528
+ raw: {
529
+ ...EVERY_TYPE_VALID_RAW,
530
+ 'address.street': '',
531
+ 'address.city': ' ',
532
+ 'address.line2': 'ignored: the part is not enabled',
533
+ },
534
+ knownCountries: ['PL', 'DE'],
535
+ expected: {
536
+ ok: false,
537
+ errors: [
538
+ { fieldKey: 'address.street', code: 'required' },
539
+ { fieldKey: 'address.city', code: 'required' },
540
+ ],
541
+ },
542
+ },
543
+ {
544
+ name: 'a number that is not one',
545
+ behaviour: 'B5',
546
+ definition: EVERY_TYPE_DEFINITION,
547
+ raw: { ...EVERY_TYPE_VALID_RAW, quantity: 'two' },
548
+ knownCountries: ['PL'],
549
+ expected: { ok: false, errors: [{ fieldKey: 'quantity', code: 'invalid_number' }] },
550
+ },
551
+ {
552
+ name: 'patterns refuse; a hidden value over the cap is truncated, not refused',
553
+ behaviour: 'B7, B9',
554
+ definition: PATTERN_DEFINITION,
555
+ raw: { digits: '12a', letters: 'Zażółć1', alnum: 'abc-1', site: 'ftp://example.com', page: 'x'.repeat(1200) },
556
+ knownCountries: [],
557
+ expected: {
558
+ ok: false,
559
+ errors: [
560
+ { fieldKey: 'digits', code: 'pattern' },
561
+ { fieldKey: 'letters', code: 'pattern' },
562
+ { fieldKey: 'alnum', code: 'pattern' },
563
+ { fieldKey: 'site', code: 'pattern' },
564
+ ],
565
+ },
566
+ },
567
+ {
568
+ name: 'patterns accept Unicode letters and an absolute https address',
569
+ behaviour: 'B7, B9',
570
+ definition: PATTERN_DEFINITION,
571
+ raw: { digits: '0042', letters: 'Zażółć', alnum: 'Gęś42', site: 'https://example.com/a?b=1', page: 'x'.repeat(1200) },
572
+ knownCountries: [],
573
+ expected: {
574
+ ok: true,
575
+ answers: {
576
+ digits: '0042',
577
+ letters: 'Zażółć',
578
+ alnum: 'Gęś42',
579
+ site: 'https://example.com/a?b=1',
580
+ page: 'x'.repeat(1000),
581
+ },
582
+ consents: [],
583
+ },
584
+ },
585
+ {
586
+ name: 'a value posted for a hidden field is dropped; a hidden required field is not required',
587
+ behaviour: 'B2, B3, US3-3',
588
+ definition: CONDITIONAL_REQUIRED_DEFINITION,
589
+ raw: { kind: 'person', company_name: 'Smuggled Ltd' },
590
+ knownCountries: [],
591
+ expected: { ok: true, answers: { kind: 'person' }, consents: [] },
592
+ },
593
+ {
594
+ name: 'a required field becomes required once its rule shows it',
595
+ behaviour: 'B6',
596
+ definition: CONDITIONAL_REQUIRED_DEFINITION,
597
+ raw: { kind: 'company' },
598
+ knownCountries: [],
599
+ expected: { ok: false, errors: [{ fieldKey: 'company_name', code: 'required' }] },
600
+ },
601
+ {
602
+ name: 'a section rule drops the values of every field in it',
603
+ behaviour: 'B2, US3-2',
604
+ definition: SECTION_RULE_DEFINITION,
605
+ raw: { a: 'hide', d: 'typed anyway', e: 'x@example.com' },
606
+ knownCountries: [],
607
+ expected: { ok: true, answers: { a: 'hide' }, consents: [] },
608
+ },
609
+ ];
610
+ //# sourceMappingURL=forms-logic.fixtures.js.map