brainerce 1.55.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -292,6 +292,9 @@ The SDK exports these utility functions for common UI tasks:
292
292
  | `buildBreadcrumbJsonLd(items)` | schema.org BreadcrumbList | See SEO section |
293
293
  | `jsonLdScriptProps(data)` | XSS-safe `<script type="application/ld+json">` props | `<script {...jsonLdScriptProps(data)} />` |
294
294
  | `getBlogSitemapEntries(client, opts)` | Paginate published posts into sitemap entries | See SEO section |
295
+ | `getProductSitemapEntries(client, opts)` | ALL published products into sitemap entries (no 100-item clamp) | See SEO section |
296
+ | `getCategorySitemapEntries(client, opts)` | Category tree into sitemap entries | See SEO section |
297
+ | `client.resolveSlugRedirect(type, slug)` | Renamed slug → current slug (301 support in not-found paths) | See SEO section |
295
298
 
296
299
  ```typescript
297
300
  import {
@@ -481,9 +484,9 @@ return <div dangerouslySetInnerHTML={{ __html: safeHtml }} className="prose" />;
481
484
 
482
485
  **SEO Autopilot writes here too**: the platform's SEO Autopilot publishes AI-written articles into this same blog automatically — render whatever `getPosts()` returns, and see the SEO section below for the required discoverability pieces.
483
486
 
484
- ### SEO — JSON-LD builders, sitemap helper, IndexNow key, llms.txt
487
+ ### SEO — JSON-LD builders, sitemap helpers, IndexNow key, llms.txt + agents.md
485
488
 
486
- The SDK ships schema.org builders that encode Google's structured-data rules (aggregateRating gated on `reviewCount > 0`, AggregateOffer for VARIABLE products, XSS-safe serialization). `buildProductJsonLd`'s Offer also always includes `itemCondition` (hardcoded `NewCondition` — first-party new-goods catalog), `priceValidUntil` when the product has an active sale-price window (`salePriceEndsAt`), and `shippingDetails` when you pass `shipping` (real flat-rate/free zones from `storeInfo.shipping` — omitted entirely, never fabricated, if you don't pass it). Prefer these builders over hand-rolled JSON-LD:
489
+ The SDK ships schema.org builders that encode Google's structured-data rules (aggregateRating gated on `reviewCount > 0` with explicit `bestRating`/`worstRating`, AggregateOffer with `offerCount` for VARIABLE products, XSS-safe serialization, and the full availability mapping — `InStock` from the backend's pre-computed `inventory.inStock`, `BackOrder` for purchasable-while-out-of-stock products, `OutOfStock` otherwise). `buildProductJsonLd`'s Offer also always includes `itemCondition` (hardcoded `NewCondition` — first-party new-goods catalog), `priceValidUntil` when the product has an active sale-price window (`salePriceEndsAt`), and `shippingDetails` when you pass `shipping` (real flat-rate/free zones from `storeInfo.shipping` — omitted entirely, never fabricated, if you don't pass it). Prefer these builders over hand-rolled JSON-LD:
487
490
 
488
491
  ```tsx
489
492
  import {
@@ -511,23 +514,43 @@ import {
511
514
  }))} />
512
515
  ```
513
516
 
514
- **Blog entries in sitemap.xml** (required autopilot articles missing from the sitemap never get crawled):
517
+ **Product + category + blog entries in sitemap.xml** (required). ⚠️ Products **must** use `getProductSitemapEntries` the public listing API clamps `limit` to 100, so a naive `getProducts({ limit: 1000 })` sitemap silently truncates at 100 products. The helper uses a dedicated lightweight endpoint (slug + updatedAt + localeSlugs, up to 5000 in one call) and falls back to pagination on older backends:
515
518
 
516
519
  ```ts
517
520
  // app/sitemap.ts
518
- import { getBlogSitemapEntries } from 'brainerce';
521
+ import {
522
+ getProductSitemapEntries,
523
+ getCategorySitemapEntries,
524
+ getBlogSitemapEntries,
525
+ } from 'brainerce';
519
526
 
