@alphabite/medusa-sdk 0.6.2 → 0.6.3

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
@@ -338,6 +338,110 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
338
338
  * Currently supports Bulgaria, can be extended with additional countries
339
339
  */
340
340
  type CountryCode = 'BGR';
341
+ /**
342
+ * Address city information for validation
343
+ */
344
+ interface ValidateAddressCity {
345
+ /**
346
+ * Country code object with ISO 3166-1 alpha-2 code
347
+ */
348
+ country: {
349
+ code2: string;
350
+ };
351
+ /**
352
+ * City name
353
+ */
354
+ name: string;
355
+ }
356
+ /**
357
+ * Input address for validation
358
+ */
359
+ interface ValidateAddressInputAddress {
360
+ /**
361
+ * City object with country code and name (required)
362
+ */
363
+ city: ValidateAddressCity;
364
+ /**
365
+ * Street name (optional)
366
+ */
367
+ street?: string;
368
+ /**
369
+ * Street number (optional)
370
+ */
371
+ num?: string;
372
+ /**
373
+ * Quarter/district name (optional)
374
+ */
375
+ quarter?: string;
376
+ /**
377
+ * Additional address details (optional)
378
+ */
379
+ other?: string;
380
+ }
381
+ /**
382
+ * Input for validating an address using Econt's address validation service
383
+ */
384
+ interface ValidateAddressInput {
385
+ /**
386
+ * Address to validate (city, street, num required)
387
+ */
388
+ address: ValidateAddressInputAddress;
389
+ }
390
+ /**
391
+ * Location coordinates from address validation
392
+ */
393
+ interface ValidateAddressLocation {
394
+ /**
395
+ * Latitude coordinate
396
+ */
397
+ latitude: number;
398
+ /**
399
+ * Longitude coordinate
400
+ */
401
+ longitude: number;
402
+ /**
403
+ * Confidence level (1-5)
404
+ */
405
+ confidence: number;
406
+ }
407
+ /**
408
+ * Validated address structure returned from validation
409
+ */
410
+ interface ValidatedAddress {
411
+ /**
412
+ * Validated city with full details (includes id, name, etc.)
413
+ */
414
+ city: City;
415
+ /**
416
+ * Full formatted address string
417
+ */
418
+ fullAddress: string;
419
+ /**
420
+ * Validated street name
421
+ */
422
+ street?: string;
423
+ /**
424
+ * Validated street number
425
+ */
426
+ num?: string;
427
+ /**
428
+ * Location coordinates if available
429
+ */
430
+ location?: ValidateAddressLocation;
431
+ }
432
+ /**
433
+ * Response containing validated address and validation status
434
+ */
435
+ interface ValidateAddressOutput {
436
+ /**
437
+ * Validated address with full details
438
+ */
439
+ address: ValidatedAddress;
440
+ /**
441
+ * Validation status: "normal" (valid and found), "processed" (modified for validation), "invalid" (could not be validated)
442
+ */
443
+ validationStatus: 'normal' | 'processed' | 'invalid';
444
+ }
341
445
  /**
342
446
  * Input for listing cities in a country
343
447
  */
@@ -347,6 +451,26 @@ interface ListCitiesInput {
347
451
  * @default "BGR"
348
452
  */
349
453
  countryCode?: CountryCode;
454
+ /**
455
+ * Search query to filter cities by name or nameEn
456
+ */
457
+ q?: string;
458
+ /**
459
+ * Comma-separated list of fields to include
460
+ */
461
+ fields?: string;
462
+ /**
463
+ * Maximum number of results (1-100, default: 15)
464
+ */
465
+ limit?: number;
466
+ /**
467
+ * Number of results to skip (default: 0)
468
+ */
469
+ offset?: number;
470
+ /**
471
+ * Sort order (e.g., "name", "-name" for descending)
472
+ */
473
+ order?: string;
350
474
  }
351
475
  /**
352
476
  * Response containing list of cities
@@ -372,6 +496,26 @@ interface ListQuartersInput {
372
496
  * Required parameter
373
497
  */
374
498
  cityId: string;
499
+ /**
500
+ * Search query to filter quarters by name or nameEn
501
+ */
502
+ q?: string;
503
+ /**
504
+ * Comma-separated list of fields to include
505
+ */
506
+ fields?: string;
507
+ /**
508
+ * Maximum number of results (1-100, default: 15)
509
+ */
510
+ limit?: number;
511
+ /**
512
+ * Number of results to skip (default: 0)
513
+ */
514
+ offset?: number;
515
+ /**
516
+ * Sort order (e.g., "name", "-name" for descending)
517
+ */
518
+ order?: string;
375
519
  }
