@sixtyninecommerce/admin 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/README.md +5772 -118
  2. package/dist/auth/index.d.ts +7 -1
  3. package/dist/auth/index.js +8 -1
  4. package/dist/catalog/assets.d.ts +120 -8
  5. package/dist/catalog/assets.js +98 -12
  6. package/dist/catalog/collections.d.ts +279 -14
  7. package/dist/catalog/collections.js +246 -15
  8. package/dist/catalog/documents.d.ts +142 -0
  9. package/dist/catalog/documents.js +114 -0
  10. package/dist/catalog/index.d.ts +54 -6
  11. package/dist/catalog/index.js +10 -1
  12. package/dist/catalog/metadata.d.ts +244 -0
  13. package/dist/catalog/metadata.js +220 -0
  14. package/dist/catalog/products.d.ts +159 -19
  15. package/dist/catalog/products.js +88 -13
  16. package/dist/catalog/properties.d.ts +140 -14
  17. package/dist/catalog/properties.js +65 -1
  18. package/dist/catalog/recommendations.d.ts +288 -0
  19. package/dist/catalog/recommendations.js +237 -0
  20. package/dist/catalog/reviews.d.ts +381 -0
  21. package/dist/catalog/reviews.js +325 -0
  22. package/dist/catalog/types.d.ts +17 -1
  23. package/dist/catalog/types.js +10 -0
  24. package/dist/catalog/variant-find.d.ts +136 -0
  25. package/dist/catalog/variant-find.js +239 -0
  26. package/dist/catalog/variants.d.ts +293 -26
  27. package/dist/catalog/variants.js +164 -7
  28. package/dist/catalog/visibility.d.ts +38 -7
  29. package/dist/catalog/visibility.js +19 -1
  30. package/dist/client.d.ts +121 -9
  31. package/dist/client.js +53 -14
  32. package/dist/content/assets.d.ts +285 -0
  33. package/dist/content/assets.js +181 -0
  34. package/dist/content/forms.d.ts +332 -1
  35. package/dist/content/forms.js +140 -4
  36. package/dist/content/items.d.ts +292 -0
  37. package/dist/content/items.js +170 -0
  38. package/dist/content/menus.d.ts +254 -0
  39. package/dist/content/menus.js +70 -0
  40. package/dist/content/strings.d.ts +137 -0
  41. package/dist/content/strings.js +82 -0
  42. package/dist/content/types.d.ts +282 -0
  43. package/dist/content/types.js +100 -0
  44. package/dist/customers/age-verification.d.ts +66 -0
  45. package/dist/customers/age-verification.js +79 -0
  46. package/dist/customers/credit.d.ts +263 -0
  47. package/dist/customers/credit.js +244 -0
  48. package/dist/customers/delivery-preferences.d.ts +120 -0
  49. package/dist/customers/delivery-preferences.js +97 -0
  50. package/dist/customers/delivery-terms.d.ts +44 -0
  51. package/dist/customers/delivery-terms.js +32 -0
  52. package/dist/customers/groups.d.ts +207 -0
  53. package/dist/customers/groups.js +438 -0
  54. package/dist/customers/index.d.ts +462 -37
  55. package/dist/customers/index.js +317 -40
  56. package/dist/customers/invitation-status.d.ts +57 -0
  57. package/dist/customers/invitation-status.js +21 -0
  58. package/dist/customers/notes.d.ts +67 -0
  59. package/dist/customers/notes.js +51 -0
  60. package/dist/customers/notification-recipients.d.ts +97 -0
  61. package/dist/customers/notification-recipients.js +84 -0
  62. package/dist/customers/saved-lists.d.ts +42 -0
  63. package/dist/customers/saved-lists.js +61 -0
  64. package/dist/customers/vat.d.ts +83 -0
  65. package/dist/customers/vat.js +46 -0
  66. package/dist/customers/wire.d.ts +20 -0
  67. package/dist/customers/wire.js +35 -0
  68. package/dist/documents/ar.d.ts +307 -0
  69. package/dist/documents/ar.js +254 -0
  70. package/dist/documents/emails.d.ts +150 -0
  71. package/dist/documents/emails.js +220 -0
  72. package/dist/documents/index.d.ts +744 -21
  73. package/dist/documents/index.js +438 -24
  74. package/dist/documents/pdf.d.ts +2 -0
  75. package/dist/documents/pdf.js +11 -0
  76. package/dist/fulfillments/create.d.ts +167 -0
  77. package/dist/fulfillments/create.js +216 -0
  78. package/dist/fulfillments/index.d.ts +163 -11
  79. package/dist/fulfillments/index.js +135 -6
  80. package/dist/fulfillments/payment-policy.d.ts +64 -0
  81. package/dist/fulfillments/payment-policy.js +140 -0
  82. package/dist/fulfillments/warehouse.d.ts +724 -0
  83. package/dist/fulfillments/warehouse.js +914 -0
  84. package/dist/geo/index.d.ts +119 -0
  85. package/dist/geo/index.js +107 -0
  86. package/dist/index.d.ts +147 -39
  87. package/dist/index.js +51 -12
  88. package/dist/integrations/afas-actions.d.ts +234 -0
  89. package/dist/integrations/afas-actions.js +310 -0
  90. package/dist/integrations/afas-types.d.ts +483 -0
  91. package/dist/integrations/afas-types.js +5 -0
  92. package/dist/integrations/afas.d.ts +234 -0
  93. package/dist/integrations/afas.js +290 -0
  94. package/dist/integrations/connections.d.ts +103 -0
  95. package/dist/integrations/connections.js +55 -0
  96. package/dist/integrations/esp.d.ts +313 -0
  97. package/dist/integrations/esp.js +169 -0
  98. package/dist/integrations/exact-online-types.d.ts +965 -0
  99. package/dist/integrations/exact-online-types.js +6 -0
  100. package/dist/integrations/exact-online.d.ts +784 -0
  101. package/dist/integrations/exact-online.js +1089 -0
  102. package/dist/integrations/index.d.ts +44 -3
  103. package/dist/integrations/index.js +23 -3
  104. package/dist/integrations/pipeline-discoveries.d.ts +65 -0
  105. package/dist/integrations/pipeline-discoveries.js +65 -0
  106. package/dist/integrations/pipeline-keys.d.ts +13 -0
  107. package/dist/integrations/pipeline-keys.js +22 -0
  108. package/dist/integrations/pipeline-runs.d.ts +119 -0
  109. package/dist/integrations/pipeline-runs.js +87 -0
  110. package/dist/integrations/pipelines.d.ts +87 -15
  111. package/dist/integrations/pipelines.js +41 -22
  112. package/dist/integrations/price-import.d.ts +223 -0
  113. package/dist/integrations/price-import.js +124 -0
  114. package/dist/integrations/types.d.ts +367 -3
  115. package/dist/integrations/types.js +4 -3
  116. package/dist/locations/index.d.ts +66 -0
  117. package/dist/locations/index.js +31 -0
  118. package/dist/meta/index.d.ts +172 -0
  119. package/dist/metafields/index.d.ts +8 -1
  120. package/dist/metafields/index.js +10 -0
  121. package/dist/orders/cancel-with-money.d.ts +237 -0
  122. package/dist/orders/cancel-with-money.js +155 -0
  123. package/dist/orders/commit-edit.d.ts +23 -1
  124. package/dist/orders/commit-edit.js +19 -2
  125. package/dist/orders/deposit-policy.d.ts +3 -1
  126. package/dist/orders/drafts.d.ts +800 -0
  127. package/dist/orders/drafts.js +771 -0
  128. package/dist/orders/fields.d.ts +245 -0
  129. package/dist/orders/fields.js +188 -0
  130. package/dist/orders/get.d.ts +29 -19
  131. package/dist/orders/get.js +17 -8
  132. package/dist/orders/index.d.ts +66 -15
  133. package/dist/orders/index.js +25 -2
  134. package/dist/orders/lifecycle.d.ts +128 -0
  135. package/dist/orders/lifecycle.js +158 -0
  136. package/dist/orders/line-price-preview.d.ts +7 -2
  137. package/dist/orders/list.d.ts +243 -0
  138. package/dist/orders/list.js +487 -0
  139. package/dist/orders/manual-discounts.d.ts +13 -5
  140. package/dist/orders/manual-pricing.d.ts +5 -0
  141. package/dist/orders/money-view.d.ts +149 -0
  142. package/dist/orders/money-view.js +99 -0
  143. package/dist/orders/order-entry.d.ts +20 -7
  144. package/dist/orders/plan-edit.d.ts +34 -2
  145. package/dist/orders/plan-edit.js +112 -11
  146. package/dist/orders/settings.d.ts +201 -0
  147. package/dist/orders/settings.js +325 -0
  148. package/dist/orders/status.d.ts +159 -13
  149. package/dist/orders/status.js +21 -0
  150. package/dist/orders/surcharges.d.ts +20 -1
  151. package/dist/orders/surcharges.js +37 -11
  152. package/dist/payments/account-credit.d.ts +46 -0
  153. package/dist/payments/account-credit.js +42 -0
  154. package/dist/payments/ar.d.ts +292 -0
  155. package/dist/payments/ar.js +223 -0
  156. package/dist/payments/connected-account.d.ts +47 -0
  157. package/dist/payments/connected-account.js +61 -0
  158. package/dist/payments/credit-noted-fields.d.ts +19 -0
  159. package/dist/payments/credit-noted-fields.js +69 -0
  160. package/dist/payments/customer-consent.d.ts +30 -0
  161. package/dist/payments/customer-consent.js +49 -0
  162. package/dist/payments/index.d.ts +340 -19
  163. package/dist/payments/index.js +151 -1
  164. package/dist/payments/methods.d.ts +303 -8
  165. package/dist/payments/methods.js +337 -7
  166. package/dist/payments/mollie-methods.d.ts +159 -0
  167. package/dist/payments/mollie-methods.js +141 -0
  168. package/dist/payments/payment-links.d.ts +180 -0
  169. package/dist/payments/payment-links.js +97 -0
  170. package/dist/payments/provider-keys.d.ts +150 -0
  171. package/dist/payments/provider-keys.js +118 -0
  172. package/dist/payments/providers.d.ts +86 -11
  173. package/dist/payments/providers.js +29 -0
  174. package/dist/payments/requests.d.ts +147 -0
  175. package/dist/payments/requests.js +93 -0
  176. package/dist/payments/store-credit-fields.d.ts +15 -0
  177. package/dist/payments/store-credit-fields.js +51 -0
  178. package/dist/pickups/index.d.ts +106 -0
  179. package/dist/pickups/index.js +108 -0
  180. package/dist/platform/channels.d.ts +132 -0
  181. package/dist/platform/channels.js +128 -0
  182. package/dist/platform/email-gateways.d.ts +165 -0
  183. package/dist/platform/email-gateways.js +78 -0
  184. package/dist/platform/geo.d.ts +123 -0
  185. package/dist/platform/geo.js +144 -0
  186. package/dist/platform/tax.d.ts +162 -0
  187. package/dist/platform/tax.js +169 -0
  188. package/dist/pos/anomalies.d.ts +158 -0
  189. package/dist/pos/anomalies.js +64 -0
  190. package/dist/pos/assisted-selling.d.ts +79 -0
  191. package/dist/pos/assisted-selling.js +38 -0
  192. package/dist/pos/exchanges.d.ts +108 -0
  193. package/dist/pos/exchanges.js +22 -0
  194. package/dist/pos/gift-cards.d.ts +135 -0
  195. package/dist/pos/gift-cards.js +47 -0
  196. package/dist/pos/index.d.ts +2370 -58
  197. package/dist/pos/index.js +854 -7
  198. package/dist/pos/no-receipt.d.ts +94 -0
  199. package/dist/pos/no-receipt.js +25 -0
  200. package/dist/pos/offline-sales.d.ts +228 -0
  201. package/dist/pos/offline-sales.js +170 -0
  202. package/dist/pos/pay-by-link.d.ts +143 -0
  203. package/dist/pos/pay-by-link.js +57 -0
  204. package/dist/pos/quick-keys.d.ts +103 -0
  205. package/dist/pos/quick-keys.js +45 -0
  206. package/dist/pos/reports.d.ts +360 -0
  207. package/dist/pos/reports.js +62 -0
  208. package/dist/pos/returns.d.ts +244 -0
  209. package/dist/pos/returns.js +83 -0
  210. package/dist/pricing/bulk-coupons.d.ts +139 -0
  211. package/dist/pricing/bulk-coupons.js +112 -0
  212. package/dist/pricing/index.d.ts +174 -4
  213. package/dist/pricing/index.js +174 -1
  214. package/dist/pricing/price-lists.d.ts +606 -0
  215. package/dist/pricing/price-lists.js +600 -0
  216. package/dist/purchasing/alerts.d.ts +104 -0
  217. package/dist/purchasing/alerts.js +88 -0
  218. package/dist/purchasing/backorders.d.ts +61 -0
  219. package/dist/purchasing/backorders.js +92 -0
  220. package/dist/purchasing/cost.d.ts +110 -0
  221. package/dist/purchasing/cost.js +86 -0
  222. package/dist/purchasing/index.d.ts +54 -0
  223. package/dist/purchasing/index.js +24 -0
  224. package/dist/purchasing/links.d.ts +263 -0
  225. package/dist/purchasing/links.js +192 -0
  226. package/dist/purchasing/purchase-orders.d.ts +551 -0
  227. package/dist/purchasing/purchase-orders.js +491 -0
  228. package/dist/purchasing/receipts.d.ts +396 -0
  229. package/dist/purchasing/receipts.js +287 -0
  230. package/dist/purchasing/replenishment.d.ts +281 -0
  231. package/dist/purchasing/replenishment.js +240 -0
  232. package/dist/purchasing/returns.d.ts +273 -0
  233. package/dist/purchasing/returns.js +229 -0
  234. package/dist/purchasing/settings.d.ts +152 -0
  235. package/dist/purchasing/settings.js +181 -0
  236. package/dist/purchasing/suppliers.d.ts +476 -0
  237. package/dist/purchasing/suppliers.js +438 -0
  238. package/dist/quotes/index.d.ts +518 -0
  239. package/dist/quotes/index.js +439 -0
  240. package/dist/reports/index.d.ts +71 -8
  241. package/dist/reports/index.js +74 -11
  242. package/dist/returns/index.d.ts +675 -21
  243. package/dist/returns/index.js +756 -11
  244. package/dist/search/index.d.ts +76 -1
  245. package/dist/search/index.js +63 -0
  246. package/dist/seo/config.d.ts +128 -0
  247. package/dist/seo/config.js +95 -0
  248. package/dist/seo/redirects.d.ts +125 -0
  249. package/dist/seo/redirects.js +60 -1
  250. package/dist/seo/settings.d.ts +147 -0
  251. package/dist/seo/settings.js +209 -0
  252. package/dist/shipping/definitions.d.ts +29 -0
  253. package/dist/shipping/definitions.js +47 -0
  254. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  255. package/dist/shipping/fulfillment-profiles.js +104 -0
  256. package/dist/shipping/hendriks.d.ts +97 -0
  257. package/dist/shipping/hendriks.js +50 -0
  258. package/dist/shipping/index.d.ts +54 -0
  259. package/dist/shipping/index.js +27 -0
  260. package/dist/shipping/methods.d.ts +205 -0
  261. package/dist/shipping/methods.js +240 -0
  262. package/dist/shipping/myparcel.d.ts +668 -0
  263. package/dist/shipping/myparcel.js +466 -0
  264. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  265. package/dist/shipping/parcel-rule.d.ts +6 -5
  266. package/dist/shipping/parcel-rule.js +21 -23
  267. package/dist/shipping/rate-tables.d.ts +324 -0
  268. package/dist/shipping/rate-tables.js +390 -0
  269. package/dist/shipping/ship-to-countries.d.ts +75 -0
  270. package/dist/shipping/ship-to-countries.js +47 -0
  271. package/dist/stock/by-location.d.ts +86 -0
  272. package/dist/stock/by-location.js +94 -0
  273. package/dist/stock/index.d.ts +18 -4
  274. package/dist/stock/index.js +7 -0
  275. package/dist/stock/locations.d.ts +144 -0
  276. package/dist/stock/locations.js +168 -0
  277. package/dist/stock/settings.d.ts +106 -0
  278. package/dist/stock/settings.js +103 -0
  279. package/dist/stock/transfers.d.ts +386 -52
  280. package/dist/stock/transfers.js +222 -17
  281. package/dist/stored-value/index.d.ts +312 -11
  282. package/dist/stored-value/index.js +223 -4
  283. package/dist/subscriptions/index.d.ts +682 -0
  284. package/dist/subscriptions/index.js +815 -0
  285. package/dist/tax/display-policy.d.ts +105 -0
  286. package/dist/tax/display-policy.js +84 -0
  287. package/dist/tax/index.d.ts +79 -1
  288. package/dist/tax/index.js +52 -0
  289. package/dist/tenant/email-style.d.ts +102 -0
  290. package/dist/tenant/email-style.js +72 -0
  291. package/dist/tenant/email-templates.d.ts +287 -0
  292. package/dist/tenant/email-templates.js +271 -0
  293. package/dist/tenant/notifications.d.ts +23 -17
  294. package/dist/tenant/settings-sources.d.ts +1 -1
  295. package/dist/tenant/time-zone.d.ts +17 -0
  296. package/dist/tenant/time-zone.js +11 -0
  297. package/dist/types.d.ts +50 -3
  298. package/dist/users/index.d.ts +3 -0
  299. package/dist/users/index.js +2 -0
  300. package/dist/users/warehouses.d.ts +50 -0
  301. package/dist/users/warehouses.js +51 -0
  302. package/package.json +2 -2
