@sixtyninecommerce/admin 0.10.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 (247) hide show
  1. package/README.md +4347 -171
  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 +159 -19
  9. package/dist/catalog/products.js +88 -13
  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 +233 -26
  21. package/dist/catalog/variants.js +125 -7
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +95 -9
  25. package/dist/client.js +35 -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 +44 -10
  63. package/dist/fulfillments/index.js +11 -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 +123 -35
  71. package/dist/index.js +45 -12
  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 +29 -3
  87. package/dist/integrations/index.js +18 -3
  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 +15 -14
  91. package/dist/integrations/pipelines.js +6 -22
  92. package/dist/integrations/types.d.ts +146 -0
  93. package/dist/locations/index.d.ts +66 -0
  94. package/dist/locations/index.js +31 -0
  95. package/dist/meta/index.d.ts +162 -0
  96. package/dist/orders/cancel-with-money.d.ts +227 -0
  97. package/dist/orders/cancel-with-money.js +153 -0
  98. package/dist/orders/commit-edit.d.ts +7 -1
  99. package/dist/orders/commit-edit.js +5 -1
  100. package/dist/orders/drafts.d.ts +800 -0
  101. package/dist/orders/drafts.js +771 -0
  102. package/dist/orders/fields.d.ts +245 -0
  103. package/dist/orders/fields.js +188 -0
  104. package/dist/orders/get.d.ts +29 -19
  105. package/dist/orders/get.js +17 -8
  106. package/dist/orders/index.d.ts +49 -9
  107. package/dist/orders/index.js +22 -2
  108. package/dist/orders/lifecycle.d.ts +128 -0
  109. package/dist/orders/lifecycle.js +158 -0
  110. package/dist/orders/line-price-preview.d.ts +7 -2
  111. package/dist/orders/list.d.ts +222 -0
  112. package/dist/orders/list.js +377 -0
  113. package/dist/orders/manual-pricing.d.ts +5 -0
  114. package/dist/orders/order-entry.d.ts +20 -7
  115. package/dist/orders/plan-edit.d.ts +1 -1
  116. package/dist/orders/plan-edit.js +4 -1
  117. package/dist/orders/settings.d.ts +201 -0
  118. package/dist/orders/settings.js +325 -0
  119. package/dist/orders/status.d.ts +159 -13
  120. package/dist/orders/status.js +21 -0
  121. package/dist/orders/surcharges.d.ts +8 -1
  122. package/dist/orders/surcharges.js +3 -2
  123. package/dist/payments/account-credit.d.ts +30 -0
  124. package/dist/payments/account-credit.js +19 -0
  125. package/dist/payments/ar.d.ts +292 -0
  126. package/dist/payments/ar.js +223 -0
  127. package/dist/payments/connected-account.d.ts +47 -0
  128. package/dist/payments/connected-account.js +61 -0
  129. package/dist/payments/credit-noted-fields.d.ts +12 -0
  130. package/dist/payments/credit-noted-fields.js +37 -0
  131. package/dist/payments/index.d.ts +257 -11
  132. package/dist/payments/index.js +131 -1
  133. package/dist/payments/methods.d.ts +303 -8
  134. package/dist/payments/methods.js +337 -7
  135. package/dist/payments/mollie-methods.d.ts +159 -0
  136. package/dist/payments/mollie-methods.js +141 -0
  137. package/dist/payments/payment-links.d.ts +180 -0
  138. package/dist/payments/payment-links.js +97 -0
  139. package/dist/payments/provider-keys.d.ts +150 -0
  140. package/dist/payments/provider-keys.js +118 -0
  141. package/dist/payments/providers.d.ts +86 -11
  142. package/dist/payments/providers.js +29 -0
  143. package/dist/payments/requests.d.ts +144 -0
  144. package/dist/payments/requests.js +92 -0
  145. package/dist/payments/store-credit-fields.d.ts +15 -0
  146. package/dist/payments/store-credit-fields.js +51 -0
  147. package/dist/pickups/index.d.ts +104 -0
  148. package/dist/pickups/index.js +105 -0
  149. package/dist/platform/channels.d.ts +132 -0
  150. package/dist/platform/channels.js +128 -0
  151. package/dist/platform/geo.d.ts +123 -0
  152. package/dist/platform/geo.js +144 -0
  153. package/dist/platform/tax.d.ts +154 -0
  154. package/dist/platform/tax.js +139 -0
  155. package/dist/pos/anomalies.d.ts +158 -0
  156. package/dist/pos/anomalies.js +64 -0
  157. package/dist/pos/assisted-selling.d.ts +79 -0
  158. package/dist/pos/assisted-selling.js +38 -0
  159. package/dist/pos/exchanges.d.ts +103 -0
  160. package/dist/pos/exchanges.js +22 -0
  161. package/dist/pos/gift-cards.d.ts +135 -0
  162. package/dist/pos/gift-cards.js +47 -0
  163. package/dist/pos/index.d.ts +2125 -32
  164. package/dist/pos/index.js +742 -4
  165. package/dist/pos/no-receipt.d.ts +94 -0
  166. package/dist/pos/no-receipt.js +25 -0
  167. package/dist/pos/offline-sales.d.ts +187 -0
  168. package/dist/pos/offline-sales.js +116 -0
  169. package/dist/pos/pay-by-link.d.ts +143 -0
  170. package/dist/pos/pay-by-link.js +57 -0
  171. package/dist/pos/quick-keys.d.ts +103 -0
  172. package/dist/pos/quick-keys.js +45 -0
  173. package/dist/pos/reports.d.ts +360 -0
  174. package/dist/pos/reports.js +62 -0
  175. package/dist/pos/returns.d.ts +217 -0
  176. package/dist/pos/returns.js +53 -0
  177. package/dist/pricing/bulk-coupons.d.ts +139 -0
  178. package/dist/pricing/bulk-coupons.js +112 -0
  179. package/dist/pricing/index.d.ts +174 -4
  180. package/dist/pricing/index.js +174 -1
  181. package/dist/pricing/price-lists.d.ts +604 -0
  182. package/dist/pricing/price-lists.js +600 -0
  183. package/dist/purchasing/alerts.d.ts +89 -0
  184. package/dist/purchasing/alerts.js +62 -0
  185. package/dist/purchasing/cost.d.ts +110 -0
  186. package/dist/purchasing/cost.js +86 -0
  187. package/dist/purchasing/index.d.ts +36 -0
  188. package/dist/purchasing/index.js +16 -0
  189. package/dist/purchasing/purchase-orders.d.ts +548 -0
  190. package/dist/purchasing/purchase-orders.js +491 -0
  191. package/dist/purchasing/replenishment.d.ts +281 -0
  192. package/dist/purchasing/replenishment.js +240 -0
  193. package/dist/purchasing/settings.d.ts +152 -0
  194. package/dist/purchasing/settings.js +181 -0
  195. package/dist/purchasing/suppliers.d.ts +476 -0
  196. package/dist/purchasing/suppliers.js +438 -0
  197. package/dist/quotes/index.d.ts +501 -0
  198. package/dist/quotes/index.js +439 -0
  199. package/dist/reports/index.d.ts +71 -8
  200. package/dist/reports/index.js +74 -11
  201. package/dist/returns/index.d.ts +614 -21
  202. package/dist/returns/index.js +695 -11
  203. package/dist/search/index.d.ts +76 -1
  204. package/dist/search/index.js +63 -0
  205. package/dist/shipping/definitions.d.ts +29 -0
  206. package/dist/shipping/definitions.js +47 -0
  207. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  208. package/dist/shipping/fulfillment-profiles.js +104 -0
  209. package/dist/shipping/hendriks.d.ts +97 -0
  210. package/dist/shipping/hendriks.js +50 -0
  211. package/dist/shipping/index.d.ts +48 -0
  212. package/dist/shipping/index.js +25 -0
  213. package/dist/shipping/methods.d.ts +198 -0
  214. package/dist/shipping/methods.js +240 -0
  215. package/dist/shipping/myparcel.d.ts +254 -0
  216. package/dist/shipping/myparcel.js +178 -0
  217. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  218. package/dist/shipping/parcel-rule.d.ts +6 -5
  219. package/dist/shipping/parcel-rule.js +21 -23
  220. package/dist/shipping/rate-tables.d.ts +179 -0
  221. package/dist/shipping/rate-tables.js +184 -0
  222. package/dist/stock/index.d.ts +10 -3
  223. package/dist/stock/index.js +3 -0
  224. package/dist/stock/locations.d.ts +144 -0
  225. package/dist/stock/locations.js +168 -0
  226. package/dist/stock/transfers.d.ts +216 -43
  227. package/dist/stock/transfers.js +140 -13
  228. package/dist/stored-value/index.d.ts +214 -4
  229. package/dist/stored-value/index.js +152 -0
  230. package/dist/subscriptions/index.d.ts +682 -0
  231. package/dist/subscriptions/index.js +815 -0
  232. package/dist/tax/index.d.ts +76 -1
  233. package/dist/tax/index.js +50 -0
  234. package/dist/tenant/email-style.d.ts +102 -0
  235. package/dist/tenant/email-style.js +72 -0
  236. package/dist/tenant/email-templates.d.ts +66 -0
  237. package/dist/tenant/email-templates.js +54 -0
  238. package/dist/tenant/notifications.d.ts +23 -17
  239. package/dist/tenant/settings-sources.d.ts +1 -1
  240. package/dist/tenant/time-zone.d.ts +17 -0
  241. package/dist/tenant/time-zone.js +11 -0
  242. package/dist/types.d.ts +50 -3
  243. package/dist/users/index.d.ts +3 -0
  244. package/dist/users/index.js +2 -0
  245. package/dist/users/warehouses.d.ts +50 -0
  246. package/dist/users/warehouses.js +51 -0
  247. package/package.json +2 -2
