@alphabite/medusa-sdk 0.7.9 → 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 +48 -15
- package/dist/index.d.ts +48 -15
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
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';
|
|
@@ -750,9 +750,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
750
750
|
* Provides a modular way to add plugin-specific API methods while maintaining
|
|
751
751
|
* full compatibility with the base Medusa SDK functionality
|
|
752
752
|
*
|
|
753
|
-
* @template TPlugins - Array of plugin definitions to integrate
|
|
754
|
-
* @template TOptions - Client options configuration type
|
|
755
|
-
*
|
|
756
753
|
* @example
|
|
757
754
|
* ```typescript
|
|
758
755
|
* const sdk = new AlphabiteMedusaSdk(
|
|
@@ -760,10 +757,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
760
757
|
* [wishlistPlugin, reviewsPlugin, paypalPlugin],
|
|
761
758
|
* { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
|
|
762
759
|
* )
|
|
763
|
-
*
|
|
764
|
-
* // Access plugin endpoints
|
|
765
|
-
* const wishlist = await sdk.alphabite.wishlist.create({ sales_channel_id: 'sc_123' })
|
|
766
|
-
* const reviews = await sdk.alphabite.reviews.list({ product_ids: ['prod_123'] })
|
|
767
760
|
* ```
|
|
768
761
|
*/
|
|
769
762
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
@@ -773,13 +766,53 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
|
|
|
773
766
|
protected options?: TOptions;
|
|
774
767
|
/** Medusa configuration passed to the constructor */
|
|
775
768
|
medusaConfig: AlphabiteMedusaConfig;
|
|
776
|
-
/**
|
|
777
|
-
* Creates a new instance of the Alphabite Medusa SDK
|
|
778
|
-
* @param medusaOptions - Configuration for the base Medusa SDK
|
|
779
|
-
* @param plugins - Array of plugin definitions to integrate
|
|
780
|
-
* @param options - Optional client configuration (e.g., auth headers)
|
|
781
|
-
*/
|
|
782
769
|
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
783
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
|
+
}
|
|
784
817
|
|
|
785
|
-
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';
|
|
@@ -750,9 +750,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
750
750
|
* Provides a modular way to add plugin-specific API methods while maintaining
|
|
751
751
|
* full compatibility with the base Medusa SDK functionality
|
|
752
752
|
*
|
|
753
|
-
* @template TPlugins - Array of plugin definitions to integrate
|
|
754
|
-
* @template TOptions - Client options configuration type
|
|
755
|
-
*
|
|
756
753
|
* @example
|
|
757
754
|
* ```typescript
|
|
758
755
|
* const sdk = new AlphabiteMedusaSdk(
|
|
@@ -760,10 +757,6 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
760
757
|
* [wishlistPlugin, reviewsPlugin, paypalPlugin],
|
|
761
758
|
* { getAuthHeader: async () => ({ Authorization: 'Bearer token' }) }
|
|
762
759
|
* )
|
|
763
|
-
*
|
|
764
|
-
* // Access plugin endpoints
|
|
765
|
-
* const wishlist = await sdk.alphabite.wishlist.create({ sales_channel_id: 'sc_123' })
|
|
766
|
-
* const reviews = await sdk.alphabite.reviews.list({ product_ids: ['prod_123'] })
|
|
767
760
|
* ```
|
|
768
761
|
*/
|
|
769
762
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
@@ -773,13 +766,53 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
|
|
|
773
766
|
protected options?: TOptions;
|
|
774
767
|
/** Medusa configuration passed to the constructor */
|
|
775
768
|
medusaConfig: AlphabiteMedusaConfig;
|
|
776
|
-
/**
|
|
777
|
-
* Creates a new instance of the Alphabite Medusa SDK
|
|
778
|
-
* @param medusaOptions - Configuration for the base Medusa SDK
|
|
779
|
-
* @param plugins - Array of plugin definitions to integrate
|
|
780
|
-
* @param options - Optional client configuration (e.g., auth headers)
|
|
781
|
-
*/
|
|
782
769
|
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
783
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
|
+
}
|
|
784
817
|
|
|
785
|
-
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
|
|
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
|
|
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};
|