create-brainerce-store 1.27.5 → 1.28.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.
Files changed (35) hide show
  1. package/dist/index.js +95 -22
  2. package/messages/en.json +12 -1
  3. package/messages/he.json +12 -1
  4. package/package.json +1 -1
  5. package/templates/nextjs/base/.env.local.ejs +3 -3
  6. package/templates/nextjs/base/next.config.ts +13 -12
  7. package/templates/nextjs/base/package.json.ejs +2 -1
  8. package/templates/nextjs/base/src/app/api/auth/logout/route.ts +15 -14
  9. package/templates/nextjs/base/src/app/api/auth/oauth-callback/route.ts +66 -59
  10. package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +76 -77
  11. package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +229 -198
  12. package/templates/nextjs/base/src/app/checkout/page.tsx +975 -972
  13. package/templates/nextjs/base/src/app/layout.tsx.ejs +29 -13
  14. package/templates/nextjs/base/src/app/order-confirmation/page.tsx +271 -271
  15. package/templates/nextjs/base/src/app/payment-complete/page.tsx +59 -59
  16. package/templates/nextjs/base/src/app/products/[slug]/product-client-section.tsx +501 -486
  17. package/templates/nextjs/base/src/app/products/page.tsx +475 -475
  18. package/templates/nextjs/base/src/app/reset-password/page.tsx +138 -131
  19. package/templates/nextjs/base/src/components/auth/register-form.tsx +245 -232
  20. package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +416 -415
  21. package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +258 -184
  22. package/templates/nextjs/base/src/components/checkout/payment-step.tsx +84 -20
  23. package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +86 -72
  24. package/templates/nextjs/base/src/lib/csrf.ts +11 -0
  25. package/templates/nextjs/base/src/lib/navigation.tsx.ejs +60 -60
  26. package/templates/nextjs/base/src/lib/nonce.ts +10 -0
  27. package/templates/nextjs/base/src/lib/safe-redirect.ts +45 -0
  28. package/templates/nextjs/base/src/lib/sanitize-html.ts +93 -0
  29. package/templates/nextjs/base/src/lib/validation.ts +37 -0
  30. package/templates/nextjs/base/src/middleware.ts.ejs +91 -8
  31. package/templates/nextjs/base/tsconfig.tsbuildinfo +1 -0
  32. package/templates/nextjs/themes/luxury/globals.css +399 -399
  33. package/templates/nextjs/themes/luxury/theme.json +23 -23
  34. package/templates/nextjs/themes/playful/globals.css +400 -400
  35. package/templates/nextjs/themes/playful/theme.json +23 -23
@@ -1,59 +1,59 @@
1
- 'use client';
2
-
3
- import { useEffect } from 'react';
4
- import { useSearchParams } from 'next/navigation';
5
- import { Suspense } from 'react';
6
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
7
-
8
- /**
9
- * Lightweight callback page for iframe-based payment providers (e.g. CardCom).
10
- *
11
- * After the customer pays on the provider's hosted page (rendered inside an
12
- * iframe on the checkout page), the provider redirects *inside the iframe* to
13
- * this page. We extract the relevant query params and send them to the parent
14
- * window via postMessage so the checkout page can verify the payment
15
- * server-side and proceed to order confirmation.
16
- */
17
- function PaymentCompleteContent() {
18
- const searchParams = useSearchParams();
19
-
20
- useEffect(() => {
21
- // Only send postMessage when running inside an iframe
22
- if (window.parent === window) {
23
- // Not in iframe — fallback: redirect to order-confirmation directly
24
- const checkoutId = searchParams.get('checkout_id');
25
- if (checkoutId) {
26
- window.location.href = `/order-confirmation?${searchParams.toString()}`;
27
- }
28
- return;
29
- }
30
-
31
- // Collect all query params from the provider redirect
32
- const data: Record<string, string> = {};
33
- searchParams.forEach((value, key) => {
34
- data[key] = value;
35
- });
36
-
37
- window.parent.postMessage({ type: 'brainerce:payment-complete', data }, window.location.origin);
38
- }, [searchParams]);
39
-
40
- return (
41
- <div className="flex min-h-[200px] items-center justify-center">
42
- <LoadingSpinner size="lg" />
43
- </div>
44
- );
45
- }
46
-
47
- export default function PaymentCompletePage() {
48
- return (
49
- <Suspense
50
- fallback={
51
- <div className="flex min-h-[200px] items-center justify-center">
52
- <LoadingSpinner size="lg" />
53
- </div>
54
- }
55
- >
56
- <PaymentCompleteContent />
57
- </Suspense>
58
- );
59
- }
1
+ 'use client';
2
+
3
+ import { useEffect } from 'react';
4
+ import { useSearchParams } from 'next/navigation';
5
+ import { Suspense } from 'react';
6
+ import { LoadingSpinner } from '@/components/shared/loading-spinner';
7
+
8
+ /**
9
+ * Lightweight callback page for iframe-based payment providers (e.g. CardCom).
10
+ *
11
+ * After the customer pays on the provider's hosted page (rendered inside an
12
+ * iframe on the checkout page), the provider redirects *inside the iframe* to
13
+ * this page. We extract the relevant query params and send them to the parent
14
+ * window via postMessage so the checkout page can verify the payment
15
+ * server-side and proceed to order confirmation.
16
+ */
17
+ function PaymentCompleteContent() {
18
+ const searchParams = useSearchParams();
19
+
20
+ useEffect(() => {
21
+ // Only send postMessage when running inside an iframe
22
+ if (window.parent === window) {
23
+ // Not in iframe — fallback: redirect to order-confirmation directly
24
+ const checkoutId = searchParams.get('checkout_id');
25
+ if (checkoutId) {
26
+ window.location.href = `/order-confirmation?${searchParams.toString()}`;
27
+ }
28
+ return;
29
+ }
30
+
31
+ // Collect all query params from the provider redirect
32
+ const data: Record<string, string> = {};
33
+ searchParams.forEach((value, key) => {
34
+ data[key] = value;
35
+ });
36
+
37
+ window.parent.postMessage({ type: 'brainerce:payment-complete', data }, window.location.origin);
38
+ }, [searchParams]);
39
+
40
+ return (
41
+ <div className="flex min-h-[200px] items-center justify-center">
42
+ <LoadingSpinner size="lg" />
43
+ </div>
44
+ );
45
+ }
46
+
47
+ export default function PaymentCompletePage() {
48
+ return (
49
+ <Suspense
50
+ fallback={
51
+ <div className="flex min-h-[200px] items-center justify-center">
52
+ <LoadingSpinner size="lg" />
53
+ </div>
54
+ }
55
+ >
56
+ <PaymentCompleteContent />
57
+ </Suspense>
58
+ );
59
+ }