brainerce 1.36.5 → 1.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2055,29 +2055,33 @@ const checkout = await client.createCheckout({
2055
2055
 
2056
2056
  #### Region display pricing (`getProducts({ regionId })`)
2057
2057
 
2058
- Product reads accept an optional `regionId`. When set, each product/variant that
2059
- a region [price list](#price-lists) resolves gains additive fields —
2060
- `resolvedPrice`, `resolvedCurrency`, `resolvedCompareAtPrice`, and `priceSource`
2061
- (`'variant-entry'` | `'product-entry'`). Your existing `basePrice` / `salePrice`
2062
- stay in the store currency; the fields appear **only** when a region entry
2063
- actually applies, so an omitted/invalid region (or a catalog-price fallback)
2064
- leaves the response byte-identical.
2058
+ All three product reads accept an optional `regionId` `getProducts`,
2059
+ `getProduct(id)`, **and** `getProductBySlug(slug)` (the PDP path). When set and the
2060
+ region's currency differs from the store currency, each product/variant gains
2061
+ additive FX-display fields `displayPrice`, `displaySalePrice`, and
2062
+ `displayCurrency` (plus `displayPriceMin` / `displayPriceMax` on storefront-mode
2063
+ list reads). Your `basePrice` / `salePrice` stay in the store currency; the
2064
+ display fields appear **only** when an FX rate applies, so an omitted/invalid
2065
+ region or a same-currency region leaves the response byte-identical.
2065
2066
 
2066
2067
  ```typescript
2067
2068
  const { data: products } = await client.getProducts({ regionId: 'region_eu' });
2068
2069
  const p = products[0];
2069
- const display = p.resolvedPrice
2070
- ? `${p.resolvedPrice} ${p.resolvedCurrency}` // e.g. "27.00 EUR"
2071
- : p.basePrice; // store-currency catalog price
2070
+ const display = p.displayPrice
2071
+ ? `${p.displayPrice} ${p.displayCurrency}` // e.g. "27.00 EUR"
2072
+ : p.basePrice; // store-currency price (no FX rate / same currency)
2072
2073
 
2073
- // Single product (id or slug) takes the same option:
2074
+ // Single product by id OR slug takes the same option:
2074
2075
  await client.getProduct('prod_tshirt', { regionId: 'region_eu' });
2076
+ await client.getProductBySlug('blue-shirt', { regionId: 'region_eu' });
2075
2077
  ```
2076
2078
 
2077
2079
  > **Display-only** — like checkout, `regionId` here does not charge the region
2078
- > price; it only changes what you render until currency-lock ships. **Mode note:**
2079
- > region resolution applies on storefront (`storeId`) and admin (`apiKey`) reads;
2080
- > it is currently ignored in vibe-coded (`vc_*`/`salesChannelId`) mode.
2080
+ > currency; it only changes what you render until currency-lock ships. Works in
2081
+ > **all three modes** vibe-coded (`vc_*`/`salesChannelId`), storefront (`storeId`),
2082
+ > and admin (`apiKey`). The response gains `displayPrice` whenever a daily FX rate
2083
+ > exists for the store/region currency pair in **either** direction (the overlay
2084
+ > inverts the stored rate when needed). See [Regions](/docs/concepts/regions).
2081
2085
 
2082
2086
  #### Partial Checkout (AliExpress-style)
2083
2087
 
@@ -3566,10 +3570,13 @@ await client.deleteTaxClass(food.id);
3566
3570
  ```
3567
3571
 
3568
3572
  **Storefront (public, no API key).** A storefront lists classes in `storeId`
3569
- mode storefront-safe fields only (for a "9% VAT" transparency badge):
3573
+ mode **or** vibe-coded mode (`salesChannelId: 'vc_*'`, gated on the
3574
+ `products:read` scope every connection already has) — storefront-safe fields
3575
+ only (for a "9% VAT" transparency badge):
3570
3576
 
3571
3577
  ```typescript
3572
3578
  const store = new BrainerceClient({ storeId: 'store_123' });
3579
+ // — or — new BrainerceClient({ salesChannelId: 'vc_abc123' });
3573
3580
  const { data: classes } = await store.getStoreTaxClasses();
3574
3581
  ```
3575
3582
 
@@ -3614,14 +3621,19 @@ await client.deleteRegion(eu.id);
3614
3621
  ```
3615
3622
 
3616
3623
  **Storefront (public, no API key).** A storefront fetches regions in `storeId`
3617
- mode only active regions, only storefront-safe fields:
3624
+ mode **or** vibe-coded mode (`salesChannelId: 'vc_*'`, gated on the
3625
+ `products:read` scope every connection already has) — only active regions, only
3626
+ storefront-safe fields. `getStoreRegions()`, `getStoreRegion()`, and
3627
+ `getAutoRegion()` all work in both modes:
3618
3628
 
3619
3629
  ```typescript
3620
3630
  const store = new BrainerceClient({ storeId: 'store_123' });
3631
+ // — or — new BrainerceClient({ salesChannelId: 'vc_abc123' });
3621
3632
 
3622
3633
  const { data: regions } = await store.getStoreRegions();
3623
3634
  const region = await store.getStoreRegion(regions[0].id); // + paymentProviders
3624
3635
  const dest = store.detectRegion('DE', regions); // pick by country, client-side
3636
+ const { region: resolved } = await store.getAutoRegion('DE'); // server-side, one round trip
3625
3637
  ```
3626
3638
 
3627
3639
  > **Multi-region checkout:** pass a `regionId` to `createCheckout` to associate the
package/dist/index.d.mts CHANGED
@@ -4556,12 +4556,27 @@ interface ProductRecommendation {
4556
4556
  id: string;
4557
4557
  name: string;
4558
4558
  slug: string | null;
4559
+ /**
4560
+ * Effective price. For a VARIABLE target this is the pinned variant's price
4561
+ * (when `targetVariantId` is set) or the "from {min variant}" range price —
4562
+ * never a stale 0 parent price.
4563
+ */
4559
4564
  basePrice: string;
4560
4565
  salePrice: string | null;
4561
4566
  images: ProductImage[];
4562
4567
  type: 'SIMPLE' | 'VARIABLE';
4563
4568
  inventory?: InventoryInfo | null;
4564
4569
  relationType: ProductRelationType;
4570
+ /** Pinned variant of the target (VARIABLE only); null = customer chooses. */
4571
+ targetVariantId?: string | null;
4572
+ /**
4573
+ * True when the target is VARIABLE with no pinned variant — the customer must
4574
+ * pick a variation (use `variants`) before this can be added to the cart.
4575
+ */
4576
+ requiresVariantSelection?: boolean;
4577
+ /** The pinned variation when `targetVariantId` is set. */
4578
+ pinnedVariant?: LockedVariant | null;
4579
+ /** Selectable variations, present when `requiresVariantSelection` is true. */
4565
4580
  variants?: RecommendationVariant[];
4566
4581
  }
4567
4582
  interface ProductRecommendationsResponse {
@@ -4596,6 +4611,15 @@ interface CartBundleOfferOfferedProduct {
4596
4611
  url: string;
4597
4612
  }>;
4598
4613
  type: string;
4614
+ /** Pinned variant for this slot (VARIABLE only); null = customer chooses. */
4615
+ variantId?: string | null;
4616
+ /** True when the offered product is VARIABLE with no pinned variant. */
4617
+ requiresVariantSelection?: boolean;
4618
+ /** The pinned variation when `variantId` is set. */
4619
+ pinnedVariant?: LockedVariant | null;
4620
+ /** Selectable variations, present when `requiresVariantSelection` is true. */
4621
+ variants?: RecommendationVariant[];
4622
+ /** Effective pre-discount unit price (pinned/cheapest variant for VARIABLE). */
4599
4623
  originalPrice: string;
4600
4624
  discountedPrice: string;
4601
4625
  }
@@ -5469,6 +5493,7 @@ declare class BrainerceClient {
5469
5493
  */
5470
5494
  getProductBySlug(slug: string, options?: {
5471
5495
  locale?: string;
5496
+ regionId?: string;
5472
5497
  }): Promise<Product>;
5473
5498
  /**
5474
5499
  * Get available categories for filtering products
@@ -8851,15 +8876,17 @@ declare class BrainerceClient {
8851
8876
  name?: string | null;
8852
8877
  }>>;
8853
8878
  /**
8854
- * List the store's ACTIVE regions (public, no apiKey). Requires storeId mode.
8855
- * Returns only storefront-safe fields (no internal flags). Default region first.
8879
+ * List the store's ACTIVE regions (public, no apiKey). Works in storeId and
8880
+ * vibe-coded modes. Returns only storefront-safe fields (no internal flags).
8881
+ * Default region first.
8856
8882
  */
8857
8883
  getStoreRegions(): Promise<{
8858
8884
  data: PublicRegion[];
8859
8885
  }>;
8860
8886
  /**
8861
8887
  * Get one active public region plus its enabled payment providers (public).
8862
- * Requires storeId mode. Throws 404 if the region is inactive or not found.
8888
+ * Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
8889
+ * or not found.
8863
8890
  */
8864
8891
  getStoreRegion(regionId: string): Promise<PublicRegionDetail>;
8865
8892
  /**
@@ -8895,9 +8922,10 @@ declare class BrainerceClient {
8895
8922
  subtotal: number;
8896
8923
  }): Promise<TaxEstimateResponse>;
8897
8924
  /**
8898
- * List the store's tax classes (public, no apiKey — storeId mode). Storefront-
8899
- * safe fields only (id/name/slug/description/isDefault) for transparency UIs
8900
- * such as a "9% VAT" badge. Admin/api-key callers use getTaxClasses().
8925
+ * List the store's tax classes (public, no apiKey — storeId or vibe-coded
8926
+ * mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
8927
+ * transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
8928
+ * getTaxClasses().
8901
8929
  */
8902
8930
  getStoreTaxClasses(): Promise<{
8903
8931
  data: PublicTaxClass[];
package/dist/index.d.ts CHANGED
@@ -4556,12 +4556,27 @@ interface ProductRecommendation {
4556
4556
  id: string;
4557
4557
  name: string;
4558
4558
  slug: string | null;
4559
+ /**
4560
+ * Effective price. For a VARIABLE target this is the pinned variant's price
4561
+ * (when `targetVariantId` is set) or the "from {min variant}" range price —
4562
+ * never a stale 0 parent price.
4563
+ */
4559
4564
  basePrice: string;
4560
4565
  salePrice: string | null;
4561
4566
  images: ProductImage[];
4562
4567
  type: 'SIMPLE' | 'VARIABLE';
4563
4568
  inventory?: InventoryInfo | null;
4564
4569
  relationType: ProductRelationType;
4570
+ /** Pinned variant of the target (VARIABLE only); null = customer chooses. */
4571
+ targetVariantId?: string | null;
4572
+ /**
4573
+ * True when the target is VARIABLE with no pinned variant — the customer must
4574
+ * pick a variation (use `variants`) before this can be added to the cart.
4575
+ */
4576
+ requiresVariantSelection?: boolean;
4577
+ /** The pinned variation when `targetVariantId` is set. */
4578
+ pinnedVariant?: LockedVariant | null;
4579
+ /** Selectable variations, present when `requiresVariantSelection` is true. */
4565
4580
  variants?: RecommendationVariant[];
4566
4581
  }
4567
4582
  interface ProductRecommendationsResponse {
@@ -4596,6 +4611,15 @@ interface CartBundleOfferOfferedProduct {
4596
4611
  url: string;
4597
4612
  }>;
4598
4613
  type: string;
4614
+ /** Pinned variant for this slot (VARIABLE only); null = customer chooses. */
4615
+ variantId?: string | null;
4616
+ /** True when the offered product is VARIABLE with no pinned variant. */
4617
+ requiresVariantSelection?: boolean;
4618
+ /** The pinned variation when `variantId` is set. */
4619
+ pinnedVariant?: LockedVariant | null;
4620
+ /** Selectable variations, present when `requiresVariantSelection` is true. */
4621
+ variants?: RecommendationVariant[];
4622
+ /** Effective pre-discount unit price (pinned/cheapest variant for VARIABLE). */
4599
4623
  originalPrice: string;
4600
4624
  discountedPrice: string;
4601
4625
  }
@@ -5469,6 +5493,7 @@ declare class BrainerceClient {
5469
5493
  */
5470
5494
  getProductBySlug(slug: string, options?: {
5471
5495
  locale?: string;
5496
+ regionId?: string;
5472
5497
  }): Promise<Product>;
5473
5498
  /**
5474
5499
  * Get available categories for filtering products
@@ -8851,15 +8876,17 @@ declare class BrainerceClient {
8851
8876
  name?: string | null;
8852
8877
  }>>;
8853
8878
  /**
8854
- * List the store's ACTIVE regions (public, no apiKey). Requires storeId mode.
8855
- * Returns only storefront-safe fields (no internal flags). Default region first.
8879
+ * List the store's ACTIVE regions (public, no apiKey). Works in storeId and
8880
+ * vibe-coded modes. Returns only storefront-safe fields (no internal flags).
8881
+ * Default region first.
8856
8882
  */
8857
8883
  getStoreRegions(): Promise<{
8858
8884
  data: PublicRegion[];
8859
8885
  }>;
8860
8886
  /**
8861
8887
  * Get one active public region plus its enabled payment providers (public).
8862
- * Requires storeId mode. Throws 404 if the region is inactive or not found.
8888
+ * Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
8889
+ * or not found.
8863
8890
  */
8864
8891
  getStoreRegion(regionId: string): Promise<PublicRegionDetail>;
8865
8892
  /**
@@ -8895,9 +8922,10 @@ declare class BrainerceClient {
8895
8922
  subtotal: number;
8896
8923
  }): Promise<TaxEstimateResponse>;
8897
8924
  /**
8898
- * List the store's tax classes (public, no apiKey — storeId mode). Storefront-
8899
- * safe fields only (id/name/slug/description/isDefault) for transparency UIs
8900
- * such as a "9% VAT" badge. Admin/api-key callers use getTaxClasses().
8925
+ * List the store's tax classes (public, no apiKey — storeId or vibe-coded
8926
+ * mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
8927
+ * transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
8928
+ * getTaxClasses().
8901
8929
  */
8902
8930
  getStoreTaxClasses(): Promise<{
8903
8931
  data: PublicTaxClass[];
package/dist/index.js CHANGED
@@ -1130,7 +1130,7 @@ var BrainerceClient = class {
1130
1130
  "GET",
1131
1131
  "/products",
1132
1132
  void 0,
1133
- queryParams
1133
+ queryParamsWithRegion
1134
1134
  );
1135
1135
  }
1136
1136
  if (this.storeId && !this.apiKey) {
@@ -1160,7 +1160,7 @@ var BrainerceClient = class {
1160
1160
  "GET",
1161
1161
  `/products/${encodePathSegment(productId)}`,
1162
1162
  void 0,
1163
- void 0,
1163
+ queryParams,
1164
1164
  headerOverrides
1165
1165
  );
1166
1166
  }
@@ -1192,13 +1192,14 @@ var BrainerceClient = class {
1192
1192
  */
1193
1193
  async getProductBySlug(slug, options) {
1194
1194
  const headerOverrides = options?.locale ? { "Accept-Language": options.locale } : void 0;
1195
+ const queryParams = options?.regionId ? { regionId: options.regionId } : void 0;
1195
1196
  const encodedSlug = encodePathSegment(slug);
1196
1197
  if (this.isVibeCodedMode()) {
1197
1198
  return this.vibeCodedRequest(
1198
1199
  "GET",
1199
1200
  `/products/slug/${encodedSlug}`,
1200
1201
  void 0,
1201
- void 0,
1202
+ queryParams,
1202
1203
  headerOverrides
1203
1204
  );
1204
1205
  }
@@ -1207,11 +1208,16 @@ var BrainerceClient = class {
1207
1208
  "GET",
1208
1209
  `/products/slug/${encodedSlug}`,
1209
1210
  void 0,
1210
- void 0,
1211
+ queryParams,
1211
1212
  headerOverrides
1212
1213
  );
1213
1214
  }
1214
- return this.adminRequest("GET", `/api/v1/products/by-slug/${encodedSlug}`);
1215
+ return this.adminRequest(
1216
+ "GET",
1217
+ `/api/v1/products/by-slug/${encodedSlug}`,
1218
+ void 0,
1219
+ queryParams
1220
+ );
1215
1221
  }
1216
1222
  /**
1217
1223
  * Get available categories for filtering products
@@ -7275,22 +7281,34 @@ var BrainerceClient = class {
7275
7281
  `/api/v1/regions/${encodePathSegment(regionId)}/compatible-providers`
7276
7282
  );
7277
7283
  }
7278
- // -------------------- Regions (Storefront mode, public — no apiKey) --------------------
7279
- // storeId-based, no auth. Call these from a storefront to detect the buyer's
7280
- // region (story S1), then pair with detectRegion(). Admin/api-key callers use
7281
- // getRegions()/getRegion() instead.
7284
+ // -------------------- Regions (Storefront + vibe-coded, public — no apiKey) --------------------
7285
+ // storeId- or connectionId-based, no auth. Call these from a storefront to
7286
+ // detect the buyer's region (story S1), then pair with detectRegion(). Then
7287
+ // pass the resolved regionId to getProducts({ regionId }) for display pricing.
7288
+ // Admin/api-key callers use getRegions()/getRegion() instead.
7282
7289
  /**
7283
- * List the store's ACTIVE regions (public, no apiKey). Requires storeId mode.
7284
- * Returns only storefront-safe fields (no internal flags). Default region first.
7290
+ * List the store's ACTIVE regions (public, no apiKey). Works in storeId and
7291
+ * vibe-coded modes. Returns only storefront-safe fields (no internal flags).
7292
+ * Default region first.
7285
7293
  */
7286
7294
  async getStoreRegions() {
7295
+ if (this.isVibeCodedMode()) {
7296
+ return this.vibeCodedRequest("GET", "/regions");
7297
+ }
7287
7298
  return this.storefrontRequest("GET", "/regions");
7288
7299
  }
7289
7300
  /**
7290
7301
  * Get one active public region plus its enabled payment providers (public).
7291
- * Requires storeId mode. Throws 404 if the region is inactive or not found.
7302
+ * Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
7303
+ * or not found.
7292
7304
  */
7293
7305
  async getStoreRegion(regionId) {
7306
+ if (this.isVibeCodedMode()) {
7307
+ return this.vibeCodedRequest(
7308
+ "GET",
7309
+ `/regions/${encodePathSegment(regionId)}`
7310
+ );
7311
+ }
7294
7312
  return this.storefrontRequest(
7295
7313
  "GET",
7296
7314
  `/regions/${encodePathSegment(regionId)}`
@@ -7318,6 +7336,14 @@ var BrainerceClient = class {
7318
7336
  * default region (or `region=null` if no default exists either).
7319
7337
  */
7320
7338
  async getAutoRegion(country) {
7339
+ if (this.isVibeCodedMode()) {
7340
+ return this.vibeCodedRequest(
7341
+ "GET",
7342
+ "/regions/auto",
7343
+ void 0,
7344
+ country ? { country } : void 0
7345
+ );
7346
+ }
7321
7347
  return this.storefrontRequest(
7322
7348
  "GET",
7323
7349
  "/regions/auto",
@@ -7335,20 +7361,23 @@ var BrainerceClient = class {
7335
7361
  * or no active rate covers it.
7336
7362
  */
7337
7363
  async estimateTax(params) {
7338
- return this.storefrontRequest(
7339
- "GET",
7340
- "/tax/estimate",
7341
- void 0,
7342
- params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal }
7343
- );
7364
+ const query = params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal };
7365
+ if (this.isVibeCodedMode()) {
7366
+ return this.vibeCodedRequest("GET", "/tax/estimate", void 0, query);
7367
+ }
7368
+ return this.storefrontRequest("GET", "/tax/estimate", void 0, query);
7344
7369
  }
7345
- // -------------------- Tax Classes (Storefront mode, public — no apiKey) --------------------
7370
+ // -------------------- Tax Classes (Storefront + vibe-coded, public — no apiKey) --------------------
7346
7371
  /**
7347
- * List the store's tax classes (public, no apiKey — storeId mode). Storefront-
7348
- * safe fields only (id/name/slug/description/isDefault) for transparency UIs
7349
- * such as a "9% VAT" badge. Admin/api-key callers use getTaxClasses().
7372
+ * List the store's tax classes (public, no apiKey — storeId or vibe-coded
7373
+ * mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
7374
+ * transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
7375
+ * getTaxClasses().
7350
7376
  */
7351
7377
  async getStoreTaxClasses() {
7378
+ if (this.isVibeCodedMode()) {
7379
+ return this.vibeCodedRequest("GET", "/tax-classes");
7380
+ }
7352
7381
  return this.storefrontRequest("GET", "/tax-classes");
7353
7382
  }
7354
7383
  // -------------------- Tax Classes (Admin mode, apiKey) --------------------
package/dist/index.mjs CHANGED
@@ -1060,7 +1060,7 @@ var BrainerceClient = class {
1060
1060
  "GET",
1061
1061
  "/products",
1062
1062
  void 0,
1063
- queryParams
1063
+ queryParamsWithRegion
1064
1064
  );
1065
1065
  }
1066
1066
  if (this.storeId && !this.apiKey) {
@@ -1090,7 +1090,7 @@ var BrainerceClient = class {
1090
1090
  "GET",
1091
1091
  `/products/${encodePathSegment(productId)}`,
1092
1092
  void 0,
1093
- void 0,
1093
+ queryParams,
1094
1094
  headerOverrides
1095
1095
  );
1096
1096
  }
@@ -1122,13 +1122,14 @@ var BrainerceClient = class {
1122
1122
  */
1123
1123
  async getProductBySlug(slug, options) {
1124
1124
  const headerOverrides = options?.locale ? { "Accept-Language": options.locale } : void 0;
1125
+ const queryParams = options?.regionId ? { regionId: options.regionId } : void 0;
1125
1126
  const encodedSlug = encodePathSegment(slug);
1126
1127
  if (this.isVibeCodedMode()) {
1127
1128
  return this.vibeCodedRequest(
1128
1129
  "GET",
1129
1130
  `/products/slug/${encodedSlug}`,
1130
1131
  void 0,
1131
- void 0,
1132
+ queryParams,
1132
1133
  headerOverrides
1133
1134
  );
1134
1135
  }
@@ -1137,11 +1138,16 @@ var BrainerceClient = class {
1137
1138
  "GET",
1138
1139
  `/products/slug/${encodedSlug}`,
1139
1140
  void 0,
1140
- void 0,
1141
+ queryParams,
1141
1142
  headerOverrides
1142
1143
  );
1143
1144
  }
1144
- return this.adminRequest("GET", `/api/v1/products/by-slug/${encodedSlug}`);
1145
+ return this.adminRequest(
1146
+ "GET",
1147
+ `/api/v1/products/by-slug/${encodedSlug}`,
1148
+ void 0,
1149
+ queryParams
1150
+ );
1145
1151
  }
1146
1152
  /**
1147
1153
  * Get available categories for filtering products
@@ -7205,22 +7211,34 @@ var BrainerceClient = class {
7205
7211
  `/api/v1/regions/${encodePathSegment(regionId)}/compatible-providers`
7206
7212
  );
7207
7213
  }
7208
- // -------------------- Regions (Storefront mode, public — no apiKey) --------------------
7209
- // storeId-based, no auth. Call these from a storefront to detect the buyer's
7210
- // region (story S1), then pair with detectRegion(). Admin/api-key callers use
7211
- // getRegions()/getRegion() instead.
7214
+ // -------------------- Regions (Storefront + vibe-coded, public — no apiKey) --------------------
7215
+ // storeId- or connectionId-based, no auth. Call these from a storefront to
7216
+ // detect the buyer's region (story S1), then pair with detectRegion(). Then
7217
+ // pass the resolved regionId to getProducts({ regionId }) for display pricing.
7218
+ // Admin/api-key callers use getRegions()/getRegion() instead.
7212
7219
  /**
7213
- * List the store's ACTIVE regions (public, no apiKey). Requires storeId mode.
7214
- * Returns only storefront-safe fields (no internal flags). Default region first.
7220
+ * List the store's ACTIVE regions (public, no apiKey). Works in storeId and
7221
+ * vibe-coded modes. Returns only storefront-safe fields (no internal flags).
7222
+ * Default region first.
7215
7223
  */
7216
7224
  async getStoreRegions() {
7225
+ if (this.isVibeCodedMode()) {
7226
+ return this.vibeCodedRequest("GET", "/regions");
7227
+ }
7217
7228
  return this.storefrontRequest("GET", "/regions");
7218
7229
  }
7219
7230
  /**
7220
7231
  * Get one active public region plus its enabled payment providers (public).
7221
- * Requires storeId mode. Throws 404 if the region is inactive or not found.
7232
+ * Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
7233
+ * or not found.
7222
7234
  */
7223
7235
  async getStoreRegion(regionId) {
7236
+ if (this.isVibeCodedMode()) {
7237
+ return this.vibeCodedRequest(
7238
+ "GET",
7239
+ `/regions/${encodePathSegment(regionId)}`
7240
+ );
7241
+ }
7224
7242
  return this.storefrontRequest(
7225
7243
  "GET",
7226
7244
  `/regions/${encodePathSegment(regionId)}`
@@ -7248,6 +7266,14 @@ var BrainerceClient = class {
7248
7266
  * default region (or `region=null` if no default exists either).
7249
7267
  */
7250
7268
  async getAutoRegion(country) {
7269
+ if (this.isVibeCodedMode()) {
7270
+ return this.vibeCodedRequest(
7271
+ "GET",
7272
+ "/regions/auto",
7273
+ void 0,
7274
+ country ? { country } : void 0
7275
+ );
7276
+ }
7251
7277
  return this.storefrontRequest(
7252
7278
  "GET",
7253
7279
  "/regions/auto",
@@ -7265,20 +7291,23 @@ var BrainerceClient = class {
7265
7291
  * or no active rate covers it.
7266
7292
  */
7267
7293
  async estimateTax(params) {
7268
- return this.storefrontRequest(
7269
- "GET",
7270
- "/tax/estimate",
7271
- void 0,
7272
- params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal }
7273
- );
7294
+ const query = params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal };
7295
+ if (this.isVibeCodedMode()) {
7296
+ return this.vibeCodedRequest("GET", "/tax/estimate", void 0, query);
7297
+ }
7298
+ return this.storefrontRequest("GET", "/tax/estimate", void 0, query);
7274
7299
  }
7275
- // -------------------- Tax Classes (Storefront mode, public — no apiKey) --------------------
7300
+ // -------------------- Tax Classes (Storefront + vibe-coded, public — no apiKey) --------------------
7276
7301
  /**
7277
- * List the store's tax classes (public, no apiKey — storeId mode). Storefront-
7278
- * safe fields only (id/name/slug/description/isDefault) for transparency UIs
7279
- * such as a "9% VAT" badge. Admin/api-key callers use getTaxClasses().
7302
+ * List the store's tax classes (public, no apiKey — storeId or vibe-coded
7303
+ * mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
7304
+ * transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
7305
+ * getTaxClasses().
7280
7306
  */
7281
7307
  async getStoreTaxClasses() {
7308
+ if (this.isVibeCodedMode()) {
7309
+ return this.vibeCodedRequest("GET", "/tax-classes");
7310
+ }
7282
7311
  return this.storefrontRequest("GET", "/tax-classes");
7283
7312
  }
7284
7313
  // -------------------- Tax Classes (Admin mode, apiKey) --------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainerce",
3
- "version": "1.36.5",
3
+ "version": "1.37.2",
4
4
  "description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",