376
520
  /**
377
521
  * Response containing list of quarters
@@ -397,6 +541,10 @@ interface ListOfficesInput {
397
541
  * At least cityId or officeCode should be provided
398
542
  */
399
543
  cityId?: string;
544
+ /**
545
+ * ID of the quarter to filter offices by
546
+ */
547
+ quarterId?: string;
400
548
  /**
401
549
  * Quarter name to filter offices by
402
550
  * Only works when cityId is also provided
@@ -407,6 +555,26 @@ interface ListOfficesInput {
407
555
  * Can be used alone or with cityId for faster filtering
408
556
  */
409
557
  officeCode?: string;
558
+ /**
559
+ * Search query to filter offices by name or nameEn
560
+ */
561
+ q?: string;
562
+ /**
563
+ * Comma-separated list of fields to include
564
+ */
565
+ fields?: string;
566
+ /**
567
+ * Maximum number of results (1-100, default: 15)
568
+ */
569
+ limit?: number;
570
+ /**
571
+ * Number of results to skip (default: 0)
572
+ */
573
+ offset?: number;
574
+ /**
575
+ * Sort order (e.g., "name", "-name" for descending)
576
+ */
577
+ order?: string;
410
578
  }
411
579
  /**
412
580
  * Response containing list of Econt offices
@@ -423,17 +591,22 @@ interface ListOfficesOutput {
423
591
  */
424
592
  type EcontEndpoints = {
425
593
  /**
426
- * Lists cities for a given country
594
+ * Validates an address using Econt's address validation service
595
+ * Returns validated address with full details and validation status
596
+ */
597
+ validateAddress: (input: ValidateAddressInput, headers?: ClientHeaders) => Promise<ValidateAddressOutput>;
598
+ /**
599
+ * Lists cities for a given country with optional filtering and pagination
427
600
  * Cities are cached and returned from Redis for fast responses
428
601
  */
429
602
  listCities: (input: ListCitiesInput, headers?: ClientHeaders) => Promise<ListCitiesOutput>;
430
603
  /**
431
- * Lists quarters (neighborhoods) for a specific city
604
+ * Lists quarters (neighborhoods) for a specific city with optional filtering and pagination
432
605
  * Quarters are cached per city for fast responses
433
606
  */
434
607
  listQuarters: (input: ListQuartersInput, headers?: ClientHeaders) => Promise<ListQuartersOutput>;
435
608
  /**
436
- * Lists Econt offices with optional filtering
609
+ * Lists Econt offices with optional filtering and pagination
437
610
  * Supports filtering by city, quarter, or specific office code
438
611
  * All data is served from hierarchical cache for instant responses
439
612
  */
@@ -441,8 +614,8 @@ type EcontEndpoints = {
441
614
  };
442
615
  /**
443
616
  * Econt fulfillment provider plugin
444
- * Provides endpoints for fetching Econt delivery locations (cities, offices, quarters)
445
- * to enable customers to select pickup locations in the storefront
617
+ * Provides endpoints for address validation and fetching Econt delivery locations (cities, offices, quarters)
618
+ * to enable customers to validate addresses and select pickup locations in the storefront
446
619
  */
447
620
  declare const econtPlugin: Plugin<'econt', EcontEndpoints>;
448
621
 
@@ -512,4 +685,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
512
685
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
513
686
  }
514
687
 
515
- 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 ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, 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 Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
688
+ 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 ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, 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
@@ -338,6 +338,110 @@ declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
338
338
  * Currently supports Bulgaria, can be extended with additional countries
339
339
  */
340
340
  type CountryCode = 'BGR';
