brainerce 1.44.0 → 1.45.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 +216 -35
- package/dist/index.d.mts +218 -1
- package/dist/index.d.ts +218 -1
- package/dist/index.js +51 -5
- package/dist/index.mjs +51 -5
- package/package.json +81 -81
package/README.md
CHANGED
|
@@ -32,28 +32,28 @@ yarn add brainerce
|
|
|
32
32
|
|
|
33
33
|
Every Brainerce storefront must include **all mandatory features** below. Features auto-hide when the underlying capability is disabled, so build them all anyway — they'll appear the moment the store owner enables them.
|
|
34
34
|
|
|
35
|
-
| Feature | SDK entry point
|
|
36
|
-
| ------------------------------------------------------- |
|
|
37
|
-
| Product list with search, filter, pagination | `client.getProducts()`, `client.getSearchSuggestions(query)`
|
|
38
|
-
| Product detail with variant picker, stock, price | `client.getProductBySlug()` + helpers
|
|
39
|
-
| Buyer customization fields (engraving, uploads, select) | `product.customizationFields`, `client.uploadCustomizationFile()`
|
|
40
|
-
| Cart (add, update, remove, coupon, totals) | `client.addToCart()`, `getCartTotals(cart)`
|
|
41
|
-
| Inventory reservation countdown | Cart expiry timestamp from `client.getCart()`
|
|
42
|
-
| Full checkout end-to-end with payment | `setShippingAddress → selectShippingMethod → getPaymentProviders → pay → handlePaymentSuccess → waitForOrder`
|
|
43
|
-
| Order confirmation (clear cart + wait for real order) | `client.handlePaymentSuccess()`, `client.waitForOrder()`
|
|
44
|
-
| Register + email verification flow | `client.registerCustomer()`, `client.verifyEmail()`
|
|
45
|
-
| Login + verification branch | `client.loginCustomer()`
|
|
46
|
-
| Forgot / reset password | `client.forgotPassword()`, `client.resetPassword()`
|
|
47
|
-
| OAuth sign-in buttons + callback handler | `client.getAvailableOAuthProviders()`
|
|
48
|
-
| Account area (profile + order history) | `client.getMyProfile()`, `client.getMyOrders()`
|
|
35
|
+
| Feature | SDK entry point | Mandatory |
|
|
36
|
+
| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
37
|
+
| Product list with search, filter, pagination | `client.getProducts()`, `client.getSearchSuggestions(query)` | ✅ |
|
|
38
|
+
| Product detail with variant picker, stock, price | `client.getProductBySlug()` + helpers | ✅ |
|
|
39
|
+
| Buyer customization fields (engraving, uploads, select) | `product.customizationFields`, `client.uploadCustomizationFile()` | ✅ |
|
|
40
|
+
| Cart (add, update, remove, coupon, totals) | `client.addToCart()`, `getCartTotals(cart)` | ✅ |
|
|
41
|
+
| Inventory reservation countdown | Cart expiry timestamp from `client.getCart()` | ✅ |
|
|
42
|
+
| Full checkout end-to-end with payment | `setShippingAddress → selectShippingMethod → getPaymentProviders → pay → handlePaymentSuccess → waitForOrder` | ✅ |
|
|
43
|
+
| Order confirmation (clear cart + wait for real order) | `client.handlePaymentSuccess()`, `client.waitForOrder()` | ✅ |
|
|
44
|
+
| Register + email verification flow | `client.registerCustomer()`, `client.verifyEmail()` | ✅ |
|
|
45
|
+
| Login + verification branch | `client.loginCustomer()` | ✅ |
|
|
46
|
+
| Forgot / reset password | `client.forgotPassword()`, `client.resetPassword()` | ✅ |
|
|
47
|
+
| OAuth sign-in buttons + callback handler | `client.getAvailableOAuthProviders()` | ✅ |
|
|
48
|
+
| Account area (profile + order history) | `client.getMyProfile()`, `client.getMyOrders()` | ✅ |
|
|
49
49
|
| Loyalty & rewards (points balance + tiers + redeem) | `client.getLoyaltyStatus()`, `client.getAvailableRewards()`, `client.redeemLoyaltyReward(id)`, `client.reportSocialShare()` | conditional |
|
|
50
|
-
| Global header: cart count + search autocomplete | `client.getCart()`, `client.getSearchSuggestions(query)`
|
|
51
|
-
| Discount banners + product badges | `client.getDiscountBanners()`, `client.getProductDiscountBadge(productId)`
|
|
52
|
-
| Product reviews on PDP + JSON-LD aggregateRating | `client.listProductReviews(id)`, `client.submitProductReview(id, …)`
|
|
53
|
-
| Site chrome (header + footer + announcement bar) | `client.content.header.get()`, `client.content.footer.get()`, `client.content.announcement.list()`
|
|
54
|
-
| FAQ page | `client.content.faq.get('main', locale)`
|
|
55
|
-
| Static pages catch-all (`/pages/[slug]`) | `client.content.page.getBySlug(slug, locale)`
|
|
56
|
-
| Multi-language + RTL (when i18n enabled) | `client.setLocale()`, `client.getStoreDirection(locale)`
|
|
50
|
+
| Global header: cart count + search autocomplete | `client.getCart()`, `client.getSearchSuggestions(query)` | ✅ |
|
|
51
|
+
| Discount banners + product badges | `client.getDiscountBanners()`, `client.getProductDiscountBadge(productId)` | ✅ |
|
|
52
|
+
| Product reviews on PDP + JSON-LD aggregateRating | `client.listProductReviews(id)`, `client.submitProductReview(id, …)` | ✅ |
|
|
53
|
+
| Site chrome (header + footer + announcement bar) | `client.content.header.get()`, `client.content.footer.get()`, `client.content.announcement.list()` | ✅ |
|
|
54
|
+
| FAQ page | `client.content.faq.get('main', locale)` | conditional |
|
|
55
|
+
| Static pages catch-all (`/pages/[slug]`) | `client.content.page.getBySlug(slug, locale)` | conditional |
|
|
56
|
+
| Multi-language + RTL (when i18n enabled) | `client.setLocale()`, `client.getStoreDirection(locale)` | conditional |
|
|
57
57
|
|
|
58
58
|
---
|
|
59
59
|
|
|
@@ -185,9 +185,22 @@ These sequences are non-negotiable. The order of SDK calls matters.
|
|
|
185
185
|
|
|
186
186
|
1. Read `checkoutId` from URL or session.
|
|
187
187
|
2. `await client.handlePaymentSuccess(checkoutId)` — mandatory, clears cart so purchased items don't show on next visit.
|
|
188
|
-
3. `const
|
|
188
|
+
3. `const result = await client.waitForOrder(checkoutId)` — polls until the webhook writes the order. `result.status.orderNumber` / `result.status.orderId` are available on success.
|
|
189
189
|
4. Show a spinner during step 3 (webhook may lag). On timeout: show "we're still processing, check your email" with a link to order history — the order WILL appear there.
|
|
190
|
-
5. On success: render order number
|
|
190
|
+
5. On success: render the order number, or — if your design wants more than that — fetch full details:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
const result = await client.waitForOrder(checkoutId);
|
|
194
|
+
if (result.success) {
|
|
195
|
+
const order = await client.getOrderByCheckout(checkoutId);
|
|
196
|
+
// order.items, order.shippingAddress, order.notes (the shopper's own
|
|
197
|
+
// order note, read-only), order.subtotal, order.shippingAmount,
|
|
198
|
+
// order.taxAmount / order.taxBreakdown, order.totalAmount
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`getOrderByCheckout` works for guests too — possession of the checkout id is
|
|
203
|
+
the credential, no customer token needed.
|
|
191
204
|
|
|
192
205
|
### Password reset flow
|
|
193
206
|
|
|
@@ -1560,7 +1573,7 @@ await client.addToCart(cartId, {
|
|
|
1560
1573
|
```typescript
|
|
1561
1574
|
// Works for CartItem, CheckoutLineItem, and OrderItem — same shape
|
|
1562
1575
|
const summary = Object.values(item.customizations ?? {})
|
|
1563
|
-
.map(c => `${c.label}: ${Array.isArray(c.value) ? c.value.join(', ') : c.value}`)
|
|
1576
|
+
.map((c) => `${c.label}: ${Array.isArray(c.value) ? c.value.join(', ') : c.value}`)
|
|
1564
1577
|
.join(' | ');
|
|
1565
1578
|
// e.g. "Frame color: Gold | Add-ons: Gift wrap, Engraving"
|
|
1566
1579
|
```
|
|
@@ -2144,6 +2157,7 @@ const checkout = await client.setCheckoutCustomer(checkoutId, {
|
|
|
2144
2157
|
firstName: 'John',
|
|
2145
2158
|
lastName: 'Doe',
|
|
2146
2159
|
phone: '+1234567890', // Optional
|
|
2160
|
+
notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
|
|
2147
2161
|
});
|
|
2148
2162
|
```
|
|
2149
2163
|
|
|
@@ -2160,12 +2174,21 @@ const { checkout, rates } = await client.setShippingAddress(checkoutId, {
|
|
|
2160
2174
|
postalCode: '10001',
|
|
2161
2175
|
country: 'US',
|
|
2162
2176
|
phone: '+1234567890', // Optional
|
|
2177
|
+
notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
|
|
2163
2178
|
});
|
|
2164
2179
|
|
|
2165
2180
|
// rates contains available shipping options
|
|
2166
2181
|
console.log(rates); // ShippingRate[]
|
|
2167
2182
|
```
|
|
2168
2183
|
|
|
2184
|
+
> **Order notes:** every checkout page should render an optional **"Order
|
|
2185
|
+
> notes"** textarea by default. Send its value via `notes` on either
|
|
2186
|
+
> `setCheckoutCustomer` or `setShippingAddress` (whichever call your flow
|
|
2187
|
+
> makes last) — max 2000 chars, empty string clears a previously-set note.
|
|
2188
|
+
> The note is copied onto the order at completion (merchant sees it in the
|
|
2189
|
+
> dashboard, it's included in the confirmation email) and echoed back
|
|
2190
|
+
> read-only as `Order.notes` on buyer order responses.
|
|
2191
|
+
|
|
2169
2192
|
#### Select Shipping Method
|
|
2170
2193
|
|
|
2171
2194
|
```typescript
|
|
@@ -2239,10 +2262,11 @@ interface Checkout {
|
|
|
2239
2262
|
subtotal: string;
|
|
2240
2263
|
discountAmount: string;
|
|
2241
2264
|
shippingAmount: string;
|
|
2242
|
-
taxAmount: string;
|
|
2265
|
+
taxAmount: string; // "0" in inclusive (VAT) mode — see taxBreakdown.totalTax
|
|
2243
2266
|
taxBreakdown?: TaxBreakdown | null; // { totalTax, pricesIncludeTax, breakdown[] }
|
|
2244
2267
|
total: string;
|
|
2245
2268
|
couponCode?: string | null;
|
|
2269
|
+
notes?: string | null; // Order note from setCheckoutCustomer/setShippingAddress
|
|
2246
2270
|
items: CheckoutLineItem[];
|
|
2247
2271
|
itemCount: number;
|
|
2248
2272
|
availableShippingRates?: ShippingRate[];
|
|
@@ -2380,12 +2404,12 @@ const checkoutId = checkout.id;
|
|
|
2380
2404
|
Use this method to get ALL enabled payment providers and build dynamic UI.
|
|
2381
2405
|
|
|
2382
2406
|
**Primary vs. additive methods (Shopify-parity).** Each provider carries a
|
|
2383
|
-
`methodType`. A `CREDIT_CARD` provider is the
|
|
2407
|
+
`methodType`. A `CREDIT_CARD` provider is the _primary_ card processor — the
|
|
2384
2408
|
single method that settles the order (`defaultProvider`, `isAdditive: false`,
|
|
2385
|
-
`presentation: 'card_form'`). Everything else is
|
|
2409
|
+
`presentation: 'card_form'`). Everything else is _additive_ (`isAdditive: true`),
|
|
2386
2410
|
e.g. PayPal is a `'WALLET'` with `presentation: 'express_button'`. Render additive
|
|
2387
2411
|
methods as accelerated-checkout **express buttons above the card form** — they sit
|
|
2388
|
-
|
|
2412
|
+
_alongside_ the primary, never replace it. (Exception: a wallet-only store has no
|
|
2389
2413
|
card processor, so its wallet becomes the `defaultProvider` and stands alone.)
|
|
2390
2414
|
|
|
2391
2415
|
```typescript
|
|
@@ -2943,8 +2967,9 @@ const rewards = await client.getAvailableRewards();
|
|
|
2943
2967
|
// Redeem → spends points, returns a one-time coupon code to apply to the cart.
|
|
2944
2968
|
// `discountType` tells you how to interpret `discountValue` (currency amount
|
|
2945
2969
|
// for FIXED_DISCOUNT, 0-100 percent for PERCENT_DISCOUNT).
|
|
2946
|
-
const { couponCode, discountType, discountValue, pointsBalance } =
|
|
2947
|
-
|
|
2970
|
+
const { couponCode, discountType, discountValue, pointsBalance } = await client.redeemLoyaltyReward(
|
|
2971
|
+
rewards[0].id
|
|
2972
|
+
);
|
|
2948
2973
|
await client.applyCoupon(cartId, couponCode);
|
|
2949
2974
|
|
|
2950
2975
|
// Self-reported social share — grants the SOCIAL_SHARE bonus if configured
|
|
@@ -3521,8 +3546,8 @@ client.trackEvent({ eventType: 'pageview', path: '/products/shoes' });
|
|
|
3521
3546
|
const params = new URLSearchParams(window.location.search);
|
|
3522
3547
|
client.trackEvent({
|
|
3523
3548
|
path: window.location.pathname,
|
|
3524
|
-
utmSource:
|
|
3525
|
-
utmMedium:
|
|
3549
|
+
utmSource: params.get('utm_source') ?? undefined,
|
|
3550
|
+
utmMedium: params.get('utm_medium') ?? undefined,
|
|
3526
3551
|
utmCampaign: params.get('utm_campaign') ?? undefined,
|
|
3527
3552
|
screenWidth: window.innerWidth,
|
|
3528
3553
|
lang: navigator.language,
|
|
@@ -3553,6 +3578,94 @@ const admin = new BrainerceClient({
|
|
|
3553
3578
|
});
|
|
3554
3579
|
```
|
|
3555
3580
|
|
|
3581
|
+
### Product Management
|
|
3582
|
+
|
|
3583
|
+
```typescript
|
|
3584
|
+
import type { Product, CreateProductDto, UpdateProductDto } from 'brainerce';
|
|
3585
|
+
|
|
3586
|
+
// Create a simple product
|
|
3587
|
+
const product: Product = await client.createProduct({
|
|
3588
|
+
name: 'Classic T-Shirt',
|
|
3589
|
+
slug: 'classic-t-shirt', // Optional — auto-generated from name if omitted
|
|
3590
|
+
sku: 'TSH-001',
|
|
3591
|
+
description: 'Soft cotton tee.',
|
|
3592
|
+
basePrice: 29.99,
|
|
3593
|
+
salePrice: 24.99, // Optional
|
|
3594
|
+
costPrice: 12.0, // Optional, internal — never synced to platforms
|
|
3595
|
+
status: 'active', // 'active' | 'draft' (default: 'active')
|
|
3596
|
+
type: 'SIMPLE', // 'SIMPLE' | 'VARIABLE' (default: 'SIMPLE')
|
|
3597
|
+
categories: ['cat_id'], // Existing category IDs
|
|
3598
|
+
categoryNames: ['Apparel'], // Or assign/auto-create by name — merged with `categories`
|
|
3599
|
+
brands: ['brand_id'],
|
|
3600
|
+
tags: ['sale', 'summer'],
|
|
3601
|
+
images: [
|
|
3602
|
+
{
|
|
3603
|
+
url: 'https://cdn.example.com/tshirt.jpg',
|
|
3604
|
+
position: 0,
|
|
3605
|
+
isMain: true,
|
|
3606
|
+
alt: 'Classic T-Shirt',
|
|
3607
|
+
},
|
|
3608
|
+
],
|
|
3609
|
+
|
|
3610
|
+
// Cross-platform identifiers (Google Shopping / Facebook Catalog / TikTok).
|
|
3611
|
+
// Provide gtin when the product has one; otherwise mpn + brand.
|
|
3612
|
+
gtin: '012345678905', // EAN/UPC/ISBN — validated (GS1 mod-10 checksum)
|
|
3613
|
+
mpn: 'MFR-TSH-001', // Manufacturer Part Number — used only when gtin is absent
|
|
3614
|
+
|
|
3615
|
+
// Google Merchant Center sale_price_effective_date — bounds when `salePrice`
|
|
3616
|
+
// is actually active. Set both together, or omit both (sale always active).
|
|
3617
|
+
salePriceStartsAt: '2026-06-01T00:00:00Z',
|
|
3618
|
+
salePriceEndsAt: '2026-06-30T23:59:59Z',
|
|
3619
|
+
|
|
3620
|
+
// Shipping weight & dimensions — used for accurate shipping-cost
|
|
3621
|
+
// calculation and Google Shopping's shipping_weight/shipping_length/etc.
|
|
3622
|
+
shippingWeightValue: 0.3,
|
|
3623
|
+
shippingWeightUnit: 'kg', // 'kg' | 'lb' | 'g' | 'oz'
|
|
3624
|
+
shippingLengthValue: 30,
|
|
3625
|
+
shippingWidthValue: 20,
|
|
3626
|
+
shippingHeightValue: 2,
|
|
3627
|
+
shippingDimensionUnit: 'cm', // 'cm' | 'in' — shared by length/width/height
|
|
3628
|
+
});
|
|
3629
|
+
|
|
3630
|
+
// Update a product — every field is optional; only send what changed.
|
|
3631
|
+
// Pass `null` on gtin/mpn/salePriceStartsAt/salePriceEndsAt/shipping* to clear them.
|
|
3632
|
+
const updated: Product = await client.updateProduct('prod_123', {
|
|
3633
|
+
salePrice: null, // End the sale
|
|
3634
|
+
salePriceStartsAt: null,
|
|
3635
|
+
salePriceEndsAt: null,
|
|
3636
|
+
} satisfies UpdateProductDto);
|
|
3637
|
+
|
|
3638
|
+
// Delete a product (optionally also delete from synced platforms)
|
|
3639
|
+
await client.deleteProduct('prod_123', { platforms: ['SHOPIFY'] });
|
|
3640
|
+
|
|
3641
|
+
// VARIABLE products: create the product with type: 'VARIABLE', then add variants
|
|
3642
|
+
const variableProduct = await client.createProduct({
|
|
3643
|
+
name: 'Hoodie',
|
|
3644
|
+
basePrice: 0,
|
|
3645
|
+
type: 'VARIABLE',
|
|
3646
|
+
});
|
|
3647
|
+
await client.bulkSaveVariants(variableProduct.id, {
|
|
3648
|
+
variants: [
|
|
3649
|
+
{
|
|
3650
|
+
sku: 'HOOD-S-BLK',
|
|
3651
|
+
attributes: { Size: 'S', Color: 'Black' },
|
|
3652
|
+
price: 49.99,
|
|
3653
|
+
stock: 20,
|
|
3654
|
+
isEnabled: true,
|
|
3655
|
+
},
|
|
3656
|
+
{
|
|
3657
|
+
sku: 'HOOD-M-BLK',
|
|
3658
|
+
attributes: { Size: 'M', Color: 'Black' },
|
|
3659
|
+
price: 49.99,
|
|
3660
|
+
stock: 15,
|
|
3661
|
+
isEnabled: true,
|
|
3662
|
+
},
|
|
3663
|
+
],
|
|
3664
|
+
});
|
|
3665
|
+
```
|
|
3666
|
+
|
|
3667
|
+
**GTIN vs MPN:** these are two different identifiers, not interchangeable — GTIN (EAN/UPC/ISBN) is a universal barcode; MPN is manufacturer-specific and only meaningful paired with a brand. Provide GTIN when the product has one; otherwise brand + MPN. A product typically needs one or the other, not both.
|
|
3668
|
+
|
|
3556
3669
|
### Taxonomy Management
|
|
3557
3670
|
|
|
3558
3671
|
```typescript
|
|
@@ -3674,6 +3787,37 @@ const euZone = await client.createShippingZone({
|
|
|
3674
3787
|
regionIds: ['reg_eu'],
|
|
3675
3788
|
});
|
|
3676
3789
|
|
|
3790
|
+
// Polygon zone ("draw on map") — a hand-drawn delivery area. GeoJSON
|
|
3791
|
+
// Polygon/MultiPolygon, [lng, lat] ring coordinates. Independent of
|
|
3792
|
+
// `countries`/`regions`/`postalCodes`: a zone matches if the address
|
|
3793
|
+
// satisfies *either* coverage, so both may be set on the same zone (this
|
|
3794
|
+
// example omits `countries` since the polygon is its only coverage).
|
|
3795
|
+
const polygonZone = await client.createShippingZone({
|
|
3796
|
+
name: 'Tel Aviv Metro',
|
|
3797
|
+
countries: [],
|
|
3798
|
+
geometry: {
|
|
3799
|
+
type: 'Polygon',
|
|
3800
|
+
coordinates: [
|
|
3801
|
+
[
|
|
3802
|
+
[34.75, 32.05],
|
|
3803
|
+
[34.75, 32.1],
|
|
3804
|
+
[34.82, 32.1],
|
|
3805
|
+
[34.82, 32.05],
|
|
3806
|
+
[34.75, 32.05],
|
|
3807
|
+
],
|
|
3808
|
+
],
|
|
3809
|
+
},
|
|
3810
|
+
});
|
|
3811
|
+
|
|
3812
|
+
// Restrict a zone to specific sales channels — `SalesChannel.id` or the
|
|
3813
|
+
// public `vc_*` connectionId. Empty/omitted = every channel; a non-empty
|
|
3814
|
+
// list hides the zone unless the checkout came from one of them.
|
|
3815
|
+
const mobileOnlyZone = await client.createShippingZone({
|
|
3816
|
+
name: 'US Domestic (mobile app only)',
|
|
3817
|
+
countries: ['US'],
|
|
3818
|
+
salesChannelIds: ['vc_abc123'],
|
|
3819
|
+
});
|
|
3820
|
+
|
|
3677
3821
|
// Shipping Rates
|
|
3678
3822
|
const rates = await client.getZoneShippingRates('zone_id');
|
|
3679
3823
|
await client.createZoneShippingRate('zone_id', {
|
|
@@ -3696,9 +3840,9 @@ const label = await admin.createShippingLabel(orderId, {
|
|
|
3696
3840
|
shippoRateObjectId: 'rate_8f123456789abcdef', // Shippo rate.object_id from checkout rates
|
|
3697
3841
|
});
|
|
3698
3842
|
|
|
3699
|
-
console.log(label.labelUrl);
|
|
3843
|
+
console.log(label.labelUrl); // PDF label URL for printing
|
|
3700
3844
|
console.log(label.trackingNumber); // Auto-populated on the order
|
|
3701
|
-
console.log(label.carrier);
|
|
3845
|
+
console.log(label.carrier); // e.g. 'USPS', 'UPS', 'FedEx'
|
|
3702
3846
|
```
|
|
3703
3847
|
|
|
3704
3848
|
The `trackingNumber` is stored on the `Order` automatically — customers see it in their
|
|
@@ -4023,6 +4167,43 @@ const preview = await client.previewEmailTemplate('template_id', {
|
|
|
4023
4167
|
});
|
|
4024
4168
|
```
|
|
4025
4169
|
|
|
4170
|
+
### Storefront Bot Settings
|
|
4171
|
+
|
|
4172
|
+
Requires an API key with the `bot-settings:read` / `bot-settings:write` scopes.
|
|
4173
|
+
|
|
4174
|
+
```typescript
|
|
4175
|
+
// Every connection on the store + its current (or default) settings
|
|
4176
|
+
const { connections, settings } = await client.getBotSettings();
|
|
4177
|
+
|
|
4178
|
+
// PATCH semantics — only the fields you pass are changed
|
|
4179
|
+
await client.updateBotSettings({
|
|
4180
|
+
salesChannelId: connections[0].salesChannelId,
|
|
4181
|
+
enabled: true,
|
|
4182
|
+
displayName: 'Maya',
|
|
4183
|
+
personaJson: {
|
|
4184
|
+
greeting: 'Hi! Looking for something specific?',
|
|
4185
|
+
tone: 'friendly', // 'friendly' | 'formal' | 'playful' | 'concise'
|
|
4186
|
+
starterQuestions: ['What sizes do you carry?', "What's your return policy?"],
|
|
4187
|
+
avoidTopics: 'Do not discuss competitor pricing or make medical claims.',
|
|
4188
|
+
customInstructions: 'Always mention free shipping over $75.',
|
|
4189
|
+
capabilities: { productQa: true, recommendations: true, returns: false },
|
|
4190
|
+
},
|
|
4191
|
+
});
|
|
4192
|
+
```
|
|
4193
|
+
|
|
4194
|
+
### Storefront Bot Conversations
|
|
4195
|
+
|
|
4196
|
+
Studio inbox transcripts + on-demand summarization. Requires the `bot-conversations:read` / `bot-conversations:write` scopes.
|
|
4197
|
+
|
|
4198
|
+
```typescript
|
|
4199
|
+
const { data: conversations } = await client.listBotConversations({ limit: 20 });
|
|
4200
|
+
const transcript = await client.getBotConversation(conversations[0].id);
|
|
4201
|
+
|
|
4202
|
+
// Persists a summary on the conversation; short threads (10 or fewer messages)
|
|
4203
|
+
// are a no-op — { summarized: false, summary: null } — no credits charged.
|
|
4204
|
+
const { summarized, summary } = await client.summarizeBotConversation(conversations[0].id);
|
|
4205
|
+
```
|
|
4206
|
+
|
|
4026
4207
|
### Sync Conflict Resolution
|
|
4027
4208
|
|
|
4028
4209
|
```typescript
|
|
@@ -5105,7 +5286,7 @@ const forms = await brainerce.contactForms.list();
|
|
|
5105
5286
|
|
|
5106
5287
|
## Storefront Bot (AI chat widget)
|
|
5107
5288
|
|
|
5108
|
-
Add the store's AI shopping assistant with one line.
|
|
5289
|
+
Add the store's AI shopping assistant with one line. Configuration (name, avatar, colors, greeting, starter questions, guardrails) is normally set in the merchant dashboard — the widget renders nothing until the bot is switched Live there. Those same settings are also readable/writable via `client.getBotSettings()` / `client.updateBotSettings()`, and conversation transcripts + summarization via `client.listBotConversations()` / `client.summarizeBotConversation()` — see [Storefront Bot Settings](#storefront-bot-settings) and [Storefront Bot Conversations](#storefront-bot-conversations) in the Admin API Reference.
|
|
5109
5290
|
|
|
5110
5291
|
```html
|
|
5111
5292
|
<!-- zero-code embed: keep the tag exactly this bare (no integrity/crossorigin) -->
|
package/dist/index.d.mts
CHANGED
|
@@ -1202,6 +1202,10 @@ interface CreateProductDto {
|
|
|
1202
1202
|
name: string;
|
|
1203
1203
|
slug?: string;
|
|
1204
1204
|
sku?: string;
|
|
1205
|
+
/** Global Trade Item Number (EAN/UPC/ISBN) — cross-platform identifier. */
|
|
1206
|
+
gtin?: string;
|
|
1207
|
+
/** Manufacturer Part Number — used by Google Shopping (with brand) when no GTIN exists. */
|
|
1208
|
+
mpn?: string;
|
|
1205
1209
|
description?: string;
|
|
1206
1210
|
basePrice: number;
|
|
1207
1211
|
salePrice?: number;
|
|
@@ -1219,11 +1223,26 @@ interface CreateProductDto {
|
|
|
1219
1223
|
brandNames?: string[];
|
|
1220
1224
|
tags?: string[];
|
|
1221
1225
|
images?: ProductImage[];
|
|
1226
|
+
/** Sale-price effective window (ISO 8601) — Google Merchant Center
|
|
1227
|
+
* sale_price_effective_date. Set both together, or neither applies. */
|
|
1228
|
+
salePriceStartsAt?: string;
|
|
1229
|
+
salePriceEndsAt?: string;
|
|
1230
|
+
shippingWeightValue?: number;
|
|
1231
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz';
|
|
1232
|
+
shippingLengthValue?: number;
|
|
1233
|
+
shippingWidthValue?: number;
|
|
1234
|
+
shippingHeightValue?: number;
|
|
1235
|
+
/** Unit shared by shippingLengthValue/shippingWidthValue/shippingHeightValue. */
|
|
1236
|
+
shippingDimensionUnit?: 'cm' | 'in';
|
|
1222
1237
|
}
|
|
1223
1238
|
interface UpdateProductDto {
|
|
1224
1239
|
name?: string;
|
|
1225
1240
|
slug?: string;
|
|
1226
1241
|
sku?: string;
|
|
1242
|
+
/** Global Trade Item Number (EAN/UPC/ISBN). Pass `null` to clear. */
|
|
1243
|
+
gtin?: string | null;
|
|
1244
|
+
/** Manufacturer Part Number. Pass `null` to clear. */
|
|
1245
|
+
mpn?: string | null;
|
|
1227
1246
|
description?: string;
|
|
1228
1247
|
basePrice?: number;
|
|
1229
1248
|
salePrice?: number | null;
|
|
@@ -1240,6 +1259,15 @@ interface UpdateProductDto {
|
|
|
1240
1259
|
brandNames?: string[];
|
|
1241
1260
|
tags?: string[];
|
|
1242
1261
|
images?: ProductImage[];
|
|
1262
|
+
/** Sale-price effective window (ISO 8601). Pass `null` to clear either bound. */
|
|
1263
|
+
salePriceStartsAt?: string | null;
|
|
1264
|
+
salePriceEndsAt?: string | null;
|
|
1265
|
+
shippingWeightValue?: number | null;
|
|
1266
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz' | null;
|
|
1267
|
+
shippingLengthValue?: number | null;
|
|
1268
|
+
shippingWidthValue?: number | null;
|
|
1269
|
+
shippingHeightValue?: number | null;
|
|
1270
|
+
shippingDimensionUnit?: 'cm' | 'in' | null;
|
|
1243
1271
|
}
|
|
1244
1272
|
/**
|
|
1245
1273
|
* Response from deleting a product
|
|
@@ -3643,6 +3671,10 @@ interface CreateCategoryDto {
|
|
|
3643
3671
|
/** R2/S3 object key for `image`; powers asset-deletion cascade. */
|
|
3644
3672
|
imageKey?: string;
|
|
3645
3673
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3674
|
+
/** Merchant override for Google's numeric product taxonomy id (Merchant
|
|
3675
|
+
* Center `google_product_category`). Omit to let the name-based
|
|
3676
|
+
* auto-resolver assign one. */
|
|
3677
|
+
googleTaxonomyId?: number;
|
|
3646
3678
|
}
|
|
3647
3679
|
interface UpdateCategoryDto {
|
|
3648
3680
|
name?: string;
|
|
@@ -3652,6 +3684,10 @@ interface UpdateCategoryDto {
|
|
|
3652
3684
|
/** R2/S3 object key for `image`; pass null to clear. */
|
|
3653
3685
|
imageKey?: string | null;
|
|
3654
3686
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3687
|
+
/** Merchant override for Google's numeric product taxonomy id. Pass a
|
|
3688
|
+
* valid id to pin it (protects it from auto-resolution forever); pass
|
|
3689
|
+
* `null` to clear the override and re-resolve automatically. */
|
|
3690
|
+
googleTaxonomyId?: number | null;
|
|
3655
3691
|
}
|
|
3656
3692
|
/**
|
|
3657
3693
|
* Brand entity for product organization
|
|
@@ -3888,6 +3924,14 @@ interface TaxonomyQueryParams {
|
|
|
3888
3924
|
/**
|
|
3889
3925
|
* Shipping zone with geographic restrictions
|
|
3890
3926
|
*/
|
|
3927
|
+
/** GeoJSON Polygon/MultiPolygon, [lng, lat] ring coordinates (RFC 7946). */
|
|
3928
|
+
type ShippingZoneGeometry = {
|
|
3929
|
+
type: 'Polygon';
|
|
3930
|
+
coordinates: number[][][];
|
|
3931
|
+
} | {
|
|
3932
|
+
type: 'MultiPolygon';
|
|
3933
|
+
coordinates: number[][][][];
|
|
3934
|
+
};
|
|
3891
3935
|
interface ShippingZone {
|
|
3892
3936
|
id: string;
|
|
3893
3937
|
accountId: string;
|
|
@@ -3899,12 +3943,25 @@ interface ShippingZone {
|
|
|
3899
3943
|
regions?: Record<string, string[]> | null;
|
|
3900
3944
|
/** Postal code patterns */
|
|
3901
3945
|
postalCodes?: Record<string, string[]> | null;
|
|
3946
|
+
/**
|
|
3947
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes.
|
|
3948
|
+
* Independent of countries/regions/postalCodes: a zone matches if the
|
|
3949
|
+
* address satisfies *either* the country-list coverage *or* the polygon
|
|
3950
|
+
* coverage, so both may be set on the same zone.
|
|
3951
|
+
*/
|
|
3952
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3902
3953
|
/**
|
|
3903
3954
|
* Region restriction (PRD §25). Region IDs this zone is limited to. Empty =
|
|
3904
3955
|
* available for any region (default). Non-empty = the zone is only offered to
|
|
3905
3956
|
* checkouts whose region is in the list.
|
|
3906
3957
|
*/
|
|
3907
3958
|
regionIds: string[];
|
|
3959
|
+
/**
|
|
3960
|
+
* Sales-channel restriction. `SalesChannel.id` values. Empty = available
|
|
3961
|
+
* on every channel (default). Non-empty = the zone is only offered to
|
|
3962
|
+
* checkouts from a channel in the list.
|
|
3963
|
+
*/
|
|
3964
|
+
salesChannelIds: string[];
|
|
3908
3965
|
/** Zone priority (lower = higher priority) */
|
|
3909
3966
|
priority: number;
|
|
3910
3967
|
isActive: boolean;
|
|
@@ -3943,8 +4000,16 @@ interface CreateShippingZoneDto {
|
|
|
3943
4000
|
countries: string[];
|
|
3944
4001
|
regions?: Record<string, string[]>;
|
|
3945
4002
|
postalCodes?: Record<string, string[]>;
|
|
4003
|
+
/**
|
|
4004
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes,
|
|
4005
|
+
* combined with countries/regions/postalCodes via OR (both may be set on
|
|
4006
|
+
* the same zone).
|
|
4007
|
+
*/
|
|
4008
|
+
geometry?: ShippingZoneGeometry;
|
|
3946
4009
|
/** Region restriction (PRD §25). Region IDs; empty/omitted = any region. */
|
|
3947
4010
|
regionIds?: string[];
|
|
4011
|
+
/** Sales-channel restriction (SalesChannel.id, or vc_* connectionId). Empty/omitted = every channel. */
|
|
4012
|
+
salesChannelIds?: string[];
|
|
3948
4013
|
priority?: number;
|
|
3949
4014
|
isActive?: boolean;
|
|
3950
4015
|
}
|
|
@@ -3953,8 +4018,12 @@ interface UpdateShippingZoneDto {
|
|
|
3953
4018
|
countries?: string[];
|
|
3954
4019
|
regions?: Record<string, string[]> | null;
|
|
3955
4020
|
postalCodes?: Record<string, string[]> | null;
|
|
4021
|
+
/** Polygon zone definition ("draw on map"). Pass `null` to clear. Omit to leave unchanged. */
|
|
4022
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3956
4023
|
/** Region restriction (PRD §25). Empty array = clear; omit = leave unchanged. */
|
|
3957
4024
|
regionIds?: string[];
|
|
4025
|
+
/** Sales-channel restriction. Empty array = clear (every channel); omit = leave unchanged. */
|
|
4026
|
+
salesChannelIds?: string[];
|
|
3958
4027
|
priority?: number;
|
|
3959
4028
|
isActive?: boolean;
|
|
3960
4029
|
platformSettings?: Record<string, unknown>;
|
|
@@ -4666,6 +4735,122 @@ interface UpdateEmailSettingsDto {
|
|
|
4666
4735
|
hourlyRateLimit?: number;
|
|
4667
4736
|
customDomainId?: string;
|
|
4668
4737
|
}
|
|
4738
|
+
/** One FAQ entry the bot can answer from directly. */
|
|
4739
|
+
interface BotFaq {
|
|
4740
|
+
q: string;
|
|
4741
|
+
a: string;
|
|
4742
|
+
}
|
|
4743
|
+
/** Per-capability on/off toggles. */
|
|
4744
|
+
interface BotCapabilities {
|
|
4745
|
+
productQa?: boolean;
|
|
4746
|
+
recommendations?: boolean;
|
|
4747
|
+
orderTracking?: boolean;
|
|
4748
|
+
returns?: boolean;
|
|
4749
|
+
cartRecovery?: boolean;
|
|
4750
|
+
bundleNudges?: boolean;
|
|
4751
|
+
}
|
|
4752
|
+
/** Persona/behavior config — greeting, tone, starter questions, guardrails, capabilities. */
|
|
4753
|
+
interface PersonaConfig {
|
|
4754
|
+
greeting?: string;
|
|
4755
|
+
tone?: 'friendly' | 'formal' | 'playful' | 'concise';
|
|
4756
|
+
accentColor?: string;
|
|
4757
|
+
responseLength?: 'concise' | 'balanced' | 'detailed';
|
|
4758
|
+
emoji?: boolean;
|
|
4759
|
+
bubbleShape?: 'rounded' | 'square';
|
|
4760
|
+
displayMode?: 'floating' | 'side_rail' | 'inline' | 'auto_open' | 'full_screen';
|
|
4761
|
+
position?: 'start' | 'end';
|
|
4762
|
+
allowExpand?: boolean;
|
|
4763
|
+
/** Freeform merchant instructions injected into the bot's system prompt. */
|
|
4764
|
+
customInstructions?: string;
|
|
4765
|
+
faqs?: BotFaq[];
|
|
4766
|
+
capabilities?: BotCapabilities;
|
|
4767
|
+
languages?: ('en' | 'he' | 'ar' | 'es' | 'fr')[];
|
|
4768
|
+
/** Starter questions shown as quick-reply chips before the shopper types. */
|
|
4769
|
+
starterQuestions?: string[];
|
|
4770
|
+
/** Freeform guardrail text — topics the bot should decline to discuss. */
|
|
4771
|
+
avoidTopics?: string;
|
|
4772
|
+
maxDiscountPct?: number | null;
|
|
4773
|
+
minRecommend?: number | null;
|
|
4774
|
+
}
|
|
4775
|
+
/** One connection (SalesChannel) + its current (or default) bot settings. */
|
|
4776
|
+
interface BotSettings {
|
|
4777
|
+
salesChannelId: string;
|
|
4778
|
+
connectionId: string;
|
|
4779
|
+
name: string;
|
|
4780
|
+
enabled: boolean;
|
|
4781
|
+
displayName: string;
|
|
4782
|
+
avatarUrl: string | null;
|
|
4783
|
+
personaJson: PersonaConfig;
|
|
4784
|
+
escalationJson: Record<string, unknown>;
|
|
4785
|
+
retentionJson: Record<string, unknown>;
|
|
4786
|
+
localeJson: Record<string, unknown> | null;
|
|
4787
|
+
dailySpendCeilingUsd: number | null;
|
|
4788
|
+
}
|
|
4789
|
+
interface BotSettingsConfigResponse {
|
|
4790
|
+
connections: {
|
|
4791
|
+
salesChannelId: string;
|
|
4792
|
+
connectionId: string;
|
|
4793
|
+
name: string;
|
|
4794
|
+
}[];
|
|
4795
|
+
settings: BotSettings[];
|
|
4796
|
+
}
|
|
4797
|
+
/** PATCH semantics — only fields present are changed. */
|
|
4798
|
+
interface UpdateBotSettingsDto {
|
|
4799
|
+
salesChannelId: string;
|
|
4800
|
+
enabled?: boolean;
|
|
4801
|
+
displayName?: string;
|
|
4802
|
+
avatarUrl?: string;
|
|
4803
|
+
personaJson?: PersonaConfig;
|
|
4804
|
+
}
|
|
4805
|
+
interface BotConversationMessage {
|
|
4806
|
+
id: string;
|
|
4807
|
+
role: string;
|
|
4808
|
+
content: string;
|
|
4809
|
+
createdAt: string;
|
|
4810
|
+
}
|
|
4811
|
+
interface BotConversationListItem {
|
|
4812
|
+
id: string;
|
|
4813
|
+
salesChannelId: string;
|
|
4814
|
+
title: string | null;
|
|
4815
|
+
locale: string;
|
|
4816
|
+
customerName: string | null;
|
|
4817
|
+
lastMessage: {
|
|
4818
|
+
role: string;
|
|
4819
|
+
content: string;
|
|
4820
|
+
createdAt: string;
|
|
4821
|
+
} | null;
|
|
4822
|
+
messageCount: number;
|
|
4823
|
+
unread: boolean;
|
|
4824
|
+
lastActivityAt: string;
|
|
4825
|
+
createdAt: string;
|
|
4826
|
+
}
|
|
4827
|
+
interface BotConversationDetail {
|
|
4828
|
+
id: string;
|
|
4829
|
+
salesChannelId: string;
|
|
4830
|
+
title: string | null;
|
|
4831
|
+
locale: string;
|
|
4832
|
+
customerName: string | null;
|
|
4833
|
+
customerEmail: string | null;
|
|
4834
|
+
merchantReadAt: string | null;
|
|
4835
|
+
lastActivityAt: string;
|
|
4836
|
+
createdAt: string;
|
|
4837
|
+
messages: BotConversationMessage[];
|
|
4838
|
+
/** Rolling summary from the most recent summarize() call, if any. */
|
|
4839
|
+
summarizedHistory: string | null;
|
|
4840
|
+
}
|
|
4841
|
+
interface BotConversationsPage {
|
|
4842
|
+
data: BotConversationListItem[];
|
|
4843
|
+
meta: {
|
|
4844
|
+
page: number;
|
|
4845
|
+
limit: number;
|
|
4846
|
+
total: number;
|
|
4847
|
+
totalPages: number;
|
|
4848
|
+
};
|
|
4849
|
+
}
|
|
4850
|
+
interface SummarizeBotConversationResult {
|
|
4851
|
+
summarized: boolean;
|
|
4852
|
+
summary: string | null;
|
|
4853
|
+
}
|
|
4669
4854
|
/** Email template */
|
|
4670
4855
|
interface EmailTemplate {
|
|
4671
4856
|
id: string;
|
|
@@ -9891,6 +10076,38 @@ declare class BrainerceClient {
|
|
|
9891
10076
|
* Requires Admin mode (apiKey)
|
|
9892
10077
|
*/
|
|
9893
10078
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
10079
|
+
/**
|
|
10080
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
10081
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
10082
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
10083
|
+
*/
|
|
10084
|
+
getBotSettings(): Promise<BotSettingsConfigResponse>;
|
|
10085
|
+
/**
|
|
10086
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
10087
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
10088
|
+
* (apiKey).
|
|
10089
|
+
*/
|
|
10090
|
+
updateBotSettings(data: UpdateBotSettingsDto): Promise<BotSettings>;
|
|
10091
|
+
/**
|
|
10092
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
10093
|
+
* connection. Requires Admin mode (apiKey).
|
|
10094
|
+
*/
|
|
10095
|
+
listBotConversations(opts?: {
|
|
10096
|
+
salesChannelId?: string;
|
|
10097
|
+
page?: number;
|
|
10098
|
+
limit?: number;
|
|
10099
|
+
}): Promise<BotConversationsPage>;
|
|
10100
|
+
/**
|
|
10101
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
10102
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
10103
|
+
*/
|
|
10104
|
+
getBotConversation(conversationId: string): Promise<BotConversationDetail>;
|
|
10105
|
+
/**
|
|
10106
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
10107
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
10108
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
10109
|
+
*/
|
|
10110
|
+
summarizeBotConversation(conversationId: string): Promise<SummarizeBotConversationResult>;
|
|
9894
10111
|
/**
|
|
9895
10112
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
9896
10113
|
* Response includes the store's primary language and supported languages so
|
|
@@ -10009,7 +10226,7 @@ declare class BrainerceError extends Error {
|
|
|
10009
10226
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
10010
10227
|
}
|
|
10011
10228
|
|
|
10012
|
-
declare const SDK_VERSION = "1.
|
|
10229
|
+
declare const SDK_VERSION = "1.45.0";
|
|
10013
10230
|
|
|
10014
10231
|
/**
|
|
10015
10232
|
* Verify a webhook signature from Brainerce
|
package/dist/index.d.ts
CHANGED
|
@@ -1202,6 +1202,10 @@ interface CreateProductDto {
|
|
|
1202
1202
|
name: string;
|
|
1203
1203
|
slug?: string;
|
|
1204
1204
|
sku?: string;
|
|
1205
|
+
/** Global Trade Item Number (EAN/UPC/ISBN) — cross-platform identifier. */
|
|
1206
|
+
gtin?: string;
|
|
1207
|
+
/** Manufacturer Part Number — used by Google Shopping (with brand) when no GTIN exists. */
|
|
1208
|
+
mpn?: string;
|
|
1205
1209
|
description?: string;
|
|
1206
1210
|
basePrice: number;
|
|
1207
1211
|
salePrice?: number;
|
|
@@ -1219,11 +1223,26 @@ interface CreateProductDto {
|
|
|
1219
1223
|
brandNames?: string[];
|
|
1220
1224
|
tags?: string[];
|
|
1221
1225
|
images?: ProductImage[];
|
|
1226
|
+
/** Sale-price effective window (ISO 8601) — Google Merchant Center
|
|
1227
|
+
* sale_price_effective_date. Set both together, or neither applies. */
|
|
1228
|
+
salePriceStartsAt?: string;
|
|
1229
|
+
salePriceEndsAt?: string;
|
|
1230
|
+
shippingWeightValue?: number;
|
|
1231
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz';
|
|
1232
|
+
shippingLengthValue?: number;
|
|
1233
|
+
shippingWidthValue?: number;
|
|
1234
|
+
shippingHeightValue?: number;
|
|
1235
|
+
/** Unit shared by shippingLengthValue/shippingWidthValue/shippingHeightValue. */
|
|
1236
|
+
shippingDimensionUnit?: 'cm' | 'in';
|
|
1222
1237
|
}
|
|
1223
1238
|
interface UpdateProductDto {
|
|
1224
1239
|
name?: string;
|
|
1225
1240
|
slug?: string;
|
|
1226
1241
|
sku?: string;
|
|
1242
|
+
/** Global Trade Item Number (EAN/UPC/ISBN). Pass `null` to clear. */
|
|
1243
|
+
gtin?: string | null;
|
|
1244
|
+
/** Manufacturer Part Number. Pass `null` to clear. */
|
|
1245
|
+
mpn?: string | null;
|
|
1227
1246
|
description?: string;
|
|
1228
1247
|
basePrice?: number;
|
|
1229
1248
|
salePrice?: number | null;
|
|
@@ -1240,6 +1259,15 @@ interface UpdateProductDto {
|
|
|
1240
1259
|
brandNames?: string[];
|
|
1241
1260
|
tags?: string[];
|
|
1242
1261
|
images?: ProductImage[];
|
|
1262
|
+
/** Sale-price effective window (ISO 8601). Pass `null` to clear either bound. */
|
|
1263
|
+
salePriceStartsAt?: string | null;
|
|
1264
|
+
salePriceEndsAt?: string | null;
|
|
1265
|
+
shippingWeightValue?: number | null;
|
|
1266
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz' | null;
|
|
1267
|
+
shippingLengthValue?: number | null;
|
|
1268
|
+
shippingWidthValue?: number | null;
|
|
1269
|
+
shippingHeightValue?: number | null;
|
|
1270
|
+
shippingDimensionUnit?: 'cm' | 'in' | null;
|
|
1243
1271
|
}
|
|
1244
1272
|
/**
|
|
1245
1273
|
* Response from deleting a product
|
|
@@ -3643,6 +3671,10 @@ interface CreateCategoryDto {
|
|
|
3643
3671
|
/** R2/S3 object key for `image`; powers asset-deletion cascade. */
|
|
3644
3672
|
imageKey?: string;
|
|
3645
3673
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3674
|
+
/** Merchant override for Google's numeric product taxonomy id (Merchant
|
|
3675
|
+
* Center `google_product_category`). Omit to let the name-based
|
|
3676
|
+
* auto-resolver assign one. */
|
|
3677
|
+
googleTaxonomyId?: number;
|
|
3646
3678
|
}
|
|
3647
3679
|
interface UpdateCategoryDto {
|
|
3648
3680
|
name?: string;
|
|
@@ -3652,6 +3684,10 @@ interface UpdateCategoryDto {
|
|
|
3652
3684
|
/** R2/S3 object key for `image`; pass null to clear. */
|
|
3653
3685
|
imageKey?: string | null;
|
|
3654
3686
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3687
|
+
/** Merchant override for Google's numeric product taxonomy id. Pass a
|
|
3688
|
+
* valid id to pin it (protects it from auto-resolution forever); pass
|
|
3689
|
+
* `null` to clear the override and re-resolve automatically. */
|
|
3690
|
+
googleTaxonomyId?: number | null;
|
|
3655
3691
|
}
|
|
3656
3692
|
/**
|
|
3657
3693
|
* Brand entity for product organization
|
|
@@ -3888,6 +3924,14 @@ interface TaxonomyQueryParams {
|
|
|
3888
3924
|
/**
|
|
3889
3925
|
* Shipping zone with geographic restrictions
|
|
3890
3926
|
*/
|
|
3927
|
+
/** GeoJSON Polygon/MultiPolygon, [lng, lat] ring coordinates (RFC 7946). */
|
|
3928
|
+
type ShippingZoneGeometry = {
|
|
3929
|
+
type: 'Polygon';
|
|
3930
|
+
coordinates: number[][][];
|
|
3931
|
+
} | {
|
|
3932
|
+
type: 'MultiPolygon';
|
|
3933
|
+
coordinates: number[][][][];
|
|
3934
|
+
};
|
|
3891
3935
|
interface ShippingZone {
|
|
3892
3936
|
id: string;
|
|
3893
3937
|
accountId: string;
|
|
@@ -3899,12 +3943,25 @@ interface ShippingZone {
|
|
|
3899
3943
|
regions?: Record<string, string[]> | null;
|
|
3900
3944
|
/** Postal code patterns */
|
|
3901
3945
|
postalCodes?: Record<string, string[]> | null;
|
|
3946
|
+
/**
|
|
3947
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes.
|
|
3948
|
+
* Independent of countries/regions/postalCodes: a zone matches if the
|
|
3949
|
+
* address satisfies *either* the country-list coverage *or* the polygon
|
|
3950
|
+
* coverage, so both may be set on the same zone.
|
|
3951
|
+
*/
|
|
3952
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3902
3953
|
/**
|
|
3903
3954
|
* Region restriction (PRD §25). Region IDs this zone is limited to. Empty =
|
|
3904
3955
|
* available for any region (default). Non-empty = the zone is only offered to
|
|
3905
3956
|
* checkouts whose region is in the list.
|
|
3906
3957
|
*/
|
|
3907
3958
|
regionIds: string[];
|
|
3959
|
+
/**
|
|
3960
|
+
* Sales-channel restriction. `SalesChannel.id` values. Empty = available
|
|
3961
|
+
* on every channel (default). Non-empty = the zone is only offered to
|
|
3962
|
+
* checkouts from a channel in the list.
|
|
3963
|
+
*/
|
|
3964
|
+
salesChannelIds: string[];
|
|
3908
3965
|
/** Zone priority (lower = higher priority) */
|
|
3909
3966
|
priority: number;
|
|
3910
3967
|
isActive: boolean;
|
|
@@ -3943,8 +4000,16 @@ interface CreateShippingZoneDto {
|
|
|
3943
4000
|
countries: string[];
|
|
3944
4001
|
regions?: Record<string, string[]>;
|
|
3945
4002
|
postalCodes?: Record<string, string[]>;
|
|
4003
|
+
/**
|
|
4004
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes,
|
|
4005
|
+
* combined with countries/regions/postalCodes via OR (both may be set on
|
|
4006
|
+
* the same zone).
|
|
4007
|
+
*/
|
|
4008
|
+
geometry?: ShippingZoneGeometry;
|
|
3946
4009
|
/** Region restriction (PRD §25). Region IDs; empty/omitted = any region. */
|
|
3947
4010
|
regionIds?: string[];
|
|
4011
|
+
/** Sales-channel restriction (SalesChannel.id, or vc_* connectionId). Empty/omitted = every channel. */
|
|
4012
|
+
salesChannelIds?: string[];
|
|
3948
4013
|
priority?: number;
|
|
3949
4014
|
isActive?: boolean;
|
|
3950
4015
|
}
|
|
@@ -3953,8 +4018,12 @@ interface UpdateShippingZoneDto {
|
|
|
3953
4018
|
countries?: string[];
|
|
3954
4019
|
regions?: Record<string, string[]> | null;
|
|
3955
4020
|
postalCodes?: Record<string, string[]> | null;
|
|
4021
|
+
/** Polygon zone definition ("draw on map"). Pass `null` to clear. Omit to leave unchanged. */
|
|
4022
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3956
4023
|
/** Region restriction (PRD §25). Empty array = clear; omit = leave unchanged. */
|
|
3957
4024
|
regionIds?: string[];
|
|
4025
|
+
/** Sales-channel restriction. Empty array = clear (every channel); omit = leave unchanged. */
|
|
4026
|
+
salesChannelIds?: string[];
|
|
3958
4027
|
priority?: number;
|
|
3959
4028
|
isActive?: boolean;
|
|
3960
4029
|
platformSettings?: Record<string, unknown>;
|
|
@@ -4666,6 +4735,122 @@ interface UpdateEmailSettingsDto {
|
|
|
4666
4735
|
hourlyRateLimit?: number;
|
|
4667
4736
|
customDomainId?: string;
|
|
4668
4737
|
}
|
|
4738
|
+
/** One FAQ entry the bot can answer from directly. */
|
|
4739
|
+
interface BotFaq {
|
|
4740
|
+
q: string;
|
|
4741
|
+
a: string;
|
|
4742
|
+
}
|
|
4743
|
+
/** Per-capability on/off toggles. */
|
|
4744
|
+
interface BotCapabilities {
|
|
4745
|
+
productQa?: boolean;
|
|
4746
|
+
recommendations?: boolean;
|
|
4747
|
+
orderTracking?: boolean;
|
|
4748
|
+
returns?: boolean;
|
|
4749
|
+
cartRecovery?: boolean;
|
|
4750
|
+
bundleNudges?: boolean;
|
|
4751
|
+
}
|
|
4752
|
+
/** Persona/behavior config — greeting, tone, starter questions, guardrails, capabilities. */
|
|
4753
|
+
interface PersonaConfig {
|
|
4754
|
+
greeting?: string;
|
|
4755
|
+
tone?: 'friendly' | 'formal' | 'playful' | 'concise';
|
|
4756
|
+
accentColor?: string;
|
|
4757
|
+
responseLength?: 'concise' | 'balanced' | 'detailed';
|
|
4758
|
+
emoji?: boolean;
|
|
4759
|
+
bubbleShape?: 'rounded' | 'square';
|
|
4760
|
+
displayMode?: 'floating' | 'side_rail' | 'inline' | 'auto_open' | 'full_screen';
|
|
4761
|
+
position?: 'start' | 'end';
|
|
4762
|
+
allowExpand?: boolean;
|
|
4763
|
+
/** Freeform merchant instructions injected into the bot's system prompt. */
|
|
4764
|
+
customInstructions?: string;
|
|
4765
|
+
faqs?: BotFaq[];
|
|
4766
|
+
capabilities?: BotCapabilities;
|
|
4767
|
+
languages?: ('en' | 'he' | 'ar' | 'es' | 'fr')[];
|
|
4768
|
+
/** Starter questions shown as quick-reply chips before the shopper types. */
|
|
4769
|
+
starterQuestions?: string[];
|
|
4770
|
+
/** Freeform guardrail text — topics the bot should decline to discuss. */
|
|
4771
|
+
avoidTopics?: string;
|
|
4772
|
+
maxDiscountPct?: number | null;
|
|
4773
|
+
minRecommend?: number | null;
|
|
4774
|
+
}
|
|
4775
|
+
/** One connection (SalesChannel) + its current (or default) bot settings. */
|
|
4776
|
+
interface BotSettings {
|
|
4777
|
+
salesChannelId: string;
|
|
4778
|
+
connectionId: string;
|
|
4779
|
+
name: string;
|
|
4780
|
+
enabled: boolean;
|
|
4781
|
+
displayName: string;
|
|
4782
|
+
avatarUrl: string | null;
|
|
4783
|
+
personaJson: PersonaConfig;
|
|
4784
|
+
escalationJson: Record<string, unknown>;
|
|
4785
|
+
retentionJson: Record<string, unknown>;
|
|
4786
|
+
localeJson: Record<string, unknown> | null;
|
|
4787
|
+
dailySpendCeilingUsd: number | null;
|
|
4788
|
+
}
|
|
4789
|
+
interface BotSettingsConfigResponse {
|
|
4790
|
+
connections: {
|
|
4791
|
+
salesChannelId: string;
|
|
4792
|
+
connectionId: string;
|
|
4793
|
+
name: string;
|
|
4794
|
+
}[];
|
|
4795
|
+
settings: BotSettings[];
|
|
4796
|
+
}
|
|
4797
|
+
/** PATCH semantics — only fields present are changed. */
|
|
4798
|
+
interface UpdateBotSettingsDto {
|
|
4799
|
+
salesChannelId: string;
|
|
4800
|
+
enabled?: boolean;
|
|
4801
|
+
displayName?: string;
|
|
4802
|
+
avatarUrl?: string;
|
|
4803
|
+
personaJson?: PersonaConfig;
|
|
4804
|
+
}
|
|
4805
|
+
interface BotConversationMessage {
|
|
4806
|
+
id: string;
|
|
4807
|
+
role: string;
|
|
4808
|
+
content: string;
|
|
4809
|
+
createdAt: string;
|
|
4810
|
+
}
|
|
4811
|
+
interface BotConversationListItem {
|
|
4812
|
+
id: string;
|
|
4813
|
+
salesChannelId: string;
|
|
4814
|
+
title: string | null;
|
|
4815
|
+
locale: string;
|
|
4816
|
+
customerName: string | null;
|
|
4817
|
+
lastMessage: {
|
|
4818
|
+
role: string;
|
|
4819
|
+
content: string;
|
|
4820
|
+
createdAt: string;
|
|
4821
|
+
} | null;
|
|
4822
|
+
messageCount: number;
|
|
4823
|
+
unread: boolean;
|
|
4824
|
+
lastActivityAt: string;
|
|
4825
|
+
createdAt: string;
|
|
4826
|
+
}
|
|
4827
|
+
interface BotConversationDetail {
|
|
4828
|
+
id: string;
|
|
4829
|
+
salesChannelId: string;
|
|
4830
|
+
title: string | null;
|
|
4831
|
+
locale: string;
|
|
4832
|
+
customerName: string | null;
|
|
4833
|
+
customerEmail: string | null;
|
|
4834
|
+
merchantReadAt: string | null;
|
|
4835
|
+
lastActivityAt: string;
|
|
4836
|
+
createdAt: string;
|
|
4837
|
+
messages: BotConversationMessage[];
|
|
4838
|
+
/** Rolling summary from the most recent summarize() call, if any. */
|
|
4839
|
+
summarizedHistory: string | null;
|
|
4840
|
+
}
|
|
4841
|
+
interface BotConversationsPage {
|
|
4842
|
+
data: BotConversationListItem[];
|
|
4843
|
+
meta: {
|
|
4844
|
+
page: number;
|
|
4845
|
+
limit: number;
|
|
4846
|
+
total: number;
|
|
4847
|
+
totalPages: number;
|
|
4848
|
+
};
|
|
4849
|
+
}
|
|
4850
|
+
interface SummarizeBotConversationResult {
|
|
4851
|
+
summarized: boolean;
|
|
4852
|
+
summary: string | null;
|
|
4853
|
+
}
|
|
4669
4854
|
/** Email template */
|
|
4670
4855
|
interface EmailTemplate {
|
|
4671
4856
|
id: string;
|
|
@@ -9891,6 +10076,38 @@ declare class BrainerceClient {
|
|
|
9891
10076
|
* Requires Admin mode (apiKey)
|
|
9892
10077
|
*/
|
|
9893
10078
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
10079
|
+
/**
|
|
10080
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
10081
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
10082
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
10083
|
+
*/
|
|
10084
|
+
getBotSettings(): Promise<BotSettingsConfigResponse>;
|
|
10085
|
+
/**
|
|
10086
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
10087
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
10088
|
+
* (apiKey).
|
|
10089
|
+
*/
|
|
10090
|
+
updateBotSettings(data: UpdateBotSettingsDto): Promise<BotSettings>;
|
|
10091
|
+
/**
|
|
10092
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
10093
|
+
* connection. Requires Admin mode (apiKey).
|
|
10094
|
+
*/
|
|
10095
|
+
listBotConversations(opts?: {
|
|
10096
|
+
salesChannelId?: string;
|
|
10097
|
+
page?: number;
|
|
10098
|
+
limit?: number;
|
|
10099
|
+
}): Promise<BotConversationsPage>;
|
|
10100
|
+
/**
|
|
10101
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
10102
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
10103
|
+
*/
|
|
10104
|
+
getBotConversation(conversationId: string): Promise<BotConversationDetail>;
|
|
10105
|
+
/**
|
|
10106
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
10107
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
10108
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
10109
|
+
*/
|
|
10110
|
+
summarizeBotConversation(conversationId: string): Promise<SummarizeBotConversationResult>;
|
|
9894
10111
|
/**
|
|
9895
10112
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
9896
10113
|
* Response includes the store's primary language and supported languages so
|
|
@@ -10009,7 +10226,7 @@ declare class BrainerceError extends Error {
|
|
|
10009
10226
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
10010
10227
|
}
|
|
10011
10228
|
|
|
10012
|
-
declare const SDK_VERSION = "1.
|
|
10229
|
+
declare const SDK_VERSION = "1.45.0";
|
|
10013
10230
|
|
|
10014
10231
|
/**
|
|
10015
10232
|
* Verify a webhook signature from Brainerce
|
package/dist/index.js
CHANGED
|
@@ -185,7 +185,7 @@ function isDevGuardsEnabled() {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// src/version.ts
|
|
188
|
-
var SDK_VERSION = "1.
|
|
188
|
+
var SDK_VERSION = "1.45.0";
|
|
189
189
|
|
|
190
190
|
// src/client.ts
|
|
191
191
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -5568,10 +5568,7 @@ var BrainerceClient = class {
|
|
|
5568
5568
|
"order"
|
|
5569
5569
|
);
|
|
5570
5570
|
}
|
|
5571
|
-
throw new BrainerceError(
|
|
5572
|
-
"getOrderByCheckout() requires vibe-coded or storefront mode",
|
|
5573
|
-
400
|
|
5574
|
-
);
|
|
5571
|
+
throw new BrainerceError("getOrderByCheckout() requires vibe-coded or storefront mode", 400);
|
|
5575
5572
|
}
|
|
5576
5573
|
/**
|
|
5577
5574
|
* Check if localStorage is available (browser environment)
|
|
@@ -8392,6 +8389,55 @@ var BrainerceClient = class {
|
|
|
8392
8389
|
async updateEmailSettings(data) {
|
|
8393
8390
|
return this.adminRequest("PUT", "/api/v1/email/settings", data);
|
|
8394
8391
|
}
|
|
8392
|
+
/**
|
|
8393
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
8394
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
8395
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
8396
|
+
*/
|
|
8397
|
+
async getBotSettings() {
|
|
8398
|
+
return this.adminRequest("GET", "/api/v1/storefront-bot/settings");
|
|
8399
|
+
}
|
|
8400
|
+
/**
|
|
8401
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
8402
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
8403
|
+
* (apiKey).
|
|
8404
|
+
*/
|
|
8405
|
+
async updateBotSettings(data) {
|
|
8406
|
+
return this.adminRequest("PUT", "/api/v1/storefront-bot/settings", data);
|
|
8407
|
+
}
|
|
8408
|
+
/**
|
|
8409
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
8410
|
+
* connection. Requires Admin mode (apiKey).
|
|
8411
|
+
*/
|
|
8412
|
+
async listBotConversations(opts) {
|
|
8413
|
+
return this.adminRequest(
|
|
8414
|
+
"GET",
|
|
8415
|
+
"/api/v1/storefront-bot/conversations",
|
|
8416
|
+
void 0,
|
|
8417
|
+
opts
|
|
8418
|
+
);
|
|
8419
|
+
}
|
|
8420
|
+
/**
|
|
8421
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
8422
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
8423
|
+
*/
|
|
8424
|
+
async getBotConversation(conversationId) {
|
|
8425
|
+
return this.adminRequest(
|
|
8426
|
+
"GET",
|
|
8427
|
+
`/api/v1/storefront-bot/conversations/${conversationId}`
|
|
8428
|
+
);
|
|
8429
|
+
}
|
|
8430
|
+
/**
|
|
8431
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
8432
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
8433
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
8434
|
+
*/
|
|
8435
|
+
async summarizeBotConversation(conversationId) {
|
|
8436
|
+
return this.adminRequest(
|
|
8437
|
+
"POST",
|
|
8438
|
+
`/api/v1/storefront-bot/conversations/${conversationId}/summarize`
|
|
8439
|
+
);
|
|
8440
|
+
}
|
|
8395
8441
|
/**
|
|
8396
8442
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
8397
8443
|
* Response includes the store's primary language and supported languages so
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function isDevGuardsEnabled() {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/version.ts
|
|
118
|
-
var SDK_VERSION = "1.
|
|
118
|
+
var SDK_VERSION = "1.45.0";
|
|
119
119
|
|
|
120
120
|
// src/client.ts
|
|
121
121
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -5498,10 +5498,7 @@ var BrainerceClient = class {
|
|
|
5498
5498
|
"order"
|
|
5499
5499
|
);
|
|
5500
5500
|
}
|
|
5501
|
-
throw new BrainerceError(
|
|
5502
|
-
"getOrderByCheckout() requires vibe-coded or storefront mode",
|
|
5503
|
-
400
|
|
5504
|
-
);
|
|
5501
|
+
throw new BrainerceError("getOrderByCheckout() requires vibe-coded or storefront mode", 400);
|
|
5505
5502
|
}
|
|
5506
5503
|
/**
|
|
5507
5504
|
* Check if localStorage is available (browser environment)
|
|
@@ -8322,6 +8319,55 @@ var BrainerceClient = class {
|
|
|
8322
8319
|
async updateEmailSettings(data) {
|
|
8323
8320
|
return this.adminRequest("PUT", "/api/v1/email/settings", data);
|
|
8324
8321
|
}
|
|
8322
|
+
/**
|
|
8323
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
8324
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
8325
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
8326
|
+
*/
|
|
8327
|
+
async getBotSettings() {
|
|
8328
|
+
return this.adminRequest("GET", "/api/v1/storefront-bot/settings");
|
|
8329
|
+
}
|
|
8330
|
+
/**
|
|
8331
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
8332
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
8333
|
+
* (apiKey).
|
|
8334
|
+
*/
|
|
8335
|
+
async updateBotSettings(data) {
|
|
8336
|
+
return this.adminRequest("PUT", "/api/v1/storefront-bot/settings", data);
|
|
8337
|
+
}
|
|
8338
|
+
/**
|
|
8339
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
8340
|
+
* connection. Requires Admin mode (apiKey).
|
|
8341
|
+
*/
|
|
8342
|
+
async listBotConversations(opts) {
|
|
8343
|
+
return this.adminRequest(
|
|
8344
|
+
"GET",
|
|
8345
|
+
"/api/v1/storefront-bot/conversations",
|
|
8346
|
+
void 0,
|
|
8347
|
+
opts
|
|
8348
|
+
);
|
|
8349
|
+
}
|
|
8350
|
+
/**
|
|
8351
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
8352
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
8353
|
+
*/
|
|
8354
|
+
async getBotConversation(conversationId) {
|
|
8355
|
+
return this.adminRequest(
|
|
8356
|
+
"GET",
|
|
8357
|
+
`/api/v1/storefront-bot/conversations/${conversationId}`
|
|
8358
|
+
);
|
|
8359
|
+
}
|
|
8360
|
+
/**
|
|
8361
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
8362
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
8363
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
8364
|
+
*/
|
|
8365
|
+
async summarizeBotConversation(conversationId) {
|
|
8366
|
+
return this.adminRequest(
|
|
8367
|
+
"POST",
|
|
8368
|
+
`/api/v1/storefront-bot/conversations/${conversationId}/summarize`
|
|
8369
|
+
);
|
|
8370
|
+
}
|
|
8325
8371
|
/**
|
|
8326
8372
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
8327
8373
|
* Response includes the store's primary language and supported languages so
|
package/package.json
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
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
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"require": "./dist/index.js",
|
|
12
|
-
"import": "./dist/index.mjs"
|
|
13
|
-
},
|
|
14
|
-
"./bot": {
|
|
15
|
-
"types": "./dist/bot/index.d.ts",
|
|
16
|
-
"require": "./dist/bot/index.js",
|
|
17
|
-
"import": "./dist/bot/index.mjs"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"README.md"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup src/index.ts --format cjs,esm --dts && tsup src/bot/index.ts --format cjs,esm --dts --out-dir dist/bot && tsup src/bot/bootstrap.ts --format iife --minify --out-dir dist/bot",
|
|
26
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
27
|
-
"lint": "eslint \"src/**/*.ts\"",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"test:watch": "vitest",
|
|
30
|
-
"prepublishOnly": "pnpm build"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [
|
|
33
|
-
"brainerce",
|
|
34
|
-
"e-commerce",
|
|
35
|
-
"ecommerce",
|
|
36
|
-
"sdk",
|
|
37
|
-
"vibe-coding",
|
|
38
|
-
"vibe-coded",
|
|
39
|
-
"ai-commerce",
|
|
40
|
-
"storefront",
|
|
41
|
-
"headless-commerce",
|
|
42
|
-
"multi-platform",
|
|
43
|
-
"shopify",
|
|
44
|
-
"tiktok",
|
|
45
|
-
"cursor",
|
|
46
|
-
"lovable",
|
|
47
|
-
"v0",
|
|
48
|
-
"cart",
|
|
49
|
-
"checkout",
|
|
50
|
-
"products",
|
|
51
|
-
"sync"
|
|
52
|
-
],
|
|
53
|
-
"author": "Brainerce",
|
|
54
|
-
"license": "MIT",
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "https://github.com/brainerce/brainerce.git",
|
|
58
|
-
"directory": "packages/sdk"
|
|
59
|
-
},
|
|
60
|
-
"homepage": "https://brainerce.com",
|
|
61
|
-
"bugs": {
|
|
62
|
-
"url": "https://github.com/brainerce/brainerce/issues"
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@types/node": "^25.0.3",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
67
|
-
"@typescript-eslint/parser": "^8.50.1",
|
|
68
|
-
"eslint": "^9.39.2",
|
|
69
|
-
"tsup": "^8.0.0",
|
|
70
|
-
"typescript": "^5.3.0",
|
|
71
|
-
"vitest": "^1.0.0"
|
|
72
|
-
},
|
|
73
|
-
"peerDependencies": {
|
|
74
|
-
"typescript": ">=4.7.0"
|
|
75
|
-
},
|
|
76
|
-
"peerDependenciesMeta": {
|
|
77
|
-
"typescript": {
|
|
78
|
-
"optional": true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "brainerce",
|
|
3
|
+
"version": "1.45.0",
|
|
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
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./bot": {
|
|
15
|
+
"types": "./dist/bot/index.d.ts",
|
|
16
|
+
"require": "./dist/bot/index.js",
|
|
17
|
+
"import": "./dist/bot/index.mjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup src/index.ts --format cjs,esm --dts && tsup src/bot/index.ts --format cjs,esm --dts --out-dir dist/bot && tsup src/bot/bootstrap.ts --format iife --minify --out-dir dist/bot",
|
|
26
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
27
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"prepublishOnly": "pnpm build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"brainerce",
|
|
34
|
+
"e-commerce",
|
|
35
|
+
"ecommerce",
|
|
36
|
+
"sdk",
|
|
37
|
+
"vibe-coding",
|
|
38
|
+
"vibe-coded",
|
|
39
|
+
"ai-commerce",
|
|
40
|
+
"storefront",
|
|
41
|
+
"headless-commerce",
|
|
42
|
+
"multi-platform",
|
|
43
|
+
"shopify",
|
|
44
|
+
"tiktok",
|
|
45
|
+
"cursor",
|
|
46
|
+
"lovable",
|
|
47
|
+
"v0",
|
|
48
|
+
"cart",
|
|
49
|
+
"checkout",
|
|
50
|
+
"products",
|
|
51
|
+
"sync"
|
|
52
|
+
],
|
|
53
|
+
"author": "Brainerce",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/brainerce/brainerce.git",
|
|
58
|
+
"directory": "packages/sdk"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://brainerce.com",
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/brainerce/brainerce/issues"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^25.0.3",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
67
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
68
|
+
"eslint": "^9.39.2",
|
|
69
|
+
"tsup": "^8.0.0",
|
|
70
|
+
"typescript": "^5.3.0",
|
|
71
|
+
"vitest": "^1.0.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"typescript": ">=4.7.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"typescript": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|