spaps-mcp 0.1.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/CHANGELOG.md +7 -0
- package/README.md +76 -0
- package/dist/chunk-GPBTYWDD.js +496 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +9 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +26 -0
- package/dist/resources/SPAPS_SURFACE_CONTRACT.md +125 -0
- package/dist/resources/glossary.md +36 -0
- package/dist/resources/llms.txt +15 -0
- package/dist/wizard/step-01-setup.md +149 -0
- package/dist/wizard/step-02-environment.md +291 -0
- package/dist/wizard/step-03-sdk-init.md +351 -0
- package/dist/wizard/step-04-email-auth.md +311 -0
- package/dist/wizard/step-05-wallet-auth.md +368 -0
- package/dist/wizard/step-06-magic-link.md +560 -0
- package/dist/wizard/step-07-payments.md +529 -0
- package/dist/wizard/step-08-whitelist.md +338 -0
- package/dist/wizard/step-09-admin.md +579 -0
- package/dist/wizard/step-10-errors.md +525 -0
- package/dist/wizard/step-11-ui-polish.md +640 -0
- package/dist/wizard/step-12-testing.md +588 -0
- package/dist/wizard/wizard.lock +67 -0
- package/package.json +66 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
# SPAPS Integration Step 12/12: Testing & Documentation
|
|
2
|
+
|
|
3
|
+
## Prerequisites Check
|
|
4
|
+
|
|
5
|
+
Before starting, confirm you have completed:
|
|
6
|
+
- ✅ Step 1-11: Complete implementation with UI polish
|
|
7
|
+
- ✅ All authentication methods working
|
|
8
|
+
- ✅ Payments and admin features functional
|
|
9
|
+
- ✅ Error handling and theming complete
|
|
10
|
+
|
|
11
|
+
## Required TodoWrite List
|
|
12
|
+
|
|
13
|
+
Create a TodoWrite with EXACTLY these items:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
TodoWrite({
|
|
17
|
+
todos: [
|
|
18
|
+
{ content: "Test email login with test@example.com / Test123!", status: "pending", activeForm: "Testing email authentication" },
|
|
19
|
+
{ content: "Test wallet with 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb8", status: "pending", activeForm: "Testing wallet authentication" },
|
|
20
|
+
{ content: "Test Stripe with card 4242 4242 4242 4242", status: "pending", activeForm: "Testing Stripe payments" },
|
|
21
|
+
{ content: "Test whitelist with vip@example.com", status: "pending", activeForm: "Testing whitelist check" },
|
|
22
|
+
{ content: "Verify token auto-refresh is working", status: "pending", activeForm: "Verifying token refresh" },
|
|
23
|
+
{ content: "Create comprehensive README.md", status: "pending", activeForm: "Creating README documentation" },
|
|
24
|
+
{ content: "Run npm run dev and verify everything works", status: "pending", activeForm: "Running final verification" },
|
|
25
|
+
{ content: "Mark SPAPS integration complete! 🎉", status: "pending", activeForm: "Completing integration" }
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Comprehensive Testing Guide
|
|
31
|
+
|
|
32
|
+
### 1. Test Authentication Methods
|
|
33
|
+
|
|
34
|
+
#### Email/Password Test
|
|
35
|
+
```typescript
|
|
36
|
+
// Test credentials
|
|
37
|
+
const testUser = {
|
|
38
|
+
email: 'test@example.com',
|
|
39
|
+
password: 'Test123!'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Expected behavior:
|
|
43
|
+
// 1. Login succeeds
|
|
44
|
+
// 2. Tokens stored in localStorage
|
|
45
|
+
// 3. User redirected to dashboard
|
|
46
|
+
// 4. Auto-refresh works
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Wallet Authentication Test
|
|
50
|
+
```typescript
|
|
51
|
+
// Test wallet
|
|
52
|
+
const testWallet = '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb8'
|
|
53
|
+
|
|
54
|
+
// Expected behavior:
|
|
55
|
+
// 1. MetaMask prompts for signature
|
|
56
|
+
// 2. Authentication succeeds
|
|
57
|
+
// 3. Tokens stored
|
|
58
|
+
// 4. Wallet address displayed
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Magic Link Test
|
|
62
|
+
```typescript
|
|
63
|
+
// Test flow:
|
|
64
|
+
// 1. Request magic link for test@example.com
|
|
65
|
+
// 2. Check console/terminal for link (local mode)
|
|
66
|
+
// 3. Open link in browser
|
|
67
|
+
// 4. Should authenticate and redirect
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Test Payment Integration
|
|
71
|
+
|
|
72
|
+
#### Stripe Checkout Test
|
|
73
|
+
```javascript
|
|
74
|
+
// Test card numbers:
|
|
75
|
+
const testCards = {
|
|
76
|
+
success: '4242 4242 4242 4242',
|
|
77
|
+
declined: '4000 0000 0000 0002',
|
|
78
|
+
requires3DS: '4000 0025 0000 3155'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Test data:
|
|
82
|
+
// - Any future expiry date
|
|
83
|
+
// - Any 3-digit CVC
|
|
84
|
+
// - Any ZIP code
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Customer Portal Test
|
|
88
|
+
```javascript
|
|
89
|
+
// Expected behavior:
|
|
90
|
+
// 1. Click "Open Customer Portal"
|
|
91
|
+
// 2. Redirects to Stripe portal
|
|
92
|
+
// 3. Can manage subscriptions
|
|
93
|
+
// 4. Returns to app after
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. Test Admin Features
|
|
97
|
+
|
|
98
|
+
#### Whitelist Test
|
|
99
|
+
```javascript
|
|
100
|
+
// Test emails:
|
|
101
|
+
const whitelistTest = {
|
|
102
|
+
vip: 'vip@example.com', // Should be whitelisted
|
|
103
|
+
regular: 'user@example.com' // Should NOT be whitelisted
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Admin credentials:
|
|
107
|
+
const admin = {
|
|
108
|
+
email: 'admin@example.com',
|
|
109
|
+
password: 'Admin123!'
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Product Sync Test
|
|
114
|
+
```javascript
|
|
115
|
+
// Expected behavior:
|
|
116
|
+
// 1. Login as admin
|
|
117
|
+
// 2. Navigate to admin panel
|
|
118
|
+
// 3. Click "Sync Products"
|
|
119
|
+
// 4. Products sync from Stripe
|
|
120
|
+
// 5. Success message shown
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 4. Test Error Scenarios
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// components/test/error-tests.tsx
|
|
127
|
+
'use client'
|
|
128
|
+
|
|
129
|
+
import { Button } from "@/components/ui/button"
|
|
130
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
|
131
|
+
import { sdk } from '@/lib/spaps'
|
|
132
|
+
import { ErrorHandler } from '@/lib/error-handler'
|
|
133
|
+
|
|
134
|
+
export function ErrorTests() {
|
|
135
|
+
const testScenarios = [
|
|
136
|
+
{
|
|
137
|
+
name: 'Invalid Credentials',
|
|
138
|
+
test: async () => {
|
|
139
|
+
try {
|
|
140
|
+
await sdk.auth.signInWithPassword({
|
|
141
|
+
email: 'test@example.com',
|
|
142
|
+
password: 'WrongPassword'
|
|
143
|
+
})
|
|
144
|
+
} catch (error) {
|
|
145
|
+
ErrorHandler.handle(error, { operation: 'testInvalidCredentials' })
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'Rate Limiting',
|
|
151
|
+
test: async () => {
|
|
152
|
+
// Make 10 rapid requests
|
|
153
|
+
for (let i = 0; i < 10; i++) {
|
|
154
|
+
try {
|
|
155
|
+
await sdk.auth.signInWithPassword({
|
|
156
|
+
email: `test${i}@example.com`,
|
|
157
|
+
password: 'Test123!'
|
|
158
|
+
})
|
|
159
|
+
} catch (error) {
|
|
160
|
+
ErrorHandler.handle(error, { operation: 'testRateLimiting' })
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'Network Error',
|
|
167
|
+
test: async () => {
|
|
168
|
+
// Temporarily break the API URL
|
|
169
|
+
const originalUrl = process.env.NEXT_PUBLIC_SPAPS_API_URL
|
|
170
|
+
process.env.NEXT_PUBLIC_SPAPS_API_URL = 'http://localhost:9999'
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
await sdk.auth.signInWithPassword({
|
|
174
|
+
email: 'test@example.com',
|
|
175
|
+
password: 'Test123!'
|
|
176
|
+
})
|
|
177
|
+
} catch (error) {
|
|
178
|
+
ErrorHandler.handle(error, { operation: 'testNetworkError' })
|
|
179
|
+
} finally {
|
|
180
|
+
process.env.NEXT_PUBLIC_SPAPS_API_URL = originalUrl
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<Card>
|
|
188
|
+
<CardHeader>
|
|
189
|
+
<CardTitle>Error Handling Tests</CardTitle>
|
|
190
|
+
</CardHeader>
|
|
191
|
+
<CardContent className="space-y-2">
|
|
192
|
+
{testScenarios.map((scenario) => (
|
|
193
|
+
<Button
|
|
194
|
+
key={scenario.name}
|
|
195
|
+
variant="outline"
|
|
196
|
+
onClick={scenario.test}
|
|
197
|
+
className="w-full justify-start"
|
|
198
|
+
>
|
|
199
|
+
Test: {scenario.name}
|
|
200
|
+
</Button>
|
|
201
|
+
))}
|
|
202
|
+
</CardContent>
|
|
203
|
+
</Card>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 5. Create Test Checklist Component
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// components/test/test-checklist.tsx
|
|
212
|
+
'use client'
|
|
213
|
+
|
|
214
|
+
import { useState } from 'react'
|
|
215
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
|
216
|
+
import { Checkbox } from "@/components/ui/checkbox"
|
|
217
|
+
import { Badge } from "@/components/ui/badge"
|
|
218
|
+
import { Progress } from "@/components/ui/progress"
|
|
219
|
+
|
|
220
|
+
const testItems = [
|
|
221
|
+
{ id: 'email-auth', label: 'Email authentication works', category: 'auth' },
|
|
222
|
+
{ id: 'wallet-auth', label: 'Wallet authentication works', category: 'auth' },
|
|
223
|
+
{ id: 'magic-link', label: 'Magic link works', category: 'auth' },
|
|
224
|
+
{ id: 'token-storage', label: 'Tokens stored in localStorage', category: 'auth' },
|
|
225
|
+
{ id: 'auto-refresh', label: 'Token auto-refresh works', category: 'auth' },
|
|
226
|
+
{ id: 'stripe-checkout', label: 'Stripe checkout works', category: 'payments' },
|
|
227
|
+
{ id: 'customer-portal', label: 'Customer portal accessible', category: 'payments' },
|
|
228
|
+
{ id: 'product-list', label: 'Products load from Stripe', category: 'payments' },
|
|
229
|
+
{ id: 'whitelist-check', label: 'Whitelist check works', category: 'admin' },
|
|
230
|
+
{ id: 'admin-auth', label: 'Admin authentication works', category: 'admin' },
|
|
231
|
+
{ id: 'product-sync', label: 'Product sync works', category: 'admin' },
|
|
232
|
+
{ id: 'error-handling', label: 'Errors show proper messages', category: 'errors' },
|
|
233
|
+
{ id: 'dark-mode', label: 'Dark mode toggle works', category: 'ui' },
|
|
234
|
+
{ id: 'responsive', label: 'Responsive on mobile', category: 'ui' },
|
|
235
|
+
{ id: 'loading-states', label: 'Loading states display', category: 'ui' }
|
|
236
|
+
]
|
|
237
|
+
|
|
238
|
+
export function TestChecklist() {
|
|
239
|
+
const [checked, setChecked] = useState<string[]>([])
|
|
240
|
+
|
|
241
|
+
const progress = (checked.length / testItems.length) * 100
|
|
242
|
+
|
|
243
|
+
const handleCheck = (itemId: string) => {
|
|
244
|
+
setChecked(prev =>
|
|
245
|
+
prev.includes(itemId)
|
|
246
|
+
? prev.filter(id => id !== itemId)
|
|
247
|
+
: [...prev, itemId]
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const categories = [...new Set(testItems.map(item => item.category))]
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<Card>
|
|
255
|
+
<CardHeader>
|
|
256
|
+
<CardTitle>Integration Test Checklist</CardTitle>
|
|
257
|
+
<CardDescription>
|
|
258
|
+
Verify all features are working correctly
|
|
259
|
+
</CardDescription>
|
|
260
|
+
<Progress value={progress} className="mt-2" />
|
|
261
|
+
<p className="text-sm text-muted-foreground">
|
|
262
|
+
{checked.length} of {testItems.length} tests passed
|
|
263
|
+
</p>
|
|
264
|
+
</CardHeader>
|
|
265
|
+
<CardContent>
|
|
266
|
+
{categories.map(category => (
|
|
267
|
+
<div key={category} className="mb-6">
|
|
268
|
+
<h3 className="font-semibold mb-3 capitalize">
|
|
269
|
+
{category}
|
|
270
|
+
<Badge variant="outline" className="ml-2">
|
|
271
|
+
{checked.filter(id =>
|
|
272
|
+
testItems.find(item => item.id === id)?.category === category
|
|
273
|
+
).length}/{testItems.filter(item => item.category === category).length}
|
|
274
|
+
</Badge>
|
|
275
|
+
</h3>
|
|
276
|
+
<div className="space-y-2">
|
|
277
|
+
{testItems
|
|
278
|
+
.filter(item => item.category === category)
|
|
279
|
+
.map(item => (
|
|
280
|
+
<div key={item.id} className="flex items-center space-x-2">
|
|
281
|
+
<Checkbox
|
|
282
|
+
id={item.id}
|
|
283
|
+
checked={checked.includes(item.id)}
|
|
284
|
+
onCheckedChange={() => handleCheck(item.id)}
|
|
285
|
+
/>
|
|
286
|
+
<label
|
|
287
|
+
htmlFor={item.id}
|
|
288
|
+
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
289
|
+
>
|
|
290
|
+
{item.label}
|
|
291
|
+
</label>
|
|
292
|
+
</div>
|
|
293
|
+
))}
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
))}
|
|
297
|
+
|
|
298
|
+
{progress === 100 && (
|
|
299
|
+
<div className="mt-6 p-4 bg-green-50 dark:bg-green-900/20 rounded-lg">
|
|
300
|
+
<p className="text-green-800 dark:text-green-200 font-semibold">
|
|
301
|
+
🎉 All tests passed! Your SPAPS integration is complete!
|
|
302
|
+
</p>
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
305
|
+
</CardContent>
|
|
306
|
+
</Card>
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### 6. Create README.md
|
|
312
|
+
|
|
313
|
+
```markdown
|
|
314
|
+
# SPAPS Demo - Next.js Integration
|
|
315
|
+
|
|
316
|
+
A complete implementation of Sweet Potato Authentication & Payment Service (SPAPS) with Next.js 15, TypeScript, and shadcn/ui.
|
|
317
|
+
|
|
318
|
+
## Features
|
|
319
|
+
|
|
320
|
+
✅ **Multi-Method Authentication**
|
|
321
|
+
- Email/Password login
|
|
322
|
+
- Ethereum wallet authentication
|
|
323
|
+
- Magic link (passwordless)
|
|
324
|
+
- Token auto-refresh
|
|
325
|
+
|
|
326
|
+
✅ **Stripe Payment Integration**
|
|
327
|
+
- One-time payments
|
|
328
|
+
- Subscriptions
|
|
329
|
+
- Customer portal
|
|
330
|
+
- Product synchronization
|
|
331
|
+
|
|
332
|
+
✅ **Admin Features**
|
|
333
|
+
- Whitelist management
|
|
334
|
+
- User administration
|
|
335
|
+
- Product sync from Stripe
|
|
336
|
+
- System statistics
|
|
337
|
+
|
|
338
|
+
✅ **Modern UI/UX**
|
|
339
|
+
- Dark mode support
|
|
340
|
+
- Responsive design
|
|
341
|
+
- Loading states
|
|
342
|
+
- Error handling with toasts
|
|
343
|
+
|
|
344
|
+
## Tech Stack
|
|
345
|
+
|
|
346
|
+
- **Framework**: Next.js 15 with App Router
|
|
347
|
+
- **Language**: TypeScript
|
|
348
|
+
- **UI**: shadcn/ui components
|
|
349
|
+
- **Styling**: Tailwind CSS
|
|
350
|
+
- **Authentication**: SPAPS SDK
|
|
351
|
+
- **Payments**: Stripe (via SPAPS)
|
|
352
|
+
- **State**: React hooks
|
|
353
|
+
- **Themes**: next-themes
|
|
354
|
+
|
|
355
|
+
## Getting Started
|
|
356
|
+
|
|
357
|
+
### Prerequisites
|
|
358
|
+
|
|
359
|
+
- Node.js 20+
|
|
360
|
+
- npm or yarn
|
|
361
|
+
- SPAPS CLI (`npm install -D spaps`)
|
|
362
|
+
|
|
363
|
+
### Installation
|
|
364
|
+
|
|
365
|
+
1. Clone the repository:
|
|
366
|
+
\`\`\`bash
|
|
367
|
+
git clone <repo-url>
|
|
368
|
+
cd spaps-demo
|
|
369
|
+
\`\`\`
|
|
370
|
+
|
|
371
|
+
2. Install dependencies:
|
|
372
|
+
\`\`\`bash
|
|
373
|
+
npm install
|
|
374
|
+
\`\`\`
|
|
375
|
+
|
|
376
|
+
3. Copy environment variables:
|
|
377
|
+
\`\`\`bash
|
|
378
|
+
cp .env.local.example .env.local
|
|
379
|
+
\`\`\`
|
|
380
|
+
|
|
381
|
+
4. Update `.env.local` with your credentials:
|
|
382
|
+
\`\`\`env
|
|
383
|
+
NEXT_PUBLIC_SPAPS_API_URL=http://localhost:3301
|
|
384
|
+
SPAPS_API_KEY=test_key_local_dev_only
|
|
385
|
+
NEXT_PUBLIC_ADMIN_EMAIL=admin@example.com
|
|
386
|
+
NEXT_PUBLIC_ADMIN_PASSWORD=Admin123!
|
|
387
|
+
\`\`\`
|
|
388
|
+
|
|
389
|
+
### Running the Application
|
|
390
|
+
|
|
391
|
+
Start both SPAPS local server and Next.js:
|
|
392
|
+
|
|
393
|
+
\`\`\`bash
|
|
394
|
+
npm run dev
|
|
395
|
+
\`\`\`
|
|
396
|
+
|
|
397
|
+
This runs:
|
|
398
|
+
- SPAPS on http://localhost:3301
|
|
399
|
+
- Next.js on http://localhost:3000
|
|
400
|
+
|
|
401
|
+
## Testing
|
|
402
|
+
|
|
403
|
+
### Test Credentials
|
|
404
|
+
|
|
405
|
+
**User Account:**
|
|
406
|
+
- Email: test@example.com
|
|
407
|
+
- Password: Test123!
|
|
408
|
+
|
|
409
|
+
**Admin Account:**
|
|
410
|
+
- Email: admin@example.com
|
|
411
|
+
- Password: Admin123!
|
|
412
|
+
|
|
413
|
+
**Test Wallet:**
|
|
414
|
+
- Address: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb8
|
|
415
|
+
|
|
416
|
+
**Test Card (Stripe):**
|
|
417
|
+
- Number: 4242 4242 4242 4242
|
|
418
|
+
- Expiry: Any future date
|
|
419
|
+
- CVC: Any 3 digits
|
|
420
|
+
|
|
421
|
+
### Running Tests
|
|
422
|
+
|
|
423
|
+
1. **Authentication**: Test all login methods
|
|
424
|
+
2. **Payments**: Create test payment with Stripe
|
|
425
|
+
3. **Whitelist**: Check vip@example.com
|
|
426
|
+
4. **Admin**: Login as admin and sync products
|
|
427
|
+
5. **Errors**: Try wrong password to see error handling
|
|
428
|
+
|
|
429
|
+
## Project Structure
|
|
430
|
+
|
|
431
|
+
\`\`\`
|
|
432
|
+
spaps-demo/
|
|
433
|
+
├── app/ # Next.js app router pages
|
|
434
|
+
│ ├── api/ # API routes
|
|
435
|
+
│ ├── auth/ # Authentication pages
|
|
436
|
+
│ ├── dashboard/ # Dashboard
|
|
437
|
+
│ └── layout.tsx # Root layout with providers
|
|
438
|
+
├── components/ # React components
|
|
439
|
+
│ ├── auth/ # Auth forms
|
|
440
|
+
│ ├── payments/ # Payment components
|
|
441
|
+
│ ├── admin/ # Admin panel
|
|
442
|
+
│ └── ui/ # shadcn/ui components
|
|
443
|
+
├── lib/ # Utilities
|
|
444
|
+
│ ├── spaps.ts # SPAPS SDK initialization
|
|
445
|
+
│ ├── admin-service.ts # Admin API service
|
|
446
|
+
│ └── error-handler.ts # Error handling
|
|
447
|
+
└── public/ # Static assets
|
|
448
|
+
\`\`\`
|
|
449
|
+
|
|
450
|
+
## API Integration
|
|
451
|
+
|
|
452
|
+
The app integrates with SPAPS API on port 3301:
|
|
453
|
+
|
|
454
|
+
- **Authentication**: /api/auth/*
|
|
455
|
+
- **Payments**: /api/stripe/*
|
|
456
|
+
- **Admin**: /api/v1/admin/*
|
|
457
|
+
- **Whitelist**: Direct API calls with JWT
|
|
458
|
+
|
|
459
|
+
## Deployment
|
|
460
|
+
|
|
461
|
+
### Environment Variables
|
|
462
|
+
|
|
463
|
+
Set these in your deployment platform:
|
|
464
|
+
|
|
465
|
+
- `NEXT_PUBLIC_SPAPS_API_URL` - SPAPS API endpoint
|
|
466
|
+
- `SPAPS_API_KEY` - Your API key
|
|
467
|
+
- `NEXT_PUBLIC_ADMIN_EMAIL` - Admin email
|
|
468
|
+
- `NEXT_PUBLIC_ADMIN_PASSWORD` - Admin password
|
|
469
|
+
|
|
470
|
+
### Build
|
|
471
|
+
|
|
472
|
+
\`\`\`bash
|
|
473
|
+
npm run build
|
|
474
|
+
npm start
|
|
475
|
+
\`\`\`
|
|
476
|
+
|
|
477
|
+
## Common Issues
|
|
478
|
+
|
|
479
|
+
### Port 3301 Already in Use
|
|
480
|
+
\`\`\`bash
|
|
481
|
+
lsof -i :3301
|
|
482
|
+
kill -9 <PID>
|
|
483
|
+
\`\`\`
|
|
484
|
+
|
|
485
|
+
### SPAPS Not Starting
|
|
486
|
+
Check package.json dev script includes:
|
|
487
|
+
\`\`\`json
|
|
488
|
+
"dev": "concurrently \"npx spaps local\" \"next dev\""
|
|
489
|
+
\`\`\`
|
|
490
|
+
|
|
491
|
+
### Wallet Not Connecting
|
|
492
|
+
- Ensure MetaMask is installed
|
|
493
|
+
- Switch to Ethereum Mainnet
|
|
494
|
+
- Check console for errors
|
|
495
|
+
|
|
496
|
+
## License
|
|
497
|
+
|
|
498
|
+
MIT
|
|
499
|
+
|
|
500
|
+
## Support
|
|
501
|
+
|
|
502
|
+
For issues or questions:
|
|
503
|
+
- GitHub Issues: [repo-url]/issues
|
|
504
|
+
- Documentation: https://docs.sweetpotato.dev
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## Final Verification Checklist
|
|
508
|
+
|
|
509
|
+
Run through this final checklist:
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
# 1. Start the application
|
|
513
|
+
npm run dev
|
|
514
|
+
|
|
515
|
+
# 2. Check SPAPS is running
|
|
516
|
+
curl http://localhost:3301/health
|
|
517
|
+
|
|
518
|
+
# 3. Check Next.js is running
|
|
519
|
+
curl http://localhost:3000
|
|
520
|
+
|
|
521
|
+
# 4. Run through all test scenarios
|
|
522
|
+
# - Login with email
|
|
523
|
+
# - Connect wallet
|
|
524
|
+
# - Make test payment
|
|
525
|
+
# - Check whitelist
|
|
526
|
+
# - Access admin panel
|
|
527
|
+
|
|
528
|
+
# 5. Verify no console errors
|
|
529
|
+
# Check browser DevTools console
|
|
530
|
+
|
|
531
|
+
# 6. Test responsive design
|
|
532
|
+
# Open DevTools and test mobile view
|
|
533
|
+
|
|
534
|
+
# 7. Test dark mode
|
|
535
|
+
# Toggle theme and check all pages
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## Success Criteria
|
|
539
|
+
|
|
540
|
+
Your integration is complete when:
|
|
541
|
+
|
|
542
|
+
✅ All authentication methods work
|
|
543
|
+
✅ Payments process successfully
|
|
544
|
+
✅ Whitelist checks function
|
|
545
|
+
✅ Admin panel accessible
|
|
546
|
+
✅ Tokens auto-refresh
|
|
547
|
+
✅ Errors handled gracefully
|
|
548
|
+
✅ UI is responsive
|
|
549
|
+
✅ Dark mode works
|
|
550
|
+
✅ README is comprehensive
|
|
551
|
+
✅ No console errors
|
|
552
|
+
|
|
553
|
+
## Congratulations! 🎉
|
|
554
|
+
|
|
555
|
+
You've successfully integrated SPAPS with:
|
|
556
|
+
- **12 completed steps**
|
|
557
|
+
- **Full authentication system**
|
|
558
|
+
- **Stripe payment processing**
|
|
559
|
+
- **Admin capabilities**
|
|
560
|
+
- **Beautiful UI with shadcn/ui**
|
|
561
|
+
- **Comprehensive error handling**
|
|
562
|
+
- **Complete documentation**
|
|
563
|
+
|
|
564
|
+
## Integration Complete!
|
|
565
|
+
|
|
566
|
+
Your SPAPS integration is now:
|
|
567
|
+
- ✅ **Fully functional**
|
|
568
|
+
- ✅ **Production ready**
|
|
569
|
+
- ✅ **Well documented**
|
|
570
|
+
- ✅ **Properly tested**
|
|
571
|
+
|
|
572
|
+
## Summary
|
|
573
|
+
|
|
574
|
+
This wizard has guided you through:
|
|
575
|
+
1. ✅ Project setup with correct dependencies
|
|
576
|
+
2. ✅ Environment configuration with port 3301
|
|
577
|
+
3. ✅ SDK initialization with proper exports
|
|
578
|
+
4. ✅ Email/password authentication
|
|
579
|
+
5. ✅ Wallet authentication with correct method
|
|
580
|
+
6. ✅ Magic link implementation
|
|
581
|
+
7. ✅ Stripe payment integration
|
|
582
|
+
8. ✅ Whitelist operations
|
|
583
|
+
9. ✅ Admin panel implementation
|
|
584
|
+
10. ✅ Error handling and token management
|
|
585
|
+
11. ✅ UI polish with theming
|
|
586
|
+
12. ✅ Testing and documentation
|
|
587
|
+
|
|
588
|
+
**Great job completing the SPAPS Integration Wizard!** 🚀
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"source": "agent-instructions/spaps-wizard-steps",
|
|
4
|
+
"hash_normalization": "sha256 over UTF-8 bytes with CRLF/CR normalized to LF",
|
|
5
|
+
"steps": [
|
|
6
|
+
{
|
|
7
|
+
"index": 1,
|
|
8
|
+
"path": "step-01-setup.md",
|
|
9
|
+
"sha256": "888010e84660a5128debb8cb7de996ec3e1c491da673970bf9a10771d63cb24a"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"index": 2,
|
|
13
|
+
"path": "step-02-environment.md",
|
|
14
|
+
"sha256": "2fd442f18f3190c3ca24ff92fd5f4ff987bdfd15e5e3906edbb2fe8bfef352cb"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"index": 3,
|
|
18
|
+
"path": "step-03-sdk-init.md",
|
|
19
|
+
"sha256": "6c9ca363bce832b202e9f6bd6ebf6911b41329421eabb6bef40434bb20e51d0d"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"index": 4,
|
|
23
|
+
"path": "step-04-email-auth.md",
|
|
24
|
+
"sha256": "b267ea839069913630207e71a4069a9981e2810b916c4d9b386df1b35d9a41a5"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"index": 5,
|
|
28
|
+
"path": "step-05-wallet-auth.md",
|
|
29
|
+
"sha256": "bb97f56f0cea87b2c1729d8005c2ee83a3b9dd0c166eab3ce1089aa71881f6cf"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"index": 6,
|
|
33
|
+
"path": "step-06-magic-link.md",
|
|
34
|
+
"sha256": "013204c2a9b49cf93c6398d63adabd807c3f1949b7e20126272feefbabf3e4b2"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"index": 7,
|
|
38
|
+
"path": "step-07-payments.md",
|
|
39
|
+
"sha256": "3e527fd805cf58c7c932a0ca286628a23c2aeaa51c4761f13069c1c7037afbf2"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"index": 8,
|
|
43
|
+
"path": "step-08-whitelist.md",
|
|
44
|
+
"sha256": "ad67b19b4b8d8ae99c877971923a10ed534343105c56c6d526a9b8dbc3f97d76"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"index": 9,
|
|
48
|
+
"path": "step-09-admin.md",
|
|
49
|
+
"sha256": "7cc16bd291a97daff7323dc581705b77903b8c62bbd224b90552a1f846eedc3a"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"index": 10,
|
|
53
|
+
"path": "step-10-errors.md",
|
|
54
|
+
"sha256": "dce6214466acb6c6f02b13ddb674bc532afd9f99b133dfbc3daff98139d9c9ec"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"index": 11,
|
|
58
|
+
"path": "step-11-ui-polish.md",
|
|
59
|
+
"sha256": "c8d07da3427fd5780769894ebd57eccad065e19211d64022dee07a541a87950d"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"index": 12,
|
|
63
|
+
"path": "step-12-testing.md",
|
|
64
|
+
"sha256": "9b756495cb2f416c9b01de24e30860596ca09b416379ecdc9182a80eb5d8f785"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|