@sixtyninecommerce/admin 0.10.0 → 0.12.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 (302) hide show
  1. package/README.md +5772 -118
  2. package/dist/auth/index.d.ts +7 -1
  3. package/dist/auth/index.js +8 -1
  4. package/dist/catalog/assets.d.ts +120 -8
  5. package/dist/catalog/assets.js +98 -12
  6. package/dist/catalog/collections.d.ts +279 -14
  7. package/dist/catalog/collections.js +246 -15
  8. package/dist/catalog/documents.d.ts +142 -0
  9. package/dist/catalog/documents.js +114 -0
  10. package/dist/catalog/index.d.ts +54 -6
  11. package/dist/catalog/index.js +10 -1
  12. package/dist/catalog/metadata.d.ts +244 -0
  13. package/dist/catalog/metadata.js +220 -0
  14. package/dist/catalog/products.d.ts +159 -19
  15. package/dist/catalog/products.js +88 -13
  16. package/dist/catalog/properties.d.ts +140 -14
  17. package/dist/catalog/properties.js +65 -1
  18. package/dist/catalog/recommendations.d.ts +288 -0
  19. package/dist/catalog/recommendations.js +237 -0
  20. package/dist/catalog/reviews.d.ts +381 -0
  21. package/dist/catalog/reviews.js +325 -0
  22. package/dist/catalog/types.d.ts +17 -1
  23. package/dist/catalog/types.js +10 -0
  24. package/dist/catalog/variant-find.d.ts +136 -0
  25. package/dist/catalog/variant-find.js +239 -0
  26. package/dist/catalog/variants.d.ts +293 -26
  27. package/dist/catalog/variants.js +164 -7
  28. package/dist/catalog/visibility.d.ts +38 -7
  29. package/dist/catalog/visibility.js +19 -1
  30. package/dist/client.d.ts +121 -9
  31. package/dist/client.js +53 -14
  32. package/dist/content/assets.d.ts +285 -0
  33. package/dist/content/assets.js +181 -0
  34. package/dist/content/forms.d.ts +332 -1
  35. package/dist/content/forms.js +140 -4
  36. package/dist/content/items.d.ts +292 -0
  37. package/dist/content/items.js +170 -0
  38. package/dist/content/menus.d.ts +254 -0
  39. package/dist/content/menus.js +70 -0
  40. package/dist/content/strings.d.ts +137 -0
  41. package/dist/content/strings.js +82 -0
  42. package/dist/content/types.d.ts +282 -0
  43. package/dist/content/types.js +100 -0
  44. package/dist/customers/age-verification.d.ts +66 -0
  45. package/dist/customers/age-verification.js +79 -0
  46. package/dist/customers/credit.d.ts +263 -0
  47. package/dist/customers/credit.js +244 -0
  48. package/dist/customers/delivery-preferences.d.ts +120 -0
  49. package/dist/customers/delivery-preferences.js +97 -0
  50. package/dist/customers/delivery-terms.d.ts +44 -0
  51. package/dist/customers/delivery-terms.js +32 -0
  52. package/dist/customers/groups.d.ts +207 -0
  53. package/dist/customers/groups.js +438 -0
  54. package/dist/customers/index.d.ts +462 -37
  55. package/dist/customers/index.js +317 -40
  56. package/dist/customers/invitation-status.d.ts +57 -0
  57. package/dist/customers/invitation-status.js +21 -0
  58. package/dist/customers/notes.d.ts +67 -0
  59. package/dist/customers/notes.js +51 -0
  60. package/dist/customers/notification-recipients.d.ts +97 -0
  61. package/dist/customers/notification-recipients.js +84 -0
  62. package/dist/customers/saved-lists.d.ts +42 -0
  63. package/dist/customers/saved-lists.js +61 -0
  64. package/dist/customers/vat.d.ts +83 -0
  65. package/dist/customers/vat.js +46 -0
  66. package/dist/customers/wire.d.ts +20 -0
  67. package/dist/customers/wire.js +35 -0
  68. package/dist/documents/ar.d.ts +307 -0
  69. package/dist/documents/ar.js +254 -0
  70. package/dist/documents/emails.d.ts +150 -0
  71. package/dist/documents/emails.js +220 -0
  72. package/dist/documents/index.d.ts +744 -21
  73. package/dist/documents/index.js +438 -24
  74. package/dist/documents/pdf.d.ts +2 -0
  75. package/dist/documents/pdf.js +11 -0
  76. package/dist/fulfillments/create.d.ts +167 -0
  77. package/dist/fulfillments/create.js +216 -0
  78. package/dist/fulfillments/index.d.ts +163 -11
  79. package/dist/fulfillments/index.js +135 -6
  80. package/dist/fulfillments/payment-policy.d.ts +64 -0
  81. package/dist/fulfillments/payment-policy.js +140 -0
  82. package/dist/fulfillments/warehouse.d.ts +724 -0
  83. package/dist/fulfillments/warehouse.js +914 -0
  84. package/dist/geo/index.d.ts +119 -0
  85. package/dist/geo/index.js +107 -0
  86. package/dist/index.d.ts +147 -39
  87. package/dist/index.js +51 -12
  88. package/dist/integrations/afas-actions.d.ts +234 -0
  89. package/dist/integrations/afas-actions.js +310 -0
  90. package/dist/integrations/afas-types.d.ts +483 -0
  91. package/dist/integrations/afas-types.js +5 -0
  92. package/dist/integrations/afas.d.ts +234 -0
  93. package/dist/integrations/afas.js +290 -0
  94. package/dist/integrations/connections.d.ts +103 -0
  95. package/dist/integrations/connections.js +55 -0
  96. package/dist/integrations/esp.d.ts +313 -0
  97. package/dist/integrations/esp.js +169 -0
  98. package/dist/integrations/exact-online-types.d.ts +965 -0
  99. package/dist/integrations/exact-online-types.js +6 -0
  100. package/dist/integrations/exact-online.d.ts +784 -0
  101. package/dist/integrations/exact-online.js +1089 -0
  102. package/dist/integrations/index.d.ts +44 -3
  103. package/dist/integrations/index.js +23 -3
  104. package/dist/integrations/pipeline-discoveries.d.ts +65 -0
  105. package/dist/integrations/pipeline-discoveries.js +65 -0
  106. package/dist/integrations/pipeline-keys.d.ts +13 -0
  107. package/dist/integrations/pipeline-keys.js +22 -0
  108. package/dist/integrations/pipeline-runs.d.ts +119 -0
  109. package/dist/integrations/pipeline-runs.js +87 -0
  110. package/dist/integrations/pipelines.d.ts +87 -15
  111. package/dist/integrations/pipelines.js +41 -22
  112. package/dist/integrations/price-import.d.ts +223 -0
  113. package/dist/integrations/price-import.js +124 -0
  114. package/dist/integrations/types.d.ts +367 -3
  115. package/dist/integrations/types.js +4 -3
  116. package/dist/locations/index.d.ts +66 -0
  117. package/dist/locations/index.js +31 -0
  118. package/dist/meta/index.d.ts +172 -0
  119. package/dist/metafields/index.d.ts +8 -1
  120. package/dist/metafields/index.js +10 -0
  121. package/dist/orders/cancel-with-money.d.ts +237 -0
  122. package/dist/orders/cancel-with-money.js +155 -0
  123. package/dist/orders/commit-edit.d.ts +23 -1
  124. package/dist/orders/commit-edit.js +19 -2
  125. package/dist/orders/deposit-policy.d.ts +3 -1
  126. package/dist/orders/drafts.d.ts +800 -0
  127. package/dist/orders/drafts.js +771 -0
  128. package/dist/orders/fields.d.ts +245 -0
  129. package/dist/orders/fields.js +188 -0
  130. package/dist/orders/get.d.ts +29 -19
  131. package/dist/orders/get.js +17 -8
  132. package/dist/orders/index.d.ts +66 -15
  133. package/dist/orders/index.js +25 -2
  134. package/dist/orders/lifecycle.d.ts +128 -0
  135. package/dist/orders/lifecycle.js +158 -0
  136. package/dist/orders/line-price-preview.d.ts +7 -2
  137. package/dist/orders/list.d.ts +243 -0
  138. package/dist/orders/list.js +487 -0
  139. package/dist/orders/manual-discounts.d.ts +13 -5
  140. package/dist/orders/manual-pricing.d.ts +5 -0
  141. package/dist/orders/money-view.d.ts +149 -0
  142. package/dist/orders/money-view.js +99 -0
  143. package/dist/orders/order-entry.d.ts +20 -7
  144. package/dist/orders/plan-edit.d.ts +34 -2
  145. package/dist/orders/plan-edit.js +112 -11
  146. package/dist/orders/settings.d.ts +201 -0
  147. package/dist/orders/settings.js +325 -0
  148. package/dist/orders/status.d.ts +159 -13
  149. package/dist/orders/status.js +21 -0
  150. package/dist/orders/surcharges.d.ts +20 -1
  151. package/dist/orders/surcharges.js +37 -11
  152. package/dist/payments/account-credit.d.ts +46 -0
  153. package/dist/payments/account-credit.js +42 -0
  154. package/dist/payments/ar.d.ts +292 -0
  155. package/dist/payments/ar.js +223 -0
  156. package/dist/payments/connected-account.d.ts +47 -0
  157. package/dist/payments/connected-account.js +61 -0
  158. package/dist/payments/credit-noted-fields.d.ts +19 -0
  159. package/dist/payments/credit-noted-fields.js +69 -0
  160. package/dist/payments/customer-consent.d.ts +30 -0
  161. package/dist/payments/customer-consent.js +49 -0
  162. package/dist/payments/index.d.ts +340 -19
  163. package/dist/payments/index.js +151 -1
  164. package/dist/payments/methods.d.ts +303 -8
  165. package/dist/payments/methods.js +337 -7
  166. package/dist/payments/mollie-methods.d.ts +159 -0
  167. package/dist/payments/mollie-methods.js +141 -0
  168. package/dist/payments/payment-links.d.ts +180 -0
  169. package/dist/payments/payment-links.js +97 -0
  170. package/dist/payments/provider-keys.d.ts +150 -0
  171. package/dist/payments/provider-keys.js +118 -0
  172. package/dist/payments/providers.d.ts +86 -11
  173. package/dist/payments/providers.js +29 -0
  174. package/dist/payments/requests.d.ts +147 -0
  175. package/dist/payments/requests.js +93 -0
  176. package/dist/payments/store-credit-fields.d.ts +15 -0
  177. package/dist/payments/store-credit-fields.js +51 -0
  178. package/dist/pickups/index.d.ts +106 -0
  179. package/dist/pickups/index.js +108 -0
  180. package/dist/platform/channels.d.ts +132 -0
  181. package/dist/platform/channels.js +128 -0
  182. package/dist/platform/email-gateways.d.ts +165 -0
  183. package/dist/platform/email-gateways.js +78 -0
  184. package/dist/platform/geo.d.ts +123 -0
  185. package/dist/platform/geo.js +144 -0
  186. package/dist/platform/tax.d.ts +162 -0
  187. package/dist/platform/tax.js +169 -0
  188. package/dist/pos/anomalies.d.ts +158 -0
  189. package/dist/pos/anomalies.js +64 -0
  190. package/dist/pos/assisted-selling.d.ts +79 -0
  191. package/dist/pos/assisted-selling.js +38 -0
  192. package/dist/pos/exchanges.d.ts +108 -0
  193. package/dist/pos/exchanges.js +22 -0
  194. package/dist/pos/gift-cards.d.ts +135 -0
  195. package/dist/pos/gift-cards.js +47 -0
  196. package/dist/pos/index.d.ts +2370 -58
  197. package/dist/pos/index.js +854 -7
  198. package/dist/pos/no-receipt.d.ts +94 -0
  199. package/dist/pos/no-receipt.js +25 -0
  200. package/dist/pos/offline-sales.d.ts +228 -0
  201. package/dist/pos/offline-sales.js +170 -0
  202. package/dist/pos/pay-by-link.d.ts +143 -0
  203. package/dist/pos/pay-by-link.js +57 -0
  204. package/dist/pos/quick-keys.d.ts +103 -0
  205. package/dist/pos/quick-keys.js +45 -0
  206. package/dist/pos/reports.d.ts +360 -0
  207. package/dist/pos/reports.js +62 -0
  208. package/dist/pos/returns.d.ts +244 -0
  209. package/dist/pos/returns.js +83 -0
  210. package/dist/pricing/bulk-coupons.d.ts +139 -0
  211. package/dist/pricing/bulk-coupons.js +112 -0
  212. package/dist/pricing/index.d.ts +174 -4
  213. package/dist/pricing/index.js +174 -1
  214. package/dist/pricing/price-lists.d.ts +606 -0
  215. package/dist/pricing/price-lists.js +600 -0
  216. package/dist/purchasing/alerts.d.ts +104 -0
  217. package/dist/purchasing/alerts.js +88 -0
  218. package/dist/purchasing/backorders.d.ts +61 -0
  219. package/dist/purchasing/backorders.js +92 -0
  220. package/dist/purchasing/cost.d.ts +110 -0
  221. package/dist/purchasing/cost.js +86 -0
  222. package/dist/purchasing/index.d.ts +54 -0
  223. package/dist/purchasing/index.js +24 -0
  224. package/dist/purchasing/links.d.ts +263 -0
  225. package/dist/purchasing/links.js +192 -0
  226. package/dist/purchasing/purchase-orders.d.ts +551 -0
  227. package/dist/purchasing/purchase-orders.js +491 -0
  228. package/dist/purchasing/receipts.d.ts +396 -0
  229. package/dist/purchasing/receipts.js +287 -0
  230. package/dist/purchasing/replenishment.d.ts +281 -0
  231. package/dist/purchasing/replenishment.js +240 -0
  232. package/dist/purchasing/returns.d.ts +273 -0
  233. package/dist/purchasing/returns.js +229 -0
  234. package/dist/purchasing/settings.d.ts +152 -0
  235. package/dist/purchasing/settings.js +181 -0
  236. package/dist/purchasing/suppliers.d.ts +476 -0
  237. package/dist/purchasing/suppliers.js +438 -0
  238. package/dist/quotes/index.d.ts +518 -0
  239. package/dist/quotes/index.js +439 -0
  240. package/dist/reports/index.d.ts +71 -8
  241. package/dist/reports/index.js +74 -11
  242. package/dist/returns/index.d.ts +675 -21
  243. package/dist/returns/index.js +756 -11
  244. package/dist/search/index.d.ts +76 -1
  245. package/dist/search/index.js +63 -0
  246. package/dist/seo/config.d.ts +128 -0
  247. package/dist/seo/config.js +95 -0
  248. package/dist/seo/redirects.d.ts +125 -0
  249. package/dist/seo/redirects.js +60 -1
  250. package/dist/seo/settings.d.ts +147 -0
  251. package/dist/seo/settings.js +209 -0
  252. package/dist/shipping/definitions.d.ts +29 -0
  253. package/dist/shipping/definitions.js +47 -0
  254. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  255. package/dist/shipping/fulfillment-profiles.js +104 -0
  256. package/dist/shipping/hendriks.d.ts +97 -0
  257. package/dist/shipping/hendriks.js +50 -0
  258. package/dist/shipping/index.d.ts +54 -0
  259. package/dist/shipping/index.js +27 -0
  260. package/dist/shipping/methods.d.ts +205 -0
  261. package/dist/shipping/methods.js +240 -0
  262. package/dist/shipping/myparcel.d.ts +668 -0
  263. package/dist/shipping/myparcel.js +466 -0
  264. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  265. package/dist/shipping/parcel-rule.d.ts +6 -5
  266. package/dist/shipping/parcel-rule.js +21 -23
  267. package/dist/shipping/rate-tables.d.ts +324 -0
  268. package/dist/shipping/rate-tables.js +390 -0
  269. package/dist/shipping/ship-to-countries.d.ts +75 -0
  270. package/dist/shipping/ship-to-countries.js +47 -0
  271. package/dist/stock/by-location.d.ts +86 -0
  272. package/dist/stock/by-location.js +94 -0
  273. package/dist/stock/index.d.ts +18 -4
  274. package/dist/stock/index.js +7 -0
  275. package/dist/stock/locations.d.ts +144 -0
  276. package/dist/stock/locations.js +168 -0
  277. package/dist/stock/settings.d.ts +106 -0
  278. package/dist/stock/settings.js +103 -0
  279. package/dist/stock/transfers.d.ts +386 -52
  280. package/dist/stock/transfers.js +222 -17
  281. package/dist/stored-value/index.d.ts +312 -11
  282. package/dist/stored-value/index.js +223 -4
  283. package/dist/subscriptions/index.d.ts +682 -0
  284. package/dist/subscriptions/index.js +815 -0
  285. package/dist/tax/display-policy.d.ts +105 -0
  286. package/dist/tax/display-policy.js +84 -0
  287. package/dist/tax/index.d.ts +79 -1
  288. package/dist/tax/index.js +52 -0
  289. package/dist/tenant/email-style.d.ts +102 -0
  290. package/dist/tenant/email-style.js +72 -0
  291. package/dist/tenant/email-templates.d.ts +287 -0
  292. package/dist/tenant/email-templates.js +271 -0
  293. package/dist/tenant/notifications.d.ts +23 -17
  294. package/dist/tenant/settings-sources.d.ts +1 -1
  295. package/dist/tenant/time-zone.d.ts +17 -0
  296. package/dist/tenant/time-zone.js +11 -0
  297. package/dist/types.d.ts +50 -3
  298. package/dist/users/index.d.ts +3 -0
  299. package/dist/users/index.js +2 -0
  300. package/dist/users/warehouses.d.ts +50 -0
  301. package/dist/users/warehouses.js +51 -0
  302. package/package.json +2 -2
