@alphabite/medusa-sdk 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -341,8 +341,25 @@ type ReviewsEndpoints = {
341
341
  };
342
342
  declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
343
343
 
344
- type EcontCity = City;
345
- type EcontOffice = Office;
344
+ interface EcontCity extends City {
345
+ econtId?: number | string;
346
+ regionName: string | null;
347
+ }
348
+ interface EcontOffice extends Office {
349
+ econtId?: number | string;
350
+ fullAddress?: string;
351
+ fullAddressEn?: string;
352
+ postCode?: string;
353
+ regionName?: string;
354
+ latitude?: number;
355
+ longitude?: number;
356
+ }
357
+ interface EcontQuarter extends Quarter {
358
+ econtId?: number | string;
359
+ }
360
+ interface EcontStreet extends Street {
361
+ econtId?: number | string;
362
+ }
346
363
  interface Region {
347
364
  id?: number | string;
348
365
  name?: string;
@@ -426,7 +443,7 @@ interface ValidatedAddress {
426
443
  /**
427
444
  * Validated city with full details (includes id, name, etc.)
428
445
  */
429
- city: City;
446
+ city: EcontCity;
430
447
  /**
431
448
  * Full formatted address string
432
449
  */
@@ -486,6 +503,14 @@ interface ListCitiesInput {
486
503
  * Sort order (e.g., "name", "-name" for descending)
487
504
  */
488
505
  order?: string;
506
+ /**
507
+ * Econt specific city ID (numeric)
508
+ */
509
+ econtCityId?: string | number;
510
+ /**
511
+ * Region name to filter cities by
512
+ */
513
+ region?: string;
489
514
  }
490
515
  /**
491
516
  * Response containing list of cities
@@ -495,7 +520,7 @@ interface ListCitiesOutput {
495
520
  * Array of cities with full details from Econt
496
521
  * Includes: id, name, nameEn, postCode, region, etc.
497
522
  */
498
- cities: City[];
523
+ cities: EcontCity[];
499
524
  }
500
525
  /**
501
526
  * Input for listing quarters (neighborhoods) in a city
@@ -531,6 +556,10 @@ interface ListQuartersInput {
531
556
  * Sort order (e.g., "name", "-name" for descending)
532
557
  */
533
558
  order?: string;
559
+ /**
560
+ * Econt specific city ID (numeric)
561
+ */
562
+ econtCityId?: string | number;
534
563
  }
535
564
  /**
536
565
  * Response containing list of quarters
@@ -540,7 +569,7 @@ interface ListQuartersOutput {
540
569
  * Array of quarters with details from Econt
541
570
  * Includes: id, cityID, name, nameEn
542
571
  */
543
- quarters: Quarter[];
572
+ quarters: EcontQuarter[];
544
573
  }
545
574
  /**
546
575
  * Input for listing Econt offices with optional filtering
@@ -590,6 +619,18 @@ interface ListOfficesInput {
590
619
  * Sort order (e.g., "name", "-name" for descending)
591
620
  */
592
621
  order?: string;
622
+ /**
623
+ * Econt specific city ID (numeric)
624
+ */
625
+ econtCityId?: string | number;
626
+ /**
627
+ * Econt specific quarter ID (numeric)
628
+ */
629
+ econtQuarterId?: string | number;
630
+ /**
631
+ * Econt specific office code (numeric)
632
+ */
633
+ econtOfficeCode?: string | number;
593
634
  }
594
635
  /**
595
636
  * Response containing list of Econt offices
@@ -599,7 +640,7 @@ interface ListOfficesOutput {
599
640
  * Array of offices with full details from Econt
600
641
  * Includes: code, name, address, phones, workingHours, etc.
601
642
  */
602
- offices: Office[];
643
+ offices: EcontOffice[];
603
644
  }
