@alphabite/medusa-sdk 0.7.4 → 0.7.6

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
@@ -341,8 +341,25 @@ type ReviewsEndpoints = {
341
341
  };
342
342
  declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
343
343
 
344
- type EcontCity = City;
345
- type EcontOffice = Office;
344
+ interface EcontCity extends City {
345
+ econtId?: number | string;
346
+ regionName: string | null;
347
+ }
348
+ interface EcontOffice extends Office {
349
+ econtId?: number | string;
350
+ fullAddress?: string;
351
+ fullAddressEn?: string;
352
+ postCode?: string;
353
+ regionName?: string;
354
+ latitude?: number;
355
+ longitude?: number;
356
+ }
357
+ interface EcontQuarter extends Quarter {
358
+ econtId?: number | string;
359
+ }
360
+ interface EcontStreet extends Street {
361
+ econtId?: number | string;
362
+ }
346
363
  interface Region {
347
364
  id?: number | string;
348
365
  name?: string;
@@ -426,7 +443,7 @@ interface ValidatedAddress {
426
443
  /**
427
444
  * Validated city with full details (includes id, name, etc.)
428
445
  */
429
- city: City;
446
+ city: EcontCity;
430
447
  /**
431
448
  * Full formatted address string
432
449
  */
@@ -470,6 +487,13 @@ interface ListCitiesInput {
470
487
  * Search query to filter cities by name or nameEn
471
488
  */
472
489
  q?: string;
490
+ /**
491
+ * Filter by whether the city has at least one Econt office
492
+ * - `true`: only cities with offices (old default behavior)
493
+ * - `false`: only cities/villages without offices
494
+ * - omitted: all cities
495
+ */
496
+ hasOffice?: boolean;
473
497
  /**
474
498
  * Comma-separated list of fields to include
475
499
  */
@@ -486,6 +510,14 @@ interface ListCitiesInput {
486
510
  * Sort order (e.g., "name", "-name" for descending)
487
511
  */
488
512
  order?: string;
513
+ /**
514
+ * Econt specific city ID (numeric)
515
+ */
516
+ econtCityId?: string | number;
517
+ /**
518
+ * Region name to filter cities by
519
+ */
520
+ region?: string;
489
521
  }
490
522
  /**
491
523
  * Response containing list of cities
@@ -495,7 +527,7 @@ interface ListCitiesOutput {
495
527
  * Array of cities with full details from Econt
496
528
  * Includes: id, name, nameEn, postCode, region, etc.
497
529
  */
498
- cities: City[];
530
+ cities: EcontCity[];
499
531
  }
500
532
  /**
501
533
  * Input for listing quarters (neighborhoods) in a city
@@ -531,6 +563,10 @@ interface ListQuartersInput {
531
563
  * Sort order (e.g., "name", "-name" for descending)
532
564
  */
533
565
  order?: string;
566
+ /**
567
+ * Econt specific city ID (numeric)
568
+ */
569
+ econtCityId?: string | number;
534
570
  }
535
571
  /**
536
572
  * Response containing list of quarters
@@ -540,7 +576,7 @@ interface ListQuartersOutput {
540
576
  * Array of quarters with details from Econt
541
577
  * Includes: id, cityID, name, nameEn
542
578
  */
543
- quarters: Quarter[];
579
+ quarters: EcontQuarter[];
544
580
  }
545
581
  /**
546
582
  * Input for listing Econt offices with optional filtering
@@ -590,6 +626,18 @@ interface ListOfficesInput {
590
626
  * Sort order (e.g., "name", "-name" for descending)
591
627
  */
592
628
  order?: string;
629
+ /**
630
+ * Econt specific city ID (numeric)
631
+ */
632
+ econtCityId?: string | number;
633
+ /**
634
+ * Econt specific quarter ID (numeric)
635
+ */
636
+ econtQuarterId?: string | number;
637
+ /**
638
+ * Econt specific office code (numeric)
639
+ */
640
+ econtOfficeCode?: string | number;
593
641
  }
594
642
  /**
595
643
  * Response containing list of Econt offices
@@ -599,7 +647,7 @@ interface ListOfficesOutput {
599
647
  * Array of offices with full details from Econt
600
648
  * Includes: code, name, address, phones, workingHours, etc.
601
649
  */
602
- offices: Office[];
650
+ offices: EcontOffice[];
603
651
  }