@@ -1,7 +1,21 @@
1
1
  import { type Page, type Transport } from '@sixtyninecommerce/core';
2
2
  import { type CatalogueOwnership } from '../catalog/types.js';
3
3
  import { type ComplianceRequest } from '../compliance/index.js';
4
+ import { type OrderListOptions, type OrderSummary, type RecentOrder, type RecentOrdersOptions } from '../orders/list.js';
4
5
  import type { Call, ListOptions } from '../types.js';
6
+ import { type CustomerAgeVerification, type CustomerDateOfBirthModule } from './age-verification.js';
7
+ import { type CustomerCreditModule } from './credit.js';
8
+ import { type CustomerDeliveryPreferencesModule } from './delivery-preferences.js';
9
+ import { type CustomerDeliveryTerms } from './delivery-terms.js';
10
+ import { type CreateCustomerGroupInput, type CustomerB2BGroupsModule, type CustomerGroup, type CustomerGroupListItem, type CustomerGroupListOptions, type CustomerGroupMembersOptions, type CustomerGroupRef, type CustomerGroupWithMembers, type UpdateCustomerGroupInput } from './groups.js';
11
+ import { type CustomerInvitationStatus } from './invitation-status.js';
12
+ import { type CustomerNotesModule } from './notes.js';
13
+ import { type CustomerNotificationRecipientsModule } from './notification-recipients.js';
14
+ import { type CustomerSavedList } from './saved-lists.js';
15
+ import { type CustomerVatModule } from './vat.js';
16
+ import { type CustomerAddressSummary } from './wire.js';
17
+ export { type CreateCustomerGroupInput, CUSTOMER_GROUP_FIELDS, CUSTOMER_GROUP_LIST_INCLUDES, CUSTOMER_GROUP_LIST_SORT_FIELDS, CUSTOMER_GROUP_QUERY, type CustomerB2BGroupsModule, type CustomerGroup, type CustomerGroupListFilter, type CustomerGroupListInclude, type CustomerGroupListItem, type CustomerGroupListOptions, type CustomerGroupListSort, type CustomerGroupListSortField, type CustomerGroupMember, type CustomerGroupMembersOptions, type CustomerGroupRef, type CustomerGroupWithMembers, MAX_CUSTOMER_GROUP_LIST_TAKE, type UpdateCustomerGroupInput, } from './groups.js';
18
+ export type { CustomerAddressSummary } from './wire.js';
5
19
  /**
6
20
  * Customers — the commerce master record (headless spec §6.5).
7
21
  *
@@ -46,9 +60,25 @@ import type { Call, ListOptions } from '../types.js';
46
60
  */
