nitrostack 1.0.54 → 1.0.56
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/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +14 -9
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/widgets/hooks/index.d.ts +7 -0
- package/dist/widgets/hooks/index.d.ts.map +1 -0
- package/dist/widgets/hooks/index.js +7 -0
- package/dist/widgets/hooks/index.js.map +1 -0
- package/dist/widgets/hooks/use-display-mode.d.ts +11 -0
- package/dist/widgets/hooks/use-display-mode.d.ts.map +1 -0
- package/dist/widgets/hooks/use-display-mode.js +13 -0
- package/dist/widgets/hooks/use-display-mode.js.map +1 -0
- package/dist/widgets/hooks/use-max-height.d.ts +10 -0
- package/dist/widgets/hooks/use-max-height.d.ts.map +1 -0
- package/dist/widgets/hooks/use-max-height.js +13 -0
- package/dist/widgets/hooks/use-max-height.js.map +1 -0
- package/dist/widgets/hooks/use-openai-global.d.ts +12 -0
- package/dist/widgets/hooks/use-openai-global.d.ts.map +1 -0
- package/dist/widgets/hooks/use-openai-global.js +32 -0
- package/dist/widgets/hooks/use-openai-global.js.map +1 -0
- package/dist/widgets/hooks/use-theme.d.ts +10 -0
- package/dist/widgets/hooks/use-theme.d.ts.map +1 -0
- package/dist/widgets/hooks/use-theme.js +12 -0
- package/dist/widgets/hooks/use-theme.js.map +1 -0
- package/dist/widgets/hooks/use-widget-state.d.ts +18 -0
- package/dist/widgets/hooks/use-widget-state.d.ts.map +1 -0
- package/dist/widgets/hooks/use-widget-state.js +27 -0
- package/dist/widgets/hooks/use-widget-state.js.map +1 -0
- package/dist/widgets/hooks/useWidgetSDK.d.ts +47 -0
- package/dist/widgets/hooks/useWidgetSDK.d.ts.map +1 -0
- package/dist/widgets/hooks/useWidgetSDK.js +67 -0
- package/dist/widgets/hooks/useWidgetSDK.js.map +1 -0
- package/dist/widgets/index.d.ts +7 -1
- package/dist/widgets/index.d.ts.map +1 -1
- package/dist/widgets/index.js +11 -1
- package/dist/widgets/index.js.map +1 -1
- package/dist/widgets/runtime/WidgetLayout.d.ts +32 -0
- package/dist/widgets/runtime/WidgetLayout.d.ts.map +1 -0
- package/dist/widgets/runtime/WidgetLayout.js +143 -0
- package/dist/widgets/runtime/WidgetLayout.js.map +1 -0
- package/dist/widgets/runtime/widget-polyfill.d.ts +1 -0
- package/dist/widgets/runtime/widget-polyfill.d.ts.map +1 -0
- package/dist/widgets/runtime/widget-polyfill.js +28 -0
- package/dist/widgets/runtime/widget-polyfill.js.map +1 -0
- package/dist/widgets/sdk.d.ts +109 -0
- package/dist/widgets/sdk.d.ts.map +1 -0
- package/dist/widgets/sdk.js +221 -0
- package/dist/widgets/sdk.js.map +1 -0
- package/dist/widgets/types.d.ts +89 -0
- package/dist/widgets/types.d.ts.map +1 -0
- package/dist/widgets/types.js +8 -0
- package/dist/widgets/types.js.map +1 -0
- package/dist/widgets/utils/media-queries.d.ts +34 -0
- package/dist/widgets/utils/media-queries.d.ts.map +1 -0
- package/dist/widgets/utils/media-queries.js +42 -0
- package/dist/widgets/utils/media-queries.js.map +1 -0
- package/package.json +2 -2
- package/src/studio/app/chat/page.tsx +274 -137
- package/src/studio/app/globals.css +140 -64
- package/src/studio/branding.md +807 -0
- package/src/studio/components/WidgetRenderer.tsx +222 -16
- package/src/studio/lib/llm-service.ts +39 -39
- package/templates/typescript-oauth/.env.example +27 -0
- package/templates/typescript-oauth/README.md +226 -306
- package/templates/typescript-oauth/package-lock.json +4253 -0
- package/templates/typescript-oauth/package.json +10 -5
- package/templates/typescript-oauth/src/app.module.ts +39 -36
- package/templates/typescript-oauth/src/guards/oauth.guard.ts +0 -1
- package/templates/typescript-oauth/src/index.ts +22 -30
- package/templates/typescript-oauth/src/modules/flights/booking.tools.ts +323 -0
- package/templates/typescript-oauth/src/modules/flights/flights.module.ts +14 -0
- package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +231 -0
- package/templates/typescript-oauth/src/modules/flights/flights.resources.ts +215 -0
- package/templates/typescript-oauth/src/modules/flights/flights.tools.ts +457 -0
- package/templates/typescript-oauth/src/services/duffel.service.ts +285 -0
- package/templates/typescript-oauth/src/widgets/app/airport-search/page.tsx +270 -0
- package/templates/typescript-oauth/src/widgets/app/flight-details/page.tsx +261 -0
- package/templates/typescript-oauth/src/widgets/app/flight-search-results/page.tsx +378 -0
- package/templates/typescript-oauth/src/widgets/app/globals.css +167 -0
- package/templates/typescript-oauth/src/widgets/app/layout.tsx +6 -2
- package/templates/typescript-oauth/src/widgets/app/order-cancellation/page.tsx +207 -0
- package/templates/typescript-oauth/src/widgets/app/order-summary/page.tsx +245 -0
- package/templates/typescript-oauth/src/widgets/app/payment-confirmation/page.tsx +152 -0
- package/templates/typescript-oauth/src/widgets/app/seat-selection/page.tsx +486 -0
- package/templates/typescript-oauth/src/widgets/next-env.d.ts +5 -0
- package/templates/typescript-oauth/src/widgets/package-lock.json +155 -126
- package/templates/typescript-oauth/src/widgets/widget-manifest.json +374 -27
- package/templates/typescript-pizzaz/IMPLEMENTATION.md +98 -0
- package/templates/typescript-pizzaz/README.md +233 -0
- package/templates/typescript-pizzaz/package.json +31 -0
- package/templates/typescript-pizzaz/src/app.module.ts +28 -0
- package/templates/typescript-pizzaz/src/index.ts +30 -0
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.data.ts +106 -0
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.module.ts +11 -0
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.service.ts +60 -0
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tools.ts +197 -0
- package/templates/typescript-pizzaz/src/widgets/app/layout.tsx +18 -0
- package/templates/typescript-pizzaz/src/widgets/app/pizza-list/page.tsx +272 -0
- package/templates/typescript-pizzaz/src/widgets/app/pizza-map/page.tsx +216 -0
- package/templates/typescript-pizzaz/src/widgets/app/pizza-shop/page.tsx +374 -0
- package/templates/typescript-pizzaz/src/widgets/components/CompactShopCard.tsx +144 -0
- package/templates/typescript-pizzaz/src/widgets/components/PizzaCard.tsx +191 -0
- package/templates/typescript-pizzaz/src/widgets/package.json +30 -0
- package/templates/typescript-pizzaz/src/widgets/widget-manifest.json +253 -0
- package/templates/typescript-pizzaz/tsconfig.json +30 -0
- package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +0 -1
- package/templates/typescript-starter/src/widgets/app/calculator-result/page.tsx +102 -56
- package/templates/typescript-starter/src/widgets/app/layout.tsx +6 -2
- package/templates/typescript-auth/AI_AGENT_CLI_REFERENCE.md +0 -702
- package/templates/typescript-auth/AI_AGENT_SDK_REFERENCE.md +0 -1260
- package/templates/typescript-auth/README.md +0 -402
- package/templates/typescript-auth/package.json +0 -36
- package/templates/typescript-auth/src/app.module.ts +0 -103
- package/templates/typescript-auth/src/db/database.ts +0 -160
- package/templates/typescript-auth/src/db/seed.ts +0 -374
- package/templates/typescript-auth/src/db/setup.ts +0 -87
- package/templates/typescript-auth/src/events/analytics.service.ts +0 -52
- package/templates/typescript-auth/src/events/notification.service.ts +0 -40
- package/templates/typescript-auth/src/filters/global-exception.filter.ts +0 -28
- package/templates/typescript-auth/src/guards/README.md +0 -75
- package/templates/typescript-auth/src/guards/jwt.guard.ts +0 -105
- package/templates/typescript-auth/src/health/database.health.ts +0 -41
- package/templates/typescript-auth/src/index.ts +0 -29
- package/templates/typescript-auth/src/interceptors/transform.interceptor.ts +0 -24
- package/templates/typescript-auth/src/middleware/logging.middleware.ts +0 -42
- package/templates/typescript-auth/src/modules/addresses/addresses.module.ts +0 -16
- package/templates/typescript-auth/src/modules/addresses/addresses.prompts.ts +0 -114
- package/templates/typescript-auth/src/modules/addresses/addresses.resources.ts +0 -40
- package/templates/typescript-auth/src/modules/addresses/addresses.tools.ts +0 -284
- package/templates/typescript-auth/src/modules/auth/auth.module.ts +0 -16
- package/templates/typescript-auth/src/modules/auth/auth.prompts.ts +0 -147
- package/templates/typescript-auth/src/modules/auth/auth.resources.ts +0 -84
- package/templates/typescript-auth/src/modules/auth/auth.tools.ts +0 -139
- package/templates/typescript-auth/src/modules/cart/cart.module.ts +0 -16
- package/templates/typescript-auth/src/modules/cart/cart.prompts.ts +0 -95
- package/templates/typescript-auth/src/modules/cart/cart.resources.ts +0 -44
- package/templates/typescript-auth/src/modules/cart/cart.tools.ts +0 -277
- package/templates/typescript-auth/src/modules/orders/orders.module.ts +0 -16
- package/templates/typescript-auth/src/modules/orders/orders.prompts.ts +0 -88
- package/templates/typescript-auth/src/modules/orders/orders.resources.ts +0 -48
- package/templates/typescript-auth/src/modules/orders/orders.tools.ts +0 -303
- package/templates/typescript-auth/src/modules/products/products.module.ts +0 -16
- package/templates/typescript-auth/src/modules/products/products.prompts.ts +0 -146
- package/templates/typescript-auth/src/modules/products/products.resources.ts +0 -98
- package/templates/typescript-auth/src/modules/products/products.tools.ts +0 -266
- package/templates/typescript-auth/src/pipes/validation.pipe.ts +0 -42
- package/templates/typescript-auth/src/services/database.service.ts +0 -90
- package/templates/typescript-auth/src/widgets/app/add-to-cart/page.tsx +0 -122
- package/templates/typescript-auth/src/widgets/app/address-added/page.tsx +0 -116
- package/templates/typescript-auth/src/widgets/app/address-deleted/page.tsx +0 -105
- package/templates/typescript-auth/src/widgets/app/address-list/page.tsx +0 -139
- package/templates/typescript-auth/src/widgets/app/address-updated/page.tsx +0 -153
- package/templates/typescript-auth/src/widgets/app/cart-cleared/page.tsx +0 -86
- package/templates/typescript-auth/src/widgets/app/cart-updated/page.tsx +0 -116
- package/templates/typescript-auth/src/widgets/app/categories/page.tsx +0 -134
- package/templates/typescript-auth/src/widgets/app/layout.tsx +0 -21
- package/templates/typescript-auth/src/widgets/app/login-result/page.tsx +0 -129
- package/templates/typescript-auth/src/widgets/app/order-confirmation/page.tsx +0 -231
- package/templates/typescript-auth/src/widgets/app/order-details/page.tsx +0 -225
- package/templates/typescript-auth/src/widgets/app/order-history/page.tsx +0 -218
- package/templates/typescript-auth/src/widgets/app/product-card/page.tsx +0 -121
- package/templates/typescript-auth/src/widgets/app/products-grid/page.tsx +0 -198
- package/templates/typescript-auth/src/widgets/app/shopping-cart/page.tsx +0 -187
- package/templates/typescript-auth/src/widgets/app/whoami/page.tsx +0 -165
- package/templates/typescript-auth/src/widgets/next.config.js +0 -38
- package/templates/typescript-auth/src/widgets/package.json +0 -18
- package/templates/typescript-auth/src/widgets/styles/ecommerce.ts +0 -169
- package/templates/typescript-auth/src/widgets/tsconfig.json +0 -28
- package/templates/typescript-auth/src/widgets/types/tool-data.ts +0 -141
- package/templates/typescript-auth/src/widgets/widget-manifest.json +0 -464
- package/templates/typescript-auth/tsconfig.json +0 -27
- package/templates/typescript-auth-api-key/AI_AGENT_CLI_REFERENCE.md +0 -701
- package/templates/typescript-auth-api-key/AI_AGENT_SDK_REFERENCE.md +0 -1260
- package/templates/typescript-auth-api-key/README.md +0 -485
- package/templates/typescript-auth-api-key/package.json +0 -21
- package/templates/typescript-auth-api-key/src/app.module.ts +0 -38
- package/templates/typescript-auth-api-key/src/guards/apikey.guard.ts +0 -47
- package/templates/typescript-auth-api-key/src/guards/multi-auth.guard.ts +0 -157
- package/templates/typescript-auth-api-key/src/index.ts +0 -47
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.module.ts +0 -12
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.prompts.ts +0 -73
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.resources.ts +0 -60
- package/templates/typescript-auth-api-key/src/modules/calculator/calculator.tools.ts +0 -71
- package/templates/typescript-auth-api-key/src/modules/demo/demo.module.ts +0 -18
- package/templates/typescript-auth-api-key/src/modules/demo/demo.tools.ts +0 -155
- package/templates/typescript-auth-api-key/src/modules/demo/multi-auth.tools.ts +0 -123
- package/templates/typescript-auth-api-key/src/widgets/app/calculator-operations/page.tsx +0 -133
- package/templates/typescript-auth-api-key/src/widgets/app/calculator-result/page.tsx +0 -134
- package/templates/typescript-auth-api-key/src/widgets/app/layout.tsx +0 -14
- package/templates/typescript-auth-api-key/src/widgets/package.json +0 -24
- package/templates/typescript-auth-api-key/src/widgets/widget-manifest.json +0 -48
- package/templates/typescript-auth-api-key/tsconfig.json +0 -23
- package/templates/typescript-oauth/OAUTH_SETUP.md +0 -592
- package/templates/typescript-oauth/src/modules/demo/demo.module.ts +0 -16
- package/templates/typescript-oauth/src/modules/demo/demo.tools.ts +0 -190
- package/templates/typescript-oauth/src/widgets/app/calculator-operations/page.tsx +0 -133
- package/templates/typescript-oauth/src/widgets/app/calculator-result/page.tsx +0 -134
- package/templates/typescript-oauth/src/widgets/out/404.html +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/WU9THacVqL52RZbrZOLS1/_buildManifest.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/WU9THacVqL52RZbrZOLS1/_ssgManifest.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/117-eb57c7ef86f964a4.js +0 -2
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/_not-found/page-dcb83ba3e4d0aafd.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/calculator-operations/page-b8913a740073ea8a.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/calculator-result/page-ddaaab2fce95dea2.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/layout-cbd3ebdc4ecc5247.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/fd9d1056-749e5812300142af.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/framework-f66176bb897dc684.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/main-76df43fcef3db344.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/main-app-f9c40224d04023c5.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/webpack-100b9e646d9c912e.js +0 -1
- package/templates/typescript-oauth/src/widgets/out/calculator-operations.html +0 -1
- package/templates/typescript-oauth/src/widgets/out/calculator-operations.txt +0 -7
- package/templates/typescript-oauth/src/widgets/out/calculator-result.html +0 -1
- package/templates/typescript-oauth/src/widgets/out/calculator-result.txt +0 -7
- package/templates/typescript-starter/src/widgets/app/calculator-operations/page.tsx +0 -133
- /package/templates/{typescript-auth-api-key → typescript-oauth}/src/health/system.health.ts +0 -0
- /package/templates/{typescript-auth-api-key → typescript-pizzaz}/src/widgets/next.config.js +0 -0
- /package/templates/{typescript-auth-api-key → typescript-pizzaz}/src/widgets/tsconfig.json +0 -0
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
-
import * as styles from '../../styles/ecommerce';
|
|
5
|
-
|
|
6
|
-
interface OrderItem {
|
|
7
|
-
product_id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
quantity: number;
|
|
10
|
-
price: number;
|
|
11
|
-
image_url?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface OrderDetailsData {
|
|
15
|
-
order: {
|
|
16
|
-
id: string;
|
|
17
|
-
total: number;
|
|
18
|
-
status: string;
|
|
19
|
-
payment_method: string;
|
|
20
|
-
created_at: string;
|
|
21
|
-
full_name?: string;
|
|
22
|
-
street?: string;
|
|
23
|
-
city?: string;
|
|
24
|
-
state?: string;
|
|
25
|
-
zip_code?: string;
|
|
26
|
-
};
|
|
27
|
-
items: OrderItem[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function OrderDetailsWidget({ data }: { data: OrderDetailsData }) {
|
|
31
|
-
const { order, items } = data;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div style={styles.containerStyle}>
|
|
35
|
-
<div style={{
|
|
36
|
-
...styles.cardStyle,
|
|
37
|
-
maxWidth: '700px',
|
|
38
|
-
margin: '0 auto',
|
|
39
|
-
}}>
|
|
40
|
-
<div style={{
|
|
41
|
-
display: 'flex',
|
|
42
|
-
justifyContent: 'space-between',
|
|
43
|
-
alignItems: 'flex-start',
|
|
44
|
-
marginBottom: styles.spacing.xl,
|
|
45
|
-
paddingBottom: styles.spacing.lg,
|
|
46
|
-
borderBottom: `2px solid ${styles.colors.gray[200]}`,
|
|
47
|
-
}}>
|
|
48
|
-
<div>
|
|
49
|
-
<h2 style={{
|
|
50
|
-
fontSize: styles.typography.fontSize['2xl'],
|
|
51
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
52
|
-
color: styles.colors.gray[900],
|
|
53
|
-
marginBottom: styles.spacing.xs,
|
|
54
|
-
}}>
|
|
55
|
-
Order #{order.id.substring(0, 8).toUpperCase()}
|
|
56
|
-
</h2>
|
|
57
|
-
<div style={styles.metaTextStyle}>
|
|
58
|
-
Placed on {new Date(order.created_at).toLocaleDateString('en-US', {
|
|
59
|
-
year: 'numeric',
|
|
60
|
-
month: 'long',
|
|
61
|
-
day: 'numeric',
|
|
62
|
-
hour: '2-digit',
|
|
63
|
-
minute: '2-digit',
|
|
64
|
-
})}
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div style={{
|
|
69
|
-
...styles.badgeStyle,
|
|
70
|
-
background: order.status === 'pending'
|
|
71
|
-
? styles.colors.warning
|
|
72
|
-
: order.status === 'delivered'
|
|
73
|
-
? styles.colors.success
|
|
74
|
-
: styles.colors.primary,
|
|
75
|
-
color: styles.colors.white,
|
|
76
|
-
padding: `${styles.spacing.sm} ${styles.spacing.lg}`,
|
|
77
|
-
}}>
|
|
78
|
-
{order.status}
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div style={{ marginBottom: styles.spacing.xl }}>
|
|
83
|
-
<h3 style={{
|
|
84
|
-
fontSize: styles.typography.fontSize.lg,
|
|
85
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
86
|
-
color: styles.colors.gray[900],
|
|
87
|
-
marginBottom: styles.spacing.md,
|
|
88
|
-
}}>
|
|
89
|
-
Order Items
|
|
90
|
-
</h3>
|
|
91
|
-
|
|
92
|
-
<div style={{
|
|
93
|
-
display: 'flex',
|
|
94
|
-
flexDirection: 'column',
|
|
95
|
-
gap: styles.spacing.md,
|
|
96
|
-
}}>
|
|
97
|
-
{items && items.map((item, index) => (
|
|
98
|
-
<div
|
|
99
|
-
key={item.product_id || index}
|
|
100
|
-
style={{
|
|
101
|
-
display: 'flex',
|
|
102
|
-
gap: styles.spacing.md,
|
|
103
|
-
padding: styles.spacing.md,
|
|
104
|
-
background: styles.colors.gray[50],
|
|
105
|
-
borderRadius: styles.borderRadius.md,
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
{item.image_url && (
|
|
109
|
-
<div style={{
|
|
110
|
-
width: '80px',
|
|
111
|
-
height: '80px',
|
|
112
|
-
flexShrink: 0,
|
|
113
|
-
borderRadius: styles.borderRadius.md,
|
|
114
|
-
overflow: 'hidden',
|
|
115
|
-
background: styles.colors.white,
|
|
116
|
-
}}>
|
|
117
|
-
<img
|
|
118
|
-
src={item.image_url}
|
|
119
|
-
alt={item.name}
|
|
120
|
-
style={{
|
|
121
|
-
width: '100%',
|
|
122
|
-
height: '100%',
|
|
123
|
-
objectFit: 'cover',
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
)}
|
|
128
|
-
|
|
129
|
-
<div style={{ flex: 1 }}>
|
|
130
|
-
<div style={{
|
|
131
|
-
fontSize: styles.typography.fontSize.base,
|
|
132
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
133
|
-
color: styles.colors.gray[900],
|
|
134
|
-
marginBottom: styles.spacing.xs,
|
|
135
|
-
}}>
|
|
136
|
-
{item.name}
|
|
137
|
-
</div>
|
|
138
|
-
<div style={styles.metaTextStyle}>
|
|
139
|
-
Quantity: {item.quantity} × ${item.price.toFixed(2)}
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<div style={{
|
|
144
|
-
fontSize: styles.typography.fontSize.xl,
|
|
145
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
146
|
-
color: styles.colors.primary,
|
|
147
|
-
}}>
|
|
148
|
-
${(item.price * item.quantity).toFixed(2)}
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
))}
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
<div style={{
|
|
156
|
-
...styles.cardStyle,
|
|
157
|
-
background: `linear-gradient(135deg, ${styles.colors.gray[900]} 0%, ${styles.colors.gray[800]} 100%)`,
|
|
158
|
-
border: `2px solid ${styles.colors.primary}`,
|
|
159
|
-
marginBottom: styles.spacing.xl,
|
|
160
|
-
}}>
|
|
161
|
-
<div style={{
|
|
162
|
-
display: 'flex',
|
|
163
|
-
justifyContent: 'space-between',
|
|
164
|
-
alignItems: 'center',
|
|
165
|
-
}}>
|
|
166
|
-
<div style={{
|
|
167
|
-
fontSize: styles.typography.fontSize.lg,
|
|
168
|
-
color: styles.colors.gray[300],
|
|
169
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
170
|
-
}}>
|
|
171
|
-
Order Total
|
|
172
|
-
</div>
|
|
173
|
-
<div style={{
|
|
174
|
-
fontSize: styles.typography.fontSize['3xl'],
|
|
175
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
176
|
-
color: styles.colors.primary,
|
|
177
|
-
}}>
|
|
178
|
-
${order.total.toFixed(2)}
|
|
179
|
-
</div>
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
{(order.full_name || order.street) && (
|
|
184
|
-
<div>
|
|
185
|
-
<h3 style={{
|
|
186
|
-
fontSize: styles.typography.fontSize.lg,
|
|
187
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
188
|
-
color: styles.colors.gray[900],
|
|
189
|
-
marginBottom: styles.spacing.md,
|
|
190
|
-
}}>
|
|
191
|
-
Delivery Address
|
|
192
|
-
</h3>
|
|
193
|
-
|
|
194
|
-
<div style={{
|
|
195
|
-
background: styles.colors.gray[50],
|
|
196
|
-
borderRadius: styles.borderRadius.md,
|
|
197
|
-
padding: styles.spacing.lg,
|
|
198
|
-
}}>
|
|
199
|
-
<div style={{
|
|
200
|
-
fontSize: styles.typography.fontSize.base,
|
|
201
|
-
color: styles.colors.gray[800],
|
|
202
|
-
lineHeight: styles.typography.lineHeight.relaxed,
|
|
203
|
-
}}>
|
|
204
|
-
{order.full_name && (
|
|
205
|
-
<div style={{
|
|
206
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
207
|
-
marginBottom: styles.spacing.xs,
|
|
208
|
-
}}>
|
|
209
|
-
{order.full_name}
|
|
210
|
-
</div>
|
|
211
|
-
)}
|
|
212
|
-
{order.street && <div>{order.street}</div>}
|
|
213
|
-
{(order.city || order.state || order.zip_code) && (
|
|
214
|
-
<div>{order.city}, {order.state} {order.zip_code}</div>
|
|
215
|
-
)}
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export default withToolData<OrderDetailsData>(OrderDetailsWidget);
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
-
import { OrderHistoryData } from '../../types/tool-data';
|
|
5
|
-
import * as styles from '../../styles/ecommerce';
|
|
6
|
-
|
|
7
|
-
function OrderHistoryWidget({ data }: { data: OrderHistoryData }) {
|
|
8
|
-
const { orders, pagination } = data;
|
|
9
|
-
|
|
10
|
-
if (orders.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 orders yet
|
|
24
|
-
</h3>
|
|
25
|
-
<p style={styles.metaTextStyle}>
|
|
26
|
-
Your order history will appear here
|
|
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
|
-
📦 Order History
|
|
41
|
-
</span>
|
|
42
|
-
<span style={{
|
|
43
|
-
...styles.badgeStyle,
|
|
44
|
-
background: styles.colors.primary,
|
|
45
|
-
color: styles.colors.black,
|
|
46
|
-
}}>
|
|
47
|
-
{orders.length} orders
|
|
48
|
-
</span>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div style={{
|
|
52
|
-
display: 'flex',
|
|
53
|
-
flexDirection: 'column',
|
|
54
|
-
gap: styles.spacing.lg,
|
|
55
|
-
}}>
|
|
56
|
-
{orders.map((order) => (
|
|
57
|
-
<div
|
|
58
|
-
key={order.id}
|
|
59
|
-
style={{
|
|
60
|
-
...styles.cardStyle,
|
|
61
|
-
cursor: 'pointer',
|
|
62
|
-
}}
|
|
63
|
-
onMouseEnter={(e) => {
|
|
64
|
-
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
65
|
-
e.currentTarget.style.boxShadow = styles.shadows.lg;
|
|
66
|
-
}}
|
|
67
|
-
onMouseLeave={(e) => {
|
|
68
|
-
e.currentTarget.style.transform = 'translateY(0)';
|
|
69
|
-
e.currentTarget.style.boxShadow = styles.shadows.md;
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<div style={{
|
|
73
|
-
display: 'flex',
|
|
74
|
-
justifyContent: 'space-between',
|
|
75
|
-
alignItems: 'flex-start',
|
|
76
|
-
marginBottom: styles.spacing.md,
|
|
77
|
-
}}>
|
|
78
|
-
<div>
|
|
79
|
-
<div style={{
|
|
80
|
-
fontSize: styles.typography.fontSize.lg,
|
|
81
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
82
|
-
color: styles.colors.gray[900],
|
|
83
|
-
marginBottom: styles.spacing.xs,
|
|
84
|
-
}}>
|
|
85
|
-
Order #{order.id.substring(0, 8).toUpperCase()}
|
|
86
|
-
</div>
|
|
87
|
-
<div style={styles.metaTextStyle}>
|
|
88
|
-
{new Date(order.created_at).toLocaleDateString('en-US', {
|
|
89
|
-
year: 'numeric',
|
|
90
|
-
month: 'long',
|
|
91
|
-
day: 'numeric',
|
|
92
|
-
})}
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<div style={{
|
|
97
|
-
...styles.badgeStyle,
|
|
98
|
-
background: order.status === 'pending'
|
|
99
|
-
? styles.colors.warning
|
|
100
|
-
: order.status === 'delivered'
|
|
101
|
-
? styles.colors.success
|
|
102
|
-
: styles.colors.primary,
|
|
103
|
-
color: styles.colors.white,
|
|
104
|
-
}}>
|
|
105
|
-
{order.status}
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
{order.items && order.items.length > 0 && (
|
|
110
|
-
<div style={{
|
|
111
|
-
display: 'flex',
|
|
112
|
-
gap: styles.spacing.sm,
|
|
113
|
-
marginBottom: styles.spacing.md,
|
|
114
|
-
overflowX: 'auto',
|
|
115
|
-
}}>
|
|
116
|
-
{order.items.slice(0, 4).map((item) => (
|
|
117
|
-
item.image_url && (
|
|
118
|
-
<div
|
|
119
|
-
key={item.id}
|
|
120
|
-
style={{
|
|
121
|
-
width: '60px',
|
|
122
|
-
height: '60px',
|
|
123
|
-
flexShrink: 0,
|
|
124
|
-
borderRadius: styles.borderRadius.md,
|
|
125
|
-
overflow: 'hidden',
|
|
126
|
-
background: styles.colors.gray[100],
|
|
127
|
-
border: `2px solid ${styles.colors.white}`,
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
<img
|
|
131
|
-
src={item.image_url}
|
|
132
|
-
alt={item.name}
|
|
133
|
-
style={{
|
|
134
|
-
width: '100%',
|
|
135
|
-
height: '100%',
|
|
136
|
-
objectFit: 'cover',
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
</div>
|
|
140
|
-
)
|
|
141
|
-
))}
|
|
142
|
-
{order.items.length > 4 && (
|
|
143
|
-
<div style={{
|
|
144
|
-
width: '60px',
|
|
145
|
-
height: '60px',
|
|
146
|
-
flexShrink: 0,
|
|
147
|
-
borderRadius: styles.borderRadius.md,
|
|
148
|
-
background: styles.colors.gray[200],
|
|
149
|
-
display: 'flex',
|
|
150
|
-
alignItems: 'center',
|
|
151
|
-
justifyContent: 'center',
|
|
152
|
-
fontSize: styles.typography.fontSize.sm,
|
|
153
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
154
|
-
color: styles.colors.gray[600],
|
|
155
|
-
}}>
|
|
156
|
-
+{order.items.length - 4}
|
|
157
|
-
</div>
|
|
158
|
-
)}
|
|
159
|
-
</div>
|
|
160
|
-
)}
|
|
161
|
-
|
|
162
|
-
<div style={{
|
|
163
|
-
display: 'flex',
|
|
164
|
-
justifyContent: 'space-between',
|
|
165
|
-
alignItems: 'center',
|
|
166
|
-
paddingTop: styles.spacing.md,
|
|
167
|
-
borderTop: `1px solid ${styles.colors.gray[200]}`,
|
|
168
|
-
}}>
|
|
169
|
-
<div>
|
|
170
|
-
<div style={styles.metaTextStyle}>
|
|
171
|
-
{order.itemCount || order.items?.length || 0} {(order.itemCount || order.items?.length || 0) === 1 ? 'item' : 'items'}
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<div style={{
|
|
176
|
-
fontSize: styles.typography.fontSize['2xl'],
|
|
177
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
178
|
-
color: styles.colors.primary,
|
|
179
|
-
}}>
|
|
180
|
-
${order.total.toFixed(2)}
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
{order.full_name && (
|
|
185
|
-
<div style={{
|
|
186
|
-
marginTop: styles.spacing.md,
|
|
187
|
-
padding: styles.spacing.md,
|
|
188
|
-
background: styles.colors.gray[50],
|
|
189
|
-
borderRadius: styles.borderRadius.md,
|
|
190
|
-
fontSize: styles.typography.fontSize.sm,
|
|
191
|
-
color: styles.colors.gray[700],
|
|
192
|
-
}}>
|
|
193
|
-
📍 Delivered to: {order.full_name}, {order.city}, {order.state}
|
|
194
|
-
</div>
|
|
195
|
-
)}
|
|
196
|
-
</div>
|
|
197
|
-
))}
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
{pagination.totalPages > 1 && (
|
|
201
|
-
<div style={{
|
|
202
|
-
marginTop: styles.spacing.xl,
|
|
203
|
-
textAlign: 'center',
|
|
204
|
-
padding: styles.spacing.lg,
|
|
205
|
-
background: styles.colors.white,
|
|
206
|
-
borderRadius: styles.borderRadius.md,
|
|
207
|
-
boxShadow: styles.shadows.sm,
|
|
208
|
-
}}>
|
|
209
|
-
<div style={styles.metaTextStyle}>
|
|
210
|
-
Page {pagination.page} of {pagination.totalPages} • {pagination.total} total orders
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
)}
|
|
214
|
-
</div>
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export default withToolData<OrderHistoryData>(OrderHistoryWidget);
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { withToolData } from 'nitrostack/widgets';
|
|
4
|
-
import { ProductCardData } from '../../types/tool-data';
|
|
5
|
-
import * as styles from '../../styles/ecommerce';
|
|
6
|
-
|
|
7
|
-
function ProductCardWidget({ data }: { data: ProductCardData }) {
|
|
8
|
-
const { product } = data;
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div style={styles.containerStyle}>
|
|
12
|
-
<div style={{
|
|
13
|
-
...styles.cardStyle,
|
|
14
|
-
maxWidth: '600px',
|
|
15
|
-
margin: '0 auto',
|
|
16
|
-
overflow: 'hidden',
|
|
17
|
-
padding: 0,
|
|
18
|
-
}}>
|
|
19
|
-
<div style={{
|
|
20
|
-
position: 'relative',
|
|
21
|
-
paddingTop: '60%',
|
|
22
|
-
background: styles.colors.gray[100],
|
|
23
|
-
}}>
|
|
24
|
-
<img
|
|
25
|
-
src={product.image_url}
|
|
26
|
-
alt={product.name}
|
|
27
|
-
style={{
|
|
28
|
-
position: 'absolute',
|
|
29
|
-
top: 0,
|
|
30
|
-
left: 0,
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%',
|
|
33
|
-
objectFit: 'cover',
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
<div style={{
|
|
37
|
-
position: 'absolute',
|
|
38
|
-
top: styles.spacing.lg,
|
|
39
|
-
right: styles.spacing.lg,
|
|
40
|
-
...styles.badgeStyle,
|
|
41
|
-
background: styles.colors.white,
|
|
42
|
-
boxShadow: styles.shadows.lg,
|
|
43
|
-
padding: `${styles.spacing.sm} ${styles.spacing.md}`,
|
|
44
|
-
}}>
|
|
45
|
-
{product.stock > 0 ? `${product.stock} in stock` : 'Out of stock'}
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div style={{ padding: styles.spacing.xl }}>
|
|
50
|
-
<div style={{
|
|
51
|
-
fontSize: styles.typography.fontSize.sm,
|
|
52
|
-
color: styles.colors.gray[500],
|
|
53
|
-
marginBottom: styles.spacing.sm,
|
|
54
|
-
textTransform: 'uppercase',
|
|
55
|
-
letterSpacing: '1px',
|
|
56
|
-
fontWeight: styles.typography.fontWeight.semibold,
|
|
57
|
-
}}>
|
|
58
|
-
{product.category}
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<h1 style={{
|
|
62
|
-
fontSize: styles.typography.fontSize['3xl'],
|
|
63
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
64
|
-
color: styles.colors.gray[900],
|
|
65
|
-
marginBottom: styles.spacing.md,
|
|
66
|
-
lineHeight: styles.typography.lineHeight.tight,
|
|
67
|
-
}}>
|
|
68
|
-
{product.name}
|
|
69
|
-
</h1>
|
|
70
|
-
|
|
71
|
-
<p style={{
|
|
72
|
-
fontSize: styles.typography.fontSize.base,
|
|
73
|
-
color: styles.colors.gray[700],
|
|
74
|
-
lineHeight: styles.typography.lineHeight.relaxed,
|
|
75
|
-
marginBottom: styles.spacing.xl,
|
|
76
|
-
}}>
|
|
77
|
-
{product.description}
|
|
78
|
-
</p>
|
|
79
|
-
|
|
80
|
-
<div style={{
|
|
81
|
-
display: 'flex',
|
|
82
|
-
justifyContent: 'space-between',
|
|
83
|
-
alignItems: 'center',
|
|
84
|
-
paddingTop: styles.spacing.lg,
|
|
85
|
-
borderTop: `2px solid ${styles.colors.gray[200]}`,
|
|
86
|
-
}}>
|
|
87
|
-
<div>
|
|
88
|
-
<div style={{
|
|
89
|
-
fontSize: styles.typography.fontSize.sm,
|
|
90
|
-
color: styles.colors.gray[500],
|
|
91
|
-
marginBottom: styles.spacing.xs,
|
|
92
|
-
}}>
|
|
93
|
-
Price
|
|
94
|
-
</div>
|
|
95
|
-
<div style={{
|
|
96
|
-
fontSize: styles.typography.fontSize['3xl'],
|
|
97
|
-
fontWeight: styles.typography.fontWeight.bold,
|
|
98
|
-
color: styles.colors.primary,
|
|
99
|
-
}}>
|
|
100
|
-
${product.price.toFixed(2)}
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
<div style={{
|
|
105
|
-
...styles.buttonStyle,
|
|
106
|
-
padding: `${styles.spacing.lg} ${styles.spacing['2xl']}`,
|
|
107
|
-
fontSize: styles.typography.fontSize.base,
|
|
108
|
-
display: 'flex',
|
|
109
|
-
alignItems: 'center',
|
|
110
|
-
gap: styles.spacing.sm,
|
|
111
|
-
}}>
|
|
112
|
-
🛒 Add to Cart
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export default withToolData<ProductCardData>(ProductCardWidget);
|