@rovela-ai/sdk 0.3.34 → 0.4.1
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/{styles/admin-theme.css → admin-theme.css} +1 -46
- package/dist/checkout/index.d.ts +1 -1
- package/dist/checkout/index.d.ts.map +1 -1
- package/dist/checkout/server/create-checkout-session.d.ts +10 -1
- package/dist/checkout/server/create-checkout-session.d.ts.map +1 -1
- package/dist/checkout/server/create-checkout-session.js +28 -17
- package/dist/checkout/server/create-checkout-session.js.map +1 -1
- package/dist/checkout/server/handle-webhook.d.ts.map +1 -1
- package/dist/checkout/server/handle-webhook.js +24 -26
- package/dist/checkout/server/handle-webhook.js.map +1 -1
- package/dist/checkout/server/order-service.d.ts +8 -3
- package/dist/checkout/server/order-service.d.ts.map +1 -1
- package/dist/checkout/server/order-service.js +60 -14
- package/dist/checkout/server/order-service.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/admin/api/accept-invite.d.ts +0 -65
- package/dist/admin/api/accept-invite.d.ts.map +0 -1
- package/dist/admin/api/accept-invite.js +0 -115
- package/dist/admin/api/accept-invite.js.map +0 -1
- package/dist/admin/api/auth.d.ts +0 -32
- package/dist/admin/api/auth.d.ts.map +0 -1
- package/dist/admin/api/auth.js +0 -37
- package/dist/admin/api/auth.js.map +0 -1
- package/dist/admin/api/categories.d.ts +0 -68
- package/dist/admin/api/categories.d.ts.map +0 -1
- package/dist/admin/api/categories.js +0 -266
- package/dist/admin/api/categories.js.map +0 -1
- package/dist/admin/api/check.d.ts +0 -38
- package/dist/admin/api/check.d.ts.map +0 -1
- package/dist/admin/api/check.js +0 -49
- package/dist/admin/api/check.js.map +0 -1
- package/dist/admin/api/customers.d.ts +0 -77
- package/dist/admin/api/customers.d.ts.map +0 -1
- package/dist/admin/api/customers.js +0 -219
- package/dist/admin/api/customers.js.map +0 -1
- package/dist/admin/api/forgot-password.d.ts +0 -39
- package/dist/admin/api/forgot-password.d.ts.map +0 -1
- package/dist/admin/api/forgot-password.js +0 -66
- package/dist/admin/api/forgot-password.js.map +0 -1
- package/dist/admin/api/index.d.ts +0 -107
- package/dist/admin/api/index.d.ts.map +0 -1
- package/dist/admin/api/index.js +0 -127
- package/dist/admin/api/index.js.map +0 -1
- package/dist/admin/api/linked-customer.d.ts +0 -32
- package/dist/admin/api/linked-customer.d.ts.map +0 -1
- package/dist/admin/api/linked-customer.js +0 -45
- package/dist/admin/api/linked-customer.js.map +0 -1
- package/dist/admin/api/me.d.ts +0 -72
- package/dist/admin/api/me.d.ts.map +0 -1
- package/dist/admin/api/me.js +0 -177
- package/dist/admin/api/me.js.map +0 -1
- package/dist/admin/api/orders.d.ts +0 -91
- package/dist/admin/api/orders.d.ts.map +0 -1
- package/dist/admin/api/orders.js +0 -390
- package/dist/admin/api/orders.js.map +0 -1
- package/dist/admin/api/products-bulk.d.ts +0 -38
- package/dist/admin/api/products-bulk.d.ts.map +0 -1
- package/dist/admin/api/products-bulk.js +0 -135
- package/dist/admin/api/products-bulk.js.map +0 -1
- package/dist/admin/api/products-stats.d.ts +0 -34
- package/dist/admin/api/products-stats.d.ts.map +0 -1
- package/dist/admin/api/products-stats.js +0 -43
- package/dist/admin/api/products-stats.js.map +0 -1
- package/dist/admin/api/products.d.ts +0 -104
- package/dist/admin/api/products.d.ts.map +0 -1
- package/dist/admin/api/products.js +0 -491
- package/dist/admin/api/products.js.map +0 -1
- package/dist/admin/api/refund.d.ts +0 -29
- package/dist/admin/api/refund.d.ts.map +0 -1
- package/dist/admin/api/refund.js +0 -142
- package/dist/admin/api/refund.js.map +0 -1
- package/dist/admin/api/reset-password.d.ts +0 -49
- package/dist/admin/api/reset-password.d.ts.map +0 -1
- package/dist/admin/api/reset-password.js +0 -99
- package/dist/admin/api/reset-password.js.map +0 -1
- package/dist/admin/api/return.d.ts +0 -47
- package/dist/admin/api/return.d.ts.map +0 -1
- package/dist/admin/api/return.js +0 -186
- package/dist/admin/api/return.js.map +0 -1
- package/dist/admin/api/settings.d.ts +0 -49
- package/dist/admin/api/settings.d.ts.map +0 -1
- package/dist/admin/api/settings.js +0 -201
- package/dist/admin/api/settings.js.map +0 -1
- package/dist/admin/api/setup-guide.d.ts +0 -78
- package/dist/admin/api/setup-guide.d.ts.map +0 -1
- package/dist/admin/api/setup-guide.js +0 -235
- package/dist/admin/api/setup-guide.js.map +0 -1
- package/dist/admin/api/setup.d.ts +0 -60
- package/dist/admin/api/setup.d.ts.map +0 -1
- package/dist/admin/api/setup.js +0 -126
- package/dist/admin/api/setup.js.map +0 -1
- package/dist/admin/api/shipping.d.ts +0 -287
- package/dist/admin/api/shipping.d.ts.map +0 -1
- package/dist/admin/api/shipping.js +0 -746
- package/dist/admin/api/shipping.js.map +0 -1
- package/dist/admin/api/stats.d.ts +0 -43
- package/dist/admin/api/stats.d.ts.map +0 -1
- package/dist/admin/api/stats.js +0 -92
- package/dist/admin/api/stats.js.map +0 -1
- package/dist/admin/api/stripe-status.d.ts +0 -39
- package/dist/admin/api/stripe-status.d.ts.map +0 -1
- package/dist/admin/api/stripe-status.js +0 -99
- package/dist/admin/api/stripe-status.js.map +0 -1
- package/dist/admin/api/tax-zones.d.ts +0 -97
- package/dist/admin/api/tax-zones.d.ts.map +0 -1
- package/dist/admin/api/tax-zones.js +0 -265
- package/dist/admin/api/tax-zones.js.map +0 -1
- package/dist/admin/api/users.d.ts +0 -142
- package/dist/admin/api/users.d.ts.map +0 -1
- package/dist/admin/api/users.js +0 -356
- package/dist/admin/api/users.js.map +0 -1
- package/dist/admin/components/AdminAcceptInviteForm.d.ts +0 -3
- package/dist/admin/components/AdminAcceptInviteForm.d.ts.map +0 -1
- package/dist/admin/components/AdminAcceptInviteForm.js +0 -137
- package/dist/admin/components/AdminAcceptInviteForm.js.map +0 -1
- package/dist/admin/components/AdminAccountPage.d.ts +0 -10
- package/dist/admin/components/AdminAccountPage.d.ts.map +0 -1
- package/dist/admin/components/AdminAccountPage.js +0 -126
- package/dist/admin/components/AdminAccountPage.js.map +0 -1
- package/dist/admin/components/AdminBarBanner.d.ts +0 -2
- package/dist/admin/components/AdminBarBanner.d.ts.map +0 -1
- package/dist/admin/components/AdminBarBanner.js +0 -266
- package/dist/admin/components/AdminBarBanner.js.map +0 -1
- package/dist/admin/components/AdminForgotPasswordForm.d.ts +0 -8
- package/dist/admin/components/AdminForgotPasswordForm.d.ts.map +0 -1
- package/dist/admin/components/AdminForgotPasswordForm.js +0 -59
- package/dist/admin/components/AdminForgotPasswordForm.js.map +0 -1
- package/dist/admin/components/AdminGuard.d.ts +0 -40
- package/dist/admin/components/AdminGuard.d.ts.map +0 -1
- package/dist/admin/components/AdminGuard.js +0 -94
- package/dist/admin/components/AdminGuard.js.map +0 -1
- package/dist/admin/components/AdminLayout.d.ts +0 -40
- package/dist/admin/components/AdminLayout.d.ts.map +0 -1
- package/dist/admin/components/AdminLayout.js +0 -39
- package/dist/admin/components/AdminLayout.js.map +0 -1
- package/dist/admin/components/AdminLoginForm.d.ts +0 -18
- package/dist/admin/components/AdminLoginForm.d.ts.map +0 -1
- package/dist/admin/components/AdminLoginForm.js +0 -61
- package/dist/admin/components/AdminLoginForm.js.map +0 -1
- package/dist/admin/components/AdminNav.d.ts +0 -44
- package/dist/admin/components/AdminNav.d.ts.map +0 -1
- package/dist/admin/components/AdminNav.js +0 -175
- package/dist/admin/components/AdminNav.js.map +0 -1
- package/dist/admin/components/AdminResetPasswordForm.d.ts +0 -12
- package/dist/admin/components/AdminResetPasswordForm.d.ts.map +0 -1
- package/dist/admin/components/AdminResetPasswordForm.js +0 -134
- package/dist/admin/components/AdminResetPasswordForm.js.map +0 -1
- package/dist/admin/components/AdminSelect.d.ts +0 -47
- package/dist/admin/components/AdminSelect.d.ts.map +0 -1
- package/dist/admin/components/AdminSelect.js +0 -71
- package/dist/admin/components/AdminSelect.js.map +0 -1
- package/dist/admin/components/AdminSetupForm.d.ts +0 -28
- package/dist/admin/components/AdminSetupForm.d.ts.map +0 -1
- package/dist/admin/components/AdminSetupForm.js +0 -85
- package/dist/admin/components/AdminSetupForm.js.map +0 -1
- package/dist/admin/components/AdminToast.d.ts +0 -31
- package/dist/admin/components/AdminToast.d.ts.map +0 -1
- package/dist/admin/components/AdminToast.js +0 -83
- package/dist/admin/components/AdminToast.js.map +0 -1
- package/dist/admin/components/AdminUserMenu.d.ts +0 -14
- package/dist/admin/components/AdminUserMenu.d.ts.map +0 -1
- package/dist/admin/components/AdminUserMenu.js +0 -34
- package/dist/admin/components/AdminUserMenu.js.map +0 -1
- package/dist/admin/components/CategoryForm.d.ts +0 -30
- package/dist/admin/components/CategoryForm.d.ts.map +0 -1
- package/dist/admin/components/CategoryForm.js +0 -152
- package/dist/admin/components/CategoryForm.js.map +0 -1
- package/dist/admin/components/CategorySelect.d.ts +0 -32
- package/dist/admin/components/CategorySelect.d.ts.map +0 -1
- package/dist/admin/components/CategorySelect.js +0 -139
- package/dist/admin/components/CategorySelect.js.map +0 -1
- package/dist/admin/components/CustomerDetails.d.ts +0 -15
- package/dist/admin/components/CustomerDetails.d.ts.map +0 -1
- package/dist/admin/components/CustomerDetails.js +0 -177
- package/dist/admin/components/CustomerDetails.js.map +0 -1
- package/dist/admin/components/CustomerTable.d.ts +0 -13
- package/dist/admin/components/CustomerTable.d.ts.map +0 -1
- package/dist/admin/components/CustomerTable.js +0 -112
- package/dist/admin/components/CustomerTable.js.map +0 -1
- package/dist/admin/components/DeleteConfirmDialog.d.ts +0 -57
- package/dist/admin/components/DeleteConfirmDialog.d.ts.map +0 -1
- package/dist/admin/components/DeleteConfirmDialog.js +0 -46
- package/dist/admin/components/DeleteConfirmDialog.js.map +0 -1
- package/dist/admin/components/ExampleContentBanner.d.ts +0 -2
- package/dist/admin/components/ExampleContentBanner.d.ts.map +0 -1
- package/dist/admin/components/ExampleContentBanner.js +0 -153
- package/dist/admin/components/ExampleContentBanner.js.map +0 -1
- package/dist/admin/components/InventoryEditor.d.ts +0 -15
- package/dist/admin/components/InventoryEditor.d.ts.map +0 -1
- package/dist/admin/components/InventoryEditor.js +0 -86
- package/dist/admin/components/InventoryEditor.js.map +0 -1
- package/dist/admin/components/InviteUserDialog.d.ts +0 -3
- package/dist/admin/components/InviteUserDialog.d.ts.map +0 -1
- package/dist/admin/components/InviteUserDialog.js +0 -127
- package/dist/admin/components/InviteUserDialog.js.map +0 -1
- package/dist/admin/components/LogoUpload.d.ts +0 -22
- package/dist/admin/components/LogoUpload.d.ts.map +0 -1
- package/dist/admin/components/LogoUpload.js +0 -210
- package/dist/admin/components/LogoUpload.js.map +0 -1
- package/dist/admin/components/LowStockAlert.d.ts +0 -11
- package/dist/admin/components/LowStockAlert.d.ts.map +0 -1
- package/dist/admin/components/LowStockAlert.js +0 -33
- package/dist/admin/components/LowStockAlert.js.map +0 -1
- package/dist/admin/components/OrderDetails.d.ts +0 -14
- package/dist/admin/components/OrderDetails.d.ts.map +0 -1
- package/dist/admin/components/OrderDetails.js +0 -210
- package/dist/admin/components/OrderDetails.js.map +0 -1
- package/dist/admin/components/OrderStatusChart.d.ts +0 -21
- package/dist/admin/components/OrderStatusChart.d.ts.map +0 -1
- package/dist/admin/components/OrderStatusChart.js +0 -61
- package/dist/admin/components/OrderStatusChart.js.map +0 -1
- package/dist/admin/components/OrderTable.d.ts +0 -13
- package/dist/admin/components/OrderTable.d.ts.map +0 -1
- package/dist/admin/components/OrderTable.js +0 -117
- package/dist/admin/components/OrderTable.js.map +0 -1
- package/dist/admin/components/PaymentSettings.d.ts +0 -13
- package/dist/admin/components/PaymentSettings.d.ts.map +0 -1
- package/dist/admin/components/PaymentSettings.js +0 -120
- package/dist/admin/components/PaymentSettings.js.map +0 -1
- package/dist/admin/components/PeriodSelector.d.ts +0 -9
- package/dist/admin/components/PeriodSelector.d.ts.map +0 -1
- package/dist/admin/components/PeriodSelector.js +0 -19
- package/dist/admin/components/PeriodSelector.js.map +0 -1
- package/dist/admin/components/PermissionsMatrix.d.ts +0 -8
- package/dist/admin/components/PermissionsMatrix.d.ts.map +0 -1
- package/dist/admin/components/PermissionsMatrix.js +0 -70
- package/dist/admin/components/PermissionsMatrix.js.map +0 -1
- package/dist/admin/components/PrimaryMetricsRow.d.ts +0 -11
- package/dist/admin/components/PrimaryMetricsRow.d.ts.map +0 -1
- package/dist/admin/components/PrimaryMetricsRow.js +0 -73
- package/dist/admin/components/PrimaryMetricsRow.js.map +0 -1
- package/dist/admin/components/ProductForm.d.ts +0 -18
- package/dist/admin/components/ProductForm.d.ts.map +0 -1
- package/dist/admin/components/ProductForm.js +0 -261
- package/dist/admin/components/ProductForm.js.map +0 -1
- package/dist/admin/components/ProductTable.d.ts +0 -14
- package/dist/admin/components/ProductTable.d.ts.map +0 -1
- package/dist/admin/components/ProductTable.js +0 -384
- package/dist/admin/components/ProductTable.js.map +0 -1
- package/dist/admin/components/RecentOrders.d.ts +0 -11
- package/dist/admin/components/RecentOrders.d.ts.map +0 -1
- package/dist/admin/components/RecentOrders.js +0 -63
- package/dist/admin/components/RecentOrders.js.map +0 -1
- package/dist/admin/components/RefundDialog.d.ts +0 -17
- package/dist/admin/components/RefundDialog.d.ts.map +0 -1
- package/dist/admin/components/RefundDialog.js +0 -90
- package/dist/admin/components/RefundDialog.js.map +0 -1
- package/dist/admin/components/RevenueChart.d.ts +0 -23
- package/dist/admin/components/RevenueChart.d.ts.map +0 -1
- package/dist/admin/components/RevenueChart.js +0 -75
- package/dist/admin/components/RevenueChart.js.map +0 -1
- package/dist/admin/components/SEOPreview.d.ts +0 -33
- package/dist/admin/components/SEOPreview.d.ts.map +0 -1
- package/dist/admin/components/SEOPreview.js +0 -30
- package/dist/admin/components/SEOPreview.js.map +0 -1
- package/dist/admin/components/SecondaryMetricsRow.d.ts +0 -14
- package/dist/admin/components/SecondaryMetricsRow.d.ts.map +0 -1
- package/dist/admin/components/SecondaryMetricsRow.js +0 -45
- package/dist/admin/components/SecondaryMetricsRow.js.map +0 -1
- package/dist/admin/components/SetupGuide.d.ts +0 -4
- package/dist/admin/components/SetupGuide.d.ts.map +0 -1
- package/dist/admin/components/SetupGuide.js +0 -244
- package/dist/admin/components/SetupGuide.js.map +0 -1
- package/dist/admin/components/ShippingSettings.d.ts +0 -3
- package/dist/admin/components/ShippingSettings.d.ts.map +0 -1
- package/dist/admin/components/ShippingSettings.js +0 -553
- package/dist/admin/components/ShippingSettings.js.map +0 -1
- package/dist/admin/components/StatsCards.d.ts +0 -18
- package/dist/admin/components/StatsCards.d.ts.map +0 -1
- package/dist/admin/components/StatsCards.js +0 -71
- package/dist/admin/components/StatsCards.js.map +0 -1
- package/dist/admin/components/StoreSettings.d.ts +0 -19
- package/dist/admin/components/StoreSettings.d.ts.map +0 -1
- package/dist/admin/components/StoreSettings.js +0 -149
- package/dist/admin/components/StoreSettings.js.map +0 -1
- package/dist/admin/components/TagInput.d.ts +0 -29
- package/dist/admin/components/TagInput.d.ts.map +0 -1
- package/dist/admin/components/TagInput.js +0 -69
- package/dist/admin/components/TagInput.js.map +0 -1
- package/dist/admin/components/TaxSettings.d.ts +0 -12
- package/dist/admin/components/TaxSettings.d.ts.map +0 -1
- package/dist/admin/components/TaxSettings.js +0 -272
- package/dist/admin/components/TaxSettings.js.map +0 -1
- package/dist/admin/components/UsersTable.d.ts +0 -3
- package/dist/admin/components/UsersTable.d.ts.map +0 -1
- package/dist/admin/components/UsersTable.js +0 -393
- package/dist/admin/components/UsersTable.js.map +0 -1
- package/dist/admin/components/VariantManager.d.ts +0 -44
- package/dist/admin/components/VariantManager.d.ts.map +0 -1
- package/dist/admin/components/VariantManager.js +0 -325
- package/dist/admin/components/VariantManager.js.map +0 -1
- package/dist/admin/components/index.d.ts +0 -71
- package/dist/admin/components/index.d.ts.map +0 -1
- package/dist/admin/components/index.js +0 -87
- package/dist/admin/components/index.js.map +0 -1
- package/dist/admin/config.d.ts +0 -71
- package/dist/admin/config.d.ts.map +0 -1
- package/dist/admin/config.js +0 -253
- package/dist/admin/config.js.map +0 -1
- package/dist/admin/hooks/fetchAdminApi.d.ts +0 -65
- package/dist/admin/hooks/fetchAdminApi.d.ts.map +0 -1
- package/dist/admin/hooks/fetchAdminApi.js +0 -96
- package/dist/admin/hooks/fetchAdminApi.js.map +0 -1
- package/dist/admin/hooks/index.d.ts +0 -24
- package/dist/admin/hooks/index.d.ts.map +0 -1
- package/dist/admin/hooks/index.js +0 -19
- package/dist/admin/hooks/index.js.map +0 -1
- package/dist/admin/hooks/useAdminAuth.d.ts +0 -25
- package/dist/admin/hooks/useAdminAuth.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminAuth.js +0 -183
- package/dist/admin/hooks/useAdminAuth.js.map +0 -1
- package/dist/admin/hooks/useAdminCategories.d.ts +0 -9
- package/dist/admin/hooks/useAdminCategories.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminCategories.js +0 -112
- package/dist/admin/hooks/useAdminCategories.js.map +0 -1
- package/dist/admin/hooks/useAdminCustomers.d.ts +0 -3
- package/dist/admin/hooks/useAdminCustomers.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminCustomers.js +0 -110
- package/dist/admin/hooks/useAdminCustomers.js.map +0 -1
- package/dist/admin/hooks/useAdminMe.d.ts +0 -31
- package/dist/admin/hooks/useAdminMe.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminMe.js +0 -78
- package/dist/admin/hooks/useAdminMe.js.map +0 -1
- package/dist/admin/hooks/useAdminOrders.d.ts +0 -3
- package/dist/admin/hooks/useAdminOrders.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminOrders.js +0 -118
- package/dist/admin/hooks/useAdminOrders.js.map +0 -1
- package/dist/admin/hooks/useAdminPermissions.d.ts +0 -3
- package/dist/admin/hooks/useAdminPermissions.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminPermissions.js +0 -51
- package/dist/admin/hooks/useAdminPermissions.js.map +0 -1
- package/dist/admin/hooks/useAdminProductMetrics.d.ts +0 -3
- package/dist/admin/hooks/useAdminProductMetrics.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminProductMetrics.js +0 -32
- package/dist/admin/hooks/useAdminProductMetrics.js.map +0 -1
- package/dist/admin/hooks/useAdminProducts.d.ts +0 -3
- package/dist/admin/hooks/useAdminProducts.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminProducts.js +0 -132
- package/dist/admin/hooks/useAdminProducts.js.map +0 -1
- package/dist/admin/hooks/useAdminSession.d.ts +0 -23
- package/dist/admin/hooks/useAdminSession.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminSession.js +0 -117
- package/dist/admin/hooks/useAdminSession.js.map +0 -1
- package/dist/admin/hooks/useAdminStats.d.ts +0 -47
- package/dist/admin/hooks/useAdminStats.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminStats.js +0 -128
- package/dist/admin/hooks/useAdminStats.js.map +0 -1
- package/dist/admin/hooks/useAdminUsers.d.ts +0 -3
- package/dist/admin/hooks/useAdminUsers.d.ts.map +0 -1
- package/dist/admin/hooks/useAdminUsers.js +0 -177
- package/dist/admin/hooks/useAdminUsers.js.map +0 -1
- package/dist/admin/hooks/useLinkedCustomerStatus.d.ts +0 -3
- package/dist/admin/hooks/useLinkedCustomerStatus.d.ts.map +0 -1
- package/dist/admin/hooks/useLinkedCustomerStatus.js +0 -48
- package/dist/admin/hooks/useLinkedCustomerStatus.js.map +0 -1
- package/dist/admin/hooks/useSetupGuide.d.ts +0 -45
- package/dist/admin/hooks/useSetupGuide.d.ts.map +0 -1
- package/dist/admin/hooks/useSetupGuide.js +0 -60
- package/dist/admin/hooks/useSetupGuide.js.map +0 -1
- package/dist/admin/index.d.ts +0 -66
- package/dist/admin/index.d.ts.map +0 -1
- package/dist/admin/index.js +0 -144
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/permissions.d.ts +0 -92
- package/dist/admin/permissions.d.ts.map +0 -1
- package/dist/admin/permissions.js +0 -201
- package/dist/admin/permissions.js.map +0 -1
- package/dist/admin/server/admin-invite.d.ts +0 -122
- package/dist/admin/server/admin-invite.d.ts.map +0 -1
- package/dist/admin/server/admin-invite.js +0 -235
- package/dist/admin/server/admin-invite.js.map +0 -1
- package/dist/admin/server/admin-password-reset.d.ts +0 -87
- package/dist/admin/server/admin-password-reset.d.ts.map +0 -1
- package/dist/admin/server/admin-password-reset.js +0 -220
- package/dist/admin/server/admin-password-reset.js.map +0 -1
- package/dist/admin/server/admin-self-service.d.ts +0 -86
- package/dist/admin/server/admin-self-service.d.ts.map +0 -1
- package/dist/admin/server/admin-self-service.js +0 -188
- package/dist/admin/server/admin-self-service.js.map +0 -1
- package/dist/admin/server/admin-service.d.ts +0 -130
- package/dist/admin/server/admin-service.d.ts.map +0 -1
- package/dist/admin/server/admin-service.js +0 -278
- package/dist/admin/server/admin-service.js.map +0 -1
- package/dist/admin/server/admin-session.d.ts +0 -173
- package/dist/admin/server/admin-session.d.ts.map +0 -1
- package/dist/admin/server/admin-session.js +0 -272
- package/dist/admin/server/admin-session.js.map +0 -1
- package/dist/admin/server/index.d.ts +0 -17
- package/dist/admin/server/index.d.ts.map +0 -1
- package/dist/admin/server/index.js +0 -39
- package/dist/admin/server/index.js.map +0 -1
- package/dist/admin/server/user-management.d.ts +0 -223
- package/dist/admin/server/user-management.d.ts.map +0 -1
- package/dist/admin/server/user-management.js +0 -846
- package/dist/admin/server/user-management.js.map +0 -1
- package/dist/admin/types.d.ts +0 -1172
- package/dist/admin/types.d.ts.map +0 -1
- package/dist/admin/types.js +0 -10
- package/dist/admin/types.js.map +0 -1
- package/dist/auth/api/auth.d.ts +0 -54
- package/dist/auth/api/auth.d.ts.map +0 -1
- package/dist/auth/api/auth.js +0 -59
- package/dist/auth/api/auth.js.map +0 -1
- package/dist/auth/api/forgot-password.d.ts +0 -41
- package/dist/auth/api/forgot-password.d.ts.map +0 -1
- package/dist/auth/api/forgot-password.js +0 -65
- package/dist/auth/api/forgot-password.js.map +0 -1
- package/dist/auth/api/index.d.ts +0 -36
- package/dist/auth/api/index.d.ts.map +0 -1
- package/dist/auth/api/index.js +0 -44
- package/dist/auth/api/index.js.map +0 -1
- package/dist/auth/api/register.d.ts +0 -41
- package/dist/auth/api/register.d.ts.map +0 -1
- package/dist/auth/api/register.js +0 -94
- package/dist/auth/api/register.js.map +0 -1
- package/dist/auth/api/request-refund.d.ts +0 -38
- package/dist/auth/api/request-refund.d.ts.map +0 -1
- package/dist/auth/api/request-refund.js +0 -142
- package/dist/auth/api/request-refund.js.map +0 -1
- package/dist/auth/api/request-return.d.ts +0 -39
- package/dist/auth/api/request-return.d.ts.map +0 -1
- package/dist/auth/api/request-return.js +0 -109
- package/dist/auth/api/request-return.js.map +0 -1
- package/dist/auth/api/resend-verification.d.ts +0 -41
- package/dist/auth/api/resend-verification.d.ts.map +0 -1
- package/dist/auth/api/resend-verification.js +0 -68
- package/dist/auth/api/resend-verification.js.map +0 -1
- package/dist/auth/api/reset-password.d.ts +0 -67
- package/dist/auth/api/reset-password.d.ts.map +0 -1
- package/dist/auth/api/reset-password.js +0 -106
- package/dist/auth/api/reset-password.js.map +0 -1
- package/dist/auth/api/verify-email.d.ts +0 -47
- package/dist/auth/api/verify-email.d.ts.map +0 -1
- package/dist/auth/api/verify-email.js +0 -90
- package/dist/auth/api/verify-email.js.map +0 -1
- package/dist/auth/components/AuthGuard.d.ts +0 -52
- package/dist/auth/components/AuthGuard.d.ts.map +0 -1
- package/dist/auth/components/AuthGuard.js +0 -109
- package/dist/auth/components/AuthGuard.js.map +0 -1
- package/dist/auth/components/ForgotPasswordForm.d.ts +0 -15
- package/dist/auth/components/ForgotPasswordForm.d.ts.map +0 -1
- package/dist/auth/components/ForgotPasswordForm.js +0 -43
- package/dist/auth/components/ForgotPasswordForm.js.map +0 -1
- package/dist/auth/components/Label.d.ts +0 -19
- package/dist/auth/components/Label.d.ts.map +0 -1
- package/dist/auth/components/Label.js +0 -18
- package/dist/auth/components/Label.js.map +0 -1
- package/dist/auth/components/ResetPasswordForm.d.ts +0 -18
- package/dist/auth/components/ResetPasswordForm.d.ts.map +0 -1
- package/dist/auth/components/ResetPasswordForm.js +0 -87
- package/dist/auth/components/ResetPasswordForm.js.map +0 -1
- package/dist/auth/components/SignInForm.d.ts +0 -21
- package/dist/auth/components/SignInForm.d.ts.map +0 -1
- package/dist/auth/components/SignInForm.js +0 -61
- package/dist/auth/components/SignInForm.js.map +0 -1
- package/dist/auth/components/SignUpForm.d.ts +0 -18
- package/dist/auth/components/SignUpForm.d.ts.map +0 -1
- package/dist/auth/components/SignUpForm.js +0 -78
- package/dist/auth/components/SignUpForm.js.map +0 -1
- package/dist/auth/components/UserMenu.d.ts +0 -18
- package/dist/auth/components/UserMenu.d.ts.map +0 -1
- package/dist/auth/components/UserMenu.js +0 -73
- package/dist/auth/components/UserMenu.js.map +0 -1
- package/dist/auth/components/VerifyEmailNotice.d.ts +0 -20
- package/dist/auth/components/VerifyEmailNotice.d.ts.map +0 -1
- package/dist/auth/components/VerifyEmailNotice.js +0 -57
- package/dist/auth/components/VerifyEmailNotice.js.map +0 -1
- package/dist/auth/components/index.d.ts +0 -15
- package/dist/auth/components/index.d.ts.map +0 -1
- package/dist/auth/components/index.js +0 -14
- package/dist/auth/components/index.js.map +0 -1
- package/dist/auth/config.d.ts +0 -59
- package/dist/auth/config.d.ts.map +0 -1
- package/dist/auth/config.js +0 -255
- package/dist/auth/config.js.map +0 -1
- package/dist/auth/hooks/index.d.ts +0 -7
- package/dist/auth/hooks/index.d.ts.map +0 -1
- package/dist/auth/hooks/index.js +0 -7
- package/dist/auth/hooks/index.js.map +0 -1
- package/dist/auth/hooks/useAuth.d.ts +0 -30
- package/dist/auth/hooks/useAuth.d.ts.map +0 -1
- package/dist/auth/hooks/useAuth.js +0 -261
- package/dist/auth/hooks/useAuth.js.map +0 -1
- package/dist/auth/index.d.ts +0 -55
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -67
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/server/customer-service.d.ts +0 -140
- package/dist/auth/server/customer-service.d.ts.map +0 -1
- package/dist/auth/server/customer-service.js +0 -266
- package/dist/auth/server/customer-service.js.map +0 -1
- package/dist/auth/server/customer-session.d.ts +0 -81
- package/dist/auth/server/customer-session.d.ts.map +0 -1
- package/dist/auth/server/customer-session.js +0 -115
- package/dist/auth/server/customer-session.js.map +0 -1
- package/dist/auth/server/email-sender.d.ts +0 -64
- package/dist/auth/server/email-sender.d.ts.map +0 -1
- package/dist/auth/server/email-sender.js +0 -106
- package/dist/auth/server/email-sender.js.map +0 -1
- package/dist/auth/server/index.d.ts +0 -15
- package/dist/auth/server/index.d.ts.map +0 -1
- package/dist/auth/server/index.js +0 -19
- package/dist/auth/server/index.js.map +0 -1
- package/dist/auth/server/password-reset-service.d.ts +0 -87
- package/dist/auth/server/password-reset-service.d.ts.map +0 -1
- package/dist/auth/server/password-reset-service.js +0 -198
- package/dist/auth/server/password-reset-service.js.map +0 -1
- package/dist/auth/server/password.d.ts +0 -58
- package/dist/auth/server/password.d.ts.map +0 -1
- package/dist/auth/server/password.js +0 -85
- package/dist/auth/server/password.js.map +0 -1
- package/dist/auth/server/verification-service.d.ts +0 -88
- package/dist/auth/server/verification-service.d.ts.map +0 -1
- package/dist/auth/server/verification-service.js +0 -224
- package/dist/auth/server/verification-service.js.map +0 -1
- package/dist/auth/types.d.ts +0 -311
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -7
- package/dist/auth/types.js.map +0 -1
- package/dist/cart/CartProvider.d.ts +0 -65
- package/dist/cart/CartProvider.d.ts.map +0 -1
- package/dist/cart/CartProvider.js +0 -100
- package/dist/cart/CartProvider.js.map +0 -1
- package/dist/cart/components/AddToCartButton.d.ts +0 -77
- package/dist/cart/components/AddToCartButton.d.ts.map +0 -1
- package/dist/cart/components/AddToCartButton.js +0 -122
- package/dist/cart/components/AddToCartButton.js.map +0 -1
- package/dist/cart/components/CartDrawer.d.ts +0 -71
- package/dist/cart/components/CartDrawer.d.ts.map +0 -1
- package/dist/cart/components/CartDrawer.js +0 -117
- package/dist/cart/components/CartDrawer.js.map +0 -1
- package/dist/cart/components/CartIcon.d.ts +0 -36
- package/dist/cart/components/CartIcon.d.ts.map +0 -1
- package/dist/cart/components/CartIcon.js +0 -68
- package/dist/cart/components/CartIcon.js.map +0 -1
- package/dist/cart/components/CartItem.d.ts +0 -52
- package/dist/cart/components/CartItem.d.ts.map +0 -1
- package/dist/cart/components/CartItem.js +0 -55
- package/dist/cart/components/CartItem.js.map +0 -1
- package/dist/cart/components/CartSummary.d.ts +0 -43
- package/dist/cart/components/CartSummary.d.ts.map +0 -1
- package/dist/cart/components/CartSummary.js +0 -60
- package/dist/cart/components/CartSummary.js.map +0 -1
- package/dist/cart/components/QuantitySelector.d.ts +0 -39
- package/dist/cart/components/QuantitySelector.d.ts.map +0 -1
- package/dist/cart/components/QuantitySelector.js +0 -85
- package/dist/cart/components/QuantitySelector.js.map +0 -1
- package/dist/cart/components/index.d.ts +0 -18
- package/dist/cart/components/index.d.ts.map +0 -1
- package/dist/cart/components/index.js +0 -12
- package/dist/cart/components/index.js.map +0 -1
- package/dist/cart/index.d.ts +0 -109
- package/dist/cart/index.d.ts.map +0 -1
- package/dist/cart/index.js +0 -115
- package/dist/cart/index.js.map +0 -1
- package/dist/cart/store.d.ts +0 -150
- package/dist/cart/store.d.ts.map +0 -1
- package/dist/cart/store.js +0 -315
- package/dist/cart/store.js.map +0 -1
- package/dist/checkout/api/checkout.js +0 -112
- package/dist/checkout/api/checkout.js.map +0 -1
- package/dist/checkout/api/countries.d.ts +0 -17
- package/dist/checkout/api/countries.d.ts.map +0 -1
- package/dist/checkout/api/countries.js +0 -38
- package/dist/checkout/api/countries.js.map +0 -1
- package/dist/checkout/api/index.js +0 -11
- package/dist/checkout/api/index.js.map +0 -1
- package/dist/checkout/api/payment-status.d.ts +0 -45
- package/dist/checkout/api/payment-status.d.ts.map +0 -1
- package/dist/checkout/api/payment-status.js +0 -104
- package/dist/checkout/api/payment-status.js.map +0 -1
- package/dist/checkout/api/shipping.d.ts +0 -34
- package/dist/checkout/api/shipping.d.ts.map +0 -1
- package/dist/checkout/api/shipping.js +0 -247
- package/dist/checkout/api/shipping.js.map +0 -1
- package/dist/checkout/api/webhook.js +0 -55
- package/dist/checkout/api/webhook.js.map +0 -1
- package/dist/checkout/components/CheckoutButton.d.ts +0 -55
- package/dist/checkout/components/CheckoutButton.d.ts.map +0 -1
- package/dist/checkout/components/CheckoutButton.js +0 -132
- package/dist/checkout/components/CheckoutButton.js.map +0 -1
- package/dist/checkout/components/CheckoutFlow.d.ts +0 -53
- package/dist/checkout/components/CheckoutFlow.d.ts.map +0 -1
- package/dist/checkout/components/CheckoutFlow.js +0 -286
- package/dist/checkout/components/CheckoutFlow.js.map +0 -1
- package/dist/checkout/components/CheckoutSuccess.d.ts +0 -29
- package/dist/checkout/components/CheckoutSuccess.d.ts.map +0 -1
- package/dist/checkout/components/CheckoutSuccess.js +0 -49
- package/dist/checkout/components/CheckoutSuccess.js.map +0 -1
- package/dist/checkout/components/OrderSummary.d.ts +0 -37
- package/dist/checkout/components/OrderSummary.d.ts.map +0 -1
- package/dist/checkout/components/OrderSummary.js +0 -71
- package/dist/checkout/components/OrderSummary.js.map +0 -1
- package/dist/checkout/components/ShippingForm.d.ts +0 -30
- package/dist/checkout/components/ShippingForm.d.ts.map +0 -1
- package/dist/checkout/components/ShippingForm.js +0 -184
- package/dist/checkout/components/ShippingForm.js.map +0 -1
- package/dist/checkout/components/ShippingOptions.d.ts +0 -51
- package/dist/checkout/components/ShippingOptions.d.ts.map +0 -1
- package/dist/checkout/components/ShippingOptions.js +0 -93
- package/dist/checkout/components/ShippingOptions.js.map +0 -1
- package/dist/checkout/components/index.d.ts +0 -12
- package/dist/checkout/components/index.d.ts.map +0 -1
- package/dist/checkout/components/index.js +0 -12
- package/dist/checkout/components/index.js.map +0 -1
- package/dist/checkout/constants.d.ts +0 -244
- package/dist/checkout/constants.d.ts.map +0 -1
- package/dist/checkout/constants.js +0 -119
- package/dist/checkout/constants.js.map +0 -1
- package/dist/checkout/hooks/index.d.ts +0 -9
- package/dist/checkout/hooks/index.d.ts.map +0 -1
- package/dist/checkout/hooks/index.js +0 -8
- package/dist/checkout/hooks/index.js.map +0 -1
- package/dist/checkout/hooks/useCheckout.d.ts +0 -61
- package/dist/checkout/hooks/useCheckout.d.ts.map +0 -1
- package/dist/checkout/hooks/useCheckout.js +0 -172
- package/dist/checkout/hooks/useCheckout.js.map +0 -1
- package/dist/checkout/hooks/usePaymentStatus.d.ts +0 -42
- package/dist/checkout/hooks/usePaymentStatus.d.ts.map +0 -1
- package/dist/checkout/hooks/usePaymentStatus.js +0 -71
- package/dist/checkout/hooks/usePaymentStatus.js.map +0 -1
- package/dist/checkout/index.js +0 -135
- package/dist/checkout/index.js.map +0 -1
- package/dist/checkout/server/coupons.d.ts +0 -91
- package/dist/checkout/server/coupons.d.ts.map +0 -1
- package/dist/checkout/server/coupons.js +0 -192
- package/dist/checkout/server/coupons.js.map +0 -1
- package/dist/checkout/server/index.js +0 -10
- package/dist/checkout/server/index.js.map +0 -1
- package/dist/checkout/stripe/client.d.ts +0 -74
- package/dist/checkout/stripe/client.d.ts.map +0 -1
- package/dist/checkout/stripe/client.js +0 -175
- package/dist/checkout/stripe/client.js.map +0 -1
- package/dist/checkout/stripe/index.d.ts +0 -7
- package/dist/checkout/stripe/index.d.ts.map +0 -1
- package/dist/checkout/stripe/index.js +0 -7
- package/dist/checkout/stripe/index.js.map +0 -1
- package/dist/checkout/types.d.ts +0 -489
- package/dist/checkout/types.d.ts.map +0 -1
- package/dist/checkout/types.js +0 -8
- package/dist/checkout/types.js.map +0 -1
- package/dist/core/StoreSettingsProvider.d.ts +0 -107
- package/dist/core/StoreSettingsProvider.d.ts.map +0 -1
- package/dist/core/StoreSettingsProvider.js +0 -200
- package/dist/core/StoreSettingsProvider.js.map +0 -1
- package/dist/core/api/index.d.ts +0 -7
- package/dist/core/api/index.d.ts.map +0 -1
- package/dist/core/api/index.js +0 -7
- package/dist/core/api/index.js.map +0 -1
- package/dist/core/api/settings.d.ts +0 -42
- package/dist/core/api/settings.d.ts.map +0 -1
- package/dist/core/api/settings.js +0 -74
- package/dist/core/api/settings.js.map +0 -1
- package/dist/core/config.d.ts +0 -296
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -117
- package/dist/core/config.js.map +0 -1
- package/dist/core/cookie-consent/CookieBanner.d.ts +0 -2
- package/dist/core/cookie-consent/CookieBanner.d.ts.map +0 -1
- package/dist/core/cookie-consent/CookieBanner.js +0 -243
- package/dist/core/cookie-consent/CookieBanner.js.map +0 -1
- package/dist/core/cookie-consent/CookieConsentProvider.d.ts +0 -53
- package/dist/core/cookie-consent/CookieConsentProvider.d.ts.map +0 -1
- package/dist/core/cookie-consent/CookieConsentProvider.js +0 -162
- package/dist/core/cookie-consent/CookieConsentProvider.js.map +0 -1
- package/dist/core/cookie-consent/CookiePreferencesLink.d.ts +0 -15
- package/dist/core/cookie-consent/CookiePreferencesLink.d.ts.map +0 -1
- package/dist/core/cookie-consent/CookiePreferencesLink.js +0 -12
- package/dist/core/cookie-consent/CookiePreferencesLink.js.map +0 -1
- package/dist/core/cookie-consent/index.d.ts +0 -17
- package/dist/core/cookie-consent/index.d.ts.map +0 -1
- package/dist/core/cookie-consent/index.js +0 -16
- package/dist/core/cookie-consent/index.js.map +0 -1
- package/dist/core/cookie-consent/types.d.ts +0 -31
- package/dist/core/cookie-consent/types.d.ts.map +0 -1
- package/dist/core/cookie-consent/types.js +0 -10
- package/dist/core/cookie-consent/types.js.map +0 -1
- package/dist/core/cookie-consent/useCookieConsent.d.ts +0 -14
- package/dist/core/cookie-consent/useCookieConsent.d.ts.map +0 -1
- package/dist/core/cookie-consent/useCookieConsent.js +0 -25
- package/dist/core/cookie-consent/useCookieConsent.js.map +0 -1
- package/dist/core/db/client.d.ts +0 -39
- package/dist/core/db/client.d.ts.map +0 -1
- package/dist/core/db/client.js +0 -86
- package/dist/core/db/client.js.map +0 -1
- package/dist/core/db/index.d.ts +0 -11
- package/dist/core/db/index.d.ts.map +0 -1
- package/dist/core/db/index.js +0 -36
- package/dist/core/db/index.js.map +0 -1
- package/dist/core/db/queries.d.ts +0 -1427
- package/dist/core/db/queries.d.ts.map +0 -1
- package/dist/core/db/queries.js +0 -1932
- package/dist/core/db/queries.js.map +0 -1
- package/dist/core/db/schema.d.ts +0 -3462
- package/dist/core/db/schema.d.ts.map +0 -1
- package/dist/core/db/schema.js +0 -494
- package/dist/core/db/schema.js.map +0 -1
- package/dist/core/index.d.ts +0 -22
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -43
- package/dist/core/index.js.map +0 -1
- package/dist/core/server/index.d.ts +0 -18
- package/dist/core/server/index.d.ts.map +0 -1
- package/dist/core/server/index.js +0 -47
- package/dist/core/server/index.js.map +0 -1
- package/dist/core/types.d.ts +0 -283
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -8
- package/dist/core/types.js.map +0 -1
- package/dist/core/utils.d.ts +0 -167
- package/dist/core/utils.d.ts.map +0 -1
- package/dist/core/utils.js +0 -351
- package/dist/core/utils.js.map +0 -1
- package/dist/emails/config.d.ts +0 -69
- package/dist/emails/config.d.ts.map +0 -1
- package/dist/emails/config.js +0 -147
- package/dist/emails/config.js.map +0 -1
- package/dist/emails/index.d.ts +0 -85
- package/dist/emails/index.d.ts.map +0 -1
- package/dist/emails/index.js +0 -110
- package/dist/emails/index.js.map +0 -1
- package/dist/emails/send/admin-auth.d.ts +0 -94
- package/dist/emails/send/admin-auth.d.ts.map +0 -1
- package/dist/emails/send/admin-auth.js +0 -118
- package/dist/emails/send/admin-auth.js.map +0 -1
- package/dist/emails/send/auth.d.ts +0 -91
- package/dist/emails/send/auth.d.ts.map +0 -1
- package/dist/emails/send/auth.js +0 -130
- package/dist/emails/send/auth.js.map +0 -1
- package/dist/emails/send/index.d.ts +0 -12
- package/dist/emails/send/index.d.ts.map +0 -1
- package/dist/emails/send/index.js +0 -18
- package/dist/emails/send/index.js.map +0 -1
- package/dist/emails/send/orders.d.ts +0 -186
- package/dist/emails/send/orders.d.ts.map +0 -1
- package/dist/emails/send/orders.js +0 -258
- package/dist/emails/send/orders.js.map +0 -1
- package/dist/emails/sender.d.ts +0 -72
- package/dist/emails/sender.d.ts.map +0 -1
- package/dist/emails/sender.js +0 -116
- package/dist/emails/sender.js.map +0 -1
- package/dist/emails/templates/admin-invite.d.ts +0 -40
- package/dist/emails/templates/admin-invite.d.ts.map +0 -1
- package/dist/emails/templates/admin-invite.js +0 -62
- package/dist/emails/templates/admin-invite.js.map +0 -1
- package/dist/emails/templates/base.d.ts +0 -109
- package/dist/emails/templates/base.d.ts.map +0 -1
- package/dist/emails/templates/base.js +0 -334
- package/dist/emails/templates/base.js.map +0 -1
- package/dist/emails/templates/email-verification.d.ts +0 -28
- package/dist/emails/templates/email-verification.d.ts.map +0 -1
- package/dist/emails/templates/email-verification.js +0 -52
- package/dist/emails/templates/email-verification.js.map +0 -1
- package/dist/emails/templates/index.d.ts +0 -16
- package/dist/emails/templates/index.d.ts.map +0 -1
- package/dist/emails/templates/index.js +0 -28
- package/dist/emails/templates/index.js.map +0 -1
- package/dist/emails/templates/order-cancelled.d.ts +0 -30
- package/dist/emails/templates/order-cancelled.d.ts.map +0 -1
- package/dist/emails/templates/order-cancelled.js +0 -83
- package/dist/emails/templates/order-cancelled.js.map +0 -1
- package/dist/emails/templates/order-confirmation.d.ts +0 -36
- package/dist/emails/templates/order-confirmation.d.ts.map +0 -1
- package/dist/emails/templates/order-confirmation.js +0 -174
- package/dist/emails/templates/order-confirmation.js.map +0 -1
- package/dist/emails/templates/order-delivered.d.ts +0 -31
- package/dist/emails/templates/order-delivered.d.ts.map +0 -1
- package/dist/emails/templates/order-delivered.js +0 -100
- package/dist/emails/templates/order-delivered.js.map +0 -1
- package/dist/emails/templates/order-shipped.d.ts +0 -32
- package/dist/emails/templates/order-shipped.d.ts.map +0 -1
- package/dist/emails/templates/order-shipped.js +0 -83
- package/dist/emails/templates/order-shipped.js.map +0 -1
- package/dist/emails/templates/password-reset.d.ts +0 -27
- package/dist/emails/templates/password-reset.d.ts.map +0 -1
- package/dist/emails/templates/password-reset.js +0 -51
- package/dist/emails/templates/password-reset.js.map +0 -1
- package/dist/emails/templates/refund-processed.d.ts +0 -32
- package/dist/emails/templates/refund-processed.d.ts.map +0 -1
- package/dist/emails/templates/refund-processed.js +0 -92
- package/dist/emails/templates/refund-processed.js.map +0 -1
- package/dist/emails/templates/welcome.d.ts +0 -27
- package/dist/emails/templates/welcome.d.ts.map +0 -1
- package/dist/emails/templates/welcome.js +0 -52
- package/dist/emails/templates/welcome.js.map +0 -1
- package/dist/emails/types.d.ts +0 -229
- package/dist/emails/types.d.ts.map +0 -1
- package/dist/emails/types.js +0 -7
- package/dist/emails/types.js.map +0 -1
- package/dist/emails/utils.d.ts +0 -94
- package/dist/emails/utils.d.ts.map +0 -1
- package/dist/emails/utils.js +0 -218
- package/dist/emails/utils.js.map +0 -1
- package/dist/index.js +0 -73
- package/dist/index.js.map +0 -1
- package/dist/media/api/delete.d.ts +0 -43
- package/dist/media/api/delete.d.ts.map +0 -1
- package/dist/media/api/delete.js +0 -124
- package/dist/media/api/delete.js.map +0 -1
- package/dist/media/api/index.d.ts +0 -17
- package/dist/media/api/index.d.ts.map +0 -1
- package/dist/media/api/index.js +0 -17
- package/dist/media/api/index.js.map +0 -1
- package/dist/media/api/presign.d.ts +0 -38
- package/dist/media/api/presign.d.ts.map +0 -1
- package/dist/media/api/presign.js +0 -130
- package/dist/media/api/presign.js.map +0 -1
- package/dist/media/components/DropZone.d.ts +0 -18
- package/dist/media/components/DropZone.d.ts.map +0 -1
- package/dist/media/components/DropZone.js +0 -107
- package/dist/media/components/DropZone.js.map +0 -1
- package/dist/media/components/ImageGalleryUpload.d.ts +0 -21
- package/dist/media/components/ImageGalleryUpload.d.ts.map +0 -1
- package/dist/media/components/ImageGalleryUpload.js +0 -195
- package/dist/media/components/ImageGalleryUpload.js.map +0 -1
- package/dist/media/components/ImageUpload.d.ts +0 -17
- package/dist/media/components/ImageUpload.d.ts.map +0 -1
- package/dist/media/components/ImageUpload.js +0 -89
- package/dist/media/components/ImageUpload.js.map +0 -1
- package/dist/media/components/index.d.ts +0 -10
- package/dist/media/components/index.d.ts.map +0 -1
- package/dist/media/components/index.js +0 -9
- package/dist/media/components/index.js.map +0 -1
- package/dist/media/config.d.ts +0 -83
- package/dist/media/config.d.ts.map +0 -1
- package/dist/media/config.js +0 -189
- package/dist/media/config.js.map +0 -1
- package/dist/media/hooks/index.d.ts +0 -8
- package/dist/media/hooks/index.d.ts.map +0 -1
- package/dist/media/hooks/index.js +0 -7
- package/dist/media/hooks/index.js.map +0 -1
- package/dist/media/hooks/useUpload.d.ts +0 -32
- package/dist/media/hooks/useUpload.d.ts.map +0 -1
- package/dist/media/hooks/useUpload.js +0 -260
- package/dist/media/hooks/useUpload.js.map +0 -1
- package/dist/media/index.d.ts +0 -57
- package/dist/media/index.d.ts.map +0 -1
- package/dist/media/index.js +0 -68
- package/dist/media/index.js.map +0 -1
- package/dist/media/server/delete.d.ts +0 -59
- package/dist/media/server/delete.d.ts.map +0 -1
- package/dist/media/server/delete.js +0 -176
- package/dist/media/server/delete.js.map +0 -1
- package/dist/media/server/index.d.ts +0 -10
- package/dist/media/server/index.d.ts.map +0 -1
- package/dist/media/server/index.js +0 -13
- package/dist/media/server/index.js.map +0 -1
- package/dist/media/server/presign.d.ts +0 -57
- package/dist/media/server/presign.d.ts.map +0 -1
- package/dist/media/server/presign.js +0 -112
- package/dist/media/server/presign.js.map +0 -1
- package/dist/media/server/r2-client.d.ts +0 -30
- package/dist/media/server/r2-client.d.ts.map +0 -1
- package/dist/media/server/r2-client.js +0 -76
- package/dist/media/server/r2-client.js.map +0 -1
- package/dist/media/types.d.ts +0 -317
- package/dist/media/types.d.ts.map +0 -1
- package/dist/media/types.js +0 -95
- package/dist/media/types.js.map +0 -1
- package/dist/products/api/categories.d.ts +0 -29
- package/dist/products/api/categories.d.ts.map +0 -1
- package/dist/products/api/categories.js +0 -46
- package/dist/products/api/categories.js.map +0 -1
- package/dist/products/api/index.d.ts +0 -24
- package/dist/products/api/index.d.ts.map +0 -1
- package/dist/products/api/index.js +0 -24
- package/dist/products/api/index.js.map +0 -1
- package/dist/products/api/product.d.ts +0 -36
- package/dist/products/api/product.d.ts.map +0 -1
- package/dist/products/api/product.js +0 -67
- package/dist/products/api/product.js.map +0 -1
- package/dist/products/api/products.d.ts +0 -41
- package/dist/products/api/products.d.ts.map +0 -1
- package/dist/products/api/products.js +0 -99
- package/dist/products/api/products.js.map +0 -1
- package/dist/products/components/CategoryNav.d.ts +0 -51
- package/dist/products/components/CategoryNav.d.ts.map +0 -1
- package/dist/products/components/CategoryNav.js +0 -110
- package/dist/products/components/CategoryNav.js.map +0 -1
- package/dist/products/components/ProductBreadcrumb.d.ts +0 -52
- package/dist/products/components/ProductBreadcrumb.d.ts.map +0 -1
- package/dist/products/components/ProductBreadcrumb.js +0 -73
- package/dist/products/components/ProductBreadcrumb.js.map +0 -1
- package/dist/products/components/ProductCard.d.ts +0 -54
- package/dist/products/components/ProductCard.d.ts.map +0 -1
- package/dist/products/components/ProductCard.js +0 -72
- package/dist/products/components/ProductCard.js.map +0 -1
- package/dist/products/components/ProductDetails.d.ts +0 -63
- package/dist/products/components/ProductDetails.d.ts.map +0 -1
- package/dist/products/components/ProductDetails.js +0 -137
- package/dist/products/components/ProductDetails.js.map +0 -1
- package/dist/products/components/ProductFilters.d.ts +0 -70
- package/dist/products/components/ProductFilters.d.ts.map +0 -1
- package/dist/products/components/ProductFilters.js +0 -125
- package/dist/products/components/ProductFilters.js.map +0 -1
- package/dist/products/components/ProductGallery.d.ts +0 -42
- package/dist/products/components/ProductGallery.d.ts.map +0 -1
- package/dist/products/components/ProductGallery.js +0 -103
- package/dist/products/components/ProductGallery.js.map +0 -1
- package/dist/products/components/ProductGrid.d.ts +0 -50
- package/dist/products/components/ProductGrid.d.ts.map +0 -1
- package/dist/products/components/ProductGrid.js +0 -81
- package/dist/products/components/ProductGrid.js.map +0 -1
- package/dist/products/components/ProductSearch.d.ts +0 -43
- package/dist/products/components/ProductSearch.d.ts.map +0 -1
- package/dist/products/components/ProductSearch.js +0 -97
- package/dist/products/components/ProductSearch.js.map +0 -1
- package/dist/products/components/ProductSort.d.ts +0 -43
- package/dist/products/components/ProductSort.d.ts.map +0 -1
- package/dist/products/components/ProductSort.js +0 -59
- package/dist/products/components/ProductSort.js.map +0 -1
- package/dist/products/components/VariantSelector.d.ts +0 -43
- package/dist/products/components/VariantSelector.d.ts.map +0 -1
- package/dist/products/components/VariantSelector.js +0 -147
- package/dist/products/components/VariantSelector.js.map +0 -1
- package/dist/products/components/index.d.ts +0 -26
- package/dist/products/components/index.d.ts.map +0 -1
- package/dist/products/components/index.js +0 -19
- package/dist/products/components/index.js.map +0 -1
- package/dist/products/hooks/index.d.ts +0 -14
- package/dist/products/hooks/index.d.ts.map +0 -1
- package/dist/products/hooks/index.js +0 -10
- package/dist/products/hooks/index.js.map +0 -1
- package/dist/products/hooks/useCategories.d.ts +0 -56
- package/dist/products/hooks/useCategories.d.ts.map +0 -1
- package/dist/products/hooks/useCategories.js +0 -126
- package/dist/products/hooks/useCategories.js.map +0 -1
- package/dist/products/hooks/useProduct.d.ts +0 -44
- package/dist/products/hooks/useProduct.d.ts.map +0 -1
- package/dist/products/hooks/useProduct.js +0 -87
- package/dist/products/hooks/useProduct.js.map +0 -1
- package/dist/products/hooks/useProductAttributes.d.ts +0 -59
- package/dist/products/hooks/useProductAttributes.d.ts.map +0 -1
- package/dist/products/hooks/useProductAttributes.js +0 -146
- package/dist/products/hooks/useProductAttributes.js.map +0 -1
- package/dist/products/hooks/useProducts.d.ts +0 -67
- package/dist/products/hooks/useProducts.d.ts.map +0 -1
- package/dist/products/hooks/useProducts.js +0 -131
- package/dist/products/hooks/useProducts.js.map +0 -1
- package/dist/products/index.d.ts +0 -94
- package/dist/products/index.d.ts.map +0 -1
- package/dist/products/index.js +0 -106
- package/dist/products/index.js.map +0 -1
- package/dist/shipping/index.d.ts +0 -8
- package/dist/shipping/index.d.ts.map +0 -1
- package/dist/shipping/index.js +0 -8
- package/dist/shipping/index.js.map +0 -1
- package/dist/shipping/shippo.d.ts +0 -85
- package/dist/shipping/shippo.d.ts.map +0 -1
- package/dist/shipping/shippo.js +0 -298
- package/dist/shipping/shippo.js.map +0 -1
- package/dist/theme/ThemeProvider.d.ts +0 -70
- package/dist/theme/ThemeProvider.d.ts.map +0 -1
- package/dist/theme/ThemeProvider.js +0 -75
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/theme/colors.d.ts +0 -148
- package/dist/theme/colors.d.ts.map +0 -1
- package/dist/theme/colors.js +0 -214
- package/dist/theme/colors.js.map +0 -1
- package/dist/theme/defaults.d.ts +0 -212
- package/dist/theme/defaults.d.ts.map +0 -1
- package/dist/theme/defaults.js +0 -275
- package/dist/theme/defaults.js.map +0 -1
- package/dist/theme/fonts.d.ts +0 -59
- package/dist/theme/fonts.d.ts.map +0 -1
- package/dist/theme/fonts.js +0 -196
- package/dist/theme/fonts.js.map +0 -1
- package/dist/theme/generator.d.ts +0 -50
- package/dist/theme/generator.d.ts.map +0 -1
- package/dist/theme/generator.js +0 -316
- package/dist/theme/generator.js.map +0 -1
- package/dist/theme/hooks.d.ts +0 -110
- package/dist/theme/hooks.d.ts.map +0 -1
- package/dist/theme/hooks.js +0 -101
- package/dist/theme/hooks.js.map +0 -1
- package/dist/theme/index.d.ts +0 -37
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js +0 -49
- package/dist/theme/index.js.map +0 -1
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useCallback, useEffect } from 'react';
|
|
4
|
-
import { fetchAdminApi } from '../hooks/fetchAdminApi';
|
|
5
|
-
import { Package, Plus, Edit2, Trash2, Globe, ChevronDown, ChevronUp, Plug, MapPin, Check, Truck, Box, RefreshCw, Key, Loader2, ExternalLink, } from 'lucide-react';
|
|
6
|
-
import { DeleteConfirmDialog } from './DeleteConfirmDialog';
|
|
7
|
-
import { AdminSelect } from './AdminSelect';
|
|
8
|
-
import { AdminToast } from './AdminToast';
|
|
9
|
-
import { useStoreSettingsOptional } from '../../core/StoreSettingsProvider';
|
|
10
|
-
import { getCurrencySymbol, formatPrice } from '../../core/utils';
|
|
11
|
-
import { COMMON_COUNTRIES, US_STATES } from '../../checkout/constants';
|
|
12
|
-
const DEFAULT_FROM_ADDRESS = {
|
|
13
|
-
name: '',
|
|
14
|
-
company: '',
|
|
15
|
-
street1: '',
|
|
16
|
-
street2: '',
|
|
17
|
-
city: '',
|
|
18
|
-
state: '',
|
|
19
|
-
zip: '',
|
|
20
|
-
country: 'US',
|
|
21
|
-
phone: '',
|
|
22
|
-
email: '',
|
|
23
|
-
};
|
|
24
|
-
const DEFAULT_PARCEL = {
|
|
25
|
-
length: 10,
|
|
26
|
-
width: 8,
|
|
27
|
-
height: 4,
|
|
28
|
-
weight: 16,
|
|
29
|
-
};
|
|
30
|
-
// =============================================================================
|
|
31
|
-
// Helper Components
|
|
32
|
-
// =============================================================================
|
|
33
|
-
function CountryTag({ code, onRemove, }) {
|
|
34
|
-
const country = COMMON_COUNTRIES.find((c) => c.code === code);
|
|
35
|
-
return (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-md bg-[hsl(var(--admin-primary-light))] px-2 py-1 text-sm text-[hsl(var(--admin-primary))]", children: [country?.name || code, _jsx("button", { type: "button", onClick: onRemove, className: "ml-1 opacity-70 hover:opacity-100", children: "\u00D7" })] }));
|
|
36
|
-
}
|
|
37
|
-
// =============================================================================
|
|
38
|
-
// Carrier Card Component (NEW)
|
|
39
|
-
// =============================================================================
|
|
40
|
-
function CarrierCard({ carrier, onEdit, onDelete, onAddZone, onEditZone, onDeleteZone, onAddRate, onEditRate, onDeleteRate, formatCurrency, }) {
|
|
41
|
-
const [isExpanded, setIsExpanded] = useState(true);
|
|
42
|
-
const zones = carrier.zones || [];
|
|
43
|
-
return (_jsxs("div", { className: "rounded-lg border border-[hsl(var(--admin-border))] overflow-hidden", children: [_jsxs("div", { className: "flex items-center justify-between bg-[hsl(var(--admin-primary))]/10 px-4 py-3", children: [_jsxs("button", { type: "button", onClick: () => setIsExpanded(!isExpanded), className: "flex items-center gap-3 text-left flex-1", children: [_jsx(Truck, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsxs("div", { children: [_jsx("span", { className: "font-semibold text-[hsl(var(--admin-foreground))]", children: carrier.name }), _jsxs("span", { className: "ml-2 text-sm text-[hsl(var(--admin-foreground-muted))]", children: ["(", carrier.code, ")"] }), carrier.description && (_jsx("p", { className: "text-sm text-[hsl(var(--admin-foreground-muted))]", children: carrier.description }))] }), isExpanded ? (_jsx(ChevronUp, { className: "h-4 w-4 text-[hsl(var(--admin-foreground-muted))]" })) : (_jsx(ChevronDown, { className: "h-4 w-4 text-[hsl(var(--admin-foreground-muted))]" }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [!carrier.isActive && (_jsx("span", { className: "admin-badge admin-badge-warning text-xs", children: "Inactive" })), _jsxs("span", { className: "text-xs text-[hsl(var(--admin-foreground-muted))]", children: [zones.length, " zone", zones.length !== 1 ? 's' : ''] }), _jsx("button", { type: "button", onClick: onEdit, className: "admin-btn admin-btn-ghost admin-btn-sm", title: "Edit carrier", children: _jsx(Edit2, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: onDelete, className: "admin-btn admin-btn-ghost admin-btn-sm text-[hsl(var(--admin-error))]", title: "Delete carrier", children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), isExpanded && (_jsxs("div", { className: "bg-[hsl(var(--admin-card))]", children: [zones.length === 0 ? (_jsxs("div", { className: "px-4 py-6 text-center text-[hsl(var(--admin-foreground-muted))]", children: [_jsx(Package, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), _jsx("p", { className: "text-sm", children: "No zones configured for this carrier" })] })) : (_jsx("div", { className: "divide-y divide-[hsl(var(--admin-border))]", children: zones.map((zone) => (_jsx(ZoneCard, { zone: zone, onEdit: () => onEditZone(zone), onDelete: () => onDeleteZone(zone), onAddRate: () => onAddRate(zone.id), onEditRate: (rate) => onEditRate(zone.id, rate), onDeleteRate: onDeleteRate, formatCurrency: formatCurrency }, zone.id))) })), _jsx("div", { className: "px-4 py-3 border-t border-[hsl(var(--admin-border))]", children: _jsxs("button", { type: "button", onClick: onAddZone, className: "flex items-center gap-2 text-sm text-[hsl(var(--admin-primary))] hover:text-[hsl(var(--admin-primary-hover))]", children: [_jsx(Plus, { className: "h-4 w-4" }), "Add shipping zone"] }) })] }))] }));
|
|
44
|
-
}
|
|
45
|
-
// =============================================================================
|
|
46
|
-
// Zone Card Component
|
|
47
|
-
// =============================================================================
|
|
48
|
-
function ZoneCard({ zone, onEdit, onDelete, onAddRate, onEditRate, onDeleteRate, formatCurrency, }) {
|
|
49
|
-
const [isExpanded, setIsExpanded] = useState(true);
|
|
50
|
-
return (_jsxs("div", { className: "bg-[hsl(var(--admin-background-subtle))]/30", children: [_jsxs("div", { className: "flex items-center justify-between px-4 py-3 pl-8", children: [_jsxs("button", { type: "button", onClick: () => setIsExpanded(!isExpanded), className: "flex items-center gap-3 text-left flex-1", children: [_jsx(Package, { className: "h-4 w-4 text-[hsl(var(--admin-foreground-muted))]" }), _jsxs("div", { children: [_jsx("span", { className: "font-medium text-[hsl(var(--admin-foreground))]", children: zone.name }), _jsxs("span", { className: "ml-2 text-sm text-[hsl(var(--admin-foreground-muted))]", children: ["(", zone.countries.includes('*') ? 'All countries' : zone.countries.join(', '), ")"] })] }), isExpanded ? (_jsx(ChevronUp, { className: "h-3 w-3 text-[hsl(var(--admin-foreground-muted))]" })) : (_jsx(ChevronDown, { className: "h-3 w-3 text-[hsl(var(--admin-foreground-muted))]" }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [!zone.isActive && (_jsx("span", { className: "admin-badge admin-badge-warning text-xs", children: "Inactive" })), _jsx("button", { type: "button", onClick: onEdit, className: "admin-btn admin-btn-ghost admin-btn-sm", title: "Edit zone", children: _jsx(Edit2, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: onDelete, className: "admin-btn admin-btn-ghost admin-btn-sm text-[hsl(var(--admin-error))]", title: "Delete zone", children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), isExpanded && (_jsxs("div", { className: "bg-[hsl(var(--admin-card))]", children: [zone.rates.length === 0 ? (_jsx("div", { className: "px-4 py-4 pl-12 text-center text-[hsl(var(--admin-foreground-muted))] text-sm", children: "No shipping rates configured" })) : (_jsx("div", { className: "divide-y divide-[hsl(var(--admin-border))]", children: zone.rates.map((rate) => (_jsxs("div", { className: "flex items-center justify-between px-4 py-2 pl-12 hover:bg-[hsl(var(--admin-background-subtle))]/50 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: "text-[hsl(var(--admin-foreground-muted))] text-xs", children: "\u2514\u2500" }), _jsxs("div", { children: [_jsx("span", { className: "text-sm font-medium text-[hsl(var(--admin-foreground))]", children: rate.name }), rate.description && (_jsx("span", { className: "ml-2 text-xs text-[hsl(var(--admin-foreground-muted))]", children: rate.description }))] })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: "font-medium text-sm text-[hsl(var(--admin-foreground))]", children: formatCurrency(rate.price) }), rate.estimatedDays && (_jsxs("span", { className: "text-xs text-[hsl(var(--admin-foreground-muted))]", children: [rate.estimatedDays, " days"] })), !rate.isActive && (_jsx("span", { className: "admin-badge admin-badge-warning text-xs", children: "Inactive" })), _jsx("button", { type: "button", onClick: () => onEditRate(rate), className: "admin-btn admin-btn-ghost admin-btn-sm", title: "Edit rate", children: _jsx(Edit2, { className: "h-3 w-3" }) }), _jsx("button", { type: "button", onClick: () => onDeleteRate(rate), className: "admin-btn admin-btn-ghost admin-btn-sm text-[hsl(var(--admin-error))]", title: "Delete rate", children: _jsx(Trash2, { className: "h-3 w-3" }) })] })] }, rate.id))) })), _jsx("div", { className: "px-4 py-2 pl-12 border-t border-[hsl(var(--admin-border))]", children: _jsxs("button", { type: "button", onClick: onAddRate, className: "flex items-center gap-2 text-xs text-[hsl(var(--admin-primary))] hover:text-[hsl(var(--admin-primary-hover))]", children: [_jsx(Plus, { className: "h-3 w-3" }), "Add rate"] }) })] }))] }));
|
|
51
|
-
}
|
|
52
|
-
// =============================================================================
|
|
53
|
-
// Main Component
|
|
54
|
-
// =============================================================================
|
|
55
|
-
export function ShippingSettings({ className }) {
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
// State
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
const [isFetching, setIsFetching] = useState(true);
|
|
60
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
61
|
-
const [toast, setToast] = useState(null);
|
|
62
|
-
// Toast helper
|
|
63
|
-
const showToast = useCallback((type, message) => {
|
|
64
|
-
setToast({ type, message });
|
|
65
|
-
if (type === 'success') {
|
|
66
|
-
setTimeout(() => setToast(null), 3000);
|
|
67
|
-
}
|
|
68
|
-
}, []);
|
|
69
|
-
// General settings
|
|
70
|
-
const [shippingEnabled, setShippingEnabled] = useState(true);
|
|
71
|
-
const [freeShippingThreshold, setFreeShippingThreshold] = useState('0');
|
|
72
|
-
const [shippingCountries, setShippingCountries] = useState(['US', 'CA']);
|
|
73
|
-
const [countryInput, setCountryInput] = useState('');
|
|
74
|
-
// Carriers (NEW - carrier-first architecture)
|
|
75
|
-
const [carriers, setCarriers] = useState([]);
|
|
76
|
-
// Shippo configuration
|
|
77
|
-
const [shippingMode, setShippingMode] = useState('manual');
|
|
78
|
-
const [shippoTestMode, setShippoTestMode] = useState(true);
|
|
79
|
-
const [shippoFromAddress, setShippoFromAddress] = useState(DEFAULT_FROM_ADDRESS);
|
|
80
|
-
const [shippoDefaultParcel, setShippoDefaultParcel] = useState(DEFAULT_PARCEL);
|
|
81
|
-
const [shippoKeyValid, setShippoKeyValid] = useState(null);
|
|
82
|
-
const [isValidatingShippo, setIsValidatingShippo] = useState(false);
|
|
83
|
-
// Shippo API key management
|
|
84
|
-
const [shippoApiKeyInput, setShippoApiKeyInput] = useState('');
|
|
85
|
-
const [isSavingApiKey, setIsSavingApiKey] = useState(false);
|
|
86
|
-
const [hasStoredKey, setHasStoredKey] = useState(false);
|
|
87
|
-
const [maskedKey, setMaskedKey] = useState(null);
|
|
88
|
-
const [isDeletingApiKey, setIsDeletingApiKey] = useState(false);
|
|
89
|
-
// Modals
|
|
90
|
-
const [showCarrierForm, setShowCarrierForm] = useState(false);
|
|
91
|
-
const [editingCarrier, setEditingCarrier] = useState(null);
|
|
92
|
-
const [showZoneForm, setShowZoneForm] = useState(false);
|
|
93
|
-
const [editingZone, setEditingZone] = useState(null);
|
|
94
|
-
const [showRateForm, setShowRateForm] = useState(false);
|
|
95
|
-
const [editingRate, setEditingRate] = useState(null);
|
|
96
|
-
// Delete confirmation dialog
|
|
97
|
-
const [deleteTarget, setDeleteTarget] = useState(null);
|
|
98
|
-
const [isDeleting, setIsDeleting] = useState(false);
|
|
99
|
-
const [deleteError, setDeleteError] = useState(null);
|
|
100
|
-
// Currency settings
|
|
101
|
-
const storeSettings = useStoreSettingsOptional();
|
|
102
|
-
const currency = storeSettings?.currency ?? 'USD';
|
|
103
|
-
const locale = storeSettings?.locale ?? 'en-US';
|
|
104
|
-
const currencySymbol = getCurrencySymbol(currency, locale);
|
|
105
|
-
const formatCurrency = (price) => {
|
|
106
|
-
return formatPrice(price, { currency, locale });
|
|
107
|
-
};
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
// Data Fetching
|
|
110
|
-
// ---------------------------------------------------------------------------
|
|
111
|
-
const fetchData = useCallback(async () => {
|
|
112
|
-
// Fetch settings and carriers in parallel.
|
|
113
|
-
const [settingsRes, carriersRes] = await Promise.all([
|
|
114
|
-
fetchAdminApi('/api/admin/settings'),
|
|
115
|
-
fetchAdminApi('/api/admin/shipping/carriers'),
|
|
116
|
-
]);
|
|
117
|
-
setIsFetching(false);
|
|
118
|
-
if (settingsRes.ok) {
|
|
119
|
-
const settings = settingsRes.data.settings || {};
|
|
120
|
-
setShippingEnabled(settings.shippingEnabled ?? true);
|
|
121
|
-
setFreeShippingThreshold(String(settings.freeShippingThreshold ?? 0));
|
|
122
|
-
setShippingCountries(settings.shippingCountries || ['US', 'CA']);
|
|
123
|
-
setShippingMode(settings.shippingMode || 'manual');
|
|
124
|
-
setShippoTestMode(settings.shippoTestMode ?? true);
|
|
125
|
-
if (settings.shippoFromAddress) {
|
|
126
|
-
setShippoFromAddress(settings.shippoFromAddress);
|
|
127
|
-
}
|
|
128
|
-
if (settings.shippoDefaultParcel) {
|
|
129
|
-
setShippoDefaultParcel(settings.shippoDefaultParcel);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
showToast('error', settingsRes.error);
|
|
134
|
-
}
|
|
135
|
-
if (carriersRes.ok) {
|
|
136
|
-
setCarriers(carriersRes.data.data || []);
|
|
137
|
-
}
|
|
138
|
-
else if (settingsRes.ok) {
|
|
139
|
-
// Only surface the carriers error if settings loaded OK — otherwise
|
|
140
|
-
// the settings error above is the more actionable message.
|
|
141
|
-
showToast('error', carriersRes.error);
|
|
142
|
-
}
|
|
143
|
-
}, [showToast]);
|
|
144
|
-
// Pattern C — populate state from async-loaded settings.
|
|
145
|
-
// Alternative is a data-fetching library (TanStack Query / SWR).
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
148
|
-
fetchData();
|
|
149
|
-
}, [fetchData]);
|
|
150
|
-
// ---------------------------------------------------------------------------
|
|
151
|
-
// Handlers
|
|
152
|
-
// ---------------------------------------------------------------------------
|
|
153
|
-
const handleSaveSettings = useCallback(async () => {
|
|
154
|
-
setToast(null);
|
|
155
|
-
setIsLoading(true);
|
|
156
|
-
const res = await fetchAdminApi('/api/admin/settings', {
|
|
157
|
-
method: 'PUT',
|
|
158
|
-
headers: { 'Content-Type': 'application/json' },
|
|
159
|
-
body: JSON.stringify({
|
|
160
|
-
shippingEnabled,
|
|
161
|
-
freeShippingThreshold: parseFloat(freeShippingThreshold) || 0,
|
|
162
|
-
shippingCountries,
|
|
163
|
-
// Shippo settings
|
|
164
|
-
shippingMode,
|
|
165
|
-
shippoTestMode,
|
|
166
|
-
shippoFromAddress,
|
|
167
|
-
shippoDefaultParcel,
|
|
168
|
-
}),
|
|
169
|
-
});
|
|
170
|
-
setIsLoading(false);
|
|
171
|
-
if (!res.ok) {
|
|
172
|
-
showToast('error', res.error);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
showToast('success', 'Settings saved successfully!');
|
|
176
|
-
}, [shippingEnabled, freeShippingThreshold, shippingCountries, shippingMode, shippoTestMode, shippoFromAddress, shippoDefaultParcel, showToast]);
|
|
177
|
-
const handleValidateShippoKey = useCallback(async () => {
|
|
178
|
-
setIsValidatingShippo(true);
|
|
179
|
-
setShippoKeyValid(null);
|
|
180
|
-
const res = await fetchAdminApi('/api/admin/shipping/shippo/validate', { method: 'POST' });
|
|
181
|
-
setIsValidatingShippo(false);
|
|
182
|
-
if (!res.ok) {
|
|
183
|
-
setShippoKeyValid(false);
|
|
184
|
-
setHasStoredKey(false);
|
|
185
|
-
setMaskedKey(null);
|
|
186
|
-
showToast('error', res.error);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
setShippoKeyValid(res.data.valid ?? false);
|
|
190
|
-
setHasStoredKey(res.data.hasStoredKey ?? false);
|
|
191
|
-
setMaskedKey(res.data.maskedKey ?? null);
|
|
192
|
-
if (!res.data.valid && res.data.error) {
|
|
193
|
-
showToast('error', res.data.error);
|
|
194
|
-
}
|
|
195
|
-
}, [showToast]);
|
|
196
|
-
// Auto-validate Shippo API key when mode is 'shippo' after initial load.
|
|
197
|
-
// Pattern C — async validation triggered by data arrival.
|
|
198
|
-
// Alternative is a data-fetching library handling derived async state.
|
|
199
|
-
useEffect(() => {
|
|
200
|
-
if (!isFetching && shippingMode === 'shippo' && shippoKeyValid === null) {
|
|
201
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
202
|
-
handleValidateShippoKey();
|
|
203
|
-
}
|
|
204
|
-
}, [isFetching, shippingMode, shippoKeyValid, handleValidateShippoKey]);
|
|
205
|
-
const handleSaveShippoApiKey = useCallback(async () => {
|
|
206
|
-
if (!shippoApiKeyInput.trim())
|
|
207
|
-
return;
|
|
208
|
-
setIsSavingApiKey(true);
|
|
209
|
-
setToast(null);
|
|
210
|
-
const res = await fetchAdminApi('/api/admin/shipping/shippo/api-key', {
|
|
211
|
-
method: 'POST',
|
|
212
|
-
headers: { 'Content-Type': 'application/json' },
|
|
213
|
-
body: JSON.stringify({ apiKey: shippoApiKeyInput }),
|
|
214
|
-
});
|
|
215
|
-
setIsSavingApiKey(false);
|
|
216
|
-
if (!res.ok) {
|
|
217
|
-
showToast('error', res.error);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
setHasStoredKey(true);
|
|
221
|
-
setMaskedKey(res.data.maskedKey ?? null);
|
|
222
|
-
setShippoApiKeyInput('');
|
|
223
|
-
setShippoKeyValid(true);
|
|
224
|
-
showToast('success', 'API key saved and verified!');
|
|
225
|
-
}, [shippoApiKeyInput, showToast]);
|
|
226
|
-
const handleRemoveApiKey = useCallback(async () => {
|
|
227
|
-
setIsDeletingApiKey(true);
|
|
228
|
-
setToast(null);
|
|
229
|
-
const res = await fetchAdminApi('/api/admin/shipping/shippo/api-key', {
|
|
230
|
-
method: 'DELETE',
|
|
231
|
-
});
|
|
232
|
-
setIsDeletingApiKey(false);
|
|
233
|
-
if (!res.ok) {
|
|
234
|
-
showToast('error', res.error);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
setHasStoredKey(false);
|
|
238
|
-
setMaskedKey(null);
|
|
239
|
-
showToast('success', 'API key removed');
|
|
240
|
-
// Re-validate to check if env var exists
|
|
241
|
-
handleValidateShippoKey();
|
|
242
|
-
}, [handleValidateShippoKey, showToast]);
|
|
243
|
-
const handleAddCountry = useCallback(() => {
|
|
244
|
-
const code = countryInput.toUpperCase().trim();
|
|
245
|
-
if (code && code.length === 2 && !shippingCountries.includes(code)) {
|
|
246
|
-
setShippingCountries((prev) => [...prev, code]);
|
|
247
|
-
setCountryInput('');
|
|
248
|
-
}
|
|
249
|
-
}, [countryInput, shippingCountries]);
|
|
250
|
-
const handleRemoveCountry = useCallback((code) => {
|
|
251
|
-
setShippingCountries((prev) => prev.filter((c) => c !== code));
|
|
252
|
-
}, []);
|
|
253
|
-
// Toggle shipping enabled and save immediately
|
|
254
|
-
const handleToggleShippingEnabled = useCallback(async () => {
|
|
255
|
-
const newValue = !shippingEnabled;
|
|
256
|
-
setShippingEnabled(newValue);
|
|
257
|
-
const res = await fetchAdminApi('/api/admin/settings', {
|
|
258
|
-
method: 'PUT',
|
|
259
|
-
headers: { 'Content-Type': 'application/json' },
|
|
260
|
-
body: JSON.stringify({ shippingEnabled: newValue }),
|
|
261
|
-
});
|
|
262
|
-
if (!res.ok) {
|
|
263
|
-
// Revert on error
|
|
264
|
-
setShippingEnabled(!newValue);
|
|
265
|
-
showToast('error', res.error);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
showToast('success', newValue ? 'Shipping enabled' : 'Shipping disabled');
|
|
269
|
-
}, [shippingEnabled, showToast]);
|
|
270
|
-
// Carrier handlers - open delete dialog
|
|
271
|
-
const handleDeleteCarrierClick = useCallback((carrier) => {
|
|
272
|
-
setDeleteTarget({ type: 'carrier', id: carrier.id, name: carrier.name });
|
|
273
|
-
setDeleteError(null);
|
|
274
|
-
}, []);
|
|
275
|
-
const handleDeleteZoneClick = useCallback((zone) => {
|
|
276
|
-
setDeleteTarget({ type: 'zone', id: zone.id, name: zone.name });
|
|
277
|
-
setDeleteError(null);
|
|
278
|
-
}, []);
|
|
279
|
-
const handleDeleteRateClick = useCallback((rate) => {
|
|
280
|
-
setDeleteTarget({ type: 'rate', id: rate.id, name: rate.name });
|
|
281
|
-
setDeleteError(null);
|
|
282
|
-
}, []);
|
|
283
|
-
const handleDeleteConfirm = useCallback(async () => {
|
|
284
|
-
if (!deleteTarget)
|
|
285
|
-
return;
|
|
286
|
-
setIsDeleting(true);
|
|
287
|
-
setDeleteError(null);
|
|
288
|
-
let endpoint;
|
|
289
|
-
switch (deleteTarget.type) {
|
|
290
|
-
case 'carrier':
|
|
291
|
-
endpoint = `/api/admin/shipping/carriers/${deleteTarget.id}`;
|
|
292
|
-
break;
|
|
293
|
-
case 'zone':
|
|
294
|
-
endpoint = `/api/admin/shipping/zones/${deleteTarget.id}`;
|
|
295
|
-
break;
|
|
296
|
-
case 'rate':
|
|
297
|
-
endpoint = `/api/admin/shipping/rates/${deleteTarget.id}`;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
const res = await fetchAdminApi(endpoint, { method: 'DELETE' });
|
|
301
|
-
setIsDeleting(false);
|
|
302
|
-
if (!res.ok) {
|
|
303
|
-
setDeleteError(res.error);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
// Update local state or refresh data
|
|
307
|
-
if (deleteTarget.type === 'carrier') {
|
|
308
|
-
setCarriers((prev) => prev.filter((c) => c.id !== deleteTarget.id));
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
// For zones and rates, refresh the full carrier list to reflect nested changes
|
|
312
|
-
await fetchData();
|
|
313
|
-
}
|
|
314
|
-
// Close dialog on success
|
|
315
|
-
setDeleteTarget(null);
|
|
316
|
-
}, [deleteTarget, fetchData]);
|
|
317
|
-
const handleDeleteCancel = useCallback(() => {
|
|
318
|
-
setDeleteTarget(null);
|
|
319
|
-
setDeleteError(null);
|
|
320
|
-
}, []);
|
|
321
|
-
// ---------------------------------------------------------------------------
|
|
322
|
-
// Loading State
|
|
323
|
-
// ---------------------------------------------------------------------------
|
|
324
|
-
if (isFetching) {
|
|
325
|
-
return (_jsxs("div", { className: `space-y-6 ${className || ''}`, children: [_jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsx("div", { className: "h-6 w-40 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse mb-4" }), _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "h-10 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse" }), _jsx("div", { className: "h-10 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse" }), _jsx("div", { className: "h-10 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse" })] })] }), _jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsx("div", { className: "h-6 w-32 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse mb-4" }), _jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "h-20 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse" }), _jsx("div", { className: "h-20 bg-[hsl(var(--admin-background-subtle))] rounded animate-pulse" })] })] })] }));
|
|
326
|
-
}
|
|
327
|
-
// ---------------------------------------------------------------------------
|
|
328
|
-
// Render
|
|
329
|
-
// ---------------------------------------------------------------------------
|
|
330
|
-
return (_jsxs("div", { className: `space-y-6 pb-20 ${className || ''}`, children: [_jsx(AdminToast, { toast: toast, onClose: () => setToast(null) }), _jsx("div", { className: "admin-card rounded-lg p-6", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-10 w-10 rounded-full bg-[hsl(var(--admin-primary))]/10 flex items-center justify-center", children: _jsx(Package, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }) }), _jsxs("div", { children: [_jsx("h3", { className: "admin-card-title", children: "Enable Shipping" }), _jsx("p", { className: "admin-text-muted text-sm", children: "Turn off to hide shipping options at checkout" })] })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": shippingEnabled, onClick: handleToggleShippingEnabled, className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${shippingEnabled
|
|
331
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
332
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${shippingEnabled ? 'translate-x-6' : 'translate-x-1'}` }) })] }) }), shippingEnabled && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx(Truck, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "Shipping Method" })] }), _jsx("p", { className: "admin-text-muted text-sm mb-4", children: "Choose how shipping rates are calculated at checkout." }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("button", { type: "button", onClick: () => setShippingMode('manual'), className: `p-4 rounded-lg border-2 text-left transition-colors ${shippingMode === 'manual'
|
|
333
|
-
? 'border-[hsl(var(--admin-primary))] bg-[hsl(var(--admin-primary-light))]'
|
|
334
|
-
: 'border-[hsl(var(--admin-border))] hover:border-[hsl(var(--admin-primary))]'}`, children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Package, { className: "h-5 w-5" }), _jsx("span", { className: "font-medium", children: "Manual Rates" })] }), _jsx("p", { className: "text-sm text-[hsl(var(--admin-foreground-muted))]", children: "Configure carriers, zones, and rates manually." })] }), _jsxs("button", { type: "button", onClick: () => setShippingMode('shippo'), className: `p-4 rounded-lg border-2 text-left transition-colors ${shippingMode === 'shippo'
|
|
335
|
-
? 'border-[hsl(var(--admin-primary))] bg-[hsl(var(--admin-primary-light))]'
|
|
336
|
-
: 'border-[hsl(var(--admin-border))] hover:border-[hsl(var(--admin-primary))]'}`, children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Plug, { className: "h-5 w-5" }), _jsx("span", { className: "font-medium", children: "Shippo (Carrier Rates)" })] }), _jsx("p", { className: "text-sm text-[hsl(var(--admin-foreground-muted))]", children: "Real-time rates from USPS, UPS, FedEx, and more." })] })] })] }), _jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-6", children: [_jsx(Globe, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "General Settings" })] }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "freeShippingThreshold", className: "admin-label", children: "Free Shipping Threshold" }), _jsx("p", { className: "admin-text-muted text-sm mb-2", children: "Orders above this amount qualify for free shipping (0 = disabled)" }), _jsxs("div", { className: "admin-input-with-addon w-full max-w-xs", children: [_jsx("span", { className: "admin-input-addon-left", children: currencySymbol }), _jsx("input", { type: "number", id: "freeShippingThreshold", value: freeShippingThreshold, onChange: (e) => setFreeShippingThreshold(e.target.value), min: "0", step: "0.01", className: "admin-input w-full pl-7", placeholder: "0.00" })] })] }), _jsxs("div", { children: [_jsxs("label", { className: "admin-label", children: [_jsx(MapPin, { className: "inline h-4 w-4 mr-1" }), "Shipping Countries"] }), _jsx("p", { className: "admin-text-muted text-sm mb-2", children: "Countries where you offer shipping" }), _jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: shippingCountries.map((code) => (_jsx(CountryTag, { code: code, onRemove: () => handleRemoveCountry(code) }, code))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx(AdminSelect, { value: countryInput, onChange: setCountryInput, placeholder: "Select a country...", options: COMMON_COUNTRIES.filter((c) => !shippingCountries.includes(c.code)).map((country) => ({
|
|
337
|
-
value: country.code,
|
|
338
|
-
label: `${country.name} (${country.code})`,
|
|
339
|
-
})), className: "w-full max-w-xs" }), _jsx("button", { type: "button", onClick: handleAddCountry, disabled: !countryInput, className: "admin-btn admin-btn-secondary disabled:opacity-50", children: "Add" })] })] })] })] }), shippingMode === 'manual' && (_jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-6", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Truck, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "Shipping Carriers" })] }), _jsxs("button", { type: "button", onClick: () => {
|
|
340
|
-
setEditingCarrier(null);
|
|
341
|
-
setShowCarrierForm(true);
|
|
342
|
-
}, className: "admin-btn admin-btn-primary admin-btn-sm", children: [_jsx(Plus, { className: "h-4 w-4 mr-1" }), "Add Carrier"] })] }), _jsx("p", { className: "admin-text-muted text-sm mb-4", children: "Configure your shipping carriers, zones, and rates. Each carrier can have multiple zones, and each zone can have multiple rates." }), carriers.length === 0 ? (_jsxs("div", { className: "text-center py-8 text-[hsl(var(--admin-foreground-muted))]", children: [_jsx(Truck, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }), _jsx("p", { className: "mb-2", children: "No shipping carriers configured" }), _jsx("p", { className: "text-sm", children: "Add your first carrier to start configuring shipping options" })] })) : (_jsx("div", { className: "space-y-4", children: carriers.map((carrier) => (_jsx(CarrierCard, { carrier: carrier, onEdit: () => {
|
|
343
|
-
setEditingCarrier(carrier);
|
|
344
|
-
setShowCarrierForm(true);
|
|
345
|
-
}, onDelete: () => handleDeleteCarrierClick(carrier), onAddZone: () => {
|
|
346
|
-
setEditingZone({ carrierId: carrier.id });
|
|
347
|
-
setShowZoneForm(true);
|
|
348
|
-
}, onEditZone: (zone) => {
|
|
349
|
-
setEditingZone({ carrierId: carrier.id, zone });
|
|
350
|
-
setShowZoneForm(true);
|
|
351
|
-
}, onDeleteZone: handleDeleteZoneClick, onAddRate: (zoneId) => {
|
|
352
|
-
setEditingRate({ zoneId });
|
|
353
|
-
setShowRateForm(true);
|
|
354
|
-
}, onEditRate: (zoneId, rate) => {
|
|
355
|
-
setEditingRate({ zoneId, rate });
|
|
356
|
-
setShowRateForm(true);
|
|
357
|
-
}, onDeleteRate: handleDeleteRateClick, formatCurrency: formatCurrency }, carrier.id))) }))] })), shippingMode === 'shippo' && (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx(Plug, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "Shippo Connection" })] }), _jsxs("div", { className: "p-4 rounded-lg border border-[hsl(var(--admin-border))] bg-[hsl(var(--admin-card))]", children: [shippoKeyValid === true && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-10 w-10 rounded-full bg-[hsl(var(--admin-success))]/20 flex items-center justify-center", children: _jsx(Check, { className: "h-5 w-5 text-[hsl(var(--admin-success))]" }) }), _jsxs("div", { children: [_jsx("p", { className: "font-medium text-[hsl(var(--admin-foreground))]", children: "Connected" }), _jsx("p", { className: "text-sm text-[hsl(var(--admin-foreground-muted))]", children: hasStoredKey ? (_jsxs(_Fragment, { children: ["API key: ", _jsx("code", { className: "px-1 py-0.5 rounded bg-[hsl(var(--admin-background))] text-xs", children: maskedKey })] })) : ('Using environment variable') })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [hasStoredKey && (_jsx("button", { type: "button", onClick: handleRemoveApiKey, disabled: isDeletingApiKey, className: "admin-btn admin-btn-ghost admin-btn-sm text-[hsl(var(--admin-error))] hover:bg-[hsl(var(--admin-error))]/10", children: isDeletingApiKey ? (_jsx(Loader2, { className: "h-4 w-4 animate-spin" })) : ('Remove Key') })), _jsx("button", { type: "button", onClick: handleValidateShippoKey, disabled: isValidatingShippo, className: "admin-btn admin-btn-secondary disabled:opacity-50", children: isValidatingShippo ? (_jsx(RefreshCw, { className: "h-4 w-4 animate-spin" })) : ('Re-verify') })] })] })), shippoKeyValid !== true && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-10 w-10 rounded-full bg-[hsl(var(--admin-warning))]/20 flex items-center justify-center", children: isValidatingShippo ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-[hsl(var(--admin-warning))]" })) : (_jsx(Key, { className: "h-5 w-5 text-[hsl(var(--admin-warning))]" })) }), _jsxs("div", { children: [_jsx("p", { className: "font-medium text-[hsl(var(--admin-foreground))]", children: isValidatingShippo
|
|
358
|
-
? 'Verifying...'
|
|
359
|
-
: hasStoredKey && shippoKeyValid === false
|
|
360
|
-
? 'API Key Invalid'
|
|
361
|
-
: 'API Key Required' }), _jsx("p", { className: "text-sm text-[hsl(var(--admin-foreground-muted))]", children: isValidatingShippo
|
|
362
|
-
? 'Checking your Shippo connection...'
|
|
363
|
-
: hasStoredKey && shippoKeyValid === false
|
|
364
|
-
? `Current key (${maskedKey}) is invalid. Enter a new key.`
|
|
365
|
-
: 'Enter your Shippo API key to enable carrier rate shipping.' })] })] }), !isValidatingShippo && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("input", { type: "password", value: shippoApiKeyInput, onChange: (e) => setShippoApiKeyInput(e.target.value), placeholder: "shippo_live_...", className: "admin-input flex-1" }), _jsx("button", { type: "button", onClick: handleSaveShippoApiKey, disabled: isSavingApiKey || !shippoApiKeyInput.trim(), className: "admin-btn admin-btn-primary disabled:opacity-50", children: isSavingApiKey ? (_jsx(Loader2, { className: "h-4 w-4 animate-spin" })) : ('Save & Verify') })] }), _jsxs("p", { className: "text-xs text-[hsl(var(--admin-foreground-muted))]", children: ["Get your API key from", ' ', _jsxs("a", { href: "https://apps.goshippo.com/settings/api", target: "_blank", rel: "noopener noreferrer", className: "text-[hsl(var(--admin-primary))] hover:underline inline-flex items-center gap-1", children: ["Shippo Dashboard", _jsx(ExternalLink, { className: "h-3 w-3" })] })] })] }))] }))] }), _jsxs("div", { className: "flex items-center justify-between mt-4 pt-4 border-t border-[hsl(var(--admin-border))]", children: [_jsxs("div", { children: [_jsx("label", { className: "admin-label", children: "Test Mode" }), _jsx("p", { className: "admin-text-muted text-sm", children: "Use Shippo test API for development (free API calls)" })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": shippoTestMode, onClick: () => setShippoTestMode(!shippoTestMode), className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${shippoTestMode
|
|
366
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
367
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${shippoTestMode ? 'translate-x-6' : 'translate-x-1'}` }) })] })] }), _jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx(MapPin, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "Ship-From Address" })] }), _jsx("p", { className: "admin-text-muted text-sm mb-4", children: "Your warehouse or fulfillment center address for shipping calculations." }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-name", className: "admin-label", children: "Name" }), _jsx("input", { type: "text", id: "shippo-name", value: shippoFromAddress.name, onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, name: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "John Smith" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-company", className: "admin-label", children: "Company (optional)" }), _jsx("input", { type: "text", id: "shippo-company", value: shippoFromAddress.company || '', onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, company: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "Acme Inc." })] }), _jsxs("div", { className: "md:col-span-2", children: [_jsx("label", { htmlFor: "shippo-street1", className: "admin-label", children: "Street Address" }), _jsx("input", { type: "text", id: "shippo-street1", value: shippoFromAddress.street1, onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, street1: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "123 Main St" })] }), _jsxs("div", { className: "md:col-span-2", children: [_jsx("label", { htmlFor: "shippo-street2", className: "admin-label", children: "Apt, Suite, etc. (optional)" }), _jsx("input", { type: "text", id: "shippo-street2", value: shippoFromAddress.street2 || '', onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, street2: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "Suite 100" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-city", className: "admin-label", children: "City" }), _jsx("input", { type: "text", id: "shippo-city", value: shippoFromAddress.city, onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, city: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "San Francisco" })] }), shippoFromAddress.country === 'US' && (_jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-state", className: "admin-label", children: "State" }), _jsx(AdminSelect, { id: "shippo-state", value: shippoFromAddress.state, onChange: (value) => setShippoFromAddress((prev) => ({ ...prev, state: value })), placeholder: "Select state...", options: US_STATES.map((state) => ({
|
|
368
|
-
value: state.code,
|
|
369
|
-
label: state.name,
|
|
370
|
-
})), className: "mt-1 w-full" })] })), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-zip", className: "admin-label", children: "ZIP Code" }), _jsx("input", { type: "text", id: "shippo-zip", value: shippoFromAddress.zip, onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, zip: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "94102" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-country", className: "admin-label", children: "Country" }), _jsx(AdminSelect, { id: "shippo-country", value: shippoFromAddress.country, onChange: (value) => setShippoFromAddress((prev) => ({ ...prev, country: value })), options: COMMON_COUNTRIES.map((country) => ({
|
|
371
|
-
value: country.code,
|
|
372
|
-
label: country.name,
|
|
373
|
-
})), className: "mt-1 w-full" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-phone", className: "admin-label", children: "Phone (optional)" }), _jsx("input", { type: "tel", id: "shippo-phone", value: shippoFromAddress.phone || '', onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, phone: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "+1 555 123 4567" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "shippo-email", className: "admin-label", children: "Email (optional)" }), _jsx("input", { type: "email", id: "shippo-email", value: shippoFromAddress.email || '', onChange: (e) => setShippoFromAddress((prev) => ({ ...prev, email: e.target.value })), className: "admin-input mt-1 w-full", placeholder: "shipping@example.com" })] })] })] }), _jsxs("div", { className: "admin-card rounded-lg p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx(Box, { className: "h-5 w-5 text-[hsl(var(--admin-primary))]" }), _jsx("h3", { className: "admin-card-title", children: "Default Package Size" })] }), _jsx("p", { className: "admin-text-muted text-sm mb-4", children: "Default package dimensions for rate calculations. You can override these per order." }), _jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "parcel-length", className: "admin-label", children: "Length (in)" }), _jsx("input", { type: "number", id: "parcel-length", value: shippoDefaultParcel.length, onChange: (e) => setShippoDefaultParcel((prev) => ({ ...prev, length: parseFloat(e.target.value) || 0 })), min: "0", step: "0.5", className: "admin-input mt-1 w-full" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "parcel-width", className: "admin-label", children: "Width (in)" }), _jsx("input", { type: "number", id: "parcel-width", value: shippoDefaultParcel.width, onChange: (e) => setShippoDefaultParcel((prev) => ({ ...prev, width: parseFloat(e.target.value) || 0 })), min: "0", step: "0.5", className: "admin-input mt-1 w-full" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "parcel-height", className: "admin-label", children: "Height (in)" }), _jsx("input", { type: "number", id: "parcel-height", value: shippoDefaultParcel.height, onChange: (e) => setShippoDefaultParcel((prev) => ({ ...prev, height: parseFloat(e.target.value) || 0 })), min: "0", step: "0.5", className: "admin-input mt-1 w-full" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "parcel-weight", className: "admin-label", children: "Weight (oz)" }), _jsx("input", { type: "number", id: "parcel-weight", value: shippoDefaultParcel.weight, onChange: (e) => setShippoDefaultParcel((prev) => ({ ...prev, weight: parseFloat(e.target.value) || 0 })), min: "0", step: "1", className: "admin-input mt-1 w-full" })] })] }), _jsx("p", { className: "admin-helper-text mt-2", children: "Typical small box: 10\u00D78\u00D74 in, 16 oz" })] })] }))] })), shippingEnabled && (_jsx("button", { type: "button", onClick: handleSaveSettings, disabled: isLoading, className: "fixed bottom-6 right-8 z-40 admin-btn admin-btn-primary shadow-lg disabled:opacity-50 flex items-center gap-2", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { children: "Saving..." })] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "h-4 w-4" }), _jsx("span", { children: "Save" })] })) })), showCarrierForm && (_jsx(CarrierFormModal, { carrier: editingCarrier, onClose: () => {
|
|
374
|
-
setShowCarrierForm(false);
|
|
375
|
-
setEditingCarrier(null);
|
|
376
|
-
}, onSuccess: () => {
|
|
377
|
-
setShowCarrierForm(false);
|
|
378
|
-
setEditingCarrier(null);
|
|
379
|
-
fetchData();
|
|
380
|
-
} })), showZoneForm && editingZone && (_jsx(ZoneFormModal, { carrierId: editingZone.carrierId, zone: editingZone.zone, onClose: () => {
|
|
381
|
-
setShowZoneForm(false);
|
|
382
|
-
setEditingZone(null);
|
|
383
|
-
}, onSuccess: () => {
|
|
384
|
-
setShowZoneForm(false);
|
|
385
|
-
setEditingZone(null);
|
|
386
|
-
fetchData();
|
|
387
|
-
} })), showRateForm && editingRate && (_jsx(RateFormModal, { zoneId: editingRate.zoneId, rate: editingRate.rate, onClose: () => {
|
|
388
|
-
setShowRateForm(false);
|
|
389
|
-
setEditingRate(null);
|
|
390
|
-
}, onSuccess: () => {
|
|
391
|
-
setShowRateForm(false);
|
|
392
|
-
setEditingRate(null);
|
|
393
|
-
fetchData();
|
|
394
|
-
}, currencySymbol: currencySymbol })), _jsx(DeleteConfirmDialog, { isOpen: !!deleteTarget, title: `Delete ${deleteTarget?.type === 'carrier' ? 'Carrier' : deleteTarget?.type === 'zone' ? 'Zone' : 'Rate'}`, itemName: deleteTarget?.name || '', itemType: deleteTarget?.type === 'carrier'
|
|
395
|
-
? 'carrier'
|
|
396
|
-
: deleteTarget?.type === 'zone'
|
|
397
|
-
? 'zone'
|
|
398
|
-
: 'rate', isDeleting: isDeleting, error: deleteError, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel })] }));
|
|
399
|
-
}
|
|
400
|
-
// =============================================================================
|
|
401
|
-
// Carrier Form Modal (NEW)
|
|
402
|
-
// =============================================================================
|
|
403
|
-
function CarrierFormModal({ carrier, onClose, onSuccess, }) {
|
|
404
|
-
const isEdit = !!carrier;
|
|
405
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
406
|
-
const [error, setError] = useState(null);
|
|
407
|
-
const [name, setName] = useState(carrier?.name || '');
|
|
408
|
-
const [code, setCode] = useState(carrier?.code || '');
|
|
409
|
-
const [description, setDescription] = useState(carrier?.description || '');
|
|
410
|
-
const [isActive, setIsActive] = useState(carrier?.isActive ?? true);
|
|
411
|
-
// Auto-generate code from name
|
|
412
|
-
const handleNameChange = (value) => {
|
|
413
|
-
setName(value);
|
|
414
|
-
if (!isEdit && !code) {
|
|
415
|
-
// Auto-generate code from name (lowercase, replace spaces with hyphens)
|
|
416
|
-
const autoCode = value
|
|
417
|
-
.toLowerCase()
|
|
418
|
-
.replace(/[^a-z0-9\s-]/g, '')
|
|
419
|
-
.replace(/\s+/g, '-')
|
|
420
|
-
.substring(0, 50);
|
|
421
|
-
setCode(autoCode);
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
const handleSubmit = async (e) => {
|
|
425
|
-
e.preventDefault();
|
|
426
|
-
setError(null);
|
|
427
|
-
setIsLoading(true);
|
|
428
|
-
const url = isEdit
|
|
429
|
-
? `/api/admin/shipping/carriers/${carrier.id}`
|
|
430
|
-
: '/api/admin/shipping/carriers';
|
|
431
|
-
const method = isEdit ? 'PUT' : 'POST';
|
|
432
|
-
const res = await fetchAdminApi(url, {
|
|
433
|
-
method,
|
|
434
|
-
headers: { 'Content-Type': 'application/json' },
|
|
435
|
-
body: JSON.stringify({
|
|
436
|
-
name,
|
|
437
|
-
code,
|
|
438
|
-
description: description || undefined,
|
|
439
|
-
isActive,
|
|
440
|
-
}),
|
|
441
|
-
});
|
|
442
|
-
setIsLoading(false);
|
|
443
|
-
if (!res.ok) {
|
|
444
|
-
setError(res.error);
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
onSuccess();
|
|
448
|
-
};
|
|
449
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onClose }), _jsx("div", { className: "relative bg-[hsl(var(--admin-card))] rounded-lg shadow-xl w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto", children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { className: "p-6", children: [_jsx("h3", { className: "admin-card-title mb-4", children: isEdit ? 'Edit Shipping Carrier' : 'Add Shipping Carrier' }), error && (_jsx("div", { className: "admin-alert admin-alert-error mb-4", children: _jsx("div", { className: "admin-alert-description", children: error }) })), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "carrierName", className: "admin-label admin-label-required", children: "Carrier Name" }), _jsx("input", { type: "text", id: "carrierName", value: name, onChange: (e) => handleNameChange(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., USPS, UPS, FedEx", required: true })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "carrierCode", className: "admin-label admin-label-required", children: "Carrier Code" }), _jsx("input", { type: "text", id: "carrierCode", value: code, onChange: (e) => setCode(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, '')), className: "admin-input mt-1 w-full", placeholder: "e.g., usps, ups, fedex", required: true, maxLength: 50 }), _jsx("p", { className: "admin-helper-text mt-1", children: "Unique identifier (lowercase, letters, numbers, hyphens only)" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "carrierDescription", className: "admin-label", children: "Description" }), _jsx("input", { type: "text", id: "carrierDescription", value: description, onChange: (e) => setDescription(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., United States Postal Service", maxLength: 500 })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("label", { className: "admin-label", children: "Active" }), _jsx("button", { type: "button", role: "switch", "aria-checked": isActive, onClick: () => setIsActive(!isActive), className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${isActive
|
|
450
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
451
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${isActive ? 'translate-x-6' : 'translate-x-1'}` }) })] })] })] }), _jsxs("div", { className: "flex justify-end gap-3 p-6 border-t border-[hsl(var(--admin-border))]", children: [_jsx("button", { type: "button", onClick: onClose, className: "admin-btn admin-btn-secondary", children: "Cancel" }), _jsx("button", { type: "submit", disabled: isLoading || !name.trim() || !code.trim(), className: "admin-btn admin-btn-primary disabled:opacity-50", children: isLoading ? 'Saving...' : isEdit ? 'Update Carrier' : 'Create Carrier' })] })] }) })] }));
|
|
452
|
-
}
|
|
453
|
-
// =============================================================================
|
|
454
|
-
// Zone Form Modal (UPDATED - requires carrierId)
|
|
455
|
-
// =============================================================================
|
|
456
|
-
function ZoneFormModal({ carrierId, zone, onClose, onSuccess, }) {
|
|
457
|
-
const isEdit = !!zone;
|
|
458
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
459
|
-
const [error, setError] = useState(null);
|
|
460
|
-
const [name, setName] = useState(zone?.name || '');
|
|
461
|
-
const [countries, setCountries] = useState(zone?.countries || ['US']);
|
|
462
|
-
const [isActive, setIsActive] = useState(zone?.isActive ?? true);
|
|
463
|
-
const [countryInput, setCountryInput] = useState('');
|
|
464
|
-
const [isAllCountries, setIsAllCountries] = useState(zone?.countries?.includes('*') || false);
|
|
465
|
-
const handleSubmit = async (e) => {
|
|
466
|
-
e.preventDefault();
|
|
467
|
-
setError(null);
|
|
468
|
-
setIsLoading(true);
|
|
469
|
-
const url = isEdit
|
|
470
|
-
? `/api/admin/shipping/zones/${zone.id}`
|
|
471
|
-
: '/api/admin/shipping/zones';
|
|
472
|
-
const method = isEdit ? 'PUT' : 'POST';
|
|
473
|
-
const res = await fetchAdminApi(url, {
|
|
474
|
-
method,
|
|
475
|
-
headers: { 'Content-Type': 'application/json' },
|
|
476
|
-
body: JSON.stringify({
|
|
477
|
-
carrierId, // Required for carrier-first architecture
|
|
478
|
-
name,
|
|
479
|
-
countries: isAllCountries ? ['*'] : countries,
|
|
480
|
-
isActive,
|
|
481
|
-
}),
|
|
482
|
-
});
|
|
483
|
-
setIsLoading(false);
|
|
484
|
-
if (!res.ok) {
|
|
485
|
-
setError(res.error);
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
onSuccess();
|
|
489
|
-
};
|
|
490
|
-
const handleAddCountry = () => {
|
|
491
|
-
const code = countryInput.toUpperCase().trim();
|
|
492
|
-
if (code && code.length === 2 && !countries.includes(code)) {
|
|
493
|
-
setCountries((prev) => [...prev, code]);
|
|
494
|
-
setCountryInput('');
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onClose }), _jsx("div", { className: "relative bg-[hsl(var(--admin-card))] rounded-lg shadow-xl w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto", children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { className: "p-6", children: [_jsx("h3", { className: "admin-card-title mb-4", children: isEdit ? 'Edit Shipping Zone' : 'Add Shipping Zone' }), error && (_jsx("div", { className: "admin-alert admin-alert-error mb-4", children: _jsx("div", { className: "admin-alert-description", children: error }) })), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "zoneName", className: "admin-label admin-label-required", children: "Zone Name" }), _jsx("input", { type: "text", id: "zoneName", value: name, onChange: (e) => setName(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., Domestic, International", required: true })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("label", { className: "admin-label", children: "All Countries" }), _jsx("p", { className: "admin-text-muted text-sm", children: "Apply to all countries not covered by other zones" })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": isAllCountries, onClick: () => setIsAllCountries(!isAllCountries), className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${isAllCountries
|
|
498
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
499
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${isAllCountries ? 'translate-x-6' : 'translate-x-1'}` }) })] }), !isAllCountries && (_jsxs("div", { children: [_jsx("label", { className: "admin-label", children: "Countries" }), _jsx("div", { className: "flex flex-wrap gap-2 mb-2 mt-1", children: countries.map((code) => (_jsx(CountryTag, { code: code, onRemove: () => setCountries((prev) => prev.filter((c) => c !== code)) }, code))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx(AdminSelect, { value: countryInput, onChange: setCountryInput, placeholder: "Select country...", options: COMMON_COUNTRIES.filter((c) => !countries.includes(c.code)).map((country) => ({
|
|
500
|
-
value: country.code,
|
|
501
|
-
label: country.name,
|
|
502
|
-
})), className: "flex-1" }), _jsx("button", { type: "button", onClick: handleAddCountry, disabled: !countryInput, className: "admin-btn admin-btn-secondary disabled:opacity-50", children: "Add" })] })] })), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("label", { className: "admin-label", children: "Active" }), _jsx("button", { type: "button", role: "switch", "aria-checked": isActive, onClick: () => setIsActive(!isActive), className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${isActive
|
|
503
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
504
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${isActive ? 'translate-x-6' : 'translate-x-1'}` }) })] })] })] }), _jsxs("div", { className: "flex justify-end gap-3 p-6 border-t border-[hsl(var(--admin-border))]", children: [_jsx("button", { type: "button", onClick: onClose, className: "admin-btn admin-btn-secondary", children: "Cancel" }), _jsx("button", { type: "submit", disabled: isLoading || !name.trim(), className: "admin-btn admin-btn-primary disabled:opacity-50", children: isLoading ? 'Saving...' : isEdit ? 'Update Zone' : 'Create Zone' })] })] }) })] }));
|
|
505
|
-
}
|
|
506
|
-
// =============================================================================
|
|
507
|
-
// Rate Form Modal
|
|
508
|
-
// =============================================================================
|
|
509
|
-
function RateFormModal({ zoneId, rate, onClose, onSuccess, currencySymbol, }) {
|
|
510
|
-
const isEdit = !!rate;
|
|
511
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
512
|
-
const [error, setError] = useState(null);
|
|
513
|
-
const [name, setName] = useState(rate?.name || '');
|
|
514
|
-
const [description, setDescription] = useState(rate?.description || '');
|
|
515
|
-
const [price, setPrice] = useState(String(rate?.price ?? ''));
|
|
516
|
-
const [estimatedDays, setEstimatedDays] = useState(rate?.estimatedDays || '');
|
|
517
|
-
const [minOrderAmount, setMinOrderAmount] = useState(rate?.minOrderAmount != null ? String(rate.minOrderAmount) : '');
|
|
518
|
-
const [maxOrderAmount, setMaxOrderAmount] = useState(rate?.maxOrderAmount != null ? String(rate.maxOrderAmount) : '');
|
|
519
|
-
const [isActive, setIsActive] = useState(rate?.isActive ?? true);
|
|
520
|
-
const handleSubmit = async (e) => {
|
|
521
|
-
e.preventDefault();
|
|
522
|
-
setError(null);
|
|
523
|
-
setIsLoading(true);
|
|
524
|
-
const url = isEdit
|
|
525
|
-
? `/api/admin/shipping/rates/${rate.id}`
|
|
526
|
-
: '/api/admin/shipping/rates';
|
|
527
|
-
const method = isEdit ? 'PUT' : 'POST';
|
|
528
|
-
const res = await fetchAdminApi(url, {
|
|
529
|
-
method,
|
|
530
|
-
headers: { 'Content-Type': 'application/json' },
|
|
531
|
-
body: JSON.stringify({
|
|
532
|
-
zoneId,
|
|
533
|
-
name,
|
|
534
|
-
description: description || undefined,
|
|
535
|
-
price: parseFloat(price) || 0,
|
|
536
|
-
estimatedDays: estimatedDays || undefined,
|
|
537
|
-
minOrderAmount: minOrderAmount ? parseFloat(minOrderAmount) : undefined,
|
|
538
|
-
maxOrderAmount: maxOrderAmount ? parseFloat(maxOrderAmount) : undefined,
|
|
539
|
-
isActive,
|
|
540
|
-
}),
|
|
541
|
-
});
|
|
542
|
-
setIsLoading(false);
|
|
543
|
-
if (!res.ok) {
|
|
544
|
-
setError(res.error);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
onSuccess();
|
|
548
|
-
};
|
|
549
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onClose }), _jsx("div", { className: "relative bg-[hsl(var(--admin-card))] rounded-lg shadow-xl w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto", children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { className: "p-6", children: [_jsx("h3", { className: "admin-card-title mb-4", children: isEdit ? 'Edit Shipping Rate' : 'Add Shipping Rate' }), error && (_jsx("div", { className: "admin-alert admin-alert-error mb-4", children: _jsx("div", { className: "admin-alert-description", children: error }) })), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "rateName", className: "admin-label admin-label-required", children: "Rate Name" }), _jsx("input", { type: "text", id: "rateName", value: name, onChange: (e) => setName(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., Standard Shipping", required: true })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "rateDescription", className: "admin-label", children: "Description" }), _jsx("input", { type: "text", id: "rateDescription", value: description, onChange: (e) => setDescription(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., Delivery in 5-7 business days" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "ratePrice", className: "admin-label admin-label-required", children: "Price" }), _jsxs("div", { className: "admin-input-with-addon mt-1", children: [_jsx("span", { className: "admin-input-addon-left", children: currencySymbol }), _jsx("input", { type: "number", id: "ratePrice", value: price, onChange: (e) => setPrice(e.target.value), min: "0", step: "0.01", className: "admin-input w-full pl-7", placeholder: "0.00", required: true })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "estimatedDays", className: "admin-label", children: "Estimated Delivery (days)" }), _jsx("input", { type: "text", id: "estimatedDays", value: estimatedDays, onChange: (e) => setEstimatedDays(e.target.value), className: "admin-input mt-1 w-full", placeholder: "e.g., 3-5" }), _jsx("p", { className: "admin-helper-text mt-1", children: "Format: single number (5) or range (3-5)" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "minOrderAmount", className: "admin-label", children: "Min Order Amount" }), _jsxs("div", { className: "admin-input-with-addon mt-1", children: [_jsx("span", { className: "admin-input-addon-left", children: currencySymbol }), _jsx("input", { type: "number", id: "minOrderAmount", value: minOrderAmount, onChange: (e) => setMinOrderAmount(e.target.value), min: "0", step: "0.01", className: "admin-input w-full pl-7", placeholder: "0.00" })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "maxOrderAmount", className: "admin-label", children: "Max Order Amount" }), _jsxs("div", { className: "admin-input-with-addon mt-1", children: [_jsx("span", { className: "admin-input-addon-left", children: currencySymbol }), _jsx("input", { type: "number", id: "maxOrderAmount", value: maxOrderAmount, onChange: (e) => setMaxOrderAmount(e.target.value), min: "0", step: "0.01", className: "admin-input w-full pl-7", placeholder: "No limit" })] })] })] }), _jsx("p", { className: "admin-helper-text", children: "Leave empty for no restrictions" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("label", { className: "admin-label", children: "Active" }), _jsx("button", { type: "button", role: "switch", "aria-checked": isActive, onClick: () => setIsActive(!isActive), className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${isActive
|
|
550
|
-
? 'bg-[hsl(var(--admin-primary))]'
|
|
551
|
-
: 'bg-[hsl(var(--admin-background-subtle))]'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${isActive ? 'translate-x-6' : 'translate-x-1'}` }) })] })] })] }), _jsxs("div", { className: "flex justify-end gap-3 p-6 border-t border-[hsl(var(--admin-border))]", children: [_jsx("button", { type: "button", onClick: onClose, className: "admin-btn admin-btn-secondary", children: "Cancel" }), _jsx("button", { type: "submit", disabled: isLoading || !name.trim() || !price, className: "admin-btn admin-btn-primary disabled:opacity-50", children: isLoading ? 'Saving...' : isEdit ? 'Update Rate' : 'Create Rate' })] })] }) })] }));
|
|
552
|
-
}
|
|
553
|
-
//# sourceMappingURL=ShippingSettings.js.map
|