@cognior/iap-sdk 0.1.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.

Potentially problematic release.


This version of @cognior/iap-sdk might be problematic. Click here for more details.

Files changed (60) hide show
  1. package/.github/copilot-instructions.md +95 -0
  2. package/README.md +79 -0
  3. package/TRACKING.md +105 -0
  4. package/USER_CONTEXT_README.md +284 -0
  5. package/package.json +154 -0
  6. package/src/config.ts +25 -0
  7. package/src/core/flowEngine.ts +1833 -0
  8. package/src/core/triggerManager.ts +1011 -0
  9. package/src/experiences/banner.ts +366 -0
  10. package/src/experiences/beacon.ts +668 -0
  11. package/src/experiences/hotspotTour.ts +654 -0
  12. package/src/experiences/hotspots.ts +566 -0
  13. package/src/experiences/modal.ts +1337 -0
  14. package/src/experiences/modalSequence.ts +1247 -0
  15. package/src/experiences/popover.ts +652 -0
  16. package/src/experiences/registry.ts +21 -0
  17. package/src/experiences/survey.ts +1639 -0
  18. package/src/experiences/taskList.ts +625 -0
  19. package/src/experiences/tooltip.ts +740 -0
  20. package/src/experiences/types.ts +395 -0
  21. package/src/experiences/walkthrough.ts +670 -0
  22. package/src/flow-sequence.ts +177 -0
  23. package/src/flows.ts +512 -0
  24. package/src/http.ts +61 -0
  25. package/src/index.ts +355 -0
  26. package/src/services/flowManager.ts +905 -0
  27. package/src/services/flowNormalizer.ts +74 -0
  28. package/src/services/locationContextService.ts +189 -0
  29. package/src/services/pageContextService.ts +221 -0
  30. package/src/services/userContextService.ts +286 -0
  31. package/src/state/appState.ts +0 -0
  32. package/src/state/hooks.ts +0 -0
  33. package/src/state/index.ts +0 -0
  34. package/src/state/migration.ts +0 -0
  35. package/src/state/store.ts +0 -0
  36. package/src/styles/banner.css.ts +0 -0
  37. package/src/styles/hotspot.css.ts +0 -0
  38. package/src/styles/hotspotTour.css.ts +0 -0
  39. package/src/styles/modal.css.ts +564 -0
  40. package/src/styles/survey.css.ts +1013 -0
  41. package/src/styles/taskList.css.ts +0 -0
  42. package/src/styles/tooltip.css.ts +149 -0
  43. package/src/styles/walkthrough.css.ts +0 -0
  44. package/src/tourUtils.ts +0 -0
  45. package/src/tracking.ts +223 -0
  46. package/src/utils/debounce.ts +66 -0
  47. package/src/utils/eventSequenceValidator.ts +124 -0
  48. package/src/utils/flowTrackingSystem.ts +524 -0
  49. package/src/utils/idGenerator.ts +155 -0
  50. package/src/utils/immediateValidationPrevention.ts +184 -0
  51. package/src/utils/normalize.ts +50 -0
  52. package/src/utils/privacyManager.ts +166 -0
  53. package/src/utils/ruleEvaluator.ts +199 -0
  54. package/src/utils/sanitize.ts +79 -0
  55. package/src/utils/selectors.ts +107 -0
  56. package/src/utils/stepExecutor.ts +345 -0
  57. package/src/utils/triggerNormalizer.ts +149 -0
  58. package/src/utils/validationInterceptor.ts +650 -0
  59. package/tsconfig.json +13 -0
  60. package/tsup.config.ts +13 -0
