Daaviid354541 commited on
Commit
e01f959
·
verified ·
1 Parent(s): 44a1294

Delete index.html

Browse files
Files changed (1) hide show
  1. index.html +0 -467
index.html DELETED
@@ -1,467 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="fr">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Mindstack — Ressources pour esprits exigeants</title>
7
- <link rel="preconnect" href="https://fonts.googleapis.com">
8
- <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Instrument+Sans:wght@400;500;600&family=DM+Mono:wght@400&display=swap" rel="stylesheet">
9
- <style>
10
- :root {
11
- --ink: #0f0e0c;
12
- --paper: #f5f2eb;
13
- --cream: #ede9df;
14
- --rule: #d4cfc3;
15
- --accent: #c8391a;
16
- --gold: #b8860b;
17
- --muted: #7a7569;
18
- --fh: 'Playfair Display', Georgia, serif;
19
- --fb: 'Instrument Sans', sans-serif;
20
- --fm: 'DM Mono', monospace;
21
- }
22
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
23
- html { scroll-behavior: smooth; }
24
- body { background: var(--paper); color: var(--ink); font-family: var(--fb); font-size: 15px; line-height: 1.6; overflow-x: hidden; }
25
- body::after { content:''; position:fixed; inset:0; pointer-events:none; z-index:900; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"); opacity:.5; }
26
-
27
- #bar { position:fixed; top:0; left:0; height:3px; background:var(--accent); width:0%; z-index:1000; transition:width .08s linear; }
28
-
29
- nav { position:sticky; top:0; z-index:200; display:flex; align-items:center; justify-content:space-between; padding:.9rem 2.5rem; background:rgba(245,242,235,.92); backdrop-filter:blur(8px); border-bottom:1.5px solid var(--rule); }
30
- .logo { font-family:var(--fh); font-size:1.35rem; font-weight:900; letter-spacing:-.03em; }
31
- .logo sup { font-family:var(--fm); font-size:.55rem; letter-spacing:.1em; color:var(--muted); vertical-align:super; }
32
- .nav-profile { font-family:var(--fm); font-size:.7rem; color:var(--muted); }
33
- .nav-profile span { color:var(--accent); }
34
-
35
- .masthead { border-bottom:1.5px solid var(--rule); padding:4rem 2.5rem 3rem; display:grid; grid-template-columns:1fr 340px; gap:3rem; align-items:end; max-width:1100px; margin:0 auto; }
36
- .masthead-kicker { font-family:var(--fm); font-size:.68rem; letter-spacing:.18em; text-transform:uppercase; color:var(--muted); margin-bottom:1rem; }
37
- .masthead h1 { font-family:var(--fh); font-size:clamp(2.6rem,5.5vw,4.5rem); font-weight:900; line-height:1.0; letter-spacing:-.04em; }
38
- .masthead h1 em { font-style:italic; color:var(--accent); }
39
- .masthead-sub { margin-top:1.2rem; color:var(--muted); font-size:.95rem; max-width:480px; line-height:1.7; }
40
- .masthead-aside { border-left:1.5px solid var(--rule); padding-left:2rem; }
41
- .aside-label { font-family:var(--fm); font-size:.65rem; letter-spacing:.15em; text-transform:uppercase; color:var(--muted); margin-bottom:.8rem; }
42
- .aside-profile-grid { display:grid; grid-template-columns:1fr 1fr; gap:.5rem; }
43
- .profile-chip { background:var(--cream); border:1px solid var(--rule); border-radius:3px; padding:.4rem .6rem; font-family:var(--fm); font-size:.65rem; }
44
- .profile-chip .chip-label { color:var(--muted); display:block; }
45
- .profile-chip .chip-val { color:var(--ink); font-weight:500; }
46
- .dynamic-badge { margin-top:1rem; background:var(--ink); color:var(--paper); border-radius:3px; padding:.5rem .8rem; font-size:.72rem; font-family:var(--fm); line-height:1.5; }
47
- .dynamic-badge strong { color:var(--accent); }
48
-
49
- .catalogue { max-width:1100px; margin:0 auto; padding:3rem 2.5rem; }
50
- .cat-header { display:flex; align-items:baseline; justify-content:space-between; border-bottom:1.5px solid var(--rule); padding-bottom:.6rem; margin-bottom:2.5rem; }
51
- .cat-header h2 { font-family:var(--fh); font-size:1.1rem; font-weight:700; letter-spacing:-.02em; }
52
- .cat-header .count { font-family:var(--fm); font-size:.7rem; color:var(--muted); }
53
-
54
- .product-grid { display:grid; grid-template-columns:1.6fr 1fr 1fr; grid-template-rows:auto auto; gap:1.5px; background:var(--rule); border:1.5px solid var(--rule); }
55
- .product-card { background:var(--paper); padding:2rem; cursor:pointer; transition:background .15s; position:relative; overflow:hidden; }
56
- .product-card:hover { background:var(--cream); }
57
- .product-card.featured { grid-row:span 2; }
58
- .card-num { font-family:var(--fm); font-size:.65rem; color:var(--muted); letter-spacing:.1em; margin-bottom:1rem; }
59
- .card-cat { font-family:var(--fm); font-size:.65rem; text-transform:uppercase; letter-spacing:.15em; color:var(--accent); margin-bottom:.6rem; }
60
- .card-title { font-family:var(--fh); font-size:1.4rem; font-weight:700; letter-spacing:-.03em; line-height:1.15; margin-bottom:.8rem; }
61
- .product-card.featured .card-title { font-size:2rem; }
62
- .card-desc { font-size:.85rem; color:var(--muted); line-height:1.65; margin-bottom:1.5rem; }
63
- .card-price-wrap { display:flex; align-items:baseline; gap:.6rem; margin-bottom:.3rem; }
64
- .card-price { font-family:var(--fh); font-size:1.8rem; font-weight:900; letter-spacing:-.04em; }
65
- .product-card.featured .card-price { font-size:2.4rem; }
66
- .card-price-orig { font-family:var(--fm); font-size:.72rem; color:var(--muted); text-decoration:line-through; }
67
- .card-price-reason { font-family:var(--fm); font-size:.62rem; color:var(--gold); margin-bottom:1.2rem; }
68
- .card-tags { display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1.5rem; }
69
- .tag { background:var(--cream); border:1px solid var(--rule); border-radius:2px; padding:.2rem .5rem; font-family:var(--fm); font-size:.6rem; color:var(--muted); }
70
- .btn-card { width:100%; background:var(--ink); color:var(--paper); border:none; padding:.75rem 1rem; font-family:var(--fb); font-weight:600; font-size:.85rem; cursor:pointer; border-radius:2px; transition:background .15s, transform .1s; }
71
- .btn-card:hover { background:var(--accent); transform:translateY(-1px); }
72
- .btn-card:disabled { background:var(--rule); color:var(--muted); cursor:default; transform:none; }
73
- .ab-badge { position:absolute; top:1rem; right:1rem; background:var(--gold); color:#fff; font-family:var(--fm); font-size:.58rem; padding:.2rem .45rem; border-radius:2px; letter-spacing:.08em; }
74
-
75
- .exp-section { max-width:1100px; margin:0 auto; padding:0 2.5rem 4rem; }
76
- .exp-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1.5px; background:var(--rule); border:1.5px solid var(--rule); }
77
- .exp-cell { background:var(--cream); padding:1.4rem; }
78
- .exp-cell-label { font-family:var(--fm); font-size:.65rem; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); margin-bottom:.4rem; }
79
- .exp-cell-val { font-family:var(--fh); font-size:1.4rem; font-weight:700; letter-spacing:-.03em; }
80
- .exp-cell-sub { font-size:.75rem; color:var(--muted); margin-top:.2rem; }
81
-
82
- footer { border-top:1.5px solid var(--rule); padding:1.5rem 2.5rem; display:flex; justify-content:space-between; align-items:center; font-size:.75rem; color:var(--muted); max-width:1100px; margin:0 auto; }
83
- footer a { color:var(--accent); text-decoration:none; }
84
-
85
- .modal-bg { position:fixed; inset:0; background:rgba(15,14,12,.6); backdrop-filter:blur(4px); z-index:500; display:none; align-items:center; justify-content:center; }
86
- .modal-bg.open { display:flex; }
87
- .modal { background:var(--paper); border:1.5px solid var(--rule); max-width:460px; width:90%; padding:2.5rem; position:relative; animation:modalIn .2s ease; }
88
- @keyframes modalIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
89
- .modal-close { position:absolute; top:1rem; right:1rem; background:none; border:none; font-size:1.2rem; cursor:pointer; color:var(--muted); }
90
- .modal-cat { font-family:var(--fm); font-size:.65rem; color:var(--accent); letter-spacing:.15em; text-transform:uppercase; margin-bottom:.5rem; }
91
- .modal-title { font-family:var(--fh); font-size:1.5rem; font-weight:700; margin-bottom:.5rem; letter-spacing:-.03em; }
92
- .modal-price { font-family:var(--fh); font-size:2rem; font-weight:900; margin-bottom:.3rem; }
93
- .modal-reason{ font-family:var(--fm); font-size:.65rem; color:var(--gold); margin-bottom:1.2rem; }
94
- .modal-features { list-style:none; margin-bottom:1.5rem; }
95
- .modal-features li { padding:.4rem 0; border-bottom:1px solid var(--rule); font-size:.85rem; display:flex; gap:.5rem; }
96
- .modal-features li::before { content:'→'; color:var(--accent); }
97
- .modal-btn { width:100%; background:var(--ink); color:var(--paper); border:none; padding:.9rem; font-family:var(--fb); font-weight:600; font-size:.95rem; cursor:pointer; border-radius:2px; transition:background .15s; }
98
- .modal-btn:hover { background:var(--accent); }
99
- .modal-legal { font-size:.65rem; color:var(--muted); text-align:center; margin-top:.8rem; }
100
-
101
- #toast { position:fixed; bottom:1.5rem; left:50%; transform:translateX(-50%); background:var(--ink); color:var(--paper); padding:.7rem 1.5rem; border-radius:3px; font-family:var(--fm); font-size:.78rem; opacity:0; transition:opacity .3s; z-index:800; white-space:nowrap; border-left:3px solid var(--accent); }
102
- #toast.show { opacity:1; }
103
-
104
- #loading-overlay { position:fixed; inset:0; background:var(--paper); z-index:9999; display:flex; align-items:center; justify-content:center; font-family:var(--fm); font-size:.8rem; color:var(--muted); }
105
-
106
- @media (max-width:768px) {
107
- .masthead { grid-template-columns:1fr; }
108
- .masthead-aside { border-left:none; border-top:1.5px solid var(--rule); padding-left:0; padding-top:1.5rem; }
109
- .product-grid { grid-template-columns:1fr; }
110
- .product-card.featured { grid-row:span 1; }
111
- }
112
- </style>
113
- </head>
114
- <body>
115
- <!-- Overlay de chargement : masque la page tant que le variant A/B n'est pas reçu du backend -->
116
- <div id="loading-overlay">Initialisation du profil...</div>
117
-
118
- <div id="bar"></div>
119
-
120
- <nav>
121
- <div class="logo">Mindstack<sup>®</sup></div>
122
- <div class="nav-profile">profil : <span id="nav-os">—</span> · <span id="nav-src">—</span> · mult <span id="nav-mult">×1.00</span></div>
123
- </nav>
124
-
125
- <div class="masthead">
126
- <div>
127
- <div class="masthead-kicker">✦ Catalogue printemps 2025 — Prix dynamiques</div>
128
- <h1>Ressources pour<br><em>esprits</em><br>exigeants.</h1>
129
- <p class="masthead-sub">Trois produits digitaux. Prix calculés en temps réel selon votre profil de navigation, votre appareil, et votre comportement sur la page.</p>
130
- </div>
131
- <div class="masthead-aside">
132
- <div class="aside-label">Votre profil détecté</div>
133
- <div class="aside-profile-grid">
134
- <div class="profile-chip"><span class="chip-label">Appareil</span><span class="chip-val" id="chip-os">—</span></div>
135
- <div class="profile-chip"><span class="chip-label">Source</span><span class="chip-val" id="chip-src">—</span></div>
136
- <div class="profile-chip"><span class="chip-label">Visite N°</span><span class="chip-val" id="chip-visit">1</span></div>
137
- <div class="profile-chip"><span class="chip-label">Segment</span><span class="chip-val" id="chip-seg">—</span></div>
138
- </div>
139
- <div class="dynamic-badge">
140
- Multiplicateur actif : <strong id="chip-mult">×1.00</strong><br>
141
- <span id="chip-reason" style="opacity:.7">calcul en cours...</span>
142
- </div>
143
- </div>
144
- </div>
145
-
146
- <div class="catalogue">
147
- <div class="cat-header">
148
- <h2>Sélection du moment</h2>
149
- <span class="count" id="cat-count">3 produits · prix personnalisés</span>
150
- </div>
151
- <div class="product-grid" id="product-grid"></div>
152
- </div>
153
-
154
- <div class="exp-section">
155
- <div class="cat-header"><h2>Session live</h2><span class="count">mise à jour toutes les 5s</span></div>
156
- <div class="exp-grid">
157
- <div class="exp-cell"><div class="exp-cell-label">Scroll</div><div class="exp-cell-val" id="m-scroll">0%</div><div class="exp-cell-sub">profondeur max</div></div>
158
- <div class="exp-cell"><div class="exp-cell-label">Temps</div><div class="exp-cell-val" id="m-time">0s</div><div class="exp-cell-sub">sur la page</div></div>
159
- <div class="exp-cell"><div class="exp-cell-label">Clics</div><div class="exp-cell-val" id="m-clicks">0</div><div class="exp-cell-sub">interactions</div></div>
160
- <div class="exp-cell"><div class="exp-cell-label">Multiplicateur</div><div class="exp-cell-val" id="m-mult">×1.00</div><div class="exp-cell-sub">prix appliqué</div></div>
161
- <div class="exp-cell"><div class="exp-cell-label">Segment</div><div class="exp-cell-val" id="m-seg">—</div><div class="exp-cell-sub">profil calculé</div></div>
162
- <div class="exp-cell"><div class="exp-cell-label">Variante A/B</div><div class="exp-cell-val" id="m-ab">—</div><div class="exp-cell-sub">assigné par serveur</div></div>
163
- </div>
164
- </div>
165
-
166
- <footer>
167
- <span>© 2025 Mindstack · Projet expérimental de recherche</span>
168
- <span>Aucun paiement réel · Données anonymisées RGPD · <a href="#">Mentions légales</a></span>
169
- </footer>
170
-
171
- <div class="modal-bg" id="modal-bg" onclick="closeModal(event)">
172
- <div class="modal">
173
- <button class="modal-close" onclick="closeModal()">✕</button>
174
- <div class="modal-cat" id="m-cat"></div>
175
- <div class="modal-title" id="m-title"></div>
176
- <div class="modal-price" id="m-price"></div>
177
- <div class="modal-reason" id="m-reason"></div>
178
- <ul class="modal-features" id="m-feats"></ul>
179
- <button class="modal-btn" id="m-btn" onclick="confirmAchat()">Obtenir maintenant</button>
180
- <div class="modal-legal">Simulation — aucun paiement réel n'est effectué.</div>
181
- </div>
182
- </div>
183
-
184
- <div id="toast"></div>
185
-
186
- <script>
187
- // ════════════════════════════════════════════════════════
188
- // CONFIG — remplace par l'URL de ton Space HuggingFace
189
- // ════════════════════════════════════════════════════════
190
- const API_URL = "https://TON-USERNAME-mindstack-tracker.hf.space";
191
-
192
- const PRODUITS = [
193
- { id:"focusflow", cat:"Ebook · 127 pages", title:"FocusFlow", subtitle:"Le guide pour doubler ta productivité en 30 jours sans épuisement.", prix_base:9, featured:true, features:["127 pages actionnables","Plan 30 jours détaillé","Templates PDF inclus","Mises à jour gratuites"], tags:["productivité","focus","habitudes"] },
194
- { id:"systemkit", cat:"Template · Notion", title:"SystemKit", subtitle:"Un OS personnel Notion pour organiser vie pro et perso en un seul endroit.", prix_base:19, featured:false, features:["Dashboard tout-en-un","50+ templates","Guide de setup 1h","Accès communauté"], tags:["notion","organisation","templates"] },
195
- { id:"deepwork", cat:"Mini-cours · Vidéo", title:"Deep Work Sprint", subtitle:"5 modules vidéo pour maîtriser le travail en profondeur, même en open-space.", prix_base:29, featured:false, features:["5 modules (3h total)","Exercices pratiques","Accès à vie","Sous-titres FR/EN"], tags:["vidéo","deep work","concentration"] },
196
- ];
197
-
198
- // ════════════════════════════════════════════════════════
199
- // SESSION — identité stable par navigateur
200
- // ════════════════════════════════════════════════════════
201
- const SESSION = {
202
- // UUID stable pour ce navigateur (pas réinitialisé à chaque visite)
203
- id: localStorage.getItem("ms_session_id") || crypto.randomUUID(),
204
- start: Date.now(),
205
- os: detectOS(),
206
- source: new URLSearchParams(location.search).get("utm_source") || "direct",
207
- visits: +localStorage.getItem("ms_visits") || 0,
208
- scroll_max: 0,
209
- clicks: 0,
210
- panier_ids: [],
211
- achats: [],
212
- // ab_variant : null jusqu'à la réponse du backend (JAMAIS généré côté client)
213
- ab_variant: null,
214
- multiplicateur: 1.0,
215
- segment: "standard",
216
- _scroll85: false,
217
- _initialized: false,
218
- };
219
-
220
- localStorage.setItem("ms_session_id", SESSION.id);
221
- localStorage.setItem("ms_visits", SESSION.visits + 1);
222
-
223
- function detectOS() {
224
- const ua = navigator.userAgent;
225
- if (/iPhone|iPad/.test(ua)) return "iOS";
226
- if (/Macintosh/.test(ua)) return "macOS";
227
- if (/Android/.test(ua)) return "Android";
228
- if (/Windows/.test(ua)) return "Windows";
229
- return "Linux";
230
- }
231
-
232
- // ════════════════════════════════════════════════════════
233
- // INITIALISATION — récupérer le variant A/B du backend
234
- // AVANT tout rendu de prix ou tracking
235
- // ════════════════════════════════════════════════════════
236
- async function initSession() {
237
- try {
238
- const res = await fetch(`${API_URL}/ab-assign?session_id=${SESSION.id}`);
239
- const json = await res.json();
240
- SESSION.ab_variant = json.ab_variant;
241
- } catch(e) {
242
- // Fallback si le backend est inaccessible : variant neutre A
243
- SESSION.ab_variant = "A";
244
- console.warn("AB assign fallback to A:", e);
245
- }
246
- SESSION._initialized = true;
247
- document.getElementById("loading-overlay").style.display = "none";
248
- renderCatalogue();
249
- sendEvent("session_start");
250
- }
251
-
252
- // ════════════════════════════════════════════════════════
253
- // MOTEUR DE PRIX — identique à la logique GBM
254
- // Le variant A/B ne modifie PAS le multiplicateur de prix
255
- // Il est enregistré comme variable indépendante pour l'analyse
256
- // ════════════════════════════════════════════════════════
257
- //
258
- // IMPORTANT anti-biais : les variantes A/B testent UNE SEULE chose
259
- // (ex: mise en page, couleur bouton, texte CTA) — PAS le prix lui-même
260
- // Car si variant B = prix plus élevé, le multiplicateur confond
261
- // l'effet du variant avec l'effet-prix.
262
- //
263
- // Les multiplicateurs comportementaux ci-dessous sont purs (sans A/B).
264
-
265
- const AB_PRICE_MULT = { A: 1.00, B: 1.00, C: 1.00 }; // tous neutres par défaut
266
- // → Pour tester l'effet prix, utilise un paramètre séparé contrôlé côté backend
267
-
268
- function calculerProfil() {
269
- const scroll = SESSION.scroll_max;
270
- const temps = (Date.now() - SESSION.start) / 1000;
271
- let mult = 1.0, raisons = [], segment = "standard";
272
-
273
- // OS — proxy richesse
274
- const os_mult = { iOS:1.30, macOS:1.20, Android:1.00, Windows:0.95, Linux:0.90 };
275
- mult *= (os_mult[SESSION.os] || 1.0);
276
- if (SESSION.os === "iOS" || SESSION.os === "macOS") { raisons.push("device premium"); segment = "premium"; }
277
-
278
- // Visite retour
279
- if (SESSION.visits > 0) { mult *= 1.10; raisons.push("retour"); segment = segment === "premium" ? "premium_fidele" : "fidele"; }
280
- // Multi-session
281
- if (SESSION.visits > 1) { mult *= 1.08; raisons.push("multi"); }
282
- // Scroll complet
283
- if (scroll >= 0.85) { mult *= 1.12; raisons.push("scroll complet"); }
284
- else if (scroll >= 0.5) { mult *= 1.05; }
285
- // Temps engagé
286
- if (temps >= 180) { mult *= 1.08; raisons.push("temps long"); }
287
- // Source comparateur
288
- if (SESSION.source === "comparateur") { mult *= 0.88; raisons.push("comparateur"); segment = "deal_seeker"; }
289
- if (SESSION.source === "social") { mult *= 1.05; }
290
-
291
- // A/B : ne pas multiplier le prix ici (variant est variable indépendante)
292
- // mult *= AB_PRICE_MULT[SESSION.ab_variant] || 1.0;
293
-
294
- mult = +Math.min(Math.max(mult, 0.75), 1.80).toFixed(2);
295
- SESSION.multiplicateur = mult;
296
- SESSION.segment = segment;
297
- return { mult, raisons: raisons.join(" · "), segment, ab: SESSION.ab_variant };
298
- }
299
-
300
- function prixFinal(base, mult) {
301
- return Math.floor(base * mult) + 0.99;
302
- }
303
-
304
- // ════════════════════════════════════════════════════════
305
- // RENDU
306
- // ════════════════════════════════════════════════════════
307
- function renderProfil() {
308
- const p = calculerProfil();
309
- document.getElementById("chip-os").textContent = SESSION.os;
310
- document.getElementById("chip-src").textContent = SESSION.source;
311
- document.getElementById("chip-visit").textContent = SESSION.visits + 1;
312
- document.getElementById("chip-seg").textContent = p.segment;
313
- document.getElementById("chip-mult").textContent = "×" + p.mult;
314
- document.getElementById("chip-reason").textContent = p.raisons;
315
- document.getElementById("nav-os").textContent = SESSION.os;
316
- document.getElementById("nav-src").textContent = SESSION.source;
317
- document.getElementById("nav-mult").textContent = "×" + p.mult;
318
- document.getElementById("m-scroll").textContent = Math.round(SESSION.scroll_max*100)+"%";
319
- document.getElementById("m-time").textContent = Math.round((Date.now()-SESSION.start)/1000)+"s";
320
- document.getElementById("m-clicks").textContent = SESSION.clicks;
321
- document.getElementById("m-mult").textContent = "×"+p.mult;
322
- document.getElementById("m-seg").textContent = p.segment;
323
- document.getElementById("m-ab").textContent = "Var. "+(p.ab || "…");
324
- return p;
325
- }
326
-
327
- function renderCatalogue() {
328
- if (!SESSION._initialized) return;
329
- const p = renderProfil();
330
- const grid = document.getElementById("product-grid");
331
- grid.innerHTML = "";
332
- PRODUITS.forEach((prod, i) => {
333
- const prix = prixFinal(prod.prix_base, p.mult);
334
- const delta = prix - prod.prix_base;
335
- const sign = delta >= 0 ? "+" : "";
336
- const card = document.createElement("div");
337
- card.className = "product-card" + (prod.featured ? " featured" : "");
338
- card.innerHTML = `
339
- <div class="ab-badge">VAR.${p.ab || "…"}</div>
340
- <div class="card-num">№ ${String(i+1).padStart(2,"0")}</div>
341
- <div class="card-cat">${prod.cat}</div>
342
- <div class="card-title">${prod.title}</div>
343
- <div class="card-desc">${prod.subtitle}</div>
344
- <div class="card-tags">${prod.tags.map(t=>`<span class="tag">${t}</span>`).join("")}</div>
345
- <div class="card-price-wrap">
346
- <span class="card-price">${prix.toFixed(2)}€</span>
347
- <span class="card-price-orig">${prod.prix_base}€</span>
348
- </div>
349
- <div class="card-price-reason">${p.segment} · ×${p.mult} · ${sign}${delta.toFixed(2)}€ vs base</div>
350
- <button class="btn-card" id="btn-${prod.id}" onclick="openModal('${prod.id}')">${SESSION.achats.includes(prod.id) ? "✓ Commandé" : "Voir l'offre →"}</button>
351
- `;
352
- if (SESSION.achats.includes(prod.id)) {
353
- card.querySelector(".btn-card").disabled = true;
354
- }
355
- grid.appendChild(card);
356
- });
357
- }
358
-
359
- // ════════════════════════════════════════════════════════
360
- // MODAL
361
- // ════════════════════════════════════════════════════════
362
- let _currentProd = null;
363
- function openModal(id) {
364
- SESSION.clicks++;
365
- const prod = PRODUITS.find(p => p.id === id);
366
- const { mult } = calculerProfil();
367
- const prix = prixFinal(prod.prix_base, mult);
368
- _currentProd = { ...prod, prix };
369
- if (!SESSION.panier_ids.includes(id)) {
370
- SESSION.panier_ids.push(id);
371
- sendEvent("panier", { product_id:id, prix });
372
- }
373
- document.getElementById("m-cat").textContent = prod.cat;
374
- document.getElementById("m-title").textContent = prod.title;
375
- document.getElementById("m-price").textContent = prix.toFixed(2)+"€";
376
- document.getElementById("m-reason").textContent = `Segment: ${SESSION.segment} · Var. ${SESSION.ab_variant} · ×${mult}`;
377
- document.getElementById("m-feats").innerHTML = prod.features.map(f=>`<li>${f}</li>`).join("");
378
- const btn = document.getElementById("m-btn");
379
- btn.disabled = SESSION.achats.includes(id);
380
- btn.textContent = SESSION.achats.includes(id) ? "✓ Déjà simulé" : "Obtenir maintenant";
381
- document.getElementById("modal-bg").classList.add("open");
382
- renderProfil();
383
- }
384
- function closeModal(e) {
385
- if (!e || e.target === document.getElementById("modal-bg"))
386
- document.getElementById("modal-bg").classList.remove("open");
387
- }
388
- function confirmAchat() {
389
- if (!_currentProd || SESSION.achats.includes(_currentProd.id)) return;
390
- SESSION.achats.push(_currentProd.id);
391
- sendEvent("achat", {
392
- product_id: _currentProd.id,
393
- prix: _currentProd.prix,
394
- prix_base: _currentProd.prix_base,
395
- multiplicateur: SESSION.multiplicateur,
396
- // ab_variant n'est PAS envoyé ici : le backend le lit depuis sa propre source de vérité
397
- segment: SESSION.segment,
398
- });
399
- document.getElementById("m-btn").disabled = true;
400
- document.getElementById("m-btn").textContent = "✓ Simulé !";
401
- showToast(`✓ ${_currentProd.title} — ${_currentProd.prix.toFixed(2)}€ enregistré`);
402
- renderCatalogue();
403
- }
404
-
405
- // ════════════════════════════════════════════════════════
406
- // TRACKING
407
- // ════════════════════════════════════════════════════════
408
- function sendEvent(type, extra={}) {
409
- const payload = {
410
- session_id: SESSION.id,
411
- event: type,
412
- os: SESSION.os,
413
- source: SESSION.source,
414
- scroll_depth: +SESSION.scroll_max.toFixed(3),
415
- temps_page_s: Math.round((Date.now()-SESSION.start)/1000),
416
- est_retour: SESSION.visits > 0,
417
- multi_session: SESSION.visits > 1,
418
- nav_profonde: SESSION.visits + 1,
419
- panier_abandonne: SESSION.panier_ids.length > 0 && SESSION.achats.length === 0,
420
- multiplicateur: SESSION.multiplicateur,
421
- segment: SESSION.segment,
422
- // ab_variant : intentionnellement absent — le backend l'assigne lui-même
423
- nb_clics: SESSION.clicks,
424
- ...extra,
425
- };
426
- fetch(API_URL+"/track", {
427
- method: "POST",
428
- headers: {"Content-Type": "application/json"},
429
- body: JSON.stringify(payload),
430
- keepalive: true,
431
- }).catch(()=>{});
432
- }
433
-
434
- window.addEventListener("scroll", () => {
435
- const pct = window.scrollY / (document.body.scrollHeight - window.innerHeight) || 0;
436
- SESSION.scroll_max = Math.max(SESSION.scroll_max, pct);
437
- document.getElementById("bar").style.width = (pct*100)+"%";
438
- if (pct >= 0.85 && !SESSION._scroll85) { SESSION._scroll85=true; renderCatalogue(); }
439
- });
440
-
441
- document.addEventListener("visibilitychange", () => {
442
- if (document.visibilityState === "hidden")
443
- navigator.sendBeacon(API_URL+"/track", JSON.stringify({
444
- session_id: SESSION.id,
445
- event: "abandon",
446
- os: SESSION.os,
447
- source: SESSION.source,
448
- scroll_depth: SESSION.scroll_max,
449
- temps_page_s: Math.round((Date.now()-SESSION.start)/1000),
450
- panier_abandonne: SESSION.panier_ids.length > 0 && SESSION.achats.length === 0,
451
- nb_clics: SESSION.clicks,
452
- }));
453
- });
454
-
455
- function showToast(msg) {
456
- const t = document.getElementById("toast");
457
- t.textContent = msg; t.classList.add("show");
458
- setTimeout(()=>t.classList.remove("show"), 4000);
459
- }
460
-
461
- setInterval(()=>{ renderProfil(); }, 5000);
462
-
463
- // Lancement : init async puis render
464
- initSession();
465
- </script>
466
- </body>
467
- </html>