@thorprovider/types 7.0.0 → 7.1.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,69 @@ 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<{ title: string; sku: string | null; quantity: number }>;
985
+ status: DropshipperDeliveryGroupStatus;
986
+ /** Fulfillment vinculado, cuando el grupo ya fue cumplido; `null` si no. */
987
+ fulfillment: {
988
+ id: string;
989
+ status: string;
990
+ provider_id: string | null;
991
+ packed_at: string | null;
992
+ shipped_at: string | null;
993
+ delivered_at: string | null;
994
+ canceled_at: string | null;
995
+ labels: DropshipperFulfillmentLabel[];
996
+ } | null;
997
+ /** Punto de recogida + encargado (solo grupos `pickup`). */
998
+ pickup: {
999
+ location: DropshipperPickupLocation | null;
1000
+ person_in_charge: string | null;
1001
+ } | null;
1002
+ }
1003
+
915
1004
  /** A credit line applied to an order (read-only; generated from a gift card,
916
1005
  * store credit or payment collection). `amount` is in major units of
917
1006
  * `currency_code`. */
@@ -957,6 +1046,8 @@ export interface DropshipperOrderDetail {
957
1046
  claims?: DropshipperOrderClaim[];
958
1047
  /** Fulfillments on the order, read-only (optional) */
959
1048
  fulfillments?: DropshipperOrderFulfillment[];
1049
+ /** Grupos de entrega del plan de envío, con o sin fulfillment (optional). */
1050
+ delivery_groups?: DropshipperDeliveryGroup[];
960
1051
  transactions: DropshipperTransaction[];
961
1052
  financial_summary: DropshipperFinancialSummary;
962
1053
  /** Credit lines applied to the order (read-only; `[]` when none). */
@@ -1005,6 +1096,8 @@ export interface CreateDropshipperOrderBody {
1005
1096
  /** One selected option per shipping group (contract v2). Replaces `shipping_method_id`. */
1006
1097
  shipping_groups?: ShippingGroupInput[];
1007
1098
  payment_method_id: string;
1099
+ /** Código de gift card (obligatorio si el método de pago es gift card). */
1100
+ gift_card_code?: string;
1008
1101
  notes?: string;
1009
1102
  }
1010
1103
 
@@ -1025,6 +1118,22 @@ export interface SetPaymentCollectorBody {
1025
1118
  payment_collected_by: 'dropshipper' | 'provider';
1026
1119
  }
1027
1120
 
1121
+ /** Body for `POST /admin/thor/dropshipper/gift-cards/validate` */
1122
+ export interface ValidateGiftCardBody {
1123
+ code: string;
1124
+ /** Moneda de la orden: si se envía, se valida que la gift card coincida. */
1125
+ currency_code?: string;
1126
+ }
1127
+
1128
+ /** Response for `POST /admin/thor/dropshipper/gift-cards/validate` */
1129
+ export interface ValidateGiftCardResponse {
1130
+ valid: boolean;
1131
+ /** Mensaje de usuario cuando `valid` es false. */
1132
+ reason?: string;
1133
+ balance?: number;
1134
+ currency_code?: string;
1135
+ }
1136
+
1028
1137
  /** Response for `POST /admin/thor/dropshipper/orders/:id/set-payment-collector` */
1029
1138
  export interface SetPaymentCollectorResponse {
1030
1139
  order_id: string;
@@ -1136,6 +1245,8 @@ export interface DropshipperDraftOrder {
1136
1245
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1137
1246
  shipping_method_id: string | null;
1138
1247
  payment_method_id: string | null;
1248
+ /** Código de gift card persistido en el borrador (metadata). */
1249
+ gift_card_code?: string | null;
1139
1250
  notes: string | null;
1140
1251
  converted_order_id: string | null; // Reference to Medusa order.id after conversion
1141
1252
  converted_at: string | null; // ISO timestamp when converted
@@ -1186,6 +1297,7 @@ export interface CreateDropshipperDraftOrderBody {
1186
1297
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1187
1298
  shipping_method_id?: string;
1188
1299
  payment_method_id?: string;
1300
+ gift_card_code?: string;
1189
1301
  notes?: string;
1190
1302
  }
1191
1303
 
@@ -1211,6 +1323,7 @@ export interface UpdateDropshipperDraftOrderBody {
1211
1323
  /** @deprecated legacy singular shipping method id; use `shipping_groups` instead. */
1212
1324
  shipping_method_id?: string;
1213
1325
  payment_method_id?: string;
1326
+ gift_card_code?: string;
1214
1327
  notes?: string;
1215
1328
  }
1216
1329
 
@@ -1237,6 +1350,41 @@ export interface DeleteDropshipperDraftOrderResponse {
1237
1350
  deleted: boolean;
1238
1351
  }
1239
1352
 
1353
+ // ============================================================
1354
+ // Order totals preview (Solo Y)
1355
+ // ============================================================
1356
+
1357
+ /** Item for `POST /admin/thor/dropshipper/orders/preview-totals` */
1358
+ export interface PreviewDropshipperOrderItem {
1359
+ variant_id: string;
1360
+ quantity: number;
1361
+ /** Sale price per unit the dropshipper intends to charge (honored over the catalog price). */
1362
+ unit_price?: number;
1363
+ }
1364
+
1365
+ /** Body for `POST /admin/thor/dropshipper/orders/preview-totals` */
1366
+ export interface PreviewDropshipperOrderTotalsBody {
1367
+ customer_id: string;
1368
+ currency_code: string;
1369
+ items: PreviewDropshipperOrderItem[];
1370
+ shipping_address: DropshipperOrderShippingAddress;
1371
+ /** One selected option per shipping group (contract v2). Required when any item needs shipping. */
1372
+ shipping_groups?: ShippingGroupInput[];
1373
+ }
1374
+
1375
+ /** Response for `POST /admin/thor/dropshipper/orders/preview-totals` */
1376
+ export interface PreviewDropshipperOrderTotalsResponse {
1377
+ subtotal: number;
1378
+ items_subtotal: number;
1379
+ shipping_subtotal: number;
1380
+ shipping_total: number;
1381
+ tax_total: number;
1382
+ discount_total: number;
1383
+ total: number;
1384
+ /** Desglose de impuestos por tasa (ítems + envío). `total` es el importe. */
1385
+ tax_lines: DropshipperOrderTaxLine[];
1386
+ }
1387
+
1240
1388
  // ============================================================
1241
1389
  // Custom Categories (Solo Y)
1242
1390
  // ============================================================
@@ -1878,6 +2026,8 @@ export interface DashboardStats {
1878
2026
  total: number;
1879
2027
  profit: number;
1880
2028
  status: string;
2029
+ /** Estado de cobro crudo del backend (captured/authorized/partially_captured/...). */
2030
+ payment_status: string;
1881
2031
  created_at: string;
1882
2032
  }>;
1883
2033
  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,
File without changes