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