@reform-society/agera-survey 0.1.1 → 0.1.3
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 +5 -78
- package/dist/index.global.js +11 -3243
- package/dist/index.global.js.map +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,86 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @reform-society/agera-survey
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Internal runtime for multi-step surveys. Not intended for public use.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
- Attribute-based markup with no framework required
|
|
10
|
-
- Built-in transitions and accessibility defaults
|
|
11
|
-
- Persistent session state via `localStorage`
|
|
12
|
-
- Lazy-loaded phone validation for optimal bundle size
|
|
13
|
-
- Basin integration for form submissions
|
|
14
|
-
- Quiz mode with weighted scoring
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
**Via CDN (recommended):**
|
|
19
|
-
|
|
20
|
-
```html
|
|
21
|
-
<script src="https://cdn.jsdelivr.net/npm/@reform-society/agera-survey@0.1.0"></script>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Via npm:**
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pnpm add @reform-society/agera-survey
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
The script auto-initializes on pages containing `[as-survey]`:
|
|
33
|
-
|
|
34
|
-
```html
|
|
35
|
-
<script src="path/to/agera-survey.js"></script>
|
|
36
|
-
|
|
37
|
-
<div as-survey>
|
|
38
|
-
<section as-step="welcome">
|
|
39
|
-
<h2>Welcome</h2>
|
|
40
|
-
<button as-next>Start</button>
|
|
41
|
-
</section>
|
|
42
|
-
|
|
43
|
-
<section as-step="info">
|
|
44
|
-
<input name="email" as-validate="required|email" />
|
|
45
|
-
<button as-back>Back</button>
|
|
46
|
-
<button as-next>Next</button>
|
|
47
|
-
</section>
|
|
48
|
-
|
|
49
|
-
<section as-step="done">
|
|
50
|
-
<p>Thank you!</p>
|
|
51
|
-
</section>
|
|
52
|
-
</div>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## API
|
|
56
|
-
|
|
57
|
-
Available at `window.agera.survey`:
|
|
58
|
-
|
|
59
|
-
| Method | Description |
|
|
60
|
-
|--------|-------------|
|
|
61
|
-
| `goToStep(id)` | Navigate to a step |
|
|
62
|
-
| `getCurrentStep()` | Get current step ID |
|
|
63
|
-
| `getStepPath()` | Get navigation history |
|
|
64
|
-
| `getAnswers()` | Get all answers |
|
|
65
|
-
| `setAnswer(key, value)` | Set an answer programmatically |
|
|
66
|
-
| `validateCurrentStep()` | Validate current step |
|
|
67
|
-
| `reset()` | Clear session and reload |
|
|
68
|
-
| `triggerPartialSubmit()` | Send partial submission to Basin |
|
|
69
|
-
| `triggerFinalSubmit()` | Send final submission to Basin |
|
|
70
|
-
| `getQuizResults()` | Get quiz scores (if quiz mode) |
|
|
71
|
-
| `getQuizScores()` | Get scores by category |
|
|
72
|
-
| `getQuizWinner()` | Get winning category |
|
|
73
|
-
| `dev` | Enable/disable debug mode |
|
|
74
|
-
| `version` | Runtime version string |
|
|
75
|
-
|
|
76
|
-
## Development
|
|
5
|
+
## Install
|
|
77
6
|
|
|
78
7
|
```bash
|
|
79
|
-
|
|
80
|
-
pnpm build # Production build
|
|
81
|
-
pnpm check # Lint + typecheck
|
|
8
|
+
npm install @reform-society/agera-survey
|
|
82
9
|
```
|
|
83
10
|
|
|
84
11
|
## License
|
|
85
12
|
|
|
86
|
-
Proprietary - Reform Society
|
|
13
|
+
Proprietary - Reform Society
|