@alphabite/medusa-sdk 0.6.15 → 0.7.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.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
2
2
  import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
3
3
  import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO, FileDTO } from '@medusajs/types';
4
+ import { City, Quarter, Office } from '@alphabite/econt-types';
4
5
 
5
6
  /**
6
7
  * Standard paginated response structure for list endpoints
@@ -84,14 +85,19 @@ interface Wishlist {
84
85
  interface WishlistItem {
85
86
  id: string;
86
87
  product_id: string;
88
+ product_variant_id: string;
87
89
  wishlist_id: string;
88
90
  created_at: string;
89
91
  updated_at: string;
90
92
  deleted_at: string | null;
91
- product_variant_id: string;
92
93
  product_variant: (Omit<BaseProductVariant, 'product'> & {
93
- product: Pick<BaseProduct, 'id' | 'thumbnail'>;
94
+ product: Pick<BaseProduct, 'id' | 'thumbnail' | 'title' | 'handle'>;
94
95
  prices: PriceDTO[];
96
+ calculated_price?: {
97
+ calculated_amount: number;
98
+ currency_code: string;
99
+ } | null;
100
+ availability?: number | null;
95
101
  }) | null;
96
102
  }
97
103
  interface CreateWishlistInput {
@@ -108,6 +114,8 @@ interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
108
114
  interface RetrieveWishlistInput {
109
115
  id: string;
110
116
  items_fields?: string[];
117
+ include_calculated_price?: boolean;
118
+ include_inventory_count?: boolean;
111
119
  }
112
120
  interface RetrieveWishlistOutput extends Wishlist {
113
121
  }
@@ -338,183 +346,6 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
338
346
  * Currently supports Bulgaria, can be extended with additional countries
339
347
  */
340
348
  type CountryCode = 'BGR';
341
- /**
342
- * Econt City entity returned from the API
343
- */
344
- interface EcontCity {
345
- /**
346
- * Medusa-generated ID with prefix (e.g., "ecty_...")
347
- */
348
- id: string;
349
- /**
350
- * Econt API ID (stored as string)
351
- */
352
- econtId: string;
353
- /**
354
- * City name in local language
355
- */
356
- name: string;
357
- /**
358
- * City name in English
359
- */
360
- nameEn: string;
361
- /**
362
- * ISO 3166-1 alpha-3 country code
363
- */
364
- countryCode: string;
365
- /**
366
- * Postal code for the city
367
- */
368
- postCode: string;
369
- /**
370
- * Region name in local language
371
- */
372
- regionName: string;
373
- /**
374
- * Region name in English
375
- */
376
- regionNameEn: string;
377
- }
378
- /**
379
- * Econt Quarter entity returned from the API
380
- */
381
- interface EcontQuarter {
382
- /**
383
- * Medusa-generated ID with prefix (e.g., "eqtr_...")
384
- */
385
- id: string;
386
- /**
387
- * Econt quarter ID (can be null for auto-extracted quarters)
388
- */
389
- econtId: string | null;
390
- /**
391
- * Quarter name in local language
392
- */
393
- name: string;
394
- /**
395
- * Quarter name in English
396
- */
397
- nameEn: string;
398
- /**
399
- * Econt city ID (stored as string)
400
- */
401
- econtCityId: string;
402
- }
403
- /**
404
- * Econt Office entity returned from the API
405
- */
406
- interface EcontOffice {
407
- /**
408
- * Medusa-generated ID with prefix (e.g., "eofc_...")
409
- */
410
- id: string;
411
- /**
412
- * Econt office ID (stored as string)
413
- */
414
- econtId: string;
415
- /**
416
- * Office name in local language
417
- */
418
- name: string;
419
- /**
420
- * Office name in English
421
- */
422
- nameEn: string;
423
- /**
424
- * Econt city ID (stored as string)
425
- */
426
- econtCityId: string;
427
- /**
428
- * Econt quarter ID (can be null)
429
- */
430
- econtQuarterId?: string | null;
431
- /**
432
- * Post code from the city
433
- */
434
- postCode: string;
435
- /**
436
- * Full address string
437
- */
438
- fullAddress?: string;
439
- /**
440
- * Full address string in English
441
- */
442
- fullAddressEn?: string;
443
- /**
444
- * Latitude coordinate
445
- */
446
- latitude?: number;
447
- /**
448
- * Longitude coordinate
449
- */
450
- longitude?: number;
451
- /**
452
- * Array of phone numbers
453
- */
454
- phones: string[];
455
- /**
456
- * Additional information
457
- */
458
- info?: string | null;
459
- /**
460
- * Normal business hours start time
461
- */
462
- normalBusinessHoursFrom: Date;
463
- /**
464
- * Normal business hours end time
465
- */
466
- normalBusinessHoursTo: Date;
467
- /**
468
- * Half day business hours start time
469
- */
470
- halfDayBusinessHoursFrom?: Date | null;
471
- /**
472
- * Half day business hours end time
473
- */
474
- halfDayBusinessHoursTo?: Date | null;
475
- }
476
- /**
477
- * Econt Street entity returned from the API
478
- */
479
- interface EcontStreet {
480
- /**
481
- * Medusa-generated ID with prefix (e.g., "estr_...")
482
- */
483
- id: string;
484
- /**
485
- * Econt street ID (stored as string)
486
- */
487
- econtId: string;
488
- /**
489
- * Econt city ID (stored as string)
490
- */
491
- econtCityId: string;
492
- /**
493
- * Street name in local language
494
- */
495
- name: string;
496
- /**
497
- * Street name in English
498
- */
499
- nameEn: string | null;
500
- }
501
- /**
502
- * Econt Region entity returned from the API
503
- */
504
- interface EcontRegion {
505
- /**
506
- * Medusa-generated ID with prefix (e.g., "ereg_...")
507
- */
508
- id: string;
509
- /**
510
- * Region name in local language
511
- */
512
- name: string;
513
- /**
514
- * Region name in English
515
- */
516
- nameEn: string;
517
- }
518
349
  /**
519
350
  * Address city information for validation
520
351
  */
