@websolutespa/bom-mixer-models 1.7.2 → 1.7.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/CHANGELOG.md +216 -208
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -20
- package/dist/index.mjs +13 -17
- package/package.json +1 -1
- package/src/page/page.service.ts +4 -4
- package/src/route/route.interceptor.ts +3 -9
- package/src/sitemap/sitemap.handler.ts +3 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,208 +1,216 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-models
|
|
2
|
-
|
|
3
|
-
## 1.7.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
- Updated dependencies
|
|
9
|
-
- @websolutespa/bom-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## 1.5.
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## 1.5.
|
|
89
|
-
|
|
90
|
-
### Patch Changes
|
|
91
|
-
|
|
92
|
-
- Modified: RouteService
|
|
93
|
-
- Updated dependencies
|
|
94
|
-
- @websolutespa/bom-mixer-store@1.4.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
- @websolutespa/bom-core@0.6.
|
|
104
|
-
|
|
105
|
-
## 1.5.
|
|
106
|
-
|
|
107
|
-
### Patch Changes
|
|
108
|
-
|
|
109
|
-
- Added:
|
|
110
|
-
- Updated dependencies
|
|
111
|
-
- @websolutespa/bom-core@0.6.
|
|
112
|
-
|
|
113
|
-
## 1.5.
|
|
114
|
-
|
|
115
|
-
###
|
|
116
|
-
|
|
117
|
-
- Added
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
1
|
+
# @websolutespa/bom-mixer-models
|
|
2
|
+
|
|
3
|
+
## 1.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added: getOrigin, getHost
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @websolutespa/bom-core@1.7.4
|
|
10
|
+
|
|
11
|
+
## 1.7.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updating: dependencies
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @websolutespa/bom-mixer-store@1.7.3
|
|
18
|
+
- @websolutespa/bom-core@1.7.3
|
|
19
|
+
|
|
20
|
+
## 1.7.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Fixing: findRoute redirects
|
|
25
|
+
|
|
26
|
+
## 1.7.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- 28e86bd: Modified: IPage, Store services & decorators
|
|
31
|
+
- Updated dependencies [28e86bd]
|
|
32
|
+
- @websolutespa/bom-mixer-store@1.7.0
|
|
33
|
+
- @websolutespa/bom-core@1.7.0
|
|
34
|
+
|
|
35
|
+
## 1.6.0
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- f664993: Added: useLivePreview
|
|
40
|
+
- 6707ca2: Fixing LocaleService getLocaleFromProps
|
|
41
|
+
- Updated dependencies [f664993]
|
|
42
|
+
- Updated dependencies [6cbf4cb]
|
|
43
|
+
- @websolutespa/bom-mixer-store@1.4.7
|
|
44
|
+
- @websolutespa/bom-core@0.6.7
|
|
45
|
+
|
|
46
|
+
## 1.5.10
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Added: captions handler
|
|
51
|
+
|
|
52
|
+
## 1.5.9
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Added: lang attribute to sitemap
|
|
57
|
+
|
|
58
|
+
## 1.5.8
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Modified: getBreadcrumbFromSegments, getSeoWeight
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @websolutespa/bom-core@0.6.6
|
|
65
|
+
|
|
66
|
+
## 1.5.7
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Fixing: getDecoratedComponents
|
|
71
|
+
|
|
72
|
+
## 1.5.6
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Added: SeoService
|
|
77
|
+
- Modified: IFeatureType, PageService, RedirectService, RouteService
|
|
78
|
+
- Updated dependencies
|
|
79
|
+
- @websolutespa/bom-mixer-store@1.4.3
|
|
80
|
+
- @websolutespa/bom-core@0.6.5
|
|
81
|
+
|
|
82
|
+
## 1.5.5
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Modified: RouteInterceptor
|
|
87
|
+
|
|
88
|
+
## 1.5.4
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Modified: PageService, RouteInterceptor, RouteService, StructuredData
|
|
93
|
+
- Updated dependencies
|
|
94
|
+
- @websolutespa/bom-mixer-store@1.4.3
|
|
95
|
+
|
|
96
|
+
## 1.5.3
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- Modified: RouteService
|
|
101
|
+
- Updated dependencies
|
|
102
|
+
- @websolutespa/bom-mixer-store@1.4.1
|
|
103
|
+
- @websolutespa/bom-core@0.6.3
|
|
104
|
+
|
|
105
|
+
## 1.5.2
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Added: StructuredData
|
|
110
|
+
- Updated dependencies
|
|
111
|
+
- @websolutespa/bom-core@0.6.2
|
|
112
|
+
|
|
113
|
+
## 1.5.1
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Added: defaultMarket, defaultLocale
|
|
118
|
+
- Updated dependencies [dad63747]
|
|
119
|
+
- @websolutespa/bom-core@0.6.1
|
|
120
|
+
|
|
121
|
+
## 1.5.0
|
|
122
|
+
|
|
123
|
+
### Minor Changes
|
|
124
|
+
|
|
125
|
+
- Added getDecoratedComponents, getPageProps
|
|
126
|
+
|
|
127
|
+
## 1.4.0
|
|
128
|
+
|
|
129
|
+
### Minor Changes
|
|
130
|
+
|
|
131
|
+
- Modified: RouteService, LayoutService
|
|
132
|
+
|
|
133
|
+
## 1.3.0
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- Added: ILazyProps, ILazyableProps, ILazyedProps
|
|
138
|
+
|
|
139
|
+
## 1.2.1
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Added: IAppProps, ILazyProps
|
|
144
|
+
|
|
145
|
+
## 1.2.0
|
|
146
|
+
|
|
147
|
+
### Minor Changes
|
|
148
|
+
|
|
149
|
+
- Updating: next 13
|
|
150
|
+
|
|
151
|
+
## 1.1.0
|
|
152
|
+
|
|
153
|
+
### Minor Changes
|
|
154
|
+
|
|
155
|
+
- Added: storeApi
|
|
156
|
+
- Modified: SiteMapService
|
|
157
|
+
|
|
158
|
+
## 1.0.1
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- Added: env ROOT_CATEGORY
|
|
163
|
+
|
|
164
|
+
## 0.5.0
|
|
165
|
+
|
|
166
|
+
### Minor Changes
|
|
167
|
+
|
|
168
|
+
- Modified routes, added redirects
|
|
169
|
+
|
|
170
|
+
## 0.4.2
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- Fixing: avoid categories circular reference
|
|
175
|
+
|
|
176
|
+
## 0.4.1
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- Added: source files
|
|
181
|
+
|
|
182
|
+
## 0.4.0
|
|
183
|
+
|
|
184
|
+
### Minor Changes
|
|
185
|
+
|
|
186
|
+
- Added: splat routes
|
|
187
|
+
|
|
188
|
+
## 0.3.0
|
|
189
|
+
|
|
190
|
+
### Minor Changes
|
|
191
|
+
|
|
192
|
+
- Added: @websolutespa/bom-core
|
|
193
|
+
|
|
194
|
+
## 0.2.0
|
|
195
|
+
|
|
196
|
+
### Minor Changes
|
|
197
|
+
|
|
198
|
+
- Added: LazyComponent Types
|
|
199
|
+
|
|
200
|
+
## 0.1.1
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- Modified: page service
|
|
205
|
+
|
|
206
|
+
## 0.1.0
|
|
207
|
+
|
|
208
|
+
### Minor Changes
|
|
209
|
+
|
|
210
|
+
- mock refactor
|
|
211
|
+
|
|
212
|
+
## 0.0.2
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- Added: first release
|
package/dist/index.d.ts
CHANGED
|
@@ -286,7 +286,7 @@ declare function getErrorPageLayout(): Promise<{
|
|
|
286
286
|
}>;
|
|
287
287
|
type PartialPageProps<T extends ICategorized, B> = Omit<PageProps<T>, 'page'> & Partial<Pick<PageProps<T>, 'page'>> & B;
|
|
288
288
|
declare function getPageProps<T extends ICategorized, B = any>(props: PartialPageProps<T, B>): Promise<PageProps<T> & B>;
|
|
289
|
-
declare function
|
|
289
|
+
declare function getPublicUrl(): string;
|
|
290
290
|
declare function resolveHref(href?: string): string;
|
|
291
291
|
|
|
292
292
|
declare const getPreviewProps: GetServerSideProps;
|
|
@@ -430,4 +430,4 @@ type StructuredDataKeys = 'article';
|
|
|
430
430
|
type StructuredDataCollections = Record<StructuredDataKeys, string[]>;
|
|
431
431
|
declare function resolveStructuredData(page: IPage, types?: StructuredDataCollections): string | undefined;
|
|
432
432
|
|
|
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,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,6 @@ __export(src_exports, {
|
|
|
53
53
|
getMenus: () => getMenus,
|
|
54
54
|
getOrder: () => getOrder,
|
|
55
55
|
getOrders: () => getOrders,
|
|
56
|
-
getOrigin: () => getOrigin,
|
|
57
56
|
getPage: () => getPage,
|
|
58
57
|
getPageCategory: () => getPageCategory,
|
|
59
58
|
getPageProps: () => getPageProps,
|
|
@@ -63,6 +62,7 @@ __export(src_exports, {
|
|
|
63
62
|
getPreviewProps: () => getPreviewProps,
|
|
64
63
|
getProvince: () => getProvince,
|
|
65
64
|
getProvinces: () => getProvinces,
|
|
65
|
+
getPublicUrl: () => getPublicUrl,
|
|
66
66
|
getRedirect: () => getRedirect,
|
|
67
67
|
getRedirects: () => getRedirects,
|
|
68
68
|
getRegion: () => getRegion,
|
|
@@ -1300,12 +1300,12 @@ async function getPageProps(props) {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
return (0, import_bom_core3.asServerProps)(props);
|
|
1302
1302
|
}
|
|
1303
|
-
function
|
|
1304
|
-
const
|
|
1305
|
-
return
|
|
1303
|
+
function getPublicUrl() {
|
|
1304
|
+
const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : "";
|
|
1305
|
+
return publicUrl;
|
|
1306
1306
|
}
|
|
1307
1307
|
function resolveHref(href = "") {
|
|
1308
|
-
return href.startsWith("http") ? href : `${
|
|
1308
|
+
return href.startsWith("http") ? href : `${getPublicUrl()}${href}`;
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
1311
|
// src/preview/preview.handler.ts
|
|
@@ -1370,6 +1370,7 @@ function routeRevalidateHandler() {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
|
|
1372
1372
|
// src/route/route.interceptor.ts
|
|
1373
|
+
var import_bom_core4 = require("@websolutespa/bom-core");
|
|
1373
1374
|
var import_bom_mixer_store16 = require("@websolutespa/bom-mixer-store");
|
|
1374
1375
|
var import_server = require("next/server");
|
|
1375
1376
|
async function routeInterceptor(request, next) {
|
|
@@ -1412,8 +1413,8 @@ async function routeInterceptor(request, next) {
|
|
|
1412
1413
|
function getHrefBeforeRedirect(request) {
|
|
1413
1414
|
let hrefBeforeRedirect = null;
|
|
1414
1415
|
const urlBeforeRedirect = request.nextUrl.clone();
|
|
1415
|
-
const host = request.headers
|
|
1416
|
-
if (
|
|
1416
|
+
const host = (0, import_bom_core4.getHost)(request.headers);
|
|
1417
|
+
if (host) {
|
|
1417
1418
|
urlBeforeRedirect.host = host;
|
|
1418
1419
|
urlBeforeRedirect.port = host.split(":")[1] || "";
|
|
1419
1420
|
hrefBeforeRedirect = urlBeforeRedirect.href;
|
|
@@ -1430,8 +1431,11 @@ var getSeoWeight = (index = 0, seoWeight) => {
|
|
|
1430
1431
|
return getter;
|
|
1431
1432
|
};
|
|
1432
1433
|
|
|
1434
|
+
// src/sitemap/sitemap.handler.ts
|
|
1435
|
+
var import_bom_core6 = require("@websolutespa/bom-core");
|
|
1436
|
+
|
|
1433
1437
|
// src/sitemap/sitemap.service.ts
|
|
1434
|
-
var
|
|
1438
|
+
var import_bom_core5 = require("@websolutespa/bom-core");
|
|
1435
1439
|
async function getSiteMapIndex(origin) {
|
|
1436
1440
|
let markets = await getMarkets();
|
|
1437
1441
|
let locales = await getLocales();
|
|
@@ -1442,7 +1446,7 @@ async function getSiteMapIndex(origin) {
|
|
|
1442
1446
|
const getTime = (date) => {
|
|
1443
1447
|
return typeof date !== "undefined" ? (typeof date === "string" ? new Date(date) : date).getTime() : 0;
|
|
1444
1448
|
};
|
|
1445
|
-
(0,
|
|
1449
|
+
(0, import_bom_core5.eachMarketLocale)(markets, locales, (market, locale, markets2, locales2) => {
|
|
1446
1450
|
const sitemapRoutes = routes.filter((x) => x.market === market.id && x.locale === locale.id);
|
|
1447
1451
|
sitemapRoutes.sort((a, b) => getTime(a.updatedAt) - getTime(b.updatedAt));
|
|
1448
1452
|
sitemaps.push({
|
|
@@ -1687,17 +1691,9 @@ async function getSiteMapXSL(localeId) {
|
|
|
1687
1691
|
}
|
|
1688
1692
|
|
|
1689
1693
|
// src/sitemap/sitemap.handler.ts
|
|
1690
|
-
var ORIGIN = process.env.NEXT_PUBLIC_URL || "";
|
|
1691
|
-
function getOrigin2(host) {
|
|
1692
|
-
if (host) {
|
|
1693
|
-
return host.indexOf("localhost") !== -1 ? "http://" + host : "https://" + host;
|
|
1694
|
-
} else {
|
|
1695
|
-
return ORIGIN;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
1694
|
var getSiteMapIndexProps = async (context) => {
|
|
1699
1695
|
const { req, res } = context;
|
|
1700
|
-
const sitemap = await getSiteMapIndex(
|
|
1696
|
+
const sitemap = await getSiteMapIndex((0, import_bom_core6.getOrigin)(req.headers));
|
|
1701
1697
|
res.setHeader("Content-Type", "application/xml; charset=UTF-8");
|
|
1702
1698
|
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
|
1703
1699
|
res.setHeader("X-Robots-Tag", "noindex, follow");
|
|
@@ -1712,7 +1708,7 @@ var getSiteMapXMLProps = async (context) => {
|
|
|
1712
1708
|
const params = context.params;
|
|
1713
1709
|
const market = params?.market;
|
|
1714
1710
|
const locale = params?.locale;
|
|
1715
|
-
const sitemap = await getSiteMapXML(
|
|
1711
|
+
const sitemap = await getSiteMapXML((0, import_bom_core6.getOrigin)(req.headers), market, locale);
|
|
1716
1712
|
res.setHeader("Content-Type", "application/xml; charset=UTF-8");
|
|
1717
1713
|
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
|
1718
1714
|
res.setHeader("X-Robots-Tag", "noindex, follow");
|
|
@@ -1802,7 +1798,6 @@ function resolveStructuredData(page, types = DefaultStructuredDataCollections) {
|
|
|
1802
1798
|
getMenus,
|
|
1803
1799
|
getOrder,
|
|
1804
1800
|
getOrders,
|
|
1805
|
-
getOrigin,
|
|
1806
1801
|
getPage,
|
|
1807
1802
|
getPageCategory,
|
|
1808
1803
|
getPageProps,
|
|
@@ -1812,6 +1807,7 @@ function resolveStructuredData(page, types = DefaultStructuredDataCollections) {
|
|
|
1812
1807
|
getPreviewProps,
|
|
1813
1808
|
getProvince,
|
|
1814
1809
|
getProvinces,
|
|
1810
|
+
getPublicUrl,
|
|
1815
1811
|
getRedirect,
|
|
1816
1812
|
getRedirects,
|
|
1817
1813
|
getRegion,
|
package/dist/index.mjs
CHANGED
|
@@ -1201,12 +1201,12 @@ async function getPageProps(props) {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
return asServerProps(props);
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
const
|
|
1206
|
-
return
|
|
1204
|
+
function getPublicUrl() {
|
|
1205
|
+
const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : "";
|
|
1206
|
+
return publicUrl;
|
|
1207
1207
|
}
|
|
1208
1208
|
function resolveHref(href = "") {
|
|
1209
|
-
return href.startsWith("http") ? href : `${
|
|
1209
|
+
return href.startsWith("http") ? href : `${getPublicUrl()}${href}`;
|
|
1210
1210
|
}
|
|
1211
1211
|
|
|
1212
1212
|
// src/preview/preview.handler.ts
|
|
@@ -1271,6 +1271,7 @@ function routeRevalidateHandler() {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
|
|
1273
1273
|
// src/route/route.interceptor.ts
|
|
1274
|
+
import { getHost } from "@websolutespa/bom-core";
|
|
1274
1275
|
import { StoreStrategy, localApiPost, storeApiPost, storeStrategy } from "@websolutespa/bom-mixer-store";
|
|
1275
1276
|
import { NextResponse } from "next/server";
|
|
1276
1277
|
async function routeInterceptor(request, next) {
|
|
@@ -1313,8 +1314,8 @@ async function routeInterceptor(request, next) {
|
|
|
1313
1314
|
function getHrefBeforeRedirect(request) {
|
|
1314
1315
|
let hrefBeforeRedirect = null;
|
|
1315
1316
|
const urlBeforeRedirect = request.nextUrl.clone();
|
|
1316
|
-
const host = request.headers
|
|
1317
|
-
if (
|
|
1317
|
+
const host = getHost(request.headers);
|
|
1318
|
+
if (host) {
|
|
1318
1319
|
urlBeforeRedirect.host = host;
|
|
1319
1320
|
urlBeforeRedirect.port = host.split(":")[1] || "";
|
|
1320
1321
|
hrefBeforeRedirect = urlBeforeRedirect.href;
|
|
@@ -1331,6 +1332,9 @@ var getSeoWeight = (index = 0, seoWeight) => {
|
|
|
1331
1332
|
return getter;
|
|
1332
1333
|
};
|
|
1333
1334
|
|
|
1335
|
+
// src/sitemap/sitemap.handler.ts
|
|
1336
|
+
import { getOrigin } from "@websolutespa/bom-core";
|
|
1337
|
+
|
|
1334
1338
|
// src/sitemap/sitemap.service.ts
|
|
1335
1339
|
import { eachMarketLocale } from "@websolutespa/bom-core";
|
|
1336
1340
|
async function getSiteMapIndex(origin) {
|
|
@@ -1588,17 +1592,9 @@ async function getSiteMapXSL(localeId) {
|
|
|
1588
1592
|
}
|
|
1589
1593
|
|
|
1590
1594
|
// src/sitemap/sitemap.handler.ts
|
|
1591
|
-
var ORIGIN = process.env.NEXT_PUBLIC_URL || "";
|
|
1592
|
-
function getOrigin2(host) {
|
|
1593
|
-
if (host) {
|
|
1594
|
-
return host.indexOf("localhost") !== -1 ? "http://" + host : "https://" + host;
|
|
1595
|
-
} else {
|
|
1596
|
-
return ORIGIN;
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
1595
|
var getSiteMapIndexProps = async (context) => {
|
|
1600
1596
|
const { req, res } = context;
|
|
1601
|
-
const sitemap = await getSiteMapIndex(
|
|
1597
|
+
const sitemap = await getSiteMapIndex(getOrigin(req.headers));
|
|
1602
1598
|
res.setHeader("Content-Type", "application/xml; charset=UTF-8");
|
|
1603
1599
|
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
|
1604
1600
|
res.setHeader("X-Robots-Tag", "noindex, follow");
|
|
@@ -1613,7 +1609,7 @@ var getSiteMapXMLProps = async (context) => {
|
|
|
1613
1609
|
const params = context.params;
|
|
1614
1610
|
const market = params?.market;
|
|
1615
1611
|
const locale = params?.locale;
|
|
1616
|
-
const sitemap = await getSiteMapXML(
|
|
1612
|
+
const sitemap = await getSiteMapXML(getOrigin(req.headers), market, locale);
|
|
1617
1613
|
res.setHeader("Content-Type", "application/xml; charset=UTF-8");
|
|
1618
1614
|
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
|
1619
1615
|
res.setHeader("X-Robots-Tag", "noindex, follow");
|
|
@@ -1702,7 +1698,6 @@ export {
|
|
|
1702
1698
|
getMenus,
|
|
1703
1699
|
getOrder,
|
|
1704
1700
|
getOrders,
|
|
1705
|
-
getOrigin,
|
|
1706
1701
|
getPage,
|
|
1707
1702
|
getPageCategory,
|
|
1708
1703
|
getPageProps,
|
|
@@ -1712,6 +1707,7 @@ export {
|
|
|
1712
1707
|
getPreviewProps,
|
|
1713
1708
|
getProvince,
|
|
1714
1709
|
getProvinces,
|
|
1710
|
+
getPublicUrl,
|
|
1715
1711
|
getRedirect,
|
|
1716
1712
|
getRedirects,
|
|
1717
1713
|
getRegion,
|
package/package.json
CHANGED
package/src/page/page.service.ts
CHANGED
|
@@ -198,11 +198,11 @@ export async function getPageProps<T extends ICategorized, B = any>(props: Parti
|
|
|
198
198
|
return asServerProps(props) as PageProps<T> & B;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
export function
|
|
202
|
-
const
|
|
203
|
-
return
|
|
201
|
+
export function getPublicUrl() {
|
|
202
|
+
const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : '';
|
|
203
|
+
return publicUrl;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export function resolveHref(href: string = '') {
|
|
207
|
-
return href.startsWith('http') ? href : `${
|
|
207
|
+
return href.startsWith('http') ? href : `${getPublicUrl()}${href}`;
|
|
208
208
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRoute } from '@websolutespa/bom-core';
|
|
1
|
+
import { IRoute, getHost } from '@websolutespa/bom-core';
|
|
2
2
|
import { StoreStrategy, localApiPost, storeApiPost, storeStrategy } from '@websolutespa/bom-mixer-store';
|
|
3
3
|
import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
|
|
4
4
|
import { resolveRoute } from './route.service';
|
|
@@ -51,17 +51,11 @@ export async function routeInterceptor(request: NextRequest, next: NextFetchEven
|
|
|
51
51
|
function getHrefBeforeRedirect(request: NextRequest): string | null {
|
|
52
52
|
let hrefBeforeRedirect: string | null = null;
|
|
53
53
|
const urlBeforeRedirect = request.nextUrl.clone();
|
|
54
|
-
const host = request.headers
|
|
55
|
-
if (
|
|
54
|
+
const host = getHost(request.headers);
|
|
55
|
+
if (host) {
|
|
56
56
|
urlBeforeRedirect.host = host;
|
|
57
57
|
urlBeforeRedirect.port = host.split(':')[1] || '';
|
|
58
58
|
hrefBeforeRedirect = urlBeforeRedirect.href;
|
|
59
59
|
}
|
|
60
|
-
/*
|
|
61
|
-
console.log('urlBeforeRedirect', urlBeforeRedirect.href);
|
|
62
|
-
console.log('url', request.url);
|
|
63
|
-
console.log('nextUrl', request.nextUrl.href, 'origin', request.nextUrl.origin);
|
|
64
|
-
console.log('host', request.headers.get('host'), 'referer', request.headers.get('referer'));
|
|
65
|
-
*/
|
|
66
60
|
return hrefBeforeRedirect;
|
|
67
61
|
}
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import { IContextParams } from '@websolutespa/bom-core';
|
|
1
|
+
import { IContextParams, getOrigin } from '@websolutespa/bom-core';
|
|
2
2
|
import { GetServerSideProps } from 'next';
|
|
3
3
|
import { getSiteMapIndex, getSiteMapXML, getSiteMapXSL } from './sitemap.service';
|
|
4
4
|
|
|
5
|
-
const ORIGIN = process.env.NEXT_PUBLIC_URL || '';
|
|
6
|
-
|
|
7
|
-
function getOrigin(host?: string): string {
|
|
8
|
-
if (host) {
|
|
9
|
-
return host.indexOf('localhost') !== -1 ? 'http://' + host : 'https://' + host;
|
|
10
|
-
} else {
|
|
11
|
-
return ORIGIN;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
5
|
export const getSiteMapIndexProps: GetServerSideProps = async (context) => {
|
|
16
6
|
const { req, res } = context;
|
|
17
7
|
// console.log('getSiteMapIndexProps', req.headers.location, req.headers.host, req.headers.origin, req.headers.protocol);
|
|
18
|
-
const sitemap = await getSiteMapIndex(getOrigin(req.headers
|
|
8
|
+
const sitemap = await getSiteMapIndex(getOrigin(req.headers));
|
|
19
9
|
res.setHeader('Content-Type', 'application/xml; charset=UTF-8');
|
|
20
10
|
res.setHeader('X-Frame-Options', 'SAMEORIGIN');
|
|
21
11
|
res.setHeader('X-Robots-Tag', 'noindex, follow');
|
|
@@ -32,7 +22,7 @@ export const getSiteMapXMLProps: GetServerSideProps = async (context) => {
|
|
|
32
22
|
const params = context.params as IContextParams;
|
|
33
23
|
const market = params?.market;
|
|
34
24
|
const locale = params?.locale;
|
|
35
|
-
const sitemap = await getSiteMapXML(getOrigin(req.headers
|
|
25
|
+
const sitemap = await getSiteMapXML(getOrigin(req.headers), market, locale);
|
|
36
26
|
res.setHeader('Content-Type', 'application/xml; charset=UTF-8');
|
|
37
27
|
res.setHeader('X-Frame-Options', 'SAMEORIGIN');
|
|
38
28
|
res.setHeader('X-Robots-Tag', 'noindex, follow');
|