@growupsell/commerce 1.0.0-alpha.1 → 1.0.0-alpha.2

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.
@@ -1,4 +1,4 @@
1
- import { C as Cart, f as OrderType, c as CartTotals, T as TaxDetails, d as DeliveryEstimate, P as Page, j as ProductListItem, k as ProductOverview, g as ProductDetail, h as ProductFilterConfig, V as VariantGroup, S as SearchSuggestion, O as Offer, o as PromoCode, G as GiftCard, R as RewardPointSettings, m as ProductSku } from './promotions-Ck9FZD7h.js';
1
+ import { C as Cart, l as OrderType, d as CartTotals, U as TaxDetails, j as DeliveryEstimate, g as CategoryTree, f as Category, B as Brand, e as CatalogSettings, x as ProductSection, p as ProductBlock, y as ProductSectionItem, w as ProductSearchOptions, P as Page, t as ProductListItem, u as ProductOverview, q as ProductDetail, r as ProductFilterConfig, V as VariantGroup, S as SearchSuggestion, O as Offer, J as PromoCode, G as GiftCard, Q as RewardPointSettings, L as ReviewListItem, N as ReviewSummary, K as ReviewEligibility, R as Review, E as ProductSku, i as CustomerProfile, h as CheckoutSettings, o as PlaceOrderResult, A as AdvanceOrder, n as PendingPayment, m as PaymentMethodType } from './checkout-CwpFl6qt.js';
2
2
 
3
3
  /** The editor the merchant wrote the post with; decides how `body` sections are styled. */
4
4
  type BlogEditor = 'quill' | 'ckeditor' | 'froala';
@@ -99,6 +99,12 @@ interface UnauthorizedEvent {
99
99
  * unknown to the backend; drop it and create a new one with `session.create()`.
100
100
  */
101
101
  kind: 'customer' | 'merchant' | 'session';
102
+ /**
103
+ * The rejected token, so a holder of several logins can tell whether the current one expired
104
+ * or a request sent with an older one came back late. Compare it and drop it: never persist,
105
+ * log or send it anywhere.
106
+ */
107
+ token: string;
102
108
  }
103
109
  interface ClientOptions {
104
110
  /** Backend base URL, e.g. `https://api.example.com`. Required: no default backend. */
@@ -378,44 +384,6 @@ interface CartApi {
378
384
  }): Promise<DeliveryEstimate>;
379
385
  }
380
386
 
