@behio/storefront-sdk 0.3.0 → 0.4.0

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.ts CHANGED
@@ -371,6 +371,51 @@ declare class BehioNetworkError extends Error {
371
371
  readonly isRetryable = true;
372
372
  constructor(message: string, isTimeout?: boolean);
373
373
  }
374
+ /**
375
+ * Shape every SDK call returns. Destructure `{data, error}` — exactly
376
+ * one of them is non-null on any given call. No more try/catch for
377
+ * expected failures; the type system forces you to handle `error`
378
+ * before touching `data`.
379
+ *
380
+ * const {data, error} = await behio.catalog.getProduct(slug);
381
+ * if (error) return <ErrorState code={error.code} />;
382
+ * return <ProductView product={data} />;
383
+ */
384
+ type SdkResult<T> = {
385
+ data: T;
386
+ error: null;
387
+ } | {
388
+ data: null;
389
+ error: SdkError;
390
+ };
391
+ /**
392
+ * Canonical error shape returned from every SDK call. Always carries a
393
+ * `code` you can branch on without parsing messages.
394
+ */
395
+ interface SdkError {
396
+ /**
397
+ * High-level category. `BehioErrorCode` covers API errors; additional
398
+ * buckets are network/timeout/abort/unknown.
399
+ */
400
+ code: BehioErrorCode;
401
+ /** Human-readable message (fallback for unknown codes / dev logging). */
402
+ message: string;
403
+ /** HTTP status, if the error came from the API. Null for network / abort. */
404
+ status: number | null;
405
+ /** Raw API body, if present. */
406
+ body?: unknown;
407
+ /** Whether the operation is safe to retry (true for 5xx / 429 / network). */
408
+ isRetryable: boolean;
409
+ /** Preserves the original thrown instance for stack traces + rethrows. */
410
+ cause?: unknown;
411
+ }
412
+ declare function ok<T>(data: T): SdkResult<T>;
413
+ declare function err<T = never>(error: SdkError): SdkResult<T>;
414
+ /**
415
+ * Converts any thrown value into a canonical SdkError. Used by the
416
+ * request wrapper when catching internal throws.
417
+ */
418
+ declare function toSdkError(err: unknown): SdkError;
374
419
  type BehioEventType = "auth:login" | "auth:logout" | "auth:token-refresh" | "auth:token-refresh-failed" | "cart:updated" | "cart:cleared" | "order:created" | "error" | "request" | "response" | "rate-limit-warning";
375
420
  type BehioEventHandler = (data?: unknown) => void;
