@deneb-ui/ui 2.0.78 → 2.0.79
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 +42 -13
- package/package.json +2 -2
package/dist/SiteDataProvider.js
CHANGED
|
@@ -260,9 +260,18 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, liveCat
|
|
|
260
260
|
const currentHome = isRecord(currentContent.home) ? currentContent.home : null;
|
|
261
261
|
const currentCommon = isRecord(currentContent.common) ? currentContent.common : {};
|
|
262
262
|
const currentContact = isRecord(currentContent.contact) ? currentContent.contact : {};
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
const rawLiveProducts = Array.isArray(live.products) ? live.products : currentContent.products;
|
|
264
|
+
const nextProducts = Array.isArray(rawLiveProducts)
|
|
265
|
+
? rawLiveProducts.map((p) => {
|
|
266
|
+
if (!isRecord(p))
|
|
267
|
+
return p;
|
|
268
|
+
const customData = isRecord(p.customData) ? p.customData : {};
|
|
269
|
+
return {
|
|
270
|
+
...customData,
|
|
271
|
+
...p,
|
|
272
|
+
};
|
|
273
|
+
})
|
|
274
|
+
: rawLiveProducts;
|
|
266
275
|
const nextServices = Array.isArray(live.services)
|
|
267
276
|
? live.services
|
|
268
277
|
: currentContent.services;
|
|
@@ -293,12 +302,18 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, liveCat
|
|
|
293
302
|
if (cleanWa) {
|
|
294
303
|
nextContact.whatsappNumber = cleanWa;
|
|
295
304
|
nextCommon.whatsappNumber = cleanWa;
|
|
296
|
-
// Dynamically update any hardcoded or static wa.me URLs across home
|
|
305
|
+
// Dynamically update any hardcoded or static wa.me URLs across home and common
|
|
297
306
|
const waRegex = /(https?:\/\/(?:wa\.me|api\.whatsapp\.com\/send\?phone=))\d+/gi;
|
|
298
307
|
for (const key of ['whatsappCtaUrl', 'whatsappOrderUrl', 'whatsappUrl']) {
|
|
299
308
|
if (typeof nextHome[key] === 'string' && waRegex.test(nextHome[key])) {
|
|
300
309
|
nextHome[key] = nextHome[key].replace(waRegex, `$1${cleanWa}`);
|
|
301
310
|
}
|
|
311
|
+
if (typeof nextCommon[key] === 'string' && waRegex.test(nextCommon[key])) {
|
|
312
|
+
nextCommon[key] = nextCommon[key].replace(waRegex, `$1${cleanWa}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (!nextCommon.whatsappUrl || waRegex.test(nextCommon.whatsappUrl)) {
|
|
316
|
+
nextCommon.whatsappUrl = `https://wa.me/${cleanWa}`;
|
|
302
317
|
}
|
|
303
318
|
}
|
|
304
319
|
}
|
|
@@ -312,6 +327,7 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, liveCat
|
|
|
312
327
|
if (typeof street === 'string' && street.trim()) {
|
|
313
328
|
nextContact.address = street;
|
|
314
329
|
nextCommon.address = street;
|
|
330
|
+
nextCommon.footerAddress = street;
|
|
315
331
|
}
|
|
316
332
|
if (typeof address.mapLocation === 'string' && address.mapLocation.trim()) {
|
|
317
333
|
nextContact.googleMapLink = address.mapLocation;
|
|
@@ -639,19 +655,32 @@ function useProducts(fallback = []) {
|
|
|
639
655
|
const content = isRecord(siteData?.content) ? siteData.content : null;
|
|
640
656
|
if (!content)
|
|
641
657
|
return fallback;
|
|
658
|
+
let rawList = null;
|
|
642
659
|
if (Array.isArray(content.products) && content.products.length > 0) {
|
|
643
|
-
|
|
660
|
+
rawList = content.products;
|
|
644
661
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
if (
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
662
|
+
else {
|
|
663
|
+
const home = isRecord(content.home) ? content.home : null;
|
|
664
|
+
if (home) {
|
|
665
|
+
if (Array.isArray(home.products) && home.products.length > 0) {
|
|
666
|
+
rawList = home.products;
|
|
667
|
+
}
|
|
668
|
+
else if (Array.isArray(home.featuredProducts) && home.featuredProducts.length > 0) {
|
|
669
|
+
rawList = home.featuredProducts;
|
|
670
|
+
}
|
|
652
671
|
}
|
|
653
672
|
}
|
|
654
|
-
|
|
673
|
+
if (!rawList)
|
|
674
|
+
return fallback;
|
|
675
|
+
return rawList.map((p) => {
|
|
676
|
+
if (!isRecord(p))
|
|
677
|
+
return p;
|
|
678
|
+
const customData = isRecord(p.customData) ? p.customData : {};
|
|
679
|
+
return {
|
|
680
|
+
...customData,
|
|
681
|
+
...p,
|
|
682
|
+
};
|
|
683
|
+
});
|
|
655
684
|
}
|
|
656
685
|
/**
|
|
657
686
|
* Hook to retrieve services cleanly from SiteData, supporting both
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deneb-ui/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.79",
|
|
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.79"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^18.0.0 || ^19.0.0",
|