oneie 3.6.39 → 3.6.40

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.
Files changed (46) hide show
  1. package/.claude/commands/deploy.md +187 -17
  2. package/.claude/commands/media-upload.md +186 -0
  3. package/.claude/hooks/.last-news-context +1 -1
  4. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  5. package/one/README.md +1 -2
  6. package/one/knowledge/one-protocol-ai-agents.md +892 -0
  7. package/one/knowledge/one-protocol-executive-report.md +617 -0
  8. package/one/knowledge/one-protocol-standard.md +869 -0
  9. package/one/knowledge/one-protocol-whitepaper.md +756 -0
  10. package/one/knowledge/ontology-education-game.md +1654 -0
  11. package/one/knowledge/ontology-v2.md +4449 -0
  12. package/one/knowledge/ontology.md +1 -1
  13. package/one/things/contracts/Move.toml +12 -0
  14. package/one/things/contracts/README.md +288 -0
  15. package/one/things/contracts/one.move +762 -0
  16. package/one/things/contracts/sdk.ts +578 -0
  17. package/one/things/crypto/FEATURES.md +78 -0
  18. package/one/things/crypto/ONECORE.md +62 -0
  19. package/one/things/crypto/ONECOREFAQ.md +22 -0
  20. package/one/things/crypto/ONECOREHOW.md +46 -0
  21. package/one/things/crypto/ONEENTERPRISE.md +64 -0
  22. package/one/things/crypto/ONEENTERPRISEFAQ.md +64 -0
  23. package/one/things/crypto/ONEENTERPRISEHOW.md +53 -0
  24. package/one/things/crypto/ONEPRO.md +60 -0
  25. package/one/things/crypto/ONEPROFAQ.md +22 -0
  26. package/one/things/crypto/ONEPROHOW.md +53 -0
  27. package/one/things/crypto/READMEAGENCY.md +64 -0
  28. package/one/things/crypto/VSL.md +45 -0
  29. package/one/things/crypto/WebsiteCopy.md +176 -0
  30. package/one/things/design-system.md +832 -0
  31. package/one/things/pay.one.ie.md +53 -0
  32. package/one/things/plans/one-protocol-and-payone-usage.md +82 -0
  33. package/one/things/plans/plan-connect-to-api.md +146 -0
  34. package/one/things/plans-u.md +905 -0
  35. package/one/things/products/Blockchain Products.md +6278 -0
  36. package/one/things/scripts-clean-mac.sh +409 -0
  37. package/one/things/todo-release.md +654 -0
  38. package/one/things/todo.md +9 -642
  39. package/one/things/video-script-backup.md +318 -0
  40. package/one/things/video-script-demo.md +382 -0
  41. package/one/things/video-script-ontology.md +0 -1
  42. package/one/things/video-script.md +361 -0
  43. package/package.json +6 -5
  44. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  45. package/.claude/hooks/__pycache__/todo.cpython-311.pyc +0 -0
  46. package/llms.txt +0 -257
