@akinon/projectzero 2.0.34-beta.0 → 2.0.34
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/CHANGELOG.md +1 -1
- package/app-template/.env.example +5 -0
- package/app-template/CHANGELOG.md +33 -32
- package/app-template/package.json +29 -29
- package/app-template/public/locales/en/product.json +3 -1
- package/app-template/public/locales/tr/product.json +3 -1
- package/app-template/src/app/[pz]/template.tsx +2 -0
- package/app-template/src/app/api/virtual-try-on/limited-categories/route.ts +1 -1
- package/app-template/src/app/api/virtual-try-on/route.ts +6 -1
- package/app-template/src/components/datalayer-observer.tsx +169 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,11 @@ SERVICE_BACKEND_URL=https://02fde10fee4440269e695aa10707dfaf.lb.akinoncloud.com
|
|
|
8
8
|
SITEMAP_S3_BUCKET_NAME=0fb534
|
|
9
9
|
NEXT_PUBLIC_VIRTUAL_TRY_ON_API_URL=https://d2a26507c7094f359aba349b96a96881.lb.akinoncloud.com
|
|
10
10
|
|
|
11
|
+
# PZ Dashboard dataLayer observability (unset = observer disabled)
|
|
12
|
+
# NEXT_PUBLIC_PZ_DASHBOARD_URL=http://localhost:3005
|
|
13
|
+
# NEXT_PUBLIC_PZ_PROJECT_NAME=projectzeronext
|
|
14
|
+
# NEXT_PUBLIC_PZ_DATALAYER_SAMPLE=1
|
|
15
|
+
|
|
11
16
|
# LOG_LEVEL_DEV=debug # For more details, please refer to the Logging documentation.
|
|
12
17
|
|
|
13
18
|
# CACHE_SECRET=KhvhE1go3GDmYJ7PhZLmskqfhYNlPSm6
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
-
## 2.0.34
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
- @akinon/pz-
|
|
10
|
-
- @akinon/
|
|
11
|
-
- @akinon/pz-
|
|
12
|
-
- @akinon/pz-
|
|
13
|
-
- @akinon/pz-
|
|
14
|
-
- @akinon/pz-
|
|
15
|
-
- @akinon/pz-
|
|
16
|
-
- @akinon/pz-
|
|
17
|
-
- @akinon/pz-
|
|
18
|
-
- @akinon/pz-
|
|
19
|
-
- @akinon/pz-
|
|
20
|
-
- @akinon/pz-
|
|
21
|
-
- @akinon/pz-
|
|
22
|
-
- @akinon/pz-
|
|
23
|
-
- @akinon/pz-
|
|
24
|
-
- @akinon/pz-
|
|
25
|
-
- @akinon/pz-
|
|
26
|
-
- @akinon/pz-masterpass
|
|
27
|
-
- @akinon/pz-
|
|
28
|
-
- @akinon/pz-
|
|
29
|
-
- @akinon/pz-
|
|
30
|
-
- @akinon/pz-
|
|
31
|
-
- @akinon/pz-
|
|
32
|
-
- @akinon/pz-
|
|
33
|
-
- @akinon/pz-
|
|
34
|
-
- @akinon/pz-
|
|
3
|
+
## 2.0.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4e2ea16b: ZERO-4582: enhance virtual try-on functionality with single and async mutations
|
|
8
|
+
- Updated dependencies [4e2ea16b]
|
|
9
|
+
- @akinon/pz-virtual-try-on@2.0.34
|
|
10
|
+
- @akinon/next@2.0.34
|
|
11
|
+
- @akinon/pz-theme@2.0.34
|
|
12
|
+
- @akinon/pz-akifast@2.0.34
|
|
13
|
+
- @akinon/pz-apple-pay@2.0.34
|
|
14
|
+
- @akinon/pz-b2b@2.0.34
|
|
15
|
+
- @akinon/pz-basket-gift-pack@2.0.34
|
|
16
|
+
- @akinon/pz-bkm@2.0.34
|
|
17
|
+
- @akinon/pz-checkout-gift-pack@2.0.34
|
|
18
|
+
- @akinon/pz-click-collect@2.0.34
|
|
19
|
+
- @akinon/pz-credit-payment@2.0.34
|
|
20
|
+
- @akinon/pz-cybersource-uc@2.0.34
|
|
21
|
+
- @akinon/pz-flow-payment@2.0.34
|
|
22
|
+
- @akinon/pz-google-pay@2.0.34
|
|
23
|
+
- @akinon/pz-gpay@2.0.34
|
|
24
|
+
- @akinon/pz-haso@2.0.34
|
|
25
|
+
- @akinon/pz-hepsipay@2.0.34
|
|
26
|
+
- @akinon/pz-masterpass@2.0.34
|
|
27
|
+
- @akinon/pz-masterpass-rest@2.0.34
|
|
28
|
+
- @akinon/pz-multi-basket@2.0.34
|
|
29
|
+
- @akinon/pz-one-click-checkout@2.0.34
|
|
30
|
+
- @akinon/pz-otp@2.0.34
|
|
31
|
+
- @akinon/pz-pay-on-delivery@2.0.34
|
|
32
|
+
- @akinon/pz-saved-card@2.0.34
|
|
33
|
+
- @akinon/pz-similar-products@2.0.34
|
|
34
|
+
- @akinon/pz-tabby-extension@2.0.34
|
|
35
|
+
- @akinon/pz-tamara-extension@2.0.34
|
|
35
36
|
|
|
36
37
|
## 2.0.33
|
|
37
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "2.0.34
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,33 +24,33 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "2.0.34
|
|
28
|
-
"@akinon/pz-akifast": "2.0.34
|
|
29
|
-
"@akinon/pz-apple-pay": "2.0.34
|
|
30
|
-
"@akinon/pz-b2b": "2.0.34
|
|
31
|
-
"@akinon/pz-basket-gift-pack": "2.0.34
|
|
32
|
-
"@akinon/pz-bkm": "2.0.34
|
|
33
|
-
"@akinon/pz-checkout-gift-pack": "2.0.34
|
|
34
|
-
"@akinon/pz-click-collect": "2.0.34
|
|
35
|
-
"@akinon/pz-credit-payment": "2.0.34
|
|
36
|
-
"@akinon/pz-cybersource-uc": "2.0.34
|
|
37
|
-
"@akinon/pz-flow-payment": "2.0.34
|
|
38
|
-
"@akinon/pz-google-pay": "2.0.34
|
|
39
|
-
"@akinon/pz-gpay": "2.0.34
|
|
40
|
-
"@akinon/pz-haso": "2.0.34
|
|
41
|
-
"@akinon/pz-hepsipay": "2.0.34
|
|
42
|
-
"@akinon/pz-masterpass": "2.0.34
|
|
43
|
-
"@akinon/pz-masterpass-rest": "2.0.34
|
|
44
|
-
"@akinon/pz-multi-basket": "2.0.34
|
|
45
|
-
"@akinon/pz-one-click-checkout": "2.0.34
|
|
46
|
-
"@akinon/pz-otp": "2.0.34
|
|
47
|
-
"@akinon/pz-pay-on-delivery": "2.0.34
|
|
48
|
-
"@akinon/pz-saved-card": "2.0.34
|
|
49
|
-
"@akinon/pz-similar-products": "2.0.34
|
|
50
|
-
"@akinon/pz-tabby-extension": "2.0.34
|
|
51
|
-
"@akinon/pz-tamara-extension": "2.0.34
|
|
52
|
-
"@akinon/pz-theme": "2.0.34
|
|
53
|
-
"@akinon/pz-virtual-try-on": "2.0.34
|
|
27
|
+
"@akinon/next": "2.0.34",
|
|
28
|
+
"@akinon/pz-akifast": "2.0.34",
|
|
29
|
+
"@akinon/pz-apple-pay": "2.0.34",
|
|
30
|
+
"@akinon/pz-b2b": "2.0.34",
|
|
31
|
+
"@akinon/pz-basket-gift-pack": "2.0.34",
|
|
32
|
+
"@akinon/pz-bkm": "2.0.34",
|
|
33
|
+
"@akinon/pz-checkout-gift-pack": "2.0.34",
|
|
34
|
+
"@akinon/pz-click-collect": "2.0.34",
|
|
35
|
+
"@akinon/pz-credit-payment": "2.0.34",
|
|
36
|
+
"@akinon/pz-cybersource-uc": "2.0.34",
|
|
37
|
+
"@akinon/pz-flow-payment": "2.0.34",
|
|
38
|
+
"@akinon/pz-google-pay": "2.0.34",
|
|
39
|
+
"@akinon/pz-gpay": "2.0.34",
|
|
40
|
+
"@akinon/pz-haso": "2.0.34",
|
|
41
|
+
"@akinon/pz-hepsipay": "2.0.34",
|
|
42
|
+
"@akinon/pz-masterpass": "2.0.34",
|
|
43
|
+
"@akinon/pz-masterpass-rest": "2.0.34",
|
|
44
|
+
"@akinon/pz-multi-basket": "2.0.34",
|
|
45
|
+
"@akinon/pz-one-click-checkout": "2.0.34",
|
|
46
|
+
"@akinon/pz-otp": "2.0.34",
|
|
47
|
+
"@akinon/pz-pay-on-delivery": "2.0.34",
|
|
48
|
+
"@akinon/pz-saved-card": "2.0.34",
|
|
49
|
+
"@akinon/pz-similar-products": "2.0.34",
|
|
50
|
+
"@akinon/pz-tabby-extension": "2.0.34",
|
|
51
|
+
"@akinon/pz-tamara-extension": "2.0.34",
|
|
52
|
+
"@akinon/pz-theme": "2.0.34",
|
|
53
|
+
"@akinon/pz-virtual-try-on": "2.0.34",
|
|
54
54
|
"@hookform/resolvers": "2.9.0",
|
|
55
55
|
"@next/third-parties": "16.2.6",
|
|
56
56
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"yup": "0.32.11"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@akinon/eslint-plugin-projectzero": "2.0.34
|
|
77
|
+
"@akinon/eslint-plugin-projectzero": "2.0.34",
|
|
78
78
|
"@semantic-release/changelog": "6.0.2",
|
|
79
79
|
"@semantic-release/exec": "6.0.3",
|
|
80
80
|
"@semantic-release/git": "10.0.1",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"instructions": "Upload a clear photo of yourself for the best virtual try-on experience. Make sure you are facing the camera directly.",
|
|
52
52
|
"try_on": "Try On",
|
|
53
53
|
"virtual_cabin": "Virtual Cabin",
|
|
54
|
+
"usage_info": "Usage: {{used}}/{{limit}}",
|
|
54
55
|
"upload_info": "Your photo is used solely for generating the virtual try-on and is not stored permanently.",
|
|
55
56
|
"edit_photo": "Edit Photo",
|
|
56
57
|
"processing": "Processing...",
|
|
@@ -101,7 +102,8 @@
|
|
|
101
102
|
"change_photo": "Change",
|
|
102
103
|
"starting": "Starting...",
|
|
103
104
|
"will_start": "will start virtual try-on for",
|
|
104
|
-
"products_count": "products"
|
|
105
|
+
"products_count": "products",
|
|
106
|
+
"limit_exceeded": "You have reached the try-on limit for this product."
|
|
105
107
|
},
|
|
106
108
|
"barcode_scanner": {
|
|
107
109
|
"title": "Scan Barcode",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"processing_message": "En iyi sonucu sunabilmek için fotoğrafınızı işliyoruz. Lütfen bekleyiniz.",
|
|
58
58
|
"result_title": "Sanal Kabin Sonuç",
|
|
59
59
|
"virtual_cabin": "Sanal Kabin",
|
|
60
|
+
"usage_info": "Kullanım: {{used}}/{{limit}}",
|
|
60
61
|
"result_placeholder": "Sonucu görmek için fotoğrafınızı yükleyin",
|
|
61
62
|
"error": "Sanal deneme başarısız oldu. Lütfen tekrar deneyin.",
|
|
62
63
|
"error_message": "Modelin net bir şekilde göründüğü daha sade bir arka plana sahip görselle tekrar deneyin.",
|
|
@@ -103,7 +104,8 @@
|
|
|
103
104
|
"change_photo": "Değiştir",
|
|
104
105
|
"starting": "Başlatılıyor...",
|
|
105
106
|
"will_start": "için sanal deneme başlatılacak",
|
|
106
|
-
"products_count": "ürün"
|
|
107
|
+
"products_count": "ürün",
|
|
108
|
+
"limit_exceeded": "Bu ürün için deneme hakkınız doldu."
|
|
107
109
|
},
|
|
108
110
|
"barcode_scanner": {
|
|
109
111
|
"title": "Barkodu Okut",
|
|
@@ -9,6 +9,7 @@ import { ROUTES } from '@theme/routes';
|
|
|
9
9
|
import { GoogleTagManager } from '@next/third-parties/google';
|
|
10
10
|
import { pushPageView } from '@theme/utils/gtm';
|
|
11
11
|
import { serializeJsonLd } from '@theme/utils/generate-jsonld';
|
|
12
|
+
import { DataLayerObserver } from '@theme/components/datalayer-observer';
|
|
12
13
|
|
|
13
14
|
export default function RootTemplate({
|
|
14
15
|
children
|
|
@@ -62,6 +63,7 @@ export default function RootTemplate({
|
|
|
62
63
|
gtmId={process.env.NEXT_PUBLIC_GTM_KEY || 'GTM-W8JJWXD'}
|
|
63
64
|
/>
|
|
64
65
|
{/* End Google Tag Manager */}
|
|
66
|
+
<DataLayerObserver />
|
|
65
67
|
<script
|
|
66
68
|
type="application/ld+json"
|
|
67
69
|
dangerouslySetInnerHTML={{ __html: serializeJsonLd(jsonLdWebSite) }}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { GET, POST, PUT, OPTIONS } from '@akinon/next/api/virtual-try-on';
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { auth } from 'auth';
|
|
2
|
+
import { createVirtualTryOnHandlers } from '@akinon/next/api/virtual-try-on';
|
|
3
|
+
|
|
4
|
+
export const { GET, POST, PUT, OPTIONS } = createVirtualTryOnHandlers({
|
|
5
|
+
auth
|
|
6
|
+
});
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
5
|
+
import { ROUTES } from '@theme/routes';
|
|
6
|
+
|
|
7
|
+
const DASHBOARD_URL = process.env.NEXT_PUBLIC_PZ_DASHBOARD_URL;
|
|
8
|
+
const SERVICE = process.env.NEXT_PUBLIC_PZ_PROJECT_NAME || 'projectzeronext';
|
|
9
|
+
const SAMPLE_RATE = Number(process.env.NEXT_PUBLIC_PZ_DATALAYER_SAMPLE ?? '1');
|
|
10
|
+
|
|
11
|
+
// Sampling never drops these — the dashboard's silence alarms watch them.
|
|
12
|
+
const CRITICAL_EVENTS = ['purchase', 'begin_checkout'];
|
|
13
|
+
|
|
14
|
+
// Only these payload keys are forwarded; dataLayer objects can carry PII
|
|
15
|
+
// (email, phone) that must never leave the browser.
|
|
16
|
+
const PAYLOAD_WHITELIST = ['ecommerce', 'currency', 'value', 'items'];
|
|
17
|
+
|
|
18
|
+
const FLUSH_INTERVAL_MS = 10_000;
|
|
19
|
+
const MAX_BATCH = 200;
|
|
20
|
+
|
|
21
|
+
// GA4 ecommerce events imply the page type more reliably than the pretty
|
|
22
|
+
// URL (which only the backend can resolve to product/category).
|
|
23
|
+
const EVENT_PAGE_TYPES: Record<string, string> = {
|
|
24
|
+
view_item: 'pdp',
|
|
25
|
+
select_item: 'plp',
|
|
26
|
+
view_item_list: 'plp',
|
|
27
|
+
view_cart: 'basket',
|
|
28
|
+
begin_checkout: 'checkout',
|
|
29
|
+
add_shipping_info: 'checkout',
|
|
30
|
+
add_payment_info: 'checkout',
|
|
31
|
+
purchase: 'order-success'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type QueuedEvent = {
|
|
35
|
+
event: string;
|
|
36
|
+
pageType: string;
|
|
37
|
+
pageUrl: string;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
payload?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const queue: QueuedEvent[] = [];
|
|
44
|
+
|
|
45
|
+
// The observer remounts with the app template on every route change and
|
|
46
|
+
// replays the persistent dataLayer array; this keeps replays idempotent.
|
|
47
|
+
const captured = new WeakSet<object>();
|
|
48
|
+
|
|
49
|
+
const resolvePageTypeFromPath = (pathname: string): string => {
|
|
50
|
+
if (pathname === ROUTES.HOME) return 'home';
|
|
51
|
+
if (pathname.startsWith(ROUTES.LIST)) return 'plp';
|
|
52
|
+
if (pathname.startsWith(ROUTES.BASKET)) return 'basket';
|
|
53
|
+
if (pathname.startsWith(ROUTES.CHECKOUT_COMPLETED)) return 'order-success';
|
|
54
|
+
if (pathname.startsWith(ROUTES.CHECKOUT)) return 'checkout';
|
|
55
|
+
if (pathname.startsWith('/account') || pathname.startsWith('/users')) {
|
|
56
|
+
return 'account';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return 'other';
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getSessionId = () => {
|
|
63
|
+
try {
|
|
64
|
+
let id = sessionStorage.getItem('pz.dl.sid');
|
|
65
|
+
|
|
66
|
+
if (!id) {
|
|
67
|
+
id = crypto.randomUUID();
|
|
68
|
+
sessionStorage.setItem('pz.dl.sid', id);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return id;
|
|
72
|
+
} catch {
|
|
73
|
+
return 'no-session';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const flush = () => {
|
|
78
|
+
if (!queue.length || !DASHBOARD_URL) return;
|
|
79
|
+
|
|
80
|
+
const events = queue.splice(0, MAX_BATCH);
|
|
81
|
+
const body = JSON.stringify({ service: SERVICE, events });
|
|
82
|
+
|
|
83
|
+
// String body → text/plain → no CORS preflight; survives page unload.
|
|
84
|
+
if (!navigator.sendBeacon(`${DASHBOARD_URL}/api/datalayer`, body)) {
|
|
85
|
+
fetch(`${DASHBOARD_URL}/api/datalayer`, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
body,
|
|
88
|
+
keepalive: true
|
|
89
|
+
}).catch(() => {
|
|
90
|
+
// Observability must never break the storefront.
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const DataLayerObserver = () => {
|
|
96
|
+
const pathname = usePathname();
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!DASHBOARD_URL) return;
|
|
100
|
+
|
|
101
|
+
const sessionId = getSessionId();
|
|
102
|
+
// Deterministic per-session sampling: same session, same decision.
|
|
103
|
+
const sampled =
|
|
104
|
+
sessionId === 'no-session' ||
|
|
105
|
+
(parseInt(sessionId.slice(0, 8), 16) & 0xffff) / 0xffff < SAMPLE_RATE;
|
|
106
|
+
|
|
107
|
+
const capture = (item: unknown) => {
|
|
108
|
+
if (!item || typeof item !== 'object') return;
|
|
109
|
+
if (captured.has(item)) return;
|
|
110
|
+
captured.add(item);
|
|
111
|
+
const record = item as Record<string, unknown>;
|
|
112
|
+
if (typeof record.event !== 'string' || !record.event) return;
|
|
113
|
+
// GTM internals (gtm.js, gtm.dom, gtm.load...) are noise, not tags.
|
|
114
|
+
if (record.event.startsWith('gtm.')) return;
|
|
115
|
+
if (!sampled && !CRITICAL_EVENTS.includes(record.event)) return;
|
|
116
|
+
|
|
117
|
+
const payload: Record<string, unknown> = {};
|
|
118
|
+
PAYLOAD_WHITELIST.forEach((key) => {
|
|
119
|
+
if (record[key] !== undefined) payload[key] = record[key];
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
queue.push({
|
|
123
|
+
event: record.event,
|
|
124
|
+
pageType:
|
|
125
|
+
(typeof record.page_type === 'string' && record.page_type) ||
|
|
126
|
+
EVENT_PAGE_TYPES[record.event] ||
|
|
127
|
+
resolvePageTypeFromPath(window.location.pathname),
|
|
128
|
+
pageUrl: window.location.href,
|
|
129
|
+
sessionId,
|
|
130
|
+
timestamp: Date.now(),
|
|
131
|
+
payload: Object.keys(payload).length ? payload : undefined
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
window.dataLayer = window.dataLayer || [];
|
|
136
|
+
// Replay events pushed before the observer mounted (early page_views).
|
|
137
|
+
window.dataLayer.forEach(capture);
|
|
138
|
+
|
|
139
|
+
const original = window.dataLayer.push.bind(window.dataLayer);
|
|
140
|
+
window.dataLayer.push = (...items: unknown[]) => {
|
|
141
|
+
items.forEach(capture);
|
|
142
|
+
return original(...items);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const timer = setInterval(flush, FLUSH_INTERVAL_MS);
|
|
146
|
+
const onVisibilityChange = () => {
|
|
147
|
+
if (document.visibilityState === 'hidden') flush();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
151
|
+
window.addEventListener('pagehide', flush);
|
|
152
|
+
|
|
153
|
+
return () => {
|
|
154
|
+
clearInterval(timer);
|
|
155
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
156
|
+
window.removeEventListener('pagehide', flush);
|
|
157
|
+
window.dataLayer.push = original;
|
|
158
|
+
flush();
|
|
159
|
+
};
|
|
160
|
+
// Mount once; route changes are read from window.location at capture time.
|
|
161
|
+
}, []);
|
|
162
|
+
|
|
163
|
+
// Route change = fresh page view context; flush the previous page's batch.
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
flush();
|
|
166
|
+
}, [pathname]);
|
|
167
|
+
|
|
168
|
+
return null;
|
|
169
|
+
};
|