@shiva004/surveys 0.1.6 → 0.1.8
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/dist/App.d.ts +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +552 -0
- package/dist/journey/JourneyApp.d.ts +2 -0
- package/dist/journey/analytics.d.ts +29 -0
- package/dist/main.d.ts +1 -0
- package/dist/survey/SurveyApp.d.ts +2 -0
- package/dist/survey/data.d.ts +3 -0
- package/dist/survey/nps.d.ts +12 -0
- package/dist/types.d.ts +40 -0
- package/dist/ui.d.ts +26 -0
- package/package.json +18 -5
- package/dist/assets/index-BPe2owrS.js +0 -40
- package/dist/index.html +0 -13
- /package/dist/{assets/index-Chkvn1aI.css → style.css} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JourneyMap } from '../types';
|
|
2
|
+
export declare const PAGES: string[];
|
|
3
|
+
/** Simulated sessions: each session is the ordered list of pages one visitor saw. */
|
|
4
|
+
export declare function simulate(count: number, rand: () => number): string[][];
|
|
5
|
+
export declare const initialSessions: () => string[][];
|
|
6
|
+
export interface NavRow {
|
|
7
|
+
page: string;
|
|
8
|
+
views: number;
|
|
9
|
+
bounceRate: number;
|
|
10
|
+
exitRate: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function navigationStats(sessions: string[][]): NavRow[];
|
|
13
|
+
export interface PathRow {
|
|
14
|
+
steps: string[];
|
|
15
|
+
users: number;
|
|
16
|
+
convRate: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function pathStats(sessions: string[][], top?: number): PathRow[];
|
|
19
|
+
export interface FlowRow {
|
|
20
|
+
from: string;
|
|
21
|
+
total: number;
|
|
22
|
+
destinations: {
|
|
23
|
+
to: string;
|
|
24
|
+
pct: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export declare function flowStats(sessions: string[][]): FlowRow[];
|
|
28
|
+
export declare const stageReach: (sessions: string[][], pages: string[]) => number;
|
|
29
|
+
export declare const defaultMap: JourneyMap;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Survey, SurveyResponse } from '../types';
|
|
2
|
+
export type NpsCategory = 'promoter' | 'passive' | 'detractor';
|
|
3
|
+
export declare const npsCategory: (s: number) => NpsCategory;
|
|
4
|
+
/** NPS = % promoters (9-10) minus % detractors (0-6). Passives (7-8) only count in the total. */
|
|
5
|
+
export declare function npsOf(scores: number[]): {
|
|
6
|
+
score: number;
|
|
7
|
+
promoters: number;
|
|
8
|
+
passives: number;
|
|
9
|
+
detractors: number;
|
|
10
|
+
total: number;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function npsScores(survey: Survey, responses: SurveyResponse[]): number[];
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type QType = 'nps' | 'rating' | 'multiple_choice' | 'open_text';
|
|
2
|
+
export type SurveyStatus = 'draft' | 'active' | 'paused' | 'closed';
|
|
3
|
+
export interface Question {
|
|
4
|
+
id: string;
|
|
5
|
+
type: QType;
|
|
6
|
+
text: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
options?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface Survey {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
status: SurveyStatus;
|
|
15
|
+
target: number;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
questions: Question[];
|
|
18
|
+
}
|
|
19
|
+
export interface Answer {
|
|
20
|
+
questionId: string;
|
|
21
|
+
value: string | number;
|
|
22
|
+
}
|
|
23
|
+
export interface SurveyResponse {
|
|
24
|
+
id: string;
|
|
25
|
+
surveyId: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
answers: Answer[];
|
|
29
|
+
}
|
|
30
|
+
export interface Stage {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
emotion: string;
|
|
34
|
+
pages: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface JourneyMap {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
stages: Stage[];
|
|
40
|
+
}
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const Stat: React.FC<{
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const Tabs: React.FC<{
|
|
8
|
+
items: {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (id: string) => void;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const Bar: React.FC<{
|
|
16
|
+
pct: number;
|
|
17
|
+
color?: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const Page: React.FC<{
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle?: string;
|
|
22
|
+
actions?: React.ReactNode;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const rng: (seed: number) => () => number;
|
|
26
|
+
export declare const uid: (p: string) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiva004/surveys",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./style.css": "./dist/style.css"
|
|
15
|
+
},
|
|
5
16
|
"files": [
|
|
6
17
|
"dist"
|
|
7
18
|
],
|
|
@@ -10,15 +21,17 @@
|
|
|
10
21
|
"build": "tsc --noEmit && vite build",
|
|
11
22
|
"preview": "vite preview"
|
|
12
23
|
},
|
|
13
|
-
"
|
|
14
|
-
"react": "^18.
|
|
15
|
-
"react-dom": "^18.
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^18.0.0",
|
|
26
|
+
"react-dom": "^18.0.0"
|
|
16
27
|
},
|
|
17
28
|
"devDependencies": {
|
|
29
|
+
"@types/node": "^26.6.6",
|
|
18
30
|
"@types/react": "^18.3.3",
|
|
19
31
|
"@types/react-dom": "^18.3.0",
|
|
20
32
|
"@vitejs/plugin-react": "^4.3.1",
|
|
21
33
|
"typescript": "^5.5.4",
|
|
22
|
-
"vite": "^5.4.2"
|
|
34
|
+
"vite": "^5.4.2",
|
|
35
|
+
"vite-plugin-dts": "^5.1.2"
|
|
23
36
|
}
|
|
24
37
|
}
|