@meetelise/studio-components 0.0.3 → 0.0.5
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/components/Accordion.d.ts +16 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +28 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/AddressBlock.d.ts +14 -0
- package/dist/components/AddressBlock.d.ts.map +1 -0
- package/dist/components/AddressBlock.js +13 -0
- package/dist/components/AddressBlock.js.map +1 -0
- package/dist/components/AmenityList.d.ts +20 -0
- package/dist/components/AmenityList.d.ts.map +1 -0
- package/dist/components/AmenityList.js +75 -0
- package/dist/components/AmenityList.js.map +1 -0
- package/dist/components/Badge.d.ts +9 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +16 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +38 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/CTABanner.d.ts +11 -0
- package/dist/components/CTABanner.d.ts.map +1 -0
- package/dist/components/CTABanner.js +17 -0
- package/dist/components/CTABanner.js.map +1 -0
- package/dist/components/ContactForm.d.ts +11 -0
- package/dist/components/ContactForm.d.ts.map +1 -0
- package/dist/components/ContactForm.js +91 -0
- package/dist/components/ContactForm.js.map +1 -0
- package/dist/components/Container.d.ts +9 -3
- package/dist/components/Container.d.ts.map +1 -1
- package/dist/components/Container.js +19 -8
- package/dist/components/Container.js.map +1 -1
- package/dist/components/Divider.d.ts +9 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +15 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/EliseChat.d.ts +8 -0
- package/dist/components/EliseChat.d.ts.map +1 -0
- package/dist/components/EliseChat.js +22 -0
- package/dist/components/EliseChat.js.map +1 -0
- package/dist/components/FeatureCard.d.ts +15 -0
- package/dist/components/FeatureCard.d.ts.map +1 -0
- package/dist/components/FeatureCard.js +13 -0
- package/dist/components/FeatureCard.js.map +1 -0
- package/dist/components/Footer.d.ts +10 -0
- package/dist/components/Footer.d.ts.map +1 -0
- package/dist/components/Footer.js +19 -0
- package/dist/components/Footer.js.map +1 -0
- package/dist/components/Gallery.d.ts +18 -0
- package/dist/components/Gallery.d.ts.map +1 -0
- package/dist/components/Gallery.js +86 -0
- package/dist/components/Gallery.js.map +1 -0
- package/dist/components/Icon.d.ts +8 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/Icon.js +26 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/Lightbox.d.ts +13 -0
- package/dist/components/Lightbox.d.ts.map +1 -0
- package/dist/components/Lightbox.js +23 -0
- package/dist/components/Lightbox.js.map +1 -0
- package/dist/components/MapEmbed.d.ts +16 -0
- package/dist/components/MapEmbed.d.ts.map +1 -0
- package/dist/components/MapEmbed.js +6 -0
- package/dist/components/MapEmbed.js.map +1 -0
- package/dist/components/Modal.d.ts +9 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +19 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/Nav.d.ts +11 -0
- package/dist/components/Nav.d.ts.map +1 -0
- package/dist/components/Nav.js +53 -0
- package/dist/components/Nav.js.map +1 -0
- package/dist/components/ScheduleTour.d.ts +8 -0
- package/dist/components/ScheduleTour.d.ts.map +1 -0
- package/dist/components/ScheduleTour.js +158 -0
- package/dist/components/ScheduleTour.js.map +1 -0
- package/dist/components/ScrollReveal.d.ts +12 -0
- package/dist/components/ScrollReveal.d.ts.map +1 -0
- package/dist/components/ScrollReveal.js +37 -0
- package/dist/components/ScrollReveal.js.map +1 -0
- package/dist/components/Slot.d.ts +14 -0
- package/dist/components/Slot.d.ts.map +1 -0
- package/dist/components/Slot.js +5 -0
- package/dist/components/Slot.js.map +1 -0
- package/dist/components/Stat.d.ts +12 -0
- package/dist/components/Stat.d.ts.map +1 -0
- package/dist/components/Stat.js +12 -0
- package/dist/components/Stat.js.map +1 -0
- package/dist/components/Testimonial.d.ts +10 -0
- package/dist/components/Testimonial.d.ts.map +1 -0
- package/dist/components/Testimonial.js +9 -0
- package/dist/components/Testimonial.js.map +1 -0
- package/dist/components/Text.d.ts +3 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +16 -7
- package/dist/components/Text.js.map +1 -1
- package/dist/components/ThemeProvider.d.ts.map +1 -1
- package/dist/components/ThemeProvider.js +85 -5
- package/dist/components/ThemeProvider.js.map +1 -1
- package/dist/components/VideoHero.d.ts +16 -0
- package/dist/components/VideoHero.d.ts.map +1 -0
- package/dist/components/VideoHero.js +19 -0
- package/dist/components/VideoHero.js.map +1 -0
- package/dist/components/VideoPlayer.d.ts +18 -0
- package/dist/components/VideoPlayer.d.ts.map +1 -0
- package/dist/components/VideoPlayer.js +14 -0
- package/dist/components/VideoPlayer.js.map +1 -0
- package/dist/components/VirtualTourEmbed.d.ts +9 -0
- package/dist/components/VirtualTourEmbed.d.ts.map +1 -0
- package/dist/components/VirtualTourEmbed.js +5 -0
- package/dist/components/VirtualTourEmbed.js.map +1 -0
- package/dist/components/browser/ComponentBrowser.d.ts +2 -0
- package/dist/components/browser/ComponentBrowser.d.ts.map +1 -0
- package/dist/components/browser/ComponentBrowser.js +73 -0
- package/dist/components/browser/ComponentBrowser.js.map +1 -0
- package/dist/components/browser/ComponentShowcase.d.ts +8 -0
- package/dist/components/browser/ComponentShowcase.d.ts.map +1 -0
- package/dist/components/browser/ComponentShowcase.js +104 -0
- package/dist/components/browser/ComponentShowcase.js.map +1 -0
- package/dist/components/browser/componentMeta.d.ts +40 -0
- package/dist/components/browser/componentMeta.d.ts.map +1 -0
- package/dist/components/browser/componentMeta.js +726 -0
- package/dist/components/browser/componentMeta.js.map +1 -0
- package/dist/components/registry.d.ts.map +1 -1
- package/dist/components/registry.js +56 -0
- package/dist/components/registry.js.map +1 -1
- package/dist/components/units/FloorPlanCard.d.ts +16 -0
- package/dist/components/units/FloorPlanCard.d.ts.map +1 -0
- package/dist/components/units/FloorPlanCard.js +28 -0
- package/dist/components/units/FloorPlanCard.js.map +1 -0
- package/dist/components/units/FloorplanExplorer.d.ts +21 -0
- package/dist/components/units/FloorplanExplorer.d.ts.map +1 -0
- package/dist/components/units/FloorplanExplorer.js +39 -0
- package/dist/components/units/FloorplanExplorer.js.map +1 -0
- package/dist/components/units/PricingMatrixModal.d.ts +12 -0
- package/dist/components/units/PricingMatrixModal.d.ts.map +1 -0
- package/dist/components/units/PricingMatrixModal.js +78 -0
- package/dist/components/units/PricingMatrixModal.js.map +1 -0
- package/dist/components/units/UnitCard.d.ts +12 -3
- package/dist/components/units/UnitCard.d.ts.map +1 -1
- package/dist/components/units/UnitCard.js +33 -5
- package/dist/components/units/UnitCard.js.map +1 -1
- package/dist/components/units/UnitDetail.d.ts +11 -0
- package/dist/components/units/UnitDetail.d.ts.map +1 -0
- package/dist/components/units/UnitDetail.js +16 -0
- package/dist/components/units/UnitDetail.js.map +1 -0
- package/dist/components/units/UnitExplorer.d.ts +17 -1
- package/dist/components/units/UnitExplorer.d.ts.map +1 -1
- package/dist/components/units/UnitExplorer.js +129 -25
- package/dist/components/units/UnitExplorer.js.map +1 -1
- package/dist/components/units/UnitFilters.d.ts +2 -2
- package/dist/components/units/UnitFilters.d.ts.map +1 -1
- package/dist/components/units/UnitFilters.js +2 -2
- package/dist/components/units/UnitFilters.js.map +1 -1
- package/dist/components/units/UnitPage.d.ts +8 -0
- package/dist/components/units/UnitPage.d.ts.map +1 -0
- package/dist/components/units/UnitPage.js +130 -0
- package/dist/components/units/UnitPage.js.map +1 -0
- package/dist/components/units/types.d.ts +109 -24
- package/dist/components/units/types.d.ts.map +1 -1
- package/dist/components/units/types.js +1 -0
- package/dist/components/units/types.js.map +1 -1
- package/dist/hooks/useAnalytics.d.ts +16 -0
- package/dist/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/hooks/useAnalytics.js +65 -0
- package/dist/hooks/useAnalytics.js.map +1 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +8 -2
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useFees.d.ts +8 -0
- package/dist/hooks/useFees.d.ts.map +1 -0
- package/dist/hooks/useFees.js +37 -0
- package/dist/hooks/useFees.js.map +1 -0
- package/dist/hooks/useFloorplans.d.ts +19 -0
- package/dist/hooks/useFloorplans.d.ts.map +1 -0
- package/dist/hooks/useFloorplans.js +52 -0
- package/dist/hooks/useFloorplans.js.map +1 -0
- package/dist/hooks/useModal.d.ts +11 -0
- package/dist/hooks/useModal.d.ts.map +1 -0
- package/dist/hooks/useModal.js +35 -0
- package/dist/hooks/useModal.js.map +1 -0
- package/dist/hooks/useProperty.d.ts +66 -0
- package/dist/hooks/useProperty.d.ts.map +1 -0
- package/dist/hooks/useProperty.js +49 -0
- package/dist/hooks/useProperty.js.map +1 -0
- package/dist/hooks/useSpecials.d.ts +8 -0
- package/dist/hooks/useSpecials.d.ts.map +1 -0
- package/dist/hooks/useSpecials.js +37 -0
- package/dist/hooks/useSpecials.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +46 -3
- package/dist/renderer.js.map +1 -1
- package/dist/router.d.ts +9 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +34 -1
- package/dist/router.js.map +1 -1
- package/dist/types.d.ts +47 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/imageUrl.d.ts +21 -0
- package/dist/utils/imageUrl.d.ts.map +1 -0
- package/dist/utils/imageUrl.js +46 -0
- package/dist/utils/imageUrl.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PublicSpecial } from "../components/units/types";
|
|
2
|
+
export declare function useSpecials(propertyIdOverride?: string): {
|
|
3
|
+
specials: PublicSpecial[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
refetch: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useSpecials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpecials.d.ts","sourceRoot":"","sources":["../../src/hooks/useSpecials.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,2BAA2B,CAAC;AAEjF,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,MAAM;;;;;EAiCtD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from "react";
|
|
2
|
+
import { useSiteConfig } from "./useSiteConfig";
|
|
3
|
+
import { useAuth } from "./useAuth";
|
|
4
|
+
export function useSpecials(propertyIdOverride) {
|
|
5
|
+
const config = useSiteConfig();
|
|
6
|
+
const { authenticatedFetch } = useAuth();
|
|
7
|
+
const propertyId = propertyIdOverride ?? config.property?.propertyId;
|
|
8
|
+
const apiBaseUrl = config.property?.apiBaseUrl ?? "";
|
|
9
|
+
const [specials, setSpecials] = useState([]);
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const fetchSpecials = useCallback(async () => {
|
|
13
|
+
if (!propertyId)
|
|
14
|
+
return;
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
try {
|
|
18
|
+
const res = await authenticatedFetch(`${apiBaseUrl}/v1/properties/${propertyId}/specials`);
|
|
19
|
+
if (!res.ok)
|
|
20
|
+
throw new Error(`${res.status}`);
|
|
21
|
+
const data = await res.json();
|
|
22
|
+
setSpecials(data.items);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
setError(e instanceof Error ? e.message : "Failed to load specials");
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
}, [propertyId, apiBaseUrl, authenticatedFetch]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (propertyId)
|
|
33
|
+
fetchSpecials();
|
|
34
|
+
}, [propertyId, fetchSpecials]);
|
|
35
|
+
return { specials, loading, error, refetch: fetchSpecials };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=useSpecials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpecials.js","sourceRoot":"","sources":["../../src/hooks/useSpecials.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,WAAW,CAAC,kBAA2B;IACrD,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,kBAAkB,IAAI,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;IACrE,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,CAAC;IAErD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAkB,EAAE,CAAC,CAAC;IAC9D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC3C,IAAI,CAAC,UAAU;YAAE,OAAO;QACxB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAClC,GAAG,UAAU,kBAAkB,UAAU,WAAW,CACrD,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9C,MAAM,IAAI,GAAqB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAChD,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,QAAQ,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QACvE,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,UAAU;YAAE,aAAa,EAAE,CAAC;IAClC,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;IAEhC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,14 @@ export { componentRegistry } from "./components/registry";
|
|
|
3
3
|
export { ThemeProvider } from "./components/ThemeProvider";
|
|
4
4
|
export { SiteConfigProvider, useSiteConfig } from "./hooks/useSiteConfig";
|
|
5
5
|
export { AuthProvider, useAuth } from "./hooks/useAuth";
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export type {
|
|
6
|
+
export { ModalProvider, useModal } from "./hooks/useModal";
|
|
7
|
+
export { navigate, useCurrentPath, useRouteParams, matchPath, RouteParamsProvider } from "./router";
|
|
8
|
+
export type { SiteNode, SitePage, SiteLayout, SiteMeta, PageMeta, SiteTheme, SiteProperty, SiteConfig, AnalyticsConfig, NavLink, FooterColumn, } from "./types";
|
|
9
|
+
export type { PublicUnit, PublicFloorplan, PublicFee, PublicSpecial, PublicPriceMatrixEntry, UnitsPageResponse, FloorplansPageResponse, FeesResponse, SpecialsResponse, UnitFilterValues, } from "./components/units/types";
|
|
10
|
+
export { useProperty } from "./hooks/useProperty";
|
|
11
|
+
export { useFloorplans } from "./hooks/useFloorplans";
|
|
12
|
+
export { useFees } from "./hooks/useFees";
|
|
13
|
+
export { useSpecials } from "./hooks/useSpecials";
|
|
14
|
+
export { imageUrl } from "./utils/imageUrl";
|
|
15
|
+
export { useAnalytics } from "./hooks/useAnalytics";
|
|
9
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpG,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,EACf,OAAO,EACP,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,12 @@ export { componentRegistry } from "./components/registry";
|
|
|
3
3
|
export { ThemeProvider } from "./components/ThemeProvider";
|
|
4
4
|
export { SiteConfigProvider, useSiteConfig } from "./hooks/useSiteConfig";
|
|
5
5
|
export { AuthProvider, useAuth } from "./hooks/useAuth";
|
|
6
|
-
export {
|
|
6
|
+
export { ModalProvider, useModal } from "./hooks/useModal";
|
|
7
|
+
export { navigate, useCurrentPath, useRouteParams, matchPath, RouteParamsProvider } from "./router";
|
|
8
|
+
export { useProperty } from "./hooks/useProperty";
|
|
9
|
+
export { useFloorplans } from "./hooks/useFloorplans";
|
|
10
|
+
export { useFees } from "./hooks/useFees";
|
|
11
|
+
export { useSpecials } from "./hooks/useSpecials";
|
|
12
|
+
export { imageUrl } from "./utils/imageUrl";
|
|
13
|
+
export { useAnalytics } from "./hooks/useAnalytics";
|
|
7
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA6BpG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;AAKxE,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,SAAS,CAY1D;AAkDD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,UAAU,CAAA;CAAE,kDAiBlE"}
|
package/dist/renderer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { componentRegistry } from "./components/registry";
|
|
3
|
-
import { useCurrentPath } from "./router";
|
|
4
|
+
import { useCurrentPath, matchPath, RouteParamsProvider } from "./router";
|
|
4
5
|
export function renderNode(node) {
|
|
5
6
|
const Component = componentRegistry[node.type];
|
|
6
7
|
if (!Component) {
|
|
@@ -13,11 +14,53 @@ export function renderNode(node) {
|
|
|
13
14
|
function RenderNode({ node }) {
|
|
14
15
|
return _jsx(_Fragment, { children: renderNode(node) });
|
|
15
16
|
}
|
|
17
|
+
function PageRoot({ tree }) {
|
|
18
|
+
return _jsx(_Fragment, { children: renderNode(tree) });
|
|
19
|
+
}
|
|
20
|
+
function findPage(pages, path) {
|
|
21
|
+
// Try exact match first (most common)
|
|
22
|
+
const exact = pages.find((p) => p.path === path);
|
|
23
|
+
if (exact)
|
|
24
|
+
return { page: exact, params: {} };
|
|
25
|
+
// Try pattern matching for :param segments
|
|
26
|
+
for (const page of pages) {
|
|
27
|
+
if (!page.path.includes(":"))
|
|
28
|
+
continue;
|
|
29
|
+
const params = matchPath(page.path, path);
|
|
30
|
+
if (params)
|
|
31
|
+
return { page, params };
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function usePageMeta(path, page, siteMeta) {
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// Per-page meta from build-time injection or inline page.meta
|
|
38
|
+
const pageMetas = typeof window !== "undefined" ? window.__STUDIO_PAGE_META__ : undefined;
|
|
39
|
+
const meta = page?.meta ?? pageMetas?.[page?.path ?? ""];
|
|
40
|
+
const title = meta?.title ?? siteMeta?.title;
|
|
41
|
+
if (title)
|
|
42
|
+
document.title = title;
|
|
43
|
+
// Update meta description
|
|
44
|
+
const desc = meta?.description ?? siteMeta?.description;
|
|
45
|
+
if (desc) {
|
|
46
|
+
let el = document.querySelector('meta[name="description"]');
|
|
47
|
+
if (!el) {
|
|
48
|
+
el = document.createElement("meta");
|
|
49
|
+
el.setAttribute("name", "description");
|
|
50
|
+
document.head.appendChild(el);
|
|
51
|
+
}
|
|
52
|
+
el.setAttribute("content", desc);
|
|
53
|
+
}
|
|
54
|
+
}, [path, page, siteMeta]);
|
|
55
|
+
}
|
|
16
56
|
export function SiteRenderer({ siteJson }) {
|
|
17
57
|
const path = useCurrentPath();
|
|
18
|
-
const
|
|
58
|
+
const match = findPage(siteJson.pages, path);
|
|
59
|
+
const page = match?.page ?? siteJson.pages[0];
|
|
60
|
+
const params = match?.params ?? {};
|
|
61
|
+
usePageMeta(path, page, siteJson.meta);
|
|
19
62
|
if (!page)
|
|
20
63
|
return null;
|
|
21
|
-
return _jsx(
|
|
64
|
+
return (_jsx(RouteParamsProvider, { value: params, children: _jsx(PageRoot, { tree: page.tree }, path) }));
|
|
22
65
|
}
|
|
23
66
|
//# sourceMappingURL=renderer.js.map
|
package/dist/renderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAM1E,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAChD,KAAC,UAAU,IAAS,IAAI,EAAE,KAAK,IAAd,CAAC,CAAiB,CACpC,CAAC,CAAC;IAEH,OAAO,KAAC,SAAS,OAAK,IAAI,CAAC,KAAK,YAAG,QAAQ,GAAa,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CAA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
package/dist/router.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export declare function navigate(to: string): void;
|
|
2
2
|
export declare function useCurrentPath(): string;
|
|
3
|
+
export declare const RouteParamsProvider: import("react").Provider<Record<string, string>>;
|
|
4
|
+
/** Read route params extracted from the matched page path. */
|
|
5
|
+
export declare function useRouteParams(): Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Match a page path pattern against the current URL path.
|
|
8
|
+
* Patterns use :param for dynamic segments: "/buildings/aventine/units/:unitId"
|
|
9
|
+
* Returns extracted params if matched, null if no match.
|
|
10
|
+
*/
|
|
11
|
+
export declare function matchPath(pattern: string, currentPath: string): Record<string, string> | null;
|
|
3
12
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.tsx"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.tsx"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,QAIlC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAevC;AAQD,eAAO,MAAM,mBAAmB,kDAA8B,CAAC;AAE/D,8DAA8D;AAC9D,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAiB/B"}
|
package/dist/router.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useState, useEffect, useCallback } from "react";
|
|
1
|
+
import { useState, useEffect, useCallback, createContext, useContext } from "react";
|
|
2
2
|
let listeners = [];
|
|
3
3
|
export function navigate(to) {
|
|
4
4
|
window.history.pushState({}, "", to);
|
|
5
|
+
window.scrollTo(0, 0);
|
|
5
6
|
listeners.forEach((fn) => fn());
|
|
6
7
|
}
|
|
7
8
|
export function useCurrentPath() {
|
|
@@ -17,4 +18,36 @@ export function useCurrentPath() {
|
|
|
17
18
|
}, [sync]);
|
|
18
19
|
return path;
|
|
19
20
|
}
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Route params — supports :param segments in page paths
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const RouteParamsContext = createContext({});
|
|
25
|
+
export const RouteParamsProvider = RouteParamsContext.Provider;
|
|
26
|
+
/** Read route params extracted from the matched page path. */
|
|
27
|
+
export function useRouteParams() {
|
|
28
|
+
return useContext(RouteParamsContext);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Match a page path pattern against the current URL path.
|
|
32
|
+
* Patterns use :param for dynamic segments: "/buildings/aventine/units/:unitId"
|
|
33
|
+
* Returns extracted params if matched, null if no match.
|
|
34
|
+
*/
|
|
35
|
+
export function matchPath(pattern, currentPath) {
|
|
36
|
+
const patternParts = pattern.split("/").filter(Boolean);
|
|
37
|
+
const pathParts = currentPath.split("/").filter(Boolean);
|
|
38
|
+
if (patternParts.length !== pathParts.length)
|
|
39
|
+
return null;
|
|
40
|
+
const params = {};
|
|
41
|
+
for (let i = 0; i < patternParts.length; i++) {
|
|
42
|
+
const pat = patternParts[i];
|
|
43
|
+
const val = pathParts[i];
|
|
44
|
+
if (pat.startsWith(":")) {
|
|
45
|
+
params[pat.slice(1)] = decodeURIComponent(val);
|
|
46
|
+
}
|
|
47
|
+
else if (pat !== val) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return params;
|
|
52
|
+
}
|
|
20
53
|
//# sourceMappingURL=router.js.map
|
package/dist/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":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 -1,15 +1,38 @@
|
|
|
1
1
|
export interface SiteNode {
|
|
2
2
|
type: string;
|
|
3
|
-
props: Record<string,
|
|
3
|
+
props: Record<string, any>;
|
|
4
4
|
children?: SiteNode[];
|
|
5
5
|
}
|
|
6
|
+
export interface NavLink {
|
|
7
|
+
label: string;
|
|
8
|
+
to: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FooterColumn {
|
|
11
|
+
title: string;
|
|
12
|
+
links: NavLink[];
|
|
13
|
+
}
|
|
14
|
+
export interface PageMeta {
|
|
15
|
+
title?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
canonical?: string;
|
|
19
|
+
}
|
|
6
20
|
export interface SitePage {
|
|
7
21
|
path: string;
|
|
8
22
|
tree: SiteNode;
|
|
23
|
+
/** Per-page meta overrides for SEO (title, description, og:image) */
|
|
24
|
+
meta?: PageMeta;
|
|
25
|
+
/** Layout name from site.layouts — wraps page tree in shared Nav/Footer/Modals */
|
|
26
|
+
layout?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SiteLayout {
|
|
29
|
+
tree: SiteNode;
|
|
9
30
|
}
|
|
10
31
|
export interface SiteMeta {
|
|
11
32
|
title: string;
|
|
12
33
|
description?: string;
|
|
34
|
+
image?: string;
|
|
35
|
+
url?: string;
|
|
13
36
|
}
|
|
14
37
|
export interface SiteTheme {
|
|
15
38
|
colors: {
|
|
@@ -20,16 +43,39 @@ export interface SiteTheme {
|
|
|
20
43
|
accent: string;
|
|
21
44
|
muted: string;
|
|
22
45
|
};
|
|
46
|
+
/** Font pair: "modern" (Inter), "editorial" (Playfair+Source Sans), "clean" (DM Sans), "bold" (Space Grotesk+Nunito) or custom {heading, body} */
|
|
47
|
+
fonts?: {
|
|
48
|
+
heading: string;
|
|
49
|
+
body: string;
|
|
50
|
+
} | "modern" | "editorial" | "clean" | "bold";
|
|
51
|
+
/** Border radius scale: "none" | "sm" | "md" | "lg" | "xl" | "full" */
|
|
52
|
+
radius?: "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
53
|
+
/** Shadow style: "none" | "crisp" | "soft" | "heavy" */
|
|
54
|
+
shadow?: "none" | "crisp" | "soft" | "heavy";
|
|
23
55
|
}
|
|
24
56
|
export interface SiteProperty {
|
|
25
57
|
propertyId: string;
|
|
26
58
|
apiBaseUrl?: string;
|
|
27
59
|
}
|
|
60
|
+
export interface AnalyticsConfig {
|
|
61
|
+
/** Google Analytics 4 measurement ID (e.g. "G-XXXXXX") */
|
|
62
|
+
ga4?: string;
|
|
63
|
+
/** Google Tag Manager container ID (e.g. "GTM-XXXXXX") */
|
|
64
|
+
gtm?: string;
|
|
65
|
+
}
|
|
28
66
|
export interface SiteConfig {
|
|
29
67
|
meta: SiteMeta;
|
|
30
68
|
theme?: SiteTheme;
|
|
31
69
|
siteId?: string;
|
|
32
70
|
property?: SiteProperty;
|
|
71
|
+
/** Skip session-token auth; use devApiToken for API calls instead. */
|
|
72
|
+
devMode?: boolean;
|
|
73
|
+
/** Static Bearer token used when devMode is true (e.g. a vendor API key). */
|
|
74
|
+
devApiToken?: string;
|
|
75
|
+
/** Named layouts for DRY templates — each layout has a component tree with Slot placeholders */
|
|
76
|
+
layouts?: Record<string, SiteLayout>;
|
|
77
|
+
/** Analytics tracking configuration */
|
|
78
|
+
analytics?: AnalyticsConfig;
|
|
33
79
|
pages: SitePage[];
|
|
34
80
|
}
|
|
35
81
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC,MAA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M,CAAC;IACtF,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACrD,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,uCAAuC;IACvC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Construct a resized image URL that routes through the Studio CDN resizer.
|
|
3
|
+
*
|
|
4
|
+
* In production, images at /_img/{path}?w=400&q=80 are served by a Lambda
|
|
5
|
+
* that fetches the original, resizes with sharp, and caches the result.
|
|
6
|
+
*
|
|
7
|
+
* For media.eliseai.com URLs, rewrites to /_img/media/{id}.{ext}?w=...
|
|
8
|
+
* For /assets/ URLs, rewrites to /_img/assets/...?w=...
|
|
9
|
+
* For other URLs (external, data:, etc.), returns as-is.
|
|
10
|
+
*
|
|
11
|
+
* When no resize options are provided, returns the original URL unchanged.
|
|
12
|
+
*/
|
|
13
|
+
interface ImageResizeOptions {
|
|
14
|
+
/** Target width in pixels. Snapped to nearest allowed: 100,200,400,600,800,1200,1600,1920 */
|
|
15
|
+
w?: number;
|
|
16
|
+
/** JPEG/WebP quality 1-100 (default: 80) */
|
|
17
|
+
q?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function imageUrl(url: string | null | undefined, opts?: ImageResizeOptions): string;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=imageUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageUrl.d.ts","sourceRoot":"","sources":["../../src/utils/imageUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,UAAU,kBAAkB;IAC1B,6FAA6F;IAC7F,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA8B1F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Construct a resized image URL that routes through the Studio CDN resizer.
|
|
3
|
+
*
|
|
4
|
+
* In production, images at /_img/{path}?w=400&q=80 are served by a Lambda
|
|
5
|
+
* that fetches the original, resizes with sharp, and caches the result.
|
|
6
|
+
*
|
|
7
|
+
* For media.eliseai.com URLs, rewrites to /_img/media/{id}.{ext}?w=...
|
|
8
|
+
* For /assets/ URLs, rewrites to /_img/assets/...?w=...
|
|
9
|
+
* For other URLs (external, data:, etc.), returns as-is.
|
|
10
|
+
*
|
|
11
|
+
* When no resize options are provided, returns the original URL unchanged.
|
|
12
|
+
*/
|
|
13
|
+
const MEDIA_CDN_PREFIX = "https://media.eliseai.com/";
|
|
14
|
+
export function imageUrl(url, opts) {
|
|
15
|
+
if (!url)
|
|
16
|
+
return "";
|
|
17
|
+
if (!opts?.w)
|
|
18
|
+
return url;
|
|
19
|
+
// On localhost, skip resizing (no Lambda available)
|
|
20
|
+
if (typeof window !== "undefined" && window.location.hostname === "localhost") {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
let path;
|
|
24
|
+
if (url.startsWith(MEDIA_CDN_PREFIX)) {
|
|
25
|
+
// media.eliseai.com/abc123.jpg → /_img/media/abc123.jpg
|
|
26
|
+
path = "/_img/media/" + url.slice(MEDIA_CDN_PREFIX.length);
|
|
27
|
+
}
|
|
28
|
+
else if (url.startsWith("/assets/")) {
|
|
29
|
+
// /assets/site/xxx/hero.jpg → /_img/assets/site/xxx/hero.jpg
|
|
30
|
+
path = "/_img" + url;
|
|
31
|
+
}
|
|
32
|
+
else if (url.startsWith("/_img/")) {
|
|
33
|
+
// Already a resize URL
|
|
34
|
+
path = url.split("?")[0];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// External URL or unrecognized — can't resize
|
|
38
|
+
return url;
|
|
39
|
+
}
|
|
40
|
+
const params = new URLSearchParams();
|
|
41
|
+
params.set("w", String(opts.w));
|
|
42
|
+
if (opts.q && opts.q !== 80)
|
|
43
|
+
params.set("q", String(opts.q));
|
|
44
|
+
return `${path}?${params}`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=imageUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageUrl.js","sourceRoot":"","sources":["../../src/utils/imageUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAStD,MAAM,UAAU,QAAQ,CAAC,GAA8B,EAAE,IAAyB;IAChF,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,IAAI,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,GAAG,CAAC;IA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