376
421
  interface RequestInterceptorConfig {
@@ -573,9 +618,9 @@ declare class BehioStorefront {
573
618
  readonly quotes: QuotesModule;
574
619
  readonly addresses: AddressModule;
575
620
  /** Get basic shop info */
576
- getShopInfo(): Promise<ShopInfo>;
621
+ getShopInfo(): Promise<SdkResult<ShopInfo>>;
577
622
  /** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
578
- getShopSeo(locale?: string): Promise<ShopSeo>;
623
+ getShopSeo(locale?: string): Promise<SdkResult<ShopSeo>>;
579
624
  /** Set auth tokens (e.g. from localStorage) */
580
625
  setTokens(tokens: {
581
626
  accessToken: string;
@@ -607,88 +652,99 @@ declare class BehioStorefront {
607
652
  reset: number | null;
608
653
  };
609
654
  private handleTokenRefresh;
610
- /** @internal */
655
+ /**
656
+ * Every public module method funnels through here. Internally calls
657
+ * `rawRequest` (which throws on failure) and maps thrown errors to
658
+ * `SdkError` so the public surface can return `SdkResult<T>`.
659
+ *
660
+ * @internal — don't call from outside the SDK; use the typed module
661
+ * methods (behio.catalog.*, behio.cart.*, …) instead.
662
+ */
611
663
  request<T>(method: string, path: string, options?: {
612
664
  body?: unknown;
613
665
  query?: Record<string, string | number | boolean | undefined | string[] | number[]>;
614
666
  auth?: boolean;
615
667
  signal?: AbortSignal;
616
- /** @internal Prevents infinite refresh loops */
617
- _isRetryAfterRefresh?: boolean;
618
- }): Promise<T>;
668
+ }): Promise<SdkResult<T>>;
669
+ /**
670
+ * Throws on failure (API error / network / timeout). Kept private so
671
+ * internal auth refresh recursion keeps its existing control flow —
672
+ * public callers must go through `request()` which returns Result.
673
+ */
674
+ private rawRequest;
619
675
  }
620
676
  declare class CatalogModule {
621
677
  private client;
622
678
  constructor(client: BehioStorefront);
623
679
  /** List products with filtering, pagination, search */
624
- getProducts(query?: ProductsQuery): Promise<PaginatedResponse<ProductListItem>>;
680
+ getProducts(query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
625
681
  /** Get product detail by slug */
626
682
  getProduct(slug: string, options?: {
627
683
  locale?: string;
628
684
  currency?: string;
629
- }): Promise<ProductDetail>;
685
+ }): Promise<SdkResult<ProductDetail>>;
630
686
  /** Get category tree */
631
- getCategories(locale?: string): Promise<{
687
+ getCategories(locale?: string): Promise<SdkResult<{
632
688
  categories: Category[];
633
- }>;
689
+ }>>;
634
690
  /** Get category detail by slug */
635
- getCategory(slug: string, locale?: string): Promise<CategoryDetail>;
691
+ getCategory(slug: string, locale?: string): Promise<SdkResult<CategoryDetail>>;
636
692
  /** Get products in a category */
637
- getCategoryProducts(slug: string, query?: ProductsQuery): Promise<PaginatedResponse<ProductListItem>>;
693
+ getCategoryProducts(slug: string, query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
638
694
  /** Get all labels */
639
- getLabels(locale?: string): Promise<{
695
+ getLabels(locale?: string): Promise<SdkResult<{
640
696
  labels: ProductLabel[];
641
- }>;
697
+ }>>;
642
698
  /** Get featured products */
643
699
  getFeatured(options?: {
644
700
  locale?: string;
645
701
  currency?: string;
646
- }): Promise<PaginatedResponse<ProductListItem>>;
702
+ }): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
647
703
  /** Get available filter fields for dynamic filter UI */
648
- getFilters(): Promise<{
704
+ getFilters(): Promise<SdkResult<{
649
705
  filters: FilterField[];
650
- }>;
706
+ }>>;
651
707
  /** Search products */
652
708
  search(query: string, options?: {
653
709
  page?: number;
654
710
  limit?: number;
655
- }): Promise<PaginatedResponse<ProductListItem>>;
711
+ }): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
656
712
  /** List all active bundles */
657
- getBundles(): Promise<{
713
+ getBundles(): Promise<SdkResult<{
658
714
  items: Bundle[];
659
- }>;
715
+ }>>;
660
716
  /** Get a single bundle by slug */
661
- getBundle(slug: string): Promise<Bundle>;
717
+ getBundle(slug: string): Promise<SdkResult<Bundle>>;
662
718
  /** Cross-sell / related / upsell products for a product */
663
- getCrossSell(productSlug: string): Promise<{
719
+ getCrossSell(productSlug: string): Promise<SdkResult<{
664
720
  related: CrossSellItem[];
665
721
  upsell: CrossSellItem[];
666
722
  crossSell: CrossSellItem[];
667
- }>;
723
+ }>>;
668
724
  /** Active promotions applicable to a product (with countdown end time) */
669
- getProductPromotions(productSlug: string): Promise<{
725
+ getProductPromotions(productSlug: string): Promise<SdkResult<{
670
726
  items: ActivePromotion[];
671
- }>;
727
+ }>>;
672
728
  /** Check a gift card code — returns validity and remaining balance */
673
- checkGiftCard(code: string): Promise<GiftCardBalance>;
729
+ checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
674
730
  }
