@shiva004/surveys 0.1.8 → 0.4.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
@@ -2,7 +2,44 @@
2
2
 
3
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.
4
4
 
5
- ## Run
5
+ ## Use as a package
6
+
7
+ ```bash
8
+ npm install @shiva004/surveys
9
+ ```
10
+
11
+ ```tsx
12
+ import { SurveyApp, JourneyApp, npsOf } from '@shiva004/surveys';
13
+ import '@shiva004/surveys/style.css';
14
+
15
+ export default function Page() {
16
+ return <SurveyApp />;
17
+ }
18
+ ```
19
+
20
+ ### Walkthrough tour + analytics (new in 0.4.0)
21
+
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
+
24
+ ```tsx
25
+ 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
+ ```
37
+
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.
41
+
42
+ ## Run the demo
6
43
 
7
44
  ```bash
8
45
  npm install
package/dist/App.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { default as React } from 'react';
1
+ import React from 'react';
2
2
  export declare const App: React.FC;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
- export { JourneyApp } from './journey/JourneyApp';
1
+ import './styles.css';
2
+ export { App as SurveyJourneyApp } from './App';
2
3
  export { SurveyApp } from './survey/SurveyApp';
3
- export { npsOf, npsCategory, npsScores, } from './survey/nps';
4
+ export { JourneyApp } from './journey/JourneyApp';
5
+ export * from './walkthrough';
6
+ export { npsOf, npsCategory, npsScores } from './survey/nps';
4
7
  export type { NpsCategory } from './survey/nps';
5
- export type * from './types';
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';