604
645
  interface ListStreetsInput {
605
646
  countryCode?: CountryCode;
@@ -609,9 +650,10 @@ interface ListStreetsInput {
609
650
  limit?: number;
610
651
  offset?: number;
611
652
  order?: string;
653
+ econtCityId?: string | number;
612
654
  }
613
655
  interface ListStreetsOutput {
614
- streets: Street[];
656
+ streets: EcontStreet[];
615
657
  }
616
658
  interface ListRegionsInput {
617
659
  countryCode?: CountryCode;
@@ -725,4 +767,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
725
767
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
726
768
  }
727
769
 
728
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type Region, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
770
+ export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type EcontQuarter, type EcontStreet, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type Region, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
package/dist/index.d.ts CHANGED
@@ -341,8 +341,25 @@ type ReviewsEndpoints = {
341
341
  };
342
342
  declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
343
343
 
344
- type EcontCity = City;
345
- type EcontOffice = Office;
344
+ interface EcontCity extends City {
345
+ econtId?: number | string;
346
+ regionName: string | null;
347
+ }
348
+ interface EcontOffice extends Office {
349
+ econtId?: number | string;
350
+ fullAddress?: string;
351
+ fullAddressEn?: string;
352
+ postCode?: string;
353
+ regionName?: string;
354
+ latitude?: number;
355
+ longitude?: number;
356
+ }
357
+ interface EcontQuarter extends Quarter {
358
+ econtId?: number | string;
359
+ }
360
+ interface EcontStreet extends Street {
361
+ econtId?: number | string;
362
+ }
346
363
  interface Region {
347
364
  id?: number | string;
348
365
  name?: string;
@@ -426,7 +443,7 @@ interface ValidatedAddress {
426
443
  /**
427
444
  * Validated city with full details (includes id, name, etc.)
428
445
  */
429
- city: City;
446
+ city: EcontCity;
430
447
  /**
431
448
  * Full formatted address string
432
449
  */
@@ -486,6 +503,14 @@ interface ListCitiesInput {
486
503
  * Sort order (e.g., "name", "-name" for descending)
487
504
  */
488
505
  order?: string;
506
+ /**
507
+ * Econt specific city ID (numeric)
508
+ */
509
+ econtCityId?: string | number;
510
+ /**
511
+ * Region name to filter cities by
512
+ */
513
+ region?: string;
489
514
  }
490
515
  /**
491
516
  * Response containing list of cities
@@ -495,7 +520,7 @@ interface ListCitiesOutput {
495
520
  * Array of cities with full details from Econt
496
521
  * Includes: id, name, nameEn, postCode, region, etc.
497
522
  */
498
- cities: City[];
523
+ cities: EcontCity[];
499
524
  }
500
525
  /**
501
526
  * Input for listing quarters (neighborhoods) in a city
@@ -531,6 +556,10 @@ interface ListQuartersInput {
531
556
  * Sort order (e.g., "name", "-name" for descending)
532
557
  */
533
558
  order?: string;
559
+ /**
560
+ * Econt specific city ID (numeric)
561
+ */
562
+ econtCityId?: string | number;
534
563
  }
535
564
  /**
536
565
  * Response containing list of quarters
@@ -540,7 +569,7 @@ interface ListQuartersOutput {
540
569
  * Array of quarters with details from Econt
541
570
  * Includes: id, cityID, name, nameEn
542
571
  */
543
- quarters: Quarter[];
572
+ quarters: EcontQuarter[];
544
573
  }
545
574
  /**
546
575
  * Input for listing Econt offices with optional filtering
@@ -590,6 +619,18 @@ interface ListOfficesInput {
590
619
  * Sort order (e.g., "name", "-name" for descending)
591
620
  */
592
621
  order?: string;
622
+ /**
623
+ * Econt specific city ID (numeric)
624
+ */
625
+ econtCityId?: string | number;
626
+ /**
627
+ * Econt specific quarter ID (numeric)
628
+ */
629
+ econtQuarterId?: string | number;
630
+ /**
631
+ * Econt specific office code (numeric)
632
+ */
633
+ econtOfficeCode?: string | number;
593
634
  }
594
635
  /**
595
636
  * Response containing list of Econt offices
@@ -599,7 +640,7 @@ interface ListOfficesOutput {
599
640
  * Array of offices with full details from Econt
600
641
  * Includes: code, name, address, phones, workingHours, etc.
601
642
  */
602
- offices: Office[];
643
+ offices: EcontOffice[];
603
644
  }