675
731
  declare class AuthModule {
676
732
  private client;
677
733
  constructor(client: BehioStorefront);
678
734
  /** Register a new customer */
679
- register(input: RegisterInput): Promise<AuthTokens>;
735
+ register(input: RegisterInput): Promise<SdkResult<AuthTokens>>;
680
736
  /** Login with email and password */
681
- login(input: LoginInput): Promise<AuthTokens>;
737
+ login(input: LoginInput): Promise<SdkResult<AuthTokens>>;
682
738
  /** Refresh access token using refresh token */
683
- refresh(refreshToken?: string): Promise<AuthTokens>;
739
+ refresh(refreshToken?: string): Promise<SdkResult<AuthTokens>>;
684
740
  /** Logout (invalidate refresh token) */
685
- logout(refreshToken?: string): Promise<MessageResponse>;
741
+ logout(refreshToken?: string): Promise<SdkResult<MessageResponse>>;
686
742
  /** Request password reset email */
687
- forgotPassword(email: string): Promise<MessageResponse>;
743
+ forgotPassword(email: string): Promise<SdkResult<MessageResponse>>;
688
744
  /** Reset password with token */
689
- resetPassword(token: string, newPassword: string): Promise<MessageResponse>;
745
+ resetPassword(token: string, newPassword: string): Promise<SdkResult<MessageResponse>>;
690
746
  /** Verify email with token */
691
- verifyEmail(token: string): Promise<MessageResponse>;
747
+ verifyEmail(token: string): Promise<SdkResult<MessageResponse>>;
692
748
  /** Check if user is logged in (has access token) */
693
749
  isLoggedIn(): boolean;
694
750
  }
@@ -696,39 +752,39 @@ declare class CartModule {
696
752
  private client;
697
753
  constructor(client: BehioStorefront);
698
754
  /** Get current cart */
699
- get(): Promise<Cart>;
755
+ get(): Promise<SdkResult<Cart>>;
700
756
  /** Add item to cart */
701
- addItem(input: AddToCartInput): Promise<Cart & {
757
+ addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
702
758
  newSessionToken?: string;
703
- }>;
759
+ }>>;
704
760
  /** Update item quantity */
705
- updateQuantity(itemId: string, quantity: number): Promise<Cart>;
761
+ updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
706
762
  /** Remove item from cart */
707
- removeItem(itemId: string): Promise<Cart>;
763
+ removeItem(itemId: string): Promise<SdkResult<Cart>>;
708
764
  /** Clear entire cart */
709
- clear(): Promise<void>;
765
+ clear(): Promise<SdkResult<void>>;
710
766
  /** Apply a gift card code to the cart. Balance is deducted at checkout. */
711
- applyGiftCard(code: string): Promise<Cart>;
767
+ applyGiftCard(code: string): Promise<SdkResult<Cart>>;
712
768
  /** Remove a gift card from the cart */
713
- removeGiftCard(): Promise<Cart>;
769
+ removeGiftCard(): Promise<SdkResult<Cart>>;
714
770
  /** Add a bundle to the cart (price is locked at the bundle's current price) */
715
- addBundle(bundleId: string, quantity?: number): Promise<Cart>;
771
+ addBundle(bundleId: string, quantity?: number): Promise<SdkResult<Cart>>;
716
772
  /** Update quantity of a bundle already in the cart */
717
- updateBundleQuantity(bundleId: string, quantity: number): Promise<Cart>;
773
+ updateBundleQuantity(bundleId: string, quantity: number): Promise<SdkResult<Cart>>;
718
774
  /** Remove a bundle from the cart */
719
- removeBundle(bundleId: string): Promise<Cart>;
775
+ removeBundle(bundleId: string): Promise<SdkResult<Cart>>;
720
776
  /** Merge anonymous cart into authenticated customer cart */
721
- merge(): Promise<Cart>;
777
+ merge(): Promise<SdkResult<Cart>>;
722
778
  /** Apply discount code */
723
- applyDiscount(code: string): Promise<Cart>;
779
+ applyDiscount(code: string): Promise<SdkResult<Cart>>;
724
780
  /** Remove discount code */
725
- removeDiscount(): Promise<Cart>;
781
+ removeDiscount(): Promise<SdkResult<Cart>>;
726
782
  }
727
783
  declare class CheckoutModule {
728
784
  private client;
729
785
  constructor(client: BehioStorefront);
730
786
  /** Create order from cart */
731
- createOrder(input: CheckoutInput): Promise<OrderDetail>;
787
+ createOrder(input: CheckoutInput): Promise<SdkResult<OrderDetail>>;
732
788
  }
733
789
  declare class OrdersModule {
734
790
  private client;
@@ -737,92 +793,92 @@ declare class OrdersModule {
737
793
  list(options?: {
738
794
  page?: number;
739
795
  limit?: number;
740
- }): Promise<PaginatedResponse<OrderListItem>>;
796
+ }): Promise<SdkResult<PaginatedResponse<OrderListItem>>>;
741
797
  /** Get order detail (requires auth) */