47
61
  export declare const CUSTOMER_FIELDS = "\n id\n createdAt\n updatedAt\n title\n firstName\n lastName\n emailAddress\n phoneNumber\n groups {\n id\n name\n }\n";
48
62
  export declare const CUSTOMER_ADDRESS_FIELDS = "\n id\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country {\n code\n name\n }\n phoneNumber\n defaultShippingAddress\n defaultBillingAddress\n";
49
- export declare const LIST_QUERY = "\n query Customers($options: CustomerListOptions) {\n customers(options: $options) {\n items { \n id\n createdAt\n updatedAt\n title\n firstName\n lastName\n emailAddress\n phoneNumber\n groups {\n id\n name\n }\n }\n totalItems\n }\n }\n";
50
63
  export declare const GET_QUERY = "\n query CustomerById($id: ID!) {\n customer(id: $id) { \n id\n createdAt\n updatedAt\n title\n firstName\n lastName\n emailAddress\n phoneNumber\n groups {\n id\n name\n }\n }\n }\n";
51
64
  export declare const ADDRESSES_QUERY = "\n query CustomerAddresses($id: ID!) {\n customer(id: $id) {\n id\n addresses { \n id\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country {\n code\n name\n }\n phoneNumber\n defaultShippingAddress\n defaultBillingAddress\n }\n }\n }\n";
