@nextsparkjs/plugin-amplitude 0.1.0-beta.1

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.
@@ -0,0 +1,593 @@
1
+ /* Amplitude Plugin Styles */
2
+
3
+ /* CSS Custom Properties for Theme Integration */
4
+ :root {
5
+ --amplitude-primary: #3b82f6;
6
+ --amplitude-primary-hover: #2563eb;
7
+ --amplitude-success: #10b981;
8
+ --amplitude-warning: #f59e0b;
9
+ --amplitude-error: #ef4444;
10
+ --amplitude-bg-primary: #ffffff;
11
+ --amplitude-bg-secondary: #f9fafb;
12
+ --amplitude-bg-modal: rgba(0, 0, 0, 0.5);
13
+ --amplitude-text-primary: #111827;
14
+ --amplitude-text-secondary: #6b7280;
15
+ --amplitude-border: #e5e7eb;
16
+ --amplitude-border-hover: #d1d5db;
17
+ --amplitude-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
18
+ --amplitude-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
19
+ --amplitude-radius: 0.375rem;
20
+ --amplitude-radius-lg: 0.5rem;
21
+ }
22
+
23
+ /* Dark mode support */
24
+ [data-theme="dark"] {
25
+ --amplitude-bg-primary: #1f2937;
26
+ --amplitude-bg-secondary: #374151;
27
+ --amplitude-bg-modal: rgba(0, 0, 0, 0.75);
28
+ --amplitude-text-primary: #f9fafb;
29
+ --amplitude-text-secondary: #d1d5db;
30
+ --amplitude-border: #4b5563;
31
+ --amplitude-border-hover: #6b7280;
32
+ }
33
+
34
+ /* Consent Manager Styles */
35
+ .amplitude-consent-modal {
36
+ position: fixed;
37
+ z-index: 9999;
38
+ font-family: system-ui, -apple-system, sans-serif;
39
+ }
40
+
41
+ .amplitude-consent-modal--bottom-right {
42
+ bottom: 20px;
43
+ right: 20px;
44
+ }
45
+
46
+ .amplitude-consent-modal--bottom-left {
47
+ bottom: 20px;
48
+ left: 20px;
49
+ }
50
+
51
+ .amplitude-consent-modal--center {
52
+ top: 50%;
53
+ left: 50%;
54
+ transform: translate(-50%, -50%);
55
+ }
56
+
57
+ .amplitude-consent-modal--top {
58
+ top: 20px;
59
+ left: 50%;
60
+ transform: translateX(-50%);
61
+ }
62
+
63
+ .amplitude-consent-modal__backdrop {
64
+ position: fixed;
65
+ top: 0;
66
+ left: 0;
67
+ right: 0;
68
+ bottom: 0;
69
+ background: var(--amplitude-bg-modal);
70
+ z-index: -1;
71
+ }
72
+
73
+ .amplitude-consent-modal__content {
74
+ background: var(--amplitude-bg-primary);
75
+ border-radius: var(--amplitude-radius-lg);
76
+ box-shadow: var(--amplitude-shadow-lg);
77
+ max-width: 400px;
78
+ width: 90vw;
79
+ max-height: 80vh;
80
+ overflow-y: auto;
81
+ border: 1px solid var(--amplitude-border);
82
+ }
83
+
84
+ .amplitude-consent-modal__content--compact {
85
+ max-width: 320px;
86
+ }
87
+
88
+ .amplitude-consent-modal__header {
89
+ display: flex;
90
+ justify-content: space-between;
91
+ align-items: center;
92
+ padding: 20px 20px 16px;
93
+ border-bottom: 1px solid var(--amplitude-border);
94
+ }
95
+
96
+ .amplitude-consent-modal__title {
97
+ margin: 0;
98
+ color: var(--amplitude-text-primary);
99
+ font-size: 1.125rem;
100
+ font-weight: 600;
101
+ }
102
+
103
+ .amplitude-consent-modal__close {
104
+ background: none;
105
+ border: none;
106
+ font-size: 1.5rem;
107
+ color: var(--amplitude-text-secondary);
108
+ cursor: pointer;
109
+ padding: 0;
110
+ width: 24px;
111
+ height: 24px;
112
+ display: flex;
113
+ align-items: center;
114
+ justify-content: center;
115
+ border-radius: var(--amplitude-radius);
116
+ transition: all 0.2s ease;
117
+ }
118
+
119
+ .amplitude-consent-modal__close:hover {
120
+ background: var(--amplitude-bg-secondary);
121
+ color: var(--amplitude-text-primary);
122
+ }
123
+
124
+ .amplitude-consent-modal__body {
125
+ padding: 20px;
126
+ }
127
+
128
+ .amplitude-consent-modal__description {
129
+ margin: 0 0 20px 0;
130
+ color: var(--amplitude-text-secondary);
131
+ line-height: 1.5;
132
+ }
133
+
134
+ .amplitude-consent-modal__categories {
135
+ space-y: 16px;
136
+ }
137
+
138
+ .amplitude-consent-category {
139
+ margin-bottom: 16px;
140
+ }
141
+
142
+ .amplitude-consent-category__label {
143
+ display: flex;
144
+ align-items: flex-start;
145
+ cursor: pointer;
146
+ font-weight: 500;
147
+ color: var(--amplitude-text-primary);
148
+ }
149
+
150
+ .amplitude-consent-category__checkbox {
151
+ margin-right: 8px;
152
+ margin-top: 2px;
153
+ accent-color: var(--amplitude-primary);
154
+ }
155
+
156
+ .amplitude-consent-category__name {
157
+ flex: 1;
158
+ }
159
+
160
+ .amplitude-consent-category__description {
161
+ margin: 4px 0 0 24px;
162
+ font-size: 0.875rem;
163
+ color: var(--amplitude-text-secondary);
164
+ line-height: 1.4;
165
+ }
166
+
167
+ .amplitude-consent-modal__actions {
168
+ display: flex;
169
+ gap: 8px;
170
+ padding: 16px 20px 20px;
171
+ border-top: 1px solid var(--amplitude-border);
172
+ flex-wrap: wrap;
173
+ }
174
+
175
+ .amplitude-consent-modal__button {
176
+ flex: 1;
177
+ min-width: 0;
178
+ padding: 8px 16px;
179
+ border-radius: var(--amplitude-radius);
180
+ border: 1px solid var(--amplitude-border);
181
+ background: var(--amplitude-bg-primary);
182
+ color: var(--amplitude-text-primary);
183
+ cursor: pointer;
184
+ font-size: 0.875rem;
185
+ font-weight: 500;
186
+ transition: all 0.2s ease;
187
+ }
188
+
189
+ .amplitude-consent-modal__button:hover {
190
+ border-color: var(--amplitude-border-hover);
191
+ background: var(--amplitude-bg-secondary);
192
+ }
193
+
194
+ .amplitude-consent-modal__button--primary {
195
+ background: var(--amplitude-primary);
196
+ color: white;
197
+ border-color: var(--amplitude-primary);
198
+ }
199
+
200
+ .amplitude-consent-modal__button--primary:hover {
201
+ background: var(--amplitude-primary-hover);
202
+ border-color: var(--amplitude-primary-hover);
203
+ }
204
+
205
+ .amplitude-consent-modal__button--accent {
206
+ background: var(--amplitude-success);
207
+ color: white;
208
+ border-color: var(--amplitude-success);
209
+ }
210
+
211
+ .amplitude-consent-modal__button--accent:hover {
212
+ opacity: 0.9;
213
+ }
214
+
215
+ .amplitude-consent-modal__button--secondary {
216
+ background: transparent;
217
+ color: var(--amplitude-text-secondary);
218
+ }
219
+
220
+ .amplitude-consent-modal__footer {
221
+ padding: 0 20px 20px;
222
+ }
223
+
224
+ .amplitude-consent-modal__footer-text {
225
+ margin: 0;
226
+ font-size: 0.75rem;
227
+ color: var(--amplitude-text-secondary);
228
+ text-align: center;
229
+ }
230
+
231
+ /* Consent Badge */
232
+ .amplitude-consent-badge {
233
+ position: fixed;
234
+ z-index: 9998;
235
+ background: var(--amplitude-bg-primary);
236
+ border: 1px solid var(--amplitude-border);
237
+ border-radius: var(--amplitude-radius);
238
+ padding: 8px 12px;
239
+ box-shadow: var(--amplitude-shadow-sm);
240
+ cursor: pointer;
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 6px;
244
+ font-size: 0.875rem;
245
+ color: var(--amplitude-text-primary);
246
+ transition: all 0.2s ease;
247
+ }
248
+
249
+ .amplitude-consent-badge:hover {
250
+ box-shadow: var(--amplitude-shadow-lg);
251
+ border-color: var(--amplitude-border-hover);
252
+ }
253
+
254
+ .amplitude-consent-badge__icon {
255
+ font-size: 1rem;
256
+ }
257
+
258
+ .amplitude-consent-badge__text {
259
+ white-space: nowrap;
260
+ }
261
+
262
+ /* Analytics Dashboard Styles */
263
+ .amplitude-dashboard {
264
+ background: var(--amplitude-bg-primary);
265
+ border-radius: var(--amplitude-radius-lg);
266
+ border: 1px solid var(--amplitude-border);
267
+ padding: 24px;
268
+ color: var(--amplitude-text-primary);
269
+ }
270
+
271
+ .amplitude-dashboard--compact {
272
+ padding: 16px;
273
+ }
274
+
275
+ .amplitude-dashboard--loading,
276
+ .amplitude-dashboard--error,
277
+ .amplitude-dashboard--not-initialized {
278
+ text-align: center;
279
+ padding: 40px 24px;
280
+ }
281
+
282
+ .amplitude-dashboard__header {
283
+ display: flex;
284
+ justify-content: space-between;
285
+ align-items: center;
286
+ margin-bottom: 24px;
287
+ padding-bottom: 16px;
288
+ border-bottom: 1px solid var(--amplitude-border);
289
+ }
290
+
291
+ .amplitude-dashboard__title {
292
+ margin: 0;
293
+ font-size: 1.25rem;
294
+ font-weight: 600;
295
+ }
296
+
297
+ .amplitude-dashboard__refresh-button,
298
+ .amplitude-dashboard__retry-button {
299
+ background: var(--amplitude-primary);
300
+ color: white;
301
+ border: none;
302
+ padding: 8px 16px;
303
+ border-radius: var(--amplitude-radius);
304
+ cursor: pointer;
305
+ font-size: 0.875rem;
306
+ font-weight: 500;
307
+ transition: background 0.2s ease;
308
+ }
309
+
310
+ .amplitude-dashboard__refresh-button:hover,
311
+ .amplitude-dashboard__retry-button:hover {
312
+ background: var(--amplitude-primary-hover);
313
+ }
314
+
315
+ .amplitude-dashboard__refresh-button:disabled {
316
+ opacity: 0.6;
317
+ cursor: not-allowed;
318
+ }
319
+
320
+ .amplitude-dashboard__alerts {
321
+ margin-bottom: 24px;
322
+ padding: 16px;
323
+ background: var(--amplitude-bg-secondary);
324
+ border-radius: var(--amplitude-radius);
325
+ border: 1px solid var(--amplitude-border);
326
+ }
327
+
328
+ .amplitude-dashboard__alerts h3 {
329
+ margin: 0 0 12px 0;
330
+ font-size: 1rem;
331
+ font-weight: 600;
332
+ }
333
+
334
+ .amplitude-dashboard__alert {
335
+ display: flex;
336
+ align-items: center;
337
+ gap: 8px;
338
+ padding: 8px 12px;
339
+ border-radius: var(--amplitude-radius);
340
+ margin-bottom: 8px;
341
+ font-size: 0.875rem;
342
+ }
343
+
344
+ .amplitude-dashboard__alert:last-child {
345
+ margin-bottom: 0;
346
+ }
347
+
348
+ .amplitude-dashboard__alert--warning {
349
+ background: rgba(245, 158, 11, 0.1);
350
+ color: var(--amplitude-warning);
351
+ }
352
+
353
+ .amplitude-dashboard__alert--error {
354
+ background: rgba(239, 68, 68, 0.1);
355
+ color: var(--amplitude-error);
356
+ }
357
+
358
+ .amplitude-dashboard__alert--critical {
359
+ background: rgba(239, 68, 68, 0.15);
360
+ color: var(--amplitude-error);
361
+ font-weight: 600;
362
+ }
363
+
364
+ .amplitude-dashboard__alert-icon {
365
+ font-size: 1rem;
366
+ }
367
+
368
+ .amplitude-dashboard__alert-message {
369
+ flex: 1;
370
+ }
371
+
372
+ .amplitude-dashboard__alert-value {
373
+ font-family: monospace;
374
+ font-size: 0.75rem;
375
+ }
376
+
377
+ .amplitude-dashboard__metrics-grid {
378
+ display: grid;
379
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
380
+ gap: 16px;
381
+ margin-bottom: 24px;
382
+ }
383
+
384
+ .amplitude-dashboard__metric-card {
385
+ background: var(--amplitude-bg-secondary);
386
+ border: 1px solid var(--amplitude-border);
387
+ border-radius: var(--amplitude-radius);
388
+ padding: 16px;
389
+ text-align: center;
390
+ }
391
+
392
+ .amplitude-dashboard__metric-card h3 {
393
+ margin: 0 0 8px 0;
394
+ font-size: 0.875rem;
395
+ font-weight: 500;
396
+ color: var(--amplitude-text-secondary);
397
+ text-transform: uppercase;
398
+ letter-spacing: 0.05em;
399
+ }
400
+
401
+ .amplitude-dashboard__metric-value {
402
+ display: block;
403
+ font-size: 1.875rem;
404
+ font-weight: 700;
405
+ color: var(--amplitude-text-primary);
406
+ margin-bottom: 4px;
407
+ }
408
+
409
+ .amplitude-dashboard__metric-label {
410
+ font-size: 0.75rem;
411
+ color: var(--amplitude-text-secondary);
412
+ }
413
+
414
+ .amplitude-dashboard__performance-table {
415
+ margin-top: 24px;
416
+ }
417
+
418
+ .amplitude-dashboard__performance-table h3 {
419
+ margin: 0 0 16px 0;
420
+ font-size: 1rem;
421
+ font-weight: 600;
422
+ }
423
+
424
+ .amplitude-dashboard__table-container {
425
+ overflow-x: auto;
426
+ border: 1px solid var(--amplitude-border);
427
+ border-radius: var(--amplitude-radius);
428
+ }
429
+
430
+ .amplitude-dashboard__table {
431
+ width: 100%;
432
+ border-collapse: collapse;
433
+ font-size: 0.875rem;
434
+ }
435
+
436
+ .amplitude-dashboard__table th,
437
+ .amplitude-dashboard__table td {
438
+ padding: 12px;
439
+ text-align: left;
440
+ border-bottom: 1px solid var(--amplitude-border);
441
+ }
442
+
443
+ .amplitude-dashboard__table th {
444
+ background: var(--amplitude-bg-secondary);
445
+ font-weight: 600;
446
+ color: var(--amplitude-text-primary);
447
+ }
448
+
449
+ .amplitude-dashboard__table td {
450
+ color: var(--amplitude-text-secondary);
451
+ }
452
+
453
+ .amplitude-dashboard__table tr:last-child td {
454
+ border-bottom: none;
455
+ }
456
+
457
+ .amplitude-dashboard__table tr:hover {
458
+ background: var(--amplitude-bg-secondary);
459
+ }
460
+
461
+ .amplitude-dashboard__footer {
462
+ margin-top: 24px;
463
+ padding-top: 16px;
464
+ border-top: 1px solid var(--amplitude-border);
465
+ }
466
+
467
+ .amplitude-dashboard__footer-text {
468
+ margin: 0;
469
+ font-size: 0.75rem;
470
+ color: var(--amplitude-text-secondary);
471
+ text-align: center;
472
+ }
473
+
474
+ .amplitude-dashboard__spinner {
475
+ width: 40px;
476
+ height: 40px;
477
+ border: 4px solid var(--amplitude-border);
478
+ border-top-color: var(--amplitude-primary);
479
+ border-radius: 50%;
480
+ animation: amplitude-spin 1s linear infinite;
481
+ margin: 0 auto 16px;
482
+ }
483
+
484
+ @keyframes amplitude-spin {
485
+ to {
486
+ transform: rotate(360deg);
487
+ }
488
+ }
489
+
490
+ /* Experiment Wrapper Styles */
491
+ .amplitude-experiment-wrapper {
492
+ position: relative;
493
+ }
494
+
495
+ .amplitude-experiment-wrapper--loading {
496
+ opacity: 0.7;
497
+ pointer-events: none;
498
+ }
499
+
500
+ .amplitude-experiment-loading {
501
+ display: flex;
502
+ align-items: center;
503
+ justify-content: center;
504
+ padding: 20px;
505
+ color: var(--amplitude-text-secondary);
506
+ font-size: 0.875rem;
507
+ }
508
+
509
+ /* Performance Monitor Styles */
510
+ .amplitude-performance-monitor {
511
+ background: var(--amplitude-bg-secondary);
512
+ border: 1px solid var(--amplitude-border);
513
+ border-radius: var(--amplitude-radius);
514
+ padding: 16px;
515
+ font-family: monospace;
516
+ font-size: 0.875rem;
517
+ color: var(--amplitude-text-primary);
518
+ }
519
+
520
+ .amplitude-performance-monitor h3 {
521
+ margin: 0 0 12px 0;
522
+ font-family: system-ui, -apple-system, sans-serif;
523
+ font-size: 1rem;
524
+ font-weight: 600;
525
+ }
526
+
527
+ .amplitude-performance-monitor ul {
528
+ list-style: none;
529
+ padding: 0;
530
+ margin: 0;
531
+ }
532
+
533
+ .amplitude-performance-monitor li {
534
+ margin-bottom: 8px;
535
+ padding: 4px 0;
536
+ border-bottom: 1px solid var(--amplitude-border);
537
+ }
538
+
539
+ .amplitude-performance-monitor li:last-child {
540
+ border-bottom: none;
541
+ margin-bottom: 0;
542
+ }
543
+
544
+ /* Responsive Design */
545
+ @media (max-width: 768px) {
546
+ .amplitude-consent-modal__content {
547
+ max-width: 95vw;
548
+ margin: 10px;
549
+ }
550
+
551
+ .amplitude-consent-modal__actions {
552
+ flex-direction: column;
553
+ }
554
+
555
+ .amplitude-dashboard__metrics-grid {
556
+ grid-template-columns: 1fr;
557
+ }
558
+
559
+ .amplitude-dashboard {
560
+ padding: 16px;
561
+ }
562
+
563
+ .amplitude-dashboard__header {
564
+ flex-direction: column;
565
+ gap: 12px;
566
+ align-items: stretch;
567
+ }
568
+ }
569
+
570
+ /* Accessibility */
571
+ @media (prefers-reduced-motion: reduce) {
572
+ .amplitude-consent-modal__button,
573
+ .amplitude-consent-badge,
574
+ .amplitude-dashboard__refresh-button,
575
+ .amplitude-dashboard__spinner {
576
+ transition: none;
577
+ animation: none;
578
+ }
579
+ }
580
+
581
+ /* High contrast mode support */
582
+ @media (prefers-contrast: high) {
583
+ :root {
584
+ --amplitude-border: #000000;
585
+ --amplitude-text-secondary: #000000;
586
+ }
587
+
588
+ [data-theme="dark"] {
589
+ --amplitude-border: #ffffff;
590
+ --amplitude-text-secondary: #ffffff;
591
+ }
592
+ }
593
+
@@ -0,0 +1,45 @@
1
+ {
2
+ "plugin": {
3
+ "name": "Amplitude Analytics",
4
+ "description": "Advanced user analytics and behavioral tracking plugin for SaaS applications."
5
+ },
6
+ "consent": {
7
+ "title": "Privacy Preferences",
8
+ "description": "We use cookies and other tracking technologies to improve your experience. Please review your preferences.",
9
+ "category": {
10
+ "analytics": "Analytics (collects anonymous usage data)",
11
+ "sessionReplay": "Session Replay (records user sessions for debugging)",
12
+ "experiments": "A/B Testing (participate in experiments)",
13
+ "performance": "Performance Monitoring (collects app performance metrics)"
14
+ },
15
+ "acceptAll": "Accept All",
16
+ "rejectAll": "Reject All",
17
+ "savePreferences": "Save Preferences",
18
+ "managePreferences": "Manage Privacy Preferences"
19
+ },
20
+ "dashboard": {
21
+ "title": "Amplitude Analytics Dashboard",
22
+ "description": "Overview of collected analytics data and plugin performance.",
23
+ "loading": "Loading analytics data...",
24
+ "error": "Error loading dashboard: {{error}}",
25
+ "notInitialized": "Amplitude plugin not initialized. Check configuration.",
26
+ "performanceMetrics": "Performance Metrics"
27
+ },
28
+ "experiments": {
29
+ "variant": "Variant: {{variantName}}",
30
+ "loading": "Loading experiment..."
31
+ },
32
+ "sessionReplay": {
33
+ "enabled": "Session Replay is enabled.",
34
+ "disabled": "Session Replay is disabled due to consent or configuration."
35
+ },
36
+ "errors": {
37
+ "apiKeyMissing": "Amplitude API Key is missing or invalid.",
38
+ "notInitialized": "Amplitude SDK is not initialized.",
39
+ "offline": "You are offline. Events will be queued.",
40
+ "trackFailed": "Failed to track event: {{eventType}}",
41
+ "identifyFailed": "Failed to identify user: {{userId}}",
42
+ "setUserPropertiesFailed": "Failed to set user properties."
43
+ }
44
+ }
45
+
@@ -0,0 +1,45 @@
1
+ {
2
+ "plugin": {
3
+ "name": "Amplitude Analytics",
4
+ "description": "Plugin avanzado de análisis de usuario y seguimiento de comportamiento para aplicaciones SaaS."
5
+ },
6
+ "consent": {
7
+ "title": "Preferencias de Privacidad",
8
+ "description": "Utilizamos cookies y otras tecnologías de seguimiento para mejorar su experiencia. Por favor, revise sus preferencias.",
9
+ "category": {
10
+ "analytics": "Análisis (recopila datos de uso anónimos)",
11
+ "sessionReplay": "Grabación de Sesiones (registra sesiones de usuario para depuración)",
12
+ "experiments": "Pruebas A/B (participar en experimentos)",
13
+ "performance": "Monitoreo de Rendimiento (recopila métricas de rendimiento de la aplicación)"
14
+ },
15
+ "acceptAll": "Aceptar Todo",
16
+ "rejectAll": "Rechazar Todo",
17
+ "savePreferences": "Guardar Preferencias",
18
+ "managePreferences": "Administrar Preferencias de Privacidad"
19
+ },
20
+ "dashboard": {
21
+ "title": "Panel de Control de Amplitude Analytics",
22
+ "description": "Resumen de los datos analíticos recopilados y el rendimiento del plugin.",
23
+ "loading": "Cargando datos analíticos...",
24
+ "error": "Error al cargar el panel: {{error}}",
25
+ "notInitialized": "El plugin de Amplitude no está inicializado. Verifique la configuración.",
26
+ "performanceMetrics": "Métricas de Rendimiento"
27
+ },
28
+ "experiments": {
29
+ "variant": "Variante: {{variantName}}",
30
+ "loading": "Cargando experimento..."
31
+ },
32
+ "sessionReplay": {
33
+ "enabled": "La Grabación de Sesiones está habilitada.",
34
+ "disabled": "La Grabación de Sesiones está deshabilitada debido al consentimiento o la configuración."
35
+ },
36
+ "errors": {
37
+ "apiKeyMissing": "La clave API de Amplitude falta o no es válida.",
38
+ "notInitialized": "El SDK de Amplitude no está inicializado.",
39
+ "offline": "Estás sin conexión. Los eventos se pondrán en cola.",
40
+ "trackFailed": "Fallo al rastrear el evento: {{eventType}}",
41
+ "identifyFailed": "Fallo al identificar al usuario: {{userId}}",
42
+ "setUserPropertiesFailed": "Fallo al establecer las propiedades del usuario."
43
+ }
44
+ }
45
+