604
645
  interface ListStreetsInput {
605
646
  countryCode?: CountryCode;
@@ -609,9 +650,10 @@ interface ListStreetsInput {
609
650
  limit?: number;
610
651
  offset?: number;
611
652
  order?: string;
653
+ econtCityId?: string | number;
612
654
  }
613
655
  interface ListStreetsOutput {
614
- streets: Street[];
656
+ streets: EcontStreet[];
615
657
  }
616
658
  interface ListRegionsInput {
617
659
  countryCode?: CountryCode;
@@ -725,4 +767,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
725
767
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
726
768
  }
727
769
 
728
- export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type Region, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
770
+ export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CountryCode, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type EcontCity, type EcontOffice, type EcontQuarter, type EcontStreet, type ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListRegionsInput, type ListRegionsOutput, type ListReviewsInput, type ListReviewsOutput, type ListStreetsInput, type ListStreetsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type Region, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type ValidateAddressCity, type ValidateAddressInput, type ValidateAddressInputAddress, type ValidateAddressLocation, type ValidateAddressOutput, type ValidatedAddress, type Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var d=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=/*#__PURE__*/_interopDefault(d);var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await s?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d__default.default{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};exports.AlphabiteMedusaSdk=o;exports.econtPlugin=C;exports.paypalPlugin=h;exports.reviewsPlugin=g;exports.wishlistPlugin=p;
1
+ 'use strict';var d=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=/*#__PURE__*/_interopDefault(d);var p={name:"wishlist",endpoints:(s,r)=>({create:async({...t},e)=>s.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>s.client.fetch("/store/wishlists",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>s.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await r?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await r?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await r?.getAuthHeader?.(),...e}}),import:async(t,e)=>s.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>s.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await r?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>s.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(s,r)=>({createClientToken:async t=>s.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await r?.getAuthHeader?.(),...t}})})};var m={name:"reviews",endpoints:(s,r,t)=>({create:async(e,i)=>s.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),list:async({...e},i)=>s.client.fetch("/store/products/reviews",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>s.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await r?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>s.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await r?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>s.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await r?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(s,r)=>({validateAddress:async(t,e)=>s.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/cities",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>s.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/offices",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>s.client.fetch("/store/econt/streets",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/regions",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d__default.default{constructor(r,t,e){super(r),this.options=e,this.medusaConfig=r;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};exports.AlphabiteMedusaSdk=o;exports.econtPlugin=C;exports.paypalPlugin=h;exports.reviewsPlugin=m;exports.wishlistPlugin=p;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import d from'@medusajs/js-sdk';var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var g={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await s?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(r,s)=>({validateAddress:async(t,e)=>r.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>r.client.fetch("/store/econt/streets",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/regions",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};export{o as AlphabiteMedusaSdk,C as econtPlugin,h as paypalPlugin,g as reviewsPlugin,p as wishlistPlugin};
1
+ import d from'@medusajs/js-sdk';var p={name:"wishlist",endpoints:(s,r)=>({create:async({...t},e)=>s.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>s.client.fetch("/store/wishlists",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>s.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await r?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await r?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>s.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await r?.getAuthHeader?.(),...e}}),import:async(t,e)=>s.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>s.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>s.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await r?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>s.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(s,r)=>({createClientToken:async t=>s.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await r?.getAuthHeader?.(),...t}})})};var m={name:"reviews",endpoints:(s,r,t)=>({create:async(e,i)=>s.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await r?.getAuthHeader?.(),...i}}),list:async({...e},i)=>s.client.fetch("/store/products/reviews",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>s.client.fetch(`/store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await r?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>s.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await r?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>s.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await r?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(!n||!a)throw new Error("Missing baseUrl or publishableKey");let u=await r?.getAuthHeader?.();return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...u,...i,"x-publishable-api-key":a}})).json()}})};var C={name:"econt",endpoints:(s,r)=>({validateAddress:async(t,e)=>s.client.fetch("/store/econt/validate-address",{method:"POST",body:t,headers:{...await r?.getAuthHeader?.(),...e}}),listCities:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/cities",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listQuarters:async({cityId:t,countryCode:e="BGR",...i},n)=>s.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listOffices:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/offices",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}}),listStreets:async({cityId:t,countryCode:e="BGR",...i},n)=>s.client.fetch("/store/econt/streets",{method:"GET",headers:{...await r?.getAuthHeader?.(),...n},query:{cityId:t,countryCode:e,...i}}),listRegions:async({countryCode:t="BGR",...e},i)=>s.client.fetch("/store/econt/regions",{method:"GET",headers:{...await r?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends d{constructor(r,t,e){super(r),this.options=e,this.medusaConfig=r;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};export{o as AlphabiteMedusaSdk,C as econtPlugin,h as paypalPlugin,m as reviewsPlugin,p as wishlistPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphabite/medusa-sdk",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",