brainerce 1.46.2 → 1.47.1

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.mts CHANGED
@@ -194,6 +194,16 @@ interface StoreInfo {
194
194
  upsell?: UpsellSettings;
195
195
  /** Multi-language / i18n settings */
196
196
  i18n?: I18nSettings;
197
+ /**
198
+ * SEO Autopilot fields (sales-channel mode only).
199
+ * `indexNowKey`: serve this verbatim at `GET /indexnow-key.txt`
200
+ * (`text/plain`) so the platform can ping IndexNow when blog posts publish.
201
+ * Not a secret — the key file is public by protocol design. `null` until
202
+ * the store's SEO Autopilot generates one; return 404 while null.
203
+ */
204
+ seo?: {
205
+ indexNowKey: string | null;
206
+ };
197
207
  }
198
208
  /** Multi-language configuration exposed to the storefront */
199
209
  interface I18nSettings {
@@ -304,6 +314,64 @@ interface LoyaltyStatus {
304
314
  type: string;
305
315
  value: number;
306
316
  } | null;
317
+ /** Milestone badges this customer has earned (newest first; empty when none). */
318
+ badges?: LoyaltyBadge[];
319
+ /**
320
+ * The customer's paid premium membership, or null for free members.
321
+ * status PAST_DUE = the last recurring charge failed (perks paused until it
322
+ * clears); cancelAtPeriodEnd = perks continue until nextBillingAt, then end.
323
+ */
324
+ paidMembership?: PaidMembershipInfo | null;
325
+ }
326
+ /** A milestone badge a customer earned (display-only recognition). */
327
+ interface LoyaltyBadge {
328
+ id: string;
329
+ name: string;
330
+ description: string | null;
331
+ iconUrl: string | null;
332
+ /** ISO timestamp of when this customer earned the badge. */
333
+ awardedAt: string;
334
+ }
335
+ /** A paid premium membership plan customers can subscribe to. */
336
+ interface LoyaltyMembershipPlan {
337
+ id: string;
338
+ name: string;
339
+ perksDescription: string | null;
340
+ /** Recurring charge amount, in the store currency. */
341
+ priceAmount: number;
342
+ /** Days between recurring charges (default 30). */
343
+ billingIntervalDays: number;
344
+ /** Points-earning multiplier while the subscription is ACTIVE (composes with the tier multiplier). */
345
+ pointsMultiplier: number;
346
+ }
347
+ /** A customer's paid membership state (see LoyaltyStatus.paidMembership). */
348
+ interface PaidMembershipInfo {
349
+ status: 'ACTIVE' | 'PAST_DUE' | 'CANCELLED';
350
+ /** True when the customer cancelled — perks continue until nextBillingAt, then end without a charge. */
351
+ cancelAtPeriodEnd: boolean;
352
+ /** ISO timestamp of the next recurring charge (null once cancelled). */
353
+ nextBillingAt: string | null;
354
+ plan: LoyaltyMembershipPlan | null;
355
+ }
356
+ /** A saved payment method (display fields only — never any card data). */
357
+ interface StorefrontSavedPaymentMethod {
358
+ id: string;
359
+ /** 'credit_card' | 'paypal' | 'bank_account' */
360
+ paymentMethod: string;
361
+ brand: string | null;
362
+ last4: string | null;
363
+ expMonth: number | null;
364
+ expYear: number | null;
365
+ isDefault: boolean;
366
+ }
367
+ /** AI reward recommendation — always a reward from the store's real catalog. */
368
+ interface LoyaltyRewardRecommendation {
369
+ /** The recommended reward, or null when the catalog is empty. */
370
+ reward: LoyaltyReward | null;
371
+ /** Short customer-facing explanation, or null (deterministic fallback picks have no reason). */
372
+ reason?: string | null;
373
+ /** 'ai' = model choice validated against the catalog; 'fallback' = deterministic pick. */
374
+ source?: 'ai' | 'fallback';
307
375
  }
308
376
  /** Public referral-link lookup result (no auth needed) — see getReferralInfo(). */