604
652
  interface ListStreetsInput {
605
653
  countryCode?: CountryCode;
@@ -609,9 +657,10 @@ interface ListStreetsInput {
609
657
  limit?: number;
610
658
  offset?: number;
611
659
  order?: string;
660
+ econtCityId?: string | number;
612
661
  }
613
662
  interface ListStreetsOutput {
614
- streets: Street[];
663
+ streets: EcontStreet[];
615
664
  }
616
665
  interface ListRegionsInput {
617
666
  countryCode?: CountryCode;
@@ -725,4 +774,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
725
774
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
726
775
  }
727
776
 
728
- 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 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 Region, 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 };
777
+ 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 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 Region, 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
@@ -341,8 +341,25 @@ type ReviewsEndpoints = {
341
341
  };
342
342
  declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
343
343
 
344
- type EcontCity = City;
345
- type EcontOffice = Office;
344
+ interface EcontCity extends City {
345
+ econtId?: number | string;
346
+ regionName: string | null;
347
+ }
348
+ interface EcontOffice extends Office {
349
+ econtId?: number | string;
350
+ fullAddress?: string;
351
+ fullAddressEn?: string;
352
+ postCode?: string;
353
+ regionName?: string;
354
+ latitude?: number;
355
+ longitude?: number;
356
+ }
357
+ interface EcontQuarter extends Quarter {
358
+ econtId?: number | string;
359
+ }
360
+ interface EcontStreet extends Street {
361
+ econtId?: number | string;
362
+ }
346
363
  interface Region {
347
364
  id?: number | string;
348
365
  name?: string;
@@ -426,7 +443,7 @@ interface ValidatedAddress {
426
443
  /**
427
444
  * Validated city with full details (includes id, name, etc.)
428
445
  */
429
- city: City;
446
+ city: EcontCity;
430
447
  /**
431
448
  * Full formatted address string
432
449
  */
@@ -470,6 +487,13 @@ interface ListCitiesInput {
470
487
  * Search query to filter cities by name or nameEn
471
488
  */
472
489
  q?: string;
490
+ /**
491
+ * Filter by whether the city has at least one Econt office
492
+ * - `true`: only cities with offices (old default behavior)
493
+ * - `false`: only cities/villages without offices
494
+ * - omitted: all cities
495
+ */
496
+ hasOffice?: boolean;
473
497
  /**
474
498
  * Comma-separated list of fields to include
475
499
  */
@@ -486,6 +510,14 @@ interface ListCitiesInput {
486
510
  * Sort order (e.g., "name", "-name" for descending)
487
511
  */
488
512
  order?: string;
513
+ /**
514
+ * Econt specific city ID (numeric)
515
+ */
516
+ econtCityId?: string | number;
517
+ /**
518
+ * Region name to filter cities by
519
+ */
520
+ region?: string;
489
521
  }
490
522
  /**
491
523
  * Response containing list of cities
@@ -495,7 +527,7 @@ interface ListCitiesOutput {
495
527
  * Array of cities with full details from Econt
496
528
  * Includes: id, name, nameEn, postCode, region, etc.
497
529
  */
498
- cities: City[];
530
+ cities: EcontCity[];
499
531
  }
500
532
  /**
501
533
  * Input for listing quarters (neighborhoods) in a city
@@ -531,6 +563,10 @@ interface ListQuartersInput {
531
563
  * Sort order (e.g., "name", "-name" for descending)
532
564
  */
533
565
  order?: string;
566
+ /**
567
+ * Econt specific city ID (numeric)
568
+ */
569
+ econtCityId?: string | number;
534
570
  }
535
571
  /**
536
572
  * Response containing list of quarters
@@ -540,7 +576,7 @@ interface ListQuartersOutput {
540
576
  * Array of quarters with details from Econt
541
577
  * Includes: id, cityID, name, nameEn
542
578
  */
543
- quarters: Quarter[];
579
+ quarters: EcontQuarter[];
544
580
  }
545
581
  /**
546
582
  * Input for listing Econt offices with optional filtering
@@ -590,6 +626,18 @@ interface ListOfficesInput {
590
626
  * Sort order (e.g., "name", "-name" for descending)
591
627
  */
592
628
  order?: string;
629
+ /**
630
+ * Econt specific city ID (numeric)
631
+ */
632
+ econtCityId?: string | number;
633
+ /**
634
+ * Econt specific quarter ID (numeric)
635
+ */
636
+ econtQuarterId?: string | number;
637
+ /**
638
+ * Econt specific office code (numeric)
639
+ */
640
+ econtOfficeCode?: string | number;
593
641
  }
594
642
  /**
595
643
  * Response containing list of Econt offices
@@ -599,7 +647,7 @@ interface ListOfficesOutput {
599
647
  * Array of offices with full details from Econt
600
648
  * Includes: code, name, address, phones, workingHours, etc.
601
649
  */
