@quintype/framework 7.18.0-test-ga.1 → 7.18.0
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 +12 -0
- package/client/start.js +34 -46
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [7.18.0](https://github.com/quintype/quintype-node-framework/compare/v7.15.2...v7.18.0) (2023-01-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **amp:** Decode embed using utf 8 ([#345](https://github.com/quintype/quintype-node-framework/issues/345)) ([4e8a3b3](https://github.com/quintype/quintype-node-framework/commit/4e8a3b38b9be62571f96e69e8b976ff610daf068))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* Amp chartbeat domain ([#344](https://github.com/quintype/quintype-node-framework/issues/344)) ([cbfd2f1](https://github.com/quintype/quintype-node-framework/commit/cbfd2f1a439fffbd4b9ba619d59df0165005a64a))
|
|
16
|
+
|
|
5
17
|
## [7.17.0](https://github.com/quintype/quintype-node-framework/compare/v7.16.1...v7.17.0) (2022-12-21)
|
|
6
18
|
|
|
7
19
|
|
package/client/start.js
CHANGED
|
@@ -55,20 +55,20 @@ function getRouteData(path, { location = global.location, existingFetch, mountAt
|
|
|
55
55
|
const [routeDataPath, relativePath] = getRouteDataAndPath(path, mountAt);
|
|
56
56
|
const url = new URL(relativePath, location.origin);
|
|
57
57
|
return (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
existingFetch ||
|
|
59
|
+
fetch(`${routeDataPath}?path=${encodeURIComponent(url.pathname)}${url.search ? `&${url.search.slice(1)}` : ""}`, {
|
|
60
|
+
credentials: "same-origin",
|
|
61
|
+
})
|
|
62
62
|
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
.then((response) => {
|
|
64
|
+
if (response.status == 404) {
|
|
65
|
+
// There is a chance this might abort
|
|
66
|
+
maybeBypassServiceWorker();
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
return response.json();
|
|
70
|
+
})
|
|
71
|
+
.then(maybeRedirect);
|
|
72
72
|
|
|
73
73
|
function maybeRedirect(page) {
|
|
74
74
|
// This next line aborts the entire load
|
|
@@ -123,7 +123,7 @@ export function navigateToPage(dispatch, path, doNotPushPath) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
Promise.resolve(
|
|
126
|
-
|
|
126
|
+
pickComponentWrapper && pickComponentWrapper.preloadComponent(page.pageType, page.subPageType)
|
|
127
127
|
).then(() => {
|
|
128
128
|
dispatch({
|
|
129
129
|
type: NAVIGATE_TO_PAGE,
|
|
@@ -132,16 +132,6 @@ export function navigateToPage(dispatch, path, doNotPushPath) {
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
if (!doNotPushPath) {
|
|
135
|
-
const title = get(
|
|
136
|
-
page,
|
|
137
|
-
["data", "customSeo", "title"],
|
|
138
|
-
get(page, ["data", "story", "seo", "meta-title"], page.title)
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
if (title) {
|
|
142
|
-
global.document.title = title;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
135
|
history.push({
|
|
146
136
|
pathname,
|
|
147
137
|
search: "",
|
|
@@ -175,10 +165,8 @@ export function maybeNavigateTo(path, store) {
|
|
|
175
165
|
*/
|
|
176
166
|
export function maybeSetUrl(path, title) {
|
|
177
167
|
if (global.location.pathname === path) return;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
global.history.pushState(null, title, path);
|
|
181
|
-
}
|
|
168
|
+
global.history.pushState && global.history.pushState(null, title, path);
|
|
169
|
+
global.document.title = title;
|
|
182
170
|
}
|
|
183
171
|
|
|
184
172
|
/**
|
|
@@ -195,7 +183,7 @@ export function renderComponent(clazz, container, store, props = {}, callback) {
|
|
|
195
183
|
|
|
196
184
|
const containerEle = document.getElementById(container);
|
|
197
185
|
|
|
198
|
-
if
|
|
186
|
+
if(!containerEle){
|
|
199
187
|
console && console.log(`Rendering component on DOM id ${container} FAILED, node not available`);
|
|
200
188
|
return null;
|
|
201
189
|
}
|
|
@@ -218,16 +206,16 @@ export function renderIsomorphicComponent(container, store, pickComponent, props
|
|
|
218
206
|
if (!store.getState().qt.disableIsomorphicComponent) {
|
|
219
207
|
pickComponentWrapper = makePickComponentSync(pickComponent);
|
|
220
208
|
return pickComponentWrapper
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
209
|
+
.preloadComponent(store.getState().qt.pageType, store.getState().qt.subPageType)
|
|
210
|
+
.then(() =>
|
|
211
|
+
renderComponent(
|
|
212
|
+
IsomorphicComponent,
|
|
213
|
+
container,
|
|
214
|
+
store,
|
|
215
|
+
Object.assign({ pickComponent: pickComponentWrapper }, props),
|
|
216
|
+
() => store.dispatch({ type: CLIENT_SIDE_RENDERED })
|
|
217
|
+
)
|
|
218
|
+
);
|
|
231
219
|
}
|
|
232
220
|
console && console.log("IsomorphicComponent is disabled");
|
|
233
221
|
}
|
|
@@ -276,15 +264,15 @@ export function startApp(renderApplication, reducers, opts) {
|
|
|
276
264
|
const path = `${location.pathname}${location.search || ""}`;
|
|
277
265
|
const staticData = global.staticPageStoreContent || getJsonContent("static-page");
|
|
278
266
|
const dataPromise = staticData
|
|
279
|
-
|
|
280
|
-
|
|
267
|
+
? Promise.resolve(staticData.qt)
|
|
268
|
+
: getRouteData(path, { existingFetch: global.initialFetch });
|
|
281
269
|
|
|
282
270
|
startAnalytics();
|
|
283
271
|
|
|
284
272
|
const store = createQtStore(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
273
|
+
reducers,
|
|
274
|
+
(staticData && staticData.qt) || global.initialPage || getJsonContent("initial-page") || {},
|
|
275
|
+
{}
|
|
288
276
|
);
|
|
289
277
|
|
|
290
278
|
if (opts.preRenderApplication) {
|
|
@@ -326,9 +314,9 @@ export function startApp(renderApplication, reducers, opts) {
|
|
|
326
314
|
|
|
327
315
|
if (page.title) {
|
|
328
316
|
global.document.title = get(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
317
|
+
page,
|
|
318
|
+
["data", "customSeo", "title"],
|
|
319
|
+
get(page, ["data", "story", "seo", "meta-title"], page.title)
|
|
332
320
|
);
|
|
333
321
|
}
|
|
334
322
|
return store;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.18.0
|
|
3
|
+
"version": "7.18.0",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
34
|
"@quintype/amp": "^2.9.1",
|
|
35
35
|
"@quintype/backend": "^2.3.3",
|
|
36
|
-
"@quintype/components": "^3.
|
|
36
|
+
"@quintype/components": "^3.3.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
|
38
38
|
"@quintype/seo": "^1.39.0",
|
|
39
39
|
"atob": "^2.1.2",
|