@behio/storefront-sdk 1.3.0 → 1.5.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.
@@ -143,6 +143,7 @@ var BehioStorefront = class {
143
143
  this.timeout = config.timeout ?? 3e4;
144
144
  this.retries = config.retries ?? 1;
145
145
  this.retryDelay = config.retryDelay ?? 1e3;
146
+ this.visitorIp = config.visitorIp;
146
147
  this.catalog = new CatalogModule(this);
147
148
  this.auth = new AuthModule(this);
148
149
  this.cart = new CartModule(this);
@@ -174,6 +175,15 @@ var BehioStorefront = class {
174
175
  getAnalyticsVisitorId() {
175
176
  return this.analyticsVisitorId;
176
177
  }
178
+ /**
179
+ * Set (or clear with null) the real visitor IP forwarded as
180
+ * X-Behio-Visitor-Ip on server-side requests. See
181
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
182
+ * automatically for per-request clients.
183
+ */
184
+ setVisitorIp(ip) {
185
+ this.visitorIp = ip ?? void 0;
186
+ }
177
187
  /**
178
188
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
179
189
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -439,6 +449,13 @@ var BehioStorefront = class {
439
449
  if (this.analyticsVisitorId) {
440
450
  headers["X-Behio-Vid"] = this.analyticsVisitorId;
441
451
  }
452
+ if (this.visitorIp) {
453
+ try {
454
+ const ip = typeof this.visitorIp === "function" ? await this.visitorIp() : this.visitorIp;
455
+ if (ip) headers["X-Behio-Visitor-Ip"] = ip;
456
+ } catch {
457
+ }
458
+ }
442
459
  if (options?.headers) {
443
460
  Object.assign(headers, options.headers);
444
461
  }
@@ -597,6 +614,15 @@ var CatalogModule = class {
597
614
  }
598
615
  );
599
616
  }
617
+ /**
618
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
619
+ * (see `Sitemap`). Added in SDK 1.4.0.
620
+ */
621
+ async getSitemap(locale) {
622
+ return this.client.request("GET", "/catalog/sitemap", {
623
+ query: { locale }
624
+ });
625
+ }
600
626
  /** Get category tree */
601
627
  async getCategories(locale) {
602
628
  const res = await this.client.request("GET", "/catalog/categories", { query: { locale } });
@@ -143,6 +143,7 @@ var BehioStorefront = class {
143
143
  this.timeout = _nullishCoalesce(config.timeout, () => ( 3e4));
144
144
  this.retries = _nullishCoalesce(config.retries, () => ( 1));
145
145
  this.retryDelay = _nullishCoalesce(config.retryDelay, () => ( 1e3));
146
+ this.visitorIp = config.visitorIp;
146
147
  this.catalog = new CatalogModule(this);
147
148
  this.auth = new AuthModule(this);
148
149
  this.cart = new CartModule(this);
@@ -174,6 +175,15 @@ var BehioStorefront = class {
174
175
  getAnalyticsVisitorId() {
175
176
  return this.analyticsVisitorId;
176
177
  }
178
+ /**
179
+ * Set (or clear with null) the real visitor IP forwarded as
180
+ * X-Behio-Visitor-Ip on server-side requests. See
181
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
182
+ * automatically for per-request clients.
183
+ */
184
+ setVisitorIp(ip) {
185
+ this.visitorIp = _nullishCoalesce(ip, () => ( void 0));
186
+ }
177
187
  /**
178
188
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
179
189
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -439,6 +449,13 @@ var BehioStorefront = class {
439
449
  if (this.analyticsVisitorId) {
440
450
  headers["X-Behio-Vid"] = this.analyticsVisitorId;
441
451
  }
452
+ if (this.visitorIp) {
453
+ try {
454
+ const ip = typeof this.visitorIp === "function" ? await this.visitorIp() : this.visitorIp;
455
+ if (ip) headers["X-Behio-Visitor-Ip"] = ip;
456
+ } catch (e4) {
457
+ }
458
+ }
442
459
  if (_optionalChain([options, 'optionalAccess', _14 => _14.headers])) {
443
460
  Object.assign(headers, options.headers);
444
461
  }
@@ -516,7 +533,7 @@ var BehioStorefront = class {
516
533
  ...options,
517
534
  _isRetryAfterRefresh: true
518
535
  });
519
- } catch (e4) {
536
+ } catch (e5) {
520
537
  this.emit("error", apiError);
521
538
  throw apiError;
522
539
  }
@@ -538,7 +555,7 @@ var BehioStorefront = class {
538
555
  data: responseData,
539
556
  headers: res.headers
540
557
  });
541
- } catch (e5) {
558
+ } catch (e6) {
542
559
  }
543
560
  }
544
561
  return responseData;
@@ -597,6 +614,15 @@ var CatalogModule = class {
597
614
  }
598
615
  );
599
616
  }
617
+ /**
618
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
619
+ * (see `Sitemap`). Added in SDK 1.4.0.
620
+ */
621
+ async getSitemap(locale) {
622
+ return this.client.request("GET", "/catalog/sitemap", {
623
+ query: { locale }
624
+ });
625
+ }
600
626
  /** Get category tree */
601
627
  async getCategories(locale) {
602
628
  const res = await this.client.request("GET", "/catalog/categories", { query: { locale } });
@@ -17,6 +17,18 @@ interface BehioStorefrontConfig {
17
17
  currency?: string;
18
18
  /** Custom fetch implementation (for Node.js < 18 or testing) */
19
19
  fetch?: typeof fetch;
20
+ /**
21
+ * Real visitor IP for server-side rendering. Sent as X-Behio-Visitor-Ip so
22
+ * the backend rate-limits per visitor instead of per server: all SSR
23
+ * requests of one deployment share the server's IP, so without this header
24
+ * the whole shop shares one rate-limit bucket. The backend only trusts the
25
+ * header from allow-listed hosting IPs, so a browser sending it gains
26
+ * nothing. Accepts a fixed string or a resolver called per request (use a
27
+ * resolver for a shared catalog client that serves many concurrent
28
+ * requests). The Next.js adapter (`@behio/storefront-sdk/next`) fills this
29
+ * automatically from the incoming request headers.
30
+ */
31
+ visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
20
32
  /** Request timeout in milliseconds. Default: 30000 (30s) */
21
33
  timeout?: number;
22
34
  /** Number of retries on network/5xx errors. Default: 1 */
@@ -675,6 +687,21 @@ interface ProductDetail extends ProductListItem {
675
687
  */
676
688
  parameterGroups: ProductParameterGroup[];
677
689
  seo: {
690
+ /**
691
+ * Slug of the page that should be canonical INSTEAD of this one. Empty
692
+ * means the page is canonical to itself.
693
+ *
694
+ * Only ever filled on a colour card in a shop whose merchant chose that
695
+ * one product page represents the product in search (catalog split
696
+ * indexing = PARENT_PAGE). Added in SDK 1.4.0.
697
+ */
698
+ canonicalSlug?: string | null;
699
+ /**
700
+ * `true` = render `noindex, follow`. Set on a parent product that colour
701
+ * cards have taken over, so it stops competing with its own cards.
702
+ * Added in SDK 1.4.0.
703
+ */
704
+ noIndex?: boolean;
678
705
  title?: string | null;
679
706
  description?: string | null;
680
707
  keywords?: string | null;
@@ -2207,6 +2234,28 @@ interface SubmitQuoteInput {
2207
2234
  requestedPrice?: number;
2208
2235
  }[];
2209
2236
  }
2237
+ /** One URL for the sitemap. Added in SDK 1.4.0. */
2238
+ interface SitemapEntry {
2239
+ /** Slug without any prefix; the template builds the path. */
2240
+ slug: string;
2241
+ /** Last change (epoch ms) for `lastmod`. */
2242
+ updatedAt: number;
2243
+ }
2244
+ /**
2245
+ * Everything the shop wants search engines to crawl, already filtered by the
2246
+ * merchant's indexing choice. Added in SDK 1.4.0.
2247
+ *
2248
+ * Build the sitemap from THIS, not from `getProducts`: which page belongs in
2249
+ * the index is a catalog rule (a product split into colour cards publishes
2250
+ * either the cards or the parent, never both), and a template that lists
2251
+ * `getProducts` gets it wrong the moment the merchant changes the setting.
2252
+ */
2253
+ interface Sitemap {
2254
+ locale: string;
2255
+ products: SitemapEntry[];
2256
+ categories: SitemapEntry[];
2257
+ pages: SitemapEntry[];
2258
+ }
2210
2259
 
2211
2260
  declare class BehioStorefront {
2212
2261
  private baseUrl;
@@ -2230,6 +2279,7 @@ declare class BehioStorefront {
2230
2279
  private responseInterceptors;
2231
2280
  private rateLimitRemaining;
2232
2281
  private rateLimitReset;
2282
+ private visitorIp?;
2233
2283
  constructor(config: BehioStorefrontConfig);
2234
2284
  readonly catalog: CatalogModule;
2235
2285
  readonly auth: AuthModule;
@@ -2256,6 +2306,13 @@ declare class BehioStorefront {
2256
2306
  setAnalyticsVisitorId(id: string | null): void;
2257
2307
  /** The consent-gated visitor id, if analytics consent was granted. */
2258
2308
  getAnalyticsVisitorId(): string | null;
2309
+ /**
2310
+ * Set (or clear with null) the real visitor IP forwarded as
2311
+ * X-Behio-Visitor-Ip on server-side requests. See
2312
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
2313
+ * automatically for per-request clients.
2314
+ */
2315
+ setVisitorIp(ip: string | null): void;
2259
2316
  /**
2260
2317
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
2261
2318
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -2402,6 +2459,11 @@ declare class CatalogModule {
2402
2459
  locale?: string;
2403
2460
  currency?: string;
2404
2461
  }): Promise<SdkResult<ProductDetail>>;
2462
+ /**
2463
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
2464
+ * (see `Sitemap`). Added in SDK 1.4.0.
2465
+ */
2466
+ getSitemap(locale?: string): Promise<SdkResult<Sitemap>>;
2405
2467
  /** Get category tree */
2406
2468
  getCategories(locale?: string): Promise<SdkResult<{
2407
2469
  categories: Category[];
@@ -2965,4 +3027,4 @@ declare class NewsletterModule {
2965
3027
  unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
2966
3028
  }
2967
3029
 
2968
- export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParametersResponse as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAvailability as aT, type ProductGroup as aU, type ProductLabel as aV, type ProductListItem as aW, type ProductMedia as aX, type ProductMediaVariant as aY, type ProductParameter as aZ, type ProductParameterGroup as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductPrice as b0, type ProductPromotionSummary as b1, type ProductReview as b2, type ProductReviewsResponse as b3, type ProductSibling as b4, ProductSort as b5, type ProductSortValue as b6, type ProductVolumePrice as b7, type ProductsQuery as b8, type QuizAnswerInput as b9, type ShopSeo as bA, type ShopSeoIdentity as bB, type StockBehavior as bC, type StockMode as bD, type SubmitQuoteInput as bE, type SubmitReturnInput as bF, type SubmitReviewInput as bG, type Subscription as bH, type SubscriptionAction as bI, type SubscriptionFrequency as bJ, type SubscriptionItem as bK, type SubscriptionStatus as bL, type TaxBreakdownLine as bM, type VariantAxis as bN, type VariantAxisValue as bO, type WishlistItem as bP, err as bQ, ok as bR, toSdkError as bS, type QuizAnswerResult as ba, type QuizQuestion as bb, type QuizResult as bc, type QuoteItem as bd, type QuoteRequest as be, type RegisterInput as bf, type RegisterResult as bg, type RequestInterceptor as bh, type RequestInterceptorConfig as bi, type ResponseInterceptor as bj, type ResponseInterceptorData as bk, type ReturnRequest as bl, type ReturnRequestItem as bm, type ReturnStatus as bn, type ReturnStatusItem as bo, type ReturnableOrder as bp, type ReturnableOrderItem as bq, type SdkError as br, type ShippingMethodSummary as bs, type ShippingQuote as bt, type ShippingQuoteInput as bu, type ShopInfo as bv, type ShopScript as bw, type ShopScriptPlacement as bx, type ShopScriptType as by, type ShopScripts as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail as z };
3030
+ export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParametersResponse as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAvailability as aT, type ProductGroup as aU, type ProductLabel as aV, type ProductListItem as aW, type ProductMedia as aX, type ProductMediaVariant as aY, type ProductParameter as aZ, type ProductParameterGroup as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductPrice as b0, type ProductPromotionSummary as b1, type ProductReview as b2, type ProductReviewsResponse as b3, type ProductSibling as b4, ProductSort as b5, type ProductSortValue as b6, type ProductVolumePrice as b7, type ProductsQuery as b8, type QuizAnswerInput as b9, type ShopSeo as bA, type ShopSeoIdentity as bB, type Sitemap as bC, type SitemapEntry as bD, type StockBehavior as bE, type StockMode as bF, type SubmitQuoteInput as bG, type SubmitReturnInput as bH, type SubmitReviewInput as bI, type Subscription as bJ, type SubscriptionAction as bK, type SubscriptionFrequency as bL, type SubscriptionItem as bM, type SubscriptionStatus as bN, type TaxBreakdownLine as bO, type VariantAxis as bP, type VariantAxisValue as bQ, type WishlistItem as bR, err as bS, ok as bT, toSdkError as bU, type QuizAnswerResult as ba, type QuizQuestion as bb, type QuizResult as bc, type QuoteItem as bd, type QuoteRequest as be, type RegisterInput as bf, type RegisterResult as bg, type RequestInterceptor as bh, type RequestInterceptorConfig as bi, type ResponseInterceptor as bj, type ResponseInterceptorData as bk, type ReturnRequest as bl, type ReturnRequestItem as bm, type ReturnStatus as bn, type ReturnStatusItem as bo, type ReturnableOrder as bp, type ReturnableOrderItem as bq, type SdkError as br, type ShippingMethodSummary as bs, type ShippingQuote as bt, type ShippingQuoteInput as bu, type ShopInfo as bv, type ShopScript as bw, type ShopScriptPlacement as bx, type ShopScriptType as by, type ShopScripts as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail as z };
@@ -17,6 +17,18 @@ interface BehioStorefrontConfig {
17
17
  currency?: string;
18
18
  /** Custom fetch implementation (for Node.js < 18 or testing) */
19
19
  fetch?: typeof fetch;
20
+ /**
21
+ * Real visitor IP for server-side rendering. Sent as X-Behio-Visitor-Ip so
22
+ * the backend rate-limits per visitor instead of per server: all SSR
23
+ * requests of one deployment share the server's IP, so without this header
24
+ * the whole shop shares one rate-limit bucket. The backend only trusts the
25
+ * header from allow-listed hosting IPs, so a browser sending it gains
26
+ * nothing. Accepts a fixed string or a resolver called per request (use a
27
+ * resolver for a shared catalog client that serves many concurrent
28
+ * requests). The Next.js adapter (`@behio/storefront-sdk/next`) fills this
29
+ * automatically from the incoming request headers.
30
+ */
31
+ visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
20
32
  /** Request timeout in milliseconds. Default: 30000 (30s) */
21
33
  timeout?: number;
22
34
  /** Number of retries on network/5xx errors. Default: 1 */
@@ -675,6 +687,21 @@ interface ProductDetail extends ProductListItem {
675
687
  */
676
688
  parameterGroups: ProductParameterGroup[];
677
689
  seo: {
690
+ /**
691
+ * Slug of the page that should be canonical INSTEAD of this one. Empty
692
+ * means the page is canonical to itself.
693
+ *
694
+ * Only ever filled on a colour card in a shop whose merchant chose that
695
+ * one product page represents the product in search (catalog split
696
+ * indexing = PARENT_PAGE). Added in SDK 1.4.0.
697
+ */
698
+ canonicalSlug?: string | null;
699
+ /**
700
+ * `true` = render `noindex, follow`. Set on a parent product that colour
701
+ * cards have taken over, so it stops competing with its own cards.
702
+ * Added in SDK 1.4.0.
703
+ */
704
+ noIndex?: boolean;
678
705
  title?: string | null;
679
706
  description?: string | null;
680
707
  keywords?: string | null;
@@ -2207,6 +2234,28 @@ interface SubmitQuoteInput {
2207
2234
  requestedPrice?: number;
2208
2235
  }[];
2209
2236
  }
2237
+ /** One URL for the sitemap. Added in SDK 1.4.0. */
2238
+ interface SitemapEntry {
2239
+ /** Slug without any prefix; the template builds the path. */
2240
+ slug: string;
2241
+ /** Last change (epoch ms) for `lastmod`. */
2242
+ updatedAt: number;
2243
+ }
2244
+ /**
2245
+ * Everything the shop wants search engines to crawl, already filtered by the
2246
+ * merchant's indexing choice. Added in SDK 1.4.0.
2247
+ *
2248
+ * Build the sitemap from THIS, not from `getProducts`: which page belongs in
2249
+ * the index is a catalog rule (a product split into colour cards publishes
2250
+ * either the cards or the parent, never both), and a template that lists
2251
+ * `getProducts` gets it wrong the moment the merchant changes the setting.
2252
+ */
2253
+ interface Sitemap {
2254
+ locale: string;
2255
+ products: SitemapEntry[];
2256
+ categories: SitemapEntry[];
2257
+ pages: SitemapEntry[];
2258
+ }
2210
2259
 
2211
2260
  declare class BehioStorefront {
2212
2261
  private baseUrl;
@@ -2230,6 +2279,7 @@ declare class BehioStorefront {
2230
2279
  private responseInterceptors;
2231
2280
  private rateLimitRemaining;
2232
2281
  private rateLimitReset;
2282
+ private visitorIp?;
2233
2283
  constructor(config: BehioStorefrontConfig);
2234
2284
  readonly catalog: CatalogModule;
2235
2285
  readonly auth: AuthModule;
@@ -2256,6 +2306,13 @@ declare class BehioStorefront {
2256
2306
  setAnalyticsVisitorId(id: string | null): void;
2257
2307
  /** The consent-gated visitor id, if analytics consent was granted. */
2258
2308
  getAnalyticsVisitorId(): string | null;
2309
+ /**
2310
+ * Set (or clear with null) the real visitor IP forwarded as
2311
+ * X-Behio-Visitor-Ip on server-side requests. See
2312
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
2313
+ * automatically for per-request clients.
2314
+ */
2315
+ setVisitorIp(ip: string | null): void;
2259
2316
  /**
2260
2317
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
2261
2318
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -2402,6 +2459,11 @@ declare class CatalogModule {
2402
2459
  locale?: string;
2403
2460
  currency?: string;
2404
2461
  }): Promise<SdkResult<ProductDetail>>;
2462
+ /**
2463
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
2464
+ * (see `Sitemap`). Added in SDK 1.4.0.
2465
+ */
2466
+ getSitemap(locale?: string): Promise<SdkResult<Sitemap>>;
2405
2467
  /** Get category tree */
2406
2468
  getCategories(locale?: string): Promise<SdkResult<{
2407
2469
  categories: Category[];
@@ -2965,4 +3027,4 @@ declare class NewsletterModule {
2965
3027
  unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
2966
3028
  }
2967
3029
 
2968
- export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParametersResponse as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAvailability as aT, type ProductGroup as aU, type ProductLabel as aV, type ProductListItem as aW, type ProductMedia as aX, type ProductMediaVariant as aY, type ProductParameter as aZ, type ProductParameterGroup as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductPrice as b0, type ProductPromotionSummary as b1, type ProductReview as b2, type ProductReviewsResponse as b3, type ProductSibling as b4, ProductSort as b5, type ProductSortValue as b6, type ProductVolumePrice as b7, type ProductsQuery as b8, type QuizAnswerInput as b9, type ShopSeo as bA, type ShopSeoIdentity as bB, type StockBehavior as bC, type StockMode as bD, type SubmitQuoteInput as bE, type SubmitReturnInput as bF, type SubmitReviewInput as bG, type Subscription as bH, type SubscriptionAction as bI, type SubscriptionFrequency as bJ, type SubscriptionItem as bK, type SubscriptionStatus as bL, type TaxBreakdownLine as bM, type VariantAxis as bN, type VariantAxisValue as bO, type WishlistItem as bP, err as bQ, ok as bR, toSdkError as bS, type QuizAnswerResult as ba, type QuizQuestion as bb, type QuizResult as bc, type QuoteItem as bd, type QuoteRequest as be, type RegisterInput as bf, type RegisterResult as bg, type RequestInterceptor as bh, type RequestInterceptorConfig as bi, type ResponseInterceptor as bj, type ResponseInterceptorData as bk, type ReturnRequest as bl, type ReturnRequestItem as bm, type ReturnStatus as bn, type ReturnStatusItem as bo, type ReturnableOrder as bp, type ReturnableOrderItem as bq, type SdkError as br, type ShippingMethodSummary as bs, type ShippingQuote as bt, type ShippingQuoteInput as bu, type ShopInfo as bv, type ShopScript as bw, type ShopScriptPlacement as bx, type ShopScriptType as by, type ShopScripts as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail as z };
3030
+ export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParametersResponse as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAvailability as aT, type ProductGroup as aU, type ProductLabel as aV, type ProductListItem as aW, type ProductMedia as aX, type ProductMediaVariant as aY, type ProductParameter as aZ, type ProductParameterGroup as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductPrice as b0, type ProductPromotionSummary as b1, type ProductReview as b2, type ProductReviewsResponse as b3, type ProductSibling as b4, ProductSort as b5, type ProductSortValue as b6, type ProductVolumePrice as b7, type ProductsQuery as b8, type QuizAnswerInput as b9, type ShopSeo as bA, type ShopSeoIdentity as bB, type Sitemap as bC, type SitemapEntry as bD, type StockBehavior as bE, type StockMode as bF, type SubmitQuoteInput as bG, type SubmitReturnInput as bH, type SubmitReviewInput as bI, type Subscription as bJ, type SubscriptionAction as bK, type SubscriptionFrequency as bL, type SubscriptionItem as bM, type SubscriptionStatus as bN, type TaxBreakdownLine as bO, type VariantAxis as bP, type VariantAxisValue as bQ, type WishlistItem as bR, err as bS, ok as bT, toSdkError as bU, type QuizAnswerResult as ba, type QuizQuestion as bb, type QuizResult as bc, type QuoteItem as bd, type QuoteRequest as be, type RegisterInput as bf, type RegisterResult as bg, type RequestInterceptor as bh, type RequestInterceptorConfig as bi, type ResponseInterceptor as bj, type ResponseInterceptorData as bk, type ReturnRequest as bl, type ReturnRequestItem as bm, type ReturnStatus as bn, type ReturnStatusItem as bo, type ReturnableOrder as bp, type ReturnableOrderItem as bq, type SdkError as br, type ShippingMethodSummary as bs, type ShippingQuote as bt, type ShippingQuoteInput as bu, type ShopInfo as bv, type ShopScript as bw, type ShopScriptPlacement as bx, type ShopScriptType as by, type ShopScripts as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-DNT6UaEI.mjs';
2
- export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAvailability, aU as ProductGroup, aV as ProductLabel, aW as ProductListItem, aX as ProductMedia, aY as ProductMediaVariant, aZ as ProductParameter, a_ as ProductParameterGroup, a$ as ProductParametersResponse, b0 as ProductPrice, b1 as ProductPromotionSummary, b2 as ProductReview, b3 as ProductReviewsResponse, b4 as ProductSibling, b5 as ProductSort, b6 as ProductSortValue, b7 as ProductVolumePrice, b8 as ProductsQuery, b9 as QuizAnswerInput, ba as QuizAnswerResult, bb as QuizQuestion, bc as QuizResult, bd as QuoteItem, be as QuoteRequest, bf as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, bl as ReturnRequest, bm as ReturnRequestItem, bn as ReturnStatus, bo as ReturnStatusItem, bp as ReturnableOrder, bq as ReturnableOrderItem, br as SdkError, bs as ShippingMethodSummary, bt as ShippingQuote, bu as ShippingQuoteInput, bv as ShopInfo, bw as ShopScript, bx as ShopScriptPlacement, by as ShopScriptType, bz as ShopScripts, bA as ShopSeo, bB as ShopSeoIdentity, bC as StockBehavior, bD as StockMode, bE as SubmitQuoteInput, bF as SubmitReturnInput, bG as SubmitReviewInput, bH as Subscription, bI as SubscriptionAction, bJ as SubscriptionFrequency, bK as SubscriptionItem, bL as SubscriptionStatus, bM as TaxBreakdownLine, bN as VariantAxis, bO as VariantAxisValue, bP as WishlistItem, bQ as err, bR as ok, bS as toSdkError } from './client-DNT6UaEI.mjs';
1
+ import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-LetSVGM1.mjs';
2
+ export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAvailability, aU as ProductGroup, aV as ProductLabel, aW as ProductListItem, aX as ProductMedia, aY as ProductMediaVariant, aZ as ProductParameter, a_ as ProductParameterGroup, a$ as ProductParametersResponse, b0 as ProductPrice, b1 as ProductPromotionSummary, b2 as ProductReview, b3 as ProductReviewsResponse, b4 as ProductSibling, b5 as ProductSort, b6 as ProductSortValue, b7 as ProductVolumePrice, b8 as ProductsQuery, b9 as QuizAnswerInput, ba as QuizAnswerResult, bb as QuizQuestion, bc as QuizResult, bd as QuoteItem, be as QuoteRequest, bf as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, bl as ReturnRequest, bm as ReturnRequestItem, bn as ReturnStatus, bo as ReturnStatusItem, bp as ReturnableOrder, bq as ReturnableOrderItem, br as SdkError, bs as ShippingMethodSummary, bt as ShippingQuote, bu as ShippingQuoteInput, bv as ShopInfo, bw as ShopScript, bx as ShopScriptPlacement, by as ShopScriptType, bz as ShopScripts, bA as ShopSeo, bB as ShopSeoIdentity, bC as Sitemap, bD as SitemapEntry, bE as StockBehavior, bF as StockMode, bG as SubmitQuoteInput, bH as SubmitReturnInput, bI as SubmitReviewInput, bJ as Subscription, bK as SubscriptionAction, bL as SubscriptionFrequency, bM as SubscriptionItem, bN as SubscriptionStatus, bO as TaxBreakdownLine, bP as VariantAxis, bQ as VariantAxisValue, bR as WishlistItem, bS as err, bT as ok, bU as toSdkError } from './client-LetSVGM1.mjs';
3
3
 
4
4
  /**
5
5
  * Format a price amount with currency using Intl.NumberFormat.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-DNT6UaEI.js';
2
- export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAvailability, aU as ProductGroup, aV as ProductLabel, aW as ProductListItem, aX as ProductMedia, aY as ProductMediaVariant, aZ as ProductParameter, a_ as ProductParameterGroup, a$ as ProductParametersResponse, b0 as ProductPrice, b1 as ProductPromotionSummary, b2 as ProductReview, b3 as ProductReviewsResponse, b4 as ProductSibling, b5 as ProductSort, b6 as ProductSortValue, b7 as ProductVolumePrice, b8 as ProductsQuery, b9 as QuizAnswerInput, ba as QuizAnswerResult, bb as QuizQuestion, bc as QuizResult, bd as QuoteItem, be as QuoteRequest, bf as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, bl as ReturnRequest, bm as ReturnRequestItem, bn as ReturnStatus, bo as ReturnStatusItem, bp as ReturnableOrder, bq as ReturnableOrderItem, br as SdkError, bs as ShippingMethodSummary, bt as ShippingQuote, bu as ShippingQuoteInput, bv as ShopInfo, bw as ShopScript, bx as ShopScriptPlacement, by as ShopScriptType, bz as ShopScripts, bA as ShopSeo, bB as ShopSeoIdentity, bC as StockBehavior, bD as StockMode, bE as SubmitQuoteInput, bF as SubmitReturnInput, bG as SubmitReviewInput, bH as Subscription, bI as SubscriptionAction, bJ as SubscriptionFrequency, bK as SubscriptionItem, bL as SubscriptionStatus, bM as TaxBreakdownLine, bN as VariantAxis, bO as VariantAxisValue, bP as WishlistItem, bQ as err, bR as ok, bS as toSdkError } from './client-DNT6UaEI.js';
1
+ import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-LetSVGM1.js';
2
+ export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAvailability, aU as ProductGroup, aV as ProductLabel, aW as ProductListItem, aX as ProductMedia, aY as ProductMediaVariant, aZ as ProductParameter, a_ as ProductParameterGroup, a$ as ProductParametersResponse, b0 as ProductPrice, b1 as ProductPromotionSummary, b2 as ProductReview, b3 as ProductReviewsResponse, b4 as ProductSibling, b5 as ProductSort, b6 as ProductSortValue, b7 as ProductVolumePrice, b8 as ProductsQuery, b9 as QuizAnswerInput, ba as QuizAnswerResult, bb as QuizQuestion, bc as QuizResult, bd as QuoteItem, be as QuoteRequest, bf as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, bl as ReturnRequest, bm as ReturnRequestItem, bn as ReturnStatus, bo as ReturnStatusItem, bp as ReturnableOrder, bq as ReturnableOrderItem, br as SdkError, bs as ShippingMethodSummary, bt as ShippingQuote, bu as ShippingQuoteInput, bv as ShopInfo, bw as ShopScript, bx as ShopScriptPlacement, by as ShopScriptType, bz as ShopScripts, bA as ShopSeo, bB as ShopSeoIdentity, bC as Sitemap, bD as SitemapEntry, bE as StockBehavior, bF as StockMode, bG as SubmitQuoteInput, bH as SubmitReturnInput, bI as SubmitReviewInput, bJ as Subscription, bK as SubscriptionAction, bL as SubscriptionFrequency, bM as SubscriptionItem, bN as SubscriptionStatus, bO as TaxBreakdownLine, bP as VariantAxis, bQ as VariantAxisValue, bR as WishlistItem, bS as err, bT as ok, bU as toSdkError } from './client-LetSVGM1.js';
3
3
 
4
4
  /**
5
5
  * Format a price amount with currency using Intl.NumberFormat.
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkODAMBLGYjs = require('./chunk-ODAMBLGY.js');
13
+ var _chunkOQK7PQYJjs = require('./chunk-OQK7PQYJ.js');
14
14
 
15
15
  // src/react/utils/format-price.ts
16
16
  function formatPrice(amount, currency, locale) {
@@ -243,4 +243,4 @@ async function revokeAnalyticsConsent(client) {
243
243
 
244
244
 
245
245
 
246
- exports.AddressTypes = _chunkODAMBLGYjs.AddressTypes; exports.BehioApiError = _chunkODAMBLGYjs.BehioApiError; exports.BehioNetworkError = _chunkODAMBLGYjs.BehioNetworkError; exports.BehioStorefront = _chunkODAMBLGYjs.BehioStorefront; exports.FulfillmentStatuses = _chunkODAMBLGYjs.FulfillmentStatuses; exports.OrderStatuses = _chunkODAMBLGYjs.OrderStatuses; exports.PaymentStatuses = _chunkODAMBLGYjs.PaymentStatuses; exports.ProductSort = _chunkODAMBLGYjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkODAMBLGYjs.err; exports.findVariantByAttributes = findVariantByAttributes; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkODAMBLGYjs.ok; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkODAMBLGYjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
246
+ exports.AddressTypes = _chunkOQK7PQYJjs.AddressTypes; exports.BehioApiError = _chunkOQK7PQYJjs.BehioApiError; exports.BehioNetworkError = _chunkOQK7PQYJjs.BehioNetworkError; exports.BehioStorefront = _chunkOQK7PQYJjs.BehioStorefront; exports.FulfillmentStatuses = _chunkOQK7PQYJjs.FulfillmentStatuses; exports.OrderStatuses = _chunkOQK7PQYJjs.OrderStatuses; exports.PaymentStatuses = _chunkOQK7PQYJjs.PaymentStatuses; exports.ProductSort = _chunkOQK7PQYJjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkOQK7PQYJjs.err; exports.findVariantByAttributes = findVariantByAttributes; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkOQK7PQYJjs.ok; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkOQK7PQYJjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  err,
11
11
  ok,
12
12
  toSdkError
13
- } from "./chunk-WMZH72WS.mjs";
13
+ } from "./chunk-7CFBSRUZ.mjs";
14
14
 
15
15
  // src/react/utils/format-price.ts
16
16
  function formatPrice(amount, currency, locale) {
package/dist/next.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-DNT6UaEI.mjs';
1
+ import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-LetSVGM1.mjs';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-DNT6UaEI.js';
1
+ import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-LetSVGM1.js';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkODAMBLGYjs = require('./chunk-ODAMBLGY.js');
3
+ var _chunkOQK7PQYJjs = require('./chunk-OQK7PQYJ.js');
4
4
 
5
5
  // src/next.ts
6
6
  var _headers = require('next/headers');
@@ -18,7 +18,7 @@ async function getBehio(options = {}) {
18
18
  const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
19
19
  const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
20
20
  const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
21
- const client = new (0, _chunkODAMBLGYjs.BehioStorefront)({
21
+ const client = new (0, _chunkOQK7PQYJjs.BehioStorefront)({
22
22
  apiKey,
23
23
  ...baseUrl ? { baseUrl } : {},
24
24
  ...locale ? { locale } : {},
@@ -30,9 +30,18 @@ async function getBehio(options = {}) {
30
30
  if (existing) {
31
31
  client.setCartSession(existing);
32
32
  }
33
+ if (!options.visitorIp) {
34
+ try {
35
+ const h = await _headers.headers.call(void 0, );
36
+ const xff = h.get("x-forwarded-for");
37
+ const ip = (_nullishCoalesce(_nullishCoalesce(_optionalChain([xff, 'optionalAccess', _4 => _4.split, 'call', _5 => _5(","), 'access', _6 => _6[0]]), () => ( h.get("x-real-ip"))), () => ( ""))).trim();
38
+ if (ip) client.setVisitorIp(ip);
39
+ } catch (e) {
40
+ }
41
+ }
33
42
  if (!currency) {
34
43
  const currencyCookieName = _nullishCoalesce(options.currencyCookieName, () => ( CURRENCY_COOKIE_NAME));
35
- const chosenCurrency = _optionalChain([cookieStore, 'access', _4 => _4.get, 'call', _5 => _5(currencyCookieName), 'optionalAccess', _6 => _6.value]);
44
+ const chosenCurrency = _optionalChain([cookieStore, 'access', _7 => _7.get, 'call', _8 => _8(currencyCookieName), 'optionalAccess', _9 => _9.value]);
36
45
  if (chosenCurrency) {
37
46
  client.setCurrency(chosenCurrency);
38
47
  }
@@ -48,14 +57,14 @@ async function getBehio(options = {}) {
48
57
  path: "/",
49
58
  maxAge: CART_COOKIE_MAX_AGE
50
59
  });
51
- } catch (e) {
60
+ } catch (e2) {
52
61
  }
53
62
  };
54
63
  client.clearCartSession = () => {
55
64
  originalClear();
56
65
  try {
57
66
  cookieStore.delete(cookieName);
58
- } catch (e2) {
67
+ } catch (e3) {
59
68
  }
60
69
  };
61
70
  return client;
package/dist/next.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  BehioStorefront
3
- } from "./chunk-WMZH72WS.mjs";
3
+ } from "./chunk-7CFBSRUZ.mjs";
4
4
 
5
5
  // src/next.ts
6
- import { cookies } from "next/headers";
6
+ import { cookies, headers } from "next/headers";
7
7
  var CART_COOKIE_NAME = "behio_cart_session";
8
8
  var CURRENCY_COOKIE_NAME = "behio_currency";
9
9
  var CART_COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
@@ -30,6 +30,15 @@ async function getBehio(options = {}) {
30
30
  if (existing) {
31
31
  client.setCartSession(existing);
32
32
  }
33
+ if (!options.visitorIp) {
34
+ try {
35
+ const h = await headers();
36
+ const xff = h.get("x-forwarded-for");
37
+ const ip = (xff?.split(",")[0] ?? h.get("x-real-ip") ?? "").trim();
38
+ if (ip) client.setVisitorIp(ip);
39
+ } catch {
40
+ }
41
+ }
33
42
  if (!currency) {
34
43
  const currencyCookieName = options.currencyCookieName ?? CURRENCY_COOKIE_NAME;
35
44
  const chosenCurrency = cookieStore.get(currencyCookieName)?.value;
package/dist/react.d.mts CHANGED
@@ -73,6 +73,18 @@ interface BehioStorefrontConfig {
73
73
  currency?: string;
74
74
  /** Custom fetch implementation (for Node.js < 18 or testing) */
75
75
  fetch?: typeof fetch;
76
+ /**
77
+ * Real visitor IP for server-side rendering. Sent as X-Behio-Visitor-Ip so
78
+ * the backend rate-limits per visitor instead of per server: all SSR
79
+ * requests of one deployment share the server's IP, so without this header
80
+ * the whole shop shares one rate-limit bucket. The backend only trusts the
81
+ * header from allow-listed hosting IPs, so a browser sending it gains
82
+ * nothing. Accepts a fixed string or a resolver called per request (use a
83
+ * resolver for a shared catalog client that serves many concurrent
84
+ * requests). The Next.js adapter (`@behio/storefront-sdk/next`) fills this
85
+ * automatically from the incoming request headers.
86
+ */
87
+ visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
76
88
  /** Request timeout in milliseconds. Default: 30000 (30s) */
77
89
  timeout?: number;
78
90
  /** Number of retries on network/5xx errors. Default: 1 */
@@ -731,6 +743,21 @@ interface ProductDetail extends ProductListItem {
731
743
  */
732
744
  parameterGroups: ProductParameterGroup[];
733
745
  seo: {
746
+ /**
747
+ * Slug of the page that should be canonical INSTEAD of this one. Empty
748
+ * means the page is canonical to itself.
749
+ *
750
+ * Only ever filled on a colour card in a shop whose merchant chose that
751
+ * one product page represents the product in search (catalog split
752
+ * indexing = PARENT_PAGE). Added in SDK 1.4.0.
753
+ */
754
+ canonicalSlug?: string | null;
755
+ /**
756
+ * `true` = render `noindex, follow`. Set on a parent product that colour
757
+ * cards have taken over, so it stops competing with its own cards.
758
+ * Added in SDK 1.4.0.
759
+ */
760
+ noIndex?: boolean;
734
761
  title?: string | null;
735
762
  description?: string | null;
736
763
  keywords?: string | null;
@@ -2251,6 +2278,28 @@ interface SubmitQuoteInput {
2251
2278
  requestedPrice?: number;
2252
2279
  }[];
2253
2280
  }
2281
+ /** One URL for the sitemap. Added in SDK 1.4.0. */
2282
+ interface SitemapEntry {
2283
+ /** Slug without any prefix; the template builds the path. */
2284
+ slug: string;
2285
+ /** Last change (epoch ms) for `lastmod`. */
2286
+ updatedAt: number;
2287
+ }
2288
+ /**
2289
+ * Everything the shop wants search engines to crawl, already filtered by the
2290
+ * merchant's indexing choice. Added in SDK 1.4.0.
2291
+ *
2292
+ * Build the sitemap from THIS, not from `getProducts`: which page belongs in
2293
+ * the index is a catalog rule (a product split into colour cards publishes
2294
+ * either the cards or the parent, never both), and a template that lists
2295
+ * `getProducts` gets it wrong the moment the merchant changes the setting.
2296
+ */
2297
+ interface Sitemap {
2298
+ locale: string;
2299
+ products: SitemapEntry[];
2300
+ categories: SitemapEntry[];
2301
+ pages: SitemapEntry[];
2302
+ }
2254
2303
 
2255
2304
  declare class BehioStorefront {
2256
2305
  private baseUrl;
@@ -2274,6 +2323,7 @@ declare class BehioStorefront {
2274
2323
  private responseInterceptors;
2275
2324
  private rateLimitRemaining;
2276
2325
  private rateLimitReset;
2326
+ private visitorIp?;
2277
2327
  constructor(config: BehioStorefrontConfig);
2278
2328
  readonly catalog: CatalogModule;
2279
2329
  readonly auth: AuthModule;
@@ -2300,6 +2350,13 @@ declare class BehioStorefront {
2300
2350
  setAnalyticsVisitorId(id: string | null): void;
2301
2351
  /** The consent-gated visitor id, if analytics consent was granted. */
2302
2352
  getAnalyticsVisitorId(): string | null;
2353
+ /**
2354
+ * Set (or clear with null) the real visitor IP forwarded as
2355
+ * X-Behio-Visitor-Ip on server-side requests. See
2356
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
2357
+ * automatically for per-request clients.
2358
+ */
2359
+ setVisitorIp(ip: string | null): void;
2303
2360
  /**
2304
2361
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
2305
2362
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -2446,6 +2503,11 @@ declare class CatalogModule {
2446
2503
  locale?: string;
2447
2504
  currency?: string;
2448
2505
  }): Promise<SdkResult<ProductDetail>>;
2506
+ /**
2507
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
2508
+ * (see `Sitemap`). Added in SDK 1.4.0.
2509
+ */
2510
+ getSitemap(locale?: string): Promise<SdkResult<Sitemap>>;
2449
2511
  /** Get category tree */
2450
2512
  getCategories(locale?: string): Promise<SdkResult<{
2451
2513
  categories: Category[];
package/dist/react.d.ts CHANGED
@@ -73,6 +73,18 @@ interface BehioStorefrontConfig {
73
73
  currency?: string;
74
74
  /** Custom fetch implementation (for Node.js < 18 or testing) */
75
75
  fetch?: typeof fetch;
76
+ /**
77
+ * Real visitor IP for server-side rendering. Sent as X-Behio-Visitor-Ip so
78
+ * the backend rate-limits per visitor instead of per server: all SSR
79
+ * requests of one deployment share the server's IP, so without this header
80
+ * the whole shop shares one rate-limit bucket. The backend only trusts the
81
+ * header from allow-listed hosting IPs, so a browser sending it gains
82
+ * nothing. Accepts a fixed string or a resolver called per request (use a
83
+ * resolver for a shared catalog client that serves many concurrent
84
+ * requests). The Next.js adapter (`@behio/storefront-sdk/next`) fills this
85
+ * automatically from the incoming request headers.
86
+ */
87
+ visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
76
88
  /** Request timeout in milliseconds. Default: 30000 (30s) */
77
89
  timeout?: number;
78
90
  /** Number of retries on network/5xx errors. Default: 1 */
@@ -731,6 +743,21 @@ interface ProductDetail extends ProductListItem {
731
743
  */
732
744
  parameterGroups: ProductParameterGroup[];
733
745
  seo: {
746
+ /**
747
+ * Slug of the page that should be canonical INSTEAD of this one. Empty
748
+ * means the page is canonical to itself.
749
+ *
750
+ * Only ever filled on a colour card in a shop whose merchant chose that
751
+ * one product page represents the product in search (catalog split
752
+ * indexing = PARENT_PAGE). Added in SDK 1.4.0.
753
+ */
754
+ canonicalSlug?: string | null;
755
+ /**
756
+ * `true` = render `noindex, follow`. Set on a parent product that colour
757
+ * cards have taken over, so it stops competing with its own cards.
758
+ * Added in SDK 1.4.0.
759
+ */
760
+ noIndex?: boolean;
734
761
  title?: string | null;
735
762
  description?: string | null;
736
763
  keywords?: string | null;
@@ -2251,6 +2278,28 @@ interface SubmitQuoteInput {
2251
2278
  requestedPrice?: number;
2252
2279
  }[];
2253
2280
  }
2281
+ /** One URL for the sitemap. Added in SDK 1.4.0. */
2282
+ interface SitemapEntry {
2283
+ /** Slug without any prefix; the template builds the path. */
2284
+ slug: string;
2285
+ /** Last change (epoch ms) for `lastmod`. */
2286
+ updatedAt: number;
2287
+ }
2288
+ /**
2289
+ * Everything the shop wants search engines to crawl, already filtered by the
2290
+ * merchant's indexing choice. Added in SDK 1.4.0.
2291
+ *
2292
+ * Build the sitemap from THIS, not from `getProducts`: which page belongs in
2293
+ * the index is a catalog rule (a product split into colour cards publishes
2294
+ * either the cards or the parent, never both), and a template that lists
2295
+ * `getProducts` gets it wrong the moment the merchant changes the setting.
2296
+ */
2297
+ interface Sitemap {
2298
+ locale: string;
2299
+ products: SitemapEntry[];
2300
+ categories: SitemapEntry[];
2301
+ pages: SitemapEntry[];
2302
+ }
2254
2303
 
2255
2304
  declare class BehioStorefront {
2256
2305
  private baseUrl;
@@ -2274,6 +2323,7 @@ declare class BehioStorefront {
2274
2323
  private responseInterceptors;
2275
2324
  private rateLimitRemaining;
2276
2325
  private rateLimitReset;
2326
+ private visitorIp?;
2277
2327
  constructor(config: BehioStorefrontConfig);
2278
2328
  readonly catalog: CatalogModule;
2279
2329
  readonly auth: AuthModule;
@@ -2300,6 +2350,13 @@ declare class BehioStorefront {
2300
2350
  setAnalyticsVisitorId(id: string | null): void;
2301
2351
  /** The consent-gated visitor id, if analytics consent was granted. */
2302
2352
  getAnalyticsVisitorId(): string | null;
2353
+ /**
2354
+ * Set (or clear with null) the real visitor IP forwarded as
2355
+ * X-Behio-Visitor-Ip on server-side requests. See
2356
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
2357
+ * automatically for per-request clients.
2358
+ */
2359
+ setVisitorIp(ip: string | null): void;
2303
2360
  /**
2304
2361
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
2305
2362
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -2446,6 +2503,11 @@ declare class CatalogModule {
2446
2503
  locale?: string;
2447
2504
  currency?: string;
2448
2505
  }): Promise<SdkResult<ProductDetail>>;
2506
+ /**
2507
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
2508
+ * (see `Sitemap`). Added in SDK 1.4.0.
2509
+ */
2510
+ getSitemap(locale?: string): Promise<SdkResult<Sitemap>>;
2449
2511
  /** Get category tree */
2450
2512
  getCategories(locale?: string): Promise<SdkResult<{
2451
2513
  categories: Category[];
package/dist/react.js CHANGED
@@ -215,6 +215,7 @@ var BehioStorefront = class {
215
215
  this.timeout = config.timeout ?? 3e4;
216
216
  this.retries = config.retries ?? 1;
217
217
  this.retryDelay = config.retryDelay ?? 1e3;
218
+ this.visitorIp = config.visitorIp;
218
219
  this.catalog = new CatalogModule(this);
219
220
  this.auth = new AuthModule(this);
220
221
  this.cart = new CartModule(this);
@@ -246,6 +247,15 @@ var BehioStorefront = class {
246
247
  getAnalyticsVisitorId() {
247
248
  return this.analyticsVisitorId;
248
249
  }
250
+ /**
251
+ * Set (or clear with null) the real visitor IP forwarded as
252
+ * X-Behio-Visitor-Ip on server-side requests. See
253
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
254
+ * automatically for per-request clients.
255
+ */
256
+ setVisitorIp(ip) {
257
+ this.visitorIp = ip ?? void 0;
258
+ }
249
259
  /**
250
260
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
251
261
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -511,6 +521,13 @@ var BehioStorefront = class {
511
521
  if (this.analyticsVisitorId) {
512
522
  headers["X-Behio-Vid"] = this.analyticsVisitorId;
513
523
  }
524
+ if (this.visitorIp) {
525
+ try {
526
+ const ip = typeof this.visitorIp === "function" ? await this.visitorIp() : this.visitorIp;
527
+ if (ip) headers["X-Behio-Visitor-Ip"] = ip;
528
+ } catch {
529
+ }
530
+ }
514
531
  if (options?.headers) {
515
532
  Object.assign(headers, options.headers);
516
533
  }
@@ -669,6 +686,15 @@ var CatalogModule = class {
669
686
  }
670
687
  );
671
688
  }
689
+ /**
690
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
691
+ * (see `Sitemap`). Added in SDK 1.4.0.
692
+ */
693
+ async getSitemap(locale) {
694
+ return this.client.request("GET", "/catalog/sitemap", {
695
+ query: { locale }
696
+ });
697
+ }
672
698
  /** Get category tree */
673
699
  async getCategories(locale) {
674
700
  const res = await this.client.request("GET", "/catalog/categories", { query: { locale } });
package/dist/react.mjs CHANGED
@@ -112,6 +112,7 @@ var BehioStorefront = class {
112
112
  this.timeout = config.timeout ?? 3e4;
113
113
  this.retries = config.retries ?? 1;
114
114
  this.retryDelay = config.retryDelay ?? 1e3;
115
+ this.visitorIp = config.visitorIp;
115
116
  this.catalog = new CatalogModule(this);
116
117
  this.auth = new AuthModule(this);
117
118
  this.cart = new CartModule(this);
@@ -143,6 +144,15 @@ var BehioStorefront = class {
143
144
  getAnalyticsVisitorId() {
144
145
  return this.analyticsVisitorId;
145
146
  }
147
+ /**
148
+ * Set (or clear with null) the real visitor IP forwarded as
149
+ * X-Behio-Visitor-Ip on server-side requests. See
150
+ * `BehioStorefrontConfig.visitorIp` for why. The Next.js adapter calls this
151
+ * automatically for per-request clients.
152
+ */
153
+ setVisitorIp(ip) {
154
+ this.visitorIp = ip ?? void 0;
155
+ }
146
156
  /**
147
157
  * Fire-and-forget Behio Analytics ingest. Uses a bare keepalive fetch (not
148
158
  * the interceptor pipeline) so flushes on pagehide still land, and swallows
@@ -408,6 +418,13 @@ var BehioStorefront = class {
408
418
  if (this.analyticsVisitorId) {
409
419
  headers["X-Behio-Vid"] = this.analyticsVisitorId;
410
420
  }
421
+ if (this.visitorIp) {
422
+ try {
423
+ const ip = typeof this.visitorIp === "function" ? await this.visitorIp() : this.visitorIp;
424
+ if (ip) headers["X-Behio-Visitor-Ip"] = ip;
425
+ } catch {
426
+ }
427
+ }
411
428
  if (options?.headers) {
412
429
  Object.assign(headers, options.headers);
413
430
  }
@@ -566,6 +583,15 @@ var CatalogModule = class {
566
583
  }
567
584
  );
568
585
  }
586
+ /**
587
+ * URLs for the sitemap, already filtered by the merchant's indexing choice
588
+ * (see `Sitemap`). Added in SDK 1.4.0.
589
+ */
590
+ async getSitemap(locale) {
591
+ return this.client.request("GET", "/catalog/sitemap", {
592
+ query: { locale }
593
+ });
594
+ }
569
595
  /** Get category tree */
570
596
  async getCategories(locale) {
571
597
  const res = await this.client.request("GET", "/catalog/categories", { query: { locale } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "TypeScript SDK for Behio Headless E-Shop — core client + React hooks",
5
5
  "author": "Behio",
6
6
  "license": "MIT",