65
+ /**
66
+ * A list row: the customer, plus what a list shows beside the name (the address book's company
67
+ * flags, for {@link CustomerListItem.company}). The order count is its own block: the engine
68
+ * counts each row's orders in a query of its own, so a list asks for it only when it shows it.
69
+ */
70
+ export declare const CUSTOMER_LIST_FIELDS = "\n \n id\n createdAt\n updatedAt\n title\n firstName\n lastName\n emailAddress\n phoneNumber\n groups {\n id\n name\n }\n\n addresses {\n company\n defaultBillingAddress\n defaultShippingAddress\n }\n";
71
+ /** The list document, with or without each row's order count. */
72
+ export declare function customerListQuery(include?: readonly CustomerListInclude[]): string;
73
+ /** How many history entries `get` reads with `include: ['history']`, newest first. */
74
+ export declare const CUSTOMER_HISTORY_TAKE = 20;
75
+ /** The plugin custom fields `include: ['customFields']` reads (AFAS, VAT validation, age check). */
76
+ export declare const CUSTOMER_PLUGIN_FIELDS = "\n afasVrId\n afasOrgId\n afasContactId\n afasPersId\n vatNumber\n vatValidationStatus\n vatValidatedAt\n vatCompanyName\n vatCompanyAddress\n dateOfBirth\n";
77
+ /**
78
+ * The document `get` sends for a set of blocks. It depends on the SET only, never on the order
79
+ * the caller listed them in. Without blocks it is {@link GET_QUERY}.
80
+ */
81
+ export declare function customerQuery(include?: readonly CustomerInclude[]): string;
52
82
  /**
53
83
  * The CHANNEL-SCOPED creation mutation. See the module docblock — core
54
84
  * `createCustomer` is not an option, and this SDK exposes no path to it.
@@ -86,9 +116,6 @@ export declare const BY_EXTERNAL_REF_QUERY = "\n query CustomerByExternalRef($s
86
116
  export declare const EXTERNAL_REFS_QUERY = "\n query CustomerExternalRefs($id: ID!) {\n customer(id: $id) {\n id\n externalRefs { \n id\n createdAt\n updatedAt\n system\n ref\n }\n }\n }\n";
87
117
  export declare const UPSERT_BY_EXTERNAL_REF_MUTATION = "\n mutation UpsertCustomerByExternalRef(\n $input: UpsertCustomerByExternalRefInput!\n $idempotencyKey: String\n ) {\n upsertCustomerByExternalRef(input: $input, idempotencyKey: $idempotencyKey) {\n customer { \n id\n createdAt\n updatedAt\n title\n firstName\n lastName\n emailAddress\n phoneNumber\n groups {\n id\n name\n }\n }\n created\n matchedByEmail\n updated\n }\n }\n";
88
118
  export declare const GROUP_BY_EXTERNAL_KEY_QUERY = "\n query CustomerGroupByExternalKey($key: String!) {\n customerGroupByExternalKey(key: $key) { \n id\n name\n externalKey\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
89
- /** A customer group as {@link CustomerGroupsModule.get} reads it. */
90
- export declare const CUSTOMER_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n name\n externalKey\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n";
91
- export declare const CUSTOMER_GROUP_QUERY = "\n query CustomerGroup($id: ID!) {\n customerGroup(id: $id) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
92
119
  export declare const GROUP_EXTERNAL_KEY_QUERY = "\n query CustomerGroupExternalKey($id: ID!) {\n customerGroup(id: $id) {\n id\n externalKey\n }\n }\n";
93
120
  export declare const UPSERT_GROUP_BY_EXTERNAL_KEY_MUTATION = "\n mutation UpsertCustomerGroupByExternalKey($key: String!, $name: String!) {\n upsertCustomerGroupByExternalKey(key: $key, name: $name) {\n customerGroup { \n id\n name\n externalKey\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n created\n renamed\n }\n }\n";
94
121
  export declare const REPLACE_GROUP_MEMBERS_MUTATION = "\n mutation ReplaceCustomerGroupMembers(\n $key: String!\n $customerExternalRefs: [CustomerExternalRefInput!]!\n $idempotencyKey: String\n ) {\n replaceCustomerGroupMembers(\n key: $key\n customerExternalRefs: $customerExternalRefs\n idempotencyKey: $idempotencyKey\n ) {\n customerGroup { \n id\n name\n externalKey\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n memberCount\n added\n removed\n unknownRefs {\n system\n ref\n }\n }\n }\n";
@@ -97,10 +124,6 @@ export declare const MAX_REPLACE_GROUP_MEMBERS = 5000;
97
124
  export declare const CREATE_ADDRESS_MUTATION = "\n mutation CreateCustomerAddress($customerId: ID!, $input: CreateAddressInput!) {\n createCustomerAddress(customerId: $customerId, input: $input) {\n \n id\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country {\n code\n name\n }\n phoneNumber\n defaultShippingAddress\n defaultBillingAddress\n\n }\n }\n";
98
125
  export declare const UPDATE_ADDRESS_MUTATION = "\n mutation UpdateCustomerAddress($input: UpdateAddressInput!) {\n updateCustomerAddress(input: $input) { \n id\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country {\n code\n name\n }\n phoneNumber\n defaultShippingAddress\n defaultBillingAddress\n }\n }\n";
99
126
  export declare const DELETE_ADDRESS_MUTATION = "\n mutation DeleteCustomerAddress($id: ID!) {\n deleteCustomerAddress(id: $id) { success }\n }\n";
100
- export interface CustomerGroupRef {
101
- id: string;
102
- name: string;
103
- }
104
127
  /** Another system's key for a customer of this store. */