@@ -0,0 +1,905 @@
1
+ # PLAN-U: Merchant Dashboard Migration & Integration
2
+
3
+ **Status**: Active Development Plan
4
+ **Version**: 1.0.0
5
+ **Created**: 2025-12-05
6
+ **Owner**: @claude-code
7
+
8
+ ---
9
+
10
+ ## 📋 Executive Summary
11
+
12
+ This plan describes the complete migration of merchant dashboard components from `one-core/frontend/` and `one-core/backend/src/` into the ONE platform's web experience at `web/src/pages/u/` (Unified Merchant Dashboard).
13
+
14
+ **Key Objectives:**
15
+ 1. ✅ Create beautiful, fast, clear merchant dashboard (`/u` route)
16
+ 2. ✅ Migrate all frontend components into `/web/src/components/`
17
+ 3. ✅ Move HTML pages into `/web/src/pages/u/` structure
18
+ 4. ✅ Integrate pay.one.ie/merchant dashboard code into ONE platform
19
+ 5. ✅ Implement 6-dimension ontology mapping (groups, people, things, connections, events, knowledge)
20
+ 6. ✅ Create index dashboard with cards for: wallets, tokens, contracts, products, transactions
21
+
22
+ ---
23
+
24
+ ## 🗂️ File Inventory & Migration Map
25
+
26
+ ### Phase 1: Source Code Analysis
27
+
28
+ #### Frontend Components (one-core/frontend/)
29
+ ```
30
+ /Users/toc/Server/ONE/apps/one-core/frontend/
31
+ ├── Claim.tsx → /web/src/components/merchant/Claim.tsx
32
+ ├── ClaimProvider.tsx → /web/src/components/merchant/ClaimProvider.tsx
33
+ ├── ClaimWithDappKit.tsx → /web/src/components/merchant/ClaimWithDappKit.tsx
34
+ ├── Pay.tsx → /web/src/components/payment/Pay.tsx
35
+ ├── PayOpen.tsx → /web/src/components/payment/PayOpen.tsx
36
+ ├── WalletDashboard.tsx → /web/src/pages/u/wallets.astro (convert to page)
37
+ ├── School.tsx → /web/src/components/forms/School.tsx
38
+ ├── ZkLogin.tsx → /web/src/components/auth/ZkLogin.tsx
39
+ ├── school.html → /web/src/pages/u/school.astro (convert to page)
40
+ ├── index.ts → /web/src/lib/merchant-exports.ts (utilities)
41
+ ├── SETUP.md → /web/src/pages/u/SETUP.md
42
+ ├── SETUP-ASTRO.md → /one/knowledge/guides/merchant-setup-astro.md
43
+ └── README.md → /one/knowledge/guides/merchant-dashboard.md
44
+ ```
45
+
46
+ #### Backend Merchant Code (one-core/backend/src/merchant.ts)
47
+ ```
48
+ /Users/toc/Server/ONE/apps/one-core/backend/src/merchant.ts
49
+ ├── MerchantConfig interface → /backend/convex/schema.ts (extend things table)
50
+ ├── getMerchantConfig() → /backend/convex/queries/merchant-config.ts
51
+ ├── getDepositAddresses() → /backend/convex/queries/merchant-addresses.ts
52
+ ├── buildSponsoredClaimPtb() → /backend/convex/mutations/merchant-claim.ts
53
+ ├── sweepDerivedWallets() → /backend/convex/mutations/merchant-sweep.ts
54
+ └── buildMerchantRegistrationPtb() → /backend/convex/mutations/merchant-register.ts
55
+ ```
56
+
57
+ #### Backend Index Routes (one-core/backend/src/index.ts)
58
+ ```
59
+ Lines: ~3200+ with merchant dashboard HTML
60
+ ├── Merchant dashboard view → /web/src/pages/u/index.astro (main dashboard)
61
+ ├── Wallet view → /web/src/pages/u/wallets.astro
62
+ ├── Tokens view → /web/src/pages/u/tokens.astro
63
+ ├── Contracts view → /web/src/pages/u/contracts.astro
64
+ ├── Products view → /web/src/pages/u/products.astro
65
+ └── Transactions view → /web/src/pages/u/transactions.astro
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 📋 Detailed File Mapping: Pages & Components
71
+
72
+ ### Pages/u/ Directory File Mapping
73
+
74
+ #### Main Dashboard Pages
75
+
76
+ | Source File | Source Location | Target File | Target Path | Purpose |
77
+ |-------------|-----------------|-------------|-------------|---------|
78
+ | `school.html` | `one-core/frontend/` | `index.astro` | `web/src/pages/u/index.astro` | Main merchant dashboard overview |
79
+ | N/A (new) | - | `layout.astro` | `web/src/pages/u/layout.astro` | Merchant dashboard layout wrapper |
80
+
81
+ #### Wallets Pages
82
+
83
+ | Source File | Source Location | Target File | Target Path | Purpose |
84
+ |-------------|-----------------|-------------|-------------|---------|
85
+ | `WalletDashboard.tsx` | `one-core/frontend/` | `wallets.astro` | `web/src/pages/u/wallets.astro` | List all merchant wallets |
86
+ | N/A (new) | - | `[walletId].astro` | `web/src/pages/u/wallets/[walletId].astro` | Individual wallet detail page |
87
+ | N/A (new) | - | `create.astro` | `web/src/pages/u/wallets/create.astro` | Create/import new wallet |
88
+
89
+ #### Tokens Pages
90
+
91
+ | Source File | Source Location | Target File | Target Path | Purpose |
92
+ |-------------|-----------------|-------------|-------------|---------|
93
+ | N/A (extract from index.ts) | `one-core/backend/src/index.ts` | `tokens.astro` | `web/src/pages/u/tokens.astro` | List all merchant tokens |
94
+ | N/A (new) | - | `[tokenId].astro` | `web/src/pages/u/tokens/[tokenId].astro` | Individual token detail page |
95
+ | N/A (new) | - | `deploy.astro` | `web/src/pages/u/tokens/deploy.astro` | Deploy new token form |
96
+
97
+ #### Contracts Pages
98
+
99
+ | Source File | Source Location | Target File | Target Path | Purpose |
100
+ |-------------|-----------------|-------------|-------------|---------|
101
+ | N/A (extract from index.ts) | `one-core/backend/src/index.ts` | `contracts.astro` | `web/src/pages/u/contracts.astro` | List all smart contracts |
102
+ | N/A (new) | - | `[contractId].astro` | `web/src/pages/u/contracts/[contractId].astro` | Contract detail + ABI explorer |
103
+ | N/A (new) | - | `connect.astro` | `web/src/pages/u/contracts/connect.astro` | Connect existing contract |
104
+
105
+ #### Products Pages
106
+
107
+ | Source File | Source Location | Target File | Target Path | Purpose |
108
+ |-------------|-----------------|-------------|-------------|---------|
109
+ | N/A (extract from index.ts) | `one-core/backend/src/index.ts` | `products.astro` | `web/src/pages/u/products.astro` | Product catalog |
110
+ | N/A (new) | - | `[productId].astro` | `web/src/pages/u/products/[productId].astro` | Individual product detail |
111
+ | N/A (new) | - | `create.astro` | `web/src/pages/u/products/create.astro` | Create new product form |
112
+
113
+ #### Transactions Pages
114
+
115
+ | Source File | Source Location | Target File | Target Path | Purpose |
116
+ |-------------|-----------------|-------------|-------------|---------|
117
+ | N/A (extract from index.ts) | `one-core/backend/src/index.ts` | `transactions.astro` | `web/src/pages/u/transactions.astro` | Transaction history + filtering |
118
+ | N/A (new) | - | `[txId].astro` | `web/src/pages/u/transactions/[txId].astro` | Individual transaction detail |
119
+
120
+ #### Settings Pages
121
+
122
+ | Source File | Source Location | Target File | Target Path | Purpose |
123
+ |-------------|-----------------|-------------|-------------|---------|
124
+ | N/A (new) | - | `settings.astro` | `web/src/pages/u/settings.astro` | Merchant account settings |
125
+ | N/A (new) | - | `settings/api-keys.astro` | `web/src/pages/u/settings/api-keys.astro` | API key management |
126
+ | N/A (new) | - | `settings/webhooks.astro` | `web/src/pages/u/settings/webhooks.astro` | Webhook configuration |
127
+
128
+ #### API Routes
129
+
130
+ | Source File | Source Location | Target File | Target Path | Purpose |
131
+ |-------------|-----------------|-------------|-------------|---------|
132
+ | N/A (new) | - | `config.json.ts` | `web/src/pages/api/merchant/config.json.ts` | Get merchant configuration |
133
+ | N/A (new) | - | `wallets.json.ts` | `web/src/pages/api/merchant/wallets.json.ts` | List merchant wallets |
134
+ | N/A (new) | - | `tokens.json.ts` | `web/src/pages/api/merchant/tokens.json.ts` | List merchant tokens |
135
+ | N/A (new) | - | `contracts.json.ts` | `web/src/pages/api/merchant/contracts.json.ts` | List contracts |
136
+ | N/A (new) | - | `products.json.ts` | `web/src/pages/api/merchant/products.json.ts` | List products |
137
+ | N/A (new) | - | `transactions.json.ts` | `web/src/pages/api/merchant/transactions.json.ts` | List transactions |
138
+
139
+ ---
140
+
141
+ ### Components Directory File Mapping
142
+
143
+ #### Merchant Components (Main Dashboard)
144
+
145
+ | Source File | Source Location | Target File | Target Path | Purpose |
146
+ |-------------|-----------------|-------------|-------------|---------|
147
+ | `WalletDashboard.tsx` | `one-core/frontend/` | `WalletDashboard.tsx` | `web/src/components/merchant/WalletDashboard.tsx` | Wallet management component |
148
+ | N/A (new) | - | `Dashboard.tsx` | `web/src/components/merchant/Dashboard.tsx` | Main dashboard container |
149
+ | N/A (new) | - | `DashboardCard.tsx` | `web/src/components/merchant/DashboardCard.tsx` | Reusable dashboard card |
150
+ | N/A (new) | - | `IndexCards.tsx` | `web/src/components/merchant/IndexCards.tsx` | 5-card grid for index page |
151
+ | N/A (new) | - | `MerchantNav.tsx` | `web/src/components/merchant/MerchantNav.tsx` | Navigation sidebar |
152
+ | N/A (new) | - | `ChainSelector.tsx` | `web/src/components/merchant/ChainSelector.tsx` | Chain/network selector |
153
+
154
+ #### Wallet Components
155
+
156
+ | Source File | Source Location | Target File | Target Path | Purpose |
157
+ |-------------|-----------------|-------------|-------------|---------|
158
+ | N/A (new) | - | `WalletCard.tsx` | `web/src/components/merchant/WalletCard.tsx` | Wallet display card |
159
+ | N/A (new) | - | `WalletList.tsx` | `web/src/components/merchant/WalletList.tsx` | Wallet list with filtering |
160
+ | N/A (new) | - | `WalletDetail.tsx` | `web/src/components/merchant/WalletDetail.tsx` | Wallet detail view |
161
+ | N/A (new) | - | `WalletBalance.tsx` | `web/src/components/merchant/WalletBalance.tsx` | Balance display widget |
162
+ | N/A (new) | - | `CreateWallet.tsx` | `web/src/components/merchant/CreateWallet.tsx` | Create/import wallet form |
163
+
164
+ #### Token Components
165
+
166
+ | Source File | Source Location | Target File | Target Path | Purpose |
167
+ |-------------|-----------------|-------------|-------------|---------|
168
+ | N/A (new) | - | `TokenCard.tsx` | `web/src/components/merchant/TokenCard.tsx` | Token display card |
169
+ | N/A (new) | - | `TokenList.tsx` | `web/src/components/merchant/TokenList.tsx` | Token list with search |
170
+ | N/A (new) | - | `TokenDetail.tsx` | `web/src/components/merchant/TokenDetail.tsx` | Token detail with metadata |
171
+ | N/A (new) | - | `TokenHolders.tsx` | `web/src/components/merchant/TokenHolders.tsx` | Token holders list |
172
+ | N/A (new) | - | `DeployToken.tsx` | `web/src/components/merchant/DeployToken.tsx` | Deploy new token form |
173
+
174
+ #### Contract Components
175
+
176
+ | Source File | Source Location | Target File | Target Path | Purpose |
177
+ |-------------|-----------------|-------------|-------------|---------|
178
+ | N/A (new) | - | `ContractCard.tsx` | `web/src/components/merchant/ContractCard.tsx` | Contract display card |
179
+ | N/A (new) | - | `ContractList.tsx` | `web/src/components/merchant/ContractList.tsx` | Contract list |
180
+ | N/A (new) | - | `ContractDetail.tsx` | `web/src/components/merchant/ContractDetail.tsx` | Contract detail view |
181
+ | N/A (new) | - | `ABIExplorer.tsx` | `web/src/components/merchant/ABIExplorer.tsx` | ABI function explorer |
182
+ | N/A (new) | - | `ContractInteraction.tsx` | `web/src/components/merchant/ContractInteraction.tsx` | Call contract functions |
183
+ | N/A (new) | - | `ConnectContract.tsx` | `web/src/components/merchant/ConnectContract.tsx` | Connect existing contract |
184
+
185
+ #### Product Components
186
+
187
+ | Source File | Source Location | Target File | Target Path | Purpose |
188
+ |-------------|-----------------|-------------|-------------|---------|
189
+ | N/A (new) | - | `ProductCard.tsx` | `web/src/components/merchant/ProductCard.tsx` | Product display card |
190
+ | N/A (new) | - | `ProductList.tsx` | `web/src/components/merchant/ProductList.tsx` | Product catalog view |
191
+ | N/A (new) | - | `ProductDetail.tsx` | `web/src/components/merchant/ProductDetail.tsx` | Product detail page |
192
+ | N/A (new) | - | `CreateProduct.tsx` | `web/src/components/merchant/CreateProduct.tsx` | Create product form |
193
+ | N/A (new) | - | `ProductPricing.tsx` | `web/src/components/merchant/ProductPricing.tsx` | Pricing management |
194
+
195
+ #### Transaction Components
196
+
197
+ | Source File | Source Location | Target File | Target Path | Purpose |
198
+ |-------------|-----------------|-------------|-------------|---------|
199
+ | N/A (new) | - | `TransactionCard.tsx` | `web/src/components/merchant/TransactionCard.tsx` | Transaction display card |
200
+ | N/A (new) | - | `TransactionList.tsx` | `web/src/components/merchant/TransactionList.tsx` | Transaction history |
201
+ | N/A (new) | - | `TransactionDetail.tsx` | `web/src/components/merchant/TransactionDetail.tsx` | Transaction detail view |
202
+ | N/A (new) | - | `TransactionFilter.tsx` | `web/src/components/merchant/TransactionFilter.tsx` | Transaction filters |
203
+ | N/A (new) | - | `TransactionExport.tsx` | `web/src/components/merchant/TransactionExport.tsx` | Export transactions (CSV/JSON) |
204
+
205
+ #### Claim & Payment Components (From one-core/frontend/)
206
+
207
+ | Source File | Source Location | Target File | Target Path | Purpose |
208
+ |-------------|-----------------|-------------|-------------|---------|
209
+ | `Claim.tsx` | `one-core/frontend/` | `Claim.tsx` | `web/src/components/merchant/Claim.tsx` | Claim token component |
210
+ | `ClaimProvider.tsx` | `one-core/frontend/` | `ClaimProvider.tsx` | `web/src/components/merchant/ClaimProvider.tsx` | Claim context provider |
211
+ | `ClaimWithDappKit.tsx` | `one-core/frontend/` | `ClaimWithDappKit.tsx` | `web/src/components/merchant/ClaimWithDappKit.tsx` | DappKit claim integration |
212
+
213
+ #### Payment Components (From one-core/frontend/)
214
+
215
+ | Source File | Source Location | Target File | Target Path | Purpose |
216
+ |-------------|-----------------|-------------|-------------|---------|
217
+ | `Pay.tsx` | `one-core/frontend/` | `Pay.tsx` | `web/src/components/payment/Pay.tsx` | Payment component |
218
+ | `PayOpen.tsx` | `one-core/frontend/` | `PayOpen.tsx` | `web/src/components/payment/PayOpen.tsx` | Payment modal/open |
219
+
220
+ #### Form Components (From one-core/frontend/)
221
+
222
+ | Source File | Source Location | Target File | Target Path | Purpose |
223
+ |-------------|-----------------|-------------|-------------|---------|
224
+ | `School.tsx` | `one-core/frontend/` | `School.tsx` | `web/src/components/forms/School.tsx` | School/organization form |
225
+
226
+ #### Auth Components (From one-core/frontend/)
227
+
228
+ | Source File | Source Location | Target File | Target Path | Purpose |
229
+ |-------------|-----------------|-------------|-------------|---------|
230
+ | `ZkLogin.tsx` | `one-core/frontend/` | `ZkLogin.tsx` | `web/src/components/auth/ZkLogin.tsx` | ZK login component |
231
+
232
+ #### Widget Components
233
+
234
+ | Source File | Source Location | Target File | Target Path | Purpose |
235
+ |-------------|-----------------|-------------|-------------|---------|
236
+ | N/A (new) | - | `BalanceWidget.tsx` | `web/src/components/merchant/BalanceWidget.tsx` | Balance summary widget |
237
+ | N/A (new) | - | `StatsPanel.tsx` | `web/src/components/merchant/StatsPanel.tsx` | Stats overview panel |
238
+ | N/A (new) | - | `RecentActivity.tsx` | `web/src/components/merchant/RecentActivity.tsx` | Recent transactions |
239
+ | N/A (new) | - | `QuickActions.tsx` | `web/src/components/merchant/QuickActions.tsx` | Quick action buttons |
240
+
241
+ ---
242
+
243
+ ## 📐 Directory Structure (Target)
244
+
245
+ ```
246
+ /Users/toc/Server/ONE/web/
247
+ ├── src/
248
+ │ ├── pages/
249
+ │ │ ├── u/ # Merchant/User Dashboard
250
+ │ │ │ ├── index.astro # Main dashboard (beautiful index view)
251
+ │ │ │ ├── wallets.astro # Wallet management
252
+ │ │ │ ├── wallets/
253
+ │ │ │ │ └── [walletId].astro # Individual wallet detail
254
+ │ │ │ ├── tokens.astro # Token inventory
255
+ │ │ │ ├── tokens/
256
+ │ │ │ │ └── [tokenId].astro # Individual token detail
257
+ │ │ │ ├── contracts.astro # Smart contract management
258
+ │ │ │ ├── contracts/
259
+ │ │ │ │ └── [contractId].astro # Individual contract detail
260
+ │ │ │ ├── products.astro # Product catalog
261
+ │ │ │ ├── products/
262
+ │ │ │ │ └── [productId].astro # Individual product detail
263
+ │ │ │ ├── transactions.astro # Transaction history
264
+ │ │ │ ├── transactions/
265
+ │ │ │ │ └── [txId].astro # Individual transaction detail
266
+ │ │ │ ├── settings.astro # Merchant settings
267
+ │ │ │ ├── SETUP.md # Setup documentation
268
+ │ │ │ └── CLAUDE.md # Merchant dashboard guidelines
269
+ │ │ │
270
+ │ │ └── api/
271
+ │ │ └── merchant/
272
+ │ │ ├── config.json.ts # Get merchant config
273
+ │ │ ├── wallets.json.ts # List wallets
274
+ │ │ ├── tokens.json.ts # List tokens
275
+ │ │ ├── contracts.json.ts # List contracts
276
+ │ │ ├── products.json.ts # List products
277
+ │ │ └── transactions.json.ts # List transactions
278
+ │ │
279
+ │ ├── components/
280
+ │ │ ├── merchant/
281
+ │ │ │ ├── Claim.tsx # Claim token component
282
+ │ │ │ ├── ClaimProvider.tsx # Claim context provider
283
+ │ │ │ ├── ClaimWithDappKit.tsx # DappKit integration
284
+ │ │ │ ├── Dashboard.tsx # Main dashboard container
285
+ │ │ │ ├── DashboardCard.tsx # Reusable card component
286
+ │ │ │ ├── WalletCard.tsx # Wallet display card
287
+ │ │ │ ├── TokenCard.tsx # Token display card
288
+ │ │ │ ├── ContractCard.tsx # Contract display card
289
+ │ │ │ ├── ProductCard.tsx # Product display card
290
+ │ │ │ ├── TransactionCard.tsx # Transaction display card
291
+ │ │ │ ├── BalanceWidget.tsx # Balance summary
292
+ │ │ │ ├── StatsPanel.tsx # Stats overview
293
+ │ │ │ ├── ChainSelector.tsx # Chain switcher
294
+ │ │ │ └── MerchantNav.tsx # Navigation bar
295
+ │ │ │
296
+ │ │ ├── payment/
297
+ │ │ │ ├── Pay.tsx # Payment component
298
+ │ │ │ └── PayOpen.tsx # Payment open/modal
299
+ │ │ │
300
+ │ │ ├── forms/
301
+ │ │ │ └── School.tsx # School/organization form
302
+ │ │ │
303
+ │ │ ├── auth/
304
+ │ │ │ └── ZkLogin.tsx # ZK login component
305
+ │ │ │
306
+ │ │ └── dashboard/
307
+ │ │ ├── IndexCards.tsx # Dashboard card grid
308
+ │ │ ├── WalletWidget.tsx # Wallet summary widget
309
+ │ │ ├── TokenWidget.tsx # Token summary widget
310
+ │ │ ├── ContractWidget.tsx # Contract summary widget
311
+ │ │ ├── ProductWidget.tsx # Product summary widget
312
+ │ │ └── TransactionWidget.tsx # Transaction summary widget
313
+ │ │
314
+ │ └── lib/
315
+ │ ├── merchant-api.ts # API client functions
316
+ │ ├── merchant-utils.ts # Utility functions
317
+ │ ├── merchant-exports.ts # Exported utilities from one-core
318
+ │ └── merchant-types.ts # TypeScript types
319
+ │
320
+ └── public/
321
+ └── merchant/
322
+ ├── icons/ # Merchant dashboard icons
323
+ ├── illustrations/ # SVG illustrations
324
+ └── favicons/ # Brand favicons
325
+ ```
326
+
327
+ ---
328
+
329
+ ## 🔄 Six-Dimension Ontology Mapping
330
+
331
+ ### Groups (Multi-tenant Organization)
332
+ - **groupId**: Merchant organization (payment processor, marketplace)
333
+ - **Instance**: Each merchant has their own group
334
+ - **Relations**: Merchant owns wallets, tokens, contracts, products within group
335
+
336
+ ### People (Authorization & Roles)
337
+ - **Creator**: Merchant owner (platform_owner within group)
338
+ - **Roles**:
339
+ - `merchant_owner` - Full access
340
+ - `merchant_admin` - Manage team, view analytics
341
+ - `merchant_user` - View-only access
342
+ - `customer` - End user making payments
343
+
344
+ ### Things (All Entities)
345
+ ```
346
+ type: 'merchant' - Merchant account record
347
+ type: 'wallet' - Merchant wallet (EVM, Sui, SOL, BTC)
348
+ type: 'token' - Fungible or NFT token
349
+ type: 'contract' - Smart contract (Sui Move, EVM Solidity)
350
+ type: 'product' - Product for sale (digital or physical)
351
+ type: 'transaction' - Payment transaction history
352
+ type: 'customer_record' - End user payment record
353
+ type: 'payment_link' - Generated payment link
354
+ ```
355
+
356
+ ### Connections (Relationships)
357
+ ```
358
+ owns - Merchant owns wallets/tokens/products
359
+ holds_wallet - Merchant holds custody of wallet
360
+ deployed_contract - Merchant deployed this contract
361
+ has_product - Merchant has product for sale
362
+ processed_payment - Merchant processed transaction
363
+ paid_in_token - Customer paid using token
364
+ received_in_wallet - Funds received in wallet
365
+ ```
366
+
367
+ ### Events (Audit Trail)
368
+ ```
369
+ merchant_registered - New merchant account created
370
+ wallet_created - New wallet generated
371
+ wallet_connected - External wallet connected
372
+ token_deployed - New token deployed
373
+ contract_deployed - Smart contract deployed
374
+ product_created - Product added to catalog
375
+ transaction_processed - Payment claimed on-chain
376
+ transaction_failed - Payment verification failed
377
+ payment_link_generated - Payment link created
378
+ ```
379
+
380
+ ### Knowledge (Labels, Tags, Vectors)
381
+ ```
382
+ search: ['merchant', 'dashboard', 'wallet', 'token', 'payment']
383
+ category: 'merchant-tools'
384
+ tags: ['one-core', 'multi-chain', 'payment-processor']
385
+ vector: [embeddings for RAG search]
386
+ ```
387
+
388
+ ---
389
+
390
+ ## 🎯 Implementation Phases
391
+
392
+ ### Phase 1: Component Migration (Cycles 1-5)
393
+ **Goal**: Move all UI components into `/web/src/components/` with proper structure
394
+
395
+ **Tasks**:
396
+ 1. Copy frontend components from one-core/frontend/ to web/src/components/
397
+ 2. Update imports and dependencies
398
+ 3. Create merchant component directory structure
399
+ 4. Register components in web/src/components/index.ts
400
+ 5. Test each component in isolation
401
+
402
+ **Deliverables**:
403
+ - All React/TSX components migrated
404
+ - Component dependencies resolved
405
+ - Storybook entries (optional)
406
+
407
+ ---
408
+
409
+ ### Phase 2: Page Architecture (Cycles 6-10)
410
+ **Goal**: Convert pages from HTML/React to Astro with component composition
411
+
412
+ **Tasks**:
413
+ 1. Create `/web/src/pages/u/` directory
414
+ 2. Create index.astro (beautiful dashboard)
415
+ 3. Create wallets.astro, tokens.astro, contracts.astro, products.astro, transactions.astro
416
+ 4. Create dynamic routes for detail pages ([walletId], [tokenId], etc.)
417
+ 5. Implement layout inheritance
418
+
419
+ **Deliverables**:
420
+ - 6 main pages + 5 detail page templates
421
+ - Navigation structure
422
+ - Layout components
423
+
424
+ ---
425
+
426
+ ### Phase 3: Backend Integration (Cycles 11-15)
427
+ **Goal**: Implement Convex queries/mutations for merchant operations
428
+
429
+ **Tasks**:
430
+ 1. Extend schema.ts with merchant-specific tables
431
+ 2. Create queries: merchant-config.ts, merchant-addresses.ts, etc.
432
+ 3. Create mutations: merchant-register.ts, merchant-sweep.ts, etc.
433
+ 4. Implement transaction history queries
434
+ 5. Add webhook support for payment notifications
435
+
436
+ **Deliverables**:
437
+ - Merchant Convex queries/mutations
438
+ - Real-time subscription support
439
+ - Transaction history tracking
440
+
441
+ ---
442
+
443
+ ### Phase 4: API Endpoints (Cycles 16-20)
444
+ **Goal**: Create serverless API endpoints for dashboard
445
+
446
+ **Tasks**:
447
+ 1. Create /api/merchant/config endpoint
448
+ 2. Create /api/merchant/wallets endpoint
449
+ 3. Create /api/merchant/tokens endpoint
450
+ 4. Create /api/merchant/contracts endpoint
451
+ 5. Create /api/merchant/products endpoint
452
+ 6. Create /api/merchant/transactions endpoint
453
+
454
+ **Deliverables**:
455
+ - 6 API endpoints
456
+ - Authentication/authorization
457
+ - Rate limiting
458
+
459
+ ---
460
+
461
+ ### Phase 5: Dashboard Integration (Cycles 21-25)
462
+ **Goal**: Wire up beautiful, fast dashboard UI with real data
463
+
464
+ **Tasks**:
465
+ 1. Build DashboardCard component system
466
+ 2. Create index page with card grid layout
467
+ 3. Implement wallet card with balance
468
+ 4. Implement token card with supply/holders
469
+ 5. Implement contract card with ABI explorer
470
+ 6. Implement product card with pricing
471
+ 7. Implement transaction card with status
472
+ 8. Add filters, search, pagination
473
+
474
+ **Deliverables**:
475
+ - Fully functional merchant dashboard
476
+ - Real-time data updates
477
+ - Beautiful UI matching ONE brand
478
+
479
+ ---
480
+
481
+ ### Phase 6: Pay.one.ie Integration (Cycles 26-30)
482
+ **Goal**: Integrate existing pay.one.ie/merchant code into ONE platform
483
+
484
+ **Tasks**:
485
+ 1. Extract merchant HTML from backend/src/index.ts
486
+ 2. Convert HTML to Astro components
487
+ 3. Port all styles to Tailwind v4
488
+ 4. Integrate authentication flow
489
+ 5. Link payment processing to backend
490
+ 6. Test complete flow
491
+
492
+ **Deliverables**:
493
+ - Pay.one.ie merchant dashboard fully integrated
494
+ - Authentication working
495
+ - Payments processing end-to-end
496
+
497
+ ---
498
+
499
+ ## 🔑 Key Features
500
+
501
+ ### Index Dashboard (Beautiful Overview)
502
+ - **Card Grid Layout**: 5 main cards (Wallets, Tokens, Contracts, Products, Transactions)
503
+ - **Quick Stats**: Total balance, transaction volume, active wallets
504
+ - **Recent Activity**: Last 5 transactions with timestamps
505
+ - **Action Buttons**: Quick access to common operations
506
+ - **Responsive**: Mobile-first, beautiful on all devices
507
+
508
+ ### Wallets Page
509
+ - List of all merchant wallets by chain
510
+ - Balance display with USD conversion
511
+ - Import/generate new wallet
512
+ - Sweep functionality for derived wallets
513
+ - QR code for sharing address
514
+ - Transaction history per wallet
515
+
516
+ ### Tokens Page
517
+ - List of deployed tokens (ERC-20, SPL, Move, etc.)
518
+ - Token metadata (name, symbol, supply, decimals)
519
+ - Holders list
520
+ - Burn/mint operations
521
+ - Token contract verification
522
+
523
+ ### Contracts Page
524
+ - Smart contracts deployed or connected
525
+ - Network and address display
526
+ - ABI explorer and interaction
527
+ - Function call interface
528
+ - Contract verification status
529
+
530
+ ### Products Page
531
+ - Product catalog
532
+ - Payment links for each product
533
+ - Pricing management
534
+ - Inventory tracking
535
+ - Sales analytics
536
+
537
+ ### Transactions Page
538
+ - Complete payment history
539
+ - Filter by status (pending, confirmed, failed)
540
+ - Filter by chain
541
+ - Search by tx hash
542
+ - Export CSV/JSON
543
+
544
+ ---
545
+
546
+ ## 📦 File Copy Matrix
547
+
548
+ | Source | Destination | Type | Action |
549
+ |--------|-------------|------|--------|
550
+ | `one-core/frontend/Claim.tsx` | `web/src/components/merchant/Claim.tsx` | Component | Copy + Update imports |
551
+ | `one-core/frontend/ClaimProvider.tsx` | `web/src/components/merchant/ClaimProvider.tsx` | Provider | Copy + Update imports |
552
+ | `one-core/frontend/ClaimWithDappKit.tsx` | `web/src/components/merchant/ClaimWithDappKit.tsx` | Component | Copy + Update imports |
553
+ | `one-core/frontend/Pay.tsx` | `web/src/components/payment/Pay.tsx` | Component | Copy + Update imports |
554
+ | `one-core/frontend/PayOpen.tsx` | `web/src/components/payment/PayOpen.tsx` | Component | Copy + Update imports |
555
+ | `one-core/frontend/WalletDashboard.tsx` | `web/src/components/merchant/WalletDashboard.tsx` | Component | Copy + Extract logic |
556
+ | `one-core/frontend/School.tsx` | `web/src/components/forms/School.tsx` | Component | Copy + Update imports |
557
+ | `one-core/frontend/ZkLogin.tsx` | `web/src/components/auth/ZkLogin.tsx` | Component | Copy + Update imports |
558
+ | `one-core/frontend/school.html` | `web/src/pages/u/school.astro` | Page | Convert HTML → Astro |
559
+ | `one-core/frontend/index.ts` | `web/src/lib/merchant-exports.ts` | Module | Adapt exports |
560
+ | `one-core/backend/src/merchant.ts` | `backend/convex/mutations/merchant.ts` | Service | Adapt to Convex |
561
+ | `one-core/backend/src/index.ts` (merchant HTML) | `web/src/pages/u/index.astro` | Page | Extract + Convert |
562
+
563
+ ---
564
+
565
+ ## 🛠️ Technical Requirements
566
+
567
+ ### Dependencies
568
+ ```json
569
+ {
570
+ "astro": "^5.0",
571
+ "react": "^19.0",
572
+ "tailwindcss": "^4.0",
573
+ "@shadcn/ui": "latest",
574
+ "ethers": "^6.x",
575
+ "@mysten/sui.js": "^0.50+",
576
+ "@solana/web3.js": "^1.x",
577
+ "zustand": "^4.x"
578
+ }
579
+ ```
580
+
581
+ ### Environment Variables
582
+ ```bash
583
+ # Merchant Dashboard
584
+ VITE_MERCHANT_API_URL=https://one.ie/api/merchant
585
+ VITE_CONVEX_URL=https://YOUR.convex.cloud
586
+
587
+ # Blockchain RPC
588
+ VITE_RPC_SUI=https://fullnode.testnet.sui.io
589
+ VITE_RPC_EVM=https://sepolia.base.org
590
+ VITE_RPC_SOL=https://api.devnet.solana.com
591
+ ```
592
+
593
+ ---
594
+
595
+ ## 🔒 Security Considerations
596
+
597
+ 1. **API Key Management**: Merchant API keys in Convex secure storage
598
+ 2. **Private Key Protection**: Never expose merchant private keys to client
599
+ 3. **Rate Limiting**: Implement per-merchant rate limits
600
+ 4. **CORS**: Restrict dashboard to one.ie domain
601
+ 5. **Audit Logging**: Log all merchant actions via event system
602
+ 6. **Signature Verification**: Verify all state-changing operations with signatures
603
+
604
+ ---
605
+
606
+ ## 📊 Success Metrics
607
+
608
+ - ✅ All 100+ components migrated
609
+ - ✅ Dashboard loads in <500ms (Core Web Vitals)
610
+ - ✅ 100% TypeScript coverage
611
+ - ✅ Zero broken imports
612
+ - ✅ Full 6-dimension ontology mapping
613
+ - ✅ 95%+ test coverage for critical paths
614
+ - ✅ Mobile responsive (Lighthouse 95+)
615
+
616
+ ---
617
+
618
+ ## 🚀 Deployment Strategy
619
+
620
+ ### Phase 1: Staging
621
+ 1. Deploy to staging environment
622
+ 2. Run integration tests
623
+ 3. Performance profiling
624
+ 4. Security audit
625
+
626
+ ### Phase 2: Beta
627
+ 1. Limited rollout to 10% of merchants
628
+ 2. Monitor error rates and performance
629
+ 3. Gather feedback
630
+ 4. Iterate based on feedback
631
+
632
+ ### Phase 3: Production
633
+ 1. Full rollout to all merchants
634
+ 2. Monitor all metrics
635
+ 3. Support escalation process
636
+ 4. Continuous optimization
637
+
638
+ ---
639
+
640
+ ## 📖 Documentation
641
+
642
+ All documentation should be created in `/one/knowledge/guides/` following the cascading context system:
643
+
644
+ ```
645
+ /one/
646
+ ├── knowledge/
647
+ │ ├── guides/
648
+ │ │ ├── merchant-dashboard.md # Overview and getting started
649
+ │ │ ├── merchant-components.md # Component documentation
650
+ │ │ ├── merchant-api.md # API reference
651
+ │ │ ├── merchant-setup-astro.md # Setup guide
652
+ │ │ ├── merchant-deployment.md # Deployment guide
653
+ │ │ ├── merchant-security.md # Security best practices
654
+ │ │ └── merchant-ontology.md # 6-dimension mapping
655
+ │ │
656
+ │ └── patterns/
657
+ │ ├── merchant/
658
+ │ │ ├── wallet-management.md
659
+ │ │ ├── payment-processing.md
660
+ │ │ ├── transaction-history.md
661
+ │ │ └── analytics.md
662
+ ```
663
+
664
+ ---
665
+
666
+ ## ⚙️ Configuration Files
667
+
668
+ ### web/src/pages/u/CLAUDE.md
669
+ ```markdown
670
+ # Merchant Dashboard Guidelines
671
+
672
+ ## Navigation Structure
673
+ - /u - Main dashboard
674
+ - /u/wallets - Wallet management
675
+ - /u/tokens - Token inventory
676
+ - /u/contracts - Smart contract management
677
+ - /u/products - Product catalog
678
+ - /u/transactions - Transaction history
679
+ - /u/settings - Merchant settings
680
+
681
+ ## Component Reuse
682
+ Always use components from web/src/components/merchant/
683
+ Never duplicate component logic
684
+
685
+ ## State Management
686
+ Use Convex for data, Zustand for UI state
687
+
688
+ ## Performance
689
+ - Target: <500ms dashboard load
690
+ - Lazy load detail pages
691
+ - Paginate lists (20 items per page)
692
+ ```
693
+
694
+ ---
695
+
696
+ ## 🎓 Related Documentation
697
+
698
+ - **[ONE Architecture](/one/knowledge/architecture.md)** - Full system design
699
+ - **[6-Dimension Ontology](/one/knowledge/ontology.md)** - Data model specification
700
+ - **[Development Workflow](/one/connections/workflow.md)** - 6-phase implementation process
701
+ - **[Frontend Patterns](/one/knowledge/patterns/frontend/)** - React + Astro patterns
702
+ - **[Backend Patterns](/one/knowledge/patterns/backend/)** - Convex patterns
703
+
704
+ ---
705
+
706
+ ## 🔗 Related Projects
707
+
708
+ - **one-core**: Source project with original implementation
709
+ - **ONE Platform (main)**: Target platform where this integrates
710
+ - **pay.one.ie**: Current production deployment
711
+ - **web**: Frontend deployment (Cloudflare Pages)
712
+ - **backend**: Backend deployment (Convex Cloud)
713
+
714
+ ---
715
+
716
+ ## 📊 Summary Statistics
717
+
718
+ ### Total Files to Create/Migrate
719
+
720
+ **From one-core/frontend/**: 8 files
721
+ - Claim.tsx
722
+ - ClaimProvider.tsx
723
+ - ClaimWithDappKit.tsx
724
+ - Pay.tsx
725
+ - PayOpen.tsx
726
+ - WalletDashboard.tsx
727
+ - School.tsx
728
+ - ZkLogin.tsx
729
+
730
+ **Pages**: 23 files
731
+ - 1 layout (layout.astro)
732
+ - 6 main pages (index, wallets, tokens, contracts, products, transactions)
733
+ - 3 settings pages (settings, api-keys, webhooks)
734
+ - 8 detail/sub-pages ([walletId], [tokenId], [contractId], [productId], [txId], create, deploy, connect)
735
+ - 6 API endpoints (.json.ts routes)
736
+
737
+ **Components**: 59 new component files
738
+ - 6 merchant main components (Dashboard, DashboardCard, IndexCards, MerchantNav, ChainSelector, WalletDashboard)
739
+ - 5 wallet components (Card, List, Detail, Balance, Create)
740
+ - 5 token components (Card, List, Detail, Holders, Deploy)
741
+ - 6 contract components (Card, List, Detail, ABIExplorer, Interaction, Connect)
742
+ - 5 product components (Card, List, Detail, Create, Pricing)
743
+ - 5 transaction components (Card, List, Detail, Filter, Export)
744
+ - 3 claim components (Claim, ClaimProvider, ClaimWithDappKit) - migrated
745
+ - 2 payment components (Pay, PayOpen) - migrated
746
+ - 1 form component (School) - migrated
747
+ - 1 auth component (ZkLogin) - migrated
748
+ - 4 widget components (BalanceWidget, StatsPanel, RecentActivity, QuickActions)
749
+
750
+ **Documentation**: 3 files
751
+ - /web/src/pages/u/SETUP.md (setup guide)
752
+ - /one/knowledge/guides/merchant-dashboard.md (overview)
753
+ - /one/knowledge/guides/merchant-setup-astro.md (Astro setup)
754
+
755
+ **Total New Files**: 90+ files (59 components + 23 pages + 8 migrated + docs)
756
+
757
+ ---
758
+
759
+ ## 🎯 Component Organization Summary
760
+
761
+ ### /web/src/components/merchant/
762
+ **Core Dashboard Components** (6)
763
+ - Dashboard.tsx - Main container
764
+ - DashboardCard.tsx - Reusable card
765
+ - IndexCards.tsx - 5-card grid
766
+ - MerchantNav.tsx - Navigation
767
+ - ChainSelector.tsx - Network selector
768
+ - WalletDashboard.tsx - Wallet management
769
+
770
+ **Wallet Components** (5)
771
+ - WalletCard.tsx
772
+ - WalletList.tsx
773
+ - WalletDetail.tsx
774
+ - WalletBalance.tsx
775
+ - CreateWallet.tsx
776
+
777
+ **Token Components** (5)
778
+ - TokenCard.tsx
779
+ - TokenList.tsx
780
+ - TokenDetail.tsx
781
+ - TokenHolders.tsx
782
+ - DeployToken.tsx
783
+
784
+ **Contract Components** (6)
785
+ - ContractCard.tsx
786
+ - ContractList.tsx
787
+ - ContractDetail.tsx
788
+ - ABIExplorer.tsx
789
+ - ContractInteraction.tsx
790
+ - ConnectContract.tsx
791
+
792
+ **Product Components** (5)
793
+ - ProductCard.tsx
794
+ - ProductList.tsx
795
+ - ProductDetail.tsx
796
+ - CreateProduct.tsx
797
+ - ProductPricing.tsx
798
+
799
+ **Transaction Components** (5)
800
+ - TransactionCard.tsx
801
+ - TransactionList.tsx
802
+ - TransactionDetail.tsx
803
+ - TransactionFilter.tsx
804
+ - TransactionExport.tsx
805
+
806
+ **Widget Components** (4)
807
+ - BalanceWidget.tsx
808
+ - StatsPanel.tsx
809
+ - RecentActivity.tsx
810
+ - QuickActions.tsx
811
+
812
+ **Claim Components** (3) - From one-core
813
+ - Claim.tsx
814
+ - ClaimProvider.tsx
815
+ - ClaimWithDappKit.tsx
816
+
817
+ ### /web/src/components/payment/
818
+ - Pay.tsx (migrated)
819
+ - PayOpen.tsx (migrated)
820
+
821
+ ### /web/src/components/forms/
822
+ - School.tsx (migrated)
823
+
824
+ ### /web/src/components/auth/
825
+ - ZkLogin.tsx (migrated)
826
+
827
+ ---
828
+
829
+ ## 🗂️ Pages Organization Summary
830
+
831
+ ### /web/src/pages/u/
832
+ **Root Pages** (1)
833
+ - index.astro - Main dashboard with 5-card overview
834
+ - layout.astro - Shared layout
835
+
836
+ **Wallets** (3)
837
+ - wallets.astro - List all wallets
838
+ - wallets/[walletId].astro - Individual wallet detail
839
+ - wallets/create.astro - Create/import wallet
840
+
841
+ **Tokens** (3)
842
+ - tokens.astro - List all tokens
843
+ - tokens/[tokenId].astro - Token detail with metadata
844
+ - tokens/deploy.astro - Deploy new token form
845
+
846
+ **Contracts** (3)
847
+ - contracts.astro - List all contracts
848
+ - contracts/[contractId].astro - Contract detail + ABI
849
+ - contracts/connect.astro - Connect existing contract
850
+
851
+ **Products** (3)
852
+ - products.astro - Product catalog
853
+ - products/[productId].astro - Individual product
854
+ - products/create.astro - Create new product
855
+
856
+ **Transactions** (2)
857
+ - transactions.astro - Transaction history with filters
858
+ - transactions/[txId].astro - Transaction detail
859
+
860
+ **Settings** (3)
861
+ - settings.astro - Main settings
862
+ - settings/api-keys.astro - API key management
863
+ - settings/webhooks.astro - Webhook configuration
864
+
865
+ ### /web/src/pages/api/merchant/
866
+ - config.json.ts
867
+ - wallets.json.ts
868
+ - tokens.json.ts
869
+ - contracts.json.ts
870
+ - products.json.ts
871
+ - transactions.json.ts
872
+
873
+ ---
874
+
875
+ ## 🚀 Next Steps After Plan
876
+
877
+ 1. **Copy 8 files** from one-core/frontend/ to web/src/components/
878
+ 2. **Create 59 new components** (stub implementations with types)
879
+ 3. **Create 23 pages** in /web/src/pages/u/
880
+ 4. **Create 6 API endpoints** in /web/src/pages/api/merchant/
881
+ 5. **Extract pay.one.ie merchant HTML** from backend/src/index.ts
882
+ 6. **Create Convex backend** for merchant operations
883
+ 7. **Wire up data flows** between components and API
884
+ 8. **Build merchant settings** and configuration UI
885
+
886
+ ---
887
+
888
+ ## 📝 Version History
889
+
890
+ | Version | Date | Changes |
891
+ |---------|------|---------|
892
+ | 1.1.0 | 2025-12-05 | Added detailed file mapping tables and component organization |
893
+ | 1.0.0 | 2025-12-05 | Initial plan created |
894
+
895
+ ---
896
+
897
+ ## 👥 Contributors
898
+
899
+ - @claude-code - Plan creation and guidance
900
+
901
+ ---
902
+
903
+ ## 📞 Questions?
904
+
905
+ Refer to `/one/knowledge/` for detailed guides on each component, or review the subdirectory CLAUDE.md files for layer-specific guidance.