@rovela-ai/sdk 0.1.2 → 0.1.3
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/admin/api/auth.d.ts +32 -0
- package/dist/admin/api/auth.d.ts.map +1 -0
- package/dist/admin/api/auth.js +43 -0
- package/dist/admin/api/auth.js.map +1 -0
- package/dist/admin/api/categories.d.ts +68 -0
- package/dist/admin/api/categories.d.ts.map +1 -0
- package/dist/admin/api/categories.js +247 -0
- package/dist/admin/api/categories.js.map +1 -0
- package/dist/admin/api/customers.d.ts +41 -0
- package/dist/admin/api/customers.d.ts.map +1 -0
- package/dist/admin/api/customers.js +113 -0
- package/dist/admin/api/customers.js.map +1 -0
- package/dist/admin/api/index.d.ts +56 -0
- package/dist/admin/api/index.d.ts.map +1 -0
- package/dist/admin/api/index.js +87 -0
- package/dist/admin/api/index.js.map +1 -0
- package/dist/admin/api/orders.d.ts +59 -0
- package/dist/admin/api/orders.d.ts.map +1 -0
- package/dist/admin/api/orders.js +209 -0
- package/dist/admin/api/orders.js.map +1 -0
- package/dist/admin/api/products.d.ts +103 -0
- package/dist/admin/api/products.d.ts.map +1 -0
- package/dist/admin/api/products.js +329 -0
- package/dist/admin/api/products.js.map +1 -0
- package/dist/admin/api/refund.d.ts +29 -0
- package/dist/admin/api/refund.d.ts.map +1 -0
- package/dist/admin/api/refund.js +136 -0
- package/dist/admin/api/refund.js.map +1 -0
- package/dist/admin/api/stats.d.ts +40 -0
- package/dist/admin/api/stats.d.ts.map +1 -0
- package/dist/admin/api/stats.js +74 -0
- package/dist/admin/api/stats.js.map +1 -0
- package/dist/admin/components/AdminGuard.d.ts +40 -0
- package/dist/admin/components/AdminGuard.d.ts.map +1 -0
- package/dist/admin/components/AdminGuard.js +97 -0
- package/dist/admin/components/AdminGuard.js.map +1 -0
- package/dist/admin/components/AdminHeader.d.ts +18 -0
- package/dist/admin/components/AdminHeader.d.ts.map +1 -0
- package/dist/admin/components/AdminHeader.js +33 -0
- package/dist/admin/components/AdminHeader.js.map +1 -0
- package/dist/admin/components/AdminLayout.d.ts +50 -0
- package/dist/admin/components/AdminLayout.d.ts.map +1 -0
- package/dist/admin/components/AdminLayout.js +46 -0
- package/dist/admin/components/AdminLayout.js.map +1 -0
- package/dist/admin/components/AdminLoginForm.d.ts +18 -0
- package/dist/admin/components/AdminLoginForm.d.ts.map +1 -0
- package/dist/admin/components/AdminLoginForm.js +58 -0
- package/dist/admin/components/AdminLoginForm.js.map +1 -0
- package/dist/admin/components/AdminNav.d.ts +34 -0
- package/dist/admin/components/AdminNav.d.ts.map +1 -0
- package/dist/admin/components/AdminNav.js +61 -0
- package/dist/admin/components/AdminNav.js.map +1 -0
- package/dist/admin/components/InventoryEditor.d.ts +15 -0
- package/dist/admin/components/InventoryEditor.d.ts.map +1 -0
- package/dist/admin/components/InventoryEditor.js +83 -0
- package/dist/admin/components/InventoryEditor.js.map +1 -0
- package/dist/admin/components/LowStockAlert.d.ts +11 -0
- package/dist/admin/components/LowStockAlert.d.ts.map +1 -0
- package/dist/admin/components/LowStockAlert.js +35 -0
- package/dist/admin/components/LowStockAlert.js.map +1 -0
- package/dist/admin/components/OrderDetails.d.ts +14 -0
- package/dist/admin/components/OrderDetails.d.ts.map +1 -0
- package/dist/admin/components/OrderDetails.js +94 -0
- package/dist/admin/components/OrderDetails.js.map +1 -0
- package/dist/admin/components/OrderTable.d.ts +13 -0
- package/dist/admin/components/OrderTable.d.ts.map +1 -0
- package/dist/admin/components/OrderTable.js +89 -0
- package/dist/admin/components/OrderTable.js.map +1 -0
- package/dist/admin/components/ProductForm.d.ts +18 -0
- package/dist/admin/components/ProductForm.d.ts.map +1 -0
- package/dist/admin/components/ProductForm.js +127 -0
- package/dist/admin/components/ProductForm.js.map +1 -0
- package/dist/admin/components/ProductTable.d.ts +13 -0
- package/dist/admin/components/ProductTable.d.ts.map +1 -0
- package/dist/admin/components/ProductTable.js +81 -0
- package/dist/admin/components/ProductTable.js.map +1 -0
- package/dist/admin/components/RecentOrders.d.ts +11 -0
- package/dist/admin/components/RecentOrders.d.ts.map +1 -0
- package/dist/admin/components/RecentOrders.js +58 -0
- package/dist/admin/components/RecentOrders.js.map +1 -0
- package/dist/admin/components/RefundDialog.d.ts +17 -0
- package/dist/admin/components/RefundDialog.d.ts.map +1 -0
- package/dist/admin/components/RefundDialog.js +86 -0
- package/dist/admin/components/RefundDialog.js.map +1 -0
- package/dist/admin/components/StatsCards.d.ts +23 -0
- package/dist/admin/components/StatsCards.d.ts.map +1 -0
- package/dist/admin/components/StatsCards.js +82 -0
- package/dist/admin/components/StatsCards.js.map +1 -0
- package/dist/admin/components/StoreSettings.d.ts +14 -0
- package/dist/admin/components/StoreSettings.d.ts.map +1 -0
- package/dist/admin/components/StoreSettings.js +88 -0
- package/dist/admin/components/StoreSettings.js.map +1 -0
- package/dist/admin/components/index.d.ts +21 -0
- package/dist/admin/components/index.d.ts.map +1 -0
- package/dist/admin/components/index.js +57 -0
- package/dist/admin/components/index.js.map +1 -0
- package/dist/admin/config.d.ts +74 -0
- package/dist/admin/config.d.ts.map +1 -0
- package/dist/admin/config.js +229 -0
- package/dist/admin/config.js.map +1 -0
- package/dist/admin/hooks/index.d.ts +10 -0
- package/dist/admin/hooks/index.d.ts.map +1 -0
- package/dist/admin/hooks/index.js +17 -0
- package/dist/admin/hooks/index.js.map +1 -0
- package/dist/admin/hooks/useAdminOrders.d.ts +41 -0
- package/dist/admin/hooks/useAdminOrders.d.ts.map +1 -0
- package/dist/admin/hooks/useAdminOrders.js +191 -0
- package/dist/admin/hooks/useAdminOrders.js.map +1 -0
- package/dist/admin/hooks/useAdminProducts.d.ts +39 -0
- package/dist/admin/hooks/useAdminProducts.d.ts.map +1 -0
- package/dist/admin/hooks/useAdminProducts.js +235 -0
- package/dist/admin/hooks/useAdminProducts.js.map +1 -0
- package/dist/admin/hooks/useAdminStats.d.ts +50 -0
- package/dist/admin/hooks/useAdminStats.d.ts.map +1 -0
- package/dist/admin/hooks/useAdminStats.js +111 -0
- package/dist/admin/hooks/useAdminStats.js.map +1 -0
- package/dist/admin/index.d.ts +63 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +148 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/server/admin-service.d.ts +130 -0
- package/dist/admin/server/admin-service.d.ts.map +1 -0
- package/dist/admin/server/admin-service.js +298 -0
- package/dist/admin/server/admin-service.js.map +1 -0
- package/dist/admin/server/index.d.ts +8 -0
- package/dist/admin/server/index.d.ts.map +1 -0
- package/dist/admin/server/index.js +25 -0
- package/dist/admin/server/index.js.map +1 -0
- package/dist/admin/types.d.ts +549 -0
- package/dist/admin/types.d.ts.map +1 -0
- package/dist/admin/types.js +11 -0
- package/dist/admin/types.js.map +1 -0
- package/dist/auth/api/auth.d.ts +54 -0
- package/dist/auth/api/auth.d.ts.map +1 -0
- package/dist/auth/api/auth.js +67 -0
- package/dist/auth/api/auth.js.map +1 -0
- package/dist/auth/api/forgot-password.d.ts +41 -0
- package/dist/auth/api/forgot-password.d.ts.map +1 -0
- package/dist/auth/api/forgot-password.js +68 -0
- package/dist/auth/api/forgot-password.js.map +1 -0
- package/dist/auth/api/index.d.ts +34 -0
- package/dist/auth/api/index.d.ts.map +1 -0
- package/dist/auth/api/index.js +52 -0
- package/dist/auth/api/index.js.map +1 -0
- package/dist/auth/api/register.d.ts +41 -0
- package/dist/auth/api/register.d.ts.map +1 -0
- package/dist/auth/api/register.js +93 -0
- package/dist/auth/api/register.js.map +1 -0
- package/dist/auth/api/resend-verification.d.ts +41 -0
- package/dist/auth/api/resend-verification.d.ts.map +1 -0
- package/dist/auth/api/resend-verification.js +71 -0
- package/dist/auth/api/resend-verification.js.map +1 -0
- package/dist/auth/api/reset-password.d.ts +67 -0
- package/dist/auth/api/reset-password.d.ts.map +1 -0
- package/dist/auth/api/reset-password.js +110 -0
- package/dist/auth/api/reset-password.js.map +1 -0
- package/dist/auth/api/verify-email.d.ts +47 -0
- package/dist/auth/api/verify-email.d.ts.map +1 -0
- package/dist/auth/api/verify-email.js +94 -0
- package/dist/auth/api/verify-email.js.map +1 -0
- package/dist/auth/components/AuthGuard.d.ts +52 -0
- package/dist/auth/components/AuthGuard.d.ts.map +1 -0
- package/dist/auth/components/AuthGuard.js +113 -0
- package/dist/auth/components/AuthGuard.js.map +1 -0
- package/dist/auth/components/ForgotPasswordForm.d.ts +15 -0
- package/dist/auth/components/ForgotPasswordForm.d.ts.map +1 -0
- package/dist/auth/components/ForgotPasswordForm.js +44 -0
- package/dist/auth/components/ForgotPasswordForm.js.map +1 -0
- package/dist/auth/components/ResetPasswordForm.d.ts +18 -0
- package/dist/auth/components/ResetPasswordForm.d.ts.map +1 -0
- package/dist/auth/components/ResetPasswordForm.js +88 -0
- package/dist/auth/components/ResetPasswordForm.js.map +1 -0
- package/dist/auth/components/SignInForm.d.ts +21 -0
- package/dist/auth/components/SignInForm.d.ts.map +1 -0
- package/dist/auth/components/SignInForm.js +63 -0
- package/dist/auth/components/SignInForm.js.map +1 -0
- package/dist/auth/components/SignUpForm.d.ts +18 -0
- package/dist/auth/components/SignUpForm.d.ts.map +1 -0
- package/dist/auth/components/SignUpForm.js +79 -0
- package/dist/auth/components/SignUpForm.js.map +1 -0
- package/dist/auth/components/UserMenu.d.ts +18 -0
- package/dist/auth/components/UserMenu.d.ts.map +1 -0
- package/dist/auth/components/UserMenu.js +75 -0
- package/dist/auth/components/UserMenu.js.map +1 -0
- package/dist/auth/components/VerifyEmailNotice.d.ts +20 -0
- package/dist/auth/components/VerifyEmailNotice.d.ts.map +1 -0
- package/dist/auth/components/VerifyEmailNotice.js +59 -0
- package/dist/auth/components/VerifyEmailNotice.js.map +1 -0
- package/dist/auth/components/index.d.ts +13 -0
- package/dist/auth/components/index.d.ts.map +1 -0
- package/dist/auth/components/index.js +24 -0
- package/dist/auth/components/index.js.map +1 -0
- package/dist/auth/config.d.ts +42 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/config.js +174 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/hooks/index.d.ts +7 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +11 -0
- package/dist/auth/hooks/index.js.map +1 -0
- package/dist/auth/index.d.ts +54 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +88 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/server/customer-service.d.ts +138 -0
- package/dist/auth/server/customer-service.d.ts.map +1 -0
- package/dist/auth/server/customer-service.js +309 -0
- package/dist/auth/server/customer-service.js.map +1 -0
- package/dist/auth/server/email-sender.d.ts +64 -0
- package/dist/auth/server/email-sender.d.ts.map +1 -0
- package/dist/auth/server/email-sender.js +112 -0
- package/dist/auth/server/email-sender.js.map +1 -0
- package/dist/auth/server/index.d.ts +13 -0
- package/dist/auth/server/index.d.ts.map +1 -0
- package/dist/auth/server/index.js +48 -0
- package/dist/auth/server/index.js.map +1 -0
- package/dist/auth/server/password-reset-service.d.ts +86 -0
- package/dist/auth/server/password-reset-service.d.ts.map +1 -0
- package/dist/auth/server/password-reset-service.js +236 -0
- package/dist/auth/server/password-reset-service.js.map +1 -0
- package/dist/auth/server/password.d.ts +58 -0
- package/dist/auth/server/password.d.ts.map +1 -0
- package/dist/auth/server/password.js +94 -0
- package/dist/auth/server/password.js.map +1 -0
- package/dist/auth/server/verification-service.d.ts +87 -0
- package/dist/auth/server/verification-service.d.ts.map +1 -0
- package/dist/auth/server/verification-service.js +268 -0
- package/dist/auth/server/verification-service.js.map +1 -0
- package/dist/auth/types.d.ts +305 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +8 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/cart/CartProvider.d.ts +65 -0
- package/dist/cart/CartProvider.d.ts.map +1 -0
- package/dist/cart/CartProvider.js +101 -0
- package/dist/cart/CartProvider.js.map +1 -0
- package/dist/cart/components/AddToCartButton.d.ts +77 -0
- package/dist/cart/components/AddToCartButton.d.ts.map +1 -0
- package/dist/cart/components/AddToCartButton.js +124 -0
- package/dist/cart/components/AddToCartButton.js.map +1 -0
- package/dist/cart/components/CartDrawer.d.ts +71 -0
- package/dist/cart/components/CartDrawer.d.ts.map +1 -0
- package/dist/cart/components/CartDrawer.js +108 -0
- package/dist/cart/components/CartDrawer.js.map +1 -0
- package/dist/cart/components/CartIcon.d.ts +36 -0
- package/dist/cart/components/CartIcon.d.ts.map +1 -0
- package/dist/cart/components/CartIcon.js +70 -0
- package/dist/cart/components/CartIcon.js.map +1 -0
- package/dist/cart/components/CartItem.d.ts +52 -0
- package/dist/cart/components/CartItem.d.ts.map +1 -0
- package/dist/cart/components/CartItem.js +55 -0
- package/dist/cart/components/CartItem.js.map +1 -0
- package/dist/cart/components/CartSummary.d.ts +43 -0
- package/dist/cart/components/CartSummary.d.ts.map +1 -0
- package/dist/cart/components/CartSummary.js +58 -0
- package/dist/cart/components/CartSummary.js.map +1 -0
- package/dist/cart/components/QuantitySelector.d.ts +39 -0
- package/dist/cart/components/QuantitySelector.d.ts.map +1 -0
- package/dist/cart/components/QuantitySelector.js +87 -0
- package/dist/cart/components/QuantitySelector.js.map +1 -0
- package/dist/cart/components/index.d.ts +18 -0
- package/dist/cart/components/index.d.ts.map +1 -0
- package/dist/cart/components/index.js +21 -0
- package/dist/cart/components/index.js.map +1 -0
- package/dist/cart/index.d.ts +109 -0
- package/dist/cart/index.d.ts.map +1 -0
- package/dist/cart/index.js +129 -0
- package/dist/cart/index.js.map +1 -0
- package/dist/cart/store.d.ts +101 -0
- package/dist/cart/store.d.ts.map +1 -0
- package/dist/cart/store.js +207 -0
- package/dist/cart/store.js.map +1 -0
- package/dist/checkout/api/checkout.d.ts +31 -0
- package/dist/checkout/api/checkout.d.ts.map +1 -0
- package/dist/checkout/api/checkout.js +103 -0
- package/dist/checkout/api/checkout.js.map +1 -0
- package/dist/checkout/api/index.d.ts +8 -0
- package/dist/checkout/api/index.d.ts.map +1 -0
- package/dist/checkout/api/index.js +13 -0
- package/dist/checkout/api/index.js.map +1 -0
- package/dist/checkout/api/webhook.d.ts +30 -0
- package/dist/checkout/api/webhook.d.ts.map +1 -0
- package/dist/checkout/api/webhook.js +58 -0
- package/dist/checkout/api/webhook.js.map +1 -0
- package/dist/checkout/components/CheckoutButton.d.ts +44 -0
- package/dist/checkout/components/CheckoutButton.d.ts.map +1 -0
- package/dist/checkout/components/CheckoutButton.js +97 -0
- package/dist/checkout/components/CheckoutButton.js.map +1 -0
- package/dist/checkout/components/CheckoutSuccess.d.ts +29 -0
- package/dist/checkout/components/CheckoutSuccess.d.ts.map +1 -0
- package/dist/checkout/components/CheckoutSuccess.js +60 -0
- package/dist/checkout/components/CheckoutSuccess.js.map +1 -0
- package/dist/checkout/components/OrderSummary.d.ts +37 -0
- package/dist/checkout/components/OrderSummary.d.ts.map +1 -0
- package/dist/checkout/components/OrderSummary.js +70 -0
- package/dist/checkout/components/OrderSummary.js.map +1 -0
- package/dist/checkout/components/ShippingForm.d.ts +30 -0
- package/dist/checkout/components/ShippingForm.d.ts.map +1 -0
- package/dist/checkout/components/ShippingForm.js +125 -0
- package/dist/checkout/components/ShippingForm.js.map +1 -0
- package/dist/checkout/components/index.d.ts +10 -0
- package/dist/checkout/components/index.d.ts.map +1 -0
- package/dist/checkout/components/index.js +17 -0
- package/dist/checkout/components/index.js.map +1 -0
- package/dist/checkout/hooks/index.d.ts +7 -0
- package/dist/checkout/hooks/index.d.ts.map +1 -0
- package/dist/checkout/hooks/index.js +12 -0
- package/dist/checkout/hooks/index.js.map +1 -0
- package/dist/checkout/hooks/useCheckout.d.ts +61 -0
- package/dist/checkout/hooks/useCheckout.d.ts.map +1 -0
- package/dist/checkout/hooks/useCheckout.js +174 -0
- package/dist/checkout/hooks/useCheckout.js.map +1 -0
- package/dist/checkout/index.d.ts +111 -0
- package/dist/checkout/index.d.ts.map +1 -0
- package/dist/checkout/index.js +148 -0
- package/dist/checkout/index.js.map +1 -0
- package/dist/checkout/server/create-checkout-session.d.ts +69 -0
- package/dist/checkout/server/create-checkout-session.d.ts.map +1 -0
- package/dist/checkout/server/create-checkout-session.js +190 -0
- package/dist/checkout/server/create-checkout-session.js.map +1 -0
- package/dist/checkout/server/handle-webhook.d.ts +35 -0
- package/dist/checkout/server/handle-webhook.d.ts.map +1 -0
- package/dist/checkout/server/handle-webhook.js +279 -0
- package/dist/checkout/server/handle-webhook.js.map +1 -0
- package/dist/checkout/server/index.d.ts +10 -0
- package/dist/checkout/server/index.d.ts.map +1 -0
- package/dist/checkout/server/index.js +19 -0
- package/dist/checkout/server/index.js.map +1 -0
- package/dist/checkout/server/order-service.d.ts +43 -0
- package/dist/checkout/server/order-service.d.ts.map +1 -0
- package/dist/checkout/server/order-service.js +196 -0
- package/dist/checkout/server/order-service.js.map +1 -0
- package/dist/checkout/stripe/client.d.ts +72 -0
- package/dist/checkout/stripe/client.d.ts.map +1 -0
- package/dist/checkout/stripe/client.js +189 -0
- package/dist/checkout/stripe/client.js.map +1 -0
- package/dist/checkout/stripe/index.d.ts +7 -0
- package/dist/checkout/stripe/index.d.ts.map +1 -0
- package/dist/checkout/stripe/index.js +21 -0
- package/dist/checkout/stripe/index.js.map +1 -0
- package/dist/checkout/types.d.ts +263 -0
- package/dist/checkout/types.d.ts.map +1 -0
- package/dist/checkout/types.js +9 -0
- package/dist/checkout/types.js.map +1 -0
- package/dist/core/config.d.ts +296 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +162 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/db/client.d.ts +69 -0
- package/dist/core/db/client.d.ts.map +1 -0
- package/dist/core/db/client.js +202 -0
- package/dist/core/db/client.js.map +1 -0
- package/dist/core/db/index.d.ts +11 -0
- package/dist/core/db/index.d.ts.map +1 -0
- package/dist/core/db/index.js +87 -0
- package/dist/core/db/index.js.map +1 -0
- package/dist/core/db/queries.d.ts +658 -0
- package/dist/core/db/queries.d.ts.map +1 -0
- package/dist/core/db/queries.js +735 -0
- package/dist/core/db/queries.js.map +1 -0
- package/dist/core/db/schema.d.ts +1628 -0
- package/dist/core/db/schema.d.ts.map +1 -0
- package/dist/core/db/schema.js +262 -0
- package/dist/core/db/schema.js.map +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +71 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/server/index.d.ts +17 -0
- package/dist/core/server/index.d.ts.map +1 -0
- package/dist/core/server/index.js +68 -0
- package/dist/core/server/index.js.map +1 -0
- package/dist/core/types.d.ts +230 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils.d.ts +153 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/utils.js +356 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/emails/config.d.ts +42 -0
- package/dist/emails/config.d.ts.map +1 -0
- package/dist/emails/config.js +89 -0
- package/dist/emails/config.js.map +1 -0
- package/dist/emails/index.d.ts +85 -0
- package/dist/emails/index.d.ts.map +1 -0
- package/dist/emails/index.js +170 -0
- package/dist/emails/index.js.map +1 -0
- package/dist/emails/send/auth.d.ts +91 -0
- package/dist/emails/send/auth.d.ts.map +1 -0
- package/dist/emails/send/auth.js +132 -0
- package/dist/emails/send/auth.js.map +1 -0
- package/dist/emails/send/index.d.ts +10 -0
- package/dist/emails/send/index.d.ts.map +1 -0
- package/dist/emails/send/index.js +33 -0
- package/dist/emails/send/index.js.map +1 -0
- package/dist/emails/send/orders.d.ts +180 -0
- package/dist/emails/send/orders.d.ts.map +1 -0
- package/dist/emails/send/orders.js +259 -0
- package/dist/emails/send/orders.js.map +1 -0
- package/dist/emails/sender.d.ts +72 -0
- package/dist/emails/sender.d.ts.map +1 -0
- package/dist/emails/sender.js +118 -0
- package/dist/emails/sender.js.map +1 -0
- package/dist/emails/templates/base.d.ts +105 -0
- package/dist/emails/templates/base.d.ts.map +1 -0
- package/dist/emails/templates/base.js +291 -0
- package/dist/emails/templates/base.js.map +1 -0
- package/dist/emails/templates/email-verification.d.ts +28 -0
- package/dist/emails/templates/email-verification.d.ts.map +1 -0
- package/dist/emails/templates/email-verification.js +56 -0
- package/dist/emails/templates/email-verification.js.map +1 -0
- package/dist/emails/templates/index.d.ts +15 -0
- package/dist/emails/templates/index.d.ts.map +1 -0
- package/dist/emails/templates/index.js +58 -0
- package/dist/emails/templates/index.js.map +1 -0
- package/dist/emails/templates/order-cancelled.d.ts +30 -0
- package/dist/emails/templates/order-cancelled.d.ts.map +1 -0
- package/dist/emails/templates/order-cancelled.js +87 -0
- package/dist/emails/templates/order-cancelled.js.map +1 -0
- package/dist/emails/templates/order-confirmation.d.ts +36 -0
- package/dist/emails/templates/order-confirmation.d.ts.map +1 -0
- package/dist/emails/templates/order-confirmation.js +161 -0
- package/dist/emails/templates/order-confirmation.js.map +1 -0
- package/dist/emails/templates/order-delivered.d.ts +31 -0
- package/dist/emails/templates/order-delivered.d.ts.map +1 -0
- package/dist/emails/templates/order-delivered.js +95 -0
- package/dist/emails/templates/order-delivered.js.map +1 -0
- package/dist/emails/templates/order-shipped.d.ts +32 -0
- package/dist/emails/templates/order-shipped.d.ts.map +1 -0
- package/dist/emails/templates/order-shipped.js +87 -0
- package/dist/emails/templates/order-shipped.js.map +1 -0
- package/dist/emails/templates/password-reset.d.ts +27 -0
- package/dist/emails/templates/password-reset.d.ts.map +1 -0
- package/dist/emails/templates/password-reset.js +55 -0
- package/dist/emails/templates/password-reset.js.map +1 -0
- package/dist/emails/templates/refund-processed.d.ts +32 -0
- package/dist/emails/templates/refund-processed.d.ts.map +1 -0
- package/dist/emails/templates/refund-processed.js +96 -0
- package/dist/emails/templates/refund-processed.js.map +1 -0
- package/dist/emails/templates/welcome.d.ts +27 -0
- package/dist/emails/templates/welcome.d.ts.map +1 -0
- package/dist/emails/templates/welcome.js +56 -0
- package/dist/emails/templates/welcome.js.map +1 -0
- package/dist/emails/types.d.ts +202 -0
- package/dist/emails/types.d.ts.map +1 -0
- package/dist/emails/types.js +8 -0
- package/dist/emails/types.js.map +1 -0
- package/dist/emails/utils.d.ts +94 -0
- package/dist/emails/utils.d.ts.map +1 -0
- package/dist/emails/utils.js +229 -0
- package/dist/emails/utils.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +225 -0
- package/dist/index.js.map +1 -0
- package/dist/products/api/categories.d.ts +29 -0
- package/dist/products/api/categories.d.ts.map +1 -0
- package/dist/products/api/categories.js +49 -0
- package/dist/products/api/categories.js.map +1 -0
- package/dist/products/api/index.d.ts +24 -0
- package/dist/products/api/index.d.ts.map +1 -0
- package/dist/products/api/index.js +30 -0
- package/dist/products/api/index.js.map +1 -0
- package/dist/products/api/product.d.ts +36 -0
- package/dist/products/api/product.d.ts.map +1 -0
- package/dist/products/api/product.js +70 -0
- package/dist/products/api/product.js.map +1 -0
- package/dist/products/api/products.d.ts +41 -0
- package/dist/products/api/products.d.ts.map +1 -0
- package/dist/products/api/products.js +102 -0
- package/dist/products/api/products.js.map +1 -0
- package/dist/products/components/CategoryNav.d.ts +51 -0
- package/dist/products/components/CategoryNav.d.ts.map +1 -0
- package/dist/products/components/CategoryNav.js +115 -0
- package/dist/products/components/CategoryNav.js.map +1 -0
- package/dist/products/components/ProductBreadcrumb.d.ts +52 -0
- package/dist/products/components/ProductBreadcrumb.d.ts.map +1 -0
- package/dist/products/components/ProductBreadcrumb.js +78 -0
- package/dist/products/components/ProductBreadcrumb.js.map +1 -0
- package/dist/products/components/ProductCard.d.ts +54 -0
- package/dist/products/components/ProductCard.d.ts.map +1 -0
- package/dist/products/components/ProductCard.js +65 -0
- package/dist/products/components/ProductCard.js.map +1 -0
- package/dist/products/components/ProductDetails.d.ts +63 -0
- package/dist/products/components/ProductDetails.d.ts.map +1 -0
- package/dist/products/components/ProductDetails.js +105 -0
- package/dist/products/components/ProductDetails.js.map +1 -0
- package/dist/products/components/ProductFilters.d.ts +70 -0
- package/dist/products/components/ProductFilters.d.ts.map +1 -0
- package/dist/products/components/ProductFilters.js +127 -0
- package/dist/products/components/ProductFilters.js.map +1 -0
- package/dist/products/components/ProductGallery.d.ts +37 -0
- package/dist/products/components/ProductGallery.d.ts.map +1 -0
- package/dist/products/components/ProductGallery.js +80 -0
- package/dist/products/components/ProductGallery.js.map +1 -0
- package/dist/products/components/ProductGrid.d.ts +50 -0
- package/dist/products/components/ProductGrid.d.ts.map +1 -0
- package/dist/products/components/ProductGrid.js +83 -0
- package/dist/products/components/ProductGrid.js.map +1 -0
- package/dist/products/components/ProductSearch.d.ts +43 -0
- package/dist/products/components/ProductSearch.d.ts.map +1 -0
- package/dist/products/components/ProductSearch.js +99 -0
- package/dist/products/components/ProductSearch.js.map +1 -0
- package/dist/products/components/ProductSort.d.ts +43 -0
- package/dist/products/components/ProductSort.d.ts.map +1 -0
- package/dist/products/components/ProductSort.js +61 -0
- package/dist/products/components/ProductSort.js.map +1 -0
- package/dist/products/components/VariantSelector.d.ts +43 -0
- package/dist/products/components/VariantSelector.d.ts.map +1 -0
- package/dist/products/components/VariantSelector.js +147 -0
- package/dist/products/components/VariantSelector.js.map +1 -0
- package/dist/products/components/index.d.ts +26 -0
- package/dist/products/components/index.d.ts.map +1 -0
- package/dist/products/components/index.js +32 -0
- package/dist/products/components/index.js.map +1 -0
- package/dist/products/hooks/index.d.ts +14 -0
- package/dist/products/hooks/index.d.ts.map +1 -0
- package/dist/products/hooks/index.js +17 -0
- package/dist/products/hooks/index.js.map +1 -0
- package/dist/products/hooks/useCategories.d.ts +56 -0
- package/dist/products/hooks/useCategories.d.ts.map +1 -0
- package/dist/products/hooks/useCategories.js +126 -0
- package/dist/products/hooks/useCategories.js.map +1 -0
- package/dist/products/hooks/useProduct.d.ts +44 -0
- package/dist/products/hooks/useProduct.d.ts.map +1 -0
- package/dist/products/hooks/useProduct.js +86 -0
- package/dist/products/hooks/useProduct.js.map +1 -0
- package/dist/products/hooks/useProductAttributes.d.ts +59 -0
- package/dist/products/hooks/useProductAttributes.d.ts.map +1 -0
- package/dist/products/hooks/useProductAttributes.js +148 -0
- package/dist/products/hooks/useProductAttributes.js.map +1 -0
- package/dist/products/hooks/useProducts.d.ts +67 -0
- package/dist/products/hooks/useProducts.d.ts.map +1 -0
- package/dist/products/hooks/useProducts.js +132 -0
- package/dist/products/hooks/useProducts.js.map +1 -0
- package/dist/products/index.d.ts +94 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +123 -0
- package/dist/products/index.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +70 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +77 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/colors.d.ts +148 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +219 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/theme/defaults.d.ts +212 -0
- package/dist/theme/defaults.d.ts.map +1 -0
- package/dist/theme/defaults.js +278 -0
- package/dist/theme/defaults.js.map +1 -0
- package/dist/theme/fonts.d.ts +59 -0
- package/dist/theme/fonts.d.ts.map +1 -0
- package/dist/theme/fonts.js +202 -0
- package/dist/theme/fonts.js.map +1 -0
- package/dist/theme/generator.d.ts +50 -0
- package/dist/theme/generator.d.ts.map +1 -0
- package/dist/theme/generator.js +322 -0
- package/dist/theme/generator.js.map +1 -0
- package/dist/theme/hooks.d.ts +110 -0
- package/dist/theme/hooks.d.ts.map +1 -0
- package/dist/theme/hooks.js +106 -0
- package/dist/theme/hooks.js.map +1 -0
- package/dist/theme/index.d.ts +37 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +85 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Product } from '../../core/types';
|
|
2
|
+
export interface UseProductsOptions {
|
|
3
|
+
/** Filter by category ID */
|
|
4
|
+
category?: string;
|
|
5
|
+
/** Search by product name */
|
|
6
|
+
search?: string;
|
|
7
|
+
/** Sort order */
|
|
8
|
+
sort?: 'newest' | 'price-asc' | 'price-desc' | 'name';
|
|
9
|
+
/** Filter by variant attributes */
|
|
10
|
+
attributes?: Record<string, string[]>;
|
|
11
|
+
/** Minimum price filter */
|
|
12
|
+
minPrice?: number;
|
|
13
|
+
/** Maximum price filter */
|
|
14
|
+
maxPrice?: number;
|
|
15
|
+
/** Page size (default 12) */
|
|
16
|
+
limit?: number;
|
|
17
|
+
/** Initial page (default 1) */
|
|
18
|
+
initialPage?: number;
|
|
19
|
+
/** API endpoint (default /api/products) */
|
|
20
|
+
endpoint?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UseProductsReturn {
|
|
23
|
+
/** List of products */
|
|
24
|
+
products: Product[];
|
|
25
|
+
/** Total number of products matching filters */
|
|
26
|
+
total: number;
|
|
27
|
+
/** Current page (1-based) */
|
|
28
|
+
page: number;
|
|
29
|
+
/** Whether data is currently loading */
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
/** Error if request failed */
|
|
32
|
+
error: Error | null;
|
|
33
|
+
/** Whether there are more products to load */
|
|
34
|
+
hasMore: boolean;
|
|
35
|
+
/** Load the next page of products */
|
|
36
|
+
loadMore: () => void;
|
|
37
|
+
/** Refresh the current page */
|
|
38
|
+
refresh: () => void;
|
|
39
|
+
/** Go to a specific page */
|
|
40
|
+
setPage: (page: number) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Hook for fetching and managing product listings.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* import { useProducts } from '@rovela/sdk/products'
|
|
48
|
+
*
|
|
49
|
+
* function ProductList() {
|
|
50
|
+
* const { products, isLoading, hasMore, loadMore } = useProducts({
|
|
51
|
+
* category: 'shirts',
|
|
52
|
+
* sort: 'price-asc',
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* if (isLoading) return <div>Loading...</div>
|
|
56
|
+
*
|
|
57
|
+
* return (
|
|
58
|
+
* <>
|
|
59
|
+
* <ProductGrid products={products} />
|
|
60
|
+
* {hasMore && <button onClick={loadMore}>Load More</button>}
|
|
61
|
+
* </>
|
|
62
|
+
* )
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function useProducts(options?: UseProductsOptions): UseProductsReturn;
|
|
67
|
+
//# sourceMappingURL=useProducts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../src/products/hooks/useProducts.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAM/C,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB;IACjB,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAA;IACrD,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACrC,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,uBAAuB;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,8BAA8B;IAC9B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAA;IAChB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,4BAA4B;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,iBAAiB,CA0H/E"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useProducts = useProducts;
|
|
5
|
+
/**
|
|
6
|
+
* @rovela/sdk/products/hooks/useProducts
|
|
7
|
+
*
|
|
8
|
+
* Hook for fetching product listings with filtering, sorting, and pagination.
|
|
9
|
+
*/
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Hook
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Hook for fetching and managing product listings.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { useProducts } from '@rovela/sdk/products'
|
|
20
|
+
*
|
|
21
|
+
* function ProductList() {
|
|
22
|
+
* const { products, isLoading, hasMore, loadMore } = useProducts({
|
|
23
|
+
* category: 'shirts',
|
|
24
|
+
* sort: 'price-asc',
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* if (isLoading) return <div>Loading...</div>
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <>
|
|
31
|
+
* <ProductGrid products={products} />
|
|
32
|
+
* {hasMore && <button onClick={loadMore}>Load More</button>}
|
|
33
|
+
* </>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function useProducts(options = {}) {
|
|
39
|
+
const { category, search, sort = 'newest', attributes, minPrice, maxPrice, limit = 12, initialPage = 1, endpoint = '/api/products', } = options;
|
|
40
|
+
const [products, setProducts] = (0, react_1.useState)([]);
|
|
41
|
+
const [total, setTotal] = (0, react_1.useState)(0);
|
|
42
|
+
const [page, setPage] = (0, react_1.useState)(initialPage);
|
|
43
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
44
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
45
|
+
const [hasMore, setHasMore] = (0, react_1.useState)(false);
|
|
46
|
+
// Track if we're appending (loadMore) or replacing (new filters)
|
|
47
|
+
const isAppending = (0, react_1.useRef)(false);
|
|
48
|
+
// Build query string
|
|
49
|
+
const buildQueryString = (0, react_1.useCallback)((pageNum) => {
|
|
50
|
+
const params = new URLSearchParams();
|
|
51
|
+
params.set('page', pageNum.toString());
|
|
52
|
+
params.set('limit', limit.toString());
|
|
53
|
+
params.set('sort', sort);
|
|
54
|
+
if (category)
|
|
55
|
+
params.set('category', category);
|
|
56
|
+
if (search)
|
|
57
|
+
params.set('search', search);
|
|
58
|
+
if (minPrice !== undefined)
|
|
59
|
+
params.set('minPrice', minPrice.toString());
|
|
60
|
+
if (maxPrice !== undefined)
|
|
61
|
+
params.set('maxPrice', maxPrice.toString());
|
|
62
|
+
if (attributes) {
|
|
63
|
+
params.set('attributes', JSON.stringify(attributes));
|
|
64
|
+
}
|
|
65
|
+
return params.toString();
|
|
66
|
+
}, [category, search, sort, attributes, minPrice, maxPrice, limit]);
|
|
67
|
+
// Fetch products
|
|
68
|
+
const fetchProducts = (0, react_1.useCallback)(async (pageNum, append = false) => {
|
|
69
|
+
setIsLoading(true);
|
|
70
|
+
setError(null);
|
|
71
|
+
try {
|
|
72
|
+
const queryString = buildQueryString(pageNum);
|
|
73
|
+
const response = await fetch(`${endpoint}?${queryString}`);
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
const errorData = await response.json().catch(() => ({}));
|
|
76
|
+
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
77
|
+
}
|
|
78
|
+
const data = await response.json();
|
|
79
|
+
if (append) {
|
|
80
|
+
setProducts((prev) => [...prev, ...data.data]);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
setProducts(data.data);
|
|
84
|
+
}
|
|
85
|
+
setTotal(data.total);
|
|
86
|
+
setHasMore(data.hasMore);
|
|
87
|
+
setPage(pageNum);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
setError(err instanceof Error ? err : new Error('Failed to fetch products'));
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
setIsLoading(false);
|
|
94
|
+
}
|
|
95
|
+
}, [buildQueryString, endpoint]);
|
|
96
|
+
// Initial fetch and refetch when filters change
|
|
97
|
+
(0, react_1.useEffect)(() => {
|
|
98
|
+
isAppending.current = false;
|
|
99
|
+
fetchProducts(1, false);
|
|
100
|
+
}, [category, search, sort, attributes, minPrice, maxPrice, limit]);
|
|
101
|
+
// Load more products
|
|
102
|
+
const loadMore = (0, react_1.useCallback)(() => {
|
|
103
|
+
if (!isLoading && hasMore) {
|
|
104
|
+
isAppending.current = true;
|
|
105
|
+
fetchProducts(page + 1, true);
|
|
106
|
+
}
|
|
107
|
+
}, [isLoading, hasMore, page, fetchProducts]);
|
|
108
|
+
// Refresh current page
|
|
109
|
+
const refresh = (0, react_1.useCallback)(() => {
|
|
110
|
+
isAppending.current = false;
|
|
111
|
+
fetchProducts(page, false);
|
|
112
|
+
}, [page, fetchProducts]);
|
|
113
|
+
// Go to specific page
|
|
114
|
+
const goToPage = (0, react_1.useCallback)((newPage) => {
|
|
115
|
+
if (newPage !== page && newPage >= 1) {
|
|
116
|
+
isAppending.current = false;
|
|
117
|
+
fetchProducts(newPage, false);
|
|
118
|
+
}
|
|
119
|
+
}, [page, fetchProducts]);
|
|
120
|
+
return {
|
|
121
|
+
products,
|
|
122
|
+
total,
|
|
123
|
+
page,
|
|
124
|
+
isLoading,
|
|
125
|
+
error,
|
|
126
|
+
hasMore,
|
|
127
|
+
loadMore,
|
|
128
|
+
refresh,
|
|
129
|
+
setPage: goToPage,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=useProducts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProducts.js","sourceRoot":"","sources":["../../../src/products/hooks/useProducts.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/products
|
|
3
|
+
*
|
|
4
|
+
* Product catalog module: display, search, filtering, variant selection.
|
|
5
|
+
*
|
|
6
|
+
* Components:
|
|
7
|
+
* - ProductCard, ProductGrid, ProductDetails
|
|
8
|
+
* - VariantSelector, ProductGallery, CategoryNav
|
|
9
|
+
* - ProductSearch, ProductFilters, ProductSort, ProductBreadcrumb
|
|
10
|
+
*
|
|
11
|
+
* Hooks:
|
|
12
|
+
* - useProducts, useProduct, useCategories, useProductAttributes
|
|
13
|
+
*
|
|
14
|
+
* API Route Handlers:
|
|
15
|
+
* - getProducts (GET /api/products)
|
|
16
|
+
* - getProduct (GET /api/products/[slug])
|
|
17
|
+
* - getCategories (GET /api/categories)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // In a product listing page
|
|
22
|
+
* import {
|
|
23
|
+
* ProductGrid,
|
|
24
|
+
* ProductSearch,
|
|
25
|
+
* ProductSort,
|
|
26
|
+
* CategoryNav,
|
|
27
|
+
* useProducts,
|
|
28
|
+
* useCategories,
|
|
29
|
+
* } from '@rovela/sdk/products'
|
|
30
|
+
*
|
|
31
|
+
* function ProductsPage() {
|
|
32
|
+
* const [search, setSearch] = useState('')
|
|
33
|
+
* const [sort, setSort] = useState('newest')
|
|
34
|
+
* const [category, setCategory] = useState(null)
|
|
35
|
+
*
|
|
36
|
+
* const { products, isLoading, hasMore, loadMore } = useProducts({
|
|
37
|
+
* search,
|
|
38
|
+
* sort,
|
|
39
|
+
* category,
|
|
40
|
+
* })
|
|
41
|
+
*
|
|
42
|
+
* const { tree: categories } = useCategories()
|
|
43
|
+
*
|
|
44
|
+
* return (
|
|
45
|
+
* <div className="flex gap-8">
|
|
46
|
+
* <aside className="w-64">
|
|
47
|
+
* <CategoryNav
|
|
48
|
+
* categories={categories}
|
|
49
|
+
* activeSlug={category}
|
|
50
|
+
* variant="vertical"
|
|
51
|
+
* />
|
|
52
|
+
* </aside>
|
|
53
|
+
* <main className="flex-1">
|
|
54
|
+
* <div className="flex gap-4 mb-6">
|
|
55
|
+
* <ProductSearch
|
|
56
|
+
* value={search}
|
|
57
|
+
* onSearch={setSearch}
|
|
58
|
+
* placeholder="Search products..."
|
|
59
|
+
* />
|
|
60
|
+
* <ProductSort value={sort} onChange={setSort} />
|
|
61
|
+
* </div>
|
|
62
|
+
* <ProductGrid
|
|
63
|
+
* products={products}
|
|
64
|
+
* isLoading={isLoading}
|
|
65
|
+
* cardProps={{ showQuickAdd: true }}
|
|
66
|
+
* />
|
|
67
|
+
* {hasMore && (
|
|
68
|
+
* <button onClick={loadMore}>Load More</button>
|
|
69
|
+
* )}
|
|
70
|
+
* </main>
|
|
71
|
+
* </div>
|
|
72
|
+
* )
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* // In app/api/products/route.ts
|
|
79
|
+
* export { getProducts as GET } from '@rovela/sdk/products/api'
|
|
80
|
+
*
|
|
81
|
+
* // In app/api/products/[slug]/route.ts
|
|
82
|
+
* export { getProduct as GET } from '@rovela/sdk/products/api'
|
|
83
|
+
*
|
|
84
|
+
* // In app/api/categories/route.ts
|
|
85
|
+
* export { getCategories as GET } from '@rovela/sdk/products/api'
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export { ProductCard, ProductGrid, ProductDetails, VariantSelector, ProductGallery, CategoryNav, ProductBreadcrumb, ProductSearch, ProductSort, ProductFilterPanel, } from './components';
|
|
89
|
+
export type { ProductCardProps, ProductGridProps, ProductDetailsProps, VariantSelectorProps, ProductGalleryProps, CategoryNavProps, ProductBreadcrumbProps, BreadcrumbItem, ProductSearchProps, ProductSortProps, SortOption, SortOptionConfig, ProductFilterPanelProps, ProductFilterValues, } from './components';
|
|
90
|
+
export { useProducts, useProduct, useCategories, useProductAttributes, } from './hooks';
|
|
91
|
+
export type { UseProductsOptions, UseProductsReturn, UseProductOptions, UseProductReturn, UseCategoriesOptions, UseCategoriesReturn, CategoryWithChildren, UseProductAttributesOptions, UseProductAttributesReturn, ProductAttribute, PriceRange, } from './hooks';
|
|
92
|
+
export { getProducts, getProduct, getCategories, } from './api';
|
|
93
|
+
export type { ProductsApiResponse, ProductsApiError, ProductApiResponse, ProductApiError, CategoriesApiResponse, CategoriesApiError, } from './api';
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/products/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAMH,OAAO,EAEL,WAAW,EACX,WAAW,EACX,cAAc,EACd,eAAe,EACf,cAAc,EAEd,WAAW,EACX,iBAAiB,EAEjB,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,cAAc,CAAA;AAMrB,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,oBAAoB,GACrB,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,GACX,MAAM,SAAS,CAAA;AAMhB,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,OAAO,CAAA;AAEd,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,OAAO,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/products
|
|
4
|
+
*
|
|
5
|
+
* Product catalog module: display, search, filtering, variant selection.
|
|
6
|
+
*
|
|
7
|
+
* Components:
|
|
8
|
+
* - ProductCard, ProductGrid, ProductDetails
|
|
9
|
+
* - VariantSelector, ProductGallery, CategoryNav
|
|
10
|
+
* - ProductSearch, ProductFilters, ProductSort, ProductBreadcrumb
|
|
11
|
+
*
|
|
12
|
+
* Hooks:
|
|
13
|
+
* - useProducts, useProduct, useCategories, useProductAttributes
|
|
14
|
+
*
|
|
15
|
+
* API Route Handlers:
|
|
16
|
+
* - getProducts (GET /api/products)
|
|
17
|
+
* - getProduct (GET /api/products/[slug])
|
|
18
|
+
* - getCategories (GET /api/categories)
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // In a product listing page
|
|
23
|
+
* import {
|
|
24
|
+
* ProductGrid,
|
|
25
|
+
* ProductSearch,
|
|
26
|
+
* ProductSort,
|
|
27
|
+
* CategoryNav,
|
|
28
|
+
* useProducts,
|
|
29
|
+
* useCategories,
|
|
30
|
+
* } from '@rovela/sdk/products'
|
|
31
|
+
*
|
|
32
|
+
* function ProductsPage() {
|
|
33
|
+
* const [search, setSearch] = useState('')
|
|
34
|
+
* const [sort, setSort] = useState('newest')
|
|
35
|
+
* const [category, setCategory] = useState(null)
|
|
36
|
+
*
|
|
37
|
+
* const { products, isLoading, hasMore, loadMore } = useProducts({
|
|
38
|
+
* search,
|
|
39
|
+
* sort,
|
|
40
|
+
* category,
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* const { tree: categories } = useCategories()
|
|
44
|
+
*
|
|
45
|
+
* return (
|
|
46
|
+
* <div className="flex gap-8">
|
|
47
|
+
* <aside className="w-64">
|
|
48
|
+
* <CategoryNav
|
|
49
|
+
* categories={categories}
|
|
50
|
+
* activeSlug={category}
|
|
51
|
+
* variant="vertical"
|
|
52
|
+
* />
|
|
53
|
+
* </aside>
|
|
54
|
+
* <main className="flex-1">
|
|
55
|
+
* <div className="flex gap-4 mb-6">
|
|
56
|
+
* <ProductSearch
|
|
57
|
+
* value={search}
|
|
58
|
+
* onSearch={setSearch}
|
|
59
|
+
* placeholder="Search products..."
|
|
60
|
+
* />
|
|
61
|
+
* <ProductSort value={sort} onChange={setSort} />
|
|
62
|
+
* </div>
|
|
63
|
+
* <ProductGrid
|
|
64
|
+
* products={products}
|
|
65
|
+
* isLoading={isLoading}
|
|
66
|
+
* cardProps={{ showQuickAdd: true }}
|
|
67
|
+
* />
|
|
68
|
+
* {hasMore && (
|
|
69
|
+
* <button onClick={loadMore}>Load More</button>
|
|
70
|
+
* )}
|
|
71
|
+
* </main>
|
|
72
|
+
* </div>
|
|
73
|
+
* )
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* // In app/api/products/route.ts
|
|
80
|
+
* export { getProducts as GET } from '@rovela/sdk/products/api'
|
|
81
|
+
*
|
|
82
|
+
* // In app/api/products/[slug]/route.ts
|
|
83
|
+
* export { getProduct as GET } from '@rovela/sdk/products/api'
|
|
84
|
+
*
|
|
85
|
+
* // In app/api/categories/route.ts
|
|
86
|
+
* export { getCategories as GET } from '@rovela/sdk/products/api'
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
|
+
exports.getCategories = exports.getProduct = exports.getProducts = exports.useProductAttributes = exports.useCategories = exports.useProduct = exports.useProducts = exports.ProductFilterPanel = exports.ProductSort = exports.ProductSearch = exports.ProductBreadcrumb = exports.CategoryNav = exports.ProductGallery = exports.VariantSelector = exports.ProductDetails = exports.ProductGrid = exports.ProductCard = void 0;
|
|
91
|
+
// =============================================================================
|
|
92
|
+
// Components
|
|
93
|
+
// =============================================================================
|
|
94
|
+
var components_1 = require("./components");
|
|
95
|
+
// Core display
|
|
96
|
+
Object.defineProperty(exports, "ProductCard", { enumerable: true, get: function () { return components_1.ProductCard; } });
|
|
97
|
+
Object.defineProperty(exports, "ProductGrid", { enumerable: true, get: function () { return components_1.ProductGrid; } });
|
|
98
|
+
Object.defineProperty(exports, "ProductDetails", { enumerable: true, get: function () { return components_1.ProductDetails; } });
|
|
99
|
+
Object.defineProperty(exports, "VariantSelector", { enumerable: true, get: function () { return components_1.VariantSelector; } });
|
|
100
|
+
Object.defineProperty(exports, "ProductGallery", { enumerable: true, get: function () { return components_1.ProductGallery; } });
|
|
101
|
+
// Navigation
|
|
102
|
+
Object.defineProperty(exports, "CategoryNav", { enumerable: true, get: function () { return components_1.CategoryNav; } });
|
|
103
|
+
Object.defineProperty(exports, "ProductBreadcrumb", { enumerable: true, get: function () { return components_1.ProductBreadcrumb; } });
|
|
104
|
+
// Filtering
|
|
105
|
+
Object.defineProperty(exports, "ProductSearch", { enumerable: true, get: function () { return components_1.ProductSearch; } });
|
|
106
|
+
Object.defineProperty(exports, "ProductSort", { enumerable: true, get: function () { return components_1.ProductSort; } });
|
|
107
|
+
Object.defineProperty(exports, "ProductFilterPanel", { enumerable: true, get: function () { return components_1.ProductFilterPanel; } });
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// Hooks
|
|
110
|
+
// =============================================================================
|
|
111
|
+
var hooks_1 = require("./hooks");
|
|
112
|
+
Object.defineProperty(exports, "useProducts", { enumerable: true, get: function () { return hooks_1.useProducts; } });
|
|
113
|
+
Object.defineProperty(exports, "useProduct", { enumerable: true, get: function () { return hooks_1.useProduct; } });
|
|
114
|
+
Object.defineProperty(exports, "useCategories", { enumerable: true, get: function () { return hooks_1.useCategories; } });
|
|
115
|
+
Object.defineProperty(exports, "useProductAttributes", { enumerable: true, get: function () { return hooks_1.useProductAttributes; } });
|
|
116
|
+
// =============================================================================
|
|
117
|
+
// API Route Handlers
|
|
118
|
+
// =============================================================================
|
|
119
|
+
var api_1 = require("./api");
|
|
120
|
+
Object.defineProperty(exports, "getProducts", { enumerable: true, get: function () { return api_1.getProducts; } });
|
|
121
|
+
Object.defineProperty(exports, "getProduct", { enumerable: true, get: function () { return api_1.getProduct; } });
|
|
122
|
+
Object.defineProperty(exports, "getCategories", { enumerable: true, get: function () { return api_1.getCategories; } });
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/products/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;;;AAEH,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,2CAcqB;AAbnB,eAAe;AACf,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,4GAAA,cAAc,OAAA;AACd,6GAAA,eAAe,OAAA;AACf,4GAAA,cAAc,OAAA;AACd,aAAa;AACb,yGAAA,WAAW,OAAA;AACX,+GAAA,iBAAiB,OAAA;AACjB,YAAY;AACZ,2GAAA,aAAa,OAAA;AACb,yGAAA,WAAW,OAAA;AACX,gHAAA,kBAAkB,OAAA;AAoBpB,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,iCAKgB;AAJd,oGAAA,WAAW,OAAA;AACX,mGAAA,UAAU,OAAA;AACV,sGAAA,aAAa,OAAA;AACb,6GAAA,oBAAoB,OAAA;AAiBtB,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,6BAIc;AAHZ,kGAAA,WAAW,OAAA;AACX,iGAAA,UAAU,OAAA;AACV,oGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/theme/ThemeProvider
|
|
3
|
+
*
|
|
4
|
+
* Runtime theme provider for accessing blueprint theme data in React components.
|
|
5
|
+
* Provides theme context to all child components.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { BlueprintTheme } from '../core/config';
|
|
9
|
+
interface ThemeContextValue {
|
|
10
|
+
theme: BlueprintTheme;
|
|
11
|
+
colors: BlueprintTheme['colors'];
|
|
12
|
+
typography: BlueprintTheme['typography'];
|
|
13
|
+
spacing: BlueprintTheme['spacing'];
|
|
14
|
+
borders: BlueprintTheme['borders'];
|
|
15
|
+
effects: BlueprintTheme['effects'];
|
|
16
|
+
}
|
|
17
|
+
declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
|
|
18
|
+
interface ThemeProviderProps {
|
|
19
|
+
/**
|
|
20
|
+
* Theme configuration from blueprint.
|
|
21
|
+
* Pass the blueprint.theme object here.
|
|
22
|
+
*/
|
|
23
|
+
theme: BlueprintTheme;
|
|
24
|
+
/**
|
|
25
|
+
* Child components that will have access to the theme.
|
|
26
|
+
*/
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* ThemeProvider component that makes theme configuration available
|
|
31
|
+
* to all child components via React context.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // In app/layout.tsx:
|
|
35
|
+
* import { ThemeProvider } from '@rovela/sdk/theme'
|
|
36
|
+
* import { getTheme } from '@rovela/sdk/core'
|
|
37
|
+
*
|
|
38
|
+
* export default function RootLayout({ children }) {
|
|
39
|
+
* const theme = getTheme()
|
|
40
|
+
* return (
|
|
41
|
+
* <html>
|
|
42
|
+
* <body>
|
|
43
|
+
* <ThemeProvider theme={theme}>
|
|
44
|
+
* {children}
|
|
45
|
+
* </ThemeProvider>
|
|
46
|
+
* </body>
|
|
47
|
+
* </html>
|
|
48
|
+
* )
|
|
49
|
+
* }
|
|
50
|
+
*/
|
|
51
|
+
export declare function ThemeProvider({ theme, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Hook to access the theme context.
|
|
54
|
+
* Must be used within a ThemeProvider.
|
|
55
|
+
*
|
|
56
|
+
* @returns Theme context value
|
|
57
|
+
* @throws Error if used outside ThemeProvider
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* import { useThemeContext } from '@rovela/sdk/theme'
|
|
61
|
+
*
|
|
62
|
+
* function MyComponent() {
|
|
63
|
+
* const { colors, typography } = useThemeContext()
|
|
64
|
+
* return <div style={{ color: colors.primary[500] }}>...</div>
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
export declare function useThemeContext(): ThemeContextValue;
|
|
68
|
+
export { ThemeContext };
|
|
69
|
+
export type { ThemeContextValue, ThemeProviderProps };
|
|
70
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAMpD,UAAU,iBAAiB;IACzB,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;IACxC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;CACnC;AAED,QAAA,MAAM,YAAY,mDAAgD,CAAA;AAMlE,UAAU,kBAAkB;IAC1B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;IACrB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAepE;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAWnD;AAMD,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ThemeContext = void 0;
|
|
5
|
+
exports.ThemeProvider = ThemeProvider;
|
|
6
|
+
exports.useThemeContext = useThemeContext;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
/**
|
|
9
|
+
* @rovela/sdk/theme/ThemeProvider
|
|
10
|
+
*
|
|
11
|
+
* Runtime theme provider for accessing blueprint theme data in React components.
|
|
12
|
+
* Provides theme context to all child components.
|
|
13
|
+
*/
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const ThemeContext = (0, react_1.createContext)(null);
|
|
16
|
+
exports.ThemeContext = ThemeContext;
|
|
17
|
+
/**
|
|
18
|
+
* ThemeProvider component that makes theme configuration available
|
|
19
|
+
* to all child components via React context.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // In app/layout.tsx:
|
|
23
|
+
* import { ThemeProvider } from '@rovela/sdk/theme'
|
|
24
|
+
* import { getTheme } from '@rovela/sdk/core'
|
|
25
|
+
*
|
|
26
|
+
* export default function RootLayout({ children }) {
|
|
27
|
+
* const theme = getTheme()
|
|
28
|
+
* return (
|
|
29
|
+
* <html>
|
|
30
|
+
* <body>
|
|
31
|
+
* <ThemeProvider theme={theme}>
|
|
32
|
+
* {children}
|
|
33
|
+
* </ThemeProvider>
|
|
34
|
+
* </body>
|
|
35
|
+
* </html>
|
|
36
|
+
* )
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
function ThemeProvider({ theme, children }) {
|
|
40
|
+
// Memoize context value to prevent unnecessary re-renders
|
|
41
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
42
|
+
theme,
|
|
43
|
+
colors: theme.colors,
|
|
44
|
+
typography: theme.typography,
|
|
45
|
+
spacing: theme.spacing,
|
|
46
|
+
borders: theme.borders,
|
|
47
|
+
effects: theme.effects,
|
|
48
|
+
}), [theme]);
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(ThemeContext.Provider, { value: value, children: children });
|
|
50
|
+
}
|
|
51
|
+
// =============================================================================
|
|
52
|
+
// Context Hook
|
|
53
|
+
// =============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Hook to access the theme context.
|
|
56
|
+
* Must be used within a ThemeProvider.
|
|
57
|
+
*
|
|
58
|
+
* @returns Theme context value
|
|
59
|
+
* @throws Error if used outside ThemeProvider
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* import { useThemeContext } from '@rovela/sdk/theme'
|
|
63
|
+
*
|
|
64
|
+
* function MyComponent() {
|
|
65
|
+
* const { colors, typography } = useThemeContext()
|
|
66
|
+
* return <div style={{ color: colors.primary[500] }}>...</div>
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
function useThemeContext() {
|
|
70
|
+
const context = (0, react_1.useContext)(ThemeContext);
|
|
71
|
+
if (!context) {
|
|
72
|
+
throw new Error('useThemeContext must be used within a ThemeProvider. ' +
|
|
73
|
+
'Make sure to wrap your app with <ThemeProvider theme={...}>.');
|
|
74
|
+
}
|
|
75
|
+
return context;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AAiEZ,sCAeC;AAqBD,0CAWC;;AA9GD;;;;;GAKG;AAEH,iCAA0E;AAgB1E,MAAM,YAAY,GAAG,IAAA,qBAAa,EAA2B,IAAI,CAAC,CAAA;AA6FzD,oCAAY;AA3ErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAsB;IACnE,0DAA0D;IAC1D,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,CAAC;QACL,KAAK;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,EACF,CAAC,KAAK,CAAC,CACR,CAAA;IAED,OAAO,uBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAyB,CAAA;AAChF,CAAC;AAED,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe;IAC7B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAA;IAExC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,uDAAuD;YACrD,8DAA8D,CACjE,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|