309
377
  interface ReferralInfo {
@@ -404,6 +472,10 @@ interface Product {
404
472
  description?: string | null;
405
473
  descriptionFormat?: 'text' | 'html' | 'markdown' | null;
406
474
  sku: string;
475
+ /** Global Trade Item Number (EAN/UPC/ISBN). Emitted in Product JSON-LD. */
476
+ gtin?: string | null;
477
+ /** Manufacturer Part Number. Emitted in Product JSON-LD. */
478
+ mpn?: string | null;
407
479
  /**
408
480
  * Base price as string (e.g., "29.99"). Use parseFloat() for calculations.
409
481
  *
@@ -1169,9 +1241,35 @@ interface ProductSuggestion {
1169
1241
  interface CategoryNode {
1170
1242
  id: string;
1171
1243
  name: string;
1244
+ /** URL-friendly handle — link a category page as `/category/${slug}`. */
1245
+ slug?: string | null;
1172
1246
  parentId?: string | null;
1247
+ image?: string | null;
1173
1248
  children: CategoryNode[];
1174
1249
  }
1250
+ /**
1251
+ * Full category-page payload from {@link BrainerceClient.getCategoryBySlug}.
1252
+ * Backs a storefront category (a.k.a. collection) landing page — the
1253
+ * highest-leverage organic-SEO surface. The products themselves come from a
1254
+ * separate `getProducts({ categories: [id] })` call, so this stays metadata.
1255
+ */
1256
+ interface CategoryDetail {
1257
+ id: string;
1258
+ name: string;
1259
+ slug: string | null;
1260
+ /** Long-form category copy as sanitized HTML (render below the grid). */
1261
+ description: string | null;
1262
+ /** Meta description for the category page `<meta name="description">`. */
1263
+ metaDescription: string | null;
1264
+ image: string | null;
1265
+ /** Ancestor chain (root → parent), for breadcrumb JSON-LD + UI. */
1266
+ breadcrumb: Array<{
1267
+ name: string;
1268
+ slug: string | null;
1269
+ }>;
1270
+ /** Products published to this channel + active + in this category. */
1271
+ productCount: number;
1272
+ }
1175
1273
  /**
1176
1274
  * Category suggestion for autocomplete.
1177
1275
  *
@@ -2985,15 +3083,14 @@ interface AddressDetailsResult {
2985
3083
  line1: string;
2986
3084
  city: string;
2987
3085
  /**
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.
3086
+ * This platform's own region `code` for the resolved place (the same
3087
+ * code `getShippingDestinations()`'s `regions` list uses), already
3088
+ * reconciled server-side from whatever raw text Google returned empty
3089
+ * string when nothing could be matched. Still validate it against
3090
+ * `destinations.regions[country]` (matching by `code`) before assigning
3091
+ * into a `SetShippingAddressDto.region` field rather than trusting it
3092
+ * unconditionally an empty/unresolved value should leave the field for
3093
+ * the shopper to pick manually, not get assigned as-is.
2997
3094
  */
2998
3095
  region: string;
2999
3096
  postalCode: string;
@@ -6126,6 +6223,23 @@ declare class BrainerceClient {
6126
6223
  }): Promise<{
6127
6224
  categories: CategoryNode[];
6128
6225
  }>;
6226
+ /**
6227
+ * Get one category by slug — the payload for a storefront category
6228
+ * (collection) landing page: name, description HTML, meta, breadcrumb and
6229
+ * product count. Fetch the products themselves with
6230
+ * `getProducts({ categories: [category.id] })`. Vibe-coded mode only, like
6231
+ * {@link getCategories}.
6232
+ *
6233
+ * @example
6234
+ * ```typescript
6235
+ * const category = await client.getCategoryBySlug('running-shoes').catch(() => null);
6236
+ * if (!category) notFound();
6237
+ * const { data: products } = await client.getProducts({ categories: [category.id] });
6238
+ * ```
6239
+ */
6240
+ getCategoryBySlug(slug: string, options?: {
6241
+ locale?: string;
6242
+ }): Promise<CategoryDetail>;
6129
6243
  /**
6130
6244
  * Get available brands for filtering products
6131
6245
  * Works in vibe-coded mode
@@ -9015,15 +9129,18 @@ declare class BrainerceClient {
9015
9129
  }): Promise<CustomerProfile>;
9016
9130
  /**
9017
9131
  * 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.
9132
+ * lifetime earned, the program's display config, earned milestone `badges`,
9133
+ * and the `paidMembership` subscription state (null for free members).
9134
+ * Requires customerToken. Only available in storefront mode. `program` is
9135
+ * null when the store has no loyalty program.
9021
9136
  *
9022
9137
  * @example
9023
9138
  * ```typescript
9024
9139
  * client.setCustomerToken(auth.token);
9025
9140
  * const status = await client.getLoyaltyStatus();
9026
9141
  * if (status.enrolled) console.log(`${status.pointsBalance} ${status.program?.pointsName}`);
9142
+ * status.badges?.forEach((b) => console.log(`🏅 ${b.name}`));
9143
+ * if (status.paidMembership?.status === 'ACTIVE') showPremiumPerks(status.paidMembership.plan);
9027
9144
  * ```
9028
9145
  */
