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,173 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import { ProductsGridData } from '../../types/tool-data';
|
|
5
|
+
import * as styles from '../../styles/ecommerce';
|
|
6
|
+
|
|
7
|
+
function ProductsGridWidget({ data }: { data: ProductsGridData }) {
|
|
8
|
+
const { products, pagination } = data;
|
|
9
|
+
|
|
10
|
+
if (products.length === 0) {
|
|
11
|
+
return (
|
|
12
|
+
<div style={styles.containerStyle}>
|
|
13
|
+
<div style={styles.emptyStateStyle}>
|
|
14
|
+
<div style={{ fontSize: '64px', marginBottom: styles.spacing.lg }}>
|
|
15
|
+
🛍️
|
|
16
|
+
</div>
|
|
17
|
+
<h3 style={{
|
|
18
|
+
fontSize: styles.typography.fontSize.xl,
|
|
19
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
20
|
+
color: styles.colors.gray[700],
|
|
21
|
+
marginBottom: styles.spacing.sm,
|
|
22
|
+
}}>
|
|
23
|
+
No products found
|
|
24
|
+
</h3>
|
|
25
|
+
<p style={styles.metaTextStyle}>
|
|
26
|
+
Try adjusting your filters or search term
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div style={styles.containerStyle}>
|
|
35
|
+
<div style={{
|
|
36
|
+
...styles.titleStyle,
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
}}>
|
|
39
|
+
<span>
|
|
40
|
+
🛍️ Products
|
|
41
|
+
</span>
|
|
42
|
+
<span style={{
|
|
43
|
+
...styles.badgeStyle,
|
|
44
|
+
background: styles.colors.primary,
|
|
45
|
+
color: styles.colors.black,
|
|
46
|
+
}}>
|
|
47
|
+
{products.length} items
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div style={styles.gridStyle}>
|
|
52
|
+
{products.map((product) => (
|
|
53
|
+
<div
|
|
54
|
+
key={product.id}
|
|
55
|
+
style={{
|
|
56
|
+
...styles.cardStyle,
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
overflow: 'hidden',
|
|
59
|
+
padding: 0,
|
|
60
|
+
}}
|
|
61
|
+
onMouseEnter={(e) => {
|
|
62
|
+
e.currentTarget.style.transform = 'translateY(-4px)';
|
|
63
|
+
e.currentTarget.style.boxShadow = styles.shadows.xl;
|
|
64
|
+
}}
|
|
65
|
+
onMouseLeave={(e) => {
|
|
66
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
67
|
+
e.currentTarget.style.boxShadow = styles.shadows.md;
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<div style={{
|
|
71
|
+
position: 'relative',
|
|
72
|
+
paddingTop: '75%',
|
|
73
|
+
overflow: 'hidden',
|
|
74
|
+
background: styles.colors.gray[100],
|
|
75
|
+
}}>
|
|
76
|
+
<img
|
|
77
|
+
src={product.image_url}
|
|
78
|
+
alt={product.name}
|
|
79
|
+
style={{
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 0,
|
|
82
|
+
left: 0,
|
|
83
|
+
width: '100%',
|
|
84
|
+
height: '100%',
|
|
85
|
+
objectFit: 'cover',
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
<div style={{
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
top: styles.spacing.md,
|
|
91
|
+
right: styles.spacing.md,
|
|
92
|
+
...styles.badgeStyle,
|
|
93
|
+
background: styles.colors.white,
|
|
94
|
+
boxShadow: styles.shadows.md,
|
|
95
|
+
}}>
|
|
96
|
+
{product.stock} in stock
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div style={{ padding: styles.spacing.lg }}>
|
|
101
|
+
<div style={{
|
|
102
|
+
fontSize: styles.typography.fontSize.sm,
|
|
103
|
+
color: styles.colors.gray[500],
|
|
104
|
+
marginBottom: styles.spacing.xs,
|
|
105
|
+
textTransform: 'uppercase',
|
|
106
|
+
letterSpacing: '0.5px',
|
|
107
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
108
|
+
}}>
|
|
109
|
+
{product.category}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<h3 style={{
|
|
113
|
+
fontSize: styles.typography.fontSize.lg,
|
|
114
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
115
|
+
color: styles.colors.gray[900],
|
|
116
|
+
marginBottom: styles.spacing.sm,
|
|
117
|
+
lineHeight: styles.typography.lineHeight.tight,
|
|
118
|
+
}}>
|
|
119
|
+
{product.name}
|
|
120
|
+
</h3>
|
|
121
|
+
|
|
122
|
+
<p style={{
|
|
123
|
+
...styles.metaTextStyle,
|
|
124
|
+
marginBottom: styles.spacing.md,
|
|
125
|
+
lineHeight: styles.typography.lineHeight.normal,
|
|
126
|
+
display: '-webkit-box',
|
|
127
|
+
WebkitLineClamp: 2,
|
|
128
|
+
WebkitBoxOrient: 'vertical',
|
|
129
|
+
overflow: 'hidden',
|
|
130
|
+
}}>
|
|
131
|
+
{product.description}
|
|
132
|
+
</p>
|
|
133
|
+
|
|
134
|
+
<div style={{
|
|
135
|
+
display: 'flex',
|
|
136
|
+
justifyContent: 'space-between',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
}}>
|
|
139
|
+
<div style={styles.priceStyle}>
|
|
140
|
+
${product.price.toFixed(2)}
|
|
141
|
+
</div>
|
|
142
|
+
<div style={{
|
|
143
|
+
...styles.buttonStyle,
|
|
144
|
+
padding: `${styles.spacing.sm} ${styles.spacing.md}`,
|
|
145
|
+
fontSize: styles.typography.fontSize.sm,
|
|
146
|
+
}}>
|
|
147
|
+
View →
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
))}
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{pagination.totalPages > 1 && (
|
|
156
|
+
<div style={{
|
|
157
|
+
marginTop: styles.spacing['2xl'],
|
|
158
|
+
textAlign: 'center',
|
|
159
|
+
padding: styles.spacing.lg,
|
|
160
|
+
background: styles.colors.white,
|
|
161
|
+
borderRadius: styles.borderRadius.md,
|
|
162
|
+
boxShadow: styles.shadows.sm,
|
|
163
|
+
}}>
|
|
164
|
+
<div style={styles.metaTextStyle}>
|
|
165
|
+
Page {pagination.page} of {pagination.totalPages} • {pagination.total} total products
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export default withToolData<ProductsGridData>(ProductsGridWidget);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import { ShoppingCartData } from '../../types/tool-data';
|
|
5
|
+
import * as styles from '../../styles/ecommerce';
|
|
6
|
+
|
|
7
|
+
function ShoppingCartWidget({ data }: { data: ShoppingCartData }) {
|
|
8
|
+
const { items, total, itemCount } = data;
|
|
9
|
+
|
|
10
|
+
if (items.length === 0) {
|
|
11
|
+
return (
|
|
12
|
+
<div style={styles.containerStyle}>
|
|
13
|
+
<div style={styles.emptyStateStyle}>
|
|
14
|
+
<div style={{ fontSize: '64px', marginBottom: styles.spacing.lg }}>
|
|
15
|
+
🛒
|
|
16
|
+
</div>
|
|
17
|
+
<h3 style={{
|
|
18
|
+
fontSize: styles.typography.fontSize.xl,
|
|
19
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
20
|
+
color: styles.colors.gray[700],
|
|
21
|
+
marginBottom: styles.spacing.sm,
|
|
22
|
+
}}>
|
|
23
|
+
Your cart is empty
|
|
24
|
+
</h3>
|
|
25
|
+
<p style={styles.metaTextStyle}>
|
|
26
|
+
Add some products to get started!
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div style={styles.containerStyle}>
|
|
35
|
+
<div style={{
|
|
36
|
+
...styles.titleStyle,
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
}}>
|
|
39
|
+
<span>
|
|
40
|
+
🛒 Shopping Cart
|
|
41
|
+
</span>
|
|
42
|
+
<span style={{
|
|
43
|
+
...styles.badgeStyle,
|
|
44
|
+
background: styles.colors.primary,
|
|
45
|
+
color: styles.colors.black,
|
|
46
|
+
}}>
|
|
47
|
+
{itemCount} {itemCount === 1 ? 'item' : 'items'}
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div style={{
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
gap: styles.spacing.md,
|
|
55
|
+
}}>
|
|
56
|
+
{items.map((item) => (
|
|
57
|
+
<div
|
|
58
|
+
key={item.product_id}
|
|
59
|
+
style={{
|
|
60
|
+
...styles.cardStyle,
|
|
61
|
+
display: 'flex',
|
|
62
|
+
gap: styles.spacing.lg,
|
|
63
|
+
alignItems: 'flex-start',
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<div style={{
|
|
67
|
+
width: '120px',
|
|
68
|
+
height: '120px',
|
|
69
|
+
flexShrink: 0,
|
|
70
|
+
borderRadius: styles.borderRadius.md,
|
|
71
|
+
overflow: 'hidden',
|
|
72
|
+
background: styles.colors.gray[100],
|
|
73
|
+
}}>
|
|
74
|
+
<img
|
|
75
|
+
src={item.image_url}
|
|
76
|
+
alt={item.name}
|
|
77
|
+
style={{
|
|
78
|
+
width: '100%',
|
|
79
|
+
height: '100%',
|
|
80
|
+
objectFit: 'cover',
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
86
|
+
<h3 style={{
|
|
87
|
+
fontSize: styles.typography.fontSize.lg,
|
|
88
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
89
|
+
color: styles.colors.gray[900],
|
|
90
|
+
marginBottom: styles.spacing.xs,
|
|
91
|
+
}}>
|
|
92
|
+
{item.name}
|
|
93
|
+
</h3>
|
|
94
|
+
|
|
95
|
+
<p style={{
|
|
96
|
+
...styles.metaTextStyle,
|
|
97
|
+
marginBottom: styles.spacing.md,
|
|
98
|
+
lineHeight: styles.typography.lineHeight.normal,
|
|
99
|
+
}}>
|
|
100
|
+
{item.description}
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
<div style={{
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
gap: styles.spacing.lg,
|
|
107
|
+
flexWrap: 'wrap',
|
|
108
|
+
}}>
|
|
109
|
+
<div style={{
|
|
110
|
+
...styles.badgeStyle,
|
|
111
|
+
background: styles.colors.gray[200],
|
|
112
|
+
}}>
|
|
113
|
+
Qty: {item.quantity}
|
|
114
|
+
</div>
|
|
115
|
+
<div style={{
|
|
116
|
+
fontSize: styles.typography.fontSize.base,
|
|
117
|
+
color: styles.colors.gray[700],
|
|
118
|
+
}}>
|
|
119
|
+
${item.price.toFixed(2)} each
|
|
120
|
+
</div>
|
|
121
|
+
<div style={{
|
|
122
|
+
...styles.badgeStyle,
|
|
123
|
+
background: styles.colors.success,
|
|
124
|
+
color: styles.colors.white,
|
|
125
|
+
}}>
|
|
126
|
+
{item.stock} available
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div style={{
|
|
132
|
+
textAlign: 'right',
|
|
133
|
+
flexShrink: 0,
|
|
134
|
+
}}>
|
|
135
|
+
<div style={{
|
|
136
|
+
fontSize: styles.typography.fontSize['2xl'],
|
|
137
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
138
|
+
color: styles.colors.primary,
|
|
139
|
+
}}>
|
|
140
|
+
${(item.price * item.quantity).toFixed(2)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
))}
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div style={{
|
|
148
|
+
marginTop: styles.spacing.xl,
|
|
149
|
+
...styles.cardStyle,
|
|
150
|
+
background: `linear-gradient(135deg, ${styles.colors.gray[900]} 0%, ${styles.colors.gray[800]} 100%)`,
|
|
151
|
+
border: `2px solid ${styles.colors.primary}`,
|
|
152
|
+
}}>
|
|
153
|
+
<div style={{
|
|
154
|
+
display: 'flex',
|
|
155
|
+
justifyContent: 'space-between',
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
}}>
|
|
158
|
+
<div>
|
|
159
|
+
<div style={{
|
|
160
|
+
fontSize: styles.typography.fontSize.sm,
|
|
161
|
+
color: styles.colors.gray[400],
|
|
162
|
+
marginBottom: styles.spacing.xs,
|
|
163
|
+
}}>
|
|
164
|
+
Total Amount
|
|
165
|
+
</div>
|
|
166
|
+
<div style={{
|
|
167
|
+
fontSize: styles.typography.fontSize['3xl'],
|
|
168
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
169
|
+
color: styles.colors.primary,
|
|
170
|
+
}}>
|
|
171
|
+
${total.toFixed(2)}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
<div style={{
|
|
175
|
+
...styles.buttonStyle,
|
|
176
|
+
padding: `${styles.spacing.lg} ${styles.spacing['2xl']}`,
|
|
177
|
+
fontSize: styles.typography.fontSize.base,
|
|
178
|
+
}}>
|
|
179
|
+
Checkout →
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export default withToolData<ShoppingCartData>(ShoppingCartWidget);
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
+
import { WhoAmIResult } from '../../types/tool-data';
|
|
5
|
+
import * as styles from '../../styles/ecommerce';
|
|
6
|
+
|
|
7
|
+
function WhoAmIWidget({ data }: { data: WhoAmIResult }) {
|
|
8
|
+
const { user, authenticated } = data;
|
|
9
|
+
|
|
10
|
+
if (!authenticated || !user) {
|
|
11
|
+
return (
|
|
12
|
+
<div style={styles.containerStyle}>
|
|
13
|
+
<div style={styles.emptyStateStyle}>
|
|
14
|
+
<div style={{ fontSize: '64px', marginBottom: styles.spacing.lg }}>
|
|
15
|
+
🔒
|
|
16
|
+
</div>
|
|
17
|
+
<h3 style={{
|
|
18
|
+
fontSize: styles.typography.fontSize.xl,
|
|
19
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
20
|
+
color: styles.colors.gray[700],
|
|
21
|
+
marginBottom: styles.spacing.sm,
|
|
22
|
+
}}>
|
|
23
|
+
Not Authenticated
|
|
24
|
+
</h3>
|
|
25
|
+
<p style={styles.metaTextStyle}>
|
|
26
|
+
Please log in to view your profile
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div style={styles.containerStyle}>
|
|
35
|
+
<div style={{
|
|
36
|
+
...styles.cardStyle,
|
|
37
|
+
maxWidth: '500px',
|
|
38
|
+
margin: '0 auto',
|
|
39
|
+
}}>
|
|
40
|
+
<div style={{
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
marginBottom: styles.spacing.xl,
|
|
43
|
+
}}>
|
|
44
|
+
{user.profile_picture ? (
|
|
45
|
+
<img
|
|
46
|
+
src={user.profile_picture}
|
|
47
|
+
alt={user.name}
|
|
48
|
+
style={{
|
|
49
|
+
width: '120px',
|
|
50
|
+
height: '120px',
|
|
51
|
+
borderRadius: styles.borderRadius.full,
|
|
52
|
+
objectFit: 'cover',
|
|
53
|
+
border: `4px solid ${styles.colors.primary}`,
|
|
54
|
+
margin: '0 auto 16px',
|
|
55
|
+
boxShadow: styles.shadows.xl,
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
) : (
|
|
59
|
+
<div style={{
|
|
60
|
+
width: '120px',
|
|
61
|
+
height: '120px',
|
|
62
|
+
borderRadius: styles.borderRadius.full,
|
|
63
|
+
background: `linear-gradient(135deg, ${styles.colors.primary} 0%, ${styles.colors.primaryHover} 100%)`,
|
|
64
|
+
display: 'flex',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
fontSize: '48px',
|
|
68
|
+
margin: '0 auto 16px',
|
|
69
|
+
}}>
|
|
70
|
+
👤
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
<h2 style={{
|
|
75
|
+
fontSize: styles.typography.fontSize['2xl'],
|
|
76
|
+
fontWeight: styles.typography.fontWeight.bold,
|
|
77
|
+
color: styles.colors.gray[900],
|
|
78
|
+
marginBottom: styles.spacing.xs,
|
|
79
|
+
}}>
|
|
80
|
+
{user.name}
|
|
81
|
+
</h2>
|
|
82
|
+
<p style={{
|
|
83
|
+
fontSize: styles.typography.fontSize.base,
|
|
84
|
+
color: styles.colors.gray[600],
|
|
85
|
+
marginBottom: styles.spacing.md,
|
|
86
|
+
}}>
|
|
87
|
+
{user.email}
|
|
88
|
+
</p>
|
|
89
|
+
|
|
90
|
+
<div style={{
|
|
91
|
+
...styles.badgeStyle,
|
|
92
|
+
background: styles.colors.success,
|
|
93
|
+
color: styles.colors.white,
|
|
94
|
+
display: 'inline-flex',
|
|
95
|
+
}}>
|
|
96
|
+
✓ Authenticated
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div style={{
|
|
101
|
+
display: 'grid',
|
|
102
|
+
gridTemplateColumns: '1fr',
|
|
103
|
+
gap: styles.spacing.md,
|
|
104
|
+
}}>
|
|
105
|
+
<div style={{
|
|
106
|
+
background: styles.colors.gray[50],
|
|
107
|
+
borderRadius: styles.borderRadius.md,
|
|
108
|
+
padding: styles.spacing.lg,
|
|
109
|
+
}}>
|
|
110
|
+
<div style={{
|
|
111
|
+
fontSize: styles.typography.fontSize.sm,
|
|
112
|
+
color: styles.colors.gray[500],
|
|
113
|
+
marginBottom: styles.spacing.xs,
|
|
114
|
+
textTransform: 'uppercase',
|
|
115
|
+
letterSpacing: '0.5px',
|
|
116
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
117
|
+
}}>
|
|
118
|
+
User ID
|
|
119
|
+
</div>
|
|
120
|
+
<div style={{
|
|
121
|
+
fontSize: styles.typography.fontSize.base,
|
|
122
|
+
fontWeight: styles.typography.fontWeight.medium,
|
|
123
|
+
color: styles.colors.gray[900],
|
|
124
|
+
fontFamily: 'monospace',
|
|
125
|
+
}}>
|
|
126
|
+
{user.id.substring(0, 16)}...
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
{user.memberSince && (
|
|
131
|
+
<div style={{
|
|
132
|
+
background: styles.colors.gray[50],
|
|
133
|
+
borderRadius: styles.borderRadius.md,
|
|
134
|
+
padding: styles.spacing.lg,
|
|
135
|
+
}}>
|
|
136
|
+
<div style={{
|
|
137
|
+
fontSize: styles.typography.fontSize.sm,
|
|
138
|
+
color: styles.colors.gray[500],
|
|
139
|
+
marginBottom: styles.spacing.xs,
|
|
140
|
+
textTransform: 'uppercase',
|
|
141
|
+
letterSpacing: '0.5px',
|
|
142
|
+
fontWeight: styles.typography.fontWeight.semibold,
|
|
143
|
+
}}>
|
|
144
|
+
Member Since
|
|
145
|
+
</div>
|
|
146
|
+
<div style={{
|
|
147
|
+
fontSize: styles.typography.fontSize.base,
|
|
148
|
+
fontWeight: styles.typography.fontWeight.medium,
|
|
149
|
+
color: styles.colors.gray[900],
|
|
150
|
+
}}>
|
|
151
|
+
{new Date(user.memberSince).toLocaleDateString('en-US', {
|
|
152
|
+
year: 'numeric',
|
|
153
|
+
month: 'long',
|
|
154
|
+
day: 'numeric',
|
|
155
|
+
})}
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export default withToolData<WhoAmIResult>(WhoAmIWidget);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @type {import('next').NextConfig} */
|
|
2
|
+
const nextConfig = {
|
|
3
|
+
// Only use static export in production
|
|
4
|
+
output: process.env.NODE_ENV === 'production' ? 'export' : undefined,
|
|
5
|
+
distDir: 'out',
|
|
6
|
+
images: { unoptimized: true },
|
|
7
|
+
reactStrictMode: false,
|
|
8
|
+
// Disable build activity indicator in dev mode
|
|
9
|
+
devIndicators: {
|
|
10
|
+
buildActivity: false,
|
|
11
|
+
buildActivityPosition: 'bottom-right',
|
|
12
|
+
},
|
|
13
|
+
// Dev server config
|
|
14
|
+
...(process.env.NODE_ENV === 'development' && {
|
|
15
|
+
compress: false, // Faster dev server
|
|
16
|
+
|
|
17
|
+
// Webpack config to prevent cache corruption when adding new widgets
|
|
18
|
+
webpack: (config, { isServer }) => {
|
|
19
|
+
// Disable persistent caching in development to prevent chunk reference errors
|
|
20
|
+
// This prevents the "Cannot find module './819.js'" type errors
|
|
21
|
+
if (config.cache && config.cache.type === 'filesystem') {
|
|
22
|
+
config.cache = {
|
|
23
|
+
type: 'memory',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Improve cache busting for new files on client
|
|
28
|
+
if (!isServer) {
|
|
29
|
+
config.cache = false; // Disable cache completely on client in dev
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return config;
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
export default nextConfig;
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "next build",
|
|
6
|
+
"dev": "next dev"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"next": "14.2.5",
|
|
10
|
+
"react": "18.2.0",
|
|
11
|
+
"react-dom": "18.2.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/react": "19.2.2"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|