742
- get(orderNumber: string): Promise<OrderDetail>;
798
+ get(orderNumber: string): Promise<SdkResult<OrderDetail>>;
743
799
  /** Cancel a PENDING order (requires auth) */
744
- cancel(orderNumber: string): Promise<OrderDetail>;
800
+ cancel(orderNumber: string): Promise<SdkResult<OrderDetail>>;
745
801
  /** Track order by tracking token (no customer login required, only API key) */
746
- track(trackingToken: string): Promise<OrderDetail>;
802
+ track(trackingToken: string): Promise<SdkResult<OrderDetail>>;
747
803
  }
748
804
  declare class CustomerModule {
749
805
  private client;
750
806
  constructor(client: BehioStorefront);
751
807
  /** Get customer profile */
752
- getProfile(): Promise<CustomerProfile>;
808
+ getProfile(): Promise<SdkResult<CustomerProfile>>;
753
809
  /** Update customer profile */
754
- updateProfile(data: Partial<Pick<CustomerProfile, "firstName" | "lastName" | "phone">>): Promise<CustomerProfile>;
810
+ updateProfile(data: Partial<Pick<CustomerProfile, "firstName" | "lastName" | "phone">>): Promise<SdkResult<CustomerProfile>>;
755
811
  /** Change password */
756
- changePassword(currentPassword: string, newPassword: string): Promise<MessageResponse>;
812
+ changePassword(currentPassword: string, newPassword: string): Promise<SdkResult<MessageResponse>>;
757
813
  /** List addresses */
758
- getAddresses(): Promise<{
814
+ getAddresses(): Promise<SdkResult<{
759
815
  items: CustomerAddress[];
760
- }>;
816
+ }>>;
761
817
  /** Create address */
762
- createAddress(address: Omit<CustomerAddress, "id">): Promise<CustomerAddress>;
818
+ createAddress(address: Omit<CustomerAddress, "id">): Promise<SdkResult<CustomerAddress>>;
763
819
  /** Update address */
764
- updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<CustomerAddress>;
820
+ updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<SdkResult<CustomerAddress>>;
765
821
  /** Delete address */
766
- deleteAddress(addressId: string): Promise<void>;
822
+ deleteAddress(addressId: string): Promise<SdkResult<void>>;
767
823
  }
768
824
  declare class PagesModule {
769
825
  private client;
770
826
  constructor(client: BehioStorefront);
771
827
  /** List CMS pages */
772
- list(locale?: string): Promise<{
828
+ list(locale?: string): Promise<SdkResult<{
773
829
  pages: Page[];
774
- }>;
830
+ }>>;
775
831
  /** Get page by slug */
776
- get(slug: string, locale?: string): Promise<PageDetail>;
832
+ get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
777
833
  }
778
834
  declare class WishlistModule {
779
835
  private client;
780
836
  constructor(client: BehioStorefront);
781
- get(): Promise<{
837
+ get(): Promise<SdkResult<{
782
838
  items: WishlistItem[];
783
- }>;
784
- add(productId: string): Promise<{
839
+ }>>;
840
+ add(productId: string): Promise<SdkResult<{
785
841
  success: boolean;
786
- }>;
787
- remove(productId: string): Promise<{
842
+ }>>;
843
+ remove(productId: string): Promise<SdkResult<{
788
844
  success: boolean;
789
- }>;
790
- isInWishlist(productId: string): Promise<{
845
+ }>>;
846
+ isInWishlist(productId: string): Promise<SdkResult<{
791
847
  inWishlist: boolean;
792
- }>;
848
+ }>>;
793
849
  }
794
850
  declare class ReviewsModule {
795
851
  private client;
796
852
  constructor(client: BehioStorefront);
797
- getProductReviews(productId: string, page?: number, limit?: number): Promise<ProductReviewsResponse>;
798
- submit(input: SubmitReviewInput): Promise<{
853
+ getProductReviews(productId: string, page?: number, limit?: number): Promise<SdkResult<ProductReviewsResponse>>;
854
+ submit(input: SubmitReviewInput): Promise<SdkResult<{
799
855
  id: string;
800
- }>;
801
- voteHelpful(reviewId: string, helpful: boolean): Promise<{
856
+ }>>;
857
+ voteHelpful(reviewId: string, helpful: boolean): Promise<SdkResult<{
802
858
  success: boolean;
803
- }>;
859
+ }>>;
804
860
  }
