@thorprovider/medusa-extended 1.0.0 → 1.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.
package/dist/index.mjs CHANGED
@@ -282,7 +282,763 @@ var MedusaAdminClient = class {
282
282
  );
283
283
  }
284
284
  };
285
+
286
+ // src/dropshipper.ts
287
+ import { createLogger as createLogger2, ProviderAPIError as ProviderAPIError2 } from "@thorprovider/adapters";
288
+ var DropshipperClient = class {
289
+ baseUrl;
290
+ token;
291
+ logger;
292
+ constructor(config) {
293
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
294
+ this.token = config.token;
295
+ this.logger = createLogger2("DropshipperClient", config.debug);
296
+ }
297
+ // -------------------------------------------------------------------------
298
+ // Private — HTTP helper
299
+ // -------------------------------------------------------------------------
300
+ async request(method, path, body) {
301
+ const url = `${this.baseUrl}${path}`;
302
+ this.logger.debug(`[dropshipper] ${method} ${path}`);
303
+ const headers = {
304
+ Authorization: `Bearer ${this.token}`,
305
+ "Content-Type": "application/json"
306
+ };
307
+ const init = {
308
+ method,
309
+ headers,
310
+ ...body !== void 0 ? { body: JSON.stringify(body) } : {}
311
+ };
312
+ let response;
313
+ try {
314
+ response = await fetch(url, init);
315
+ } catch (networkError) {
316
+ throw new ProviderAPIError2(
317
+ `[dropshipper] Network error on ${method} ${path}: ${networkError.message}`,
318
+ "NETWORK_ERROR",
319
+ networkError
320
+ );
321
+ }
322
+ if (!response.ok) {
323
+ let message = `HTTP ${response.status}`;
324
+ try {
325
+ const json = await response.json();
326
+ message = json?.message ?? message;
327
+ } catch {
328
+ }
329
+ throw new ProviderAPIError2(
330
+ `[dropshipper] ${method} ${path} failed: ${message}`,
331
+ `DROPSHIPPER_API_${response.status}`,
332
+ response.status
333
+ );
334
+ }
335
+ return response.json();
336
+ }
337
+ // -------------------------------------------------------------------------
338
+ // Onboarding (Solo X)
339
+ // -------------------------------------------------------------------------
340
+ /**
341
+ * Create a new dropshipper account (sales channel + user + price list).
342
+ *
343
+ * `POST /admin/thor/dropshipper/onboard`
344
+ */
345
+ async onboardDropshipper(body) {
346
+ return this.request(
347
+ "POST",
348
+ "/admin/thor/dropshipper/onboard",
349
+ body
350
+ );
351
+ }
352
+ // -------------------------------------------------------------------------
353
+ // Variant Costs (Solo X)
354
+ // -------------------------------------------------------------------------
355
+ /**
356
+ * List variant cost records, optionally filtered by account/variant/currency.
357
+ *
358
+ * `GET /admin/thor/dropshipper/variant-costs`
359
+ */
360
+ async getVariantCosts(options = {}) {
361
+ const { account_id, variant_id, currency_code, limit = 20, offset = 0 } = options;
362
+ const qs = new URLSearchParams({
363
+ limit: String(limit),
364
+ offset: String(offset),
365
+ ...account_id ? { account_id } : {},
366
+ ...variant_id ? { variant_id } : {},
367
+ ...currency_code ? { currency_code } : {}
368
+ });
369
+ return this.request(
370
+ "GET",
371
+ `/admin/thor/dropshipper/variant-costs?${qs}`
372
+ );
373
+ }
374
+ /**
375
+ * Upsert a single variant cost record.
376
+ *
377
+ * `POST /admin/thor/dropshipper/variant-costs`
378
+ */
379
+ async createVariantCost(body) {
380
+ return this.request(
381
+ "POST",
382
+ "/admin/thor/dropshipper/variant-costs",
383
+ body
384
+ );
385
+ }
386
+ /**
387
+ * Batch-upsert variant costs for a given account and currency.
388
+ *
389
+ * `POST /admin/thor/dropshipper/variant-costs/batch`
390
+ */
391
+ async batchVariantCosts(body) {
392
+ return this.request(
393
+ "POST",
394
+ "/admin/thor/dropshipper/variant-costs/batch",
395
+ body
396
+ );
397
+ }
398
+ /**
399
+ * Delete a variant cost record by ID.
400
+ *
401
+ * `DELETE /admin/thor/dropshipper/variant-costs/:id`
402
+ */
403
+ async deleteVariantCost(id) {
404
+ return this.request(
405
+ "DELETE",
406
+ `/admin/thor/dropshipper/variant-costs/${id}`
407
+ );
408
+ }
409
+ // -------------------------------------------------------------------------
410
+ // Products (Solo Y)
411
+ // -------------------------------------------------------------------------
412
+ /**
413
+ * List products available in Y's channel with cost/margin data.
414
+ *
415
+ * `GET /admin/thor/dropshipper/products`
416
+ */
417
+ async getProducts(options = {}) {
418
+ const { q, category_id, status, in_stock, limit = 20, offset = 0 } = options;
419
+ const qs = new URLSearchParams({
420
+ limit: String(limit),
421
+ offset: String(offset),
422
+ ...q ? { q } : {},
423
+ ...category_id ? { category_id } : {},
424
+ ...status ? { status } : {},
425
+ ...in_stock !== void 0 ? { in_stock: String(in_stock) } : {}
426
+ });
427
+ return this.request(
428
+ "GET",
429
+ `/admin/thor/dropshipper/products?${qs}`
430
+ );
431
+ }
432
+ // -------------------------------------------------------------------------
433
+ // Prices (Solo Y)
434
+ // -------------------------------------------------------------------------
435
+ /**
436
+ * Bulk-update sale prices on Y's channel price list.
437
+ *
438
+ * `PUT /admin/thor/dropshipper/prices`
439
+ */
440
+ async updatePrices(body) {
441
+ return this.request(
442
+ "PUT",
443
+ "/admin/thor/dropshipper/prices",
444
+ body
445
+ );
446
+ }
447
+ // -------------------------------------------------------------------------
448
+ // Orders (Y + X for set-payment-collector)
449
+ // -------------------------------------------------------------------------
450
+ /**
451
+ * Paginated list of orders in Y's channel.
452
+ *
453
+ * `GET /admin/thor/dropshipper/orders`
454
+ */
455
+ async getOrders(options = {}) {
456
+ const { status, payment_collector, settlement_status, from, to, q, limit = 20, offset = 0 } = options;
457
+ const qs = new URLSearchParams({
458
+ limit: String(limit),
459
+ offset: String(offset),
460
+ ...status ? { status } : {},
461
+ ...payment_collector ? { payment_collector } : {},
462
+ ...settlement_status ? { settlement_status } : {},
463
+ ...from ? { from } : {},
464
+ ...to ? { to } : {},
465
+ ...q ? { q } : {}
466
+ });
467
+ return this.request(
468
+ "GET",
469
+ `/admin/thor/dropshipper/orders?${qs}`
470
+ );
471
+ }
472
+ /**
473
+ * Full detail for a single order with profit breakdown.
474
+ *
475
+ * `GET /admin/thor/dropshipper/orders/:id`
476
+ */
477
+ async getOrder(orderId) {
478
+ return this.request(
479
+ "GET",
480
+ `/admin/thor/dropshipper/orders/${orderId}`
481
+ );
482
+ }
483
+ /**
484
+ * Manually create an order on behalf of a customer.
485
+ *
486
+ * `POST /admin/thor/dropshipper/orders`
487
+ */
488
+ async createOrder(body) {
489
+ return this.request(
490
+ "POST",
491
+ "/admin/thor/dropshipper/orders",
492
+ body
493
+ );
494
+ }
495
+ /**
496
+ * Set who collects payment for an order (Solo X).
497
+ *
498
+ * `POST /admin/thor/dropshipper/orders/:id/set-payment-collector`
499
+ */
500
+ async setPaymentCollector(orderId, body) {
501
+ return this.request(
502
+ "POST",
503
+ `/admin/thor/dropshipper/orders/${orderId}/set-payment-collector`,
504
+ body
505
+ );
506
+ }
507
+ // -------------------------------------------------------------------------
508
+ // Order Cancel & Edits (Solo Y) — B-04
509
+ // -------------------------------------------------------------------------
510
+ /**
511
+ * Cancel a dropshipper order.
512
+ *
513
+ * `POST /admin/thor/dropshipper/orders/:id/cancel`
514
+ */
515
+ async cancelOrder(orderId) {
516
+ return this.request(
517
+ "POST",
518
+ `/admin/thor/dropshipper/orders/${orderId}/cancel`
519
+ );
520
+ }
521
+ /**
522
+ * Create an order edit for a dropshipper order.
523
+ *
524
+ * `POST /admin/thor/dropshipper/orders/:id/edit`
525
+ */
526
+ async createOrderEdit(orderId, body = {}) {
527
+ return this.request(
528
+ "POST",
529
+ `/admin/thor/dropshipper/orders/${orderId}/edit`,
530
+ body
531
+ );
532
+ }
533
+ /**
534
+ * Add an item to the active order edit.
535
+ *
536
+ * `POST /admin/thor/dropshipper/orders/:id/edit/items`
537
+ */
538
+ async addOrderEditItem(orderId, body) {
539
+ return this.request(
540
+ "POST",
541
+ `/admin/thor/dropshipper/orders/${orderId}/edit/items`,
542
+ body
543
+ );
544
+ }
545
+ /**
546
+ * Confirm the active order edit, applying changes to the order.
547
+ *
548
+ * `POST /admin/thor/dropshipper/orders/:id/edit/confirm`
549
+ */
550
+ async confirmOrderEdit(orderId) {
551
+ return this.request(
552
+ "POST",
553
+ `/admin/thor/dropshipper/orders/${orderId}/edit/confirm`
554
+ );
555
+ }
556
+ /**
557
+ * Get all notes for an order.
558
+ *
559
+ * `GET /admin/thor/dropshipper/orders/:id/notes`
560
+ */
561
+ async getOrderNotes(orderId) {
562
+ return this.request(
563
+ "GET",
564
+ `/admin/thor/dropshipper/orders/${orderId}/notes`
565
+ );
566
+ }
567
+ /**
568
+ * Create a new note for an order.
569
+ *
570
+ * `POST /admin/thor/dropshipper/orders/:id/notes`
571
+ */
572
+ async createOrderNote(orderId, body) {
573
+ return this.request(
574
+ "POST",
575
+ `/admin/thor/dropshipper/orders/${orderId}/notes`,
576
+ body
577
+ );
578
+ }
579
+ /**
580
+ * Delete a note from an order.
581
+ *
582
+ * `DELETE /admin/thor/dropshipper/orders/:id/notes/:noteId`
583
+ */
584
+ async deleteOrderNote(orderId, noteId) {
585
+ return this.request(
586
+ "DELETE",
587
+ `/admin/thor/dropshipper/orders/${orderId}/notes/${noteId}`
588
+ );
589
+ }
590
+ // -------------------------------------------------------------------------
591
+ // Custom Categories (Solo Y)
592
+ // -------------------------------------------------------------------------
593
+ /**
594
+ * List Y's custom product categories.
595
+ *
596
+ * `GET /admin/thor/dropshipper/categories`
597
+ */
598
+ async getCategories(options = {}) {
599
+ const { parent_id, include_children } = options;
600
+ const qs = new URLSearchParams({
601
+ ...parent_id ? { parent_id } : {},
602
+ ...include_children !== void 0 ? { include_children: String(include_children) } : {}
603
+ });
604
+ const query = qs.toString() ? `?${qs}` : "";
605
+ return this.request(
606
+ "GET",
607
+ `/admin/thor/dropshipper/categories${query}`
608
+ );
609
+ }
610
+ /**
611
+ * Create a custom category in Y's channel.
612
+ *
613
+ * `POST /admin/thor/dropshipper/categories`
614
+ */
615
+ async createCategory(body) {
616
+ return this.request(
617
+ "POST",
618
+ "/admin/thor/dropshipper/categories",
619
+ body
620
+ );
621
+ }
622
+ /**
623
+ * Update a custom category.
624
+ *
625
+ * `PUT /admin/thor/dropshipper/categories/:id`
626
+ */
627
+ async updateCategory(categoryId, body) {
628
+ return this.request(
629
+ "PUT",
630
+ `/admin/thor/dropshipper/categories/${categoryId}`,
631
+ body
632
+ );
633
+ }
634
+ /**
635
+ * Delete a custom category.
636
+ *
637
+ * `DELETE /admin/thor/dropshipper/categories/:id`
638
+ */
639
+ async deleteCategory(categoryId) {
640
+ return this.request(
641
+ "DELETE",
642
+ `/admin/thor/dropshipper/categories/${categoryId}`
643
+ );
644
+ }
645
+ /**
646
+ * Map a product to a custom category.
647
+ *
648
+ * `POST /admin/thor/dropshipper/category-mappings`
649
+ */
650
+ async createCategoryMapping(body) {
651
+ return this.request(
652
+ "POST",
653
+ "/admin/thor/dropshipper/category-mappings",
654
+ body
655
+ );
656
+ }
657
+ /**
658
+ * Remove a product-to-category mapping.
659
+ *
660
+ * `DELETE /admin/thor/dropshipper/category-mappings/:id`
661
+ */
662
+ async deleteCategoryMapping(mappingId) {
663
+ return this.request(
664
+ "DELETE",
665
+ `/admin/thor/dropshipper/category-mappings/${mappingId}`
666
+ );
667
+ }
668
+ // -------------------------------------------------------------------------
669
+ // Customers (Solo Y)
670
+ // -------------------------------------------------------------------------
671
+ /**
672
+ * Paginated list of customers in Y's channel.
673
+ *
674
+ * `GET /admin/thor/dropshipper/customers`
675
+ */
676
+ async getCustomers(options = {}) {
677
+ const { q, has_orders, from, limit = 20, offset = 0 } = options;
678
+ const qs = new URLSearchParams({
679
+ limit: String(limit),
680
+ offset: String(offset),
681
+ ...q ? { q } : {},
682
+ ...has_orders !== void 0 ? { has_orders: String(has_orders) } : {},
683
+ ...from ? { from } : {}
684
+ });
685
+ return this.request(
686
+ "GET",
687
+ `/admin/thor/dropshipper/customers?${qs}`
688
+ );
689
+ }
690
+ /**
691
+ * Full detail for a single customer.
692
+ *
693
+ * `GET /admin/thor/dropshipper/customers/:id`
694
+ */
695
+ async getCustomer(customerId) {
696
+ return this.request(
697
+ "GET",
698
+ `/admin/thor/dropshipper/customers/${customerId}`
699
+ );
700
+ }
701
+ /**
702
+ * Create a customer scoped to Y's channel.
703
+ *
704
+ * `POST /admin/thor/dropshipper/customers`
705
+ */
706
+ async createCustomer(body) {
707
+ return this.request(
708
+ "POST",
709
+ "/admin/thor/dropshipper/customers",
710
+ body
711
+ );
712
+ }
713
+ // -------------------------------------------------------------------------
714
+ // Customer Addresses (Solo Y) — B-06
715
+ // -------------------------------------------------------------------------
716
+ /**
717
+ * List addresses for a customer in Y's channel.
718
+ *
719
+ * `GET /admin/thor/dropshipper/customers/:id/addresses`
720
+ */
721
+ async getCustomerAddresses(customerId) {
722
+ return this.request(
723
+ "GET",
724
+ `/admin/thor/dropshipper/customers/${customerId}/addresses`
725
+ );
726
+ }
727
+ /**
728
+ * Create a new address for a customer.
729
+ *
730
+ * `POST /admin/thor/dropshipper/customers/:id/addresses`
731
+ */
732
+ async createCustomerAddress(customerId, body) {
733
+ return this.request(
734
+ "POST",
735
+ `/admin/thor/dropshipper/customers/${customerId}/addresses`,
736
+ body
737
+ );
738
+ }
739
+ /**
740
+ * Update an existing customer address.
741
+ *
742
+ * `PUT /admin/thor/dropshipper/customers/:id/addresses/:addressId`
743
+ */
744
+ async updateCustomerAddress(customerId, addressId, body) {
745
+ return this.request(
746
+ "PUT",
747
+ `/admin/thor/dropshipper/customers/${customerId}/addresses/${addressId}`,
748
+ body
749
+ );
750
+ }
751
+ /**
752
+ * Delete a customer address.
753
+ *
754
+ * `DELETE /admin/thor/dropshipper/customers/:id/addresses/:addressId`
755
+ */
756
+ async deleteCustomerAddress(customerId, addressId) {
757
+ return this.request(
758
+ "DELETE",
759
+ `/admin/thor/dropshipper/customers/${customerId}/addresses/${addressId}`
760
+ );
761
+ }
762
+ // -------------------------------------------------------------------------
763
+ // Account & Settlements (Y read-only)
764
+ // -------------------------------------------------------------------------
765
+ /**
766
+ * Y's account info with current balance.
767
+ *
768
+ * `GET /admin/thor/dropshipper/account`
769
+ */
770
+ async getAccount() {
771
+ return this.request(
772
+ "GET",
773
+ "/admin/thor/dropshipper/account"
774
+ );
775
+ }
776
+ /**
777
+ * Orders where Y owes money to X (Y collected payment, needs to pay costs).
778
+ *
779
+ * `GET /admin/thor/dropshipper/account/payable`
780
+ */
781
+ async getPayable() {
782
+ return this.request(
783
+ "GET",
784
+ "/admin/thor/dropshipper/account/payable"
785
+ );
786
+ }
787
+ /**
788
+ * Orders where X owes money to Y (X collected COD, needs to transfer profit).
789
+ *
790
+ * `GET /admin/thor/dropshipper/account/receivable`
791
+ */
792
+ async getReceivable() {
793
+ return this.request(
794
+ "GET",
795
+ "/admin/thor/dropshipper/account/receivable"
796
+ );
797
+ }
798
+ /**
799
+ * List settlements (Y sees own; X can filter by account_id).
800
+ *
801
+ * `GET /admin/thor/dropshipper/settlements`
802
+ */
803
+ async getSettlements(options = {}) {
804
+ const { status, type, account_id, limit = 20, offset = 0 } = options;
805
+ const qs = new URLSearchParams({
806
+ limit: String(limit),
807
+ offset: String(offset),
808
+ ...status ? { status } : {},
809
+ ...type ? { type } : {},
810
+ ...account_id ? { account_id } : {}
811
+ });
812
+ return this.request(
813
+ "GET",
814
+ `/admin/thor/dropshipper/settlements?${qs}`
815
+ );
816
+ }
817
+ /**
818
+ * Full detail for a single settlement record.
819
+ *
820
+ * `GET /admin/thor/dropshipper/settlements/:id`
821
+ */
822
+ async getSettlement(settlementId) {
823
+ return this.request(
824
+ "GET",
825
+ `/admin/thor/dropshipper/settlements/${settlementId}`
826
+ );
827
+ }
828
+ // -------------------------------------------------------------------------
829
+ // Admin Settlements (Solo X)
830
+ // -------------------------------------------------------------------------
831
+ /**
832
+ * Create a settlement record for a dropshipper account.
833
+ *
834
+ * `POST /admin/thor/dropshipper/admin/settlements`
835
+ */
836
+ async createSettlement(body) {
837
+ return this.request(
838
+ "POST",
839
+ "/admin/thor/dropshipper/admin/settlements",
840
+ body
841
+ );
842
+ }
843
+ /**
844
+ * Confirm a pending settlement (marks it as paid/received).
845
+ *
846
+ * `POST /admin/thor/dropshipper/admin/settlements/:id/confirm`
847
+ */
848
+ async confirmSettlement(settlementId, body = {}) {
849
+ return this.request(
850
+ "POST",
851
+ `/admin/thor/dropshipper/admin/settlements/${settlementId}/confirm`,
852
+ body
853
+ );
854
+ }
855
+ /**
856
+ * Cancel a pending settlement.
857
+ *
858
+ * `POST /admin/thor/dropshipper/admin/settlements/:id/cancel`
859
+ */
860
+ async cancelSettlement(settlementId, body = {}) {
861
+ return this.request(
862
+ "POST",
863
+ `/admin/thor/dropshipper/admin/settlements/${settlementId}/cancel`,
864
+ body
865
+ );
866
+ }
867
+ // -------------------------------------------------------------------------
868
+ // Admin Settlements — list (Solo X)
869
+ // -------------------------------------------------------------------------
870
+ /**
871
+ * X views all settlement records across all dropshipper accounts.
872
+ *
873
+ * `GET /admin/thor/dropshipper/admin/settlements`
874
+ */
875
+ async getAdminSettlements(options = {}) {
876
+ const { status, type, account_id, limit = 20, offset = 0 } = options;
877
+ const qs = new URLSearchParams({
878
+ limit: String(limit),
879
+ offset: String(offset),
880
+ ...status ? { status } : {},
881
+ ...type ? { type } : {},
882
+ ...account_id ? { account_id } : {}
883
+ });
884
+ return this.request(
885
+ "GET",
886
+ `/admin/thor/dropshipper/admin/settlements?${qs}`
887
+ );
888
+ }
889
+ // -------------------------------------------------------------------------
890
+ // Admin Account Management (Solo X)
891
+ // -------------------------------------------------------------------------
892
+ /**
893
+ * List all dropshipper accounts.
894
+ *
895
+ * `GET /admin/thor/dropshipper/admin/accounts`
896
+ */
897
+ async getAdminAccounts() {
898
+ return this.request(
899
+ "GET",
900
+ "/admin/thor/dropshipper/admin/accounts"
901
+ );
902
+ }
903
+ /**
904
+ * Full balance detail for a specific dropshipper account.
905
+ *
906
+ * `GET /admin/thor/dropshipper/admin/accounts/:id/balance`
907
+ */
908
+ async getAdminAccountBalance(accountId) {
909
+ return this.request(
910
+ "GET",
911
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/balance`
912
+ );
913
+ }
914
+ /**
915
+ * List all dropshipper price lists.
916
+ *
917
+ * `GET /admin/thor/dropshipper/admin/price-lists`
918
+ */
919
+ async getAdminPriceLists() {
920
+ return this.request(
921
+ "GET",
922
+ "/admin/thor/dropshipper/admin/price-lists"
923
+ );
924
+ }
925
+ /**
926
+ * Utility: look up which sales channel a user belongs to.
927
+ *
928
+ * `GET /admin/thor/dropshipper/admin/user-channel`
929
+ */
930
+ async getUserChannel() {
931
+ return this.request(
932
+ "GET",
933
+ "/admin/thor/dropshipper/admin/user-channel"
934
+ );
935
+ }
936
+ // -------------------------------------------------------------------------
937
+ // Promotions (Solo Y)
938
+ // -------------------------------------------------------------------------
939
+ /**
940
+ * List Y's promotions (discount codes).
941
+ *
942
+ * `GET /admin/thor/dropshipper/promotions`
943
+ */
944
+ async getPromotions(options = {}) {
945
+ const { type, limit = 20, offset = 0 } = options;
946
+ const qs = new URLSearchParams({
947
+ limit: String(limit),
948
+ offset: String(offset),
949
+ ...type ? { type } : {}
950
+ });
951
+ return this.request(
952
+ "GET",
953
+ `/admin/thor/dropshipper/promotions?${qs}`
954
+ );
955
+ }
956
+ /**
957
+ * Create a promotion for Y's channel.
958
+ *
959
+ * `POST /admin/thor/dropshipper/promotions`
960
+ */
961
+ async createPromotion(body) {
962
+ return this.request(
963
+ "POST",
964
+ "/admin/thor/dropshipper/promotions",
965
+ body
966
+ );
967
+ }
968
+ /**
969
+ * Get a single promotion by ID.
970
+ *
971
+ * `GET /admin/thor/dropshipper/promotions/:id`
972
+ */
973
+ async getPromotion(promotionId) {
974
+ return this.request(
975
+ "GET",
976
+ `/admin/thor/dropshipper/promotions/${promotionId}`
977
+ );
978
+ }
979
+ /**
980
+ * Update an existing promotion.
981
+ *
982
+ * `PUT /admin/thor/dropshipper/promotions/:id`
983
+ */
984
+ async updatePromotion(promotionId, body) {
985
+ return this.request(
986
+ "PUT",
987
+ `/admin/thor/dropshipper/promotions/${promotionId}`,
988
+ body
989
+ );
990
+ }
991
+ /**
992
+ * Delete a promotion.
993
+ *
994
+ * `DELETE /admin/thor/dropshipper/promotions/:id`
995
+ */
996
+ async deletePromotion(promotionId) {
997
+ return this.request(
998
+ "DELETE",
999
+ `/admin/thor/dropshipper/promotions/${promotionId}`
1000
+ );
1001
+ }
1002
+ // -------------------------------------------------------------------------
1003
+ // Dashboard (Solo Y)
1004
+ // -------------------------------------------------------------------------
1005
+ /**
1006
+ * Aggregate stats for Y's dashboard (revenue, profit, top products).
1007
+ *
1008
+ * `GET /admin/thor/dropshipper/dashboard/stats`
1009
+ */
1010
+ async getDashboardStats(options = {}) {
1011
+ const { period, from, to, currency_code } = options;
1012
+ const qs = new URLSearchParams({
1013
+ ...period ? { period } : {},
1014
+ ...from ? { from } : {},
1015
+ ...to ? { to } : {},
1016
+ ...currency_code ? { currency_code } : {}
1017
+ });
1018
+ const query = qs.toString() ? `?${qs}` : "";
1019
+ return this.request(
1020
+ "GET",
1021
+ `/admin/thor/dropshipper/dashboard/stats${query}`
1022
+ );
1023
+ }
1024
+ // -------------------------------------------------------------------------
1025
+ // Storefront (V — end customer, uses publishable API key)
1026
+ // -------------------------------------------------------------------------
1027
+ /**
1028
+ * Public endpoint: dropshipper-scoped categories for the storefront.
1029
+ * Typically called with a publishable API key rather than a JWT.
1030
+ *
1031
+ * `GET /store/thor/dropshipper-categories`
1032
+ */
1033
+ async getStorefrontCategories() {
1034
+ return this.request(
1035
+ "GET",
1036
+ "/store/thor/dropshipper-categories"
1037
+ );
1038
+ }
1039
+ };
285
1040
  export {
1041
+ DropshipperClient,
286
1042
  MedusaAdminClient
287
1043
  };
288
1044
  //# sourceMappingURL=index.mjs.map