@rovela-ai/sdk 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/api/auth.js +5 -11
- package/dist/admin/api/auth.js.map +1 -1
- package/dist/admin/api/categories.js +43 -50
- package/dist/admin/api/categories.js.map +1 -1
- package/dist/admin/api/check.js +6 -9
- package/dist/admin/api/check.js.map +1 -1
- package/dist/admin/api/customers.js +17 -21
- package/dist/admin/api/customers.js.map +1 -1
- package/dist/admin/api/index.js +10 -38
- package/dist/admin/api/index.js.map +1 -1
- package/dist/admin/api/orders.js +30 -35
- package/dist/admin/api/orders.js.map +1 -1
- package/dist/admin/api/products.js +56 -66
- package/dist/admin/api/products.js.map +1 -1
- package/dist/admin/api/refund.js +26 -29
- package/dist/admin/api/refund.js.map +1 -1
- package/dist/admin/api/settings.js +17 -21
- package/dist/admin/api/settings.js.map +1 -1
- package/dist/admin/api/setup.js +17 -20
- package/dist/admin/api/setup.js.map +1 -1
- package/dist/admin/api/stats.js +14 -17
- package/dist/admin/api/stats.js.map +1 -1
- package/dist/admin/components/AdminGuard.js +13 -17
- package/dist/admin/components/AdminGuard.js.map +1 -1
- package/dist/admin/components/AdminHeader.js +8 -11
- package/dist/admin/components/AdminHeader.js.map +1 -1
- package/dist/admin/components/AdminLayout.js +5 -8
- package/dist/admin/components/AdminLayout.js.map +1 -1
- package/dist/admin/components/AdminLoginForm.js +11 -14
- package/dist/admin/components/AdminLoginForm.js.map +1 -1
- package/dist/admin/components/AdminNav.d.ts.map +1 -1
- package/dist/admin/components/AdminNav.js +16 -14
- package/dist/admin/components/AdminNav.js.map +1 -1
- package/dist/admin/components/AdminSetupForm.js +11 -14
- package/dist/admin/components/AdminSetupForm.js.map +1 -1
- package/dist/admin/components/CategoryForm.d.ts +30 -0
- package/dist/admin/components/CategoryForm.d.ts.map +1 -0
- package/dist/admin/components/CategoryForm.js +153 -0
- package/dist/admin/components/CategoryForm.js.map +1 -0
- package/dist/admin/components/CategorySelect.d.ts +32 -0
- package/dist/admin/components/CategorySelect.d.ts.map +1 -0
- package/dist/admin/components/CategorySelect.js +148 -0
- package/dist/admin/components/CategorySelect.js.map +1 -0
- package/dist/admin/components/InventoryEditor.js +16 -19
- package/dist/admin/components/InventoryEditor.js.map +1 -1
- package/dist/admin/components/LowStockAlert.js +6 -9
- package/dist/admin/components/LowStockAlert.js.map +1 -1
- package/dist/admin/components/OrderDetails.js +15 -18
- package/dist/admin/components/OrderDetails.js.map +1 -1
- package/dist/admin/components/OrderTable.js +13 -16
- package/dist/admin/components/OrderTable.js.map +1 -1
- package/dist/admin/components/ProductForm.d.ts +2 -2
- package/dist/admin/components/ProductForm.d.ts.map +1 -1
- package/dist/admin/components/ProductForm.js +140 -27
- package/dist/admin/components/ProductForm.js.map +1 -1
- package/dist/admin/components/ProductTable.js +15 -18
- package/dist/admin/components/ProductTable.js.map +1 -1
- package/dist/admin/components/RecentOrders.js +6 -9
- package/dist/admin/components/RecentOrders.js.map +1 -1
- package/dist/admin/components/RefundDialog.js +12 -15
- package/dist/admin/components/RefundDialog.js.map +1 -1
- package/dist/admin/components/SEOPreview.d.ts +32 -0
- package/dist/admin/components/SEOPreview.d.ts.map +1 -0
- package/dist/admin/components/SEOPreview.js +30 -0
- package/dist/admin/components/SEOPreview.js.map +1 -0
- package/dist/admin/components/StatsCards.js +7 -10
- package/dist/admin/components/StatsCards.js.map +1 -1
- package/dist/admin/components/StoreSettings.js +10 -13
- package/dist/admin/components/StoreSettings.js.map +1 -1
- package/dist/admin/components/TagInput.d.ts +29 -0
- package/dist/admin/components/TagInput.d.ts.map +1 -0
- package/dist/admin/components/TagInput.js +73 -0
- package/dist/admin/components/TagInput.js.map +1 -0
- package/dist/admin/components/VariantManager.d.ts +42 -0
- package/dist/admin/components/VariantManager.d.ts.map +1 -0
- package/dist/admin/components/VariantManager.js +175 -0
- package/dist/admin/components/VariantManager.js.map +1 -0
- package/dist/admin/components/index.d.ts +5 -0
- package/dist/admin/components/index.d.ts.map +1 -1
- package/dist/admin/components/index.js +27 -35
- package/dist/admin/components/index.js.map +1 -1
- package/dist/admin/config.js +12 -54
- package/dist/admin/config.js.map +1 -1
- package/dist/admin/hooks/index.d.ts +2 -0
- package/dist/admin/hooks/index.d.ts.map +1 -1
- package/dist/admin/hooks/index.js +5 -11
- package/dist/admin/hooks/index.js.map +1 -1
- package/dist/admin/hooks/useAdminAuth.js +9 -12
- package/dist/admin/hooks/useAdminAuth.js.map +1 -1
- package/dist/admin/hooks/useAdminCategories.d.ts +36 -0
- package/dist/admin/hooks/useAdminCategories.d.ts.map +1 -0
- package/dist/admin/hooks/useAdminCategories.js +217 -0
- package/dist/admin/hooks/useAdminCategories.js.map +1 -0
- package/dist/admin/hooks/useAdminOrders.js +11 -14
- package/dist/admin/hooks/useAdminOrders.js.map +1 -1
- package/dist/admin/hooks/useAdminProducts.js +13 -16
- package/dist/admin/hooks/useAdminProducts.js.map +1 -1
- package/dist/admin/hooks/useAdminStats.js +11 -14
- package/dist/admin/hooks/useAdminStats.js.map +1 -1
- package/dist/admin/index.d.ts +3 -2
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +17 -66
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/server/admin-service.js +39 -83
- package/dist/admin/server/admin-service.js.map +1 -1
- package/dist/admin/server/index.js +3 -13
- package/dist/admin/server/index.js.map +1 -1
- package/dist/admin/types.js +1 -2
- package/dist/admin/types.js.map +1 -1
- package/dist/auth/api/auth.js +6 -14
- package/dist/auth/api/auth.js.map +1 -1
- package/dist/auth/api/forgot-password.js +8 -11
- package/dist/auth/api/forgot-password.js.map +1 -1
- package/dist/auth/api/index.js +6 -18
- package/dist/auth/api/index.js.map +1 -1
- package/dist/auth/api/register.js +17 -20
- package/dist/auth/api/register.js.map +1 -1
- package/dist/auth/api/resend-verification.js +9 -12
- package/dist/auth/api/resend-verification.js.map +1 -1
- package/dist/auth/api/reset-password.js +18 -22
- package/dist/auth/api/reset-password.js.map +1 -1
- package/dist/auth/api/verify-email.js +14 -18
- package/dist/auth/api/verify-email.js.map +1 -1
- package/dist/auth/components/AuthGuard.js +13 -17
- package/dist/auth/components/AuthGuard.js.map +1 -1
- package/dist/auth/components/ForgotPasswordForm.js +11 -14
- package/dist/auth/components/ForgotPasswordForm.js.map +1 -1
- package/dist/auth/components/ResetPasswordForm.js +18 -21
- package/dist/auth/components/ResetPasswordForm.js.map +1 -1
- package/dist/auth/components/SignInForm.js +13 -16
- package/dist/auth/components/SignInForm.js.map +1 -1
- package/dist/auth/components/SignUpForm.js +15 -18
- package/dist/auth/components/SignUpForm.js.map +1 -1
- package/dist/auth/components/UserMenu.js +13 -16
- package/dist/auth/components/UserMenu.js.map +1 -1
- package/dist/auth/components/VerifyEmailNotice.js +10 -13
- package/dist/auth/components/VerifyEmailNotice.js.map +1 -1
- package/dist/auth/components/index.js +7 -18
- package/dist/auth/components/index.js.map +1 -1
- package/dist/auth/config.js +9 -49
- package/dist/auth/config.js.map +1 -1
- package/dist/auth/hooks/index.js +1 -5
- package/dist/auth/hooks/index.js.map +1 -1
- package/dist/auth/hooks/useAuth.js +14 -17
- package/dist/auth/hooks/useAuth.js.map +1 -1
- package/dist/auth/index.js +15 -37
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/server/customer-service.js +39 -83
- package/dist/auth/server/customer-service.js.map +1 -1
- package/dist/auth/server/email-sender.js +11 -17
- package/dist/auth/server/email-sender.js.map +1 -1
- package/dist/auth/server/index.js +5 -36
- package/dist/auth/server/index.js.map +1 -1
- package/dist/auth/server/password-reset-service.js +30 -70
- package/dist/auth/server/password-reset-service.js.map +1 -1
- package/dist/auth/server/password.js +9 -18
- package/dist/auth/server/password.js.map +1 -1
- package/dist/auth/server/verification-service.js +35 -76
- package/dist/auth/server/verification-service.js.map +1 -1
- package/dist/auth/types.js +1 -2
- package/dist/auth/types.js.map +1 -1
- package/dist/cart/CartProvider.js +13 -17
- package/dist/cart/CartProvider.js.map +1 -1
- package/dist/cart/components/AddToCartButton.js +16 -19
- package/dist/cart/components/AddToCartButton.js.map +1 -1
- package/dist/cart/components/CartDrawer.js +17 -23
- package/dist/cart/components/CartDrawer.js.map +1 -1
- package/dist/cart/components/CartIcon.js +9 -12
- package/dist/cart/components/CartIcon.js.map +1 -1
- package/dist/cart/components/CartItem.js +7 -13
- package/dist/cart/components/CartItem.js.map +1 -1
- package/dist/cart/components/CartSummary.js +12 -15
- package/dist/cart/components/CartSummary.js.map +1 -1
- package/dist/cart/components/QuantitySelector.js +9 -12
- package/dist/cart/components/QuantitySelector.js.map +1 -1
- package/dist/cart/components/index.js +6 -15
- package/dist/cart/components/index.js.map +1 -1
- package/dist/cart/index.js +3 -17
- package/dist/cart/index.js.map +1 -1
- package/dist/cart/store.js +8 -13
- package/dist/cart/store.js.map +1 -1
- package/dist/checkout/api/checkout.js +12 -15
- package/dist/checkout/api/checkout.js.map +1 -1
- package/dist/checkout/api/index.js +2 -7
- package/dist/checkout/api/index.js.map +1 -1
- package/dist/checkout/api/webhook.js +8 -11
- package/dist/checkout/api/webhook.js.map +1 -1
- package/dist/checkout/components/CheckoutButton.js +8 -11
- package/dist/checkout/components/CheckoutButton.js.map +1 -1
- package/dist/checkout/components/CheckoutSuccess.js +11 -14
- package/dist/checkout/components/CheckoutSuccess.js.map +1 -1
- package/dist/checkout/components/OrderSummary.js +8 -11
- package/dist/checkout/components/OrderSummary.js.map +1 -1
- package/dist/checkout/components/ShippingForm.js +14 -17
- package/dist/checkout/components/ShippingForm.js.map +1 -1
- package/dist/checkout/components/index.js +4 -11
- package/dist/checkout/components/index.js.map +1 -1
- package/dist/checkout/hooks/index.js +1 -6
- package/dist/checkout/hooks/index.js.map +1 -1
- package/dist/checkout/hooks/useCheckout.js +10 -19
- package/dist/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/checkout/index.js +7 -28
- package/dist/checkout/index.js.map +1 -1
- package/dist/checkout/server/create-checkout-session.js +11 -16
- package/dist/checkout/server/create-checkout-session.js.map +1 -1
- package/dist/checkout/server/handle-webhook.js +21 -24
- package/dist/checkout/server/handle-webhook.js.map +1 -1
- package/dist/checkout/server/index.js +3 -13
- package/dist/checkout/server/index.js.map +1 -1
- package/dist/checkout/server/order-service.js +11 -16
- package/dist/checkout/server/order-service.js.map +1 -1
- package/dist/checkout/stripe/client.js +13 -29
- package/dist/checkout/stripe/client.js.map +1 -1
- package/dist/checkout/stripe/index.js +1 -15
- package/dist/checkout/stripe/index.js.map +1 -1
- package/dist/checkout/types.js +1 -2
- package/dist/checkout/types.js.map +1 -1
- package/dist/core/StoreSettingsProvider.d.ts +104 -0
- package/dist/core/StoreSettingsProvider.d.ts.map +1 -0
- package/dist/core/StoreSettingsProvider.js +195 -0
- package/dist/core/StoreSettingsProvider.js.map +1 -0
- package/dist/core/api/index.d.ts +7 -0
- package/dist/core/api/index.d.ts.map +1 -0
- package/dist/core/api/index.js +7 -0
- package/dist/core/api/index.js.map +1 -0
- package/dist/core/api/settings.d.ts +42 -0
- package/dist/core/api/settings.d.ts.map +1 -0
- package/dist/core/api/settings.js +74 -0
- package/dist/core/api/settings.js.map +1 -0
- package/dist/core/config.js +12 -57
- package/dist/core/config.js.map +1 -1
- package/dist/core/db/client.js +16 -62
- package/dist/core/db/client.js.map +1 -1
- package/dist/core/db/index.js +14 -93
- package/dist/core/db/index.js.map +1 -1
- package/dist/core/db/queries.d.ts +6 -6
- package/dist/core/db/queries.js +207 -284
- package/dist/core/db/queries.js.map +1 -1
- package/dist/core/db/schema.js +179 -182
- package/dist/core/db/schema.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +14 -42
- package/dist/core/index.js.map +1 -1
- package/dist/core/server/index.js +16 -68
- package/dist/core/server/index.js.map +1 -1
- package/dist/core/types.js +1 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/utils.js +26 -51
- package/dist/core/utils.js.map +1 -1
- package/dist/emails/config.js +13 -21
- package/dist/emails/config.js.map +1 -1
- package/dist/emails/index.js +10 -72
- package/dist/emails/index.js.map +1 -1
- package/dist/emails/send/auth.js +26 -34
- package/dist/emails/send/auth.js.map +1 -1
- package/dist/emails/send/index.js +2 -21
- package/dist/emails/send/index.js.map +1 -1
- package/dist/emails/send/orders.js +38 -50
- package/dist/emails/send/orders.js.map +1 -1
- package/dist/emails/sender.js +7 -12
- package/dist/emails/sender.js.map +1 -1
- package/dist/emails/templates/base.js +37 -53
- package/dist/emails/templates/base.js.map +1 -1
- package/dist/emails/templates/email-verification.js +12 -16
- package/dist/emails/templates/email-verification.js.map +1 -1
- package/dist/emails/templates/index.js +9 -43
- package/dist/emails/templates/index.js.map +1 -1
- package/dist/emails/templates/order-cancelled.js +18 -22
- package/dist/emails/templates/order-cancelled.js.map +1 -1
- package/dist/emails/templates/order-confirmation.js +30 -34
- package/dist/emails/templates/order-confirmation.js.map +1 -1
- package/dist/emails/templates/order-delivered.js +20 -24
- package/dist/emails/templates/order-delivered.js.map +1 -1
- package/dist/emails/templates/order-shipped.js +19 -23
- package/dist/emails/templates/order-shipped.js.map +1 -1
- package/dist/emails/templates/password-reset.js +12 -16
- package/dist/emails/templates/password-reset.js.map +1 -1
- package/dist/emails/templates/refund-processed.js +17 -21
- package/dist/emails/templates/refund-processed.js.map +1 -1
- package/dist/emails/templates/welcome.js +11 -15
- package/dist/emails/templates/welcome.js.map +1 -1
- package/dist/emails/types.js +1 -2
- package/dist/emails/types.js.map +1 -1
- package/dist/emails/utils.js +9 -20
- package/dist/emails/utils.js.map +1 -1
- package/dist/index.js +24 -176
- package/dist/index.js.map +1 -1
- package/dist/products/api/categories.js +7 -10
- package/dist/products/api/categories.js.map +1 -1
- package/dist/products/api/index.js +3 -9
- package/dist/products/api/index.js.map +1 -1
- package/dist/products/api/product.js +10 -13
- package/dist/products/api/product.js.map +1 -1
- package/dist/products/api/products.js +8 -11
- package/dist/products/api/products.js.map +1 -1
- package/dist/products/components/CategoryNav.js +20 -26
- package/dist/products/components/CategoryNav.js.map +1 -1
- package/dist/products/components/ProductBreadcrumb.js +7 -13
- package/dist/products/components/ProductBreadcrumb.js.map +1 -1
- package/dist/products/components/ProductCard.js +6 -12
- package/dist/products/components/ProductCard.js.map +1 -1
- package/dist/products/components/ProductDetails.js +14 -17
- package/dist/products/components/ProductDetails.js.map +1 -1
- package/dist/products/components/ProductFilters.js +15 -18
- package/dist/products/components/ProductFilters.js.map +1 -1
- package/dist/products/components/ProductGallery.js +17 -23
- package/dist/products/components/ProductGallery.js.map +1 -1
- package/dist/products/components/ProductGrid.js +10 -13
- package/dist/products/components/ProductGrid.js.map +1 -1
- package/dist/products/components/ProductSearch.js +14 -17
- package/dist/products/components/ProductSearch.js.map +1 -1
- package/dist/products/components/ProductSort.js +8 -11
- package/dist/products/components/ProductSort.js.map +1 -1
- package/dist/products/components/VariantSelector.js +16 -19
- package/dist/products/components/VariantSelector.js.map +1 -1
- package/dist/products/components/index.js +10 -23
- package/dist/products/components/index.js.map +1 -1
- package/dist/products/hooks/index.js +4 -11
- package/dist/products/hooks/index.js.map +1 -1
- package/dist/products/hooks/useCategories.js +12 -15
- package/dist/products/hooks/useCategories.js.map +1 -1
- package/dist/products/hooks/useProduct.js +9 -12
- package/dist/products/hooks/useProduct.js.map +1 -1
- package/dist/products/hooks/useProductAttributes.js +10 -13
- package/dist/products/hooks/useProductAttributes.js.map +1 -1
- package/dist/products/hooks/useProducts.js +15 -18
- package/dist/products/hooks/useProducts.js.map +1 -1
- package/dist/products/index.js +6 -23
- package/dist/products/index.js.map +1 -1
- package/dist/theme/ThemeProvider.js +12 -14
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/colors.js +3 -8
- package/dist/theme/colors.js.map +1 -1
- package/dist/theme/defaults.js +27 -30
- package/dist/theme/defaults.js.map +1 -1
- package/dist/theme/fonts.js +12 -18
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/generator.js +63 -69
- package/dist/theme/generator.js.map +1 -1
- package/dist/theme/hooks.js +11 -16
- package/dist/theme/hooks.js.map +1 -1
- package/dist/theme/index.js +6 -42
- package/dist/theme/index.js.map +1 -1
- package/package.json +35 -30
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @rovela/sdk/checkout/stripe
|
|
4
3
|
*
|
|
5
4
|
* Stripe client and configuration exports
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
exports.getPublishableKey = exports.getAllowedShippingCountries = exports.getStoreCurrency = exports.getAllWebhookSecrets = exports.getConnectWebhookSecret = exports.getWebhookSecret = exports.calculateApplicationFee = exports.getPlatformFeePercent = exports.hasConnectedAccount = exports.getConnectedAccountId = exports.getStripe = void 0;
|
|
9
|
-
var client_1 = require("./client");
|
|
10
|
-
Object.defineProperty(exports, "getStripe", { enumerable: true, get: function () { return client_1.getStripe; } });
|
|
11
|
-
Object.defineProperty(exports, "getConnectedAccountId", { enumerable: true, get: function () { return client_1.getConnectedAccountId; } });
|
|
12
|
-
Object.defineProperty(exports, "hasConnectedAccount", { enumerable: true, get: function () { return client_1.hasConnectedAccount; } });
|
|
13
|
-
Object.defineProperty(exports, "getPlatformFeePercent", { enumerable: true, get: function () { return client_1.getPlatformFeePercent; } });
|
|
14
|
-
Object.defineProperty(exports, "calculateApplicationFee", { enumerable: true, get: function () { return client_1.calculateApplicationFee; } });
|
|
15
|
-
Object.defineProperty(exports, "getWebhookSecret", { enumerable: true, get: function () { return client_1.getWebhookSecret; } });
|
|
16
|
-
Object.defineProperty(exports, "getConnectWebhookSecret", { enumerable: true, get: function () { return client_1.getConnectWebhookSecret; } });
|
|
17
|
-
Object.defineProperty(exports, "getAllWebhookSecrets", { enumerable: true, get: function () { return client_1.getAllWebhookSecrets; } });
|
|
18
|
-
Object.defineProperty(exports, "getStoreCurrency", { enumerable: true, get: function () { return client_1.getStoreCurrency; } });
|
|
19
|
-
Object.defineProperty(exports, "getAllowedShippingCountries", { enumerable: true, get: function () { return client_1.getAllowedShippingCountries; } });
|
|
20
|
-
Object.defineProperty(exports, "getPublishableKey", { enumerable: true, get: function () { return client_1.getPublishableKey; } });
|
|
6
|
+
export { getStripe, getConnectedAccountId, hasConnectedAccount, getPlatformFeePercent, calculateApplicationFee, getWebhookSecret, getConnectWebhookSecret, getAllWebhookSecrets, getStoreCurrency, getAllowedShippingCountries, getPublishableKey, } from './client';
|
|
21
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkout/stripe/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkout/stripe/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,UAAU,CAAA"}
|
package/dist/checkout/types.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @rovela/sdk/checkout/types
|
|
4
3
|
*
|
|
5
4
|
* Type definitions for the checkout module.
|
|
6
5
|
* Stripe Connect with Direct Charges and platform fees.
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
export {};
|
|
9
8
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/checkout/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/checkout/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/core/StoreSettingsProvider
|
|
3
|
+
*
|
|
4
|
+
* React context provider for dynamic store settings.
|
|
5
|
+
* Fetches settings from the database and provides them to all components.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // app/layout.tsx
|
|
10
|
+
* import { StoreSettingsProvider } from '@rovela-ai/sdk/core'
|
|
11
|
+
*
|
|
12
|
+
* export default function RootLayout({ children }) {
|
|
13
|
+
* return (
|
|
14
|
+
* <html>
|
|
15
|
+
* <body>
|
|
16
|
+
* <StoreSettingsProvider>
|
|
17
|
+
* {children}
|
|
18
|
+
* </StoreSettingsProvider>
|
|
19
|
+
* </body>
|
|
20
|
+
* </html>
|
|
21
|
+
* )
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* // In any component
|
|
25
|
+
* import { useStoreSettings } from '@rovela-ai/sdk/core'
|
|
26
|
+
*
|
|
27
|
+
* function MyComponent() {
|
|
28
|
+
* const { storeName, currency, formatPrice, isLoading } = useStoreSettings()
|
|
29
|
+
* return <h1>{storeName}</h1>
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { type ReactNode } from 'react';
|
|
34
|
+
export interface StoreSettings {
|
|
35
|
+
storeName: string;
|
|
36
|
+
storeEmail: string;
|
|
37
|
+
storeCurrency: string;
|
|
38
|
+
storeTimezone: string;
|
|
39
|
+
taxEnabled: boolean;
|
|
40
|
+
taxRate: number;
|
|
41
|
+
shippingEnabled: boolean;
|
|
42
|
+
freeShippingThreshold: number;
|
|
43
|
+
}
|
|
44
|
+
export interface StoreSettingsContextValue {
|
|
45
|
+
/** Store display name */
|
|
46
|
+
storeName: string;
|
|
47
|
+
/** Store currency code (USD, EUR, etc.) */
|
|
48
|
+
currency: string;
|
|
49
|
+
/** Store locale for formatting */
|
|
50
|
+
locale: string;
|
|
51
|
+
/** Support email */
|
|
52
|
+
supportEmail: string;
|
|
53
|
+
/** Whether settings are still loading */
|
|
54
|
+
isLoading: boolean;
|
|
55
|
+
/** Error message if fetch failed */
|
|
56
|
+
error: string | null;
|
|
57
|
+
/** Full settings object */
|
|
58
|
+
settings: StoreSettings | null;
|
|
59
|
+
/** Format a price with the store's currency */
|
|
60
|
+
formatPrice: (price: number | string) => string;
|
|
61
|
+
/** Format a date with the store's timezone and locale */
|
|
62
|
+
formatDate: (date: Date | string, options?: Intl.DateTimeFormatOptions) => string;
|
|
63
|
+
/** Refetch settings from server */
|
|
64
|
+
refetch: () => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export interface StoreSettingsProviderProps {
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
/** Initial settings for SSR (optional) */
|
|
69
|
+
initialSettings?: Partial<StoreSettings>;
|
|
70
|
+
/** Fallback values when settings not available */
|
|
71
|
+
fallback?: {
|
|
72
|
+
storeName?: string;
|
|
73
|
+
currency?: string;
|
|
74
|
+
locale?: string;
|
|
75
|
+
supportEmail?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare function StoreSettingsProvider({ children, initialSettings, fallback, }: StoreSettingsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* Hook to access store settings from context.
|
|
81
|
+
*
|
|
82
|
+
* @throws Error if used outside of StoreSettingsProvider
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* function PriceDisplay({ price }: { price: number }) {
|
|
87
|
+
* const { formatPrice } = useStoreSettings()
|
|
88
|
+
* return <span>{formatPrice(price)}</span>
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* function Header() {
|
|
92
|
+
* const { storeName, isLoading } = useStoreSettings()
|
|
93
|
+
* if (isLoading) return <Skeleton />
|
|
94
|
+
* return <h1>{storeName}</h1>
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function useStoreSettings(): StoreSettingsContextValue;
|
|
99
|
+
/**
|
|
100
|
+
* Optional hook that returns null instead of throwing if used outside provider.
|
|
101
|
+
* Useful for components that can work with or without settings.
|
|
102
|
+
*/
|
|
103
|
+
export declare function useStoreSettingsOptional(): StoreSettingsContextValue | null;
|
|
104
|
+
//# sourceMappingURL=StoreSettingsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreSettingsProvider.d.ts","sourceRoot":"","sources":["../../src/core/StoreSettingsProvider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;IACxB,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAA;IAClB,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,2BAA2B;IAC3B,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,+CAA+C;IAC/C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IAC/C,yDAAyD;IACzD,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,KAAK,MAAM,CAAA;IACjF,mCAAmC;IACnC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAA;IACnB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IACxC,kDAAkD;IAClD,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;CACF;AAuCD,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,eAAe,EACf,QAAQ,GACT,EAAE,0BAA0B,2CAwH5B;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAW5D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,yBAAyB,GAAG,IAAI,CAE3E"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @rovela/sdk/core/StoreSettingsProvider
|
|
5
|
+
*
|
|
6
|
+
* React context provider for dynamic store settings.
|
|
7
|
+
* Fetches settings from the database and provides them to all components.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // app/layout.tsx
|
|
12
|
+
* import { StoreSettingsProvider } from '@rovela-ai/sdk/core'
|
|
13
|
+
*
|
|
14
|
+
* export default function RootLayout({ children }) {
|
|
15
|
+
* return (
|
|
16
|
+
* <html>
|
|
17
|
+
* <body>
|
|
18
|
+
* <StoreSettingsProvider>
|
|
19
|
+
* {children}
|
|
20
|
+
* </StoreSettingsProvider>
|
|
21
|
+
* </body>
|
|
22
|
+
* </html>
|
|
23
|
+
* )
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // In any component
|
|
27
|
+
* import { useStoreSettings } from '@rovela-ai/sdk/core'
|
|
28
|
+
*
|
|
29
|
+
* function MyComponent() {
|
|
30
|
+
* const { storeName, currency, formatPrice, isLoading } = useStoreSettings()
|
|
31
|
+
* return <h1>{storeName}</h1>
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import { createContext, useContext, useState, useEffect, useCallback, useMemo, } from 'react';
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// Defaults
|
|
38
|
+
// =============================================================================
|
|
39
|
+
const DEFAULT_SETTINGS = {
|
|
40
|
+
storeName: 'Store',
|
|
41
|
+
storeEmail: '',
|
|
42
|
+
storeCurrency: 'USD',
|
|
43
|
+
storeTimezone: 'America/New_York',
|
|
44
|
+
taxEnabled: false,
|
|
45
|
+
taxRate: 0,
|
|
46
|
+
shippingEnabled: true,
|
|
47
|
+
freeShippingThreshold: 0,
|
|
48
|
+
};
|
|
49
|
+
const DEFAULT_LOCALE = 'en-US';
|
|
50
|
+
// Currency to locale mapping for proper formatting
|
|
51
|
+
const CURRENCY_LOCALES = {
|
|
52
|
+
USD: 'en-US',
|
|
53
|
+
EUR: 'de-DE',
|
|
54
|
+
GBP: 'en-GB',
|
|
55
|
+
CAD: 'en-CA',
|
|
56
|
+
AUD: 'en-AU',
|
|
57
|
+
JPY: 'ja-JP',
|
|
58
|
+
};
|
|
59
|
+
// =============================================================================
|
|
60
|
+
// Context
|
|
61
|
+
// =============================================================================
|
|
62
|
+
const StoreSettingsContext = createContext(null);
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// Provider Component
|
|
65
|
+
// =============================================================================
|
|
66
|
+
export function StoreSettingsProvider({ children, initialSettings, fallback, }) {
|
|
67
|
+
const [settings, setSettings] = useState(initialSettings ? { ...DEFAULT_SETTINGS, ...initialSettings } : null);
|
|
68
|
+
const [isLoading, setIsLoading] = useState(!initialSettings);
|
|
69
|
+
const [error, setError] = useState(null);
|
|
70
|
+
// Fetch settings from API
|
|
71
|
+
const fetchSettings = useCallback(async () => {
|
|
72
|
+
try {
|
|
73
|
+
setIsLoading(true);
|
|
74
|
+
setError(null);
|
|
75
|
+
const response = await fetch('/api/store/settings');
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw new Error('Failed to fetch store settings');
|
|
78
|
+
}
|
|
79
|
+
const data = await response.json();
|
|
80
|
+
setSettings({
|
|
81
|
+
storeName: data.settings?.storeName || DEFAULT_SETTINGS.storeName,
|
|
82
|
+
storeEmail: data.settings?.storeEmail || DEFAULT_SETTINGS.storeEmail,
|
|
83
|
+
storeCurrency: data.settings?.storeCurrency || DEFAULT_SETTINGS.storeCurrency,
|
|
84
|
+
storeTimezone: data.settings?.storeTimezone || DEFAULT_SETTINGS.storeTimezone,
|
|
85
|
+
taxEnabled: data.settings?.taxEnabled ?? DEFAULT_SETTINGS.taxEnabled,
|
|
86
|
+
taxRate: data.settings?.taxRate ?? DEFAULT_SETTINGS.taxRate,
|
|
87
|
+
shippingEnabled: data.settings?.shippingEnabled ?? DEFAULT_SETTINGS.shippingEnabled,
|
|
88
|
+
freeShippingThreshold: data.settings?.freeShippingThreshold ?? DEFAULT_SETTINGS.freeShippingThreshold,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.error('[StoreSettingsProvider] Failed to fetch settings:', err);
|
|
93
|
+
setError(err instanceof Error ? err.message : 'Failed to load settings');
|
|
94
|
+
// Use fallback or defaults on error
|
|
95
|
+
setSettings({
|
|
96
|
+
...DEFAULT_SETTINGS,
|
|
97
|
+
storeName: fallback?.storeName || DEFAULT_SETTINGS.storeName,
|
|
98
|
+
storeCurrency: fallback?.currency || DEFAULT_SETTINGS.storeCurrency,
|
|
99
|
+
storeEmail: fallback?.supportEmail || DEFAULT_SETTINGS.storeEmail,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
setIsLoading(false);
|
|
104
|
+
}
|
|
105
|
+
}, [fallback]);
|
|
106
|
+
// Fetch on mount
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (!initialSettings) {
|
|
109
|
+
fetchSettings();
|
|
110
|
+
}
|
|
111
|
+
}, [fetchSettings, initialSettings]);
|
|
112
|
+
// Memoized formatPrice function
|
|
113
|
+
const formatPrice = useCallback((price) => {
|
|
114
|
+
const currency = settings?.storeCurrency || fallback?.currency || 'USD';
|
|
115
|
+
const locale = CURRENCY_LOCALES[currency] || fallback?.locale || DEFAULT_LOCALE;
|
|
116
|
+
// Convert to number
|
|
117
|
+
let numPrice = typeof price === 'string' ? parseFloat(price) : price;
|
|
118
|
+
// Assume cents if price is a large integer (> 100 and whole number)
|
|
119
|
+
if (Number.isInteger(numPrice) && numPrice > 100) {
|
|
120
|
+
numPrice = numPrice / 100;
|
|
121
|
+
}
|
|
122
|
+
return new Intl.NumberFormat(locale, {
|
|
123
|
+
style: 'currency',
|
|
124
|
+
currency,
|
|
125
|
+
minimumFractionDigits: 2,
|
|
126
|
+
maximumFractionDigits: 2,
|
|
127
|
+
}).format(numPrice);
|
|
128
|
+
}, [settings?.storeCurrency, fallback?.currency, fallback?.locale]);
|
|
129
|
+
// Memoized formatDate function with timezone support
|
|
130
|
+
const formatDate = useCallback((date, options = {
|
|
131
|
+
year: 'numeric',
|
|
132
|
+
month: 'short',
|
|
133
|
+
day: 'numeric',
|
|
134
|
+
}) => {
|
|
135
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
136
|
+
const timezone = settings?.storeTimezone || DEFAULT_SETTINGS.storeTimezone;
|
|
137
|
+
const locale = CURRENCY_LOCALES[settings?.storeCurrency || ''] || fallback?.locale || DEFAULT_LOCALE;
|
|
138
|
+
return new Intl.DateTimeFormat(locale, {
|
|
139
|
+
...options,
|
|
140
|
+
timeZone: timezone,
|
|
141
|
+
}).format(d);
|
|
142
|
+
}, [settings?.storeTimezone, settings?.storeCurrency, fallback?.locale]);
|
|
143
|
+
// Memoized context value
|
|
144
|
+
const value = useMemo(() => ({
|
|
145
|
+
storeName: settings?.storeName || fallback?.storeName || DEFAULT_SETTINGS.storeName,
|
|
146
|
+
currency: settings?.storeCurrency || fallback?.currency || DEFAULT_SETTINGS.storeCurrency,
|
|
147
|
+
locale: CURRENCY_LOCALES[settings?.storeCurrency || ''] || fallback?.locale || DEFAULT_LOCALE,
|
|
148
|
+
supportEmail: settings?.storeEmail || fallback?.supportEmail || '',
|
|
149
|
+
isLoading,
|
|
150
|
+
error,
|
|
151
|
+
settings,
|
|
152
|
+
formatPrice,
|
|
153
|
+
formatDate,
|
|
154
|
+
refetch: fetchSettings,
|
|
155
|
+
}), [settings, fallback, isLoading, error, formatPrice, formatDate, fetchSettings]);
|
|
156
|
+
return (_jsx(StoreSettingsContext.Provider, { value: value, children: children }));
|
|
157
|
+
}
|
|
158
|
+
// =============================================================================
|
|
159
|
+
// Hook
|
|
160
|
+
// =============================================================================
|
|
161
|
+
/**
|
|
162
|
+
* Hook to access store settings from context.
|
|
163
|
+
*
|
|
164
|
+
* @throws Error if used outside of StoreSettingsProvider
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* function PriceDisplay({ price }: { price: number }) {
|
|
169
|
+
* const { formatPrice } = useStoreSettings()
|
|
170
|
+
* return <span>{formatPrice(price)}</span>
|
|
171
|
+
* }
|
|
172
|
+
*
|
|
173
|
+
* function Header() {
|
|
174
|
+
* const { storeName, isLoading } = useStoreSettings()
|
|
175
|
+
* if (isLoading) return <Skeleton />
|
|
176
|
+
* return <h1>{storeName}</h1>
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export function useStoreSettings() {
|
|
181
|
+
const context = useContext(StoreSettingsContext);
|
|
182
|
+
if (!context) {
|
|
183
|
+
throw new Error('useStoreSettings must be used within a StoreSettingsProvider. ' +
|
|
184
|
+
'Make sure to wrap your app with <StoreSettingsProvider> in layout.tsx');
|
|
185
|
+
}
|
|
186
|
+
return context;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Optional hook that returns null instead of throwing if used outside provider.
|
|
190
|
+
* Useful for components that can work with or without settings.
|
|
191
|
+
*/
|
|
192
|
+
export function useStoreSettingsOptional() {
|
|
193
|
+
return useContext(StoreSettingsContext);
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=StoreSettingsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreSettingsProvider.js","sourceRoot":"","sources":["../../src/core/StoreSettingsProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,GAER,MAAM,OAAO,CAAA;AAqDd,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,MAAM,gBAAgB,GAAkB;IACtC,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,EAAE;IACd,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,kBAAkB;IACjC,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,IAAI;IACrB,qBAAqB,EAAE,CAAC;CACzB,CAAA;AAED,MAAM,cAAc,GAAG,OAAO,CAAA;AAE9B,mDAAmD;AACnD,MAAM,gBAAgB,GAA2B;IAC/C,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACb,CAAA;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,oBAAoB,GAAG,aAAa,CAAmC,IAAI,CAAC,CAAA;AAElF,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,MAAM,UAAU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IACtC,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/core/api/settings
|
|
3
|
+
*
|
|
4
|
+
* Public (read-only) settings API endpoint.
|
|
5
|
+
* Returns basic store settings needed for the storefront.
|
|
6
|
+
*
|
|
7
|
+
* Unlike admin settings, this endpoint is PUBLIC and does not require authentication.
|
|
8
|
+
* It returns a subset of settings that are safe to expose to the client.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // app/api/store/settings/route.ts
|
|
13
|
+
* import { getPublicSettings } from '@rovela-ai/sdk/core/api'
|
|
14
|
+
* export { getPublicSettings as GET }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { NextResponse } from 'next/server';
|
|
18
|
+
interface PublicSettingsResponse {
|
|
19
|
+
settings: {
|
|
20
|
+
storeName: string | null;
|
|
21
|
+
storeEmail: string | null;
|
|
22
|
+
storeCurrency: string | null;
|
|
23
|
+
storeTimezone: string | null;
|
|
24
|
+
taxEnabled: boolean | null;
|
|
25
|
+
taxRate: number | null;
|
|
26
|
+
shippingEnabled: boolean | null;
|
|
27
|
+
freeShippingThreshold: number | null;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
interface ErrorResponse {
|
|
31
|
+
error: string;
|
|
32
|
+
code: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* GET /api/store/settings
|
|
36
|
+
*
|
|
37
|
+
* Returns public store settings (no authentication required).
|
|
38
|
+
* Used by StoreSettingsProvider to get dynamic store configuration.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getPublicSettings(): Promise<NextResponse<PublicSettingsResponse | ErrorResponse>>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/core/api/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,UAAU,sBAAsB;IAC9B,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;QACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;QACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,UAAU,EAAE,OAAO,GAAG,IAAI,CAAA;QAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;QACtB,eAAe,EAAE,OAAO,GAAG,IAAI,CAAA;QAC/B,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;KACrC,CAAA;CACF;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAqBD;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,sBAAsB,GAAG,aAAa,CAAC,CAAC,CAkCvG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/core/api/settings
|
|
3
|
+
*
|
|
4
|
+
* Public (read-only) settings API endpoint.
|
|
5
|
+
* Returns basic store settings needed for the storefront.
|
|
6
|
+
*
|
|
7
|
+
* Unlike admin settings, this endpoint is PUBLIC and does not require authentication.
|
|
8
|
+
* It returns a subset of settings that are safe to expose to the client.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // app/api/store/settings/route.ts
|
|
13
|
+
* import { getPublicSettings } from '@rovela-ai/sdk/core/api'
|
|
14
|
+
* export { getPublicSettings as GET }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { NextResponse } from 'next/server';
|
|
18
|
+
import { findSettings } from '../db/queries';
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// Default Settings
|
|
21
|
+
// =============================================================================
|
|
22
|
+
const DEFAULT_SETTINGS = {
|
|
23
|
+
storeName: process.env.STORE_NAME || 'Store',
|
|
24
|
+
storeEmail: process.env.SUPPORT_EMAIL || process.env.RESEND_FROM_EMAIL || '',
|
|
25
|
+
storeCurrency: process.env.STORE_CURRENCY || 'USD',
|
|
26
|
+
storeTimezone: process.env.STORE_TIMEZONE || 'America/New_York',
|
|
27
|
+
taxEnabled: false,
|
|
28
|
+
taxRate: 0,
|
|
29
|
+
shippingEnabled: true,
|
|
30
|
+
freeShippingThreshold: 0,
|
|
31
|
+
};
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Handler
|
|
34
|
+
// =============================================================================
|
|
35
|
+
/**
|
|
36
|
+
* GET /api/store/settings
|
|
37
|
+
*
|
|
38
|
+
* Returns public store settings (no authentication required).
|
|
39
|
+
* Used by StoreSettingsProvider to get dynamic store configuration.
|
|
40
|
+
*/
|
|
41
|
+
export async function getPublicSettings() {
|
|
42
|
+
try {
|
|
43
|
+
// Try to find existing settings in database
|
|
44
|
+
const settings = await findSettings();
|
|
45
|
+
// If no settings in database, return defaults
|
|
46
|
+
if (!settings) {
|
|
47
|
+
return NextResponse.json({
|
|
48
|
+
settings: DEFAULT_SETTINGS,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Return settings from database
|
|
52
|
+
return NextResponse.json({
|
|
53
|
+
settings: {
|
|
54
|
+
storeName: settings.storeName ?? DEFAULT_SETTINGS.storeName,
|
|
55
|
+
storeEmail: settings.storeEmail ?? DEFAULT_SETTINGS.storeEmail,
|
|
56
|
+
storeCurrency: settings.storeCurrency ?? DEFAULT_SETTINGS.storeCurrency,
|
|
57
|
+
storeTimezone: settings.storeTimezone ?? DEFAULT_SETTINGS.storeTimezone,
|
|
58
|
+
taxEnabled: settings.taxEnabled ?? DEFAULT_SETTINGS.taxEnabled,
|
|
59
|
+
taxRate: settings.taxRate ?? DEFAULT_SETTINGS.taxRate,
|
|
60
|
+
shippingEnabled: settings.shippingEnabled ?? DEFAULT_SETTINGS.shippingEnabled,
|
|
61
|
+
freeShippingThreshold: settings.freeShippingThreshold ?? DEFAULT_SETTINGS.freeShippingThreshold,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
console.error('[Public Settings API] GET error:', error);
|
|
67
|
+
// On error, return defaults instead of failing
|
|
68
|
+
// This ensures the storefront works even if DB is temporarily unavailable
|
|
69
|
+
return NextResponse.json({
|
|
70
|
+
settings: DEFAULT_SETTINGS,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/core/api/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAwB5C,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,MAAM,gBAAgB,GAAG;IACvB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO;IAC5C,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAA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,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAA;QAExD,+CAA+C;QAC/C,0EAA0E;QAC1E,OAAO,YAAY,CAAC,IAAI,CAAC;YACvB,QAAQ,EAAE,gBAAgB;SAC3B,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
package/dist/core/config.js
CHANGED
|
@@ -1,56 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @rovela/sdk/core/config
|
|
4
3
|
*
|
|
5
4
|
* Configuration system for reading blueprint.json at runtime.
|
|
6
5
|
* The blueprint is generated by Rovela and placed at .rovela/blueprint.json
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.loadBlueprint = loadBlueprint;
|
|
43
|
-
exports.getBlueprint = getBlueprint;
|
|
44
|
-
exports.getStoreConfig = getStoreConfig;
|
|
45
|
-
exports.clearConfigCache = clearConfigCache;
|
|
46
|
-
exports.blueprintExists = blueprintExists;
|
|
47
|
-
exports.getTheme = getTheme;
|
|
48
|
-
exports.getBrand = getBrand;
|
|
49
|
-
exports.getHomepage = getHomepage;
|
|
50
|
-
exports.getModules = getModules;
|
|
51
|
-
exports.getSEO = getSEO;
|
|
52
|
-
const fs = __importStar(require("fs"));
|
|
53
|
-
const path = __importStar(require("path"));
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
54
9
|
// =============================================================================
|
|
55
10
|
// Configuration Loading
|
|
56
11
|
// =============================================================================
|
|
@@ -70,7 +25,7 @@ function getBlueprintPath() {
|
|
|
70
25
|
* Load and parse the blueprint.json file
|
|
71
26
|
* @throws Error if blueprint file is not found or invalid
|
|
72
27
|
*/
|
|
73
|
-
function loadBlueprint() {
|
|
28
|
+
export function loadBlueprint() {
|
|
74
29
|
if (cachedBlueprint) {
|
|
75
30
|
return cachedBlueprint;
|
|
76
31
|
}
|
|
@@ -92,14 +47,14 @@ function loadBlueprint() {
|
|
|
92
47
|
* Get the full blueprint object
|
|
93
48
|
* Use this when you need access to all blueprint data (theme, brand, homepage, etc.)
|
|
94
49
|
*/
|
|
95
|
-
function getBlueprint() {
|
|
50
|
+
export function getBlueprint() {
|
|
96
51
|
return loadBlueprint();
|
|
97
52
|
}
|
|
98
53
|
/**
|
|
99
54
|
* Get simplified store configuration
|
|
100
55
|
* Use this for basic store info (name, currency, locale)
|
|
101
56
|
*/
|
|
102
|
-
function getStoreConfig() {
|
|
57
|
+
export function getStoreConfig() {
|
|
103
58
|
if (cachedConfig) {
|
|
104
59
|
return cachedConfig;
|
|
105
60
|
}
|
|
@@ -116,14 +71,14 @@ function getStoreConfig() {
|
|
|
116
71
|
/**
|
|
117
72
|
* Clear cached blueprint and config (useful for testing or hot reloading)
|
|
118
73
|
*/
|
|
119
|
-
function clearConfigCache() {
|
|
74
|
+
export function clearConfigCache() {
|
|
120
75
|
cachedBlueprint = null;
|
|
121
76
|
cachedConfig = null;
|
|
122
77
|
}
|
|
123
78
|
/**
|
|
124
79
|
* Check if blueprint exists at the expected path
|
|
125
80
|
*/
|
|
126
|
-
function blueprintExists() {
|
|
81
|
+
export function blueprintExists() {
|
|
127
82
|
return fs.existsSync(getBlueprintPath());
|
|
128
83
|
}
|
|
129
84
|
// =============================================================================
|
|
@@ -132,31 +87,31 @@ function blueprintExists() {
|
|
|
132
87
|
/**
|
|
133
88
|
* Get theme configuration from blueprint
|
|
134
89
|
*/
|
|
135
|
-
function getTheme() {
|
|
90
|
+
export function getTheme() {
|
|
136
91
|
return loadBlueprint().theme;
|
|
137
92
|
}
|
|
138
93
|
/**
|
|
139
94
|
* Get brand configuration from blueprint
|
|
140
95
|
*/
|
|
141
|
-
function getBrand() {
|
|
96
|
+
export function getBrand() {
|
|
142
97
|
return loadBlueprint().brand;
|
|
143
98
|
}
|
|
144
99
|
/**
|
|
145
100
|
* Get homepage configuration from blueprint
|
|
146
101
|
*/
|
|
147
|
-
function getHomepage() {
|
|
102
|
+
export function getHomepage() {
|
|
148
103
|
return loadBlueprint().homepage;
|
|
149
104
|
}
|
|
150
105
|
/**
|
|
151
106
|
* Get module configuration from blueprint
|
|
152
107
|
*/
|
|
153
|
-
function getModules() {
|
|
108
|
+
export function getModules() {
|
|
154
109
|
return loadBlueprint().modules;
|
|
155
110
|
}
|
|
156
111
|
/**
|
|
157
112
|
* Get SEO configuration from blueprint
|
|
158
113
|
*/
|
|
159
|
-
function getSEO() {
|
|
114
|
+
export function getSEO() {
|
|
160
115
|
return loadBlueprint().seo;
|
|
161
116
|
}
|
|
162
117
|
//# sourceMappingURL=config.js.map
|