@thorprovider/types 5.3.2 → 5.3.3

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;
@@ -430,29 +492,92 @@ export interface DropshipperOrderShippingAddress {
430
492
  }
431
493
 
432
494
  /** A line item with cost and profit breakdown */
495
+
496
+ export interface DropshipperItemCost {
497
+ unit_amount: number;
498
+ total: number;
499
+ }
500
+
501
+ export interface DropshipperItemProfit {
502
+ amount: number;
503
+ margin_percent: number;
504
+ }
505
+
506
+ export interface DropshipperItemDetail {
507
+ quantity: number;
508
+ fulfilled_quantity: number;
509
+ delivered_quantity: number;
510
+ shipped_quantity: number;
511
+ return_requested_quantity: number;
512
+ return_received_quantity: number;
513
+ return_dismissed_quantity: number;
514
+ written_off_quantity: number;
515
+ }
516
+
517
+ export interface DropshipperItemAdjustment {
518
+ id: string;
519
+ promotion_id: string | null;
520
+ code: string | null;
521
+ amount: number;
522
+ description: string | null;
523
+ }
524
+
525
+ export interface DropshipperItemTaxLine {
526
+ id: string;
527
+ code: string | null;
528
+ rate: number;
529
+ total: number;
530
+ subtotal: number;
531
+ }
532
+
433
533
  export interface DropshipperOrderItem {
434
534
  id: string;
435
535
  title: string;
436
- variant_title: string;
437
- sku: string | null;
536
+ variant_title: string | null;
537
+ thumbnail: string | null;
438
538
  quantity: number;
439
539
  unit_price: number;
440
- cost_price: number;
540
+ applied_tier_min_qty: number | null;
541
+ subtitle: string | null;
542
+ product_id: string | null;
543
+ product_title: string;
544
+ variant_id: string | null;
545
+ variant_sku: string | null;
546
+ variant_barcode: string | null;
547
+ variant_option_values: Record<string, string> | null;
548
+ compare_at_unit_price: number | null;
549
+ requires_shipping: boolean;
550
+ is_discountable: boolean;
551
+ is_tax_inclusive: boolean;
552
+ detail: DropshipperItemDetail;
553
+ adjustments: DropshipperItemAdjustment[];
554
+ tax_lines: DropshipperItemTaxLine[];
555
+ original_total: number;
556
+ original_subtotal: number;
557
+ original_tax_total: number;
558
+ item_total: number;
559
+ item_subtotal: number;
560
+ item_tax_total: number;
561
+ total: number;
441
562
  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;
563
+ tax_total: number;
564
+ discount_total: number;
565
+ discount_tax_total: number;
566
+ refundable_total: number;
567
+ refundable_total_per_unit: number;
568
+ cost: DropshipperItemCost;
569
+ profit: DropshipperItemProfit;
570
+ metadata: null;
448
571
  }
449
572
 
450
573
  /** Order totals with profit breakdown */
