@deneb-ui/ui 2.0.33 → 2.0.34
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/SiteDataProvider.js +1 -5
- package/dist/location/LocationCard.d.ts +6 -1
- package/dist/location/LocationCard.js +6 -3
- package/dist/location/MapLink.d.ts +6 -1
- package/dist/location/MapLink.js +4 -3
- package/dist/utils/urls.d.ts +15 -0
- package/dist/utils/urls.js +15 -4
- package/package.json +2 -2
package/dist/SiteDataProvider.js
CHANGED
|
@@ -271,12 +271,8 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, }) {
|
|
|
271
271
|
window.parent.postMessage({ type: exports.LEGACY_PREVIEW_READY_MESSAGE, pathname: window.location.pathname }, parentOrigin ?? '*');
|
|
272
272
|
return () => window.removeEventListener('message', onMessage);
|
|
273
273
|
}, []);
|
|
274
|
-
const [hydrated, setHydrated] = (0, react_1.useState)(false);
|
|
275
|
-
(0, react_1.useEffect)(() => {
|
|
276
|
-
setHydrated(true);
|
|
277
|
-
}, []);
|
|
278
274
|
const value = (0, react_1.useMemo)(() => siteData, [siteData]);
|
|
279
|
-
return ((0, jsx_runtime_1.jsxs)(exports.SiteDataContext.Provider, { value: value, children: [(0, jsx_runtime_1.jsx)(FontLoader_1.FontLoader, {}), (0, jsx_runtime_1.jsx)(ResponsiveBaseStyles_1.ResponsiveBaseStyles, {}), (0, jsx_runtime_1.jsx)(DenebComponentStyles_1.DenebComponentStyles, {}),
|
|
275
|
+
return ((0, jsx_runtime_1.jsxs)(exports.SiteDataContext.Provider, { value: value, children: [(0, jsx_runtime_1.jsx)(FontLoader_1.FontLoader, {}), (0, jsx_runtime_1.jsx)(ResponsiveBaseStyles_1.ResponsiveBaseStyles, {}), (0, jsx_runtime_1.jsx)(DenebComponentStyles_1.DenebComponentStyles, {}), children] }));
|
|
280
276
|
}
|
|
281
277
|
function useSiteData() {
|
|
282
278
|
return (0, react_1.useContext)(exports.SiteDataContext);
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface LocationCardProps {
|
|
3
|
+
name?: string | null;
|
|
3
4
|
title?: string;
|
|
4
5
|
titleFieldPath?: string;
|
|
5
6
|
address?: string | null;
|
|
6
7
|
city?: string | null;
|
|
8
|
+
state?: string | null;
|
|
7
9
|
country?: string | null;
|
|
8
10
|
postalCode?: string | null;
|
|
9
11
|
mapUrl?: string | null;
|
|
12
|
+
addressUrl?: string | null;
|
|
13
|
+
url?: string | null;
|
|
10
14
|
fieldPath?: string;
|
|
15
|
+
nameFieldPath?: string;
|
|
11
16
|
addressFieldPath?: string;
|
|
12
17
|
mapUrlFieldPath?: string;
|
|
13
18
|
directionsLabel?: string;
|
|
@@ -17,4 +22,4 @@ export interface LocationCardProps {
|
|
|
17
22
|
/**
|
|
18
23
|
* Premium storefront LocationCard displaying address, pin icon, and Google Maps directions button.
|
|
19
24
|
*/
|
|
20
|
-
export declare function LocationCard({ title, titleFieldPath, address, city, country, postalCode, mapUrl, fieldPath, addressFieldPath, mapUrlFieldPath, directionsLabel, className, style, }: LocationCardProps): React.JSX.Element | null;
|
|
25
|
+
export declare function LocationCard({ name, title, titleFieldPath, address, city, state, country, postalCode, mapUrl, addressUrl, url, fieldPath, nameFieldPath, addressFieldPath, mapUrlFieldPath, directionsLabel, className, style, }: LocationCardProps): React.JSX.Element | null;
|
|
@@ -9,8 +9,11 @@ const EditableText_1 = require("../EditableText");
|
|
|
9
9
|
/**
|
|
10
10
|
* Premium storefront LocationCard displaying address, pin icon, and Google Maps directions button.
|
|
11
11
|
*/
|
|
12
|
-
function LocationCard({ title = 'Our Location', titleFieldPath, address, city, country, postalCode, mapUrl, fieldPath, addressFieldPath = 'common.business.location.address', mapUrlFieldPath = 'common.business.location.addressUrl', directionsLabel = 'Get Directions →', className = '', style, }) {
|
|
13
|
-
|
|
12
|
+
function LocationCard({ name, title = 'Our Location', titleFieldPath, address, city, state, country, postalCode, mapUrl, addressUrl, url, fieldPath, nameFieldPath, addressFieldPath = 'common.business.location.address', mapUrlFieldPath = 'common.business.location.addressUrl', directionsLabel = 'Get Directions →', className = '', style, }) {
|
|
13
|
+
const explicitUrl = (addressUrl || mapUrl || url || '').trim();
|
|
14
|
+
const cardTitle = name || title || 'Our Location';
|
|
15
|
+
const resolvedTitleFieldPath = nameFieldPath || titleFieldPath || (fieldPath ? `${fieldPath}.name` : 'contact.locationTitle');
|
|
16
|
+
if (!address && !city && !country && !explicitUrl && !name) {
|
|
14
17
|
return null;
|
|
15
18
|
}
|
|
16
19
|
const cardStyles = {
|
|
@@ -37,5 +40,5 @@ function LocationCard({ title = 'Our Location', titleFieldPath, address, city, c
|
|
|
37
40
|
alignItems: 'center',
|
|
38
41
|
justifyContent: 'center',
|
|
39
42
|
};
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `deneb-location-card ${className}`.trim(), style: cardStyles, children: [(0, jsx_runtime_1.jsx)("div", { style: iconCircleStyles, children: (0, jsx_runtime_1.jsxs)("svg", { "data-preview-static": "location-card-icon", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "10", r: "3" })] }) }), (0, jsx_runtime_1.jsx)(EditableText_1.EditableText, { as: "h3", id: titleFieldPath || (fieldPath ? `${fieldPath}.title` : 'contact.locationTitle'), defaultValue:
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `deneb-location-card ${className}`.trim(), style: cardStyles, children: [(0, jsx_runtime_1.jsx)("div", { style: iconCircleStyles, children: (0, jsx_runtime_1.jsxs)("svg", { "data-preview-static": "location-card-icon", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "10", r: "3" })] }) }), (0, jsx_runtime_1.jsx)(EditableText_1.EditableText, { as: "h3", id: titleFieldPath || (fieldPath ? `${fieldPath}.title` : 'contact.locationTitle'), defaultValue: cardTitle, style: { margin: 0, fontSize: '1.25rem', fontWeight: 600, color: 'var(--color-text, #0f172a)' } }), (0, jsx_runtime_1.jsx)(Address_1.Address, { address: address, city: city, country: country, postalCode: postalCode, fieldPath: fieldPath, addressFieldPath: addressFieldPath }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: '0.5rem', width: '100%' }, children: (0, jsx_runtime_1.jsx)(MapLink_1.MapLink, { name: name, mapUrl: explicitUrl, addressUrl: explicitUrl, url: explicitUrl, address: address, city: city, state: state, country: country, postalCode: postalCode, label: directionsLabel, urlFieldPath: mapUrlFieldPath, variant: "primary", size: "md", style: { width: '100%' } }) })] }));
|
|
41
44
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MapLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
name?: string | null;
|
|
3
4
|
mapUrl?: string | null;
|
|
5
|
+
addressUrl?: string | null;
|
|
6
|
+
url?: string | null;
|
|
4
7
|
address?: string | null;
|
|
5
8
|
city?: string | null;
|
|
9
|
+
state?: string | null;
|
|
6
10
|
country?: string | null;
|
|
11
|
+
postalCode?: string | null;
|
|
7
12
|
label?: React.ReactNode;
|
|
8
13
|
/** Visible label field path, e.g. `contact.directionsLabel`. */
|
|
9
14
|
labelFieldPath?: string;
|
|
@@ -18,4 +23,4 @@ export interface MapLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
|
|
|
18
23
|
/**
|
|
19
24
|
* Directions CTA with Fivora-safe split fields: label on the button, URL on a hidden sibling.
|
|
20
25
|
*/
|
|
21
|
-
export declare function MapLink({ mapUrl, address, city, country, label, labelFieldPath, urlFieldPath, fieldPath, variant, size, icon, className, style, ...rest }: MapLinkProps): React.JSX.Element | null;
|
|
26
|
+
export declare function MapLink({ name, mapUrl, addressUrl, url, address, city, state, country, postalCode, label, labelFieldPath, urlFieldPath, fieldPath, variant, size, icon, className, style, ...rest }: MapLinkProps): React.JSX.Element | null;
|
package/dist/location/MapLink.js
CHANGED
|
@@ -7,11 +7,12 @@ const urls_1 = require("../utils/urls");
|
|
|
7
7
|
/**
|
|
8
8
|
* Directions CTA with Fivora-safe split fields: label on the button, URL on a hidden sibling.
|
|
9
9
|
*/
|
|
10
|
-
function MapLink({ mapUrl, address, city, country, label = 'Get Directions', labelFieldPath, urlFieldPath, fieldPath, variant = 'outline', size = 'md', icon, className = '', style, ...rest }) {
|
|
10
|
+
function MapLink({ name, mapUrl, addressUrl, url, address, city, state, country, postalCode, label = 'Get Directions', labelFieldPath, urlFieldPath, fieldPath, variant = 'outline', size = 'md', icon, className = '', style, ...rest }) {
|
|
11
11
|
const resolvedUrlFieldPath = urlFieldPath || fieldPath || 'contact.directionsUrl';
|
|
12
12
|
const resolvedLabelFieldPath = labelFieldPath || resolvedUrlFieldPath.replace(/Url$/, 'Label');
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const explicitUrl = (addressUrl || mapUrl || url || '').trim();
|
|
14
|
+
const resolvedHref = (0, urls_1.createMapUrl)({ name, mapUrl: explicitUrl, addressUrl: explicitUrl, url: explicitUrl, address, city, state, country, postalCode });
|
|
15
|
+
const urlText = explicitUrl || resolvedHref;
|
|
15
16
|
const finalHref = resolvedHref || '#';
|
|
16
17
|
if (!finalHref && !label)
|
|
17
18
|
return null;
|
package/dist/utils/urls.d.ts
CHANGED
|
@@ -3,12 +3,27 @@
|
|
|
3
3
|
* Created by Chamika Gayashan & Induranga Kawishwara
|
|
4
4
|
*/
|
|
5
5
|
export interface MapLocationInput {
|
|
6
|
+
/** Location or branch name, e.g. "Main Roastery", "Downtown Cafe". */
|
|
7
|
+
name?: string | null;
|
|
8
|
+
/** Alternative title property. */
|
|
9
|
+
title?: string | null;
|
|
10
|
+
/** Explicit Google Maps or destination URL. */
|
|
6
11
|
mapUrl?: string | null;
|
|
7
12
|
/** Fivora-paired sibling of `address` (`addressUrl` shares the `address` inspector stem). */
|
|
8
13
|
addressUrl?: string | null;
|
|
14
|
+
/** Generic external or map URL. */
|
|
15
|
+
url?: string | null;
|
|
16
|
+
/** Link URL alias. */
|
|
17
|
+
linkUrl?: string | null;
|
|
18
|
+
/** Street address. */
|
|
9
19
|
address?: string | null;
|
|
10
20
|
city?: string | null;
|
|
21
|
+
state?: string | null;
|
|
11
22
|
country?: string | null;
|
|
23
|
+
postalCode?: string | null;
|
|
24
|
+
zipCode?: string | null;
|
|
25
|
+
/** Permissive index signature so custom or template-specific keys never trigger TS2561. */
|
|
26
|
+
[key: string]: any;
|
|
12
27
|
}
|
|
13
28
|
/**
|
|
14
29
|
* Creates a valid WhatsApp click-to-chat URL.
|
package/dist/utils/urls.js
CHANGED
|
@@ -66,13 +66,24 @@ function createMapUrl(location) {
|
|
|
66
66
|
}
|
|
67
67
|
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(location)}`;
|
|
68
68
|
}
|
|
69
|
-
const explicitUrl = (location.addressUrl ||
|
|
69
|
+
const explicitUrl = (location.addressUrl ||
|
|
70
|
+
location.mapUrl ||
|
|
71
|
+
location.url ||
|
|
72
|
+
location.linkUrl ||
|
|
73
|
+
'').trim();
|
|
70
74
|
if (explicitUrl) {
|
|
71
75
|
return explicitUrl;
|
|
72
76
|
}
|
|
73
|
-
const queryParts = [
|
|
74
|
-
.
|
|
75
|
-
.
|
|
77
|
+
const queryParts = [
|
|
78
|
+
location.name || location.title,
|
|
79
|
+
location.address,
|
|
80
|
+
location.city,
|
|
81
|
+
location.state,
|
|
82
|
+
location.country,
|
|
83
|
+
location.postalCode || location.zipCode,
|
|
84
|
+
]
|
|
85
|
+
.filter((part) => Boolean(part && String(part).trim()))
|
|
86
|
+
.map((part) => String(part).trim());
|
|
76
87
|
if (queryParts.length > 0) {
|
|
77
88
|
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(queryParts.join(', '))}`;
|
|
78
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deneb-ui/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"description": "Visual-first React component library for editable commerce storefronts. Built for Next.js and Fivora.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"license": "MIT",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@deneb-ui/core": "^2.0.
|
|
52
|
+
"@deneb-ui/core": "^2.0.34"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"react": "^18.0.0 || ^19.0.0",
|