brainerce 1.36.5 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/dist/index.d.mts +33 -6
- package/dist/index.d.ts +33 -6
- package/dist/index.js +42 -19
- package/dist/index.mjs +42 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2076,8 +2076,11 @@ await client.getProduct('prod_tshirt', { regionId: 'region_eu' });
|
|
|
2076
2076
|
|
|
2077
2077
|
> **Display-only** — like checkout, `regionId` here does not charge the region
|
|
2078
2078
|
> price; it only changes what you render until currency-lock ships. **Mode note:**
|
|
2079
|
-
>
|
|
2080
|
-
>
|
|
2079
|
+
> the additive FX display overlay (`displayPrice` / `displayCurrency`, see
|
|
2080
|
+
> [Regions](/docs/concepts/regions)) now applies in vibe-coded
|
|
2081
|
+
> (`vc_*`/`salesChannelId`) mode too — previously it was populated on storefront
|
|
2082
|
+
> (`storeId`) and admin (`apiKey`) reads only. Pass `regionId` and the response
|
|
2083
|
+
> gains `displayPrice` whenever a daily FX rate exists for the store→region pair.
|
|
2081
2084
|
|
|
2082
2085
|
#### Partial Checkout (AliExpress-style)
|
|
2083
2086
|
|
|
@@ -3566,10 +3569,13 @@ await client.deleteTaxClass(food.id);
|
|
|
3566
3569
|
```
|
|
3567
3570
|
|
|
3568
3571
|
**Storefront (public, no API key).** A storefront lists classes in `storeId`
|
|
3569
|
-
mode
|
|
3572
|
+
mode **or** vibe-coded mode (`salesChannelId: 'vc_*'`, gated on the
|
|
3573
|
+
`products:read` scope every connection already has) — storefront-safe fields
|
|
3574
|
+
only (for a "9% VAT" transparency badge):
|
|
3570
3575
|
|
|
3571
3576
|
```typescript
|
|
3572
3577
|
const store = new BrainerceClient({ storeId: 'store_123' });
|
|
3578
|
+
// — or — new BrainerceClient({ salesChannelId: 'vc_abc123' });
|
|
3573
3579
|
const { data: classes } = await store.getStoreTaxClasses();
|
|
3574
3580
|
```
|
|
3575
3581
|
|
|
@@ -3614,14 +3620,19 @@ await client.deleteRegion(eu.id);
|
|
|
3614
3620
|
```
|
|
3615
3621
|
|
|
3616
3622
|
**Storefront (public, no API key).** A storefront fetches regions in `storeId`
|
|
3617
|
-
mode
|
|
3623
|
+
mode **or** vibe-coded mode (`salesChannelId: 'vc_*'`, gated on the
|
|
3624
|
+
`products:read` scope every connection already has) — only active regions, only
|
|
3625
|
+
storefront-safe fields. `getStoreRegions()`, `getStoreRegion()`, and
|
|
3626
|
+
`getAutoRegion()` all work in both modes:
|
|
3618
3627
|
|
|
3619
3628
|
```typescript
|
|
3620
3629
|
const store = new BrainerceClient({ storeId: 'store_123' });
|
|
3630
|
+
// — or — new BrainerceClient({ salesChannelId: 'vc_abc123' });
|
|
3621
3631
|
|
|
3622
3632
|
const { data: regions } = await store.getStoreRegions();
|
|
3623
3633
|
const region = await store.getStoreRegion(regions[0].id); // + paymentProviders
|
|
3624
3634
|
const dest = store.detectRegion('DE', regions); // pick by country, client-side
|
|
3635
|
+
const { region: resolved } = await store.getAutoRegion('DE'); // server-side, one round trip
|
|
3625
3636
|
```
|
|
3626
3637
|
|
|
3627
3638
|
> **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
|
}
|
|
@@ -8851,15 +8875,17 @@ declare class BrainerceClient {
|
|
|
8851
8875
|
name?: string | null;
|
|
8852
8876
|
}>>;
|
|
8853
8877
|
/**
|
|
8854
|
-
* List the store's ACTIVE regions (public, no apiKey).
|
|
8855
|
-
* Returns only storefront-safe fields (no internal flags).
|
|
8878
|
+
* List the store's ACTIVE regions (public, no apiKey). Works in storeId and
|
|
8879
|
+
* vibe-coded modes. Returns only storefront-safe fields (no internal flags).
|
|
8880
|
+
* Default region first.
|
|
8856
8881
|
*/
|
|
8857
8882
|
getStoreRegions(): Promise<{
|
|
8858
8883
|
data: PublicRegion[];
|
|
8859
8884
|
}>;
|
|
8860
8885
|
/**
|
|
8861
8886
|
* Get one active public region plus its enabled payment providers (public).
|
|
8862
|
-
*
|
|
8887
|
+
* Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
|
|
8888
|
+
* or not found.
|
|
8863
8889
|
*/
|
|
8864
8890
|
getStoreRegion(regionId: string): Promise<PublicRegionDetail>;
|
|
8865
8891
|
/**
|
|
@@ -8895,9 +8921,10 @@ declare class BrainerceClient {
|
|
|
8895
8921
|
subtotal: number;
|
|
8896
8922
|
}): Promise<TaxEstimateResponse>;
|
|
8897
8923
|
/**
|
|
8898
|
-
* List the store's tax classes (public, no apiKey — storeId
|
|
8899
|
-
* safe fields only (id/name/slug/description/isDefault) for
|
|
8900
|
-
* such as a "9% VAT" badge. Admin/api-key callers use
|
|
8924
|
+
* List the store's tax classes (public, no apiKey — storeId or vibe-coded
|
|
8925
|
+
* mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
|
|
8926
|
+
* transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
|
|
8927
|
+
* getTaxClasses().
|
|
8901
8928
|
*/
|
|
8902
8929
|
getStoreTaxClasses(): Promise<{
|
|
8903
8930
|
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
|
}
|
|
@@ -8851,15 +8875,17 @@ declare class BrainerceClient {
|
|
|
8851
8875
|
name?: string | null;
|
|
8852
8876
|
}>>;
|
|
8853
8877
|
/**
|
|
8854
|
-
* List the store's ACTIVE regions (public, no apiKey).
|
|
8855
|
-
* Returns only storefront-safe fields (no internal flags).
|
|
8878
|
+
* List the store's ACTIVE regions (public, no apiKey). Works in storeId and
|
|
8879
|
+
* vibe-coded modes. Returns only storefront-safe fields (no internal flags).
|
|
8880
|
+
* Default region first.
|
|
8856
8881
|
*/
|
|
8857
8882
|
getStoreRegions(): Promise<{
|
|
8858
8883
|
data: PublicRegion[];
|
|
8859
8884
|
}>;
|
|
8860
8885
|
/**
|
|
8861
8886
|
* Get one active public region plus its enabled payment providers (public).
|
|
8862
|
-
*
|
|
8887
|
+
* Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
|
|
8888
|
+
* or not found.
|
|
8863
8889
|
*/
|
|
8864
8890
|
getStoreRegion(regionId: string): Promise<PublicRegionDetail>;
|
|
8865
8891
|
/**
|
|
@@ -8895,9 +8921,10 @@ declare class BrainerceClient {
|
|
|
8895
8921
|
subtotal: number;
|
|
8896
8922
|
}): Promise<TaxEstimateResponse>;
|
|
8897
8923
|
/**
|
|
8898
|
-
* List the store's tax classes (public, no apiKey — storeId
|
|
8899
|
-
* safe fields only (id/name/slug/description/isDefault) for
|
|
8900
|
-
* such as a "9% VAT" badge. Admin/api-key callers use
|
|
8924
|
+
* List the store's tax classes (public, no apiKey — storeId or vibe-coded
|
|
8925
|
+
* mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
|
|
8926
|
+
* transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
|
|
8927
|
+
* getTaxClasses().
|
|
8901
8928
|
*/
|
|
8902
8929
|
getStoreTaxClasses(): Promise<{
|
|
8903
8930
|
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
|
-
|
|
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
|
-
|
|
1163
|
+
queryParams,
|
|
1164
1164
|
headerOverrides
|
|
1165
1165
|
);
|
|
1166
1166
|
}
|
|
@@ -7275,22 +7275,34 @@ var BrainerceClient = class {
|
|
|
7275
7275
|
`/api/v1/regions/${encodePathSegment(regionId)}/compatible-providers`
|
|
7276
7276
|
);
|
|
7277
7277
|
}
|
|
7278
|
-
// -------------------- Regions (Storefront
|
|
7279
|
-
// storeId-based, no auth. Call these from a storefront to
|
|
7280
|
-
// region (story S1), then pair with detectRegion().
|
|
7281
|
-
//
|
|
7278
|
+
// -------------------- Regions (Storefront + vibe-coded, public — no apiKey) --------------------
|
|
7279
|
+
// storeId- or connectionId-based, no auth. Call these from a storefront to
|
|
7280
|
+
// detect the buyer's region (story S1), then pair with detectRegion(). Then
|
|
7281
|
+
// pass the resolved regionId to getProducts({ regionId }) for display pricing.
|
|
7282
|
+
// Admin/api-key callers use getRegions()/getRegion() instead.
|
|
7282
7283
|
/**
|
|
7283
|
-
* List the store's ACTIVE regions (public, no apiKey).
|
|
7284
|
-
* Returns only storefront-safe fields (no internal flags).
|
|
7284
|
+
* List the store's ACTIVE regions (public, no apiKey). Works in storeId and
|
|
7285
|
+
* vibe-coded modes. Returns only storefront-safe fields (no internal flags).
|
|
7286
|
+
* Default region first.
|
|
7285
7287
|
*/
|
|
7286
7288
|
async getStoreRegions() {
|
|
7289
|
+
if (this.isVibeCodedMode()) {
|
|
7290
|
+
return this.vibeCodedRequest("GET", "/regions");
|
|
7291
|
+
}
|
|
7287
7292
|
return this.storefrontRequest("GET", "/regions");
|
|
7288
7293
|
}
|
|
7289
7294
|
/**
|
|
7290
7295
|
* Get one active public region plus its enabled payment providers (public).
|
|
7291
|
-
*
|
|
7296
|
+
* Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
|
|
7297
|
+
* or not found.
|
|
7292
7298
|
*/
|
|
7293
7299
|
async getStoreRegion(regionId) {
|
|
7300
|
+
if (this.isVibeCodedMode()) {
|
|
7301
|
+
return this.vibeCodedRequest(
|
|
7302
|
+
"GET",
|
|
7303
|
+
`/regions/${encodePathSegment(regionId)}`
|
|
7304
|
+
);
|
|
7305
|
+
}
|
|
7294
7306
|
return this.storefrontRequest(
|
|
7295
7307
|
"GET",
|
|
7296
7308
|
`/regions/${encodePathSegment(regionId)}`
|
|
@@ -7318,6 +7330,14 @@ var BrainerceClient = class {
|
|
|
7318
7330
|
* default region (or `region=null` if no default exists either).
|
|
7319
7331
|
*/
|
|
7320
7332
|
async getAutoRegion(country) {
|
|
7333
|
+
if (this.isVibeCodedMode()) {
|
|
7334
|
+
return this.vibeCodedRequest(
|
|
7335
|
+
"GET",
|
|
7336
|
+
"/regions/auto",
|
|
7337
|
+
void 0,
|
|
7338
|
+
country ? { country } : void 0
|
|
7339
|
+
);
|
|
7340
|
+
}
|
|
7321
7341
|
return this.storefrontRequest(
|
|
7322
7342
|
"GET",
|
|
7323
7343
|
"/regions/auto",
|
|
@@ -7335,20 +7355,23 @@ var BrainerceClient = class {
|
|
|
7335
7355
|
* or no active rate covers it.
|
|
7336
7356
|
*/
|
|
7337
7357
|
async estimateTax(params) {
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
"/tax/estimate",
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
);
|
|
7358
|
+
const query = params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal };
|
|
7359
|
+
if (this.isVibeCodedMode()) {
|
|
7360
|
+
return this.vibeCodedRequest("GET", "/tax/estimate", void 0, query);
|
|
7361
|
+
}
|
|
7362
|
+
return this.storefrontRequest("GET", "/tax/estimate", void 0, query);
|
|
7344
7363
|
}
|
|
7345
|
-
// -------------------- Tax Classes (Storefront
|
|
7364
|
+
// -------------------- Tax Classes (Storefront + vibe-coded, public — no apiKey) --------------------
|
|
7346
7365
|
/**
|
|
7347
|
-
* List the store's tax classes (public, no apiKey — storeId
|
|
7348
|
-
* safe fields only (id/name/slug/description/isDefault) for
|
|
7349
|
-
* such as a "9% VAT" badge. Admin/api-key callers use
|
|
7366
|
+
* List the store's tax classes (public, no apiKey — storeId or vibe-coded
|
|
7367
|
+
* mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
|
|
7368
|
+
* transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
|
|
7369
|
+
* getTaxClasses().
|
|
7350
7370
|
*/
|
|
7351
7371
|
async getStoreTaxClasses() {
|
|
7372
|
+
if (this.isVibeCodedMode()) {
|
|
7373
|
+
return this.vibeCodedRequest("GET", "/tax-classes");
|
|
7374
|
+
}
|
|
7352
7375
|
return this.storefrontRequest("GET", "/tax-classes");
|
|
7353
7376
|
}
|
|
7354
7377
|
// -------------------- 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
|
-
|
|
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
|
-
|
|
1093
|
+
queryParams,
|
|
1094
1094
|
headerOverrides
|
|
1095
1095
|
);
|
|
1096
1096
|
}
|
|
@@ -7205,22 +7205,34 @@ var BrainerceClient = class {
|
|
|
7205
7205
|
`/api/v1/regions/${encodePathSegment(regionId)}/compatible-providers`
|
|
7206
7206
|
);
|
|
7207
7207
|
}
|
|
7208
|
-
// -------------------- Regions (Storefront
|
|
7209
|
-
// storeId-based, no auth. Call these from a storefront to
|
|
7210
|
-
// region (story S1), then pair with detectRegion().
|
|
7211
|
-
//
|
|
7208
|
+
// -------------------- Regions (Storefront + vibe-coded, public — no apiKey) --------------------
|
|
7209
|
+
// storeId- or connectionId-based, no auth. Call these from a storefront to
|
|
7210
|
+
// detect the buyer's region (story S1), then pair with detectRegion(). Then
|
|
7211
|
+
// pass the resolved regionId to getProducts({ regionId }) for display pricing.
|
|
7212
|
+
// Admin/api-key callers use getRegions()/getRegion() instead.
|
|
7212
7213
|
/**
|
|
7213
|
-
* List the store's ACTIVE regions (public, no apiKey).
|
|
7214
|
-
* Returns only storefront-safe fields (no internal flags).
|
|
7214
|
+
* List the store's ACTIVE regions (public, no apiKey). Works in storeId and
|
|
7215
|
+
* vibe-coded modes. Returns only storefront-safe fields (no internal flags).
|
|
7216
|
+
* Default region first.
|
|
7215
7217
|
*/
|
|
7216
7218
|
async getStoreRegions() {
|
|
7219
|
+
if (this.isVibeCodedMode()) {
|
|
7220
|
+
return this.vibeCodedRequest("GET", "/regions");
|
|
7221
|
+
}
|
|
7217
7222
|
return this.storefrontRequest("GET", "/regions");
|
|
7218
7223
|
}
|
|
7219
7224
|
/**
|
|
7220
7225
|
* Get one active public region plus its enabled payment providers (public).
|
|
7221
|
-
*
|
|
7226
|
+
* Works in storeId and vibe-coded modes. Throws 404 if the region is inactive
|
|
7227
|
+
* or not found.
|
|
7222
7228
|
*/
|
|
7223
7229
|
async getStoreRegion(regionId) {
|
|
7230
|
+
if (this.isVibeCodedMode()) {
|
|
7231
|
+
return this.vibeCodedRequest(
|
|
7232
|
+
"GET",
|
|
7233
|
+
`/regions/${encodePathSegment(regionId)}`
|
|
7234
|
+
);
|
|
7235
|
+
}
|
|
7224
7236
|
return this.storefrontRequest(
|
|
7225
7237
|
"GET",
|
|
7226
7238
|
`/regions/${encodePathSegment(regionId)}`
|
|
@@ -7248,6 +7260,14 @@ var BrainerceClient = class {
|
|
|
7248
7260
|
* default region (or `region=null` if no default exists either).
|
|
7249
7261
|
*/
|
|
7250
7262
|
async getAutoRegion(country) {
|
|
7263
|
+
if (this.isVibeCodedMode()) {
|
|
7264
|
+
return this.vibeCodedRequest(
|
|
7265
|
+
"GET",
|
|
7266
|
+
"/regions/auto",
|
|
7267
|
+
void 0,
|
|
7268
|
+
country ? { country } : void 0
|
|
7269
|
+
);
|
|
7270
|
+
}
|
|
7251
7271
|
return this.storefrontRequest(
|
|
7252
7272
|
"GET",
|
|
7253
7273
|
"/regions/auto",
|
|
@@ -7265,20 +7285,23 @@ var BrainerceClient = class {
|
|
|
7265
7285
|
* or no active rate covers it.
|
|
7266
7286
|
*/
|
|
7267
7287
|
async estimateTax(params) {
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
"/tax/estimate",
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
);
|
|
7288
|
+
const query = params.country ? { country: params.country, subtotal: params.subtotal } : { subtotal: params.subtotal };
|
|
7289
|
+
if (this.isVibeCodedMode()) {
|
|
7290
|
+
return this.vibeCodedRequest("GET", "/tax/estimate", void 0, query);
|
|
7291
|
+
}
|
|
7292
|
+
return this.storefrontRequest("GET", "/tax/estimate", void 0, query);
|
|
7274
7293
|
}
|
|
7275
|
-
// -------------------- Tax Classes (Storefront
|
|
7294
|
+
// -------------------- Tax Classes (Storefront + vibe-coded, public — no apiKey) --------------------
|
|
7276
7295
|
/**
|
|
7277
|
-
* List the store's tax classes (public, no apiKey — storeId
|
|
7278
|
-
* safe fields only (id/name/slug/description/isDefault) for
|
|
7279
|
-
* such as a "9% VAT" badge. Admin/api-key callers use
|
|
7296
|
+
* List the store's tax classes (public, no apiKey — storeId or vibe-coded
|
|
7297
|
+
* mode). Storefront-safe fields only (id/name/slug/description/isDefault) for
|
|
7298
|
+
* transparency UIs such as a "9% VAT" badge. Admin/api-key callers use
|
|
7299
|
+
* getTaxClasses().
|
|
7280
7300
|
*/
|
|
7281
7301
|
async getStoreTaxClasses() {
|
|
7302
|
+
if (this.isVibeCodedMode()) {
|
|
7303
|
+
return this.vibeCodedRequest("GET", "/tax-classes");
|
|
7304
|
+
}
|
|
7282
7305
|
return this.storefrontRequest("GET", "/tax-classes");
|
|
7283
7306
|
}
|
|
7284
7307
|
// -------------------- Tax Classes (Admin mode, apiKey) --------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
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",
|