805
861
  declare class ReturnsModule {
806
862
  private client;
807
863
  constructor(client: BehioStorefront);
808
- submit(input: SubmitReturnInput): Promise<ReturnRequest>;
809
- getStatus(returnId: string, email: string): Promise<ReturnRequest>;
864
+ submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
865
+ getStatus(returnId: string, email: string): Promise<SdkResult<ReturnRequest>>;
810
866
  }
811
867
  declare class ConsentModule {
812
868
  private client;
813
869
  constructor(client: BehioStorefront);
814
- record(input: CookieConsentInput): Promise<CookieConsent>;
815
- get(visitorId: string): Promise<CookieConsent | null>;
816
- revoke(visitorId: string): Promise<{
870
+ record(input: CookieConsentInput): Promise<SdkResult<CookieConsent>>;
871
+ get(visitorId: string): Promise<SdkResult<CookieConsent | null>>;
872
+ revoke(visitorId: string): Promise<SdkResult<{
817
873
  success: boolean;
818
- }>;
874
+ }>>;
819
875
  }
820
876
  declare class QuotesModule {
821
877
  private client;
822
878
  constructor(client: BehioStorefront);
823
- submit(input: SubmitQuoteInput): Promise<QuoteRequest>;
824
- accept(quoteId: string, email: string): Promise<QuoteRequest>;
825
- getStatus(quoteId: string): Promise<QuoteRequest>;
879
+ submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
880
+ accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
881
+ getStatus(quoteId: string): Promise<SdkResult<QuoteRequest>>;
826
882
  }
827
883
  interface AddressSuggestion {
828
884
  placeId: string;
@@ -848,11 +904,11 @@ declare class AddressModule {
848
904
  private client;
849
905
  constructor(client: BehioStorefront);
850
906
  /** Search for address suggestions (debounce on your side, or use the React hook) */
851
- autocomplete(query: string, country: string): Promise<{
907
+ autocomplete(query: string, country: string): Promise<SdkResult<{
852
908
  suggestions: AddressSuggestion[];
853
- }>;
909
+ }>>;
854
910
  /** Get full structured address from a suggestion's placeId */
855
- getDetail(placeId: string): Promise<AddressDetail>;
911
+ getDetail(placeId: string): Promise<SdkResult<AddressDetail>>;
856
912
  }
857
913
 
858
- export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
914
+ export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type SdkError, type SdkResult, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem, err, ok, toSdkError };
package/dist/index.js CHANGED
@@ -7,14 +7,20 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkZEPWNT56js = require('./chunk-ZEPWNT56.js');
11
10
 
12
11
 
13
12
 
13
+ var _chunkYLKO3SURjs = require('./chunk-YLKO3SUR.js');
14
14
 
15
15
 
16
16
 
17
17
 
18
18
 
19
19
 
