create-brainerce-store 1.17.0 → 1.18.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/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "create-brainerce-store",
34
- version: "1.16.0",
34
+ version: "1.18.0",
35
35
  description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
36
36
  bin: {
37
37
  "create-brainerce-store": "dist/index.js"
package/messages/en.json CHANGED
@@ -154,6 +154,9 @@
154
154
  "paymentNotConfigured": "Payment Not Configured",
155
155
  "paymentNotConfiguredDesc": "Payment has not been set up for this store yet. Please contact the store owner.",
156
156
  "paymentError": "Payment Error",
157
+ "sandboxTitle": "Sandbox Mode",
158
+ "sandboxDescription": "This is a test order. No real payment will be processed.",
159
+ "completeTestOrder": "Complete Test Order",
157
160
  "redirectingToPayment": "Redirecting to payment provider...",
158
161
  "redirectingHint": "If you are not redirected automatically, ",
159
162
  "clickHere": "click here",
package/messages/he.json CHANGED
@@ -154,6 +154,9 @@
154
154
  "paymentNotConfigured": "תשלום לא מוגדר",
155
155
  "paymentNotConfiguredDesc": "התשלום עדיין לא הוגדר לחנות זו. אנא פנו לבעל החנות.",
156
156
  "paymentError": "שגיאת תשלום",
157
+ "sandboxTitle": "מצב בדיקה",
158
+ "sandboxDescription": "זוהי הזמנת בדיקה. לא יבוצע תשלום אמיתי.",
159
+ "completeTestOrder": "השלם הזמנת בדיקה",
157
160
  "redirectingToPayment": "...מפנה לספק התשלום",
158
161
  "redirectingHint": "אם אינכם מופנים אוטומטית, ",
159
162
  "clickHere": "לחצו כאן",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -152,7 +152,12 @@ export default function CartPage() {
152
152
  <div className="mt-6 space-y-3">
153
153
  <h3 className="text-foreground text-sm font-semibold">{t('bundleOffers')}</h3>
154
154
  {bundles.bundles.map((offer) => (
155
- <CartBundleOfferCard key={offer.id} offer={offer} cartId={cart.id} onAdd={refreshCart} />
155
+ <CartBundleOfferCard
156
+ key={offer.id}
157
+ offer={offer}
158
+ cartId={cart.id}
159
+ onAdd={refreshCart}
160
+ />
156
161
  ))}
157
162
  </div>
158
163
  )}
@@ -305,8 +305,9 @@ export function PaymentStep({ checkoutId, className }: PaymentStepProps) {
305
305
  })
306
306
  .catch(() => null);
307
307
 
308
- // B) Load + init SDK as early as possible
308
+ // B) Load + init SDK as early as possible (skip for sandbox)
309
309
  providerPromise.then((providerSdk) => {
310
+ if (providerSdk?.renderType === 'sandbox') return;
310
311
  if (providerSdk?.renderType === 'sdk-widget' && providerSdk.scriptUrl) {
311
312
  currentSdk = providerSdk;
312
313
  loadScript(providerSdk);
@@ -333,6 +334,9 @@ export function PaymentStep({ checkoutId, className }: PaymentStepProps) {
333
334
  const sdk = resolveClientSdk(intent, providerSdk);
334
335
  currentSdk = sdk;
335
336
 
337
+ // Sandbox mode — no SDK to load, UI handles it
338
+ if (sdk.renderType === 'sandbox') return;
339
+
336
340
  if (sdk.renderType === 'redirect') {
337
341
  window.location.href = intent.clientSecret;
338
342
  return;
@@ -427,6 +431,48 @@ export function PaymentStep({ checkoutId, className }: PaymentStepProps) {
427
431
 
428
432
  const sdk = resolveClientSdk(paymentIntent, preloadedSdk);
429
433
 
434
+ if (sdk.renderType === 'sandbox') {
435
+ const handleCompleteSandbox = async () => {
436
+ setLoading(true);
437
+ try {
438
+ const client = getClient();
439
+ await client.completeGuestCheckout(checkoutId);
440
+ window.location.href = `/order-confirmation?checkout_id=${checkoutId}`;
441
+ } catch (err) {
442
+ setError(err instanceof Error ? err.message : t('paymentError'));
443
+ setLoading(false);
444
+ }
445
+ };
446
+
447
+ return (
448
+ <div className={cn('py-8 text-center', className)}>
449
+ <div className="mx-auto max-w-md rounded-lg border border-amber-200 bg-amber-50 p-6">
450
+ <svg
451
+ className="mx-auto mb-3 h-10 w-10 text-amber-500"
452
+ fill="none"
453
+ viewBox="0 0 24 24"
454
+ stroke="currentColor"
455
+ >
456
+ <path
457
+ strokeLinecap="round"
458
+ strokeLinejoin="round"
459
+ strokeWidth={1.5}
460
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"
461
+ />
462
+ </svg>
463
+ <h3 className="text-foreground mb-1 text-lg font-semibold">{t('sandboxTitle')}</h3>
464
+ <p className="text-muted-foreground mb-4 text-sm">{t('sandboxDescription')}</p>
465
+ <button
466
+ onClick={handleCompleteSandbox}
467
+ className="inline-flex items-center rounded-md bg-amber-500 px-6 py-2.5 text-sm font-medium text-white transition-colors hover:bg-amber-600"
468
+ >
469
+ {t('completeTestOrder')}
470
+ </button>
471
+ </div>
472
+ </div>
473
+ );
474
+ }
475
+
430
476
  if (sdk.renderType === 'sdk-widget') {
431
477
  const containerId =
432
478
  sdk.containerId || `${paymentIntent.provider || 'payment'}-payment-container`;