brainerce 1.43.0 → 1.44.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/README.md +64 -3
- package/dist/index.d.mts +141 -1
- package/dist/index.d.ts +141 -1
- package/dist/index.js +128 -12
- package/dist/index.mjs +128 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ These sequences are non-negotiable. The order of SDK calls matters.
|
|
|
120
120
|
|
|
121
121
|
### Checkout flow
|
|
122
122
|
|
|
123
|
-
1. Collect customer email, billing address, shipping address (`line1`, `line2`, `city`, `region`, `postalCode`, `country`). `email` is required.
|
|
123
|
+
1. Collect customer email, billing address, shipping address (`line1`, `line2`, `city`, `region`, `postalCode`, `country`). `email` is required. Include an optional **"Order notes"** textarea by default — its value lands on the order for the merchant.
|
|
124
124
|
2. Submit address to get shipping rates:
|
|
125
125
|
```ts
|
|
126
126
|
const { checkout, rates } = await client.setShippingAddress(checkoutId, {
|
|
@@ -132,6 +132,7 @@ These sequences are non-negotiable. The order of SDK calls matters.
|
|
|
132
132
|
region,
|
|
133
133
|
postalCode,
|
|
134
134
|
country,
|
|
135
|
+
notes: orderNotes, // optional shopper note (max 2000 chars)
|
|
135
136
|
});
|
|
136
137
|
// rates = available shipping rates; checkout = updated checkout object
|
|
137
138
|
```
|
|
@@ -184,9 +185,22 @@ These sequences are non-negotiable. The order of SDK calls matters.
|
|
|
184
185
|
|
|
185
186
|
1. Read `checkoutId` from URL or session.
|
|
186
187
|
2. `await client.handlePaymentSuccess(checkoutId)` — mandatory, clears cart so purchased items don't show on next visit.
|
|
187
|
-
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.
|
|
188
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.
|
|
189
|
-
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.
|
|
190
204
|
|
|
191
205
|
### Password reset flow
|
|
192
206
|
|
|
@@ -2143,6 +2157,7 @@ const checkout = await client.setCheckoutCustomer(checkoutId, {
|
|
|
2143
2157
|
firstName: 'John',
|
|
2144
2158
|
lastName: 'Doe',
|
|
2145
2159
|
phone: '+1234567890', // Optional
|
|
2160
|
+
notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
|
|
2146
2161
|
});
|
|
2147
2162
|
```
|
|
2148
2163
|
|
|
@@ -2159,12 +2174,21 @@ const { checkout, rates } = await client.setShippingAddress(checkoutId, {
|
|
|
2159
2174
|
postalCode: '10001',
|
|
2160
2175
|
country: 'US',
|
|
2161
2176
|
phone: '+1234567890', // Optional
|
|
2177
|
+
notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
|
|
2162
2178
|
});
|
|
2163
2179
|
|
|
2164
2180
|
// rates contains available shipping options
|
|
2165
2181
|
console.log(rates); // ShippingRate[]
|
|
2166
2182
|
```
|
|
2167
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
|
+
|
|
2168
2192
|
#### Select Shipping Method
|
|
2169
2193
|
|
|
2170
2194
|
```typescript
|
|
@@ -2242,6 +2266,7 @@ interface Checkout {
|
|
|
2242
2266
|
taxBreakdown?: TaxBreakdown | null; // { totalTax, pricesIncludeTax, breakdown[] }
|
|
2243
2267
|
total: string;
|
|
2244
2268
|
couponCode?: string | null;
|
|
2269
|
+
notes?: string | null; // Order note from setCheckoutCustomer/setShippingAddress
|
|
2245
2270
|
items: CheckoutLineItem[];
|
|
2246
2271
|
itemCount: number;
|
|
2247
2272
|
availableShippingRates?: ShippingRate[];
|
|
@@ -2951,6 +2976,37 @@ await client.applyCoupon(cartId, couponCode);
|
|
|
2951
2976
|
await client.reportSocialShare('instagram');
|
|
2952
2977
|
```
|
|
2953
2978
|
|
|
2979
|
+
#### Referrals & Birthday Gifts
|
|
2980
|
+
|
|
2981
|
+
When the store enables referrals, `getLoyaltyStatus()` also returns the
|
|
2982
|
+
member's share code (`referralCode`) and — for customers who signed up via a
|
|
2983
|
+
referral link — their still-unused welcome coupon (`referralWelcomeCoupon`).
|
|
2984
|
+
|
|
2985
|
+
```typescript
|
|
2986
|
+
// 1. The referrer shares a link you build around their code.
|
|
2987
|
+
const { referralCode } = await client.getLoyaltyStatus();
|
|
2988
|
+
const shareUrl = `https://your-store.com/?ref=${referralCode}`;
|
|
2989
|
+
|
|
2990
|
+
// 2. On the landing page — public lookup, NO customerToken needed. Never
|
|
2991
|
+
// returns PII beyond the referrer's first name.
|
|
2992
|
+
const info = await client.getReferralInfo(refFromQuery);
|
|
2993
|
+
if (info.valid) {
|
|
2994
|
+
// e.g. "Jane sent you a gift: 10% off your first order"
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
// 3. Pass the code at registration. Invalid codes never fail registration —
|
|
2998
|
+
// they're validated asynchronously server-side (with fraud checks).
|
|
2999
|
+
await client.registerCustomer({ email, password, referralCode: refFromQuery });
|
|
3000
|
+
|
|
3001
|
+
// 4. After the referee's first qualifying order, the referrer earns a points
|
|
3002
|
+
// bonus (held through the program's pending window, like order points).
|
|
3003
|
+
```
|
|
3004
|
+
|
|
3005
|
+
Birthday gifts need no SDK calls beyond profile data: set the customer's
|
|
3006
|
+
`birthMonth`/`birthDay` (1-12 / 1-31, no year) via `updateMyProfile()` and the
|
|
3007
|
+
platform emails a one-time gift coupon ahead of their birthday automatically
|
|
3008
|
+
(when the store has it enabled).
|
|
3009
|
+
|
|
2954
3010
|
#### Auth Response Type
|
|
2955
3011
|
|
|
2956
3012
|
```typescript
|
|
@@ -3890,6 +3946,11 @@ Merchants publish through the dashboard's per-row Platforms cell or via the
|
|
|
3890
3946
|
admin SDK below.
|
|
3891
3947
|
|
|
3892
3948
|
```typescript
|
|
3949
|
+
// Publish a product to a sales channel (accepts record ID or vc_* connection ID)
|
|
3950
|
+
await client.publishProductToSalesChannel('prod_id', 'vc_conn_id');
|
|
3951
|
+
await client.publishCouponToSalesChannel('coupon_id', 'vc_conn_id');
|
|
3952
|
+
await client.unpublishProductFromSalesChannel('prod_id', 'vc_conn_id');
|
|
3953
|
+
|
|
3893
3954
|
// Publish a category to a specific vibe-coded site
|
|
3894
3955
|
await client.publishCategoryToVibeCodedSite('cat_id', 'conn_id');
|
|
3895
3956
|
// Tag, brand, metafield definition follow the same shape:
|
package/dist/index.d.mts
CHANGED
|
@@ -287,6 +287,37 @@ interface LoyaltyStatus {
|
|
|
287
287
|
progressToNextTier: number;
|
|
288
288
|
/** Remaining spend/points needed to reach nextTier, or null if there's no nextTier. */
|
|
289
289
|
pointsToNextTier: number | null;
|
|
290
|
+
/**
|
|
291
|
+
* The customer's referral share code — build your referral link around it
|
|
292
|
+
* (e.g. `https://your-store.com/?ref=<code>`). Null when the program has
|
|
293
|
+
* referrals disabled or the customer isn't enrolled. Lazy-created on first
|
|
294
|
+
* read of this endpoint.
|
|
295
|
+
*/
|
|
296
|
+
referralCode?: string | null;
|
|
297
|
+
/**
|
|
298
|
+
* The still-unused welcome coupon this customer received for registering via
|
|
299
|
+
* a referral link, or null (none / already used). `type` is the coupon type
|
|
300
|
+
* ('PERCENTAGE' | 'FIXED_AMOUNT').
|
|
301
|
+
*/
|
|
302
|
+
referralWelcomeCoupon?: {
|
|
303
|
+
code: string;
|
|
304
|
+
type: string;
|
|
305
|
+
value: number;
|
|
306
|
+
} | null;
|
|
307
|
+
}
|
|
308
|
+
/** Public referral-link lookup result (no auth needed) — see getReferralInfo(). */
|
|
309
|
+
interface ReferralInfo {
|
|
310
|
+
/** False for unknown codes, disabled referral programs, or inactive programs. */
|
|
311
|
+
valid: boolean;
|
|
312
|
+
/** Referrer's first name for "Jane sent you a gift" copy — never any other PII. */
|
|
313
|
+
referrerFirstName: string | null;
|
|
314
|
+
/** The welcome reward the referee will receive on signup, or null if none configured. */
|
|
315
|
+
reward: {
|
|
316
|
+
name: string;
|
|
317
|
+
type: 'FIXED_DISCOUNT' | 'PERCENT_DISCOUNT';
|
|
318
|
+
value: number;
|
|
319
|
+
minOrderAmount: number | null;
|
|
320
|
+
} | null;
|
|
290
321
|
}
|
|
291
322
|
/** A reward a customer can redeem points for. */
|
|
292
323
|
interface LoyaltyReward {
|
|
@@ -1277,6 +1308,12 @@ interface Order {
|
|
|
1277
1308
|
*/
|
|
1278
1309
|
taxBreakdown?: TaxBreakdown | null;
|
|
1279
1310
|
createdAt: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* The shopper's own order note from checkout, echoed back read-only
|
|
1313
|
+
* (e.g., "Please leave at the door"). Display it in order history /
|
|
1314
|
+
* confirmation views; it cannot be edited after purchase.
|
|
1315
|
+
*/
|
|
1316
|
+
notes?: string | null;
|
|
1280
1317
|
/** Payment method used (e.g., "card", "paypal", "cash_on_delivery"). */
|
|
1281
1318
|
paymentMethod?: string | null;
|
|
1282
1319
|
/** Financial status: "pending", "paid", "refunded", "partially_refunded", "voided". */
|
|
@@ -1851,6 +1888,12 @@ interface RegisterCustomerDto {
|
|
|
1851
1888
|
lastName?: string;
|
|
1852
1889
|
phone?: string;
|
|
1853
1890
|
acceptsMarketing?: boolean;
|
|
1891
|
+
/**
|
|
1892
|
+
* Loyalty referral share code (REF-XXXXXXXX) from a referrer's link.
|
|
1893
|
+
* Validated asynchronously after registration — an invalid code never fails
|
|
1894
|
+
* the registration itself.
|
|
1895
|
+
*/
|
|
1896
|
+
referralCode?: string;
|
|
1854
1897
|
}
|
|
1855
1898
|
type CartStatus = 'ACTIVE' | 'MERGED' | 'CONVERTED' | 'ABANDONED';
|
|
1856
1899
|
/**
|
|
@@ -2701,6 +2744,11 @@ interface Checkout {
|
|
|
2701
2744
|
customFieldValues?: Record<string, unknown> | null;
|
|
2702
2745
|
/** Applied coupon code */
|
|
2703
2746
|
couponCode?: string | null;
|
|
2747
|
+
/**
|
|
2748
|
+
* Order-level note from the shopper (set via setCheckoutCustomer).
|
|
2749
|
+
* Copied onto the order at completion and shown to the merchant.
|
|
2750
|
+
*/
|
|
2751
|
+
notes?: string | null;
|
|
2704
2752
|
/** Line items with nested product/variant data */
|
|
2705
2753
|
lineItems: CheckoutLineItem[];
|
|
2706
2754
|
/** Total item count */
|
|
@@ -2799,6 +2847,13 @@ interface SetCheckoutCustomerDto {
|
|
|
2799
2847
|
lastName?: string;
|
|
2800
2848
|
phone?: string;
|
|
2801
2849
|
acceptsMarketing?: boolean;
|
|
2850
|
+
/**
|
|
2851
|
+
* Order-level note from the shopper ("Please leave at the door").
|
|
2852
|
+
* Copied onto the order at completion — visible to the merchant in the
|
|
2853
|
+
* dashboard and included in the confirmation email. Max 2000 chars.
|
|
2854
|
+
* Send an empty string to clear a previously-set note.
|
|
2855
|
+
*/
|
|
2856
|
+
notes?: string;
|
|
2802
2857
|
}
|
|
2803
2858
|
/**
|
|
2804
2859
|
* Shipping address with customer email (required for checkout).
|
|
@@ -2819,6 +2874,13 @@ interface SetShippingAddressDto {
|
|
|
2819
2874
|
phone?: string;
|
|
2820
2875
|
/** Whether customer accepts marketing emails */
|
|
2821
2876
|
acceptsMarketing?: boolean;
|
|
2877
|
+
/**
|
|
2878
|
+
* Order-level note from the shopper ("Please leave at the door").
|
|
2879
|
+
* Rides along with the address step so single-page checkouts need no extra
|
|
2880
|
+
* call. Copied onto the order at completion — visible to the merchant in
|
|
2881
|
+
* the dashboard and included in the confirmation email. Max 2000 chars.
|
|
2882
|
+
*/
|
|
2883
|
+
notes?: string;
|
|
2822
2884
|
}
|
|
2823
2885
|
/**
|
|
2824
2886
|
* Billing address (email not required - already set in shipping address)
|
|
@@ -7890,12 +7952,18 @@ declare class BrainerceClient {
|
|
|
7890
7952
|
/**
|
|
7891
7953
|
* Set customer information on checkout
|
|
7892
7954
|
*
|
|
7955
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
7956
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
7957
|
+
* value here. The note is copied onto the order at completion, shown to the
|
|
7958
|
+
* merchant in the dashboard, and included in the confirmation email.
|
|
7959
|
+
*
|
|
7893
7960
|
* @example
|
|
7894
7961
|
* ```typescript
|
|
7895
7962
|
* const checkout = await client.setCheckoutCustomer('checkout_123', {
|
|
7896
7963
|
* email: 'customer@example.com',
|
|
7897
7964
|
* firstName: 'John',
|
|
7898
7965
|
* lastName: 'Doe',
|
|
7966
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
7899
7967
|
* });
|
|
7900
7968
|
* ```
|
|
7901
7969
|
*/
|
|
@@ -7933,6 +8001,10 @@ declare class BrainerceClient {
|
|
|
7933
8001
|
* **This is the first step of the simplified checkout flow.**
|
|
7934
8002
|
* Email is required and will be used for order confirmation.
|
|
7935
8003
|
*
|
|
8004
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
8005
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
8006
|
+
* value here (or via `setCheckoutCustomer`). The note lands on the order.
|
|
8007
|
+
*
|
|
7936
8008
|
* @example
|
|
7937
8009
|
* ```typescript
|
|
7938
8010
|
* const { checkout, rates } = await client.setShippingAddress('checkout_123', {
|
|
@@ -7944,6 +8016,7 @@ declare class BrainerceClient {
|
|
|
7944
8016
|
* region: 'NY',
|
|
7945
8017
|
* postalCode: '10001',
|
|
7946
8018
|
* country: 'US',
|
|
8019
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
7947
8020
|
* });
|
|
7948
8021
|
* console.log('Available rates:', rates);
|
|
7949
8022
|
* ```
|
|
@@ -8308,6 +8381,27 @@ declare class BrainerceClient {
|
|
|
8308
8381
|
* ```
|
|
8309
8382
|
*/
|
|
8310
8383
|
waitForOrder(checkoutId: string, options?: WaitForOrderOptions): Promise<WaitForOrderResult>;
|
|
8384
|
+
/**
|
|
8385
|
+
* Get the full order created by a completed checkout.
|
|
8386
|
+
*
|
|
8387
|
+
* Use this on the order-confirmation page (after `waitForOrder` succeeds)
|
|
8388
|
+
* when you want to render more than the order number — line items, shipping
|
|
8389
|
+
* address, financial breakdown, and the shopper's order note are all
|
|
8390
|
+
* included (the buyer-safe order shape, same as `getMyOrders`).
|
|
8391
|
+
*
|
|
8392
|
+
* Works for guests too: possession of the checkout id is the credential —
|
|
8393
|
+
* no customer token needed.
|
|
8394
|
+
*
|
|
8395
|
+
* @example
|
|
8396
|
+
* ```typescript
|
|
8397
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
8398
|
+
* if (result.success) {
|
|
8399
|
+
* const order = await client.getOrderByCheckout(checkoutId);
|
|
8400
|
+
* // order.items, order.shippingAddress, order.notes, order.totalAmount, ...
|
|
8401
|
+
* }
|
|
8402
|
+
* ```
|
|
8403
|
+
*/
|
|
8404
|
+
getOrderByCheckout(checkoutId: string): Promise<Order>;
|
|
8311
8405
|
private readonly LOCAL_CART_KEY;
|
|
8312
8406
|
/**
|
|
8313
8407
|
* Check if localStorage is available (browser environment)
|
|
@@ -8635,12 +8729,17 @@ declare class BrainerceClient {
|
|
|
8635
8729
|
/**
|
|
8636
8730
|
* Update the current customer's profile (requires customerToken)
|
|
8637
8731
|
* Only available in storefront mode
|
|
8732
|
+
*
|
|
8733
|
+
* `birthMonth`/`birthDay` (1-12 / 1-31, no year — privacy) power the loyalty
|
|
8734
|
+
* birthday gift; they must be provided together.
|
|
8638
8735
|
*/
|
|
8639
8736
|
updateMyProfile(data: {
|
|
8640
8737
|
firstName?: string;
|
|
8641
8738
|
lastName?: string;
|
|
8642
8739
|
phone?: string;
|
|
8643
8740
|
acceptsMarketing?: boolean;
|
|
8741
|
+
birthMonth?: number;
|
|
8742
|
+
birthDay?: number;
|
|
8644
8743
|
}): Promise<CustomerProfile>;
|
|
8645
8744
|
/**
|
|
8646
8745
|
* Get the logged-in customer's loyalty status: enrollment, points balance,
|
|
@@ -8705,6 +8804,23 @@ declare class BrainerceClient {
|
|
|
8705
8804
|
awarded: boolean;
|
|
8706
8805
|
points: number;
|
|
8707
8806
|
}>;
|
|
8807
|
+
/**
|
|
8808
|
+
* Public referral-link lookup: who referred the visitor and what welcome
|
|
8809
|
+
* reward awaits them. No customerToken needed (like getStoreInfo/trackEvent)
|
|
8810
|
+
* — safe to call on a referral landing page before signup. Returns
|
|
8811
|
+
* `{ valid: false }` for unknown codes or stores with referrals disabled.
|
|
8812
|
+
* Only available in storefront mode.
|
|
8813
|
+
*
|
|
8814
|
+
* @example
|
|
8815
|
+
* ```typescript
|
|
8816
|
+
* const info = await client.getReferralInfo(searchParams.get('ref')!);
|
|
8817
|
+
* if (info.valid) {
|
|
8818
|
+
* showBanner(`${info.referrerFirstName ?? 'A friend'} sent you a gift!`);
|
|
8819
|
+
* // later: client.registerCustomer({ ...form, referralCode })
|
|
8820
|
+
* }
|
|
8821
|
+
* ```
|
|
8822
|
+
*/
|
|
8823
|
+
getReferralInfo(code: string): Promise<ReferralInfo>;
|
|
8708
8824
|
/**
|
|
8709
8825
|
* Get the current customer's orders (requires customerToken)
|
|
8710
8826
|
* Works in vibe-coded and storefront modes
|
|
@@ -9487,6 +9603,30 @@ declare class BrainerceClient {
|
|
|
9487
9603
|
unpublishMetafieldDefinitionFromVibeCodedSite(definitionId: string, vibeCodedConnectionId: string): Promise<{
|
|
9488
9604
|
success: boolean;
|
|
9489
9605
|
}>;
|
|
9606
|
+
/**
|
|
9607
|
+
* Publish a product to a sales channel (admin mode) — makes it visible on
|
|
9608
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
9609
|
+
* public `vc_*` connection ID.
|
|
9610
|
+
*/
|
|
9611
|
+
publishProductToSalesChannel(productId: string, salesChannelId: string): Promise<{
|
|
9612
|
+
success: boolean;
|
|
9613
|
+
}>;
|
|
9614
|
+
/** Unpublish a product from a sales channel (admin mode). */
|
|
9615
|
+
unpublishProductFromSalesChannel(productId: string, salesChannelId: string): Promise<{
|
|
9616
|
+
success: boolean;
|
|
9617
|
+
}>;
|
|
9618
|
+
/**
|
|
9619
|
+
* Publish a coupon to a sales channel (admin mode) — makes it redeemable on
|
|
9620
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
9621
|
+
* public `vc_*` connection ID.
|
|
9622
|
+
*/
|
|
9623
|
+
publishCouponToSalesChannel(couponId: string, salesChannelId: string): Promise<{
|
|
9624
|
+
success: boolean;
|
|
9625
|
+
}>;
|
|
9626
|
+
/** Unpublish a coupon from a sales channel (admin mode). */
|
|
9627
|
+
unpublishCouponFromSalesChannel(couponId: string, salesChannelId: string): Promise<{
|
|
9628
|
+
success: boolean;
|
|
9629
|
+
}>;
|
|
9490
9630
|
/** Publish a category to a vibe-coded site (admin mode). */
|
|
9491
9631
|
publishCategoryToVibeCodedSite(categoryId: string, vibeCodedConnectionId: string): Promise<{
|
|
9492
9632
|
success: boolean;
|
|
@@ -10009,4 +10149,4 @@ declare function formatVariantPrice(variant: Pick<ProductVariant, 'price' | 'sal
|
|
|
10009
10149
|
/** Format any numeric amount as currency. Useful for cart totals, fees, etc. */
|
|
10010
10150
|
declare function formatMoney(amount: number, currency: string, locale?: string): string;
|
|
10011
10151
|
|
|
10012
|
-
export { type AddToCartDto, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, 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 CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
|
10152
|
+
export { type AddToCartDto, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, 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 CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -287,6 +287,37 @@ interface LoyaltyStatus {
|
|
|
287
287
|
progressToNextTier: number;
|
|
288
288
|
/** Remaining spend/points needed to reach nextTier, or null if there's no nextTier. */
|
|
289
289
|
pointsToNextTier: number | null;
|
|
290
|
+
/**
|
|
291
|
+
* The customer's referral share code — build your referral link around it
|
|
292
|
+
* (e.g. `https://your-store.com/?ref=<code>`). Null when the program has
|
|
293
|
+
* referrals disabled or the customer isn't enrolled. Lazy-created on first
|
|
294
|
+
* read of this endpoint.
|
|
295
|
+
*/
|
|
296
|
+
referralCode?: string | null;
|
|
297
|
+
/**
|
|
298
|
+
* The still-unused welcome coupon this customer received for registering via
|
|
299
|
+
* a referral link, or null (none / already used). `type` is the coupon type
|
|
300
|
+
* ('PERCENTAGE' | 'FIXED_AMOUNT').
|
|
301
|
+
*/
|
|
302
|
+
referralWelcomeCoupon?: {
|
|
303
|
+
code: string;
|
|
304
|
+
type: string;
|
|
305
|
+
value: number;
|
|
306
|
+
} | null;
|
|
307
|
+
}
|
|
308
|
+
/** Public referral-link lookup result (no auth needed) — see getReferralInfo(). */
|
|
309
|
+
interface ReferralInfo {
|
|
310
|
+
/** False for unknown codes, disabled referral programs, or inactive programs. */
|
|
311
|
+
valid: boolean;
|
|
312
|
+
/** Referrer's first name for "Jane sent you a gift" copy — never any other PII. */
|
|
313
|
+
referrerFirstName: string | null;
|
|
314
|
+
/** The welcome reward the referee will receive on signup, or null if none configured. */
|
|
315
|
+
reward: {
|
|
316
|
+
name: string;
|
|
317
|
+
type: 'FIXED_DISCOUNT' | 'PERCENT_DISCOUNT';
|
|
318
|
+
value: number;
|
|
319
|
+
minOrderAmount: number | null;
|
|
320
|
+
} | null;
|
|
290
321
|
}
|
|
291
322
|
/** A reward a customer can redeem points for. */
|
|
292
323
|
interface LoyaltyReward {
|
|
@@ -1277,6 +1308,12 @@ interface Order {
|
|
|
1277
1308
|
*/
|
|
1278
1309
|
taxBreakdown?: TaxBreakdown | null;
|
|
1279
1310
|
createdAt: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* The shopper's own order note from checkout, echoed back read-only
|
|
1313
|
+
* (e.g., "Please leave at the door"). Display it in order history /
|
|
1314
|
+
* confirmation views; it cannot be edited after purchase.
|
|
1315
|
+
*/
|
|
1316
|
+
notes?: string | null;
|
|
1280
1317
|
/** Payment method used (e.g., "card", "paypal", "cash_on_delivery"). */
|
|
1281
1318
|
paymentMethod?: string | null;
|
|
1282
1319
|
/** Financial status: "pending", "paid", "refunded", "partially_refunded", "voided". */
|
|
@@ -1851,6 +1888,12 @@ interface RegisterCustomerDto {
|
|
|
1851
1888
|
lastName?: string;
|
|
1852
1889
|
phone?: string;
|
|
1853
1890
|
acceptsMarketing?: boolean;
|
|
1891
|
+
/**
|
|
1892
|
+
* Loyalty referral share code (REF-XXXXXXXX) from a referrer's link.
|
|
1893
|
+
* Validated asynchronously after registration — an invalid code never fails
|
|
1894
|
+
* the registration itself.
|
|
1895
|
+
*/
|
|
1896
|
+
referralCode?: string;
|
|
1854
1897
|
}
|
|
1855
1898
|
type CartStatus = 'ACTIVE' | 'MERGED' | 'CONVERTED' | 'ABANDONED';
|
|
1856
1899
|
/**
|
|
@@ -2701,6 +2744,11 @@ interface Checkout {
|
|
|
2701
2744
|
customFieldValues?: Record<string, unknown> | null;
|
|
2702
2745
|
/** Applied coupon code */
|
|
2703
2746
|
couponCode?: string | null;
|
|
2747
|
+
/**
|
|
2748
|
+
* Order-level note from the shopper (set via setCheckoutCustomer).
|
|
2749
|
+
* Copied onto the order at completion and shown to the merchant.
|
|
2750
|
+
*/
|
|
2751
|
+
notes?: string | null;
|
|
2704
2752
|
/** Line items with nested product/variant data */
|
|
2705
2753
|
lineItems: CheckoutLineItem[];
|
|
2706
2754
|
/** Total item count */
|
|
@@ -2799,6 +2847,13 @@ interface SetCheckoutCustomerDto {
|
|
|
2799
2847
|
lastName?: string;
|
|
2800
2848
|
phone?: string;
|
|
2801
2849
|
acceptsMarketing?: boolean;
|
|
2850
|
+
/**
|
|
2851
|
+
* Order-level note from the shopper ("Please leave at the door").
|
|
2852
|
+
* Copied onto the order at completion — visible to the merchant in the
|
|
2853
|
+
* dashboard and included in the confirmation email. Max 2000 chars.
|
|
2854
|
+
* Send an empty string to clear a previously-set note.
|
|
2855
|
+
*/
|
|
2856
|
+
notes?: string;
|
|
2802
2857
|
}
|
|
2803
2858
|
/**
|
|
2804
2859
|
* Shipping address with customer email (required for checkout).
|
|
@@ -2819,6 +2874,13 @@ interface SetShippingAddressDto {
|
|
|
2819
2874
|
phone?: string;
|
|
2820
2875
|
/** Whether customer accepts marketing emails */
|
|
2821
2876
|
acceptsMarketing?: boolean;
|
|
2877
|
+
/**
|
|
2878
|
+
* Order-level note from the shopper ("Please leave at the door").
|
|
2879
|
+
* Rides along with the address step so single-page checkouts need no extra
|
|
2880
|
+
* call. Copied onto the order at completion — visible to the merchant in
|
|
2881
|
+
* the dashboard and included in the confirmation email. Max 2000 chars.
|
|
2882
|
+
*/
|
|
2883
|
+
notes?: string;
|
|
2822
2884
|
}
|
|
2823
2885
|
/**
|
|
2824
2886
|
* Billing address (email not required - already set in shipping address)
|
|
@@ -7890,12 +7952,18 @@ declare class BrainerceClient {
|
|
|
7890
7952
|
/**
|
|
7891
7953
|
* Set customer information on checkout
|
|
7892
7954
|
*
|
|
7955
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
7956
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
7957
|
+
* value here. The note is copied onto the order at completion, shown to the
|
|
7958
|
+
* merchant in the dashboard, and included in the confirmation email.
|
|
7959
|
+
*
|
|
7893
7960
|
* @example
|
|
7894
7961
|
* ```typescript
|
|
7895
7962
|
* const checkout = await client.setCheckoutCustomer('checkout_123', {
|
|
7896
7963
|
* email: 'customer@example.com',
|
|
7897
7964
|
* firstName: 'John',
|
|
7898
7965
|
* lastName: 'Doe',
|
|
7966
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
7899
7967
|
* });
|
|
7900
7968
|
* ```
|
|
7901
7969
|
*/
|
|
@@ -7933,6 +8001,10 @@ declare class BrainerceClient {
|
|
|
7933
8001
|
* **This is the first step of the simplified checkout flow.**
|
|
7934
8002
|
* Email is required and will be used for order confirmation.
|
|
7935
8003
|
*
|
|
8004
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
8005
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
8006
|
+
* value here (or via `setCheckoutCustomer`). The note lands on the order.
|
|
8007
|
+
*
|
|
7936
8008
|
* @example
|
|
7937
8009
|
* ```typescript
|
|
7938
8010
|
* const { checkout, rates } = await client.setShippingAddress('checkout_123', {
|
|
@@ -7944,6 +8016,7 @@ declare class BrainerceClient {
|
|
|
7944
8016
|
* region: 'NY',
|
|
7945
8017
|
* postalCode: '10001',
|
|
7946
8018
|
* country: 'US',
|
|
8019
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
7947
8020
|
* });
|
|
7948
8021
|
* console.log('Available rates:', rates);
|
|
7949
8022
|
* ```
|
|
@@ -8308,6 +8381,27 @@ declare class BrainerceClient {
|
|
|
8308
8381
|
* ```
|
|
8309
8382
|
*/
|
|
8310
8383
|
waitForOrder(checkoutId: string, options?: WaitForOrderOptions): Promise<WaitForOrderResult>;
|
|
8384
|
+
/**
|
|
8385
|
+
* Get the full order created by a completed checkout.
|
|
8386
|
+
*
|
|
8387
|
+
* Use this on the order-confirmation page (after `waitForOrder` succeeds)
|
|
8388
|
+
* when you want to render more than the order number — line items, shipping
|
|
8389
|
+
* address, financial breakdown, and the shopper's order note are all
|
|
8390
|
+
* included (the buyer-safe order shape, same as `getMyOrders`).
|
|
8391
|
+
*
|
|
8392
|
+
* Works for guests too: possession of the checkout id is the credential —
|
|
8393
|
+
* no customer token needed.
|
|
8394
|
+
*
|
|
8395
|
+
* @example
|
|
8396
|
+
* ```typescript
|
|
8397
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
8398
|
+
* if (result.success) {
|
|
8399
|
+
* const order = await client.getOrderByCheckout(checkoutId);
|
|
8400
|
+
* // order.items, order.shippingAddress, order.notes, order.totalAmount, ...
|
|
8401
|
+
* }
|
|
8402
|
+
* ```
|
|
8403
|
+
*/
|
|
8404
|
+
getOrderByCheckout(checkoutId: string): Promise<Order>;
|
|
8311
8405
|
private readonly LOCAL_CART_KEY;
|
|
8312
8406
|
/**
|
|
8313
8407
|
* Check if localStorage is available (browser environment)
|
|
@@ -8635,12 +8729,17 @@ declare class BrainerceClient {
|
|
|
8635
8729
|
/**
|
|
8636
8730
|
* Update the current customer's profile (requires customerToken)
|
|
8637
8731
|
* Only available in storefront mode
|
|
8732
|
+
*
|
|
8733
|
+
* `birthMonth`/`birthDay` (1-12 / 1-31, no year — privacy) power the loyalty
|
|
8734
|
+
* birthday gift; they must be provided together.
|
|
8638
8735
|
*/
|
|
8639
8736
|
updateMyProfile(data: {
|
|
8640
8737
|
firstName?: string;
|
|
8641
8738
|
lastName?: string;
|
|
8642
8739
|
phone?: string;
|
|
8643
8740
|
acceptsMarketing?: boolean;
|
|
8741
|
+
birthMonth?: number;
|
|
8742
|
+
birthDay?: number;
|
|
8644
8743
|
}): Promise<CustomerProfile>;
|
|
8645
8744
|
/**
|
|
8646
8745
|
* Get the logged-in customer's loyalty status: enrollment, points balance,
|
|
@@ -8705,6 +8804,23 @@ declare class BrainerceClient {
|
|
|
8705
8804
|
awarded: boolean;
|
|
8706
8805
|
points: number;
|
|
8707
8806
|
}>;
|
|
8807
|
+
/**
|
|
8808
|
+
* Public referral-link lookup: who referred the visitor and what welcome
|
|
8809
|
+
* reward awaits them. No customerToken needed (like getStoreInfo/trackEvent)
|
|
8810
|
+
* — safe to call on a referral landing page before signup. Returns
|
|
8811
|
+
* `{ valid: false }` for unknown codes or stores with referrals disabled.
|
|
8812
|
+
* Only available in storefront mode.
|
|
8813
|
+
*
|
|
8814
|
+
* @example
|
|
8815
|
+
* ```typescript
|
|
8816
|
+
* const info = await client.getReferralInfo(searchParams.get('ref')!);
|
|
8817
|
+
* if (info.valid) {
|
|
8818
|
+
* showBanner(`${info.referrerFirstName ?? 'A friend'} sent you a gift!`);
|
|
8819
|
+
* // later: client.registerCustomer({ ...form, referralCode })
|
|
8820
|
+
* }
|
|
8821
|
+
* ```
|
|
8822
|
+
*/
|
|
8823
|
+
getReferralInfo(code: string): Promise<ReferralInfo>;
|
|
8708
8824
|
/**
|
|
8709
8825
|
* Get the current customer's orders (requires customerToken)
|
|
8710
8826
|
* Works in vibe-coded and storefront modes
|
|
@@ -9487,6 +9603,30 @@ declare class BrainerceClient {
|
|
|
9487
9603
|
unpublishMetafieldDefinitionFromVibeCodedSite(definitionId: string, vibeCodedConnectionId: string): Promise<{
|
|
9488
9604
|
success: boolean;
|
|
9489
9605
|
}>;
|
|
9606
|
+
/**
|
|
9607
|
+
* Publish a product to a sales channel (admin mode) — makes it visible on
|
|
9608
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
9609
|
+
* public `vc_*` connection ID.
|
|
9610
|
+
*/
|
|
9611
|
+
publishProductToSalesChannel(productId: string, salesChannelId: string): Promise<{
|
|
9612
|
+
success: boolean;
|
|
9613
|
+
}>;
|
|
9614
|
+
/** Unpublish a product from a sales channel (admin mode). */
|
|
9615
|
+
unpublishProductFromSalesChannel(productId: string, salesChannelId: string): Promise<{
|
|
9616
|
+
success: boolean;
|
|
9617
|
+
}>;
|
|
9618
|
+
/**
|
|
9619
|
+
* Publish a coupon to a sales channel (admin mode) — makes it redeemable on
|
|
9620
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
9621
|
+
* public `vc_*` connection ID.
|
|
9622
|
+
*/
|
|
9623
|
+
publishCouponToSalesChannel(couponId: string, salesChannelId: string): Promise<{
|
|
9624
|
+
success: boolean;
|
|
9625
|
+
}>;
|
|
9626
|
+
/** Unpublish a coupon from a sales channel (admin mode). */
|
|
9627
|
+
unpublishCouponFromSalesChannel(couponId: string, salesChannelId: string): Promise<{
|
|
9628
|
+
success: boolean;
|
|
9629
|
+
}>;
|
|
9490
9630
|
/** Publish a category to a vibe-coded site (admin mode). */
|
|
9491
9631
|
publishCategoryToVibeCodedSite(categoryId: string, vibeCodedConnectionId: string): Promise<{
|
|
9492
9632
|
success: boolean;
|
|
@@ -10009,4 +10149,4 @@ declare function formatVariantPrice(variant: Pick<ProductVariant, 'price' | 'sal
|
|
|
10009
10149
|
/** Format any numeric amount as currency. Useful for cart totals, fees, etc. */
|
|
10010
10150
|
declare function formatMoney(amount: number, currency: string, locale?: string): string;
|
|
10011
10151
|
|
|
10012
|
-
export { type AddToCartDto, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, 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 CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
|
10152
|
+
export { type AddToCartDto, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, 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 CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -4771,12 +4771,18 @@ var BrainerceClient = class {
|
|
|
4771
4771
|
/**
|
|
4772
4772
|
* Set customer information on checkout
|
|
4773
4773
|
*
|
|
4774
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
4775
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
4776
|
+
* value here. The note is copied onto the order at completion, shown to the
|
|
4777
|
+
* merchant in the dashboard, and included in the confirmation email.
|
|
4778
|
+
*
|
|
4774
4779
|
* @example
|
|
4775
4780
|
* ```typescript
|
|
4776
4781
|
* const checkout = await client.setCheckoutCustomer('checkout_123', {
|
|
4777
4782
|
* email: 'customer@example.com',
|
|
4778
4783
|
* firstName: 'John',
|
|
4779
4784
|
* lastName: 'Doe',
|
|
4785
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
4780
4786
|
* });
|
|
4781
4787
|
* ```
|
|
4782
4788
|
*/
|
|
@@ -4848,6 +4854,10 @@ var BrainerceClient = class {
|
|
|
4848
4854
|
* **This is the first step of the simplified checkout flow.**
|
|
4849
4855
|
* Email is required and will be used for order confirmation.
|
|
4850
4856
|
*
|
|
4857
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
4858
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
4859
|
+
* value here (or via `setCheckoutCustomer`). The note lands on the order.
|
|
4860
|
+
*
|
|
4851
4861
|
* @example
|
|
4852
4862
|
* ```typescript
|
|
4853
4863
|
* const { checkout, rates } = await client.setShippingAddress('checkout_123', {
|
|
@@ -4859,6 +4869,7 @@ var BrainerceClient = class {
|
|
|
4859
4869
|
* region: 'NY',
|
|
4860
4870
|
* postalCode: '10001',
|
|
4861
4871
|
* country: 'US',
|
|
4872
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
4862
4873
|
* });
|
|
4863
4874
|
* console.log('Available rates:', rates);
|
|
4864
4875
|
* ```
|
|
@@ -5524,6 +5535,44 @@ var BrainerceClient = class {
|
|
|
5524
5535
|
waitedMs: Date.now() - startTime
|
|
5525
5536
|
};
|
|
5526
5537
|
}
|
|
5538
|
+
/**
|
|
5539
|
+
* Get the full order created by a completed checkout.
|
|
5540
|
+
*
|
|
5541
|
+
* Use this on the order-confirmation page (after `waitForOrder` succeeds)
|
|
5542
|
+
* when you want to render more than the order number — line items, shipping
|
|
5543
|
+
* address, financial breakdown, and the shopper's order note are all
|
|
5544
|
+
* included (the buyer-safe order shape, same as `getMyOrders`).
|
|
5545
|
+
*
|
|
5546
|
+
* Works for guests too: possession of the checkout id is the credential —
|
|
5547
|
+
* no customer token needed.
|
|
5548
|
+
*
|
|
5549
|
+
* @example
|
|
5550
|
+
* ```typescript
|
|
5551
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
5552
|
+
* if (result.success) {
|
|
5553
|
+
* const order = await client.getOrderByCheckout(checkoutId);
|
|
5554
|
+
* // order.items, order.shippingAddress, order.notes, order.totalAmount, ...
|
|
5555
|
+
* }
|
|
5556
|
+
* ```
|
|
5557
|
+
*/
|
|
5558
|
+
async getOrderByCheckout(checkoutId) {
|
|
5559
|
+
if (this.isVibeCodedMode()) {
|
|
5560
|
+
return this.withGuards(
|
|
5561
|
+
this.vibeCodedRequest("GET", `/checkout/${encodePathSegment(checkoutId)}/order`),
|
|
5562
|
+
"order"
|
|
5563
|
+
);
|
|
5564
|
+
}
|
|
5565
|
+
if (this.storeId && !this.apiKey) {
|
|
5566
|
+
return this.withGuards(
|
|
5567
|
+
this.storefrontRequest("GET", `/checkout/${encodePathSegment(checkoutId)}/order`),
|
|
5568
|
+
"order"
|
|
5569
|
+
);
|
|
5570
|
+
}
|
|
5571
|
+
throw new BrainerceError(
|
|
5572
|
+
"getOrderByCheckout() requires vibe-coded or storefront mode",
|
|
5573
|
+
400
|
|
5574
|
+
);
|
|
5575
|
+
}
|
|
5527
5576
|
/**
|
|
5528
5577
|
* Check if localStorage is available (browser environment)
|
|
5529
5578
|
*/
|
|
@@ -6296,6 +6345,9 @@ var BrainerceClient = class {
|
|
|
6296
6345
|
/**
|
|
6297
6346
|
* Update the current customer's profile (requires customerToken)
|
|
6298
6347
|
* Only available in storefront mode
|
|
6348
|
+
*
|
|
6349
|
+
* `birthMonth`/`birthDay` (1-12 / 1-31, no year — privacy) power the loyalty
|
|
6350
|
+
* birthday gift; they must be provided together.
|
|
6299
6351
|
*/
|
|
6300
6352
|
async updateMyProfile(data) {
|
|
6301
6353
|
if (!this.customerToken && !this.proxyMode) {
|
|
@@ -6438,6 +6490,30 @@ var BrainerceClient = class {
|
|
|
6438
6490
|
}
|
|
6439
6491
|
throw new BrainerceError("reportSocialShare is only available in storefront mode", 400);
|
|
6440
6492
|
}
|
|
6493
|
+
/**
|
|
6494
|
+
* Public referral-link lookup: who referred the visitor and what welcome
|
|
6495
|
+
* reward awaits them. No customerToken needed (like getStoreInfo/trackEvent)
|
|
6496
|
+
* — safe to call on a referral landing page before signup. Returns
|
|
6497
|
+
* `{ valid: false }` for unknown codes or stores with referrals disabled.
|
|
6498
|
+
* Only available in storefront mode.
|
|
6499
|
+
*
|
|
6500
|
+
* @example
|
|
6501
|
+
* ```typescript
|
|
6502
|
+
* const info = await client.getReferralInfo(searchParams.get('ref')!);
|
|
6503
|
+
* if (info.valid) {
|
|
6504
|
+
* showBanner(`${info.referrerFirstName ?? 'A friend'} sent you a gift!`);
|
|
6505
|
+
* // later: client.registerCustomer({ ...form, referralCode })
|
|
6506
|
+
* }
|
|
6507
|
+
* ```
|
|
6508
|
+
*/
|
|
6509
|
+
async getReferralInfo(code) {
|
|
6510
|
+
if (this.storeId && !this.apiKey) {
|
|
6511
|
+
return this.storefrontRequest("GET", "/loyalty/referral-info", void 0, {
|
|
6512
|
+
code
|
|
6513
|
+
});
|
|
6514
|
+
}
|
|
6515
|
+
throw new BrainerceError("getReferralInfo is only available in storefront mode", 400);
|
|
6516
|
+
}
|
|
6441
6517
|
/**
|
|
6442
6518
|
* Get the current customer's orders (requires customerToken)
|
|
6443
6519
|
* Works in vibe-coded and storefront modes
|
|
@@ -7848,52 +7924,92 @@ var BrainerceClient = class {
|
|
|
7848
7924
|
{ vibeCodedConnectionId }
|
|
7849
7925
|
);
|
|
7850
7926
|
}
|
|
7927
|
+
/**
|
|
7928
|
+
* Publish a product to a sales channel (admin mode) — makes it visible on
|
|
7929
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
7930
|
+
* public `vc_*` connection ID.
|
|
7931
|
+
*/
|
|
7932
|
+
async publishProductToSalesChannel(productId, salesChannelId) {
|
|
7933
|
+
return this.adminRequest(
|
|
7934
|
+
"POST",
|
|
7935
|
+
`/api/v1/products/${encodePathSegment(productId)}/publish-sales-channel`,
|
|
7936
|
+
{ salesChannelId }
|
|
7937
|
+
);
|
|
7938
|
+
}
|
|
7939
|
+
/** Unpublish a product from a sales channel (admin mode). */
|
|
7940
|
+
async unpublishProductFromSalesChannel(productId, salesChannelId) {
|
|
7941
|
+
return this.adminRequest(
|
|
7942
|
+
"POST",
|
|
7943
|
+
`/api/v1/products/${encodePathSegment(productId)}/unpublish-sales-channel`,
|
|
7944
|
+
{ salesChannelId }
|
|
7945
|
+
);
|
|
7946
|
+
}
|
|
7947
|
+
/**
|
|
7948
|
+
* Publish a coupon to a sales channel (admin mode) — makes it redeemable on
|
|
7949
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
7950
|
+
* public `vc_*` connection ID.
|
|
7951
|
+
*/
|
|
7952
|
+
async publishCouponToSalesChannel(couponId, salesChannelId) {
|
|
7953
|
+
return this.adminRequest(
|
|
7954
|
+
"POST",
|
|
7955
|
+
`/api/v1/coupons/${encodePathSegment(couponId)}/publish-sales-channel`,
|
|
7956
|
+
{ salesChannelId }
|
|
7957
|
+
);
|
|
7958
|
+
}
|
|
7959
|
+
/** Unpublish a coupon from a sales channel (admin mode). */
|
|
7960
|
+
async unpublishCouponFromSalesChannel(couponId, salesChannelId) {
|
|
7961
|
+
return this.adminRequest(
|
|
7962
|
+
"POST",
|
|
7963
|
+
`/api/v1/coupons/${encodePathSegment(couponId)}/unpublish-sales-channel`,
|
|
7964
|
+
{ salesChannelId }
|
|
7965
|
+
);
|
|
7966
|
+
}
|
|
7851
7967
|
/** Publish a category to a vibe-coded site (admin mode). */
|
|
7852
7968
|
async publishCategoryToVibeCodedSite(categoryId, vibeCodedConnectionId) {
|
|
7853
7969
|
return this.adminRequest(
|
|
7854
7970
|
"POST",
|
|
7855
|
-
`/api/v1/categories/${encodePathSegment(categoryId)}/publish-
|
|
7856
|
-
{ vibeCodedConnectionId }
|
|
7971
|
+
`/api/v1/categories/${encodePathSegment(categoryId)}/publish-sales-channel`,
|
|
7972
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7857
7973
|
);
|
|
7858
7974
|
}
|
|
7859
7975
|
/** Unpublish a category from a vibe-coded site (admin mode). */
|
|
7860
7976
|
async unpublishCategoryFromVibeCodedSite(categoryId, vibeCodedConnectionId) {
|
|
7861
7977
|
return this.adminRequest(
|
|
7862
7978
|
"POST",
|
|
7863
|
-
`/api/v1/categories/${encodePathSegment(categoryId)}/unpublish-
|
|
7864
|
-
{ vibeCodedConnectionId }
|
|
7979
|
+
`/api/v1/categories/${encodePathSegment(categoryId)}/unpublish-sales-channel`,
|
|
7980
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7865
7981
|
);
|
|
7866
7982
|
}
|
|
7867
7983
|
/** Publish a tag to a vibe-coded site (admin mode). */
|
|
7868
7984
|
async publishTagToVibeCodedSite(tagId, vibeCodedConnectionId) {
|
|
7869
7985
|
return this.adminRequest(
|
|
7870
7986
|
"POST",
|
|
7871
|
-
`/api/v1/tags/${encodePathSegment(tagId)}/publish-
|
|
7872
|
-
{ vibeCodedConnectionId }
|
|
7987
|
+
`/api/v1/tags/${encodePathSegment(tagId)}/publish-sales-channel`,
|
|
7988
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7873
7989
|
);
|
|
7874
7990
|
}
|
|
7875
7991
|
/** Unpublish a tag from a vibe-coded site (admin mode). */
|
|
7876
7992
|
async unpublishTagFromVibeCodedSite(tagId, vibeCodedConnectionId) {
|
|
7877
7993
|
return this.adminRequest(
|
|
7878
7994
|
"POST",
|
|
7879
|
-
`/api/v1/tags/${encodePathSegment(tagId)}/unpublish-
|
|
7880
|
-
{ vibeCodedConnectionId }
|
|
7995
|
+
`/api/v1/tags/${encodePathSegment(tagId)}/unpublish-sales-channel`,
|
|
7996
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7881
7997
|
);
|
|
7882
7998
|
}
|
|
7883
7999
|
/** Publish a brand to a vibe-coded site (admin mode). */
|
|
7884
8000
|
async publishBrandToVibeCodedSite(brandId, vibeCodedConnectionId) {
|
|
7885
8001
|
return this.adminRequest(
|
|
7886
8002
|
"POST",
|
|
7887
|
-
`/api/v1/brands/${encodePathSegment(brandId)}/publish-
|
|
7888
|
-
{ vibeCodedConnectionId }
|
|
8003
|
+
`/api/v1/brands/${encodePathSegment(brandId)}/publish-sales-channel`,
|
|
8004
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7889
8005
|
);
|
|
7890
8006
|
}
|
|
7891
8007
|
/** Unpublish a brand from a vibe-coded site (admin mode). */
|
|
7892
8008
|
async unpublishBrandFromVibeCodedSite(brandId, vibeCodedConnectionId) {
|
|
7893
8009
|
return this.adminRequest(
|
|
7894
8010
|
"POST",
|
|
7895
|
-
`/api/v1/brands/${encodePathSegment(brandId)}/unpublish-
|
|
7896
|
-
{ vibeCodedConnectionId }
|
|
8011
|
+
`/api/v1/brands/${encodePathSegment(brandId)}/unpublish-sales-channel`,
|
|
8012
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7897
8013
|
);
|
|
7898
8014
|
}
|
|
7899
8015
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -4701,12 +4701,18 @@ var BrainerceClient = class {
|
|
|
4701
4701
|
/**
|
|
4702
4702
|
* Set customer information on checkout
|
|
4703
4703
|
*
|
|
4704
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
4705
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
4706
|
+
* value here. The note is copied onto the order at completion, shown to the
|
|
4707
|
+
* merchant in the dashboard, and included in the confirmation email.
|
|
4708
|
+
*
|
|
4704
4709
|
* @example
|
|
4705
4710
|
* ```typescript
|
|
4706
4711
|
* const checkout = await client.setCheckoutCustomer('checkout_123', {
|
|
4707
4712
|
* email: 'customer@example.com',
|
|
4708
4713
|
* firstName: 'John',
|
|
4709
4714
|
* lastName: 'Doe',
|
|
4715
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
4710
4716
|
* });
|
|
4711
4717
|
* ```
|
|
4712
4718
|
*/
|
|
@@ -4778,6 +4784,10 @@ var BrainerceClient = class {
|
|
|
4778
4784
|
* **This is the first step of the simplified checkout flow.**
|
|
4779
4785
|
* Email is required and will be used for order confirmation.
|
|
4780
4786
|
*
|
|
4787
|
+
* Also accepts an optional order-level `notes` field — every checkout page
|
|
4788
|
+
* should include an optional "Order notes" textarea by default and send its
|
|
4789
|
+
* value here (or via `setCheckoutCustomer`). The note lands on the order.
|
|
4790
|
+
*
|
|
4781
4791
|
* @example
|
|
4782
4792
|
* ```typescript
|
|
4783
4793
|
* const { checkout, rates } = await client.setShippingAddress('checkout_123', {
|
|
@@ -4789,6 +4799,7 @@ var BrainerceClient = class {
|
|
|
4789
4799
|
* region: 'NY',
|
|
4790
4800
|
* postalCode: '10001',
|
|
4791
4801
|
* country: 'US',
|
|
4802
|
+
* notes: 'Please leave the package at the door', // optional order notes
|
|
4792
4803
|
* });
|
|
4793
4804
|
* console.log('Available rates:', rates);
|
|
4794
4805
|
* ```
|
|
@@ -5454,6 +5465,44 @@ var BrainerceClient = class {
|
|
|
5454
5465
|
waitedMs: Date.now() - startTime
|
|
5455
5466
|
};
|
|
5456
5467
|
}
|
|
5468
|
+
/**
|
|
5469
|
+
* Get the full order created by a completed checkout.
|
|
5470
|
+
*
|
|
5471
|
+
* Use this on the order-confirmation page (after `waitForOrder` succeeds)
|
|
5472
|
+
* when you want to render more than the order number — line items, shipping
|
|
5473
|
+
* address, financial breakdown, and the shopper's order note are all
|
|
5474
|
+
* included (the buyer-safe order shape, same as `getMyOrders`).
|
|
5475
|
+
*
|
|
5476
|
+
* Works for guests too: possession of the checkout id is the credential —
|
|
5477
|
+
* no customer token needed.
|
|
5478
|
+
*
|
|
5479
|
+
* @example
|
|
5480
|
+
* ```typescript
|
|
5481
|
+
* const result = await client.waitForOrder(checkoutId);
|
|
5482
|
+
* if (result.success) {
|
|
5483
|
+
* const order = await client.getOrderByCheckout(checkoutId);
|
|
5484
|
+
* // order.items, order.shippingAddress, order.notes, order.totalAmount, ...
|
|
5485
|
+
* }
|
|
5486
|
+
* ```
|
|
5487
|
+
*/
|
|
5488
|
+
async getOrderByCheckout(checkoutId) {
|
|
5489
|
+
if (this.isVibeCodedMode()) {
|
|
5490
|
+
return this.withGuards(
|
|
5491
|
+
this.vibeCodedRequest("GET", `/checkout/${encodePathSegment(checkoutId)}/order`),
|
|
5492
|
+
"order"
|
|
5493
|
+
);
|
|
5494
|
+
}
|
|
5495
|
+
if (this.storeId && !this.apiKey) {
|
|
5496
|
+
return this.withGuards(
|
|
5497
|
+
this.storefrontRequest("GET", `/checkout/${encodePathSegment(checkoutId)}/order`),
|
|
5498
|
+
"order"
|
|
5499
|
+
);
|
|
5500
|
+
}
|
|
5501
|
+
throw new BrainerceError(
|
|
5502
|
+
"getOrderByCheckout() requires vibe-coded or storefront mode",
|
|
5503
|
+
400
|
|
5504
|
+
);
|
|
5505
|
+
}
|
|
5457
5506
|
/**
|
|
5458
5507
|
* Check if localStorage is available (browser environment)
|
|
5459
5508
|
*/
|
|
@@ -6226,6 +6275,9 @@ var BrainerceClient = class {
|
|
|
6226
6275
|
/**
|
|
6227
6276
|
* Update the current customer's profile (requires customerToken)
|
|
6228
6277
|
* Only available in storefront mode
|
|
6278
|
+
*
|
|
6279
|
+
* `birthMonth`/`birthDay` (1-12 / 1-31, no year — privacy) power the loyalty
|
|
6280
|
+
* birthday gift; they must be provided together.
|
|
6229
6281
|
*/
|
|
6230
6282
|
async updateMyProfile(data) {
|
|
6231
6283
|
if (!this.customerToken && !this.proxyMode) {
|
|
@@ -6368,6 +6420,30 @@ var BrainerceClient = class {
|
|
|
6368
6420
|
}
|
|
6369
6421
|
throw new BrainerceError("reportSocialShare is only available in storefront mode", 400);
|
|
6370
6422
|
}
|
|
6423
|
+
/**
|
|
6424
|
+
* Public referral-link lookup: who referred the visitor and what welcome
|
|
6425
|
+
* reward awaits them. No customerToken needed (like getStoreInfo/trackEvent)
|
|
6426
|
+
* — safe to call on a referral landing page before signup. Returns
|
|
6427
|
+
* `{ valid: false }` for unknown codes or stores with referrals disabled.
|
|
6428
|
+
* Only available in storefront mode.
|
|
6429
|
+
*
|
|
6430
|
+
* @example
|
|
6431
|
+
* ```typescript
|
|
6432
|
+
* const info = await client.getReferralInfo(searchParams.get('ref')!);
|
|
6433
|
+
* if (info.valid) {
|
|
6434
|
+
* showBanner(`${info.referrerFirstName ?? 'A friend'} sent you a gift!`);
|
|
6435
|
+
* // later: client.registerCustomer({ ...form, referralCode })
|
|
6436
|
+
* }
|
|
6437
|
+
* ```
|
|
6438
|
+
*/
|
|
6439
|
+
async getReferralInfo(code) {
|
|
6440
|
+
if (this.storeId && !this.apiKey) {
|
|
6441
|
+
return this.storefrontRequest("GET", "/loyalty/referral-info", void 0, {
|
|
6442
|
+
code
|
|
6443
|
+
});
|
|
6444
|
+
}
|
|
6445
|
+
throw new BrainerceError("getReferralInfo is only available in storefront mode", 400);
|
|
6446
|
+
}
|
|
6371
6447
|
/**
|
|
6372
6448
|
* Get the current customer's orders (requires customerToken)
|
|
6373
6449
|
* Works in vibe-coded and storefront modes
|
|
@@ -7778,52 +7854,92 @@ var BrainerceClient = class {
|
|
|
7778
7854
|
{ vibeCodedConnectionId }
|
|
7779
7855
|
);
|
|
7780
7856
|
}
|
|
7857
|
+
/**
|
|
7858
|
+
* Publish a product to a sales channel (admin mode) — makes it visible on
|
|
7859
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
7860
|
+
* public `vc_*` connection ID.
|
|
7861
|
+
*/
|
|
7862
|
+
async publishProductToSalesChannel(productId, salesChannelId) {
|
|
7863
|
+
return this.adminRequest(
|
|
7864
|
+
"POST",
|
|
7865
|
+
`/api/v1/products/${encodePathSegment(productId)}/publish-sales-channel`,
|
|
7866
|
+
{ salesChannelId }
|
|
7867
|
+
);
|
|
7868
|
+
}
|
|
7869
|
+
/** Unpublish a product from a sales channel (admin mode). */
|
|
7870
|
+
async unpublishProductFromSalesChannel(productId, salesChannelId) {
|
|
7871
|
+
return this.adminRequest(
|
|
7872
|
+
"POST",
|
|
7873
|
+
`/api/v1/products/${encodePathSegment(productId)}/unpublish-sales-channel`,
|
|
7874
|
+
{ salesChannelId }
|
|
7875
|
+
);
|
|
7876
|
+
}
|
|
7877
|
+
/**
|
|
7878
|
+
* Publish a coupon to a sales channel (admin mode) — makes it redeemable on
|
|
7879
|
+
* that vibe-coded storefront. Accepts the sales-channel record ID or its
|
|
7880
|
+
* public `vc_*` connection ID.
|
|
7881
|
+
*/
|
|
7882
|
+
async publishCouponToSalesChannel(couponId, salesChannelId) {
|
|
7883
|
+
return this.adminRequest(
|
|
7884
|
+
"POST",
|
|
7885
|
+
`/api/v1/coupons/${encodePathSegment(couponId)}/publish-sales-channel`,
|
|
7886
|
+
{ salesChannelId }
|
|
7887
|
+
);
|
|
7888
|
+
}
|
|
7889
|
+
/** Unpublish a coupon from a sales channel (admin mode). */
|
|
7890
|
+
async unpublishCouponFromSalesChannel(couponId, salesChannelId) {
|
|
7891
|
+
return this.adminRequest(
|
|
7892
|
+
"POST",
|
|
7893
|
+
`/api/v1/coupons/${encodePathSegment(couponId)}/unpublish-sales-channel`,
|
|
7894
|
+
{ salesChannelId }
|
|
7895
|
+
);
|
|
7896
|
+
}
|
|
7781
7897
|
/** Publish a category to a vibe-coded site (admin mode). */
|
|
7782
7898
|
async publishCategoryToVibeCodedSite(categoryId, vibeCodedConnectionId) {
|
|
7783
7899
|
return this.adminRequest(
|
|
7784
7900
|
"POST",
|
|
7785
|
-
`/api/v1/categories/${encodePathSegment(categoryId)}/publish-
|
|
7786
|
-
{ vibeCodedConnectionId }
|
|
7901
|
+
`/api/v1/categories/${encodePathSegment(categoryId)}/publish-sales-channel`,
|
|
7902
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7787
7903
|
);
|
|
7788
7904
|
}
|
|
7789
7905
|
/** Unpublish a category from a vibe-coded site (admin mode). */
|
|
7790
7906
|
async unpublishCategoryFromVibeCodedSite(categoryId, vibeCodedConnectionId) {
|
|
7791
7907
|
return this.adminRequest(
|
|
7792
7908
|
"POST",
|
|
7793
|
-
`/api/v1/categories/${encodePathSegment(categoryId)}/unpublish-
|
|
7794
|
-
{ vibeCodedConnectionId }
|
|
7909
|
+
`/api/v1/categories/${encodePathSegment(categoryId)}/unpublish-sales-channel`,
|
|
7910
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7795
7911
|
);
|
|
7796
7912
|
}
|
|
7797
7913
|
/** Publish a tag to a vibe-coded site (admin mode). */
|
|
7798
7914
|
async publishTagToVibeCodedSite(tagId, vibeCodedConnectionId) {
|
|
7799
7915
|
return this.adminRequest(
|
|
7800
7916
|
"POST",
|
|
7801
|
-
`/api/v1/tags/${encodePathSegment(tagId)}/publish-
|
|
7802
|
-
{ vibeCodedConnectionId }
|
|
7917
|
+
`/api/v1/tags/${encodePathSegment(tagId)}/publish-sales-channel`,
|
|
7918
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7803
7919
|
);
|
|
7804
7920
|
}
|
|
7805
7921
|
/** Unpublish a tag from a vibe-coded site (admin mode). */
|
|
7806
7922
|
async unpublishTagFromVibeCodedSite(tagId, vibeCodedConnectionId) {
|
|
7807
7923
|
return this.adminRequest(
|
|
7808
7924
|
"POST",
|
|
7809
|
-
`/api/v1/tags/${encodePathSegment(tagId)}/unpublish-
|
|
7810
|
-
{ vibeCodedConnectionId }
|
|
7925
|
+
`/api/v1/tags/${encodePathSegment(tagId)}/unpublish-sales-channel`,
|
|
7926
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7811
7927
|
);
|
|
7812
7928
|
}
|
|
7813
7929
|
/** Publish a brand to a vibe-coded site (admin mode). */
|
|
7814
7930
|
async publishBrandToVibeCodedSite(brandId, vibeCodedConnectionId) {
|
|
7815
7931
|
return this.adminRequest(
|
|
7816
7932
|
"POST",
|
|
7817
|
-
`/api/v1/brands/${encodePathSegment(brandId)}/publish-
|
|
7818
|
-
{ vibeCodedConnectionId }
|
|
7933
|
+
`/api/v1/brands/${encodePathSegment(brandId)}/publish-sales-channel`,
|
|
7934
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7819
7935
|
);
|
|
7820
7936
|
}
|
|
7821
7937
|
/** Unpublish a brand from a vibe-coded site (admin mode). */
|
|
7822
7938
|
async unpublishBrandFromVibeCodedSite(brandId, vibeCodedConnectionId) {
|
|
7823
7939
|
return this.adminRequest(
|
|
7824
7940
|
"POST",
|
|
7825
|
-
`/api/v1/brands/${encodePathSegment(brandId)}/unpublish-
|
|
7826
|
-
{ vibeCodedConnectionId }
|
|
7941
|
+
`/api/v1/brands/${encodePathSegment(brandId)}/unpublish-sales-channel`,
|
|
7942
|
+
{ salesChannelId: vibeCodedConnectionId }
|
|
7827
7943
|
);
|
|
7828
7944
|
}
|
|
7829
7945
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.1",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|