341
+ /**
342
+ * Address city information for validation
343
+ */
344
+ interface ValidateAddressCity {
345
+ /**
346
+ * Country code object with ISO 3166-1 alpha-2 code
347
+ */
348
+ country: {
349
+ code2: string;
350
+ };
351
+ /**
352
+ * City name
353
+ */
354
+ name: string;
355
+ }
356
+ /**
357
+ * Input address for validation
358
+ */
359
+ interface ValidateAddressInputAddress {
360
+ /**
361
+ * City object with country code and name (required)
362
+ */
363
+ city: ValidateAddressCity;
364
+ /**
365
+ * Street name (optional)
366
+ */
367
+ street?: string;
368
+ /**
369
+ * Street number (optional)
370
+ */
371
+ num?: string;
372
+ /**
373
+ * Quarter/district name (optional)
374
+ */
375
+ quarter?: string;
376
+ /**
377
+ * Additional address details (optional)
378
+ */
379
+ other?: string;
380
+ }
381
+ /**
382
+ * Input for validating an address using Econt's address validation service
383
+ */
384
+ interface ValidateAddressInput {
385
+ /**
386
+ * Address to validate (city, street, num required)
387
+ */
388
+ address: ValidateAddressInputAddress;
389
+ }
390
+ /**
391
+ * Location coordinates from address validation
392
+ */
393
+ interface ValidateAddressLocation {
394
+ /**
395
+ * Latitude coordinate
396
+ */
397
+ latitude: number;
398
+ /**
399
+ * Longitude coordinate
400
+ */
401
+ longitude: number;
402
+ /**
403
+ * Confidence level (1-5)
404
+ */
405
+ confidence: number;
406
+ }
407
+ /**
408
+ * Validated address structure returned from validation
409
+ */
410
+ interface ValidatedAddress {
411
+ /**
412
+ * Validated city with full details (includes id, name, etc.)
413
+ */
414
+ city: City;
415
+ /**
416
+ * Full formatted address string
417
+ */
418
+ fullAddress: string;
419
+ /**
420
+ * Validated street name
421
+ */
422
+ street?: string;
423
+ /**
424
+ * Validated street number
425
+ */
426
+ num?: string;
427
+ /**
428
+ * Location coordinates if available
429
+ */
430
+ location?: ValidateAddressLocation;
431
+ }
432
+ /**
433
+ * Response containing validated address and validation status
434
+ */
435
+ interface ValidateAddressOutput {
436
+ /**
437
+ * Validated address with full details
438
+ */
439
+ address: ValidatedAddress;
440
+ /**
441
+ * Validation status: "normal" (valid and found), "processed" (modified for validation), "invalid" (could not be validated)
442
+ */
443
+ validationStatus: 'normal' | 'processed' | 'invalid';
444
+ }
341
445
  /**
342
446
  * Input for listing cities in a country
343
447
  */
@@ -347,6 +451,26 @@ interface ListCitiesInput {
347
451
  * @default "BGR"
348
452
  */
349
453
  countryCode?: CountryCode;
454
+ /**
455
+ * Search query to filter cities by name or nameEn
456
+ */
457
+ q?: string;
458
+ /**
459
+ * Comma-separated list of fields to include
460
+ */
461
+ fields?: string;
462
+ /**
463
+ * Maximum number of results (1-100, default: 15)
464
+ */
465
+ limit?: number;
466
+ /**
467
+ * Number of results to skip (default: 0)
468
+ */
469
+ offset?: number;
470
+ /**
471
+ * Sort order (e.g., "name", "-name" for descending)
472
+ */
473
+ order?: string;
350
474
  }
351
475
  /**
352
476
  * Response containing list of cities
@@ -372,6 +496,26 @@ interface ListQuartersInput {
372
496
  * Required parameter
373
497
  */
374
498
  cityId: string;
499
+ /**
500
+ * Search query to filter quarters by name or nameEn
501
+ */
502
+ q?: string;
503
+ /**
504
+ * Comma-separated list of fields to include
505
+ */
506
+ fields?: string;
507
+ /**
508
+ * Maximum number of results (1-100, default: 15)
509
+ */
510
+ limit?: number;
511
+ /**
512
+ * Number of results to skip (default: 0)
513
+ */
514
+ offset?: number;
515
+ /**
516
+ * Sort order (e.g., "name", "-name" for descending)
517
+ */
518
+ order?: string;
375
519
  }
376
520
  /**
377
521
  * Response containing list of quarters
@@ -397,6 +541,10 @@ interface ListOfficesInput {
397
541
  * At least cityId or officeCode should be provided
398
542
  */
399
543
  cityId?: string;
544
+ /**
545
+ * ID of the quarter to filter offices by
546
+ */
547
+ quarterId?: string;
400
548
  /**
401
549
  * Quarter name to filter offices by
402
550
  * Only works when cityId is also provided
@@ -407,6 +555,26 @@ interface ListOfficesInput {
407
555
  * Can be used alone or with cityId for faster filtering
408
556
  */
409
557
  officeCode?: string;
