@thorprovider/types 7.0.0 → 7.2.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.
@@ -184,6 +184,18 @@ export interface DropshipperVariant {
184
184
  id: string;
185
185
  title: string;
186
186
  sku: string | null;
187
+ /**
188
+ * URL of the variant's own thumbnail (its first linked product image), or
189
+ * null when the variant has no dedicated image. Consumers should fall back to
190
+ * the product thumbnail when null.
191
+ */
192
+ thumbnail: string | null;
193
+ /**
194
+ * All product images linked to the variant, ordered by `rank` (ascending).
195
+ * Empty when the variant has no dedicated images. Consumers should fall back
196
+ * to the product media when empty.
197
+ */
198
+ images: DropshipperProductImage[];
187
199
  options: DropshipperVariantOption[];
188
200
  /** Whether inventory is tracked for this variant */
189
201
  manageInventory: boolean;
@@ -516,6 +528,8 @@ export interface ExtendedCreateDropshipperOrderResponse {
516
528
  discount_total: number;
517
529
  total: number;
518
530
  profit: number;
531
+ /** Desglose de impuestos por tasa (ítems + envío). `total` es el importe. */
532
+ tax_lines: DropshipperOrderTaxLine[];
519
533
  created_at: string;
520
534
  /** One shipping method per group (contract v2). Replaces `shipping_method`. */
521
535
  shipping_methods: DropshipperShippingMethod[];
@@ -577,6 +591,20 @@ export interface DropshipperItemTaxLine {
577
591
  subtotal: number;
578
592
  }
579
593
 
594
+ /**
595
+ * Línea de impuesto del desglose de una orden (ítems + envío).
596
+ *
597
+ * `total` es el **importe del impuesto** (no la base imponible). No expone
598
+ * `subtotal` porque en el contrato de order ese campo también es un importe de
599
+ * impuesto (impuesto sobre la base pre-descuento), no la base.
600
+ */
601
+ export interface DropshipperOrderTaxLine {
602
+ code: string | null;
603
+ rate: number;
604
+ total: number;
605
+ kind: 'item' | 'shipping';
606
+ }
607
+
580
608
  export interface DropshipperOrderItem {
581
609
  id: string;
582
610
  title: string;
@@ -817,6 +845,8 @@ export interface DropshipperShippingMethod {
817
845
  original_total: number;
818
846
  total: number;
819
847
  tax_total: number;
848
+ /** Tax lines del método de envío (importe por tasa). El backend ya las emite. */
849
+ tax_lines?: DropshipperItemTaxLine[];
820
850
  discount_total: number;
821
851
  /** Discount adjustments applied to this shipping method (read-only; [] when none). */
822
852
  adjustments?: DropshipperItemAdjustment[];
@@ -908,10 +938,79 @@ export interface DropshipperOrderFulfillment {
908
938
  provider_id: string | null;
909
939
  /** Name of the stock location the fulfillment ships from, when resolvable */
910
940
  location_name: string | null;
941
+ /** Delivery type of the fulfillment (a group travels together in one fulfillment). */
942
+ type: 'pickup' | 'shipping';
943
+ /** Shipping option of origin, to resolve the method name against `order.shipping_methods`. */
944
+ shipping_option_id: string | null;
945
+ /** Pickup store (name + address) for a `pickup` fulfillment; `null` for shipping. */
946
+ pickup_location: DropshipperPickupLocation | null;
911
947
  items: DropshipperFulfillmentItem[];
912
948
  labels: DropshipperFulfillmentLabel[];
913
949
  }
914
950
 
951
+ /**
952
+ * Estado de un grupo de entrega. `configured` = plan aplicado, aún no enviado
953
+ * al almacén; `preparing` = enviado al almacén (FulfillmentDeliveryInfo) sin
954
+ * fulfillment; el resto son estados del fulfillment vinculado.
955
+ */
956
+ export type DropshipperDeliveryGroupStatus =
957
+ | 'configured'
958
+ | 'preparing'
959
+ | 'pending'
960
+ | 'packed'
961
+ | 'shipped'
962
+ | 'delivered'
963
+ | 'canceled';
964
+
965
+ /**
966
+ * Un grupo de entrega de la orden: un grupo configurado del plan de envío
967
+ * (`metadata.shipping_plan.configured_groups`), con o sin fulfillment. Los
968
+ * campos se resuelven progresivamente a medida que la orden avanza.
969
+ */
970
+ export interface DropshipperDeliveryGroup {
971
+ id: string;
972
+ type: 'pickup' | 'shipping';
973
+ origin: {
974
+ id: string | null;
975
+ name: string | null;
976
+ /** Código corto del almacén (`metadata.code`), si existe. */
977
+ code: string | null;
978
+ };
979
+ method: {
980
+ id: string | null;
981
+ name: string | null;
982
+ estimated_days: string | null;
983
+ };
984
+ items: Array<{
985
+ title: string;
986
+ sku: string | null;
987
+ quantity: number;
988
+ /** Identificador de variante de la línea de la orden, si existe. */
989
+ variant_id?: string | null;
990
+ /** Título de variante (fallback de la etiqueta de opciones). */
991
+ variant_title?: string | null;
992
+ /** Valores de opción de la variante (p. ej. `{ Color: "Negro" }`). */
993
+ variant_option_values?: Record<string, string> | null;
994
+ }>;
995
+ status: DropshipperDeliveryGroupStatus;
996
+ /** Fulfillment vinculado, cuando el grupo ya fue cumplido; `null` si no. */
997
+ fulfillment: {
998
+ id: string;
999
+ status: string;
1000
+ provider_id: string | null;
1001
+ packed_at: string | null;
1002
+ shipped_at: string | null;
1003
+ delivered_at: string | null;
1004
+ canceled_at: string | null;
1005
+ labels: DropshipperFulfillmentLabel[];
1006
+ } | null;
1007
+ /** Punto de recogida + encargado (solo grupos `pickup`). */
1008
+ pickup: {
1009
+ location: DropshipperPickupLocation | null;
1010
+ person_in_charge: string | null;
1011
+ } | null;
1012
+ }
1013
+
915
1014
  /** A credit line applied to an order (read-only; generated from a gift card,
916
1015
  * store credit or payment collection). `amount` is in major units of
917
1016
  * `currency_code`. */
@@ -957,6 +1056,8 @@ export interface DropshipperOrderDetail {
957
1056
  claims?: DropshipperOrderClaim[];
958
1057
  /** Fulfillments on the order, read-only (optional) */
959
1058
  fulfillments?: DropshipperOrderFulfillment[];
1059
+ /** Grupos de entrega del plan de envío, con o sin fulfillment (optional). */
1060
+ delivery_groups?: DropshipperDeliveryGroup[];
960
1061
  transactions: DropshipperTransaction[];
961
1062
  financial_summary: DropshipperFinancialSummary;
962
1063
  /** Credit lines applied to the order (read-only; `[]` when none). */
@@ -1005,6 +1106,8 @@ export interface CreateDropshipperOrderBody {
1005
1106
  /** One selected option per shipping group (contract v2). Replaces `shipping_method_id`. */
1006
1107
  shipping_groups?: ShippingGroupInput[];
1007
1108
  payment_method_id: string;
1109
+ /** Código de gift card (obligatorio si el método de pago es gift card). */
1110
+ gift_card_code?: string;
1008
1111
  notes?: string;
1009
1112
  }
1010
1113
 
@@ -1025,6 +1128,22 @@ export interface SetPaymentCollectorBody {
1025
1128
  payment_collected_by: 'dropshipper' | 'provider';
1026
1129
  }
1027
1130
 
1131
+ /** Body for `POST /admin/thor/dropshipper/gift-cards/validate` */
1132
+ export interface ValidateGiftCardBody {
1133
+ code: string;
1134
+ /** Moneda de la orden: si se envía, se valida que la gift card coincida. */
1135
+ currency_code?: string;
1136
+ }
1137
+
1138
+ /** Response for `POST /admin/thor/dropshipper/gift-cards/validate` */
1139
+ export interface ValidateGiftCardResponse {
1140
+ valid: boolean;
1141
+ /** Mensaje de usuario cuando `valid` es false. */
1142
+ reason?: string;
1143
+ balance?: number;
1144
+ currency_code?: string;
1145
+ }
1146
+
1028
1147
  /** Response for `POST /admin/thor/dropshipper/orders/:id/set-payment-collector` */
1029
1148
  export interface SetPaymentCollectorResponse {
1030
1149
  order_id: string;
@@ -1136,6 +1255,8 @@ export interface DropshipperDraftOrder {
1136
1255
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1137
1256
  shipping_method_id: string | null;
1138
1257
  payment_method_id: string | null;
1258
+ /** Código de gift card persistido en el borrador (metadata). */
1259
+ gift_card_code?: string | null;
1139
1260
  notes: string | null;
1140
1261
  converted_order_id: string | null; // Reference to Medusa order.id after conversion
1141
1262
  converted_at: string | null; // ISO timestamp when converted
@@ -1186,6 +1307,7 @@ export interface CreateDropshipperDraftOrderBody {
1186
1307
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1187
1308
  shipping_method_id?: string;
1188
1309
  payment_method_id?: string;
1310
+ gift_card_code?: string;
1189
1311
  notes?: string;
1190
1312
  }
1191
1313
 
@@ -1211,6 +1333,7 @@ export interface UpdateDropshipperDraftOrderBody {
1211
1333
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1212
1334
  shipping_method_id?: string;
1213
1335
  payment_method_id?: string;
1336
+ gift_card_code?: string;
1214
1337
  notes?: string;
1215
1338
  }
1216
1339
 
@@ -1237,6 +1360,41 @@ export interface DeleteDropshipperDraftOrderResponse {
1237
1360
  deleted: boolean;
1238
1361
  }
1239
1362
 
1363
+ // ============================================================
1364
+ // Order totals preview (Solo Y)
1365
+ // ============================================================
1366
+
1367
+ /** Item for `POST /admin/thor/dropshipper/orders/preview-totals` */
1368
+ export interface PreviewDropshipperOrderItem {
1369
+ variant_id: string;
1370
+ quantity: number;
1371
+ /** Sale price per unit the dropshipper intends to charge (honored over the catalog price). */
1372
+ unit_price?: number;
1373
+ }
1374
+
1375
+ /** Body for `POST /admin/thor/dropshipper/orders/preview-totals` */
1376
+ export interface PreviewDropshipperOrderTotalsBody {
1377
+ customer_id: string;
1378
+ currency_code: string;
1379
+ items: PreviewDropshipperOrderItem[];
1380
+ shipping_address: DropshipperOrderShippingAddress;
1381
+ /** One selected option per shipping group (contract v2). Required when any item needs shipping. */
1382
+ shipping_groups?: ShippingGroupInput[];
1383
+ }
1384
+
1385
+ /** Response for `POST /admin/thor/dropshipper/orders/preview-totals` */
1386
+ export interface PreviewDropshipperOrderTotalsResponse {
1387
+ subtotal: number;
1388
+ items_subtotal: number;
1389
+ shipping_subtotal: number;
1390
+ shipping_total: number;
1391
+ tax_total: number;
1392
+ discount_total: number;
1393
+ total: number;
1394
+ /** Desglose de impuestos por tasa (ítems + envío). `total` es el importe. */
1395
+ tax_lines: DropshipperOrderTaxLine[];
1396
+ }
1397
+
1240
1398
  // ============================================================
1241
1399
  // Custom Categories (Solo Y)
1242
1400
  // ============================================================
@@ -1878,6 +2036,8 @@ export interface DashboardStats {
1878
2036
  total: number;
1879
2037
  profit: number;
1880
2038
  status: string;
2039
+ /** Estado de cobro crudo del backend (captured/authorized/partially_captured/...). */
2040
+ payment_status: string;
1881
2041
  created_at: string;
1882
2042
  }>;
1883
2043
  top_products_by_profit: DashboardTopProduct[];
package/src/index.ts CHANGED
@@ -340,6 +340,7 @@ export type {
340
340
  DropshipperOrderShippingAddress,
341
341
  DropshipperOrderItem,
342
342
  DropshipperOrderTotals,
343
+ DropshipperOrderTaxLine,
343
344
  DropshipperOrderTimelineEvent,
344
345
  DropshipperOrderDetail,
345
346
  GetDropshipperOrderDetailResponse,
@@ -352,6 +353,8 @@ export type {
352
353
  SetPaymentCollectorResponse,
353
354
  SetPaymentMethodBody,
354
355
  SetPaymentMethodResponse,
356
+ ValidateGiftCardBody,
357
+ ValidateGiftCardResponse,
355
358
  DropshipperCategory,
356
359
  GetDropshipperCategoriesOptions,
357
360
  GetDropshipperCategoriesResponse,
@@ -441,6 +444,10 @@ export type {
441
444
  ConvertDropshipperDraftOrderBody,
442
445
  ConvertDropshipperDraftOrderResponse,
443
446
  DeleteDropshipperDraftOrderResponse,
447
+ // Order totals preview
448
+ PreviewDropshipperOrderItem,
449
+ PreviewDropshipperOrderTotalsBody,
450
+ PreviewDropshipperOrderTotalsResponse,
444
451
  // Dropshipper addresses (channel-scoped)
445
452
  DropshipperAddressBody,
446
453
  DropshipperAddressResponse,