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.
- package/dist/index.js +95 -22
- package/messages/en.json +12 -1
- package/messages/he.json +12 -1
- package/package.json +1 -1
- package/templates/nextjs/base/.env.local.ejs +3 -3
- package/templates/nextjs/base/next.config.ts +13 -12
- package/templates/nextjs/base/package.json.ejs +2 -1
- package/templates/nextjs/base/src/app/api/auth/logout/route.ts +15 -14
- package/templates/nextjs/base/src/app/api/auth/oauth-callback/route.ts +66 -59
- package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +76 -77
- package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +229 -198
- package/templates/nextjs/base/src/app/checkout/page.tsx +975 -972
- package/templates/nextjs/base/src/app/layout.tsx.ejs +29 -13
- package/templates/nextjs/base/src/app/order-confirmation/page.tsx +271 -271
- package/templates/nextjs/base/src/app/payment-complete/page.tsx +59 -59
- package/templates/nextjs/base/src/app/products/[slug]/product-client-section.tsx +501 -486
- package/templates/nextjs/base/src/app/products/page.tsx +475 -475
- package/templates/nextjs/base/src/app/reset-password/page.tsx +138 -131
- package/templates/nextjs/base/src/components/auth/register-form.tsx +245 -232
- package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +416 -415
- package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +258 -184
- package/templates/nextjs/base/src/components/checkout/payment-step.tsx +84 -20
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +86 -72
- package/templates/nextjs/base/src/lib/csrf.ts +11 -0
- package/templates/nextjs/base/src/lib/navigation.tsx.ejs +60 -60
- package/templates/nextjs/base/src/lib/nonce.ts +10 -0
- package/templates/nextjs/base/src/lib/safe-redirect.ts +45 -0
- package/templates/nextjs/base/src/lib/sanitize-html.ts +93 -0
- package/templates/nextjs/base/src/lib/validation.ts +37 -0
- package/templates/nextjs/base/src/middleware.ts.ejs +91 -8
- package/templates/nextjs/base/tsconfig.tsbuildinfo +1 -0
- package/templates/nextjs/themes/luxury/globals.css +399 -399
- package/templates/nextjs/themes/luxury/theme.json +23 -23
- package/templates/nextjs/themes/playful/globals.css +400 -400
- 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
|
+
}
|