@@ -0,0 +1,564 @@
1
+ export const modalCssText = `
2
+ /* ===================== Modal Styles ===================== */
3
+ .dap-modal-overlay {
4
+ position: fixed !important;
5
+ top: 0 !important;
6
+ left: 0 !important;
7
+ right: 0 !important;
8
+ bottom: 0 !important;
9
+ background: rgba(0, 0, 0, 0.4) !important;
10
+ backdrop-filter: blur(4px) !important;
11
+ z-index: 2147483640 !important;
12
+ display: flex !important;
13
+ align-items: center !important;
14
+ justify-content: center !important;
15
+ padding: 20px !important;
16
+ animation: dap-modal-fade-in 0.3s ease-out !important;
17
+ }
18
+
19
+ .dap-modal {
20
+ background: white !important;
21
+ border-radius: 12px !important;
22
+ box-shadow:
23
+ 0 25px 50px rgba(0, 0, 0, 0.15),
24
+ 0 10px 25px rgba(0, 0, 0, 0.1),
25
+ 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
26
+ width: 680px !important;
27
+ max-width: 90vw !important;
28
+ max-height: 80vh !important;
29
+ min-height: 400px !important;
30
+ display: flex !important;
31
+ flex-direction: column !important;
32
+ overflow: hidden !important;
33
+ animation: dap-modal-slide-up 0.3s ease-out !important;
34
+ transform-origin: center bottom !important;
35
+ }
36
+
37
+ .dap-modal-header {
38
+ background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
39
+ border-bottom: 1px solid #e2e8f0 !important;
40
+ padding: 20px 24px !important;
41
+ display: flex !important;
42
+ align-items: center !important;
43
+ justify-content: space-between !important;
44
+ cursor: move !important;
45
+ user-select: none !important;
46
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
47
+ position: relative !important;
48
+ flex-shrink: 0 !important;
49
+ border-radius: 12px 12px 0 0 !important;
50
+ transition: background 0.2s ease !important;
51
+ }
52
+
53
+ .dap-modal-header:hover {
54
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
55
+ }
56
+
57
+ .dap-modal-header.dragging {
58
+ background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
59
+ cursor: grabbing !important;
60
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
61
+ }
62
+
63
+ .dap-modal-overlay.dragging {
64
+ cursor: grabbing !important;
65
+ }
66
+
67
+ .dap-modal-header::before {
68
+ content: '' !important;
69
+ position: absolute !important;
70
+ top: 0 !important;
71
+ left: 0 !important;
72
+ right: 0 !important;
73
+ height: 3px !important;
74
+ background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4) !important;
75
+ border-radius: 12px 12px 0 0 !important;
76
+ }
77
+
78
+ .dap-modal-title {
79
+ margin: 0 !important;
80
+ font-size: 20px !important;
81
+ font-weight: 700 !important;
82
+ color: #1e293b !important;
83
+ flex: 1 !important;
84
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
85
+ letter-spacing: -0.025em !important;
86
+ }
87
+
88
+ .dap-modal-close {
89
+ background: transparent !important;
90
+ border: 2px solid transparent !important;
91
+ cursor: pointer !important;
92
+ padding: 8px !important;
93
+ color: #64748b !important;
94
+ font-size: 20px !important;
95
+ width: 36px !important;
96
+ height: 36px !important;
97
+ border-radius: 8px !important;
98
+ transition: all 0.2s ease !important;
99
+ display: flex !important;
100
+ align-items: center !important;
101
+ justify-content: center !important;
102
+ }
103
+
104
+ .dap-modal-close:hover {
105
+ color: #dc2626 !important;
106
+ background: #fef2f2 !important;
107
+ border-color: #fecaca !important;
108
+ transform: scale(1.05) !important;
109
+ }
110
+
111
+ .dap-modal-body {
112
+ flex: 1 !important;
113
+ padding: 24px !important;
114
+ overflow-y: auto !important;
115
+ overflow-x: hidden !important;
116
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
117
+ line-height: 1.6 !important;
118
+ color: #374151 !important;
119
+ min-height: 0 !important;
120
+ }
121
+
122
+ .dap-modal-body::-webkit-scrollbar {
123
+ width: 6px !important;
124
+ }
125
+
126
+ .dap-modal-body::-webkit-scrollbar-track {
127
+ background: transparent !important;
128
+ }
129
+
130
+ .dap-modal-body::-webkit-scrollbar-thumb {
131
+ background: rgba(0, 0, 0, 0.2) !important;
132
+ border-radius: 3px !important;
133
+ }
134
+
135
+ .dap-modal-body::-webkit-scrollbar-thumb:hover {
136
+ background: rgba(0, 0, 0, 0.3) !important;
137
+ }
138
+
139
+ .dap-modal-body h1,
140
+ .dap-modal-body h2,
141
+ .dap-modal-body h3,
142
+ .dap-modal-body h4,
143
+ .dap-modal-body h5,
144
+ .dap-modal-body h6 {
145
+ margin: 0 0 16px 0 !important;
146
+ color: #1f2937 !important;
147
+ font-weight: 700 !important;
148
+ }
149
+
150
+ .dap-modal-body h1 { font-size: 24px !important; }
151
+ .dap-modal-body h2 { font-size: 20px !important; }
152
+ .dap-modal-body h3 { font-size: 18px !important; }
153
+ .dap-modal-body h4 { font-size: 16px !important; }
154
+
155
+ .dap-modal-body p {
156
+ margin: 0 0 16px 0 !important;
157
+ line-height: 1.7 !important;
158
+ }
159
+
160
+ .dap-modal-body ul,
161
+ .dap-modal-body ol {
162
+ margin: 0 0 16px 0 !important;
163
+ padding-left: 24px !important;
164
+ }
165
+
166
+ .dap-modal-body li {
167
+ margin-bottom: 8px !important;
168
+ }
169
+
170
+ .dap-modal-footer {
171
+ border-top: 1px solid #e5e7eb !important;
172
+ padding: 20px 24px !important;
173
+ background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%) !important;
174
+ min-height: 60px !important;
175
+ display: flex !important;
176
+ align-items: center !important;
177
+ justify-content: space-between !important;
178
+ gap: 16px !important;
179
+ box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04) !important;
180
+ flex-shrink: 0 !important;
181
+ border-radius: 0 0 12px 12px !important;
182
+ }
183
+
184
+ .dap-modal-footer .dap-modal-buttons {
185
+ margin-top: 0 !important;
186
+ margin-left: auto !important;
187
+ }
188
+
189
+ .dap-modal-footer-content {
190
+ flex: 1 !important;
191
+ color: #6b7280 !important;
192
+ font-size: 13px !important;
193
+ line-height: 1.5 !important;
194
+ }
195
+
196
+ .dap-content-text {
197
+ color: #1e293b !important;
198
+ line-height: 1.6 !important;
199
+ }
200
+
201
+ .dap-content-video video {
202
+ width: 100% !important;
203
+ height: auto !important;
204
+ }
205
+
206
+ .dap-content-image img {
207
+ max-width: 100% !important;
208
+ height: auto !important;
209
+ }
210
+
211
+ /* Modal Button Styles with DAP Design Tokens */
212
+ .dap-modal-button {
213
+ display: inline-flex !important;
214
+ align-items: center !important;
215
+ justify-content: center !important;
216
+ gap: 8px !important;
217
+ padding: 12px 24px !important;
218
+ border-radius: 8px !important;
219
+ font-size: 14px !important;
220
+ font-weight: 600 !important;
221
+ text-decoration: none !important;
222
+ cursor: pointer !important;
223
+ transition: all 0.2s ease !important;
224
+ border: 2px solid transparent !important;
225
+ min-width: 120px !important;
226
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
227
+ }
228
+
229
+ .dap-modal-button.primary {
230
+ background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
231
+ color: white !important;
232
+ box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
233
+ }
234
+
235
+ .dap-modal-button.primary:hover {
236
+ background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
237
+ transform: translateY(-1px) !important;
238
+ box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4) !important;
239
+ }
240
+
241
+ .dap-modal-button.secondary {
242
+ background: white !important;
243
+ color: #374151 !important;
244
+ border-color: #d1d5db !important;
245
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
246
+ }
247
+
248
+ .dap-modal-button.secondary:hover {
249
+ background: #f9fafb !important;
250
+ border-color: #9ca3af !important;
251
+ transform: translateY(-1px) !important;
252
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
253
+ }
254
+
255
+ .dap-modal-button.outline {
256
+ background: transparent !important;
257
+ color: #3b82f6 !important;
258
+ border-color: #3b82f6 !important;
259
+ }
260
+
261
+ .dap-modal-button.outline:hover {
262
+ background: #eff6ff !important;
263
+ border-color: #2563eb !important;
264
+ color: #2563eb !important;
265
+ }
266
+
267
+ .dap-modal-buttons {
268
+ display: flex !important;
269
+ gap: 12px !important;
270
+ margin-top: 20px !important;
271
+ flex-wrap: wrap !important;
272
+ justify-content: flex-start !important;
273
+ }
274
+
275
+ /* Knowledge Base specific styling */
276
+ .dap-kb-item-button {
277
+ width: 100% !important;
278
+ text-align: left !important;
279
+ justify-content: flex-start !important;
280
+ margin-bottom: 12px !important;
281
+ position: relative !important;
282
+ }
283
+
284
+ .dap-kb-icon {
285
+ margin-right: 12px !important;
286
+ font-size: 16px !important;
287
+ opacity: 0.8 !important;
288
+ }
289
+
290
+ .dap-document-actions {
291
+ margin-top: 24px !important;
292
+ padding-top: 20px !important;
293
+ border-top: 1px solid #e5e7eb !important;
294
+ }
295
+
296
+ /* Article Content Styling */
297
+ .dap-kb-article-viewer {
298
+ max-width: 100% !important;
299
+ }
300
+
301
+ .dap-article-title {
302
+ margin: 0 0 12px 0 !important;
303
+ font-size: 20px !important;
304
+ font-weight: 700 !important;
305
+ color: #1f2937 !important;
306
+ border-bottom: 2px solid #3b82f6 !important;
307
+ padding-bottom: 8px !important;
308
+ }
309
+
310
+ .dap-article-description {
311
+ margin: 0 0 20px 0 !important;
312
+ color: #6b7280 !important;
313
+ font-size: 14px !important;
314
+ line-height: 1.5 !important;
315
+ }
316
+
317
+ .dap-article-loading {
318
+ text-align: center !important;
319
+ padding: 40px 20px !important;
320
+ color: #6b7280 !important;
321
+ }
322
+
323
+ .dap-loading-spinner {
324
+ width: 32px !important;
325
+ height: 32px !important;
326
+ border: 3px solid #e5e7eb !important;
327
+ border-top: 3px solid #3b82f6 !important;
328
+ border-radius: 50% !important;
329
+ margin: 0 auto 16px !important;
330
+ animation: spin 1s linear infinite !important;
331
+ }
332
+
333
+ @keyframes spin {
334
+ 0% { transform: rotate(0deg); }
335
+ 100% { transform: rotate(360deg); }
336
+ }
337
+
338
+ /* PDF and Document Viewers */
339
+ .dap-pdf-viewer-container,
340
+ .dap-document-viewer-container,
341
+ .dap-presentation-viewer-container {
342
+ margin-top: 20px !important;
343
+ }
344
+
345
+ .dap-pdf-iframe,
346
+ .dap-web-iframe {
347
+ width: 100% !important;
348
+ height: 500px !important;
349
+ border: 1px solid #e5e7eb !important;
350
+ border-radius: 8px !important;
351
+ }
352
+
353
+ .dap-kb-pdf-fallback {
354
+ text-align: center !important;
355
+ padding: 40px 20px !important;
356
+ background: #f9fafb !important;
357
+ border: 1px solid #e5e7eb !important;
358
+ border-radius: 8px !important;
359
+ margin-top: 16px !important;
360
+ }
361
+
362
+ /* Enhanced Fallback Viewer */
363
+ .dap-enhanced-fallback-viewer {
364
+ text-align: center !important;
365
+ padding: 40px 20px !important;
366
+ background: #f9fafb !important;
367
+ border: 1px solid #e5e7eb !important;
368
+ border-radius: 12px !important;
369
+ margin-top: 20px !important;
370
+ }
371
+
372
+ .dap-fallback-icon {
373
+ font-size: 48px !important;
374
+ margin-bottom: 16px !important;
375
+ }
376
+
377
+ .dap-enhanced-fallback-message h4 {
378
+ margin: 0 0 12px 0 !important;
379
+ font-size: 18px !important;
380
+ font-weight: 700 !important;
381
+ color: #1f2937 !important;
382
+ }
383
+
384
+ .dap-fallback-primary {
385
+ margin: 0 0 8px 0 !important;
386
+ font-size: 16px !important;
387
+ color: #374151 !important;
388
+ }
389
+
390
+ .dap-fallback-filename,
391
+ .dap-fallback-type {
392
+ margin: 4px 0 !important;
393
+ font-size: 14px !important;
394
+ color: #6b7280 !important;
395
+ }
396
+
397
+ .dap-fallback-no-url {
398
+ margin: 16px 0 0 0 !important;
399
+ font-size: 14px !important;
400
+ color: #9ca3af !important;
401
+ font-style: italic !important;
402
+ }
403
+
404
+ /* Enhanced Document Actions */
405
+ .dap-enhanced-document-actions {
406
+ margin-top: 24px !important;
407
+ display: flex !important;
408
+ gap: 12px !important;
409
+ justify-content: center !important;
410
+ flex-wrap: wrap !important;
411
+ }
412
+
413
+ .dap-primary-btn {
414
+ background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
415
+ color: white !important;
416
+ }
417
+
418
+ .dap-secondary-btn {
419
+ background: white !important;
420
+ color: #374151 !important;
421
+ border: 2px solid #d1d5db !important;
422
+ }
423
+
424
+ .dap-btn-icon {
425
+ margin-right: 8px !important;
426
+ }
427
+
428
+ .dap-btn-text {
429
+ font-weight: 600 !important;
430
+ }
431
+
432
+ /* KB Item Detail Viewer */
433
+ .dap-kb-viewer-header {
434
+ margin-bottom: 20px !important;
435
+ padding-bottom: 16px !important;
436
+ border-bottom: 1px solid #e5e7eb !important;
437
+ }
438
+
439
+ .dap-kb-item-title {
440
+ margin: 12px 0 0 0 !important;
441
+ font-size: 18px !important;
442
+ font-weight: 600 !important;
443
+ color: #1f2937 !important;
444
+ }
445
+
446
+ .dap-file-metadata {
447
+ margin: 8px 0 0 0 !important;
448
+ font-size: 14px !important;
449
+ color: #6b7280 !important;
450
+ }
451
+
452
+ /* File Type Badges */
453
+ .dap-file-type-badge {
454
+ display: inline-flex !important;
455
+ align-items: center !important;
456
+ gap: 6px !important;
457
+ padding: 4px 12px !important;
458
+ background: #eff6ff !important;
459
+ color: #2563eb !important;
460
+ font-size: 12px !important;
461
+ font-weight: 600 !important;
462
+ border-radius: 20px !important;
463
+ margin-bottom: 12px !important;
464
+ }
465
+
466
+ .dap-file-type-badge.video {
467
+ background: #fef3c7 !important;
468
+ color: #92400e !important;
469
+ }
470
+
471
+ .dap-file-type-badge.image {
472
+ background: #d1fae5 !important;
473
+ color: #065f46 !important;
474
+ }
475
+
476
+ .dap-file-type-badge.article {
477
+ background: #e0e7ff !important;
478
+ color: #3730a3 !important;
479
+ }
480
+
481
+ @media (max-width: 768px) {
482
+ .dap-modal {
483
+ width: 95vw !important;
484
+ max-width: 95vw !important;
485
+ margin: 10px !important;
486
+ max-height: 85vh !important;
487
+ }
488
+
489
+ .dap-modal-header {
490
+ padding: 16px 20px !important;
491
+ }
492
+
493
+ .dap-modal-title {
494
+ font-size: 18px !important;
495
+ }
496
+
497
+ .dap-modal-body {
498
+ padding: 20px !important;
499
+ }
500
+
501
+ .dap-modal-footer {
502
+ padding: 16px 20px !important;
503
+ flex-direction: column !important;
504
+ align-items: stretch !important;
505
+ }
506
+
507
+ .dap-modal-footer .dap-modal-buttons {
508
+ margin-left: 0 !important;
509
+ justify-content: stretch !important;
510
+ flex-direction: column !important;
511
+ }
512
+
513
+ .dap-modal-button {
514
+ width: 100% !important;
515
+ min-width: auto !important;
516
+ }
517
+ }
518
+
519
+ /* Modal Animations */
520
+ @keyframes dap-modal-fade-in {
521
+ from {
522
+ opacity: 0;
523
+ }
524
+ to {
525
+ opacity: 1;
526
+ }
527
+ }
528
+
529
+ @keyframes dap-modal-slide-up {
530
+ from {
531
+ opacity: 0;
532
+ transform: translateY(20px) scale(0.95);
533
+ }
534
+ to {
535
+ opacity: 1;
536
+ transform: translateY(0) scale(1);
537
+ }
538
+ }
539
+
540
+ /* Accessibility and reduced motion */
541
+ @media (prefers-reduced-motion: reduce) {
542
+ .dap-modal-overlay,
543
+ .dap-modal {
544
+ animation: none !important;
545
+ }
546
+
547
+ .dap-modal-button,
548
+ .dap-modal-close {
549
+ transition: none !important;
550
+ transform: none !important;
551
+ }
552
+ }
553
+
554
+ /* Focus styles for accessibility */
555
+ .dap-modal:focus-visible {
556
+ outline: 3px solid #3b82f6 !important;
557
+ outline-offset: -3px !important;
558
+ }
559
+
560
+ .dap-modal-button:focus-visible {
561
+ outline: 2px solid #3b82f6 !important;
562
+ outline-offset: 2px !important;
563
+ }
564
+ `;