@@ -0,0 +1,668 @@
1
+ import { type PlatformError, type Transport, type VendureErrorResult } from '@sixtyninecommerce/core';
2
+ import { type FulfillmentLabelFormat } from '../fulfillments/index.js';
3
+ import type { Call } from '../types.js';
4
+ /**
5
+ * The store-wide default label format: `A4` or `A6` paper, or `BOTH`, which has MyParcel make
6
+ * both for every new fulfillment.
7
+ */
8
+ export type MyparcelLabelFormat = 'A4' | 'A6' | 'BOTH';
9
+ /**
10
+ * A store's MyParcel set-up, as every reader gets it: both secrets masked. The API key is never
11
+ * readable again once saved, and the webhook secret is only ever needed by the platform itself
12
+ * (it registers the callback URL at MyParcel), so neither is answered in clear here.
13
+ */
14
+ export interface MyparcelConfig {
15
+ id: string;
16
+ channelId: string;
17
+ /** A key is stored. */
18
+ hasApiKey: boolean;
19
+ /**
20
+ * The key's preview, for display only: mask glyphs (`•`) and its last 4 characters. It is never
21
+ * the key: `update` refuses it (`SECRET_ARG_MASK_INVALID`).
22
+ */
23
+ maskedApiKey: string;
24
+ /** The webhook secret's preview, for display only: 8 mask glyphs and its last 4 characters. */
25
+ maskedWebhookSecret: string;
26
+ defaultLabelFormat: MyparcelLabelFormat;
27
+ /** MyParcel is on for the store. Independent of the key: switching off keeps it. */
28
+ enabled: boolean;
29
+ }
30
+ /** What `config.update` takes: the key alone. */
31
+ export interface UpdateMyparcelConfigInput {
32
+ /** The MyParcel API key, from the store's MyParcel account. Trimmed; never empty. */
33
+ apiKey: string;
34
+ }
35
+ /** A carrier MyParcel offers. The list is the same for every store (`GET /carriers`). */
36
+ export interface MyparcelCarrier {
37
+ /** MyParcel's carrier id, as a shipment names it. */
38
+ id: number;
39
+ /** The carrier's slug (`postnl`, `dhlforyou`, …). */
40
+ name: string;
41
+ /** Its name for people (`PostNL`). */
42
+ human: string;
43
+ /** MyParcel's logo links; `''` where MyParcel has none. */
44
+ meta: {
45
+ logoSvg: string;
46
+ logoPng: string;
47
+ };
48
+ }
49
+ /** A stock location's parcel sender address. */
50
+ export interface MyparcelSenderAddress {
51
+ streetLine1: string;
52
+ streetLine2: string | null;
53
+ city: string;
54
+ postalCode: string;
55
+ province: string | null;
56
+ /** ISO 3166-1 alpha-2, upper case. */
57
+ countryCode: string;
58
+ phoneNumber: string | null;
59
+ contactName: string | null;
60
+ company: string | null;
61
+ }
62
+ /** One stock location of the store as a parcel sender. */
63
+ export interface MyparcelSenderLocation {
64
+ /** The stock location's id. */
65
+ id: string;
66
+ name: string;
67
+ /** Its sender address, or `null` when none is stored or the stored one does not parse. */
68
+ address: MyparcelSenderAddress | null;
69
+ /** The store's default sender: a shipment that names no location ships from it. */
70
+ isDefaultSender: boolean;
71
+ /** The address has every field a shipment needs (street, city, postal code, country). */
72
+ isResolvable: boolean;
73
+ }
74
+ /** What `senders.set` writes. */
75
+ export interface SetMyparcelSenderInput {
76
+ stockLocationId: string;
77
+ /** The whole address. `null` or a blank optional field is stored as absent. */
78
+ address: {
79
+ streetLine1: string;
80
+ streetLine2?: string | null;
81
+ city: string;
82
+ postalCode: string;
83
+ province?: string | null;
84
+ countryCode: string;
85
+ phoneNumber?: string | null;
86
+ contactName?: string | null;
87
+ company?: string | null;
88
+ };
89
+ /**
90
+ * Make this location the store's default sender (`true`) or not. Send the location's CURRENT
91
+ * flag to change the address alone: only a change of the flag is judged and written.
92
+ */
93
+ isDefault: boolean;
94
+ }
95
+ /**
96
+ * The MyParcel set-up of the store the client is scoped to (`admin.shipping.myparcel.config`).
97
+ * There is no channel argument: a SuperAdmin head configures ANOTHER store with
98
+ * `admin.withTenant({ scope: { kind: 'channel', code } })`, or a per-call `tenant`.
99
+ *
100
+ * Every method needs `UpdateSettings`. An app installation is refused all of them
101
+ * (`APP_CREDENTIAL_NOT_ALLOWED`), the read included: the engine still answers the webhook secret
102
+ * in clear on an older field of the same object. A store without the MyParcel plugin is refused
103
+ * `PLUGIN_ACCESS_DENIED` (`PermissionDeniedError`, 403) on every write, `remove` included, for an
104
+ * ordinary caller; the engine never refuses a SuperAdmin on that ground.
105
+ */
106
+ export interface MyparcelConfigModule {
107
+ /**
108
+ * The store's set-up, or `null` when no key was ever saved (or it was removed). A stored key the
109
+ * engine can no longer decrypt (its encryption key was rotated) fails this read with the
110
+ * engine's internal error (code `INTERNAL_SERVER_ERROR`: a non-retryable 500, raised as
111
+ * `UpstreamError`), not a coded refusal: the read is not a union. Saving the key again with `update` repairs it; the writes answer the
112
+ * same condition as `MYPARCEL_DECRYPTION_FAILED_ERROR` (`BusinessRuleError`, 422).
113
+ *
114
+ * @effect read
115
+ * @permission UpdateSettings
116
+ */
117
+ get(options?: Call): Promise<MyparcelConfig | null>;
118
+ /**
119
+ * Save the store's API key; the first save also switches MyParcel on, with `A6` labels and a new
120
+ * webhook secret. A later save replaces the key alone (the on/off switch, the label format and
121
+ * the webhook secret stay). The key is trimmed and stored as given: the engine does not test it
122
+ * against MyParcel, so a wrong key fails at the first shipment or label.
123
+ *
124
+ * An empty key is refused here (`TypeError`), never sent: an empty key REMOVES the whole set-up
125
+ * on the wire, and that is `remove()`'s job. The message never quotes the argument.
126
+ *
127
+ * Refused, with nothing stored:
128
+ * - `SECRET_ARG_MASK_INVALID` (`ValidationError`, 400, `details[0].field: 'apiKey'`): a key
129
+ * carrying the mask glyph (`•`), {@link MyparcelConfig.maskedApiKey} sent back included. The
130
+ * preview is never the key; leave the key alone to keep it;
131
+ * - `ORGANIZATION_WORKSPACE_NOT_A_STORE` (`BusinessRuleError`, 422): an organization's workspace
132
+ * ships nothing.
133
+ *
134
+ * @effect write
135
+ * @permission UpdateSettings
136
+ */
137
+ update(input: UpdateMyparcelConfigInput, options?: Call): Promise<MyparcelConfig>;
138
+ /**
139
+ * Remove the store's MyParcel set-up: the API key, the label format, the on/off switch AND the
140
+ * webhook secret. MyParcel's status and label callbacks for the store are refused from then on,
141
+ * and every MyParcel shipment or label of the store is refused (`MYPARCEL_NOT_CONFIGURED_ERROR`)
142
+ * until a key is saved again, which mints a new webhook secret. Resolves when the store has no
143
+ * set-up any more, also when it had none. Allowed in an organization's workspace.
144
+ *
145
+ * @effect destructive
146
+ * @permission UpdateSettings
147
+ */
148
+ remove(options?: Call): Promise<void>;
149
+ /**
150
+ * Set the store-wide default label format. A fulfillment's own format, when it has one, wins.
151
+ *
152
+ * Refused: `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`, 422) before a key is saved;
153
+ * `MYPARCEL_INVALID_LABEL_FORMAT_ERROR` (422) for any other value.
154
+ *
155
+ * @effect write
156
+ * @permission UpdateSettings
157
+ */
158
+ setLabelFormat(format: MyparcelLabelFormat, options?: Call): Promise<MyparcelConfig>;
159
+ /**
160
+ * Switch MyParcel on or off for the store without touching the key or the webhook secret. Off,
161
+ * every new MyParcel shipment and label of the store is refused; what MyParcel already holds is
162
+ * left as it is.
163
+ *
164
+ * Refused: `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`, 422) before a key is saved;
165
+ * switching ON in an organization's workspace, `ORGANIZATION_WORKSPACE_NOT_A_STORE` (422).
166
+ *
167
+ * @effect write
168
+ * @permission UpdateSettings
169
+ */
170
+ setEnabled(enabled: boolean, options?: Call): Promise<MyparcelConfig>;
171
+ /**
172
+ * Replace the store's webhook secret, answering the set-up with the NEW secret's preview (the
173
+ * secret itself is never answered). The old secret stops authenticating at once, and MyParcel
174
+ * keeps calling the old callback URL, refused, until the engine's worker registers the webhooks
175
+ * again, which it does when it starts. Status and label updates sent meanwhile are lost.
176
+ *
177
+ * The secret is answered in clear by the engine's older `webhookSecret` field and stored in
178
+ * clear; hashing it at rest is an open follow-up, after which only a preview can be read.
179
+ *
180
+ * Refused: `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`, 422) before a key is saved.
181
+ *
182
+ * @effect destructive
183
+ * @permission UpdateSettings
184
+ */
185
+ regenerateWebhookSecret(options?: Call): Promise<MyparcelConfig>;
186
+ }
187
+ /**
188
+ * The stock locations of the store as MyParcel parcel senders (`admin.shipping.myparcel.senders`).
189
+ * A location's sender address and default flag are columns of its ONE row, so a location several
190
+ * stores hold has one sender for all of them.
191
+ */
192
+ export interface MyparcelSendersModule {
193
+ /**
194
+ * Every stock location of the store with its sender address, default flag and whether a
195
+ * shipment can ship from it. Needs `ReadStockLocation`; answered whether or not MyParcel is set
196
+ * up.
197
+ *
198
+ * @effect read
199
+ * @permission ReadStockLocation
200
+ */
201
+ list(options?: Call): Promise<MyparcelSenderLocation[]>;
202
+ /**
203
+ * Set a stock location's sender address, and whether it is the store's default sender. Making it
204
+ * the default clears the flag on the store's other locations in the same transaction, so the
205
+ * store keeps exactly one. This is the one door that writes either column: core's stock-location
206
+ * create and update refuse a change to them (`STOCK_LOCATION_SENDER_READ_ONLY`).
207
+ *
208
+ * Refused, with nothing written:
209
+ * - `MYPARCEL_INVALID_SENDER_ERROR` (`BusinessRuleError`, 422): a mandatory field missing or a
210
+ * country code that is not 2 letters; `details[]` names each field (`streetLine1`, `city`,
211
+ * `postalCode`, `countryCode`);
212
+ * - `MYPARCEL_STOCK_LOCATION_NOT_FOUND_ERROR` (`NotFoundError`, 404): no such location in the
213
+ * store (another store's, a missing and a malformed id alike);
214
+ * - `SHARED_STOCK_LOCATION_NOT_ALLOWED` (403): the location, or a default it would clear, is
215
+ * also another store's, and the caller may not update stock locations there;
216
+ * - `LOCATION_NOT_ALLOWED` (403): a credential restricted to some locations names, or would
217
+ * clear the default of, one it does not hold;
218
+ * - `ORGANIZATION_WORKSPACE_NOT_A_STORE` / `DEFAULT_SENDER_NOT_A_STORE` (422): changing the
219
+ * default flag in an organization's workspace or on the platform root. Sending the current
220
+ * flag there saves the address alone.
221
+ *
222
+ * @effect write
223
+ * @permission UpdateStockLocation
224
+ */
225
+ set(input: SetMyparcelSenderInput, options?: Call): Promise<MyparcelSenderLocation>;
226
+ }
227
+ /**
228
+ * One MyParcel shipment (one parcel) as MyParcel holds it, read live: the engine stores none of
229
+ * these fields itself.
230
+ */
231
+ export interface MyparcelShipment {
232
+ /** MyParcel's shipment id. */
233
+ id: number;
234
+ /** What MyParcel knows the shipment by (`F-12`, `F-12#2`, a transfer's code); null when none. */
235
+ referenceIdentifier: string | null;
236
+ /** The carrier's barcode; null until MyParcel has registered the shipment. */
237
+ barcode: string | null;
238
+ /** MyParcel's status number: 1 is a concept, 2 registered, 3 and up on its way or done. */
239
+ status: number;
240
+ /** MyParcel's carrier id (`carriers()` names it). */
241
+ carrierId: number;
242
+ /**
243
+ * When MyParcel created the shipment, as MyParcel writes it, passed through untouched. MyParcel
244
+ * sends no offset: never read it as UTC.
245
+ */
246
+ created: string;
247
+ /** When MyParcel last changed the shipment, as `created` is written. */
248
+ modified: string;
249
+ /** The recipient's track-and-trace page at MyParcel; null when MyParcel has none. */
250
+ linkConsumerPortal: string | null;
251
+ }
252
+ /** Whether MyParcel has made a shipment's label in one format: `pending` until it has. */
253
+ export interface MyparcelLabelReadiness {
254
+ status: 'pending' | 'ready';
255
+ }
256
+ /** One shipment's label as a PDF, fetched live from MyParcel. */
257
+ export interface MyparcelShipmentLabel {
258
+ format: FulfillmentLabelFormat;
259
+ contentType: string;
260
+ /** A download filename, from the order code when there is one. */
261
+ filename: string;
262
+ bytes: Uint8Array;
263
+ }
264
+ /** What `labels.request` asks for: one parcel's label, in one format. */
265
+ export interface RequestMyparcelLabelInput {
266
+ /** The fulfillment holding the shipment. */
267
+ fulfillmentId: string;
268
+ /** The shipment (one parcel) of that fulfillment. */
269
+ shipmentId: number;
270
+ format: FulfillmentLabelFormat;
271
+ }
272
+ /**
273
+ * What one carrier can ship, from the engine's static carrier table (the same for every store).
274
+ * Join it with `carriers()` on `carrierId` for the carrier's name for people and its logo.
275
+ */
276
+ export interface MyparcelCarrierCapability {
277
+ /** MyParcel's carrier id. */
278
+ carrierId: number;
279
+ /** The carrier's slug (`postnl`, …). */
280
+ name: string;
281
+ /** MyParcel package-type numbers the carrier takes (1 package, 2 mailbox, 3 letter, …). */
282
+ packageTypes: number[];
283
+ /** MyParcel delivery-type numbers it offers (1 morning, 2 standard, 3 evening, 4 pickup, …). */
284
+ deliveryTypes: number[];
285
+ /** ISO 3166-1 alpha-2 codes, or a scope token (`NL`, `BE`, `EU`, `GLOBAL`). */
286
+ countries: string[];
287
+ /** The shipment option keys it accepts, as MyParcel writes them (`signature`, `only_recipient`, …). */
288
+ supportedOptions: string[];
289
+ supportsPickup: boolean;
290
+ /** Rules across options a form should enforce, in words. */
291
+ constraints: string[];
292
+ }
293
+ /** What `deliveryOptions` asks MyParcel about: one destination and, optionally, the parcel. */
294
+ export interface MyparcelDeliveryOptionsInput {
295
+ /** The destination's postal code. Required: a blank one is refused before any request. */
296
+ postalCode: string;
297
+ /** ISO 3166-1 alpha-2; the engine assumes `NL` when absent. */
298
+ countryCode?: string | null;
299
+ houseNumber?: string | null;
300
+ /** MyParcel's carrier id; a carrier the engine cannot name to MyParcel is left out of the ask. */
301
+ carrierId?: number | null;
302
+ /** The parcel's weight in grams. */
303
+ weight?: number | null;
304
+ /** MyParcel's package-type number. */
305
+ packageType?: number | null;
306
+ /** As MyParcel takes it (`YYYY-MM-DD`). */
307
+ deliveryDate?: string | null;
308
+ /** The store's cut-off time (`HH:MM`). */
309
+ cutoffTime?: string | null;
310
+ mondayDelivery?: boolean | null;
311
+ saturdayDelivery?: boolean | null;
312
+ /** MyParcel's drop-off days list (`1;2;3;4;5`). */
313
+ dropoffDays?: string | null;
314
+ }
315
+ /** An amount in MINOR units (cents) with its currency, as MyParcel answers it. */
316
+ export interface MyparcelMoney {
317
+ amount: number;
318
+ currency: string;
319
+ }
320
+ /** One priced delivery window, one row per window of a day. */
321
+ export interface MyparcelDeliveryOption {
322
+ /** MyParcel's delivery-type number of this window. */
323
+ deliveryType: number;
324
+ /** The delivery day as MyParcel writes it; never read it as a UTC instant. */
325
+ date: string;
326
+ startTime: string | null;
327
+ endTime: string | null;
328
+ /**
329
+ * MyParcel's base rate for the window, or `null` when MyParcel named none. Carrier surcharges
330
+ * are settled when the shipment is created, so this is a quote, not the bill.
331
+ */
332
+ price: MyparcelMoney | null;
333
+ }
334
+ /** A pickup point MyParcel offers near the destination. */
335
+ export interface MyparcelPickupOption {
336
+ locationCode: string;
337
+ locationName: string;
338
+ street: string;
339
+ number: string;
340
+ numberSuffix: string | null;
341
+ postalCode: string;
342
+ city: string;
343
+ countryCode: string;
344
+ /** The carrier asked for, or `null` when the ask named none. */
345
+ carrierId: number | null;
346
+ /** Metres from the destination, when MyParcel says. */
347
+ distance: number | null;
348
+ }
349
+ /** MyParcel's answer for a destination: delivery windows and pickup points. */
350
+ export interface MyparcelDeliveryOptions {
351
+ deliveryOptions: MyparcelDeliveryOption[];
352
+ pickupOptions: MyparcelPickupOption[];
353
+ }
354
+ /**
355
+ * One MyParcel handler argument as the create-shipment form writes it (`carrier`, `packageType`,
356
+ * `parcelCount`, `deliveryType`, `pickupLocation`, the shipment options, …). The engine reads the
357
+ * same names as `admin.fulfillments.create`'s `handlerArgs` for the `myparcel` handler.
358
+ */
359
+ export interface MyparcelHandlerArgument {
360
+ name: string;
361
+ value: string;
362
+ }
363
+ /** What `shipments.recreate` books again. */
364
+ export interface RecreateMyparcelShipmentInput {
365
+ /** The fulfillment whose MyParcel shipment(s) are replaced. */
366
+ fulfillmentId: string;
367
+ /**
368
+ * The new shipment's choices. A `parcelCount` left out keeps the fulfillment's recorded parcel
369
+ * count (never "one"); an empty list books the same parcels with the engine's defaults.
370
+ */
371
+ handlerArguments: readonly MyparcelHandlerArgument[];
372
+ }
373
+ /** What `shipments.import` attaches. */
374
+ export interface ImportMyparcelShipmentInput {
375
+ /** A fulfillment of the store that holds no MyParcel shipment yet. */
376
+ fulfillmentId: string;
377
+ /** The numeric id the MyParcel backoffice shows for the shipment. */
378
+ shipmentId: number;
379
+ }
380
+ /** The shipment now on the fulfillment, and the label format it prints in. */
381
+ export interface MyparcelShipmentAttached {
382
+ /** The first parcel's MyParcel shipment id. */
383
+ shipmentId: number;
384
+ labelFormat: MyparcelLabelFormat;
385
+ }
386
+ /** What `returns.create` asks MyParcel for: a return label linked to a shipment of the store. */
387
+ export interface CreateMyparcelReturnInput {
388
+ /** The outbound shipment (one parcel) the customer sends back. */
389
+ parentShipmentId: number;
390
+ /** MyParcel's carrier id for the return. */
391
+ carrier: number;
392
+ /** The customer's name, as the return label carries it. Trimmed; never blank. */
393
+ name: string;
394
+ /** Where MyParcel sends the customer the return label. Trimmed; never blank. */
395
+ email: string;
396
+ }
397
+ /** The return shipment MyParcel made. */
398
+ export interface MyparcelReturnShipment {
399
+ shipmentId: number;
400
+ }
401
+ /**
402
+ * The store's MyParcel shipments (`admin.shipping.myparcel.shipments`). A shipment is named by
403
+ * MyParcel's id, and only one a fulfillment or a stock transfer of the store holds is answered:
404
+ * two stores may share one MyParcel account, whose ids are small and sequential.
405
+ */
406
+ export interface MyparcelShipmentsModule {
407
+ /**
408
+ * The shipment as MyParcel answers it now (one call to MyParcel), or `null` when MyParcel no
409
+ * longer holds a shipment the store still records. Needs `ReadOrder`.
410
+ *
411
+ * Refused: a shipment no fulfillment or stock transfer of the store holds (another store's, a
412
+ * missing id) is `ENTITY_NOT_FOUND` (`NotFoundError`), before MyParcel is asked. A credential
413
+ * restricted to stock locations (an API token or app installation with `locationIds`) reads only
414
+ * a shipment of a fulfillment that ships from one of them (`LOCATION_OUT_OF_SCOPE`, 422). A store
415
+ * without the MyParcel plugin still reads a shipment one of its fulfillments holds; any other is
416
+ * `PLUGIN_ACCESS_DENIED` (403) for an ordinary caller. An id that is not a positive integer is
417
+ * refused before any request (`INVALID_INPUT`, `ValidationError`).
418
+ *
419
+ * A store whose MyParcel set-up was removed after the shipment was booked is refused
420
+ * `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`, 422): set MyParcel up again in the
421
+ * store's shipping settings. An engine older than this answer failed it uncoded (`GRAPHQL_ERROR`,
422
+ * 500). `labels.status` and `labels.download` answer that case the same way.
423
+ *
424
+ * @effect read
425
+ * @permission ReadOrder
426
+ */
427
+ get(shipmentId: number, options?: Call): Promise<MyparcelShipment | null>;
428
+ /**
429
+ * Replace the MyParcel shipment(s) of a fulfillment with new ones booked from
430
+ * `handlerArguments`: the order's recipient, the fulfillment's lines and parcels. Used to
431
+ * recover a failed booking or to change a concept's choices (MyParcel cannot edit a shipment
432
+ * in place). The new shipments are attached to the SAME fulfillment, and only then are the old
433
+ * concepts retracted (queued; one MyParcel keeps is recorded on the fulfillment). Needs
434
+ * `UpdateOrder`.
435
+ *
436
+ * `@effect money`: the new shipments are booked at MyParcel and their labels asked for, which
437
+ * registers and bills them. Takes no idempotency key: a repeat books another set while the
438
+ * first is still a concept, retracting the first; once it is registered a repeat is refused
439
+ * (below).
440
+ *
441
+ * Refused with nothing booked, each with its code and, where the engine names fields, one
442
+ * `details[]` entry per field (`details[].field`), so a form can mark each:
443
+ * - `MYPARCEL_INVALID_RECIPIENT_ERROR` (`BusinessRuleError`): the order's shipping address
444
+ * lacks what a label needs (`fullName`, `countryCode`, `city`, `postalCode`, `streetLine1`,
445
+ * or `shippingAddress` for none at all). `streetLine1` alone means no house number could be
446
+ * read from it. Fix the address on the order, then recreate;
447
+ * - `MYPARCEL_INVALID_SENDER_ERROR`: the shipping stock location's sender address is
448
+ * incomplete (`details[].field` names each field); set it with `senders.set`;
449
+ * - `MYPARCEL_VALIDATION_ERROR`: a choice MyParcel or the engine refuses, with the fields it
450
+ * names (`parcelCount` below the packed parcels: re-pack first; `shipmentId` for a parcel
451
+ * already past concept: MyParcel keeps and bills it, so cancel the fulfillment instead;
452
+ * `fulfillmentId` when another recreate or booking changed it meanwhile: reload and retry,
453
+ * or for a fulfillment that does not ship with MyParcel, such as a manual one: create a
454
+ * MyParcel fulfillment instead);
455
+ * - `MYPARCEL_PICKUP_LOCATION_REQUIRED_ERROR` / `_DEACTIVATED_ERROR` / `_NOT_FOUND_ERROR` /
456
+ * `_INVALID_ERROR` (fields named): pick another pickup point;
457
+ * - `MYPARCEL_INVALID_CUSTOMS_ERROR`, `MYPARCEL_MISSING_PHYSICAL_PROPERTIES_ERROR`: a parcel
458
+ * outside the EU needs customs data and weights on its products;
459
+ * - `MYPARCEL_NOT_CONFIGURED_ERROR` (no set-up, or switched off: turn it on in the store's
460
+ * shipping settings), `MYPARCEL_DECRYPTION_FAILED_ERROR` (save the key again),
461
+ * `MYPARCEL_STOCK_LOCATION_NOT_FOUND_ERROR`, `MYPARCEL_ORDER_NOT_FOUND_ERROR`
462
+ * (`NotFoundError`), `MYPARCEL_API_ERROR` (MyParcel's own refusal or outage);
463
+ * - a fulfillment of another store or a credential restricted to other stock locations is
464
+ * refused by the engine's door before anything is read (`ENTITY_NOT_FOUND`,
465
+ * `LOCATION_OUT_OF_SCOPE`).
466
+ *
467
+ * A blank fulfillment id or an argument that is not `{ name, value }` strings is refused
468
+ * before any request (`INVALID_INPUT`, `ValidationError`).
469
+ *
470
+ * @effect money
471
+ * @permission UpdateOrder
472
+ */
473
+ recreate(input: RecreateMyparcelShipmentInput, options?: Call): Promise<MyparcelShipmentAttached>;
474
+ /**
475
+ * Attach a shipment made by hand in the MyParcel backoffice to a fulfillment that holds none,
476
+ * by its numeric id, and ask MyParcel for its label (queued). Needs `UpdateOrder`.
477
+ *
478
+ * `@effect money`: the label request registers a shipment MyParcel still holds as a concept,
479
+ * and bills it. No idempotency key: a repeat is refused, since the fulfillment then holds a
480
+ * shipment.
481
+ *
482
+ * Refused with nothing attached:
483
+ * - `MYPARCEL_VALIDATION_ERROR` (`details[].field: 'shipmentId'`): the fulfillment already
484
+ * holds a shipment (recreate it instead), or the store's MyParcel account has no such
485
+ * shipment (check the id in the backoffice);
486
+ * - `MYPARCEL_VALIDATION_ERROR` (`details[].field: 'fulfillmentId'`): the fulfillment does not
487
+ * ship with MyParcel (a manual one, say), so it takes no MyParcel shipment; refused before
488
+ * MyParcel is asked;
489
+ * - `MYPARCEL_SHIPMENT_ALREADY_ATTACHED_ERROR`: another fulfillment or stock transfer holds it;
490
+ * - `MYPARCEL_NOT_CONFIGURED_ERROR` (no set-up, or switched off),
491
+ * `MYPARCEL_DECRYPTION_FAILED_ERROR`, `MYPARCEL_ORDER_NOT_FOUND_ERROR` (`NotFoundError`),
492
+ * `MYPARCEL_API_ERROR`;
493
+ * - another store's fulfillment, or a credential restricted to other stock locations, by the
494
+ * engine's door first (`ENTITY_NOT_FOUND`, `LOCATION_OUT_OF_SCOPE`).
495
+ *
496
+ * A blank fulfillment id or a shipment id that is not a positive integer is refused before any
497
+ * request (`INVALID_INPUT`, `ValidationError`).
498
+ *
499
+ * @effect money
500
+ * @permission UpdateOrder
501
+ */
502
+ import(input: ImportMyparcelShipmentInput, options?: Call): Promise<MyparcelShipmentAttached>;
503
+ }
504
+ /** MyParcel return labels for the store's shipments (`admin.shipping.myparcel.returns`). */
505
+ export interface MyparcelReturnsModule {
506
+ /**
507
+ * Ask MyParcel for a return shipment linked to an outbound shipment of the store. MyParcel
508
+ * e-mails the customer the return label at `email`. Needs `UpdateOrder`.
509
+ *
510
+ * `@effect money`: MyParcel bills the return shipment to the store's account. No idempotency
511
+ * key: every call makes ANOTHER return shipment and e-mail.
512
+ *
513
+ * Refused:
514
+ * - a shipment no fulfillment or stock transfer of the store holds (another store's on a
515
+ * shared MyParcel account, a missing id) is `ENTITY_NOT_FOUND` (`NotFoundError`), before
516
+ * MyParcel is asked;
517
+ * - `MYPARCEL_NOT_CONFIGURED_ERROR` (no set-up, or switched off: turn it on in the store's
518
+ * shipping settings), before MyParcel is asked; `MYPARCEL_DECRYPTION_FAILED_ERROR` (save the
519
+ * key again), `MYPARCEL_VALIDATION_ERROR` (fields named in `details[]`),
520
+ * `MYPARCEL_API_ERROR` (MyParcel's own refusal: a carrier that takes no returns, …).
521
+ *
522
+ * A shipment or carrier id that is not a positive integer, or a blank name or e-mail, is
523
+ * refused before any request (`INVALID_INPUT`, `ValidationError`, the field in `details[]`).
524
+ *
525
+ * @effect money
526
+ * @permission UpdateOrder
527
+ */
528
+ create(input: CreateMyparcelReturnInput, options?: Call): Promise<MyparcelReturnShipment>;
529
+ }
530
+ /**
531
+ * The labels of the store's MyParcel shipments (`admin.shipping.myparcel.labels`).
532
+ *
533
+ * MyParcel registers a shipment it still holds as a concept on the FIRST call that asks for its
534
+ * label, in any format and by any of the three methods here, and bills the store for it from then
535
+ * on; a registered shipment is not registered again. So each of the three is `@effect money`. A
536
+ * registered label cannot be deleted through MyParcel's API.
537
+ *
538
+ * A store without the MyParcel plugin is refused `PLUGIN_ACCESS_DENIED` (`PermissionDeniedError`,
539
+ * 403) on all three, for an ordinary caller; the engine never refuses a SuperAdmin on that ground.
540
+ */
541
+ export interface MyparcelLabelsModule {
542
+ /**
543
+ * Whether MyParcel has made the label of these shipments in `format`: `ready` once every one of
544
+ * them has it, `pending` until then. A readiness signal only: the label itself is `download`
545
+ * (or `admin.fulfillments.myparcelLabel` for every parcel of a fulfillment). Each call is one
546
+ * request to MyParcel, so poll it with a back-off. Allowed up to 55s, like `download`: the
547
+ * engine retries a slow MyParcel within a budget the default timeout does not cover. Needs
548
+ * `ReadOrder`.
549
+ *
550
+ * Refused before MyParcel is asked: a shipment the store does not hold (`ENTITY_NOT_FOUND`,
551
+ * `NotFoundError`) refuses the whole call. A store whose set-up was removed is refused
552
+ * `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`, 422; see `shipments.get`); a set-up
553
+ * switched off is still answered. An
554
+ * empty list, an id that is not a positive integer or a format other than `A4`/`A6` is refused
555
+ * before any request (`MYPARCEL_LABEL_INPUT_INVALID`, `ValidationError`).
556
+ *
557
+ * @effect money
558
+ * @permission ReadOrder
559
+ */
560
+ status(shipmentIds: readonly number[], format: FulfillmentLabelFormat, options?: Call): Promise<MyparcelLabelReadiness>;
561
+ /**
562
+ * One shipment's label as a PDF, fetched live from MyParcel and never cached: a link MyParcel
563
+ * mints expires within hours, so none is answered. For a fulfillment of several parcels,
564
+ * `admin.fulfillments.myparcelLabel` merges every parcel's label into one PDF; this answers only
565
+ * the parcel it names. Allowed up to 55s (`MYPARCEL_LABEL_TIMEOUT_MS`): the engine retries a
566
+ * slow MyParcel up to three times. Needs `ReadOrder`.
567
+ *
568
+ * Refused as `status` is. A MyParcel failure (a prepaid account's `402`, an outage) arrives as
569
+ * the engine's error.
570
+ *
571
+ * @effect money
572
+ * @permission ReadOrder
573
+ */
574
+ download(shipmentId: number, format: FulfillmentLabelFormat, options?: Call): Promise<MyparcelShipmentLabel>;
575
+ /**
576
+ * Ask MyParcel for one parcel's label in one format: the operator's request, made again even
577
+ * when the label is ready. It QUEUES the request and answers `pending`; the label lands when the
578
+ * job has run (the fulfillment's label fields, `status`, and the label webhook say so), and a
579
+ * refusal MyParcel answers then is recorded on the fulfillment, not thrown here. Needs
580
+ * `UpdateOrder`. For every parcel of a fulfillment at once, `admin.fulfillments.labelMyparcelParcels`.
581
+ *
582
+ * Takes no idempotency key: a repeat queues another request for the same parcel.
583
+ *
584
+ * Refused, with nothing queued: `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`) while the
585
+ * store has no set-up or has MyParcel switched off; `ENTITY_NOT_FOUND` (`NotFoundError`) for
586
+ * another store's or a missing fulfillment, before anything is read; `MYPARCEL_VALIDATION_ERROR`
587
+ * (`BusinessRuleError`, `details[].field` naming what to fix) for a cancelled fulfillment or a
588
+ * shipment it does not hold (reload: its parcels may have been replaced);
589
+ * `MYPARCEL_DECRYPTION_FAILED_ERROR` when the stored key no longer decrypts (save it again);
590
+ * `LOCATION_OUT_OF_SCOPE` (422) for a credential restricted to other stock locations. A blank fulfillment id, a shipment id
591
+ * that is not a positive integer or a format other than `A4`/`A6` is refused before any request
592
+ * (`MYPARCEL_LABEL_INPUT_INVALID`, `ValidationError`).
593
+ *
594
+ * @effect money
595
+ * @permission UpdateOrder
596
+ */
597
+ request(input: RequestMyparcelLabelInput, options?: Call): Promise<MyparcelLabelReadiness>;
598
+ }
599
+ /** `admin.shipping.myparcel`: the MyParcel integration of the store. */
600
+ export interface MyparcelModule {
601
+ config: MyparcelConfigModule;
602
+ /**
603
+ * The carriers MyParcel offers, the same list for every store (cached by the engine for an
604
+ * hour). What a carrier can do for one address is not in it. Needs `ReadSettings`; a store
605
+ * without the MyParcel plugin is refused `PLUGIN_ACCESS_DENIED` (403).
606
+ *
607
+ * @effect read
608
+ * @permission ReadSettings
609
+ */
610
+ carriers(options?: Call): Promise<MyparcelCarrier[]>;
611
+ /**
612
+ * What each carrier can ship (package types, delivery types, countries, options, pickup), from
613
+ * the engine's static table: no call to MyParcel, the same for every store. Needs
614
+ * `ReadSettings`.
615
+ *
616
+ * @effect read
617
+ * @permission ReadSettings
618
+ */
619
+ carrierCapabilities(options?: Call): Promise<MyparcelCarrierCapability[]>;
620
+ /**
621
+ * MyParcel's delivery windows, with its base rate, and pickup points for one destination: one
622
+ * live call to MyParcel with the store's key. A quote: nothing is booked or billed. Needs
623
+ * `ReadOrder`.
624
+ *
625
+ * Refused: `MYPARCEL_NOT_CONFIGURED_ERROR` (`BusinessRuleError`) when the store has no set-up
626
+ * (a set-up switched off is still answered); `MYPARCEL_DECRYPTION_FAILED_ERROR` (save the key
627
+ * again); `MYPARCEL_API_ERROR` for MyParcel's own refusal or outage. A blank postal code is
628
+ * refused before any request (`INVALID_INPUT`, `ValidationError`, `details[0].field:
629
+ * 'postalCode'`).
630
+ *
631
+ * @effect read
632
+ * @permission ReadOrder
633
+ */
634
+ deliveryOptions(input: MyparcelDeliveryOptionsInput, options?: Call): Promise<MyparcelDeliveryOptions>;
635
+ senders: MyparcelSendersModule;
636
+ /** The store's MyParcel shipments: read live, booked again, or imported from the backoffice. */
637
+ shipments: MyparcelShipmentsModule;
638
+ /** Whether a shipment's label is made, the label itself, and asking for it again. */
639
+ labels: MyparcelLabelsModule;
640
+ /** Return labels for the store's shipments. */
641
+ returns: MyparcelReturnsModule;
642
+ }
643
+ export declare const MYPARCEL_CONFIG_QUERY = "\n query MyparcelConfig {\n myparcelConfig { \n id\n channelId\n hasApiKey\n maskedApiKey\n maskedWebhookSecret\n defaultLabelFormat\n enabled\n }\n }\n";
644
+ export declare const UPDATE_MYPARCEL_CONFIG_MUTATION = "\n mutation UpdateMyparcelConfig($input: MyparcelConfigInput!) {\n updateMyparcelConfig(input: $input) {\n \n __typename\n ... on MyparcelConfig { \n id\n channelId\n hasApiKey\n maskedApiKey\n maskedWebhookSecret\n defaultLabelFormat\n enabled\n }\n ... on ErrorResult { errorCode message }\n\n ... on MyparcelValidationError { errors }\n }\n }\n";
645
+ export declare const UPDATE_MYPARCEL_LABEL_FORMAT_MUTATION = "\n mutation UpdateMyparcelLabelFormat($input: MyparcelLabelFormatInput!) {\n updateMyparcelLabelFormat(input: $input) { \n __typename\n ... on MyparcelConfig { \n id\n channelId\n hasApiKey\n maskedApiKey\n maskedWebhookSecret\n defaultLabelFormat\n enabled\n }\n ... on ErrorResult { errorCode message }\n }\n }\n";
646
+ export declare const SET_MYPARCEL_ENABLED_MUTATION = "\n mutation SetMyparcelEnabled($enabled: Boolean!) {\n setMyparcelEnabled(enabled: $enabled) {\n \n __typename\n ... on MyparcelConfig { \n id\n channelId\n hasApiKey\n maskedApiKey\n maskedWebhookSecret\n defaultLabelFormat\n enabled\n }\n ... on ErrorResult { errorCode message }\n\n ... on MyparcelValidationError { errors }\n }\n }\n";
647
+ export declare const REGENERATE_MYPARCEL_WEBHOOK_SECRET_MUTATION = "\n mutation RegenerateMyparcelWebhookSecret {\n regenerateMyparcelWebhookSecret { \n __typename\n ... on MyparcelConfig { \n id\n channelId\n hasApiKey\n maskedApiKey\n maskedWebhookSecret\n defaultLabelFormat\n enabled\n }\n ... on ErrorResult { errorCode message }\n }\n }\n";
648
+ export declare const MYPARCEL_CARRIERS_QUERY = "\n query MyparcelCarriers {\n myparcelCarriers {\n id\n name\n human\n meta { logoSvg logoPng }\n }\n }\n";
649
+ export declare const MYPARCEL_SENDERS_QUERY = "\n query MyparcelSenderStockLocations {\n myparcelSenderStockLocations { \n id\n name\n address {\n streetLine1\n streetLine2\n city\n postalCode\n province\n countryCode\n phoneNumber\n contactName\n company\n }\n isDefaultSender\n isResolvable\n }\n }\n";
650
+ export declare const SET_MYPARCEL_SENDER_MUTATION = "\n mutation SetStockLocationSender($input: MyparcelSetStockLocationSenderInput!) {\n setStockLocationSender(input: $input) {\n __typename\n ... on MyparcelSenderStockLocationSummary { \n id\n name\n address {\n streetLine1\n streetLine2\n city\n postalCode\n province\n countryCode\n phoneNumber\n contactName\n company\n }\n isDefaultSender\n isResolvable\n }\n ... on ErrorResult { errorCode message }\n ... on MyparcelInvalidSenderError { fields }\n }\n }\n";
651
+ export declare const MYPARCEL_SHIPMENT_QUERY = "\n query MyparcelShipment($shipmentId: Int!) {\n myparcelShipment(shipmentId: $shipmentId) {\n id\n referenceIdentifier\n barcode\n status\n carrierId\n created\n modified\n linkConsumerPortal\n }\n }\n";
652
+ /** Readiness only: the engine answers no link (it would outlive every check made on it). */
653
+ export declare const MYPARCEL_LABEL_STATUS_QUERY = "\n query MyparcelLabelStatus($shipmentIds: [Int!]!, $format: MyparcelLabelFormatEnum!) {\n myparcelShipmentLabelUrl(shipmentIds: $shipmentIds, format: $format) {\n status\n }\n }\n";
654
+ export declare const MYPARCEL_SHIPMENT_LABEL_MUTATION = "\n mutation MyparcelShipmentLabel($shipmentId: Int!, $format: MyparcelLabelFormatEnum!) {\n getMyparcelLabel(shipmentId: $shipmentId, format: $format) {\n format\n base64\n contentType\n filename\n }\n }\n";
655
+ export declare const REQUEST_MYPARCEL_LABEL_MUTATION = "\n mutation RequestMyparcelLabel($input: MyparcelRequestLabelInput!) {\n requestMyparcelLabel(input: $input) {\n __typename\n ... on MyparcelLabelResult { status }\n ... on ErrorResult { errorCode message }\n ... on MyparcelValidationError { errors }\n }\n }\n";
656
+ export declare const MYPARCEL_CARRIER_CAPABILITIES_QUERY = "\n query MyparcelCarrierCapabilities {\n myparcelCarrierCapabilities {\n carrierId\n name\n packageTypes\n deliveryTypes\n countries\n supportedOptions\n supportsPickup\n constraints\n }\n }\n";
657
+ export declare const MYPARCEL_DELIVERY_OPTIONS_QUERY = "\n query MyparcelAdminDeliveryOptions($input: MyparcelAdminDeliveryOptionsInput!) {\n myparcelAdminDeliveryOptions(input: $input) {\n __typename\n ... on MyparcelAdminDeliveryOptions {\n deliveryOptions {\n deliveryType\n date\n startTime\n endTime\n price { amount currency }\n }\n pickupOptions {\n locationCode\n locationName\n street\n number\n numberSuffix\n postalCode\n city\n countryCode\n carrierId\n distance\n }\n }\n ... on ErrorResult { errorCode message }\n ... on MyparcelValidationError { errors }\n }\n }\n";
658
+ export declare const RECREATE_MYPARCEL_SHIPMENT_MUTATION = "\n mutation RecreateMyparcelShipment($input: MyparcelRecreateShipmentInput!) {\n recreateMyparcelShipment(input: $input) {\n __typename\n ... on MyparcelShipmentMutationResult { shipmentId labelFormat }\n \n ... on ErrorResult { errorCode message }\n ... on MyparcelValidationError { errors }\n ... on MyparcelInvalidRecipientError { missingFields }\n ... on MyparcelInvalidSenderError { fields }\n ... on MyparcelPickupLocationInvalidError { fields }\n\n }\n }\n";
659
+ export declare const IMPORT_MYPARCEL_SHIPMENT_MUTATION = "\n mutation ImportMyparcelShipment($input: MyparcelImportShipmentInput!) {\n importMyparcelShipment(input: $input) {\n __typename\n ... on MyparcelShipmentMutationResult { shipmentId labelFormat }\n ... on ErrorResult { errorCode message }\n ... on MyparcelValidationError { errors }\n }\n }\n";
660
+ export declare const CREATE_MYPARCEL_RETURN_MUTATION = "\n mutation CreateMyparcelReturnShipment($input: MyparcelReturnShipmentInput!) {\n createMyparcelReturnShipment(input: $input) {\n __typename\n ... on MyparcelReturnShipmentResult { shipmentId }\n ... on ErrorResult { errorCode message }\n ... on MyparcelValidationError { errors }\n }\n }\n";
661
+ /**
662
+ * A refusal member as its error class, by core's `errorFromErrorResult`. The field names a member
663
+ * carries (`MyparcelInvalidSenderError.fields`, `MyparcelPickupLocationInvalidError.fields`,
664
+ * `MyparcelValidationError.errors`, `MyparcelInvalidRecipientError.missingFields`) ride
665
+ * `details[]`, one per field, so a form can mark each without matching the sentence.
666
+ */
667
+ export declare function myparcelRefusal(result: VendureErrorResult): PlatformError;
668
+ export declare function createMyparcelModule(transport: Transport): MyparcelModule;