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