@websolutespa/bom-mixer-models 1.7.3 → 1.7.5
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 +17 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +22 -10
- package/dist/index.mjs +20 -10
- package/package.json +1 -1
- package/src/structured_data/structured_data.ts +26 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-models
|
|
2
2
|
|
|
3
|
+
## 1.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Modified: StructuredData Seo
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @websolutespa/bom-mixer-store@1.7.4
|
|
10
|
+
- @websolutespa/bom-core@1.7.7
|
|
11
|
+
|
|
12
|
+
## 1.7.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Modified: structuredData
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @websolutespa/bom-core@1.7.5
|
|
19
|
+
|
|
3
20
|
## 1.7.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
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,31 +1737,39 @@ 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
|
-
|
|
1744
|
-
|
|
1752
|
+
let pageType = page.schema || "";
|
|
1753
|
+
if (page.template) {
|
|
1754
|
+
pageType = (0, import_bom_core7.asCategoryId)(page.template);
|
|
1755
|
+
}
|
|
1745
1756
|
if (types.article.includes(pageType)) {
|
|
1746
1757
|
schema = {
|
|
1747
1758
|
"@context": "https://schema.org",
|
|
1748
1759
|
"@type": "NewsArticle",
|
|
1749
1760
|
headline: page.title,
|
|
1750
|
-
image: page.media ? [
|
|
1761
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
1751
1762
|
datePublished: page.createdAt,
|
|
1752
1763
|
dateModified: page.updatedAt,
|
|
1753
1764
|
author: [{
|
|
1754
|
-
"@type": "
|
|
1755
|
-
name:
|
|
1756
|
-
|
|
1757
|
-
// url: 'https://twitter.com/autoritadac',
|
|
1765
|
+
"@type": "Person",
|
|
1766
|
+
name: websiteName,
|
|
1767
|
+
url: getPublicUrl()
|
|
1758
1768
|
}]
|
|
1759
1769
|
};
|
|
1760
1770
|
}
|
|
1761
|
-
if (
|
|
1762
|
-
return JSON.stringify(
|
|
1771
|
+
if (schema) {
|
|
1772
|
+
return JSON.stringify(schema);
|
|
1763
1773
|
}
|
|
1764
1774
|
return void 0;
|
|
1765
1775
|
}
|
|
@@ -1831,8 +1841,10 @@ function resolveStructuredData(page, types = DefaultStructuredDataCollections) {
|
|
|
1831
1841
|
redirectTo,
|
|
1832
1842
|
resolveHref,
|
|
1833
1843
|
resolveLabel,
|
|
1844
|
+
resolveMediaSrc,
|
|
1834
1845
|
resolveRoute,
|
|
1835
1846
|
resolveStructuredData,
|
|
1847
|
+
resolveTemplate,
|
|
1836
1848
|
routeInterceptor,
|
|
1837
1849
|
routeRevalidateHandler,
|
|
1838
1850
|
routeToRouteLink,
|
package/dist/index.mjs
CHANGED
|
@@ -1636,31 +1636,39 @@ 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
|
-
|
|
1645
|
-
|
|
1651
|
+
let pageType = page.schema || "";
|
|
1652
|
+
if (page.template) {
|
|
1653
|
+
pageType = asCategoryId2(page.template);
|
|
1654
|
+
}
|
|
1646
1655
|
if (types.article.includes(pageType)) {
|
|
1647
1656
|
schema = {
|
|
1648
1657
|
"@context": "https://schema.org",
|
|
1649
1658
|
"@type": "NewsArticle",
|
|
1650
1659
|
headline: page.title,
|
|
1651
|
-
image: page.media ? [
|
|
1660
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
1652
1661
|
datePublished: page.createdAt,
|
|
1653
1662
|
dateModified: page.updatedAt,
|
|
1654
1663
|
author: [{
|
|
1655
|
-
"@type": "
|
|
1656
|
-
name:
|
|
1657
|
-
|
|
1658
|
-
// url: 'https://twitter.com/autoritadac',
|
|
1664
|
+
"@type": "Person",
|
|
1665
|
+
name: websiteName,
|
|
1666
|
+
url: getPublicUrl()
|
|
1659
1667
|
}]
|
|
1660
1668
|
};
|
|
1661
1669
|
}
|
|
1662
|
-
if (
|
|
1663
|
-
return JSON.stringify(
|
|
1670
|
+
if (schema) {
|
|
1671
|
+
return JSON.stringify(schema);
|
|
1664
1672
|
}
|
|
1665
1673
|
return void 0;
|
|
1666
1674
|
}
|
|
@@ -1731,8 +1739,10 @@ export {
|
|
|
1731
1739
|
redirectTo,
|
|
1732
1740
|
resolveHref,
|
|
1733
1741
|
resolveLabel,
|
|
1742
|
+
resolveMediaSrc,
|
|
1734
1743
|
resolveRoute,
|
|
1735
1744
|
resolveStructuredData,
|
|
1745
|
+
resolveTemplate,
|
|
1736
1746
|
routeInterceptor,
|
|
1737
1747
|
routeRevalidateHandler,
|
|
1738
1748
|
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,27 +83,41 @@ const DefaultStructuredDataCollections: StructuredDataCollections = {
|
|
|
83
83
|
article: ['news_detail'],
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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 {
|
|
99
|
+
let schema: {} | null = null;
|
|
100
|
+
let pageType = page.schema || '';
|
|
101
|
+
if (page.template) {
|
|
102
|
+
pageType = asCategoryId(page.template);
|
|
103
|
+
}
|
|
90
104
|
if (types.article.includes(pageType)) {
|
|
91
105
|
schema = {
|
|
92
106
|
'@context': 'https://schema.org',
|
|
93
107
|
'@type': 'NewsArticle',
|
|
94
108
|
headline: page.title,
|
|
95
|
-
image: page.media ? [
|
|
109
|
+
image: page.media ? [resolveMediaSrc(page.media)] : [],
|
|
96
110
|
datePublished: page.createdAt,
|
|
97
111
|
dateModified: page.updatedAt,
|
|
98
112
|
author: [{
|
|
99
|
-
'@type': '
|
|
100
|
-
name:
|
|
101
|
-
|
|
113
|
+
'@type': 'Person',
|
|
114
|
+
name: websiteName,
|
|
115
|
+
url: getPublicUrl(),
|
|
102
116
|
}],
|
|
103
117
|
} as StructuredDataArticle;
|
|
104
118
|
}
|
|
105
|
-
if (
|
|
106
|
-
return JSON.stringify(
|
|
119
|
+
if (schema) {
|
|
120
|
+
return JSON.stringify(schema);
|
|
107
121
|
}
|
|
108
122
|
return undefined;
|
|
109
123
|
}
|