nitrostack 1.0.0 → 1.0.2
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 +30 -0
- package/dist/cli/index.js +4 -1
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/src/studio/README.md +140 -0
- package/src/studio/app/api/auth/fetch-metadata/route.ts +71 -0
- package/src/studio/app/api/auth/register-client/route.ts +67 -0
- package/src/studio/app/api/chat/route.ts +123 -0
- package/src/studio/app/api/health/checks/route.ts +42 -0
- package/src/studio/app/api/health/route.ts +13 -0
- package/src/studio/app/api/init/route.ts +85 -0
- package/src/studio/app/api/ping/route.ts +13 -0
- package/src/studio/app/api/prompts/[name]/route.ts +21 -0
- package/src/studio/app/api/prompts/route.ts +13 -0
- package/src/studio/app/api/resources/[...uri]/route.ts +18 -0
- package/src/studio/app/api/resources/route.ts +13 -0
- package/src/studio/app/api/roots/route.ts +13 -0
- package/src/studio/app/api/sampling/route.ts +14 -0
- package/src/studio/app/api/tools/[name]/call/route.ts +41 -0
- package/src/studio/app/api/tools/route.ts +23 -0
- package/src/studio/app/api/widget-examples/route.ts +44 -0
- package/src/studio/app/auth/callback/page.tsx +160 -0
- package/src/studio/app/auth/page.tsx +543 -0
- package/src/studio/app/chat/page.tsx +530 -0
- package/src/studio/app/chat/page.tsx.backup +390 -0
- package/src/studio/app/globals.css +410 -0
- package/src/studio/app/health/page.tsx +177 -0
- package/src/studio/app/layout.tsx +48 -0
- package/src/studio/app/page.tsx +337 -0
- package/src/studio/app/page.tsx.backup +346 -0
- package/src/studio/app/ping/page.tsx +204 -0
- package/src/studio/app/prompts/page.tsx +228 -0
- package/src/studio/app/resources/page.tsx +313 -0
- package/src/studio/components/EnlargeModal.tsx +116 -0
- package/src/studio/components/Sidebar.tsx +133 -0
- package/src/studio/components/ToolCard.tsx +108 -0
- package/src/studio/components/WidgetRenderer.tsx +99 -0
- package/src/studio/lib/api.ts +207 -0
- package/src/studio/lib/llm-service.ts +361 -0
- package/src/studio/lib/mcp-client.ts +168 -0
- package/src/studio/lib/store.ts +192 -0
- package/src/studio/lib/theme-provider.tsx +50 -0
- package/src/studio/lib/types.ts +107 -0
- package/src/studio/lib/widget-loader.ts +90 -0
- package/src/studio/middleware.ts +27 -0
- package/src/studio/next.config.js +16 -0
- package/src/studio/package-lock.json +2696 -0
- package/src/studio/package.json +34 -0
- package/src/studio/postcss.config.mjs +10 -0
- package/src/studio/tailwind.config.ts +67 -0
- package/src/studio/tsconfig.json +41 -0
- package/templates/typescript-auth/.env.example +23 -0
- package/templates/typescript-auth/src/app.module.ts +103 -0
- package/templates/typescript-auth/src/db/database.ts +163 -0
- package/templates/typescript-auth/src/db/seed.ts +374 -0
- package/templates/typescript-auth/src/db/setup.ts +87 -0
- package/templates/typescript-auth/src/events/analytics.service.ts +52 -0
- package/templates/typescript-auth/src/events/notification.service.ts +40 -0
- package/templates/typescript-auth/src/filters/global-exception.filter.ts +28 -0
- package/templates/typescript-auth/src/guards/README.md +75 -0
- package/templates/typescript-auth/src/guards/jwt.guard.ts +105 -0
- package/templates/typescript-auth/src/health/database.health.ts +41 -0
- package/templates/typescript-auth/src/index.ts +26 -0
- package/templates/typescript-auth/src/interceptors/transform.interceptor.ts +24 -0
- package/templates/typescript-auth/src/middleware/logging.middleware.ts +42 -0
- package/templates/typescript-auth/src/modules/addresses/addresses.module.ts +16 -0
- package/templates/typescript-auth/src/modules/addresses/addresses.prompts.ts +114 -0
- package/templates/typescript-auth/src/modules/addresses/addresses.resources.ts +40 -0
- package/templates/typescript-auth/src/modules/addresses/addresses.tools.ts +241 -0
- package/templates/typescript-auth/src/modules/auth/auth.module.ts +16 -0
- package/templates/typescript-auth/src/modules/auth/auth.prompts.ts +147 -0
- package/templates/typescript-auth/src/modules/auth/auth.resources.ts +84 -0
- package/templates/typescript-auth/src/modules/auth/auth.tools.ts +139 -0
- package/templates/typescript-auth/src/modules/cart/cart.module.ts +16 -0
- package/templates/typescript-auth/src/modules/cart/cart.prompts.ts +95 -0
- package/templates/typescript-auth/src/modules/cart/cart.resources.ts +44 -0
- package/templates/typescript-auth/src/modules/cart/cart.tools.ts +281 -0
- package/templates/typescript-auth/src/modules/orders/orders.module.ts +16 -0
- package/templates/typescript-auth/src/modules/orders/orders.prompts.ts +88 -0
- package/templates/typescript-auth/src/modules/orders/orders.resources.ts +48 -0
- package/templates/typescript-auth/src/modules/orders/orders.tools.ts +281 -0
- package/templates/typescript-auth/src/modules/products/products.module.ts +16 -0
- package/templates/typescript-auth/src/modules/products/products.prompts.ts +146 -0
- package/templates/typescript-auth/src/modules/products/products.resources.ts +98 -0
- package/templates/typescript-auth/src/modules/products/products.tools.ts +266 -0
- package/templates/typescript-auth/src/pipes/validation.pipe.ts +42 -0
- package/templates/typescript-auth/src/services/database.service.ts +90 -0
- package/templates/typescript-auth/src/widgets/app/add-to-cart/page.tsx +122 -0
- package/templates/typescript-auth/src/widgets/app/address-added/page.tsx +116 -0
- package/templates/typescript-auth/src/widgets/app/address-deleted/page.tsx +105 -0
- package/templates/typescript-auth/src/widgets/app/address-list/page.tsx +139 -0
- package/templates/typescript-auth/src/widgets/app/address-updated/page.tsx +153 -0
- package/templates/typescript-auth/src/widgets/app/cart-cleared/page.tsx +86 -0
- package/templates/typescript-auth/src/widgets/app/cart-updated/page.tsx +116 -0
- package/templates/typescript-auth/src/widgets/app/categories/page.tsx +134 -0
- package/templates/typescript-auth/src/widgets/app/layout.tsx +21 -0
- package/templates/typescript-auth/src/widgets/app/login-result/page.tsx +129 -0
- package/templates/typescript-auth/src/widgets/app/order-confirmation/page.tsx +206 -0
- package/templates/typescript-auth/src/widgets/app/order-details/page.tsx +225 -0
- package/templates/typescript-auth/src/widgets/app/order-history/page.tsx +218 -0
- package/templates/typescript-auth/src/widgets/app/product-card/page.tsx +121 -0
- package/templates/typescript-auth/src/widgets/app/products-grid/page.tsx +173 -0
- package/templates/typescript-auth/src/widgets/app/shopping-cart/page.tsx +187 -0
- package/templates/typescript-auth/src/widgets/app/whoami/page.tsx +165 -0
- package/templates/typescript-auth/src/widgets/next.config.js +38 -0
- package/templates/typescript-auth/src/widgets/package.json +18 -0
- package/templates/typescript-auth/src/widgets/styles/ecommerce.ts +169 -0
- package/templates/typescript-auth/src/widgets/tsconfig.json +28 -0
- package/templates/typescript-auth/src/widgets/types/tool-data.ts +141 -0
- package/templates/typescript-auth/src/widgets/widget-manifest.json +464 -0
- package/templates/typescript-auth/tsconfig.json +27 -0
- package/templates/typescript-auth-api-key/.env +15 -0
- package/templates/typescript-auth-api-key/.env.example +4 -0
- package/templates/typescript-auth-api-key/src/app.module.ts +38 -0
- package/templates/typescript-auth-api-key/src/guards/apikey.guard.ts +47 -0
- package/templates/typescript-auth-api-key/src/guards/multi-auth.guard.ts +157 -0
- package/templates/typescript-auth-api-key/src/health/system.health.ts +55 -0
- package/templates/typescript-auth-api-key/src/index.ts +47 -0
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.module.ts +12 -0
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.prompts.ts +73 -0
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.resources.ts +60 -0
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.tools.ts +71 -0
- package/templates/typescript-auth-api-key/src/modules/demo/demo.module.ts +18 -0
- package/templates/typescript-auth-api-key/src/modules/demo/demo.tools.ts +155 -0
- package/templates/typescript-auth-api-key/src/modules/demo/multi-auth.tools.ts +123 -0
- package/templates/typescript-auth-api-key/src/widgets/app/calculator-operations/page.tsx +133 -0
- package/templates/typescript-auth-api-key/src/widgets/app/calculator-result/page.tsx +134 -0
- package/templates/typescript-auth-api-key/src/widgets/app/layout.tsx +14 -0
- package/templates/typescript-auth-api-key/src/widgets/next.config.js +37 -0
- package/templates/typescript-auth-api-key/src/widgets/package.json +24 -0
- package/templates/typescript-auth-api-key/src/widgets/tsconfig.json +28 -0
- package/templates/typescript-auth-api-key/src/widgets/widget-manifest.json +48 -0
- package/templates/typescript-auth-api-key/tsconfig.json +23 -0
- package/templates/typescript-oauth/.env.example +91 -0
- package/templates/typescript-oauth/src/app.module.ts +89 -0
- package/templates/typescript-oauth/src/guards/oauth.guard.ts +127 -0
- package/templates/typescript-oauth/src/index.ts +74 -0
- package/templates/typescript-oauth/src/modules/demo/demo.module.ts +16 -0
- package/templates/typescript-oauth/src/modules/demo/demo.tools.ts +190 -0
- package/templates/typescript-oauth/src/widgets/app/calculator-operations/page.tsx +133 -0
- package/templates/typescript-oauth/src/widgets/app/calculator-result/page.tsx +134 -0
- package/templates/typescript-oauth/src/widgets/app/layout.tsx +14 -0
- package/templates/typescript-oauth/src/widgets/next.config.js +37 -0
- package/templates/typescript-oauth/src/widgets/package.json +24 -0
- package/templates/typescript-oauth/src/widgets/tsconfig.json +28 -0
- package/templates/typescript-oauth/src/widgets/widget-manifest.json +48 -0
- package/templates/typescript-oauth/tsconfig.json +23 -0
- package/templates/typescript-starter/.env.example +4 -0
- package/templates/typescript-starter/src/app.module.ts +34 -0
- package/templates/typescript-starter/src/health/system.health.ts +55 -0
- package/templates/typescript-starter/src/index.ts +27 -0
- package/templates/typescript-starter/src/modules/calculator/calculator.module.ts +12 -0
- package/templates/typescript-starter/src/modules/calculator/calculator.prompts.ts +73 -0
- package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +60 -0
- package/templates/typescript-starter/src/modules/calculator/calculator.tools.ts +71 -0
- package/templates/typescript-starter/src/widgets/app/calculator-operations/page.tsx +133 -0
- package/templates/typescript-starter/src/widgets/app/calculator-result/page.tsx +134 -0
- package/templates/typescript-starter/src/widgets/app/layout.tsx +14 -0
- package/templates/typescript-starter/src/widgets/next.config.js +37 -0
- package/templates/typescript-starter/src/widgets/package.json +24 -0
- package/templates/typescript-starter/src/widgets/tsconfig.json +28 -0
- package/templates/typescript-starter/src/widgets/widget-manifest.json +48 -0
- package/templates/typescript-starter/tsconfig.json +23 -0
- package/LICENSE_URLS_UPDATE_COMPLETE.md +0 -388
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import * as styles from '../../styles/ecommerce';
|
|
5
|
+
|
|
6
|
+
interface Category {
|
|
7
|
+
name: string;
|
|
8
|
+
productCount: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CategoriesData {
|
|
12
|
+
categories: Category[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const categoryIcons: Record<string, string> = {
|
|
16
|
+
'Beauty': '💄',
|
|
17
|
+
'Fragrances': '🌸',
|
|
18
|
+
'Furniture': '🛋️',
|
|
19
|
+
'Groceries': '🛒',
|
|
20
|
+
'Home Decoration': '🏠',
|
|
21
|
+
'Kitchen Accessories': '🍳',
|
|
22
|
+
'Laptops': '💻',
|
|
23
|
+
'Mens Shirts': '👔',
|
|
24
|
+
'Mens Shoes': '👞',
|
|
25
|
+
'Mens Watches': '⌚',
|
|
26
|
+
'Mobile Accessories': '📱',
|
|
27
|
+
'Motorcycle': '🏍️',
|
|
28
|
+
'Skin Care': '✨',
|
|
29
|
+
'Smartphones': '📱',
|
|
30
|
+
'Sports Accessories': '⚽',
|
|
31
|
+
'Sunglasses': '🕶️',
|
|
32
|
+
'Tablets': '📱',
|
|
33
|
+
'Tops': '👕',
|
|
34
|
+
'Vehicle': '🚗',
|
|
35
|
+
'Womens Bags': '👜',
|
|
36
|
+
'Womens Dresses': '👗',
|
|
37
|
+
'Womens Jewellery': '💎',
|
|
38
|
+
'Womens Shoes': '👠',
|
|
39
|
+
'Womens Watches': '⌚'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function CategoriesWidget({ data }: { data: CategoriesData }) {
|
|
43
|
+
const { categories } = data;
|
|
44
|
+
|
|
45
|
+
if (!categories || categories.length === 0) {
|
|
46
|
+
return (
|
|
47
|
+
<div style={styles.containerStyle}>
|
|
48
|
+
<div style={styles.emptyStateStyle}>
|
|
49
|
+
<div style={{ fontSize: '64px', marginBottom: styles.spacing.lg }}>
|
|
50
|
+
🏷️
|
|
51
|
+
</div>
|
|
52
|
+
<h3 style={{
|
|
53
|
+
fontSize: styles.typography.fontSize.xl,
|
|
54
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
55
|
+
color: styles.colors.gray[700],
|
|
56
|
+
marginBottom: styles.spacing.sm,
|
|
57
|
+
}}>
|
|
58
|
+
No categories available
|
|
59
|
+
</h3>
|
|
60
|
+
<p style={styles.metaTextStyle}>
|
|
61
|
+
Categories will appear here once they're added
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div style={styles.containerStyle}>
|
|
70
|
+
<div style={{
|
|
71
|
+
...styles.titleStyle,
|
|
72
|
+
marginBottom: styles.spacing.xl,
|
|
73
|
+
}}>
|
|
74
|
+
<span>🏷️ Product Categories</span>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div style={{
|
|
78
|
+
display: 'grid',
|
|
79
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
|
|
80
|
+
gap: styles.spacing.lg,
|
|
81
|
+
}}>
|
|
82
|
+
{categories.map((category) => {
|
|
83
|
+
const icon = categoryIcons[category.name] || '📦';
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
key={category.name}
|
|
87
|
+
style={{
|
|
88
|
+
...styles.cardStyle,
|
|
89
|
+
cursor: 'pointer',
|
|
90
|
+
textAlign: 'center',
|
|
91
|
+
padding: styles.spacing.xl,
|
|
92
|
+
}}
|
|
93
|
+
onMouseEnter={(e) => {
|
|
94
|
+
e.currentTarget.style.transform = 'translateY(-4px)';
|
|
95
|
+
e.currentTarget.style.boxShadow = styles.shadows.xl;
|
|
96
|
+
e.currentTarget.style.borderColor = styles.colors.primary;
|
|
97
|
+
}}
|
|
98
|
+
onMouseLeave={(e) => {
|
|
99
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
100
|
+
e.currentTarget.style.boxShadow = styles.shadows.md;
|
|
101
|
+
e.currentTarget.style.borderColor = styles.colors.gray[200];
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<div style={{
|
|
105
|
+
fontSize: '48px',
|
|
106
|
+
marginBottom: styles.spacing.md,
|
|
107
|
+
}}>
|
|
108
|
+
{icon}
|
|
109
|
+
</div>
|
|
110
|
+
<div style={{
|
|
111
|
+
fontSize: styles.typography.fontSize.lg,
|
|
112
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
113
|
+
color: styles.colors.gray[900],
|
|
114
|
+
marginBottom: styles.spacing.xs,
|
|
115
|
+
}}>
|
|
116
|
+
{category.name}
|
|
117
|
+
</div>
|
|
118
|
+
<div style={{
|
|
119
|
+
...styles.badgeStyle,
|
|
120
|
+
background: `${styles.colors.primary}15`,
|
|
121
|
+
color: styles.colors.gray[700],
|
|
122
|
+
border: `1px solid ${styles.colors.primary}30`,
|
|
123
|
+
}}>
|
|
124
|
+
{category.productCount} products
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
})}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default withToolData<CategoriesData>(CategoriesWidget);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
|
|
3
|
+
export const metadata: Metadata = {
|
|
4
|
+
title: 'E-commerce Widgets',
|
|
5
|
+
description: 'UI components for e-commerce MCP server',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default function RootLayout({
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<body style={{ margin: 0, padding: 0 }}>
|
|
16
|
+
{children}
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import { LoginResult } from '../../types/tool-data';
|
|
5
|
+
import * as styles from '../../styles/ecommerce';
|
|
6
|
+
|
|
7
|
+
function LoginResultWidget({ data }: { data: LoginResult }) {
|
|
8
|
+
const { user, token, message } = data;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div style={styles.containerStyle}>
|
|
12
|
+
<div style={{
|
|
13
|
+
...styles.cardStyle,
|
|
14
|
+
maxWidth: '500px',
|
|
15
|
+
margin: '0 auto',
|
|
16
|
+
}}>
|
|
17
|
+
<div style={{
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
marginBottom: styles.spacing['2xl'],
|
|
20
|
+
}}>
|
|
21
|
+
<div style={{
|
|
22
|
+
width: '80px',
|
|
23
|
+
height: '80px',
|
|
24
|
+
margin: '0 auto 16px',
|
|
25
|
+
borderRadius: styles.borderRadius.full,
|
|
26
|
+
background: `linear-gradient(135deg, ${styles.colors.primary} 0%, ${styles.colors.primaryHover} 100%)`,
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
fontSize: '36px',
|
|
31
|
+
}}>
|
|
32
|
+
✓
|
|
33
|
+
</div>
|
|
34
|
+
<h2 style={{
|
|
35
|
+
fontSize: styles.typography.fontSize['2xl'],
|
|
36
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
37
|
+
color: styles.colors.gray[900],
|
|
38
|
+
marginBottom: styles.spacing.sm,
|
|
39
|
+
}}>
|
|
40
|
+
Welcome Back!
|
|
41
|
+
</h2>
|
|
42
|
+
<p style={{
|
|
43
|
+
fontSize: styles.typography.fontSize.base,
|
|
44
|
+
color: styles.colors.gray[600],
|
|
45
|
+
}}>
|
|
46
|
+
{message}
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div style={{
|
|
51
|
+
background: styles.colors.gray[50],
|
|
52
|
+
borderRadius: styles.borderRadius.md,
|
|
53
|
+
padding: styles.spacing.lg,
|
|
54
|
+
marginBottom: styles.spacing.lg,
|
|
55
|
+
}}>
|
|
56
|
+
<div style={{
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
gap: styles.spacing.md,
|
|
60
|
+
marginBottom: styles.spacing.md,
|
|
61
|
+
}}>
|
|
62
|
+
{user.profile_picture && (
|
|
63
|
+
<img
|
|
64
|
+
src={user.profile_picture}
|
|
65
|
+
alt={user.name}
|
|
66
|
+
style={{
|
|
67
|
+
width: '60px',
|
|
68
|
+
height: '60px',
|
|
69
|
+
borderRadius: styles.borderRadius.full,
|
|
70
|
+
objectFit: 'cover',
|
|
71
|
+
border: `3px solid ${styles.colors.primary}`,
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
<div>
|
|
76
|
+
<div style={{
|
|
77
|
+
fontSize: styles.typography.fontSize.lg,
|
|
78
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
79
|
+
color: styles.colors.gray[900],
|
|
80
|
+
}}>
|
|
81
|
+
{user.name}
|
|
82
|
+
</div>
|
|
83
|
+
<div style={styles.metaTextStyle}>
|
|
84
|
+
{user.email}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div style={{
|
|
91
|
+
background: styles.colors.gray[900],
|
|
92
|
+
borderRadius: styles.borderRadius.md,
|
|
93
|
+
padding: styles.spacing.md,
|
|
94
|
+
}}>
|
|
95
|
+
<div style={{
|
|
96
|
+
fontSize: styles.typography.fontSize.xs,
|
|
97
|
+
color: styles.colors.gray[400],
|
|
98
|
+
marginBottom: styles.spacing.xs,
|
|
99
|
+
}}>
|
|
100
|
+
Authentication Token
|
|
101
|
+
</div>
|
|
102
|
+
<div style={{
|
|
103
|
+
fontSize: styles.typography.fontSize.xs,
|
|
104
|
+
fontFamily: 'monospace',
|
|
105
|
+
color: styles.colors.primary,
|
|
106
|
+
wordBreak: 'break-all',
|
|
107
|
+
lineHeight: styles.typography.lineHeight.relaxed,
|
|
108
|
+
}}>
|
|
109
|
+
{token.substring(0, 50)}...
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<div style={{
|
|
114
|
+
marginTop: styles.spacing.lg,
|
|
115
|
+
padding: styles.spacing.md,
|
|
116
|
+
background: `rgba(${parseInt(styles.colors.primary.slice(1, 3), 16)}, ${parseInt(styles.colors.primary.slice(3, 5), 16)}, ${parseInt(styles.colors.primary.slice(5, 7), 16)}, 0.1)`,
|
|
117
|
+
borderRadius: styles.borderRadius.md,
|
|
118
|
+
fontSize: styles.typography.fontSize.sm,
|
|
119
|
+
color: styles.colors.gray[700],
|
|
120
|
+
textAlign: 'center',
|
|
121
|
+
}}>
|
|
122
|
+
🔒 Token stored securely in local storage
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default withToolData<LoginResult>(LoginResultWidget);
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import { OrderConfirmationData } from '../../types/tool-data';
|
|
5
|
+
import * as styles from '../../styles/ecommerce';
|
|
6
|
+
|
|
7
|
+
function OrderConfirmationWidget({ data }: { data: OrderConfirmationData }) {
|
|
8
|
+
const { order, message } = data;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div style={styles.containerStyle}>
|
|
12
|
+
<div style={{
|
|
13
|
+
...styles.cardStyle,
|
|
14
|
+
maxWidth: '700px',
|
|
15
|
+
margin: '0 auto',
|
|
16
|
+
}}>
|
|
17
|
+
<div style={{
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
marginBottom: styles.spacing['2xl'],
|
|
20
|
+
}}>
|
|
21
|
+
<div style={{
|
|
22
|
+
width: '80px',
|
|
23
|
+
height: '80px',
|
|
24
|
+
margin: '0 auto 16px',
|
|
25
|
+
borderRadius: styles.borderRadius.full,
|
|
26
|
+
background: styles.colors.success,
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
fontSize: '40px',
|
|
31
|
+
}}>
|
|
32
|
+
✓
|
|
33
|
+
</div>
|
|
34
|
+
<h2 style={{
|
|
35
|
+
fontSize: styles.typography.fontSize['2xl'],
|
|
36
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
37
|
+
color: styles.colors.gray[900],
|
|
38
|
+
marginBottom: styles.spacing.sm,
|
|
39
|
+
}}>
|
|
40
|
+
Order Confirmed!
|
|
41
|
+
</h2>
|
|
42
|
+
<p style={{
|
|
43
|
+
fontSize: styles.typography.fontSize.base,
|
|
44
|
+
color: styles.colors.gray[600],
|
|
45
|
+
}}>
|
|
46
|
+
{message}
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div style={{
|
|
51
|
+
background: styles.colors.gray[50],
|
|
52
|
+
borderRadius: styles.borderRadius.md,
|
|
53
|
+
padding: styles.spacing.lg,
|
|
54
|
+
marginBottom: styles.spacing.lg,
|
|
55
|
+
}}>
|
|
56
|
+
<div style={{
|
|
57
|
+
display: 'grid',
|
|
58
|
+
gridTemplateColumns: '1fr 1fr',
|
|
59
|
+
gap: styles.spacing.lg,
|
|
60
|
+
}}>
|
|
61
|
+
<div>
|
|
62
|
+
<div style={{
|
|
63
|
+
fontSize: styles.typography.fontSize.xs,
|
|
64
|
+
color: styles.colors.gray[500],
|
|
65
|
+
marginBottom: styles.spacing.xs,
|
|
66
|
+
textTransform: 'uppercase',
|
|
67
|
+
letterSpacing: '0.5px',
|
|
68
|
+
}}>
|
|
69
|
+
Order ID
|
|
70
|
+
</div>
|
|
71
|
+
<div style={{
|
|
72
|
+
fontSize: styles.typography.fontSize.base,
|
|
73
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
74
|
+
color: styles.colors.gray[900],
|
|
75
|
+
fontFamily: 'monospace',
|
|
76
|
+
}}>
|
|
77
|
+
#{order.id.substring(0, 8).toUpperCase()}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div>
|
|
81
|
+
<div style={{
|
|
82
|
+
fontSize: styles.typography.fontSize.xs,
|
|
83
|
+
color: styles.colors.gray[500],
|
|
84
|
+
marginBottom: styles.spacing.xs,
|
|
85
|
+
textTransform: 'uppercase',
|
|
86
|
+
letterSpacing: '0.5px',
|
|
87
|
+
}}>
|
|
88
|
+
Status
|
|
89
|
+
</div>
|
|
90
|
+
<div style={{
|
|
91
|
+
...styles.badgeStyle,
|
|
92
|
+
background: styles.colors.primary,
|
|
93
|
+
color: styles.colors.black,
|
|
94
|
+
}}>
|
|
95
|
+
{order.status}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div style={{ marginBottom: styles.spacing.lg }}>
|
|
102
|
+
<h3 style={{
|
|
103
|
+
fontSize: styles.typography.fontSize.lg,
|
|
104
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
105
|
+
color: styles.colors.gray[900],
|
|
106
|
+
marginBottom: styles.spacing.md,
|
|
107
|
+
}}>
|
|
108
|
+
Order Items
|
|
109
|
+
</h3>
|
|
110
|
+
|
|
111
|
+
<div style={{
|
|
112
|
+
display: 'flex',
|
|
113
|
+
flexDirection: 'column',
|
|
114
|
+
gap: styles.spacing.md,
|
|
115
|
+
}}>
|
|
116
|
+
{order.items.map((item) => (
|
|
117
|
+
<div
|
|
118
|
+
key={item.id}
|
|
119
|
+
style={{
|
|
120
|
+
display: 'flex',
|
|
121
|
+
gap: styles.spacing.md,
|
|
122
|
+
padding: styles.spacing.md,
|
|
123
|
+
background: styles.colors.white,
|
|
124
|
+
borderRadius: styles.borderRadius.md,
|
|
125
|
+
border: `1px solid ${styles.colors.gray[200]}`,
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{item.image_url && (
|
|
129
|
+
<div style={{
|
|
130
|
+
width: '60px',
|
|
131
|
+
height: '60px',
|
|
132
|
+
flexShrink: 0,
|
|
133
|
+
borderRadius: styles.borderRadius.md,
|
|
134
|
+
overflow: 'hidden',
|
|
135
|
+
background: styles.colors.gray[100],
|
|
136
|
+
}}>
|
|
137
|
+
<img
|
|
138
|
+
src={item.image_url}
|
|
139
|
+
alt={item.name}
|
|
140
|
+
style={{
|
|
141
|
+
width: '100%',
|
|
142
|
+
height: '100%',
|
|
143
|
+
objectFit: 'cover',
|
|
144
|
+
}}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
)}
|
|
148
|
+
|
|
149
|
+
<div style={{ flex: 1 }}>
|
|
150
|
+
<div style={{
|
|
151
|
+
fontSize: styles.typography.fontSize.base,
|
|
152
|
+
fontWeight: styles.typography.fontWeight.medium,
|
|
153
|
+
color: styles.colors.gray[900],
|
|
154
|
+
marginBottom: styles.spacing.xs,
|
|
155
|
+
}}>
|
|
156
|
+
{item.name}
|
|
157
|
+
</div>
|
|
158
|
+
<div style={styles.metaTextStyle}>
|
|
159
|
+
Qty: {item.quantity} × ${item.price.toFixed(2)}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div style={{
|
|
164
|
+
fontSize: styles.typography.fontSize.lg,
|
|
165
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
166
|
+
color: styles.colors.primary,
|
|
167
|
+
}}>
|
|
168
|
+
${(item.price * item.quantity).toFixed(2)}
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div style={{
|
|
176
|
+
...styles.cardStyle,
|
|
177
|
+
background: `linear-gradient(135deg, ${styles.colors.gray[900]} 0%, ${styles.colors.gray[800]} 100%)`,
|
|
178
|
+
border: `2px solid ${styles.colors.primary}`,
|
|
179
|
+
}}>
|
|
180
|
+
<div style={{
|
|
181
|
+
display: 'flex',
|
|
182
|
+
justifyContent: 'space-between',
|
|
183
|
+
alignItems: 'center',
|
|
184
|
+
}}>
|
|
185
|
+
<div style={{
|
|
186
|
+
fontSize: styles.typography.fontSize.lg,
|
|
187
|
+
color: styles.colors.gray[300],
|
|
188
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
189
|
+
}}>
|
|
190
|
+
Total Amount
|
|
191
|
+
</div>
|
|
192
|
+
<div style={{
|
|
193
|
+
fontSize: styles.typography.fontSize['3xl'],
|
|
194
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
195
|
+
color: styles.colors.primary,
|
|
196
|
+
}}>
|
|
197
|
+
${order.total.toFixed(2)}
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export default withToolData<OrderConfirmationData>(OrderConfirmationWidget);
|