brainerce 1.44.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.
Files changed (2) hide show
  1. package/README.md +26 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -185,9 +185,22 @@ These sequences are non-negotiable. The order of SDK calls matters.
185
185
 
186
186
  1. Read `checkoutId` from URL or session.
187
187
  2. `await client.handlePaymentSuccess(checkoutId)` — mandatory, clears cart so purchased items don't show on next visit.
188
- 3. `const order = await client.waitForOrder(checkoutId)` — polls until the webhook writes the order.
188
+ 3. `const result = await client.waitForOrder(checkoutId)` — polls until the webhook writes the order. `result.status.orderNumber` / `result.status.orderId` are available on success.
189
189
  4. Show a spinner during step 3 (webhook may lag). On timeout: show "we're still processing, check your email" with a link to order history — the order WILL appear there.
190
- 5. On success: render order number and line items from the returned `order` object.
190
+ 5. On success: render the order number, or if your design wants more than that — fetch full details:
191
+
192
+ ```typescript
193
+ const result = await client.waitForOrder(checkoutId);
194
+ if (result.success) {
195
+ const order = await client.getOrderByCheckout(checkoutId);
196
+ // order.items, order.shippingAddress, order.notes (the shopper's own
197
+ // order note, read-only), order.subtotal, order.shippingAmount,
198
+ // order.taxAmount / order.taxBreakdown, order.totalAmount
199
+ }
200
+ ```
201
+
202
+ `getOrderByCheckout` works for guests too — possession of the checkout id is
203
+ the credential, no customer token needed.
191
204
 
192
205
  ### Password reset flow
193
206
 
@@ -2144,6 +2157,7 @@ const checkout = await client.setCheckoutCustomer(checkoutId, {
2144
2157
  firstName: 'John',
2145
2158
  lastName: 'Doe',
2146
2159
  phone: '+1234567890', // Optional
2160
+ notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
2147
2161
  });
2148
2162
  ```
2149
2163
 
@@ -2160,12 +2174,21 @@ const { checkout, rates } = await client.setShippingAddress(checkoutId, {
2160
2174
  postalCode: '10001',
2161
2175
  country: 'US',
2162
2176
  phone: '+1234567890', // Optional
2177
+ notes: 'Please leave the package at the door', // Optional order note (max 2000 chars)
2163
2178
  });
2164
2179
 
2165
2180
  // rates contains available shipping options
2166
2181
  console.log(rates); // ShippingRate[]
2167
2182
  ```
2168
2183
 
2184
+ > **Order notes:** every checkout page should render an optional **"Order
2185
+ > notes"** textarea by default. Send its value via `notes` on either
2186
+ > `setCheckoutCustomer` or `setShippingAddress` (whichever call your flow
2187
+ > makes last) — max 2000 chars, empty string clears a previously-set note.
2188
+ > The note is copied onto the order at completion (merchant sees it in the
2189
+ > dashboard, it's included in the confirmation email) and echoed back
2190
+ > read-only as `Order.notes` on buyer order responses.
2191
+
2169
2192
  #### Select Shipping Method
2170
2193
 
2171
2194
  ```typescript
@@ -2243,6 +2266,7 @@ interface Checkout {
2243
2266
  taxBreakdown?: TaxBreakdown | null; // { totalTax, pricesIncludeTax, breakdown[] }
2244
2267
  total: string;
2245
2268
  couponCode?: string | null;
2269
+ notes?: string | null; // Order note from setCheckoutCustomer/setShippingAddress
2246
2270
  items: CheckoutLineItem[];
2247
2271
  itemCount: number;
2248
2272
  availableShippingRates?: ShippingRate[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainerce",
3
- "version": "1.44.0",
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",