@@ -588,7 +419,7 @@ interface ValidatedAddress {
588
419
  /**
589
420
  * Validated city with full details (includes id, name, etc.)
590
421
  */
591
- city: EcontCity;
422
+ city: City;
592
423
  /**
593
424
  * Full formatted address string
594
425
  */
@@ -632,16 +463,12 @@ interface ListCitiesInput {
632
463
  * Search query to filter cities by name or nameEn
633
464
  */
634
465
  q?: string;
635
- /**
636
- * Filter by region name (matches both regionName and regionNameEn)
637
- */
638
- region?: string;
639
466
  /**
640
467
  * Comma-separated list of fields to include
641
468
  */
642
469
  fields?: string;
643
470
  /**
644
- * Maximum number of results (1-500, default: 15)
471
+ * Maximum number of results (1-100, default: 15)
645
472
  */
646
473
  limit?: number;
647
474
  /**
@@ -658,22 +485,10 @@ interface ListCitiesInput {
658
485
  */
659
486
  interface ListCitiesOutput {
660
487
  /**
661
- * Array of cities with standard fields
662
- * Includes: id, econtId, name, nameEn, countryCode, postCode, regionName, regionNameEn
663
- */
664
- cities: EcontCity[];
665
- /**
666
- * Total count of cities matching the query
488
+ * Array of cities with full details from Econt
489
+ * Includes: id, name, nameEn, postCode, region, etc.
667
490
  */
668
- count: number;
669
- /**
670
- * Maximum number of results per page
671
- */
672
- limit: number;
673
- /**
674
- * Number of results skipped
675
- */
676
- offset: number;
491
+ cities: City[];
677
492
  }
678
493
  /**
679
494
  * Input for listing quarters (neighborhoods) in a city
@@ -685,10 +500,10 @@ interface ListQuartersInput {
685
500
  */
686
501
  countryCode?: CountryCode;
687
502
  /**
688
- * Econt City ID to get quarters for
503
+ * ID of the city to get quarters for
689
504
  * Required parameter
690
505
  */
691
- econtCityId: string;
506
+ cityId: string;
692
507
  /**
693
508
  * Search query to filter quarters by name or nameEn
694
509
  */
@@ -698,7 +513,7 @@ interface ListQuartersInput {
698
513
  */
699
514
  fields?: string;
700
515
  /**
701
- * Maximum number of results (1-500, default: 15)
516
+ * Maximum number of results (1-100, default: 15)
702
517
  */
703
518
  limit?: number;
704
519
  /**
@@ -715,22 +530,10 @@ interface ListQuartersInput {
715
530
  */
716
531
  interface ListQuartersOutput {
717
532
  /**
718
- * Array of quarters with standard fields
719
- * Includes: id, econtId, name, nameEn, econtCityId
720
- */
721
- quarters: EcontQuarter[];
722
- /**
723
- * Total count of quarters matching the query
724
- */
725
- count: number;
726
- /**
727
- * Maximum number of results per page
728
- */
729
- limit: number;
730
- /**
731
- * Number of results skipped
533
+ * Array of quarters with details from Econt
534
+ * Includes: id, cityID, name, nameEn
732
535
  */
733
- offset: number;
536
+ quarters: Quarter[];
734
537
  }
735
538
  /**
736
539
  * Input for listing Econt offices with optional filtering
@@ -742,17 +545,24 @@ interface ListOfficesInput {
742
545
  */
743
546
  countryCode?: CountryCode;
744
547
  /**
745
- * Econt City ID to filter offices by
548
+ * ID of the city to filter offices by
549
+ * At least cityId or officeCode should be provided
550
+ */
551
+ cityId?: string;
552
+ /**
553
+ * ID of the quarter to filter offices by
746
554
  */
747
- econtCityId?: string;
555
+ quarterId?: string;
748
556
  /**
749
- * Econt Quarter ID to filter offices by
557
+ * Quarter name to filter offices by
558
+ * Only works when cityId is also provided
750
559
  */
751
- econtQuarterId?: string;
560
+ quarter?: string;
752
561
  /**
753
- * Specific Econt office code to retrieve
562
+ * Specific office code to retrieve
563
+ * Can be used alone or with cityId for faster filtering
754
564
  */
755
- econtOfficeCode?: string;
565
+ officeCode?: string;
756
566
  /**
757
567
  * Search query to filter offices by name or nameEn
758
568
  */
@@ -762,7 +572,7 @@ interface ListOfficesInput {
762
572
  */
763
573
  fields?: string;
764
574
  /**
765
- * Maximum number of results (1-500, default: 15)
575
+ * Maximum number of results (1-100, default: 15)
766
576
  */
767
577
  limit?: number;
768
578
  /**
@@ -779,120 +589,10 @@ interface ListOfficesInput {
779
589
  */
780
590
  interface ListOfficesOutput {
781
591
  /**
782
- * Array of offices with standard fields
783
- * Includes: id, econtId, name, nameEn, econtCityId, econtQuarterId, postCode, fullAddress, etc.
784
- */
785
- offices: EcontOffice[];
786
- /**
787
- * Total count of offices matching the query
592
+ * Array of offices with full details from Econt
593
+ * Includes: code, name, address, phones, workingHours, etc.
788
594
  */
789
- count: number;
790
- /**
791
- * Maximum number of results per page
792
- */
793
- limit: number;
794
- /**
795
- * Number of results skipped
796
- */
797
- offset: number;
798
- }
799
- /**
800
- * Input for listing Econt streets with optional filtering
801
- */
802
- interface ListStreetsInput {
803
- /**
804
- * Econt City ID - Required to filter streets by city
805
- */
806
- econtCityId: string;
807
- /**
808
- * Search query to filter streets by name or nameEn
809
- */
810
- q?: string;
811
- /**
812
- * Comma-separated list of fields to include
813
- */
814
- fields?: string;
815
- /**
816
- * Maximum number of results (1-500, default: 50)
817
- */
818
- limit?: number;
819
- /**
820
- * Number of results to skip (default: 0)
821
- */
822
- offset?: number;
823
- /**
824
- * Sort order (e.g., "name", "-name" for descending)
825
- */
826
- order?: string;
827
- }
828
- /**
829
- * Response containing list of Econt streets
830
- */
831
- interface ListStreetsOutput {
832
- /**
833
- * Array of streets with standard fields
834
- * Includes: id, econtId, econtCityId, name, nameEn
835
- */
836
- streets: EcontStreet[];
837
- /**
838
- * Total count of streets matching the query
839
- */
840
- count: number;
841
- /**
842
- * Maximum number of results per page
843
- */
844
- limit: number;
845
- /**
846
- * Number of results skipped
847
- */
848
- offset: number;
849
- }
850
- /**
851
- * Input for listing Econt regions with optional filtering
852
- */
853
- interface ListRegionsInput {
854
- /**
855
- * Search query to filter regions by name or nameEn
856
- */
857
- q?: string;
858
- /**
859
- * Comma-separated list of fields to include
860
- */
861
- fields?: string;
862
- /**
863
- * Maximum number of results (1-500, default: 15)
864
- */
865
- limit?: number;
866
- /**
867
- * Number of results to skip (default: 0)
868
- */
869
- offset?: number;
870
- /**
871
- * Sort order (e.g., "name", "-name" for descending)
872
- */
873
- order?: string;
874
- }
875
- /**
876
- * Response containing list of Econt regions
877
- */
878
- interface ListRegionsOutput {
879
- /**
880
- * Array of regions with standard fields
881
- * Includes: id, name, nameEn
882
- */
883
- regions: EcontRegion[];
884
- /**
885
- * Total count of regions matching the query
886
- */
887
- count: number;
888
- /**
889
- * Maximum number of results per page
890
- */
891
- limit: number;
892
- /**
893
- * Number of results skipped
894
- */
895
- offset: number;
595
+ offices: Office[];
896
596
  }
897
597
  /**
898
598
  * Available Econt plugin endpoints
@@ -919,15 +619,6 @@ type EcontEndpoints = {
919
619
  * All data is served from hierarchical cache for instant responses
920
620
  */
921
621
  listOffices: (input: ListOfficesInput, headers?: ClientHeaders) => Promise<ListOfficesOutput>;
922
- /**
923
- * Lists Econt streets for a specific city with optional filtering and pagination
924
- * Requires econtCityId to filter streets by city
925
- */
926
- listStreets: (input: ListStreetsInput, headers?: ClientHeaders) => Promise<ListStreetsOutput>;
927
- /**
928
- * Lists Econt regions with optional filtering and pagination
929
- */
930
- listRegions: (input: ListRegionsInput, headers?: ClientHeaders) => Promise<ListRegionsOutput>;
931
622
  };
932
623
  /**
933
624
  * Econt fulfillment provider plugin
@@ -1002,4 +693,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
1002
693
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
1003
694
  }
1004
695
 
1005
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type EcontQuarter, type EcontRegion, type EcontStreet, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
696
+ export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
2
2
  import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
3
3
  import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO, FileDTO } from '@medusajs/types';
4
+ import { City, Quarter, Office } from '@alphabite/econt-types';
4
5
 
5
6
  /**
6
7
  * Standard paginated response structure for list endpoints
@@ -84,14 +85,19 @@ interface Wishlist {
84
85
  interface WishlistItem {
85
86
  id: string;
86
87
  product_id: string;
88
+ product_variant_id: string;
87
89
  wishlist_id: string;
88
90
  created_at: string;
89
91
  updated_at: string;
90
92
  deleted_at: string | null;
91
- product_variant_id: string;
92
93
  product_variant: (Omit<BaseProductVariant, 'product'> & {
93
- product: Pick<BaseProduct, 'id' | 'thumbnail'>;
94
+ product: Pick<BaseProduct, 'id' | 'thumbnail' | 'title' | 'handle'>;
94
95
  prices: PriceDTO[];
96
+ calculated_price?: {
97
+ calculated_amount: number;
98
+ currency_code: string;
99
+ } | null;
100
+ availability?: number | null;
95
101
  }) | null;
96
102
  }
97
103
  interface CreateWishlistInput {
@@ -108,6 +114,8 @@ interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
108
114
  interface RetrieveWishlistInput {
109
115
  id: string;
110
116
  items_fields?: string[];
117
+ include_calculated_price?: boolean;
118
+ include_inventory_count?: boolean;
111
119
  }
112
120
  interface RetrieveWishlistOutput extends Wishlist {
113
121
  }
@@ -338,183 +346,6 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
338
346
  * Currently supports Bulgaria, can be extended with additional countries
339
347
  */
340
348
  type CountryCode = 'BGR';
341
- /**
342
- * Econt City entity returned from the API
343
- */
344
- interface EcontCity {
345
- /**
346
- * Medusa-generated ID with prefix (e.g., "ecty_...")
347
- */
348
- id: string;
349
- /**
350
- * Econt API ID (stored as string)
351
- */
352
- econtId: string;
353
- /**
354
- * City name in local language
355
- */
356
- name: string;
357
- /**
358
- * City name in English
359
- */
360
- nameEn: string;
361
- /**
362
- * ISO 3166-1 alpha-3 country code
363
- */
364
- countryCode: string;
365
- /**
366
- * Postal code for the city
367
- */
368
- postCode: string;
369
- /**
370
- * Region name in local language
371
- */
372
- regionName: string;
373
- /**
374
- * Region name in English
375
- */
376
- regionNameEn: string;
377
- }
378
- /**
379
- * Econt Quarter entity returned from the API
380
- */
381
- interface EcontQuarter {
382
- /**
383
- * Medusa-generated ID with prefix (e.g., "eqtr_...")
384
- */
385
- id: string;
386
- /**
387
- * Econt quarter ID (can be null for auto-extracted quarters)
388
- */
389
- econtId: string | null;
390
- /**
391
- * Quarter name in local language
392
- */
393
- name: string;
394
- /**
395
- * Quarter name in English
396
- */
397
- nameEn: string;
398
- /**
399
- * Econt city ID (stored as string)
400
- */
401
- econtCityId: string;
402
- }
403
- /**
404
- * Econt Office entity returned from the API
405
- */
406
- interface EcontOffice {
407
- /**
408
- * Medusa-generated ID with prefix (e.g., "eofc_...")
409
- */
410
- id: string;
411
- /**
412
- * Econt office ID (stored as string)
413
- */
414
- econtId: string;
415
- /**
416
- * Office name in local language
417
- */
418
- name: string;
419
- /**
420
- * Office name in English
421
- */
422
- nameEn: string;
423
- /**
424
- * Econt city ID (stored as string)
425
- */
426
- econtCityId: string;
427
- /**
428
- * Econt quarter ID (can be null)
429
- */
430
- econtQuarterId?: string | null;
431
- /**
432
- * Post code from the city
433
- */
434
- postCode: string;
435
- /**
436
- * Full address string
437
- */
438
- fullAddress?: string;
439
- /**
440
- * Full address string in English
441
- */
442
- fullAddressEn?: string;
443
- /**
444
- * Latitude coordinate
445
- */
446
- latitude?: number;
447
- /**
448
- * Longitude coordinate
449
- */
450
- longitude?: number;
451
- /**
452
- * Array of phone numbers
453
- */
454
- phones: string[];
455
- /**
456
- * Additional information
457
- */
458
- info?: string | null;
459
- /**
460
- * Normal business hours start time
461
- */
462
- normalBusinessHoursFrom: Date;
463
- /**
464
- * Normal business hours end time
465
- */
466
- normalBusinessHoursTo: Date;
467
- /**
468
- * Half day business hours start time
469
- */
470
- halfDayBusinessHoursFrom?: Date | null;
471
- /**
472
- * Half day business hours end time
473
- */
474
- halfDayBusinessHoursTo?: Date | null;
475
- }
476
- /**
477
- * Econt Street entity returned from the API
478
- */
479
- interface EcontStreet {
480
- /**
481
- * Medusa-generated ID with prefix (e.g., "estr_...")
482
- */
483
- id: string;
484
- /**
485
- * Econt street ID (stored as string)
486
- */
487
- econtId: string;
488
- /**
489
- * Econt city ID (stored as string)
490
- */
491
- econtCityId: string;
492
- /**
493
- * Street name in local language
494
- */
495
- name: string;
496
- /**
497
- * Street name in English
498
- */
499
- nameEn: string | null;
500
- }
501
- /**
502
- * Econt Region entity returned from the API
503
- */
504
- interface EcontRegion {
505
- /**
506
- * Medusa-generated ID with prefix (e.g., "ereg_...")
507
- */
508
- id: string;
509
- /**
510
- * Region name in local language
511
- */
512
- name: string;
513
- /**
514
- * Region name in English
515
- */
516
- nameEn: string;
517
- }
518
349
  /**
519
350
  * Address city information for validation
520
351
  */
@@ -588,7 +419,7 @@ interface ValidatedAddress {
588
419
  /**
589
420
  * Validated city with full details (includes id, name, etc.)
590
421
  */
591
- city: EcontCity;
422
+ city: City;
592
423
  /**
593
424
  * Full formatted address string
594
425
  */
@@ -632,16 +463,12 @@ interface ListCitiesInput {
632
463
  * Search query to filter cities by name or nameEn
633
464
  */
634
465
  q?: string;
635
- /**
636
- * Filter by region name (matches both regionName and regionNameEn)
637
- */
638
- region?: string;
639
466
  /**
640
467
  * Comma-separated list of fields to include
641
468
  */
642
469
  fields?: string;
643
470
  /**
644
- * Maximum number of results (1-500, default: 15)
471
+ * Maximum number of results (1-100, default: 15)
645
472
  */
646
473
  limit?: number;
647
474
  /**
@@ -658,22 +485,10 @@ interface ListCitiesInput {
658
485
  */
659
486
  interface ListCitiesOutput {
660
487
  /**
661
- * Array of cities with standard fields
662
- * Includes: id, econtId, name, nameEn, countryCode, postCode, regionName, regionNameEn
663
- */
664
- cities: EcontCity[];
665
- /**
666
- * Total count of cities matching the query
488
+ * Array of cities with full details from Econt
489
+ * Includes: id, name, nameEn, postCode, region, etc.
667
490
  */
668
- count: number;
669
- /**
670
- * Maximum number of results per page
671
- */
672
- limit: number;
673
- /**
674
- * Number of results skipped
675
- */
676
- offset: number;
491
+ cities: City[];
677
492
  }
678
493
  /**
679
494
  * Input for listing quarters (neighborhoods) in a city
@@ -685,10 +500,10 @@ interface ListQuartersInput {
685
500
  */
686
501
  countryCode?: CountryCode;
687
502
  /**
688
- * Econt City ID to get quarters for
503
+ * ID of the city to get quarters for
689
504
  * Required parameter
690
505
  */
691
- econtCityId: string;
506
+ cityId: string;
692
507
  /**
693
508
  * Search query to filter quarters by name or nameEn
694
509
  */
@@ -698,7 +513,7 @@ interface ListQuartersInput {
698
513
  */
699
514
  fields?: string;
700
515
  /**
701
- * Maximum number of results (1-500, default: 15)
516
+ * Maximum number of results (1-100, default: 15)
702
517
  */
703
518
  limit?: number;
704
519
  /**
@@ -715,22 +530,10 @@ interface ListQuartersInput {
715
530
  */
716
531
  interface ListQuartersOutput {
717
532
  /**
718
- * Array of quarters with standard fields
719
- * Includes: id, econtId, name, nameEn, econtCityId
720
- */
721
- quarters: EcontQuarter[];
722
- /**
723
- * Total count of quarters matching the query
724
- */
725
- count: number;
726
- /**
727
- * Maximum number of results per page
728
- */
729
- limit: number;
730
- /**
731
- * Number of results skipped
533
+ * Array of quarters with details from Econt
534
+ * Includes: id, cityID, name, nameEn
732
535
  */
733
- offset: number;
536
+ quarters: Quarter[];
734
537
  }
735
538
  /**
736
539
  * Input for listing Econt offices with optional filtering
@@ -742,17 +545,24 @@ interface ListOfficesInput {
742
545
  */
743
546
  countryCode?: CountryCode;
744
547
  /**
745
- * Econt City ID to filter offices by
548
+ * ID of the city to filter offices by
549
+ * At least cityId or officeCode should be provided
550
+ */
551
+ cityId?: string;
552
+ /**
553
+ * ID of the quarter to filter offices by
746
554
  */
747
- econtCityId?: string;
555
+ quarterId?: string;
748
556
  /**
749
- * Econt Quarter ID to filter offices by
557
+ * Quarter name to filter offices by
558
+ * Only works when cityId is also provided
750
559
  */
751
- econtQuarterId?: string;
560
+ quarter?: string;
752
561
  /**
753
- * Specific Econt office code to retrieve
562
+ * Specific office code to retrieve
563
+ * Can be used alone or with cityId for faster filtering
754
564
  */
755
- econtOfficeCode?: string;
565
+ officeCode?: string;
756
566
  /**
757
567
  * Search query to filter offices by name or nameEn
758
568
  */
@@ -762,7 +572,7 @@ interface ListOfficesInput {
762
572
  */
763
573
  fields?: string;
764
574
  /**
765
- * Maximum number of results (1-500, default: 15)
575
+ * Maximum number of results (1-100, default: 15)
766
576
  */
767
577
  limit?: number;
768
578
  /**
@@ -779,120 +589,10 @@ interface ListOfficesInput {
779
589
  */
780
590
  interface ListOfficesOutput {
781
591
  /**
782
- * Array of offices with standard fields
783
- * Includes: id, econtId, name, nameEn, econtCityId, econtQuarterId, postCode, fullAddress, etc.
784
- */
785
- offices: EcontOffice[];
786
- /**
787
- * Total count of offices matching the query
592
+ * Array of offices with full details from Econt
593
+ * Includes: code, name, address, phones, workingHours, etc.
788
594
  */
789
- count: number;
790
- /**
791
- * Maximum number of results per page
792
- */
793
- limit: number;
794
- /**
795
- * Number of results skipped
796
- */
797
- offset: number;
798
- }
799
- /**
800
- * Input for listing Econt streets with optional filtering
801
- */
802
- interface ListStreetsInput {
803
- /**
804
- * Econt City ID - Required to filter streets by city
805
- */
806
- econtCityId: string;
807
- /**
808
- * Search query to filter streets by name or nameEn
809
- */
810
- q?: string;
811
- /**
812
- * Comma-separated list of fields to include
813
- */
814
- fields?: string;
815
- /**
816
- * Maximum number of results (1-500, default: 50)
817
- */
818
- limit?: number;
819
- /**
820
- * Number of results to skip (default: 0)
821
- */
822
- offset?: number;
823
- /**
824
- * Sort order (e.g., "name", "-name" for descending)
825
- */
826
- order?: string;
827
- }
828
- /**
829
- * Response containing list of Econt streets
830
- */
831
- interface ListStreetsOutput {
832
- /**
833
- * Array of streets with standard fields
834
- * Includes: id, econtId, econtCityId, name, nameEn
835
- */
836
- streets: EcontStreet[];
837
- /**
838
- * Total count of streets matching the query
839
- */
840
- count: number;
841
- /**
842
- * Maximum number of results per page
843
- */
844
- limit: number;
845
- /**
846
- * Number of results skipped
847
- */
848
- offset: number;
849
- }
850
- /**
851
- * Input for listing Econt regions with optional filtering
852
- */
853
- interface ListRegionsInput {
854
- /**
855
- * Search query to filter regions by name or nameEn
856
- */
857
- q?: string;
858
- /**
859
- * Comma-separated list of fields to include
860
- */
861
- fields?: string;
862
- /**
863
- * Maximum number of results (1-500, default: 15)
864
- */
865
- limit?: number;
866
- /**
867
- * Number of results to skip (default: 0)
868
- */
869
- offset?: number;
870
- /**
871
- * Sort order (e.g., "name", "-name" for descending)
872
- */
873
- order?: string;
874
- }
875
- /**
876
- * Response containing list of Econt regions
877
- */
878
- interface ListRegionsOutput {
879
- /**
880
- * Array of regions with standard fields
881
- * Includes: id, name, nameEn
882
- */
883
- regions: EcontRegion[];
884
- /**
885
- * Total count of regions matching the query
886
- */
887
- count: number;
888
- /**
889
- * Maximum number of results per page
890
- */
891
- limit: number;
892
- /**
893
- * Number of results skipped
894
- */
895
- offset: number;
595
+ offices: Office[];
896
596
  }
897
597
  /**
898
598
  * Available Econt plugin endpoints
@@ -919,15 +619,6 @@ type EcontEndpoints = {
919
619
  * All data is served from hierarchical cache for instant responses
920
620
  */
921
621
  listOffices: (input: ListOfficesInput, headers?: ClientHeaders) => Promise<ListOfficesOutput>;
922
- /**
923
- * Lists Econt streets for a specific city with optional filtering and pagination
924
- * Requires econtCityId to filter streets by city
925
- */
926
- listStreets: (input: ListStreetsInput, headers?: ClientHeaders) => Promise<ListStreetsOutput>;
927
- /**
928
- * Lists Econt regions with optional filtering and pagination
929
- */
930
- listRegions: (input: ListRegionsInput, headers?: ClientHeaders) => Promise<ListRegionsOutput>;
931
622
  };
932
623
  /**
933
624
  * Econt fulfillment provider plugin
@@ -1002,4 +693,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
1002
693
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
1003
694
  }
1004
695
 
1005
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type EcontQuarter, type EcontRegion, type EcontStreet, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
696
+ export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var u=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var l={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({econtCityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{econtCityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async(t,e)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:t}),listRegions:async(t,e)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:t})})};var o=class extends u__default.default{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};exports.AlphabiteMedusaSdk=o;exports.econtPlugin=f;exports.paypalPlugin=c;exports.reviewsPlugin=g;exports.wishlistPlugin=l;
1
+ 'use strict';var d=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=/*#__PURE__*/_interopDefault(d);var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await s?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d__default.default{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};exports.AlphabiteMedusaSdk=o;exports.econtPlugin=C;exports.paypalPlugin=h;exports.reviewsPlugin=g;exports.wishlistPlugin=p;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import u from'@medusajs/js-sdk';var l={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({econtCityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{econtCityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async(t,e)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:t}),listRegions:async(t,e)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:t})})};var o=class extends u{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};export{o as AlphabiteMedusaSdk,f as econtPlugin,c as paypalPlugin,g as reviewsPlugin,l as wishlistPlugin};
1
+ import d from'@medusajs/js-sdk';var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await s?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};export{o as AlphabiteMedusaSdk,C as econtPlugin,h as paypalPlugin,g as reviewsPlugin,p as wishlistPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphabite/medusa-sdk",
3
- "version": "0.6.15",
3
+ "version": "0.7.0",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",
@@ -46,5 +46,7 @@
46
46
  "url": "git+ssh://git@github.com/alphabite-soft/medusa-sdk.git"
47
47
  },
48
48
  "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610",
49
- "dependencies": {}
49
+ "dependencies": {
50
+ "@alphabite/econt-types": "^1.1.0"
51
+ }
50
52
  }