feat(05-purchase-redirect-hardening): harden purchase redirect tracking

Phase 5 complete:

- guard purchase event per transaction in sessionStorage

- restore saved consent before GTM and purchase

- add centered Przelewy24 countdown redirect
This commit is contained in:
2026-05-08 23:56:37 +02:00
parent df1c1f4a7d
commit 28b7a1dd54
8 changed files with 457 additions and 66 deletions

View File

@@ -5,19 +5,19 @@
See: .paul/PROJECT.md (updated 2026-05-08)
**Core value:** Uzytkownicy moga szybko i bezpiecznie kupic bilety online oraz otrzymac natychmiastowe potwierdzenie zakupu.
**Current focus:** v0.3 Cookie Notice Hotfix - COMPLETE
**Current focus:** v0.4 Purchase Redirect Hardening - COMPLETE
## Current Position
Milestone: v0.3 Cookie Notice Hotfix - COMPLETE
Phase: 1 of 1 (Cookie Notice Bugfix) - Complete
Plan: 04-01 complete
Milestone: v0.4 Purchase Redirect Hardening - COMPLETE
Phase: 1 of 1 (Purchase Redirect Hardening) - Complete
Plan: 05-01 complete
Status: Milestone complete - ready for next milestone
Last activity: 2026-05-08 - Phase 4 complete, v0.3 hotfix shipped
Last activity: 2026-05-08 - Phase 5 complete, v0.4 shipped
Progress:
- Milestone: [##########] 100%
- Phase 4: [##########] 100%
- Phase 5: [##########] 100%
## Loop Position
@@ -44,19 +44,16 @@ Documents: `.paul/codebase/` (8 files - stack, architecture, structure, conventi
- 2026-04-26: `cookieNoticePro.init()` used instead of `$.fn.cookieNoticePro()`.
- 2026-04-26: Consent Mode v2 default-denied initialized before the GTM snippet.
- 2026-05-08: Undefined `injectScripts()` calls removed from CookieNoticePro instead of adding a no-op stub.
- 2026-05-08: Manual redirect pause confirmed purchase fires; saved consent must be restored before GTM/purchase.
### Cookie Consent (Phase 3 - COMPLETE)
- Library: `libraries/CookieNoticePro/`.
- Analytics denied bug fixed around line 351.
- Additional fixes: CSS initial hide for `acceptBtnSettingsLabel`, Bootstrap 5 compatibility reset.
- Consent Mode v2 init is before the GTM snippet in `templates/site/layout-logged.php`.
### Cookie Notice Hotfix (Phase 4 - COMPLETE)
- Reported browser error: `Uncaught ReferenceError: injectScripts is not defined`.
- Root cause: `libraries/CookieNoticePro/cookienoticepro.script.js` called `injectScripts()` but this function was absent in the local library copy.
- Applied fix: removed both `injectScripts()` calls from `libraries/CookieNoticePro/cookienoticepro.script.js`.
- Verification passed: no `injectScripts` references remain, `node --check` passes, and layout still contains Consent Mode v2, GTM, and `cookieNoticePro.init()`.
- Summary: `.paul/phases/04-cookie-notice-bugfix/04-01-SUMMARY.md`.
### Current Plan Context
- Plan path: `.paul/phases/05-purchase-redirect-hardening/05-01-PLAN.md`.
- Current uncommitted source changes include `templates/site/layout-logged.php` consent restore and `templates/tickets/przelewy24.php` temporary manual redirect button.
- Applied changes: `templates/tickets/przelewy24.php` now guards purchase with `sessionStorage` per transaction and auto-submits to Przelewy24 after a 5-second countdown; `templates/site/layout-logged.php` preserves saved consent restore before GTM.
- Final UI adjustment: visible fallback button removed; redirect message is a centered Bootstrap alert with countdown.
- Verification passed: PHP lint for both modified templates, grep checks for purchase guard/countdown/consent restore, and user browser approval.
- Summary: `.paul/phases/05-purchase-redirect-hardening/05-01-SUMMARY.md`.
- Existing unrelated uncommitted change: `.vscode/ftp-kr.sync.cache.json` must remain untouched.
### Deferred Issues
None.
@@ -65,16 +62,16 @@ None.
None.
### Git State
Last commit: current phase commit (`feat(04-cookie-notice-bugfix): fix CookieNoticePro injectScripts error`)
Last commit: current phase commit (`feat(05-purchase-redirect-hardening): harden purchase redirect tracking`)
Branch: main
Feature branches merged: none
## Session Continuity
Last session: 2026-05-08
Stopped at: v0.3 hotfix milestone complete
Stopped at: v0.4 milestone complete
Next action: Start next milestone when needed
Resume file: .paul/phases/04-cookie-notice-bugfix/04-01-SUMMARY.md
Resume file: .paul/phases/05-purchase-redirect-hardening/05-01-SUMMARY.md
---
*STATE.md - Updated after every significant action*