@shiva004/surveys 0.4.0 → 0.5.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Survey + User Journey POC
1
+ # Logs + Feedback POC
2
2
 
3
- A standalone proof of concept for the Survey and User Journey modules. No backend, no auth: all data is mock and lives in memory, so a page reload resets it.
3
+ Standalone proof of concept with two modules: a **Log Viewer** (with a guided tour) and a **Feedback** popup (4-step star-rating survey preview). All data is mock and lives in memory.
4
4
 
5
5
  ## Use as a package
6
6
 
@@ -9,82 +9,34 @@ npm install @shiva004/surveys
9
9
  ```
10
10
 
11
11
  ```tsx
12
- import { SurveyApp, JourneyApp, npsOf } from '@shiva004/surveys';
12
+ import { LogsApp, FeedbackApp } from '@shiva004/surveys';
13
13
  import '@shiva004/surveys/style.css';
14
14
 
15
15
  export default function Page() {
16
- return <SurveyApp />;
16
+ return <LogsApp />; // or <FeedbackApp />
17
17
  }
18
18
  ```
19
19
 
20
- ### Walkthrough tour + analytics (new in 0.4.0)
20
+ `LogsApp` accepts `autoStart` (default `true`) to open the tutorial once on first load.
21
+ `LogsFeedbackApp` renders both modules behind tabs.
21
22
 
22
- Replaces `UserJourneyDocs`. A React port of the Sonnaga walkthrough: spotlight tour, passive tracking (time, scroll depth, clicks, navigation, heatmap) and an optional event endpoint.
23
+ ### Walkthrough tour + analytics
23
24
 
24
25
  ```tsx
25
26
  import { JourneyProvider, useJourney, WalkthroughDemo } from '@shiva004/surveys';
26
- import '@shiva004/surveys/style.css';
27
-
28
- // Full sample site with tour and Insights panel
29
- <WalkthroughDemo />
30
-
31
- // Or wrap your own app
32
- <JourneyProvider config={{ endpoint: '/api/journey/events', welcome: { title: 'Welcome', body: 'Quick tour?' } }}>
33
- <App />
34
- </JourneyProvider>
35
- // inside: const { start, setTheme, toggleHeat } = useJourney();
36
27
  ```
37
28
 
38
- Steps come from `config.steps`, else `data-sj-*` attributes, else the page's header, nav, sections and footer. `useJourneyStats()` returns live metrics. Needs `react` and `react-dom` 18+.
39
-
40
- Requires React 18 or newer. Also exported: `SurveyJourneyApp` (both modules with tabs), the NPS helpers, the journey analytics functions and all types.
29
+ Unchanged from 0.4.0. Needs `react` and `react-dom` 18+.
41
30
 
42
31
  ## Run the demo
43
32
 
44
33
  ```bash
45
34
  npm install
46
35
  npm run dev # http://localhost:5173
47
- npm run build # type-check + production build
48
- ```
49
-
50
- ## What it proves
51
-
52
- **Survey**
53
- - Create a survey with a question builder (nps, rating, multiple choice, open text) and validation
54
- - Change status (draft / active / paused / closed); only active surveys accept answers
55
- - Take a survey; each submission becomes a response
56
- - Results page: NPS (promoters 9-10 minus detractors 0-6), category split, responses table
57
- - Delete a survey and its responses
58
-
59
- **User Journey**
60
- - A simulated page-view session stream (400 seeded sessions, "+ Simulate 50 sessions" adds more)
61
- - Navigation Analysis: views, share, bounce rate, exit rate per page
62
- - Paths: top 8 sequences (first 4 steps) with share reaching /signup
63
- - Userflows: where users go next from each page, as a percentage
64
- - Journey Maps: build stages with emotion and touchpoint pages; each stage's reach is computed from the same sessions
65
-
66
- The point of the Journey half: one event stream feeds all four views, so adding more traffic updates every tab.
67
-
68
- ## Layout
69
-
70
- ```
71
- src/
72
- types.ts shared types (mirror survey.types.ts / journeys.types.ts)
73
- ui.tsx Stat, Tabs, Bar, Page + seeded rng
74
- survey/
75
- nps.ts NPS maths (pure functions)
76
- data.ts seed surveys and responses
77
- SurveyApp.tsx list, create, take, results
78
- journey/
79
- analytics.ts simulator + navigation / path / flow / reach calculations
80
- JourneyApp.tsx four views + map builder
36
+ npm run build # production build + type declarations
81
37
  ```
82
38
 
83
- ## From POC to the real modules
39
+ ## What changed in 0.5.0
84
40
 
85
- | POC | Real module |
86
- | --- | --- |
87
- | `survey/nps.ts`, `journey/analytics.ts` | Move to the backend (or a shared util); the real UI only renders summaries |
88
- | In-memory state | `surveysApi` / `journeysApi` with react-query |
89
- | Plain tables and cards | shared `DataTable`, `Header`, `StatCard`, `Card` |
90
- | Simulated sessions | Real page-view events from tracking |
41
+ - Removed: Survey and User Journey modules (`SurveyApp`, `JourneyApp`, `SurveyJourneyApp`, NPS helpers, journey analytics, types, `UserJourneyDocs`).
42
+ - Added: `LogsApp`, `FeedbackApp`, `LogsFeedbackApp`.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './feedback.css';
3
+ export declare const FeedbackApp: React.FC;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import './styles.css';
2
- export { App as SurveyJourneyApp } from './App';
3
- export { SurveyApp } from './survey/SurveyApp';
4
- export { JourneyApp } from './journey/JourneyApp';
2
+ export { App as LogsFeedbackApp } from './App';
3
+ export { LogsApp } from './logs/LogsApp';
4
+ export { FeedbackApp } from './feedback/FeedbackApp';
5
5
  export * from './walkthrough';
6
- export { npsOf, npsCategory, npsScores } from './survey/nps';
7
- export type { NpsCategory } from './survey/nps';
8
- export { simulate, navigationStats, pathStats, flowStats, stageReach } from './journey/analytics';
9
- export type { NavRow, PathRow, FlowRow } from './journey/analytics';
10
- export type { Survey, Question, QType, SurveyStatus, Answer, SurveyResponse, Stage, JourneyMap } from './types';