20
- exports.AddressTypes = _chunkZEPWNT56js.AddressTypes; exports.BehioApiError = _chunkZEPWNT56js.BehioApiError; exports.BehioNetworkError = _chunkZEPWNT56js.BehioNetworkError; exports.BehioStorefront = _chunkZEPWNT56js.BehioStorefront; exports.FulfillmentStatuses = _chunkZEPWNT56js.FulfillmentStatuses; exports.OrderStatuses = _chunkZEPWNT56js.OrderStatuses; exports.PaymentStatuses = _chunkZEPWNT56js.PaymentStatuses; exports.ProductSort = _chunkZEPWNT56js.ProductSort;
20
+
21
+
22
+
23
+
24
+
25
+
26
+ exports.AddressTypes = _chunkYLKO3SURjs.AddressTypes; exports.BehioApiError = _chunkYLKO3SURjs.BehioApiError; exports.BehioNetworkError = _chunkYLKO3SURjs.BehioNetworkError; exports.BehioStorefront = _chunkYLKO3SURjs.BehioStorefront; exports.FulfillmentStatuses = _chunkYLKO3SURjs.FulfillmentStatuses; exports.OrderStatuses = _chunkYLKO3SURjs.OrderStatuses; exports.PaymentStatuses = _chunkYLKO3SURjs.PaymentStatuses; exports.ProductSort = _chunkYLKO3SURjs.ProductSort; exports.err = _chunkYLKO3SURjs.err; exports.ok = _chunkYLKO3SURjs.ok; exports.toSdkError = _chunkYLKO3SURjs.toSdkError;
package/dist/index.mjs CHANGED
@@ -6,8 +6,11 @@ import {
6
6
  FulfillmentStatuses,
7
7
  OrderStatuses,
8
8
  PaymentStatuses,
9
- ProductSort
10
- } from "./chunk-45FTJKSW.mjs";
9
+ ProductSort,
10
+ err,
11
+ ok,
12
+ toSdkError
13
+ } from "./chunk-L5KVNLTD.mjs";
11
14
  export {
12
15
  AddressTypes,
13
16
  BehioApiError,
@@ -16,5 +19,8 @@ export {
16
19
  FulfillmentStatuses,
17
20
  OrderStatuses,
18
21
  PaymentStatuses,
19
- ProductSort
22
+ ProductSort,
23
+ err,
24
+ ok,
25
+ toSdkError
20
26
  };
package/dist/react.d.mts CHANGED
@@ -211,7 +211,7 @@ interface UseAddressAutocompleteReturn {
211
211
  query: string;
212
212
  /** Update handler — bind to input's onChange */
213
213
  setQuery: (value: string) => void;
214
- /** Address suggestions from Google Places */
214
+ /** Current list of address suggestions */
215
215
  suggestions: AddressSuggestion[];
216
216
  /** Loading state */
217
217
  isLoading: boolean;
@@ -317,14 +317,14 @@ declare function useShopInfo(options?: UseShopInfoOptions): _tanstack_react_quer
317
317
  interface UseShopSeoOptions {
318
318
  /** Override locale (ISO-639-1). Defaults to the shop's default locale. */
319
319
  locale?: string;
320
- /** Hydrate from SSR-fetched data (use `client.getShopSeo(locale)` on the server). */
320
+ /** Hydrate from SSR-fetched data (use `unwrap(client.getShopSeo(locale))` on the server). */
321
321
  initialData?: ShopSeo;
322
322
  /** Disable the query. */
323
323
  enabled?: boolean;
324
324
  }
325
325
  /**
326
326
  * React Query hook for per-locale shop SEO metadata. Safe to render on the
327
- * server via `initialData` from `client.getShopSeo(locale)`.
327
+ * server via `initialData` from `unwrap(client.getShopSeo(locale))`.
328
328
  */
329
329
  declare function useShopSeo(options?: UseShopSeoOptions): _tanstack_react_query.UseQueryResult<ShopSeo, Error>;
330
330
 
package/dist/react.d.ts CHANGED
@@ -211,7 +211,7 @@ interface UseAddressAutocompleteReturn {
211
211
  query: string;
212
212
  /** Update handler — bind to input's onChange */
213
213
  setQuery: (value: string) => void;
214
- /** Address suggestions from Google Places */
214
+ /** Current list of address suggestions */
215
215
  suggestions: AddressSuggestion[];
216
216
  /** Loading state */
217
217
  isLoading: boolean;
@@ -317,14 +317,14 @@ declare function useShopInfo(options?: UseShopInfoOptions): _tanstack_react_quer
317
317
  interface UseShopSeoOptions {
318
318
  /** Override locale (ISO-639-1). Defaults to the shop's default locale. */
319
319
  locale?: string;
320
- /** Hydrate from SSR-fetched data (use `client.getShopSeo(locale)` on the server). */
320
+ /** Hydrate from SSR-fetched data (use `unwrap(client.getShopSeo(locale))` on the server). */
321
321
  initialData?: ShopSeo;
322
322
  /** Disable the query. */
323
323
  enabled?: boolean;
324
324
  }
325
325
  /**
326
326
  * React Query hook for per-locale shop SEO metadata. Safe to render on the
327
- * server via `initialData` from `client.getShopSeo(locale)`.
327
+ * server via `initialData` from `unwrap(client.getShopSeo(locale))`.
328
328
  */
329
329
  declare function useShopSeo(options?: UseShopSeoOptions): _tanstack_react_query.UseQueryResult<ShopSeo, Error>;
330
330