brainerce 1.20.2 → 1.23.11

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
@@ -1,18 +1,21 @@
1
1
  interface BrainerceClientOptions {
2
2
  /**
3
- * Connection ID for vibe-coded sites (starts with "vc_").
4
- * This is the simplest way to connect - just use your Connection ID!
3
+ * Sales Channel ID (starts with "vc_") — the simplest way to connect.
5
4
  * Safe to use in frontend applications.
6
5
  *
7
6
  * @example
8
7
  * ```typescript
9
- * // Vibe-coded site usage - simplest option!
10
8
  * const client = new BrainerceClient({
11
- * connectionId: 'vc_abc123xyz...',
9
+ * salesChannelId: 'vc_abc123xyz...',
12
10
  * });
13
11
  * const products = await client.getProducts();
14
12
  * ```
15
13
  */
14
+ salesChannelId?: string;
15
+ /**
16
+ * @deprecated Use `salesChannelId` instead. `connectionId` is kept as a
17
+ * backwards-compatible alias and will be removed in SDK 2.0.
18
+ */
16
19
  connectionId?: string;
17
20
  /**
18
21
  * Store ID for public storefront access (no API key needed).
@@ -115,17 +118,21 @@ interface StoreInfo {
115
118
  name: string;
116
119
  currency: string;
117
120
  language: string;
118
- /** Connection ID (vibe-coded mode only) */
121
+ /** Sales Channel ID (sales-channel mode only) */
122
+ salesChannelId?: string;
123
+ /** @deprecated alias of `salesChannelId` — will be removed in SDK 2.0 */
119
124
  connectionId?: string;
120
- /** Store name (vibe-coded mode only - same as name) */
125
+ /** Store name (sales-channel mode only - same as name) */
121
126
  storeName?: string;
122
- /** Connection status (vibe-coded mode only) */
127
+ /** Sales channel status (sales-channel mode only) */
128
+ salesChannelStatus?: string;
129
+ /** @deprecated alias of `salesChannelStatus` — will be removed in SDK 2.0 */
123
130
  status?: string;
124
- /** Allowed API scopes (vibe-coded mode only) */
131
+ /** Allowed API scopes (sales-channel mode only) */
125
132
  allowedScopes?: string[];
126
- /** Whether orders can be created (vibe-coded mode only) */
133
+ /** Whether orders can be created (sales-channel mode only) */
127
134
  ordersWriteEnabled?: boolean;
128
- /** Whether guest checkout is tracked (vibe-coded mode only) */
135
+ /** Whether guest checkout is tracked (sales-channel mode only) */
129
136
  guestCheckoutTracking?: boolean;
130
137
  /**
131
138
  * Whether new customer registrations require email verification.
@@ -272,15 +279,34 @@ interface Product {
272
279
  translations?: Record<string, Record<string, string>> | null;
273
280
  } | null;
274
281
  }>;
275
- /** Vibe-coded sites this product is published to (admin mode only) */
282
+ /** Sales channels this product is published to (admin mode only) */
283
+ channelPublishes?: Array<{
284
+ salesChannel: {
285
+ id: string;
286
+ name: string;
287
+ connectionId: string;
288
+ };
289
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
290
+ connection?: {
291
+ id: string;
292
+ name: string;
293
+ connectionId: string;
294
+ };
295
+ }>;
296
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
276
297
  vibeCodedPublishes?: Array<{
277
- connection: {
298
+ salesChannel: {
299
+ id: string;
300
+ name: string;
301
+ connectionId: string;
302
+ };
303
+ connection?: {
278
304
  id: string;
279
305
  name: string;
280
306
  connectionId: string;
281
307
  };
282
308
  }>;
283
- /** Discount info from matching discount rules (storefront/VC mode only) */
309
+ /** Discount info from matching discount rules (storefront/sales-channel mode only) */
284
310
  discount?: ProductDiscount | null;
285
311
  /** Recommendations (upsells, cross-sells, related) — included in storefront/VC getProductBySlug response */
286
312
  recommendations?: ProductRecommendationsResponse;
@@ -730,6 +756,21 @@ interface ProductQueryParams {
730
756
  minPrice?: number;
731
757
  /** Maximum price filter */
732
758
  maxPrice?: number;
759
+ /**
760
+ * Filter by custom-field (metafield) values. Keys are metafield definition
761
+ * keys (e.g. "color", "in_stock"); each value is one or more accepted values.
762
+ * Only definitions with `filterable: true` and a supported type
763
+ * (SELECT / MULTI_SELECT / BOOLEAN) are honored — others are ignored
764
+ * server-side.
765
+ *
766
+ * @example
767
+ * ```typescript
768
+ * client.getProducts({
769
+ * metafields: { color: ['red', 'blue'], in_stock: ['true'] },
770
+ * });
771
+ * ```
772
+ */
773
+ metafields?: Record<string, string | string[]>;
733
774
  /** Sort by field (default: menuOrder) */
734
775
  sortBy?: 'name' | 'price' | 'createdAt';
735
776
  sortOrder?: 'asc' | 'desc';
@@ -1093,6 +1134,33 @@ interface Coupon {
1093
1134
  lastSyncedAt?: string | null;
1094
1135
  /** Per-platform channel overrides */
1095
1136
  channels?: Record<string, Record<string, unknown>> | null;
1137
+ /** Sales channels this coupon is explicitly published to (admin response only). */
1138
+ channelPublishes?: Array<{
1139
+ salesChannel: {
1140
+ id: string;
1141
+ name: string;
1142
+ connectionId: string;
1143
+ };
1144
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
1145
+ connection?: {
1146
+ id: string;
1147
+ name: string;
1148
+ connectionId: string;
1149
+ };
1150
+ }>;
1151
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
1152
+ vibeCodedPublishes?: Array<{
1153
+ salesChannel: {
1154
+ id: string;
1155
+ name: string;
1156
+ connectionId: string;
1157
+ };
1158
+ connection?: {
1159
+ id: string;
1160
+ name: string;
1161
+ connectionId: string;
1162
+ };
1163
+ }>;
1096
1164
  createdAt: string;
1097
1165
  updatedAt: string;
1098
1166
  }
@@ -1216,6 +1284,34 @@ interface Customer {
1216
1284
  createdAt: string;
1217
1285
  updatedAt: string;
1218
1286
  }
1287
+ /**
1288
+ * Display-only summary of a vaulted payment method.
1289
+ *
1290
+ * The underlying provider token is encrypted at rest in the platform
1291
+ * DB and NEVER exposed through any public API. Use the fields below
1292
+ * for UI ("Visa ending in 4242, exp 03/26").
1293
+ */
1294
+ interface SavedPaymentMethodSummary {
1295
+ id: string;
1296
+ customerId: string;
1297
+ appInstallationId: string;
1298
+ /** 'credit_card' | 'paypal' | 'bank_account'. Provider-controlled. */
1299
+ paymentMethod: string;
1300
+ /** Card brand (Visa, Mastercard, etc.). May be null for non-card methods. */
1301
+ brand: string | null;
1302
+ /** Last 4 digits. May be null for non-card methods. */
1303
+ last4: string | null;
1304
+ expMonth: number | null;
1305
+ expYear: number | null;
1306
+ isDefault: boolean;
1307
+ /** 'active' | 'expired' | 'invalid'. */
1308
+ status: string;
1309
+ failureReason: string | null;
1310
+ lastUsedAt: string | null;
1311
+ expiresAt: string | null;
1312
+ createdAt: string;
1313
+ updatedAt: string;
1314
+ }
1219
1315
  interface CustomerAddress {
1220
1316
  id: string;
1221
1317
  label?: string;
@@ -1414,6 +1510,10 @@ type CartStatus = 'ACTIVE' | 'MERGED' | 'CONVERTED' | 'ABANDONED';
1414
1510
  * @see Cart
1415
1511
  * @see LocalCartItem for client-side cart items
1416
1512
  */
1513
+ /**
1514
+ * Why a cart item is currently not purchasable. `null` means available.
1515
+ */
1516
+ type CartItemUnavailableReason = 'PRODUCT_DRAFT' | 'PRODUCT_ARCHIVED' | 'VARIANT_DRAFT' | 'VARIANT_DELETED' | 'INVENTORY_DISABLED' | 'OUT_OF_STOCK';
1417
1517
  interface CartItem {
1418
1518
  /** Unique identifier for this cart line item */
1419
1519
  id: string;
@@ -1424,10 +1524,26 @@ interface CartItem {
1424
1524
  /** Quantity of this item in the cart */
1425
1525
  quantity: number;
1426
1526
  /**
1427
- * Unit price as a string (e.g., "29.99").
1428
- * Use parseFloat() for calculations.
1527
+ * Snapshot price captured at add-to-cart time as a string (e.g., "29.99").
1528
+ * Stable until the customer accepts a price refresh. Use parseFloat() for
1529
+ * calculations.
1429
1530
  */
1430
1531
  unitPrice: string;
1532
+ /**
1533
+ * Live unit price resolved from the current product/variant. Differs from
1534
+ * `unitPrice` if the merchant changed the price after the item was added.
1535
+ * Display this if you want the customer to see the latest price.
1536
+ */
1537
+ currentUnitPrice: string;
1538
+ /** True iff `currentUnitPrice !== unitPrice`. */
1539
+ priceChanged: boolean;
1540
+ /** `currentUnitPrice - unitPrice` as a Decimal string (negative = cheaper now). */
1541
+ priceDelta: string;
1542
+ priceDirection: 'increased' | 'decreased' | 'unchanged';
1543
+ /** False if the item cannot be purchased right now. Block checkout / show banner. */
1544
+ isAvailable: boolean;
1545
+ /** Why the item is unavailable. `null` when `isAvailable === true`. */
1546
+ unavailableReason: CartItemUnavailableReason | null;
1431
1547
  /**
1432
1548
  * Discount amount applied to this item as a string (from discount rules).
1433
1549
  * Use parseFloat() for calculations.
@@ -1446,6 +1562,27 @@ interface CartItem {
1446
1562
  notes?: string | null;
1447
1563
  /** Optional metadata for this line item */
1448
1564
  metadata?: Record<string, unknown> | null;
1565
+ /**
1566
+ * Per-line modifier breakdown — present when the line was added with
1567
+ * modifier `selections`. Snapshot taken at add-time; immutable to catalog
1568
+ * edits afterward (PRD §5.6.4).
1569
+ */
1570
+ modifiers?: CartItemModifierLine[];
1571
+ /**
1572
+ * Decimal-string total of the modifier deltas applied to this line
1573
+ * (after free-allocation). Present when `modifiers` is non-empty.
1574
+ */
1575
+ modifiersTotal?: string;
1576
+ /**
1577
+ * PRD §15 Q5 — when this cart line is a child of a nested-combo parent
1578
+ * (e.g. the burger inside a "Build Your Combo"), `parentCartItemId`
1579
+ * points at the parent CartItem.id. Absent / null for top-level lines.
1580
+ *
1581
+ * Storefronts can group children visually under their parent in the
1582
+ * cart drawer; the cart subtotal already includes every line in the
1583
+ * tree, so children should NOT be summed twice.
1584
+ */
1585
+ parentCartItemId?: string | null;
1449
1586
  /**
1450
1587
  * Nested product information.
1451
1588
  * Access product details via this object (e.g., item.product.name).
@@ -1539,6 +1676,15 @@ interface Cart {
1539
1676
  items: CartItem[];
1540
1677
  /** Total number of items (sum of quantities) */
1541
1678
  itemCount: number;
1679
+ /**
1680
+ * True if any item has `priceChanged === true`. Use as a single signal to
1681
+ * show a "prices have changed" banner without iterating items.
1682
+ */
1683
+ hasPriceChanges: boolean;
1684
+ /** True if any item has `isAvailable === false`. */
1685
+ hasUnavailableItems: boolean;
1686
+ /** Convenience list of unavailable `CartItem.id`s. */
1687
+ unavailableItemIds: string[];
1542
1688
  /** ISO timestamp when cart expires */
1543
1689
  expiresAt?: string | null;
1544
1690
  /** ISO timestamp when cart was created */
@@ -1558,6 +1704,19 @@ interface AddToCartDto {
1558
1704
  quantity: number;
1559
1705
  notes?: string;
1560
1706
  metadata?: Record<string, unknown>;
1707
+ /**
1708
+ * Modifier-group selections for restaurant / customizable products
1709
+ * (e.g., toppings, sauces, sides). The server validates against effective
1710
+ * group rules and rejects invalid payloads with a `MODIFIER_VALIDATION_FAILED`
1711
+ * envelope (`BrainerceError.errorData`).
1712
+ */
1713
+ selections?: ModifierSelection[];
1714
+ /**
1715
+ * Nested-combo selections keyed by parent `modifierId` — only required when
1716
+ * a picked modifier carries `referencedProductId` and that referenced product
1717
+ * itself has modifier groups. Server enforces depth ≤ 3.
1718
+ */
1719
+ nestedByModifierId?: Record<string, ModifierSelection[]>;
1561
1720
  /**
1562
1721
  * Optional product info for local cart (guest mode).
1563
1722
  * If provided, SDK uses this directly without fetching from API.
@@ -1572,6 +1731,14 @@ interface AddToCartDto {
1572
1731
  }
1573
1732
  interface UpdateCartItemDto {
1574
1733
  quantity: number;
1734
+ /**
1735
+ * Replace the line's modifier selections. Idempotent: server deletes
1736
+ * existing `CartItemModifier` rows and recreates them inside the same
1737
+ * transaction (PRD §7.2.3).
1738
+ */
1739
+ selections?: ModifierSelection[];
1740
+ /** Nested-combo selections (see `AddToCartDto.nestedByModifierId`). */
1741
+ nestedByModifierId?: Record<string, ModifierSelection[]>;
1575
1742
  }
1576
1743
  interface ApplyCouponDto {
1577
1744
  code: string;
@@ -2848,6 +3015,33 @@ interface Category {
2848
3015
  name: string;
2849
3016
  sku?: string;
2850
3017
  }>;
3018
+ /** Sales channels this category is explicitly published to (admin response only). */
3019
+ channelPublishes?: Array<{
3020
+ salesChannel: {
3021
+ id: string;
3022
+ name: string;
3023
+ connectionId: string;
3024
+ };
3025
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
3026
+ connection?: {
3027
+ id: string;
3028
+ name: string;
3029
+ connectionId: string;
3030
+ };
3031
+ }>;
3032
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
3033
+ vibeCodedPublishes?: Array<{
3034
+ salesChannel: {
3035
+ id: string;
3036
+ name: string;
3037
+ connectionId: string;
3038
+ };
3039
+ connection?: {
3040
+ id: string;
3041
+ name: string;
3042
+ connectionId: string;
3043
+ };
3044
+ }>;
2851
3045
  createdAt: string;
2852
3046
  updatedAt: string;
2853
3047
  }
@@ -2893,6 +3087,33 @@ interface Brand {
2893
3087
  name: string;
2894
3088
  sku?: string;
2895
3089
  }>;
3090
+ /** Sales channels this brand is explicitly published to (admin response only). */
3091
+ channelPublishes?: Array<{
3092
+ salesChannel: {
3093
+ id: string;
3094
+ name: string;
3095
+ connectionId: string;
3096
+ };
3097
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
3098
+ connection?: {
3099
+ id: string;
3100
+ name: string;
3101
+ connectionId: string;
3102
+ };
3103
+ }>;
3104
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
3105
+ vibeCodedPublishes?: Array<{
3106
+ salesChannel: {
3107
+ id: string;
3108
+ name: string;
3109
+ connectionId: string;
3110
+ };
3111
+ connection?: {
3112
+ id: string;
3113
+ name: string;
3114
+ connectionId: string;
3115
+ };
3116
+ }>;
2896
3117
  createdAt: string;
2897
3118
  updatedAt: string;
2898
3119
  }
@@ -2922,6 +3143,8 @@ interface Tag {
2922
3143
  platformIds?: Record<string, string> | null;
2923
3144
  /** Platforms this tag is published on */
2924
3145
  publishedOn: string[];
3146
+ /** Per-platform mapping config (parity with Category/Brand/MetafieldDefinition). */
3147
+ platformMetadata?: Record<string, Record<string, unknown>> | null;
2925
3148
  isActive: boolean;
2926
3149
  productCount?: number;
2927
3150
  products?: Array<{
@@ -2929,6 +3152,33 @@ interface Tag {
2929
3152
  name: string;
2930
3153
  sku?: string;
2931
3154
  }>;
3155
+ /** Sales channels this tag is explicitly published to (admin response only). */
3156
+ channelPublishes?: Array<{
3157
+ salesChannel: {
3158
+ id: string;
3159
+ name: string;
3160
+ connectionId: string;
3161
+ };
3162
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
3163
+ connection?: {
3164
+ id: string;
3165
+ name: string;
3166
+ connectionId: string;
3167
+ };
3168
+ }>;
3169
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
3170
+ vibeCodedPublishes?: Array<{
3171
+ salesChannel: {
3172
+ id: string;
3173
+ name: string;
3174
+ connectionId: string;
3175
+ };
3176
+ connection?: {
3177
+ id: string;
3178
+ name: string;
3179
+ connectionId: string;
3180
+ };
3181
+ }>;
2932
3182
  createdAt: string;
2933
3183
  updatedAt: string;
2934
3184
  }
@@ -3193,11 +3443,21 @@ interface UpdateTaxRateDto {
3193
3443
  */
3194
3444
  type MetafieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME' | 'URL' | 'COLOR' | 'DIMENSION' | 'WEIGHT' | 'JSON' | 'IMAGE' | 'GALLERY' | 'SELECT' | 'MULTI_SELECT';
3195
3445
  /**
3196
- * Metafield definition - schema for product metafields
3446
+ * Metafield definition - schema for product metafields.
3447
+ *
3448
+ * Definitions are scoped either to a single store (`storeId` set) or to
3449
+ * the entire account (`storeId === null`). Listing from a store route
3450
+ * returns both — store-scoped first, then account-wide.
3451
+ *
3452
+ * Platform sync state is stored inline (`publishedOn`, `platformMetadata`,
3453
+ * etc.) — same shape as Category / Tag / Brand. The `MetafieldPlatformMapping`
3454
+ * junction was dropped on 2026-04-30.
3197
3455
  */
3198
3456
  interface MetafieldDefinition {
3199
3457
  id: string;
3200
3458
  accountId: string;
3459
+ /** When null, the definition is shared across the account; otherwise it belongs to this store. */
3460
+ storeId: string | null;
3201
3461
  name: string;
3202
3462
  key: string;
3203
3463
  description?: string | null;
@@ -3210,6 +3470,12 @@ interface MetafieldDefinition {
3210
3470
  * individual `ProductCustomizationField` rows when this is set.
3211
3471
  */
3212
3472
  appliesToAllProducts?: boolean;
3473
+ /**
3474
+ * When `true`, the field is exposed in storefront facet filters. Only
3475
+ * meaningful for SELECT / MULTI_SELECT / BOOLEAN types — the backend
3476
+ * rejects setting this on other types.
3477
+ */
3478
+ filterable?: boolean;
3213
3479
  minLength?: number | null;
3214
3480
  maxLength?: number | null;
3215
3481
  minValue?: number | null;
@@ -3218,15 +3484,64 @@ interface MetafieldDefinition {
3218
3484
  defaultValue?: string | null;
3219
3485
  position: number;
3220
3486
  isActive: boolean;
3221
- mappings?: MetafieldPlatformMapping[];
3487
+ /** Sales channels / platforms where this field is published. */
3488
+ publishedOn: string[];
3489
+ /** External IDs of the metafield definition on each platform. */
3490
+ platformIds?: Record<string, string> | null;
3491
+ /** Per-platform mapping config required for sync. */
3492
+ platformMetadata?: PlatformMetafieldMetadata | null;
3493
+ /** Sync state per platform. */
3494
+ syncStatus?: Record<string, string> | null;
3495
+ /** Last sync timestamp per platform (ISO strings). */
3496
+ lastSyncedAt?: Record<string, string> | null;
3497
+ /** Origin of the definition (e.g. "LOCAL", "SHOPIFY"). */
3498
+ source: string;
3222
3499
  /** Products this definition is explicitly attached to (customer-input only). */
3223
3500
  products?: Array<{
3224
3501
  id: string;
3225
3502
  name: string;
3226
3503
  }>;
3504
+ /** Sales channels this definition is explicitly published to (admin response only). */
3505
+ channelPublishes?: Array<{
3506
+ salesChannel: {
3507
+ id: string;
3508
+ name: string;
3509
+ connectionId: string;
3510
+ };
3511
+ /** @deprecated alias of `salesChannel` — will be removed in SDK 2.0 */
3512
+ connection?: {
3513
+ id: string;
3514
+ name: string;
3515
+ connectionId: string;
3516
+ };
3517
+ }>;
3518
+ /** @deprecated alias of `channelPublishes` — will be removed in SDK 2.0 */
3519
+ vibeCodedPublishes?: Array<{
3520
+ salesChannel: {
3521
+ id: string;
3522
+ name: string;
3523
+ connectionId: string;
3524
+ };
3525
+ connection?: {
3526
+ id: string;
3527
+ name: string;
3528
+ connectionId: string;
3529
+ };
3530
+ }>;
3227
3531
  createdAt: string;
3228
3532
  updatedAt: string;
3229
3533
  }
3534
+ /**
3535
+ * Per-platform mapping configuration. Required entry per platform listed in
3536
+ * `publishedOn` for the platform to actually sync.
3537
+ *
3538
+ * Shape per platform:
3539
+ * - `SHOPIFY`: `{ namespace: string; key: string; type?: string }`
3540
+ * - `WOOCOMMERCE`: `{ key: string }`
3541
+ * - `TIKTOK`: `{ attributeName: string }`
3542
+ * - `META`: `{ field: 'custom_label_0' | … | 'custom_label_4' }`
3543
+ */
3544
+ type PlatformMetafieldMetadata = Record<string, Record<string, unknown>>;
3230
3545
  /**
3231
3546
  * Public subset of MetafieldDefinition for storefront/vibe-coded use.
3232
3547
  * Does not include admin-only validation fields.
@@ -3244,6 +3559,11 @@ interface PublicMetafieldDefinition {
3244
3559
  * including ones created after the flag was set.
3245
3560
  */
3246
3561
  appliesToAllProducts?: boolean;
3562
+ /**
3563
+ * When true, the storefront should expose this field as a facet filter.
3564
+ * Pair with `getProducts({ metafields: { [key]: [...] } })`.
3565
+ */
3566
+ filterable?: boolean;
3247
3567
  enumValues?: string[];
3248
3568
  minLength?: number | null;
3249
3569
  maxLength?: number | null;
@@ -3271,19 +3591,6 @@ interface ProductCustomizationField {
3271
3591
  defaultValue?: string | null;
3272
3592
  position: number;
3273
3593
  }
3274
- /**
3275
- * Platform mapping for metafield syncing
3276
- */
3277
- interface MetafieldPlatformMapping {
3278
- id: string;
3279
- definitionId: string;
3280
- platform: ConnectorPlatform;
3281
- namespace: string;
3282
- key: string;
3283
- isEnabled: boolean;
3284
- createdAt: string;
3285
- updatedAt: string;
3286
- }
3287
3594
  interface CreateMetafieldDefinitionDto {
3288
3595
  name: string;
3289
3596
  key: string;
@@ -3293,6 +3600,11 @@ interface CreateMetafieldDefinitionDto {
3293
3600
  isCustomerInput?: boolean;
3294
3601
  /** When true the field applies to every product in the account. */
3295
3602
  appliesToAllProducts?: boolean;
3603
+ /**
3604
+ * When true, the field is exposed as a storefront facet filter. Backend
3605
+ * rejects this for types other than SELECT / MULTI_SELECT / BOOLEAN.
3606
+ */
3607
+ filterable?: boolean;
3296
3608
  /**
3297
3609
  * Assign the new (customer-input) definition to specific products atomically
3298
3610
  * in the same create call. Only valid when `isCustomerInput` is true.
@@ -3305,6 +3617,33 @@ interface CreateMetafieldDefinitionDto {
3305
3617
  enumValues?: string[];
3306
3618
  defaultValue?: string;
3307
3619
  position?: number;
3620
+ /**
3621
+ * When `true`, create the definition account-wide (`storeId = null`).
3622
+ * Defaults to false — the definition belongs to the store named in the
3623
+ * route's `:storeId` parameter.
3624
+ */
3625
+ accountWide?: boolean;
3626
+ /** Sales channels / platforms where this field is published. */
3627
+ publishedOn?: string[];
3628
+ /**
3629
+ * Per-platform sync configuration. Must contain a key for every platform
3630
+ * listed in `publishedOn`.
3631
+ */
3632
+ platformMetadata?: PlatformMetafieldMetadata;
3633
+ /** Origin of the definition (defaults to "LOCAL"). */
3634
+ source?: string;
3635
+ }
3636
+ /**
3637
+ * Replace the platform publishing configuration on a definition.
3638
+ * Updates `publishedOn` + `platformMetadata` atomically.
3639
+ */
3640
+ interface SetMetafieldPlatformsDto {
3641
+ publishedOn: string[];
3642
+ /**
3643
+ * Per-platform mapping config keyed by platform. Must contain a key for
3644
+ * every platform listed in `publishedOn`. Pass `null` to clear all metadata.
3645
+ */
3646
+ platformMetadata?: PlatformMetafieldMetadata | null;
3308
3647
  }
3309
3648
  interface UpdateMetafieldDefinitionDto {
3310
3649
  name?: string;
@@ -3313,6 +3652,8 @@ interface UpdateMetafieldDefinitionDto {
3313
3652
  required?: boolean;
3314
3653
  isCustomerInput?: boolean;
3315
3654
  appliesToAllProducts?: boolean;
3655
+ /** Toggle storefront filter exposure. See CreateMetafieldDefinitionDto.filterable. */
3656
+ filterable?: boolean;
3316
3657
  minLength?: number | null;
3317
3658
  maxLength?: number | null;
3318
3659
  minValue?: number | null;
@@ -3352,10 +3693,10 @@ interface UpsertProductMetafieldDto {
3352
3693
  variantId?: string;
3353
3694
  }
3354
3695
  /**
3355
- * @deprecated Use StoreRole instead. Account-level team management is deprecated
3356
- * in favor of store-level team management.
3696
+ * @deprecated Use StoreRole instead. Account-level team management is reserved
3697
+ * for billing/account-owner operations only.
3357
3698
  */
3358
- type TeamRole = 'ACCOUNT_OWNER' | 'STORE_MANAGER' | 'ANALYST' | 'INTEGRATION_BOT';
3699
+ type TeamRole = 'ACCOUNT_OWNER';
3359
3700
  /**
3360
3701
  * @deprecated Use StoreMember instead.
3361
3702
  */
@@ -3413,7 +3754,7 @@ interface UpdateMemberRoleDto {
3413
3754
  /** Store-level team member role */
3414
3755
  type StoreRole = 'OWNER' | 'MANAGER' | 'STAFF' | 'VIEWER';
3415
3756
  /** Granular store permission */
3416
- type StorePermission = 'VIEW_PRODUCTS' | 'CREATE_PRODUCTS' | 'EDIT_PRODUCTS' | 'DELETE_PRODUCTS' | 'MANAGE_PRODUCT_CATEGORIES' | 'VIEW_ORDERS' | 'UPDATE_ORDER_STATUS' | 'FULFILL_ORDERS' | 'CANCEL_ORDERS' | 'REFUND_ORDERS' | 'VIEW_INVENTORY' | 'UPDATE_INVENTORY' | 'VIEW_CUSTOMERS' | 'EDIT_CUSTOMERS' | 'DELETE_CUSTOMERS' | 'VIEW_ANALYTICS' | 'EXPORT_REPORTS' | 'MANAGE_STORE_SETTINGS' | 'MANAGE_INTEGRATIONS' | 'MANAGE_TEAM' | 'MANAGE_BILLING';
3757
+ type StorePermission = 'VIEW_PRODUCTS' | 'CREATE_PRODUCTS' | 'EDIT_PRODUCTS' | 'DELETE_PRODUCTS' | 'MANAGE_PRODUCT_CATEGORIES' | 'VIEW_ORDERS' | 'UPDATE_ORDER_STATUS' | 'FULFILL_ORDERS' | 'CANCEL_ORDERS' | 'REFUND_ORDERS' | 'VIEW_INVENTORY' | 'UPDATE_INVENTORY' | 'VIEW_CUSTOMERS' | 'EDIT_CUSTOMERS' | 'VIEW_ANALYTICS' | 'MANAGE_STORE_SETTINGS' | 'MANAGE_INTEGRATIONS' | 'MANAGE_TEAM' | 'MANAGE_BILLING';
3417
3758
  /** Store team member info */
3418
3759
  interface StoreMember {
3419
3760
  id: string;
@@ -3748,19 +4089,39 @@ interface LockedVariant {
3748
4089
  name?: string | null;
3749
4090
  attributes?: Record<string, string> | null;
3750
4091
  }
4092
+ interface CartBundleOfferOfferedProduct {
4093
+ id: string;
4094
+ name: string;
4095
+ slug: string | null;
4096
+ basePrice: string;
4097
+ salePrice: string | null;
4098
+ images: Array<{
4099
+ url: string;
4100
+ }>;
4101
+ type: string;
4102
+ originalPrice: string;
4103
+ discountedPrice: string;
4104
+ }
3751
4105
  interface CartBundleOffer {
3752
4106
  id: string;
3753
4107
  name: string;
3754
4108
  description: string | null;
3755
- sourceProductId: string;
3756
- bundleProduct: ProductRecommendation;
3757
- bundleVariantId: string | null;
3758
- requiresVariantSelection: boolean;
3759
- lockedVariant?: LockedVariant | null;
4109
+ /** First product in productIds — must be in cart for the bundle to surface. */
4110
+ triggerProductId: string;
4111
+ /**
4112
+ * Full product list for the bundle. Index 0 is the trigger; indices 1..n
4113
+ * are offered together at the discount.
4114
+ */
4115
+ productIds: string[];
4116
+ /**
4117
+ * Products being offered to the customer (productIds[1..] minus those
4118
+ * already in cart). Each item carries the discounted price.
4119
+ */
4120
+ offeredProducts: CartBundleOfferOfferedProduct[];
3760
4121
  discountType: 'PERCENTAGE' | 'FIXED_AMOUNT';
3761
4122
  discountValue: string;
3762
- originalPrice: string;
3763
- discountedPrice: string;
4123
+ totalOriginalPrice: string;
4124
+ totalDiscountedPrice: string;
3764
4125
  }
3765
4126
  interface CartBundlesResponse {
3766
4127
  bundles: CartBundleOffer[];
@@ -3851,12 +4212,50 @@ type CheckoutFieldPricing = {
3851
4212
  interface SetCheckoutCustomFieldsDto {
3852
4213
  fields: Record<string, unknown>;
3853
4214
  }
4215
+ /**
4216
+ * Submit a contact inquiry to the store.
4217
+ *
4218
+ * **Legacy shape (kept working forever — any existing storefront keeps submitting):**
4219
+ * ```ts
4220
+ * await brainerce.createInquiry({
4221
+ * name: 'Jane',
4222
+ * email: 'jane@example.com',
4223
+ * subject: 'Hi',
4224
+ * message: 'Shipping to Canada?',
4225
+ * });
4226
+ * ```
4227
+ *
4228
+ * **Phase 2 (multi-form, custom fields):**
4229
+ * ```ts
4230
+ * await brainerce.createInquiry({
4231
+ * formKey: 'newsletter',
4232
+ * fields: {
4233
+ * email: 'jane@example.com',
4234
+ * source: 'homepage-hero',
4235
+ * },
4236
+ * locale: 'he',
4237
+ * sourceMetadata: { page: '/products/42' },
4238
+ * });
4239
+ * ```
4240
+ *
4241
+ * The two shapes may be mixed. If both a top-level `email` and `fields.email`
4242
+ * are present, `fields.email` wins. Unknown keys inside `fields` are stripped
4243
+ * server-side; every value is validated against the form's field schema.
4244
+ */
3854
4245
  interface CreateInquiryInput {
3855
- name: string;
3856
- email: string;
3857
- subject: string;
3858
- message: string;
4246
+ name?: string;
4247
+ email?: string;
4248
+ subject?: string;
4249
+ message?: string;
3859
4250
  phone?: string;
4251
+ /** Target form identifier. Defaults to `"main"` when omitted. */
4252
+ formKey?: string;
4253
+ /** Arbitrary form payload keyed by ContactFormField.key. */
4254
+ fields?: Record<string, unknown>;
4255
+ /** Storefront locale (e.g. `"he"`, `"en"`). */
4256
+ locale?: string;
4257
+ /** Provenance metadata (referrer, UTM, origin page, etc.). */
4258
+ sourceMetadata?: Record<string, unknown>;
3860
4259
  customerId?: string;
3861
4260
  metadata?: Record<string, unknown>;
3862
4261
  }
@@ -3865,6 +4264,322 @@ interface CreateInquiryResponse {
3865
4264
  status: 'NEW';
3866
4265
  createdAt: string;
3867
4266
  }
4267
+ type ContactFormFieldType = 'TEXT' | 'TEXTAREA' | 'EMAIL' | 'PHONE' | 'NUMBER' | 'SELECT' | 'MULTI_SELECT' | 'CHECKBOX' | 'URL' | 'DATE';
4268
+ interface ContactFormFieldValidation {
4269
+ minLength?: number;
4270
+ maxLength?: number;
4271
+ min?: number;
4272
+ max?: number;
4273
+ pattern?: string;
4274
+ patternMessage?: string;
4275
+ }
4276
+ interface ContactFormPublicField {
4277
+ key: string;
4278
+ type: ContactFormFieldType;
4279
+ label: string;
4280
+ placeholder?: string;
4281
+ helpText?: string;
4282
+ isRequired: boolean;
4283
+ enumValues?: Array<{
4284
+ value: string;
4285
+ label: string;
4286
+ }>;
4287
+ validation?: ContactFormFieldValidation;
4288
+ defaultValue?: string;
4289
+ /** Layout width hint. Render in a CSS grid: FULL = full row, HALF = half row, THIRD = one-third. */
4290
+ width?: 'FULL' | 'HALF' | 'THIRD';
4291
+ }
4292
+ interface ContactFormPublic {
4293
+ id: string;
4294
+ key: string;
4295
+ name: string;
4296
+ description?: string;
4297
+ submitButton: string;
4298
+ successMessage: string;
4299
+ fields: ContactFormPublicField[];
4300
+ }
4301
+ interface ContactFormSummary {
4302
+ key: string;
4303
+ name: string;
4304
+ isDefault: boolean;
4305
+ }
4306
+ /**
4307
+ * How many modifiers a customer can pick from a group.
4308
+ *
4309
+ * - `SINGLE`: radio behavior, max 1.
4310
+ * - `MULTIPLE`: checkbox behavior, bounded by `min`/`max`.
4311
+ */
4312
+ type ModifierSelectionType = 'SINGLE' | 'MULTIPLE';
4313
+ /**
4314
+ * Tie-break rule for which selected modifiers consume the group's free quantity.
4315
+ *
4316
+ * - `EXPENSIVE_FREE`: the priciest picks become free (best for the customer).
4317
+ * - `CHEAPEST_FREE`: the cheapest picks become free (best for the merchant).
4318
+ * - `SELECTION_ORDER`: free is granted by click-order (first-N rule).
4319
+ *
4320
+ * Negative `priceDelta` modifiers never consume free slots regardless of policy.
4321
+ */
4322
+ type FreeAllocationPolicy = 'EXPENSIVE_FREE' | 'CHEAPEST_FREE' | 'SELECTION_ORDER';
4323
+ /**
4324
+ * Allergen tag attached to a Modifier or Product (e.g., gluten, dairy).
4325
+ */
4326
+ interface Allergen {
4327
+ id: string;
4328
+ /** Lowercase canonical code, e.g. "gluten", "dairy". */
4329
+ code: string;
4330
+ /** Display label. */
4331
+ name: string;
4332
+ iconUrl?: string;
4333
+ translations?: Record<string, {
4334
+ name?: string;
4335
+ }>;
4336
+ }
4337
+ /**
4338
+ * A single picker option inside a `ModifierGroup` (e.g., "Olives", "Thick crust").
4339
+ *
4340
+ * **Money fields are strings**: `priceDelta` is a decimal string like `"5.00"`
4341
+ * (negative values such as `"-2.00"` are valid for downsell modifiers, e.g.,
4342
+ * "no bread −2₪"). Use `parseFloat()` for client-side arithmetic.
4343
+ */
4344
+ interface Modifier {
4345
+ id: string;
4346
+ name: string;
4347
+ description?: string;
4348
+ /**
4349
+ * Decimal string — `"5.00"`, `"-2.00"`. Never a JSON number.
4350
+ * Per the platform's Decimal-on-the-wire contract (PRD §6.4.1).
4351
+ */
4352
+ priceDelta: string;
4353
+ sku?: string;
4354
+ image?: {
4355
+ url: string;
4356
+ thumbnailUrl?: string;
4357
+ alt?: string;
4358
+ };
4359
+ position: number;
4360
+ /** Pre-checked in the UI on first render. */
4361
+ isDefault: boolean;
4362
+ /** Sold-out toggle: `false` = out of stock, hidden as selectable in storefronts. */
4363
+ available: boolean;
4364
+ allergens?: Allergen[];
4365
+ /**
4366
+ * Nested-combo target. When present, picking this modifier opens the
4367
+ * referenced product's own modifier groups (depth ≤ 3).
4368
+ */
4369
+ referencedProductId?: string;
4370
+ translations?: Record<string, {
4371
+ name?: string;
4372
+ description?: string;
4373
+ }>;
4374
+ status?: 'active' | 'archived';
4375
+ createdAt?: string;
4376
+ updatedAt?: string;
4377
+ }
4378
+ /**
4379
+ * A modifier group — the customer-facing block of related options
4380
+ * (e.g., "Toppings", "Bread type"). Effective fields (`min`, `max`,
4381
+ * `freeQuantity`, `required`, `freeAllocationPolicy`, `defaultModifierIds`)
4382
+ * already reflect any per-attachment or per-variant overrides when fetched
4383
+ * via a product context (`GET /products/:id`).
4384
+ *
4385
+ * `internalName` is admin-only and is stripped from public storefront responses
4386
+ * (PRD §5.2 invariant). It surfaces only when fetched with a Clerk JWT or API key.
4387
+ */
4388
+ interface ModifierGroup {
4389
+ id: string;
4390
+ /**
4391
+ * Set when fetched in a product context — the `ProductModifierGroup` row id.
4392
+ * Use this to update or detach the attachment without reattaching the group.
4393
+ */
4394
+ attachmentId?: string;
4395
+ /** Customer-facing canonical name. */
4396
+ name: string;
4397
+ /** Admin-only disambiguator; never returned on public storefront responses. */
4398
+ internalName?: string;
4399
+ description?: string;
4400
+ selectionType: ModifierSelectionType;
4401
+ /** Effective minimum after any overrides. */
4402
+ min: number;
4403
+ /** Effective maximum after any overrides; `null` = unlimited. */
4404
+ max?: number | null;
4405
+ /** Effective free quantity. */
4406
+ freeQuantity: number;
4407
+ /** Effective required flag. */
4408
+ required: boolean;
4409
+ freeAllocationPolicy: FreeAllocationPolicy;
4410
+ modifiers: Modifier[];
4411
+ /** Effective default selections. */
4412
+ defaultModifierIds: string[];
4413
+ /**
4414
+ * When fetched in a product context with admin scope: the per-variant overrides
4415
+ * applied to this group on this product. Each entry shadows the group's default
4416
+ * scalar fields when present.
4417
+ */
4418
+ variantOverrides?: Record<string, Partial<{
4419
+ min: number;
4420
+ max: number;
4421
+ freeQuantity: number;
4422
+ required: boolean;
4423
+ defaultModifierIds: string[];
4424
+ freeAllocationPolicy: FreeAllocationPolicy;
4425
+ }>>;
4426
+ translations?: Record<string, {
4427
+ name?: string;
4428
+ description?: string;
4429
+ }>;
4430
+ status?: 'active' | 'archived';
4431
+ position?: number;
4432
+ createdAt?: string;
4433
+ updatedAt?: string;
4434
+ }
4435
+ /**
4436
+ * Join row connecting a `ModifierGroup` to a `Product` (with optional per-variant overrides).
4437
+ *
4438
+ * Three patterns (PRD §5.4):
4439
+ * - `variantId` omitted → default attach (applies to all variants).
4440
+ * - `variantId` set + matching default attach exists → variant override row.
4441
+ * - `variantId` set + no default attach → variant-only group.
4442
+ *
4443
+ * `null` overrides inherit; any non-null value (including `0` or `false`) wins.
4444
+ */
4445
+ interface ProductModifierGroupAttachment {
4446
+ id: string;
4447
+ productId: string;
4448
+ modifierGroupId: string;
4449
+ variantId?: string | null;
4450
+ position: number;
4451
+ minOverride?: number | null;
4452
+ maxOverride?: number | null;
4453
+ freeQuantityOverride?: number | null;
4454
+ requiredOverride?: boolean | null;
4455
+ freeAllocationPolicyOverride?: FreeAllocationPolicy | null;
4456
+ /** Empty array = inherit (PRD rule E); non-empty = override. */
4457
+ defaultModifierIds?: string[];
4458
+ createdAt?: string;
4459
+ updatedAt?: string;
4460
+ }
4461
+ /**
4462
+ * Customer-side selection payload for cart add/update.
4463
+ * `modifierIds` is in click-order — the resolver may use this for
4464
+ * `SELECTION_ORDER` free-allocation policy.
4465
+ */
4466
+ interface ModifierSelection {
4467
+ modifierGroupId: string;
4468
+ modifierIds: string[];
4469
+ }
4470
+ /**
4471
+ * Per-line modifier breakdown surfaced on `CartItem` and `OrderItem`
4472
+ * once the cart line includes selections.
4473
+ */
4474
+ interface CartItemModifierLine {
4475
+ modifierId: string;
4476
+ /** Snapshot of the modifier name at the time the line was added. */
4477
+ name: string;
4478
+ /** Decimal string snapshot of the priceDelta at the time the line was added. */
4479
+ priceDelta: string;
4480
+ /** True if this modifier consumed one of the group's free slots. */
4481
+ freeApplied: boolean;
4482
+ }
4483
+ /** Query parameters for `listModifierGroups`. */
4484
+ interface ListModifierGroupsParams {
4485
+ [key: string]: string | number | undefined;
4486
+ page?: number;
4487
+ limit?: number;
4488
+ /** Substring match against `name` and `internalName`. */
4489
+ search?: string;
4490
+ status?: 'active' | 'archived';
4491
+ }
4492
+ interface CreateModifierGroupInput {
4493
+ name: string;
4494
+ internalName?: string;
4495
+ description?: string;
4496
+ translations?: Record<string, {
4497
+ name?: string;
4498
+ description?: string;
4499
+ }>;
4500
+ selectionType?: ModifierSelectionType;
4501
+ minSelections?: number;
4502
+ /** `null` = unlimited. */
4503
+ maxSelections?: number | null;
4504
+ freeQuantity?: number;
4505
+ required?: boolean;
4506
+ freeAllocationPolicy?: FreeAllocationPolicy;
4507
+ /** Default position hint for new product attachments. Per-attach value always wins. */
4508
+ position?: number;
4509
+ }
4510
+ interface UpdateModifierGroupInput extends Partial<CreateModifierGroupInput> {
4511
+ status?: 'active' | 'archived';
4512
+ }
4513
+ interface CreateModifierInput {
4514
+ name: string;
4515
+ description?: string;
4516
+ translations?: Record<string, {
4517
+ name?: string;
4518
+ description?: string;
4519
+ }>;
4520
+ /**
4521
+ * Decimal string. Negative values are accepted for downsell modifiers
4522
+ * (e.g., `"-2.00"`); the server still enforces a `unitPrice >= 0` floor and
4523
+ * rejects negative deltas combined with `referencedProductId`.
4524
+ */
4525
+ priceDelta: string;
4526
+ sku?: string;
4527
+ image?: {
4528
+ url: string;
4529
+ thumbnailUrl?: string;
4530
+ alt?: string;
4531
+ };
4532
+ position?: number;
4533
+ isDefault?: boolean;
4534
+ available?: boolean;
4535
+ referencedProductId?: string;
4536
+ }
4537
+ interface UpdateModifierInput extends Partial<CreateModifierInput> {
4538
+ status?: 'active' | 'archived';
4539
+ }
4540
+ interface AttachModifierGroupInput {
4541
+ modifierGroupId: string;
4542
+ /** Specific variant for a per-variant override. Omit for a default attach. */
4543
+ variantId?: string;
4544
+ position?: number;
4545
+ /** `null` = inherit; any value (incl. `0`) overrides. */
4546
+ minOverride?: number | null;
4547
+ maxOverride?: number | null;
4548
+ freeQuantityOverride?: number | null;
4549
+ /** `null` = inherit; any value (incl. `false`) overrides. */
4550
+ requiredOverride?: boolean | null;
4551
+ freeAllocationPolicyOverride?: FreeAllocationPolicy | null;
4552
+ /** Empty array = inherit (PRD rule E); non-empty array = override. */
4553
+ defaultModifierIds?: string[];
4554
+ }
4555
+ /**
4556
+ * Update DTO for an existing attachment.
4557
+ *
4558
+ * `modifierGroupId` and `variantId` are immutable — they form the attachment's
4559
+ * identity (PRD §5.4 partial unique index). To swap a group on a product, detach
4560
+ * and re-attach.
4561
+ */
4562
+ type UpdateAttachmentInput = Partial<Omit<AttachModifierGroupInput, 'modifierGroupId' | 'variantId'>>;
4563
+ /**
4564
+ * Stable error codes returned in the structured `MODIFIER_VALIDATION_FAILED`
4565
+ * envelope when a cart add/update payload fails server-side validation.
4566
+ *
4567
+ * `MODIFIER_PRICE_FLOOR_VIOLATED` is also wrapped in this envelope (Phase 1.5
4568
+ * Slice C) — it fires when modifier downsells push the unit price below `0`.
4569
+ */
4570
+ type ModifierValidationCode = 'REQUIRED_GROUP_MISSING' | 'MIN_SELECTIONS_NOT_MET' | 'MAX_SELECTIONS_EXCEEDED' | 'SINGLE_GROUP_MULTIPLE_PICKS' | 'UNKNOWN_MODIFIER' | 'UNKNOWN_GROUP' | 'MODIFIER_DISABLED_FOR_VARIANT' | 'MODIFIER_NOT_AVAILABLE' | 'NESTED_DEPTH_EXCEEDED' | 'NESTED_REQUIRES_PRODUCT_REF' | 'INVALID_PRICE_DELTA' | 'MODIFIER_PRICE_FLOOR_VIOLATED';
4571
+ /**
4572
+ * Single validation issue inside the `MODIFIER_VALIDATION_FAILED` envelope.
4573
+ */
4574
+ interface ModifierValidationError {
4575
+ code: ModifierValidationCode;
4576
+ /** Human-readable message — safe to show users. */
4577
+ message: string;
4578
+ /** Group the error belongs to (when applicable). */
4579
+ modifierGroupId?: string;
4580
+ /** Modifier the error belongs to (when applicable). */
4581
+ modifierId?: string;
4582
+ }
3868
4583
  interface BrainerceApiError {
3869
4584
  statusCode: number;
3870
4585
  message: string;
@@ -3960,7 +4675,11 @@ declare class BrainerceClient {
3960
4675
  */
3961
4676
  private withPaginatedGuards;
3962
4677
  /**
3963
- * Check if client is in vibe-coded mode (using connectionId)
4678
+ * Check if client is in sales-channel mode (using salesChannelId / legacy connectionId).
4679
+ */
4680
+ isSalesChannelMode(): boolean;
4681
+ /**
4682
+ * @deprecated Use `isSalesChannelMode()` instead. Kept as a backwards-compatible alias.
3964
4683
  */
3965
4684
  isVibeCodedMode(): boolean;
3966
4685
  /**
@@ -4695,6 +5414,50 @@ declare class BrainerceClient {
4695
5414
  * Get a customer by email
4696
5415
  */
4697
5416
  getCustomerByEmail(email: string): Promise<Customer | null>;
5417
+ /**
5418
+ * List a customer's saved payment methods (vaulted cards).
5419
+ *
5420
+ * Returns display-only metadata — last4, brand, expiry, default flag,
5421
+ * status. The underlying provider token is encrypted at rest and
5422
+ * NEVER returned through this API.
5423
+ *
5424
+ * Apps mode requires `customers:read` and `payments:read` scopes.
5425
+ *
5426
+ * @param storeId - The store this customer belongs to
5427
+ * @param customerId - The customer's ID
5428
+ * @returns Array of saved payment methods
5429
+ *
5430
+ * @example
5431
+ * ```typescript
5432
+ * const methods = await client.listSavedPaymentMethods(storeId, customerId);
5433
+ * methods.forEach((m) => {
5434
+ * console.log(`${m.brand} ending in ${m.last4} (expires ${m.expMonth}/${m.expYear})`);
5435
+ * });
5436
+ * ```
5437
+ */
5438
+ listSavedPaymentMethods(storeId: string, customerId: string): Promise<SavedPaymentMethodSummary[]>;
5439
+ /**
5440
+ * Remove a customer's saved payment method.
5441
+ *
5442
+ * Hard-deletes the row. The provider may still hold the underlying
5443
+ * token internally — we don't issue a delete-at-provider call because
5444
+ * not every provider supports it. From the platform's perspective the
5445
+ * token is gone; subsequent charges will fail.
5446
+ *
5447
+ * Apps mode requires `customers:write` scope.
5448
+ *
5449
+ * @param storeId - The store this customer belongs to
5450
+ * @param customerId - The customer's ID
5451
+ * @param paymentMethodId - The saved payment method ID to remove
5452
+ *
5453
+ * @example
5454
+ * ```typescript
5455
+ * await client.removeSavedPaymentMethod(storeId, customerId, methodId);
5456
+ * ```
5457
+ */
5458
+ removeSavedPaymentMethod(storeId: string, customerId: string, paymentMethodId: string): Promise<{
5459
+ success: true;
5460
+ }>;
4698
5461
  /**
4699
5462
  * Login an existing customer (returns JWT token)
4700
5463
  * Works in vibe-coded, storefront, and admin mode
@@ -4978,6 +5741,36 @@ declare class BrainerceClient {
4978
5741
  page?: number;
4979
5742
  limit?: number;
4980
5743
  }): Promise<PaginatedResponse<Order>>;
5744
+ /**
5745
+ * List active contact forms configured for the store.
5746
+ *
5747
+ * Storefront (public) mode only. Useful when your site has multiple
5748
+ * forms (e.g. "main", "newsletter", "whatsapp_prechat") and you need
5749
+ * to pick the right one at render time.
5750
+ *
5751
+ * @example
5752
+ * ```typescript
5753
+ * const forms = await brainerce.contactForms.list();
5754
+ * // → [{ key: 'main', name: 'Main Contact', isDefault: true }, ...]
5755
+ * ```
5756
+ */
5757
+ contactForms: {
5758
+ list: () => Promise<ContactFormSummary[]>;
5759
+ /**
5760
+ * Fetch the full schema for a single contact form, including all
5761
+ * visible fields + their localized labels/placeholders/help text.
5762
+ *
5763
+ * `locale` is the storefront locale at render time (e.g. `"he"`).
5764
+ * Falls back to the store's default language when omitted.
5765
+ *
5766
+ * @example
5767
+ * ```typescript
5768
+ * const form = await brainerce.contactForms.get('main', 'he');
5769
+ * // Render form.fields; submit via brainerce.createInquiry({ formKey: 'main', fields })
5770
+ * ```
5771
+ */
5772
+ get: (formKey?: string, locale?: string) => Promise<ContactFormPublic>;
5773
+ };
4981
5774
  /**
4982
5775
  * Submit a contact inquiry from a storefront contact form.
4983
5776
  *
@@ -4985,7 +5778,7 @@ declare class BrainerceClient {
4985
5778
  * per IP on the server. Include an empty `honeypot` field on your form
4986
5779
  * and do NOT send it — bots that auto-fill every input will be rejected.
4987
5780
  *
4988
- * @example
5781
+ * **Legacy shape (kept working forever):**
4989
5782
  * ```typescript
4990
5783
  * await brainerce.createInquiry({
4991
5784
  * name: 'Jane Doe',
@@ -4995,6 +5788,16 @@ declare class BrainerceClient {
4995
5788
  * phone: '+1-555-0100',
4996
5789
  * });
4997
5790
  * ```
5791
+ *
5792
+ * **Phase 2 (multi-form / custom fields):**
5793
+ * ```typescript
5794
+ * const form = await brainerce.contactForms.get('newsletter');
5795
+ * await brainerce.createInquiry({
5796
+ * formKey: 'newsletter',
5797
+ * fields: { email: 'jane@example.com', source: 'homepage' },
5798
+ * locale: 'he',
5799
+ * });
5800
+ * ```
4998
5801
  */
4999
5802
  createInquiry(input: CreateInquiryInput): Promise<CreateInquiryResponse>;
5000
5803
  /**
@@ -5134,6 +5937,42 @@ declare class BrainerceClient {
5134
5937
  * ```
5135
5938
  */
5136
5939
  removeCoupon(cartId: string): Promise<Cart>;
5940
+ /**
5941
+ * Recalculate cart totals against current product/variant prices and
5942
+ * discount rules. Idempotent — does NOT mutate the per-item snapshot
5943
+ * `unitPrice`. The returned cart's `hasPriceChanges` / `hasUnavailableItems`
5944
+ * flags reflect the live state. Call this on cart load if you want to
5945
+ * surface drift to the customer before they reach checkout.
5946
+ *
5947
+ * @example
5948
+ * ```typescript
5949
+ * const cart = await client.recalculateCart('cart_123');
5950
+ * if (cart.hasPriceChanges) {
5951
+ * // show "prices have changed" banner
5952
+ * }
5953
+ * ```
5954
+ */
5955
+ recalculateCart(cartId: string): Promise<Cart>;
5956
+ /**
5957
+ * Refresh per-item `unitPrice` snapshots to current live prices. Use this
5958
+ * after the customer accepts new prices in the drift-reconfirm flow. The
5959
+ * subsequent `createCheckout` call will then succeed (it would otherwise
5960
+ * throw `PRICE_DRIFT`).
5961
+ *
5962
+ * @example
5963
+ * ```typescript
5964
+ * try {
5965
+ * await client.createCheckout(cartId);
5966
+ * } catch (err) {
5967
+ * if (err.code === 'PRICE_DRIFT') {
5968
+ * // ask user to confirm new prices, then:
5969
+ * await client.refreshCartSnapshots(cartId);
5970
+ * await client.createCheckout(cartId);
5971
+ * }
5972
+ * }
5973
+ * ```
5974
+ */
5975
+ refreshCartSnapshots(cartId: string): Promise<Cart>;
5137
5976
  /**
5138
5977
  * Link a cart to the currently logged-in customer.
5139
5978
  * Use this after customer logs in to associate their guest cart with their account.
@@ -5268,7 +6107,8 @@ declare class BrainerceClient {
5268
6107
  * ```typescript
5269
6108
  * const { bundles } = await client.getCartBundles('cart_123');
5270
6109
  * bundles.forEach(b => {
5271
- * console.log(`Add ${b.bundleProduct.name} and save! Was ${b.originalPrice}, now ${b.discountedPrice}`);
6110
+ * const names = b.offeredProducts.map(p => p.name).join(', ');
6111
+ * console.log(`Add ${names} and save! Was ${b.totalOriginalPrice}, now ${b.totalDiscountedPrice}`);
5272
6112
  * });
5273
6113
  * ```
5274
6114
  */
@@ -5298,23 +6138,27 @@ declare class BrainerceClient {
5298
6138
  */
5299
6139
  removeOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
5300
6140
  /**
5301
- * Add a bundle offer product to the cart with its discount applied.
6141
+ * Accept an N-product bundle offer: every offered product not yet in cart
6142
+ * is added with the bundle discount applied.
5302
6143
  *
5303
6144
  * @param cartId - Cart ID
5304
6145
  * @param bundleOfferId - Bundle offer ID
5305
- * @param variantId - Optional variant ID (required when bundle product has variants and no admin-locked variant)
6146
+ * @param variantSelections - Optional map of `productId variantId` for offered products with variants
5306
6147
  * @returns Updated cart
5307
6148
  *
5308
6149
  * @example
5309
6150
  * ```typescript
5310
6151
  * const { bundles } = await client.getCartBundles('cart_123');
5311
- * // Simple product or locked variant:
5312
- * const cart = await client.addBundleToCart('cart_123', bundles[0].id);
5313
- * // Product with variants (customer selects):
5314
- * const cart = await client.addBundleToCart('cart_123', bundles[0].id, selectedVariantId);
6152
+ * const bundle = bundles[0];
6153
+ * // Simple products only:
6154
+ * await client.addBundleToCart('cart_123', bundle.id);
6155
+ * // Some offered products have variants:
6156
+ * await client.addBundleToCart('cart_123', bundle.id, {
6157
+ * [variantProductId]: selectedVariantId,
6158
+ * });
5315
6159
  * ```
5316
6160
  */
5317
- addBundleToCart(cartId: string, bundleOfferId: string, variantId?: string): Promise<Cart>;
6161
+ addBundleToCart(cartId: string, bundleOfferId: string, variantSelections?: Record<string, string>): Promise<Cart>;
5318
6162
  /**
5319
6163
  * Remove a bundle offer product from the cart.
5320
6164
  *
@@ -5426,6 +6270,10 @@ declare class BrainerceClient {
5426
6270
  variantId?: string;
5427
6271
  quantity: number;
5428
6272
  metadata?: Record<string, unknown>;
6273
+ /** Modifier-group selections (PRD §7.3 / §8.4). */
6274
+ selections?: ModifierSelection[];
6275
+ /** Nested-combo selections keyed by parent modifierId. */
6276
+ nestedByModifierId?: Record<string, ModifierSelection[]>;
5429
6277
  }): Promise<Cart>;
5430
6278
  /**
5431
6279
  * Smart get cart - returns the current cart (server-side for both guests and logged-in users)
@@ -5848,6 +6696,21 @@ declare class BrainerceClient {
5848
6696
  createPaymentIntent(checkoutId: string, options?: {
5849
6697
  successUrl?: string;
5850
6698
  cancelUrl?: string;
6699
+ /**
6700
+ * Per-checkout opt-in to vault the card for off-session reuse.
6701
+ * Set to `true` when the customer ticked a "save card for next
6702
+ * time" checkbox. Only honored when the checkout has a known
6703
+ * `customerId` (logged-in customers, not guests). The platform
6704
+ * forwards this to the underlying payment provider; providers
6705
+ * that don't support tokenization (e.g. Grow today) silently
6706
+ * ignore it.
6707
+ *
6708
+ * After a successful charge with `saveCard: true`, the saved
6709
+ * card appears in `customers.listSavedPaymentMethods()` and can
6710
+ * be charged off-session via the dashboard / future
6711
+ * subscription features.
6712
+ */
6713
+ saveCard?: boolean;
5851
6714
  }): Promise<PaymentIntent>;
5852
6715
  /**
5853
6716
  * Get payment status for a checkout.
@@ -6663,6 +7526,133 @@ declare class BrainerceClient {
6663
7526
  * Requires Admin mode (apiKey)
6664
7527
  */
6665
7528
  deleteAttributeOption(attributeId: string, optionId: string): Promise<void>;
7529
+ /**
7530
+ * List modifier groups in a store, paginated.
7531
+ * Requires Admin mode (apiKey).
7532
+ *
7533
+ * @example
7534
+ * ```typescript
7535
+ * const groups = await client.listModifierGroups('store_123', {
7536
+ * page: 1,
7537
+ * limit: 20,
7538
+ * search: 'pizza',
7539
+ * status: 'active',
7540
+ * });
7541
+ * ```
7542
+ */
7543
+ listModifierGroups(storeId: string, params?: ListModifierGroupsParams): Promise<PaginatedResponse<ModifierGroup>>;
7544
+ /**
7545
+ * Fetch a single modifier group (with its modifiers).
7546
+ * Requires Admin mode (apiKey).
7547
+ *
7548
+ * Admin fetches include `internalName`; storefront responses strip it
7549
+ * (PRD §5.2 invariant).
7550
+ */
7551
+ getModifierGroup(storeId: string, groupId: string): Promise<ModifierGroup>;
7552
+ /**
7553
+ * Create a modifier group. Modifiers themselves are created separately via
7554
+ * `createModifier(storeId, groupId, …)`.
7555
+ * Requires Admin mode (apiKey).
7556
+ *
7557
+ * @example
7558
+ * ```typescript
7559
+ * const group = await client.createModifierGroup('store_123', {
7560
+ * name: 'Toppings',
7561
+ * internalName: 'Pizza toppings',
7562
+ * selectionType: 'MULTIPLE',
7563
+ * minSelections: 0,
7564
+ * maxSelections: 8,
7565
+ * freeQuantity: 3,
7566
+ * freeAllocationPolicy: 'EXPENSIVE_FREE',
7567
+ * });
7568
+ * ```
7569
+ */
7570
+ createModifierGroup(storeId: string, data: CreateModifierGroupInput): Promise<ModifierGroup>;
7571
+ /**
7572
+ * Update a modifier group's metadata or selection rules. Pass `status: 'archived'`
7573
+ * to soft-delete (the group becomes hidden from product attachments).
7574
+ * Requires Admin mode (apiKey).
7575
+ */
7576
+ updateModifierGroup(storeId: string, groupId: string, data: UpdateModifierGroupInput): Promise<ModifierGroup>;
7577
+ /**
7578
+ * Hard-delete a modifier group. Server rejects deletion when the group is
7579
+ * still attached to any product (detach the attachments first, or use
7580
+ * `updateModifierGroup(..., { status: 'archived' })` to keep the row).
7581
+ * Requires Admin mode (apiKey).
7582
+ */
7583
+ deleteModifierGroup(storeId: string, groupId: string): Promise<void>;
7584
+ /**
7585
+ * Create a modifier inside a group (e.g., "Olives" inside the "Toppings" group).
7586
+ * Requires Admin mode (apiKey).
7587
+ *
7588
+ * `priceDelta` is a decimal string. Negatives are accepted for downsell
7589
+ * modifiers (e.g., `"-2.00"` for "no bread"); the server still enforces
7590
+ * `unitPrice >= 0` at cart-line resolution and rejects negative deltas
7591
+ * combined with a `referencedProductId`.
7592
+ *
7593
+ * @example
7594
+ * ```typescript
7595
+ * const olives = await client.createModifier('store_123', 'mg_toppings', {
7596
+ * name: 'Olives',
7597
+ * priceDelta: '5.00',
7598
+ * isDefault: false,
7599
+ * available: true,
7600
+ * });
7601
+ * ```
7602
+ */
7603
+ createModifier(storeId: string, groupId: string, data: CreateModifierInput): Promise<Modifier>;
7604
+ /**
7605
+ * Update a modifier. Pass `status: 'archived'` to soft-delete.
7606
+ * Requires Admin mode (apiKey).
7607
+ */
7608
+ updateModifier(storeId: string, groupId: string, modifierId: string, data: UpdateModifierInput): Promise<Modifier>;
7609
+ /**
7610
+ * Hard-delete a modifier. Use `updateModifier(..., { status: 'archived' })`
7611
+ * if existing line items / order snapshots reference it.
7612
+ * Requires Admin mode (apiKey).
7613
+ */
7614
+ deleteModifier(storeId: string, groupId: string, modifierId: string): Promise<void>;
7615
+ /**
7616
+ * Flip the sold-out toggle on a modifier. Operational endpoint kept separate
7617
+ * from `updateModifier` because the daily ops bar is intentionally lower
7618
+ * (PRD §7.1 — STAFF role once the granular `TOGGLE_MODIFIER_AVAILABILITY`
7619
+ * permission ships).
7620
+ * Requires Admin mode (apiKey).
7621
+ *
7622
+ * @example
7623
+ * ```typescript
7624
+ * // Mark the egg modifier as out of stock during a busy lunch service
7625
+ * await client.toggleModifierAvailability('store_123', 'mg_toppings', 'm_egg', false);
7626
+ * ```
7627
+ */
7628
+ toggleModifierAvailability(storeId: string, groupId: string, modifierId: string, available: boolean): Promise<Modifier>;
7629
+ /**
7630
+ * Attach a modifier group to a product. Three patterns (PRD §5.4):
7631
+ *
7632
+ * - `variantId` omitted → default attach (applies to all variants).
7633
+ * - `variantId` set + matching default attach already exists → variant override row.
7634
+ * - `variantId` set + no default attach → variant-only group.
7635
+ *
7636
+ * Override fields use `null` to mean inherit; any non-null value (including
7637
+ * `0` or `false`) wins. The disable-for-variant convention is `maxOverride: 0` —
7638
+ * the resolver returns the group with `effectiveMax=0` and the validator
7639
+ * silently skips it on cart add.
7640
+ *
7641
+ * Requires Admin mode (apiKey).
7642
+ */
7643
+ attachModifierGroup(storeId: string, productId: string, data: AttachModifierGroupInput): Promise<ProductModifierGroupAttachment>;
7644
+ /**
7645
+ * Update an existing attachment's overrides or position. The `modifierGroupId`
7646
+ * and `variantId` are immutable — to swap groups or move between default /
7647
+ * per-variant rows, detach and re-attach.
7648
+ * Requires Admin mode (apiKey).
7649
+ */
7650
+ updateAttachment(storeId: string, productId: string, attachmentId: string, data: UpdateAttachmentInput): Promise<ProductModifierGroupAttachment>;
7651
+ /**
7652
+ * Detach a modifier group from a product (or remove a per-variant override row).
7653
+ * Requires Admin mode (apiKey).
7654
+ */
7655
+ detachModifierGroup(storeId: string, productId: string, attachmentId: string): Promise<void>;
6666
7656
  /**
6667
7657
  * List all shipping zones for the store with pagination
6668
7658
  * Requires Admin mode (apiKey)
@@ -6807,6 +7797,64 @@ declare class BrainerceClient {
6807
7797
  * Requires Admin mode (apiKey)
6808
7798
  */
6809
7799
  deleteMetafieldDefinition(definitionId: string): Promise<void>;
7800
+ /**
7801
+ * Replace the platform publishing configuration on a metafield definition.
7802
+ * `publishedOn` is the source of truth for which sales channels the field
7803
+ * appears on; `platformMetadata` carries the per-platform mapping config
7804
+ * required for sync.
7805
+ *
7806
+ * Requires Admin mode (apiKey).
7807
+ *
7808
+ * @example
7809
+ * ```typescript
7810
+ * await client.setMetafieldPlatforms('def_123', {
7811
+ * publishedOn: ['SHOPIFY', 'WOOCOMMERCE'],
7812
+ * platformMetadata: {
7813
+ * SHOPIFY: { namespace: 'custom', key: 'warranty' },
7814
+ * WOOCOMMERCE: { key: '_warranty_info' },
7815
+ * },
7816
+ * });
7817
+ * ```
7818
+ */
7819
+ setMetafieldPlatforms(definitionId: string, data: SetMetafieldPlatformsDto): Promise<MetafieldDefinition>;
7820
+ /**
7821
+ * Publish a metafield definition to a vibe-coded site (admin mode).
7822
+ * @example
7823
+ * ```typescript
7824
+ * await client.publishMetafieldDefinitionToVibeCodedSite('def_123', 'conn_456');
7825
+ * ```
7826
+ */
7827
+ publishMetafieldDefinitionToVibeCodedSite(definitionId: string, vibeCodedConnectionId: string): Promise<{
7828
+ success: boolean;
7829
+ }>;
7830
+ /** Unpublish a metafield definition from a vibe-coded site (admin mode). */
7831
+ unpublishMetafieldDefinitionFromVibeCodedSite(definitionId: string, vibeCodedConnectionId: string): Promise<{
7832
+ success: boolean;
7833
+ }>;
7834
+ /** Publish a category to a vibe-coded site (admin mode). */
7835
+ publishCategoryToVibeCodedSite(categoryId: string, vibeCodedConnectionId: string): Promise<{
7836
+ success: boolean;
7837
+ }>;
7838
+ /** Unpublish a category from a vibe-coded site (admin mode). */
7839
+ unpublishCategoryFromVibeCodedSite(categoryId: string, vibeCodedConnectionId: string): Promise<{
7840
+ success: boolean;
7841
+ }>;
7842
+ /** Publish a tag to a vibe-coded site (admin mode). */
7843
+ publishTagToVibeCodedSite(tagId: string, vibeCodedConnectionId: string): Promise<{
7844
+ success: boolean;
7845
+ }>;
7846
+ /** Unpublish a tag from a vibe-coded site (admin mode). */
7847
+ unpublishTagFromVibeCodedSite(tagId: string, vibeCodedConnectionId: string): Promise<{
7848
+ success: boolean;
7849
+ }>;
7850
+ /** Publish a brand to a vibe-coded site (admin mode). */
7851
+ publishBrandToVibeCodedSite(brandId: string, vibeCodedConnectionId: string): Promise<{
7852
+ success: boolean;
7853
+ }>;
7854
+ /** Unpublish a brand from a vibe-coded site (admin mode). */
7855
+ unpublishBrandFromVibeCodedSite(brandId: string, vibeCodedConnectionId: string): Promise<{
7856
+ success: boolean;
7857
+ }>;
6810
7858
  /**
6811
7859
  * Replace the list of products a (customer-input) metafield definition is
6812
7860
  * attached to. Diff-scoped: only rows for this definition are touched, so
@@ -7142,7 +8190,7 @@ declare class BrainerceError extends Error {
7142
8190
  constructor(message: string, statusCode: number, details?: unknown);
7143
8191
  }
7144
8192
 
7145
- declare const SDK_VERSION = "1.11.2";
8193
+ declare const SDK_VERSION = "1.21.0";
7146
8194
 
7147
8195
  /**
7148
8196
  * Verify a webhook signature from Brainerce
@@ -7216,4 +8264,33 @@ declare function enableDevGuards(options?: {
7216
8264
  force?: boolean;
7217
8265
  }): void;
7218
8266
 
7219
- export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, 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 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 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 CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, 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 FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, 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 PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, 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 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 UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, 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 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, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
8267
+ interface PaymentUrlOptions {
8268
+ /**
8269
+ * Additional hostnames to allow (matches `host` exactly OR
8270
+ * `*.host`). Use for custom self-hosted payment providers.
8271
+ * Cannot remove entries from the platform default list.
8272
+ */
8273
+ extraHosts?: readonly string[];
8274
+ /**
8275
+ * Allow `http://localhost` and `http://127.0.0.1` so a local dev
8276
+ * storefront can iframe a local backend embed proxy. Off by default —
8277
+ * callers running in a known dev context should pass `true` explicitly.
8278
+ */
8279
+ allowLocalhost?: boolean;
8280
+ }
8281
+ /**
8282
+ * Validate that a URL points to a known payment-provider host (or
8283
+ * platform-hosted embed). Returns `false` for any malformed input,
8284
+ * non-https URL (except localhost when explicitly allowed), or unknown host.
8285
+ */
8286
+ declare function isAllowedPaymentUrl(url: string, options?: PaymentUrlOptions): boolean;
8287
+ /**
8288
+ * Navigate the browser to a payment URL after validating it against the
8289
+ * allowlist. Throws synchronously on a disallowed URL so the caller can
8290
+ * surface a localized error instead of leaking the raw URL.
8291
+ *
8292
+ * No-op outside a browser environment.
8293
+ */
8294
+ declare function safePaymentRedirect(url: string, options?: PaymentUrlOptions): void;
8295
+
8296
+ export { type AddToCartDto, type Allergen, 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 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 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 FormatPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, 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 MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, 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 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 ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, 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 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 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, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, verifyWebhook };