520
- const blogPages = await getBlogSitemapEntries(client, {
527
+ const productPages = await getProductSitemapEntries(client, {
521
528
  siteUrl: baseUrl,
522
529
  locales: supportedLocales, // optional (multi-locale stores)
523
530
  defaultLocale,
524
531
  }).catch(() => []);
525
- return [...staticPages, ...productPages, ...blogPages];
532
+ const categoryPages = await getCategorySitemapEntries(client, {
533
+ siteUrl: baseUrl,
534
+ locales: supportedLocales,
535
+ defaultLocale,
536
+ }).catch(() => []);
537
+ const blogPages = await getBlogSitemapEntries(client, {
538
+ siteUrl: baseUrl,
539
+ locales: supportedLocales,
540
+ defaultLocale,
541
+ }).catch(() => []);
542
+ return [...staticPages, ...productPages, ...categoryPages, ...blogPages];
526
543
  ```
527
544
 
545
+ **robots.txt** (required): allow the AI search crawlers by name (`OAI-SearchBot`, `ChatGPT-User`, `Claude-SearchBot`, `Claude-User`, `PerplexityBot`, `Perplexity-User`, `Bingbot`, `Applebot`, `Amazonbot`) — they power ChatGPT/Claude/Perplexity/Copilot shopping answers and respect robots.txt. Keep `/api/`, `/auth/`, `/checkout/`, `/account/` disallowed.
546
+
528
547
  **IndexNow key file** (required): the platform pings IndexNow when posts publish; search engines verify by fetching `GET /indexnow-key.txt`. Serve `getStoreInfo().seo.indexNowKey` as `text/plain`, 404 while `null`. The key is **not a secret** (public by protocol design).
529
548
 
530
- **llms.txt** (recommended): a plain-text site summary (store name, key pages, recent article links) for AI answer engines at `GET /llms.txt`.
549
+ **llms.txt + agents.md** (required): `/llms.txt` is a plain-text site summary (store name, categories, key pages, recent article links) for AI answer engines; `/agents.md` is the agent-facing guide (machine surfaces, key URLs, currency, how buying works). Multi-locale stores: keep these dotted routes (plus `indexnow-key.txt`) at the app ROOT — locale middleware matchers skip dotted paths, so a locale-nested copy serves the homepage HTML instead.
550
+
551
+ **Site verification** : when `getStoreInfo().seo.googleSiteVerification` is set, render `<meta name="google-site-verification" content={token} />` in the root layout head (Search Console verification + Merchant Center website claim).
552
+
553
+ **Renamed slugs 301 instead of 404** (required): the platform records every product/blog slug rename. In the not-found path of the product and blog pages call `client.resolveSlugRedirect('product' | 'blog', slug)` — on a hit, `permanentRedirect()` to the returned `currentSlug`; `null` means a genuine 404 (never throws, safe to call unconditionally). Rename chains collapse to one hop.
531
554
 
532
555
  ---
533
556
 
@@ -2434,6 +2457,10 @@ const checkout = await client.setCheckoutCustomer(checkoutId, {
2434
2457
  notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
2435
2458
  // analyticsClientId / analyticsSessionId: auto-attached if you called
2436
2459
  // loadGoogleAnalytics() — no need to pass these yourself.
2460
+ // trafficReferrerHost / trafficUtm*: auto-attached from the SDK's own
2461
+ // traffic-attribution capture (external referrer + utm, 30-day window) so
2462
+ // the dashboard can report "orders from ChatGPT / Google / …". Nothing to
2463
+ // wire up; pass explicitly only to override.
2437
2464
  });
2438
2465
  ```
2439
2466
 
@@ -4071,6 +4098,15 @@ const cart = await client.createCart();
4071
4098
  await client.addToCart(cart.id, { productId: 'prod_abc', quantity: 1 });
4072
4099
  ```
4073
4100
 
4101
+ ### Traffic attribution (automatic, zero-config)
4102
+
4103
+ The SDK also records where each visit came from — the external referrer host
4104
+ and any `utm_source`/`utm_medium`/`utm_campaign` — as a **last non-direct
4105
+ touch** (`brainerce_attr` in localStorage, 30-day window). The captured values
4106
+ are auto-attached to `setCheckoutCustomer()` / `setShippingAddress()` and end
4107
+ up on the order, powering the dashboard's "orders from ChatGPT / Google / …"
4108
+ reporting. Nothing to configure; a value you pass explicitly always wins.
4109
+
4074
4110
  What this does:
4075
4111
 
4076
4112
  - Idempotently injects `gtag.js` and initializes `dataLayer` (skips injection if you're already loading `gtag.js` yourself — safe to call either way).
@@ -4718,6 +4754,46 @@ target vibe-coded connection both belong to the same account. Cross-account
4718
4754
  calls fail with `404 Not Found` (the connection ID is treated as if it doesn't
4719
4755
  exist for that account).
4720
4756
 
4757
+ #### Customers and sales channels
4758
+
4759
+ Customers use the same publish/unpublish shape, with one important difference:
4760
+ **you almost never have to call it.** A customer is attached to a channel
4761
+ automatically the moment they are seen on it — when they register, sign in
4762
+ (including via OAuth), or complete a checkout there.
4763
+
4764
+ There is one customer record per store, shared by every channel
4765
+ (`@@unique(storeId, email)`), so the same person shopping two of your
4766
+ storefronts stays one customer with two channel rows — never a duplicate.
4767
+
4768
+ ```typescript
4769
+ // Attach / detach by hand — for migrations and corrections only
4770
+ await client.publishCustomerToSalesChannel('cust_id', 'vc_conn_id');
4771
+ await client.unpublishCustomerFromSalesChannel('cust_id', 'vc_conn_id');
4772
+
4773
+ // Read both facts off any customer get/by-email response
4774
+ const customer = await client.getCustomer('cust_id');
4775
+ customer.channelPublishes;
4776
+ // [{ salesChannel: { id, name, connectionId }, firstSeenAt, lastSeenAt }, ...]
4777
+ customer.acquisitionSalesChannel; // first-touch channel, or null if unknown
4778
+
4779
+ // Set / correct the first-touch channel ('' clears it back to unknown)
4780
+ await client.updateCustomer('cust_id', { acquisitionSalesChannelId: 'vc_conn_id' });
4781
+ ```
4782
+
4783
+ Two things to keep straight:
4784
+
4785
+ - **`channelPublishes`** = every channel they are active in. Grows over time.
4786
+ - **`acquisitionSalesChannel`** = the FIRST channel they ever arrived through.
4787
+ Written once and then never touched by the platform again, so it stays a
4788
+ reliable answer to "which storefront is bringing me customers". `null` is a
4789
+ normal value: customers created through the API, imported from a file, or
4790
+ arriving via a `storeId`-mode storefront have no observed origin.
4791
+
4792
+ `unpublishCustomerFromSalesChannel` is a **correction, not a block.** It does
4793
+ not prevent that person from buying on that storefront, and the row comes back
4794
+ the next time they sign in or order there. There is no API to bar a customer
4795
+ from a sales channel.
4796
+
4721
4797
  ### Store Team Management
4722
4798
 
4723
4799
  Each store has its own team with roles (`OWNER`, `MANAGER`, `STAFF`, `VIEWER`) and granular permissions.
package/dist/index.d.mts CHANGED
@@ -229,14 +229,24 @@ interface StoreInfo {
229
229
  /** Multi-language / i18n settings */
230
230
  i18n?: I18nSettings;
231
231
  /**
232
- * SEO Autopilot fields (sales-channel mode only).
232
+ * SEO fields (sales-channel mode only).
233
+ *
233
234
  * `indexNowKey`: serve this verbatim at `GET /indexnow-key.txt`
234
235
  * (`text/plain`) so the platform can ping IndexNow when blog posts publish.
235
236
  * Not a secret — the key file is public by protocol design. `null` until
236
237
  * the store's SEO Autopilot generates one; return 404 while null.
238
+ *
239
+ * `googleSiteVerification`: the merchant's Google site-verification token
240
+ * (the `content` value of the `google-site-verification` meta tag), set in
241
+ * the dashboard under the sales channel's settings. When present, render
242
+ * `<meta name="google-site-verification" content={token} />` in the root
243
+ * layout `<head>` — it is what lets the merchant verify the storefront in
244
+ * Google Search Console and claim it in Merchant Center. Public by design
245
+ * (the token appears in page source on every verified site).
237
246
  */
238
247
  seo?: {
239
248
  indexNowKey: string | null;
249
+ googleSiteVerification?: string | null;
240
250
  };
241
251
  /**
242
252
  * Real merchant-configured shipping rates (sales-channel mode only) —
@@ -1998,9 +2008,40 @@ interface Customer {
1998
2008
  externalId: string;
1999
2009
  }>;
2000
2010
  addresses: CustomerAddress[];
2011
+ /**
2012
+ * FIRST-TOUCH sales channel — the storefront this customer originally arrived
2013
+ * through. `null`/absent is a normal state, not an error: customers created in
2014
+ * the dashboard, imported from a file, arriving via a `storeId`-mode
2015
+ * storefront, or predating channel attribution have no value here.
2016
+ *
2017
+ * Different from `platformConnections` (their ids on Shopify/WooCommerce) and
2018
+ * from `channelPublishes` below (where they are active now).
2019
+ */
2020
+ acquisitionSalesChannel?: CustomerSalesChannelRef | null;
2021
+ /**
2022
+ * Every sales channel this customer is active in — one entry per channel they
2023
+ * registered, signed in, checked out or ordered on, plus any a merchant
2024
+ * attached by hand. A customer belongs to exactly one store but can be active
2025
+ * in any number of that store's channels. `[]` = none known yet.
2026
+ */
2027
+ channelPublishes?: CustomerChannelPublish[];
2001
2028
  createdAt: string;
2002
2029
  updatedAt: string;
2003
2030
  }
2031
+ interface CustomerSalesChannelRef {
2032
+ /** Internal SalesChannel id (cuid). */
2033
+ id: string;
2034
+ name: string;
2035
+ /** Public `vc_*` connection id — the one your storefront initialises with. */
2036
+ connectionId: string;
2037
+ }
2038
+ interface CustomerChannelPublish {
2039
+ salesChannel: CustomerSalesChannelRef;
2040
+ /** First time this customer was seen on this channel. */
2041
+ firstSeenAt: string;
2042
+ /** Most recent time this customer was seen on this channel. */
2043
+ lastSeenAt: string;
2044
+ }
2004
2045
  /**
2005
2046
  * Display-only summary of a vaulted payment method.
2006
2047
  *
@@ -2091,6 +2132,14 @@ interface CreateCustomerDto {
2091
2132
  tags?: string[];
2092
2133
  /** Free-form merchant-set segment (e.g. "wholesale", "vip"), max 50 chars. */
2093
2134
  role?: string;
2135
+ /**
2136
+ * Explicit FIRST-TOUCH channel (internal SalesChannel id or public `vc_*`).
2137
+ * Creating a customer through the API is not itself a channel sighting, so
2138
+ * omitting this leaves the customer's origin unknown — set it only when you
2139
+ * actually know where the person came from (a migration, a phone order for a
2140
+ * specific storefront). Which channels they SHOP on is separate.
2141
+ */
2142
+ acquisitionSalesChannelId?: string;
2094
2143
  metadata?: Record<string, unknown>;
2095
2144
  }
2096
2145
  interface UpdateCustomerDto {
@@ -2102,6 +2151,15 @@ interface UpdateCustomerDto {
2102
2151
  tags?: string[];
2103
2152
  /** Free-form merchant-set segment. Pass '' to clear it. */
2104
2153
  role?: string;
2154
+ /**
2155
+ * Override the FIRST-TOUCH channel. Normally stamped automatically when the
2156
+ * customer registers, signs in with OAuth, or checks out — this is the
2157
+ * correction path for customers created through the API/dashboard or imported
2158
+ * from a file, where no channel was ever observed. Accepts an internal
2159
+ * SalesChannel id or a public `vc_*` connectionId; `''` clears it back to
2160
+ * unknown. Does NOT change which channels they are active in.
2161
+ */
2162
+ acquisitionSalesChannelId?: string;
2105
2163
  metadata?: Record<string, unknown>;
2106
2164
  }
2107
2165
  interface CustomerQueryParams {
@@ -2111,6 +2169,17 @@ interface CustomerQueryParams {
2111
2169
  hasAccount?: boolean;
2112
2170
  /** Filter by merchant-set customer role/segment (exact match, case-insensitive). */
2113
2171
  role?: string;
2172
+ /**
2173
+ * Only customers ACTIVE IN this channel (they registered, signed in, checked
2174
+ * out or ordered there, or a merchant attached them). Accepts an internal
2175
+ * SalesChannel id or a public `vc_*` connectionId.
2176
+ */
2177
+ salesChannelId?: string;
2178
+ /**
2179
+ * Only customers whose FIRST TOUCH was this channel, regardless of where they
2180
+ * have been active since. Customers with no attribution match nothing here.
2181
+ */
2182
+ acquisitionSalesChannelId?: string;
2114
2183
  sortBy?: 'createdAt' | 'email' | 'firstName' | 'lastName' | 'lastOrderAt';
2115
2184
  sortOrder?: 'asc' | 'desc';
2116
2185
  }
@@ -3225,6 +3294,16 @@ interface SetCheckoutCustomerDto {
3225
3294
  */
3226
3295
  analyticsClientId?: string;
3227
3296
  analyticsSessionId?: string;
3297
+ /**
3298
+ * Traffic attribution (last non-direct touch) — auto-attached by the SDK
3299
+ * from its `brainerce_attr` capture (external referrer host + utm params,
3300
+ * 30-day window). Lets the dashboard report "orders from ChatGPT/Google/…".
3301
+ * Pass explicitly to override; omit to use the captured values.
3302
+ */
3303
+ trafficReferrerHost?: string;
3304
+ trafficUtmSource?: string;
3305
+ trafficUtmMedium?: string;
3306
+ trafficUtmCampaign?: string;
3228
3307
  }
3229
3308
  /**
3230
3309
  * Shipping address with customer email (required for checkout).
@@ -3258,6 +3337,16 @@ interface SetShippingAddressDto {
3258
3337
  */
3259
3338
  analyticsClientId?: string;
3260
3339
  analyticsSessionId?: string;
3340
+ /**
3341
+ * Traffic attribution (last non-direct touch) — auto-attached by the SDK
3342
+ * from its `brainerce_attr` capture (external referrer host + utm params,
3343
+ * 30-day window). Lets the dashboard report "orders from ChatGPT/Google/…".
3344
+ * Pass explicitly to override; omit to use the captured values.
3345
+ */
3346
+ trafficReferrerHost?: string;
3347
+ trafficUtmSource?: string;
3348
+ trafficUtmMedium?: string;
3349
+ trafficUtmCampaign?: string;
3261
3350
  /**
3262
3351
  * The `placeId` of the autocomplete suggestion the shopper picked (from
3263
3352
  * `addressAutocomplete()`). Send it whenever the address came from the
@@ -6778,6 +6867,26 @@ declare class BrainerceClient {
6778
6867
  * No-op (returns `dto` unchanged) if `loadGoogleAnalytics()` was never
6779
6868
  * called, or if it hasn't resolved any ids by the time this is awaited.
6780
6869
  */
6870
+ /** localStorage key holding the last non-direct-touch attribution blob. */
6871
+ private readonly TRAFFIC_ATTR_KEY;
6872
+ /** Attribution older than this is stale and never forwarded (classic 30-day window). */
6873
+ private static readonly TRAFFIC_ATTR_MAX_AGE_MS;
6874
+ /**
6875
+ * Record the visit's traffic origin — LAST NON-DIRECT TOUCH semantics: an
6876
+ * external referrer or any utm_source overwrites the stored blob; a direct
6877
+ * or internal navigation keeps the previous touch. Runs once per client
6878
+ * construction (i.e. per page load in browser storefronts) and must never
6879
+ * throw — attribution is telemetry, the storefront always wins.
6880
+ */
6881
+ private captureTrafficAttribution;
6882
+ /** The stored attribution as request-body fields, or null when absent/stale. */
6883
+ private getTrafficAttribution;
6884
+ /**
6885
+ * Merge the stored traffic attribution onto a request body — only for
6886
+ * fields the caller didn't set explicitly (explicit values always win),
6887
+ * mirroring `withAnalyticsStitchIds`. No-op outside the browser.
6888
+ */
6889
+ private withTrafficAttribution;
6781
6890
  private withAnalyticsStitchIds;
6782
6891
  /**
6783
6892
  * Drop the fields `getAddressDetails()` returns that no address endpoint
@@ -6817,6 +6926,41 @@ declare class BrainerceClient {
6817
6926
  * ```
6818
6927
  */
6819
6928
  getProducts(params?: ProductQueryParams): Promise<PaginatedResponse<Product>>;
6929
+ /**
6930
+ * Lightweight product rows for sitemap generation: `slug`, `updatedAt`, and
6931
+ * per-locale `localeSlugs` only — up to `limit` (max 5000) in ONE request,
6932
+ * with none of the 100-per-page clamp the full listing applies.
6933
+ *
6934
+ * Sales-channel (`salesChannelId`) mode only; other modes throw so
6935
+ * {@link getProductSitemapEntries} (sitemap.ts) can catch and fall back to
6936
+ * paginating `getProducts`. Prefer that helper over calling this directly.
6937
+ */
6938
+ getSitemapProducts(limit?: number): Promise<Array<{
6939
+ id: string;
6940
+ slug: string | null;
6941
+ updatedAt: string;
6942
+ localeSlugs: Record<string, string> | null;
6943
+ }>>;
6944
+ /**
6945
+ * Resolve an old (renamed) slug to the entity's CURRENT slug, so the
6946
+ * storefront can issue a permanent (301/308) redirect instead of a 404.
6947
+ *
6948
+ * Call this in the catch/not-found path of a product or blog page:
6949
+ * the platform records every slug rename, so a URL that stopped matching
6950
+ * usually has a redirect. Returns `null` when there is no redirect (real
6951
+ * 404) or outside sales-channel mode — always fall through to notFound().
6952
+ *
6953
+ * @example
6954
+ * ```typescript
6955
+ * // app/products/[slug]/page.tsx — in the catch path:
6956
+ * const redirect = await client.resolveSlugRedirect('product', slug);
6957
+ * if (redirect) permanentRedirect(`/products/${redirect.currentSlug}`);
6958
+ * notFound();
6959
+ * ```
6960
+ */
6961
+ resolveSlugRedirect(entityType: 'product' | 'blog', slug: string): Promise<{
6962
+ currentSlug: string;
6963
+ } | null>;
6820
6964
  /**
6821
6965
  * Get a single product by ID
6822
6966
  * Works in vibe-coded, storefront (public), and admin mode
@@ -10918,6 +11062,33 @@ declare class BrainerceClient {
10918
11062
  unpublishProductFromSalesChannel(productId: string, salesChannelId: string): Promise<{
10919
11063
  success: boolean;
10920
11064
  }>;
11065
+ /**
11066
+ * Attach a customer to a sales channel (admin mode) — marks them as active in
11067
+ * that storefront. Accepts the sales-channel record ID or its public `vc_*`
11068
+ * connection ID.
11069
+ *
11070
+ * Rarely needed: the platform records a channel by itself whenever the
11071
+ * customer registers, signs in or checks out on it. Use this for migrations
11072
+ * from another system and for fixing up records you created yourself. A
11073
+ * customer belongs to one store but can be active in any number of its
11074
+ * channels, so calling this for several channels is normal and expected.
11075
+ *
11076
+ * This does not change where the customer CAME FROM — for that, pass
11077
+ * `acquisitionSalesChannelId` to {@link updateCustomer}.
11078
+ */
11079
+ publishCustomerToSalesChannel(customerId: string, salesChannelId: string): Promise<{
11080
+ success: boolean;
11081
+ }>;
11082
+ /**
11083
+ * Detach a customer from a sales channel (admin mode).
11084
+ *
11085
+ * A correction, NOT a block — it does not stop that person from buying on
11086
+ * that storefront, and the channel is recorded again the next time they sign
11087
+ * in or order there. There is no way to bar a customer from a channel.
11088
+ */
11089
+ unpublishCustomerFromSalesChannel(customerId: string, salesChannelId: string): Promise<{
11090
+ success: boolean;
11091
+ }>;
10921
11092
  /**
10922
11093
  * Publish a coupon to a sales channel (admin mode) — makes it redeemable on
10923
11094
  * that vibe-coded storefront. Accepts the sales-channel record ID or its
@@ -11725,6 +11896,34 @@ interface BlogSitemapOptions {
11725
11896
  * only returns PUBLISHED posts, so no status filtering is needed.
11726
11897
  */
11727
11898
  declare function getBlogSitemapEntries(client: BrainerceClient, opts: BlogSitemapOptions): Promise<SitemapEntry[]>;
11899
+ interface ProductSitemapOptions {
11900
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
11901
+ siteUrl: string;
11902
+ /** Product route prefix. Default '/products'. */
11903
+ basePath?: string;
11904
+ /**
11905
+ * Locales to emit locale-prefixed entries for. The default locale is emitted
11906
+ * unprefixed; every other locale as `/{locale}{basePath}/{localeSlug}`,
11907
+ * using the product's per-locale slug (`localeSlugs`) when one exists.
11908
+ */
11909
+ locales?: string[];
11910
+ defaultLocale?: string;
11911
+ /** Page size for the pagination fallback (max 100). Default 100. */
11912
+ pageSize?: number;
11913
+ /** Safety cap on total products. Default 5000. */
11914
+ maxEntries?: number;
11915
+ }
11916
+ /**
11917
+ * Every published product as sitemap entries — the REQUIRED way to build the
11918
+ * products section of `app/sitemap.ts`.
11919
+ *
11920
+ * Do NOT call `getProducts({ limit: 1000 })` for sitemaps: the public API
11921
+ * clamps `limit` to 100, so any store with more than 100 products silently
11922
+ * ships a truncated sitemap. This helper uses the dedicated lightweight
11923
+ * sitemap endpoint (slug + updatedAt only, up to 5000 in one call) and falls
11924
+ * back to paginating the full listing on older backends.
11925
+ */
11926
+ declare function getProductSitemapEntries(client: BrainerceClient, opts: ProductSitemapOptions): Promise<SitemapEntry[]>;
11728
11927
  interface CategorySitemapOptions {
11729
11928
  /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
11730
11929
  siteUrl: string;
@@ -11742,4 +11941,4 @@ interface CategorySitemapOptions {
11742
11941
  */
11743
11942
  declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
11744
11943
 
11745
- export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DateFieldParseResult, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
11944
+ export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DateFieldParseResult, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSitemapOptions, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };