@deneb-ui/ui 2.0.74 → 2.0.76
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/EditableBeforeAfterSlider.js +7 -1
- package/dist/EditableCustomerReviews.js +3 -2
- package/dist/EditableGoogleFeedback.js +0 -1
- package/dist/EditableTestimonialSection.js +4 -4
- package/dist/SiteDataProvider.js +3 -3
- package/dist/business/BusinessHours.js +4 -3
- package/dist/contact/EmailButton.js +4 -3
- package/dist/contact/FloatingContactWidget.js +3 -2
- package/dist/contact/PhoneButton.js +4 -3
- package/dist/contact/WhatsAppButton.js +5 -4
- package/dist/location/LocationCard.js +11 -10
- package/dist/location/LocationLink.js +8 -6
- package/dist/location/MapEmbed.js +9 -7
- package/dist/location/MapLink.js +0 -1
- package/package.json +2 -2
|
@@ -11,6 +11,12 @@ function EditableBeforeAfterSlider({ beforeImageId = 'home.showcase.beforeImage'
|
|
|
11
11
|
const [sliderPos, setSliderPos] = (0, react_1.useState)(initialPosition);
|
|
12
12
|
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
13
13
|
const containerRef = (0, react_1.useRef)(null);
|
|
14
|
+
const [containerWidth, setContainerWidth] = (0, react_1.useState)(null);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
if (containerRef.current) {
|
|
17
|
+
setContainerWidth(containerRef.current.clientWidth);
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
14
20
|
const updatePosition = (0, react_1.useCallback)((clientX) => {
|
|
15
21
|
if (!containerRef.current)
|
|
16
22
|
return;
|
|
@@ -96,7 +102,7 @@ function EditableBeforeAfterSlider({ beforeImageId = 'home.showcase.beforeImage'
|
|
|
96
102
|
position: 'absolute',
|
|
97
103
|
top: 0,
|
|
98
104
|
left: 0,
|
|
99
|
-
width:
|
|
105
|
+
width: containerWidth ? `${containerWidth}px` : '100%',
|
|
100
106
|
height: '100%',
|
|
101
107
|
}, children: (0, jsx_runtime_1.jsx)(EditableImage_1.EditableImage, { id: beforeImageId, src: defaultBeforeImage, alt: "Before transformation", style: { width: '100%', height: '100%', objectFit: 'cover' } }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
102
108
|
position: 'absolute',
|
|
@@ -48,7 +48,8 @@ function EditableCustomerReviews({ sectionPath = 'home', title, subtitle, averag
|
|
|
48
48
|
const [selectedStarFilter, setSelectedStarFilter] = (0, react_1.useState)(null);
|
|
49
49
|
const liveReviews = (0, SiteDataProvider_1.useReviews)();
|
|
50
50
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
51
|
-
const
|
|
51
|
+
const contentRecord = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
52
|
+
const siteReviews = contentRecord[sectionPath]?.reviews || contentRecord.reviews || (contentRecord.home && typeof contentRecord.home === 'object' ? contentRecord.home.reviews : undefined);
|
|
52
53
|
const rawReviews = (reviews && reviews.length > 0)
|
|
53
54
|
? reviews
|
|
54
55
|
: (liveReviews && liveReviews.length > 0)
|
|
@@ -84,7 +85,7 @@ function EditableCustomerReviews({ sectionPath = 'home', title, subtitle, averag
|
|
|
84
85
|
return normalizedReviews;
|
|
85
86
|
return normalizedReviews.filter((r) => r.rating === selectedStarFilter);
|
|
86
87
|
}, [normalizedReviews, selectedStarFilter]);
|
|
87
|
-
return ((0, jsx_runtime_1.jsxs)("section", { "data-preview-page-key": sectionPath, className: `editable-customer-reviews max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 ${className}`.trim(), style: style, ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center max-w-2xl mx-auto mb-12", children: [subtitle && ((0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `${sectionPath}.reviewsSubtitle`, className: "text-xs font-black tracking-widest uppercase text-emerald-600 dark:text-lime-400 block mb-2", children: resolvedSubtitle })), (0, jsx_runtime_1.jsx)("h2", { "data-preview-field-path": `${sectionPath}.reviewsTitle`, className: "text-3xl sm:text-4xl font-extrabold tracking-tight text-slate-900 dark:text-white leading-tight", children:
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)("section", { "data-preview-page-key": sectionPath, className: `editable-customer-reviews max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 ${className}`.trim(), style: style, ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center max-w-2xl mx-auto mb-12", children: [subtitle && ((0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `${sectionPath}.reviewsSubtitle`, className: "text-xs font-black tracking-widest uppercase text-emerald-600 dark:text-lime-400 block mb-2", children: resolvedSubtitle })), (0, jsx_runtime_1.jsx)("h2", { "data-preview-field-path": `${sectionPath}.reviewsTitle`, className: "text-3xl sm:text-4xl font-extrabold tracking-tight text-slate-900 dark:text-white leading-tight", children: resolvedTitle }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex items-center justify-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex text-amber-500 dark:text-amber-400 text-lg", children: '★★★★★' }), (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-900 dark:text-white font-extrabold text-lg", children: [(0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `${sectionPath}.reviewsAverage`, children: resolvedAverageRating }), " / 5.0"] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-500 dark:text-slate-400 text-sm", children: ["(", (0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `${sectionPath}.reviewsCount`, children: resolvedTotalReviews }), " reviews)"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center gap-2 mb-8", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setSelectedStarFilter(null), className: `px-3.5 py-1.5 rounded-xl text-xs font-bold transition-all ${selectedStarFilter === null
|
|
88
89
|
? 'bg-slate-900 text-white dark:bg-lime-400 dark:text-slate-950 font-extrabold shadow-sm'
|
|
89
90
|
: 'bg-slate-100 text-slate-600 hover:text-slate-900 border border-slate-200 dark:bg-slate-900/60 dark:text-slate-400 dark:hover:text-white dark:border-slate-800'}`, children: "All Reviews" }), [5, 4, 3].map((stars) => ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setSelectedStarFilter(stars), className: `px-3.5 py-1.5 rounded-xl text-xs font-bold transition-all flex items-center gap-1 ${selectedStarFilter === stars
|
|
90
91
|
? 'bg-slate-900 text-white dark:bg-lime-400 dark:text-slate-950 font-extrabold shadow-sm'
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GoogleFeedback = void 0;
|
|
4
4
|
exports.EditableGoogleFeedback = EditableGoogleFeedback;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
/* eslint-disable @next/next/no-img-element */
|
|
7
6
|
const react_1 = require("react");
|
|
8
7
|
const SiteDataProvider_1 = require("./SiteDataProvider");
|
|
9
8
|
const DEFAULT_GOOGLE_ICON = 'https://upload.wikimedia.org/wikipedia/commons/c/c1/Google_%22G%22_logo.svg';
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TestimonialSection = void 0;
|
|
4
4
|
exports.EditableTestimonialSection = EditableTestimonialSection;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
/* eslint-disable @next/next/no-img-element */
|
|
7
6
|
const react_1 = require("react");
|
|
8
7
|
const SiteDataProvider_1 = require("./SiteDataProvider");
|
|
9
8
|
const DEFAULT_TESTIMONIALS = [
|
|
@@ -107,11 +106,12 @@ function EditableTestimonialSection({ basePath = 'testimonials', badge = 'WORDS
|
|
|
107
106
|
tag: t.tag || 'Verified Buyer',
|
|
108
107
|
}));
|
|
109
108
|
}, [rawTestimonials]);
|
|
110
|
-
const
|
|
111
|
-
const
|
|
109
|
+
const contentRecord = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
110
|
+
const effectiveHeading = heading ?? contentRecord[basePath]?.heading ?? 'WHAT OUR CUSTOMERS ARE SAYING';
|
|
111
|
+
const effectiveSubheading = subheading ?? contentRecord[basePath]?.subheading ?? 'Reflections and feedback from verified customers and dedicated regulars.';
|
|
112
112
|
const hasCustomPy = /(^|\s)(p|py|pt)-/.test(className);
|
|
113
113
|
const defaultPadding = hasCustomPy ? '' : 'py-6 sm:py-8';
|
|
114
|
-
return ((0, jsx_runtime_1.jsx)("section", { "data-preview-page-key": basePath, "data-design-section": basePath, className: `editable-testimonial-section w-full ${defaultPadding} px-3 sm:px-6 lg:px-8 ${className}`.trim(), style: style, ...props, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-full mx-auto", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center max-w-3xl mx-auto space-y-3 mb-6 sm:mb-8 px-2", children: [badge && ((0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-slate-100 text-slate-800 border border-slate-200 dark:bg-slate-800/80 dark:text-lime-400 dark:border-lime-400/20 text-xs uppercase tracking-widest font-black shadow-sm", children: (0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `testimonials.badge`, children: badge }) })), (0, jsx_runtime_1.jsx)("h2", { "data-preview-field-path": `testimonials.heading`, className: "font-heading text-2xl xs:text-3xl sm:text-4xl lg:text-5xl font-black text-slate-900 dark:text-white tracking-tight", children:
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)("section", { "data-preview-page-key": basePath, "data-design-section": basePath, className: `editable-testimonial-section w-full ${defaultPadding} px-3 sm:px-6 lg:px-8 ${className}`.trim(), style: style, ...props, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-full mx-auto", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center max-w-3xl mx-auto space-y-3 mb-6 sm:mb-8 px-2", children: [badge && ((0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-slate-100 text-slate-800 border border-slate-200 dark:bg-slate-800/80 dark:text-lime-400 dark:border-lime-400/20 text-xs uppercase tracking-widest font-black shadow-sm", children: (0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `testimonials.badge`, children: badge }) })), (0, jsx_runtime_1.jsx)("h2", { "data-preview-field-path": `testimonials.heading`, className: "font-heading text-2xl xs:text-3xl sm:text-4xl lg:text-5xl font-black text-slate-900 dark:text-white tracking-tight", children: effectiveHeading }), (0, jsx_runtime_1.jsx)("p", { "data-preview-field-path": `testimonials.subheading`, className: "text-xs sm:text-base text-slate-600 dark:text-slate-400 leading-relaxed max-w-2xl mx-auto", children: effectiveSubheading })] }), (0, jsx_runtime_1.jsx)("div", { "data-preview-list-path": `testimonials.testimonials`, className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-5 sm:gap-7 [grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr))] w-full", children: items.map((item, index) => ((0, jsx_runtime_1.jsx)(TestimonialCard, { item: item, index: index, maxStars: maxStars, cardClassName: cardClassName }, item.id || String(index)))) })] }) }));
|
|
115
115
|
}
|
|
116
116
|
// Canonical alias
|
|
117
117
|
exports.TestimonialSection = EditableTestimonialSection;
|
package/dist/SiteDataProvider.js
CHANGED
|
@@ -272,9 +272,9 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, liveCat
|
|
|
272
272
|
// Shop / Merchant profile live synchronization
|
|
273
273
|
let nextShop = isRecord(current.shop) ? { ...current.shop } : {};
|
|
274
274
|
let nextMerchant = isRecord(current.merchant) ? { ...current.merchant } : {};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
const nextCommon = { ...currentCommon };
|
|
276
|
+
const nextContact = { ...currentContact };
|
|
277
|
+
const nextHome = currentHome ? { ...currentHome } : {};
|
|
278
278
|
if (isRecord(live.shop)) {
|
|
279
279
|
nextShop = mergeSiteData(nextShop, live.shop);
|
|
280
280
|
nextMerchant = mergeSiteData(nextMerchant, live.shop);
|
|
@@ -44,9 +44,10 @@ function formatTime(timeStr) {
|
|
|
44
44
|
function BusinessHours({ hours, title = 'Business Hours', fieldPath = 'common.business.hours', showStatusBadge = true, compact = false, className = '', style, }) {
|
|
45
45
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
46
46
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
47
|
-
const
|
|
48
|
-
const common =
|
|
49
|
-
const
|
|
47
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
48
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
49
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
50
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
50
51
|
const effectiveHours = hours ||
|
|
51
52
|
liveShop?.openingHours ||
|
|
52
53
|
contact.hours ||
|
|
@@ -8,9 +8,10 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
8
8
|
function EmailButton({ email, value, label = 'Email Us', fieldPath = 'common.business.email', variant = 'outline', ...rest }) {
|
|
9
9
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
10
10
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
11
|
-
const
|
|
12
|
-
const common =
|
|
13
|
-
const
|
|
11
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
12
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
13
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
14
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
14
15
|
const effectiveEmail = email ||
|
|
15
16
|
value ||
|
|
16
17
|
liveShop?.contact?.email ||
|
|
@@ -17,11 +17,12 @@ const urls_1 = require("../utils/urls");
|
|
|
17
17
|
function FloatingContactWidget({ fieldPath = 'contact', defaultPhone, defaultWhatsApp, defaultEmail, defaultMessage = 'Hello! I have an inquiry about your products.', position = 'bottom-right', className = '', style = {}, }) {
|
|
18
18
|
const { siteData } = (0, SiteDataProvider_1.useSiteData)();
|
|
19
19
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
20
|
-
const
|
|
20
|
+
const sdRecord = (siteData && typeof siteData === 'object' ? siteData : {});
|
|
21
|
+
const contactData = (sdRecord.contact && typeof sdRecord.contact === 'object' ? sdRecord.contact : {});
|
|
21
22
|
const phone = contactData.phone || defaultPhone || '';
|
|
22
23
|
const whatsapp = contactData.whatsapp || defaultWhatsApp || phone;
|
|
23
24
|
const email = contactData.email || defaultEmail || '';
|
|
24
|
-
const storeName =
|
|
25
|
+
const storeName = typeof sdRecord.site?.name === 'string' ? sdRecord.site.name : 'Support';
|
|
25
26
|
const hasWhatsApp = Boolean(whatsapp && whatsapp.trim().length > 0);
|
|
26
27
|
const hasPhone = Boolean(phone && phone.trim().length > 0);
|
|
27
28
|
const hasEmail = Boolean(email && email.trim().length > 0);
|
|
@@ -8,9 +8,10 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
8
8
|
function PhoneButton({ phoneNumber, value, label = 'Call Us', fieldPath = 'common.business.phone', variant = 'primary', ...rest }) {
|
|
9
9
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
10
10
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
11
|
-
const
|
|
12
|
-
const common =
|
|
13
|
-
const
|
|
11
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
12
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
13
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
14
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
14
15
|
const effectiveNumber = phoneNumber ||
|
|
15
16
|
value ||
|
|
16
17
|
liveShop?.contact?.phone ||
|
|
@@ -12,10 +12,11 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
12
12
|
function WhatsAppButton({ phoneNumber, value, label = 'Chat on WhatsApp', fieldPath = 'common.business.whatsapp', variant = 'whatsapp', message, ...rest }) {
|
|
13
13
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
14
14
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
15
|
-
const
|
|
16
|
-
const common =
|
|
17
|
-
const
|
|
18
|
-
const
|
|
15
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
16
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
17
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
18
|
+
const home = (content.home && typeof content.home === 'object' ? content.home : {});
|
|
19
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
19
20
|
const effectiveNumber = phoneNumber ||
|
|
20
21
|
value ||
|
|
21
22
|
liveShop?.contact?.whatsapp ||
|
|
@@ -14,16 +14,17 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
14
14
|
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, }) {
|
|
15
15
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
16
16
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
17
|
-
const
|
|
18
|
-
const common =
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
17
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
18
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
19
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
20
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
21
|
+
const effectiveAddress = (address ?? liveShop?.address ?? (typeof contact.address === 'string' ? contact.address : null) ?? (typeof contact.location === 'string' ? contact.location : null) ?? (typeof merchant.address === 'string' ? merchant.address : null) ?? '');
|
|
22
|
+
const effectiveCity = (city ?? liveShop?.city ?? (typeof contact.city === 'string' ? contact.city : null) ?? (typeof merchant.city === 'string' ? merchant.city : null) ?? '');
|
|
23
|
+
const effectiveState = (state ?? '');
|
|
24
|
+
const effectiveCountry = (country ?? (typeof contact.country === 'string' ? contact.country : null) ?? (typeof merchant.country === 'string' ? merchant.country : null) ?? '');
|
|
25
|
+
const effectivePostalCode = (postalCode ?? (typeof contact.postalCode === 'string' ? contact.postalCode : null) ?? '');
|
|
26
|
+
const explicitUrl = (addressUrl || mapUrl || url || liveShop?.mapLocation || (typeof contact.googleMapLink === 'string' ? contact.googleMapLink : null) || (typeof contact.mapLocation === 'string' ? contact.mapLocation : null) || (typeof merchant.mapLocation === 'string' ? merchant.mapLocation : null) || (typeof merchant.googleMapLink === 'string' ? merchant.googleMapLink : null) || '').trim();
|
|
27
|
+
const effectiveName = (name ?? liveShop?.name ?? (typeof common.websiteTitle === 'string' ? common.websiteTitle : null) ?? (typeof merchant.businessName === 'string' ? merchant.businessName : null) ?? title ?? 'Our Location');
|
|
27
28
|
const resolvedTitleFieldPath = nameFieldPath || titleFieldPath || (fieldPath ? `${fieldPath}.name` : 'contact.locationTitle');
|
|
28
29
|
if (!effectiveAddress && !effectiveCity && !effectiveCountry && !explicitUrl && !effectiveName) {
|
|
29
30
|
return null;
|
|
@@ -13,12 +13,14 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
13
13
|
function LocationLink({ address, city, country, mapUrl, fieldPath, addressFieldPath = 'common.business.location.address', mapUrlFieldPath = 'common.business.location.addressUrl', directionsLabel = 'Get Directions', showAddress = true, className = '', style, }) {
|
|
14
14
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
15
15
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
16
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
17
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
18
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
19
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
20
|
+
const effectiveAddress = (address ?? liveShop?.address ?? (typeof contact.address === 'string' ? contact.address : null) ?? (typeof contact.location === 'string' ? contact.location : null) ?? (typeof merchant.address === 'string' ? merchant.address : null) ?? '');
|
|
21
|
+
const effectiveCity = (city ?? liveShop?.city ?? (typeof contact.city === 'string' ? contact.city : null) ?? (typeof merchant.city === 'string' ? merchant.city : null) ?? '');
|
|
22
|
+
const effectiveCountry = (country ?? (typeof contact.country === 'string' ? contact.country : null) ?? (typeof merchant.country === 'string' ? merchant.country : null) ?? '');
|
|
23
|
+
const effectiveMapUrl = (mapUrl || liveShop?.mapLocation || (typeof contact.googleMapLink === 'string' ? contact.googleMapLink : null) || (typeof contact.mapLocation === 'string' ? contact.mapLocation : null) || (typeof merchant.mapLocation === 'string' ? merchant.mapLocation : null) || '').trim();
|
|
22
24
|
if (!effectiveAddress && !effectiveCity && !effectiveCountry && !effectiveMapUrl) {
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
@@ -13,13 +13,15 @@ const SiteDataProvider_1 = require("../SiteDataProvider");
|
|
|
13
13
|
function MapEmbed({ embedUrl, mapUrl, address, city, country, title = 'Business Location Map', fieldPath = 'common.business.location.mapEmbedUrl', height = 360, className = '', style, }) {
|
|
14
14
|
const liveShop = (0, SiteDataProvider_1.useShop)();
|
|
15
15
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
16
|
+
const content = (siteData?.content && typeof siteData.content === 'object' ? siteData.content : {});
|
|
17
|
+
const common = (content.common && typeof content.common === 'object' ? content.common : {});
|
|
18
|
+
const contact = (content.contact && typeof content.contact === 'object' ? content.contact : (common.contact && typeof common.contact === 'object' ? common.contact : {}));
|
|
19
|
+
const merchant = (siteData && 'merchant' in siteData && typeof siteData.merchant === 'object' ? siteData.merchant : {});
|
|
20
|
+
const effectiveEmbedUrl = (embedUrl ?? (typeof contact.mapEmbedUrl === 'string' ? contact.mapEmbedUrl : null) ?? (typeof merchant.mapEmbedUrl === 'string' ? merchant.mapEmbedUrl : null) ?? '');
|
|
21
|
+
const effectiveMapUrl = (mapUrl || liveShop?.mapLocation || (typeof contact.googleMapLink === 'string' ? contact.googleMapLink : null) || (typeof contact.mapLocation === 'string' ? contact.mapLocation : null) || (typeof merchant.mapLocation === 'string' ? merchant.mapLocation : null) || '').trim();
|
|
22
|
+
const effectiveAddress = (address ?? liveShop?.address ?? (typeof contact.address === 'string' ? contact.address : null) ?? (typeof contact.location === 'string' ? contact.location : null) ?? (typeof merchant.address === 'string' ? merchant.address : null) ?? '');
|
|
23
|
+
const effectiveCity = (city ?? liveShop?.city ?? (typeof contact.city === 'string' ? contact.city : null) ?? (typeof merchant.city === 'string' ? merchant.city : null) ?? '');
|
|
24
|
+
const effectiveCountry = (country ?? (typeof contact.country === 'string' ? contact.country : null) ?? (typeof merchant.country === 'string' ? merchant.country : null) ?? '');
|
|
23
25
|
const containerStyles = {
|
|
24
26
|
width: '100%',
|
|
25
27
|
height: typeof height === 'number' ? `${height}px` : height,
|
package/dist/location/MapLink.js
CHANGED
|
@@ -12,7 +12,6 @@ function MapLink({ name, mapUrl, addressUrl, url, address, city, state, country,
|
|
|
12
12
|
const resolvedLabelFieldPath = labelFieldPath || resolvedUrlFieldPath.replace(/Url$/, 'Label');
|
|
13
13
|
const explicitUrl = (addressUrl || mapUrl || url || '').trim();
|
|
14
14
|
const resolvedHref = (0, urls_1.createMapUrl)({ name, mapUrl: explicitUrl, addressUrl: explicitUrl, url: explicitUrl, address, city, state, country, postalCode });
|
|
15
|
-
const urlText = explicitUrl || resolvedHref;
|
|
16
15
|
const finalHref = resolvedHref || '#';
|
|
17
16
|
if (!finalHref && !label)
|
|
18
17
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deneb-ui/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.76",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@deneb-ui/core": "^2.0.
|
|
53
|
+
"@deneb-ui/core": "^2.0.76"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^18.0.0 || ^19.0.0",
|