File size: 16,582 Bytes
36d488d
 
 
 
 
 
 
 
 
 
 
 
 
32246b9
36d488d
32246b9
 
36d488d
 
 
 
 
32246b9
36d488d
 
 
32246b9
36d488d
 
 
32246b9
 
36d488d
 
32246b9
36d488d
 
 
 
 
32246b9
36d488d
 
32246b9
36d488d
32246b9
 
 
 
 
 
 
36d488d
32246b9
 
36d488d
32246b9
 
 
 
 
 
 
 
36d488d
 
 
 
 
 
32246b9
36d488d
 
 
 
32246b9
36d488d
32246b9
36d488d
 
 
32246b9
36d488d
 
 
 
32246b9
 
 
 
36d488d
 
32246b9
36d488d
32246b9
 
 
 
 
36d488d
32246b9
 
36d488d
32246b9
36d488d
 
 
 
 
32246b9
 
36d488d
 
 
 
32246b9
36d488d
32246b9
 
36d488d
32246b9
 
 
 
36d488d
32246b9
 
 
 
 
 
 
 
 
 
 
 
36d488d
32246b9
36d488d
 
 
 
 
 
 
 
 
 
 
32246b9
 
36d488d
 
32246b9
36d488d
 
 
 
32246b9
36d488d
32246b9
 
 
36d488d
32246b9
36d488d
32246b9
 
 
36d488d
32246b9
36d488d
 
e28108d
32246b9
 
 
e28108d
36d488d
32246b9
36d488d
 
32246b9
36d488d
092070c
32246b9
36d488d
 
32246b9
36d488d
 
e28108d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36d488d
32246b9
36d488d
32246b9
 
36d488d
32246b9
36d488d
32246b9
 
 
36d488d
32246b9
36d488d
 
 
 
 
 
 
 
 
 
32246b9
36d488d
 
 
e28108d
36d488d
 
 
 
 
 
 
 
 
 
e28108d
 
 
 
 
 
 
 
 
36d488d
 
 
 
 
32246b9
e28108d
32246b9
 
 
 
 
 
 
 
e28108d
32246b9
 
e28108d
 
32246b9
 
 
 
36d488d
 
32246b9
 
36d488d
 
 
 
32246b9
36d488d
 
 
 
32246b9
 
