@alphabite/medusa-sdk 0.6.14 → 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,13 +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
93
  product_variant: (Omit<BaseProductVariant, 'product'> & {
92
- product: Pick<BaseProduct, 'id' | 'thumbnail'>;
94
+ product: Pick<BaseProduct, 'id' | 'thumbnail' | 'title' | 'handle'>;
93
95
  prices: PriceDTO[];
96
+ calculated_price?: {
97
+ calculated_amount: number;
98
+ currency_code: string;
99
+ } | null;
100
+ availability?: number | null;
94
101
  }) | null;
95
102
  }
96
103
  interface CreateWishlistInput {
@@ -107,6 +114,8 @@ interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
107
114
  interface RetrieveWishlistInput {
108
115
  id: string;
109
116
  items_fields?: string[];
117
+ include_calculated_price?: boolean;
118
+ include_inventory_count?: boolean;
110
119
  }
111
120
  interface RetrieveWishlistOutput extends Wishlist {
112
121
  }
@@ -337,183 +346,6 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
337
346
  * Currently supports Bulgaria, can be extended with additional countries
338
347
  */
339
348
  type CountryCode = 'BGR';
340
- /**
341
- * Econt City entity returned from the API
342
- */
343
- interface EcontCity {
344
- /**
345
- * Medusa-generated ID with prefix (e.g., "ecty_...")
346
- */
347
- id: string;
348
- /**
349
- * Econt API ID (stored as string)
350
- */
351
- econtId: string;
352
- /**
353
- * City name in local language
354
- */
355
- name: string;
356
- /**
357
- * City name in English
358
- */
359
- nameEn: string;
360
- /**
361
- * ISO 3166-1 alpha-3 country code
362
- */
363
- countryCode: string;
364
- /**
365
- * Postal code for the city
366
- */
367
- postCode: string;
368
- /**
369
- * Region name in local language
370
- */
371
- regionName: string;
372
- /**
373
- * Region name in English
374
- */
375
- regionNameEn: string;
376
- }
377
- /**
378
- * Econt Quarter entity returned from the API
379
- */
380
- interface EcontQuarter {
381
- /**
382
- * Medusa-generated ID with prefix (e.g., "eqtr_...")
383
- */
384
- id: string;
385
- /**
386
- * Econt quarter ID (can be null for auto-extracted quarters)
387
- */
388
- econtId: string | null;
389
- /**
390
- * Quarter name in local language
391
- */
392
- name: string;
393
- /**
394
- * Quarter name in English
395
- */
396
- nameEn: string;
397
- /**
398
- * Econt city ID (stored as string)
399
- */
400
- econtCityId: string;
401
- }
402
- /**
403
- * Econt Office entity returned from the API
404
- */
405
- interface EcontOffice {
406
- /**
407
- * Medusa-generated ID with prefix (e.g., "eofc_...")
408
- */
409
- id: string;
410
- /**
411
- * Econt office ID (stored as string)
412
- */
413
- econtId: string;
414
- /**
415
- * Office name in local language
416
- */
417
- name: string;
418
- /**
419
- * Office name in English
420
- */
421
- nameEn: string;
422
- /**
423
- * Econt city ID (stored as string)
424
- */
425
- econtCityId: string;
426
- /**
427
- * Econt quarter ID (can be null)
428
- */
429
- econtQuarterId?: string | null;
430
- /**
431
- * Post code from the city
432
- */
433
- postCode: string;
434
- /**
435
- * Full address string
436
- */
437
- fullAddress?: string;
438
- /**
439
- * Full address string in English
440
- */
441
- fullAddressEn?: string;
442
- /**
443
- * Latitude coordinate
444
- */
445
- latitude?: number;
446
- /**
447
- * Longitude coordinate
448
- */
449
- longitude?: number;
450
- /**
451
- * Array of phone numbers
452
- */
453
- phones: string[];
454
- /**
455
- * Additional information
456
- */
457
- info?: string | null;
458
- /**
459
- * Normal business hours start time
460
- */
461
- normalBusinessHoursFrom: Date;
462
- /**
463
- * Normal business hours end time
464
- */
465
- normalBusinessHoursTo: Date;
466
- /**
467
- * Half day business hours start time
468
- */
469
- halfDayBusinessHoursFrom?: Date | null;
470
- /**
471
- * Half day business hours end time
472
- */
473
- halfDayBusinessHoursTo?: Date | null;
474
- }
475
- /**
476
- * Econt Street entity returned from the API
477
- */
478
- interface EcontStreet {
479
- /**
480
- * Medusa-generated ID with prefix (e.g., "estr_...")
481
- */
482
- id: string;
483
- /**
484
- * Econt street ID (stored as string)
485
- */
486
- econtId: string;
487
- /**
488
- * Econt city ID (stored as string)
489
- */
490
- econtCityId: string;
491
- /**
492
- * Street name in local language
493
- */
494
- name: string;
495
- /**
496
- * Street name in English
497
- */
498
- nameEn: string | null;
499
- }
500
- /**
501
- * Econt Region entity returned from the API
502
- */
503
- interface EcontRegion {
504
- /**
505
- * Medusa-generated ID with prefix (e.g., "ereg_...")
506
- */
507
- id: string;
508
- /**
509
- * Region name in local language
510
- */
511
- name: string;
512
- /**
513
- * Region name in English
514
- */
515
- nameEn: string;
516
- }
517
349
  /**
518
350
  * Address city information for validation
519
351
  */
@@ -587,7 +419,7 @@ interface ValidatedAddress {
587
419
  /**
588
420
  * Validated city with full details (includes id, name, etc.)
589
421
  */
590
- city: EcontCity;
422
+ city: City;
591
423
  /**
592
424
  * Full formatted address string
593
425
  */
@@ -631,16 +463,12 @@ interface ListCitiesInput {
631
463
  * Search query to filter cities by name or nameEn
632
464
  */
633
465
  q?: string;
634
- /**
635
- * Filter by region name (matches both regionName and regionNameEn)
636
- */
637
- region?: string;
638
466
  /**
639
467
  * Comma-separated list of fields to include
640
468
  */
641
469
  fields?: string;
642
470
  /**
643
- * Maximum number of results (1-500, default: 15)
471
+ * Maximum number of results (1-100, default: 15)
644
472
  */
645
473
  limit?: number;
646
474
  /**
@@ -657,22 +485,10 @@ interface ListCitiesInput {
657
485
  */
658
486
  interface ListCitiesOutput {
659
487
  /**
660
- * Array of cities with standard fields
661
- * Includes: id, econtId, name, nameEn, countryCode, postCode, regionName, regionNameEn
662
- */
663
- cities: EcontCity[];
664
- /**
665
- * Total count of cities matching the query
488
+ * Array of cities with full details from Econt
489
+ * Includes: id, name, nameEn, postCode, region, etc.
666
490
  */
667
- count: number;
668
- /**
669
- * Maximum number of results per page
670
- */
671
- limit: number;
672
- /**
673
- * Number of results skipped
674
- */
675
- offset: number;
491
+ cities: City[];
676
492
  }
677
493
  /**
678
494
  * Input for listing quarters (neighborhoods) in a city
@@ -684,10 +500,10 @@ interface ListQuartersInput {
684
500
  */
685
501
  countryCode?: CountryCode;
686
502
  /**
687
- * Econt City ID to get quarters for
503
+ * ID of the city to get quarters for
688
504
  * Required parameter
689
505
  */
690
- econtCityId: string;
506
+ cityId: string;
691
507
  /**
692
508
  * Search query to filter quarters by name or nameEn
693
509
  */
@@ -697,7 +513,7 @@ interface ListQuartersInput {
697
513
  */
698
514
  fields?: string;
699
515
  /**
700
- * Maximum number of results (1-500, default: 15)
516
+ * Maximum number of results (1-100, default: 15)
701
517
  */
702
518
  limit?: number;
703
519
  /**
@@ -714,22 +530,10 @@ interface ListQuartersInput {
714
530
  */
715
531
  interface ListQuartersOutput {
716
532
  /**
717
- * Array of quarters with standard fields
718
- * Includes: id, econtId, name, nameEn, econtCityId
719
- */
720
- quarters: EcontQuarter[];
721
- /**
722
- * Total count of quarters matching the query
723
- */
724
- count: number;
725
- /**
726
- * Maximum number of results per page
727
- */
728
- limit: number;
729
- /**
730
- * Number of results skipped
533
+ * Array of quarters with details from Econt
534
+ * Includes: id, cityID, name, nameEn
731
535
  */
732
- offset: number;
536
+ quarters: Quarter[];
733
537
  }
734
538
  /**
735
539
  * Input for listing Econt offices with optional filtering
@@ -741,17 +545,24 @@ interface ListOfficesInput {
741
545
  */
742
546
  countryCode?: CountryCode;
743
547
  /**
744
- * 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
745
554
  */
746
- econtCityId?: string;
555
+ quarterId?: string;
747
556
  /**
748
- * Econt Quarter ID to filter offices by
557
+ * Quarter name to filter offices by
558
+ * Only works when cityId is also provided
749
559
  */
750
- econtQuarterId?: string;
560
+ quarter?: string;
751
561
  /**
752
- * Specific Econt office code to retrieve
562
+ * Specific office code to retrieve
563
+ * Can be used alone or with cityId for faster filtering
753
564
  */
754
- econtOfficeCode?: string;
565
+ officeCode?: string;
755
566
  /**
756
567
  * Search query to filter offices by name or nameEn
757
568
  */
@@ -761,7 +572,7 @@ interface ListOfficesInput {
761
572
  */
762
573
  fields?: string;
763
574
  /**
764
- * Maximum number of results (1-500, default: 15)
575
+ * Maximum number of results (1-100, default: 15)
765
576
  */
766
577
  limit?: number;
767
578
  /**
@@ -778,120 +589,10 @@ interface ListOfficesInput {
778
589
  */
779
590
  interface ListOfficesOutput {
780
591
  /**
781
- * Array of offices with standard fields
782
- * Includes: id, econtId, name, nameEn, econtCityId, econtQuarterId, postCode, fullAddress, etc.
783
- */
784
- offices: EcontOffice[];
785
- /**
786
- * Total count of offices matching the query
592
+ * Array of offices with full details from Econt
593
+ * Includes: code, name, address, phones, workingHours, etc.
787
594
  */
788
- count: number;
789
- /**
790
- * Maximum number of results per page
791
- */
792
- limit: number;
793
- /**
794
- * Number of results skipped
795
- */
796
- offset: number;
797
- }
798
- /**
799
- * Input for listing Econt streets with optional filtering
800
- */
801
- interface ListStreetsInput {
802
- /**
803
- * Econt City ID - Required to filter streets by city
804
- */
805
- econtCityId: string;
806
- /**
807
- * Search query to filter streets by name or nameEn
808
- */
809
- q?: string;
810
- /**
811
- * Comma-separated list of fields to include
812
- */
813
- fields?: string;
814
- /**
815
- * Maximum number of results (1-500, default: 50)
816
- */
817
- limit?: number;
818
- /**
819
- * Number of results to skip (default: 0)
820
- */
821
- offset?: number;
822
- /**
823
- * Sort order (e.g., "name", "-name" for descending)
824
- */
825
- order?: string;
826
- }
827
- /**
828
- * Response containing list of Econt streets
829
- */
830
- interface ListStreetsOutput {
831
- /**
832
- * Array of streets with standard fields
833
- * Includes: id, econtId, econtCityId, name, nameEn
834
- */
835
- streets: EcontStreet[];
836
- /**
837
- * Total count of streets matching the query
838
- */
839
- count: number;
840
- /**
841
- * Maximum number of results per page
842
- */
843
- limit: number;
844
- /**
845
- * Number of results skipped
846
- */
847
- offset: number;
848
- }
849
- /**
850
- * Input for listing Econt regions with optional filtering
851
- */
852
- interface ListRegionsInput {
853
- /**
854
- * Search query to filter regions by name or nameEn
855
- */
856
- q?: string;
857
- /**
858
- * Comma-separated list of fields to include
859
- */
860
- fields?: string;
861
- /**
862
- * Maximum number of results (1-500, default: 15)
863
- */
864
- limit?: number;
865
- /**
866
- * Number of results to skip (default: 0)
867
- */
868
- offset?: number;
869
- /**
870
- * Sort order (e.g., "name", "-name" for descending)
871
- */
872
- order?: string;
873
- }
874
- /**
875
- * Response containing list of Econt regions
876
- */
877
- interface ListRegionsOutput {
878
- /**
879
- * Array of regions with standard fields
880
- * Includes: id, name, nameEn
881
- */
882
- regions: EcontRegion[];
883
- /**
884
- * Total count of regions matching the query
885
- */
886
- count: number;
887
- /**
888
- * Maximum number of results per page
889
- */
890
- limit: number;
891
- /**
892
- * Number of results skipped
893
- */
894
- offset: number;
595
+ offices: Office[];
895
596
  }
896
597
  /**
897
598
  * Available Econt plugin endpoints
@@ -918,15 +619,6 @@ type EcontEndpoints = {
918
619
  * All data is served from hierarchical cache for instant responses
919
620
  */
920
621
  listOffices: (input: ListOfficesInput, headers?: ClientHeaders) => Promise<ListOfficesOutput>;
921
- /**
922
- * Lists Econt streets for a specific city with optional filtering and pagination
923
- * Requires econtCityId to filter streets by city
924
- */
925
- listStreets: (input: ListStreetsInput, headers?: ClientHeaders) => Promise<ListStreetsOutput>;
926
- /**
927
- * Lists Econt regions with optional filtering and pagination
928
- */
929
- listRegions: (input: ListRegionsInput, headers?: ClientHeaders) => Promise<ListRegionsOutput>;
930
622
  };
931
623
  /**
932
624
  * Econt fulfillment provider plugin
@@ -1001,4 +693,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
1001
693
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
1002
694
  }
1003
695
 
1004
- 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,13 +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
93
  product_variant: (Omit<BaseProductVariant, 'product'> & {
92
- product: Pick<BaseProduct, 'id' | 'thumbnail'>;
94
+ product: Pick<BaseProduct, 'id' | 'thumbnail' | 'title' | 'handle'>;
93
95
  prices: PriceDTO[];
96
+ calculated_price?: {
97
+ calculated_amount: number;
98
+ currency_code: string;
99
+ } | null;
100
+ availability?: number | null;
94
101
  }) | null;
95
102
  }
96
103
  interface CreateWishlistInput {
@@ -107,6 +114,8 @@ interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
107
114
  interface RetrieveWishlistInput {
108
115
  id: string;
109
116
  items_fields?: string[];
117
+ include_calculated_price?: boolean;
118
+ include_inventory_count?: boolean;
110
119
  }
111
120
  interface RetrieveWishlistOutput extends Wishlist {
112
121
  }
@@ -337,183 +346,6 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
337
346
  * Currently supports Bulgaria, can be extended with additional countries
338
347
  */
339
348
  type CountryCode = 'BGR';
340
- /**
341
- * Econt City entity returned from the API
342
- */
343
- interface EcontCity {
344
- /**
345
- * Medusa-generated ID with prefix (e.g., "ecty_...")
346
- */
347
- id: string;
348
- /**
349
- * Econt API ID (stored as string)
350
- */
351
- econtId: string;
352
- /**
353
- * City name in local language
354
- */
355
- name: string;
356
- /**
357
- * City name in English
358
- */
359
- nameEn: string;
360
- /**
361
- * ISO 3166-1 alpha-3 country code
362
- */
363
- countryCode: string;
364
- /**
365
- * Postal code for the city
366
- */
367
- postCode: string;
368
- /**
369
- * Region name in local language
370
- */
371
- regionName: string;
372
- /**
373
- * Region name in English
374
- */
375
- regionNameEn: string;
376
- }
377
- /**
378
- * Econt Quarter entity returned from the API
379
- */
380
- interface EcontQuarter {
381
- /**
382
- * Medusa-generated ID with prefix (e.g., "eqtr_...")
383
- */
384
- id: string;
385
- /**
386
- * Econt quarter ID (can be null for auto-extracted quarters)
387
- */
388
- econtId: string | null;
389
- /**
390
- * Quarter name in local language
391
- */
392
- name: string;
393
- /**
394
- * Quarter name in English
395
- */
396
- nameEn: string;
397
- /**
398
- * Econt city ID (stored as string)
399
- */
400
- econtCityId: string;
401
- }
402
- /**
403
- * Econt Office entity returned from the API
404
- */
405
- interface EcontOffice {
406
- /**
407
- * Medusa-generated ID with prefix (e.g., "eofc_...")
408
- */
409
- id: string;
410
- /**
411
- * Econt office ID (stored as string)
412
- */
413
- econtId: string;
414
- /**
415
- * Office name in local language
416
- */
417
- name: string;
418
- /**
419
- * Office name in English
420
- */
421
- nameEn: string;
422
- /**
423
- * Econt city ID (stored as string)
424
- */
425
- econtCityId: string;
426
- /**
427
- * Econt quarter ID (can be null)
428
- */
429
- econtQuarterId?: string | null;
430
- /**
431
- * Post code from the city
432
- */
433
- postCode: string;
434
- /**
435
- * Full address string
436
- */
437
- fullAddress?: string;
438
- /**
439
- * Full address string in English
440
- */
441
- fullAddressEn?: string;
442
- /**
443
- * Latitude coordinate
444
- */
445
- latitude?: number;
446
- /**
447
- * Longitude coordinate
448
- */
449
- longitude?: number;
450
- /**
451
- * Array of phone numbers
452
- */
453
- phones: string[];
454
- /**
455
- * Additional information
456
- */
457
- info?: string | null;
458
- /**
459
- * Normal business hours start time
460
- */
461
- normalBusinessHoursFrom: Date;
462
- /**
463
- * Normal business hours end time
464
- */
465
- normalBusinessHoursTo: Date;
466
- /**
467
- * Half day business hours start time
468
- */
469
- halfDayBusinessHoursFrom?: Date | null;
470
- /**
471
- * Half day business hours end time
472
- */
473
- halfDayBusinessHoursTo?: Date | null;
474
- }
475
- /**
476
- * Econt Street entity returned from the API
477
- */
478
- interface EcontStreet {
479
- /**
480
- * Medusa-generated ID with prefix (e.g., "estr_...")
481
- */
482
- id: string;
483
- /**
484
- * Econt street ID (stored as string)
485
- */
486
- econtId: string;
487
- /**
488
- * Econt city ID (stored as string)
489
- */
490
- econtCityId: string;
491
- /**
492
- * Street name in local language
493
- */
494
- name: string;
495
- /**
496
- * Street name in English
497
- */
498
- nameEn: string | null;
499
- }
500
- /**
501
- * Econt Region entity returned from the API
502
- */
503
- interface EcontRegion {
504
- /**
505
- * Medusa-generated ID with prefix (e.g., "ereg_...")
506
- */
507
- id: string;
508
- /**
509
- * Region name in local language
510
- */
511
- name: string;
512
- /**
513
- * Region name in English
514
- */
515
- nameEn: string;
516
- }
517
349
  /**
518
350
  * Address city information for validation
519
351
  */
@@ -587,7 +419,7 @@ interface ValidatedAddress {
587
419
  /**
588
420
  * Validated city with full details (includes id, name, etc.)
589
421
  */
590
- city: EcontCity;
422
+ city: City;
591
423
  /**
592
424
  * Full formatted address string
593
425
  */
@@ -631,16 +463,12 @@ interface ListCitiesInput {
631
463
  * Search query to filter cities by name or nameEn
632
464
  */
633
465
  q?: string;
634
- /**
635
- * Filter by region name (matches both regionName and regionNameEn)
636
- */
637
- region?: string;
638
466
  /**
639
467
  * Comma-separated list of fields to include
640
468
  */
641
469
  fields?: string;
642
470
  /**
643
- * Maximum number of results (1-500, default: 15)
471
+ * Maximum number of results (1-100, default: 15)
644
472
  */
645
473
  limit?: number;
646
474
  /**
@@ -657,22 +485,10 @@ interface ListCitiesInput {
657
485
  */
658
486
  interface ListCitiesOutput {
659
487
  /**
660
- * Array of cities with standard fields
661
- * Includes: id, econtId, name, nameEn, countryCode, postCode, regionName, regionNameEn
662
- */
663
- cities: EcontCity[];
664
- /**
665
- * Total count of cities matching the query
488
+ * Array of cities with full details from Econt
489
+ * Includes: id, name, nameEn, postCode, region, etc.
666
490
  */
667
- count: number;
668
- /**
669
- * Maximum number of results per page
670
- */
671
- limit: number;
672
- /**
673
- * Number of results skipped
674
- */
675
- offset: number;
491
+ cities: City[];
676
492
  }
677
493
  /**
678
494
  * Input for listing quarters (neighborhoods) in a city
@@ -684,10 +500,10 @@ interface ListQuartersInput {
684
500
  */
685
501
  countryCode?: CountryCode;
686
502
  /**
687
- * Econt City ID to get quarters for
503
+ * ID of the city to get quarters for
688
504
  * Required parameter
689
505
  */
690
- econtCityId: string;
506
+ cityId: string;
691
507
  /**
692
508
  * Search query to filter quarters by name or nameEn
693
509
  */
@@ -697,7 +513,7 @@ interface ListQuartersInput {
697
513
  */
698
514
  fields?: string;
699
515
  /**
700
- * Maximum number of results (1-500, default: 15)
516
+ * Maximum number of results (1-100, default: 15)
701
517
  */
702
518
  limit?: number;
703
519
  /**
@@ -714,22 +530,10 @@ interface ListQuartersInput {
714
530
  */
715
531
  interface ListQuartersOutput {
716
532
  /**
717
- * Array of quarters with standard fields
718
- * Includes: id, econtId, name, nameEn, econtCityId
719
- */
720
- quarters: EcontQuarter[];
721
- /**
722
- * Total count of quarters matching the query
723
- */
724
- count: number;
725
- /**
726
- * Maximum number of results per page
727
- */
728
- limit: number;
729
- /**
730
- * Number of results skipped
533
+ * Array of quarters with details from Econt
534
+ * Includes: id, cityID, name, nameEn
731
535
  */
732
- offset: number;
536
+ quarters: Quarter[];
733
537
  }
734
538
  /**
735
539
  * Input for listing Econt offices with optional filtering
@@ -741,17 +545,24 @@ interface ListOfficesInput {
741
545
  */
742
546
  countryCode?: CountryCode;
743
547
  /**
744
- * 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
745
554
  */
746
- econtCityId?: string;
555
+ quarterId?: string;
747
556
  /**
748
- * Econt Quarter ID to filter offices by
557
+ * Quarter name to filter offices by
558
+ * Only works when cityId is also provided
749
559
  */
750
- econtQuarterId?: string;
560
+ quarter?: string;
751
561
  /**
752
- * Specific Econt office code to retrieve
562
+ * Specific office code to retrieve
563
+ * Can be used alone or with cityId for faster filtering
753
564
  */
754
- econtOfficeCode?: string;
565
+ officeCode?: string;
755
566
  /**
756
567
  * Search query to filter offices by name or nameEn
757
568
  */
@@ -761,7 +572,7 @@ interface ListOfficesInput {
761
572
  */
762
573
  fields?: string;
763
574
  /**
764
- * Maximum number of results (1-500, default: 15)
575
+ * Maximum number of results (1-100, default: 15)
765
576
  */
766
577
  limit?: number;
767
578
  /**
@@ -778,120 +589,10 @@ interface ListOfficesInput {
778
589
  */
779
590
  interface ListOfficesOutput {
780
591
  /**
781
- * Array of offices with standard fields
782
- * Includes: id, econtId, name, nameEn, econtCityId, econtQuarterId, postCode, fullAddress, etc.
783
- */
784
- offices: EcontOffice[];
785
- /**
786
- * Total count of offices matching the query
592
+ * Array of offices with full details from Econt
593
+ * Includes: code, name, address, phones, workingHours, etc.
787
594
  */
788
- count: number;
789
- /**
790
- * Maximum number of results per page
791
- */
792
- limit: number;
793
- /**
794
- * Number of results skipped
795
- */
796
- offset: number;
797
- }
798
- /**
799
- * Input for listing Econt streets with optional filtering
800
- */
801
- interface ListStreetsInput {
802
- /**
803
- * Econt City ID - Required to filter streets by city
804
- */
805
- econtCityId: string;
806
- /**
807
- * Search query to filter streets by name or nameEn
808
- */
809
- q?: string;
810
- /**
811
- * Comma-separated list of fields to include
812
- */
813
- fields?: string;
814
- /**
815
- * Maximum number of results (1-500, default: 50)
816
- */
817
- limit?: number;
818
- /**
819
- * Number of results to skip (default: 0)
820
- */
821
- offset?: number;
822
- /**
823
- * Sort order (e.g., "name", "-name" for descending)
824
- */
825
- order?: string;
826
- }
827
- /**
828
- * Response containing list of Econt streets
829
- */
830
- interface ListStreetsOutput {
831
- /**
832
- * Array of streets with standard fields
833
- * Includes: id, econtId, econtCityId, name, nameEn
834
- */
835
- streets: EcontStreet[];
836
- /**
837
- * Total count of streets matching the query
838
- */
839
- count: number;
840
- /**
841
- * Maximum number of results per page
842
- */
843
- limit: number;
844
- /**
845
- * Number of results skipped
846
- */
847
- offset: number;
848
- }
849
- /**
850
- * Input for listing Econt regions with optional filtering
851
- */
852
- interface ListRegionsInput {
853
- /**
854
- * Search query to filter regions by name or nameEn
855
- */
856
- q?: string;
857
- /**
858
- * Comma-separated list of fields to include
859
- */
860
- fields?: string;
861
- /**
862
- * Maximum number of results (1-500, default: 15)
863
- */
864
- limit?: number;
865
- /**
866
- * Number of results to skip (default: 0)
867
- */
868
- offset?: number;
869
- /**
870
- * Sort order (e.g., "name", "-name" for descending)
871
- */
872
- order?: string;
873
- }
874
- /**
875
- * Response containing list of Econt regions
876
- */
877
- interface ListRegionsOutput {
878
- /**
879
- * Array of regions with standard fields
880
- * Includes: id, name, nameEn
881
- */
882
- regions: EcontRegion[];
883
- /**
884
- * Total count of regions matching the query
885
- */
886
- count: number;
887
- /**
888
- * Maximum number of results per page
889
- */
890
- limit: number;
891
- /**
892
- * Number of results skipped
893
- */
894
- offset: number;
595
+ offices: Office[];
895
596
  }
896
597
  /**
897
598
  * Available Econt plugin endpoints
@@ -918,15 +619,6 @@ type EcontEndpoints = {
918
619
  * All data is served from hierarchical cache for instant responses
919
620
  */
920
621
  listOffices: (input: ListOfficesInput, headers?: ClientHeaders) => Promise<ListOfficesOutput>;
921
- /**
922
- * Lists Econt streets for a specific city with optional filtering and pagination
923
- * Requires econtCityId to filter streets by city
924
- */
925
- listStreets: (input: ListStreetsInput, headers?: ClientHeaders) => Promise<ListStreetsOutput>;
926
- /**
927
- * Lists Econt regions with optional filtering and pagination
928
- */
929
- listRegions: (input: ListRegionsInput, headers?: ClientHeaders) => Promise<ListRegionsOutput>;
930
622
  };
931
623
  /**
932
624
  * Econt fulfillment provider plugin
@@ -1001,4 +693,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
1001
693
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
1002
694
  }
1003
695
 
1004
- 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.14",
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
  }