brainerce 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI_BUILDER_PROMPT.md +720 -716
- package/README.md +4371 -4409
- package/dist/index.d.mts +258 -219
- package/dist/index.d.ts +258 -219
- package/dist/index.js +197 -200
- package/dist/index.mjs +186 -204
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ interface BrainerceClientOptions {
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
9
|
* // Vibe-coded site usage - simplest option!
|
|
10
|
-
* const
|
|
10
|
+
* const client = new BrainerceClient({
|
|
11
11
|
* connectionId: 'vc_abc123xyz...',
|
|
12
12
|
* });
|
|
13
|
-
* const products = await
|
|
13
|
+
* const products = await client.getProducts();
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
connectionId?: string;
|
|
@@ -21,18 +21,18 @@ interface BrainerceClientOptions {
|
|
|
21
21
|
* @example
|
|
22
22
|
* ```typescript
|
|
23
23
|
* // Frontend usage - safe to expose
|
|
24
|
-
* const
|
|
24
|
+
* const client = new BrainerceClient({ storeId: 'store_abc123' });
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
storeId?: string;
|
|
28
28
|
/**
|
|
29
|
-
* API Key for admin/backend access (starts with "
|
|
29
|
+
* API Key for admin/backend access (starts with "brainerce_").
|
|
30
30
|
* Keep this secret - never expose in frontend code!
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```typescript
|
|
34
34
|
* // Backend usage - keep secret
|
|
35
|
-
* const
|
|
35
|
+
* const client = new BrainerceClient({ apiKey: process.env.BRAINERCE_API_KEY });
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
apiKey?: string;
|
|
@@ -57,7 +57,7 @@ interface BrainerceClientOptions {
|
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```typescript
|
|
60
|
-
* const
|
|
60
|
+
* const client = new BrainerceClient({
|
|
61
61
|
* connectionId: 'vc_abc123...',
|
|
62
62
|
* onAuthError: (error) => {
|
|
63
63
|
* // Clear stored token
|
|
@@ -212,6 +212,8 @@ interface Product {
|
|
|
212
212
|
connectionId: string;
|
|
213
213
|
};
|
|
214
214
|
}>;
|
|
215
|
+
/** Discount info from matching discount rules (storefront/VC mode only) */
|
|
216
|
+
discount?: ProductDiscount | null;
|
|
215
217
|
createdAt: string;
|
|
216
218
|
updatedAt: string;
|
|
217
219
|
}
|
|
@@ -375,7 +377,7 @@ declare function getDescriptionContent(product: Pick<Product, 'description' | 'd
|
|
|
375
377
|
*
|
|
376
378
|
* @example
|
|
377
379
|
* ```typescript
|
|
378
|
-
* const product = await
|
|
380
|
+
* const product = await client.getProduct('prod_123');
|
|
379
381
|
* const status = getStockStatus(product.inventory);
|
|
380
382
|
* // Returns "In Stock" or "Out of Stock"
|
|
381
383
|
*
|
|
@@ -463,7 +465,7 @@ declare function formatPrice(priceString: string | number | undefined | null, op
|
|
|
463
465
|
*
|
|
464
466
|
* @example
|
|
465
467
|
* ```typescript
|
|
466
|
-
* const product = await
|
|
468
|
+
* const product = await client.getProduct('prod_123');
|
|
467
469
|
* const price = getProductPrice(product); // Returns number, e.g., 29.99
|
|
468
470
|
*
|
|
469
471
|
* // Check if on sale
|
|
@@ -534,7 +536,7 @@ declare function getVariantPrice(variant: Pick<ProductVariant, 'price' | 'salePr
|
|
|
534
536
|
*
|
|
535
537
|
* @example
|
|
536
538
|
* ```typescript
|
|
537
|
-
* const cart = await
|
|
539
|
+
* const cart = await client.getCart(cartId);
|
|
538
540
|
* const totals = getCartTotals(cart);
|
|
539
541
|
* // totals = { subtotal: 59.98, discount: 10, shipping: 0, total: 49.98 }
|
|
540
542
|
*
|
|
@@ -1019,8 +1021,8 @@ interface PlatformCouponCapabilities {
|
|
|
1019
1021
|
*
|
|
1020
1022
|
* @example
|
|
1021
1023
|
* ```typescript
|
|
1022
|
-
* const coupon = await
|
|
1023
|
-
* const product = await
|
|
1024
|
+
* const coupon = await client.getCoupon('coupon_123');
|
|
1025
|
+
* const product = await client.getProduct('prod_456');
|
|
1024
1026
|
*
|
|
1025
1027
|
* if (isCouponApplicableToProduct(coupon, product.id)) {
|
|
1026
1028
|
* // Apply discount
|
|
@@ -1172,6 +1174,17 @@ interface CustomerAuthResponse {
|
|
|
1172
1174
|
interface EmailVerificationResponse {
|
|
1173
1175
|
verified: boolean;
|
|
1174
1176
|
message: string;
|
|
1177
|
+
/** Present when verification promotes a pending registration to a real account */
|
|
1178
|
+
token?: string;
|
|
1179
|
+
expiresAt?: string;
|
|
1180
|
+
customer?: {
|
|
1181
|
+
id: string;
|
|
1182
|
+
email: string;
|
|
1183
|
+
firstName?: string;
|
|
1184
|
+
lastName?: string;
|
|
1185
|
+
phone?: string;
|
|
1186
|
+
emailVerified: boolean;
|
|
1187
|
+
};
|
|
1175
1188
|
}
|
|
1176
1189
|
type CustomerOAuthProvider = 'GOOGLE' | 'FACEBOOK' | 'GITHUB';
|
|
1177
1190
|
interface OAuthAuthorizeResponse {
|
|
@@ -1219,7 +1232,7 @@ type CartStatus = 'ACTIVE' | 'MERGED' | 'CONVERTED' | 'ABANDONED';
|
|
|
1219
1232
|
* @example
|
|
1220
1233
|
* ```typescript
|
|
1221
1234
|
* // Accessing cart item details
|
|
1222
|
-
* const cart = await
|
|
1235
|
+
* const cart = await client.getCart(cartId);
|
|
1223
1236
|
* cart.items.forEach(item => {
|
|
1224
1237
|
* console.log(item.product.name); // Product name (nested)
|
|
1225
1238
|
* console.log(item.variant?.name); // Variant name if applicable
|
|
@@ -1296,7 +1309,7 @@ interface CartItem {
|
|
|
1296
1309
|
* @example
|
|
1297
1310
|
* ```typescript
|
|
1298
1311
|
* // Get cart and calculate totals
|
|
1299
|
-
* const cart = await
|
|
1312
|
+
* const cart = await client.getCart(cartId);
|
|
1300
1313
|
* const subtotal = parseFloat(cart.subtotal);
|
|
1301
1314
|
* const discount = parseFloat(cart.discountAmount);
|
|
1302
1315
|
* const total = subtotal - discount;
|
|
@@ -1371,6 +1384,7 @@ interface AddToCartDto {
|
|
|
1371
1384
|
* Optional product info for local cart (guest mode).
|
|
1372
1385
|
* If provided, SDK uses this directly without fetching from API.
|
|
1373
1386
|
* Recommended: pass this when you already have the product loaded.
|
|
1387
|
+
* @deprecated Guest carts now use server-side sessions. Product info is always resolved by the server.
|
|
1374
1388
|
*/
|
|
1375
1389
|
productInfo?: {
|
|
1376
1390
|
name: string;
|
|
@@ -1389,8 +1403,23 @@ interface MergeCartsDto {
|
|
|
1389
1403
|
targetCustomerId: string;
|
|
1390
1404
|
}
|
|
1391
1405
|
/**
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1406
|
+
* Lightweight session cart reference stored in localStorage.
|
|
1407
|
+
* Only stores identifiers and cached item count, NOT cart contents.
|
|
1408
|
+
* The full cart data lives on the server and is fetched via API.
|
|
1409
|
+
*/
|
|
1410
|
+
interface SessionCartRef {
|
|
1411
|
+
/** UUID session token from the server */
|
|
1412
|
+
sessionToken: string;
|
|
1413
|
+
/** Server cart ID */
|
|
1414
|
+
cartId: string;
|
|
1415
|
+
/** Cached item count for instant badge display without API call */
|
|
1416
|
+
itemCount?: number;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Local cart item stored in localStorage/cookies.
|
|
1420
|
+
* Used for guest checkout without server-side cart.
|
|
1421
|
+
* @deprecated Guest carts now use server-side sessions via sessionToken.
|
|
1422
|
+
* Use the Cart type from smartGetCart() instead. Will be removed in v1.0.
|
|
1394
1423
|
*/
|
|
1395
1424
|
interface LocalCartItem {
|
|
1396
1425
|
productId: string;
|
|
@@ -1406,6 +1435,9 @@ interface LocalCartItem {
|
|
|
1406
1435
|
* Local cart stored in localStorage/cookies.
|
|
1407
1436
|
* Complete client-side cart for guest users.
|
|
1408
1437
|
*
|
|
1438
|
+
* @deprecated Guest carts now use server-side sessions via sessionToken.
|
|
1439
|
+
* Use the Cart type from smartGetCart() instead. Will be removed in v1.0.
|
|
1440
|
+
*
|
|
1409
1441
|
* **Initialization:** You can initialize with just `{ items: [] }`.
|
|
1410
1442
|
* All other fields are optional.
|
|
1411
1443
|
*
|
|
@@ -1521,7 +1553,7 @@ interface GuestOrderResponse {
|
|
|
1521
1553
|
*
|
|
1522
1554
|
* @example
|
|
1523
1555
|
* ```typescript
|
|
1524
|
-
* const result = await
|
|
1556
|
+
* const result = await client.startGuestCheckout(cart);
|
|
1525
1557
|
* if (result.tracked) {
|
|
1526
1558
|
* // Safe to access checkoutId and cartId
|
|
1527
1559
|
* console.log(result.checkoutId, result.cartId);
|
|
@@ -1552,7 +1584,7 @@ type CheckoutStatus = 'PENDING' | 'SHIPPING_SET' | 'PAYMENT_PENDING' | 'PAYMENT_
|
|
|
1552
1584
|
* ```
|
|
1553
1585
|
*/
|
|
1554
1586
|
interface TaxBreakdownItem {
|
|
1555
|
-
/** Tax name (e.g., "Israel VAT
|
|
1587
|
+
/** Tax name (e.g., "Israel VAT 18%", "California Sales Tax") */
|
|
1556
1588
|
name: string;
|
|
1557
1589
|
/** Tax rate as decimal (0.17 = 17%) */
|
|
1558
1590
|
rate: number;
|
|
@@ -1710,7 +1742,7 @@ interface CheckoutLineItem {
|
|
|
1710
1742
|
* @example
|
|
1711
1743
|
* ```typescript
|
|
1712
1744
|
* // Get and display shipping rates
|
|
1713
|
-
* const { checkout, rates } = await
|
|
1745
|
+
* const { checkout, rates } = await client.setShippingAddress(checkoutId, address);
|
|
1714
1746
|
*
|
|
1715
1747
|
* if (rates.length === 0) {
|
|
1716
1748
|
* // Handle no shipping options
|
|
@@ -1726,7 +1758,7 @@ interface CheckoutLineItem {
|
|
|
1726
1758
|
* });
|
|
1727
1759
|
*
|
|
1728
1760
|
* // Select a rate
|
|
1729
|
-
* await
|
|
1761
|
+
* await client.selectShippingMethod(checkoutId, rates[0].id);
|
|
1730
1762
|
* ```
|
|
1731
1763
|
*/
|
|
1732
1764
|
interface ShippingRate {
|
|
@@ -1776,7 +1808,7 @@ interface ShippingRate {
|
|
|
1776
1808
|
* @example
|
|
1777
1809
|
* ```typescript
|
|
1778
1810
|
* // Display checkout summary - use checkout.lineItems, NOT localCart!
|
|
1779
|
-
* const checkout = await
|
|
1811
|
+
* const checkout = await client.getCheckout(checkoutId);
|
|
1780
1812
|
*
|
|
1781
1813
|
* // Order Summary - ALWAYS use checkout.lineItems
|
|
1782
1814
|
* checkout.lineItems.forEach(item => {
|
|
@@ -1879,7 +1911,7 @@ interface CreateCheckoutDto {
|
|
|
1879
1911
|
* @example
|
|
1880
1912
|
* ```typescript
|
|
1881
1913
|
* // Checkout only items 1 and 3, leave item 2 in cart
|
|
1882
|
-
* const checkout = await
|
|
1914
|
+
* const checkout = await client.createCheckout({
|
|
1883
1915
|
* cartId: 'cart_123',
|
|
1884
1916
|
* selectedItemIds: ['item_1', 'item_3'],
|
|
1885
1917
|
* });
|
|
@@ -2256,7 +2288,7 @@ type PaymentProvider = PaymentProviderConfig;
|
|
|
2256
2288
|
*
|
|
2257
2289
|
* @example
|
|
2258
2290
|
* ```typescript
|
|
2259
|
-
* const { providers, hasPayments } = await
|
|
2291
|
+
* const { providers, hasPayments } = await client.getPaymentProviders();
|
|
2260
2292
|
*
|
|
2261
2293
|
* if (!hasPayments) {
|
|
2262
2294
|
* // Show error: "Payment is not configured"
|
|
@@ -2382,7 +2414,7 @@ interface WaitForOrderOptions {
|
|
|
2382
2414
|
*
|
|
2383
2415
|
* @example
|
|
2384
2416
|
* ```typescript
|
|
2385
|
-
* const result = await
|
|
2417
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
2386
2418
|
* if (result.success) {
|
|
2387
2419
|
* const orderNumber = result.status.orderNumber; // e.g., "ORD-20260201-0001"
|
|
2388
2420
|
* const orderId = result.status.orderId;
|
|
@@ -2418,7 +2450,7 @@ type InventoryReservationStrategy = 'ON_PAYMENT' | 'ON_CHECKOUT' | 'ON_CART';
|
|
|
2418
2450
|
*
|
|
2419
2451
|
* @example
|
|
2420
2452
|
* ```typescript
|
|
2421
|
-
* const cart = await
|
|
2453
|
+
* const cart = await client.getCart(cartId);
|
|
2422
2454
|
* if (cart.reservation?.hasReservation) {
|
|
2423
2455
|
* const remaining = cart.reservation.remainingSeconds;
|
|
2424
2456
|
* console.log(`Items reserved for ${remaining} seconds`);
|
|
@@ -2443,7 +2475,7 @@ interface ReservationInfo {
|
|
|
2443
2475
|
*
|
|
2444
2476
|
* @example
|
|
2445
2477
|
* ```typescript
|
|
2446
|
-
* const availability = await
|
|
2478
|
+
* const availability = await client.getAvailability(['prod_123', 'prod_456']);
|
|
2447
2479
|
* availability.forEach(item => {
|
|
2448
2480
|
* if (!item.canPurchase) {
|
|
2449
2481
|
* console.log(`${item.productId}: Cannot purchase`);
|
|
@@ -3253,6 +3285,17 @@ interface ProductDiscountBadge {
|
|
|
3253
3285
|
originalPrice: string;
|
|
3254
3286
|
discountedPrice: string;
|
|
3255
3287
|
}
|
|
3288
|
+
/** Discount info embedded in product responses */
|
|
3289
|
+
interface ProductDiscount {
|
|
3290
|
+
ruleId: string;
|
|
3291
|
+
ruleName: string;
|
|
3292
|
+
type: string;
|
|
3293
|
+
badgeText: string;
|
|
3294
|
+
message: string | null;
|
|
3295
|
+
originalPrice: string;
|
|
3296
|
+
discountedPrice: string;
|
|
3297
|
+
discountAmount: string;
|
|
3298
|
+
}
|
|
3256
3299
|
/** Nudge encouraging customers to qualify for a discount */
|
|
3257
3300
|
interface CartNudge {
|
|
3258
3301
|
ruleId: string;
|
|
@@ -3295,20 +3338,20 @@ interface BrainerceApiError {
|
|
|
3295
3338
|
*
|
|
3296
3339
|
* **Vibe-Coded Mode (Simplest)** - Use connectionId for vibe-coded sites:
|
|
3297
3340
|
* ```typescript
|
|
3298
|
-
* const
|
|
3299
|
-
* const products = await
|
|
3341
|
+
* const client = new BrainerceClient({ connectionId: 'vc_abc123...' });
|
|
3342
|
+
* const products = await client.getProducts();
|
|
3300
3343
|
* ```
|
|
3301
3344
|
*
|
|
3302
3345
|
* **Storefront Mode (Frontend)** - Use storeId for public access:
|
|
3303
3346
|
* ```typescript
|
|
3304
|
-
* const
|
|
3305
|
-
* const products = await
|
|
3347
|
+
* const client = new BrainerceClient({ storeId: 'store_abc123' });
|
|
3348
|
+
* const products = await client.getProducts();
|
|
3306
3349
|
* ```
|
|
3307
3350
|
*
|
|
3308
3351
|
* **Admin Mode (Backend)** - Use apiKey for full access:
|
|
3309
3352
|
* ```typescript
|
|
3310
|
-
* const
|
|
3311
|
-
* const orders = await
|
|
3353
|
+
* const client = new BrainerceClient({ apiKey: process.env.BRAINERCE_API_KEY });
|
|
3354
|
+
* const orders = await client.getOrders();
|
|
3312
3355
|
* ```
|
|
3313
3356
|
*/
|
|
3314
3357
|
declare class BrainerceClient {
|
|
@@ -3359,11 +3402,11 @@ declare class BrainerceClient {
|
|
|
3359
3402
|
*
|
|
3360
3403
|
* @example
|
|
3361
3404
|
* ```typescript
|
|
3362
|
-
* const auth = await
|
|
3363
|
-
*
|
|
3405
|
+
* const auth = await client.loginCustomer('user@example.com', 'password');
|
|
3406
|
+
* client.setCustomerToken(auth.token);
|
|
3364
3407
|
*
|
|
3365
3408
|
* // Now can access customer data
|
|
3366
|
-
* const profile = await
|
|
3409
|
+
* const profile = await client.getMyProfile();
|
|
3367
3410
|
* ```
|
|
3368
3411
|
*/
|
|
3369
3412
|
setCustomerToken(token: string | null): void;
|
|
@@ -3403,10 +3446,10 @@ declare class BrainerceClient {
|
|
|
3403
3446
|
* @example
|
|
3404
3447
|
* ```typescript
|
|
3405
3448
|
* // Basic usage
|
|
3406
|
-
* const products = await
|
|
3449
|
+
* const products = await client.getProducts({ page: 1, limit: 20 });
|
|
3407
3450
|
*
|
|
3408
3451
|
* // With filters (vibe-coded mode)
|
|
3409
|
-
* const filtered = await
|
|
3452
|
+
* const filtered = await client.getProducts({
|
|
3410
3453
|
* categories: ['cat_123', 'cat_456'],
|
|
3411
3454
|
* minPrice: 10,
|
|
3412
3455
|
* maxPrice: 100,
|
|
@@ -3428,7 +3471,7 @@ declare class BrainerceClient {
|
|
|
3428
3471
|
* @example
|
|
3429
3472
|
* ```typescript
|
|
3430
3473
|
* // Get product by its URL-friendly slug
|
|
3431
|
-
* const product = await
|
|
3474
|
+
* const product = await client.getProductBySlug('awesome-product-name');
|
|
3432
3475
|
* ```
|
|
3433
3476
|
*/
|
|
3434
3477
|
getProductBySlug(slug: string): Promise<Product>;
|
|
@@ -3438,7 +3481,7 @@ declare class BrainerceClient {
|
|
|
3438
3481
|
*
|
|
3439
3482
|
* @example
|
|
3440
3483
|
* ```typescript
|
|
3441
|
-
* const { categories } = await
|
|
3484
|
+
* const { categories } = await client.getCategories();
|
|
3442
3485
|
* // categories is a tree structure with children
|
|
3443
3486
|
* ```
|
|
3444
3487
|
*/
|
|
@@ -3456,7 +3499,7 @@ declare class BrainerceClient {
|
|
|
3456
3499
|
*
|
|
3457
3500
|
* @example
|
|
3458
3501
|
* ```typescript
|
|
3459
|
-
* const { brands } = await
|
|
3502
|
+
* const { brands } = await client.getBrands();
|
|
3460
3503
|
* // Use brand IDs in getProducts({ brands: ['brand_id'] })
|
|
3461
3504
|
* ```
|
|
3462
3505
|
*/
|
|
@@ -3472,7 +3515,7 @@ declare class BrainerceClient {
|
|
|
3472
3515
|
*
|
|
3473
3516
|
* @example
|
|
3474
3517
|
* ```typescript
|
|
3475
|
-
* const { tags } = await
|
|
3518
|
+
* const { tags } = await client.getTags();
|
|
3476
3519
|
* // Use tag IDs in getProducts({ tags: ['tag_id'] })
|
|
3477
3520
|
* ```
|
|
3478
3521
|
*/
|
|
@@ -3494,12 +3537,12 @@ declare class BrainerceClient {
|
|
|
3494
3537
|
* @example
|
|
3495
3538
|
* ```typescript
|
|
3496
3539
|
* // Basic autocomplete
|
|
3497
|
-
* const suggestions = await
|
|
3540
|
+
* const suggestions = await client.getSearchSuggestions('shirt');
|
|
3498
3541
|
* console.log(suggestions.products); // [{ id, name, image, basePrice, type }]
|
|
3499
3542
|
* console.log(suggestions.categories); // [{ id, name, productCount }]
|
|
3500
3543
|
*
|
|
3501
3544
|
* // With custom limit
|
|
3502
|
-
* const suggestions = await
|
|
3545
|
+
* const suggestions = await client.getSearchSuggestions('dress', 3);
|
|
3503
3546
|
* ```
|
|
3504
3547
|
*/
|
|
3505
3548
|
getSearchSuggestions(query: string, limit?: number): Promise<SearchSuggestions>;
|
|
@@ -3521,11 +3564,11 @@ declare class BrainerceClient {
|
|
|
3521
3564
|
*
|
|
3522
3565
|
* @example
|
|
3523
3566
|
* ```typescript
|
|
3524
|
-
* // Delete from
|
|
3525
|
-
* const result = await
|
|
3567
|
+
* // Delete from Brainerce only
|
|
3568
|
+
* const result = await client.deleteProduct('prod_123');
|
|
3526
3569
|
*
|
|
3527
|
-
* // Delete from
|
|
3528
|
-
* const result = await
|
|
3570
|
+
* // Delete from Brainerce and connected platforms
|
|
3571
|
+
* const result = await client.deleteProduct('prod_123', {
|
|
3529
3572
|
* platforms: ['SHOPIFY', 'WOOCOMMERCE']
|
|
3530
3573
|
* });
|
|
3531
3574
|
* console.log(result.success); // true
|
|
@@ -3541,7 +3584,7 @@ declare class BrainerceClient {
|
|
|
3541
3584
|
*
|
|
3542
3585
|
* @example
|
|
3543
3586
|
* ```typescript
|
|
3544
|
-
* const product = await
|
|
3587
|
+
* const product = await client.convertToVariable('prod_123');
|
|
3545
3588
|
* console.log('Product type:', product.type); // 'VARIABLE'
|
|
3546
3589
|
* ```
|
|
3547
3590
|
*/
|
|
@@ -3552,7 +3595,7 @@ declare class BrainerceClient {
|
|
|
3552
3595
|
*
|
|
3553
3596
|
* @example
|
|
3554
3597
|
* ```typescript
|
|
3555
|
-
* const product = await
|
|
3598
|
+
* const product = await client.convertToSimple('prod_123');
|
|
3556
3599
|
* console.log('Product type:', product.type); // 'SIMPLE'
|
|
3557
3600
|
* ```
|
|
3558
3601
|
*/
|
|
@@ -3562,7 +3605,7 @@ declare class BrainerceClient {
|
|
|
3562
3605
|
*
|
|
3563
3606
|
* @example
|
|
3564
3607
|
* ```typescript
|
|
3565
|
-
* const result = await
|
|
3608
|
+
* const result = await client.publishProduct('prod_123', ['SHOPIFY', 'WOOCOMMERCE']);
|
|
3566
3609
|
* console.log('Publish results:', result.results);
|
|
3567
3610
|
* ```
|
|
3568
3611
|
*/
|
|
@@ -3572,7 +3615,7 @@ declare class BrainerceClient {
|
|
|
3572
3615
|
*
|
|
3573
3616
|
* @example
|
|
3574
3617
|
* ```typescript
|
|
3575
|
-
* const variant = await
|
|
3618
|
+
* const variant = await client.createVariant('prod_123', {
|
|
3576
3619
|
* sku: 'PROD-SM-RED',
|
|
3577
3620
|
* name: 'Small / Red',
|
|
3578
3621
|
* attributes: { size: 'S', color: 'Red' },
|
|
@@ -3587,7 +3630,7 @@ declare class BrainerceClient {
|
|
|
3587
3630
|
*
|
|
3588
3631
|
* @example
|
|
3589
3632
|
* ```typescript
|
|
3590
|
-
* const result = await
|
|
3633
|
+
* const result = await client.bulkSaveVariants('prod_123', {
|
|
3591
3634
|
* variants: [
|
|
3592
3635
|
* { sku: 'SM-RED', attributes: { size: 'S', color: 'Red' }, stock: 10, isEnabled: true },
|
|
3593
3636
|
* { id: 'var_456', sku: 'MD-BLUE', attributes: { size: 'M', color: 'Blue' }, stock: 5, isEnabled: true },
|
|
@@ -3603,7 +3646,7 @@ declare class BrainerceClient {
|
|
|
3603
3646
|
*
|
|
3604
3647
|
* @example
|
|
3605
3648
|
* ```typescript
|
|
3606
|
-
* const variant = await
|
|
3649
|
+
* const variant = await client.updateVariant('prod_123', 'var_456', {
|
|
3607
3650
|
* price: 34.99,
|
|
3608
3651
|
* salePrice: 29.99,
|
|
3609
3652
|
* });
|
|
@@ -3615,7 +3658,7 @@ declare class BrainerceClient {
|
|
|
3615
3658
|
*
|
|
3616
3659
|
* @example
|
|
3617
3660
|
* ```typescript
|
|
3618
|
-
* await
|
|
3661
|
+
* await client.deleteVariant('prod_123', 'var_456');
|
|
3619
3662
|
* ```
|
|
3620
3663
|
*/
|
|
3621
3664
|
deleteVariant(productId: string, variantId: string): Promise<void>;
|
|
@@ -3624,7 +3667,7 @@ declare class BrainerceClient {
|
|
|
3624
3667
|
*
|
|
3625
3668
|
* @example
|
|
3626
3669
|
* ```typescript
|
|
3627
|
-
* const inventory = await
|
|
3670
|
+
* const inventory = await client.getVariantInventory('prod_123', 'var_456');
|
|
3628
3671
|
* console.log('Available:', inventory.available);
|
|
3629
3672
|
* ```
|
|
3630
3673
|
*/
|
|
@@ -3634,7 +3677,7 @@ declare class BrainerceClient {
|
|
|
3634
3677
|
*
|
|
3635
3678
|
* @example
|
|
3636
3679
|
* ```typescript
|
|
3637
|
-
* const inventory = await
|
|
3680
|
+
* const inventory = await client.updateVariantInventory('prod_123', 'var_456', {
|
|
3638
3681
|
* newTotal: 50,
|
|
3639
3682
|
* reason: 'Restocked from supplier',
|
|
3640
3683
|
* });
|
|
@@ -3663,7 +3706,7 @@ declare class BrainerceClient {
|
|
|
3663
3706
|
*
|
|
3664
3707
|
* @example
|
|
3665
3708
|
* ```typescript
|
|
3666
|
-
* const order = await
|
|
3709
|
+
* const order = await client.updateOrderStatus('order_123', 'shipped');
|
|
3667
3710
|
* ```
|
|
3668
3711
|
*/
|
|
3669
3712
|
updateOrderStatus(orderId: string, status: string): Promise<Order>;
|
|
@@ -3673,7 +3716,7 @@ declare class BrainerceClient {
|
|
|
3673
3716
|
*
|
|
3674
3717
|
* @example
|
|
3675
3718
|
* ```typescript
|
|
3676
|
-
* const order = await
|
|
3719
|
+
* const order = await client.updatePaymentMethod('order_123', 'credit_card');
|
|
3677
3720
|
* ```
|
|
3678
3721
|
*/
|
|
3679
3722
|
updatePaymentMethod(orderId: string, paymentMethod: string): Promise<Order>;
|
|
@@ -3682,7 +3725,7 @@ declare class BrainerceClient {
|
|
|
3682
3725
|
*
|
|
3683
3726
|
* @example
|
|
3684
3727
|
* ```typescript
|
|
3685
|
-
* const order = await
|
|
3728
|
+
* const order = await client.updateOrderNotes('order_123', 'Customer requested gift wrapping');
|
|
3686
3729
|
* ```
|
|
3687
3730
|
*/
|
|
3688
3731
|
updateOrderNotes(orderId: string, notes: string): Promise<Order>;
|
|
@@ -3692,7 +3735,7 @@ declare class BrainerceClient {
|
|
|
3692
3735
|
*
|
|
3693
3736
|
* @example
|
|
3694
3737
|
* ```typescript
|
|
3695
|
-
* const refunds = await
|
|
3738
|
+
* const refunds = await client.getOrderRefunds('order_123');
|
|
3696
3739
|
* console.log('Total refunds:', refunds.length);
|
|
3697
3740
|
* ```
|
|
3698
3741
|
*/
|
|
@@ -3704,7 +3747,7 @@ declare class BrainerceClient {
|
|
|
3704
3747
|
* @example
|
|
3705
3748
|
* ```typescript
|
|
3706
3749
|
* // Full refund
|
|
3707
|
-
* const refund = await
|
|
3750
|
+
* const refund = await client.createRefund('order_123', {
|
|
3708
3751
|
* type: 'full',
|
|
3709
3752
|
* restockInventory: true,
|
|
3710
3753
|
* notifyCustomer: true,
|
|
@@ -3712,7 +3755,7 @@ declare class BrainerceClient {
|
|
|
3712
3755
|
* });
|
|
3713
3756
|
*
|
|
3714
3757
|
* // Partial refund
|
|
3715
|
-
* const partialRefund = await
|
|
3758
|
+
* const partialRefund = await client.createRefund('order_123', {
|
|
3716
3759
|
* type: 'partial',
|
|
3717
3760
|
* items: [
|
|
3718
3761
|
* { lineItemId: 'item_456', quantity: 1 },
|
|
@@ -3728,7 +3771,7 @@ declare class BrainerceClient {
|
|
|
3728
3771
|
*
|
|
3729
3772
|
* @example
|
|
3730
3773
|
* ```typescript
|
|
3731
|
-
* const order = await
|
|
3774
|
+
* const order = await client.updateOrderShipping('order_123', {
|
|
3732
3775
|
* firstName: 'John',
|
|
3733
3776
|
* lastName: 'Doe',
|
|
3734
3777
|
* line1: '456 New Address',
|
|
@@ -3746,7 +3789,7 @@ declare class BrainerceClient {
|
|
|
3746
3789
|
*
|
|
3747
3790
|
* @example
|
|
3748
3791
|
* ```typescript
|
|
3749
|
-
* const order = await
|
|
3792
|
+
* const order = await client.cancelOrder('order_123');
|
|
3750
3793
|
* console.log('Order status:', order.status); // 'cancelled'
|
|
3751
3794
|
* ```
|
|
3752
3795
|
*/
|
|
@@ -3757,7 +3800,7 @@ declare class BrainerceClient {
|
|
|
3757
3800
|
*
|
|
3758
3801
|
* @example
|
|
3759
3802
|
* ```typescript
|
|
3760
|
-
* const order = await
|
|
3803
|
+
* const order = await client.fulfillOrder('order_123', {
|
|
3761
3804
|
* trackingNumber: '1Z999AA10123456784',
|
|
3762
3805
|
* trackingCompany: 'UPS',
|
|
3763
3806
|
* notifyCustomer: true,
|
|
@@ -3770,7 +3813,7 @@ declare class BrainerceClient {
|
|
|
3770
3813
|
*
|
|
3771
3814
|
* @example
|
|
3772
3815
|
* ```typescript
|
|
3773
|
-
* const result = await
|
|
3816
|
+
* const result = await client.syncDraftOrders();
|
|
3774
3817
|
* console.log('Draft orders synced');
|
|
3775
3818
|
* ```
|
|
3776
3819
|
*/
|
|
@@ -3782,7 +3825,7 @@ declare class BrainerceClient {
|
|
|
3782
3825
|
*
|
|
3783
3826
|
* @example
|
|
3784
3827
|
* ```typescript
|
|
3785
|
-
* const order = await
|
|
3828
|
+
* const order = await client.completeDraftOrder('draft_123', {
|
|
3786
3829
|
* paymentPending: false,
|
|
3787
3830
|
* });
|
|
3788
3831
|
* ```
|
|
@@ -3793,7 +3836,7 @@ declare class BrainerceClient {
|
|
|
3793
3836
|
*
|
|
3794
3837
|
* @example
|
|
3795
3838
|
* ```typescript
|
|
3796
|
-
* await
|
|
3839
|
+
* await client.sendDraftInvoice('draft_123', {
|
|
3797
3840
|
* to: 'customer@example.com',
|
|
3798
3841
|
* subject: 'Your Invoice',
|
|
3799
3842
|
* customMessage: 'Thank you for your order!',
|
|
@@ -3808,7 +3851,7 @@ declare class BrainerceClient {
|
|
|
3808
3851
|
*
|
|
3809
3852
|
* @example
|
|
3810
3853
|
* ```typescript
|
|
3811
|
-
* await
|
|
3854
|
+
* await client.deleteDraftOrder('draft_123');
|
|
3812
3855
|
* ```
|
|
3813
3856
|
*/
|
|
3814
3857
|
deleteDraftOrder(orderId: string): Promise<void>;
|
|
@@ -3817,7 +3860,7 @@ declare class BrainerceClient {
|
|
|
3817
3860
|
*
|
|
3818
3861
|
* @example
|
|
3819
3862
|
* ```typescript
|
|
3820
|
-
* const order = await
|
|
3863
|
+
* const order = await client.updateDraftOrder('draft_123', {
|
|
3821
3864
|
* note: 'Updated customer note',
|
|
3822
3865
|
* email: 'newemail@example.com',
|
|
3823
3866
|
* shippingAddress: {
|
|
@@ -3851,7 +3894,7 @@ declare class BrainerceClient {
|
|
|
3851
3894
|
*
|
|
3852
3895
|
* @example
|
|
3853
3896
|
* ```typescript
|
|
3854
|
-
* const inventory = await
|
|
3897
|
+
* const inventory = await client.editInventory({
|
|
3855
3898
|
* productId: 'prod_123',
|
|
3856
3899
|
* newTotal: 100,
|
|
3857
3900
|
* reason: 'Restocked from warehouse',
|
|
@@ -3868,7 +3911,7 @@ declare class BrainerceClient {
|
|
|
3868
3911
|
*
|
|
3869
3912
|
* @example
|
|
3870
3913
|
* ```typescript
|
|
3871
|
-
* const status = await
|
|
3914
|
+
* const status = await client.getInventorySyncStatus();
|
|
3872
3915
|
* console.log(`${status.pending} products pending sync`);
|
|
3873
3916
|
* console.log(`Last sync: ${status.lastSyncAt}`);
|
|
3874
3917
|
* ```
|
|
@@ -3879,7 +3922,7 @@ declare class BrainerceClient {
|
|
|
3879
3922
|
*
|
|
3880
3923
|
* @example
|
|
3881
3924
|
* ```typescript
|
|
3882
|
-
* const inventories = await
|
|
3925
|
+
* const inventories = await client.getBulkInventory(['prod_123', 'prod_456', 'prod_789']);
|
|
3883
3926
|
* inventories.forEach(inv => {
|
|
3884
3927
|
* console.log(`${inv.productId}: ${inv.available} available`);
|
|
3885
3928
|
* });
|
|
@@ -3893,10 +3936,10 @@ declare class BrainerceClient {
|
|
|
3893
3936
|
* @example
|
|
3894
3937
|
* ```typescript
|
|
3895
3938
|
* // Reconcile single product (dry run)
|
|
3896
|
-
* const result = await
|
|
3939
|
+
* const result = await client.reconcileInventory({ productId: 'prod_123' });
|
|
3897
3940
|
*
|
|
3898
3941
|
* // Reconcile all products with auto-fix
|
|
3899
|
-
* const summary = await
|
|
3942
|
+
* const summary = await client.reconcileInventory({ autoFix: true });
|
|
3900
3943
|
* console.log(`Reconciled ${summary.reconciled} products`);
|
|
3901
3944
|
* ```
|
|
3902
3945
|
*/
|
|
@@ -3911,7 +3954,7 @@ declare class BrainerceClient {
|
|
|
3911
3954
|
* @example
|
|
3912
3955
|
* ```typescript
|
|
3913
3956
|
* // Check if items are available before adding to cart
|
|
3914
|
-
* const result = await
|
|
3957
|
+
* const result = await client.checkStockAvailability([
|
|
3915
3958
|
* { productId: 'prod_123', quantity: 2 },
|
|
3916
3959
|
* { productId: 'prod_456', variantId: 'var_789', quantity: 1 }
|
|
3917
3960
|
* ]);
|
|
@@ -3943,10 +3986,10 @@ declare class BrainerceClient {
|
|
|
3943
3986
|
* @example
|
|
3944
3987
|
* ```typescript
|
|
3945
3988
|
* // Check all cart items (full checkout)
|
|
3946
|
-
* const result = await
|
|
3989
|
+
* const result = await client.checkCartStock(cart);
|
|
3947
3990
|
*
|
|
3948
3991
|
* // Check only selected items (partial checkout - server cart only)
|
|
3949
|
-
* const result = await
|
|
3992
|
+
* const result = await client.checkCartStock(cart, ['item_1', 'item_3']);
|
|
3950
3993
|
*
|
|
3951
3994
|
* if (!result.allAvailable) {
|
|
3952
3995
|
* const unavailable = result.results.filter(r => !r.isAvailable);
|
|
@@ -3977,7 +4020,7 @@ declare class BrainerceClient {
|
|
|
3977
4020
|
*
|
|
3978
4021
|
* @example
|
|
3979
4022
|
* ```typescript
|
|
3980
|
-
* const coupon = await
|
|
4023
|
+
* const coupon = await client.createCoupon({
|
|
3981
4024
|
* code: 'SUMMER20',
|
|
3982
4025
|
* type: 'PERCENTAGE',
|
|
3983
4026
|
* value: 20,
|
|
@@ -4013,7 +4056,7 @@ declare class BrainerceClient {
|
|
|
4013
4056
|
* @example
|
|
4014
4057
|
* ```typescript
|
|
4015
4058
|
* // Only sync to WooCommerce and Shopify
|
|
4016
|
-
* await
|
|
4059
|
+
* await client.publishCoupon('coupon_123', ['WOOCOMMERCE', 'SHOPIFY']);
|
|
4017
4060
|
* ```
|
|
4018
4061
|
*/
|
|
4019
4062
|
publishCoupon(couponId: string, platforms: ConnectorPlatform[]): Promise<SyncJob>;
|
|
@@ -4023,7 +4066,7 @@ declare class BrainerceClient {
|
|
|
4023
4066
|
*
|
|
4024
4067
|
* @example
|
|
4025
4068
|
* ```typescript
|
|
4026
|
-
* const capabilities = await
|
|
4069
|
+
* const capabilities = await client.getCouponPlatformCapabilities();
|
|
4027
4070
|
* if (!capabilities.SHOPIFY.supportsProductExclusions) {
|
|
4028
4071
|
* console.log('Shopify does not support product exclusions');
|
|
4029
4072
|
* }
|
|
@@ -4035,7 +4078,7 @@ declare class BrainerceClient {
|
|
|
4035
4078
|
*
|
|
4036
4079
|
* @example
|
|
4037
4080
|
* ```typescript
|
|
4038
|
-
* const customer = await
|
|
4081
|
+
* const customer = await client.createCustomer({
|
|
4039
4082
|
* email: 'customer@example.com',
|
|
4040
4083
|
* firstName: 'John',
|
|
4041
4084
|
* lastName: 'Doe',
|
|
@@ -4062,7 +4105,7 @@ declare class BrainerceClient {
|
|
|
4062
4105
|
*
|
|
4063
4106
|
* @example
|
|
4064
4107
|
* ```typescript
|
|
4065
|
-
* const auth = await
|
|
4108
|
+
* const auth = await client.loginCustomer('customer@example.com', 'password123');
|
|
4066
4109
|
* console.log('Customer logged in:', auth.customer.email);
|
|
4067
4110
|
* // Store auth.token for subsequent authenticated requests
|
|
4068
4111
|
* ```
|
|
@@ -4074,7 +4117,7 @@ declare class BrainerceClient {
|
|
|
4074
4117
|
*
|
|
4075
4118
|
* @example
|
|
4076
4119
|
* ```typescript
|
|
4077
|
-
* const auth = await
|
|
4120
|
+
* const auth = await client.registerCustomer({
|
|
4078
4121
|
* email: 'newcustomer@example.com',
|
|
4079
4122
|
* password: 'securepassword123',
|
|
4080
4123
|
* firstName: 'Jane',
|
|
@@ -4100,14 +4143,14 @@ declare class BrainerceClient {
|
|
|
4100
4143
|
* @example
|
|
4101
4144
|
* ```typescript
|
|
4102
4145
|
* // Option 1: Pass token directly (recommended for verification flow)
|
|
4103
|
-
* const auth = await
|
|
4146
|
+
* const auth = await client.registerCustomer({...});
|
|
4104
4147
|
* if (auth.requiresVerification) {
|
|
4105
|
-
* const result = await
|
|
4148
|
+
* const result = await client.verifyEmail('123456', auth.token);
|
|
4106
4149
|
* }
|
|
4107
4150
|
*
|
|
4108
4151
|
* // Option 2: Use setCustomerToken first
|
|
4109
|
-
*
|
|
4110
|
-
* const result = await
|
|
4152
|
+
* client.setCustomerToken(auth.token);
|
|
4153
|
+
* const result = await client.verifyEmail('123456');
|
|
4111
4154
|
* ```
|
|
4112
4155
|
*/
|
|
4113
4156
|
verifyEmail(code: string, token?: string): Promise<EmailVerificationResponse>;
|
|
@@ -4121,15 +4164,16 @@ declare class BrainerceClient {
|
|
|
4121
4164
|
* @example
|
|
4122
4165
|
* ```typescript
|
|
4123
4166
|
* // Option 1: Pass token directly
|
|
4124
|
-
* await
|
|
4167
|
+
* await client.resendVerificationEmail(auth.token);
|
|
4125
4168
|
*
|
|
4126
4169
|
* // Option 2: Use setCustomerToken first
|
|
4127
|
-
*
|
|
4128
|
-
* await
|
|
4170
|
+
* client.setCustomerToken(auth.token);
|
|
4171
|
+
* await client.resendVerificationEmail();
|
|
4129
4172
|
* ```
|
|
4130
4173
|
*/
|
|
4131
4174
|
resendVerificationEmail(token?: string): Promise<{
|
|
4132
4175
|
message: string;
|
|
4176
|
+
token?: string;
|
|
4133
4177
|
}>;
|
|
4134
4178
|
/**
|
|
4135
4179
|
* Get available OAuth providers for this store.
|
|
@@ -4140,7 +4184,7 @@ declare class BrainerceClient {
|
|
|
4140
4184
|
*
|
|
4141
4185
|
* @example
|
|
4142
4186
|
* ```typescript
|
|
4143
|
-
* const { providers } = await
|
|
4187
|
+
* const { providers } = await client.getAvailableOAuthProviders();
|
|
4144
4188
|
* // providers: ['GOOGLE', 'FACEBOOK'] - array of strings, not objects!
|
|
4145
4189
|
*
|
|
4146
4190
|
* // To display with friendly names:
|
|
@@ -4169,7 +4213,7 @@ declare class BrainerceClient {
|
|
|
4169
4213
|
* @example
|
|
4170
4214
|
* ```typescript
|
|
4171
4215
|
* // Get authorization URL (redirectUrl MUST be absolute with origin)
|
|
4172
|
-
* const { authorizationUrl } = await
|
|
4216
|
+
* const { authorizationUrl } = await client.getOAuthAuthorizeUrl('GOOGLE', {
|
|
4173
4217
|
* redirectUrl: window.location.origin + '/auth/callback'
|
|
4174
4218
|
* });
|
|
4175
4219
|
*
|
|
@@ -4180,7 +4224,7 @@ declare class BrainerceClient {
|
|
|
4180
4224
|
* const params = new URLSearchParams(window.location.search);
|
|
4181
4225
|
* if (params.get('oauth_success') === 'true') {
|
|
4182
4226
|
* const token = params.get('token');
|
|
4183
|
-
*
|
|
4227
|
+
* client.setCustomerToken(token);
|
|
4184
4228
|
* // Also available: customer_id, customer_email, is_new
|
|
4185
4229
|
* } else if (params.get('oauth_error')) {
|
|
4186
4230
|
* // Show error
|
|
@@ -4218,10 +4262,10 @@ declare class BrainerceClient {
|
|
|
4218
4262
|
* @example
|
|
4219
4263
|
* ```typescript
|
|
4220
4264
|
* // Customer must be logged in first
|
|
4221
|
-
*
|
|
4265
|
+
* client.setCustomerToken(auth.token);
|
|
4222
4266
|
*
|
|
4223
4267
|
* // Get authorization URL for linking
|
|
4224
|
-
* const { authorizationUrl } = await
|
|
4268
|
+
* const { authorizationUrl } = await client.linkOAuthProvider('GITHUB', {
|
|
4225
4269
|
* redirectUrl: '/settings'
|
|
4226
4270
|
* });
|
|
4227
4271
|
*
|
|
@@ -4240,8 +4284,8 @@ declare class BrainerceClient {
|
|
|
4240
4284
|
*
|
|
4241
4285
|
* @example
|
|
4242
4286
|
* ```typescript
|
|
4243
|
-
*
|
|
4244
|
-
* await
|
|
4287
|
+
* client.setCustomerToken(auth.token);
|
|
4288
|
+
* await client.unlinkOAuthProvider('FACEBOOK');
|
|
4245
4289
|
* ```
|
|
4246
4290
|
*/
|
|
4247
4291
|
unlinkOAuthProvider(provider: CustomerOAuthProvider): Promise<{
|
|
@@ -4253,8 +4297,8 @@ declare class BrainerceClient {
|
|
|
4253
4297
|
*
|
|
4254
4298
|
* @example
|
|
4255
4299
|
* ```typescript
|
|
4256
|
-
*
|
|
4257
|
-
* const { connections } = await
|
|
4300
|
+
* client.setCustomerToken(auth.token);
|
|
4301
|
+
* const { connections } = await client.getOAuthConnections();
|
|
4258
4302
|
* // connections: [{ id: '...', provider: 'GOOGLE', email: 'user@gmail.com', createdAt: '...' }]
|
|
4259
4303
|
* ```
|
|
4260
4304
|
*/
|
|
@@ -4267,10 +4311,10 @@ declare class BrainerceClient {
|
|
|
4267
4311
|
* @example
|
|
4268
4312
|
* ```typescript
|
|
4269
4313
|
* // After login/register, set the token
|
|
4270
|
-
*
|
|
4314
|
+
* client.setCustomerToken(auth.token);
|
|
4271
4315
|
*
|
|
4272
4316
|
* // Then get the profile
|
|
4273
|
-
* const profile = await
|
|
4317
|
+
* const profile = await client.getCustomerProfile();
|
|
4274
4318
|
* console.log('Customer:', profile.email);
|
|
4275
4319
|
* ```
|
|
4276
4320
|
*/
|
|
@@ -4291,7 +4335,7 @@ declare class BrainerceClient {
|
|
|
4291
4335
|
*
|
|
4292
4336
|
* @example
|
|
4293
4337
|
* ```typescript
|
|
4294
|
-
* const address = await
|
|
4338
|
+
* const address = await client.addCustomerAddress('cust_123', {
|
|
4295
4339
|
* firstName: 'John',
|
|
4296
4340
|
* lastName: 'Doe',
|
|
4297
4341
|
* line1: '123 Main St',
|
|
@@ -4317,7 +4361,7 @@ declare class BrainerceClient {
|
|
|
4317
4361
|
*
|
|
4318
4362
|
* @example
|
|
4319
4363
|
* ```typescript
|
|
4320
|
-
* const orders = await
|
|
4364
|
+
* const orders = await client.getCustomerOrders('cust_123', { page: 1, limit: 10 });
|
|
4321
4365
|
* console.log(`Customer has ${orders.meta.total} total orders`);
|
|
4322
4366
|
* ```
|
|
4323
4367
|
*/
|
|
@@ -4331,7 +4375,7 @@ declare class BrainerceClient {
|
|
|
4331
4375
|
*
|
|
4332
4376
|
* @example
|
|
4333
4377
|
* ```typescript
|
|
4334
|
-
* const cart = await
|
|
4378
|
+
* const cart = await client.createCart();
|
|
4335
4379
|
* console.log('Cart session:', cart.sessionToken);
|
|
4336
4380
|
* // Store sessionToken in localStorage or cookie
|
|
4337
4381
|
* ```
|
|
@@ -4342,7 +4386,7 @@ declare class BrainerceClient {
|
|
|
4342
4386
|
*
|
|
4343
4387
|
* @example
|
|
4344
4388
|
* ```typescript
|
|
4345
|
-
* const cart = await
|
|
4389
|
+
* const cart = await client.getCartBySession('sess_abc123');
|
|
4346
4390
|
* console.log('Items in cart:', cart.itemCount);
|
|
4347
4391
|
* ```
|
|
4348
4392
|
*/
|
|
@@ -4352,7 +4396,7 @@ declare class BrainerceClient {
|
|
|
4352
4396
|
*
|
|
4353
4397
|
* @example
|
|
4354
4398
|
* ```typescript
|
|
4355
|
-
* const cart = await
|
|
4399
|
+
* const cart = await client.getCartByCustomer('cust_123');
|
|
4356
4400
|
* console.log('Customer cart total:', cart.subtotal);
|
|
4357
4401
|
* ```
|
|
4358
4402
|
*/
|
|
@@ -4366,7 +4410,7 @@ declare class BrainerceClient {
|
|
|
4366
4410
|
*
|
|
4367
4411
|
* @example
|
|
4368
4412
|
* ```typescript
|
|
4369
|
-
* const cart = await
|
|
4413
|
+
* const cart = await client.addToCart('cart_123', {
|
|
4370
4414
|
* productId: 'prod_abc',
|
|
4371
4415
|
* quantity: 2,
|
|
4372
4416
|
* notes: 'Gift wrap please',
|
|
@@ -4379,7 +4423,7 @@ declare class BrainerceClient {
|
|
|
4379
4423
|
*
|
|
4380
4424
|
* @example
|
|
4381
4425
|
* ```typescript
|
|
4382
|
-
* const cart = await
|
|
4426
|
+
* const cart = await client.updateCartItem('cart_123', 'item_456', { quantity: 3 });
|
|
4383
4427
|
* ```
|
|
4384
4428
|
*/
|
|
4385
4429
|
updateCartItem(cartId: string, itemId: string, data: UpdateCartItemDto): Promise<Cart>;
|
|
@@ -4388,7 +4432,7 @@ declare class BrainerceClient {
|
|
|
4388
4432
|
*
|
|
4389
4433
|
* @example
|
|
4390
4434
|
* ```typescript
|
|
4391
|
-
* const cart = await
|
|
4435
|
+
* const cart = await client.removeCartItem('cart_123', 'item_456');
|
|
4392
4436
|
* ```
|
|
4393
4437
|
*/
|
|
4394
4438
|
removeCartItem(cartId: string, itemId: string): Promise<Cart>;
|
|
@@ -4397,7 +4441,7 @@ declare class BrainerceClient {
|
|
|
4397
4441
|
*
|
|
4398
4442
|
* @example
|
|
4399
4443
|
* ```typescript
|
|
4400
|
-
* await
|
|
4444
|
+
* await client.clearCart('cart_123');
|
|
4401
4445
|
* ```
|
|
4402
4446
|
*/
|
|
4403
4447
|
clearCart(cartId: string): Promise<Cart>;
|
|
@@ -4406,7 +4450,7 @@ declare class BrainerceClient {
|
|
|
4406
4450
|
*
|
|
4407
4451
|
* @example
|
|
4408
4452
|
* ```typescript
|
|
4409
|
-
* const cart = await
|
|
4453
|
+
* const cart = await client.applyCoupon('cart_123', 'SAVE20');
|
|
4410
4454
|
* console.log('Discount:', cart.discountAmount);
|
|
4411
4455
|
* ```
|
|
4412
4456
|
*/
|
|
@@ -4416,7 +4460,7 @@ declare class BrainerceClient {
|
|
|
4416
4460
|
*
|
|
4417
4461
|
* @example
|
|
4418
4462
|
* ```typescript
|
|
4419
|
-
* const cart = await
|
|
4463
|
+
* const cart = await client.removeCoupon('cart_123');
|
|
4420
4464
|
* ```
|
|
4421
4465
|
*/
|
|
4422
4466
|
removeCoupon(cartId: string): Promise<Cart>;
|
|
@@ -4432,8 +4476,8 @@ declare class BrainerceClient {
|
|
|
4432
4476
|
* @example
|
|
4433
4477
|
* ```typescript
|
|
4434
4478
|
* // After customer logs in
|
|
4435
|
-
*
|
|
4436
|
-
* const cart = await
|
|
4479
|
+
* client.setCustomerToken(authResponse.token);
|
|
4480
|
+
* const cart = await client.linkCart('cart_123'); // cartId is REQUIRED
|
|
4437
4481
|
* // Cart is now linked to the customer
|
|
4438
4482
|
* ```
|
|
4439
4483
|
*/
|
|
@@ -4445,7 +4489,7 @@ declare class BrainerceClient {
|
|
|
4445
4489
|
* @example
|
|
4446
4490
|
* ```typescript
|
|
4447
4491
|
* // After customer logs in, merge their guest cart
|
|
4448
|
-
* const mergedCart = await
|
|
4492
|
+
* const mergedCart = await client.mergeCarts({
|
|
4449
4493
|
* sourceSessionToken: 'sess_guest_abc',
|
|
4450
4494
|
* targetCustomerId: 'cust_123',
|
|
4451
4495
|
* });
|
|
@@ -4458,7 +4502,7 @@ declare class BrainerceClient {
|
|
|
4458
4502
|
*
|
|
4459
4503
|
* @example
|
|
4460
4504
|
* ```typescript
|
|
4461
|
-
* const banners = await
|
|
4505
|
+
* const banners = await client.getDiscountBanners();
|
|
4462
4506
|
* banners.forEach(b => console.log(b.text));
|
|
4463
4507
|
* ```
|
|
4464
4508
|
*/
|
|
@@ -4472,7 +4516,7 @@ declare class BrainerceClient {
|
|
|
4472
4516
|
*
|
|
4473
4517
|
* @example
|
|
4474
4518
|
* ```typescript
|
|
4475
|
-
* const badge = await
|
|
4519
|
+
* const badge = await client.getProductDiscountBadge('prod_123');
|
|
4476
4520
|
* if (badge) {
|
|
4477
4521
|
* console.log(badge.badgeText); // e.g., "20% OFF"
|
|
4478
4522
|
* console.log(badge.discountedPrice); // e.g., "39.99"
|
|
@@ -4488,7 +4532,7 @@ declare class BrainerceClient {
|
|
|
4488
4532
|
*
|
|
4489
4533
|
* @example
|
|
4490
4534
|
* ```typescript
|
|
4491
|
-
* const nudges = await
|
|
4535
|
+
* const nudges = await client.getCartNudges('cart_123');
|
|
4492
4536
|
* nudges.forEach(n => {
|
|
4493
4537
|
* console.log(n.text); // e.g., "Add $12.50 more for free shipping!"
|
|
4494
4538
|
* });
|
|
@@ -4504,7 +4548,7 @@ declare class BrainerceClient {
|
|
|
4504
4548
|
*
|
|
4505
4549
|
* @example
|
|
4506
4550
|
* ```typescript
|
|
4507
|
-
* const recs = await
|
|
4551
|
+
* const recs = await client.getProductRecommendations('prod_123');
|
|
4508
4552
|
* console.log(recs.crossSells); // complementary products
|
|
4509
4553
|
* console.log(recs.upsells); // premium alternatives
|
|
4510
4554
|
* console.log(recs.related); // related products
|
|
@@ -4520,7 +4564,7 @@ declare class BrainerceClient {
|
|
|
4520
4564
|
*
|
|
4521
4565
|
* @example
|
|
4522
4566
|
* ```typescript
|
|
4523
|
-
* const recs = await
|
|
4567
|
+
* const recs = await client.getCartRecommendations('cart_123', 6);
|
|
4524
4568
|
* recs.recommendations.forEach(product => {
|
|
4525
4569
|
* console.log(product.name, product.basePrice);
|
|
4526
4570
|
* });
|
|
@@ -4533,7 +4577,7 @@ declare class BrainerceClient {
|
|
|
4533
4577
|
*
|
|
4534
4578
|
* @example
|
|
4535
4579
|
* ```typescript
|
|
4536
|
-
* if (
|
|
4580
|
+
* if (client.isCustomerLoggedIn()) {
|
|
4537
4581
|
* console.log('Cart will be stored on server');
|
|
4538
4582
|
* } else {
|
|
4539
4583
|
* console.log('Cart will be stored in localStorage');
|
|
@@ -4561,7 +4605,7 @@ declare class BrainerceClient {
|
|
|
4561
4605
|
* @example
|
|
4562
4606
|
* ```typescript
|
|
4563
4607
|
* // Works the same whether logged in or not
|
|
4564
|
-
* await
|
|
4608
|
+
* await client.smartAddToCart({
|
|
4565
4609
|
* productId: 'prod_123',
|
|
4566
4610
|
* quantity: 2,
|
|
4567
4611
|
* name: 'Cool Product', // Optional: for localStorage display
|
|
@@ -4575,7 +4619,7 @@ declare class BrainerceClient {
|
|
|
4575
4619
|
*
|
|
4576
4620
|
* @example
|
|
4577
4621
|
* ```typescript
|
|
4578
|
-
* const cart = await
|
|
4622
|
+
* const cart = await client.smartGetCart();
|
|
4579
4623
|
* console.log('Items:', cart.items.length);
|
|
4580
4624
|
* ```
|
|
4581
4625
|
*/
|
|
@@ -4585,8 +4629,8 @@ declare class BrainerceClient {
|
|
|
4585
4629
|
*
|
|
4586
4630
|
* @example
|
|
4587
4631
|
* ```typescript
|
|
4588
|
-
* await
|
|
4589
|
-
* await
|
|
4632
|
+
* await client.smartUpdateCartItem('prod_123', 3); // Set quantity to 3
|
|
4633
|
+
* await client.smartUpdateCartItem('prod_123', 0); // Remove item
|
|
4590
4634
|
* ```
|
|
4591
4635
|
*/
|
|
4592
4636
|
smartUpdateCartItem(productId: string, quantity: number, variantId?: string): Promise<Cart | LocalCart>;
|
|
@@ -4595,8 +4639,8 @@ declare class BrainerceClient {
|
|
|
4595
4639
|
*
|
|
4596
4640
|
* @example
|
|
4597
4641
|
* ```typescript
|
|
4598
|
-
* await
|
|
4599
|
-
* await
|
|
4642
|
+
* await client.smartRemoveFromCart('prod_123');
|
|
4643
|
+
* await client.smartRemoveFromCart('prod_456', 'variant_789');
|
|
4600
4644
|
* ```
|
|
4601
4645
|
*/
|
|
4602
4646
|
smartRemoveFromCart(productId: string, variantId?: string): Promise<Cart | LocalCart>;
|
|
@@ -4614,11 +4658,11 @@ declare class BrainerceClient {
|
|
|
4614
4658
|
* @example
|
|
4615
4659
|
* ```typescript
|
|
4616
4660
|
* // Customer logs in
|
|
4617
|
-
* const auth = await
|
|
4618
|
-
*
|
|
4661
|
+
* const auth = await client.login(email, password);
|
|
4662
|
+
* client.setCustomerToken(auth.token);
|
|
4619
4663
|
*
|
|
4620
4664
|
* // Sync their local cart to server
|
|
4621
|
-
* const cart = await
|
|
4665
|
+
* const cart = await client.syncCartOnLogin();
|
|
4622
4666
|
* console.log('Cart synced, items:', cart.items.length);
|
|
4623
4667
|
* ```
|
|
4624
4668
|
*/
|
|
@@ -4631,11 +4675,11 @@ declare class BrainerceClient {
|
|
|
4631
4675
|
*
|
|
4632
4676
|
* @example
|
|
4633
4677
|
* ```typescript
|
|
4634
|
-
*
|
|
4635
|
-
*
|
|
4678
|
+
* client.clearCustomerToken();
|
|
4679
|
+
* client.onLogout();
|
|
4636
4680
|
*
|
|
4637
4681
|
* // Now back to guest mode - cart uses localStorage
|
|
4638
|
-
* await
|
|
4682
|
+
* await client.smartAddToCart({ productId: 'prod_123', quantity: 1 });
|
|
4639
4683
|
* ```
|
|
4640
4684
|
*/
|
|
4641
4685
|
onLogout(): void;
|
|
@@ -4649,8 +4693,8 @@ declare class BrainerceClient {
|
|
|
4649
4693
|
* ```typescript
|
|
4650
4694
|
* // After payment success
|
|
4651
4695
|
* if (paymentStatus === 'succeeded') {
|
|
4652
|
-
*
|
|
4653
|
-
*
|
|
4696
|
+
* client.onCheckoutComplete();
|
|
4697
|
+
* client.clearLocalCart(); // Also clear localStorage for guests
|
|
4654
4698
|
* }
|
|
4655
4699
|
* ```
|
|
4656
4700
|
*/
|
|
@@ -4667,10 +4711,10 @@ declare class BrainerceClient {
|
|
|
4667
4711
|
* @example
|
|
4668
4712
|
* ```typescript
|
|
4669
4713
|
* // Full cart checkout (default)
|
|
4670
|
-
* const checkout = await
|
|
4714
|
+
* const checkout = await client.createCheckout({ cartId: 'cart_123' });
|
|
4671
4715
|
*
|
|
4672
4716
|
* // Partial checkout - only buy selected items
|
|
4673
|
-
* const checkout = await
|
|
4717
|
+
* const checkout = await client.createCheckout({
|
|
4674
4718
|
* cartId: 'cart_123',
|
|
4675
4719
|
* selectedItemIds: ['item_1', 'item_3'], // Only these items will be purchased
|
|
4676
4720
|
* });
|
|
@@ -4682,7 +4726,7 @@ declare class BrainerceClient {
|
|
|
4682
4726
|
*
|
|
4683
4727
|
* @example
|
|
4684
4728
|
* ```typescript
|
|
4685
|
-
* const checkout = await
|
|
4729
|
+
* const checkout = await client.getCheckout('checkout_123');
|
|
4686
4730
|
* console.log('Status:', checkout.status);
|
|
4687
4731
|
* ```
|
|
4688
4732
|
*/
|
|
@@ -4692,7 +4736,7 @@ declare class BrainerceClient {
|
|
|
4692
4736
|
*
|
|
4693
4737
|
* @example
|
|
4694
4738
|
* ```typescript
|
|
4695
|
-
* const checkout = await
|
|
4739
|
+
* const checkout = await client.setCheckoutCustomer('checkout_123', {
|
|
4696
4740
|
* email: 'customer@example.com',
|
|
4697
4741
|
* firstName: 'John',
|
|
4698
4742
|
* lastName: 'Doe',
|
|
@@ -4709,7 +4753,7 @@ declare class BrainerceClient {
|
|
|
4709
4753
|
*
|
|
4710
4754
|
* @example
|
|
4711
4755
|
* ```typescript
|
|
4712
|
-
* const { checkout, rates } = await
|
|
4756
|
+
* const { checkout, rates } = await client.setShippingAddress('checkout_123', {
|
|
4713
4757
|
* email: 'customer@example.com', // Required!
|
|
4714
4758
|
* firstName: 'John',
|
|
4715
4759
|
* lastName: 'Doe',
|
|
@@ -4729,7 +4773,7 @@ declare class BrainerceClient {
|
|
|
4729
4773
|
*
|
|
4730
4774
|
* @example
|
|
4731
4775
|
* ```typescript
|
|
4732
|
-
* const rates = await
|
|
4776
|
+
* const rates = await client.getShippingRates('checkout_123');
|
|
4733
4777
|
* console.log('Shipping options:', rates);
|
|
4734
4778
|
* ```
|
|
4735
4779
|
*/
|
|
@@ -4739,7 +4783,7 @@ declare class BrainerceClient {
|
|
|
4739
4783
|
*
|
|
4740
4784
|
* @example
|
|
4741
4785
|
* ```typescript
|
|
4742
|
-
* const checkout = await
|
|
4786
|
+
* const checkout = await client.selectShippingMethod('checkout_123', 'rate_express');
|
|
4743
4787
|
* console.log('Shipping cost:', checkout.shippingAmount);
|
|
4744
4788
|
* ```
|
|
4745
4789
|
*/
|
|
@@ -4751,13 +4795,13 @@ declare class BrainerceClient {
|
|
|
4751
4795
|
* @example
|
|
4752
4796
|
* ```typescript
|
|
4753
4797
|
* // Use same as shipping
|
|
4754
|
-
* const checkout = await
|
|
4798
|
+
* const checkout = await client.setBillingAddress('checkout_123', {
|
|
4755
4799
|
* ...shippingAddress,
|
|
4756
4800
|
* sameAsShipping: true,
|
|
4757
4801
|
* });
|
|
4758
4802
|
*
|
|
4759
4803
|
* // Or set different billing address
|
|
4760
|
-
* const checkout = await
|
|
4804
|
+
* const checkout = await client.setBillingAddress('checkout_123', {
|
|
4761
4805
|
* firstName: 'John',
|
|
4762
4806
|
* lastName: 'Doe',
|
|
4763
4807
|
* line1: '456 Business Ave',
|
|
@@ -4775,7 +4819,7 @@ declare class BrainerceClient {
|
|
|
4775
4819
|
*
|
|
4776
4820
|
* @example
|
|
4777
4821
|
* ```typescript
|
|
4778
|
-
* const { orderId } = await
|
|
4822
|
+
* const { orderId } = await client.completeCheckout('checkout_123');
|
|
4779
4823
|
* console.log('Order created:', orderId);
|
|
4780
4824
|
* ```
|
|
4781
4825
|
*/
|
|
@@ -4791,7 +4835,7 @@ declare class BrainerceClient {
|
|
|
4791
4835
|
*
|
|
4792
4836
|
* @example
|
|
4793
4837
|
* ```typescript
|
|
4794
|
-
* const config = await
|
|
4838
|
+
* const config = await client.getPaymentConfig();
|
|
4795
4839
|
*
|
|
4796
4840
|
* // Initialize Stripe.js with the public key
|
|
4797
4841
|
* const stripe = Stripe(config.publicKey);
|
|
@@ -4816,7 +4860,7 @@ declare class BrainerceClient {
|
|
|
4816
4860
|
*
|
|
4817
4861
|
* @example
|
|
4818
4862
|
* ```typescript
|
|
4819
|
-
* const { providers, hasPayments, defaultProvider } = await
|
|
4863
|
+
* const { providers, hasPayments, defaultProvider } = await client.getPaymentProviders();
|
|
4820
4864
|
*
|
|
4821
4865
|
* if (!hasPayments) {
|
|
4822
4866
|
* // Show error: "Payment is not configured for this store"
|
|
@@ -4860,7 +4904,7 @@ declare class BrainerceClient {
|
|
|
4860
4904
|
* @example
|
|
4861
4905
|
* ```typescript
|
|
4862
4906
|
* // After completing checkout steps (shipping address, method, etc.)
|
|
4863
|
-
* const intent = await
|
|
4907
|
+
* const intent = await client.createPaymentIntent(checkout.id, {
|
|
4864
4908
|
* successUrl: `${window.location.origin}/order-confirmation?checkout_id=${checkout.id}`,
|
|
4865
4909
|
* cancelUrl: `${window.location.origin}/checkout?error=cancelled`,
|
|
4866
4910
|
* });
|
|
@@ -4899,7 +4943,7 @@ declare class BrainerceClient {
|
|
|
4899
4943
|
* @example
|
|
4900
4944
|
* ```typescript
|
|
4901
4945
|
* // After returning from Stripe redirect
|
|
4902
|
-
* const status = await
|
|
4946
|
+
* const status = await client.getPaymentStatus(checkoutId);
|
|
4903
4947
|
*
|
|
4904
4948
|
* if (status.status === 'succeeded') {
|
|
4905
4949
|
* // Redirect to order confirmation
|
|
@@ -4941,7 +4985,7 @@ declare class BrainerceClient {
|
|
|
4941
4985
|
* @example
|
|
4942
4986
|
* ```typescript
|
|
4943
4987
|
* // Basic usage - wait up to 30 seconds
|
|
4944
|
-
* const result = await
|
|
4988
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
4945
4989
|
*
|
|
4946
4990
|
* if (result.success) {
|
|
4947
4991
|
* console.log('Order created:', result.status.orderNumber);
|
|
@@ -4954,7 +4998,7 @@ declare class BrainerceClient {
|
|
|
4954
4998
|
* @example
|
|
4955
4999
|
* ```typescript
|
|
4956
5000
|
* // With progress callback for UI updates
|
|
4957
|
-
* const result = await
|
|
5001
|
+
* const result = await client.waitForOrder(checkoutId, {
|
|
4958
5002
|
* maxWaitMs: 20000,
|
|
4959
5003
|
* onPollAttempt: (attempt, status) => {
|
|
4960
5004
|
* setLoadingMessage(`Confirming order... (attempt ${attempt})`);
|
|
@@ -4977,7 +5021,7 @@ declare class BrainerceClient {
|
|
|
4977
5021
|
*
|
|
4978
5022
|
* @example
|
|
4979
5023
|
* ```typescript
|
|
4980
|
-
* const cart =
|
|
5024
|
+
* const cart = client.getLocalCart();
|
|
4981
5025
|
* console.log('Items in cart:', cart.items.length);
|
|
4982
5026
|
* ```
|
|
4983
5027
|
*/
|
|
@@ -5002,7 +5046,7 @@ declare class BrainerceClient {
|
|
|
5002
5046
|
*
|
|
5003
5047
|
* @example
|
|
5004
5048
|
* ```typescript
|
|
5005
|
-
*
|
|
5049
|
+
* client.addToLocalCart({
|
|
5006
5050
|
* productId: 'prod_123',
|
|
5007
5051
|
* quantity: 2,
|
|
5008
5052
|
* name: 'Cool Shirt',
|
|
@@ -5017,8 +5061,8 @@ declare class BrainerceClient {
|
|
|
5017
5061
|
*
|
|
5018
5062
|
* @example
|
|
5019
5063
|
* ```typescript
|
|
5020
|
-
*
|
|
5021
|
-
*
|
|
5064
|
+
* client.updateLocalCartItem('prod_123', 3); // Set quantity to 3
|
|
5065
|
+
* client.updateLocalCartItem('prod_123', 0); // Remove item
|
|
5022
5066
|
* ```
|
|
5023
5067
|
*/
|
|
5024
5068
|
updateLocalCartItem(productId: string, quantity: number, variantId?: string): LocalCart;
|
|
@@ -5027,8 +5071,8 @@ declare class BrainerceClient {
|
|
|
5027
5071
|
*
|
|
5028
5072
|
* @example
|
|
5029
5073
|
* ```typescript
|
|
5030
|
-
*
|
|
5031
|
-
*
|
|
5074
|
+
* client.removeFromLocalCart('prod_123');
|
|
5075
|
+
* client.removeFromLocalCart('prod_456', 'variant_789');
|
|
5032
5076
|
* ```
|
|
5033
5077
|
*/
|
|
5034
5078
|
removeFromLocalCart(productId: string, variantId?: string): LocalCart;
|
|
@@ -5037,7 +5081,7 @@ declare class BrainerceClient {
|
|
|
5037
5081
|
*
|
|
5038
5082
|
* @example
|
|
5039
5083
|
* ```typescript
|
|
5040
|
-
*
|
|
5084
|
+
* client.clearLocalCart();
|
|
5041
5085
|
* ```
|
|
5042
5086
|
*/
|
|
5043
5087
|
clearLocalCart(): LocalCart;
|
|
@@ -5046,7 +5090,7 @@ declare class BrainerceClient {
|
|
|
5046
5090
|
*
|
|
5047
5091
|
* @example
|
|
5048
5092
|
* ```typescript
|
|
5049
|
-
*
|
|
5093
|
+
* client.setLocalCartCustomer({
|
|
5050
5094
|
* email: 'john@example.com',
|
|
5051
5095
|
* firstName: 'John',
|
|
5052
5096
|
* lastName: 'Doe',
|
|
@@ -5059,7 +5103,7 @@ declare class BrainerceClient {
|
|
|
5059
5103
|
*
|
|
5060
5104
|
* @example
|
|
5061
5105
|
* ```typescript
|
|
5062
|
-
*
|
|
5106
|
+
* client.setLocalCartShippingAddress({
|
|
5063
5107
|
* firstName: 'John',
|
|
5064
5108
|
* lastName: 'Doe',
|
|
5065
5109
|
* line1: '123 Main St',
|
|
@@ -5093,12 +5137,12 @@ declare class BrainerceClient {
|
|
|
5093
5137
|
* @example
|
|
5094
5138
|
* ```typescript
|
|
5095
5139
|
* // Build up the local cart first
|
|
5096
|
-
*
|
|
5097
|
-
*
|
|
5098
|
-
*
|
|
5140
|
+
* client.addToLocalCart({ productId: 'prod_123', quantity: 2 });
|
|
5141
|
+
* client.setLocalCartCustomer({ email: 'john@example.com', firstName: 'John' });
|
|
5142
|
+
* client.setLocalCartShippingAddress({ ... });
|
|
5099
5143
|
*
|
|
5100
5144
|
* // Then submit the order - tracking is automatic if enabled in admin!
|
|
5101
|
-
* const result = await
|
|
5145
|
+
* const result = await client.submitGuestOrder();
|
|
5102
5146
|
* console.log('Order created:', result.orderId);
|
|
5103
5147
|
*
|
|
5104
5148
|
* // Cart is automatically cleared on success
|
|
@@ -5131,14 +5175,14 @@ declare class BrainerceClient {
|
|
|
5131
5175
|
* @example
|
|
5132
5176
|
* ```typescript
|
|
5133
5177
|
* // Full checkout (all items)
|
|
5134
|
-
* const result = await
|
|
5178
|
+
* const result = await client.startGuestCheckout();
|
|
5135
5179
|
*
|
|
5136
5180
|
* // Partial checkout (only items at index 0 and 2)
|
|
5137
|
-
* const result = await
|
|
5181
|
+
* const result = await client.startGuestCheckout({ selectedIndices: [0, 2] });
|
|
5138
5182
|
*
|
|
5139
5183
|
* if (result.tracked) {
|
|
5140
5184
|
* // IMPORTANT: Fetch checkout and use checkout.lineItems for Order Summary!
|
|
5141
|
-
* const checkout = await
|
|
5185
|
+
* const checkout = await client.getCheckout(result.checkoutId);
|
|
5142
5186
|
*
|
|
5143
5187
|
* // Display Order Summary using checkout.lineItems (NOT localCart.items!)
|
|
5144
5188
|
* // checkout.lineItems contains ONLY the selected items
|
|
@@ -5147,15 +5191,15 @@ declare class BrainerceClient {
|
|
|
5147
5191
|
* });
|
|
5148
5192
|
*
|
|
5149
5193
|
* // Update checkout with address
|
|
5150
|
-
* await
|
|
5194
|
+
* await client.updateGuestCheckoutAddress(result.checkoutId, {
|
|
5151
5195
|
* shippingAddress: { ... },
|
|
5152
5196
|
* });
|
|
5153
5197
|
*
|
|
5154
5198
|
* // After payment success, call handlePaymentSuccess() to clear cart
|
|
5155
|
-
*
|
|
5199
|
+
* client.handlePaymentSuccess(result.checkoutId);
|
|
5156
5200
|
* } else {
|
|
5157
5201
|
* // Tracking not enabled, use regular submitGuestOrder
|
|
5158
|
-
* const order = await
|
|
5202
|
+
* const order = await client.submitGuestOrder();
|
|
5159
5203
|
* }
|
|
5160
5204
|
* ```
|
|
5161
5205
|
*/
|
|
@@ -5186,7 +5230,7 @@ declare class BrainerceClient {
|
|
|
5186
5230
|
* @example
|
|
5187
5231
|
* ```typescript
|
|
5188
5232
|
* // After partial checkout success, remove purchased items
|
|
5189
|
-
*
|
|
5233
|
+
* client.removeLocalCartItemsByIndex([0, 2]); // Removes items at index 0 and 2
|
|
5190
5234
|
* ```
|
|
5191
5235
|
*/
|
|
5192
5236
|
removeLocalCartItemsByIndex(indices: number[]): void;
|
|
@@ -5210,13 +5254,13 @@ declare class BrainerceClient {
|
|
|
5210
5254
|
*
|
|
5211
5255
|
* @example Full checkout (clears entire cart):
|
|
5212
5256
|
* ```typescript
|
|
5213
|
-
* await
|
|
5257
|
+
* await client.completeGuestCheckout(checkoutId);
|
|
5214
5258
|
* ```
|
|
5215
5259
|
*
|
|
5216
5260
|
* @example Partial checkout (removes only purchased items):
|
|
5217
5261
|
* ```typescript
|
|
5218
5262
|
* // User selected items at indices 0 and 2 for checkout
|
|
5219
|
-
* await
|
|
5263
|
+
* await client.completeGuestCheckout(checkoutId, { selectedIndices: [0, 2] });
|
|
5220
5264
|
* // Items at indices 1, 3, etc. remain in cart
|
|
5221
5265
|
* ```
|
|
5222
5266
|
*/
|
|
@@ -5232,7 +5276,7 @@ declare class BrainerceClient {
|
|
|
5232
5276
|
*
|
|
5233
5277
|
* @example
|
|
5234
5278
|
* ```typescript
|
|
5235
|
-
* const activeCheckout =
|
|
5279
|
+
* const activeCheckout = client.getActiveGuestCheckout();
|
|
5236
5280
|
* if (activeCheckout) {
|
|
5237
5281
|
* console.log('Active checkout:', activeCheckout.checkoutId);
|
|
5238
5282
|
* console.log('Partial checkout:', activeCheckout.selectedIndices?.length);
|
|
@@ -5275,7 +5319,7 @@ declare class BrainerceClient {
|
|
|
5275
5319
|
*
|
|
5276
5320
|
* if (!error && paymentIntent?.status === 'succeeded') {
|
|
5277
5321
|
* // Clear the cart automatically - handles all scenarios!
|
|
5278
|
-
* const result =
|
|
5322
|
+
* const result = client.handlePaymentSuccess(checkoutId);
|
|
5279
5323
|
* console.log('Cart cleared:', result.cleared);
|
|
5280
5324
|
* console.log('User type:', result.userType); // 'guest' or 'customer'
|
|
5281
5325
|
* }
|
|
@@ -5286,7 +5330,7 @@ declare class BrainerceClient {
|
|
|
5286
5330
|
* // On success page (after redirect)
|
|
5287
5331
|
* const checkoutId = new URLSearchParams(location.search).get('checkout_id');
|
|
5288
5332
|
* if (checkoutId) {
|
|
5289
|
-
*
|
|
5333
|
+
* client.handlePaymentSuccess(checkoutId);
|
|
5290
5334
|
* }
|
|
5291
5335
|
* ```
|
|
5292
5336
|
*/
|
|
@@ -5307,7 +5351,7 @@ declare class BrainerceClient {
|
|
|
5307
5351
|
*
|
|
5308
5352
|
* @example
|
|
5309
5353
|
* ```typescript
|
|
5310
|
-
* const result = await
|
|
5354
|
+
* const result = await client.createGuestOrder({
|
|
5311
5355
|
* items: [{ productId: 'prod_123', quantity: 2 }],
|
|
5312
5356
|
* customer: { email: 'john@example.com' },
|
|
5313
5357
|
* shippingAddress: { firstName: 'John', ... },
|
|
@@ -5321,9 +5365,9 @@ declare class BrainerceClient {
|
|
|
5321
5365
|
*
|
|
5322
5366
|
* @example
|
|
5323
5367
|
* ```typescript
|
|
5324
|
-
* const auth = await
|
|
5325
|
-
*
|
|
5326
|
-
* const profile = await
|
|
5368
|
+
* const auth = await client.loginCustomer('user@example.com', 'password');
|
|
5369
|
+
* client.setCustomerToken(auth.token);
|
|
5370
|
+
* const profile = await client.getMyProfile();
|
|
5327
5371
|
* ```
|
|
5328
5372
|
*/
|
|
5329
5373
|
getMyProfile(): Promise<CustomerProfile>;
|
|
@@ -5334,9 +5378,9 @@ declare class BrainerceClient {
|
|
|
5334
5378
|
*
|
|
5335
5379
|
* @example
|
|
5336
5380
|
* ```typescript
|
|
5337
|
-
*
|
|
5381
|
+
* client.setCustomerToken(auth.token);
|
|
5338
5382
|
*
|
|
5339
|
-
* const prefill = await
|
|
5383
|
+
* const prefill = await client.getCheckoutPrefillData();
|
|
5340
5384
|
*
|
|
5341
5385
|
* if (prefill.shippingAddress) {
|
|
5342
5386
|
* // Pre-fill shipping form with customer's default address
|
|
@@ -5373,7 +5417,7 @@ declare class BrainerceClient {
|
|
|
5373
5417
|
*
|
|
5374
5418
|
* @example
|
|
5375
5419
|
* ```typescript
|
|
5376
|
-
* const links = await
|
|
5420
|
+
* const links = await client.getOrderDownloads('order_123');
|
|
5377
5421
|
* for (const link of links) {
|
|
5378
5422
|
* console.log(`${link.productName}: ${link.downloadUrl}`);
|
|
5379
5423
|
* }
|
|
@@ -5412,7 +5456,7 @@ declare class BrainerceClient {
|
|
|
5412
5456
|
*
|
|
5413
5457
|
* @example
|
|
5414
5458
|
* ```typescript
|
|
5415
|
-
* const integrations = await
|
|
5459
|
+
* const integrations = await client.getCustomApiIntegrations();
|
|
5416
5460
|
* integrations.forEach(api => {
|
|
5417
5461
|
* console.log(`${api.name}: ${api.status}`);
|
|
5418
5462
|
* });
|
|
@@ -5425,7 +5469,7 @@ declare class BrainerceClient {
|
|
|
5425
5469
|
*
|
|
5426
5470
|
* @example
|
|
5427
5471
|
* ```typescript
|
|
5428
|
-
* const api = await
|
|
5472
|
+
* const api = await client.getCustomApiIntegration('api_123');
|
|
5429
5473
|
* console.log(`API: ${api.name}, URL: ${api.baseUrl}`);
|
|
5430
5474
|
* ```
|
|
5431
5475
|
*/
|
|
@@ -5436,7 +5480,7 @@ declare class BrainerceClient {
|
|
|
5436
5480
|
*
|
|
5437
5481
|
* @example
|
|
5438
5482
|
* ```typescript
|
|
5439
|
-
* const api = await
|
|
5483
|
+
* const api = await client.createCustomApiIntegration({
|
|
5440
5484
|
* name: 'My External API',
|
|
5441
5485
|
* baseUrl: 'https://api.example.com',
|
|
5442
5486
|
* authType: 'api_key',
|
|
@@ -5460,7 +5504,7 @@ declare class BrainerceClient {
|
|
|
5460
5504
|
*
|
|
5461
5505
|
* @example
|
|
5462
5506
|
* ```typescript
|
|
5463
|
-
* const api = await
|
|
5507
|
+
* const api = await client.updateCustomApiIntegration('api_123', {
|
|
5464
5508
|
* enabled: false,
|
|
5465
5509
|
* syncConfig: { products: true, orders: false, inventory: true },
|
|
5466
5510
|
* });
|
|
@@ -5473,7 +5517,7 @@ declare class BrainerceClient {
|
|
|
5473
5517
|
*
|
|
5474
5518
|
* @example
|
|
5475
5519
|
* ```typescript
|
|
5476
|
-
* await
|
|
5520
|
+
* await client.deleteCustomApiIntegration('api_123');
|
|
5477
5521
|
* ```
|
|
5478
5522
|
*/
|
|
5479
5523
|
deleteCustomApiIntegration(integrationId: string): Promise<void>;
|
|
@@ -5483,7 +5527,7 @@ declare class BrainerceClient {
|
|
|
5483
5527
|
*
|
|
5484
5528
|
* @example
|
|
5485
5529
|
* ```typescript
|
|
5486
|
-
* const result = await
|
|
5530
|
+
* const result = await client.testCustomApiConnection('api_123');
|
|
5487
5531
|
* if (result.success) {
|
|
5488
5532
|
* console.log(`Connection OK, latency: ${result.latency}ms`);
|
|
5489
5533
|
* } else {
|
|
@@ -5503,7 +5547,7 @@ declare class BrainerceClient {
|
|
|
5503
5547
|
*
|
|
5504
5548
|
* @example
|
|
5505
5549
|
* ```typescript
|
|
5506
|
-
* const availability = await
|
|
5550
|
+
* const availability = await client.getAvailability(['prod_123', 'prod_456']);
|
|
5507
5551
|
* availability.forEach(item => {
|
|
5508
5552
|
* if (!item.canPurchase) {
|
|
5509
5553
|
* console.log(`${item.productId}: Cannot purchase`);
|
|
@@ -5529,7 +5573,7 @@ declare class BrainerceClient {
|
|
|
5529
5573
|
* @example
|
|
5530
5574
|
* ```typescript
|
|
5531
5575
|
* // Extend reservation when customer shows activity
|
|
5532
|
-
* const result = await
|
|
5576
|
+
* const result = await client.extendReservation({ checkoutId: 'chk_123' });
|
|
5533
5577
|
* if (result.success) {
|
|
5534
5578
|
* console.log(`Reservation extended until ${result.reservation.expiresAt}`);
|
|
5535
5579
|
* }
|
|
@@ -5551,7 +5595,7 @@ declare class BrainerceClient {
|
|
|
5551
5595
|
* @example
|
|
5552
5596
|
* ```typescript
|
|
5553
5597
|
* // Release reservation when customer abandons checkout
|
|
5554
|
-
* await
|
|
5598
|
+
* await client.releaseReservation({ checkoutId: 'chk_123' });
|
|
5555
5599
|
* ```
|
|
5556
5600
|
*/
|
|
5557
5601
|
releaseReservation(options: {
|
|
@@ -5564,7 +5608,7 @@ declare class BrainerceClient {
|
|
|
5564
5608
|
*
|
|
5565
5609
|
* @example
|
|
5566
5610
|
* ```typescript
|
|
5567
|
-
* const categories = await
|
|
5611
|
+
* const categories = await client.listCategories({ page: 1, limit: 20 });
|
|
5568
5612
|
* console.log(`Found ${categories.meta.total} categories`);
|
|
5569
5613
|
* ```
|
|
5570
5614
|
*/
|
|
@@ -5580,7 +5624,7 @@ declare class BrainerceClient {
|
|
|
5580
5624
|
*
|
|
5581
5625
|
* @example
|
|
5582
5626
|
* ```typescript
|
|
5583
|
-
* const category = await
|
|
5627
|
+
* const category = await client.createCategory({
|
|
5584
5628
|
* name: 'Electronics',
|
|
5585
5629
|
* slug: 'electronics',
|
|
5586
5630
|
* description: 'Electronic devices and accessories',
|
|
@@ -5614,7 +5658,7 @@ declare class BrainerceClient {
|
|
|
5614
5658
|
*
|
|
5615
5659
|
* @example
|
|
5616
5660
|
* ```typescript
|
|
5617
|
-
* const brand = await
|
|
5661
|
+
* const brand = await client.createBrand({
|
|
5618
5662
|
* name: 'Nike',
|
|
5619
5663
|
* slug: 'nike',
|
|
5620
5664
|
* logoUrl: 'https://example.com/nike-logo.png',
|
|
@@ -5648,7 +5692,7 @@ declare class BrainerceClient {
|
|
|
5648
5692
|
*
|
|
5649
5693
|
* @example
|
|
5650
5694
|
* ```typescript
|
|
5651
|
-
* const tag = await
|
|
5695
|
+
* const tag = await client.createTag({
|
|
5652
5696
|
* name: 'New Arrival',
|
|
5653
5697
|
* slug: 'new-arrival',
|
|
5654
5698
|
* });
|
|
@@ -5681,7 +5725,7 @@ declare class BrainerceClient {
|
|
|
5681
5725
|
*
|
|
5682
5726
|
* @example
|
|
5683
5727
|
* ```typescript
|
|
5684
|
-
* const attribute = await
|
|
5728
|
+
* const attribute = await client.createAttribute({
|
|
5685
5729
|
* name: 'Color',
|
|
5686
5730
|
* slug: 'color',
|
|
5687
5731
|
* source: 'custom',
|
|
@@ -5710,7 +5754,7 @@ declare class BrainerceClient {
|
|
|
5710
5754
|
*
|
|
5711
5755
|
* @example
|
|
5712
5756
|
* ```typescript
|
|
5713
|
-
* const option = await
|
|
5757
|
+
* const option = await client.createAttributeOption('attr_123', {
|
|
5714
5758
|
* value: 'Red',
|
|
5715
5759
|
* slug: 'red',
|
|
5716
5760
|
* sortOrder: 1,
|
|
@@ -5744,7 +5788,7 @@ declare class BrainerceClient {
|
|
|
5744
5788
|
*
|
|
5745
5789
|
* @example
|
|
5746
5790
|
* ```typescript
|
|
5747
|
-
* const zone = await
|
|
5791
|
+
* const zone = await client.createShippingZone({
|
|
5748
5792
|
* name: 'US Domestic',
|
|
5749
5793
|
* countries: ['US'],
|
|
5750
5794
|
* regions: ['CA', 'NY', 'TX'],
|
|
@@ -5773,7 +5817,7 @@ declare class BrainerceClient {
|
|
|
5773
5817
|
*
|
|
5774
5818
|
* @example
|
|
5775
5819
|
* ```typescript
|
|
5776
|
-
* const rate = await
|
|
5820
|
+
* const rate = await client.createZoneShippingRate('zone_123', {
|
|
5777
5821
|
* name: 'Standard Shipping',
|
|
5778
5822
|
* type: 'flat',
|
|
5779
5823
|
* price: 5.99,
|
|
@@ -5809,7 +5853,7 @@ declare class BrainerceClient {
|
|
|
5809
5853
|
*
|
|
5810
5854
|
* @example
|
|
5811
5855
|
* ```typescript
|
|
5812
|
-
* const rate = await
|
|
5856
|
+
* const rate = await client.createTaxRate({
|
|
5813
5857
|
* name: 'California Sales Tax',
|
|
5814
5858
|
* rate: 7.25,
|
|
5815
5859
|
* country: 'US',
|
|
@@ -5853,7 +5897,7 @@ declare class BrainerceClient {
|
|
|
5853
5897
|
*
|
|
5854
5898
|
* @example
|
|
5855
5899
|
* ```typescript
|
|
5856
|
-
* const definition = await
|
|
5900
|
+
* const definition = await client.createMetafieldDefinition({
|
|
5857
5901
|
* name: 'Care Instructions',
|
|
5858
5902
|
* key: 'care_instructions',
|
|
5859
5903
|
* type: 'multi_line_text',
|
|
@@ -5883,7 +5927,7 @@ declare class BrainerceClient {
|
|
|
5883
5927
|
*
|
|
5884
5928
|
* @example
|
|
5885
5929
|
* ```typescript
|
|
5886
|
-
* const metafield = await
|
|
5930
|
+
* const metafield = await client.setProductMetafield('prod_123', 'def_456', {
|
|
5887
5931
|
* value: 'Machine wash cold, tumble dry low',
|
|
5888
5932
|
* });
|
|
5889
5933
|
* ```
|
|
@@ -5928,7 +5972,7 @@ declare class BrainerceClient {
|
|
|
5928
5972
|
*
|
|
5929
5973
|
* @example
|
|
5930
5974
|
* ```typescript
|
|
5931
|
-
* const { members, invitations } = await
|
|
5975
|
+
* const { members, invitations } = await client.getStoreTeam('store_id');
|
|
5932
5976
|
* ```
|
|
5933
5977
|
*/
|
|
5934
5978
|
getStoreTeam(storeId: string): Promise<StoreTeamResponse>;
|
|
@@ -5938,7 +5982,7 @@ declare class BrainerceClient {
|
|
|
5938
5982
|
*
|
|
5939
5983
|
* @example
|
|
5940
5984
|
* ```typescript
|
|
5941
|
-
* const invitation = await
|
|
5985
|
+
* const invitation = await client.inviteStoreMember('store_id', {
|
|
5942
5986
|
* email: 'newmember@example.com',
|
|
5943
5987
|
* role: 'MANAGER', // 'MANAGER' | 'STAFF' | 'VIEWER'
|
|
5944
5988
|
* });
|
|
@@ -5952,10 +5996,10 @@ declare class BrainerceClient {
|
|
|
5952
5996
|
* @example
|
|
5953
5997
|
* ```typescript
|
|
5954
5998
|
* // Update role
|
|
5955
|
-
* await
|
|
5999
|
+
* await client.updateStoreMember('store_id', 'member_id', { role: 'MANAGER' });
|
|
5956
6000
|
*
|
|
5957
6001
|
* // Set custom permissions (overrides role defaults)
|
|
5958
|
-
* await
|
|
6002
|
+
* await client.updateStoreMember('store_id', 'member_id', {
|
|
5959
6003
|
* permissions: ['VIEW_PRODUCTS', 'VIEW_ORDERS', 'FULFILL_ORDERS'],
|
|
5960
6004
|
* });
|
|
5961
6005
|
* ```
|
|
@@ -5992,7 +6036,7 @@ declare class BrainerceClient {
|
|
|
5992
6036
|
*
|
|
5993
6037
|
* @example
|
|
5994
6038
|
* ```typescript
|
|
5995
|
-
* const stores = await
|
|
6039
|
+
* const stores = await client.getMyStores();
|
|
5996
6040
|
* // Returns stores from all accounts where user is owner or team member
|
|
5997
6041
|
* stores.forEach(store => {
|
|
5998
6042
|
* console.log(`${store.name} - ${store.role} (${store.context})`);
|
|
@@ -6006,7 +6050,7 @@ declare class BrainerceClient {
|
|
|
6006
6050
|
*
|
|
6007
6051
|
* @example
|
|
6008
6052
|
* ```typescript
|
|
6009
|
-
* const { role, permissions } = await
|
|
6053
|
+
* const { role, permissions } = await client.getMyStorePermissions('store_id');
|
|
6010
6054
|
* if (permissions.includes('MANAGE_TEAM')) {
|
|
6011
6055
|
* // Show team management UI
|
|
6012
6056
|
* }
|
|
@@ -6039,7 +6083,7 @@ declare class BrainerceClient {
|
|
|
6039
6083
|
*
|
|
6040
6084
|
* @example
|
|
6041
6085
|
* ```typescript
|
|
6042
|
-
* const template = await
|
|
6086
|
+
* const template = await client.createEmailTemplate({
|
|
6043
6087
|
* name: 'Order Confirmation',
|
|
6044
6088
|
* eventType: 'ORDER_CONFIRMATION',
|
|
6045
6089
|
* subject: 'Your order #{{orderNumber}} has been confirmed',
|
|
@@ -6110,7 +6154,7 @@ declare class BrainerceClient {
|
|
|
6110
6154
|
*
|
|
6111
6155
|
* @example
|
|
6112
6156
|
* ```typescript
|
|
6113
|
-
* const config = await
|
|
6157
|
+
* const config = await client.configureOAuthProvider({
|
|
6114
6158
|
* provider: 'GOOGLE',
|
|
6115
6159
|
* clientId: 'your-google-client-id',
|
|
6116
6160
|
* clientSecret: 'your-google-client-secret',
|
|
@@ -6143,7 +6187,7 @@ declare class BrainerceError extends Error {
|
|
|
6143
6187
|
* Verify a webhook signature from Brainerce
|
|
6144
6188
|
*
|
|
6145
6189
|
* @param payload - The raw webhook payload (as string or object)
|
|
6146
|
-
* @param signature - The X-
|
|
6190
|
+
* @param signature - The X-Brainerce-Signature header value
|
|
6147
6191
|
* @param secret - Your webhook secret
|
|
6148
6192
|
* @returns true if the signature is valid
|
|
6149
6193
|
*
|
|
@@ -6152,7 +6196,7 @@ declare class BrainerceError extends Error {
|
|
|
6152
6196
|
* import { verifyWebhook } from 'brainerce';
|
|
6153
6197
|
*
|
|
6154
6198
|
* app.post('/webhooks/brainerce', async (req, res) => {
|
|
6155
|
-
* const signature = req.headers['x-
|
|
6199
|
+
* const signature = req.headers['x-brainerce-signature'];
|
|
6156
6200
|
* const isValid = verifyWebhook(req.body, signature, process.env.WEBHOOK_SECRET);
|
|
6157
6201
|
*
|
|
6158
6202
|
* if (!isValid) {
|
|
@@ -6211,9 +6255,4 @@ declare function enableDevGuards(options?: {
|
|
|
6211
6255
|
force?: boolean;
|
|
6212
6256
|
}): void;
|
|
6213
6257
|
|
|
6214
|
-
|
|
6215
|
-
declare const OmniSyncClient: typeof BrainerceClient;
|
|
6216
|
-
/** @deprecated Use BrainerceError instead */
|
|
6217
|
-
declare const OmniSyncError: typeof BrainerceError;
|
|
6218
|
-
|
|
6219
|
-
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, OmniSyncClient, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
6258
|
+
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|