@thorprovider/types 5.3.1 → 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) */
@@ -89,79 +86,6 @@ export interface OnboardDropshipperResponse {
89
86
  };
90
87
  }
91
88
 
92
- // ============================================================
93
- // Variant Costs (Solo X)
94
- // ============================================================
95
-
96
- /** A single variant cost record */
97
- export interface VariantCost {
98
- id: string;
99
- account_id: string;
100
- variant_id: string;
101
- variant_title?: string;
102
- product_title?: string;
103
- cost_amount: number;
104
- currency_code: string;
105
- created_at?: string;
106
- updated_at: string;
107
- }
108
-
109
- /** Options for `GET /admin/thor/dropshipper/variant-costs` */
110
- export interface GetVariantCostsOptions {
111
- /** Filter by dropshipper account */
112
- account_id?: string;
113
- variant_id?: string;
114
- currency_code?: string;
115
- limit?: number;
116
- offset?: number;
117
- }
118
-
119
- /** Response for `GET /admin/thor/dropshipper/variant-costs` */
120
- export interface GetVariantCostsResponse {
121
- variant_costs: VariantCost[];
122
- count: number;
123
- offset: number;
124
- limit: number;
125
- }
126
-
127
- /** Body for `POST /admin/thor/dropshipper/variant-costs` (upsert) */
128
- export interface CreateVariantCostBody {
129
- account_id: string;
130
- variant_id: string;
131
- cost_amount: number;
132
- currency_code: string;
133
- }
134
-
135
- /** Response for `POST /admin/thor/dropshipper/variant-costs` */
136
- export interface CreateVariantCostResponse {
137
- variant_cost: VariantCost;
138
- }
139
-
140
- /** Single item in a batch variant cost update */
141
- export interface BatchVariantCostItem {
142
- variant_id: string;
143
- cost_amount: number;
144
- }
145
-
146
- /** Body for `POST /admin/thor/dropshipper/variant-costs/batch` */
147
- export interface BatchVariantCostsBody {
148
- account_id: string;
149
- currency_code: string;
150
- costs: BatchVariantCostItem[];
151
- }
152
-
153
- /** Response for `POST /admin/thor/dropshipper/variant-costs/batch` */
154
- export interface BatchVariantCostsResponse {
155
- updated: number;
156
- errors: unknown[];
157
- }
158
-
159
- /** Response for `DELETE /admin/thor/dropshipper/variant-costs/:id` */
160
- export interface DeleteVariantCostResponse {
161
- deleted: true;
162
- id: string;
163
- }
164
-
165
89
  // ============================================================
166
90
  // Products & Sale Prices (Solo Y)
167
91
  // ============================================================
