brainerce 1.46.2 → 1.47.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -76,6 +76,31 @@ interface BrainerceClientOptions {
76
76
  statusCode: number;
77
77
  path?: string;
78
78
  }) => void;
79
+ /**
80
+ * Callback fired when the SDK silently resets the guest session cart because
81
+ * the previously-stored cart could no longer be resolved as-is — either the
82
+ * fetch failed (network error, 404 — cart deleted/expired) or the cart was
83
+ * found but is no longer `ACTIVE` (e.g. a prior checkout on it already
84
+ * completed or the cart was abandoned/merged). In both cases the SDK
85
+ * transparently creates a fresh empty cart so `smartAddToCart()` /
86
+ * `smartGetCart()` keep working — this callback is your only signal that it
87
+ * happened, so the storefront can tell the shopper their cart expired
88
+ * instead of them just seeing it silently empty out.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const client = new BrainerceClient({
93
+ * salesChannelId: 'vc_abc123...',
94
+ * onCartReset: ({ previousCartId, reason }) => {
95
+ * toast.warn('Your cart session expired — please re-add your items.');
96
+ * },
97
+ * });
98
+ * ```
99
+ */
100
+ onCartReset?: (info: {
101
+ previousCartId: string;
102
+ reason: 'not_found' | 'not_active';
103
+ }) => void;
79
104
  /**
80
105
  * Origin header to send with requests.
81
106
  * Browsers add this automatically, but Node.js environments (SSR, scripts, npx)
@@ -194,6 +219,36 @@ interface StoreInfo {
194
219
  upsell?: UpsellSettings;
195
220
  /** Multi-language / i18n settings */
196
221
  i18n?: I18nSettings;
222
+ /**
223
+ * SEO Autopilot fields (sales-channel mode only).
224
+ * `indexNowKey`: serve this verbatim at `GET /indexnow-key.txt`
225
+ * (`text/plain`) so the platform can ping IndexNow when blog posts publish.
226
+ * Not a secret — the key file is public by protocol design. `null` until
227
+ * the store's SEO Autopilot generates one; return 404 while null.
228
+ */
229
+ seo?: {
230
+ indexNowKey: string | null;
231
+ };
232
+ /**
233
+ * Real merchant-configured shipping rates (sales-channel mode only) —
234
+ * flat-rate/free zones only, each with a single unconditional price.
235
+ * Weight/price-tiered and local-pickup rates are excluded because their
236
+ * cost depends on cart contents, so there's no single number to declare.
237
+ * Feeds Product JSON-LD `shippingDetails` — pass as `buildProductJsonLd(product, { ..., shipping: storeInfo.shipping })`.
238
+ */
239
+ shipping?: ShippingSummaryEntry[];
240
+ }
241
+ /** One flat-rate/free shipping zone, as exposed by `StoreInfo.shipping`. */
242
+ interface ShippingSummaryEntry {
243
+ /** ISO 3166-1 alpha-2 country codes this rate applies to. */
244
+ countries: string[];
245
+ rateType: 'FLAT_RATE' | 'FREE';
246
+ /** Shipping cost in the store's currency. `0` for FREE, `null` if a FLAT_RATE has no configured amount. */
247
+ amount: number | null;
248
+ minDeliveryDays: number | null;
249
+ maxDeliveryDays: number | null;
250
+ /** Order-processing time in business days before the item ships. */
251
+ handlingTime: number | null;
197
252
  }
198
253
  /** Multi-language configuration exposed to the storefront */
199
254
  interface I18nSettings {
@@ -304,6 +359,64 @@ interface LoyaltyStatus {
304
359
  type: string;
305
360
  value: number;
306
361
  } | null;
362
+ /** Milestone badges this customer has earned (newest first; empty when none). */
363
+ badges?: LoyaltyBadge[];
364
+ /**
365
+ * The customer's paid premium membership, or null for free members.
366
+ * status PAST_DUE = the last recurring charge failed (perks paused until it
367
+ * clears); cancelAtPeriodEnd = perks continue until nextBillingAt, then end.
368
+ */
369
+ paidMembership?: PaidMembershipInfo | null;
370
+ }
371
+ /** A milestone badge a customer earned (display-only recognition). */
372
+ interface LoyaltyBadge {
373
+ id: string;
374
+ name: string;
375
+ description: string | null;
376
+ iconUrl: string | null;
377
+ /** ISO timestamp of when this customer earned the badge. */
378
+ awardedAt: string;
379
+ }
380
+ /** A paid premium membership plan customers can subscribe to. */
381
+ interface LoyaltyMembershipPlan {
382
+ id: string;
383
+ name: string;
384
+ perksDescription: string | null;
385
+ /** Recurring charge amount, in the store currency. */
386
+ priceAmount: number;
387
+ /** Days between recurring charges (default 30). */
388
+ billingIntervalDays: number;
389
+ /** Points-earning multiplier while the subscription is ACTIVE (composes with the tier multiplier). */
390
+ pointsMultiplier: number;
391
+ }
392
+ /** A customer's paid membership state (see LoyaltyStatus.paidMembership). */
393
+ interface PaidMembershipInfo {
394
+ status: 'ACTIVE' | 'PAST_DUE' | 'CANCELLED';
395
+ /** True when the customer cancelled — perks continue until nextBillingAt, then end without a charge. */
396
+ cancelAtPeriodEnd: boolean;
397
+ /** ISO timestamp of the next recurring charge (null once cancelled). */
398
+ nextBillingAt: string | null;
399
+ plan: LoyaltyMembershipPlan | null;
400
+ }
401
+ /** A saved payment method (display fields only — never any card data). */
402
+ interface StorefrontSavedPaymentMethod {
403
+ id: string;
404
+ /** 'credit_card' | 'paypal' | 'bank_account' */
405
+ paymentMethod: string;
406
+ brand: string | null;
407
+ last4: string | null;
408
+ expMonth: number | null;
409
+ expYear: number | null;
410
+ isDefault: boolean;
411
+ }
412
+ /** AI reward recommendation — always a reward from the store's real catalog. */
413
+ interface LoyaltyRewardRecommendation {
414
+ /** The recommended reward, or null when the catalog is empty. */
415
+ reward: LoyaltyReward | null;
416
+ /** Short customer-facing explanation, or null (deterministic fallback picks have no reason). */
417
+ reason?: string | null;
418
+ /** 'ai' = model choice validated against the catalog; 'fallback' = deterministic pick. */
419
+ source?: 'ai' | 'fallback';
307
420
  }
308
421
  /** Public referral-link lookup result (no auth needed) — see getReferralInfo(). */