9029
9146
  getLoyaltyStatus(): Promise<LoyaltyStatus>;
@@ -9093,6 +9210,79 @@ declare class BrainerceClient {
9093
9210
  * ```
9094
9211
  */
9095
9212
  getReferralInfo(code: string): Promise<ReferralInfo>;
9213
+ /**
9214
+ * AI-recommended reward for the logged-in customer — "recommended for you"
9215
+ * at the top of the rewards list (requires customerToken). The result is
9216
+ * ALWAYS a real reward from the store's catalog (the AI only ranks; a
9217
+ * hallucinated pick falls back to a deterministic choice). Returns
9218
+ * `{ reward: null }` when the catalog is empty. Rate-limited (5/min per
9219
+ * customer — it spends the merchant's AI credits). Only available in
9220
+ * storefront mode.
9221
+ *
9222
+ * @example
9223
+ * ```typescript
9224
+ * const { reward, reason } = await client.getRecommendedReward();
9225
+ * if (reward) showRecommendation(reward, reason);
9226
+ * ```
9227
+ */
9228
+ getRecommendedReward(): Promise<LoyaltyRewardRecommendation>;
9229
+ /**
9230
+ * List the paid membership plans the customer can subscribe to (requires
9231
+ * customerToken). Empty when the store offers none or the program is not
9232
+ * active. Only available in storefront mode.
9233
+ *
9234
+ * @example
9235
+ * ```typescript
9236
+ * const plans = await client.getMembershipPlans();
9237
+ * ```
9238
+ */
9239
+ getMembershipPlans(): Promise<LoyaltyMembershipPlan[]>;
9240
+ /**
9241
+ * List the customer's saved payment methods (display fields only — brand /
9242
+ * last4 / expiry, never card data) for the membership subscribe flow.
9243
+ * Requires customerToken. Cards are vaulted by checking out with
9244
+ * `saveCard: true`. Only available in storefront mode.
9245
+ *
9246
+ * @example
9247
+ * ```typescript
9248
+ * const methods = await client.getMySavedPaymentMethods();
9249
+ * ```
9250
+ */
9251
+ getMySavedPaymentMethods(): Promise<StorefrontSavedPaymentMethod[]>;
9252
+ /**
9253
+ * Subscribe the customer to a paid membership plan — charges the saved card
9254
+ * IMMEDIATELY and starts the recurring cycle (requires customerToken).
9255
+ * Throws a 409 with a `code` ('card_declined' | 'requires_action' | ...)
9256
+ * when the charge fails; 3D-Secure challenges are not supported off-session
9257
+ * and surface as `requires_action`. Only available in storefront mode.
9258
+ *
9259
+ * @example
9260
+ * ```typescript
9261
+ * const membership = await client.subscribeToMembership({
9262
+ * planId: plan.id,
9263
+ * savedPaymentTokenId: method.id,
9264
+ * });
9265
+ * // membership.status === 'ACTIVE'
9266
+ * ```
9267
+ */
9268
+ subscribeToMembership(params: {
9269
+ planId: string;
9270
+ savedPaymentTokenId: string;
9271
+ }): Promise<PaidMembershipInfo>;
9272
+ /**
9273
+ * Cancel the customer's paid membership (requires customerToken).
9274
+ * End-of-period semantics: perks continue until `nextBillingAt`, then the
9275
+ * subscription ends without another charge (a PAST_DUE membership cancels
9276
+ * immediately). Re-subscribing to the same plan before period end simply
9277
+ * un-cancels. Only available in storefront mode.
9278
+ *
9279
+ * @example
9280
+ * ```typescript
9281
+ * const membership = await client.cancelMembership();
9282
+ * // membership.cancelAtPeriodEnd === true
9283
+ * ```
9284
+ */
9285
+ cancelMembership(): Promise<PaidMembershipInfo>;
9096
9286
  /**
9097
9287
  * Get the current customer's orders (requires customerToken)
9098
9288
  * Works in vibe-coded and storefront modes
@@ -10453,4 +10643,147 @@ declare function formatVariantPrice(variant: Pick<ProductVariant, 'price' | 'sal
10453
10643
  /** Format any numeric amount as currency. Useful for cart totals, fees, etc. */
10454
10644
  declare function formatMoney(amount: number, currency: string, locale?: string): string;
10455
10645
 
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 };
10646
+ /**
10647
+ * JSON-LD (schema.org) builders for storefronts.
10648
+ *
10649
+ * Structured data is the "organic visibility without a Merchant Center feed"
10650
+ * lever: complete Product markup (Offer, availability, ratings) qualifies
10651
+ * pages for Google merchant-listing surfaces directly, and Organization/
10652
+ * Article/BreadcrumbList markup feeds rich results and AI-answer citations.
10653
+ *
10654
+ * Pure functions — no client dependency, framework-agnostic. Render with
10655
+ * {@link jsonLdScriptProps}:
10656
+ *
10657
+ * <script {...jsonLdScriptProps(buildProductJsonLd(product, { siteUrl, path }))} />
10658
+ *
10659
+ * Rules baked in (Google's structured-data guidelines):
10660
+ * - Product markup belongs on single-product pages only.
10661
+ * - `aggregateRating` is emitted ONLY when the product has visible reviews.
10662
+ * - Offers carry ISO-4217 currency and a positive price.
10663
+ */
10664
+
10665
+ interface JsonLdOptions {
10666
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10667
+ siteUrl: string;
10668
+ /** Path of the page being marked up, e.g. "/products/red-shoes". */
10669
+ path?: string;
10670
+ }
10671
+ type JsonLd = Record<string, unknown>;
10672
+ /**
10673
+ * schema.org/Article for a blog post. Emit on the article page
10674
+ * (`/blog/[slug]`) alongside {@link buildBreadcrumbJsonLd}.
10675
+ */
10676
+ declare function buildArticleJsonLd(post: BlogPost, opts: JsonLdOptions & {
10677
+ organizationName?: string;
10678
+ }): JsonLd;
10679
+ /**
10680
+ * schema.org/Product for a single-product page (PDP). Do NOT emit on
10681
+ * category/listing pages — Google's Product rich results apply to
10682
+ * single-product pages only.
10683
+ */
10684
+ declare function buildProductJsonLd(product: Product, opts: JsonLdOptions & {
10685
+ /** ISO-4217 currency code, e.g. "USD" / "ILS" (from StoreInfo.currency). */
10686
+ currency: string;
10687
+ /** Brand display name; falls back to product.brands[0]. */
10688
+ brandName?: string;
10689
+ }): JsonLd;
10690
+ /**
10691
+ * schema.org/Organization for the homepage (Knowledge Panel + AI-answer
10692
+ * citation grounding).
10693
+ */
10694
+ declare function buildOrganizationJsonLd(store: StoreInfo, opts: JsonLdOptions): JsonLd;
10695
+ /**
10696
+ * schema.org/WebSite for the homepage. Establishes the site as a brand entity
10697
+ * (an off-page "Authority" signal that grounds Google's Knowledge Panel and AI
10698
+ * answers) and — when `searchUrlTemplate` is given — declares a SearchAction so
10699
+ * Google can show a sitelinks search box for the brand.
10700
+ *
10701
+ * `searchUrlTemplate` must contain the literal token `{search_term_string}`,
10702
+ * e.g. `"/products?search={search_term_string}"`. Only pass it when the site
10703
+ * actually has a search results page at that URL.
10704
+ */
10705
+ declare function buildWebsiteJsonLd(store: StoreInfo, opts: JsonLdOptions & {
10706
+ searchUrlTemplate?: string;
10707
+ }): JsonLd;
10708
+ /**
10709
+ * schema.org/CollectionPage for a category (collection) landing page. This is
10710
+ * the correct markup for a listing page — never emit {@link buildProductJsonLd}
10711
+ * here (Product rich results are single-product only). Pair with
10712
+ * {@link buildBreadcrumbJsonLd} built from `category.breadcrumb`.
10713
+ */
10714
+ declare function buildCollectionPageJsonLd(category: Pick<CategoryDetail, 'name' | 'description' | 'metaDescription' | 'image'>, opts: JsonLdOptions): JsonLd;
10715
+ /** schema.org/BreadcrumbList. Items in order from root to current page. */
10716
+ declare function buildBreadcrumbJsonLd(items: Array<{
10717
+ name: string;
10718
+ url: string;
10719
+ }>): JsonLd;
10720
+ /**
10721
+ * Safe `<script type="application/ld+json">` props for React. Escapes `<` so
10722
+ * malicious content can never close the script tag (XSS-safe serialization).
10723
+ */
10724
+ declare function jsonLdScriptProps(data: JsonLd): {
10725
+ type: 'application/ld+json';
10726
+ dangerouslySetInnerHTML: {
10727
+ __html: string;
10728
+ };
10729
+ };
10730
+
10731
+ /**
10732
+ * Sitemap helpers for storefronts.
10733
+ *
10734
+ * `getBlogSitemapEntries` paginates the public blog API and returns entries
10735
+ * structurally compatible with Next.js `MetadataRoute.Sitemap` — without
10736
+ * importing Next (the SDK stays framework-agnostic).
10737
+ *
10738
+ * // app/sitemap.ts
10739
+ * const blogPages = await getBlogSitemapEntries(client, { siteUrl }).catch(() => []);
10740
+ * return [...staticPages, ...productPages, ...blogPages];
10741
+ */
10742
+
10743
+ interface SitemapEntry {
10744
+ url: string;
10745
+ lastModified?: Date;
10746
+ changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
10747
+ priority?: number;
10748
+ }
10749
+ interface BlogSitemapOptions {
10750
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10751
+ siteUrl: string;
10752
+ /** Blog route prefix. Default '/blog'. */
10753
+ basePath?: string;
10754
+ /**
10755
+ * Locales to emit locale-prefixed entries for (e.g. ['en','he']). When set
10756
+ * with `defaultLocale`, the default locale is emitted unprefixed and every
10757
+ * other locale as `/{locale}{basePath}/{slug}` — matching the product-page
10758
+ * convention in the storefront template.
10759
+ */
10760
+ locales?: string[];
10761
+ defaultLocale?: string;
10762
+ /** Page size per API call (max 100). Default 100. */
10763
+ pageSize?: number;
10764
+ /** Safety cap on total entries. Default 5000. */
10765
+ maxEntries?: number;
10766
+ }
10767
+ /**
10768
+ * Fetch every published blog post and map to sitemap entries. Public mode
10769
+ * only returns PUBLISHED posts, so no status filtering is needed.
10770
+ */
10771
+ declare function getBlogSitemapEntries(client: BrainerceClient, opts: BlogSitemapOptions): Promise<SitemapEntry[]>;
10772
+ interface CategorySitemapOptions {
10773
+ /** Canonical site origin, e.g. "https://shop.com" (no trailing slash). */
10774
+ siteUrl: string;
10775
+ /** Category route prefix. Default '/category'. */
10776
+ basePath?: string;
10777
+ /** Emit locale-prefixed variants for these (default locale stays unprefixed). */
10778
+ locales?: string[];
10779
+ defaultLocale?: string;
10780
+ }
10781
+ /**
10782
+ * Category (collection) pages for the sitemap — high-priority organic-SEO
10783
+ * surfaces. Walks the {@link BrainerceClient.getCategories} tree and emits one
10784
+ * entry per category that has a slug. Categories carry no lastModified in the
10785
+ * public tree, so entries omit it.
10786
+ */
10787
+ declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
10788
+
10789
+ 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 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 };