381
- /**
382
- * Catalog domain types: categories, brands and the business's catalog settings.
383
- * Built from wire responses in http/catalog.ts.
384
- */
385
- interface Category {
386
- id: number;
387
- name: string;
388
- description: string | null;
389
- photo: string | null;
390
- parentId: number | null;
391
- /** Products in this category and all its sub-categories. */
392
- productCount: number;
393
- }
394
- /** A category with its sub-categories, as returned by `catalog.categories()`. */
395
- interface CategoryTree extends Category {
396
- /** Newest first. */
397
- children: CategoryTree[];
398
- }
399
- interface Brand {
400
- id: number;
401
- name: string;
402
- description: string | null;
403
- photo: string | null;
404
- productCount: number;
405
- }
406
- /** Which catalog features the merchant has switched on. Use them to show or hide UI. */
407
- interface CatalogSettings {
408
- reviews: boolean;
409
- brands: boolean;
410
- categories: boolean;
411
- subscriptions: boolean;
412
- digitalDelivery: boolean;
413
- variants: boolean;
414
- specifications: boolean;
415
- unitTracking: boolean;
416
- manufactureAndExpiryDates: boolean;
417
- }
418
-
419
387
  interface CatalogApi {
420
388
  /**
421
389
  * Top-level categories with their sub-categories. With `search`, the categories whose name
@@ -601,6 +569,44 @@ interface NewsletterApi {
601
569
  verify(email: string, otp: string): Promise<void>;
602
570
  }
603
571
 
572
+ /**
573
+ * A browser's web push subscription as plain data: what `PushSubscription.toJSON()` returns,
574
+ * so `client.push.subscribe(subscription.toJSON())` type-checks. `commerce` has no DOM types,
575
+ * so this mirrors the DOM's `PushSubscriptionJSON` (every field optional there too). The
576
+ * library refuses one without `endpoint`, `keys.p256dh` or `keys.auth` before sending.
577
+ */
578
+ interface PushSubscriptionJson {
579
+ endpoint?: string;
580
+ expirationTime?: number | null;
581
+ keys?: Record<string, string>;
582
+ }
583
+
584
+ /**
585
+ * Web push subscriptions (backend `/subscribers/push/…`). The app does the browser work
586
+ * (permission, service worker, `pushManager.subscribe` with the VAPID key) and passes
587
+ * `PushSubscription.toJSON()` in; the library never touches platform APIs.
588
+ */
589
+ interface PushApi {
590
+ /**
591
+ * The server's VAPID public key (base64url), for `pushManager.subscribe`'s
592
+ * `applicationServerKey`. Null when the backend has none configured.
593
+ */
594
+ vapidPublicKey(): Promise<string | null>;
595
+ /**
596
+ * Registers the browser's subscription for the business. When a customer is logged in, the
597
+ * backend links it to the customer (one subscription per customer: a new browser replaces the
598
+ * old one). Safe to repeat: an existing subscription is updated. Rejects without a request
599
+ * (`TypeError`) when `endpoint`, `keys.p256dh` or `keys.auth` is missing.
600
+ */
601
+ subscribe(subscription: PushSubscriptionJson): Promise<void>;
602
+ /**
603
+ * Switches the subscription off for the business. Resolves also when the backend had no such
604
+ * subscription. Call it before `PushSubscription.unsubscribe()` in the browser. Rejects
605
+ * without a request (`TypeError`) like `subscribe`.
606
+ */
607
+ unsubscribe(subscription: PushSubscriptionJson): Promise<void>;
608
+ }
609
+
604
610
  /** The merchant's chat button. WhatsApp is the only channel the backend offers. */
605
611
  interface LiveSupportWidget {
606
612
  channel: 'whatsapp';
@@ -613,65 +619,6 @@ interface LiveSupportApi {
613
619
  widget(): Promise<LiveSupportWidget | null>;
614
620
  }
615
621
 
616
- /**
617
- * Merchant-built product-page content. Built from wire responses in http/productPage.ts.
618
- *
619
- * Two kinds, both edited by the merchant from the storefront in theme-edit mode:
620
- * - **Sections**: titled tabs under the product (e.g. "Description", "FAQs"), each with items.
621
- * An item's `data` holds the components the storefront renders (description, FAQs, features,
622
- * video slider…).
623
- * - **Blocks**: one-off content keyed by a slug, e.g. `hero` (the detail layout) and
624
- * `showcase` (vertical video cards).
625
- *
626
- * `data` is free-form JSON the backend stores as given (apart from the checks listed on
627
- * `ProductBlock`), so it is `unknown`: check its shape before use.
628
- */
629
- /**
630
- * Which shoppers see a section item:
631
- * - `'all'`: every variant.
632
- * - `{ skuId, variantIds }`: only this SKU. `variantIds` are its variant options; null when the
633
- * backend did not send them (create and update responses) or the SKU has none.
634
- * - `{ variantId }`: every SKU with this variant option, e.g. all "Blue" phones.
635
- */
636
- type ProductSectionItemTarget = 'all' | {
637
- skuId: number;
638
- variantIds: number[] | null;
639
- } | {
640
- variantId: number;
641
- };
642
- /** One item of a section: storefront components, possibly limited to a SKU or variant. */
643
- interface ProductSectionItem {
644
- id: number;
645
- sectionId: number;
646
- /** As saved by the merchant. The storefront saves a list of `{ slug, … }` components. */
647
- data: unknown;
648
- /** Position within the section, from 1. */
649
- order: number;
650
- target: ProductSectionItemTarget;
651
- }
652
- /** A titled section of the product page, with its items in display order. */
653
- interface ProductSection {
654
- id: number;
655
- productId: number;
656
- title: string;
657
- items: ProductSectionItem[];
658
- }
659
- /**
660
- * A slug-keyed content block of a product. The backend checks two slugs:
661
- * - `hero`: at most one per product; `data` must be `{ layout: 'default' | 'fullscreen' }`.
662
- * - `showcase`: at most one per product; `data` is `{ items: [{ source: 'youtube' | 'upload',
663
- * url, … }] }` with a non-empty url (a valid YouTube link for `youtube`).
664
- * Any other slug is stored without checks.
665
- */
666
- interface ProductBlock {
667
- id: number;
668
- productId: number;
669
- slug: string;
670
- data: unknown;
671
- /** Position among the product's blocks with the same slug, from 1. */
672
- order: number;
673
- }
674
-
675
622
  /**
676
623
  * Who sees a new or changed section item:
677
624
  * - `'all'`: every variant.
@@ -732,29 +679,6 @@ interface ProductPageApi {
732
679
  deleteBlock(id: number): Promise<void>;
733
680
  }
734
681
 
735
- type ProductSort = 'price-low-to-high' | 'price-high-to-low' | 'newest' | 'popularity' | 'category';
736
- interface ProductSearchOptions {
737
- /** Free-text search over name and related fields. */
738
- search?: string;
739
- /** Includes sub-categories. */
740
- categoryIds?: readonly number[];
741
- brandIds?: readonly number[];
742
- /** Variant option labels, e.g. ["Blue", "128 GB"]. */
743
- variantLabels?: readonly string[];
744
- /** Specification filters from `filterConfig()`: AND across ids, OR within one id's values. */
745
- specifications?: ReadonlyArray<{
746
- id: number;
747
- values: readonly string[];
748
- }>;
749
- minPrice?: number;
750
- maxPrice?: number;
751
- minDiscountPercent?: number;
752
- minRating?: number;
753
- sortBy?: ProductSort;
754
- /** Default 20. */
755
- limit?: number;
756
- offset?: number;
757
- }
758
682
  interface ProductsApi {
759
683
  /**
760
684
  * The product listing: one item per sellable SKU, only products available on the website.
@@ -811,69 +735,6 @@ interface PromotionsApi {
811
735
  rewardPointSettings(): Promise<RewardPointSettings>;
812
736
  }
813
737
 
814
- /**
815
- * Product review domain types. Built from wire responses in http/reviews.ts.
816
- * Ratings are numbers from 1 to 5 in steps of 0.5 (the backend stores one decimal and sends it
817
- * as a string such as "4.5").
818
- */
819
- /** A review as the backend stores it: what `create()` and `update()` return. */
820
- interface Review {
821
- id: number;
822
- productId: number;
823
- /** The customer who wrote it: compare with the logged-in customer to offer edit and delete. */
824
- customerId: number;
825
- title: string;
826
- message: string | null;
827
- /** URL of the photo attached to the review. */
828
- photo: string | null;
829
- /** Null for old reviews saved without a rating. */
830
- rating: number | null;
831
- /** ISO 8601 timestamp. */
832
- createdAt: string;
833
- }
834
- /** The business's reply to a review. */
835
- interface ReviewReply {
836
- id: number;
837
- message: string;
838
- /** Name of the staff member who replied. */
839
- authorName: string | null;
840
- authorPhoto: string | null;
841
- }
842
- /** A published review, as listed on product pages and the home page. */
843
- interface ReviewListItem extends Review {
844
- productName: string;
845
- /** Full name, or the company name for business customers. */
846
- customerName: string | null;
847
- customerPhoto: string | null;
848
- reply: ReviewReply | null;
849
- }
850
- /** Rating summary of one product. */
851
- interface ReviewSummary {
852
- reviewCount: number;
853
- /** Average of all ratings, rounded to one decimal; 0 without reviews. */
854
- averageRating: number;
855
- /**
856
- * Number of reviews per whole star. Half-star ratings (e.g. 4.5) are counted in no bucket by
857
- * the backend, so these may add up to less than `reviewCount`.
858
- */
859
- starCounts: {
860
- 1: number;
861
- 2: number;
862
- 3: number;
863
- 4: number;
864
- 5: number;
865
- };
866
- }
867
- /** Whether the logged-in customer may review a product. */
868
- type ReviewEligibility = {
869
- canReview: true;
870
- /** The ordered item the review is for: pass it to `reviews.create()`. */
871
- orderProductId: number;
872
- } | {
873
- canReview: false;
874
- orderProductId: null;
875
- };
876
-
877
738
  /**
878
739
  * A file to upload, passed through to the platform's `FormData` untouched: a `File` or `Blob`
879
740
  * on the web, `{ uri, name, type }` in React Native.
@@ -1131,7 +992,7 @@ interface GuestSession {
1131
992
  interface SessionApi {
1132
993
  /**
1133
994
  * Starts a new guest session. Call it when no session is stored, and again when the client
1134
- * reports `onUnauthorized({ kind: 'session' })`. The library stores nothing: keep the token
995
+ * reports `onUnauthorized({ kind: 'session', token })`. The library stores nothing: keep the token
1135
996
  * and return it from `credentials().sessionToken`. There is no logout endpoint.
1136
997
  */
1137
998
  create(): Promise<GuestSession>;
@@ -1165,25 +1026,6 @@ interface LookupApi {
1165
1026
  states(countryCode: string): Promise<CountryState[]>;
1166
1027
  }
1167
1028
 
1168
- /** Customer domain types. Built from wire responses in http/auth.ts and http/customer.ts. */
1169
- /** The logged-in customer's own profile. */
1170
- interface CustomerProfile {
1171
- id: number;
1172
- type: 'individual' | 'business';
1173
- firstName: string | null;
1174
- lastName: string | null;
1175
- email: string | null;
1176
- /** E.164, e.g. "+919876543210". */
1177
- phone: string | null;
1178
- businessName: string | null;
1179
- taxNumber: string | null;
1180
- /** Profile photo URL. */
1181
- photo: string | null;
1182
- isActive: boolean;
1183
- emailVerified: boolean;
1184
- phoneVerified: boolean;
1185
- }
1186
-
1187
1029
  /** Sign-up and login domain types. Built from wire responses in http/auth.ts. */
1188
1030
 
1189
1031
  /**
@@ -1391,58 +1233,6 @@ interface AddressesApi {
1391
1233
  remove(id: number): Promise<void>;
1392
1234
  }
1393
1235
 
1394
- /** The business's order settings: what checkout may offer. */
1395
- interface CheckoutSettings {
1396
- allowCashOnDelivery: boolean;
1397
- /** Customers may cancel their own orders. */
1398
- allowCancellation: boolean;
1399
- /** New orders are accepted without the merchant confirming them. */
1400
- autoAccept: boolean;
1401
- onlineOrdersEnabled: boolean;
1402
- deliveryChargeEnabled: boolean;
1403
- /** Most units of one SKU an individual customer may order. */
1404
- maxQuantityIndividual: number;
1405
- /** Most units of one SKU a business customer may order. */
1406
- maxQuantityBusiness: number;
1407
- }
1408
- /** How a payment is made. Open string: the backend may add methods. */
1409
- type PaymentMethodType = 'razorpay' | 'stripe' | 'phonepe' | 'direct-transfer' | 'cashfree' | 'paytm' | 'upi' | 'cash' | 'swipe-machine' | (string & {});
1410
- /**
1411
- * What is still to pay after placing an order. `method` says which payment SDK the app runs;
1412
- * then it confirms through `client.payments`.
1413
- */
1414
- interface PendingPayment {
1415
- /** Pass this to `client.payments.*`. */
1416
- id: number;
1417
- amount: number;
1418
- method: PaymentMethodType | null;
1419
- /** The provider's public key: Razorpay key id, Stripe publishable key. */
1420
- publicKey: string | null;
1421
- /** The provider's order: Razorpay order id, Stripe PaymentIntent id. */
1422
- providerOrderId: string | null;
1423
- /** Stripe only: the PaymentIntent's client secret for Stripe Elements. */
1424
- clientSecret: string | null;
1425
- /** PhonePe only: the page to send the shopper to. */
1426
- redirectUrl: string | null;
1427
- }
1428
- /**
1429
- * The result of placing an order. `placed` also covers cash on delivery and orders fully paid
1430
- * by gift cards or reward points.
1431
- */
1432
- type PlaceOrderResult = {
1433
- status: 'placed';
1434
- orderId: number;
1435
- } | {
1436
- status: 'payment-required';
1437
- orderId: number;
1438
- payment: PendingPayment;
1439
- };
1440
- /** A made-to-order product's new order and the advance to pay now. */
1441
- interface AdvanceOrder {
1442
- orderId: number;
1443
- payment: PendingPayment;
1444
- }
1445
-
1446
1236
  interface PlaceOrderOptions {
1447
1237
  /**
1448
1238
  * Gift cards to spend, by id (from `promotions.validateGiftCard()`), in this order. Not
@@ -1926,6 +1716,21 @@ interface ReturnRequest {
1926
1716
  }
1927
1717
  /** `replace`: the same SKU again; `exchange`: a sibling SKU of the same product. */
1928
1718
  type ExchangeType = 'replace' | 'exchange';
1719
+ /**
1720
+ * A SKU the shopper can exchange a bought SKU for: an active, in-stock sibling of the same
1721
+ * product (another variant), never the bought SKU itself.
1722
+ */
1723
+ interface ExchangeTargetSku {
1724
+ skuId: number;
1725
+ skuCode: string;
1726
+ /** Product name with the SKU's variants, e.g. "Iphone 15 (256 GB, Blue)". */
1727
+ name: string;
1728
+ /** The SKU's first photo; null when the product has none. */
1729
+ photo: string | null;
1730
+ price: number;
1731
+ /** Always above 0: SKUs out of stock are not offered. */
1732
+ stockQty: number;
1733
+ }
1929
1734
  /** An exchange or replacement request of an order. */
1930
1735
  interface ExchangeListItem {
1931
1736
  id: number;
@@ -2024,6 +1829,13 @@ interface ExchangesApi {
2024
1829
  list(orderId: number): Promise<ExchangeListItem[]>;
2025
1830
  /** One request with its lines. Rejects with a 404 for another customer's request. */
2026
1831
  detail(exchangeId: number): Promise<ExchangeDetail>;
1832
+ /**
1833
+ * The SKUs a bought SKU can be exchanged for (`targetSkuId` in `create`): the product's other
1834
+ * active, in-stock variants. Takes the bought SKU's id (`OrderLine.skuId`), not the order line:
1835
+ * the backend checks no line eligibility, so offer it only for lines with `canExchange`.
1836
+ * Rejects with a 404 when the SKU is unknown or deleted.
1837
+ */
1838
+ targetSkus(skuId: number): Promise<ExchangeTargetSku[]>;
2027
1839
  }
2028
1840
 
2029
1841
  interface Client {
@@ -2060,6 +1872,8 @@ interface Client {
2060
1872
  helpdesk: HelpdeskApi;
2061
1873
  /** Email newsletter sign-up (backend `/subscribers/`). */
2062
1874
  newsletter: NewsletterApi;
1875
+ /** Web push subscriptions; the app does the browser work and passes the subscription in. */
1876
+ push: PushApi;
2063
1877
  liveSupport: LiveSupportApi;
2064
1878
  /** File uploads for custom-manufacturing form fields (logged-in customer). */
2065
1879
  customManufacturing: CustomManufacturingApi;
@@ -2082,26 +1896,5 @@ interface Client {
2082
1896
  */
2083
1897
  declare function createClient(options: ClientOptions): Client;
2084
1898
 
2085
- type ApiErrorKind = 'http' | 'network' | 'timeout' | 'parse';
2086
- /**
2087
- * The single error type every request rejects with, so every app can show the same messages.
2088
- */
2089
- declare class GrowupsellApiError extends Error {
2090
- readonly kind: ApiErrorKind;
2091
- /** HTTP status; undefined when no response arrived (network, timeout). */
2092
- readonly status: number | undefined;
2093
- /** Validation messages per field, as returned by the backend (`non_field_errors` included). */
2094
- readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
2095
- /** The parsed response body, for anything the fields above don't cover. */
2096
- readonly body: unknown;
2097
- constructor(init: {
2098
- kind: ApiErrorKind;
2099
- message: string;
2100
- status?: number;
2101
- fieldErrors?: Record<string, string[]>;
2102
- body?: unknown;
2103
- });
2104
- }
2105
-
2106
- export { GrowupsellApiError as ap, createClient as bO };
2107
- export type { CustomPageHero as $, AddCartItemInput as A, BankTransferOption as B, CancelCodItemsInput as C, ChangePasswordInput as D, CheckoutApi as E, CheckoutSettings as F, Client as G, ClientOptions as H, ConfirmEmailChangeInput as I, ConfirmPhoneChangeInput as J, ContentImage as K, ContentImageUpload as L, ContentImageUsage as M, ContentPlatform as N, Country as O, CountryState as P, CreateAdvanceOrderInput as Q, CreateExchangeInput as R, CreateReturnInput as S, CreateReviewInput as T, CreateSubscriptionInput as U, Credentials as V, Currency as W, CustomManufacturingApi as X, CustomPage as Y, CustomPageContent as Z, CustomPageContentInput as _, Address as a, ProductSectionItem as a$, CustomPageSection as a0, CustomPagesApi as a1, CustomerApi as a2, CustomerProfile as a3, CustomerSettings as a4, DeliveryStatus as a5, DocumentOptions as a6, ExchangeDetail as a7, ExchangeListItem as a8, ExchangeResult as a9, LookupApi as aA, MoveDirection as aB, NewsletterApi as aC, OrderAddress as aD, OrderDetail as aE, OrderLine as aF, OrderListItem as aG, OrderListOptions as aH, OrderPaymentEntry as aI, OrderStatus as aJ, OrderSummary as aK, OrdersApi as aL, PaymentConfirmation as aM, PaymentMethodType as aN, PaymentStatus as aO, PaymentsApi as aP, PendingPayment as aQ, PlaceOrderOptions as aR, PlaceOrderResult as aS, PoliciesApi as aT, Policy as aU, PolicyInput as aV, PolicyType as aW, ProductBlock as aX, ProductPageApi as aY, ProductSearchOptions as aZ, ProductSection as a_, ExchangeType as aa, ExchangesApi as ab, Faq as ac, FaqApi as ad, FaqInput as ae, FetchInitLike as af, FetchLike as ag, FetchResponseLike as ah, FormDataLike as ai, FormField as aj, FormFieldOption as ak, FormFieldType as al, FormSummary as am, FormValue as an, FormsApi as ao, GuestSession as aq, HelpdeskApi as ar, HttpMethod as as, InquiryInput as at, InvoiceFormat as au, InvoicePayment as av, InvoicePaymentStatus as aw, LiveSupportApi as ax, LiveSupportWidget as ay, LoginInput as az, AddressInput as b, ProductSectionItemTarget as b0, ProductSectionItemTargetInput as b1, ProductSort as b2, ProductsApi as b3, PromotionsApi as b4, PublicForm as b5, Query as b6, QueryValue as b7, RazorpayResult as b8, RegisterInput as b9, ThemeContent as bA, ThemeContentApi as bB, ThemeSettings as bC, ThemeSettingsUpdate as bD, TrackingInfo as bE, UnauthorizedEvent as bF, UpdateProfileInput as bG, UpdateReviewInput as bH, UploadFile as bI, UploadedFile as bJ, VerifyOtpInput as bK, Weekday as bL, WishlistApi as bM, WishlistItem as bN, RequestFn as ba, RequestOptions as bb, ResetPasswordInput as bc, ReturnRequest as bd, ReturnStatus as be, ReturnableItem as bf, ReturnsApi as bg, Review as bh, ReviewEligibility as bi, ReviewListItem as bj, ReviewPhoto as bk, ReviewReply as bl, ReviewSummary as bm, ReviewsApi as bn, SessionApi as bo, Shipment as bp, SignedInCustomer as bq, SocialLinks as br, Subscription as bs, SubscriptionDelivery as bt, SubscriptionDeliveryItem as bu, SubscriptionHold as bv, SubscriptionInterval as bw, SubscriptionInvoice as bx, SubscriptionStatus as by, SubscriptionsApi as bz, AddressesApi as c, AdvanceOrder as d, AnyFetch as e, ApiErrorKind as f, AuthApi as g, AuthResult as h, BinaryResponse as i, BlogApi as j, BlogAuthor as k, BlogCategory as l, BlogEditor as m, BlogPost as n, BlogPostSummary as o, Brand as p, Business as q, BusinessApi as r, BusinessMedia as s, BusinessSettings as t, CartAddressesInput as u, CartApi as v, CatalogApi as w, CatalogSettings as x, Category as y, CategoryTree as z };
1899
+ export { createClient as bu };
1900
+ export type { ExchangeDetail as $, AddCartItemInput as A, BankTransferOption as B, CancelCodItemsInput as C, ContentImage as D, ContentImageUpload as E, ContentImageUsage as F, ContentPlatform as G, Country as H, CountryState as I, CreateAdvanceOrderInput as J, CreateExchangeInput as K, CreateReturnInput as L, CreateReviewInput as M, CreateSubscriptionInput as N, Credentials as O, Currency as P, CustomManufacturingApi as Q, CustomPage as R, CustomPageContent as S, CustomPageContentInput as T, CustomPageHero as U, CustomPageSection as V, CustomPagesApi as W, CustomerApi as X, CustomerSettings as Y, DeliveryStatus as Z, DocumentOptions as _, Address as a, ReturnStatus as a$, ExchangeListItem as a0, ExchangeResult as a1, ExchangeTargetSku as a2, ExchangeType as a3, ExchangesApi as a4, Faq as a5, FaqApi as a6, FaqInput as a7, FetchInitLike as a8, FetchLike as a9, OrderPaymentEntry as aA, OrderStatus as aB, OrderSummary as aC, OrdersApi as aD, PaymentConfirmation as aE, PaymentStatus as aF, PaymentsApi as aG, PlaceOrderOptions as aH, PoliciesApi as aI, Policy as aJ, PolicyInput as aK, PolicyType as aL, ProductPageApi as aM, ProductSectionItemTargetInput as aN, ProductsApi as aO, PromotionsApi as aP, PublicForm as aQ, PushApi as aR, PushSubscriptionJson as aS, Query as aT, QueryValue as aU, RazorpayResult as aV, RegisterInput as aW, RequestFn as aX, RequestOptions as aY, ResetPasswordInput as aZ, ReturnRequest as a_, FetchResponseLike as aa, FormDataLike as ab, FormField as ac, FormFieldOption as ad, FormFieldType as ae, FormSummary as af, FormValue as ag, FormsApi as ah, GuestSession as ai, HelpdeskApi as aj, HttpMethod as ak, InquiryInput as al, InvoiceFormat as am, InvoicePayment as an, InvoicePaymentStatus as ao, LiveSupportApi as ap, LiveSupportWidget as aq, LoginInput as ar, LookupApi as as, MoveDirection as at, NewsletterApi as au, OrderAddress as av, OrderDetail as aw, OrderLine as ax, OrderListItem as ay, OrderListOptions as az, AddressInput as b, ReturnableItem as b0, ReturnsApi as b1, ReviewPhoto as b2, ReviewsApi as b3, SessionApi as b4, Shipment as b5, SignedInCustomer as b6, SocialLinks as b7, Subscription as b8, SubscriptionDelivery as b9, SubscriptionDeliveryItem as ba, SubscriptionHold as bb, SubscriptionInterval as bc, SubscriptionInvoice as bd, SubscriptionStatus as be, SubscriptionsApi as bf, ThemeContent as bg, ThemeContentApi as bh, ThemeSettings as bi, ThemeSettingsUpdate as bj, TrackingInfo as bk, UnauthorizedEvent as bl, UpdateProfileInput as bm, UpdateReviewInput as bn, UploadFile as bo, UploadedFile as bp, VerifyOtpInput as bq, Weekday as br, WishlistApi as bs, WishlistItem as bt, AddressesApi as c, AnyFetch as d, AuthApi as e, AuthResult as f, BinaryResponse as g, BlogApi as h, BlogAuthor as i, BlogCategory as j, BlogEditor as k, BlogPost as l, BlogPostSummary as m, Business as n, BusinessApi as o, BusinessMedia as p, BusinessSettings as q, CartAddressesInput as r, CartApi as s, CatalogApi as t, ChangePasswordInput as u, CheckoutApi as v, Client as w, ClientOptions as x, ConfirmEmailChangeInput as y, ConfirmPhoneChangeInput as z };
@@ -1,2 +1,32 @@
1
- export { A as AddCartItemInput, c as AddressesApi, e as AnyFetch, f as ApiErrorKind, g as AuthApi, i as BinaryResponse, j as BlogApi, r as BusinessApi, C as CancelCodItemsInput, u as CartAddressesInput, v as CartApi, w as CatalogApi, D as ChangePasswordInput, E as CheckoutApi, G as Client, H as ClientOptions, I as ConfirmEmailChangeInput, J as ConfirmPhoneChangeInput, L as ContentImageUpload, Q as CreateAdvanceOrderInput, R as CreateExchangeInput, S as CreateReturnInput, T as CreateReviewInput, U as CreateSubscriptionInput, V as Credentials, X as CustomManufacturingApi, _ as CustomPageContentInput, a1 as CustomPagesApi, a2 as CustomerApi, a6 as DocumentOptions, ab as ExchangesApi, ad as FaqApi, ae as FaqInput, af as FetchInitLike, ag as FetchLike, ah as FetchResponseLike, ai as FormDataLike, ao as FormsApi, ap as GrowupsellApiError, ar as HelpdeskApi, as as HttpMethod, at as InquiryInput, ax as LiveSupportApi, az as LoginInput, aA as LookupApi, aB as MoveDirection, aC as NewsletterApi, aH as OrderListOptions, aL as OrdersApi, aP as PaymentsApi, aR as PlaceOrderOptions, aT as PoliciesApi, aV as PolicyInput, aY as ProductPageApi, aZ as ProductSearchOptions, b1 as ProductSectionItemTargetInput, b2 as ProductSort, b3 as ProductsApi, b4 as PromotionsApi, b6 as Query, b7 as QueryValue, b8 as RazorpayResult, b9 as RegisterInput, ba as RequestFn, bb as RequestOptions, bc as ResetPasswordInput, bg as ReturnsApi, bk as ReviewPhoto, bn as ReviewsApi, bo as SessionApi, bz as SubscriptionsApi, bB as ThemeContentApi, bF as UnauthorizedEvent, bG as UpdateProfileInput, bH as UpdateReviewInput, bI as UploadFile, bK as VerifyOtpInput, bM as WishlistApi, bO as createClient } from '../index-tlJ3s67B.js';
2
- import '../promotions-Ck9FZD7h.js';
1
+ export { A as AddCartItemInput, c as AddressesApi, d as AnyFetch, e as AuthApi, g as BinaryResponse, h as BlogApi, o as BusinessApi, C as CancelCodItemsInput, r as CartAddressesInput, s as CartApi, t as CatalogApi, u as ChangePasswordInput, v as CheckoutApi, w as Client, x as ClientOptions, y as ConfirmEmailChangeInput, z as ConfirmPhoneChangeInput, E as ContentImageUpload, J as CreateAdvanceOrderInput, K as CreateExchangeInput, L as CreateReturnInput, M as CreateReviewInput, N as CreateSubscriptionInput, O as Credentials, Q as CustomManufacturingApi, T as CustomPageContentInput, W as CustomPagesApi, X as CustomerApi, _ as DocumentOptions, a4 as ExchangesApi, a6 as FaqApi, a7 as FaqInput, a8 as FetchInitLike, a9 as FetchLike, aa as FetchResponseLike, ab as FormDataLike, ah as FormsApi, aj as HelpdeskApi, ak as HttpMethod, al as InquiryInput, ap as LiveSupportApi, ar as LoginInput, as as LookupApi, at as MoveDirection, au as NewsletterApi, az as OrderListOptions, aD as OrdersApi, aG as PaymentsApi, aH as PlaceOrderOptions, aI as PoliciesApi, aK as PolicyInput, aM as ProductPageApi, aN as ProductSectionItemTargetInput, aO as ProductsApi, aP as PromotionsApi, aR as PushApi, aT as Query, aU as QueryValue, aV as RazorpayResult, aW as RegisterInput, aX as RequestFn, aY as RequestOptions, aZ as ResetPasswordInput, b1 as ReturnsApi, b2 as ReviewPhoto, b3 as ReviewsApi, b4 as SessionApi, bf as SubscriptionsApi, bh as ThemeContentApi, bl as UnauthorizedEvent, bm as UpdateProfileInput, bn as UpdateReviewInput, bo as UploadFile, bq as VerifyOtpInput, bs as WishlistApi, bu as createClient } from '../client-D4JNDM6j.js';
2
+ export { w as ProductSearchOptions, H as ProductSort } from '../checkout-CwpFl6qt.js';
3
+
4
+ type ApiErrorKind = 'http' | 'network' | 'timeout' | 'parse';
5
+ /**
6
+ * The single error type every request rejects with, so every app can show the same messages.
7
+ */
8
+ declare class GrowupsellApiError extends Error {
9
+ readonly kind: ApiErrorKind;
10
+ /** HTTP status; undefined when no response arrived (network, timeout). */
11
+ readonly status: number | undefined;
12
+ /** Validation messages per field, as returned by the backend (`non_field_errors` included). */
13
+ readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
14
+ /** The parsed response body, for anything the fields above don't cover. */
15
+ readonly body: unknown;
16
+ /**
17
+ * For a 429 (throttled OTP checks and sends, backend S14): the seconds from `Retry-After`.
18
+ * Null otherwise, and when the header is missing or not a whole number of seconds.
19
+ */
20
+ readonly retryAfterSeconds: number | null;
21
+ constructor(init: {
22
+ kind: ApiErrorKind;
23
+ message: string;
24
+ status?: number;
25
+ fieldErrors?: Record<string, string[]>;
26
+ body?: unknown;
27
+ retryAfterSeconds?: number | null;
28
+ });
29
+ }
30
+
31
+ export { GrowupsellApiError };
32
+ export type { ApiErrorKind };
@@ -1,7 +1,8 @@
1
+ import "../chunk-NNKXIBK4.js";
1
2
  import {
2
3
  GrowupsellApiError,
3
4
  createClient
4
- } from "../chunk-YZJTPFCH.js";
5
+ } from "../chunk-AI2CWQ22.js";
5
6
  export {
6
7
  GrowupsellApiError,
7
8
  createClient
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
- export { A as AddCartItemInput, a as Address, b as AddressInput, c as AddressesApi, d as AdvanceOrder, e as AnyFetch, f as ApiErrorKind, g as AuthApi, h as AuthResult, B as BankTransferOption, i as BinaryResponse, j as BlogApi, k as BlogAuthor, l as BlogCategory, m as BlogEditor, n as BlogPost, o as BlogPostSummary, p as Brand, q as Business, r as BusinessApi, s as BusinessMedia, t as BusinessSettings, C as CancelCodItemsInput, u as CartAddressesInput, v as CartApi, w as CatalogApi, x as CatalogSettings, y as Category, z as CategoryTree, D as ChangePasswordInput, E as CheckoutApi, F as CheckoutSettings, G as Client, H as ClientOptions, I as ConfirmEmailChangeInput, J as ConfirmPhoneChangeInput, K as ContentImage, L as ContentImageUpload, M as ContentImageUsage, N as ContentPlatform, O as Country, P as CountryState, Q as CreateAdvanceOrderInput, R as CreateExchangeInput, S as CreateReturnInput, T as CreateReviewInput, U as CreateSubscriptionInput, V as Credentials, W as Currency, X as CustomManufacturingApi, Y as CustomPage, Z as CustomPageContent, _ as CustomPageContentInput, $ as CustomPageHero, a0 as CustomPageSection, a1 as CustomPagesApi, a2 as CustomerApi, a3 as CustomerProfile, a4 as CustomerSettings, a5 as DeliveryStatus, a6 as DocumentOptions, a7 as ExchangeDetail, a8 as ExchangeListItem, a9 as ExchangeResult, aa as ExchangeType, ab as ExchangesApi, ac as Faq, ad as FaqApi, ae as FaqInput, af as FetchInitLike, ag as FetchLike, ah as FetchResponseLike, ai as FormDataLike, aj as FormField, ak as FormFieldOption, al as FormFieldType, am as FormSummary, an as FormValue, ao as FormsApi, ap as GrowupsellApiError, aq as GuestSession, ar as HelpdeskApi, as as HttpMethod, at as InquiryInput, au as InvoiceFormat, av as InvoicePayment, aw as InvoicePaymentStatus, ax as LiveSupportApi, ay as LiveSupportWidget, az as LoginInput, aA as LookupApi, aB as MoveDirection, aC as NewsletterApi, aD as OrderAddress, aE as OrderDetail, aF as OrderLine, aG as OrderListItem, aH as OrderListOptions, aI as OrderPaymentEntry, aJ as OrderStatus, aK as OrderSummary, aL as OrdersApi, aM as PaymentConfirmation, aN as PaymentMethodType, aO as PaymentStatus, aP as PaymentsApi, aQ as PendingPayment, aR as PlaceOrderOptions, aS as PlaceOrderResult, aT as PoliciesApi, aU as Policy, aV as PolicyInput, aW as PolicyType, aX as ProductBlock, aY as ProductPageApi, aZ as ProductSearchOptions, a_ as ProductSection, a$ as ProductSectionItem, b0 as ProductSectionItemTarget, b1 as ProductSectionItemTargetInput, b2 as ProductSort, b3 as ProductsApi, b4 as PromotionsApi, b5 as PublicForm, b6 as Query, b7 as QueryValue, b8 as RazorpayResult, b9 as RegisterInput, ba as RequestFn, bb as RequestOptions, bc as ResetPasswordInput, bd as ReturnRequest, be as ReturnStatus, bf as ReturnableItem, bg as ReturnsApi, bh as Review, bi as ReviewEligibility, bj as ReviewListItem, bk as ReviewPhoto, bl as ReviewReply, bm as ReviewSummary, bn as ReviewsApi, bo as SessionApi, bp as Shipment, bq as SignedInCustomer, br as SocialLinks, bs as Subscription, bt as SubscriptionDelivery, bu as SubscriptionDeliveryItem, bv as SubscriptionHold, bw as SubscriptionInterval, bx as SubscriptionInvoice, by as SubscriptionStatus, bz as SubscriptionsApi, bA as ThemeContent, bB as ThemeContentApi, bC as ThemeSettings, bD as ThemeSettingsUpdate, bE as TrackingInfo, bF as UnauthorizedEvent, bG as UpdateProfileInput, bH as UpdateReviewInput, bI as UploadFile, bJ as UploadedFile, bK as VerifyOtpInput, bL as Weekday, bM as WishlistApi, bN as WishlistItem, bO as createClient } from './index-tlJ3s67B.js';
2
- export { CheckoutPreview, CheckoutPreviewInput, PaymentOptions, PaymentOptionsInput, checkoutPreview, discountPercent, giftCardBalance, paymentOptions, requiresShippingAddress, resolveSku, specificationsFor } from './rules/index.js';
3
- export { A as AppliedOffer, a as AppliedPromoCode, C as Cart, b as CartLine, c as CartTotals, D as DeliveryChargeType, d as DeliveryEstimate, F as FulfillmentMode, G as GiftCard, O as Offer, e as OfferScope, f as OrderType, P as Page, g as ProductDetail, h as ProductFilterConfig, i as ProductImage, j as ProductListItem, k as ProductOverview, l as ProductPolicies, m as ProductSku, n as ProductSpecificationGroup, o as PromoCode, R as RewardPointSettings, S as SearchSuggestion, p as SpecificationScope, T as TaxDetails, V as VariantGroup, q as VariantOption } from './promotions-Ck9FZD7h.js';
1
+ export { A as AddCartItemInput, a as Address, b as AddressInput, c as AddressesApi, d as AnyFetch, e as AuthApi, f as AuthResult, B as BankTransferOption, g as BinaryResponse, h as BlogApi, i as BlogAuthor, j as BlogCategory, k as BlogEditor, l as BlogPost, m as BlogPostSummary, n as Business, o as BusinessApi, p as BusinessMedia, q as BusinessSettings, C as CancelCodItemsInput, r as CartAddressesInput, s as CartApi, t as CatalogApi, u as ChangePasswordInput, v as CheckoutApi, w as Client, x as ClientOptions, y as ConfirmEmailChangeInput, z as ConfirmPhoneChangeInput, D as ContentImage, E as ContentImageUpload, F as ContentImageUsage, G as ContentPlatform, H as Country, I as CountryState, J as CreateAdvanceOrderInput, K as CreateExchangeInput, L as CreateReturnInput, M as CreateReviewInput, N as CreateSubscriptionInput, O as Credentials, P as Currency, Q as CustomManufacturingApi, R as CustomPage, S as CustomPageContent, T as CustomPageContentInput, U as CustomPageHero, V as CustomPageSection, W as CustomPagesApi, X as CustomerApi, Y as CustomerSettings, Z as DeliveryStatus, _ as DocumentOptions, $ as ExchangeDetail, a0 as ExchangeListItem, a1 as ExchangeResult, a2 as ExchangeTargetSku, a3 as ExchangeType, a4 as ExchangesApi, a5 as Faq, a6 as FaqApi, a7 as FaqInput, a8 as FetchInitLike, a9 as FetchLike, aa as FetchResponseLike, ab as FormDataLike, ac as FormField, ad as FormFieldOption, ae as FormFieldType, af as FormSummary, ag as FormValue, ah as FormsApi, ai as GuestSession, aj as HelpdeskApi, ak as HttpMethod, al as InquiryInput, am as InvoiceFormat, an as InvoicePayment, ao as InvoicePaymentStatus, ap as LiveSupportApi, aq as LiveSupportWidget, ar as LoginInput, as as LookupApi, at as MoveDirection, au as NewsletterApi, av as OrderAddress, aw as OrderDetail, ax as OrderLine, ay as OrderListItem, az as OrderListOptions, aA as OrderPaymentEntry, aB as OrderStatus, aC as OrderSummary, aD as OrdersApi, aE as PaymentConfirmation, aF as PaymentStatus, aG as PaymentsApi, aH as PlaceOrderOptions, aI as PoliciesApi, aJ as Policy, aK as PolicyInput, aL as PolicyType, aM as ProductPageApi, aN as ProductSectionItemTargetInput, aO as ProductsApi, aP as PromotionsApi, aQ as PublicForm, aR as PushApi, aS as PushSubscriptionJson, aT as Query, aU as QueryValue, aV as RazorpayResult, aW as RegisterInput, aX as RequestFn, aY as RequestOptions, aZ as ResetPasswordInput, a_ as ReturnRequest, a$ as ReturnStatus, b0 as ReturnableItem, b1 as ReturnsApi, b2 as ReviewPhoto, b3 as ReviewsApi, b4 as SessionApi, b5 as Shipment, b6 as SignedInCustomer, b7 as SocialLinks, b8 as Subscription, b9 as SubscriptionDelivery, ba as SubscriptionDeliveryItem, bb as SubscriptionHold, bc as SubscriptionInterval, bd as SubscriptionInvoice, be as SubscriptionStatus, bf as SubscriptionsApi, bg as ThemeContent, bh as ThemeContentApi, bi as ThemeSettings, bj as ThemeSettingsUpdate, bk as TrackingInfo, bl as UnauthorizedEvent, bm as UpdateProfileInput, bn as UpdateReviewInput, bo as UploadFile, bp as UploadedFile, bq as VerifyOtpInput, br as Weekday, bs as WishlistApi, bt as WishlistItem, bu as createClient } from './client-D4JNDM6j.js';
2
+ export { ApiErrorKind, GrowupsellApiError } from './http/index.js';
3
+ export { DEFAULT_LISTING_CRITERIA, JsonLd, LISTING_PAGE_SIZE, PageMetadata, ProductPricing, ProductPurchase, ProductPurchaseInput, PurchaseLimit, PurchaseLimitInput, PurchaseMode, RatingBreakdownRow, VariantSelection, absoluteUrl, articleJsonLd, breadcrumbJsonLd, categoryAndDescendants, discountPercent, faqJsonLd, faqsFromSections, formatSelectedVariants, htmlToText, imagesFor, instagramEmbedUrl, isEmail, isOtp, isPhone, isVideoFileUrl, listingQuery, listingSearchOptions, organizationJsonLd, pageMetadata, parseListingQuery, parseSelectedVariants, productJsonLd, productPricing, productPurchase, promoCodeStatus, purchaseLimit, purchaseMode, quantityLimitFor, ratingBreakdown, roundToHalfStar, sectionItemsFor, serializeJsonLd, siteOrigin, slugify, specificationsFor, toE164, truncateText, videoEmbed, webSiteJsonLd, withCategory, youtubeEmbedUrl, youtubeThumbnailUrl, youtubeVideoId, youtubeWatchUrl } from './rules/index.js';
4
+ export { C as CheckoutPreview, a as CheckoutPreviewInput, L as ListingCriteria, b as ListingQuery, P as PaymentOptions, c as PaymentOptionsInput, V as VariantChoice, d as checkoutPreview, e as defaultSelection, g as giftCardBalance, i as isSelectionComplete, p as paymentOptions, r as requiresShippingAddress, f as resolveSku, s as selectOption, h as sellableSkus, v as variantChoices } from './sku-C3SGyRqT.js';
5
+ export { ActionResult, AuthOutcome, AuthState, AuthStore, BusinessSection, BusinessState, BusinessStore, CartDeliveryState, CartLinePending, CartPending, CartState, CartStore, CatalogState, CatalogStore, CheckoutOrder, CheckoutPhase, CheckoutState, CheckoutStore, EventBus, GrowupsellEvent, GrowupsellStores, GrowupsellStoresOptions, Identity, ListingFacets, ListingInput, ListingQueryInput, ListingState, ListingStore, LoadStatus, ProductDetailInput, ProductDetailState, ProductDetailStore, REFERRAL_TTL_MS, ReferralState, ReferralStore, SearchSuggestionsOptions, SearchSuggestionsState, SearchSuggestionsStore, SessionState, SessionStore, StorageAdapter, Store, StoreError, StoreErrorKind, StoreSeeds, ThemeConfigState, ThemeConfigStore, ThemeSectionState, WishlistState, WishlistStore, cartItemCount, cartLineForSku, checkoutPreviewFor, createGrowupsellStores, createMemoryStorage, isInWishlist, paymentOptionsFor } from './stores/index.js';
6
+ export { A as AdvanceOrder, a as AppliedOffer, b as AppliedPromoCode, B as Brand, C as Cart, c as CartLine, d as CartTotals, e as CatalogSettings, f as Category, g as CategoryTree, h as CheckoutSettings, i as CustomerProfile, D as DeliveryChargeType, j as DeliveryEstimate, F as FulfillmentMode, G as GiftCard, O as Offer, k as OfferScope, l as OrderType, P as Page, m as PaymentMethodType, n as PendingPayment, o as PlaceOrderResult, p as ProductBlock, q as ProductDetail, r as ProductFilterConfig, s as ProductImage, t as ProductListItem, u as ProductOverview, v as ProductPolicies, w as ProductSearchOptions, x as ProductSection, y as ProductSectionItem, z as ProductSectionItemTarget, E as ProductSku, H as ProductSort, I as ProductSpecificationGroup, J as PromoCode, R as Review, K as ReviewEligibility, L as ReviewListItem, M as ReviewReply, N as ReviewSummary, Q as RewardPointSettings, S as SearchSuggestion, T as SpecificationScope, U as TaxDetails, V as VariantGroup, W as VariantOption } from './checkout-CwpFl6qt.js';