309
422
  interface ReferralInfo {
@@ -404,6 +517,10 @@ interface Product {
404
517
  description?: string | null;
405
518
  descriptionFormat?: 'text' | 'html' | 'markdown' | null;
406
519
  sku: string;
520
+ /** Global Trade Item Number (EAN/UPC/ISBN). Emitted in Product JSON-LD. */
521
+ gtin?: string | null;
522
+ /** Manufacturer Part Number. Emitted in Product JSON-LD. */
523
+ mpn?: string | null;
407
524
  /**
408
525
  * Base price as string (e.g., "29.99"). Use parseFloat() for calculations.
409
526
  *
@@ -425,6 +542,10 @@ interface Product {
425
542
  * `SIMPLE` products it is the product's own stored sale price.
426
543
  */
427
544
  salePrice?: string | null;
545
+ /** ISO 8601 — start of the sale-price effective window. `null` when unset (sale has no window). */
546
+ salePriceStartsAt?: string | null;
547
+ /** ISO 8601 — end of the sale-price effective window. Feeds Product JSON-LD `priceValidUntil`. `null` when unset. */
548
+ salePriceEndsAt?: string | null;
428
549
  /** Cost price as string. Use parseFloat() for calculations. */
429
550
  costPrice?: string | null;
430
551
  /** Lowest effective variant price (VARIABLE products only). String Decimal, e.g. "19.99". */
@@ -454,13 +575,15 @@ interface Product {
454
575
  inventory?: InventoryInfo | null;
455
576
  variants?: ProductVariant[];
456
577
  /**
457
- * Categories as objects with `id` and `name`.
458
- * NOT string[] - each category is `{ id: string; name: string }`.
459
- * Access: `product.categories?.map(cat => cat.name)`
578
+ * Categories as objects with `id`, `name`, and `slug`.
579
+ * NOT string[] - each category is `{ id: string; name: string; slug?: string | null }`.
580
+ * Access: `product.categories?.map(cat => cat.name)`. Use `slug` to link to
581
+ * that category's `/category/{slug}` landing page.
460
582
  */
461
583
  categories?: Array<{
462
584
  id: string;
463
585
  name: string;
586
+ slug?: string | null;
464
587
  }>;
465
588
  /** Brands as objects with id and name */
466
589
  brands?: Array<{
@@ -632,6 +755,10 @@ interface ProductVariant {
632
755
  price?: string | null;
633
756
  /** Variant sale price as string. Use parseFloat() for calculations. */
634
757
  salePrice?: string | null;
758
+ /** Variant unit cost (COGS) override as string — falls back to the product
759
+ * costPrice in margin analytics. Admin (apiKey) reads only; public
760
+ * storefront responses never include it. */
761
+ costPrice?: string | null;
635
762
  /** PRD §23: variant price converted to the region's currency via the daily
636
763
  * FX snapshot. Present only with `getProducts({ regionId })`. Display-only. */
637
764
  displayPrice?: string;
@@ -1169,9 +1296,35 @@ interface ProductSuggestion {
1169
1296
  interface CategoryNode {
1170
1297
  id: string;
1171
1298
  name: string;
1299
+ /** URL-friendly handle — link a category page as `/category/${slug}`. */
1300
+ slug?: string | null;
1172
1301
  parentId?: string | null;
1302
+ image?: string | null;
1173
1303
  children: CategoryNode[];
1174
1304
  }
1305
+ /**
1306
+ * Full category-page payload from {@link BrainerceClient.getCategoryBySlug}.
1307
+ * Backs a storefront category (a.k.a. collection) landing page — the
1308
+ * highest-leverage organic-SEO surface. The products themselves come from a
1309
+ * separate `getProducts({ categories: [id] })` call, so this stays metadata.
1310
+ */
1311
+ interface CategoryDetail {
1312
+ id: string;
1313
+ name: string;
1314
+ slug: string | null;
1315
+ /** Long-form category copy as sanitized HTML (render below the grid). */
1316
+ description: string | null;
1317
+ /** Meta description for the category page `<meta name="description">`. */
1318
+ metaDescription: string | null;
1319
+ image: string | null;
1320
+ /** Ancestor chain (root → parent), for breadcrumb JSON-LD + UI. */
1321
+ breadcrumb: Array<{
1322
+ name: string;
1323
+ slug: string | null;
1324
+ }>;
1325
+ /** Products published to this channel + active + in this category. */
1326
+ productCount: number;
1327
+ }
1175
1328
  /**
1176
1329
  * Category suggestion for autocomplete.
1177
1330
  *
@@ -2985,15 +3138,14 @@ interface AddressDetailsResult {
2985
3138
  line1: string;
2986
3139
  city: string;
2987
3140
  /**
2988
- * Google's own administrative-area code for the resolved place (e.g.
2989
- * `"D"` for an Israeli address in the Southern District). Usually — but
2990
- * not guaranteed the same ISO 3166-2 subdivision code this platform's
2991
- * own region lists use (`getShippingDestinations()`'s `regions`), since
2992
- * both ultimately derive from the same standard. Before assigning this
2993
- * into a `SetShippingAddressDto.region` field, validate it against the
2994
- * store's own `destinations.regions[country]` list (matching by `code`)
2995
- * if it's not one of the known codes, leave the field for the shopper
2996
- * to pick manually rather than assigning an unrecognized value.
3141
+ * This platform's own region `code` for the resolved place (the same
3142
+ * code `getShippingDestinations()`'s `regions` list uses), already
3143
+ * reconciled server-side from whatever raw text Google returned empty
3144
+ * string when nothing could be matched. Still validate it against
3145
+ * `destinations.regions[country]` (matching by `code`) before assigning
3146
+ * into a `SetShippingAddressDto.region` field rather than trusting it
3147
+ * unconditionally an empty/unresolved value should leave the field for
3148
+ * the shopper to pick manually, not get assigned as-is.
2997
3149
  */
2998
3150
  region: string;
2999
3151
  postalCode: string;
@@ -3023,6 +3175,8 @@ interface CreateVariantDto {
3023
3175
  attributes?: Record<string, string>;
3024
3176
  price?: number;
3025
3177
  salePrice?: number;
3178
+ /** Variant unit cost (COGS) override — falls back to product costPrice in margin analytics. */
3179
+ costPrice?: number;
3026
3180
  inventory?: number;
3027
3181
  image?: unknown;
3028
3182
  position?: number;
@@ -3034,6 +3188,8 @@ interface UpdateVariantDto {
3034
3188
  attributes?: Record<string, string>;
3035
3189
  price?: number;
3036
3190
  salePrice?: number;
3191
+ /** Variant unit cost (COGS) override. Pass null to clear (falls back to product costPrice). */
3192
+ costPrice?: number | null;
3037
3193
  image?: string | unknown;
3038
3194
  position?: number;
3039
3195
  status?: VariantStatus;
@@ -3052,6 +3208,8 @@ interface BulkVariantInput {
3052
3208
  attributes: Record<string, string>;
3053
3209
  price?: number | null;
3054
3210
  salePrice?: number | null;
3211
+ /** Variant unit cost (COGS) override. null clears (falls back to product costPrice). */
3212
+ costPrice?: number | null;
3055
3213
  stock: number;
3056
3214
  position?: number;
3057
3215
  image?: unknown | null;
@@ -5915,6 +6073,7 @@ declare class BrainerceClient {
5915
6073
  private readonly origin?;
5916
6074
  private readonly proxyMode;
5917
6075
  private readonly onAuthError?;
6076
+ private readonly onCartReset?;
5918
6077
  /** Active locale for content translation. When set, content endpoints return translated data. */
5919
6078
  private locale?;
5920
6079
  constructor(options: BrainerceClientOptions);
@@ -6126,6 +6285,23 @@ declare class BrainerceClient {
6126
6285
  }): Promise<{
6127
6286
  categories: CategoryNode[];
6128
6287
  }>;
6288
+ /**
6289
+ * Get one category by slug — the payload for a storefront category
6290
+ * (collection) landing page: name, description HTML, meta, breadcrumb and
6291
+ * product count. Fetch the products themselves with
6292
+ * `getProducts({ categories: [category.id] })`. Vibe-coded mode only, like
6293
+ * {@link getCategories}.
6294
+ *
6295
+ * @example
6296
+ * ```typescript
6297
+ * const category = await client.getCategoryBySlug('running-shoes').catch(() => null);
6298
+ * if (!category) notFound();
6299
+ * const { data: products } = await client.getProducts({ categories: [category.id] });
6300
+ * ```
6301
+ */
6302
+ getCategoryBySlug(slug: string, options?: {
6303
+ locale?: string;
6304
+ }): Promise<CategoryDetail>;
6129
6305
  /**
6130
6306
  * Get available brands for filtering products
6131
6307
  * Works in vibe-coded mode
@@ -9015,15 +9191,18 @@ declare class BrainerceClient {
9015
9191
  }): Promise<CustomerProfile>;
9016
9192
  /**
9017
9193
  * Get the logged-in customer's loyalty status: enrollment, points balance,
9018
- * lifetime earned, and the program's display config (requires customerToken).
9019
- * Only available in storefront mode. `program` is null when the store has no
9020
- * loyalty program.
9194
+ * lifetime earned, the program's display config, earned milestone `badges`,
9195
+ * and the `paidMembership` subscription state (null for free members).
9196
+ * Requires customerToken. Only available in storefront mode. `program` is
9197
+ * null when the store has no loyalty program.
9021
9198
  *
9022
9199
  * @example
9023
9200
  * ```typescript
9024
9201
  * client.setCustomerToken(auth.token);
9025
9202
  * const status = await client.getLoyaltyStatus();
9026
9203
  * if (status.enrolled) console.log(`${status.pointsBalance} ${status.program?.pointsName}`);
9204
+ * status.badges?.forEach((b) => console.log(`🏅 ${b.name}`));
9205
+ * if (status.paidMembership?.status === 'ACTIVE') showPremiumPerks(status.paidMembership.plan);
9027
9206
  * ```
9028
9207
  */
9029
9208
  getLoyaltyStatus(): Promise<LoyaltyStatus>;
@@ -9093,6 +9272,98 @@ declare class BrainerceClient {
9093
9272
  * ```
9094
9273
  */
9095
9274
  getReferralInfo(code: string): Promise<ReferralInfo>;
9275
+ /**
9276
+ * AI-recommended reward for the logged-in customer — "recommended for you"
9277
+ * at the top of the rewards list (requires customerToken). The result is
9278
+ * ALWAYS a real reward from the store's catalog (the AI only ranks; a
9279
+ * hallucinated pick falls back to a deterministic choice). Returns
9280
+ * `{ reward: null }` when the catalog is empty. Rate-limited (5/min per
9281
+ * customer — it spends the merchant's AI credits). Only available in
9282
+ * storefront mode.
9283
+ *
9284
+ * @example
9285
+ * ```typescript
9286
+ * const { reward, reason } = await client.getRecommendedReward();
9287
+ * if (reward) showRecommendation(reward, reason);
9288
+ * ```
9289
+ */
9290
+ getRecommendedReward(): Promise<LoyaltyRewardRecommendation>;
9291
+ /**
9292
+ * List the paid membership plans the customer can subscribe to (requires
9293
+ * customerToken). Empty when the store offers none or the program is not
9294
+ * active. Only available in storefront mode.
9295
+ *
9296
+ * @example
9297
+ * ```typescript
9298
+ * const plans = await client.getMembershipPlans();
9299
+ * ```
9300
+ */
9301
+ getMembershipPlans(): Promise<LoyaltyMembershipPlan[]>;
9302
+ /**
9303
+ * List the customer's saved payment methods (display fields only — brand /
9304
+ * last4 / expiry, never card data) for the membership subscribe flow.
9305
+ * Requires customerToken. Cards are vaulted by checking out with
9306
+ * `saveCard: true`. Only available in storefront mode.
9307
+ *
9308
+ * @example
9309
+ * ```typescript
9310
+ * const methods = await client.getMySavedPaymentMethods();
9311
+ * ```
9312
+ */
9313
+ getMySavedPaymentMethods(): Promise<StorefrontSavedPaymentMethod[]>;
9314
+ /**
9315
+ * Subscribe the customer to a paid membership plan — charges the saved card
9316
+ * IMMEDIATELY and starts the recurring cycle (requires customerToken).
9317
+ * Throws a 409 with a `code` ('card_declined' | 'requires_action' | ...)
9318
+ * when the charge fails; 3D-Secure challenges are not supported off-session
9319
+ * and surface as `requires_action`. Only available in storefront mode.
9320
+ *
9321
+ * @example
9322
+ * ```typescript
9323
+ * const membership = await client.subscribeToMembership({
9324
+ * planId: plan.id,
9325
+ * savedPaymentTokenId: method.id,
9326
+ * });
9327
+ * // membership.status === 'ACTIVE'
9328
+ * ```
9329
+ */
9330
+ subscribeToMembership(params: {
9331
+ planId: string;
9332
+ savedPaymentTokenId: string;
9333
+ }): Promise<PaidMembershipInfo>;
9334
+ /**
9335
+ * Cancel the customer's paid membership (requires customerToken).
9336
+ * End-of-period semantics: perks continue until `nextBillingAt`, then the
9337
+ * subscription ends without another charge (a PAST_DUE membership cancels
9338
+ * immediately). Re-subscribing to the same plan before period end simply
9339
+ * un-cancels. Only available in storefront mode.
9340
+ *
9341
+ * @example
9342
+ * ```typescript
9343
+ * const membership = await client.cancelMembership();
9344
+ * // membership.cancelAtPeriodEnd === true
9345
+ * ```
9346
+ */
9347
+ cancelMembership(): Promise<PaidMembershipInfo>;
9348
+ /**
9349
+ * Mint a short-lived session for the embeddable loyalty widget (Phase 5) and
9350
+ * return the ready-to-use iframe URL. Requires customerToken. The returned
9351
+ * `embedUrl` is safe to drop straight into an `<iframe src>` — it carries a
9352
+ * scoped ~15-minute session token, never the real customerToken. Re-call this
9353
+ * before the iframe reloads (e.g. on page navigation) to refresh it.
9354
+ *
9355
+ * @example
9356
+ * ```typescript
9357
+ * const { embedUrl } = await client.getLoyaltyWidgetSession();
9358
+ * // <iframe src={embedUrl} width="360" height="420" />
9359
+ * ```
9360
+ */
9361
+ getLoyaltyWidgetSession(): Promise<{
9362
+ sessionId: string;
9363
+ expiresAt: string;
9364
+ storeId: string;
9365
+ embedUrl: string;
9366
+ }>;
9096
9367
  /**
9097
9368
  * Get the current customer's orders (requires customerToken)
9098
9369
  * Works in vibe-coded and storefront modes
@@ -10453,4 +10724,149 @@ declare function formatVariantPrice(variant: Pick<ProductVariant, 'price' | 'sal
10453
10724
  /** Format any numeric amount as currency. Useful for cart totals, fees, etc. */
10454
10725
  declare function formatMoney(amount: number, currency: string, locale?: string): string;
10455
10726
 
10456
- export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, 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 CategoryNode, 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 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 ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, 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 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 ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, 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 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, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
10727
+ /**
10728
+ * JSON-LD (schema.org) builders for storefronts.
10729
+ *
10730
+ * Structured data is the "organic visibility without a Merchant Center feed"
10731
+ * lever: complete Product markup (Offer, availability, ratings) qualifies
10732
+ * pages for Google merchant-listing surfaces directly, and Organization/
10733
+ * Article/BreadcrumbList markup feeds rich results and AI-answer citations.
10734
+ *
10735
+ * Pure functions — no client dependency, framework-agnostic. Render with
10736
+ * {@link jsonLdScriptProps}:
10737
+ *
10738
+ * <script {...jsonLdScriptProps(buildProductJsonLd(product, { siteUrl, path }))} />
10739
+ *
10740
+ * Rules baked in (Google's structured-data guidelines):
10741
+ * - Product markup belongs on single-product pages only.
10742
+ * - `aggregateRating` is emitted ONLY when the product has visible reviews.
10743
+ * - Offers carry ISO-4217 currency and a positive price.
10744
+ */
10745
+
10746
+ interface JsonLdOptions {
10747
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10748
+ siteUrl: string;
10749
+ /** Path of the page being marked up, e.g. "/products/red-shoes". */
10750
+ path?: string;
10751
+ }
10752
+ type JsonLd = Record<string, unknown>;
10753
+ /**
10754
+ * schema.org/Article for a blog post. Emit on the article page
10755
+ * (`/blog/[slug]`) alongside {@link buildBreadcrumbJsonLd}.
10756
+ */
10757
+ declare function buildArticleJsonLd(post: BlogPost, opts: JsonLdOptions & {
10758
+ organizationName?: string;
10759
+ }): JsonLd;
10760
+ /**
10761
+ * schema.org/Product for a single-product page (PDP). Do NOT emit on
10762
+ * category/listing pages — Google's Product rich results apply to
10763
+ * single-product pages only.
10764
+ */
10765
+ declare function buildProductJsonLd(product: Product, opts: JsonLdOptions & {
10766
+ /** ISO-4217 currency code, e.g. "USD" / "ILS" (from StoreInfo.currency). */
10767
+ currency: string;
10768
+ /** Brand display name; falls back to product.brands[0]. */
10769
+ brandName?: string;
10770
+ /** Flat-rate/free shipping zones (from `StoreInfo.shipping`). Omitted entirely when not provided — no fabricated shipping cost. */
10771
+ shipping?: ShippingSummaryEntry[];
10772
+ }): JsonLd;
10773
+ /**
10774
+ * schema.org/Organization for the homepage (Knowledge Panel + AI-answer
10775
+ * citation grounding).
10776
+ */
10777
+ declare function buildOrganizationJsonLd(store: StoreInfo, opts: JsonLdOptions): JsonLd;
10778
+ /**
10779
+ * schema.org/WebSite for the homepage. Establishes the site as a brand entity
10780
+ * (an off-page "Authority" signal that grounds Google's Knowledge Panel and AI
10781
+ * answers) and — when `searchUrlTemplate` is given — declares a SearchAction so
10782
+ * Google can show a sitelinks search box for the brand.
10783
+ *
10784
+ * `searchUrlTemplate` must contain the literal token `{search_term_string}`,
10785
+ * e.g. `"/products?search={search_term_string}"`. Only pass it when the site
10786
+ * actually has a search results page at that URL.
10787
+ */
10788
+ declare function buildWebsiteJsonLd(store: StoreInfo, opts: JsonLdOptions & {
10789
+ searchUrlTemplate?: string;
10790
+ }): JsonLd;
10791
+ /**
10792
+ * schema.org/CollectionPage for a category (collection) landing page. This is
10793
+ * the correct markup for a listing page — never emit {@link buildProductJsonLd}
10794
+ * here (Product rich results are single-product only). Pair with
10795
+ * {@link buildBreadcrumbJsonLd} built from `category.breadcrumb`.
10796
+ */
10797
+ declare function buildCollectionPageJsonLd(category: Pick<CategoryDetail, 'name' | 'description' | 'metaDescription' | 'image'>, opts: JsonLdOptions): JsonLd;
10798
+ /** schema.org/BreadcrumbList. Items in order from root to current page. */
10799
+ declare function buildBreadcrumbJsonLd(items: Array<{
10800
+ name: string;
10801
+ url: string;
10802
+ }>): JsonLd;
10803
+ /**
10804
+ * Safe `<script type="application/ld+json">` props for React. Escapes `<` so
10805
+ * malicious content can never close the script tag (XSS-safe serialization).
10806
+ */
10807
+ declare function jsonLdScriptProps(data: JsonLd): {
10808
+ type: 'application/ld+json';
10809
+ dangerouslySetInnerHTML: {
10810
+ __html: string;
10811
+ };
10812
+ };
10813
+
10814
+ /**
10815
+ * Sitemap helpers for storefronts.
10816
+ *
10817
+ * `getBlogSitemapEntries` paginates the public blog API and returns entries
10818
+ * structurally compatible with Next.js `MetadataRoute.Sitemap` — without
10819
+ * importing Next (the SDK stays framework-agnostic).
10820
+ *
10821
+ * // app/sitemap.ts
10822
+ * const blogPages = await getBlogSitemapEntries(client, { siteUrl }).catch(() => []);
10823
+ * return [...staticPages, ...productPages, ...blogPages];
10824
+ */
10825
+
10826
+ interface SitemapEntry {
10827
+ url: string;
10828
+ lastModified?: Date;
10829
+ changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
10830
+ priority?: number;
10831
+ }
10832
+ interface BlogSitemapOptions {
10833
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10834
+ siteUrl: string;
10835
+ /** Blog route prefix. Default '/blog'. */
10836
+ basePath?: string;
10837
+ /**
10838
+ * Locales to emit locale-prefixed entries for (e.g. ['en','he']). When set
10839
+ * with `defaultLocale`, the default locale is emitted unprefixed and every
10840
+ * other locale as `/{locale}{basePath}/{slug}` — matching the product-page
10841
+ * convention in the storefront template.
10842
+ */
10843
+ locales?: string[];
10844
+ defaultLocale?: string;
10845
+ /** Page size per API call (max 100). Default 100. */
10846
+ pageSize?: number;
10847
+ /** Safety cap on total entries. Default 5000. */
10848
+ maxEntries?: number;
10849
+ }
10850
+ /**
10851
+ * Fetch every published blog post and map to sitemap entries. Public mode
10852
+ * only returns PUBLISHED posts, so no status filtering is needed.
10853
+ */
10854
+ declare function getBlogSitemapEntries(client: BrainerceClient, opts: BlogSitemapOptions): Promise<SitemapEntry[]>;
10855
+ interface CategorySitemapOptions {
10856
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10857
+ siteUrl: string;
10858
+ /** Category route prefix. Default '/category'. */
10859
+ basePath?: string;
10860
+ /** Emit locale-prefixed variants for these (default locale stays unprefixed). */
10861
+ locales?: string[];
10862
+ defaultLocale?: string;
10863
+ }
10864
+ /**
10865
+ * Category (collection) pages for the sitemap — high-priority organic-SEO
10866
+ * surfaces. Walks the {@link BrainerceClient.getCategories} tree and emits one
10867
+ * entry per category that has a slug. Categories carry no lastModified in the
10868
+ * public tree, so entries omit it.
10869
+ */
10870
+ declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
10871
+
10872
+ export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, 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 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 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 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 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 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, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };