@sixtyninecommerce/admin 0.11.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 (147) hide show
  1. package/README.md +1501 -23
  2. package/dist/auth/index.d.ts +7 -1
  3. package/dist/auth/index.js +8 -1
  4. package/dist/catalog/documents.d.ts +142 -0
  5. package/dist/catalog/documents.js +114 -0
  6. package/dist/catalog/index.d.ts +48 -7
  7. package/dist/catalog/index.js +6 -1
  8. package/dist/catalog/metadata.d.ts +244 -0
  9. package/dist/catalog/metadata.js +220 -0
  10. package/dist/catalog/properties.d.ts +38 -0
  11. package/dist/catalog/properties.js +52 -1
  12. package/dist/catalog/recommendations.d.ts +33 -6
  13. package/dist/catalog/recommendations.js +94 -2
  14. package/dist/catalog/reviews.d.ts +17 -4
  15. package/dist/catalog/reviews.js +7 -0
  16. package/dist/catalog/variants.d.ts +60 -0
  17. package/dist/catalog/variants.js +39 -0
  18. package/dist/catalog/visibility.d.ts +18 -2
  19. package/dist/client.d.ts +29 -3
  20. package/dist/client.js +19 -8
  21. package/dist/content/assets.d.ts +3 -4
  22. package/dist/content/forms.d.ts +332 -1
  23. package/dist/content/forms.js +140 -4
  24. package/dist/content/items.d.ts +31 -8
  25. package/dist/content/items.js +1 -1
  26. package/dist/content/menus.d.ts +254 -0
  27. package/dist/content/menus.js +70 -0
  28. package/dist/content/strings.d.ts +137 -0
  29. package/dist/content/strings.js +82 -0
  30. package/dist/customers/delivery-terms.d.ts +44 -0
  31. package/dist/customers/delivery-terms.js +32 -0
  32. package/dist/customers/index.d.ts +15 -0
  33. package/dist/customers/index.js +4 -0
  34. package/dist/documents/emails.d.ts +150 -0
  35. package/dist/documents/emails.js +220 -0
  36. package/dist/documents/index.d.ts +13 -0
  37. package/dist/documents/index.js +2 -0
  38. package/dist/fulfillments/index.d.ts +119 -1
  39. package/dist/fulfillments/index.js +124 -4
  40. package/dist/index.d.ts +43 -23
  41. package/dist/index.js +11 -5
  42. package/dist/integrations/exact-online-types.d.ts +542 -0
  43. package/dist/integrations/exact-online.d.ts +541 -5
  44. package/dist/integrations/exact-online.js +714 -1
  45. package/dist/integrations/index.d.ts +23 -8
  46. package/dist/integrations/index.js +9 -4
  47. package/dist/integrations/pipeline-discoveries.d.ts +65 -0
  48. package/dist/integrations/pipeline-discoveries.js +65 -0
  49. package/dist/integrations/pipeline-runs.d.ts +119 -0
  50. package/dist/integrations/pipeline-runs.js +87 -0
  51. package/dist/integrations/pipelines.d.ts +73 -2
  52. package/dist/integrations/pipelines.js +36 -1
  53. package/dist/integrations/price-import.d.ts +223 -0
  54. package/dist/integrations/price-import.js +124 -0
  55. package/dist/integrations/types.d.ts +221 -3
  56. package/dist/integrations/types.js +4 -3
  57. package/dist/meta/index.d.ts +10 -0
  58. package/dist/metafields/index.d.ts +8 -1
  59. package/dist/metafields/index.js +10 -0
  60. package/dist/orders/cancel-with-money.d.ts +10 -0
  61. package/dist/orders/cancel-with-money.js +2 -0
  62. package/dist/orders/commit-edit.d.ts +16 -0
  63. package/dist/orders/commit-edit.js +14 -1
  64. package/dist/orders/deposit-policy.d.ts +3 -1
  65. package/dist/orders/index.d.ts +22 -11
  66. package/dist/orders/index.js +5 -2
  67. package/dist/orders/list.d.ts +26 -5
  68. package/dist/orders/list.js +123 -13
  69. package/dist/orders/manual-discounts.d.ts +13 -5
  70. package/dist/orders/money-view.d.ts +149 -0
  71. package/dist/orders/money-view.js +99 -0
  72. package/dist/orders/plan-edit.d.ts +34 -2
  73. package/dist/orders/plan-edit.js +110 -12
  74. package/dist/orders/surcharges.d.ts +12 -0
  75. package/dist/orders/surcharges.js +34 -9
  76. package/dist/payments/account-credit.d.ts +17 -1
  77. package/dist/payments/account-credit.js +25 -2
  78. package/dist/payments/credit-noted-fields.d.ts +8 -1
  79. package/dist/payments/credit-noted-fields.js +34 -2
  80. package/dist/payments/customer-consent.d.ts +30 -0
  81. package/dist/payments/customer-consent.js +49 -0
  82. package/dist/payments/index.d.ts +89 -14
  83. package/dist/payments/index.js +22 -2
  84. package/dist/payments/requests.d.ts +6 -3
  85. package/dist/payments/requests.js +1 -0
  86. package/dist/pickups/index.d.ts +5 -3
  87. package/dist/pickups/index.js +5 -2
  88. package/dist/platform/email-gateways.d.ts +165 -0
  89. package/dist/platform/email-gateways.js +78 -0
  90. package/dist/platform/tax.d.ts +11 -3
  91. package/dist/platform/tax.js +30 -0
  92. package/dist/pos/exchanges.d.ts +6 -1
  93. package/dist/pos/index.d.ts +229 -10
  94. package/dist/pos/index.js +113 -4
  95. package/dist/pos/offline-sales.d.ts +44 -3
  96. package/dist/pos/offline-sales.js +57 -3
  97. package/dist/pos/returns.d.ts +28 -1
  98. package/dist/pos/returns.js +36 -6
  99. package/dist/pricing/price-lists.d.ts +3 -1
  100. package/dist/purchasing/alerts.d.ts +19 -4
  101. package/dist/purchasing/alerts.js +29 -3
  102. package/dist/purchasing/backorders.d.ts +61 -0
  103. package/dist/purchasing/backorders.js +92 -0
  104. package/dist/purchasing/index.d.ts +21 -3
  105. package/dist/purchasing/index.js +8 -0
  106. package/dist/purchasing/links.d.ts +263 -0
  107. package/dist/purchasing/links.js +192 -0
  108. package/dist/purchasing/purchase-orders.d.ts +4 -1
  109. package/dist/purchasing/receipts.d.ts +396 -0
  110. package/dist/purchasing/receipts.js +287 -0
  111. package/dist/purchasing/returns.d.ts +273 -0
  112. package/dist/purchasing/returns.js +229 -0
  113. package/dist/quotes/index.d.ts +20 -3
  114. package/dist/returns/index.d.ts +62 -1
  115. package/dist/returns/index.js +61 -0
  116. package/dist/seo/config.d.ts +128 -0
  117. package/dist/seo/config.js +95 -0
  118. package/dist/seo/redirects.d.ts +125 -0
  119. package/dist/seo/redirects.js +60 -1
  120. package/dist/seo/settings.d.ts +147 -0
  121. package/dist/seo/settings.js +209 -0
  122. package/dist/shipping/index.d.ts +6 -0
  123. package/dist/shipping/index.js +2 -0
  124. package/dist/shipping/methods.d.ts +8 -1
  125. package/dist/shipping/myparcel.d.ts +415 -1
  126. package/dist/shipping/myparcel.js +291 -3
  127. package/dist/shipping/rate-tables.d.ts +149 -4
  128. package/dist/shipping/rate-tables.js +229 -23
  129. package/dist/shipping/ship-to-countries.d.ts +75 -0
  130. package/dist/shipping/ship-to-countries.js +47 -0
  131. package/dist/stock/by-location.d.ts +86 -0
  132. package/dist/stock/by-location.js +94 -0
  133. package/dist/stock/index.d.ts +8 -1
  134. package/dist/stock/index.js +4 -0
  135. package/dist/stock/settings.d.ts +106 -0
  136. package/dist/stock/settings.js +103 -0
  137. package/dist/stock/transfers.d.ts +171 -10
  138. package/dist/stock/transfers.js +82 -4
  139. package/dist/stored-value/index.d.ts +98 -7
  140. package/dist/stored-value/index.js +71 -4
  141. package/dist/tax/display-policy.d.ts +105 -0
  142. package/dist/tax/display-policy.js +84 -0
  143. package/dist/tax/index.d.ts +3 -0
  144. package/dist/tax/index.js +2 -0
  145. package/dist/tenant/email-templates.d.ts +222 -1
  146. package/dist/tenant/email-templates.js +227 -10
  147. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
1
  import { type PlatformError, type Transport, type VendureErrorResult } from '@sixtyninecommerce/core';
2
+ import { type FulfillmentLabelFormat } from '../fulfillments/index.js';
2
3
  import type { Call } from '../types.js';
3
4
  /**
4
5
  * The store-wide default label format: `A4` or `A6` paper, or `BOTH`, which has MyParcel make
@@ -223,6 +224,378 @@ export interface MyparcelSendersModule {
223
224
  */
224
225
  set(input: SetMyparcelSenderInput, options?: Call): Promise<MyparcelSenderLocation>;
225
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
+ }
226
599
  /** `admin.shipping.myparcel`: the MyParcel integration of the store. */
227
600
  export interface MyparcelModule {
228
601
  config: MyparcelConfigModule;
@@ -235,7 +608,37 @@ export interface MyparcelModule {
235
608
  * @permission ReadSettings
236
609
  */
237
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>;
238
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;
239
642
  }
240
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";
241
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";
@@ -245,9 +648,20 @@ export declare const REGENERATE_MYPARCEL_WEBHOOK_SECRET_MUTATION = "\n mutation
245
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";
246
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";
247
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";
248
661
  /**
249
662
  * A refusal member as its error class, by core's `errorFromErrorResult`. The field names a member
250
- * carries (`MyparcelInvalidSenderError.fields`, `MyparcelValidationError.errors`) ride
663
+ * carries (`MyparcelInvalidSenderError.fields`, `MyparcelPickupLocationInvalidError.fields`,
664
+ * `MyparcelValidationError.errors`, `MyparcelInvalidRecipientError.missingFields`) ride
251
665
  * `details[]`, one per field, so a form can mark each without matching the sentence.
252
666
  */
253
667
  export declare function myparcelRefusal(result: VendureErrorResult): PlatformError;