@moneybar.online/moneybar 3.7.0 → 3.8.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.
@@ -1,3099 +0,0 @@
1
- import { createClient } from '@supabase/supabase-js';
2
-
3
- /**
4
- * MoneyBar - The navbar of monetization
5
- *
6
- * Fix the 3 money-blocking stages that stop revenue:
7
- * 1. Forced sign-ins before value → Value-first trials
8
- * 2. Silent drop-offs → Exit feedback capture
9
- * 3. Broken payment flows → Seamless Google Auth + payments
10
- *
11
- * Features:
12
- * - Server-side usage tracking (incognito-proof)
13
- * - Google OAuth authentication
14
- * - Payment integration with DodoPayments
15
- * - User feedback collection
16
- * - Automatic UI management (paywall, auth, status)
17
- * - User context for personalization
18
- *
19
- * @example Simple Usage (Recommended):
20
- * ```javascript
21
- * import { MoneyBar } from '@moneybar.online/moneybar';
22
- *
23
- * const moneyBar = new MoneyBar({
24
- * appId: 'my-pdf-app',
25
- * freeAttemptLimit: 3,
26
- * supabase: { url: 'https://xyz.supabase.co', anonKey: 'anon_key' },
27
- * payment: { productId: 'prod_xyz' }
28
- * });
29
- *
30
- * // Single button - handles all monetization automatically
31
- * moneyBar.attachToButton('#action-btn', (userContext) => {
32
- * // Your action logic here - with user context for personalization
33
- * if (userContext.isPremium) {
34
- * generatePremiumPDF();
35
- * } else {
36
- * generateBasicPDF();
37
- * }
38
- * });
39
- * ```
40
- *
41
- * @example Multiple Buttons:
42
- * ```javascript
43
- * moneyBar.attachToButtons({
44
- * buttons: [
45
- * {
46
- * selector: '#free-btn',
47
- * downloadCallback: (ctx) => downloadFreeTemplate(ctx),
48
- * isPremium: false
49
- * },
50
- * {
51
- * selector: '#premium-btn',
52
- * downloadCallback: (ctx) => downloadPremiumTemplate(ctx),
53
- * isPremium: true
54
- * }
55
- * ]
56
- * });
57
- * ```
58
- */
59
- class MoneyBar {
60
- mergeConfigs(config) {
61
- // Try to get config from window.APP_CONFIG
62
- const windowConfig = typeof window !== 'undefined' ? window.APP_CONFIG : null;
63
- if (!config && !windowConfig) {
64
- throw new Error('MoneyBar: No configuration provided. Either pass config to constructor or set window.APP_CONFIG');
65
- }
66
- // If no constructor config provided, use window config entirely
67
- if (!config) {
68
- return windowConfig;
69
- }
70
- // If no window config, use constructor config entirely
71
- if (!windowConfig) {
72
- return config;
73
- }
74
- // Merge configs: constructor config takes precedence over window config
75
- return {
76
- ...windowConfig,
77
- ...config
78
- };
79
- }
80
- constructor(config) {
81
- this.currentUser = null;
82
- this.userFingerprint = null;
83
- this.eventListeners = new Map();
84
- this.supabaseConnectionFailed = false;
85
- this.paymentConnectionFailed = false;
86
- this.cachedStatus = null;
87
- this.statusCacheTime = 0;
88
- this.STATUS_CACHE_DURATION = 5000; // 5 seconds cache
89
- this.initializationPromise = null;
90
- this.cachedPremiumStatus = null;
91
- this.premiumStatusCacheTime = 0;
92
- // Auto-load from window.APP_CONFIG if no config provided, or merge configs
93
- this.config = this.mergeConfigs(config);
94
- if (this.config.options?.debug) ;
95
- this.validateConfig();
96
- this.initializeSupabase();
97
- this.initializePayment();
98
- this.initializeFingerprint();
99
- this.setupAuthListener();
100
- this.checkPaymentStatus();
101
- }
102
- /**
103
- * Main method to handle download attempts
104
- * Call this from your download button's click handler
105
- */
106
- async handleDownload() {
107
- try {
108
- // Security check: if Supabase connection failed, disable downloads to prevent localStorage bypass
109
- if (this.supabaseConnectionFailed) {
110
- this.config.callbacks?.onError?.(new Error('Server connection required for download verification. Please check your configuration.'));
111
- return;
112
- }
113
- // Security check: if payment configuration is invalid, disable downloads
114
- if (this.config.payment && this.paymentConnectionFailed) {
115
- this.config.callbacks?.onError?.(new Error('Payment configuration error. Please contact support.'));
116
- return;
117
- }
118
- // Check if user is premium first (if authenticated)
119
- if (this.currentUser) {
120
- const isPremium = await this.checkPremiumStatus(this.currentUser.email);
121
- if (isPremium) {
122
- this.config.callbacks?.onPremiumDownload();
123
- return;
124
- }
125
- }
126
- // Check usage limits (works for both authenticated and anonymous users)
127
- const status = await this.getDownloadStatus();
128
- if (status.currentCount >= status.limit) {
129
- // Limit reached - show paywall/limit message
130
- this.config.callbacks?.onLimitReached(status.currentCount, status.limit);
131
- return;
132
- }
133
- // Increment counter and proceed with action
134
- await this.incrementDownloadCount();
135
- this.config.callbacks?.onDownloadAllowed();
136
- // Invalidate cache since count changed
137
- this.cachedStatus = null;
138
- // Check if limit reached after increment
139
- const newStatus = await this.getDownloadStatus();
140
- this.emit('countChanged', { count: newStatus.currentCount, limit: newStatus.limit });
141
- if (newStatus.currentCount >= newStatus.limit) {
142
- // Show paywall for next time
143
- setTimeout(() => {
144
- this.config.callbacks?.onLimitReached(newStatus.currentCount, newStatus.limit);
145
- }, 100);
146
- }
147
- }
148
- catch (error) {
149
- this.handleError(error);
150
- }
151
- }
152
- /**
153
- * Get current download status for the user
154
- */
155
- async getDownloadStatus(forceRefresh = false) {
156
- console.log(`🔍 [INIT] getDownloadStatus called (forceRefresh: ${forceRefresh}) at ${new Date().toISOString()}`);
157
- // Check if we can use cached status
158
- const cacheAge = this.cachedStatus ? Date.now() - this.statusCacheTime : -1;
159
- const canUseCache = !forceRefresh && this.cachedStatus && cacheAge < this.STATUS_CACHE_DURATION;
160
- if (canUseCache) {
161
- console.log(`🔍 [INIT] Using cached status (age: ${cacheAge}ms)`);
162
- return this.cachedStatus;
163
- }
164
- // If there's already an initialization in progress and it's not forced refresh, wait for it
165
- if (!forceRefresh && this.initializationPromise) {
166
- console.log(`🔍 [INIT] Waiting for existing initialization promise`);
167
- return await this.initializationPromise;
168
- }
169
- console.log(`🔍 [INIT] Starting new status fetch (cache age: ${cacheAge}ms)`);
170
- // Create the initialization promise
171
- this.initializationPromise = this.fetchFreshStatus(forceRefresh);
172
- try {
173
- const result = await this.initializationPromise;
174
- console.log(`🔍 [INIT] Status fetch completed successfully`);
175
- return result;
176
- }
177
- finally {
178
- // Clear the promise after completion
179
- this.initializationPromise = null;
180
- }
181
- }
182
- async fetchFreshStatus(forceRefresh) {
183
- try {
184
- let count = 0;
185
- let isPremium = false;
186
- // Only call API if we really need fresh data
187
- if (forceRefresh || !this.cachedStatus) {
188
- // Get download count only if we don't have it cached
189
- count = await this.getDownloadCount();
190
- }
191
- else {
192
- // Use cached count if available to avoid unnecessary API call
193
- count = this.cachedStatus.currentCount;
194
- }
195
- // Check premium status only for authenticated users, and only when needed
196
- if (this.currentUser) {
197
- const premiumCacheValid = this.cachedPremiumStatus !== null && (Date.now() - this.premiumStatusCacheTime) < this.STATUS_CACHE_DURATION;
198
- if (forceRefresh || !premiumCacheValid) {
199
- console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from getDownloadStatus (forceRefresh: ${forceRefresh}, cacheValid: ${premiumCacheValid})`);
200
- isPremium = await this.checkPremiumStatus(this.currentUser.email);
201
- // Update cache
202
- this.cachedPremiumStatus = isPremium;
203
- this.premiumStatusCacheTime = Date.now();
204
- }
205
- else {
206
- // Use cached premium status to avoid unnecessary API call
207
- isPremium = this.cachedPremiumStatus; // We know it's not null because premiumCacheValid is true
208
- console.log(`🔍 [CACHE] Using cached premium status from getDownloadStatus: ${isPremium}`);
209
- }
210
- }
211
- else {
212
- // Unauthenticated users cannot be premium
213
- isPremium = false;
214
- }
215
- const status = {
216
- currentCount: count,
217
- limit: this.config.freeAttemptLimit,
218
- isPremium,
219
- isAuthenticated: !!this.currentUser,
220
- remaining: Math.max(0, this.config.freeAttemptLimit - count)
221
- };
222
- // Cache the status
223
- this.cachedStatus = status;
224
- this.statusCacheTime = Date.now();
225
- return status;
226
- }
227
- catch (error) {
228
- this.handleError(error);
229
- // Return safe defaults on error
230
- const errorStatus = {
231
- currentCount: 0,
232
- limit: this.config.freeAttemptLimit,
233
- isPremium: false,
234
- isAuthenticated: false,
235
- remaining: this.config.freeAttemptLimit
236
- };
237
- // Cache error status for short time to avoid repeated failures
238
- this.cachedStatus = errorStatus;
239
- this.statusCacheTime = Date.now();
240
- return errorStatus;
241
- }
242
- }
243
- /**
244
- * Creates a UserContext object with current user information
245
- */
246
- async getUserContext() {
247
- const status = await this.getDownloadStatus();
248
- return {
249
- isPremium: status.isPremium,
250
- isAuthenticated: status.isAuthenticated,
251
- email: this.currentUser?.email,
252
- name: this.currentUser?.user_metadata?.full_name || this.currentUser?.user_metadata?.name,
253
- currentCount: status.currentCount,
254
- remaining: status.remaining,
255
- limit: status.limit,
256
- user: this.currentUser
257
- };
258
- }
259
- /**
260
- * Manually trigger Google sign-in
261
- */
262
- async signIn() {
263
- try {
264
- const { error } = await this.supabase.auth.signInWithOAuth({
265
- provider: 'google',
266
- options: {
267
- redirectTo: `${window.location.origin}${window.location.pathname}`
268
- }
269
- });
270
- if (error)
271
- throw error;
272
- }
273
- catch (error) {
274
- this.handleError(error);
275
- }
276
- }
277
- /**
278
- * Sign out current user
279
- */
280
- async signOut() {
281
- try {
282
- await this.supabase.auth.signOut();
283
- this.currentUser = null;
284
- this.emit('authChanged', { user: null, isPremium: false });
285
- }
286
- catch (error) {
287
- this.handleError(error);
288
- }
289
- }
290
- /**
291
- * Create payment for premium upgrade
292
- */
293
- async createPayment() {
294
- if (!this.currentUser) {
295
- throw new Error('User must be signed in to create payment');
296
- }
297
- if (!this.config.payment) {
298
- throw new Error('Payment configuration not provided');
299
- }
300
- const payment = this.config.payment?.find(p => p.provider === 'dodo');
301
- if (!payment) {
302
- throw new Error('No dodo payment provider configured');
303
- }
304
- const requestBody = {
305
- email: this.currentUser.email,
306
- product_id: payment.productId,
307
- mode: payment.mode || 'test',
308
- app_id: this.config.appId,
309
- return_url: `${window.location.origin}${window.location.pathname}?payment=success`
310
- };
311
- console.log(`🔥 [PAYMENT API] createPayment called for provider: ${payment.provider}, email: ${this.currentUser.email} | Time: ${new Date().toISOString()}`);
312
- try {
313
- // Route to appropriate payment API based on provider
314
- let response;
315
- if (payment.provider === 'dodo') {
316
- response = await fetch(`${this.config.supabase.url}/functions/v1/create-payment`, {
317
- method: 'POST',
318
- headers: {
319
- 'Content-Type': 'application/json',
320
- 'Authorization': `Bearer ${this.config.supabase.anonKey}`
321
- },
322
- body: JSON.stringify(requestBody)
323
- });
324
- }
325
- else {
326
- throw new Error(`Payment provider '${payment.provider}' is not yet supported`);
327
- }
328
- console.log(`🔥 [PAYMENT API] createPayment response for ${payment.provider}: ${response.status}`);
329
- if (this.config.options?.debug) {
330
- //console.log('🔍 DEBUG: createPayment response status:', response.status);
331
- }
332
- if (!response.ok) {
333
- const errorText = await response.text();
334
- if (this.config.options?.debug) {
335
- console.error('🔍 DEBUG: createPayment error response:', errorText);
336
- }
337
- let errorData;
338
- try {
339
- errorData = JSON.parse(errorText);
340
- }
341
- catch {
342
- errorData = { error: errorText };
343
- }
344
- // Check if this is a product ID error (invalid config)
345
- if (errorText.includes('404') || errorText.includes('could not be found')) {
346
- this.paymentConnectionFailed = true;
347
- if (this.config.options?.debug) {
348
- console.warn('Invalid payment product ID detected, disabling downloads');
349
- }
350
- // Update UI to show disabled state
351
- this.updateStatusDisplays();
352
- }
353
- throw new Error(errorData.error || 'Payment creation failed');
354
- }
355
- const result = await response.json();
356
- if (this.config.options?.debug) {
357
- //console.log('🔍 DEBUG: createPayment success response:', result);
358
- }
359
- return result;
360
- }
361
- catch (error) {
362
- this.handleError(error);
363
- return null;
364
- }
365
- }
366
- /**
367
- * Simplified API: Attach download limiting to a single button
368
- * Handles all UI logic automatically (paywall, auth, payment flow)
369
- */
370
- attachToButton(selector, downloadCallback) {
371
- //console.log('🎨 [THEME DEBUG] attachToButton called');
372
- //console.log('🎨 [THEME DEBUG] Full config:', JSON.stringify(this.config, null, 2));
373
- const button = document.querySelector(selector);
374
- if (!button) {
375
- throw new Error(`Button not found: ${selector}`);
376
- }
377
- // Store original button text (for potential future use)
378
- // const originalText = button.textContent || 'Download';
379
- // Create and inject UI elements
380
- this.injectBaseStyles();
381
- this.createTitleBar(); // Always create title bar first
382
- this.createPaywallModal();
383
- this.createSuccessModal();
384
- this.createAuthUI();
385
- this.createStatusDisplay();
386
- // Set up button click handler
387
- // Mark button as attached by LeadFast
388
- button.setAttribute('data-leadfast-attached', 'true');
389
- button.onclick = async (e) => {
390
- e.preventDefault();
391
- await this.handleButtonClick(downloadCallback);
392
- };
393
- // Update UI based on auth state
394
- this.setupUIUpdates();
395
- }
396
- /**
397
- * Simplified API: Attach download limiting to multiple buttons
398
- * Each button can have different download callbacks and premium status
399
- */
400
- attachToButtons(config) {
401
- this.injectBaseStyles();
402
- this.createTitleBar(); // Always create title bar first
403
- this.createPaywallModal();
404
- this.createSuccessModal();
405
- this.createAuthUI();
406
- config.buttons.forEach(buttonConfig => {
407
- const button = document.querySelector(buttonConfig.selector);
408
- if (!button) {
409
- console.warn(`Button not found: ${buttonConfig.selector}`);
410
- return;
411
- }
412
- // Store original text for potential future use
413
- // const originalText = button.textContent || 'Download';
414
- // Set up click handler - all buttons use the same logic now
415
- // Mark button as attached by LeadFast
416
- button.setAttribute('data-leadfast-attached', 'true');
417
- button.onclick = async (e) => {
418
- e.preventDefault();
419
- await this.handleButtonClick(buttonConfig.downloadCallback);
420
- };
421
- this.setupUIUpdates();
422
- });
423
- // Add global status display
424
- this.createGlobalStatusDisplay();
425
- }
426
- async handleButtonClick(downloadCallback) {
427
- // Prevent rapid clicks/race conditions
428
- const button = document.querySelector('[data-leadfast-attached="true"]');
429
- if (button && button.disabled) {
430
- console.log('⚠️ Button click ignored - operation already in progress');
431
- return;
432
- }
433
- if (button) {
434
- button.disabled = true;
435
- button.style.opacity = '0.6';
436
- }
437
- try {
438
- await this.handleButtonClickInternal(downloadCallback);
439
- }
440
- finally {
441
- // Re-enable button
442
- if (button) {
443
- button.disabled = false;
444
- button.style.opacity = '1';
445
- }
446
- }
447
- }
448
- async handleButtonClickInternal(downloadCallback) {
449
- // const clickTime = Date.now();
450
- // console.log(`🕐 [TIMING] Button click started at: ${new Date(clickTime).toISOString()}`);
451
- // Security check: if Supabase connection failed, disable downloads to prevent localStorage bypass
452
- if (this.supabaseConnectionFailed) {
453
- // console.log(`🕐 [TIMING] Connection failed check: ${Date.now() - clickTime}ms`);
454
- this.showConnectionError();
455
- return;
456
- }
457
- // Security check: if payment configuration is invalid, disable downloads
458
- if (this.config.payment && this.paymentConnectionFailed) {
459
- // console.log(`🕐 [TIMING] Payment config failed check: ${Date.now() - clickTime}ms`);
460
- this.showPaymentConfigError();
461
- return;
462
- }
463
- // Check cache status
464
- const cacheValid = this.cachedStatus && (Date.now() - this.statusCacheTime) < this.STATUS_CACHE_DURATION;
465
- // console.log(`🕐 [CACHE] Cache valid: ${cacheValid}, age: ${this.cachedStatus ? Date.now() - this.statusCacheTime : 'no cache'}ms`);
466
- // console.log(`🕐 [CACHE] Cached status:`, this.cachedStatus);
467
- // const statusStartTime = Date.now();
468
- // Use cached status if available (since it's already displayed in title bar)
469
- const status = cacheValid
470
- ? this.cachedStatus
471
- : await this.getDownloadStatus();
472
- // console.log(`🕐 [TIMING] Status check completed: ${Date.now() - statusStartTime}ms (total: ${Date.now() - clickTime}ms)`);
473
- // console.log(`🕐 [STATUS] Final status:`, status);
474
- // Check if user is premium first (quick check from cached status)
475
- if (status.isPremium) {
476
- // console.log(`🕐 [TIMING] Premium user - callback executed: ${Date.now() - clickTime}ms`);
477
- // Get user context for premium users too
478
- const userContext = await this.getUserContext();
479
- // Check if callback expects user context parameter
480
- if (downloadCallback.length > 0) {
481
- // Callback expects user context parameter
482
- downloadCallback(userContext);
483
- }
484
- else {
485
- // Legacy callback with no parameters
486
- downloadCallback();
487
- }
488
- return;
489
- }
490
- // Quick limit check from cached status - show paywall immediately if needed
491
- if (status.currentCount >= status.limit) {
492
- // console.log(`🕐 [TIMING] Limit reached (${status.currentCount}/${status.limit}) - showing paywall: ${Date.now() - clickTime}ms`);
493
- // Limit reached - show paywall instantly (no additional API calls)
494
- // const paywallStartTime = Date.now();
495
- this.showPaywallInstant(status);
496
- // console.log(`🕐 [TIMING] Paywall shown: ${Date.now() - paywallStartTime}ms (total: ${Date.now() - clickTime}ms)`);
497
- return;
498
- }
499
- // console.log(`🕐 [TIMING] Limit not reached (${status.currentCount}/${status.limit}) - proceeding with action`);
500
- // Allow action and increment counter
501
- // const incrementStartTime = Date.now();
502
- // Execute user's function first - only increment count if it succeeds
503
- try {
504
- // Check if callback expects user context parameter
505
- if (downloadCallback.length > 0) {
506
- // Get user context BEFORE increment for callback
507
- const userContext = await this.getUserContext();
508
- // For non-premium users, simulate the increment so user context matches UI
509
- if (!userContext.isPremium) {
510
- userContext.currentCount += 1;
511
- userContext.remaining = Math.max(0, userContext.limit - userContext.currentCount);
512
- }
513
- // Callback expects user context parameter
514
- downloadCallback(userContext);
515
- }
516
- else {
517
- // Legacy callback with no parameters
518
- downloadCallback();
519
- }
520
- // Double-check limit before increment (race condition protection)
521
- const freshStatus = await this.getDownloadStatus(true); // Force refresh
522
- if (freshStatus.currentCount >= freshStatus.limit) {
523
- console.warn(`⚠️ Limit reached during execution (${freshStatus.currentCount}/${freshStatus.limit}) - canceling increment`);
524
- // User reached limit while their function was executing
525
- alert('⚠️ You reached the limit while this action was processing. No attempt was counted.');
526
- return;
527
- }
528
- // Only increment count after successful execution - with limit check
529
- const newCount = await this.incrementDownloadCount();
530
- // Double-check: if server returned count exceeding limit, something went wrong
531
- if (newCount > this.config.freeAttemptLimit) {
532
- console.error(`⚠️ Server returned count (${newCount}) exceeding limit (${this.config.freeAttemptLimit})`);
533
- // Don't update UI with invalid state
534
- return;
535
- }
536
- // console.log(`🕐 [TIMING] Count incremented: ${Date.now() - incrementStartTime}ms`);
537
- // Show success message only if explicitly enabled in config
538
- if (this.config.successMessage?.enabled === true) {
539
- const title = this.config.successMessage?.title || 'Action Completed!';
540
- const message = this.config.successMessage?.message || 'Your action completed successfully!';
541
- this.showSuccess(title, message);
542
- }
543
- }
544
- catch (error) {
545
- console.error('User function failed:', error);
546
- // Don't increment count on error - user shouldn't lose an attempt
547
- alert('Action failed. Please check the console for details. No attempt was counted.');
548
- return; // Exit early, don't update UI
549
- }
550
- // Update UI with fresh status (invalidate cache since count changed)
551
- // console.log(`🕐 [CACHE] Invalidating cache due to count change (was: ${this.cachedStatus ? 'cached' : 'null'})`);
552
- this.cachedStatus = null;
553
- this.updateStatusDisplays();
554
- // console.log(`🕐 [TIMING] Button click completed: ${Date.now() - clickTime}ms`);
555
- }
556
- injectBaseStyles() {
557
- //console.log('🎨 [THEME DEBUG] injectBaseStyles called');
558
- if (document.getElementById('lead-fast-styles')) {
559
- //console.log('🎨 [THEME DEBUG] Styles already injected, skipping');
560
- return;
561
- }
562
- // Inject DaisyUI CDN if theme is specified
563
- if (this.config.theme?.name) {
564
- //console.log('🎨 [THEME DEBUG] Theme specified, calling injectDaisyUI');
565
- this.injectDaisyUI();
566
- }
567
- const styles = document.createElement('style');
568
- styles.id = 'lead-fast-styles';
569
- const primaryColor = this.config.theme?.primaryColor || '#3182ce';
570
- styles.textContent = `
571
- /* User Profile Card - Top Right */
572
- .lead-fast-profile {
573
- position: fixed;
574
- top: 20px;
575
- left: 50%;
576
- transform: translateX(-50%);
577
- z-index: 1000;
578
- font-family: system-ui, -apple-system, sans-serif;
579
- width: 90%;
580
- max-width: 1200px;
581
- }
582
-
583
- .lead-fast-title-bar {
584
- background: rgba(250, 247, 245, 0.9) !important;
585
- border: 1px solid rgba(231, 226, 223, 0.6) !important;
586
- color: #291334 !important;
587
- border-radius: 16px;
588
- padding: 12px 24px;
589
- box-shadow: 0 8px 32px rgb(0 0 0 / 0.1), 0 2px 8px rgb(0 0 0 / 0.05);
590
- backdrop-filter: blur(20px);
591
- display: flex;
592
- align-items: center;
593
- justify-content: space-between;
594
- min-height: 60px;
595
- font-family: system-ui, -apple-system, sans-serif;
596
- }
597
-
598
- /* Theme variations for floating title bar */
599
- [data-theme="bumblebee"] .lead-fast-title-bar {
600
- background: rgba(255, 248, 220, 0.9) !important;
601
- border-color: rgba(254, 215, 170, 0.6) !important;
602
- color: #1c1917 !important;
603
- }
604
-
605
- [data-theme="garden"] .lead-fast-title-bar {
606
- background: rgba(240, 253, 244, 0.9) !important;
607
- border-color: rgba(134, 239, 172, 0.6) !important;
608
- color: #14532d !important;
609
- }
610
-
611
- [data-theme="emerald"] .lead-fast-title-bar {
612
- background: rgba(236, 253, 245, 0.9) !important;
613
- border-color: rgba(167, 243, 208, 0.6) !important;
614
- color: #065f46 !important;
615
- }
616
-
617
- [data-theme="corporate"] .lead-fast-title-bar {
618
- background: rgba(248, 250, 252, 0.9) !important;
619
- border-color: rgba(226, 232, 240, 0.6) !important;
620
- color: #1e293b !important;
621
- }
622
-
623
- [data-theme="dark"] .lead-fast-title-bar {
624
- background: rgba(31, 41, 55, 0.9) !important;
625
- border-color: rgba(55, 65, 81, 0.6) !important;
626
- color: #f9fafb !important;
627
- }
628
-
629
- [data-theme="cyberpunk"] .lead-fast-title-bar {
630
- background: rgba(0, 20, 36, 0.9) !important;
631
- border-color: rgba(7, 89, 133, 0.6) !important;
632
- color: #0ea5e9 !important;
633
- box-shadow: 0 8px 32px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(14, 165, 233, 0.1);
634
- }
635
-
636
- [data-theme="valentine"] .lead-fast-title-bar {
637
- background: rgba(233, 30, 122, 0.15) !important;
638
- border-color: rgba(233, 30, 122, 0.6) !important;
639
- color: #831843 !important;
640
- }
641
-
642
- [data-theme="synthwave"] .lead-fast-title-bar {
643
- background: rgba(32, 20, 64, 0.9) !important;
644
- border-color: rgba(186, 85, 211, 0.6) !important;
645
- color: #ff00ff !important;
646
- box-shadow: 0 8px 32px rgba(255, 0, 255, 0.2), 0 2px 8px rgba(255, 0, 255, 0.1);
647
- }
648
-
649
- [data-theme="dracula"] .lead-fast-title-bar {
650
- background: rgba(40, 42, 54, 0.9) !important;
651
- border-color: rgba(98, 114, 164, 0.6) !important;
652
- color: #f8f8f2 !important;
653
- }
654
-
655
- [data-theme="halloween"] .lead-fast-title-bar {
656
- background: rgba(26, 26, 26, 0.9) !important;
657
- border-color: rgba(255, 165, 0, 0.6) !important;
658
- color: #ff6600 !important;
659
- }
660
-
661
- [data-theme="forest"] .lead-fast-title-bar {
662
- background: rgba(23, 46, 23, 0.9) !important;
663
- border-color: rgba(34, 197, 94, 0.6) !important;
664
- color: #22c55e !important;
665
- }
666
-
667
- [data-theme="luxury"] .lead-fast-title-bar {
668
- background: rgba(9, 9, 11, 0.9) !important;
669
- border-color: rgba(212, 175, 55, 0.6) !important;
670
- color: #d4af37 !important;
671
- }
672
-
673
- [data-theme="night"] .lead-fast-title-bar {
674
- background: rgba(15, 23, 42, 0.9) !important;
675
- border-color: rgba(30, 58, 138, 0.6) !important;
676
- color: #60a5fa !important;
677
- }
678
-
679
- [data-theme="light"] .lead-fast-title-bar {
680
- background: rgba(255, 255, 255, 0.9) !important;
681
- border-color: rgba(229, 231, 235, 0.6) !important;
682
- color: #1f2937 !important;
683
- }
684
-
685
- [data-theme="cupcake"] .lead-fast-title-bar {
686
- background: rgba(250, 235, 215, 0.9) !important;
687
- border-color: rgba(219, 185, 156, 0.6) !important;
688
- color: #8b4513 !important;
689
- }
690
-
691
- [data-theme="retro"] .lead-fast-title-bar {
692
- background: rgba(212, 165, 116, 0.9) !important;
693
- border-color: rgba(185, 144, 102, 0.6) !important;
694
- color: #5d4037 !important;
695
- }
696
-
697
- [data-theme="aqua"] .lead-fast-title-bar {
698
- background: rgba(240, 253, 250, 0.9) !important;
699
- border-color: rgba(125, 211, 252, 0.6) !important;
700
- color: #155e75 !important;
701
- }
702
-
703
- [data-theme="lofi"] .lead-fast-title-bar {
704
- background: rgba(248, 248, 248, 0.9) !important;
705
- border-color: rgba(68, 68, 68, 0.6) !important;
706
- color: #1a1a1a !important;
707
- }
708
-
709
- [data-theme="pastel"] .lead-fast-title-bar {
710
- background: rgba(254, 251, 255, 0.9) !important;
711
- border-color: rgba(209, 196, 233, 0.6) !important;
712
- color: #7c3aed !important;
713
- }
714
-
715
- [data-theme="fantasy"] .lead-fast-title-bar {
716
- background: rgba(255, 247, 237, 0.9) !important;
717
- border-color: rgba(249, 168, 212, 0.6) !important;
718
- color: #be185d !important;
719
- }
720
-
721
- [data-theme="wireframe"] .lead-fast-title-bar {
722
- background: rgba(223, 223, 223, 0.9) !important;
723
- border-color: rgba(0, 0, 0, 0.3) !important;
724
- color: #000000 !important;
725
- }
726
-
727
- [data-theme="black"] .lead-fast-title-bar {
728
- background: rgba(0, 0, 0, 0.9) !important;
729
- border-color: rgba(55, 55, 55, 0.6) !important;
730
- color: #ffffff !important;
731
- }
732
-
733
- [data-theme="cmyk"] .lead-fast-title-bar {
734
- background: rgba(0, 255, 255, 0.9) !important;
735
- border-color: rgba(255, 0, 255, 0.6) !important;
736
- color: #000000 !important;
737
- }
738
-
739
- [data-theme="autumn"] .lead-fast-title-bar {
740
- background: rgba(139, 69, 19, 0.9) !important;
741
- border-color: rgba(255, 140, 0, 0.6) !important;
742
- color: #ff8c00 !important;
743
- }
744
-
745
- [data-theme="business"] .lead-fast-title-bar {
746
- background: rgba(29, 78, 216, 0.9) !important;
747
- border-color: rgba(59, 130, 246, 0.6) !important;
748
- color: #3b82f6 !important;
749
- }
750
-
751
- [data-theme="acid"] .lead-fast-title-bar {
752
- background: rgba(255, 255, 0, 0.9) !important;
753
- border-color: rgba(255, 0, 255, 0.6) !important;
754
- color: #000000 !important;
755
- }
756
-
757
- [data-theme="lemonade"] .lead-fast-title-bar {
758
- background: rgba(255, 255, 224, 0.9) !important;
759
- border-color: rgba(34, 197, 94, 0.6) !important;
760
- color: #15803d !important;
761
- }
762
-
763
- [data-theme="coffee"] .lead-fast-title-bar {
764
- background: rgba(101, 67, 33, 0.9) !important;
765
- border-color: rgba(160, 82, 45, 0.6) !important;
766
- color: #d2b48c !important;
767
- }
768
-
769
- [data-theme="winter"] .lead-fast-title-bar {
770
- background: rgba(248, 250, 252, 0.9) !important;
771
- border-color: rgba(59, 130, 246, 0.6) !important;
772
- color: #1e40af !important;
773
- }
774
-
775
- .lead-fast-title-section {
776
- display: flex;
777
- align-items: center;
778
- gap: 16px;
779
- }
780
-
781
- .lead-fast-logo {
782
- font-size: 20px;
783
- font-weight: 700;
784
- display: flex;
785
- align-items: center;
786
- gap: 8px;
787
- color: inherit;
788
- text-decoration: none;
789
- }
790
-
791
- .lead-fast-logo img {
792
- width: 32px;
793
- height: 32px;
794
- border-radius: 6px;
795
- }
796
-
797
- .lead-fast-nav {
798
- display: flex;
799
- align-items: center;
800
- gap: 32px;
801
- margin-left: 24px;
802
- }
803
-
804
- .lead-fast-nav-link {
805
- color: inherit;
806
- text-decoration: none;
807
- font-weight: 500;
808
- font-size: 14px;
809
- opacity: 0.8;
810
- transition: all 0.2s;
811
- }
812
-
813
- .lead-fast-nav-link:hover {
814
- opacity: 1;
815
- text-decoration: none;
816
- }
817
-
818
- .lead-fast-user-section {
819
- display: flex;
820
- align-items: center;
821
- gap: 12px;
822
- }
823
-
824
- .lead-fast-avatar {
825
- width: 36px;
826
- height: 36px;
827
- border-radius: 50%;
828
- background: linear-gradient(135deg, ${primaryColor}, #4f46e5);
829
- display: flex;
830
- align-items: center;
831
- justify-content: center;
832
- color: white;
833
- font-weight: 600;
834
- font-size: 14px;
835
- }
836
-
837
- .lead-fast-user-info {
838
- display: flex;
839
- flex-direction: column;
840
- align-items: flex-start;
841
- gap: 2px;
842
- }
843
-
844
- .lead-fast-user-email {
845
- color: inherit !important;
846
- font-size: 13px;
847
- font-weight: 500;
848
- line-height: 1;
849
- }
850
-
851
- .lead-fast-user-status {
852
- display: flex;
853
- align-items: center;
854
- gap: 6px;
855
- }
856
-
857
- .lead-fast-badge {
858
- padding: 2px 6px;
859
- border-radius: 12px;
860
- font-size: 10px;
861
- font-weight: 600;
862
- text-transform: uppercase;
863
- letter-spacing: 0.025em;
864
- line-height: 1;
865
- }
866
-
867
- .lead-fast-badge.premium {
868
- background: #10b981 !important;
869
- color: #ffffff !important;
870
- }
871
-
872
- .lead-fast-badge.free {
873
- background: #65c3c8 !important;
874
- color: #291334 !important;
875
- }
876
-
877
- [data-theme="dark"] .lead-fast-badge.premium {
878
- background: #059669 !important;
879
- color: #ffffff !important;
880
- }
881
-
882
- [data-theme="dark"] .lead-fast-badge.free {
883
- background: #374151 !important;
884
- color: #f9fafb !important;
885
- }
886
-
887
- .lead-fast-count {
888
- font-size: 10px;
889
- color: inherit !important;
890
- opacity: 0.7;
891
- line-height: 1;
892
- }
893
-
894
- .lead-fast-signout {
895
- background: rgba(0, 0, 0, 0.1) !important;
896
- border: none;
897
- color: inherit !important;
898
- cursor: pointer;
899
- padding: 6px 12px;
900
- border-radius: 8px;
901
- transition: all 0.2s;
902
- font-size: 11px;
903
- font-weight: 500;
904
- margin-left: 8px;
905
- }
906
-
907
- [data-theme="dark"] .lead-fast-signout {
908
- background: rgba(255, 255, 255, 0.1) !important;
909
- }
910
-
911
- [data-theme="cyberpunk"] .lead-fast-signout {
912
- background: rgba(14, 165, 233, 0.2) !important;
913
- }
914
-
915
- .lead-fast-signout:hover {
916
- background: rgba(0, 0, 0, 0.2) !important;
917
- transform: translateY(-1px);
918
- }
919
-
920
- [data-theme="dark"] .lead-fast-signout:hover {
921
- background: rgba(255, 255, 255, 0.2) !important;
922
- }
923
-
924
- [data-theme="cyberpunk"] .lead-fast-signout:hover {
925
- background: rgba(14, 165, 233, 0.3) !important;
926
- }
927
-
928
- .lead-fast-branding {
929
- position: absolute;
930
- bottom: -20px;
931
- left: 24px;
932
- font-size: 9px;
933
- color: inherit !important;
934
- opacity: 0.4;
935
- font-weight: 500;
936
- letter-spacing: 0.05em;
937
- text-transform: lowercase;
938
- background: rgba(255, 255, 255, 0.8);
939
- padding: 2px 6px;
940
- border-radius: 4px;
941
- backdrop-filter: blur(8px);
942
- }
943
-
944
- [data-theme="dark"] .lead-fast-branding {
945
- background: rgba(0, 0, 0, 0.6);
946
- }
947
-
948
- [data-theme="cyberpunk"] .lead-fast-branding {
949
- background: rgba(0, 20, 36, 0.8);
950
- }
951
-
952
- /* Modal Theming */
953
- .download-limiter-modal {
954
- display: none;
955
- position: fixed;
956
- top: 0;
957
- left: 0;
958
- width: 100%;
959
- height: 100%;
960
- background: rgba(0,0,0,0.5);
961
- z-index: 9999;
962
- align-items: center;
963
- justify-content: center;
964
- }
965
- .download-limiter-modal.show { display: flex; }
966
-
967
- .download-limiter-content {
968
- background: #faf7f5 !important;
969
- color: #291334 !important;
970
- padding: 2rem;
971
- border-radius: 12px;
972
- max-width: 400px;
973
- text-align: center;
974
- box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
975
- border: 1px solid #e7e2df !important;
976
- font-family: system-ui, -apple-system, sans-serif;
977
- }
978
-
979
- [data-theme="dark"] .download-limiter-content {
980
- background: #1f2937 !important;
981
- color: #f9fafb !important;
982
- border-color: #374151 !important;
983
- }
984
-
985
- [data-theme="cyberpunk"] .download-limiter-content {
986
- background: #001424 !important;
987
- color: #0ea5e9 !important;
988
- border-color: #075985 !important;
989
- }
990
-
991
- [data-theme="valentine"] .download-limiter-content {
992
- background: rgba(233, 30, 122, 0.05) !important;
993
- color: #831843 !important;
994
- border-color: #e91e7a !important;
995
- }
996
-
997
- [data-theme="bumblebee"] .download-limiter-content {
998
- background: rgba(255, 248, 220, 0.95) !important;
999
- color: #1c1917 !important;
1000
- border-color: rgba(254, 215, 170, 0.8) !important;
1001
- }
1002
-
1003
- [data-theme="garden"] .download-limiter-content {
1004
- background: rgba(240, 253, 244, 0.95) !important;
1005
- color: #14532d !important;
1006
- border-color: rgba(134, 239, 172, 0.8) !important;
1007
- }
1008
-
1009
- [data-theme="emerald"] .download-limiter-content {
1010
- background: rgba(236, 253, 245, 0.95) !important;
1011
- color: #065f46 !important;
1012
- border-color: rgba(167, 243, 208, 0.8) !important;
1013
- }
1014
-
1015
- [data-theme="corporate"] .download-limiter-content {
1016
- background: rgba(248, 250, 252, 0.95) !important;
1017
- color: #1e293b !important;
1018
- border-color: rgba(226, 232, 240, 0.8) !important;
1019
- }
1020
-
1021
- [data-theme="forest"] .download-limiter-content {
1022
- background: rgba(23, 46, 23, 0.95) !important;
1023
- color: #22c55e !important;
1024
- border-color: rgba(34, 197, 94, 0.8) !important;
1025
- }
1026
-
1027
- [data-theme="halloween"] .download-limiter-content {
1028
- background: rgba(26, 26, 26, 0.95) !important;
1029
- color: #ff6500 !important;
1030
- border-color: rgba(255, 165, 0, 0.3) !important;
1031
- }
1032
-
1033
- [data-theme="synthwave"] .download-limiter-content {
1034
- background: rgba(32, 20, 64, 0.95) !important;
1035
- color: #ba55d3 !important;
1036
- border-color: rgba(186, 85, 211, 0.3) !important;
1037
- }
1038
-
1039
- [data-theme="dracula"] .download-limiter-content {
1040
- background: rgba(40, 42, 54, 0.95) !important;
1041
- color: #f8f8f2 !important;
1042
- border-color: rgba(98, 114, 164, 0.3) !important;
1043
- }
1044
-
1045
- [data-theme="luxury"] .download-limiter-content {
1046
- background: rgba(9, 9, 11, 0.95) !important;
1047
- color: #d4af37 !important;
1048
- border-color: rgba(212, 175, 55, 0.3) !important;
1049
- }
1050
-
1051
- [data-theme="night"] .download-limiter-content {
1052
- background: rgba(15, 23, 42, 0.95) !important;
1053
- color: #1e40af !important;
1054
- border-color: rgba(30, 58, 138, 0.3) !important;
1055
- }
1056
-
1057
- [data-theme="light"] .download-limiter-content {
1058
- background: rgba(255, 255, 255, 0.95) !important;
1059
- color: #1f2937 !important;
1060
- border-color: rgba(229, 231, 235, 0.8) !important;
1061
- }
1062
-
1063
- [data-theme="cupcake"] .download-limiter-content {
1064
- background: rgba(250, 235, 215, 0.95) !important;
1065
- color: #8b4513 !important;
1066
- border-color: rgba(219, 185, 156, 0.8) !important;
1067
- }
1068
-
1069
- [data-theme="retro"] .download-limiter-content {
1070
- background: rgba(212, 165, 116, 0.95) !important;
1071
- color: #5d4037 !important;
1072
- border-color: rgba(185, 144, 102, 0.8) !important;
1073
- }
1074
-
1075
- [data-theme="aqua"] .download-limiter-content {
1076
- background: rgba(240, 253, 250, 0.95) !important;
1077
- color: #155e75 !important;
1078
- border-color: rgba(125, 211, 252, 0.8) !important;
1079
- }
1080
-
1081
- [data-theme="lofi"] .download-limiter-content {
1082
- background: rgba(248, 248, 248, 0.95) !important;
1083
- color: #1a1a1a !important;
1084
- border-color: rgba(68, 68, 68, 0.8) !important;
1085
- }
1086
-
1087
- [data-theme="pastel"] .download-limiter-content {
1088
- background: rgba(254, 251, 255, 0.95) !important;
1089
- color: #7c3aed !important;
1090
- border-color: rgba(209, 196, 233, 0.8) !important;
1091
- }
1092
-
1093
- [data-theme="fantasy"] .download-limiter-content {
1094
- background: rgba(255, 247, 237, 0.95) !important;
1095
- color: #be185d !important;
1096
- border-color: rgba(249, 168, 212, 0.8) !important;
1097
- }
1098
-
1099
- [data-theme="wireframe"] .download-limiter-content {
1100
- background: rgba(255, 255, 255, 0.95) !important;
1101
- color: #000000 !important;
1102
- border-color: rgba(0, 0, 0, 0.3) !important;
1103
- }
1104
-
1105
- [data-theme="black"] .download-limiter-content {
1106
- background: rgba(0, 0, 0, 0.95) !important;
1107
- color: #ffffff !important;
1108
- border-color: rgba(55, 55, 55, 0.8) !important;
1109
- }
1110
-
1111
- [data-theme="cmyk"] .download-limiter-content {
1112
- background: rgba(0, 255, 255, 0.95) !important;
1113
- color: #000000 !important;
1114
- border-color: rgba(255, 0, 255, 0.8) !important;
1115
- }
1116
-
1117
- [data-theme="autumn"] .download-limiter-content {
1118
- background: rgba(139, 69, 19, 0.95) !important;
1119
- color: #ff8c00 !important;
1120
- border-color: rgba(255, 140, 0, 0.8) !important;
1121
- }
1122
-
1123
- [data-theme="business"] .download-limiter-content {
1124
- background: rgba(29, 78, 216, 0.95) !important;
1125
- color: #3b82f6 !important;
1126
- border-color: rgba(59, 130, 246, 0.8) !important;
1127
- }
1128
-
1129
- [data-theme="acid"] .download-limiter-content {
1130
- background: rgba(255, 255, 0, 0.95) !important;
1131
- color: #000000 !important;
1132
- border-color: rgba(255, 0, 255, 0.8) !important;
1133
- }
1134
-
1135
- [data-theme="lemonade"] .download-limiter-content {
1136
- background: rgba(255, 255, 224, 0.95) !important;
1137
- color: #15803d !important;
1138
- border-color: rgba(34, 197, 94, 0.8) !important;
1139
- }
1140
-
1141
- [data-theme="coffee"] .download-limiter-content {
1142
- background: rgba(101, 67, 33, 0.95) !important;
1143
- color: #d2b48c !important;
1144
- border-color: rgba(160, 82, 45, 0.8) !important;
1145
- }
1146
-
1147
- [data-theme="winter"] .download-limiter-content {
1148
- background: rgba(248, 250, 252, 0.95) !important;
1149
- color: #1e40af !important;
1150
- border-color: rgba(59, 130, 246, 0.8) !important;
1151
- }
1152
-
1153
- .download-limiter-content h2 {
1154
- color: inherit !important;
1155
- margin: 0 0 1rem 0;
1156
- font-size: 1.5rem;
1157
- font-weight: 600;
1158
- }
1159
- .download-limiter-content p {
1160
- color: inherit !important;
1161
- margin: 0 0 1.5rem 0;
1162
- line-height: 1.6;
1163
- }
1164
- .download-limiter-signin-btn {
1165
- display: inline-flex;
1166
- align-items: center;
1167
- gap: 8px;
1168
- background: #65c3c8 !important;
1169
- color: #291334 !important;
1170
- border: none;
1171
- padding: 12px 20px;
1172
- border-radius: 8px;
1173
- font-size: 14px;
1174
- font-weight: 500;
1175
- cursor: pointer;
1176
- text-decoration: none;
1177
- transition: all 0.2s;
1178
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
1179
- }
1180
-
1181
- [data-theme="dark"] .download-limiter-signin-btn {
1182
- background: #3b82f6 !important;
1183
- color: #ffffff !important;
1184
- }
1185
-
1186
- [data-theme="cyberpunk"] .download-limiter-signin-btn {
1187
- background: #f59e0b !important;
1188
- color: #000000 !important;
1189
- }
1190
-
1191
- [data-theme="valentine"] .download-limiter-signin-btn {
1192
- background: #e91e7a !important;
1193
- color: #ffffff !important;
1194
- }
1195
-
1196
- [data-theme="bumblebee"] .download-limiter-signin-btn {
1197
- background: #fbbf24 !important;
1198
- color: #1c1917 !important;
1199
- }
1200
-
1201
- [data-theme="garden"] .download-limiter-signin-btn {
1202
- background: #22c55e !important;
1203
- color: #ffffff !important;
1204
- }
1205
-
1206
- [data-theme="emerald"] .download-limiter-signin-btn {
1207
- background: #10b981 !important;
1208
- color: #ffffff !important;
1209
- }
1210
-
1211
- [data-theme="corporate"] .download-limiter-signin-btn {
1212
- background: #3b82f6 !important;
1213
- color: #ffffff !important;
1214
- }
1215
-
1216
- [data-theme="forest"] .download-limiter-signin-btn {
1217
- background: #22c55e !important;
1218
- color: #1a1a1a !important;
1219
- }
1220
-
1221
- [data-theme="halloween"] .download-limiter-signin-btn {
1222
- background: #ff6500 !important;
1223
- color: #1a1a1a !important;
1224
- }
1225
-
1226
- [data-theme="synthwave"] .download-limiter-signin-btn {
1227
- background: #ba55d3 !important;
1228
- color: #201040 !important;
1229
- }
1230
-
1231
- [data-theme="dracula"] .download-limiter-signin-btn {
1232
- background: #8be9fd !important;
1233
- color: #282a36 !important;
1234
- }
1235
-
1236
- [data-theme="luxury"] .download-limiter-signin-btn {
1237
- background: #d4af37 !important;
1238
- color: #09090b !important;
1239
- }
1240
-
1241
- [data-theme="night"] .download-limiter-signin-btn {
1242
- background: #1e40af !important;
1243
- color: #ffffff !important;
1244
- }
1245
-
1246
- [data-theme="light"] .download-limiter-signin-btn {
1247
- background: #3b82f6 !important;
1248
- color: #ffffff !important;
1249
- }
1250
-
1251
- [data-theme="cupcake"] .download-limiter-signin-btn {
1252
- background: #8b4513 !important;
1253
- color: #ffffff !important;
1254
- }
1255
-
1256
- [data-theme="retro"] .download-limiter-signin-btn {
1257
- background: #d4a574 !important;
1258
- color: #ffffff !important;
1259
- }
1260
-
1261
- [data-theme="aqua"] .download-limiter-signin-btn {
1262
- background: #0891b2 !important;
1263
- color: #ffffff !important;
1264
- }
1265
-
1266
- [data-theme="lofi"] .download-limiter-signin-btn {
1267
- background: #1a1a1a !important;
1268
- color: #ffffff !important;
1269
- }
1270
-
1271
- [data-theme="pastel"] .download-limiter-signin-btn {
1272
- background: #7c3aed !important;
1273
- color: #ffffff !important;
1274
- }
1275
-
1276
- [data-theme="fantasy"] .download-limiter-signin-btn {
1277
- background: #be185d !important;
1278
- color: #ffffff !important;
1279
- }
1280
-
1281
- [data-theme="wireframe"] .download-limiter-signin-btn {
1282
- background: #dfdfdf !important;
1283
- color: #000000 !important;
1284
- border: 1px solid #000000 !important;
1285
- }
1286
-
1287
- [data-theme="black"] .download-limiter-signin-btn {
1288
- background: #ffffff !important;
1289
- color: #000000 !important;
1290
- }
1291
-
1292
- [data-theme="cmyk"] .download-limiter-signin-btn {
1293
- background: #ff00ff !important;
1294
- color: #000000 !important;
1295
- }
1296
-
1297
- [data-theme="autumn"] .download-limiter-signin-btn {
1298
- background: #ff8c00 !important;
1299
- color: #ffffff !important;
1300
- }
1301
-
1302
- [data-theme="business"] .download-limiter-signin-btn {
1303
- background: #3b82f6 !important;
1304
- color: #ffffff !important;
1305
- }
1306
-
1307
- [data-theme="acid"] .download-limiter-signin-btn {
1308
- background: #ff00ff !important;
1309
- color: #000000 !important;
1310
- }
1311
-
1312
- [data-theme="lemonade"] .download-limiter-signin-btn {
1313
- background: #22c55e !important;
1314
- color: #ffffff !important;
1315
- }
1316
-
1317
- [data-theme="coffee"] .download-limiter-signin-btn {
1318
- background: #a0522d !important;
1319
- color: #ffffff !important;
1320
- }
1321
-
1322
- [data-theme="winter"] .download-limiter-signin-btn {
1323
- background: #3b82f6 !important;
1324
- color: #ffffff !important;
1325
- }
1326
-
1327
- .download-limiter-signin-btn:hover {
1328
- opacity: 0.9;
1329
- transform: translateY(-1px);
1330
- box-shadow: 0 4px 8px rgba(0,0,0,0.15);
1331
- }
1332
-
1333
- /* Upgrade Button Styles for All Themes */
1334
- [data-theme="dark"] .upgrade-btn {
1335
- background: #3b82f6 !important;
1336
- color: #ffffff !important;
1337
- }
1338
-
1339
- [data-theme="cyberpunk"] .upgrade-btn {
1340
- background: #ff073a !important;
1341
- color: #ffffff !important;
1342
- }
1343
-
1344
- [data-theme="valentine"] .upgrade-btn {
1345
- background: #e91e7a !important;
1346
- color: #ffffff !important;
1347
- }
1348
-
1349
- [data-theme="bumblebee"] .upgrade-btn {
1350
- background: #f59e0b !important;
1351
- color: #ffffff !important;
1352
- }
1353
-
1354
- [data-theme="garden"] .upgrade-btn {
1355
- background: #10b981 !important;
1356
- color: #ffffff !important;
1357
- }
1358
-
1359
- [data-theme="emerald"] .upgrade-btn {
1360
- background: #10b981 !important;
1361
- color: #ffffff !important;
1362
- }
1363
-
1364
- [data-theme="corporate"] .upgrade-btn {
1365
- background: #3b82f6 !important;
1366
- color: #ffffff !important;
1367
- }
1368
-
1369
- [data-theme="forest"] .upgrade-btn {
1370
- background: #10b981 !important;
1371
- color: #ffffff !important;
1372
- }
1373
-
1374
- [data-theme="halloween"] .upgrade-btn {
1375
- background: #ff7b00 !important;
1376
- color: #000000 !important;
1377
- }
1378
-
1379
- [data-theme="synthwave"] .upgrade-btn {
1380
- background: #e879f9 !important;
1381
- color: #ffffff !important;
1382
- }
1383
-
1384
- [data-theme="dracula"] .upgrade-btn {
1385
- background: #bd93f9 !important;
1386
- color: #ffffff !important;
1387
- }
1388
-
1389
- [data-theme="luxury"] .upgrade-btn {
1390
- background: #d4af37 !important;
1391
- color: #000000 !important;
1392
- }
1393
-
1394
- [data-theme="night"] .upgrade-btn {
1395
- background: #38bdf8 !important;
1396
- color: #ffffff !important;
1397
- }
1398
-
1399
- [data-theme="light"] .upgrade-btn {
1400
- background: #3b82f6 !important;
1401
- color: #ffffff !important;
1402
- }
1403
-
1404
- [data-theme="cupcake"] .upgrade-btn {
1405
- background: #f472b6 !important;
1406
- color: #ffffff !important;
1407
- }
1408
-
1409
- [data-theme="retro"] .upgrade-btn {
1410
- background: #d4a574 !important;
1411
- color: #ffffff !important;
1412
- }
1413
-
1414
- [data-theme="aqua"] .upgrade-btn {
1415
- background: #06b6d4 !important;
1416
- color: #ffffff !important;
1417
- }
1418
-
1419
- [data-theme="lofi"] .upgrade-btn {
1420
- background: #a3a3a3 !important;
1421
- color: #000000 !important;
1422
- }
1423
-
1424
- [data-theme="pastel"] .upgrade-btn {
1425
- background: #a78bfa !important;
1426
- color: #ffffff !important;
1427
- }
1428
-
1429
- [data-theme="fantasy"] .upgrade-btn {
1430
- background: #f472b6 !important;
1431
- color: #ffffff !important;
1432
- }
1433
-
1434
- [data-theme="wireframe"] .upgrade-btn {
1435
- background: #dfdfdf !important;
1436
- color: #000000 !important;
1437
- border: 1px solid #000000 !important;
1438
- }
1439
-
1440
- [data-theme="black"] .upgrade-btn {
1441
- background: #ffffff !important;
1442
- color: #000000 !important;
1443
- }
1444
-
1445
- [data-theme="cmyk"] .upgrade-btn {
1446
- background: #0891b2 !important;
1447
- color: #ffffff !important;
1448
- }
1449
-
1450
- [data-theme="autumn"] .upgrade-btn {
1451
- background: #d97706 !important;
1452
- color: #ffffff !important;
1453
- }
1454
-
1455
- [data-theme="business"] .upgrade-btn {
1456
- background: #3b82f6 !important;
1457
- color: #ffffff !important;
1458
- }
1459
-
1460
- [data-theme="acid"] .upgrade-btn {
1461
- background: #84cc16 !important;
1462
- color: #000000 !important;
1463
- }
1464
-
1465
- [data-theme="lemonade"] .upgrade-btn {
1466
- background: #22c55e !important;
1467
- color: #ffffff !important;
1468
- }
1469
-
1470
- [data-theme="coffee"] .upgrade-btn {
1471
- background: #a0522d !important;
1472
- color: #ffffff !important;
1473
- }
1474
-
1475
- [data-theme="winter"] .upgrade-btn {
1476
- background: #3b82f6 !important;
1477
- color: #ffffff !important;
1478
- }
1479
-
1480
- /* Cancel Button Styles for All Themes */
1481
- [data-theme="dark"] .cancel-btn {
1482
- background: #4b5563 !important;
1483
- color: #ffffff !important;
1484
- }
1485
-
1486
- [data-theme="cyberpunk"] .cancel-btn {
1487
- background: #7e22ce !important;
1488
- color: #ffffff !important;
1489
- }
1490
-
1491
- [data-theme="valentine"] .cancel-btn {
1492
- background: #c11560 !important;
1493
- color: #ffffff !important;
1494
- }
1495
-
1496
- [data-theme="bumblebee"] .cancel-btn {
1497
- background: #d97706 !important;
1498
- color: #ffffff !important;
1499
- }
1500
-
1501
- [data-theme="garden"] .cancel-btn {
1502
- background: #059669 !important;
1503
- color: #ffffff !important;
1504
- }
1505
-
1506
- [data-theme="emerald"] .cancel-btn {
1507
- background: #059669 !important;
1508
- color: #ffffff !important;
1509
- }
1510
-
1511
- [data-theme="corporate"] .cancel-btn {
1512
- background: #6b7280 !important;
1513
- color: #ffffff !important;
1514
- }
1515
-
1516
- [data-theme="forest"] .cancel-btn {
1517
- background: #059669 !important;
1518
- color: #ffffff !important;
1519
- }
1520
-
1521
- [data-theme="halloween"] .cancel-btn {
1522
- background: #7c3aed !important;
1523
- color: #ffffff !important;
1524
- }
1525
-
1526
- [data-theme="synthwave"] .cancel-btn {
1527
- background: #7e22ce !important;
1528
- color: #ffffff !important;
1529
- }
1530
-
1531
- [data-theme="dracula"] .cancel-btn {
1532
- background: #6272a4 !important;
1533
- color: #ffffff !important;
1534
- }
1535
-
1536
- [data-theme="luxury"] .cancel-btn {
1537
- background: #8b5cf6 !important;
1538
- color: #ffffff !important;
1539
- }
1540
-
1541
- [data-theme="night"] .cancel-btn {
1542
- background: #0284c7 !important;
1543
- color: #ffffff !important;
1544
- }
1545
-
1546
- [data-theme="light"] .cancel-btn {
1547
- background: #6b7280 !important;
1548
- color: #ffffff !important;
1549
- }
1550
-
1551
- [data-theme="cupcake"] .cancel-btn {
1552
- background: #ec4899 !important;
1553
- color: #ffffff !important;
1554
- }
1555
-
1556
- [data-theme="retro"] .cancel-btn {
1557
- background: #b8925c !important;
1558
- color: #ffffff !important;
1559
- }
1560
-
1561
- [data-theme="aqua"] .cancel-btn {
1562
- background: #0891b2 !important;
1563
- color: #ffffff !important;
1564
- }
1565
-
1566
- [data-theme="lofi"] .cancel-btn {
1567
- background: #6b7280 !important;
1568
- color: #ffffff !important;
1569
- }
1570
-
1571
- [data-theme="pastel"] .cancel-btn {
1572
- background: #8b5cf6 !important;
1573
- color: #ffffff !important;
1574
- }
1575
-
1576
- [data-theme="fantasy"] .cancel-btn {
1577
- background: #ec4899 !important;
1578
- color: #ffffff !important;
1579
- }
1580
-
1581
- [data-theme="wireframe"] .cancel-btn {
1582
- background: #f5f5f5 !important;
1583
- color: #000000 !important;
1584
- border: 1px solid #000000 !important;
1585
- }
1586
-
1587
- [data-theme="black"] .cancel-btn {
1588
- background: #6b7280 !important;
1589
- color: #ffffff !important;
1590
- }
1591
-
1592
- [data-theme="cmyk"] .cancel-btn {
1593
- background: #0369a1 !important;
1594
- color: #ffffff !important;
1595
- }
1596
-
1597
- [data-theme="autumn"] .cancel-btn {
1598
- background: #c2410c !important;
1599
- color: #ffffff !important;
1600
- }
1601
-
1602
- [data-theme="business"] .cancel-btn {
1603
- background: #6b7280 !important;
1604
- color: #ffffff !important;
1605
- }
1606
-
1607
- [data-theme="acid"] .cancel-btn {
1608
- background: #65a30d !important;
1609
- color: #ffffff !important;
1610
- }
1611
-
1612
- [data-theme="lemonade"] .cancel-btn {
1613
- background: #16a34a !important;
1614
- color: #ffffff !important;
1615
- }
1616
-
1617
- [data-theme="coffee"] .cancel-btn {
1618
- background: #8b4513 !important;
1619
- color: #ffffff !important;
1620
- }
1621
-
1622
- [data-theme="winter"] .cancel-btn {
1623
- background: #1e40af !important;
1624
- color: #ffffff !important;
1625
- }
1626
-
1627
- /* Success Button Styles for All Themes */
1628
- [data-theme="dark"] .success-btn {
1629
- background: #10b981 !important;
1630
- color: #ffffff !important;
1631
- }
1632
-
1633
- [data-theme="cyberpunk"] .success-btn {
1634
- background: #00ff41 !important;
1635
- color: #000000 !important;
1636
- }
1637
-
1638
- [data-theme="valentine"] .success-btn {
1639
- background: #e91e7a !important;
1640
- color: #ffffff !important;
1641
- }
1642
-
1643
- [data-theme="bumblebee"] .success-btn {
1644
- background: #f59e0b !important;
1645
- color: #ffffff !important;
1646
- }
1647
-
1648
- [data-theme="garden"] .success-btn {
1649
- background: #10b981 !important;
1650
- color: #ffffff !important;
1651
- }
1652
-
1653
- [data-theme="emerald"] .success-btn {
1654
- background: #10b981 !important;
1655
- color: #ffffff !important;
1656
- }
1657
-
1658
- [data-theme="corporate"] .success-btn {
1659
- background: #10b981 !important;
1660
- color: #ffffff !important;
1661
- }
1662
-
1663
- [data-theme="forest"] .success-btn {
1664
- background: #10b981 !important;
1665
- color: #ffffff !important;
1666
- }
1667
-
1668
- [data-theme="halloween"] .success-btn {
1669
- background: #ff7b00 !important;
1670
- color: #000000 !important;
1671
- }
1672
-
1673
- [data-theme="synthwave"] .success-btn {
1674
- background: #00ff41 !important;
1675
- color: #000000 !important;
1676
- }
1677
-
1678
- [data-theme="dracula"] .success-btn {
1679
- background: #50fa7b !important;
1680
- color: #000000 !important;
1681
- }
1682
-
1683
- [data-theme="luxury"] .success-btn {
1684
- background: #d4af37 !important;
1685
- color: #000000 !important;
1686
- }
1687
-
1688
- [data-theme="night"] .success-btn {
1689
- background: #22d3ee !important;
1690
- color: #ffffff !important;
1691
- }
1692
-
1693
- [data-theme="light"] .success-btn {
1694
- background: #10b981 !important;
1695
- color: #ffffff !important;
1696
- }
1697
-
1698
- [data-theme="cupcake"] .success-btn {
1699
- background: #f472b6 !important;
1700
- color: #ffffff !important;
1701
- }
1702
-
1703
- [data-theme="retro"] .success-btn {
1704
- background: #d4a574 !important;
1705
- color: #ffffff !important;
1706
- }
1707
-
1708
- [data-theme="aqua"] .success-btn {
1709
- background: #06b6d4 !important;
1710
- color: #ffffff !important;
1711
- }
1712
-
1713
- [data-theme="lofi"] .success-btn {
1714
- background: #10b981 !important;
1715
- color: #ffffff !important;
1716
- }
1717
-
1718
- [data-theme="pastel"] .success-btn {
1719
- background: #34d399 !important;
1720
- color: #ffffff !important;
1721
- }
1722
-
1723
- [data-theme="fantasy"] .success-btn {
1724
- background: #f472b6 !important;
1725
- color: #ffffff !important;
1726
- }
1727
-
1728
- [data-theme="wireframe"] .success-btn {
1729
- background: #dfdfdf !important;
1730
- color: #000000 !important;
1731
- border: 1px solid #000000 !important;
1732
- }
1733
-
1734
- [data-theme="black"] .success-btn {
1735
- background: #10b981 !important;
1736
- color: #ffffff !important;
1737
- }
1738
-
1739
- [data-theme="cmyk"] .success-btn {
1740
- background: #06b6d4 !important;
1741
- color: #ffffff !important;
1742
- }
1743
-
1744
- [data-theme="autumn"] .success-btn {
1745
- background: #d97706 !important;
1746
- color: #ffffff !important;
1747
- }
1748
-
1749
- [data-theme="business"] .success-btn {
1750
- background: #10b981 !important;
1751
- color: #ffffff !important;
1752
- }
1753
-
1754
- [data-theme="acid"] .success-btn {
1755
- background: #84cc16 !important;
1756
- color: #000000 !important;
1757
- }
1758
-
1759
- [data-theme="lemonade"] .success-btn {
1760
- background: #22c55e !important;
1761
- color: #ffffff !important;
1762
- }
1763
-
1764
- [data-theme="coffee"] .success-btn {
1765
- background: #a0522d !important;
1766
- color: #ffffff !important;
1767
- }
1768
-
1769
- [data-theme="winter"] .success-btn {
1770
- background: #3b82f6 !important;
1771
- color: #ffffff !important;
1772
- }
1773
- .download-limiter-signout-btn {
1774
- background: #dc3545;
1775
- color: white;
1776
- border: none;
1777
- padding: 6px 12px;
1778
- border-radius: 4px;
1779
- font-size: 12px;
1780
- cursor: pointer;
1781
- margin-left: 8px;
1782
- }
1783
- .download-limiter-premium-badge {
1784
- background: linear-gradient(45deg, #f39c12, #e74c3c);
1785
- color: white;
1786
- padding: 2px 6px;
1787
- border-radius: 3px;
1788
- font-size: 10px;
1789
- margin-left: 8px;
1790
- font-weight: bold;
1791
- }
1792
- .download-limiter-btn-premium {
1793
- opacity: 0.7;
1794
- }
1795
- .download-limiter-success-modal {
1796
- display: none;
1797
- position: fixed;
1798
- top: 0;
1799
- left: 0;
1800
- width: 100%;
1801
- height: 100%;
1802
- background: rgba(0,0,0,0.5);
1803
- z-index: 10000;
1804
- align-items: center;
1805
- justify-content: center;
1806
- }
1807
- .download-limiter-success-modal.show { display: flex; }
1808
- .download-limiter-success-content {
1809
- background: white;
1810
- padding: 2rem;
1811
- border-radius: 8px;
1812
- max-width: 400px;
1813
- text-align: center;
1814
- box-shadow: 0 4px 20px rgba(0,0,0,0.15);
1815
- border-left: 4px solid #38a169;
1816
- }
1817
-
1818
- /* Single upgrade flow styles */
1819
- .single-upgrade-container {
1820
- margin: 20px 0;
1821
- text-align: center;
1822
- }
1823
-
1824
- .single-upgrade-content .upgrade-btn {
1825
- background: linear-gradient(135deg, #059669, #0d9488) !important;
1826
- color: white !important;
1827
- border: none !important;
1828
- padding: 16px 32px !important;
1829
- border-radius: 12px !important;
1830
- font-size: 18px !important;
1831
- font-weight: 600 !important;
1832
- cursor: pointer !important;
1833
- transition: all 0.3s ease !important;
1834
- box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
1835
- margin-bottom: 16px !important;
1836
- min-width: 200px !important;
1837
- }
1838
-
1839
- .single-upgrade-content .upgrade-btn:hover {
1840
- background: linear-gradient(135deg, #047857, #0f766e) !important;
1841
- transform: translateY(-2px) !important;
1842
- box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4) !important;
1843
- }
1844
-
1845
- .single-upgrade-content .upgrade-description {
1846
- font-size: 14px !important;
1847
- color: #6b7280 !important;
1848
- margin: 12px 0 0 0 !important;
1849
- line-height: 1.5 !important;
1850
- max-width: 300px !important;
1851
- margin-left: auto !important;
1852
- margin-right: auto !important;
1853
- }
1854
-
1855
- /* Anonymous user usage count styles */
1856
- .lead-fast-anonymous-status {
1857
- display: flex;
1858
- align-items: center;
1859
- gap: 12px;
1860
- }
1861
-
1862
- .lead-fast-anonymous-status .lead-fast-count {
1863
- background: rgba(59, 130, 246, 0.1);
1864
- color: #1d4ed8;
1865
- padding: 6px 12px;
1866
- border-radius: 8px;
1867
- font-size: 14px;
1868
- font-weight: 500;
1869
- border: 1px solid rgba(59, 130, 246, 0.2);
1870
- }
1871
-
1872
- /* Success button theming */
1873
- .download-limiter-btn.success-btn {
1874
- background: #059669 !important;
1875
- color: white !important;
1876
- border: none !important;
1877
- padding: 12px 24px !important;
1878
- border-radius: 8px !important;
1879
- cursor: pointer !important;
1880
- margin-top: 20px !important;
1881
- font-size: 16px !important;
1882
- font-weight: 500 !important;
1883
- transition: all 0.2s ease !important;
1884
- }
1885
-
1886
- .download-limiter-btn.success-btn:hover {
1887
- background: #047857 !important;
1888
- transform: translateY(-1px) !important;
1889
- }
1890
-
1891
- /* Theme-specific success button colors */
1892
- [data-theme="cyberpunk"] .download-limiter-btn.success-btn {
1893
- background: #0ea5e9 !important;
1894
- box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;
1895
- }
1896
-
1897
- [data-theme="cyberpunk"] .download-limiter-btn.success-btn:hover {
1898
- background: #0284c7 !important;
1899
- }
1900
-
1901
- [data-theme="valentine"] .download-limiter-btn.success-btn {
1902
- background: #be185d !important;
1903
- }
1904
-
1905
- [data-theme="valentine"] .download-limiter-btn.success-btn:hover {
1906
- background: #9d174d !important;
1907
- }
1908
-
1909
- [data-theme="bumblebee"] .download-limiter-btn.success-btn {
1910
- background: #f59e0b !important;
1911
- }
1912
-
1913
- [data-theme="bumblebee"] .download-limiter-btn.success-btn:hover {
1914
- background: #d97706 !important;
1915
- }
1916
-
1917
- [data-theme="garden"] .download-limiter-btn.success-btn {
1918
- background: #16a34a !important;
1919
- }
1920
-
1921
- [data-theme="garden"] .download-limiter-btn.success-btn:hover {
1922
- background: #15803d !important;
1923
- }
1924
-
1925
- /* Google Sign-in button theming */
1926
- .download-limiter-btn.google-signin-btn {
1927
- background: #4285f4 !important;
1928
- color: white !important;
1929
- border: none !important;
1930
- padding: 12px 24px !important;
1931
- border-radius: 8px !important;
1932
- cursor: pointer !important;
1933
- margin-right: 10px !important;
1934
- display: inline-flex !important;
1935
- align-items: center !important;
1936
- gap: 8px !important;
1937
- font-size: 14px !important;
1938
- font-weight: 500 !important;
1939
- transition: all 0.2s ease !important;
1940
- }
1941
-
1942
- .download-limiter-btn.google-signin-btn:hover {
1943
- background: #3367d6 !important;
1944
- transform: translateY(-1px) !important;
1945
- }
1946
-
1947
- /* Upgrade button theming */
1948
- .download-limiter-btn.upgrade-btn {
1949
- background: #059669 !important;
1950
- color: white !important;
1951
- border: none !important;
1952
- padding: 12px 24px !important;
1953
- border-radius: 8px !important;
1954
- cursor: pointer !important;
1955
- margin-right: 10px !important;
1956
- font-size: 16px !important;
1957
- font-weight: 500 !important;
1958
- transition: all 0.2s ease !important;
1959
- }
1960
-
1961
- .download-limiter-btn.upgrade-btn:hover {
1962
- background: #047857 !important;
1963
- transform: translateY(-1px) !important;
1964
- }
1965
-
1966
- /* Theme-specific button colors */
1967
- [data-theme="cyberpunk"] .download-limiter-btn.upgrade-btn {
1968
- background: #0ea5e9 !important;
1969
- box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;
1970
- }
1971
-
1972
- [data-theme="valentine"] .download-limiter-btn.upgrade-btn {
1973
- background: #be185d !important;
1974
- }
1975
-
1976
- [data-theme="bumblebee"] .download-limiter-btn.upgrade-btn {
1977
- background: #f59e0b !important;
1978
- }
1979
-
1980
- [data-theme="garden"] .download-limiter-btn.upgrade-btn {
1981
- background: #16a34a !important;
1982
- }
1983
-
1984
- /* Cancel button container and styling - positioned at very bottom */
1985
- .download-limiter-cancel-container {
1986
- margin-top: 30px !important;
1987
- padding-top: 20px !important;
1988
- border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
1989
- text-align: center !important;
1990
- position: relative !important;
1991
- bottom: 0 !important;
1992
- }
1993
-
1994
- .download-limiter-btn.cancel-btn {
1995
- background: transparent !important;
1996
- color: #6b7280 !important;
1997
- border: none !important;
1998
- padding: 8px 16px !important;
1999
- border-radius: 6px !important;
2000
- cursor: pointer !important;
2001
- font-size: 13px !important;
2002
- font-weight: 400 !important;
2003
- transition: all 0.2s ease !important;
2004
- text-decoration: underline !important;
2005
- margin: 0 auto !important;
2006
- display: block !important;
2007
- }
2008
-
2009
- .download-limiter-btn.cancel-btn:hover {
2010
- color: #374151 !important;
2011
- background: rgba(107, 114, 128, 0.1) !important;
2012
- text-decoration: none !important;
2013
- }
2014
-
2015
- /* Theme-specific cancel button border */
2016
- [data-theme="dark"] .download-limiter-cancel-container {
2017
- border-top-color: rgba(255, 255, 255, 0.1) !important;
2018
- }
2019
-
2020
- [data-theme="dark"] .download-limiter-btn.cancel-btn {
2021
- color: #9ca3af !important;
2022
- }
2023
-
2024
- [data-theme="dark"] .download-limiter-btn.cancel-btn:hover {
2025
- color: #d1d5db !important;
2026
- background: rgba(156, 163, 175, 0.1) !important;
2027
- }
2028
-
2029
- [data-theme="cyberpunk"] .download-limiter-cancel-container {
2030
- border-top-color: rgba(14, 165, 233, 0.2) !important;
2031
- }
2032
-
2033
- [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn {
2034
- color: #0ea5e9 !important;
2035
- }
2036
-
2037
- [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn:hover {
2038
- color: #38bdf8 !important;
2039
- background: rgba(14, 165, 233, 0.1) !important;
2040
- }
2041
- `;
2042
- document.head.appendChild(styles);
2043
- }
2044
- injectDaisyUI() {
2045
- //console.log('🎨 [THEME DEBUG] injectDaisyUI called');
2046
- //console.log('🎨 [THEME DEBUG] Theme config:', this.config.theme);
2047
- // Check if DaisyUI is already loaded
2048
- const existingLink = document.querySelector('link[href*="daisyui"]');
2049
- if (existingLink) {
2050
- //console.log('🎨 [THEME DEBUG] DaisyUI already exists:', existingLink);
2051
- // Apply theme if DaisyUI already exists
2052
- if (this.config.theme?.name) {
2053
- const themeName = this.config.theme.name.toLowerCase();
2054
- //console.log('🎨 [THEME DEBUG] Setting existing theme:', themeName);
2055
- document.documentElement.setAttribute('data-theme', themeName);
2056
- //console.log('🎨 [THEME DEBUG] Current data-theme attribute:', document.documentElement.getAttribute('data-theme'));
2057
- }
2058
- return;
2059
- }
2060
- //console.log('🎨 [THEME DEBUG] No existing DaisyUI found, injecting...');
2061
- // Note: Tailwind CSS is not needed as we use custom CSS for all styling
2062
- // Apply theme directly using our custom CSS - no external dependencies needed
2063
- if (this.config.theme?.name) {
2064
- const themeName = this.config.theme.name.toLowerCase();
2065
- document.documentElement.setAttribute('data-theme', themeName);
2066
- // Update status displays immediately since no CSS loading is needed
2067
- this.updateStatusDisplays();
2068
- }
2069
- }
2070
- createPaywallModal() {
2071
- if (document.getElementById('download-limiter-paywall'))
2072
- return;
2073
- const modal = document.createElement('div');
2074
- modal.id = 'download-limiter-paywall';
2075
- modal.className = 'download-limiter-modal';
2076
- modal.innerHTML = `
2077
- <div class="download-limiter-content">
2078
- <h3 id="download-limiter-paywall-title">Usage Limit Reached</h3>
2079
- <p id="download-limiter-paywall-subtitle">You've used all your free attempts. Upgrade to premium for unlimited usage!</p>
2080
-
2081
- <!-- Auth Section (shows when not signed in) -->
2082
- <div id="download-limiter-auth-section" style="margin: 20px 0;">
2083
- <p>Sign in to continue or upgrade to premium</p>
2084
- <button id="download-limiter-signin-btn" class="download-limiter-btn google-signin-btn">
2085
- <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
2086
- <path d="M16.51 8H8.98v3h4.3c-.18 1-.74 1.48-1.6 2.04v2.01h2.6a8.8 8.8 0 0 0 2.38-5.88c0-.57-.05-.66-.15-1.18z" fill="white"/>
2087
- <path d="M8.98 17c2.16 0 3.97-.72 5.3-1.94l-2.6-2.04a4.8 4.8 0 0 1-2.7.75 4.8 4.8 0 0 1-4.52-3.4H1.83v2.07A8 8 0 0 0 8.98 17z" fill="white"/>
2088
- <path d="M4.46 10.37a4.8 4.8 0 0 1-.25-1.37c0-.48.09-.94.25-1.37V5.56H1.83a8 8 0 0 0 0 6.88l2.63-2.07z" fill="white"/>
2089
- <path d="M8.98 3.77c1.32 0 2.5.45 3.44 1.35l2.58-2.58C13.94.64 11.66 0 8.98 0A8 8 0 0 0 1.83 5.56l2.63 2.07c.61-1.8 2.26-3.86 4.52-3.86z" fill="white"/>
2090
- </svg>
2091
- Sign in with Google
2092
- </button>
2093
- </div>
2094
-
2095
- <!-- Payment Section (shows when signed in) -->
2096
- <div id="download-limiter-payment-section" style="margin: 20px 0; display: none;">
2097
- <button id="download-limiter-upgrade-btn" class="download-limiter-btn upgrade-btn">
2098
- Upgrade to Premium
2099
- </button>
2100
- </div>
2101
-
2102
- <div class="download-limiter-cancel-container">
2103
- <button id="download-limiter-close-btn" class="download-limiter-btn cancel-btn">
2104
- Cancel
2105
- </button>
2106
- </div>
2107
- </div>
2108
- `;
2109
- document.body.appendChild(modal);
2110
- // Set up event handlers
2111
- modal.querySelector('#download-limiter-signin-btn').addEventListener('click', async () => {
2112
- await this.signIn();
2113
- });
2114
- modal.querySelector('#download-limiter-upgrade-btn').addEventListener('click', async () => {
2115
- const payment = await this.createPayment();
2116
- if (payment?.checkout_url) {
2117
- window.location.href = payment.checkout_url;
2118
- }
2119
- });
2120
- modal.querySelector('#download-limiter-close-btn').addEventListener('click', () => {
2121
- if (this.config.options?.debug) {
2122
- console.log('🔍 DEBUG: Cancel button clicked');
2123
- console.log('🔍 DEBUG: this.config.feedback:', this.config.feedback);
2124
- console.log('🔍 DEBUG: this.config.email:', this.config.email);
2125
- console.log('🔍 DEBUG: Feedback config exists:', !!(this.config.feedback || this.config.email));
2126
- }
2127
- // Show feedback form if feedback config exists, otherwise just close
2128
- if (this.config.feedback || this.config.email) {
2129
- if (this.config.options?.debug) {
2130
- console.log('🔍 DEBUG: Showing feedback form');
2131
- }
2132
- this.showFeedbackForm();
2133
- }
2134
- else {
2135
- if (this.config.options?.debug) {
2136
- console.log('🔍 DEBUG: No email config, just closing modal');
2137
- }
2138
- modal.classList.remove('show');
2139
- }
2140
- });
2141
- // Removed click-outside-to-close behavior to encourage users to use the Cancel button
2142
- // which triggers the feedback form. This improves feedback collection.
2143
- }
2144
- createSuccessModal() {
2145
- if (document.getElementById('download-limiter-success'))
2146
- return;
2147
- const modal = document.createElement('div');
2148
- modal.id = 'download-limiter-success';
2149
- modal.className = 'download-limiter-modal'; // Use same modal class as paywall
2150
- modal.innerHTML = `
2151
- <div class="download-limiter-content"> <!-- Use same content class as paywall for theming -->
2152
- <h3 id="download-limiter-success-title">Action Started!</h3>
2153
- <p id="download-limiter-success-message">Your action completed successfully!</p>
2154
- <button id="download-limiter-success-close" class="download-limiter-btn success-btn">
2155
- OK
2156
- </button>
2157
- </div>
2158
- `;
2159
- document.body.appendChild(modal);
2160
- // Set up event handlers
2161
- modal.querySelector('#download-limiter-success-close').addEventListener('click', () => {
2162
- modal.classList.remove('show');
2163
- });
2164
- modal.addEventListener('click', (e) => {
2165
- if (e.target === modal) {
2166
- modal.classList.remove('show');
2167
- }
2168
- });
2169
- }
2170
- showFeedbackForm() {
2171
- // const feedbackStartTime = Date.now();
2172
- // console.log(`🕐 [FEEDBACK] showFeedbackForm called: ${new Date(feedbackStartTime).toISOString()}`);
2173
- // Hide paywall first
2174
- // const paywallHideStart = Date.now();
2175
- const paywall = document.getElementById('download-limiter-paywall');
2176
- if (paywall) {
2177
- paywall.classList.remove('show');
2178
- // console.log(`🕐 [FEEDBACK] Paywall hidden: ${Date.now() - paywallHideStart}ms`);
2179
- }
2180
- // Create or show feedback modal
2181
- // const createFeedbackStart = Date.now();
2182
- this.createFeedbackModal();
2183
- // console.log(`🕐 [FEEDBACK] createFeedbackModal completed: ${Date.now() - createFeedbackStart}ms`);
2184
- const modal = document.getElementById('download-limiter-feedback');
2185
- if (modal) {
2186
- modal.classList.add('show');
2187
- // console.log(`🕐 [FEEDBACK] Feedback modal shown: ${Date.now() - feedbackStartTime}ms total`);
2188
- }
2189
- }
2190
- createFeedbackModal() {
2191
- if (document.getElementById('download-limiter-feedback')) {
2192
- if (this.config.options?.debug) {
2193
- console.log('🔍 DEBUG: Feedback modal already exists');
2194
- }
2195
- return;
2196
- }
2197
- // Get feedback configuration or fallback to legacy email config
2198
- const feedbackConfig = this.config.feedback || (this.config.email ? {
2199
- form: {
2200
- title: 'Quick Feedback',
2201
- description: 'Why didn\'t you upgrade?',
2202
- option1: 'Not useful for my needs',
2203
- option2: 'Didn\'t find what I was looking for',
2204
- option3: 'Just trying it out'
2205
- },
2206
- email: this.config.email
2207
- } : null);
2208
- if (this.config.options?.debug) {
2209
- console.log('🔍 DEBUG: Feedback config:', feedbackConfig);
2210
- console.log('🔍 DEBUG: this.config.feedback:', this.config.feedback);
2211
- console.log('🔍 DEBUG: this.config.email:', this.config.email);
2212
- }
2213
- if (!feedbackConfig) {
2214
- if (this.config.options?.debug) {
2215
- console.log('🔍 DEBUG: No feedback config found, not creating modal');
2216
- }
2217
- return;
2218
- }
2219
- const modal = document.createElement('div');
2220
- modal.id = 'download-limiter-feedback';
2221
- modal.className = 'download-limiter-modal';
2222
- modal.innerHTML = `
2223
- <div class="download-limiter-content">
2224
- <h3>${feedbackConfig.form.title}</h3>
2225
- <p style="margin-bottom: 20px;">${feedbackConfig.form.description}</p>
2226
-
2227
- <form id="feedback-form" style="text-align: left;">
2228
- <div style="margin-bottom: 15px;">
2229
- <label style="display: block; margin-bottom: 8px;">
2230
- <input type="radio" name="reason" value="option1" style="margin-right: 8px;">
2231
- ${feedbackConfig.form.option1}
2232
- </label>
2233
- <label style="display: block; margin-bottom: 8px;">
2234
- <input type="radio" name="reason" value="option2" style="margin-right: 8px;">
2235
- ${feedbackConfig.form.option2}
2236
- </label>
2237
- <label style="display: block; margin-bottom: 8px;">
2238
- <input type="radio" name="reason" value="option3" style="margin-right: 8px;">
2239
- ${feedbackConfig.form.option3}
2240
- </label>
2241
- </div>
2242
-
2243
- <div style="margin-bottom: 15px;">
2244
- <label for="feedback-details" style="display: block; margin-bottom: 5px;">Tell us more:</label>
2245
- <textarea
2246
- id="feedback-details"
2247
- name="details"
2248
- rows="3"
2249
- style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
2250
- placeholder="Your feedback helps us improve..." maxlength="200"></textarea>
2251
- </div>
2252
-
2253
- <div style="margin-bottom: 20px;">
2254
- <label for="feedback-email" style="display: block; margin-bottom: 5px;">
2255
- Email (optional):
2256
- </label>
2257
- <input
2258
- type="email"
2259
- id="feedback-email"
2260
- name="email"
2261
- style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
2262
- placeholder="your@email.com">
2263
- <small style="color: #666; display: block; margin-top: 4px;">
2264
- Only if you want us to reach out about what you mentioned above. We don't follow up unless you want us to
2265
- </small>
2266
- </div>
2267
-
2268
-
2269
- <div style="text-align: center;">
2270
- <button type="submit" class="download-limiter-btn success-btn" style="margin-right: 10px;">
2271
- Submit Feedback
2272
- </button>
2273
- <button type="button" id="feedback-skip-btn" class="download-limiter-btn cancel-btn">
2274
- Skip
2275
- </button>
2276
- </div>
2277
- </form>
2278
- </div>
2279
- `;
2280
- document.body.appendChild(modal);
2281
- if (this.config.options?.debug) {
2282
- console.log('🔍 DEBUG: Feedback modal created and added to DOM');
2283
- }
2284
- // Set up event listeners
2285
- const form = modal.querySelector('#feedback-form');
2286
- form.addEventListener('submit', (e) => {
2287
- e.preventDefault();
2288
- this.submitFeedback(form);
2289
- });
2290
- modal.querySelector('#feedback-skip-btn').addEventListener('click', () => {
2291
- modal.classList.remove('show');
2292
- });
2293
- modal.addEventListener('click', (e) => {
2294
- if (e.target === modal) {
2295
- modal.classList.remove('show');
2296
- }
2297
- });
2298
- }
2299
- async submitFeedback(form) {
2300
- const formData = new FormData(form);
2301
- const reason = formData.get('reason');
2302
- const details = formData.get('details');
2303
- const email = formData.get('email');
2304
- if (!reason) {
2305
- alert('Please select a reason');
2306
- return;
2307
- }
2308
- const feedbackData = {
2309
- reason,
2310
- details,
2311
- email: email || undefined,
2312
- timestamp: new Date().toISOString(),
2313
- userAgent: navigator.userAgent,
2314
- appId: this.config.appId
2315
- };
2316
- try {
2317
- await this.sendFeedbackEmail(feedbackData);
2318
- // Close feedback modal
2319
- const modal = document.getElementById('download-limiter-feedback');
2320
- if (modal) {
2321
- modal.classList.remove('show');
2322
- }
2323
- // Show thank you message
2324
- alert('Thank you for your feedback!');
2325
- }
2326
- catch (error) {
2327
- console.error('Failed to send feedback:', error);
2328
- alert('Failed to send feedback. Please try again.');
2329
- }
2330
- }
2331
- async sendFeedbackEmail(feedbackData) {
2332
- // Get email config - handle both new array format and legacy format
2333
- let emailConfig;
2334
- if (this.config.feedback?.email) {
2335
- // New array format - use first provider (typically resend)
2336
- if (Array.isArray(this.config.feedback.email)) {
2337
- emailConfig = this.config.feedback.email[0];
2338
- }
2339
- else {
2340
- // Legacy format fallback
2341
- emailConfig = this.config.feedback.email;
2342
- }
2343
- }
2344
- else if (this.config.email) {
2345
- // Deprecated legacy email config
2346
- emailConfig = {
2347
- provider: 'resend',
2348
- apiKey: this.config.email.resendApiKey,
2349
- fromEmail: this.config.email.fromEmail
2350
- };
2351
- }
2352
- if (!emailConfig) {
2353
- throw new Error('Email configuration not available');
2354
- }
2355
- const emailBody = `
2356
- New Feedback from ${this.config.appId}
2357
-
2358
- Reason: ${feedbackData.reason}
2359
- Details: ${feedbackData.details}
2360
- User Email: ${feedbackData.email || 'Not provided'}
2361
- Timestamp: ${feedbackData.timestamp}
2362
- User Agent: ${feedbackData.userAgent}
2363
- `.trim();
2364
- // Handle different email providers
2365
- let response;
2366
- if (emailConfig.provider === 'resend' || !emailConfig.provider) {
2367
- response = await fetch('https://api.resend.com/emails', {
2368
- method: 'POST',
2369
- headers: {
2370
- 'Content-Type': 'application/json',
2371
- 'Authorization': `Bearer ${emailConfig.apiKey || emailConfig.resendApiKey}`
2372
- },
2373
- body: JSON.stringify({
2374
- from: emailConfig.fromEmail,
2375
- to: [emailConfig.fromEmail], // Send feedback to yourself
2376
- subject: `Feedback from ${this.config.appId}`,
2377
- text: emailBody
2378
- })
2379
- });
2380
- }
2381
- else {
2382
- throw new Error(`Unsupported email provider: ${emailConfig.provider}`);
2383
- }
2384
- if (!response.ok) {
2385
- throw new Error(`Email API error: ${response.status}`);
2386
- }
2387
- }
2388
- createAuthUI() {
2389
- if (document.getElementById('lead-fast-profile'))
2390
- return;
2391
- const profileContainer = document.createElement('div');
2392
- profileContainer.id = 'lead-fast-profile';
2393
- profileContainer.className = 'lead-fast-profile';
2394
- document.body.appendChild(profileContainer);
2395
- }
2396
- createStatusDisplay() {
2397
- if (document.getElementById('download-limiter-status'))
2398
- return;
2399
- const statusDiv = document.createElement('div');
2400
- statusDiv.id = 'download-limiter-status';
2401
- statusDiv.className = 'download-limiter-status';
2402
- document.body.appendChild(statusDiv);
2403
- }
2404
- createGlobalStatusDisplay() {
2405
- this.createStatusDisplay();
2406
- }
2407
- showPaywallInstant(status) {
2408
- // const showStartTime = Date.now();
2409
- // console.log(`🕐 [MODAL] showPaywallInstant started: ${new Date(showStartTime).toISOString()}`);
2410
- // Ensure modal exists before trying to show it
2411
- // const createStartTime = Date.now();
2412
- this.createPaywallModal();
2413
- // console.log(`🕐 [MODAL] createPaywallModal completed: ${Date.now() - createStartTime}ms`);
2414
- const modal = document.getElementById('download-limiter-paywall');
2415
- if (modal) {
2416
- // console.log(`🕐 [MODAL] Modal found in DOM: ${Date.now() - showStartTime}ms`);
2417
- // Update paywall title with exact count (no API call needed)
2418
- const titleEl = modal.querySelector('#download-limiter-paywall-title');
2419
- if (titleEl) {
2420
- titleEl.textContent = `You've used ${status.limit} free attempts`;
2421
- // console.log(`🕐 [MODAL] Title updated: ${Date.now() - showStartTime}ms`);
2422
- }
2423
- // Show appropriate section based on auth state
2424
- const authSection = modal.querySelector('#download-limiter-auth-section');
2425
- const paymentSection = modal.querySelector('#download-limiter-payment-section');
2426
- if (!this.currentUser) {
2427
- // console.log(`🕐 [MODAL] Setting up anonymous user flow: ${Date.now() - showStartTime}ms`);
2428
- // Anonymous user - show single upgrade flow
2429
- const subtitleEl = modal.querySelector('#download-limiter-paywall-subtitle');
2430
- if (subtitleEl) {
2431
- subtitleEl.textContent = 'Sign in to continue. If you\'re already premium, you\'ll get unlimited access. New users can upgrade after signing in.';
2432
- }
2433
- // Hide separate auth/payment sections and show single upgrade button
2434
- authSection.style.display = 'none';
2435
- paymentSection.style.display = 'none';
2436
- // Show single upgrade button
2437
- // const upgradeStartTime = Date.now();
2438
- this.showSingleUpgradeFlow(modal);
2439
- // console.log(`🕐 [MODAL] Single upgrade flow setup: ${Date.now() - upgradeStartTime}ms`);
2440
- }
2441
- else {
2442
- // console.log(`🕐 [MODAL] Setting up signed-in user flow: ${Date.now() - showStartTime}ms`);
2443
- // Existing flow for signed-in users - direct to payment
2444
- authSection.style.display = 'none';
2445
- paymentSection.style.display = 'block';
2446
- }
2447
- modal.classList.add('show');
2448
- // console.log(`🕐 [MODAL] Modal shown (classList.add('show')): ${Date.now() - showStartTime}ms`);
2449
- }
2450
- }
2451
- async showPaywall() {
2452
- // Get current status if not cached
2453
- const status = await this.getDownloadStatus();
2454
- this.showPaywallInstant(status);
2455
- }
2456
- showSingleUpgradeFlow(modal) {
2457
- // Create single upgrade button that handles both login and payment
2458
- let upgradeContainer = modal.querySelector('.single-upgrade-container');
2459
- if (!upgradeContainer) {
2460
- upgradeContainer = document.createElement('div');
2461
- upgradeContainer.className = 'single-upgrade-container';
2462
- upgradeContainer.innerHTML = `
2463
- <div class="single-upgrade-content">
2464
- <button class="download-limiter-btn upgrade-btn" id="single-upgrade-btn">
2465
- Continue with Google
2466
- </button>
2467
- <!--<p class="upgrade-description">
2468
- Sign in to restore access. Premium members get unlimited usage immediately.
2469
- </p>-->
2470
- </div>
2471
- `;
2472
- // Insert before the cancel container to keep cancel at the bottom
2473
- const cancelContainer = modal.querySelector('.download-limiter-cancel-container');
2474
- if (cancelContainer) {
2475
- modal.querySelector('.download-limiter-content')?.insertBefore(upgradeContainer, cancelContainer);
2476
- }
2477
- else {
2478
- modal.querySelector('.download-limiter-content')?.appendChild(upgradeContainer);
2479
- }
2480
- }
2481
- upgradeContainer.style.display = 'block';
2482
- // Add click handler for single upgrade flow
2483
- const upgradeBtn = modal.querySelector('#single-upgrade-btn');
2484
- if (upgradeBtn) {
2485
- upgradeBtn.replaceWith(upgradeBtn.cloneNode(true)); // Remove existing listeners
2486
- const newUpgradeBtn = modal.querySelector('#single-upgrade-btn');
2487
- newUpgradeBtn?.addEventListener('click', async () => {
2488
- try {
2489
- // Step 1: Sign in with Google
2490
- const { error } = await this.supabase.auth.signInWithOAuth({
2491
- provider: 'google',
2492
- options: {
2493
- redirectTo: `${window.location.origin}${window.location.pathname}?upgrade=true`
2494
- }
2495
- });
2496
- if (error) {
2497
- console.error('Sign in error:', error);
2498
- this.showError('Sign In Failed', 'Failed to sign in with Google. Please try again.');
2499
- }
2500
- // OAuth will redirect, so no further action needed here
2501
- }
2502
- catch (error) {
2503
- console.error('Upgrade flow error:', error);
2504
- this.showError('Upgrade Failed', 'Failed to start upgrade process. Please try again.');
2505
- }
2506
- });
2507
- }
2508
- }
2509
- showSuccess(title, message) {
2510
- const modal = document.getElementById('download-limiter-success');
2511
- if (modal) {
2512
- const titleEl = modal.querySelector('#download-limiter-success-title');
2513
- const messageEl = modal.querySelector('#download-limiter-success-message');
2514
- if (titleEl)
2515
- titleEl.textContent = title;
2516
- if (messageEl)
2517
- messageEl.textContent = message;
2518
- modal.classList.add('show');
2519
- // No auto-hide - let user dismiss manually
2520
- }
2521
- }
2522
- showError(title, message) {
2523
- // Create a clean error toast instead of alert
2524
- const toast = document.createElement('div');
2525
- toast.style.cssText = `
2526
- position: fixed;
2527
- top: 20px;
2528
- right: 20px;
2529
- background: #fee2e2;
2530
- border: 1px solid #fecaca;
2531
- color: #dc2626;
2532
- padding: 12px 16px;
2533
- border-radius: 8px;
2534
- font-size: 14px;
2535
- font-weight: 500;
2536
- line-height: 1.4;
2537
- max-width: 300px;
2538
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
2539
- z-index: 10000;
2540
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
2541
- `;
2542
- toast.innerHTML = `
2543
- <div style="font-weight: 600; margin-bottom: 4px;">${title}</div>
2544
- <div style="font-size: 13px; opacity: 0.9;">${message}</div>
2545
- `;
2546
- document.body.appendChild(toast);
2547
- // Auto-remove after 5 seconds
2548
- setTimeout(() => {
2549
- if (toast.parentNode) {
2550
- toast.parentNode.removeChild(toast);
2551
- }
2552
- }, 5000);
2553
- // Click to dismiss
2554
- toast.addEventListener('click', () => {
2555
- if (toast.parentNode) {
2556
- toast.parentNode.removeChild(toast);
2557
- }
2558
- });
2559
- }
2560
- showConnectionError() {
2561
- this.showError('Connection Error', 'Server connection required for download verification. Please check your configuration and try again.');
2562
- }
2563
- showPaymentConfigError() {
2564
- this.showError('Payment Configuration Error', 'Payment system is not properly configured. Please contact support.');
2565
- }
2566
- disableDownloadButtons(errorType) {
2567
- // Find all buttons that were attached by the library
2568
- const buttons = document.querySelectorAll('[data-leadfast-attached]');
2569
- const errorMessages = {
2570
- connection: 'Download disabled: Server connection required',
2571
- payment: 'Download disabled: Payment configuration error'
2572
- };
2573
- const statusMessages = {
2574
- connection: '⚠️ Connection Error - Downloads Disabled',
2575
- payment: '⚠️ Payment Config Error - Downloads Disabled'
2576
- };
2577
- buttons.forEach(button => {
2578
- const btnElement = button;
2579
- btnElement.disabled = true;
2580
- btnElement.style.opacity = '0.5';
2581
- btnElement.style.cursor = 'not-allowed';
2582
- btnElement.title = errorMessages[errorType];
2583
- });
2584
- // Update user section to show error
2585
- const userSection = document.querySelector('.lead-fast-user-section');
2586
- if (userSection) {
2587
- userSection.innerHTML = `
2588
- <div style="
2589
- color: #ef4444;
2590
- padding: 6px 8px;
2591
- font-size: 12px;
2592
- font-weight: 500;
2593
- line-height: 1.2;
2594
- border-radius: 4px;
2595
- background: rgba(239, 68, 68, 0.05);
2596
- border: 1px solid rgba(239, 68, 68, 0.2);
2597
- max-width: 200px;
2598
- text-align: center;
2599
- ">
2600
- ${statusMessages[errorType]}
2601
- </div>
2602
- `;
2603
- }
2604
- }
2605
- async updateStatusDisplays() {
2606
- //console.log('🎨 [THEME DEBUG] updateStatusDisplays called');
2607
- // If connection failed, disable all download buttons
2608
- if (this.supabaseConnectionFailed) {
2609
- this.disableDownloadButtons('connection');
2610
- return;
2611
- }
2612
- // If payment configuration is invalid, disable all download buttons
2613
- if (this.config.payment && this.paymentConnectionFailed) {
2614
- this.disableDownloadButtons('payment');
2615
- return;
2616
- }
2617
- const status = await this.getDownloadStatus();
2618
- this.updateUserSection(status);
2619
- }
2620
- createTitleBar() {
2621
- //console.log('🎨 [THEME DEBUG] Creating title bar');
2622
- // Create the profile div if it doesn't exist
2623
- let profileDiv = document.getElementById('lead-fast-profile');
2624
- if (!profileDiv) {
2625
- profileDiv = document.createElement('div');
2626
- profileDiv.id = 'lead-fast-profile';
2627
- profileDiv.className = 'lead-fast-profile';
2628
- document.body.appendChild(profileDiv);
2629
- }
2630
- // Get title bar configuration
2631
- const titleConfig = this.config.titleBar || {};
2632
- const title = titleConfig.title || 'My App';
2633
- const titleImage = titleConfig.titleImage;
2634
- const links = titleConfig.links || [];
2635
- // Always create title bar with logo and navigation
2636
- profileDiv.innerHTML = `
2637
- <div class="lead-fast-title-bar">
2638
- <div class="lead-fast-title-section">
2639
- <a href="#" class="lead-fast-logo">
2640
- ${titleImage ? `<img src="${titleImage}" alt="${title}">` : ''}
2641
- <span>${title}</span>
2642
- </a>
2643
- <nav class="lead-fast-nav">
2644
- ${links.map(link => `
2645
- <a href="${link.url}" class="lead-fast-nav-link" ${link.target ? `target="${link.target}"` : ''}>
2646
- ${link.text}
2647
- </a>
2648
- `).join('')}
2649
- </nav>
2650
- </div>
2651
-
2652
- <div class="lead-fast-user-section" id="lead-fast-user-section">
2653
- <!-- User section will be populated when logged in -->
2654
- </div>
2655
-
2656
- <!-- <a href="https://www.moneyfast.bar" target="_blank" class="lead-fast-branding" style="text-decoration: none; color: inherit;">moneyfast.bar</a>-->
2657
- </div>
2658
- `;
2659
- }
2660
- updateUserSection(status) {
2661
- //console.log('🎨 [THEME DEBUG] updateUserSection called');
2662
- //console.log('🎨 [THEME DEBUG] Current data-theme:', document.documentElement.getAttribute('data-theme'));
2663
- const userSection = document.getElementById('lead-fast-user-section');
2664
- if (!userSection) {
2665
- //console.log('🎨 [THEME DEBUG] User section not found!');
2666
- return;
2667
- }
2668
- if (this.currentUser) {
2669
- // User is signed in - show user info
2670
- const userInitial = this.currentUser.email.charAt(0).toUpperCase();
2671
- const userEmail = this.currentUser.email;
2672
- const badgeClass = status.isPremium ? 'premium' : 'free';
2673
- const badgeText = status.isPremium ? 'Premium' : 'Free';
2674
- const countText = status.isPremium ? 'Unlimited' : `${status.currentCount}/${status.limit}`;
2675
- //console.log('🎨 [THEME DEBUG] Populating user section');
2676
- userSection.innerHTML = `
2677
- <div class="lead-fast-avatar">${userInitial}</div>
2678
- <div class="lead-fast-user-info">
2679
- <div class="lead-fast-user-email">${userEmail}</div>
2680
- <div class="lead-fast-user-status">
2681
- <span class="lead-fast-badge ${badgeClass}">${badgeText}</span>
2682
- <span class="lead-fast-count">${countText}</span>
2683
- </div>
2684
- </div>
2685
- <button class="lead-fast-signout">signout</button>
2686
- `;
2687
- // Debug CSS variables after updating user section
2688
- const titleBar = document.querySelector('.lead-fast-title-bar');
2689
- if (titleBar) {
2690
- getComputedStyle(titleBar);
2691
- //console.log('🎨 [THEME DEBUG] Title bar background color:', computedStyle.backgroundColor);
2692
- //console.log('🎨 [THEME DEBUG] Title bar border color:', computedStyle.borderColor);
2693
- }
2694
- // Add sign out functionality
2695
- const signoutBtn = userSection.querySelector('.lead-fast-signout');
2696
- if (signoutBtn) {
2697
- signoutBtn.addEventListener('click', () => {
2698
- this.signOut();
2699
- });
2700
- }
2701
- }
2702
- else {
2703
- // Anonymous user - show usage count
2704
- //console.log('🎨 [THEME DEBUG] Showing anonymous user usage count');
2705
- const countText = `Attempts: ${status.currentCount}/${status.limit}`;
2706
- userSection.innerHTML = `
2707
- <div class="lead-fast-anonymous-status">
2708
- <span class="lead-fast-count">${countText}</span>
2709
- </div>
2710
- `;
2711
- }
2712
- }
2713
- setupUIUpdates() {
2714
- // Update UI on auth changes
2715
- this.on('authChanged', async () => {
2716
- // Invalidate cache when auth state changes
2717
- // console.log(`🕐 [CACHE] Invalidating cache due to auth change (was: ${this.cachedStatus ? 'cached' : 'null'})`);
2718
- this.cachedStatus = null;
2719
- this.updateStatusDisplays();
2720
- // Update paywall display if it's currently shown
2721
- const modal = document.getElementById('download-limiter-paywall');
2722
- if (modal && modal.classList.contains('show')) {
2723
- this.updatePaywallDisplay();
2724
- // Auto-redirect to payment after sign-in from paywall (if not already premium)
2725
- if (this.currentUser && this.config.payment) {
2726
- setTimeout(async () => {
2727
- const isPremium = await this.checkPremiumStatus(this.currentUser.email);
2728
- if (!isPremium) {
2729
- // User is not premium, redirect to payment
2730
- const payment = await this.createPayment();
2731
- if (payment?.checkout_url) {
2732
- window.location.href = payment.checkout_url;
2733
- }
2734
- }
2735
- else {
2736
- // User is already premium, just close paywall and stay on page
2737
- modal.classList.remove('show');
2738
- }
2739
- }, 1000); // Small delay to let UI update
2740
- }
2741
- }
2742
- });
2743
- // Update UI on count changes
2744
- this.on('countChanged', () => {
2745
- this.updateStatusDisplays();
2746
- });
2747
- // Initial update
2748
- this.updateStatusDisplays();
2749
- }
2750
- updatePaywallDisplay() {
2751
- const modal = document.getElementById('download-limiter-paywall');
2752
- if (!modal)
2753
- return;
2754
- const authSection = modal.querySelector('#download-limiter-auth-section');
2755
- const paymentSection = modal.querySelector('#download-limiter-payment-section');
2756
- if (!this.currentUser) {
2757
- // Not signed in - show auth section
2758
- authSection.style.display = 'block';
2759
- paymentSection.style.display = 'none';
2760
- }
2761
- else {
2762
- // Signed in - show payment section
2763
- authSection.style.display = 'none';
2764
- paymentSection.style.display = 'block';
2765
- }
2766
- }
2767
- /**
2768
- * Event listener management
2769
- */
2770
- on(event, listener) {
2771
- if (!this.eventListeners.has(event)) {
2772
- this.eventListeners.set(event, []);
2773
- }
2774
- this.eventListeners.get(event).push(listener);
2775
- }
2776
- off(event, listener) {
2777
- const listeners = this.eventListeners.get(event);
2778
- if (listeners) {
2779
- const index = listeners.indexOf(listener);
2780
- if (index > -1) {
2781
- listeners.splice(index, 1);
2782
- }
2783
- }
2784
- }
2785
- emit(event, data) {
2786
- const listeners = this.eventListeners.get(event);
2787
- if (listeners) {
2788
- listeners.forEach(listener => {
2789
- try {
2790
- listener(data);
2791
- }
2792
- catch (error) {
2793
- console.error(`Error in ${event} listener:`, error);
2794
- }
2795
- });
2796
- }
2797
- }
2798
- validateConfig() {
2799
- if (!this.config.appId)
2800
- throw new Error('appId is required');
2801
- if (!this.config.supabase?.url)
2802
- throw new Error('supabase.url is required');
2803
- if (!this.config.supabase?.anonKey)
2804
- throw new Error('supabase.anonKey is required');
2805
- if (typeof this.config.freeAttemptLimit !== 'number' || this.config.freeAttemptLimit < 0) {
2806
- throw new Error('freeAttemptLimit must be a non-negative number');
2807
- }
2808
- }
2809
- async initializeSupabase() {
2810
- try {
2811
- this.supabase = createClient(this.config.supabase.url, this.config.supabase.anonKey);
2812
- // Skip connection test - we'll detect connection issues during actual API calls
2813
- this.supabaseConnectionFailed = false;
2814
- }
2815
- catch (error) {
2816
- console.error('Failed to initialize Supabase:', error);
2817
- this.supabaseConnectionFailed = true;
2818
- }
2819
- }
2820
- async initializePayment() {
2821
- // Skip if no payment configuration
2822
- if (!this.config.payment) {
2823
- return;
2824
- }
2825
- // Validate product ID format
2826
- const payment = this.config.payment?.find(p => p.provider === 'dodo');
2827
- if (!payment) {
2828
- this.paymentConnectionFailed = true;
2829
- if (this.config.options?.debug) {
2830
- console.warn('No dodo payment provider configured');
2831
- }
2832
- return;
2833
- }
2834
- const productId = payment.productId;
2835
- if (!productId || !productId.startsWith('pdt_') || productId.length < 10) {
2836
- this.paymentConnectionFailed = true;
2837
- if (this.config.options?.debug) {
2838
- console.warn('Invalid payment product ID format:', productId);
2839
- }
2840
- return;
2841
- }
2842
- // For now, skip payment gateway connectivity test
2843
- // Only validate product ID format (which we already did above)
2844
- // In production, you can add actual DodoPayments API test here
2845
- this.paymentConnectionFailed = false;
2846
- }
2847
- async initializeFingerprint() {
2848
- try {
2849
- this.userFingerprint = await this.generateFingerprint();
2850
- }
2851
- catch (error) {
2852
- this.userFingerprint = crypto.randomUUID ? crypto.randomUUID() : String(Date.now());
2853
- if (this.config.options?.debug) {
2854
- console.warn('Fingerprint generation failed, using fallback:', error);
2855
- }
2856
- }
2857
- }
2858
- async generateFingerprint() {
2859
- const ua = navigator.userAgent || '';
2860
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || '';
2861
- const screenSize = `${screen.width}x${screen.height}`;
2862
- const lang = navigator.language || '';
2863
- const raw = `${ua}||${tz}||${screenSize}||${lang}`;
2864
- const buf = new TextEncoder().encode(raw);
2865
- const hashBuffer = await crypto.subtle.digest('SHA-256', buf);
2866
- const hashArray = Array.from(new Uint8Array(hashBuffer));
2867
- return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
2868
- }
2869
- async setupAuthListener() {
2870
- this.supabase.auth.onAuthStateChange(async (event, session) => {
2871
- const previousUser = this.currentUser;
2872
- this.currentUser = session?.user || null;
2873
- let isPremium = false;
2874
- if (this.currentUser) {
2875
- // Only check premium status if user changed or cache is expired
2876
- const userChanged = !previousUser || previousUser.email !== this.currentUser.email;
2877
- const cacheExpired = !this.cachedPremiumStatus || (Date.now() - this.premiumStatusCacheTime) > this.STATUS_CACHE_DURATION;
2878
- if (userChanged || cacheExpired) {
2879
- console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from setupAuthListener (userChanged: ${userChanged}, cacheExpired: ${cacheExpired})`);
2880
- isPremium = await this.checkPremiumStatus(this.currentUser.email);
2881
- // Cache the result
2882
- this.cachedPremiumStatus = isPremium;
2883
- this.premiumStatusCacheTime = Date.now();
2884
- }
2885
- else {
2886
- // Use cached result
2887
- isPremium = this.cachedPremiumStatus; // We know it's not null because cacheExpired is false
2888
- console.log(`🔍 [CACHE] Using cached premium status from auth listener: ${isPremium}`);
2889
- }
2890
- }
2891
- else {
2892
- // Clear cache when user logs out
2893
- this.cachedPremiumStatus = null;
2894
- this.premiumStatusCacheTime = 0;
2895
- }
2896
- // Check if user just signed in for upgrade flow
2897
- const urlParams = new URLSearchParams(window.location.search);
2898
- const isUpgradeFlow = urlParams.get('upgrade') === 'true';
2899
- if (event === 'SIGNED_IN' && !previousUser && this.currentUser && this.config.payment) {
2900
- // Check if this is an upgrade flow (from anonymous trial)
2901
- if (isUpgradeFlow) {
2902
- if (!isPremium) {
2903
- // User signed in for upgrade - redirect to payment immediately
2904
- const payment = await this.createPayment();
2905
- if (payment?.checkout_url) {
2906
- // Clean URL before redirect
2907
- window.history.replaceState({}, document.title, window.location.pathname);
2908
- window.location.href = payment.checkout_url;
2909
- }
2910
- }
2911
- else {
2912
- // User is already premium, just clean URL and close modal
2913
- window.history.replaceState({}, document.title, window.location.pathname);
2914
- const modal = document.getElementById('download-limiter-paywall');
2915
- if (modal) {
2916
- modal.classList.remove('show');
2917
- }
2918
- }
2919
- }
2920
- }
2921
- this.emit('authChanged', { user: this.currentUser, isPremium });
2922
- });
2923
- // Get initial auth state
2924
- const { data: { user } } = await this.supabase.auth.getUser();
2925
- this.currentUser = user;
2926
- }
2927
- async getDownloadCount() {
2928
- if (!this.userFingerprint)
2929
- return 0;
2930
- console.log(`🔥 [SUPABASE API] getDownloadCount called | Time: ${new Date().toISOString()}`);
2931
- try {
2932
- const response = await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`, {
2933
- method: 'POST',
2934
- headers: {
2935
- 'Content-Type': 'application/json',
2936
- 'Authorization': `Bearer ${this.config.supabase.anonKey}`
2937
- },
2938
- body: JSON.stringify({
2939
- fingerprint: this.userFingerprint,
2940
- app_id: this.config.appId,
2941
- action: 'check'
2942
- })
2943
- });
2944
- console.log(`🔥 [SUPABASE API] getDownloadCount response: ${response.status}`);
2945
- if (response.ok) {
2946
- const data = await response.json();
2947
- this.supabaseConnectionFailed = false; // Connection successful
2948
- return data.current_count || 0;
2949
- }
2950
- else {
2951
- // Handle auth errors (401/403) as connection failures
2952
- if (response.status === 401 || response.status === 403) {
2953
- console.warn(`Supabase authentication failed: ${response.status} - Invalid anon key`);
2954
- this.supabaseConnectionFailed = true;
2955
- }
2956
- }
2957
- }
2958
- catch (error) {
2959
- this.supabaseConnectionFailed = true; // Mark connection as failed
2960
- if (this.config.options?.debug) {
2961
- console.warn('Failed to get server usage count, connection failed:', error);
2962
- }
2963
- }
2964
- // Security: Do not fallback to localStorage when server connection fails
2965
- // This prevents users from bypassing limits by manipulating localStorage
2966
- return 0;
2967
- }
2968
- async incrementDownloadCount() {
2969
- if (!this.userFingerprint) {
2970
- // if (this.config.options?.debug) {
2971
- // console.warn('🔍 DEBUG: No userFingerprint available for incrementDownloadCount');
2972
- // }
2973
- return 0;
2974
- }
2975
- const requestBody = {
2976
- fingerprint: this.userFingerprint,
2977
- app_id: this.config.appId,
2978
- action: 'increment'
2979
- };
2980
- console.log(`🔥 [SUPABASE API] incrementDownloadCount called | Time: ${new Date().toISOString()}`);
2981
- try {
2982
- const response = await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`, {
2983
- method: 'POST',
2984
- headers: {
2985
- 'Content-Type': 'application/json',
2986
- 'Authorization': `Bearer ${this.config.supabase.anonKey}`
2987
- },
2988
- body: JSON.stringify(requestBody)
2989
- });
2990
- console.log(`🔥 [SUPABASE API] incrementDownloadCount response: ${response.status}`);
2991
- if (this.config.options?.debug) {
2992
- //console.log('🔍 DEBUG: Response status:', response.status);
2993
- if (!response.ok) {
2994
- const errorText = await response.text();
2995
- console.error('🔍 DEBUG: Error response:', errorText);
2996
- }
2997
- }
2998
- if (response.ok) {
2999
- const data = await response.json();
3000
- this.supabaseConnectionFailed = false; // Connection successful
3001
- return data.new_count || 0;
3002
- }
3003
- else {
3004
- // Handle auth errors (401/403) as connection failures
3005
- if (response.status === 401 || response.status === 403) {
3006
- console.warn(`Supabase authentication failed: ${response.status} - Invalid anon key`);
3007
- this.supabaseConnectionFailed = true;
3008
- }
3009
- }
3010
- }
3011
- catch (error) {
3012
- this.supabaseConnectionFailed = true; // Mark connection as failed
3013
- if (this.config.options?.debug) {
3014
- console.warn('Failed to increment server count, connection failed:', error);
3015
- }
3016
- }
3017
- // Security: Do not fallback to localStorage when server connection fails
3018
- // This prevents users from bypassing limits by manipulating localStorage
3019
- return 0;
3020
- }
3021
- async checkPremiumStatus(email) {
3022
- console.log(`🔥 [SUPABASE API] checkPremiumStatus called for email: ${email} | Time: ${new Date().toISOString()}`);
3023
- try {
3024
- const response = await fetch(`${this.config.supabase.url}/functions/v1/check-payment-status`, {
3025
- method: 'POST',
3026
- headers: {
3027
- 'Content-Type': 'application/json',
3028
- 'Authorization': `Bearer ${this.config.supabase.anonKey}`
3029
- },
3030
- body: JSON.stringify({
3031
- email,
3032
- app_id: this.config.appId
3033
- })
3034
- });
3035
- console.log(`🔥 [SUPABASE API] checkPremiumStatus response: ${response.status}`);
3036
- if (response.ok) {
3037
- const data = await response.json();
3038
- return data.status === 'completed';
3039
- }
3040
- }
3041
- catch (error) {
3042
- if (this.config.options?.debug) {
3043
- console.warn('Failed to check premium status:', error);
3044
- }
3045
- }
3046
- return false;
3047
- }
3048
- getLocalDownloadCount() {
3049
- const key = `download_count_${this.config.appId}`;
3050
- const val = parseInt(localStorage.getItem(key) || '0', 10);
3051
- return isNaN(val) ? 0 : val;
3052
- }
3053
- incrementLocalDownloadCount() {
3054
- const key = `download_count_${this.config.appId}`;
3055
- const next = this.getLocalDownloadCount() + 1;
3056
- localStorage.setItem(key, String(next));
3057
- return next;
3058
- }
3059
- handleError(error) {
3060
- if (this.config.options?.debug) {
3061
- console.error('Lead Fast Error:', error);
3062
- }
3063
- if (this.config.callbacks?.onError) {
3064
- this.config.callbacks.onError(error);
3065
- }
3066
- else {
3067
- // Default error handling
3068
- console.error('Lead Fast:', error.message);
3069
- }
3070
- this.emit('error', error);
3071
- }
3072
- async checkPaymentStatus() {
3073
- // Check if user returned from payment
3074
- const urlParams = new URLSearchParams(window.location.search);
3075
- if (urlParams.get('payment') === 'success') {
3076
- // Wait for auth to be ready
3077
- setTimeout(async () => {
3078
- if (this.currentUser) {
3079
- const isPremium = await this.checkPremiumStatus(this.currentUser.email);
3080
- if (isPremium) {
3081
- this.showSuccess('Payment Successful!', 'Welcome to premium! You now have unlimited usage.');
3082
- }
3083
- else {
3084
- this.showSuccess('Processing Payment', 'Payment is being processed. Please refresh in a few moments.');
3085
- }
3086
- }
3087
- else {
3088
- this.showSuccess('Processing Payment', 'Please wait while we verify your payment...');
3089
- }
3090
- // Clean up URL
3091
- const cleanUrl = window.location.href.split('?')[0];
3092
- window.history.replaceState({}, document.title, cleanUrl);
3093
- }, 2000);
3094
- }
3095
- }
3096
- }
3097
-
3098
- export { MoneyBar };
3099
- //# sourceMappingURL=index.browser.js.map