105
128
  export interface CustomerExternalRef {
106
129
  id: string;
@@ -147,23 +170,6 @@ export interface UpsertedCustomer {
147
170
  /** Fields of an existing customer were written. */
148
171
  updated: boolean;
149
172
  }
150
- /** One of the store's customer groups, as {@link CustomerGroupsModule.get} answers it. */
151
- export interface CustomerGroup {
152
- id: string;
153
- /** ISO-8601 UTC. */
154
- createdAt: string;
155
- /** ISO-8601 UTC. */
156
- updatedAt: string;
157
- name: string;
158
- /** This store's key for the group in the customer master, or `null` when no master keys it. */
159
- externalKey: string | null;
160
- /**
161
- * The store's own group, or its organization's (shared while the organization shares
162
- * `customer_groups`); see {@link CatalogueOwnership}. `editableHere` false: rename it in the
163
- * workspace.
164
- */
165
- catalogueOwnership: CatalogueOwnership;
166
- }
167
173
  /** A customer group with this store's external key, or `null` for a group nobody keyed. */
168
174
  export interface ExternalKeyedCustomerGroup {
169
175
  id: string;
@@ -233,6 +239,135 @@ export interface CustomerAddress {
233
239
  */
234
240
  redacted?: true;
235
241
  }
242
+ /** One customer as `list` answers it. */
243
+ export interface CustomerListItem extends Customer {
244
+ /** The company flags of every address in the customer's book. */
245
+ addresses: CustomerAddressSummary[];
246
+ /**
247
+ * The customer's company: the default billing address's, else the default shipping address's,
248
+ * else the first address that names one; `null` when none does. Blanked addresses (`redacted`)
249
+ * read `null` here too.
250
+ */
251
+ company: string | null;
252
+ /**
253
+ * How many orders the customer has in this store, present only when the call asked for
254
+ * `include: ['orderCount']`. An open cart counts too; an order still in the `Draft` state (a
255
+ * back-office draft) does not: the engine leaves drafts out of a customer's orders.
256
+ */
257
+ orderCount?: number;
258
+ }
259
+ /** What a customer list can be narrowed by. Several keys combine with AND. */
260
+ export interface CustomerListFilter {
261
+ /** These customers only. An empty list matches nothing. */
262
+ ids?: readonly string[];
263
+ /** The email address begins with this, ignoring case. */
264
+ emailStartsWith?: string;
265
+ /**
266
+ * The last name contains this, ignoring case. The engine trims it, and reads `%` and `_` in it
267
+ * as wildcards.
268
+ */
269
+ lastName?: string;
270
+ }
271
+ export declare const CUSTOMER_LIST_SORT_FIELDS: readonly ["createdAt", "updatedAt", "firstName", "lastName", "emailAddress", "phoneNumber"];
272
+ export type CustomerListSortField = (typeof CUSTOMER_LIST_SORT_FIELDS)[number];
273
+ export interface CustomerListSort {
274
+ field: CustomerListSortField;
275
+ direction: 'ASC' | 'DESC';
276
+ }
277
+ /** The blocks a list row can add: `orderCount`, each row's order count. */
278
+ export declare const CUSTOMER_LIST_INCLUDES: readonly ["orderCount"];
279
+ export type CustomerListInclude = (typeof CUSTOMER_LIST_INCLUDES)[number];
280
+ /** The engine's `adminListQueryLimit`: a larger page is refused. */
281
+ export declare const MAX_CUSTOMER_LIST_TAKE = 1000;
282
+ export interface CustomerListOptions extends ListOptions {
283
+ filter?: CustomerListFilter;
284
+ /** The engine's order (creation, oldest first) when omitted. */
285
+ sort?: CustomerListSort;
286
+ /** Rows to skip, 0 when omitted. Not together with `after`. */
287
+ skip?: number;
288
+ /** Rows per page, 1 to {@link MAX_CUSTOMER_LIST_TAKE}; `limit`, else 25, when omitted. */
289
+ take?: number;
290
+ include?: readonly CustomerListInclude[];
291
+ }
292
+ /**
293
+ * The blocks `get` can add to a customer, each asked for by name in `include`:
294
+ *
295
+ * - `addresses`: the address book.
296
+ * - `user`: the sign-in account (`null` for a guest customer).
297
+ * - `history`: the {@link CUSTOMER_HISTORY_TAKE} most recent history entries, newest first.
298
+ * - `customFields`: the fields the AFAS, VAT-validation and age-check plugins keep on the customer
299
+ * (and, with `addresses`, each address's AFAS id).
300
+ */
301
+ export declare const CUSTOMER_INCLUDES: readonly ["addresses", "user", "history", "customFields"];
302
+ export type CustomerInclude = (typeof CUSTOMER_INCLUDES)[number];
303
+ export interface CustomerUser {
304
+ id: string;
305
+ /** Whether the account's email address was verified. */
306
+ verified: boolean;
307
+ /** ISO-8601; null when the account never signed in. */
308
+ lastLogin: string | null;
309
+ }
310
+ export interface CustomerHistoryEntry {
311
+ id: string;
312
+ /** The engine's entry type (`CUSTOMER_NOTE`, `CUSTOMER_REGISTERED`, …). */
313
+ type: string;
314
+ isPublic: boolean;
315
+ data: Record<string, unknown>;
316
+ createdAt: string;
317
+ /** The staff member who wrote it; null for the system or the customer. */
318
+ administrator: {
319
+ id: string;
320
+ firstName: string;
321
+ lastName: string;
322
+ } | null;
323
+ }
324
+ /**
325
+ * The plugin fields of a customer. A field is null when the customer has no value, and also when
326
+ * the caller's customer-data level withholds it (`redacted` on the customer).
327
+ */
328
+ export interface CustomerPluginFields {
329
+ afasVrId: string | null;
330
+ afasOrgId: string | null;
331
+ afasContactId: string | null;
332
+ afasPersId: string | null;
333
+ vatNumber: string | null;
334
+ vatValidationStatus: string | null;
335
+ vatValidatedAt: string | null;
336
+ vatCompanyName: string | null;
337
+ vatCompanyAddress: string | null;
338
+ /** ISO-8601 instant of the date of birth the age check recorded. */
339
+ dateOfBirth: string | null;
340
+ }
341
+ /** An address read with `include: ['addresses', 'customFields']`. */
342
+ export interface CustomerBookAddress extends CustomerAddress {
343
+ /** Present only when the read included `customFields`. */
344
+ customFields?: {
345
+ afasAddressId: string | null;
346
+ } | null;
347
+ }
348
+ /** What each `get` block adds to a customer. */
349
+ export interface CustomerBlocks {
350
+ addresses: CustomerBookAddress[];
351
+ user: CustomerUser | null;
352
+ /** The most recent entries (`items`) and how many the customer has in all (`totalItems`). */
353
+ history: {
354
+ items: CustomerHistoryEntry[];
355
+ totalItems: number;
356
+ };
357
+ customFields: CustomerPluginFields | null;
358
+ }
359
+ /** True for a union of two or more types. */
360
+ type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
361
+ /** A list element that names ONE block for sure; one that may be one of several names none. */
362
+ type SureBlock<E> = [E] extends [never] ? never : true extends IsUnion<E> ? never : E;
363
+ /**
364
+ * The customer a `get` with this `include` answers, as the list's TYPE says it is: a literal list
365
+ * of fixed length promises its blocks; a list of no fixed length (`CustomerInclude[]`), or an
366
+ * element that may be one of several blocks, promises none for sure (each may be on the answer).
367
+ */
368
+ export type CustomerFor<L extends readonly CustomerInclude[]> = number extends L['length'] ? Customer & Partial<CustomerBlocks> : Customer & Pick<CustomerBlocks, {
369
+ [K in keyof L]: SureBlock<L[K]>;
370
+ }[number]> & Partial<CustomerBlocks>;
236
371
  export interface CreateCustomerInput {
237
372
  emailAddress: string;
238
373
  firstName: string;
@@ -378,32 +513,162 @@ export interface ActAsCustomerOptions extends Call {
378
513
  reason: string;
379
514
  }
380
515
  export interface CustomerAddressesModule {
516
+ /**
517
+ * A customer's address book; `[]` for a customer with none, and for one the store does not
518
+ * hold. Needs `ReadCustomer`.
519
+ *
520
+ * @effect read
521
+ */
381
522
  list(customerId: string, options?: Call): Promise<CustomerAddress[]>;
523
+ /**
524
+ * Add an address to a customer's book. Needs `CreateCustomer`. Refused `FIELD_GROUP_LOCKED`
525
+ * while an app or API token owns Customer details (see {@link CustomersModule.update}).
526
+ *
527
+ * @effect write
528
+ */
382
529
  create(customerId: string, input: Record<string, unknown>, options?: Call): Promise<CustomerAddress>;
530
+ /**
531
+ * Change one address. Needs `UpdateCustomer`. Refused like {@link create}.
532
+ *
533
+ * @effect write
534
+ */
383
535
  update(input: {
384
536
  id: string;
385
537
  } & Record<string, unknown>, options?: Call): Promise<CustomerAddress>;
538
+ /**
539
+ * Delete one address from its customer's book. Needs `DeleteCustomer`. Refused like
540
+ * {@link create}, and `ADDRESS_NOT_DELETED` (`BusinessRuleError`, 422) when the engine answers
541
+ * that it deleted nothing.
542
+ *
543
+ * @effect destructive
544
+ */
386
545
  delete(id: string, options?: Call): Promise<void>;
387
546
  }
388
547
  export interface CustomerGroupsModule {
389
548
  /**
390
- * One of the ACTIVE store's customer groups by id, its `catalogueOwnership` included, or `null`
391
- * for a group the store does not hold (another store's, a deleted one, an unknown id), the same
392
- * for each, like every other entity `get` here. A badge shows `null` as "not found", never as
393
- * the store's own group. An id that is not a uuid is refused before the engine looks with core's
394
- * `ENTITY_NOT_FOUND`: branch on the `NotFoundError` class, not the code. Needs `ReadCustomer` or `ReadCustomerGroup`. Requires
395
- * a platform release that serves `catalogueOwnership`: an older engine fails the call as a whole.
549
+ * One page of the store's customer groups, with `total` the exact count of every group the
550
+ * filter matches. Needs `ReadCustomer` or `ReadCustomerGroup`.
551
+ *
552
+ * - Page with `after` (the cursor of `page.next()`) and `limit`, or with `skip` and `take`; not
553
+ * `after` and `skip` together. Sorted by name, A to Z, unless `sort` says otherwise.
554
+ * - `include: ['memberCount']` adds how many of the store's customers each group holds. It
555
+ * needs `ReadCustomer` too: without it the engine refuses the whole call. Ask for it only
556
+ * where the count is shown: today's engine reads every member of each listed group to answer
557
+ * it.
558
+ * - A group the store holds from its organization is listed like its own; `get` says whose it
559
+ * is (`catalogueOwnership`).
560
+ * - To search by text, find ids with `search.index('customer_groups', …)`, then list them with
561
+ * `filter: { ids }`.
562
+ *
563
+ * Refused before anything is asked: `INVALID_CUSTOMER_GROUP_LIST_OPTIONS` (`ValidationError`,
564
+ * 400) for a filter key it does not list, a sort field it does not list, `take`/`skip` out of
565
+ * range, `after` with `skip`, or an `include` name it does not know.
566
+ *
567
+ * @effect read
568
+ */
569
+ list(options?: CustomerGroupListOptions): Promise<Page<CustomerGroupListItem>>;
570
+ /**
571
+ * One of the ACTIVE store's customer groups by id, its flags and its `catalogueOwnership`
572
+ * included, or `null` for a group the store does not hold (another store's, a deleted one, an
573
+ * unknown id), the same for each, like every other entity `get` here. A badge shows `null` as
574
+ * "not found", never as the store's own group. An id that is not a uuid is refused before the
575
+ * engine looks with core's `ENTITY_NOT_FOUND`: branch on the `NotFoundError` class, not the
576
+ * code. Needs `ReadCustomer` or `ReadCustomerGroup`. Requires a platform release that serves
577
+ * `catalogueOwnership`: an older engine fails the call as a whole.
578
+ *
579
+ * With `members`, the answer also carries one page of the group's members in this store and
580
+ * their count ({@link CustomerGroupWithMembers.members}), in a fixed order (by id);
581
+ * `members.filter.ids` asks which of those customers are members. Reading members needs `ReadCustomer`: without it the engine
582
+ * refuses the whole call. An app installation below `customerData: full` reads each member
583
+ * with the fields its level withholds blanked (`redacted: true`). A page option out of range
584
+ * or unknown is refused `INVALID_CUSTOMER_GROUP_MEMBERS_OPTIONS` (`ValidationError`, 400)
585
+ * before anything is asked. However small the page or the `filter.ids` list, today's engine
586
+ * reads every member of the group to answer it.
587
+ *
588
+ * @effect read
396
589
  */
590
+ get(id: string, options: Call & {
591
+ members: CustomerGroupMembersOptions;
592
+ }): Promise<CustomerGroupWithMembers | null>;
397
593
  get(id: string, options?: Call): Promise<CustomerGroup | null>;
398
594
  /**
399
- * Add customers to a group. Emits one `customer.group_changed` per customer added; a customer
400
- * already in the group is left as it is and emits nothing, so naming only members emits none.
595
+ * Create a customer group in this store. Needs `CreateCustomerGroup`. `customerIds` puts
596
+ * customers of the store in it at once; an id the store does not hold is left out, not
597
+ * refused. The engine does not judge the name: an empty one is saved as it is. Input of the
598
+ * wrong type is refused `INVALID_CUSTOMER_GROUP_INPUT` (`ValidationError`, 400) before it is
599
+ * sent.
600
+ *
601
+ * @effect write
602
+ */
603
+ create(input: CreateCustomerGroupInput, options?: Call): Promise<CustomerGroup>;
604
+ /**
605
+ * Rename a group or change its flags; an absent field keeps what the group has. Needs
606
+ * `UpdateCustomerGroup`.
607
+ *
608
+ * A group is ONE row for every store that holds it, so the change shows in each of them.
609
+ * Refused `MANAGED_BY_ORGANIZATION` (`BusinessRuleError`, 422) for a group the store holds from
610
+ * its organization (change it in the workspace; `catalogueOwnership.editableHere` is false),
611
+ * `SHARED_CUSTOMER_GROUP_NOT_ALLOWED` (`PermissionDeniedError`) for a group other stores hold
612
+ * too unless the caller has `UpdateCustomerGroup` in each of them, and `ENTITY_NOT_FOUND`
613
+ * (`NotFoundError`) for a group the store does not hold.
614
+ *
615
+ * @effect write
616
+ */
617
+ update(id: string, input: UpdateCustomerGroupInput, options?: Call): Promise<CustomerGroup>;
618
+ /**
619
+ * Delete a group for good. Its members stay customers of the store, and a product whose
620
+ * visibility named the group no longer names it. Deleting an organization's group in its
621
+ * workspace takes it out of every member store that holds it. Needs `DeleteCustomerGroup`.
622
+ *
623
+ * Refused like {@link update} for an organization's group (`MANAGED_BY_ORGANIZATION`) and for
624
+ * one other stores hold too (`SHARED_CUSTOMER_GROUP_NOT_ALLOWED`, asking `DeleteCustomerGroup`
625
+ * in each), and `CUSTOMER_GROUP_NOT_DELETED` (`ConflictError`, 409) with the engine's own
626
+ * reason for a group the store does not hold.
627
+ *
628
+ * @effect destructive
629
+ */
630
+ delete(id: string, options?: Call): Promise<void>;
631
+ /**
632
+ * Delete several groups in one call. Needs `DeleteCustomerGroup`. An empty list does nothing.
633
+ *
634
+ * All or nothing for the engine's sharing rule: ONE group it protects (an organization's, or
635
+ * one other stores hold without the caller's permission there) refuses the whole call, as
636
+ * {@link delete} does, and no group is deleted. An id the store does not hold is different:
637
+ * the other groups ARE deleted, and the call then rejects `CUSTOMER_GROUP_NOT_DELETED`
638
+ * (`ConflictError`, 409) whose `details` name each id that was not (`field: 'ids.<index>'`).
639
+ *
640
+ * @effect destructive
641
+ */
642
+ deleteMany(ids: readonly string[], options?: Call): Promise<void>;
643
+ /**
644
+ * Add customers to a group. Needs `UpdateCustomerGroup`. Emits one `customer.group_changed`
645
+ * per customer added; a customer already in the group is left as it is and emits nothing, so
646
+ * naming only members emits none. A customer the store does not hold is left out, and a group
647
+ * it does not hold is `ENTITY_NOT_FOUND` (`NotFoundError`).
648
+ *
649
+ * @effect write
401
650
  */
402
651
  add(groupId: string, customerIds: string[], options?: Call): Promise<CustomerGroupRef>;
652
+ /**
653
+ * Take customers out of a group; they stay customers of the store. Needs
654
+ * `UpdateCustomerGroup`. Emits one `customer.group_changed` per customer removed. Naming a
655
+ * customer of the store who is not a member refuses the whole call (`ValidationError`,
656
+ * `USER_INPUT_ERROR`); a customer the store does not hold is left out.
657
+ *
658
+ * @effect destructive
659
+ */
403
660
  remove(groupId: string, customerIds: string[], options?: Call): Promise<CustomerGroupRef>;
404
- /** The store's group under the master system's segment key, or `null`. Needs `ReadCustomerGroup`. */
661
+ /**
662
+ * The store's group under the master system's segment key, or `null`. Needs `ReadCustomerGroup`.
663
+ *
664
+ * @effect read
665
+ */
405
666
  byExternalKey(key: string, options?: Call): Promise<ExternalKeyedCustomerGroup | null>;
406
- /** This store's external key for a group, or `null` when no master keys it. */
667
+ /**
668
+ * This store's external key for a group, or `null` when no master keys it.
669
+ *
670
+ * @effect read
671
+ */
407
672
  externalKey(groupId: string, options?: Call): Promise<string | null>;
408
673
  /**
409
674
  * Create the store's group for a segment key, or rename the one it names. Twice is ONE group.
@@ -412,6 +677,8 @@ export interface CustomerGroupsModule {
412
677
  * Renaming a group a member store holds from its organization's workspace is refused
413
678
  * `MANAGED_BY_ORGANIZATION` (422 `BusinessRuleError`): rename it in the workspace
414
679
  * (`catalogueOwnership.editableHere` is false).
680
+ *
681
+ * @effect write
415
682
  */
416
683
  upsertByExternalKey(key: string, name: string, options?: Call): Promise<UpsertedCustomerGroup>;
417
684
  /**
@@ -425,17 +692,69 @@ export interface CustomerGroupsModule {
425
692
  * Known limit: atomic against other replaces and upserts of the same key, not against
426
693
  * `add`/`remove` (core's membership doors) running at the same moment, which do not take the
427
694
  * key's lock: a membership edit made by hand meanwhile can survive the replace or be undone.
695
+ *
696
+ * @effect destructive
428
697
  */
429
698
  replaceMembers(key: string, customerExternalRefs: CustomerExternalRefKey[], options?: Call): Promise<ReplacedCustomerGroupMembers>;
699
+ /** Which of the store's groups are trade (B2B) groups. */
700
+ b2b: CustomerB2BGroupsModule;
430
701
  }
431
702
  export interface CustomersModule {
432
- list(options?: ListOptions): Promise<Page<Customer>>;
703
+ /**
704
+ * One page of the store's customers, with `total` the exact count of every customer the filter
705
+ * matches. Needs `ReadCustomer`.
706
+ *
707
+ * - Page with `after` (the cursor of `page.next()`) and `limit`, or with `skip` and `take`; not
708
+ * `after` and `skip` together.
709
+ * - Each row carries its address book's company flags and {@link CustomerListItem.company};
710
+ * `include: ['orderCount']` adds each row's order count (carts count; `Draft`-state orders do not).
711
+ * - To search by text (a name, part of an address, a phone number), find ids with
712
+ * `search.index('customers', …)`, then list them with `filter: { ids }`.
713
+ *
714
+ * An app installation below `customerData: full` reads every row with the fields its level
715
+ * withholds blanked (`redacted: true` on each), and the engine refuses it a filter or sort on a
716
+ * withheld field (`CUSTOMER_DATA_NOT_GRANTED`).
717
+ *
718
+ * Refused before anything is asked: `INVALID_CUSTOMER_LIST_OPTIONS` (`ValidationError`, 400)
719
+ * for a filter key it does not list, a sort field it does not list, `take`/`skip` out of
720
+ * range, `after` with `skip`, or an `include` name it does not know.
721
+ *
722
+ * @effect read
723
+ */
724
+ list(options?: CustomerListOptions): Promise<Page<CustomerListItem>>;
725
+ /**
726
+ * One customer of this store, or `null` when the store holds no customer with that id (another
727
+ * store's customer answers `null` too). Needs `ReadCustomer`.
728
+ *
729
+ * Without `include` the answer is the customer record itself. Each name in `include` adds one
730
+ * block ({@link CUSTOMER_INCLUDES}) to the answer and to its type: pass a literal list to have
731
+ * those blocks on the type. The customer's orders are {@link CustomersModule.orders}.
732
+ *
733
+ * `customFields` reads the fields the AFAS, VAT-validation and age-check plugins add to a
734
+ * customer. The engine serves them because those plugins are installed on it; a value is null
735
+ * for a customer the plugin never wrote. An app installation below `customerData: full` reads
736
+ * the customer, the addresses, the account and the plugin fields with what its level withholds
737
+ * blanked, and the answer says so (`redacted: true`).
738
+ *
739
+ * An `include` name this version does not know is refused with a `ValidationError`
740
+ * (`INVALID_CUSTOMER_INCLUDE`) before anything is asked.
741
+ *
742
+ * @effect read
743
+ */
433
744
  get(id: string, options?: Call): Promise<Customer | null>;
745
+ get<const L extends readonly CustomerInclude[]>(id: string, options: Call & {
746
+ include: L;
747
+ }): Promise<CustomerFor<L> | null>;
434
748
  /**
435
749
  * Create a customer ON THIS CHANNEL, with no usable login: the customer
436
750
  * cannot sign in until they set a password through the link `invite` mails
437
751
  * them (or sign in with a magic link). Staff and API tokens never set a
438
752
  * customer's password, so there is no option for one.
753
+ *
754
+ * An address this store's customers already use is not refused: the answer is THAT customer,
755
+ * with `createdNew: false`. A caller that meant a new customer reads that as "address in use".
756
+ *
757
+ * @effect write
439
758
  */
440
759
  create(input: CreateCustomerInput, options?: Call): Promise<CreatedCustomer>;
441
760
  /**
@@ -451,18 +770,57 @@ export interface CustomersModule {
451
770
  * `FIELD_GROUP_LOCKED` (`BusinessRuleError`); an unchanged value passes. So is adding,
452
771
  * changing or removing one of their addresses (`addresses.*`), and deleting the customer.
453
772
  * Creating a customer is never refused.
773
+ *
774
+ * @effect write
454
775
  */
455
776
  update(id: string, input: UpdateCustomerInput, options?: Call): Promise<Customer>;
456
777
  /**
457
- * Mail the customer a way in: a set-password link, or a magic-link sign-in.
778
+ * Mail the customer a way in: a set-password link, or a magic-link sign-in. Needs
779
+ * `UpdateCustomer`. Ask {@link invitationStatus} first: it says whether an invitation can be
780
+ * sent, and `resend` is its `nextMode`.
458
781
  *
459
782
  * Not the storefront's forgot-password screen, which mails a password RESET
460
783
  * — something a customer who has never had an account did not ask for.
784
+ *
785
+ * Refused with the engine's sentence (`ValidationError`, `USER_INPUT_ERROR`, 400) for each
786
+ * blocked reason of the status, during the cooldown ("An invitation was sent less than a
787
+ * minute ago"), and while the store's invitation email is switched off or has no recipient.
788
+ * Refused `CUSTOMER_LOGIN_ON_OTHER_STORES` (`BusinessRuleError`) when the sign-in the address
789
+ * needs is one another store uses too.
790
+ *
791
+ * @effect write
461
792
  */
462
793
  invite(id: string, options?: Call & {
463
794
  mode?: CustomerInviteMode;
464
795
  resend?: boolean;
465
796
  }): Promise<CustomerInvitation>;
797
+ /**
798
+ * Whether an invitation can be sent to this customer now, what the last one was, and until
799
+ * when its cooldown runs. Needs `ReadCustomer`.
800
+ *
801
+ * The last invitation and the cooldown are read from the record each invitation leaves on the
802
+ * customer's history (a staff-visible note, among the customer's 100 newest), so a reworded
803
+ * or deleted record reads as "never invited". The send itself is judged by {@link invite}.
804
+ *
805
+ * A customer this store does not hold is a `NotFoundError` (`ENTITY_NOT_FOUND`). Requires a
806
+ * platform release that serves `customerInvitationStatus`: an older engine refuses the call
807
+ * as a whole (a `ValidationError`, 400).
808
+ *
809
+ * @effect read
810
+ */
811
+ invitationStatus(id: string, options?: Call): Promise<CustomerInvitationStatus>;
812
+ /**
813
+ * The age check of one customer: whether the store checks age, its minimum, the customer's
814
+ * date of birth, their age today and whether it meets the minimum. Needs `ReadCustomer`.
815
+ *
816
+ * The engine answers a status for any id: a customer the store does not hold reads
817
+ * `verified: false` with no date of birth, like a customer with none. `null` is reserved for
818
+ * an engine that answers none. Requires a platform release that answers the age: an older
819
+ * engine refuses the call as a whole (a `ValidationError`, 400).
820
+ *
821
+ * @effect read
822
+ */
823
+ ageVerification(id: string, options?: Call): Promise<CustomerAgeVerification | null>;
466
824
  /**
467
825
  * Invite every trade (B2B) customer on this store to set a password: the
468
826
  * members of the store's configured B2B customer groups, one per login
@@ -630,7 +988,74 @@ export interface CustomersModule {
630
988
  * and the address rules of {@link update}.
631
989
  */
632
990
  upsertByExternalRef(input: UpsertCustomerByExternalRefInput, options?: Call): Promise<UpsertedCustomer>;
991
+ /**
992
+ * One page of a customer's orders in this store, or `null` when the store holds no customer
993
+ * with that id. The same rows, filter, sort, paging and refusals as `orders.list`, including its
994
+ * two traps: the customer's open cart is one of the orders unless the filter leaves it out, and
995
+ * `orderPlacedAt` descending lists the never-placed rows first. Needs `ReadCustomer` (the engine
996
+ * asks nothing more for the customer's orders).
997
+ *
998
+ * @effect read
999
+ */
1000
+ orders(customerId: string, options?: OrderListOptions): Promise<Page<OrderSummary> | null>;
1001
+ /**
1002
+ * The customer's last PLACED orders in this store, newest first, each with its lines: what was
1003
+ * bought, how many, and the unit price a line stated in place of the catalogue's, with the
1004
+ * basis it is stated in. `null` when the store holds no customer with that id. Carts and drafts are never among them. What an "order it again"
1005
+ * picker and a "recently ordered" list read; `orders` is the paged list, without lines.
1006
+ *
1007
+ * A line names the variant as it is now. Before offering one as a product, read it through
1008
+ * `catalog.variants.find({ ids })`: that leaves out a variant the store no longer holds and
1009
+ * the hidden carrier variant behind an externally priced line.
1010
+ *
1011
+ * Needs `ReadCustomer`. Refused before anything is asked: `INVALID_ORDER_LIST_OPTIONS`
1012
+ * (`ValidationError`, 400) for a `take` outside 1 to 20 (`MAX_RECENT_ORDERS`).
1013
+ *
1014
+ * @effect read
1015
+ */
1016
+ recentOrders(customerId: string, options?: RecentOrdersOptions): Promise<RecentOrder[] | null>;
1017
+ /**
1018
+ * The customer's saved lists in this store (the lists of products and quantities a shopper
1019
+ * keeps on the storefront to order again), most recently changed first, each with its items in
1020
+ * the shopper's order. `null` when the store holds no customer with that id (another store's
1021
+ * included); `[]` for a customer with none. Read-only: the shopper writes them through the Shop
1022
+ * API. A variant of a disabled product is still listed (the Shop API hides it from the shopper,
1023
+ * multi-region decision 87); a variant the store no longer holds reads `productVariant: null`.
1024
+ * The list's name is customer data, withheld below `customerData: full` (`redacted`). Needs
1025
+ * `ReadCustomer`.
1026
+ *
1027
+ * @effect read
1028
+ */
1029
+ savedLists(customerId: string, options?: Call): Promise<CustomerSavedList[] | null>;
1030
+ /**
1031
+ * The customer's delivery terms as an order placed now would take them: the preferred and
1032
+ * allowed shipping methods, the Incoterm, the dispatch lead time and whether a partial delivery
1033
+ * is accepted, from whichever source governs them (an ERP such as Exact Online). `null` when
1034
+ * nothing governs the customer's delivery. A local read of what the source last synchronized;
1035
+ * it calls no ERP.
1036
+ *
1037
+ * Refused `USER_INPUT_ERROR` (`ValidationError`, 400) for a customer this store does not hold
1038
+ * (another store's included). Needs `ReadCustomer`.
1039
+ *
1040
+ * @effect read
1041
+ * @permission ReadCustomer
1042
+ */
1043
+ deliveryTerms(customerId: string, options?: Call): Promise<CustomerDeliveryTerms | null>;
633
1044
  groups: CustomerGroupsModule;
634
1045
  addresses: CustomerAddressesModule;
1046
+ /** A customer's B2B credit: account, limit, terms, status and what may be invoiced. */
1047
+ credit: CustomerCreditModule;
1048
+ /** A customer's staff notes: add, change, delete. */
1049
+ notes: CustomerNotesModule;
1050
+ /** A customer's saved delivery preferences, and the handlers' preference forms. */
1051
+ deliveryPreferences: CustomerDeliveryPreferencesModule;
1052
+ /** The extra addresses a customer's order emails also go to. */
1053
+ notificationRecipients: CustomerNotificationRecipientsModule;
1054
+ /** A customer's date of birth, as a calendar date. */
1055
+ dateOfBirth: CustomerDateOfBirthModule;
1056
+ /** A customer's VAT number: check it with VIES, or clear it. */
1057
+ vat: CustomerVatModule;
635
1058
  }
1059
+ /** The Admin API's `CustomerFilterParameter` for a typed filter; unknown keys are refused. */
1060
+ export declare function toCustomerFilterParameter(filter: CustomerListFilter | undefined): Record<string, unknown>;
636
1061
  export declare function createCustomersModule(transport: Transport): CustomersModule;