558
+ /**
559
+ * Search query to filter offices by name or nameEn
560
+ */
561
+ q?: string;
562
+ /**
563
+ * Comma-separated list of fields to include
564
+ */
565
+ fields?: string;
566
+ /**
567
+ * Maximum number of results (1-100, default: 15)
568
+ */
569
+ limit?: number;
570
+ /**
571
+ * Number of results to skip (default: 0)
572
+ */
573
+ offset?: number;
574
+ /**
575
+ * Sort order (e.g., "name", "-name" for descending)
576
+ */
577
+ order?: string;
410
578
  }
411
579
  /**
412
580
  * Response containing list of Econt offices
@@ -423,17 +591,22 @@ interface ListOfficesOutput {
423
591
  */
424
592
  type EcontEndpoints = {
425
593
  /**
426
- * Lists cities for a given country
594
+ * Validates an address using Econt's address validation service
595
+ * Returns validated address with full details and validation status
596
+ */
597
+ validateAddress: (input: ValidateAddressInput, headers?: ClientHeaders) => Promise<ValidateAddressOutput>;
598
+ /**
599
+ * Lists cities for a given country with optional filtering and pagination
427
600
  * Cities are cached and returned from Redis for fast responses
428
601
  */
429
602
  listCities: (input: ListCitiesInput, headers?: ClientHeaders) => Promise<ListCitiesOutput>;
430
603
  /**
431
- * Lists quarters (neighborhoods) for a specific city
604
+ * Lists quarters (neighborhoods) for a specific city with optional filtering and pagination
432
605
  * Quarters are cached per city for fast responses
433
606
  */
434
607
  listQuarters: (input: ListQuartersInput, headers?: ClientHeaders) => Promise<ListQuartersOutput>;
435
608
  /**
436
- * Lists Econt offices with optional filtering
609
+ * Lists Econt offices with optional filtering and pagination
437
610
  * Supports filtering by city, quarter, or specific office code
438
611
  * All data is served from hierarchical cache for instant responses
439
612
  */
@@ -441,8 +614,8 @@ type EcontEndpoints = {
441
614
  };
442
615
  /**
443
616
  * Econt fulfillment provider plugin
444
- * Provides endpoints for fetching Econt delivery locations (cities, offices, quarters)
445
- * to enable customers to select pickup locations in the storefront
617
+ * Provides endpoints for address validation and fetching Econt delivery locations (cities, offices, quarters)
618
+ * to enable customers to validate addresses and select pickup locations in the storefront
446
619
  */
447
620
  declare const econtPlugin: Plugin<'econt', EcontEndpoints>;
448
621
 
@@ -512,4 +685,4 @@ declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], T
512
685
  constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
513
686
  }
514
687
 
515
- 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 ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, 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 Wishlist, type WishlistItem, econtPlugin, paypalPlugin, reviewsPlugin, wishlistPlugin };
688
+ 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 ImportWishlistInput, type ImportWishlistOutput, type ListCitiesInput, type ListCitiesOutput, type ListItemsInput, type ListItemsOutput, type ListOfficesInput, type ListOfficesOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListQuartersInput, type ListQuartersOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, 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,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 c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={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");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={name:"econt",endpoints:(r,s)=>({listCities:async({countryCode:t="BGR"},e)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{countryCode:t}}),listQuarters:async({cityId:t,countryCode:e="BGR"},i)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{cityId:t,countryCode:e}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends u__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=f;exports.paypalPlugin=c;exports.reviewsPlugin=m;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 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 c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={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");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={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}})})};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=f;exports.paypalPlugin=c;exports.reviewsPlugin=m;exports.wishlistPlugin=p;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import u from'@medusajs/js-sdk';var d={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 c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={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");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={name:"econt",endpoints:(r,s)=>({listCities:async({countryCode:t="BGR"},e)=>r.client.fetch("/store/econt/cities",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{countryCode:t}}),listQuarters:async({cityId:t,countryCode:e="BGR"},i)=>r.client.fetch("/store/econt/quarters",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{cityId:t,countryCode:e}}),listOffices:async({countryCode:t="BGR",...e},i)=>r.client.fetch("/store/econt/offices",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:{countryCode:t,...e}})})};var o=class extends u{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,f as econtPlugin,c as paypalPlugin,m as reviewsPlugin,d as wishlistPlugin};
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 c={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={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");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var f={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}})})};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,f as econtPlugin,c 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.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
5
5
  "author": "Alphabite",
6
6
  "license": "MIT",