nitrostack 1.0.55 → 1.0.57

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