@websolutespa/bom-mixer-models 1.7.3 → 1.7.4
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/CHANGELOG.md +8 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +20 -7
- package/dist/index.mjs +18 -7
- package/package.json +1 -1
- package/src/structured_data/structured_data.ts +23 -8
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -428,6 +428,8 @@ type StructuredDataEvent = {
|
|
|
428
428
|
};
|
|
429
429
|
type StructuredDataKeys = 'article';
|
|
430
430
|
type StructuredDataCollections = Record<StructuredDataKeys, string[]>;
|
|
431
|
-
declare function
|
|
431
|
+
declare function resolveTemplate(value: any): string | undefined;
|
|
432
|
+
declare function resolveMediaSrc(media: IMedia): string | undefined;
|
|
433
|
+
declare function resolveStructuredData(page: IPage, websiteName?: string, types?: StructuredDataCollections): string | undefined;
|
|
432
434
|
|
|
433
|
-
export { IAddress, IAddressOptions, IAppProps, IApplication, IApplicationProps, ICartAddItem, ICartItem, ICheckout, ICheckoutDelivery, ICheckoutDiscount, ICheckoutInfo, ICheckoutItem, ICheckoutPartial, ICheckoutPayment, ICheckoutPaymentRedirect, ICheckoutStore, ICompanyAddress, IFeatureType, IKeyedList, ILazyComponent, ILazyComponentFunc, ILazyComponentProps, ILazyFuncProps, ILazyModules, ILazyProps, ILazyStaticProps, ILazyStaticPropsFunc, ILazyableProps, ILazyedProps, ILink, IList, IModelStore, IOrder, IOrderDetail, IOrderStatus, IOrderStatusValue, ISiteMap, IUser, IUserAddress, IUserChangePassword, IUserForgot, IUserLogin, IUserRegister, LAZY_PROPS, NotFound, PartialPageProps, SeoWeight, StaticPath, StructuredDataAddress, StructuredDataArticle, StructuredDataCollections, StructuredDataEvent, StructuredDataKeys, StructuredDataOffer, StructuredDataOrganization, StructuredDataPerformingGroup, StructuredDataPerson, StructuredDataPlace, categoryToRouteLink, findManyPages, findOnePage, getBreadcrumbFromSegments, getCaptionsVttProps, getCategories, getCategory, getCountries, getCountry, getDecoratedComponents, getDeliveries, getErrorPageLayout, getFeatureType, getFeatureTypes, getInfo, getItems, getLabel, getLabels, getLayout, getListByKeys, getLists, getLocale, getLocaleFromProps, getLocales, getMarket, getMarkets, getMenu, getMenus, getOrder, getOrders, getPage, getPageCategory, getPageProps, getPageRoutes, getPayment, getPayments, getPreviewProps, getProvince, getProvinces, getPublicUrl, getRedirect, getRedirects, getRegion, getRegions, getRoute, getRouteLinkTree, getRoutes, getRoutesForSchemas, getRoutesForTemplates, getSegments, getSeoWeight, getSiteMapIndex, getSiteMapIndexProps, getSiteMapXML, getSiteMapXMLProps, getSiteMapXSL, getSiteMapXSLProps, getStaticPathsForSchema, getStores, newRouteLink, redirectTo, resolveHref, resolveLabel, resolveRoute, resolveStructuredData, routeInterceptor, routeRevalidateHandler, routeToRouteLink, setDiscountCode, updateCheckout, withLazyProps };
|
|
435
|
+
export { IAddress, IAddressOptions, IAppProps, IApplication, IApplicationProps, ICartAddItem, ICartItem, ICheckout, ICheckoutDelivery, ICheckoutDiscount, ICheckoutInfo, ICheckoutItem, ICheckoutPartial, ICheckoutPayment, ICheckoutPaymentRedirect, ICheckoutStore, ICompanyAddress, IFeatureType, IKeyedList, ILazyComponent, ILazyComponentFunc, ILazyComponentProps, ILazyFuncProps, ILazyModules, ILazyProps, ILazyStaticProps, ILazyStaticPropsFunc, ILazyableProps, ILazyedProps, ILink, IList, IModelStore, IOrder, IOrderDetail, IOrderStatus, IOrderStatusValue, ISiteMap, IUser, IUserAddress, IUserChangePassword, IUserForgot, IUserLogin, IUserRegister, LAZY_PROPS, NotFound, PartialPageProps, SeoWeight, StaticPath, StructuredDataAddress, StructuredDataArticle, StructuredDataCollections, StructuredDataEvent, StructuredDataKeys, StructuredDataOffer, StructuredDataOrganization, StructuredDataPerformingGroup, StructuredDataPerson, StructuredDataPlace, categoryToRouteLink, findManyPages, findOnePage, getBreadcrumbFromSegments, getCaptionsVttProps, getCategories, getCategory, getCountries, getCountry, getDecoratedComponents, getDeliveries, getErrorPageLayout, getFeatureType, getFeatureTypes, getInfo, getItems, getLabel, getLabels, getLayout, getListByKeys, getLists, getLocale, getLocaleFromProps, getLocales, getMarket, getMarkets, getMenu, getMenus, getOrder, getOrders, getPage, getPageCategory, getPageProps, getPageRoutes, getPayment, getPayments, getPreviewProps, getProvince, getProvinces, getPublicUrl, getRedirect, getRedirects, getRegion, getRegions, getRoute, getRouteLinkTree, getRoutes, getRoutesForSchemas, getRoutesForTemplates, getSegments, getSeoWeight, getSiteMapIndex, getSiteMapIndexProps, getSiteMapXML, getSiteMapXMLProps, getSiteMapXSL, getSiteMapXSLProps, getStaticPathsForSchema, getStores, newRouteLink, redirectTo, resolveHref, resolveLabel, resolveMediaSrc, resolveRoute, resolveStructuredData, resolveTemplate, routeInterceptor, routeRevalidateHandler, routeToRouteLink, setDiscountCode, updateCheckout, withLazyProps };
|
package/dist/index.js
CHANGED
|
@@ -86,8 +86,10 @@ __export(src_exports, {
|
|
|
86
86
|
redirectTo: () => redirectTo,
|
|
87
87
|
resolveHref: () => resolveHref,
|
|
88
88
|
resolveLabel: () => resolveLabel,
|
|
89
|
+
resolveMediaSrc: () => resolveMediaSrc,
|
|
89
90
|
resolveRoute: () => resolveRoute,
|
|
90
91
|
resolveStructuredData: () => resolveStructuredData,
|
|
92
|
+
resolveTemplate: () => resolveTemplate,
|
|
91
93
|
routeInterceptor: () => routeInterceptor,
|
|
92
94
|
routeRevalidateHandler: () => routeRevalidateHandler,
|
|
93
95
|
routeToRouteLink: () => routeToRouteLink,
|
|
@@ -1735,26 +1737,35 @@ var getSiteMapXSLProps = async (context) => {
|
|
|
1735
1737
|
};
|
|
1736
1738
|
|
|
1737
1739
|
// src/structured_data/structured_data.ts
|
|
1740
|
+
var import_bom_core7 = require("@websolutespa/bom-core");
|
|
1738
1741
|
var DefaultStructuredDataCollections = {
|
|
1739
1742
|
article: ["news_detail"]
|
|
1740
1743
|
};
|
|
1741
|
-
function
|
|
1744
|
+
function resolveTemplate(value) {
|
|
1745
|
+
return (0, import_bom_core7.asCategoryId)(value);
|
|
1746
|
+
}
|
|
1747
|
+
function resolveMediaSrc(media) {
|
|
1748
|
+
return resolveHref(media.src || media.url);
|
|
1749
|
+
}
|
|
1750
|
+
function resolveStructuredData(page, websiteName = "WebsiteName", types = DefaultStructuredDataCollections) {
|
|
1742
1751
|
let schema = null;
|
|
1743
1752
|
const json = null;
|
|
1744
|
-
|
|
1753
|
+
let pageType = page.schema || "";
|
|
1754
|
+
if (page.template) {
|
|
1755
|
+
pageType = (0, import_bom_core7.asCategoryId)(page.template);
|
|
1756
|
+
}
|
|
1745
1757
|
if (types.article.includes(pageType)) {
|
|
1746
1758
|
schema = {
|
|
1747
1759
|
"@context": "https://schema.org",
|
|
1748
1760
|
"@type": "NewsArticle",
|
|
1749
1761
|
headline: page.title,
|
|
1750
|
-
image: page.media ? [
|
|
1762
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
1751
1763
|
datePublished: page.createdAt,
|
|
1752
1764
|
dateModified: page.updatedAt,
|
|
1753
1765
|
author: [{
|
|
1754
|
-
"@type": "
|
|
1755
|
-
name:
|
|
1756
|
-
|
|
1757
|
-
// url: 'https://twitter.com/autoritadac',
|
|
1766
|
+
"@type": "Person",
|
|
1767
|
+
name: websiteName,
|
|
1768
|
+
url: getPublicUrl()
|
|
1758
1769
|
}]
|
|
1759
1770
|
};
|
|
1760
1771
|
}
|
|
@@ -1831,8 +1842,10 @@ function resolveStructuredData(page, types = DefaultStructuredDataCollections) {
|
|
|
1831
1842
|
redirectTo,
|
|
1832
1843
|
resolveHref,
|
|
1833
1844
|
resolveLabel,
|
|
1845
|
+
resolveMediaSrc,
|
|
1834
1846
|
resolveRoute,
|
|
1835
1847
|
resolveStructuredData,
|
|
1848
|
+
resolveTemplate,
|
|
1836
1849
|
routeInterceptor,
|
|
1837
1850
|
routeRevalidateHandler,
|
|
1838
1851
|
routeToRouteLink,
|
package/dist/index.mjs
CHANGED
|
@@ -1636,26 +1636,35 @@ var getSiteMapXSLProps = async (context) => {
|
|
|
1636
1636
|
};
|
|
1637
1637
|
|
|
1638
1638
|
// src/structured_data/structured_data.ts
|
|
1639
|
+
import { asCategoryId as asCategoryId2 } from "@websolutespa/bom-core";
|
|
1639
1640
|
var DefaultStructuredDataCollections = {
|
|
1640
1641
|
article: ["news_detail"]
|
|
1641
1642
|
};
|
|
1642
|
-
function
|
|
1643
|
+
function resolveTemplate(value) {
|
|
1644
|
+
return asCategoryId2(value);
|
|
1645
|
+
}
|
|
1646
|
+
function resolveMediaSrc(media) {
|
|
1647
|
+
return resolveHref(media.src || media.url);
|
|
1648
|
+
}
|
|
1649
|
+
function resolveStructuredData(page, websiteName = "WebsiteName", types = DefaultStructuredDataCollections) {
|
|
1643
1650
|
let schema = null;
|
|
1644
1651
|
const json = null;
|
|
1645
|
-
|
|
1652
|
+
let pageType = page.schema || "";
|
|
1653
|
+
if (page.template) {
|
|
1654
|
+
pageType = asCategoryId2(page.template);
|
|
1655
|
+
}
|
|
1646
1656
|
if (types.article.includes(pageType)) {
|
|
1647
1657
|
schema = {
|
|
1648
1658
|
"@context": "https://schema.org",
|
|
1649
1659
|
"@type": "NewsArticle",
|
|
1650
1660
|
headline: page.title,
|
|
1651
|
-
image: page.media ? [
|
|
1661
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
1652
1662
|
datePublished: page.createdAt,
|
|
1653
1663
|
dateModified: page.updatedAt,
|
|
1654
1664
|
author: [{
|
|
1655
|
-
"@type": "
|
|
1656
|
-
name:
|
|
1657
|
-
|
|
1658
|
-
// url: 'https://twitter.com/autoritadac',
|
|
1665
|
+
"@type": "Person",
|
|
1666
|
+
name: websiteName,
|
|
1667
|
+
url: getPublicUrl()
|
|
1659
1668
|
}]
|
|
1660
1669
|
};
|
|
1661
1670
|
}
|
|
@@ -1731,8 +1740,10 @@ export {
|
|
|
1731
1740
|
redirectTo,
|
|
1732
1741
|
resolveHref,
|
|
1733
1742
|
resolveLabel,
|
|
1743
|
+
resolveMediaSrc,
|
|
1734
1744
|
resolveRoute,
|
|
1735
1745
|
resolveStructuredData,
|
|
1746
|
+
resolveTemplate,
|
|
1736
1747
|
routeInterceptor,
|
|
1737
1748
|
routeRevalidateHandler,
|
|
1738
1749
|
routeToRouteLink,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IPage } from '@websolutespa/bom-core';
|
|
2
|
-
import { resolveHref } from '../page/page.service';
|
|
1
|
+
import { IMedia, IPage, asCategoryId } from '@websolutespa/bom-core';
|
|
2
|
+
import { getPublicUrl, resolveHref } from '../page/page.service';
|
|
3
3
|
|
|
4
4
|
export type StructuredDataPerson = {
|
|
5
5
|
'@type': 'Person';
|
|
@@ -83,22 +83,37 @@ const DefaultStructuredDataCollections: StructuredDataCollections = {
|
|
|
83
83
|
article: ['news_detail'],
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export function
|
|
86
|
+
export function resolveTemplate(value: any): string | undefined {
|
|
87
|
+
return asCategoryId(value);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function resolveMediaSrc(media: IMedia): string | undefined {
|
|
91
|
+
return resolveHref(media.src || media.url);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function resolveStructuredData(
|
|
95
|
+
page: IPage,
|
|
96
|
+
websiteName = 'WebsiteName',
|
|
97
|
+
types: StructuredDataCollections = DefaultStructuredDataCollections
|
|
98
|
+
): string | undefined {
|
|
87
99
|
let schema = null;
|
|
88
100
|
const json: {} | null = null;
|
|
89
|
-
|
|
101
|
+
let pageType = page.schema || '';
|
|
102
|
+
if (page.template) {
|
|
103
|
+
pageType = asCategoryId(page.template);
|
|
104
|
+
}
|
|
90
105
|
if (types.article.includes(pageType)) {
|
|
91
106
|
schema = {
|
|
92
107
|
'@context': 'https://schema.org',
|
|
93
108
|
'@type': 'NewsArticle',
|
|
94
109
|
headline: page.title,
|
|
95
|
-
image: page.media ? [
|
|
110
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
96
111
|
datePublished: page.createdAt,
|
|
97
112
|
dateModified: page.updatedAt,
|
|
98
113
|
author: [{
|
|
99
|
-
'@type': '
|
|
100
|
-
name:
|
|
101
|
-
|
|
114
|
+
'@type': 'Person',
|
|
115
|
+
name: websiteName,
|
|
116
|
+
url: getPublicUrl(),
|
|
102
117
|
}],
|
|
103
118
|
} as StructuredDataArticle;
|
|
104
119
|
}
|