@alphabite/medusa-sdk 0.7.10 → 0.7.11

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,4 +1,4 @@
1
- import Medusa, { ClientHeaders, Client, Store, Auth } from '@medusajs/js-sdk';
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
4
  import { City, Office, Quarter, Street } from '@alphabite/econt-types';
@@ -345,12 +345,11 @@ interface EcontCity extends City {
345
345
  econtId?: number | string;
346
346
  regionName: string | null;
347
347
  }
348
- interface EcontOffice extends Omit<Office, 'isAPS'> {
348
+ interface EcontOffice extends Office {
349
349
  econtId?: number | string;
350
350
  fullAddress?: string;
351
351
  fullAddressEn?: string;
352
352
  postCode?: string;
353
- isAPS?: boolean;
354
353
  regionName?: string;
355
354
  latitude?: number;
356
355
  longitude?: number;
@@ -494,10 +493,6 @@ interface ListCitiesInput {
494
493
  * - omitted or `false`: all cities (default)
495
494
  */
496
495
  onlyWithOffices?: boolean;
497
- /**
498
- * Filter to only return cities that have at least one econtomat (APS) office
499
- */
500
- hasEcontomat?: boolean;
501
496
  /**
502
497
  * Comma-separated list of fields to include
503
498
  */
@@ -642,10 +637,6 @@ interface ListOfficesInput {
642
637
  * Econt specific office code (numeric)
643
638
  */
644
639
  econtOfficeCode?: string | number;
645
- /**
646
- * Filter to only return econtomat (APS / self-service 24/7) offices
647
- */
648
- isEcontomat?: boolean;
649
640
  }
650
641
  /**
651
642
  * Response containing list of Econt offices
@@ -750,6 +741,9 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
750
741
  * Provides a modular way to add plugin-specific API methods while maintaining
751
742
  * full compatibility with the base Medusa SDK functionality
752
743
  *
744
+ * @template TPlugins - Array of plugin definitions to integrate
745
+ * @template TOptions - Client options configuration type
746
+ *
753
747
  * @example
754
748
  * ```typescript
755
749
  * const sdk = new AlphabiteMedusaSdk(
@@ -757,6 +751,10 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
757
751
  * [wishlistPlugin, reviewsPlugin, paypalPlugin],
758
752
  * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
759
753
  * )
754
+ *
755
+ * // Access plugin endpoints
756
+ * const wishlist = await sdk.alphabite.wishlist.create({ sales_channel_id: 'sc_123' })
757
+ * const reviews = await sdk.alphabite.reviews.list({ product_ids: ['prod_123'] })
760
758
  * ```
761
759
  */
762
760
  declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
@@ -766,53 +764,13 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
766
764
  protected options?: TOptions;
767
765
  /** Medusa configuration passed to the constructor */
768
766
  medusaConfig: AlphabiteMedusaConfig;
767
+ /**
768
+ * Creates a new instance of the Alphabite Medusa SDK
769
+ * @param medusaOptions - Configuration for the base Medusa SDK
770
+ * @param plugins - Array of plugin definitions to integrate
771
+ * @param options - Optional client configuration (e.g., auth headers)
772
+ */
769
773
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
770
774
  }
771
- /**
772
- * Toggle map for which Medusa API modules to instantiate
773
- */
774
- type ApiSelection = {
775
- store?: boolean;
776
- auth?: boolean;
777
- };
778
- /**
779
- * Resolves an API property type — present when enabled, absent when not
780
- */
781
- type ResolveApi<TApis extends ApiSelection, K extends keyof ApiSelection, V> = K extends keyof TApis ? TApis[K] extends true ? V : undefined : undefined;
782
- /**
783
- * Lightweight Medusa SDK that only instantiates the API modules you enable.
784
- * Consumers toggle which APIs to include — disabled ones are never instantiated,
785
- * and bundlers can tree-shake the unused imports when the flags are statically known.
786
- *
787
- * @example
788
- * ```typescript
789
- * // Storefront: only Store + Auth (~70KB), Admin (~350KB) is excluded
790
- * const sdk = new AlphabiteMedusaSdkLight(
791
- * { baseUrl: 'https://api.example.com', publishableKey: 'pk_...' },
792
- * {
793
- * apis: { store: true, auth: true },
794
- * plugins: [wishlistPlugin, reviewsPlugin],
795
- * },
796
- * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
797
- * )
798
- *
799
- * sdk.store // ✓ typed, available
800
- * sdk.auth // ✓ typed, available
801
- * sdk.alphabite // ✓ plugin endpoints
802
- * // sdk.admin // TypeScript error — not enabled
803
- * ```
804
- */
805
- declare class AlphabiteMedusaSdkLight<TApis extends ApiSelection, TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> {
806
- client: Client;
807
- store: ResolveApi<TApis, 'store', Store>;
808
- auth: ResolveApi<TApis, 'auth', Auth>;
809
- alphabite: PluginsToAlphabite<TPlugins>;
810
- protected options?: TOptions;
811
- medusaConfig: AlphabiteMedusaConfig;
812
- constructor(medusaOptions: AlphabiteMedusaConfig, config: {
813
- apis: TApis;
814
- plugins: TPlugins;
815
- }, options?: TOptions);
816
- }
817
775
 
818
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, AlphabiteMedusaSdkLight, type ApiSelection, 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 };
776
+ 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
@@ -1,4 +1,4 @@
1
- import Medusa, { ClientHeaders, Client, Store, Auth } from '@medusajs/js-sdk';
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
4
  import { City, Office, Quarter, Street } from '@alphabite/econt-types';
@@ -345,12 +345,11 @@ interface EcontCity extends City {
345
345
  econtId?: number | string;
346
346
  regionName: string | null;
347
347
  }
348
- interface EcontOffice extends Omit<Office, 'isAPS'> {
348
+ interface EcontOffice extends Office {
349
349
  econtId?: number | string;
350
350
  fullAddress?: string;
351
351
  fullAddressEn?: string;
352
352
  postCode?: string;
353
- isAPS?: boolean;
354
353
  regionName?: string;
355
354
  latitude?: number;
356
355
  longitude?: number;
@@ -494,10 +493,6 @@ interface ListCitiesInput {
494
493
  * - omitted or `false`: all cities (default)
495
494
  */
496
495
  onlyWithOffices?: boolean;
497
- /**
498
- * Filter to only return cities that have at least one econtomat (APS) office
499
- */
500
- hasEcontomat?: boolean;
501
496
  /**
502
497
  * Comma-separated list of fields to include
503
498
  */
@@ -642,10 +637,6 @@ interface ListOfficesInput {
642
637
  * Econt specific office code (numeric)
643
638
  */
644
639
  econtOfficeCode?: string | number;
645
- /**
646
- * Filter to only return econtomat (APS / self-service 24/7) offices
647
- */
648
- isEcontomat?: boolean;
649
640
  }
650
641
  /**
651
642
  * Response containing list of Econt offices
@@ -750,6 +741,9 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
750
741
  * Provides a modular way to add plugin-specific API methods while maintaining
751
742
  * full compatibility with the base Medusa SDK functionality
752
743
  *
744
+ * @template TPlugins - Array of plugin definitions to integrate
745
+ * @template TOptions - Client options configuration type
746
+ *
753
747
  * @example
754
748
  * ```typescript
755
749
  * const sdk = new AlphabiteMedusaSdk(
@@ -757,6 +751,10 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
757
751
  * [wishlistPlugin, reviewsPlugin, paypalPlugin],
758
752
  * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
759
753
  * )
754
+ *
755
+ * // Access plugin endpoints
756
+ * const wishlist = await sdk.alphabite.wishlist.create({ sales_channel_id: 'sc_123' })
757
+ * const reviews = await sdk.alphabite.reviews.list({ product_ids: ['prod_123'] })
760
758
  * ```
761
759
  */
762
760
  declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
@@ -766,53 +764,13 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
766
764
  protected options?: TOptions;
767
765
  /** Medusa configuration passed to the constructor */
768
766
  medusaConfig: AlphabiteMedusaConfig;
767
+ /**
768
+ * Creates a new instance of the Alphabite Medusa SDK
769
+ * @param medusaOptions - Configuration for the base Medusa SDK
770
+ * @param plugins - Array of plugin definitions to integrate
771
+ * @param options - Optional client configuration (e.g., auth headers)
772
+ */
769
773
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
770
774
  }
771
- /**
772
- * Toggle map for which Medusa API modules to instantiate
773
- */
774
- type ApiSelection = {
775
- store?: boolean;
776
- auth?: boolean;
777
- };
778
- /**
779
- * Resolves an API property type — present when enabled, absent when not
780
- */
781
- type ResolveApi<TApis extends ApiSelection, K extends keyof ApiSelection, V> = K extends keyof TApis ? TApis[K] extends true ? V : undefined : undefined;
782
- /**
783
- * Lightweight Medusa SDK that only instantiates the API modules you enable.
784
- * Consumers toggle which APIs to include — disabled ones are never instantiated,
785
- * and bundlers can tree-shake the unused imports when the flags are statically known.
786
- *
787
- * @example
788
- * ```typescript
789
- * // Storefront: only Store + Auth (~70KB), Admin (~350KB) is excluded
790
- * const sdk = new AlphabiteMedusaSdkLight(
791
- * { baseUrl: 'https://api.example.com', publishableKey: 'pk_...' },
792
- * {
793
- * apis: { store: true, auth: true },
794
- * plugins: [wishlistPlugin, reviewsPlugin],
795
- * },
796
- * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
797
- * )
798
- *
799
- * sdk.store // ✓ typed, available
800
- * sdk.auth // ✓ typed, available
801
- * sdk.alphabite // ✓ plugin endpoints
802
- * // sdk.admin // TypeScript error — not enabled
803
- * ```
804
- */
805
- declare class AlphabiteMedusaSdkLight<TApis extends ApiSelection, TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> {
806
- client: Client;
807
- store: ResolveApi<TApis, 'store', Store>;
808
- auth: ResolveApi<TApis, 'auth', Auth>;
809
- alphabite: PluginsToAlphabite<TPlugins>;
810
- protected options?: TOptions;
811
- medusaConfig: AlphabiteMedusaConfig;
812
- constructor(medusaOptions: AlphabiteMedusaConfig, config: {
813
- apis: TApis;
814
- plugins: TPlugins;
815
- }, options?: TOptions);
816
- }
817
775
 
818
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, AlphabiteMedusaSdkLight, type ApiSelection, 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 };
776
+ 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 h={name:"wishlist",endpoints:(s,i)=>({create:async({...e},t)=>s.client.fetch("/store/wishlists",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({limit:e=10,offset:t=0,...r},n)=>s.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{limit:e,offset:t,...r}}),retrieve:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:t}),update:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...r}}),delete:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>s.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}}),transfer:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),share:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}/share`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),import:async(e,t)=>s.client.fetch("/store/wishlists/import",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),addItem:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}/add-item`,{method:"POST",body:t,headers:{...await i?.getAuthHeader?.(),...r}}),listItems:async({id:e,limit:t=10,offset:r=0,...n},u)=>s.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...u},query:{limit:t,offset:r,...n}}),removeItem:async({wishlist_item_id:e,id:t},r)=>s.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...r}})})};var m={name:"paypal",endpoints:(s,i)=>({createClientToken:async e=>s.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var C={name:"reviews",endpoints:(s,i)=>({create:async(e,t)=>s.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>s.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},r)=>s.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...r}}),aggregateCounts:async({product_id:e,...t},r)=>s.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...r}}),delete:async({id:e},t)=>s.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),uploadImageFiles:async(e,t)=>s.client.fetch("/store/reviews/files/images/upload",{method:"POST",body:e.formData,headers:{...await i?.getAuthHeader?.(),...t,"content-type":null}})})};var x={name:"econt",endpoints:(s,i)=>({validateAddress:async(e,t)=>s.client.fetch("/store/econt/validate-address",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),listCities:async({countryCode:e="BGR",...t},r)=>s.client.fetch("/store/econt/cities",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{countryCode:e,...t}}),listQuarters:async({cityId:e,countryCode:t="BGR",...r},n)=>s.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...r}}),listOffices:async({countryCode:e="BGR",...t},r)=>s.client.fetch("/store/econt/offices",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{countryCode:e,...t}}),listStreets:async({cityId:e,...t},r)=>s.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{cityId:e,...t}}),listRegions:async({...e},t)=>s.client.fetch("/store/econt/regions",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{...e}})})};var a=class extends d__default.default{constructor(i,e,t){super(i),this.options=t,this.medusaConfig=i;let r={};e.forEach(n=>{r[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=r;}},o=class{constructor(i,e,t){this.options=t,this.medusaConfig=i,this.client=new d.Client(i),e.apis.store&&(this.store=new d.Store(this.client)),e.apis.auth&&(this.auth=new d.Auth(this.client,i));let r={};e.plugins.forEach(n=>{r[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=r;}};exports.AlphabiteMedusaSdk=a;exports.AlphabiteMedusaSdkLight=o;exports.econtPlugin=x;exports.paypalPlugin=m;exports.reviewsPlugin=C;exports.wishlistPlugin=h;
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,...t},s)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{cityId:e,...t}}),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,{Client,Store,Auth}from'@medusajs/js-sdk';var h={name:"wishlist",endpoints:(s,i)=>({create:async({...e},t)=>s.client.fetch("/store/wishlists",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({limit:e=10,offset:t=0,...r},n)=>s.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{limit:e,offset:t,...r}}),retrieve:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:t}),update:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...r}}),delete:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>s.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}}),transfer:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),share:async({id:e},t)=>s.client.fetch(`/store/wishlists/${e}/share`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),import:async(e,t)=>s.client.fetch("/store/wishlists/import",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),addItem:async({id:e,...t},r)=>s.client.fetch(`/store/wishlists/${e}/add-item`,{method:"POST",body:t,headers:{...await i?.getAuthHeader?.(),...r}}),listItems:async({id:e,limit:t=10,offset:r=0,...n},u)=>s.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...u},query:{limit:t,offset:r,...n}}),removeItem:async({wishlist_item_id:e,id:t},r)=>s.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...r}})})};var m={name:"paypal",endpoints:(s,i)=>({createClientToken:async e=>s.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var C={name:"reviews",endpoints:(s,i)=>({create:async(e,t)=>s.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>s.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},r)=>s.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...r}}),aggregateCounts:async({product_id:e,...t},r)=>s.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...r}}),delete:async({id:e},t)=>s.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),uploadImageFiles:async(e,t)=>s.client.fetch("/store/reviews/files/images/upload",{method:"POST",body:e.formData,headers:{...await i?.getAuthHeader?.(),...t,"content-type":null}})})};var x={name:"econt",endpoints:(s,i)=>({validateAddress:async(e,t)=>s.client.fetch("/store/econt/validate-address",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),listCities:async({countryCode:e="BGR",...t},r)=>s.client.fetch("/store/econt/cities",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{countryCode:e,...t}}),listQuarters:async({cityId:e,countryCode:t="BGR",...r},n)=>s.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await i?.getAuthHeader?.(),...n},query:{cityId:e,countryCode:t,...r}}),listOffices:async({countryCode:e="BGR",...t},r)=>s.client.fetch("/store/econt/offices",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{countryCode:e,...t}}),listStreets:async({cityId:e,...t},r)=>s.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...r},query:{cityId:e,...t}}),listRegions:async({...e},t)=>s.client.fetch("/store/econt/regions",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{...e}})})};var a=class extends d{constructor(i,e,t){super(i),this.options=t,this.medusaConfig=i;let r={};e.forEach(n=>{r[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=r;}},o=class{constructor(i,e,t){this.options=t,this.medusaConfig=i,this.client=new Client(i),e.apis.store&&(this.store=new Store(this.client)),e.apis.auth&&(this.auth=new Auth(this.client,i));let r={};e.plugins.forEach(n=>{r[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=r;}};export{a as AlphabiteMedusaSdk,o as AlphabiteMedusaSdkLight,x as econtPlugin,m as paypalPlugin,C as reviewsPlugin,h 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,...t},s)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{cityId:e,...t}}),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.10",
3
+ "version": "0.7.11",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",
@@ -28,8 +28,8 @@
28
28
  "medusa other"
29
29
  ],
30
30
  "devDependencies": {
31
- "@medusajs/js-sdk": "^2.8.3",
32
- "@medusajs/types": "^2.8.3",
31
+ "@medusajs/js-sdk": "^2.15.0",
32
+ "@medusajs/types": "^2.15.0",
33
33
  "@typescript-eslint/eslint-plugin": "^5.62.0",
34
34
  "@typescript-eslint/parser": "^5.62.0",
35
35
  "eslint": "^8.57.0",