@alphabite/medusa-sdk 0.7.8 → 0.7.10

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 } from '@medusajs/js-sdk';
1
+ import Medusa, { ClientHeaders, Client, Store, Auth } 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,11 +345,12 @@ interface EcontCity extends City {
345
345
  econtId?: number | string;
346
346
  regionName: string | null;
347
347
  }
348
- interface EcontOffice extends Office {
348
+ interface EcontOffice extends Omit<Office, 'isAPS'> {
349
349
  econtId?: number | string;
350
350
  fullAddress?: string;
351
351
  fullAddressEn?: string;
352
352
  postCode?: string;
353
+ isAPS?: boolean;
353
354
  regionName?: string;
354
355
  latitude?: number;
355
356
  longitude?: number;
@@ -493,6 +494,10 @@ interface ListCitiesInput {
493
494
  * - omitted or `false`: all cities (default)
494
495
  */
495
496
  onlyWithOffices?: boolean;
497
+ /**
498
+ * Filter to only return cities that have at least one econtomat (APS) office
499
+ */
500
+ hasEcontomat?: boolean;
496
501
  /**
497
502
  * Comma-separated list of fields to include
498
503
  */
@@ -637,6 +642,10 @@ interface ListOfficesInput {
637
642
  * Econt specific office code (numeric)
638
643
  */
639
644
  econtOfficeCode?: string | number;
645
+ /**
646
+ * Filter to only return econtomat (APS / self-service 24/7) offices
647
+ */
648
+ isEcontomat?: boolean;
640
649
  }
641
650
  /**
642
651
  * Response containing list of Econt offices
@@ -741,9 +750,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
741
750
  * Provides a modular way to add plugin-specific API methods while maintaining
742
751
  * full compatibility with the base Medusa SDK functionality
743
752
  *
744
- * @template TPlugins - Array of plugin definitions to integrate
745
- * @template TOptions - Client options configuration type
746
- *
747
753
  * @example
748
754
  * ```typescript
749
755
  * const sdk = new AlphabiteMedusaSdk(
@@ -751,10 +757,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
751
757
  * [wishlistPlugin, reviewsPlugin, paypalPlugin],
752
758
  * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
753
759
  * )
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'] })
758
760
  * ```
759
761
  */
760
762
  declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
@@ -764,13 +766,53 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
764
766
  protected options?: TOptions;
765
767
  /** Medusa configuration passed to the constructor */
766
768
  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
- */
773
769
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
774
770
  }
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
+ }
775
817
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
1
+ import Medusa, { ClientHeaders, Client, Store, Auth } 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,11 +345,12 @@ interface EcontCity extends City {
345
345
  econtId?: number | string;
346
346
  regionName: string | null;
347
347
  }
348
- interface EcontOffice extends Office {
348
+ interface EcontOffice extends Omit<Office, 'isAPS'> {
349
349
  econtId?: number | string;
350
350
  fullAddress?: string;
351
351
  fullAddressEn?: string;
352
352
  postCode?: string;
353
+ isAPS?: boolean;
353
354
  regionName?: string;
354
355
  latitude?: number;
355
356
  longitude?: number;
@@ -493,6 +494,10 @@ interface ListCitiesInput {
493
494
  * - omitted or `false`: all cities (default)
494
495
  */
495
496
  onlyWithOffices?: boolean;
497
+ /**
498
+ * Filter to only return cities that have at least one econtomat (APS) office
499
+ */
500
+ hasEcontomat?: boolean;
496
501
  /**
497
502
  * Comma-separated list of fields to include
498
503
  */
@@ -637,6 +642,10 @@ interface ListOfficesInput {
637
642
  * Econt specific office code (numeric)
638
643
  */
639
644
  econtOfficeCode?: string | number;
645
+ /**
646
+ * Filter to only return econtomat (APS / self-service 24/7) offices
647
+ */
648
+ isEcontomat?: boolean;
640
649
  }
641
650
  /**
642
651
  * Response containing list of Econt offices
@@ -741,9 +750,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
741
750
  * Provides a modular way to add plugin-specific API methods while maintaining
742
751
  * full compatibility with the base Medusa SDK functionality
743
752
  *
744
- * @template TPlugins - Array of plugin definitions to integrate
745
- * @template TOptions - Client options configuration type
746
- *
747
753
  * @example
748
754
  * ```typescript
749
755
  * const sdk = new AlphabiteMedusaSdk(
@@ -751,10 +757,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
751
757
  * [wishlistPlugin, reviewsPlugin, paypalPlugin],
752
758
  * { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
753
759
  * )
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'] })
758
760
  * ```
759
761
  */
760
762
  declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
@@ -764,13 +766,53 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
764
766
  protected options?: TOptions;
765
767
  /** Medusa configuration passed to the constructor */
766
768
  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
- */
773
769
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
774
770
  }
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
+ }
775
817
 
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 };
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 };
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 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;
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;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
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};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphabite/medusa-sdk",
3
- "version": "0.7.8",
3
+ "version": "0.7.10",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",