602
- offices: Office[];
650
+ offices: EcontOffice[];
603
651
  }
604
652
  interface ListStreetsInput {
605
653
  countryCode?: CountryCode;
@@ -609,9 +657,10 @@ interface ListStreetsInput {
609
657
  limit?: number;
610
658
  offset?: number;
611
659
  order?: string;
660
+ econtCityId?: string | number;
612
661
  }
613
662
  interface ListStreetsOutput {
614
- streets: Street[];
663
+ streets: EcontStreet[];
615
664
  }
616
665
  interface ListRegionsInput {
617
666
  countryCode?: CountryCode;
@@ -725,4 +774,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
725
774
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
726
775
  }
727
776
 
728
- 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 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 Region, 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 };
777
+ 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 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 Region, 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 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}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/regions",{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;
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 d={name:"wishlist",endpoints:(r,i)=>({create:async({...e},t)=>r.client.fetch("/store/wishlists",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({limit:e=10,offset:t=0,...s},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{limit:e,offset:t,...s}}),retrieve:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:t}),update:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}}),transfer:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),share:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/share`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),import:async(e,t)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),addItem:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}/add-item`,{method:"POST",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),listItems:async({id:e,limit:t=10,offset:s=0,...n},o)=>r.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:t,offset:s,...n}}),removeItem:async({wishlist_item_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...s}})})};var p={name:"paypal",endpoints:(r,i)=>({createClientToken:async e=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var h={name:"reviews",endpoints:(r,i)=>({create:async(e,t)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),aggregateCounts:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),uploadImageFiles:async(e,t)=>r.client.fetch("/store/reviews/files/images/upload",{method:"POST",body:e.formData,headers:{...await i?.getAuthHeader?.(),...t,"content-type":null}})})};var g={name:"econt",endpoints:(r,i)=>({validateAddress:async(e,t)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),listCities:async({countryCode:e="BGR",...t},s)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{countryCode:e,...t}}),listQuarters:async({cityId:e,countryCode:t="BGR",...s},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...s}}),listOffices:async({countryCode:e="BGR",...t},s)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{countryCode:e,...t}}),listStreets:async({cityId:e,countryCode:t="BGR",...s},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...s}}),listRegions:async({...e},t)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{...e}})})};var a=class extends u__default.default{constructor(i,e,t){super(i),this.options=t,this.medusaConfig=i;let s={};e.forEach(n=>{s[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=s;}};exports.AlphabiteMedusaSdk=a;exports.econtPlugin=g;exports.paypalPlugin=p;exports.reviewsPlugin=h;exports.wishlistPlugin=d;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
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}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/regions",{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};
1
+ import u from'@medusajs/js-sdk';var d={name:"wishlist",endpoints:(r,i)=>({create:async({...e},t)=>r.client.fetch("/store/wishlists",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({limit:e=10,offset:t=0,...s},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{limit:e,offset:t,...s}}),retrieve:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:t}),update:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}}),transfer:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),share:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/share`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),import:async(e,t)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),addItem:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}/add-item`,{method:"POST",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),listItems:async({id:e,limit:t=10,offset:s=0,...n},o)=>r.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:t,offset:s,...n}}),removeItem:async({wishlist_item_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...s}})})};var p={name:"paypal",endpoints:(r,i)=>({createClientToken:async e=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var h={name:"reviews",endpoints:(r,i)=>({create:async(e,t)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),aggregateCounts:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),uploadImageFiles:async(e,t)=>r.client.fetch("/store/reviews/files/images/upload",{method:"POST",body:e.formData,headers:{...await i?.getAuthHeader?.(),...t,"content-type":null}})})};var g={name:"econt",endpoints:(r,i)=>({validateAddress:async(e,t)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),listCities:async({countryCode:e="BGR",...t},s)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{countryCode:e,...t}}),listQuarters:async({cityId:e,countryCode:t="BGR",...s},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...s}}),listOffices:async({countryCode:e="BGR",...t},s)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{countryCode:e,...t}}),listStreets:async({cityId:e,countryCode:t="BGR",...s},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...s}}),listRegions:async({...e},t)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{...e}})})};var a=class extends u{constructor(i,e,t){super(i),this.options=t,this.medusaConfig=i;let s={};e.forEach(n=>{s[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=s;}};export{a as AlphabiteMedusaSdk,g as econtPlugin,p as paypalPlugin,h as reviewsPlugin,d as wishlistPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphabite/medusa-sdk",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",