@prosdevlab/experience-sdk-plugins 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.
package/src/types.ts ADDED
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Shared types for Experience SDK plugins
3
+ * These types are re-exported by core for user convenience
4
+ */
5
+
6
+ /**
7
+ * Experience content - varies by type
8
+ */
9
+ export type ExperienceContent = BannerContent | ModalContent | TooltipContent;
10
+
11
+ /**
12
+ * Banner content configuration
13
+ */
14
+ export interface BannerContent {
15
+ title?: string;
16
+ message: string;
17
+ buttons?: Array<{
18
+ text: string;
19
+ action?: string;
20
+ url?: string;
21
+ variant?: 'primary' | 'secondary' | 'link';
22
+ metadata?: Record<string, any>;
23
+ }>;
24
+ dismissable?: boolean;
25
+ position?: 'top' | 'bottom';
26
+ }
27
+
28
+ /**
29
+ * Modal content configuration
30
+ */
31
+ export interface ModalContent {
32
+ title: string;
33
+ message: string;
34
+ confirmText?: string;
35
+ cancelText?: string;
36
+ }
37
+
38
+ /**
39
+ * Tooltip content configuration
40
+ */
41
+ export interface TooltipContent {
42
+ message: string;
43
+ position?: 'top' | 'bottom' | 'left' | 'right';
44
+ }
45
+
46
+ /**
47
+ * Experience definition
48
+ */
49
+ export interface Experience {
50
+ id: string;
51
+ type: 'banner' | 'modal' | 'tooltip';
52
+ targeting: Record<string, any>;
53
+ content: ExperienceContent;
54
+ frequency?: {
55
+ max: number;
56
+ per: 'session' | 'day' | 'week';
57
+ };
58
+ priority?: number;
59
+ }
60
+
61
+ /**
62
+ * Decision output from evaluation
63
+ */
64
+ export interface Decision {
65
+ show: boolean;
66
+ experienceId?: string;
67
+ reasons: string[];
68
+ trace: TraceStep[];
69
+ context: Record<string, any>;
70
+ metadata: DecisionMetadata;
71
+ }
72
+
73
+ /**
74
+ * Trace step for decision path
75
+ */
76
+ export interface TraceStep {
77
+ step: string;
78
+ timestamp: number;
79
+ duration: number;
80
+ input?: any;
81
+ output?: any;
82
+ passed: boolean;
83
+ }
84
+
85
+ /**
86
+ * Decision metadata
87
+ */
88
+ export interface DecisionMetadata {
89
+ evaluatedAt: number;
90
+ experienceCount: number;
91
+ evaluationTimeMs: number;
92
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
9
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ dts: true,
7
+ splitting: false,
8
+ sourcemap: true,
9
+ clean: true,
10
+ treeshake: true,
11
+ minify: false,
12
+ outDir: 'dist',
13
+ skipNodeModulesBundle: true,
14
+ });