36d488d
 
 
32246b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36d488d
 
 
 
 
32246b9
 
 
 
 
36d488d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Creator Plans — ViralFlow AI</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&family=Plus+Jakarta+Sans:wght@300;400;600;700&display=swap" rel="stylesheet">
    <script src="https://unpkg.com/lucide@latest"></script>
    <script src="https://checkout.razorpay.com/v1/checkout.js"></script>
    <style>
        :root {
            --bg: #030712;
            --surface: #0f172a;
            --accent: #8b5cf6;
            --accent-light: #c084fc;
            --text: #f8fafc;
            --text-dim: #94a3b8;
            --glass: rgba(255, 255, 255, 0.03);
            --glass-border: rgba(255, 255, 255, 0.08);
            --success: #10b981;
            --danger: #ef4444;
        }

        body {
            background: radial-gradient(circle at top right, #1e1b4b, #030712);
            color: var(--text);
            font-family: 'Plus Jakarta Sans', sans-serif;
            margin: 0;
            padding: 20px;
            min-height: 100vh;
        }

        .container { width: 100%; max-width: 1000px; margin: 0 auto; padding-top: 40px; }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 40px;
        }

        .logo { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 900; color: #fff; letter-spacing: -1px; }

        .btn-back { 
            color: var(--text-dim); 
            text-decoration: none; 
            display: flex; 
            align-items: center; 
            gap: 8px; 
            font-weight: 600; 
            background: var(--glass);
            padding: 10px 20px;
            border-radius: 14px;
            border: 1px solid var(--glass-border);
            font-size: 0.9rem;
            transition: 0.3s;
        }
        .btn-back:hover { background: rgba(255,255,255,0.1); color: #fff; }

        .status-panel {
            background: rgba(139, 92, 246, 0.05);
            border: 1px solid rgba(139, 92, 246, 0.15);
            padding: 30px;
            border-radius: 32px;
            margin-bottom: 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            backdrop-filter: blur(20px);
        }

        .plans-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 25px;
            margin-bottom: 60px;
        }

        .plan-card {
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid var(--glass-border);
            padding: 40px;
            border-radius: 40px;
            position: relative;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            backdrop-filter: blur(20px);
            display: flex;
            flex-direction: column;
        }

        .plan-card:hover { transform: translateY(-10px); border-color: var(--accent); box-shadow: 0 20px 40px rgba(0,0,0,0.4); }

        .plan-card.active-plan {
            border: 2px solid var(--accent);
            background: linear-gradient(180deg, rgba(139, 92, 246, 0.1) 0%, rgba(15, 23, 42, 0.8) 100%);
            box-shadow: 0 0 30px rgba(139, 92, 246, 0.1);
        }

        .price { font-size: 3.5rem; font-weight: 900; margin: 20px 0; font-family: 'Outfit', sans-serif; letter-spacing: -2px; }
        .old-price { text-decoration: line-through; color: var(--text-dim); font-size: 1.2rem; margin-right: 10px; opacity: 0.5; }

        .features { list-style: none; padding: 0; margin: 30px 0; flex: 1; }
        .features li { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; font-size: 0.95rem; color: var(--text-dim); }
        .features li i { color: var(--success); width: 18px; }

        .btn-buy {
            width: 100%;
            padding: 18px;
            border-radius: 22px;
            border: none;
            background: var(--accent);
            color: white;
            font-weight: 800;
            font-size: 1.1rem;
            cursor: pointer;
            transition: 0.3s;
            box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
        }
        .btn-buy:hover { transform: scale(1.02); filter: brightness(1.1); }
        .btn-buy:disabled { background: var(--glass); color: var(--text-dim); cursor: default; box-shadow: none; }

        .tag { position: absolute; top: -15px; left: 40px; background: var(--accent); color: white; padding: 8px 16px; border-radius: 12px; font-size: 0.75rem; font-weight: 900; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

        .current-label {
            position: absolute;
            top: 20px;
            right: 20px;
            background: var(--success);
            color: white;
            padding: 4px 10px;
            border-radius: 8px;
            font-size: 0.65rem;
            font-weight: 900;
            display: none;
        }

        @media (max-width: 700px) { body { padding: 15px; } .plans-grid { grid-template-columns: 1fr; } .status-panel { flex-direction: column; gap: 20px; text-align: center; } }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <a href="index.html" class="btn-back"><i data-lucide="arrow-left"></i> Dashboard</a>
            <div class="logo">ViralFlow AI</div>
        </header>

        <div class="status-panel">
            <div>
                <div style="font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; font-weight: 800; letter-spacing: 1px;">Current Tier</div>
                <div id="current-plan" style="font-size: 1.8rem; font-weight: 900; margin-top: 5px; font-family: 'Outfit';">Loading...</div>
            </div>
            <div style="text-align: right;">
                <div style="font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; font-weight: 800; letter-spacing: 1px;">Access Validity</div>
                <div id="expiry-date" style="font-size: 1.1rem; font-weight: 700; margin-top: 5px; color: var(--accent-light);">Loading...</div>
            </div>
        </div>

        <div class="plans-grid">
            <!-- FREE PLAN -->
            <div class="plan-card" id="card-free">
                <div class="current-label">ACTIVE</div>
                <div style="font-weight: 800; color: var(--text-dim); font-size: 0.8rem; letter-spacing: 1px;">CREATOR START</div>
                <div class="price">₹0</div>
                <div style="color: var(--text-dim); font-size: 0.85rem;">For new creators testing the waters</div>
                <ul class="features">
                    <li><i data-lucide="check-circle-2"></i> 1 Video / Day</li>
                    <li><i data-lucide="check-circle-2"></i> Standard Processing</li>
                    <li><i data-lucide="x-circle" style="color: var(--danger); opacity:0.3;"></i> Multi-Channel Support</li>
                </ul>
                <button class="btn-buy" disabled>Free Forever</button>
            </div>

            <!-- PRO MONTHLY -->
            <div class="plan-card featured" id="card-pro">
                <div class="tag">MOST POPULAR</div>
                <div class="current-label">ACTIVE</div>
                <div style="font-weight: 800; color: var(--accent-light); font-size: 0.8rem; letter-spacing: 1px;">PRO MONTHLY</div>
                <div class="price">
                    <span id="old-m" style="display: none;" class="old-price">₹499</span>
                    <span id="new-m">₹299</span>
                </div>
                <div style="color: var(--text-dim); font-size: 0.85rem;">+30 Days of Unlimited Growth</div>
                <ul class="features">
                    <li><i data-lucide="check-circle-2"></i> 2 YouTube Channels</li>
                    <li><i data-lucide="check-circle-2"></i> 5 Videos / Day</li>
                    <li><i data-lucide="check-circle-2"></i> Auto-Scheduling Engine</li>
                </ul>
                <button class="btn-buy" id="btn-pro" onclick="buyPlan('pro_monthly')">Add 30 Days</button>
            </div>

            <!-- PRO YEARLY -->
            <div class="plan-card featured" id="card-pro-yearly" style="border-color: #10b981;">
                <div class="tag" style="background: #10b981;">BEST VALUE</div>
                <div class="current-label">ACTIVE</div>
                <div style="font-weight: 800; color: #10b981; font-size: 0.8rem; letter-spacing: 1px;">PRO YEARLY</div>
                <div class="price">
                    <span id="old-y" style="display: none;" class="old-price">₹4,999</span>
                    <span id="new-y">₹2,999</span>
                </div>
                <div style="color: var(--text-dim); font-size: 0.85rem;">+365 Days of Global Dominance</div>
                <ul class="features">
                    <li><i data-lucide="check-circle-2"></i> 2 YouTube Channels</li>
                    <li><i data-lucide="check-circle-2"></i> 5 Videos / Day</li>
                    <li><i data-lucide="check-circle-2"></i> Priority Support</li>
                </ul>
                <button class="btn-buy" id="btn-pro-y" onclick="buyPlan('pro_yearly')" style="background: #10b981;">Add 365 Days</button>
            </div>

            <!-- ULTRA PLAN -->
            <div class="plan-card" id="card-ultra" style="border-color: #f59e0b;">
                <div class="tag" style="background: #f59e0b;">GOD MODE</div>
                <div class="current-label">ACTIVE</div>
                <div style="font-weight: 800; color: #f59e0b; font-size: 0.8rem; letter-spacing: 1px;">ULTRA UNLIMITED</div>
                <div class="price">👑</div>
                <div style="color: var(--text-dim); font-size: 0.85rem;">Maximum Power. No Boundaries.</div>
                <ul class="features">
                    <li><i data-lucide="zap" style="color: #f59e0b;"></i> Unlimited Production</li>
                    <li><i data-lucide="zap" style="color: #f59e0b;"></i> Bulk Management</li>
                    <li><i data-lucide="zap" style="color: #f59e0b;"></i> Personal Account Manager</li>
                </ul>
                <button class="btn-buy" style="background: #f59e0b;" disabled>Contact Sales</button>
            </div>
        </div>
    </div>

    <script>
        const authToken = localStorage.getItem('saas_token');
        if (!authToken) window.location.href = 'index.html';

        async function init() {
            try {
                // 1. Load Pricing
                const pRes = await fetch(`/api/platform/pricing?t=${Date.now()}`);
                const p = await pRes.json();
                const monthlyBase = p.pro_monthly || 299;
                const yearlyBase = p.pro_yearly || 2999;

                if (p.m_discount_active) {
                    document.getElementById('old-m').innerText = `₹${monthlyBase}`;
                    document.getElementById('old-m').style.display = 'inline';
                    document.getElementById('new-m').innerText = `₹${Math.round(monthlyBase * (1 - p.discount_percent/100))}`;
                } else {
                    document.getElementById('old-m').style.display = 'none';
                    document.getElementById('new-m').innerText = `₹${monthlyBase}`;
                }

                if (p.y_discount_active) {
                    document.getElementById('old-y').innerText = `₹${yearlyBase}`;
                    document.getElementById('old-y').style.display = 'inline';
                    document.getElementById('new-y').innerText = `₹${Math.round(yearlyBase * (1 - p.discount_percent/100))}`;
                } else {
                    document.getElementById('old-y').style.display = 'none';
                    document.getElementById('new-y').innerText = `₹${yearlyBase}`;
                }

                // 2. Load User Status
                const res = await fetch('/api/auth/me', { headers: { 'Authorization': `Bearer ${authToken}` } });
                const user = await res.json();
                
                if (user.loggedIn) {
                    let plan = user.plan || 'free';
                    if (user.role === 'admin') plan = 'ultra';

                    let statusText = '🛡️ FREE START';
                    if (plan === 'ultra') {
                        statusText = '☢️ GOD MODE';
                        document.getElementById('card-ultra').classList.add('active-plan');
                        document.getElementById('card-ultra').querySelector('.current-label').style.display = 'block';
                    } else if (plan === 'pro' || plan === 'premium') {
                        statusText = '⚡ PRO CREATOR';
                        // Highlight Both Pro Cards as they fall under Pro tier
                        document.getElementById('card-pro').classList.add('active-plan');
                        document.getElementById('card-pro').querySelector('.current-label').style.display = 'block';
                        document.getElementById('card-pro-yearly').classList.add('active-plan');
                        document.getElementById('card-pro-yearly').querySelector('.current-label').style.display = 'block';
                    } else {
                        document.getElementById('card-free').classList.add('active-plan');
                        document.getElementById('card-free').querySelector('.current-label').style.display = 'block';
                    }
                    
                    document.getElementById('current-plan').innerText = statusText;

                    if (user.role === 'admin' || plan === 'ultra') {
                        document.getElementById('expiry-date').innerText = '∞ Permanent Access';
                    } else if (user.expires_at) {
                        const date = new Date(user.expires_at).toLocaleDateString('en-IN', { day: 'numeric', month: 'long', year: 'numeric' });
                        const daysLeft = Math.ceil((new Date(user.expires_at) - new Date()) / (1000 * 60 * 60 * 24));
                        document.getElementById('expiry-date').innerText = daysLeft > 0 ? `${date} (${daysLeft} Days Left)` : 'Expired';
                    } else {
                        document.getElementById('expiry-date').innerText = 'No Active Plan';
                    }
                }
                lucide.createIcons();
            } catch (e) { console.error(e); }
        }

        async function buyPlan(plan) {
            const btn = event.target;
            const orig = btn.innerText;
            btn.innerText = "Securing Order...";
            try {
                const res = await fetch('/api/payments/create-order', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${authToken}` },
                    body: JSON.stringify({ plan })
                });
                const order = await res.json();
                
                const options = {
                    "key": "rzp_live_SlfVPYNAQ7dyZ4",
                    "amount": order.amount,
                    "currency": "INR",
                    "name": "ViralFlow AI",
                    "description": "Pro Creator Upgrade",
                    "order_id": order.id,
                    "handler": async function (response) {
                        response.plan_type = plan;
                        const verify = await fetch('/api/payments/verify', {
                            method: 'POST',
                            headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${authToken}` },
                            body: JSON.stringify(response)
                        });
                        if (verify.ok) {
                            alert("Time Stacked Successfully! 🚀💎");
                            location.reload();
                        }
                    },
                    "theme": { "color": "#8b5cf6" }
                };
                const rzp1 = new Razorpay(options);
                rzp1.open();
            } catch(e) { alert("Payment Failed"); }
            btn.innerText = orig;
        }

        init();
    </script>
</body>
</html>

        init();
    </script>
</body>
</html>