@thorprovider/types 5.3.2 → 5.3.4

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.
@@ -34,14 +34,11 @@ export interface DropshipperCostTier {
34
34
  maxQuantity: number | null;
35
35
  }
36
36
 
37
- /** A quantity-based sale tier (Y→V) configured by the dropshipper (read response) */
37
+ /** A quantity-based sale tier (Y→V) derived by the backend (read response) */
38
38
  export interface DropshipperSaleTier {
39
- /** Markup % over cost applied to this tier (X→Y baseline). */
40
- margin_percent: number;
41
- /** Derived sale price: round(cost × (1 + margin_percent/100)). */
42
- sale_amount: number;
43
- minQuantity: number;
44
- maxQuantity?: number | null;
39
+ amount: number;
40
+ minQuantity: number | null;
41
+ maxQuantity: number | null;
45
42
  }
46
43
 
47
44
  /** A quantity-based sale tier in a price update payload (Y→V) */
@@ -97,6 +94,7 @@ export interface OnboardDropshipperResponse {
97
94
  export interface DropshipperProductImage {
98
95
  id: string;
99
96
  url: string;
97
+ rank: number;
100
98
  }
101
99
 
102
100
  /** A product attachment (file/doc) linked via the product_attachment module */
@@ -126,34 +124,74 @@ export interface DropshipperProductPrivateMedia {
126
124
  metadata: Record<string, unknown> | null;
127
125
  }
128
126
 
127
+ /** A selected option value on a variant */
128
+ export interface DropshipperVariantOption {
129
+ option_id: string;
130
+ option_title: string;
131
+ value_id: string;
132
+ value: string;
133
+ }
134
+
135
+ /** Inventory aggregates for a variant */
136
+ export interface DropshipperVariantInventory {
137
+ stockedQuantity: number | null;
138
+ reservedQuantity: number | null;
139
+ availableQuantity: number | null;
140
+ incomingQuantity: number | null;
141
+ }
142
+
143
+ /** Stock level at a single location */
144
+ export interface DropshipperVariantLocation {
145
+ id: string;
146
+ name: string;
147
+ stockedQuantity: number;
148
+ reservedQuantity: number;
149
+ availableQuantity: number;
150
+ incomingQuantity: number;
151
+ }
152
+
153
+ /** Cost price and tiers (X→Y) */
154
+ export interface DropshipperVariantCostPricing {
155
+ amount: number;
156
+ currency: string;
157
+ source: 'custom' | 'base_price';
158
+ tiers: DropshipperCostTier[];
159
+ }
160
+
161
+ /** Sale price and tiers (Y→V) */
162
+ export interface DropshipperVariantSalePricing {
163
+ amount: number;
164
+ currency: string;
165
+ tiers: DropshipperSaleTier[];
166
+ }
167
+
168
+ /** Margin (Y) */
169
+ export interface DropshipperVariantMarginPricing {
170
+ amount: number;
171
+ percent: number;
172
+ }
173
+
174
+ /** Pricing bundle for a variant */
175
+ export interface DropshipperVariantPricing {
176
+ cost: DropshipperVariantCostPricing;
177
+ sale: DropshipperVariantSalePricing;
178
+ margin: DropshipperVariantMarginPricing;
179
+ markup_percent: number;
180
+ }
181
+
129
182
  /** A product variant as seen by the dropshipper */
130
183
  export interface DropshipperVariant {
131
184
  id: string;
132
185
  title: string;
133
186
  sku: string | null;
134
- availableQuantity: number;
187
+ options: DropshipperVariantOption[];
135
188
  /** Whether inventory is tracked for this variant */
136
189
  manageInventory: boolean;
137
190
  /** Whether backorders are allowed when out of stock */
138
191
  allowBackorder: boolean;
139
- /** Price Y pays to X. Read-only for Y. */
140
- cost_price: number;
141
- cost_price_currency: string;
142
- /** "custom" if a custom cost was set, "base_price" if fallback */
143
- cost_price_source: 'custom' | 'base_price';
144
- /** Quantity-based cost tiers (X→Y) from the Price List */
145
- cost_tiers: DropshipperCostTier[];
146
- /** Price Y charges to V. From the channel's price list. */
147
- sale_price: number;
148
- sale_price_currency: string;
149
- /** Markup % over cost applied to the base sale price (0–1000). */
150
- sale_margin_percent: number;
151
- /** Quantity-based sale tiers (Y→V) configured by the dropshipper */
152
- sale_tiers: DropshipperSaleTier[];
153
- /** sale_price - cost_price (calculated by backend) */
154
- margin: number;
155
- /** (margin / sale_price) × 100 (calculated by backend) */
156
- margin_percent: number;
192
+ inventory: DropshipperVariantInventory;
193
+ locations: DropshipperVariantLocation[];
194
+ pricing: DropshipperVariantPricing;
157
195
  }
158
196
 
159
197
  /** A native Medusa product option value */
@@ -169,49 +207,68 @@ export interface DropshipperProductOption {
169
207
  values: DropshipperProductOptionValue[];
170
208
  }
171
209
 
210
+ /** Standard (provider) physical attributes of a product */
211
+ export interface DropshipperProductStandardAttributes {
212
+ width: number | null;
213
+ height: number | null;
214
+ length: number | null;
215
+ weight: number | null;
216
+ material: string | null;
217
+ origin_country: string | null;
218
+ hs_code: string | null;
219
+ mid_code: string | null;
220
+ }
221
+
222
+ /** A custom attribute assigned to a product */
223
+ export interface DropshipperProductCustomAttribute {
224
+ id: string;
225
+ code: string;
226
+ name: string;
227
+ type: string;
228
+ value: string | null;
229
+ }
230
+
231
+ /** Product attributes bundle */
232
+ export interface DropshipperProductAttributes {
233
+ standard: DropshipperProductStandardAttributes;
234
+ custom: DropshipperProductCustomAttribute[];
235
+ }
236
+
237
+ /** Product media bundle */
238
+ export interface DropshipperProductMedia {
239
+ thumbnail: string | null;
240
+ images: DropshipperProductImage[];
241
+ private_images: DropshipperProductPrivateMedia[];
242
+ }
243
+
244
+ /** A channel-scoped category the product belongs to */
245
+ export interface DropshipperProductCategory {
246
+ id: string;
247
+ name: string;
248
+ handle: string;
249
+ }
250
+
172
251
  /** A product as seen by the dropshipper */
173
252
  export interface DropshipperProduct {
174
253
  id: string;
175
254
  title: string;
176
- thumbnail: string | null;
177
- status: 'published' | 'draft' | string;
178
- global_status?: string | null;
179
- can_publish?: boolean;
180
- cannot_publish_reason?: 'missing_price' | 'product_not_published' | null;
181
- /** Default margin applied to variants that do not have an override. */
182
- margin_percent?: number;
183
- variants: DropshipperVariant[];
184
- subtitle?: string | null;
185
- description?: string | null;
186
- handle?: string | null;
187
- /** Physical dimensions and shipping metadata */
188
- width?: number | null;
189
- height?: number | null;
190
- length?: number | null;
191
- weight?: number | null;
192
- material?: string | null;
193
- origin_country?: string | null;
194
- hs_code?: string | null;
195
- mid_code?: string | null;
196
- collection?: {
255
+ subtitle: string | null;
256
+ description: string | null;
257
+ handle: string | null;
258
+ status: 'published' | 'draft' | 'archived' | string;
259
+ can_publish: boolean;
260
+ attributes: DropshipperProductAttributes;
261
+ media: DropshipperProductMedia;
262
+ categories: DropshipperProductCategory[];
263
+ collection: {
197
264
  id: string;
198
265
  title: string;
199
- handle?: string;
266
+ handle: string;
200
267
  } | null;
201
- medusa_categories?: Array<{
202
- id: string;
203
- name: string;
204
- handle?: string;
205
- parent_category_id?: string | null;
206
- }>;
207
- /** Native Medusa product options (Size, Color, etc.) */
208
- medusa_options?: DropshipperProductOption[];
209
- /** Public gallery images from Medusa — only set when the endpoint fetches them */
210
- images?: DropshipperProductImage[];
268
+ options: DropshipperProductOption[];
269
+ variants: DropshipperVariant[];
211
270
  /** Product attachments (PDFs, CSVs, etc.) from the product_attachment module */
212
271
  attachments?: DropshipperProductAttachment[];
213
- /** Private media (images/videos for dropshipper internal use) */
214
- private_media?: DropshipperProductPrivateMedia[];
215
272
  }
216
273
 
217
274
  /** Options for `GET /admin/thor/dropshipper/products` */
@@ -312,12 +369,17 @@ export interface DropshipperOrderCustomer {
312
369
  export interface DropshipperOrder {
313
370
  id: string;
314
371
  display_id: number;
372
+ custom_display_id?: string | null;
373
+ version: number;
315
374
  status: string;
375
+ payment_status: string;
316
376
  fulfillment_status: string | null;
317
377
  created_at: string;
318
378
  customer: DropshipperOrderCustomer;
319
379
  currency_code: string;
320
380
  total: number;
381
+ tax_total: number;
382
+ net_revenue: number;
321
383
  profit: number;
322
384
  margin_percent: number;
323
385
  items_count: number;
@@ -333,6 +395,7 @@ export interface GetDropshipperOrdersOptions {
333
395
  from?: string;
334
396
  to?: string;
335
397
  q?: string;
398
+ customer_id?: string;
336
399
  limit?: number;
337
400
  offset?: number;
338
401
  }
@@ -430,29 +493,92 @@ export interface DropshipperOrderShippingAddress {
430
493
  }
431
494
 
432
495
  /** A line item with cost and profit breakdown */
496
+
497
+ export interface DropshipperItemCost {
498
+ unit_amount: number;
499
+ total: number;
500
+ }
501
+
502
+ export interface DropshipperItemProfit {
503
+ amount: number;
504
+ margin_percent: number;
505
+ }
506
+
507
+ export interface DropshipperItemDetail {
508
+ quantity: number;
509
+ fulfilled_quantity: number;
510
+ delivered_quantity: number;
511
+ shipped_quantity: number;
512
+ return_requested_quantity: number;
513
+ return_received_quantity: number;
514
+ return_dismissed_quantity: number;
515
+ written_off_quantity: number;
516
+ }
517
+
518
+ export interface DropshipperItemAdjustment {
519
+ id: string;
520
+ promotion_id: string | null;
521
+ code: string | null;
522
+ amount: number;
523
+ description: string | null;
524
+ }
525
+
526
+ export interface DropshipperItemTaxLine {
527
+ id: string;
528
+ code: string | null;
529
+ rate: number;
530
+ total: number;
531
+ subtotal: number;
532
+ }
533
+
433
534
  export interface DropshipperOrderItem {
434
535
  id: string;
435
536
  title: string;
436
- variant_title: string;
437
- sku: string | null;
537
+ variant_title: string | null;
538
+ thumbnail: string | null;
438
539
  quantity: number;
439
540
  unit_price: number;
440
- cost_price: number;
541
+ applied_tier_min_qty: number | null;
542
+ subtitle: string | null;
543
+ product_id: string | null;
544
+ product_title: string;
545
+ variant_id: string | null;
546
+ variant_sku: string | null;
547
+ variant_barcode: string | null;
548
+ variant_option_values: Record<string, string> | null;
549
+ compare_at_unit_price: number | null;
550
+ requires_shipping: boolean;
551
+ is_discountable: boolean;
552
+ is_tax_inclusive: boolean;
553
+ detail: DropshipperItemDetail;
554
+ adjustments: DropshipperItemAdjustment[];
555
+ tax_lines: DropshipperItemTaxLine[];
556
+ original_total: number;
557
+ original_subtotal: number;
558
+ original_tax_total: number;
559
+ item_total: number;
560
+ item_subtotal: number;
561
+ item_tax_total: number;
562
+ total: number;
441
563
  subtotal: number;
442
- cost_subtotal: number;
443
- profit: number;
444
- thumbnail: string | null;
445
- /** Minimum quantity of the cost tier that matched this item at order.placed.
446
- * null when no tier matching occurred (base price was used). */
447
- applied_tier_min_qty?: number | null;
564
+ tax_total: number;
565
+ discount_total: number;
566
+ discount_tax_total: number;
567
+ refundable_total: number;
568
+ refundable_total_per_unit: number;
569
+ cost: DropshipperItemCost;
570
+ profit: DropshipperItemProfit;
571
+ metadata: null;
448
572
  }
449
573
 
450
574
  /** Order totals with profit breakdown */
451
575
  export interface DropshipperOrderTotals {
452
576
  subtotal: number;
577
+ tax_total: number;
453
578
  shipping_total: number;
454
579
  discount_total: number;
455
580
  total: number;
581
+ net_revenue: number;
456
582
  cost_total: number;
457
583
  profit: number;
458
584
  margin_percent: number;
@@ -461,50 +587,175 @@ export interface DropshipperOrderTotals {
461
587
  /** Timeline event on an order */
462
588
  export interface DropshipperOrderTimelineEvent {
463
589
  id: string;
464
- event: string;
465
- description?: string;
466
- type?: "info" | "success" | "warning" | "error";
590
+ code: string;
591
+ title: string;
592
+ description: string;
593
+ type: "info" | "success" | "warning" | "error";
467
594
  timestamp: string;
468
595
  }
469
596
 
597
+ /** Payment collection on an order */
598
+ export interface DropshipperPaymentSession {
599
+ id: string;
600
+ provider: string;
601
+ status: string;
602
+ amount: number;
603
+ currency_code: string;
604
+ authorized_at: string | null;
605
+ provider_reference: string | null;
606
+ }
607
+
608
+ export interface DropshipperPaymentCapture {
609
+ id: string;
610
+ amount: number;
611
+ created_at: string;
612
+ created_by: string | null;
613
+ }
614
+
615
+ export interface DropshipperPaymentRefund {
616
+ id: string;
617
+ amount: number;
618
+ created_at: string;
619
+ created_by: string | null;
620
+ }
621
+
622
+ export interface DropshipperPayment {
623
+ id: string;
624
+ provider: string;
625
+ amount: number;
626
+ currency_code: string;
627
+ authorized_amount: number;
628
+ captured_amount: number;
629
+ refunded_amount: number;
630
+ created_at: string;
631
+ updated_at: string;
632
+ captured_at: string | null;
633
+ canceled_at: string | null;
634
+ captures: DropshipperPaymentCapture[];
635
+ refunds: DropshipperPaymentRefund[];
636
+ }
637
+
638
+ export interface DropshipperPaymentCollection {
639
+ id: string;
640
+ currency_code: string;
641
+ amount: number;
642
+ status: string;
643
+ payment_sessions: DropshipperPaymentSession[];
644
+ payments: DropshipperPayment[];
645
+ }
646
+
647
+ /** Return on an order */
648
+ export interface DropshipperReturnItem {
649
+ id: string;
650
+ item_id: string;
651
+ quantity: number;
652
+ received_quantity: number;
653
+ damaged_quantity: number;
654
+ reason_id: string | null;
655
+ note: string | null;
656
+ metadata: unknown | null;
657
+ }
658
+
659
+ export interface DropshipperReturn {
660
+ id: string;
661
+ display_id: number;
662
+ status: string;
663
+ order_version: number;
664
+ refund_amount: number;
665
+ no_notification: boolean;
666
+ requested_at: string | null;
667
+ received_at: string | null;
668
+ canceled_at: string | null;
669
+ created_by: string | null;
670
+ items: DropshipperReturnItem[];
671
+ }
672
+
673
+ /** Transaction on an order */
674
+ export interface DropshipperTransaction {
675
+ id: string;
676
+ amount: number;
677
+ currency_code: string;
678
+ reference: string | null;
679
+ reference_id: string | null;
680
+ created_at: string;
681
+ }
682
+
683
+ /** Financial summary of an order */
684
+ export interface DropshipperFinancialSummary {
685
+ paid_total: number;
686
+ refunded_total: number;
687
+ pending_difference: number;
688
+ current_order_total: number;
689
+ original_order_total: number;
690
+ transaction_total: number;
691
+ accounting_total: number;
692
+ }
693
+
694
+ /** Pickup location */
695
+ export interface DropshipperPickupLocation {
696
+ id: string;
697
+ name: string;
698
+ address: {
699
+ address_1: string;
700
+ city: string | null;
701
+ province: string | null;
702
+ postal_code: string | null;
703
+ country_code: string;
704
+ } | null;
705
+ }
706
+
707
+ /** A shipping method on an order */
708
+ export interface DropshipperShippingMethod {
709
+ id: string;
710
+ name: string;
711
+ amount: number;
712
+ is_tax_inclusive: boolean;
713
+ original_total: number;
714
+ total: number;
715
+ tax_total: number;
716
+ discount_total: number;
717
+ shipping_option_id: string | null;
718
+ fulfillment_set_type: string | null;
719
+ pickup_location: DropshipperPickupLocation | null;
720
+ }
721
+
470
722
  /** Full order detail as returned by GET /admin/thor/dropshipper/orders/:id */
471
723
  export interface DropshipperOrderDetail {
472
724
  id: string;
473
725
  display_id: number;
726
+ custom_display_id?: string | null;
727
+ version: number;
474
728
  status: string;
475
729
  payment_status?: string;
476
730
  fulfillment_status: string | null;
477
731
  created_at: string;
478
732
  currency_code: string;
479
733
  customer: DropshipperOrderCustomer & { phone?: string };
480
- shipping_address: DropshipperOrderShippingAddress;
734
+ shipping_address: DropshipperOrderShippingAddress | null;
735
+ billing_address: DropshipperOrderShippingAddress | null;
481
736
  items: DropshipperOrderItem[];
482
737
  totals: DropshipperOrderTotals;
738
+ shipping_methods: DropshipperShippingMethod[];
739
+ payment_collections: DropshipperPaymentCollection[];
740
+ returns: DropshipperReturn[];
741
+ transactions: DropshipperTransaction[];
742
+ financial_summary: DropshipperFinancialSummary;
743
+ timeline: DropshipperOrderTimelineEvent[];
744
+ payment_collected_by: 'dropshipper' | 'provider' | null;
745
+ payment_method?: { id: string; name: string } | null;
746
+ paid_amount?: number;
747
+ due_date?: string | null;
748
+ settlement_status: 'settled' | 'unsettled';
749
+ pickup_location: DropshipperPickupLocation | null;
750
+ /** Legacy singular shipping_method kept for backward compatibility */
483
751
  shipping_method?: {
484
752
  id: string;
485
753
  name: string;
486
754
  amount: number;
487
755
  shipping_option_id: string | null;
488
- /** Fulfillment intent of the underlying shipping option: 'delivery' | 'pickup' | 'shipping' | null */
489
756
  fulfillment_set_type?: string | null;
490
- pickup_location?: {
491
- id: string;
492
- name: string;
493
- address: {
494
- address_1: string;
495
- city: string | null;
496
- province: string | null;
497
- postal_code: string | null;
498
- country_code: string;
499
- } | null;
500
- } | null;
757
+ pickup_location?: DropshipperPickupLocation | null;
501
758
  } | null;
502
- payment_collected_by: 'dropshipper' | 'provider' | null;
503
- payment_method?: { id: string; name: string } | null;
504
- paid_amount?: number;
505
- due_date?: string | null;
506
- settlement_status: 'settled' | 'unsettled';
507
- timeline: DropshipperOrderTimelineEvent[];
508
759
  }
509
760
 
510
761
  /** Response for `GET /admin/thor/dropshipper/orders/:id` */
@@ -885,32 +1136,52 @@ export interface DropshipperCustomer {
885
1136
  email: string;
886
1137
  phone: string | null;
887
1138
  created_at: string;
888
- total_orders: number;
889
- total_spent: number;
890
- currency_code: string;
891
- last_order_at: string | null;
892
1139
  type: string;
893
1140
  status: string;
1141
+ stats: DropshipperCustomerStats;
1142
+ financial: DropshipperCustomerFinancial;
894
1143
  }
895
1144
 
896
1145
  /** Stats on a customer as seen by the dropshipper */
897
1146
  export interface DropshipperCustomerStats {
898
1147
  total_orders: number;
899
1148
  total_spent: number;
900
- total_profit_generated: number;
901
1149
  avg_order_value: number;
902
1150
  currency_code: string;
903
1151
  first_order_at: string | null;
904
1152
  last_order_at: string | null;
905
1153
  }
906
1154
 
907
- /** Slim order reference for customer detail */
908
- export interface DropshipperCustomerOrderRef {
1155
+ /** Financial summary on a customer as seen by the dropshipper */
1156
+ export interface DropshipperCustomerFinancial {
1157
+ currency_code: string;
1158
+ debt: {
1159
+ total: number;
1160
+ overdue: number;
1161
+ };
1162
+ store_credit: {
1163
+ balance: number;
1164
+ };
1165
+ }
1166
+
1167
+ /** Address as returned within a customer detail response */
1168
+ export interface DropshipperCustomerAddress {
909
1169
  id: string;
910
- display_id: number;
911
- status: string;
912
- total: number;
1170
+ address_name: string | null;
1171
+ is_default_shipping: boolean;
1172
+ is_default_billing: boolean;
1173
+ company: string | null;
1174
+ first_name: string | null;
1175
+ last_name: string | null;
1176
+ address_1: string | null;
1177
+ address_2: string | null;
1178
+ city: string | null;
1179
+ province: string | null;
1180
+ postal_code: string | null;
1181
+ country_code: string | null;
1182
+ phone: string | null;
913
1183
  created_at: string;
1184
+ updated_at: string;
914
1185
  }
915
1186
 
916
1187
  /** Full customer detail as seen by the dropshipper */
@@ -921,9 +1192,11 @@ export interface DropshipperCustomerDetail {
921
1192
  email: string;
922
1193
  phone: string | null;
923
1194
  created_at: string;
924
- default_shipping_address?: DropshipperOrderShippingAddress | null;
1195
+ type: string;
1196
+ status: string;
1197
+ addresses: DropshipperCustomerAddress[];
925
1198
  stats: DropshipperCustomerStats;
926
- recent_orders: DropshipperCustomerOrderRef[];
1199
+ financial: DropshipperCustomerFinancial;
927
1200
  }
928
1201
 
929
1202
  /** Options for `GET /admin/thor/dropshipper/customers` */
@@ -931,6 +1204,8 @@ export interface GetDropshipperCustomersOptions {
931
1204
  q?: string;
932
1205
  has_orders?: boolean;
933
1206
  from?: string;
1207
+ type?: 'regular' | 'vip' | 'wholesale';
1208
+ status?: 'active' | 'inactive';
934
1209
  limit?: number;
935
1210
  offset?: number;
936
1211
  /** Sort order in `field:direction` format, e.g. `createdAt:desc` or `name:asc` */
package/src/index.ts CHANGED
@@ -321,7 +321,8 @@ export type {
321
321
  DeleteCategoryMappingResponse,
322
322
  DropshipperCustomer,
323
323
  DropshipperCustomerStats,
324
- DropshipperCustomerOrderRef,
324
+ DropshipperCustomerFinancial,
325
+ DropshipperCustomerAddress,
325
326
  DropshipperCustomerDetail,
326
327
  GetDropshipperCustomersOptions,
327
328
  GetDropshipperCustomersResponse,