myquizbot-react 1.0.0 → 1.0.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 +35 -3
- package/dist/myquizbot-react.es.js +1509 -1214
- package/dist/myquizbot-react.umd.js +7 -7
- package/package.json +5 -1
- package/dist/react.css +0 -1
package/README.md
CHANGED
|
@@ -166,22 +166,54 @@ Or pass custom styles via props:
|
|
|
166
166
|
|
|
167
167
|
## API Configuration
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
The component connects to your MyQuizBot backend API. Configure the base URL:
|
|
170
170
|
|
|
171
171
|
```jsx
|
|
172
172
|
<Quiz
|
|
173
173
|
quizId="my-quiz"
|
|
174
174
|
apiKey="pk_live"
|
|
175
|
-
baseUrl="
|
|
175
|
+
baseUrl="http://localhost:8080"
|
|
176
176
|
/>
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
Or set it via environment variable:
|
|
180
180
|
|
|
181
181
|
```bash
|
|
182
|
-
VITE_API_BASE_URL=
|
|
182
|
+
VITE_API_BASE_URL=http://localhost:8080
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
### Current Backend Integration
|
|
186
|
+
|
|
187
|
+
The library currently uses the following backend endpoints:
|
|
188
|
+
|
|
189
|
+
- `GET /core/quiz` - Fetches all quizzes (requires authentication)
|
|
190
|
+
|
|
191
|
+
The component filters the quiz list client-side to find the requested `quizId`.
|
|
192
|
+
|
|
193
|
+
### Session Management
|
|
194
|
+
|
|
195
|
+
**Note:** Quiz sessions are currently managed client-side using `localStorage`. This means:
|
|
196
|
+
- Session data is stored in the browser
|
|
197
|
+
- Answers are tracked locally
|
|
198
|
+
- No server-side session persistence yet
|
|
199
|
+
|
|
200
|
+
**Recommended Backend Improvements:**
|
|
201
|
+
|
|
202
|
+
For production use, consider adding these endpoints to your backend:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
GET /core/quiz/:id - Fetch specific quiz by ID
|
|
206
|
+
POST /core/quiz/session - Create new quiz session
|
|
207
|
+
POST /core/quiz/session/:id/answer - Submit answer
|
|
208
|
+
POST /core/quiz/session/:id/complete - Complete session
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This will enable:
|
|
212
|
+
- Server-side session tracking
|
|
213
|
+
- Answer persistence
|
|
214
|
+
- Analytics and reporting
|
|
215
|
+
- Multi-device session continuity
|
|
216
|
+
|
|
185
217
|
## TypeScript Support
|
|
186
218
|
|
|
187
219
|
The library is written in TypeScript and includes full type definitions. Import types as needed:
|