@@ -170,6 +94,7 @@ export interface DeleteVariantCostResponse {
170
94
  export interface DropshipperProductImage {
171
95
  id: string;
172
96
  url: string;
97
+ rank: number;
173
98
  }
174
99
 
175
100
  /** A product attachment (file/doc) linked via the product_attachment module */
@@ -199,34 +124,74 @@ export interface DropshipperProductPrivateMedia {
199
124
  metadata: Record<string, unknown> | null;
200
125
  }
201
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
+
202
182
  /** A product variant as seen by the dropshipper */
203
183
  export interface DropshipperVariant {
204
184
  id: string;
205
185
  title: string;
206
186
  sku: string | null;
207
- availableQuantity: number;
187
+ options: DropshipperVariantOption[];
208
188
  /** Whether inventory is tracked for this variant */
209
189
  manageInventory: boolean;
210
190
  /** Whether backorders are allowed when out of stock */
211
191
  allowBackorder: boolean;
212
- /** Price Y pays to X. Read-only for Y. */
213
- cost_price: number;
214
- cost_price_currency: string;
215
- /** "custom" if from DropshipperVariantCost, "base_price" if fallback */
216
- cost_price_source: 'custom' | 'base_price';
217
- /** Quantity-based cost tiers (X→Y) from the Price List */
218
- cost_tiers: DropshipperCostTier[];
219
- /** Price Y charges to V. From the channel's price list. */
220
- sale_price: number;
221
- sale_price_currency: string;
222
- /** Markup % over cost applied to the base sale price (0–1000). */
223
- sale_margin_percent: number;
224
- /** Quantity-based sale tiers (Y→V) configured by the dropshipper */
225
- sale_tiers: DropshipperSaleTier[];
226
- /** sale_price - cost_price (calculated by backend) */
227
- margin: number;
228
- /** (margin / sale_price) × 100 (calculated by backend) */
229
- margin_percent: number;
192
+ inventory: DropshipperVariantInventory;
193
+ locations: DropshipperVariantLocation[];
194
+ pricing: DropshipperVariantPricing;
230
195
  }
231
196
 
232
197
  /** A native Medusa product option value */
@@ -242,49 +207,68 @@ export interface DropshipperProductOption {
242
207
  values: DropshipperProductOptionValue[];
243
208
  }
244
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
+
245
251
  /** A product as seen by the dropshipper */
246
252
  export interface DropshipperProduct {
247
253
  id: string;
248
254
  title: string;
249
- thumbnail: string | null;
250
- status: 'published' | 'draft' | string;
251
- global_status?: string | null;
252
- can_publish?: boolean;
253
- cannot_publish_reason?: 'missing_price' | 'product_not_published' | null;
254
- /** Default margin applied to variants that do not have an override. */
255
- margin_percent?: number;
256
- variants: DropshipperVariant[];
257
- subtitle?: string | null;
258
- description?: string | null;
259
- handle?: string | null;
260
- /** Physical dimensions and shipping metadata */
261
- width?: number | null;
262
- height?: number | null;
263
- length?: number | null;
264
- weight?: number | null;
265
- material?: string | null;
266
- origin_country?: string | null;
267
- hs_code?: string | null;
268
- mid_code?: string | null;
269
- 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: {
270
264
  id: string;
271
265
  title: string;
272
- handle?: string;
266
+ handle: string;
273
267
  } | null;
274
- medusa_categories?: Array<{
275
- id: string;
276
- name: string;
277
- handle?: string;
278
- parent_category_id?: string | null;
279
- }>;
280
- /** Native Medusa product options (Size, Color, etc.) */
281
- medusa_options?: DropshipperProductOption[];
282
- /** Public gallery images from Medusa — only set when the endpoint fetches them */
283
- images?: DropshipperProductImage[];
268
+ options: DropshipperProductOption[];
269
+ variants: DropshipperVariant[];
284
270
  /** Product attachments (PDFs, CSVs, etc.) from the product_attachment module */
285
271
  attachments?: DropshipperProductAttachment[];
286
- /** Private media (images/videos for dropshipper internal use) */
287
- private_media?: DropshipperProductPrivateMedia[];
288
272
  }
289
273
 
290
274
  /** Options for `GET /admin/thor/dropshipper/products` */
@@ -385,12 +369,17 @@ export interface DropshipperOrderCustomer {
385
369
  export interface DropshipperOrder {
386
370
  id: string;
387
371
  display_id: number;
372
+ custom_display_id?: string | null;
373
+ version: number;
388
374
  status: string;
375
+ payment_status: string;
389
376
  fulfillment_status: string | null;
390
377
  created_at: string;
391
378
  customer: DropshipperOrderCustomer;
392
379
  currency_code: string;
393
380
  total: number;
381
+ tax_total: number;
382
+ net_revenue: number;
394
383
  profit: number;
395
384
  margin_percent: number;
396
385
  items_count: number;
@@ -503,29 +492,92 @@ export interface DropshipperOrderShippingAddress {
503
492
  }
504
493
 
505
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
+
506
533
  export interface DropshipperOrderItem {
507
534
  id: string;
508
535
  title: string;
509
- variant_title: string;
510
- sku: string | null;
536
+ variant_title: string | null;
537
+ thumbnail: string | null;
511
538
  quantity: number;
512
539
  unit_price: number;
513
- 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;
514
562
  subtotal: number;
515
- cost_subtotal: number;
516
- profit: number;
517
- thumbnail: string | null;
518
- /** Minimum quantity of the cost tier that matched this item at order.placed.
519
- * null when no tier matching occurred (base price was used). */
520
- 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;
521
571
  }
522
572
 
523
573
  /** Order totals with profit breakdown */
524
574
  export interface DropshipperOrderTotals {
525
575
  subtotal: number;
576
+ tax_total: number;
526
577
  shipping_total: number;
527
578
  discount_total: number;
528
579
  total: number;
580
+ net_revenue: number;
529
581
  cost_total: number;
530
582
  profit: number;
531
583
  margin_percent: number;
@@ -534,50 +586,175 @@ export interface DropshipperOrderTotals {
534
586
  /** Timeline event on an order */
535
587
  export interface DropshipperOrderTimelineEvent {
536
588
  id: string;
537
- event: string;
538
- description?: string;
539
- type?: "info" | "success" | "warning" | "error";
589
+ code: string;
590
+ title: string;
591
+ description: string;
592
+ type: "info" | "success" | "warning" | "error";
540
593
  timestamp: string;
541
594
  }
542
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
+
543
721
  /** Full order detail as returned by GET /admin/thor/dropshipper/orders/:id */
544
722
  export interface DropshipperOrderDetail {
545
723
  id: string;
546
724
  display_id: number;
725
+ custom_display_id?: string | null;
726
+ version: number;
547
727
  status: string;
548
728
  payment_status?: string;
549
729
  fulfillment_status: string | null;
550
730
  created_at: string;
551
731
  currency_code: string;
552
732
  customer: DropshipperOrderCustomer & { phone?: string };
553
- shipping_address: DropshipperOrderShippingAddress;
733
+ shipping_address: DropshipperOrderShippingAddress | null;
734
+ billing_address: DropshipperOrderShippingAddress | null;
554
735
  items: DropshipperOrderItem[];
555
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 */
556
750
  shipping_method?: {
557
751
  id: string;
558
752
  name: string;
559
753
  amount: number;
560
754
  shipping_option_id: string | null;
561
- /** Fulfillment intent of the underlying shipping option: 'delivery' | 'pickup' | 'shipping' | null */
562
755
  fulfillment_set_type?: string | null;
563
- pickup_location?: {
564
- id: string;
565
- name: string;
566
- address: {
567
- address_1: string;
568
- city: string | null;
569
- province: string | null;
570
- postal_code: string | null;
571
- country_code: string;
572
- } | null;
573
- } | null;
756
+ pickup_location?: DropshipperPickupLocation | null;
574
757
  } | null;
575
- payment_collected_by: 'dropshipper' | 'provider' | null;
576
- payment_method?: { id: string; name: string } | null;
577
- paid_amount?: number;
578
- due_date?: string | null;
579
- settlement_status: 'settled' | 'unsettled';
580
- timeline: DropshipperOrderTimelineEvent[];
581
758
  }
582
759
 
583
760
  /** Response for `GET /admin/thor/dropshipper/orders/:id` */
package/src/index.ts CHANGED
@@ -267,15 +267,6 @@ export type {
267
267
  DropshipperSaleTier,
268
268
  OnboardDropshipperBody,
269
269
  OnboardDropshipperResponse,
270
- VariantCost,
271
- GetVariantCostsOptions,
272
- GetVariantCostsResponse,
273
- CreateVariantCostBody,
274
- CreateVariantCostResponse,
275
- BatchVariantCostItem,
276
- BatchVariantCostsBody,
277
- BatchVariantCostsResponse,
278
- DeleteVariantCostResponse,
279
270
  DropshipperVariant,
280
271
  DropshipperProduct,
281
272
  DropshipperProductImage,