@explorer02/cfm-survey-sdk 0.1.3 → 0.1.5
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/package.json +1 -1
- package/postinstall.js +30 -18
- package/templates/AGENT.md +10 -1906
- package/templates/docs/01-sdk-core/01-fetch-survey.md +68 -0
- package/templates/docs/01-sdk-core/02-survey-mapper.md +85 -0
- package/templates/docs/01-sdk-core/03-question-mappers.md +114 -0
- package/templates/docs/01-sdk-core/04-pagination.md +72 -0
- package/templates/docs/01-sdk-core/05-validation.md +66 -0
- package/templates/docs/01-sdk-core/06-submit-survey.md +90 -0
- package/templates/docs/01-sdk-core/07-language-handling.md +111 -0
- package/templates/docs/01-sdk-core/08-icons-and-emojis.md +88 -0
- package/templates/docs/01-sdk-core/README.md +53 -0
- package/templates/docs/02-question-types/01-rating.md +52 -0
- package/templates/docs/02-question-types/02-radio.md +26 -0
- package/templates/docs/02-question-types/03-text.md +26 -0
- package/templates/docs/02-question-types/04-csat.md +54 -0
- package/templates/docs/02-question-types/05-rating-scale.md +26 -0
- package/templates/docs/02-question-types/06-slider.md +30 -0
- package/templates/docs/02-question-types/07-matrix-cfm.md +43 -0
- package/templates/docs/02-question-types/08-matrix-csat.md +29 -0
- package/templates/docs/02-question-types/09-matrix-rating.md +28 -0
- package/templates/docs/02-question-types/10-slider-matrix.md +40 -0
- package/templates/docs/02-question-types/11-file-upload.md +34 -0
- package/templates/docs/02-question-types/12-text-and-media.md +35 -0
- package/templates/docs/02-question-types/README.md +74 -0
- package/templates/docs/03-client-components/01-survey-page.md +113 -0
- package/templates/docs/03-client-components/02-question.md +57 -0
- package/templates/docs/03-client-components/03-rating-scale.md +38 -0
- package/templates/docs/03-client-components/04-csat-scale.md +40 -0
- package/templates/docs/03-client-components/05-csat-matrix-scale.md +43 -0
- package/templates/docs/03-client-components/06-likert-matrix-scale.md +38 -0
- package/templates/docs/03-client-components/07-slider-matrix-scale.md +44 -0
- package/templates/docs/03-client-components/08-file-upload-scale.md +33 -0
- package/templates/docs/03-client-components/09-custom-slider-track.md +27 -0
- package/templates/docs/03-client-components/10-header-footer.md +46 -0
- package/templates/docs/03-client-components/11-progress-bar.md +31 -0
- package/templates/docs/03-client-components/12-language-selector.md +41 -0
- package/templates/docs/03-client-components/13-matrix-dropdown.md +42 -0
- package/templates/docs/03-client-components/README.md +63 -0
- package/templates/docs/04-critical-rules/01-import-rules.md +51 -0
- package/templates/docs/04-critical-rules/02-action-dispatching.md +56 -0
- package/templates/docs/04-critical-rules/03-scroll-navigation.md +37 -0
- package/templates/docs/04-critical-rules/04-logo-branding.md +42 -0
- package/templates/docs/04-critical-rules/05-troubleshooting.md +46 -0
- package/templates/docs/04-critical-rules/README.md +29 -0
- package/templates/docs/index.md +129 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Import Rules & Setup
|
|
2
|
+
|
|
3
|
+
> Non-negotiable constraints for setting up Next.js with `@explorer02/cfm-survey-sdk`.
|
|
4
|
+
|
|
5
|
+
## 1. Top-Level Imports ONLY
|
|
6
|
+
|
|
7
|
+
You must import from the root package name.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// ✅ REQUIRED
|
|
11
|
+
import { useSurveySDK, getEmojiForIndex } from '@explorer02/cfm-survey-sdk';
|
|
12
|
+
|
|
13
|
+
// ❌ FORBIDDEN (Will fail Next.js build)
|
|
14
|
+
import { useSurveySDK } from '@explorer02/cfm-survey-sdk/src/fetchSurvey/useFetchSurvey';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 2. Peer Dependencies
|
|
18
|
+
|
|
19
|
+
The SDK requires `@tanstack/react-query` to be installed in the client project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @explorer02/cfm-survey-sdk @tanstack/react-query
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 3. Client Components Only
|
|
26
|
+
|
|
27
|
+
Because the SDK uses React state, `useQuery`, and DOM interactions, the `SurveyPage` must be a client component.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
'use client';
|
|
31
|
+
|
|
32
|
+
import { useSurveySDK } from '@explorer02/cfm-survey-sdk';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 4. Next.js Configuration
|
|
36
|
+
|
|
37
|
+
**CRITICAL**: You must configure `next.config.js` to transpile the SDK, because the SDK exports modern ES modules and uses CSS that Next.js needs to process.
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
/** @type {import('next').NextConfig} */
|
|
41
|
+
const nextConfig = {
|
|
42
|
+
transpilePackages: ['@explorer02/cfm-survey-sdk'],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = nextConfig;
|
|
46
|
+
```
|
|
47
|
+
If you forget this, you will get `"SyntaxError: Cannot use import statement outside a module"`.
|
|
48
|
+
|
|
49
|
+
## 5. React 18 / StrictMode
|
|
50
|
+
|
|
51
|
+
Next.js `reactStrictMode: true` causes effects to fire twice in development. The SDK is built to handle this safely (e.g., query caching), but be aware of double-logging if `debug: true` is enabled.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Action Dispatching Rule
|
|
2
|
+
|
|
3
|
+
> The single flow of data mutation in the SDK.
|
|
4
|
+
|
|
5
|
+
## The Rule
|
|
6
|
+
|
|
7
|
+
You must NEVER try to update the `state` object directly. The `state` returned by `useSurveySDK` is deeply immutable.
|
|
8
|
+
|
|
9
|
+
All state mutations (answering a question, navigating pages, submitting) must be done through the `onAction` dispatcher function provided by the hook.
|
|
10
|
+
|
|
11
|
+
## The `onAction` Function
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const { onAction } = useSurveySDK({ ... });
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Action Types
|
|
18
|
+
|
|
19
|
+
#### 1. Answering a Question
|
|
20
|
+
```tsx
|
|
21
|
+
// Standard (number/string)
|
|
22
|
+
onAction({
|
|
23
|
+
type: 'CHANGE',
|
|
24
|
+
payload: { questionId: 'q123', value: 4 }
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Matrix (MatrixAnswerMap)
|
|
28
|
+
onAction({
|
|
29
|
+
type: 'CHANGE',
|
|
30
|
+
payload: { questionId: 'q456', value: { row1: 5, row2: 2 } }
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### 2. Next Page
|
|
35
|
+
```tsx
|
|
36
|
+
// Automatically triggers validation. If on the last page, auto-converts to SUBMIT.
|
|
37
|
+
onAction({ type: 'NEXT' });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### 3. Previous Page
|
|
41
|
+
```tsx
|
|
42
|
+
onAction({ type: 'PREVIOUS' });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### 4. Force Submit
|
|
46
|
+
```tsx
|
|
47
|
+
// Validates ALL pages, then triggers API request.
|
|
48
|
+
onAction({ type: 'SUBMIT' });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Why This Matters
|
|
52
|
+
The `onAction` dispatcher internally handles:
|
|
53
|
+
- Clearing validation errors the moment a user answers
|
|
54
|
+
- Tracking analytics (timestamps, backtrack counts)
|
|
55
|
+
- Preserving scroll position
|
|
56
|
+
- Triggering cross-question logic
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Scroll Navigation Rule
|
|
2
|
+
|
|
3
|
+
> The DOM requirement for validation error scrolling to function.
|
|
4
|
+
|
|
5
|
+
## The Rule
|
|
6
|
+
|
|
7
|
+
When rendering the wrapper for ANY question, the outermost DOM element (usually a `<section>` or `<div>`) **MUST** have its `id` attribute set to `question.id`.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// ✅ REQUIRED
|
|
11
|
+
export default function Question({ question, ... }) {
|
|
12
|
+
return (
|
|
13
|
+
<section id={question.id} className="p-6 bg-white rounded-xl">
|
|
14
|
+
<h2>{question.text}</h2>
|
|
15
|
+
{/* ... */}
|
|
16
|
+
</section>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ❌ FORBIDDEN
|
|
21
|
+
export default function Question({ question, ... }) {
|
|
22
|
+
return (
|
|
23
|
+
<section className="p-6 bg-white rounded-xl">
|
|
24
|
+
<h2 id={question.id}>{question.text}</h2> {/* Wrong element */}
|
|
25
|
+
{/* ... */}
|
|
26
|
+
</section>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Why This Matters
|
|
32
|
+
|
|
33
|
+
When the user clicks "Next" or "Submit", the SDK validates the fields. If it finds a required field is empty, it does two things:
|
|
34
|
+
1. Sets `validationErrors[questionId]`
|
|
35
|
+
2. Calls `document.getElementById(questionId).scrollIntoView()`
|
|
36
|
+
|
|
37
|
+
If the ID is missing from the DOM, the error message will appear, but the page will not scroll to the error, resulting in a broken User Experience (especially on long pages).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Logo and Branding Rule
|
|
2
|
+
|
|
3
|
+
> How to handle logos and branding without breaking the build or deployment.
|
|
4
|
+
|
|
5
|
+
## The Rule
|
|
6
|
+
|
|
7
|
+
You must **NEVER** use `<img>` tags pointing to external URLs (e.g., Telekom or Sprinklr servers) for the main brand logo.
|
|
8
|
+
|
|
9
|
+
You must **NEVER** attempt to download image files, save them to the `public/` folder, and reference them.
|
|
10
|
+
|
|
11
|
+
You MUST construct the logo purely using **Tailwind CSS**.
|
|
12
|
+
|
|
13
|
+
## Example: Telekom "T" Logo (Abstracted)
|
|
14
|
+
|
|
15
|
+
Instead of finding the exact Telekom logo, build a clean, recognizable abstract representation using geometric divs:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
{/* Abstract Magenta "T" equivalent */}
|
|
19
|
+
<div className="flex items-center gap-2">
|
|
20
|
+
<div className="flex h-8 w-8 items-center justify-center rounded-sm bg-[#e20074]">
|
|
21
|
+
<div className="flex flex-col items-center">
|
|
22
|
+
<div className="h-1 w-4 bg-white" />
|
|
23
|
+
<div className="h-3 w-1 bg-white" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<span className="font-bold text-gray-900 tracking-tight">Telekom</span>
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example: Generic Circular Logo
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<div className="flex items-center gap-3">
|
|
34
|
+
<div className="h-8 w-8 rounded-full bg-gradient-to-tr from-blue-600 to-indigo-500" />
|
|
35
|
+
<span className="text-xl font-bold tracking-tight text-gray-900">BrandName</span>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Why This Matters
|
|
40
|
+
1. **Broken Links**: External image URLs often change, expire, or return 403 Forbidden when accessed from a Vercel deployment domain.
|
|
41
|
+
2. **File System Issues**: Downloading assets to `public/` during an automated AI build process often fails due to permissions, path resolution, or missing dependencies.
|
|
42
|
+
3. **Performance**: CSS-only logos render instantly and scale perfectly without network requests.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Troubleshooting & Common Errors
|
|
2
|
+
|
|
3
|
+
> Solutions for common issues encountered while building with the SDK.
|
|
4
|
+
|
|
5
|
+
## 1. "Cannot use import statement outside a module"
|
|
6
|
+
**Symptom**: Next.js build fails immediately on start.
|
|
7
|
+
**Cause**: Next.js is not transpiling the SDK package.
|
|
8
|
+
**Fix**: Add the package to `transpilePackages` in `next.config.js`:
|
|
9
|
+
```javascript
|
|
10
|
+
const nextConfig = {
|
|
11
|
+
transpilePackages: ['@explorer02/cfm-survey-sdk'],
|
|
12
|
+
};
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 2. Infinite Re-renders / Re-fetching
|
|
16
|
+
**Symptom**: The browser freezes or the network tab shows hundreds of API requests to the survey endpoint.
|
|
17
|
+
**Cause**: Passing a new object reference to `options.placeholders` on every render.
|
|
18
|
+
**Fix**: Extract the placeholders object outside the component:
|
|
19
|
+
```tsx
|
|
20
|
+
// OUTSIDE the component
|
|
21
|
+
const SURVEY_PLACEHOLDERS = { FIRST_NAME: 'John' };
|
|
22
|
+
|
|
23
|
+
export default function SurveyPage() {
|
|
24
|
+
const { ... } = useSurveySDK({ options: { placeholders: SURVEY_PLACEHOLDERS } });
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 3. "window is not defined" or "document is not defined"
|
|
29
|
+
**Symptom**: Next.js SSR crashes with DOM errors.
|
|
30
|
+
**Cause**: A component using the SDK is missing the `'use client'` directive. The SDK relies on browser APIs.
|
|
31
|
+
**Fix**: Add `'use client';` to the very top of `SurveyPage.tsx` and any file importing the SDK.
|
|
32
|
+
|
|
33
|
+
## 4. Clicking "Next" shows errors but doesn't scroll
|
|
34
|
+
**Symptom**: Required field validation fails, text appears, but the viewport doesn't move.
|
|
35
|
+
**Cause**: The DOM wrapper for the question is missing the `id` attribute.
|
|
36
|
+
**Fix**: Ensure `<section id={question.id}>` is present on the outermost element of every question card.
|
|
37
|
+
|
|
38
|
+
## 5. Survey renders completely empty
|
|
39
|
+
**Symptom**: `surveyQueryResults.data` is `null`, but there's no error.
|
|
40
|
+
**Cause**: The provided `instanceId` is empty, malformed, or has expired/been deleted on the server.
|
|
41
|
+
**Fix**: Verify the `instanceId` JWT token. Ask the client to provide a fresh one.
|
|
42
|
+
|
|
43
|
+
## 6. Icons/Emojis are missing or look broken
|
|
44
|
+
**Symptom**: CSAT scales show empty boxes instead of faces.
|
|
45
|
+
**Cause**: Missing peer dependencies.
|
|
46
|
+
**Fix**: Ensure `react-icons` is installed in the client project: `npm install react-icons`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Critical Operating Rules
|
|
2
|
+
|
|
3
|
+
> This folder contains the absolute, non-negotiable constraints you MUST follow when building a survey using `@explorer02/cfm-survey-sdk`.
|
|
4
|
+
|
|
5
|
+
## Files in This Folder
|
|
6
|
+
|
|
7
|
+
| File | Topic | Importance |
|
|
8
|
+
|------|-------|------------|
|
|
9
|
+
| `01-import-rules.md` | Imports and Next.js setup | **CRITICAL** (Build breaks without it) |
|
|
10
|
+
| `02-action-dispatching.md` | `onAction` pattern | **CRITICAL** (State breaks without it) |
|
|
11
|
+
| `03-scroll-navigation.md` | `id={question.id}` rule | **CRITICAL** (Validation UX breaks) |
|
|
12
|
+
| `04-logo-branding.md` | CSS-only logo mandate | **CRITICAL** (Deployment breaks) |
|
|
13
|
+
| `05-troubleshooting.md` | Common errors & fixes | Useful reference |
|
|
14
|
+
|
|
15
|
+
## The Golden Rule
|
|
16
|
+
|
|
17
|
+
**You are building a client application using a pre-compiled npm package.**
|
|
18
|
+
|
|
19
|
+
You are STRICTLY PROHIBITED from trying to modify, monkey-patch, or import internal files from inside `node_modules/@explorer02/cfm-survey-sdk`.
|
|
20
|
+
|
|
21
|
+
Everything you need is exported from the top-level barrel file.
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// ✅ CORRECT
|
|
25
|
+
import { useSurveySDK, type SurveyQuestion } from '@explorer02/cfm-survey-sdk';
|
|
26
|
+
|
|
27
|
+
// ❌ WRONG — Build will fail immediately
|
|
28
|
+
import { mapQuestion } from '@explorer02/cfm-survey-sdk/src/fetchSurvey/utils';
|
|
29
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# CFM SURVEY SDK — AGENT DOCUMENTATION INDEX
|
|
2
|
+
|
|
3
|
+
**@explorer02/cfm-survey-sdk**
|
|
4
|
+
|
|
5
|
+
This file is the MASTER GUIDE for AI coding agents (Cursor, Copilot, etc.).
|
|
6
|
+
It is a structured roadmap that tells the agent exactly which documentation files to read and in what order.
|
|
7
|
+
|
|
8
|
+
## ── HOW THIS DOCUMENTATION SYSTEM WORKS ──────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
The `docs/` folder mirrors the SDK's internal architecture:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
docs/
|
|
14
|
+
├── index.md ← YOU ARE HERE — read this first
|
|
15
|
+
├── 01-sdk-core/ ← SDK internals: fetch, map, paginate, validate, submit
|
|
16
|
+
├── 02-question-types/ ← One doc per question type (12 types)
|
|
17
|
+
├── 03-client-components/ ← One doc per UI component (13 components)
|
|
18
|
+
└── 04-critical-rules/ ← Non-negotiable constraints, imports, troubleshooting
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## ── CLIENT INTERACTION FLOW (3 INPUTS ONLY) ──────────────────────────────────
|
|
22
|
+
|
|
23
|
+
The entire build process requires EXACTLY 3 inputs from the client:
|
|
24
|
+
|
|
25
|
+
**INPUT 1: Client's initial prompt**
|
|
26
|
+
→ "Build a survey like this image using @explorer02/cfm-survey-sdk"
|
|
27
|
+
→ May include UI mockup screenshots, brand colors, or text description
|
|
28
|
+
→ Agent begins project scaffolding and component architecture
|
|
29
|
+
|
|
30
|
+
**INPUT 2: Instance ID (agent asks for it)**
|
|
31
|
+
→ Agent asks: "Please provide your survey instance ID (JWT token)"
|
|
32
|
+
→ Client pastes the instanceId string
|
|
33
|
+
→ Agent wires it into SurveyPage.tsx and fetches the survey
|
|
34
|
+
|
|
35
|
+
**INPUT 3: Deployment confirmation (agent asks at the end)**
|
|
36
|
+
→ Agent asks: "Your survey is built and tested. Ready to deploy to Vercel?"
|
|
37
|
+
→ Client confirms → Agent runs `npx vercel --prod --yes`
|
|
38
|
+
|
|
39
|
+
## ── EXECUTION PIPELINE ───────────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
Follow these phases IN ORDER. Each phase references specific doc files.
|
|
42
|
+
|
|
43
|
+
### PHASE 1: PROJECT SCAFFOLDING
|
|
44
|
+
Read: `04-critical-rules/01-import-rules.md`
|
|
45
|
+
|
|
46
|
+
Actions:
|
|
47
|
+
1. Create Next.js project:
|
|
48
|
+
`npx -y create-next-app@latest ./ --ts --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm`
|
|
49
|
+
2. Install SDK:
|
|
50
|
+
`npm install @explorer02/cfm-survey-sdk @tanstack/react-query`
|
|
51
|
+
3. Configure `next.config.js`:
|
|
52
|
+
`transpilePackages: ["@explorer02/cfm-survey-sdk"]`
|
|
53
|
+
|
|
54
|
+
### PHASE 2: ASK FOR INSTANCE ID (INPUT 2)
|
|
55
|
+
Read: `01-sdk-core/01-fetch-survey.md`
|
|
56
|
+
|
|
57
|
+
Ask the client in chat:
|
|
58
|
+
"Please provide your survey instance ID (the JWT token string) so I can connect your survey."
|
|
59
|
+
|
|
60
|
+
Wait for the client to paste the instanceId. Store it — you will wire it into SurveyPage.tsx in Phase 4.
|
|
61
|
+
|
|
62
|
+
### PHASE 3: UNDERSTAND THE SDK PIPELINE
|
|
63
|
+
Read these docs IN ORDER to understand how the SDK works:
|
|
64
|
+
|
|
65
|
+
1. `01-sdk-core/01-fetch-survey.md` — How survey data is fetched
|
|
66
|
+
2. `01-sdk-core/02-survey-mapper.md` — How raw API → Survey object
|
|
67
|
+
3. `01-sdk-core/03-question-mappers.md` — How questions are typed/mapped
|
|
68
|
+
4. `01-sdk-core/07-language-handling.md` — Translations & placeholders
|
|
69
|
+
5. `01-sdk-core/04-pagination.md` — Page navigation state
|
|
70
|
+
6. `01-sdk-core/05-validation.md` — Required field validation
|
|
71
|
+
7. `01-sdk-core/06-submit-survey.md` — Response submission format
|
|
72
|
+
8. `01-sdk-core/08-icons-and-emojis.md` — CSAT emoji/star icon system
|
|
73
|
+
|
|
74
|
+
Then understand what question types exist:
|
|
75
|
+
9. `02-question-types/README.md` — Overview of all 12 types
|
|
76
|
+
|
|
77
|
+
*You do NOT need to read every question type doc upfront. Read them ON DEMAND when you encounter each type during component building.*
|
|
78
|
+
|
|
79
|
+
### PHASE 4: BUILD THE SURVEY UI
|
|
80
|
+
Read these component docs IN ORDER:
|
|
81
|
+
|
|
82
|
+
1. `03-client-components/README.md` — File structure overview
|
|
83
|
+
2. `03-client-components/01-survey-page.md` — MAIN orchestrator (REQUIRED)
|
|
84
|
+
3. `03-client-components/02-question.md` — Question dispatcher (REQUIRED)
|
|
85
|
+
4. `03-client-components/10-header-footer.md` — CSS-built logo/branding
|
|
86
|
+
5. `03-client-components/11-progress-bar.md` — Progress indicator
|
|
87
|
+
6. `03-client-components/12-language-selector.md` — Language dropdown
|
|
88
|
+
|
|
89
|
+
Then for EACH question type present in the fetched survey, read the matching question-type doc AND component doc:
|
|
90
|
+
|
|
91
|
+
| `question.type` | Question Doc | Component Doc |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| `'rating'` | `02-question-types/01-rating` | `03-components/03-rating` |
|
|
94
|
+
| `'radio'` | `02-question-types/02-radio` | (inline in Question) |
|
|
95
|
+
| `'text'` | `02-question-types/03-text` | (inline in Question) |
|
|
96
|
+
| `'csat'` | `02-question-types/04-csat` | `03-components/04-csat` |
|
|
97
|
+
| `'rating_scale'` | `02-question-types/05-rating-s` | `03-components/03-rating` |
|
|
98
|
+
| `'slider'` | `02-question-types/06-slider` | `03-components/09-slider` |
|
|
99
|
+
| `'matrix'` CFM | `02-question-types/07-matrix-c` | `03-components/06-likert` |
|
|
100
|
+
| `'matrix'` CSAT | `02-question-types/08-matrix-c` | `03-components/05-csat-m` |
|
|
101
|
+
| `'matrix'` RATING| `02-question-types/09-matrix-r` | `03-components/05-csat-m` |
|
|
102
|
+
| `'slider_matrix'`| `02-question-types/10-slider-m` | `03-components/07-slider` |
|
|
103
|
+
| `'file_upload'` | `02-question-types/11-file-up` | `03-components/08-file` |
|
|
104
|
+
| `'text_and_media'`| `02-question-types/12-text-med` | (inline in Question) |
|
|
105
|
+
|
|
106
|
+
Also read these shared component docs:
|
|
107
|
+
- `03-client-components/09-custom-slider-track.md` (used by CSAT matrix, slider matrix when sliderType='graphics')
|
|
108
|
+
- `03-client-components/13-matrix-dropdown.md` (used by matrix dropdown fmt)
|
|
109
|
+
|
|
110
|
+
### PHASE 5: APPLY CRITICAL RULES
|
|
111
|
+
Read ALL files in `04-critical-rules/`:
|
|
112
|
+
1. `01-import-rules.md` — Package imports, 'use client', Suspense
|
|
113
|
+
2. `02-action-dispatching.md` — onAction pattern, placeholder constants
|
|
114
|
+
3. `03-scroll-navigation.md` — id={question.id} requirement
|
|
115
|
+
4. `04-logo-branding.md` — CSS-only logo, no external image needed
|
|
116
|
+
5. `05-troubleshooting.md` — Common build errors and fixes
|
|
117
|
+
|
|
118
|
+
Verify your implementation against every rule before proceeding.
|
|
119
|
+
|
|
120
|
+
### PHASE 6: BUILD VERIFICATION
|
|
121
|
+
1. Run: `npm run build`
|
|
122
|
+
2. If errors → fix automatically → re-run until clean
|
|
123
|
+
3. Run: `npm run dev`
|
|
124
|
+
4. Verify: survey loads, navigation works, validation fires, submit works
|
|
125
|
+
|
|
126
|
+
### PHASE 7: DEPLOYMENT (INPUT 3)
|
|
127
|
+
Ask the client: "Your survey is built and verified. Ready to deploy to Vercel?"
|
|
128
|
+
If yes → run: `npx vercel --prod --yes`
|
|
129
|
+
Report the final deployment URL to the client.
|