@@ -0,0 +1,800 @@
1
+ /**
2
+ * `admin.orders.drafts`: staff build an order by hand, one step at a time (headless spec §9.2
3
+ * `orders` "draft-order editing"; plan W10-21).
4
+ *
5
+ * A draft is an order in the `Draft` state that only staff can see. Each method here changes
6
+ * one thing about it and answers the draft as it then stands; `cloneFrom` fills it from an
7
+ * earlier order, and `place` turns it into a placed order with its payment recorded.
8
+ *
9
+ * `orders.createOrRecover` is the other way to make an order: ONE keyed call that composes a
10
+ * whole order an external system already decided (its reference, its lines, its prices). This
11
+ * module is the builder a person drives: a line can carry a manual price with a reason, a variant
12
+ * can be on two lines, and the customer, shipping and minimum are settled step by step.
13
+ *
14
+ * **Only drafts.** Every write refuses an order that is not a `Draft` with `ORDER_NOT_DRAFT`
15
+ * (`BusinessRuleError`, 422): a shopper's cart, a till sale or a placed order is changed through
16
+ * its own door (`orders.planEdit` / `orders.commitEdit` for a placed one). A till's held sale is
17
+ * refused `POS_CART_HELD`. An order of another store, or none, is core's `ENTITY_NOT_FOUND`
18
+ * (`NotFoundError`, 404).
19
+ *
20
+ * **Only `place` records money.** A draft bills nobody, so the editing methods take no
21
+ * idempotency key and repeating one repeats the edit (adding a line twice adds it twice). Three
22
+ * methods are keyed: `place` (it records the order's payment), `cloneFrom` (it replaces the
23
+ * draft's contents) and `saveAddresses` (it can add an entry to the customer's address book). A
24
+ * repeat of one of them under the same key answers the first call's result.
25
+ */
26
+ import { BusinessRuleError, type PlatformErrorInit, type Transport } from '@sixtyninecommerce/core';
27
+ import type { Call } from '../types.js';
28
+ import type { OrderAddress, OrderGetModule } from './get.js';
29
+ /** One line of a draft. Money is an integer in minor units of the draft's `currencyCode`. */
30
+ export interface DraftOrderLine {
31
+ id: string;
32
+ quantity: number;
33
+ /** The unit price before promotions, net. */
34
+ unitPrice: number;
35
+ unitPriceWithTax: number;
36
+ /** Whether the line is priced gross; a manual price is stated in this basis. */
37
+ listPriceIncludesTax: boolean;
38
+ linePrice: number;
39
+ linePriceWithTax: number;
40
+ productVariant: {
41
+ id: string;
42
+ name: string;
43
+ sku: string;
44
+ };
45
+ customFields: {
46
+ /** The manual unit price, in the line's basis; null when the catalogue prices it. */
47
+ unitPriceOverride: number | null;
48
+ priceOverrideReason: string | null;
49
+ /** True for a line priced exactly as it arrived (an import, a quote, a till price). */
50
+ unitPriceImported: boolean | null;
51
+ } | null;
52
+ }
53
+ /** A draft as every method of this module answers it. */
54
+ export interface DraftOrder {
55
+ id: string;
56
+ code: string;
57
+ state: string;
58
+ currencyCode: string;
59
+ subTotal: number;
60
+ subTotalWithTax: number;
61
+ shipping: number;
62
+ shippingWithTax: number;
63
+ total: number;
64
+ totalWithTax: number;
65
+ customer: {
66
+ id: string;
67
+ firstName: string;
68
+ lastName: string;
69
+ emailAddress: string;
70
+ } | null;
71
+ lines: DraftOrderLine[];
72
+ shippingLines: Array<{
73
+ id: string;
74
+ price: number;
75
+ priceWithTax: number;
76
+ shippingMethod: {
77
+ id: string;
78
+ code: string;
79
+ name: string;
80
+ } | null;
81
+ }>;
82
+ couponCodes: string[];
83
+ /** The draft's addresses; every field is null until one is set. */
84
+ shippingAddress: OrderAddress | null;
85
+ billingAddress: OrderAddress | null;
86
+ customFields: {
87
+ paymentConditionCode: string | null;
88
+ paymentTermsDays: number | null;
89
+ poNumber: string | null;
90
+ orderNotes: string | null;
91
+ /** ISO-8601; the day it names is read as its UTC date. */
92
+ requestedDeliveryDate: string | null;
93
+ /** The customer's saved address the shipping address was taken from, when one was. */
94
+ customerShippingAddressId: string | null;
95
+ customerBillingAddressId: string | null;
96
+ /**
97
+ * True for an address kept on this order only: it is not added to the customer's saved
98
+ * addresses when the order is placed.
99
+ */
100
+ shippingAddressIsTemporary: boolean | null;
101
+ billingAddressIsTemporary: boolean | null;
102
+ } | null;
103
+ /**
104
+ * Set when the caller's customer-data level blanked the customer (an app installation below
105
+ * `customerData: full`): read an empty name as "not granted", never as "none".
106
+ */
107
+ redacted?: true;
108
+ }
109
+ /**
110
+ * The price fields a line can state, as the engine's line custom fields. Each is three-state: left
111
+ * out keeps what the line has, `null` clears it, a value sets it.
112
+ */
113
+ export interface DraftLinePriceInput {
114
+ /**
115
+ * A manual unit price, a whole number of minor units, in the LINE's tax basis (gross when
116
+ * `listPriceIncludesTax`). It is a layer: the customer's price list and the draft's one-time
117
+ * discounts still apply on top. `null` clears it and prices the line from the catalogue again,
118
+ * refused `ORDER_LINE_VARIANT_UNPRICED` when the variant has no price in the store.
119
+ */
120
+ unitPriceOverride?: number | null;
121
+ /** A free-text note on the manual price. */
122
+ priceOverrideReason?: string | null;
123
+ /**
124
+ * `true` keeps the line at exactly the price it states, out of every price list and one-time
125
+ * discount; staff editing a price send `null` to take the line out of that state.
126
+ */
127
+ unitPriceImported?: boolean | null;
128
+ /**
129
+ * One of the store's active discount reasons (`orders.manualDiscounts.reasons`), when the
130
+ * manual price LOWERS the line's price and the store requires a reason
131
+ * (`DISCOUNT_REASON_REQUIRED` otherwise; `DISCOUNT_REASON_UNKNOWN` for a code it does not
132
+ * have). Not stored on the line: the price movement it explains is recorded
133
+ * (`orders.manualDiscounts.list`).
134
+ */
135
+ reasonCode?: string | null;
136
+ }
137
+ export interface DraftAddLineInput extends DraftLinePriceInput {
138
+ productVariantId: string;
139
+ /** 1 or more. */
140
+ quantity: number;
141
+ }
142
+ export interface DraftAdjustLineInput extends DraftLinePriceInput {
143
+ /** 1 or more; to take a line off, `removeLine`. */
144
+ quantity: number;
145
+ }
146
+ /** The draft fields staff fill in. Each left out keeps what the draft has; `null` clears it. */
147
+ export interface DraftOrderFields {
148
+ /** The payment condition code the draft is placed under (`payments` terms). */
149
+ paymentConditionCode?: string | null;
150
+ /** Days until payment is due, with the condition. */
151
+ paymentTermsDays?: number | null;
152
+ /** The customer's purchase-order reference. */
153
+ poNumber?: string | null;
154
+ /** A note on the order. */
155
+ orderNotes?: string | null;
156
+ /**
157
+ * The day the customer wants it delivered, as midnight UTC of that calendar day
158
+ * (`2026-11-03T00:00:00.000Z` for 3 November): the engine reads this field by its UTC date.
159
+ */
160
+ requestedDeliveryDate?: string | null;
161
+ }
162
+ /** An address typed for a draft. */
163
+ export interface DraftAddressInput {
164
+ fullName?: string | null;
165
+ company?: string | null;
166
+ streetLine1: string;
167
+ streetLine2?: string | null;
168
+ city?: string | null;
169
+ province?: string | null;
170
+ postalCode?: string | null;
171
+ /** ISO 3166-1 alpha-2, a country the store knows. */
172
+ countryCode: string;
173
+ phoneNumber?: string | null;
174
+ }
175
+ /**
176
+ * One side of a draft's addresses: a saved address of the draft's customer
177
+ * (`customers.addresses.list`), or a typed one.
178
+ */
179
+ export type DraftAddressSide = {
180
+ customerAddressId: string;
181
+ } | {
182
+ address: DraftAddressInput;
183
+ /**
184
+ * Keep the typed address on this order only: it is not added to the customer's saved
185
+ * addresses now, nor when the order is placed. Refused on a draft with no customer.
186
+ */
187
+ temporary?: boolean;
188
+ };
189
+ /** Both addresses of a draft, as `saveAddresses` takes them. */
190
+ export type SaveDraftAddressesInput = {
191
+ shipping: DraftAddressSide;
192
+ billing: DraftAddressSide;
193
+ } | {
194
+ shipping: DraftAddressSide;
195
+ billingSameAsShipping: true;
196
+ };
197
+ /** What `saveAddresses` did. */
198
+ export interface SavedDraftAddresses {
199
+ order: DraftOrder;
200
+ /** The saved addresses the call added to the customer's address book, at most two. */
201
+ createdAddressIds: string[];
202
+ }
203
+ /** The fields of an address a draft can start from; a blank one is `''`. */
204
+ export interface DraftAddressFields {
205
+ fullName: string;
206
+ company: string;
207
+ streetLine1: string;
208
+ streetLine2: string;
209
+ city: string;
210
+ province: string;
211
+ postalCode: string;
212
+ countryCode: string;
213
+ phoneNumber: string;
214
+ }
215
+ /** What one side of a draft's addresses starts from (`drafts.addressDefaults`). */
216
+ export interface DraftAddressDefault {
217
+ /**
218
+ * Where the answer comes from: the address already on the draft (`ORDER`), the customer's
219
+ * most recent placed order in the store (`LATEST_ORDER`), their default saved address, else
220
+ * their first (`ADDRESS_BOOK`), or nothing (`NONE`).
221
+ */
222
+ source: 'ORDER' | 'LATEST_ORDER' | 'ADDRESS_BOOK' | 'NONE';
223
+ /** The customer's saved address to select, or null. */
224
+ customerAddressId: string | null;
225
+ /** The address to start a typed one from, when no saved address matches it. */
226
+ address: DraftAddressFields | null;
227
+ /** Whether that address is kept on this order only. */
228
+ temporary: boolean;
229
+ /**
230
+ * True when `temporary` was carried over from the customer's last order rather than recorded
231
+ * on this draft: it describes that address, and no longer applies once another one is typed.
232
+ */
233
+ temporaryInferred: boolean;
234
+ }
235
+ export interface DraftAddressDefaults {
236
+ shipping: DraftAddressDefault;
237
+ billing: DraftAddressDefault;
238
+ /**
239
+ * Whether billing follows shipping, when the addresses found say so; null when neither the
240
+ * draft nor the customer's last order has a billing address to compare.
241
+ */
242
+ billingSameAsShipping: boolean | null;
243
+ /**
244
+ * Set when the caller's customer-data level blanked the addresses (an app installation below
245
+ * `customerData: full`): read an empty field as "not granted", never as "none".
246
+ */
247
+ redacted?: true;
248
+ }
249
+ /** One shipping method the draft can take now, priced for it. */
250
+ export interface DraftShippingQuote {
251
+ id: string;
252
+ code: string;
253
+ name: string;
254
+ description: string;
255
+ price: number;
256
+ priceWithTax: number;
257
+ /** What the method's calculator answered beside the price (carrier data, pickup points). */
258
+ metadata: Record<string, unknown> | null;
259
+ /**
260
+ * Always `false` on this read today: the engine does not know the draft here. The customer's
261
+ * preferred method is `customers` delivery terms; `applyPreferredDelivery` applies it.
262
+ */
263
+ isPreferred: boolean;
264
+ /** False only when an externally governed customer may not choose this method. */
265
+ isDeliveryTermsEligible: boolean;
266
+ }
267
+ /** The draft against the customer's order minimums (`drafts.minimum.status`). */
268
+ export interface DraftMinimumStatus {
269
+ /**
270
+ * True when the draft does not clear the customer's minimums, judged IGNORING an override, so
271
+ * "below the minimum, overridden" can be shown.
272
+ */
273
+ belowMinimum: boolean;
274
+ /** The unmet minimum in words; null when every minimum is met. */
275
+ message: string | null;
276
+ overridden: boolean;
277
+ /** ISO-8601, when the override was set. */
278
+ overriddenAt: string | null;
279
+ /** The name of the administrator who overrode it, when it can be read. */
280
+ overriddenBy: string | null;
281
+ reason: string | null;
282
+ }
283
+ /** What a re-price did (`drafts.reprice`). */
284
+ export interface DraftRepriceOutcome {
285
+ /** True when a price moved and the draft was saved; false when nothing was written. */
286
+ changed: boolean;
287
+ /** How many lines' unit price moved. */
288
+ linesRepriced: number;
289
+ }
290
+ /** The payment a draft is placed with (`drafts.place`). */
291
+ export interface DraftPaymentInput {
292
+ /**
293
+ * The code of one of the store's ENABLED payment methods on the manual handler (bank transfer,
294
+ * invoice, cash on delivery, net terms). A method that takes payments through a provider is
295
+ * refused: placing a draft records a payment, it never asks a provider for one.
296
+ */
297
+ methodCode: string;
298
+ /**
299
+ * Whether the money has already arrived.
300
+ *
301
+ * - `false`: an expected payment is recorded (`Authorized`); the order is placed and reads as
302
+ * due until the payment is settled (`payments.settle`).
303
+ * - `true`: the payment is recorded as RECEIVED (`Settled`) for what the order owes. Nothing
304
+ * is charged at a provider and no money moves: you are stating that it already did.
305
+ *
306
+ * A net-terms method is always pay-later: send `false` for one. `true` is refused
307
+ * (`DRAFT_PAYMENT_NET_TERMS_NOT_RECEIVABLE`), never recorded as expected instead. Which
308
+ * methods are net terms: `isNetTermsCredit` on the store's payment methods.
309
+ */
310
+ received: boolean;
311
+ /**
312
+ * Your reference for a received payment (a bank statement line). Left out or blank, it is
313
+ * `manual-<order code>`, the same on every attempt. Not stored for an expected payment.
314
+ */
315
+ transactionId?: string | null;
316
+ /**
317
+ * Your own keys and values, stored on the payment. An expected payment keeps only the keys the
318
+ * manual handler knows (`poNumber`, `requestedDeliveryDate`, `orderNotes`, `notes`).
319
+ */
320
+ metadata?: Record<string, unknown> | null;
321
+ }
322
+ export interface PlaceDraftInput {
323
+ orderId: string;
324
+ /**
325
+ * The payment condition the order is placed under. Left out, the draft's payment terms are not
326
+ * touched. `null` or blank clears an override, so the customer's own terms apply. Either way
327
+ * the numeric-day override (`paymentTermsDays`) is cleared with it: the two exclude each
328
+ * other. Writing it needs `CreateOrder` beside `UpdateOrder`.
329
+ */
330
+ paymentConditionCode?: string | null;
331
+ payment: DraftPaymentInput;
332
+ }
333
+ /** A payment on a placed order. `amount` is in minor units of the order's currency. */
334
+ export interface PlacedDraftPayment {
335
+ id: string;
336
+ /** `Authorized` for an expected payment, `Settled` for one recorded as received. */
337
+ state: string;
338
+ /** The payment method's code. */
339
+ method: string;
340
+ amount: number;
341
+ transactionId: string | null;
342
+ }
343
+ /** The order `drafts.place` placed. */
344
+ export interface PlacedDraftOrder {
345
+ id: string;
346
+ code: string;
347
+ /** `PaymentAuthorized` or `PaymentSettled`. */
348
+ state: string;
349
+ currencyCode: string;
350
+ totalWithTax: number;
351
+ payments: PlacedDraftPayment[];
352
+ }
353
+ /**
354
+ * Why `drafts.cloneFrom` did not copy a line. A new value may be added: treat one you do not
355
+ * know like `UNAVAILABLE` and show `message`.
356
+ */
357
+ export type DraftCloneSkipReason =
358
+ /** An external system priced the line; that system has to send it again. */
359
+ 'EXTERNALLY_PRICED'
360
+ /** The line was cancelled on the source order. */
361
+ | 'CANCELLED'
362
+ /** Its manual price is in the source's currency, another than the draft's. */
363
+ | 'PRICE_IN_OTHER_CURRENCY'
364
+ /** The store has no price for the variant. */
365
+ | 'UNPRICED'
366
+ /** Its manual price lowers the line and the store requires a discount reason. */
367
+ | 'DISCOUNT_REASON_REQUIRED'
368
+ /** Its manual price is deeper than the store's discount ceiling allows the caller. */
369
+ | 'DISCOUNT_OVER_LIMIT'
370
+ /** Anything else the engine refused the line for. */
371
+ | 'UNAVAILABLE' | (string & {});
372
+ /** What `drafts.cloneFrom` did. */
373
+ export interface ClonedDraft {
374
+ /** The draft as it now stands. */
375
+ order: DraftOrder;
376
+ /** The source lines that were not copied, with why; `message` is the engine's own sentence. */
377
+ skipped: Array<{
378
+ sourceLineId: string;
379
+ reason: DraftCloneSkipReason;
380
+ message: string;
381
+ }>;
382
+ /** The source lines copied with fewer units than they had: the store has no more in stock. */
383
+ clamped: Array<{
384
+ sourceLineId: string;
385
+ quantityAdded: number;
386
+ }>;
387
+ /**
388
+ * Whether the source's shipping method was selected on the draft: `false` when the draft
389
+ * cannot take it (select another), `null` when the source had none.
390
+ */
391
+ shippingMethodApplied: boolean | null;
392
+ }
393
+ /**
394
+ * How long `cloneFrom` waits for its answer. The engine copies an order in ONE call and one
395
+ * transaction, adding its lines one by one, so the call lasts as long as the whole copy; the
396
+ * default 15 s aborted the copy of a large order the engine went on to finish. Measured on a dev
397
+ * stack under heavy load (5-minute load average 34): 164 lines copied in 47 s, about 0.3 s a
398
+ * line, so the default ran out past some 50 lines and this covers some 300. Well under the
399
+ * engine's five-minute idempotency claim, so a repeat under the same key after this runs out
400
+ * meets the first attempt's claim (`IDEMPOTENCY_IN_PROGRESS`) instead of starting a second copy.
401
+ */
402
+ export declare const DRAFT_CLONE_TIMEOUT_MS = 90000;
403
+ /** Options of the two keyed draft calls. */
404
+ export interface KeyedDraftCall extends Call {
405
+ /**
406
+ * One key per attempt, re-sent unchanged on a retry of THAT attempt (a timeout, a dropped
407
+ * connection). Pass your own: left out, one is made up (a UUIDv7) and returned as
408
+ * `idempotencyKey` on the result, but on a thrown error only as an untyped own property of the
409
+ * error. Never reuse a key for a different request or a fresh attempt.
410
+ */
411
+ idempotencyKey?: string;
412
+ }
413
+ /**
414
+ * `addLine` and `adjustLine` asked for more than the stock allows. The engine took what it could
415
+ * and answers the draft as it now stands, so this is a partial success to show, not a refusal to
416
+ * retry: `INSUFFICIENT_STOCK` (`BusinessRuleError`, 422). Read the line's quantity off `order`.
417
+ */
418
+ export declare class DraftInsufficientStockError extends BusinessRuleError {
419
+ /**
420
+ * The engine's own figure, which means a different thing per method:
421
+ * - `addLine`: how many units the add could TAKE. When the add merged into a line the draft
422
+ * already had, the line holds its old quantity plus this. `0` means nothing was added.
423
+ * - `adjustLine`: the quantity the line holds now.
424
+ */
425
+ readonly quantityAvailable: number;
426
+ /** The draft as the engine left it. */
427
+ readonly order: DraftOrder;
428
+ constructor(init: Omit<PlatformErrorInit, 'status'>, quantityAvailable: number, order: DraftOrder);
429
+ }
430
+ export interface DraftMinimumModule {
431
+ /**
432
+ * The draft against the customer's order minimums, judged as placement will judge it. Needs
433
+ * `ReadOrder`. Any order of the store can be read; the minimum gate and the override exist only
434
+ * for drafts.
435
+ *
436
+ * @effect read
437
+ */
438
+ status(orderId: string, options?: Call): Promise<DraftMinimumStatus>;
439
+ /**
440
+ * Let this draft be placed below the customer's minimum. Needs `UpdateOrder`. Recorded on the
441
+ * draft under the caller's name, with the minimum it bypassed and the reason, as a private
442
+ * note. A second call replaces the first. Shipping methods priced by order value stop applying
443
+ * their value bands to the draft at once.
444
+ *
445
+ * Refused `ORDER_NOT_DRAFT` for an order that is not (or stopped being) a draft, and
446
+ * `DRAFT_MINIMUM_OVERRIDE_NOT_ALLOWED` (`PermissionDeniedError`, 403) for a caller that is not
447
+ * a signed-in user, whose override could not be recorded under a name.
448
+ *
449
+ * @effect write
450
+ */
451
+ override(orderId: string, options?: Call & {
452
+ reason?: string | null;
453
+ }): Promise<void>;
454
+ /**
455
+ * Take the override off a draft. A draft with none is left as it is. Needs `UpdateOrder`;
456
+ * refused `ORDER_NOT_DRAFT` like {@link override}.
457
+ *
458
+ * @effect write
459
+ */
460
+ clear(orderId: string, options?: Call): Promise<void>;
461
+ }
462
+ export interface DraftCouponsModule {
463
+ /**
464
+ * Apply a coupon code to the draft. Needs `CreateOrder`. Refused with core's coupon codes:
465
+ * `COUPON_CODE_INVALID_ERROR`, `COUPON_CODE_EXPIRED_ERROR`, `COUPON_CODE_LIMIT_ERROR`
466
+ * (`BusinessRuleError`, 422).
467
+ *
468
+ * @effect write
469
+ */
470
+ apply(orderId: string, couponCode: string, options?: Call): Promise<DraftOrder>;
471
+ /**
472
+ * Take a coupon code off the draft. A code it does not carry changes nothing. Needs
473
+ * `CreateOrder`.
474
+ *
475
+ * @effect write
476
+ */
477
+ remove(orderId: string, couponCode: string, options?: Call): Promise<DraftOrder>;
478
+ }
479
+ export interface OrderDraftsModule {
480
+ /**
481
+ * Start an empty draft in the store. Needs `CreateOrder`. A draft nobody finishes stays until
482
+ * it is deleted.
483
+ *
484
+ * @effect write
485
+ */
486
+ create(options?: Call): Promise<DraftOrder>;
487
+ /**
488
+ * The draft as `orders.get` reads any order (the same answer and `include` blocks).
489
+ *
490
+ * @effect read
491
+ */
492
+ get: OrderGetModule['get'];
493
+ /**
494
+ * Delete a draft for good. Needs `DeleteOrder`. Anything that is not a draft is kept and
495
+ * answered `ORDER_NOT_DELETED` (`ConflictError`, 409) with the engine's reason.
496
+ *
497
+ * @effect destructive
498
+ */
499
+ delete(orderId: string, options?: Call): Promise<void>;
500
+ /**
501
+ * Make an existing customer of the store the draft's customer. Needs `CreateOrder`.
502
+ *
503
+ * It takes a customer ID only: to order for someone new, create them first with
504
+ * `customers.create`, which never touches another store's customer, and pass its `id` (when
505
+ * the store already had a customer with that email, `createdNew` is false and that customer's
506
+ * id is answered; say so to the person typing). A customer of another store, or none, is
507
+ * `ENTITY_NOT_FOUND`.
508
+ *
509
+ * @effect write
510
+ */
511
+ setCustomer(orderId: string, customerId: string, options?: Call): Promise<DraftOrder>;
512
+ /**
513
+ * Add a line. Needs `CreateOrder`.
514
+ *
515
+ * Without a manual price, a line for a variant the draft already has adds to that line; with
516
+ * one, it is a line of its own (12 paid and 6 free of the same wine).
517
+ *
518
+ * **More than the stock allows is clamped, not refused:** the add takes what the store has and
519
+ * {@link DraftInsufficientStockError} (`INSUFFICIENT_STOCK`) is thrown with the units it could
520
+ * take (`quantityAvailable`, `0` when none) and the draft.
521
+ *
522
+ * Refused, with nothing written: `LINE_NOT_SALEABLE` (the variant is not for sale in the
523
+ * store), `VARIANT_NOT_FOR_SALE_IN_CURRENCY`, `ORDER_LINE_VARIANT_UNPRICED` (no store price and
524
+ * no manual price), `DISCOUNT_REASON_REQUIRED` / `DISCOUNT_REASON_UNKNOWN` /
525
+ * `DISCOUNT_OVER_LIMIT` (a manual price that lowers the line, see
526
+ * {@link DraftLinePriceInput.reasonCode}), `HUB_HAS_NO_ORDERS` (an organization's workspace
527
+ * takes no orders), and core's `ORDER_LIMIT_ERROR`, `NEGATIVE_QUANTITY_ERROR` and an
528
+ * `ORDER_INTERCEPTOR_ERROR` with the interceptor's own reason as the message.
529
+ *
530
+ * @effect write
531
+ */
532
+ addLine(orderId: string, input: DraftAddLineInput, options?: Call): Promise<DraftOrder>;
533
+ /**
534
+ * Change a line's quantity and, optionally, its manual price. Needs `CreateOrder`. Clamped on
535
+ * stock like {@link addLine} (here `quantityAvailable` is the line's new quantity), and refused
536
+ * with the same codes.
537
+ *
538
+ * @effect write
539
+ */
540
+ adjustLine(orderId: string, lineId: string, input: DraftAdjustLineInput, options?: Call): Promise<DraftOrder>;
541
+ /**
542
+ * Take a line off the draft. Needs `CreateOrder`. An edit, not a deletion: a draft bills
543
+ * nothing.
544
+ *
545
+ * @effect write
546
+ */
547
+ removeLine(orderId: string, lineId: string, options?: Call): Promise<DraftOrder>;
548
+ /**
549
+ * Fill in the draft's own fields (payment condition, purchase-order reference, notes, the
550
+ * requested delivery day). Needs `CreateOrder`. A field left out keeps its value.
551
+ *
552
+ * @effect write
553
+ */
554
+ setFields(orderId: string, fields: DraftOrderFields, options?: Call): Promise<DraftOrder>;
555
+ /**
556
+ * What the draft's address step starts from, per side: the address already on the draft, else
557
+ * the customer's most recent placed order in the store, else their default saved address. An
558
+ * address found is matched to a saved address of the customer where one exists
559
+ * (`customerAddressId`), and otherwise answered as `address` to start a typed one from. Needs
560
+ * `ReadOrder`. Any order of the store can be read.
561
+ *
562
+ * Refused `CUSTOMER_DATA_NOT_GRANTED` for an app installation below `customerData: full`: the
563
+ * answer says whether an address is one of the customer's saved ones.
564
+ *
565
+ * @effect read
566
+ */
567
+ addressDefaults(orderId: string, options?: Call): Promise<DraftAddressDefaults>;
568
+ /**
569
+ * Save the draft's shipping and billing address in ONE call: both addresses, which saved
570
+ * address each was taken from, whether a typed address is kept on this order only, and the
571
+ * address-book entry a typed address adds. All or nothing: a refusal or a failure leaves the
572
+ * draft and the customer's saved addresses as they were. Needs `CreateOrder`, and
573
+ * `CreateCustomer` when the call adds an address-book entry (`FORBIDDEN` otherwise).
574
+ *
575
+ * A typed address is added to the customer's saved addresses unless it is `temporary` or the
576
+ * customer already has exactly that address, field for field, capitals and outer spaces
577
+ * aside (then the draft is linked to that entry; `createdAddressIds` is empty). An address
578
+ * that differs from a saved one in any field, a phone number included, is added as its own
579
+ * entry. On a draft with no customer only the two addresses are written.
580
+ *
581
+ * Pass `options.idempotencyKey`: a repeat under the same key answers the first call's result
582
+ * instead of saving again (`IDEMPOTENCY_CONFLICT` for a different request under it).
583
+ *
584
+ * Refused: `ORDER_NOT_DRAFT`; `ADDRESS_INVALID` (`ValidationError`, 400, the argument in
585
+ * `details[0].field`, e.g. `/input/billing/address/countryCode`) for a blank street line, a
586
+ * country the store does not know, `temporary` on a draft with no customer, or a typed
587
+ * address that cannot be stored in an address book, with the reason as its message;
588
+ * `ENTITY_NOT_FOUND` for a `customerAddressId` the draft's customer does not have;
589
+ * `FIELD_GROUP_LOCKED` when an app or API key manages the customer's details and the call
590
+ * would add an address; `POS_CART_HELD` for a till's held sale; and
591
+ * `CUSTOMER_DATA_NOT_GRANTED` for a typed address from an app installation below
592
+ * `customerData: full` (it is compared with the customer's saved addresses; type it through
593
+ * {@link setShippingAddress} / {@link setBillingAddress} instead).
594
+ *
595
+ * @effect write
596
+ */
597
+ saveAddresses(orderId: string, input: SaveDraftAddressesInput, options?: Call): Promise<SavedDraftAddresses>;
598
+ /**
599
+ * Core's own door to set the draft's shipping address alone. Needs `CreateOrder`. It records
600
+ * no saved-address link and adds nothing to the customer's saved addresses; prefer
601
+ * {@link saveAddresses}. An unknown `countryCode` is core's `USER_INPUT_ERROR`.
602
+ *
603
+ * @effect write
604
+ */
605
+ setShippingAddress(orderId: string, address: DraftAddressInput, options?: Call): Promise<DraftOrder>;
606
+ /**
607
+ * Core's own door to set the draft's billing address alone; as {@link setShippingAddress}.
608
+ *
609
+ * @effect write
610
+ */
611
+ setBillingAddress(orderId: string, address: DraftAddressInput, options?: Call): Promise<DraftOrder>;
612
+ /**
613
+ * Take the shipping address off the draft. Needs `CreateOrder`. The saved-address link and
614
+ * the "this order only" flag of that side are left as they were.
615
+ *
616
+ * @effect write
617
+ */
618
+ unsetShippingAddress(orderId: string, options?: Call): Promise<DraftOrder>;
619
+ /**
620
+ * Take the billing address off the draft; as {@link unsetShippingAddress}.
621
+ *
622
+ * @effect write
623
+ */
624
+ unsetBillingAddress(orderId: string, options?: Call): Promise<DraftOrder>;
625
+ /**
626
+ * The shipping methods the draft can take now, each priced for it. Needs `ReadOrder`. Set the
627
+ * customer and the shipping address first: eligibility and price depend on them.
628
+ *
629
+ * @effect read
630
+ */
631
+ shippingQuotes(orderId: string, options?: Call): Promise<DraftShippingQuote[]>;
632
+ /**
633
+ * Choose the draft's shipping method, as staff do in the builder. Needs `UpdateOrder`. For a
634
+ * customer whose delivery terms an ERP governs, the choice is recorded as theirs and checked:
635
+ * refused `DELIVERY_METHOD_NOT_ELIGIBLE` (`BusinessRuleError`, 422) when the method is not
636
+ * mapped to an active external method or not eligible for the draft now, and
637
+ * `DELIVERY_TERMS_LOCKED` once the delivery terms were accepted. Core refuses a method the
638
+ * draft is not eligible for with `INELIGIBLE_SHIPPING_METHOD_ERROR`.
639
+ *
640
+ * @effect write
641
+ */
642
+ selectDelivery(orderId: string, shippingMethodId: string, options?: Call): Promise<DraftOrder>;
643
+ /**
644
+ * Apply the customer's preferred shipping method from their ERP delivery terms. Needs
645
+ * `UpdateOrder`. Refused `DELIVERY_PREFERENCE_NOT_FOUND` (`NotFoundError`, 404) when the draft
646
+ * has no customer yet or the customer has no usable preferred method; otherwise as
647
+ * {@link selectDelivery}.
648
+ *
649
+ * @effect write
650
+ */
651
+ applyPreferredDelivery(orderId: string, options?: Call): Promise<DraftOrder>;
652
+ /**
653
+ * Core's own door to set the draft's shipping method, which records no delivery-terms choice.
654
+ * Needs `CreateOrder`. Prefer {@link selectDelivery}; this one is kept for parity with the
655
+ * engine.
656
+ *
657
+ * @effect write
658
+ */
659
+ setShippingMethod(orderId: string, shippingMethodId: string, options?: Call): Promise<DraftOrder>;
660
+ /**
661
+ * Price the draft's lines again against today's price lists and rules. Needs `UpdateOrder`.
662
+ * Run it when a draft is opened: the engine prices a line only when it is added or changed, so
663
+ * a draft started before a price-list change keeps the older prices until then.
664
+ *
665
+ * It writes only when something moved (a line's price, an order-level rule, a shipping price):
666
+ * `changed: false` means nothing was saved, so opening a draft in two tabs never overwrites
667
+ * either. Read the draft again with {@link get} after a `changed: true`.
668
+ *
669
+ * Refused `ORDER_NOT_DRAFT` for an order that is not a draft, `ENTITY_NOT_FOUND` for none.
670
+ *
671
+ * @effect write
672
+ */
673
+ reprice(orderId: string, options?: Call): Promise<DraftRepriceOutcome>;
674
+ /**
675
+ * Replace the draft's lines, addresses and shipping method with those of an earlier order of
676
+ * the store that was PLACED. Needs `CreateOrder` and `ReadOrder`; selecting the shipping
677
+ * method also needs `UpdateOrder` (without it, `shippingMethodApplied` is `false`).
678
+ *
679
+ * - A line at a manual price keeps it, with its note, and `options.reasonCode` as its discount
680
+ * reason (one of the store's active reasons, `orders.manualDiscounts.reasons`). Every other
681
+ * line is priced from today's catalogue and price lists.
682
+ * - The addresses are copied with where they came from: the source's "this order only" flag,
683
+ * and its link to a saved address when the draft's customer has that address.
684
+ * - A line the store's rules refuse is skipped and listed in `skipped`; a line the store has
685
+ * too little stock for is copied with what there is and listed in `clamped`.
686
+ * - Anything else that fails leaves the draft exactly as it was (all or nothing).
687
+ *
688
+ * One key per attempt (`options.idempotencyKey`): the same key replays the first answer over
689
+ * the draft as it stands now.
690
+ *
691
+ * The whole copy is this one call, so it waits `DRAFT_CLONE_TIMEOUT_MS` (90 s) instead of the
692
+ * default 15 s. When that runs out (`REQUEST_TIMEOUT`) the engine may still be copying: repeat
693
+ * the call under the SAME key, which answers `IDEMPOTENCY_IN_PROGRESS` until the copy ends and
694
+ * its result after.
695
+ *
696
+ * Refused, with nothing changed: `ORDER_NOT_DRAFT` for an `orderId` that is not a draft;
697
+ * `ENTITY_NOT_FOUND` for a draft or a source the store does not have;
698
+ * `DRAFT_CLONE_SOURCE_INVALID` (`ValidationError`, 400) for a source that was never placed or
699
+ * is the draft itself; `DISCOUNT_REASON_UNKNOWN` for a `reasonCode` the store does not have;
700
+ * `DRAFT_CLONE_REFUSED` when a line of the draft could not be removed; `POS_CART_HELD` for a
701
+ * till's held sale; `FORBIDDEN` without `ReadOrder`; `IDEMPOTENCY_CONFLICT` (409) for a key
702
+ * used for another request.
703
+ *
704
+ * @effect write
705
+ */
706
+ cloneFrom(orderId: string, sourceOrderId: string, options?: KeyedDraftCall & {
707
+ reasonCode?: string | null;
708
+ }): Promise<ClonedDraft & {
709
+ idempotencyKey: string;
710
+ }>;
711
+ /**
712
+ * Place the draft: write its payment terms, move it out of `Draft` through every placement
713
+ * gate, and record its payment, in ONE step. All or nothing: a refusal or a failure leaves the
714
+ * order a draft, exactly as it was. Needs `UpdateOrder` (and `CreateOrder` to write
715
+ * `paymentConditionCode`).
716
+ *
717
+ * **`received: true` records money as received; nothing is charged at a provider.** Only an
718
+ * enabled method on the manual handler is taken. Net terms are extended only to a customer in
719
+ * one of the method's customer groups (`NET_TERMS_NOT_ELIGIBLE`), unless the method lets staff
720
+ * use it for any customer.
721
+ *
722
+ * One key per attempt (`options.idempotencyKey`): the same key replays the placed order and
723
+ * records no second payment. After a refusal, send the corrected request under a NEW key: the
724
+ * engine keeps a refusal against its key.
725
+ *
726
+ * Refused, with nothing changed:
727
+ * - `ORDER_NOT_DRAFT`: the order is not a draft (it was already placed: record its payment or
728
+ * cancel it from the order's own methods);
729
+ * - `DRAFT_PAYMENT_METHOD_NOT_FOUND` (`NotFoundError`, 404) / `DRAFT_PAYMENT_METHOD_NOT_MANUAL`:
730
+ * the method is not one of the store's enabled methods, or takes payments through a provider;
731
+ * - `DRAFT_PAYMENT_NET_TERMS_NOT_RECEIVABLE` (`BusinessRuleError`, 422): `received: true` on a
732
+ * net-terms method. A pay-later order is not paid yet: place it as owed (`received: false`)
733
+ * and settle its payment (`payments.settle`) when the money arrives;
734
+ * - `NET_TERMS_NOT_ELIGIBLE`: see above;
735
+ * - a placement gate's own code, with the gate's reason as the message and its field reasons in
736
+ * `details`: `ORDER_MINIMUM_AMOUNT_NOT_MET` / `ORDER_MINIMUM_QUANTITY_NOT_MET` (override it
737
+ * with `minimum.override`), `SHIPPING_ADDRESS_INCOMPLETE`, `SHIPPING_COUNTRY_NOT_SERVED`,
738
+ * `INSUFFICIENT_STOCK`, `CUSTOMER_REQUIRED`, `SHIPPING_METHOD_REQUIRED`, `ORDER_EMPTY`,
739
+ * `VARIANT_NOT_FOR_SALE_IN_CURRENCY` and the others of the platform's placement vocabulary;
740
+ * - `HOOK_REJECTED` / `HOOK_UNAVAILABLE` (`UpstreamError`, 503): an installed app refused the
741
+ * order, or could not be asked;
742
+ * - `TAX_CHANGED` (`ConflictError`, 409): the store's tax provider answers different tax than
743
+ * the draft carries. Call {@link reprice}, read the new total, then place again;
744
+ * - `COUPON_EXPIRED` / `COUPON_USAGE_EXHAUSTED` / `COUPON_INVALID`: a coupon on the draft can no
745
+ * longer be used (it ended, another order used it up, its promotion was switched off) and the
746
+ * order costs more without it. The message names the code, in quotes; the draft still
747
+ * carries it (`get(orderId).couponCodes`). Remove it (`coupons.remove`, which answers the
748
+ * draft with its new total), then place again. `error.details` is empty: the engine states
749
+ * the code and both totals as an object in its GraphQL answer (`extensions.details`), a
750
+ * shape this client does not lift. A dead code whose removal changes no total is dropped
751
+ * silently;
752
+ * - `DRAFT_PLACEMENT_REFUSED` / `DRAFT_PAYMENT_REFUSED`: anything else the engine refused,
753
+ * with its reason as the message;
754
+ * - `DRAFT_PAYMENT_METADATA_INVALID` / `DRAFT_PAYMENT_CONDITION_INVALID` (`ValidationError`,
755
+ * 400): `metadata` is not an object; `paymentConditionCode` is longer than 64 characters;
756
+ * - `POS_CART_HELD` for a till's held sale; `ENTITY_NOT_FOUND` for another store's order;
757
+ * - `IDEMPOTENCY_CONFLICT` (409): the key was used for another request.
758
+ *
759
+ * @effect money
760
+ */
761
+ place(input: PlaceDraftInput, options?: KeyedDraftCall): Promise<PlacedDraftOrder & {
762
+ idempotencyKey: string;
763
+ }>;
764
+ /** The customer's order minimum on a draft, and the staff override of it. */
765
+ minimum: DraftMinimumModule;
766
+ /** Coupon codes on a draft. The keyed order doors are `pricing.coupons`. */
767
+ coupons: DraftCouponsModule;
768
+ }
769
+ export declare const DRAFT_ORDER_FIELDS = "\n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n";
770
+ export declare const CREATE_DRAFT_ORDER_MUTATION = "\n mutation DraftsCreate {\n createDraftOrder {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
771
+ export declare const DELETE_DRAFT_ORDER_MUTATION = "\n mutation DraftsDelete($orderId: ID!) {\n deleteDraftOrder(orderId: $orderId) {\n result\n message\n }\n }\n";
772
+ export declare const SET_DRAFT_CUSTOMER_MUTATION = "\n mutation DraftsSetCustomer($orderId: ID!, $customerId: ID!) {\n setCustomerForDraftOrder(orderId: $orderId, customerId: $customerId) {\n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n";
773
+ export declare const ADD_DRAFT_LINE_MUTATION = "\n mutation DraftsAddLine($orderId: ID!, $input: AddItemToDraftOrderInput!) {\n addItemToDraftOrder(orderId: $orderId, input: $input) {\n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n \n ... on OrderInterceptorError {\n interceptorError\n }\n ... on InsufficientStockError {\n quantityAvailable\n order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n ... on ErrorResult {\n errorCode\n message\n }\n\n }\n }\n";
774
+ export declare const ADJUST_DRAFT_LINE_MUTATION = "\n mutation DraftsAdjustLine($orderId: ID!, $input: AdjustDraftOrderLineInput!) {\n adjustDraftOrderLine(orderId: $orderId, input: $input) {\n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n \n ... on OrderInterceptorError {\n interceptorError\n }\n ... on InsufficientStockError {\n quantityAvailable\n order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n ... on ErrorResult {\n errorCode\n message\n }\n\n }\n }\n";
775
+ export declare const REMOVE_DRAFT_LINE_MUTATION = "\n mutation DraftsRemoveLine($orderId: ID!, $orderLineId: ID!) {\n removeDraftOrderLine(orderId: $orderId, orderLineId: $orderLineId) {\n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on OrderInterceptorError {\n interceptorError\n }\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n";
776
+ export declare const SET_DRAFT_FIELDS_MUTATION = "\n mutation DraftsSetFields($orderId: ID!, $input: UpdateOrderInput!) {\n setDraftOrderCustomFields(orderId: $orderId, input: $input) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
777
+ export declare const DRAFT_ADDRESS_DEFAULTS_QUERY = "\n query DraftsAddressDefaults($orderId: ID!) {\n draftOrderAddressDefaults(orderId: $orderId) {\n shipping {\n \n source\n customerAddressId\n address {\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n temporary\n temporaryInferred\n\n }\n billing {\n \n source\n customerAddressId\n address {\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n temporary\n temporaryInferred\n\n }\n billingSameAsShipping\n }\n }\n";
778
+ export declare const SAVE_DRAFT_ADDRESSES_MUTATION = "\n mutation DraftsSaveAddresses(\n $orderId: ID!\n $input: SaveDraftOrderAddressesInput!\n $idempotencyKey: String\n ) {\n saveDraftOrderAddresses(orderId: $orderId, input: $input, idempotencyKey: $idempotencyKey) {\n order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n createdAddressIds\n }\n }\n";
779
+ export declare const SET_DRAFT_SHIPPING_ADDRESS_MUTATION = "\n mutation DraftsSetShippingAddress($orderId: ID!, $input: CreateAddressInput!) {\n setDraftOrderShippingAddress(orderId: $orderId, input: $input) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
780
+ export declare const SET_DRAFT_BILLING_ADDRESS_MUTATION = "\n mutation DraftsSetBillingAddress($orderId: ID!, $input: CreateAddressInput!) {\n setDraftOrderBillingAddress(orderId: $orderId, input: $input) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
781
+ export declare const UNSET_DRAFT_SHIPPING_ADDRESS_MUTATION = "\n mutation DraftsUnsetShippingAddress($orderId: ID!) {\n unsetDraftOrderShippingAddress(orderId: $orderId) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
782
+ export declare const UNSET_DRAFT_BILLING_ADDRESS_MUTATION = "\n mutation DraftsUnsetBillingAddress($orderId: ID!) {\n unsetDraftOrderBillingAddress(orderId: $orderId) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
783
+ export declare const DRAFT_SHIPPING_QUOTES_QUERY = "\n query DraftsShippingQuotes($orderId: ID!) {\n eligibleShippingMethodsForDraftOrder(orderId: $orderId) {\n id\n code\n name\n description\n price\n priceWithTax\n metadata\n isPreferred\n isDeliveryTermsEligible\n }\n }\n";
784
+ export declare const SELECT_DRAFT_DELIVERY_MUTATION = "\n mutation DraftsSelectDelivery($orderId: ID!, $shippingMethodId: ID!) {\n selectDraftOrderDeliveryMethod(orderId: $orderId, shippingMethodId: $shippingMethodId) {\n \n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on ErrorResult {\n errorCode\n message\n }\n\n }\n }\n";
785
+ export declare const APPLY_PREFERRED_DRAFT_DELIVERY_MUTATION = "\n mutation DraftsApplyPreferredDelivery($orderId: ID!) {\n applyPreferredDeliveryMethodToDraftOrder(orderId: $orderId) {\n \n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on ErrorResult {\n errorCode\n message\n }\n\n }\n }\n";
786
+ export declare const SET_DRAFT_SHIPPING_METHOD_MUTATION = "\n mutation DraftsSetShippingMethod($orderId: ID!, $shippingMethodId: ID!) {\n setDraftOrderShippingMethod(orderId: $orderId, shippingMethodId: $shippingMethodId) {\n \n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on ErrorResult {\n errorCode\n message\n }\n\n }\n }\n";
787
+ export declare const REPRICE_DRAFT_MUTATION = "\n mutation DraftsReprice($orderId: ID!) {\n repriceDraftOrder(orderId: $orderId) {\n success\n changed\n linesRepriced\n error\n errorCode\n }\n }\n";
788
+ /**
789
+ * The same mutation as an engine released before 2026-10-10 serves it, with no `errorCode`.
790
+ * Used only when that engine refuses the current document at validation.
791
+ */
792
+ export declare const REPRICE_DRAFT_LEGACY_MUTATION = "\n mutation DraftsRepriceLegacy($orderId: ID!) {\n repriceDraftOrder(orderId: $orderId) {\n success\n changed\n linesRepriced\n error\n }\n }\n";
793
+ export declare const DRAFT_MINIMUM_STATUS_QUERY = "\n query DraftsMinimumStatus($orderId: ID!) {\n draftOrderMinimumStatus(orderId: $orderId) {\n belowMinimum\n message\n overridden\n overriddenAt\n overriddenBy\n reason\n }\n }\n";
794
+ export declare const OVERRIDE_DRAFT_MINIMUM_MUTATION = "\n mutation DraftsMinimumOverride($orderId: ID!, $reason: String) {\n overrideDraftOrderMinimum(orderId: $orderId, reason: $reason) {\n id\n }\n }\n";
795
+ export declare const CLEAR_DRAFT_MINIMUM_MUTATION = "\n mutation DraftsMinimumClear($orderId: ID!) {\n clearDraftOrderMinimumOverride(orderId: $orderId) {\n id\n }\n }\n";
796
+ export declare const APPLY_DRAFT_COUPON_MUTATION = "\n mutation DraftsApplyCoupon($orderId: ID!, $couponCode: String!) {\n applyCouponCodeToDraftOrder(orderId: $orderId, couponCode: $couponCode) {\n ... on Order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n";
797
+ export declare const REMOVE_DRAFT_COUPON_MUTATION = "\n mutation DraftsRemoveCoupon($orderId: ID!, $couponCode: String!) {\n removeCouponCodeFromDraftOrder(orderId: $orderId, couponCode: $couponCode) {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n }\n";
798
+ export declare const PLACE_DRAFT_MUTATION = "\n mutation DraftsPlace($input: PlaceDraftOrderInput!, $idempotencyKey: String!) {\n placeDraftOrder(input: $input, idempotencyKey: $idempotencyKey) {\n id\n code\n state\n currencyCode\n totalWithTax\n payments {\n id\n state\n method\n amount\n transactionId\n }\n }\n }\n";
799
+ export declare const CLONE_DRAFT_MUTATION = "\n mutation DraftsCloneFrom(\n $orderId: ID!\n $sourceOrderId: ID!\n $reasonCode: String\n $idempotencyKey: String!\n ) {\n cloneOrderToDraftOrder(\n orderId: $orderId\n sourceOrderId: $sourceOrderId\n reasonCode: $reasonCode\n idempotencyKey: $idempotencyKey\n ) {\n order {\n \n id\n code\n state\n currencyCode\n subTotal\n subTotalWithTax\n shipping\n shippingWithTax\n total\n totalWithTax\n customer {\n id\n firstName\n lastName\n emailAddress\n }\n lines {\n id\n quantity\n unitPrice\n unitPriceWithTax\n listPriceIncludesTax\n linePrice\n linePriceWithTax\n productVariant {\n id\n name\n sku\n }\n customFields {\n unitPriceOverride\n priceOverrideReason\n unitPriceImported\n }\n }\n shippingLines {\n id\n price\n priceWithTax\n shippingMethod {\n id\n code\n name\n }\n }\n couponCodes\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n billingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n\n }\n customFields {\n paymentConditionCode\n paymentTermsDays\n poNumber\n orderNotes\n requestedDeliveryDate\n customerShippingAddressId\n customerBillingAddressId\n shippingAddressIsTemporary\n billingAddressIsTemporary\n }\n\n }\n skipped {\n sourceLineId\n reason\n message\n }\n clamped {\n sourceLineId\n quantityAdded\n }\n shippingMethodApplied\n }\n }\n";
800
+ export declare function createOrderDraftsModule(transport: Transport, getModule: OrderGetModule): OrderDraftsModule;