@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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/checkout/components
|
|
3
|
+
*
|
|
4
|
+
* Checkout UI components
|
|
5
|
+
*/
|
|
6
|
+
export { CheckoutButton } from './CheckoutButton';
|
|
7
|
+
export { CheckoutSuccess } from './CheckoutSuccess';
|
|
8
|
+
export { OrderSummary } from './OrderSummary';
|
|
9
|
+
export { ShippingForm } from './ShippingForm';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkout/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/checkout/components
|
|
4
|
+
*
|
|
5
|
+
* Checkout UI components
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ShippingForm = exports.OrderSummary = exports.CheckoutSuccess = exports.CheckoutButton = void 0;
|
|
9
|
+
var CheckoutButton_1 = require("./CheckoutButton");
|
|
10
|
+
Object.defineProperty(exports, "CheckoutButton", { enumerable: true, get: function () { return CheckoutButton_1.CheckoutButton; } });
|
|
11
|
+
var CheckoutSuccess_1 = require("./CheckoutSuccess");
|
|
12
|
+
Object.defineProperty(exports, "CheckoutSuccess", { enumerable: true, get: function () { return CheckoutSuccess_1.CheckoutSuccess; } });
|
|
13
|
+
var OrderSummary_1 = require("./OrderSummary");
|
|
14
|
+
Object.defineProperty(exports, "OrderSummary", { enumerable: true, get: function () { return OrderSummary_1.OrderSummary; } });
|
|
15
|
+
var ShippingForm_1 = require("./ShippingForm");
|
|
16
|
+
Object.defineProperty(exports, "ShippingForm", { enumerable: true, get: function () { return ShippingForm_1.ShippingForm; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkout/components/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,+CAA6C;AAApC,4GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkout/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/checkout/hooks
|
|
4
|
+
*
|
|
5
|
+
* React hooks for checkout
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.useCheckoutSuccess = exports.useCheckout = void 0;
|
|
9
|
+
var useCheckout_1 = require("./useCheckout");
|
|
10
|
+
Object.defineProperty(exports, "useCheckout", { enumerable: true, get: function () { return useCheckout_1.useCheckout; } });
|
|
11
|
+
Object.defineProperty(exports, "useCheckoutSuccess", { enumerable: true, get: function () { return useCheckout_1.useCheckoutSuccess; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkout/hooks/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAA+D;AAAtD,0GAAA,WAAW,OAAA;AAAE,iHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/checkout/hooks/useCheckout
|
|
3
|
+
*
|
|
4
|
+
* React hook for initiating Stripe Checkout.
|
|
5
|
+
*/
|
|
6
|
+
import type { UseCheckoutOptions, UseCheckoutReturn } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Hook for initiating Stripe Checkout.
|
|
9
|
+
*
|
|
10
|
+
* Automatically reads cart items and creates a checkout session.
|
|
11
|
+
* Redirects to Stripe's hosted checkout page.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { useCheckout } from '@rovela/sdk/checkout'
|
|
16
|
+
*
|
|
17
|
+
* function CheckoutButton() {
|
|
18
|
+
* const { checkout, isLoading, error } = useCheckout()
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <button onClick={checkout} disabled={isLoading}>
|
|
22
|
+
* {isLoading ? 'Redirecting...' : 'Checkout'}
|
|
23
|
+
* </button>
|
|
24
|
+
* )
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example With custom options
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { checkout } = useCheckout({
|
|
31
|
+
* onSuccess: (session) => console.log('Session created:', session.sessionId),
|
|
32
|
+
* onError: (error) => alert(error.error),
|
|
33
|
+
* customerEmail: 'customer@example.com',
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function useCheckout(options?: UseCheckoutOptions): UseCheckoutReturn;
|
|
38
|
+
/**
|
|
39
|
+
* Hook to retrieve checkout session details from URL.
|
|
40
|
+
* Used on success pages to display order confirmation.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // app/checkout/success/page.tsx
|
|
45
|
+
* 'use client'
|
|
46
|
+
*
|
|
47
|
+
* import { useCheckoutSuccess } from '@rovela/sdk/checkout'
|
|
48
|
+
*
|
|
49
|
+
* export default function SuccessPage() {
|
|
50
|
+
* const { sessionId, isLoading, session } = useCheckoutSuccess()
|
|
51
|
+
*
|
|
52
|
+
* if (isLoading) return <div>Loading...</div>
|
|
53
|
+
*
|
|
54
|
+
* return <div>Thank you for your order! Session: {sessionId}</div>
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useCheckoutSuccess(): {
|
|
59
|
+
sessionId: string | null;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=useCheckout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCheckout.d.ts","sourceRoot":"","sources":["../../../src/checkout/hooks/useCheckout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAGV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAMjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,CA8F3E;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB;;EAgBjC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/checkout/hooks/useCheckout
|
|
4
|
+
*
|
|
5
|
+
* React hook for initiating Stripe Checkout.
|
|
6
|
+
*/
|
|
7
|
+
'use client';
|
|
8
|
+
/**
|
|
9
|
+
* @rovela/sdk/checkout/hooks/useCheckout
|
|
10
|
+
*
|
|
11
|
+
* React hook for initiating Stripe Checkout.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.useCheckout = useCheckout;
|
|
15
|
+
exports.useCheckoutSuccess = useCheckoutSuccess;
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const store_1 = require("../../cart/store");
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Hook
|
|
20
|
+
// =============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* Hook for initiating Stripe Checkout.
|
|
23
|
+
*
|
|
24
|
+
* Automatically reads cart items and creates a checkout session.
|
|
25
|
+
* Redirects to Stripe's hosted checkout page.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { useCheckout } from '@rovela/sdk/checkout'
|
|
30
|
+
*
|
|
31
|
+
* function CheckoutButton() {
|
|
32
|
+
* const { checkout, isLoading, error } = useCheckout()
|
|
33
|
+
*
|
|
34
|
+
* return (
|
|
35
|
+
* <button onClick={checkout} disabled={isLoading}>
|
|
36
|
+
* {isLoading ? 'Redirecting...' : 'Checkout'}
|
|
37
|
+
* </button>
|
|
38
|
+
* )
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example With custom options
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const { checkout } = useCheckout({
|
|
45
|
+
* onSuccess: (session) => console.log('Session created:', session.sessionId),
|
|
46
|
+
* onError: (error) => alert(error.error),
|
|
47
|
+
* customerEmail: 'customer@example.com',
|
|
48
|
+
* })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function useCheckout(options) {
|
|
52
|
+
const { items, clearCart } = (0, store_1.useCart)();
|
|
53
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
54
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
55
|
+
const checkout = (0, react_1.useCallback)(async () => {
|
|
56
|
+
// Reset error state
|
|
57
|
+
setError(null);
|
|
58
|
+
// Validate cart
|
|
59
|
+
if (items.length === 0) {
|
|
60
|
+
const emptyError = {
|
|
61
|
+
error: 'Your cart is empty',
|
|
62
|
+
code: 'EMPTY_CART',
|
|
63
|
+
};
|
|
64
|
+
setError(emptyError);
|
|
65
|
+
options?.onError?.(emptyError);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setIsLoading(true);
|
|
69
|
+
try {
|
|
70
|
+
// Build request body
|
|
71
|
+
const body = {
|
|
72
|
+
items: items.map((item) => ({
|
|
73
|
+
productId: item.productId,
|
|
74
|
+
variantId: item.variantId,
|
|
75
|
+
name: item.name,
|
|
76
|
+
description: item.attributes
|
|
77
|
+
? Object.entries(item.attributes)
|
|
78
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
79
|
+
.join(', ')
|
|
80
|
+
: undefined,
|
|
81
|
+
// Convert dollars to cents for Stripe
|
|
82
|
+
price: Math.round(item.price * 100),
|
|
83
|
+
quantity: item.quantity,
|
|
84
|
+
image: item.image,
|
|
85
|
+
})),
|
|
86
|
+
customerEmail: options?.customerEmail,
|
|
87
|
+
customerId: options?.customerId,
|
|
88
|
+
successUrl: options?.successUrl,
|
|
89
|
+
cancelUrl: options?.cancelUrl,
|
|
90
|
+
metadata: options?.metadata,
|
|
91
|
+
};
|
|
92
|
+
// Call checkout API
|
|
93
|
+
const response = await fetch('/api/checkout', {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
headers: { 'Content-Type': 'application/json' },
|
|
96
|
+
body: JSON.stringify(body),
|
|
97
|
+
});
|
|
98
|
+
const data = await response.json();
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
const apiError = data;
|
|
101
|
+
setError(apiError);
|
|
102
|
+
options?.onError?.(apiError);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const session = data;
|
|
106
|
+
// Call success callback
|
|
107
|
+
options?.onSuccess?.(session);
|
|
108
|
+
// Clear cart before redirect (optional behavior)
|
|
109
|
+
if (options?.clearCartOnCheckout !== false) {
|
|
110
|
+
clearCart();
|
|
111
|
+
}
|
|
112
|
+
// Redirect to Stripe Checkout
|
|
113
|
+
if (session.url) {
|
|
114
|
+
window.location.href = session.url;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
const networkError = {
|
|
119
|
+
error: 'Network error. Please try again.',
|
|
120
|
+
code: 'CHECKOUT_ERROR',
|
|
121
|
+
};
|
|
122
|
+
setError(networkError);
|
|
123
|
+
options?.onError?.(networkError);
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
setIsLoading(false);
|
|
127
|
+
}
|
|
128
|
+
}, [items, clearCart, options]);
|
|
129
|
+
return {
|
|
130
|
+
checkout,
|
|
131
|
+
isLoading,
|
|
132
|
+
error,
|
|
133
|
+
clearError: (0, react_1.useCallback)(() => setError(null), []),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// =============================================================================
|
|
137
|
+
// Additional Hooks
|
|
138
|
+
// =============================================================================
|
|
139
|
+
/**
|
|
140
|
+
* Hook to retrieve checkout session details from URL.
|
|
141
|
+
* Used on success pages to display order confirmation.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```tsx
|
|
145
|
+
* // app/checkout/success/page.tsx
|
|
146
|
+
* 'use client'
|
|
147
|
+
*
|
|
148
|
+
* import { useCheckoutSuccess } from '@rovela/sdk/checkout'
|
|
149
|
+
*
|
|
150
|
+
* export default function SuccessPage() {
|
|
151
|
+
* const { sessionId, isLoading, session } = useCheckoutSuccess()
|
|
152
|
+
*
|
|
153
|
+
* if (isLoading) return <div>Loading...</div>
|
|
154
|
+
*
|
|
155
|
+
* return <div>Thank you for your order! Session: {sessionId}</div>
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
function useCheckoutSuccess() {
|
|
160
|
+
const [sessionId, setSessionId] = (0, react_1.useState)(null);
|
|
161
|
+
// Extract session_id from URL on mount
|
|
162
|
+
if (typeof window !== 'undefined' && !sessionId) {
|
|
163
|
+
const params = new URLSearchParams(window.location.search);
|
|
164
|
+
const id = params.get('session_id');
|
|
165
|
+
if (id) {
|
|
166
|
+
setSessionId(id);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
sessionId,
|
|
171
|
+
// Could be extended to fetch session details from API if needed
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=useCheckout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCheckout.js","sourceRoot":"","sources":["../../../src/checkout/hooks/useCheckout.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/checkout
|
|
3
|
+
*
|
|
4
|
+
* Stripe Checkout integration with Direct Charges for connected accounts.
|
|
5
|
+
*
|
|
6
|
+
* ## Overview
|
|
7
|
+
*
|
|
8
|
+
* This module provides complete Stripe Checkout integration:
|
|
9
|
+
* - Stripe Checkout (hosted) for payment collection
|
|
10
|
+
* - Direct Charges to connected accounts
|
|
11
|
+
* - Automatic platform fee calculation
|
|
12
|
+
* - Webhook handling for order creation
|
|
13
|
+
*
|
|
14
|
+
* ## Quick Start
|
|
15
|
+
*
|
|
16
|
+
* ### 1. Environment Variables
|
|
17
|
+
*
|
|
18
|
+
* ```env
|
|
19
|
+
* # Platform (Rovela) credentials
|
|
20
|
+
* STRIPE_SECRET_KEY=sk_live_...
|
|
21
|
+
* STRIPE_PUBLISHABLE_KEY=pk_live_...
|
|
22
|
+
* STRIPE_WEBHOOK_SECRET=whsec_...
|
|
23
|
+
*
|
|
24
|
+
* # Per-store connected account (set during store setup)
|
|
25
|
+
* STRIPE_CONNECTED_ACCOUNT_ID=acct_...
|
|
26
|
+
*
|
|
27
|
+
* # Optional configuration
|
|
28
|
+
* STRIPE_PLATFORM_FEE_PERCENT=5 # Platform takes 5%
|
|
29
|
+
* STORE_CURRENCY=USD # Store currency
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* ### 2. API Routes
|
|
33
|
+
*
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // app/api/checkout/route.ts
|
|
36
|
+
* export { POST } from '@rovela/sdk/checkout/api'
|
|
37
|
+
*
|
|
38
|
+
* // app/api/webhooks/stripe/route.ts
|
|
39
|
+
* import { handleStripeWebhook } from '@rovela/sdk/checkout/server'
|
|
40
|
+
*
|
|
41
|
+
* export async function POST(request: Request) {
|
|
42
|
+
* const payload = await request.text()
|
|
43
|
+
* const signature = request.headers.get('stripe-signature')!
|
|
44
|
+
* const result = await handleStripeWebhook(payload, signature)
|
|
45
|
+
* return Response.json(result)
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ### 3. Checkout Button
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // In your cart or product page
|
|
53
|
+
* import { CheckoutButton } from '@rovela/sdk/checkout'
|
|
54
|
+
*
|
|
55
|
+
* function Cart() {
|
|
56
|
+
* return (
|
|
57
|
+
* <div>
|
|
58
|
+
* <CartItems />
|
|
59
|
+
* <CartSummary />
|
|
60
|
+
* <CheckoutButton size="lg" fullWidth>
|
|
61
|
+
* Proceed to Checkout
|
|
62
|
+
* </CheckoutButton>
|
|
63
|
+
* </div>
|
|
64
|
+
* )
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ### 4. Success Page
|
|
69
|
+
*
|
|
70
|
+
* ```tsx
|
|
71
|
+
* // app/checkout/success/page.tsx
|
|
72
|
+
* import { CheckoutSuccess } from '@rovela/sdk/checkout'
|
|
73
|
+
* import { useCart } from '@rovela/sdk/cart'
|
|
74
|
+
*
|
|
75
|
+
* export default function SuccessPage() {
|
|
76
|
+
* const { clearCart } = useCart()
|
|
77
|
+
*
|
|
78
|
+
* return (
|
|
79
|
+
* <CheckoutSuccess
|
|
80
|
+
* continueShoppingHref="/products"
|
|
81
|
+
* viewOrderHref="/account/orders/{orderId}"
|
|
82
|
+
* onMount={clearCart}
|
|
83
|
+
* />
|
|
84
|
+
* )
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* ## Architecture
|
|
89
|
+
*
|
|
90
|
+
* ```
|
|
91
|
+
* Cart → CheckoutButton → /api/checkout → Stripe Checkout (hosted)
|
|
92
|
+
* ↓
|
|
93
|
+
* Database ← Webhook ← /api/webhooks/stripe ← Stripe
|
|
94
|
+
* ↓
|
|
95
|
+
* Order Created
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* ## Direct Charges Model
|
|
99
|
+
*
|
|
100
|
+
* With Direct Charges, payments are made directly on the connected account:
|
|
101
|
+
* - Payment shows connected account name on customer statement
|
|
102
|
+
* - Connected account handles disputes
|
|
103
|
+
* - Platform collects application fee automatically
|
|
104
|
+
*/
|
|
105
|
+
export type { CheckoutLineItem, CheckoutSessionRequest, CheckoutSessionResponse, CheckoutApiError, CreateOrderParams, WebhookResult, CheckoutStep, ShippingOption, CheckoutState, CheckoutButtonProps, ShippingFormProps, OrderSummaryProps, CheckoutSuccessProps, UseCheckoutOptions, UseCheckoutReturn, } from './types';
|
|
106
|
+
export { CheckoutButton, CheckoutSuccess, OrderSummary, ShippingForm, } from './components';
|
|
107
|
+
export { useCheckout, useCheckoutSuccess } from './hooks';
|
|
108
|
+
export { createCheckoutSession, getCheckoutSession, createOrderFromCheckout, extractOrderParamsFromSession, handleRefund, handleStripeWebhook, } from './server';
|
|
109
|
+
export type { CreateCheckoutSessionOptions } from './server';
|
|
110
|
+
export { getStripe, getConnectedAccountId, hasConnectedAccount, getPlatformFeePercent, calculateApplicationFee, getWebhookSecret, getStoreCurrency, getAllowedShippingCountries, getPublishableKey, } from './stripe';
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuGG;AAMH,YAAY,EAEV,gBAAgB,EAEhB,sBAAsB,EACtB,uBAAuB,EAEvB,gBAAgB,EAEhB,iBAAiB,EAEjB,aAAa,EAEb,YAAY,EACZ,cAAc,EACd,aAAa,EAEb,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EAEpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,SAAS,CAAA;AAMhB,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAMzD,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,EAElB,uBAAuB,EACvB,6BAA6B,EAC7B,YAAY,EAEZ,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAM5D,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/checkout
|
|
4
|
+
*
|
|
5
|
+
* Stripe Checkout integration with Direct Charges for connected accounts.
|
|
6
|
+
*
|
|
7
|
+
* ## Overview
|
|
8
|
+
*
|
|
9
|
+
* This module provides complete Stripe Checkout integration:
|
|
10
|
+
* - Stripe Checkout (hosted) for payment collection
|
|
11
|
+
* - Direct Charges to connected accounts
|
|
12
|
+
* - Automatic platform fee calculation
|
|
13
|
+
* - Webhook handling for order creation
|
|
14
|
+
*
|
|
15
|
+
* ## Quick Start
|
|
16
|
+
*
|
|
17
|
+
* ### 1. Environment Variables
|
|
18
|
+
*
|
|
19
|
+
* ```env
|
|
20
|
+
* # Platform (Rovela) credentials
|
|
21
|
+
* STRIPE_SECRET_KEY=sk_live_...
|
|
22
|
+
* STRIPE_PUBLISHABLE_KEY=pk_live_...
|
|
23
|
+
* STRIPE_WEBHOOK_SECRET=whsec_...
|
|
24
|
+
*
|
|
25
|
+
* # Per-store connected account (set during store setup)
|
|
26
|
+
* STRIPE_CONNECTED_ACCOUNT_ID=acct_...
|
|
27
|
+
*
|
|
28
|
+
* # Optional configuration
|
|
29
|
+
* STRIPE_PLATFORM_FEE_PERCENT=5 # Platform takes 5%
|
|
30
|
+
* STORE_CURRENCY=USD # Store currency
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* ### 2. API Routes
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // app/api/checkout/route.ts
|
|
37
|
+
* export { POST } from '@rovela/sdk/checkout/api'
|
|
38
|
+
*
|
|
39
|
+
* // app/api/webhooks/stripe/route.ts
|
|
40
|
+
* import { handleStripeWebhook } from '@rovela/sdk/checkout/server'
|
|
41
|
+
*
|
|
42
|
+
* export async function POST(request: Request) {
|
|
43
|
+
* const payload = await request.text()
|
|
44
|
+
* const signature = request.headers.get('stripe-signature')!
|
|
45
|
+
* const result = await handleStripeWebhook(payload, signature)
|
|
46
|
+
* return Response.json(result)
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ### 3. Checkout Button
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // In your cart or product page
|
|
54
|
+
* import { CheckoutButton } from '@rovela/sdk/checkout'
|
|
55
|
+
*
|
|
56
|
+
* function Cart() {
|
|
57
|
+
* return (
|
|
58
|
+
* <div>
|
|
59
|
+
* <CartItems />
|
|
60
|
+
* <CartSummary />
|
|
61
|
+
* <CheckoutButton size="lg" fullWidth>
|
|
62
|
+
* Proceed to Checkout
|
|
63
|
+
* </CheckoutButton>
|
|
64
|
+
* </div>
|
|
65
|
+
* )
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* ### 4. Success Page
|
|
70
|
+
*
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // app/checkout/success/page.tsx
|
|
73
|
+
* import { CheckoutSuccess } from '@rovela/sdk/checkout'
|
|
74
|
+
* import { useCart } from '@rovela/sdk/cart'
|
|
75
|
+
*
|
|
76
|
+
* export default function SuccessPage() {
|
|
77
|
+
* const { clearCart } = useCart()
|
|
78
|
+
*
|
|
79
|
+
* return (
|
|
80
|
+
* <CheckoutSuccess
|
|
81
|
+
* continueShoppingHref="/products"
|
|
82
|
+
* viewOrderHref="/account/orders/{orderId}"
|
|
83
|
+
* onMount={clearCart}
|
|
84
|
+
* />
|
|
85
|
+
* )
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* ## Architecture
|
|
90
|
+
*
|
|
91
|
+
* ```
|
|
92
|
+
* Cart → CheckoutButton → /api/checkout → Stripe Checkout (hosted)
|
|
93
|
+
* ↓
|
|
94
|
+
* Database ← Webhook ← /api/webhooks/stripe ← Stripe
|
|
95
|
+
* ↓
|
|
96
|
+
* Order Created
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* ## Direct Charges Model
|
|
100
|
+
*
|
|
101
|
+
* With Direct Charges, payments are made directly on the connected account:
|
|
102
|
+
* - Payment shows connected account name on customer statement
|
|
103
|
+
* - Connected account handles disputes
|
|
104
|
+
* - Platform collects application fee automatically
|
|
105
|
+
*/
|
|
106
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
107
|
+
exports.getPublishableKey = exports.getAllowedShippingCountries = exports.getStoreCurrency = exports.getWebhookSecret = exports.calculateApplicationFee = exports.getPlatformFeePercent = exports.hasConnectedAccount = exports.getConnectedAccountId = exports.getStripe = exports.handleStripeWebhook = exports.handleRefund = exports.extractOrderParamsFromSession = exports.createOrderFromCheckout = exports.getCheckoutSession = exports.createCheckoutSession = exports.useCheckoutSuccess = exports.useCheckout = exports.ShippingForm = exports.OrderSummary = exports.CheckoutSuccess = exports.CheckoutButton = void 0;
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// Components
|
|
110
|
+
// =============================================================================
|
|
111
|
+
var components_1 = require("./components");
|
|
112
|
+
Object.defineProperty(exports, "CheckoutButton", { enumerable: true, get: function () { return components_1.CheckoutButton; } });
|
|
113
|
+
Object.defineProperty(exports, "CheckoutSuccess", { enumerable: true, get: function () { return components_1.CheckoutSuccess; } });
|
|
114
|
+
Object.defineProperty(exports, "OrderSummary", { enumerable: true, get: function () { return components_1.OrderSummary; } });
|
|
115
|
+
Object.defineProperty(exports, "ShippingForm", { enumerable: true, get: function () { return components_1.ShippingForm; } });
|
|
116
|
+
// =============================================================================
|
|
117
|
+
// Hooks
|
|
118
|
+
// =============================================================================
|
|
119
|
+
var hooks_1 = require("./hooks");
|
|
120
|
+
Object.defineProperty(exports, "useCheckout", { enumerable: true, get: function () { return hooks_1.useCheckout; } });
|
|
121
|
+
Object.defineProperty(exports, "useCheckoutSuccess", { enumerable: true, get: function () { return hooks_1.useCheckoutSuccess; } });
|
|
122
|
+
// =============================================================================
|
|
123
|
+
// Server Functions
|
|
124
|
+
// =============================================================================
|
|
125
|
+
var server_1 = require("./server");
|
|
126
|
+
// Session creation
|
|
127
|
+
Object.defineProperty(exports, "createCheckoutSession", { enumerable: true, get: function () { return server_1.createCheckoutSession; } });
|
|
128
|
+
Object.defineProperty(exports, "getCheckoutSession", { enumerable: true, get: function () { return server_1.getCheckoutSession; } });
|
|
129
|
+
// Order management
|
|
130
|
+
Object.defineProperty(exports, "createOrderFromCheckout", { enumerable: true, get: function () { return server_1.createOrderFromCheckout; } });
|
|
131
|
+
Object.defineProperty(exports, "extractOrderParamsFromSession", { enumerable: true, get: function () { return server_1.extractOrderParamsFromSession; } });
|
|
132
|
+
Object.defineProperty(exports, "handleRefund", { enumerable: true, get: function () { return server_1.handleRefund; } });
|
|
133
|
+
// Webhook handler
|
|
134
|
+
Object.defineProperty(exports, "handleStripeWebhook", { enumerable: true, get: function () { return server_1.handleStripeWebhook; } });
|
|
135
|
+
// =============================================================================
|
|
136
|
+
// Stripe Client Utilities
|
|
137
|
+
// =============================================================================
|
|
138
|
+
var stripe_1 = require("./stripe");
|
|
139
|
+
Object.defineProperty(exports, "getStripe", { enumerable: true, get: function () { return stripe_1.getStripe; } });
|
|
140
|
+
Object.defineProperty(exports, "getConnectedAccountId", { enumerable: true, get: function () { return stripe_1.getConnectedAccountId; } });
|
|
141
|
+
Object.defineProperty(exports, "hasConnectedAccount", { enumerable: true, get: function () { return stripe_1.hasConnectedAccount; } });
|
|
142
|
+
Object.defineProperty(exports, "getPlatformFeePercent", { enumerable: true, get: function () { return stripe_1.getPlatformFeePercent; } });
|
|
143
|
+
Object.defineProperty(exports, "calculateApplicationFee", { enumerable: true, get: function () { return stripe_1.calculateApplicationFee; } });
|
|
144
|
+
Object.defineProperty(exports, "getWebhookSecret", { enumerable: true, get: function () { return stripe_1.getWebhookSecret; } });
|
|
145
|
+
Object.defineProperty(exports, "getStoreCurrency", { enumerable: true, get: function () { return stripe_1.getStoreCurrency; } });
|
|
146
|
+
Object.defineProperty(exports, "getAllowedShippingCountries", { enumerable: true, get: function () { return stripe_1.getAllowedShippingCountries; } });
|
|
147
|
+
Object.defineProperty(exports, "getPublishableKey", { enumerable: true, get: function () { return stripe_1.getPublishableKey; } });
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkout/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuGG;;;AAgCH,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,2CAKqB;AAJnB,4GAAA,cAAc,OAAA;AACd,6GAAA,eAAe,OAAA;AACf,0GAAA,YAAY,OAAA;AACZ,0GAAA,YAAY,OAAA;AAGd,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,iCAAyD;AAAhD,oGAAA,WAAW,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAExC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,mCAUiB;AATf,mBAAmB;AACnB,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,mBAAmB;AACnB,iHAAA,uBAAuB,OAAA;AACvB,uHAAA,6BAA6B,OAAA;AAC7B,sGAAA,YAAY,OAAA;AACZ,kBAAkB;AAClB,6GAAA,mBAAmB,OAAA;AAKrB,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF,mCAUiB;AATf,mGAAA,SAAS,OAAA;AACT,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA;AACnB,+GAAA,qBAAqB,OAAA;AACrB,iHAAA,uBAAuB,OAAA;AACvB,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,qHAAA,2BAA2B,OAAA;AAC3B,2GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/checkout/server/create-checkout-session
|
|
3
|
+
*
|
|
4
|
+
* Creates a Stripe Checkout session using Direct Charges.
|
|
5
|
+
* The payment is processed ON the connected account, not the platform.
|
|
6
|
+
*/
|
|
7
|
+
import type Stripe from 'stripe';
|
|
8
|
+
import type { CheckoutSessionRequest, CheckoutSessionResponse, CheckoutLineItem } from '../types';
|
|
9
|
+
export interface CreateCheckoutSessionOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to collect shipping address.
|
|
12
|
+
* Default: true
|
|
13
|
+
*/
|
|
14
|
+
collectShippingAddress?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to collect phone number.
|
|
17
|
+
* Default: false
|
|
18
|
+
*/
|
|
19
|
+
collectPhoneNumber?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to allow promotion codes.
|
|
22
|
+
* Default: false
|
|
23
|
+
*/
|
|
24
|
+
allowPromotionCodes?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Automatic tax calculation.
|
|
27
|
+
* Requires Stripe Tax to be enabled.
|
|
28
|
+
* Default: false
|
|
29
|
+
*/
|
|
30
|
+
automaticTax?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Custom application fee in cents.
|
|
33
|
+
* If not provided, calculated from STRIPE_PLATFORM_FEE_PERCENT.
|
|
34
|
+
*/
|
|
35
|
+
applicationFeeAmount?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a Stripe Checkout session for Direct Charges.
|
|
39
|
+
*
|
|
40
|
+
* This creates the checkout session ON the connected account (Direct Charge),
|
|
41
|
+
* meaning the payment shows up in the connected account's dashboard, and
|
|
42
|
+
* the application fee is transferred to the platform.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const session = await createCheckoutSession({
|
|
47
|
+
* items: [
|
|
48
|
+
* { name: 'T-Shirt', price: 2999, quantity: 1 }
|
|
49
|
+
* ],
|
|
50
|
+
* customerEmail: 'customer@example.com',
|
|
51
|
+
* successUrl: 'https://store.example.com/success?session_id={CHECKOUT_SESSION_ID}',
|
|
52
|
+
* cancelUrl: 'https://store.example.com/cart',
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* // Redirect customer to Stripe Checkout
|
|
56
|
+
* redirect(session.url)
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function createCheckoutSession(request: CheckoutSessionRequest, options?: CreateCheckoutSessionOptions): Promise<CheckoutSessionResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Deserialize items from Stripe metadata.
|
|
62
|
+
*/
|
|
63
|
+
export declare function deserializeItemsFromMetadata(json: string): CheckoutLineItem[];
|
|
64
|
+
/**
|
|
65
|
+
* Retrieve a checkout session by ID.
|
|
66
|
+
* Useful for the success page to get order details.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getCheckoutSession(sessionId: string): Promise<Stripe.Checkout.Session | null>;
|
|
69
|
+
//# sourceMappingURL=create-checkout-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-checkout-session.d.ts","sourceRoot":"","sources":["../../../src/checkout/server/create-checkout-session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAQhC,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAMjB,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAEhC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,uBAAuB,CAAC,CAsHlC;AA4BD;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,GACX,gBAAgB,EAAE,CAqBpB;AAMD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,CAoBzC"}
|