451
574
  export interface DropshipperOrderTotals {
452
575
  subtotal: number;
576
+ tax_total: number;
453
577
  shipping_total: number;
454
578
  discount_total: number;
455
579
  total: number;
580
+ net_revenue: number;
456
581
  cost_total: number;
457
582
  profit: number;
458
583
  margin_percent: number;
@@ -461,50 +586,175 @@ export interface DropshipperOrderTotals {
461
586
  /** Timeline event on an order */
462
587
  export interface DropshipperOrderTimelineEvent {
463
588
  id: string;
464
- event: string;
465
- description?: string;
466
- type?: "info" | "success" | "warning" | "error";
589
+ code: string;
590
+ title: string;
591
+ description: string;
592
+ type: "info" | "success" | "warning" | "error";
467
593
  timestamp: string;
468
594
  }
469
595
 
596
+ /** Payment collection on an order */
597
+ export interface DropshipperPaymentSession {
598
+ id: string;
599
+ provider: string;
600
+ status: string;
601
+ amount: number;
602
+ currency_code: string;
603
+ authorized_at: string | null;
604
+ provider_reference: string | null;
605
+ }
606
+
607
+ export interface DropshipperPaymentCapture {
608
+ id: string;
609
+ amount: number;
610
+ created_at: string;
611
+ created_by: string | null;
612
+ }
613
+
614
+ export interface DropshipperPaymentRefund {
615
+ id: string;
616
+ amount: number;
617
+ created_at: string;
618
+ created_by: string | null;
619
+ }
620
+
621
+ export interface DropshipperPayment {
622
+ id: string;
623
+ provider: string;
624
+ amount: number;
625
+ currency_code: string;
626
+ authorized_amount: number;
627
+ captured_amount: number;
628
+ refunded_amount: number;
629
+ created_at: string;
630
+ updated_at: string;
631
+ captured_at: string | null;
632
+ canceled_at: string | null;
633
+ captures: DropshipperPaymentCapture[];
634
+ refunds: DropshipperPaymentRefund[];
635
+ }
636
+
637
+ export interface DropshipperPaymentCollection {
638
+ id: string;
639
+ currency_code: string;
640
+ amount: number;
641
+ status: string;
642
+ payment_sessions: DropshipperPaymentSession[];
643
+ payments: DropshipperPayment[];
644
+ }
645
+
646
+ /** Return on an order */
647
+ export interface DropshipperReturnItem {
648
+ id: string;
649
+ item_id: string;
650
+ quantity: number;
651
+ received_quantity: number;
652
+ damaged_quantity: number;
653
+ reason_id: string | null;
654
+ note: string | null;
655
+ metadata: unknown | null;
656
+ }
657
+
658
+ export interface DropshipperReturn {
659
+ id: string;
660
+ display_id: number;
661
+ status: string;
662
+ order_version: number;
663
+ refund_amount: number;
664
+ no_notification: boolean;
665
+ requested_at: string | null;
666
+ received_at: string | null;
667
+ canceled_at: string | null;
668
+ created_by: string | null;
669
+ items: DropshipperReturnItem[];
670
+ }
671
+
672
+ /** Transaction on an order */
673
+ export interface DropshipperTransaction {
674
+ id: string;
675
+ amount: number;
676
+ currency_code: string;
677
+ reference: string | null;
678
+ reference_id: string | null;
679
+ created_at: string;
680
+ }
681
+
682
+ /** Financial summary of an order */
683
+ export interface DropshipperFinancialSummary {
684
+ paid_total: number;
685
+ refunded_total: number;
686
+ pending_difference: number;
687
+ current_order_total: number;
688
+ original_order_total: number;
689
+ transaction_total: number;
690
+ accounting_total: number;
691
+ }
692
+
693
+ /** Pickup location */
694
+ export interface DropshipperPickupLocation {
695
+ id: string;
696
+ name: string;
697
+ address: {
698
+ address_1: string;
699
+ city: string | null;
700
+ province: string | null;
701
+ postal_code: string | null;
702
+ country_code: string;
703
+ } | null;
704
+ }
705
+
706
+ /** A shipping method on an order */
707
+ export interface DropshipperShippingMethod {
708
+ id: string;
709
+ name: string;
710
+ amount: number;
711
+ is_tax_inclusive: boolean;
712
+ original_total: number;
713
+ total: number;
714
+ tax_total: number;
715
+ discount_total: number;
716
+ shipping_option_id: string | null;
717
+ fulfillment_set_type: string | null;
718
+ pickup_location: DropshipperPickupLocation | null;
719
+ }
720
+
470
721
  /** Full order detail as returned by GET /admin/thor/dropshipper/orders/:id */
471
722
  export interface DropshipperOrderDetail {
472
723
  id: string;
473
724
  display_id: number;
725
+ custom_display_id?: string | null;
726
+ version: number;
474
727
  status: string;
475
728
  payment_status?: string;
476
729
  fulfillment_status: string | null;
477
730
  created_at: string;
478
731
  currency_code: string;
479
732
  customer: DropshipperOrderCustomer & { phone?: string };
480
- shipping_address: DropshipperOrderShippingAddress;
733
+ shipping_address: DropshipperOrderShippingAddress | null;
734
+ billing_address: DropshipperOrderShippingAddress | null;
481
735
  items: DropshipperOrderItem[];
482
736
  totals: DropshipperOrderTotals;
737
+ shipping_methods: DropshipperShippingMethod[];
738
+ payment_collections: DropshipperPaymentCollection[];
739
+ returns: DropshipperReturn[];
740
+ transactions: DropshipperTransaction[];
741
+ financial_summary: DropshipperFinancialSummary;
742
+ timeline: DropshipperOrderTimelineEvent[];
743
+ payment_collected_by: 'dropshipper' | 'provider' | null;
744
+ payment_method?: { id: string; name: string } | null;
745
+ paid_amount?: number;
746
+ due_date?: string | null;
747
+ settlement_status: 'settled' | 'unsettled';
748
+ pickup_location: DropshipperPickupLocation | null;
749
+ /** Legacy singular shipping_method kept for backward compatibility */
483
750
  shipping_method?: {
484
751
  id: string;
485
752
  name: string;
486
753
  amount: number;
487
754
  shipping_option_id: string | null;
488
- /** Fulfillment intent of the underlying shipping option: 'delivery' | 'pickup' | 'shipping' | null */
489
755
  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;
756
+ pickup_location?: DropshipperPickupLocation | null;
501
757
  } | 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
758
  }
509
759
 
510
760
  /** Response for `GET /admin/thor/dropshipper/orders/:id` */