@infrab4a/connect 5.5.6-beta.1 → 5.5.6-beta.3
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/index.cjs.js +19 -13
- package/index.esm.js +19 -13
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2435,9 +2435,9 @@ class ShopSettings extends BaseModel {
|
|
|
2435
2435
|
if (section.type === ShopPageSectionType.CAROUSEL && Array.isArray(section.banners)) {
|
|
2436
2436
|
const filteredBanners = section.banners.filter((banner) => {
|
|
2437
2437
|
// Filtra por displayRules
|
|
2438
|
-
const rulesMatch = banner.displayRules
|
|
2439
|
-
? Object.keys(
|
|
2440
|
-
:
|
|
2438
|
+
const rulesMatch = banner.displayRules.length
|
|
2439
|
+
? banner.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2440
|
+
: true;
|
|
2441
2441
|
// Filtra por publishDate e expirationDate
|
|
2442
2442
|
const publishOk = !banner.publishDate || now >= new Date(banner.publishDate);
|
|
2443
2443
|
const expireOk = !banner.expirationDate || now <= new Date(banner.expirationDate);
|
|
@@ -2449,27 +2449,30 @@ class ShopSettings extends BaseModel {
|
|
|
2449
2449
|
if (section.type === ShopPageSectionType.HIGHLIGHTS && Array.isArray(section.highlights)) {
|
|
2450
2450
|
const filteredHighlights = section.highlights.filter((highlight) => {
|
|
2451
2451
|
// Filtra por displayRules
|
|
2452
|
-
const rulesMatch = highlight.displayRules
|
|
2453
|
-
? Object.keys(
|
|
2454
|
-
:
|
|
2452
|
+
const rulesMatch = highlight.displayRules.length
|
|
2453
|
+
? highlight.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2454
|
+
: true;
|
|
2455
2455
|
return rulesMatch;
|
|
2456
2456
|
});
|
|
2457
|
-
|
|
2457
|
+
const sortedHighlights = !displayRules.beautyProfile
|
|
2458
|
+
? filteredHighlights.sort((a, b) => (a.starred === b.starred ? 0 : a.starred ? -1 : 1))
|
|
2459
|
+
: filteredHighlights;
|
|
2460
|
+
return { ...section, highlights: sortedHighlights };
|
|
2458
2461
|
}
|
|
2459
2462
|
// Filtra collections
|
|
2460
2463
|
if (section.type === ShopPageSectionType.COLLECTION) {
|
|
2461
|
-
const rulesMatch = section.displayRules
|
|
2462
|
-
? Object.keys(
|
|
2463
|
-
:
|
|
2464
|
+
const rulesMatch = section.displayRules.length
|
|
2465
|
+
? section.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2466
|
+
: true;
|
|
2464
2467
|
const publishOk = !section.publishDate || now >= new Date(section.publishDate);
|
|
2465
2468
|
const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
|
|
2466
2469
|
return rulesMatch && publishOk && expireOk ? section : null;
|
|
2467
2470
|
}
|
|
2468
2471
|
// Filtra banners
|
|
2469
2472
|
if (section.type === ShopPageSectionType.BANNER) {
|
|
2470
|
-
const rulesMatch = section.displayRules
|
|
2471
|
-
? Object.keys(
|
|
2472
|
-
:
|
|
2473
|
+
const rulesMatch = section.displayRules.length
|
|
2474
|
+
? section.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2475
|
+
: true;
|
|
2473
2476
|
const publishOk = !section.publishDate || now >= new Date(section.publishDate);
|
|
2474
2477
|
const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
|
|
2475
2478
|
return rulesMatch && publishOk && expireOk ? section : null;
|
|
@@ -2477,6 +2480,9 @@ class ShopSettings extends BaseModel {
|
|
|
2477
2480
|
if (section.type === ShopPageSectionType.LIVE) {
|
|
2478
2481
|
return section.active ? section : null;
|
|
2479
2482
|
}
|
|
2483
|
+
if (section.type === ShopPageSectionType.PLANS || section.type === ShopPageSectionType.SINGLE_PLAN) {
|
|
2484
|
+
return displayRules.notSubscriber ? section : null;
|
|
2485
|
+
}
|
|
2480
2486
|
// Demais seções retornam normalmente
|
|
2481
2487
|
return section;
|
|
2482
2488
|
})
|
package/index.esm.js
CHANGED
|
@@ -2411,9 +2411,9 @@ class ShopSettings extends BaseModel {
|
|
|
2411
2411
|
if (section.type === ShopPageSectionType.CAROUSEL && Array.isArray(section.banners)) {
|
|
2412
2412
|
const filteredBanners = section.banners.filter((banner) => {
|
|
2413
2413
|
// Filtra por displayRules
|
|
2414
|
-
const rulesMatch = banner.displayRules
|
|
2415
|
-
? Object.keys(
|
|
2416
|
-
:
|
|
2414
|
+
const rulesMatch = banner.displayRules.length
|
|
2415
|
+
? banner.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2416
|
+
: true;
|
|
2417
2417
|
// Filtra por publishDate e expirationDate
|
|
2418
2418
|
const publishOk = !banner.publishDate || now >= new Date(banner.publishDate);
|
|
2419
2419
|
const expireOk = !banner.expirationDate || now <= new Date(banner.expirationDate);
|
|
@@ -2425,27 +2425,30 @@ class ShopSettings extends BaseModel {
|
|
|
2425
2425
|
if (section.type === ShopPageSectionType.HIGHLIGHTS && Array.isArray(section.highlights)) {
|
|
2426
2426
|
const filteredHighlights = section.highlights.filter((highlight) => {
|
|
2427
2427
|
// Filtra por displayRules
|
|
2428
|
-
const rulesMatch = highlight.displayRules
|
|
2429
|
-
? Object.keys(
|
|
2430
|
-
:
|
|
2428
|
+
const rulesMatch = highlight.displayRules.length
|
|
2429
|
+
? highlight.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2430
|
+
: true;
|
|
2431
2431
|
return rulesMatch;
|
|
2432
2432
|
});
|
|
2433
|
-
|
|
2433
|
+
const sortedHighlights = !displayRules.beautyProfile
|
|
2434
|
+
? filteredHighlights.sort((a, b) => (a.starred === b.starred ? 0 : a.starred ? -1 : 1))
|
|
2435
|
+
: filteredHighlights;
|
|
2436
|
+
return { ...section, highlights: sortedHighlights };
|
|
2434
2437
|
}
|
|
2435
2438
|
// Filtra collections
|
|
2436
2439
|
if (section.type === ShopPageSectionType.COLLECTION) {
|
|
2437
|
-
const rulesMatch = section.displayRules
|
|
2438
|
-
? Object.keys(
|
|
2439
|
-
:
|
|
2440
|
+
const rulesMatch = section.displayRules.length
|
|
2441
|
+
? section.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2442
|
+
: true;
|
|
2440
2443
|
const publishOk = !section.publishDate || now >= new Date(section.publishDate);
|
|
2441
2444
|
const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
|
|
2442
2445
|
return rulesMatch && publishOk && expireOk ? section : null;
|
|
2443
2446
|
}
|
|
2444
2447
|
// Filtra banners
|
|
2445
2448
|
if (section.type === ShopPageSectionType.BANNER) {
|
|
2446
|
-
const rulesMatch = section.displayRules
|
|
2447
|
-
? Object.keys(
|
|
2448
|
-
:
|
|
2449
|
+
const rulesMatch = section.displayRules.length
|
|
2450
|
+
? section.displayRules.some((rule) => Object.keys(rule).every((key) => rule[key] === displayRules[key]))
|
|
2451
|
+
: true;
|
|
2449
2452
|
const publishOk = !section.publishDate || now >= new Date(section.publishDate);
|
|
2450
2453
|
const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
|
|
2451
2454
|
return rulesMatch && publishOk && expireOk ? section : null;
|
|
@@ -2453,6 +2456,9 @@ class ShopSettings extends BaseModel {
|
|
|
2453
2456
|
if (section.type === ShopPageSectionType.LIVE) {
|
|
2454
2457
|
return section.active ? section : null;
|
|
2455
2458
|
}
|
|
2459
|
+
if (section.type === ShopPageSectionType.PLANS || section.type === ShopPageSectionType.SINGLE_PLAN) {
|
|
2460
|
+
return displayRules.notSubscriber ? section : null;
|
|
2461
|
+
}
|
|
2456
2462
|
// Demais seções retornam normalmente
|
|
2457
2463
|
return section;
|
|
2458
2464
|
})
|