@rovela-ai/sdk 0.1.19 → 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/components/AdminNav.d.ts.map +1 -1
- package/dist/admin/components/AdminNav.js +5 -0
- package/dist/admin/components/AdminNav.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/ProductForm.d.ts +2 -2
- package/dist/admin/components/ProductForm.d.ts.map +1 -1
- package/dist/admin/components/ProductForm.js +125 -9
- package/dist/admin/components/ProductForm.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/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 +11 -0
- package/dist/admin/components/index.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 +1 -0
- package/dist/admin/hooks/index.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/index.d.ts +3 -2
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +5 -1
- package/dist/admin/index.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/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -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,CA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e,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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AAE,CAAC,IAAI,QAAQ,EAAE,MAAM,IAAI,cAAc;QAC7F,YAAY,EAAE,QAAQ,EAAE,UAAU,IAAI,QAAQ,EAAE,YAAY,IAAI,EAAE;QAClE,SAAS;QACT,KAAK;QACL,QAAQ;QACR,WAAW;QACX,UAAU;QACV,OAAO,EAAE,aAAa;KACvB,CAAC,EACF,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAC/E,CAAA;IAED,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACxC,QAAQ,GACqB,CACjC,CAAA;AACH,CAAC;AAED,gFAAgF;AAChF,OAAO;AACP,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAEhD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,gEAAgE;YAChE,uEAAuE,CACxE,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB;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,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;IAC5E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK;IAClD,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,kBAAkB;IAC/D,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,IAAI;IACrB,qBAAqB,EAAE,CAAC;CACzB,CAAA;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,4CAA4C;QAC5C,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;QAErC,8CAA8C;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,YAAY,CAAC,IAAI,CAAC;gBACvB,QAAQ,EAAE,gBAAgB;aAC3B,CAAC,CAAA;QACJ,CAAC;QAED,gCAAgC;QAChC,OAAO,YAAY,CAAC,IAAI,CAAC;YACvB,QAAQ,EAAE;gBACR,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,gBAAgB,CAAC,SAAS;gBAC3D,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,gBAAgB,CAAC,UAAU;gBAC9D,aAAa,EAAE,QAAQ,CAAC,aAAa,IAAI,gBAAgB,CAAC,aAAa;gBACvE,aAAa,EAAE,QAAQ,CAAC,aAAa,IAAI,gBAAgB,CAAC,aAAa;gBACvE,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,gBAAgB,CAAC,UAAU;gBAC9D,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO;gBACrD,eAAe,EAAE,QAAQ,CAAC,eAAe,IAAI,gBAAgB,CAAC,eAAe;gBAC7E,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB,IAAI,gBAAgB,CAAC,qBAAqB;aAChG;SACF,CAAC,CAAA;IACJ,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/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export * from './types';
|
|
18
|
+
export { StoreSettingsProvider, useStoreSettings, useStoreSettingsOptional, } from './StoreSettingsProvider';
|
|
19
|
+
export type { StoreSettings, StoreSettingsContextValue, StoreSettingsProviderProps, } from './StoreSettingsProvider';
|
|
18
20
|
export { cn, formatPrice, parsePrice, generateSlug, generateUniqueSlug, generateSKU, formatDate, formatRelativeTime, truncate, capitalize, titleCase, clamp, formatNumber, percentage, isValidEmail, isValidPhone, isValidPostalCode, deepClone, compact, pick, omit, sleep, retry, } from './utils';
|
|
19
21
|
export type { FormatPriceOptions } from './utils';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,SAAS,CAAA;AAGvB,OAAO,EAEL,EAAE,EAEF,WAAW,EACX,UAAU,EAEV,YAAY,EACZ,kBAAkB,EAElB,WAAW,EAEX,UAAU,EACV,kBAAkB,EAElB,QAAQ,EACR,UAAU,EACV,SAAS,EAET,KAAK,EACL,YAAY,EACZ,UAAU,EAEV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAEjB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EAEJ,KAAK,EACL,KAAK,GACN,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,SAAS,CAAA;AAGvB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EACV,aAAa,EACb,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAEL,EAAE,EAEF,WAAW,EACX,UAAU,EAEV,YAAY,EACZ,kBAAkB,EAElB,WAAW,EAEX,UAAU,EACV,kBAAkB,EAElB,QAAQ,EACR,UAAU,EACV,SAAS,EAET,KAAK,EACL,YAAY,EACZ,UAAU,EAEV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAEjB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EAEJ,KAAK,EACL,KAAK,GACN,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/core/index.js
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
// Types - all shared domain types (browser-safe)
|
|
18
18
|
export * from './types';
|
|
19
|
+
// Store Settings Provider and Hook (browser-safe)
|
|
20
|
+
export { StoreSettingsProvider, useStoreSettings, useStoreSettingsOptional, } from './StoreSettingsProvider';
|
|
19
21
|
// Utilities - browser-safe functions
|
|
20
22
|
export {
|
|
21
23
|
// Class names
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iDAAiD;AACjD,cAAc,SAAS,CAAA;AAEvB,qCAAqC;AACrC,OAAO;AACL,cAAc;AACd,EAAE;AACF,mBAAmB;AACnB,WAAW,EACX,UAAU;AACV,kBAAkB;AAClB,YAAY,EACZ,kBAAkB;AAClB,iBAAiB;AACjB,WAAW;AACX,kBAAkB;AAClB,UAAU,EACV,kBAAkB;AAClB,mBAAmB;AACnB,QAAQ,EACR,UAAU,EACV,SAAS;AACT,mBAAmB;AACnB,KAAK,EACL,YAAY,EACZ,UAAU;AACV,aAAa;AACb,YAAY,EACZ,YAAY,EACZ,iBAAiB;AACjB,mBAAmB;AACnB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI;AACJ,kBAAkB;AAClB,KAAK,EACL,KAAK,GACN,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iDAAiD;AACjD,cAAc,SAAS,CAAA;AAEvB,kDAAkD;AAClD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,yBAAyB,CAAA;AAQhC,qCAAqC;AACrC,OAAO;AACL,cAAc;AACd,EAAE;AACF,mBAAmB;AACnB,WAAW,EACX,UAAU;AACV,kBAAkB;AAClB,YAAY,EACZ,kBAAkB;AAClB,iBAAiB;AACjB,WAAW;AACX,kBAAkB;AAClB,UAAU,EACV,kBAAkB;AAClB,mBAAmB;AACnB,QAAQ,EACR,UAAU,EACV,SAAS;AACT,mBAAmB;AACnB,KAAK,EACL,YAAY,EACZ,UAAU;AACV,aAAa;AACb,YAAY,EACZ,YAAY,EACZ,iBAAiB;AACjB,mBAAmB;AACnB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI;AACJ,kBAAkB;AAClB,KAAK,EACL,KAAK,GACN,MAAM,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rovela-ai/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Rovela SDK - Pre-built e-commerce components for AI-powered store generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/core/server/index.d.ts",
|
|
41
41
|
"import": "./dist/core/server/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./core/api": {
|
|
44
|
+
"types": "./dist/core/api/index.d.ts",
|
|
45
|
+
"import": "./dist/core/api/index.js"
|
|
46
|
+
},
|
|
43
47
|
"./theme": {
|
|
44
48
|
"types": "./dist/theme/index.d.ts",
|
|
45
49
|
"import": "./dist/theme/index.js"
|