brainerce 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2207,6 +2207,44 @@ export default function CheckoutSuccessPage() {
2207
2207
 
2208
2208
  ---
2209
2209
 
2210
+ #### Sandbox / Test Mode
2211
+
2212
+ When `sandboxPaymentsEnabled` is turned on for a vibe-coded connection, `getPaymentProviders()` includes a sandbox provider that allows placing test orders without real payment.
2213
+
2214
+ ```typescript
2215
+ const { providers } = await client.getPaymentProviders();
2216
+ const sandboxProvider = providers.find((p) => p.provider === 'sandbox');
2217
+
2218
+ if (sandboxProvider) {
2219
+ // Sandbox is available — testMode will be true
2220
+ console.log(sandboxProvider.testMode); // true
2221
+ console.log(sandboxProvider.name); // "Sandbox (Test Orders)"
2222
+ }
2223
+ ```
2224
+
2225
+ When you create a payment intent with the sandbox provider, it returns `renderType: 'sandbox'`:
2226
+
2227
+ ```typescript
2228
+ const intent = await client.createPaymentIntent(checkoutId);
2229
+
2230
+ if (intent.clientSdk?.renderType === 'sandbox') {
2231
+ // Show a "Complete Test Order" button instead of real payment UI
2232
+ // No real charges — call completeGuestCheckout() to finalize
2233
+ await client.completeGuestCheckout(checkoutId);
2234
+ // Redirect to order confirmation
2235
+ window.location.href = `/order-confirmation?checkout_id=${checkoutId}`;
2236
+ }
2237
+ ```
2238
+
2239
+ **Important notes:**
2240
+
2241
+ - Sandbox orders are marked `isTestOrder: true` in the database
2242
+ - Sandbox orders are automatically set to `financialStatus: 'paid'`
2243
+ - Test orders do not affect store analytics
2244
+ - The embedded `PaymentStep` template handles sandbox rendering automatically
2245
+
2246
+ ---
2247
+
2210
2248
  ### Customer Authentication
2211
2249
 
2212
2250
  #### Register Customer
package/dist/index.d.mts CHANGED
@@ -2454,8 +2454,8 @@ interface CustomApiTestResult {
2454
2454
  * The frontend dynamically loads the SDK script and calls init/render methods.
2455
2455
  */
2456
2456
  interface PaymentClientSdk {
2457
- /** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', or 'redirect' */
2458
- renderType: 'sdk-widget' | 'iframe' | 'redirect';
2457
+ /** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', or 'sandbox' (test orders) */
2458
+ renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox';
2459
2459
  /** URL of the main SDK script to load */
2460
2460
  scriptUrl?: string;
2461
2461
  /** Name of the global variable set by the SDK script (e.g., 'growPayment') */
package/dist/index.d.ts CHANGED
@@ -2454,8 +2454,8 @@ interface CustomApiTestResult {
2454
2454
  * The frontend dynamically loads the SDK script and calls init/render methods.
2455
2455
  */
2456
2456
  interface PaymentClientSdk {
2457
- /** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', or 'redirect' */
2458
- renderType: 'sdk-widget' | 'iframe' | 'redirect';
2457
+ /** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', or 'sandbox' (test orders) */
2458
+ renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox';
2459
2459
  /** URL of the main SDK script to load */
2460
2460
  scriptUrl?: string;
2461
2461
  /** Name of the global variable set by the SDK script (e.g., 'growPayment') */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainerce",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",