@quintype/framework 7.30.4-collection-preview.1 → 7.30.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 +7 -0
- package/package.json +3 -3
- package/server/data-loader-helpers.js +1 -4
- package/server/generate-routes.js +90 -103
- package/test/unit/generate-routes-test.js +16 -326
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.30.4](https://github.com/quintype/quintype-node-framework/compare/v7.30.3...v7.30.4) (2024-10-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **publish time:** fix amp publish time ([#441](https://github.com/quintype/quintype-node-framework/issues/441)) ([fe22c6b](https://github.com/quintype/quintype-node-framework/commit/fe22c6b78e435b32a03da79bdf616197d4ecdb39))
|
|
11
|
+
|
|
5
12
|
### [7.30.3](https://github.com/quintype/quintype-node-framework/compare/v7.30.2...v7.30.3) (2024-09-30)
|
|
6
13
|
|
|
7
14
|
### [7.30.2](https://github.com/quintype/quintype-node-framework/compare/v7.30.1...v7.30.2) (2024-09-13)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.30.4
|
|
3
|
+
"version": "7.30.4",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
|
-
"@quintype/amp": "^2.19.
|
|
35
|
-
"@quintype/backend": "2.5.
|
|
34
|
+
"@quintype/amp": "^2.19.3",
|
|
35
|
+
"@quintype/backend": "2.5.1",
|
|
36
36
|
"@quintype/components": "^3.5.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
|
38
38
|
"@quintype/seo": "^1.46.1",
|
|
@@ -23,19 +23,16 @@ exports.homeCollectionOrStories = function homeCollectionOrStories(
|
|
|
23
23
|
customLayouts = [],
|
|
24
24
|
defaultNestedLimit = null
|
|
25
25
|
) {
|
|
26
|
-
const {qtInternalAppsKey = "", previewId = "", ...rest} = params || {};
|
|
27
26
|
return Collection.getCollectionBySlug(
|
|
28
27
|
client,
|
|
29
28
|
"home",
|
|
30
|
-
{ "item-type": "collection", ...
|
|
29
|
+
{ "item-type": "collection", ...params },
|
|
31
30
|
{
|
|
32
31
|
depth,
|
|
33
32
|
...(getStoryLimits && { storyLimits: getStoryLimits() }),
|
|
34
33
|
collectionOfCollectionsIndexes,
|
|
35
34
|
customLayouts,
|
|
36
35
|
defaultNestedLimit,
|
|
37
|
-
qtInternalAppsKey,
|
|
38
|
-
previewId
|
|
39
36
|
}
|
|
40
37
|
).then((collection) => {
|
|
41
38
|
if (collection) return collection;
|
|
@@ -10,101 +10,108 @@
|
|
|
10
10
|
// The below code dynamically generates routes based on the config
|
|
11
11
|
// A section sect will generate three urls:
|
|
12
12
|
// /sect, /sect/:storySlug, /sect/*/:storySlug
|
|
13
|
-
const _ = require(
|
|
13
|
+
const _ = require("lodash");
|
|
14
14
|
|
|
15
|
-
let shownDeprecationWarning = false
|
|
16
|
-
function deprecationWarning
|
|
15
|
+
let shownDeprecationWarning = false;
|
|
16
|
+
function deprecationWarning() {
|
|
17
17
|
if (!shownDeprecationWarning) {
|
|
18
18
|
// eslint-disable-next-line no-console
|
|
19
19
|
console.warn(
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
shownDeprecationWarning = true
|
|
20
|
+
"[WARNING] generateSectionPageRoutes and generateStoryPageRoutes are deprecated and will be removed in @quintype/framework v4. Please switch to generateCommonRoutes https://github.com/quintype/quintype-node-framework/blob/master/README.md#switching-to-generatecommonroutes"
|
|
21
|
+
);
|
|
22
|
+
shownDeprecationWarning = true;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
exports.generateSectionPageRoutes = function generateSectionPageRoutes
|
|
27
|
-
|
|
26
|
+
exports.generateSectionPageRoutes = function generateSectionPageRoutes(
|
|
27
|
+
config,
|
|
28
|
+
opts = {}
|
|
29
|
+
) {
|
|
30
|
+
deprecationWarning();
|
|
28
31
|
|
|
29
|
-
const sections = config.getDomainSections(opts.domainSlug)
|
|
32
|
+
const sections = config.getDomainSections(opts.domainSlug);
|
|
30
33
|
|
|
31
34
|
const sectionsById = _(sections).reduce((acc, section) => {
|
|
32
|
-
acc[section.id] = section
|
|
33
|
-
return acc
|
|
34
|
-
}, {})
|
|
35
|
+
acc[section.id] = section;
|
|
36
|
+
return acc;
|
|
37
|
+
}, {});
|
|
35
38
|
|
|
36
39
|
return _(sections)
|
|
37
|
-
.flatMap(section => generateSectionPageRoute(section, sectionsById, opts))
|
|
38
|
-
.value()
|
|
39
|
-
}
|
|
40
|
+
.flatMap((section) => generateSectionPageRoute(section, sectionsById, opts))
|
|
41
|
+
.value();
|
|
42
|
+
};
|
|
40
43
|
|
|
41
|
-
function generateSectionPageRoute
|
|
44
|
+
function generateSectionPageRoute(section, sectionsById, opts) {
|
|
42
45
|
const params = {
|
|
43
46
|
sectionId: section.id,
|
|
44
47
|
...(opts.layoutId && { layoutId: opts.layoutId }),
|
|
45
|
-
...(opts.preview && { preview: true })
|
|
46
|
-
}
|
|
47
|
-
if (section.collection) params.collectionSlug = section.collection.slug
|
|
48
|
-
|
|
49
|
-
let { slug } = section
|
|
50
|
-
|
|
51
|
-
if (section[
|
|
52
|
-
let currentSection = section
|
|
53
|
-
let depth = 0
|
|
54
|
-
while (currentSection[
|
|
55
|
-
currentSection = sectionsById[currentSection[
|
|
56
|
-
slug:
|
|
57
|
-
}
|
|
58
|
-
slug = `${currentSection.slug}/${slug}
|
|
48
|
+
...(opts.preview && { preview: true }),
|
|
49
|
+
};
|
|
50
|
+
if (section.collection) params.collectionSlug = section.collection.slug;
|
|
51
|
+
|
|
52
|
+
let { slug } = section;
|
|
53
|
+
|
|
54
|
+
if (section["parent-id"]) {
|
|
55
|
+
let currentSection = section;
|
|
56
|
+
let depth = 0;
|
|
57
|
+
while (currentSection["parent-id"] && depth++ < 5) {
|
|
58
|
+
currentSection = sectionsById[currentSection["parent-id"]] || {
|
|
59
|
+
slug: "invalid",
|
|
60
|
+
};
|
|
61
|
+
slug = `${currentSection.slug}/${slug}`;
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
let routes = []
|
|
63
|
-
if (section[
|
|
64
|
-
|
|
65
|
+
let routes = [];
|
|
66
|
+
if (section["parent-id"] && opts.secWithoutParentPrefix)
|
|
67
|
+
routes = [section.slug, slug];
|
|
68
|
+
else routes = [slug];
|
|
65
69
|
|
|
66
70
|
if (opts.addSectionPrefix)
|
|
67
|
-
routes = _.flatMap(routes, route => [
|
|
68
|
-
|
|
71
|
+
routes = _.flatMap(routes, (route) => [
|
|
72
|
+
sectionPageRoute(route, params),
|
|
73
|
+
addSectionPrefix(route, params),
|
|
74
|
+
]);
|
|
75
|
+
else routes = _.flatMap(routes, (route) => [sectionPageRoute(route, params)]);
|
|
69
76
|
|
|
70
|
-
return routes
|
|
77
|
+
return routes;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
function addSectionPrefix
|
|
74
|
-
return sectionPageRoute(`section/${route}`, params)
|
|
80
|
+
function addSectionPrefix(route, params) {
|
|
81
|
+
return sectionPageRoute(`section/${route}`, params);
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
function sectionPageRoute
|
|
84
|
+
function sectionPageRoute(route, params) {
|
|
78
85
|
return {
|
|
79
|
-
pageType:
|
|
86
|
+
pageType: "section-page",
|
|
80
87
|
exact: true,
|
|
81
88
|
path: `/${route}`,
|
|
82
|
-
params
|
|
83
|
-
}
|
|
89
|
+
params,
|
|
90
|
+
};
|
|
84
91
|
}
|
|
85
92
|
|
|
86
|
-
exports.generateStoryPageRoutes = function generateStoryPageRoutes
|
|
93
|
+
exports.generateStoryPageRoutes = function generateStoryPageRoutes(
|
|
87
94
|
config,
|
|
88
95
|
{ withoutParentSection, domainSlug, skipPWA } = {}
|
|
89
96
|
) {
|
|
90
|
-
deprecationWarning()
|
|
91
|
-
const sections = config.getDomainSections(domainSlug)
|
|
97
|
+
deprecationWarning();
|
|
98
|
+
const sections = config.getDomainSections(domainSlug);
|
|
92
99
|
return _(sections)
|
|
93
|
-
.filter(section => withoutParentSection || !section[
|
|
94
|
-
.flatMap(section => [
|
|
100
|
+
.filter((section) => withoutParentSection || !section["parent-id"])
|
|
101
|
+
.flatMap((section) => [
|
|
95
102
|
storyPageRoute(`/${section.slug}/:storySlug`, skipPWA || false),
|
|
96
|
-
storyPageRoute(`/${section.slug}/*/:storySlug`, skipPWA || false)
|
|
103
|
+
storyPageRoute(`/${section.slug}/*/:storySlug`, skipPWA || false),
|
|
97
104
|
])
|
|
98
|
-
.value()
|
|
99
|
-
}
|
|
105
|
+
.value();
|
|
106
|
+
};
|
|
100
107
|
|
|
101
|
-
function storyPageRoute
|
|
108
|
+
function storyPageRoute(path, skipPWA = false) {
|
|
102
109
|
return {
|
|
103
|
-
pageType:
|
|
110
|
+
pageType: "story-page",
|
|
104
111
|
exact: true,
|
|
105
112
|
path,
|
|
106
|
-
skipPWA
|
|
107
|
-
}
|
|
113
|
+
skipPWA,
|
|
114
|
+
};
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
/**
|
|
@@ -123,7 +130,7 @@ function storyPageRoute (path, skipPWA = false) {
|
|
|
123
130
|
* @param {boolean} opts.skipPWA.section Skips PWA for section pages
|
|
124
131
|
* @return {Array<module:match-best-route~Route>} Array of created routes
|
|
125
132
|
*/
|
|
126
|
-
exports.generateCommonRoutes = function generateSectionPageRoutes
|
|
133
|
+
exports.generateCommonRoutes = function generateSectionPageRoutes(
|
|
127
134
|
config,
|
|
128
135
|
domainSlug,
|
|
129
136
|
{
|
|
@@ -131,86 +138,66 @@ exports.generateCommonRoutes = function generateSectionPageRoutes (
|
|
|
131
138
|
sectionPageRoutes = allRoutes,
|
|
132
139
|
storyPageRoutes = allRoutes,
|
|
133
140
|
homePageRoute = allRoutes,
|
|
134
|
-
skipPWA = {}
|
|
141
|
+
skipPWA = {},
|
|
135
142
|
} = {}
|
|
136
143
|
) {
|
|
137
|
-
const sections = config.getDomainSections(domainSlug)
|
|
138
|
-
const sectionRoutes = sections.map(s =>
|
|
144
|
+
const sections = config.getDomainSections(domainSlug);
|
|
145
|
+
const sectionRoutes = sections.map((s) =>
|
|
146
|
+
sectionToSectionRoute(config["sketches-host"], s, skipPWA.section || false)
|
|
147
|
+
);
|
|
139
148
|
const storyRoutes = sectionRoutes.map(({ path }) => ({
|
|
140
|
-
path: `${path.replace(/^\/section\//,
|
|
141
|
-
pageType:
|
|
149
|
+
path: `${path.replace(/^\/section\//, "/")}(/.*)?/:storySlug`,
|
|
150
|
+
pageType: "story-page",
|
|
142
151
|
exact: true,
|
|
143
|
-
skipPWA: skipPWA.story || false
|
|
144
|
-
}))
|
|
152
|
+
skipPWA: skipPWA.story || false,
|
|
153
|
+
}));
|
|
145
154
|
return [].concat(
|
|
146
155
|
homePageRoute
|
|
147
156
|
? [
|
|
148
157
|
{
|
|
149
|
-
path:
|
|
150
|
-
pageType:
|
|
158
|
+
path: "/",
|
|
159
|
+
pageType: "home-page",
|
|
151
160
|
exact: true,
|
|
152
161
|
skipPWA: skipPWA.home || false,
|
|
153
162
|
params: {
|
|
154
|
-
collectionSlug: config.getHomeCollectionSlug(domainSlug)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
163
|
+
collectionSlug: config.getHomeCollectionSlug(domainSlug),
|
|
164
|
+
},
|
|
165
|
+
},
|
|
157
166
|
]
|
|
158
167
|
: [],
|
|
159
|
-
[
|
|
160
|
-
{
|
|
161
|
-
path: '/preview/:previewId/collection/home',
|
|
162
|
-
pageType: 'home-page-preview',
|
|
163
|
-
exact: true,
|
|
164
|
-
skipPWA: true,
|
|
165
|
-
params: {
|
|
166
|
-
collectionSlug: config.getHomeCollectionSlug(domainSlug)
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
[
|
|
171
|
-
{
|
|
172
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
173
|
-
pageType: 'collection-page-preview',
|
|
174
|
-
exact: true,
|
|
175
|
-
skipPWA: skipPWA.home || false,
|
|
176
|
-
params: {
|
|
177
|
-
collectionSlug: config.getHomeCollectionSlug(domainSlug)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
168
|
sectionPageRoutes ? sectionRoutes : [],
|
|
182
169
|
storyPageRoutes ? storyRoutes : []
|
|
183
|
-
)
|
|
184
|
-
}
|
|
170
|
+
);
|
|
171
|
+
};
|
|
185
172
|
|
|
186
|
-
function sectionToSectionRoute
|
|
173
|
+
function sectionToSectionRoute(baseUrl, section, skipPWA = false) {
|
|
187
174
|
const params = {
|
|
188
|
-
sectionId: section.id
|
|
189
|
-
}
|
|
175
|
+
sectionId: section.id,
|
|
176
|
+
};
|
|
190
177
|
if (section.collection && section.collection.slug) {
|
|
191
|
-
params.collectionSlug = section.collection.slug
|
|
178
|
+
params.collectionSlug = section.collection.slug;
|
|
192
179
|
}
|
|
193
180
|
|
|
194
181
|
try {
|
|
195
|
-
const sectionUrl = section[
|
|
182
|
+
const sectionUrl = section["section-url"];
|
|
196
183
|
const relativeUrl =
|
|
197
184
|
baseUrl && sectionUrl.startsWith(baseUrl)
|
|
198
185
|
? sectionUrl.slice(baseUrl.length)
|
|
199
|
-
: new URL(section[
|
|
186
|
+
: new URL(section["section-url"]).pathname;
|
|
200
187
|
return {
|
|
201
188
|
path: relativeUrl,
|
|
202
|
-
pageType:
|
|
189
|
+
pageType: "section-page",
|
|
203
190
|
exact: true,
|
|
204
191
|
params,
|
|
205
|
-
skipPWA
|
|
206
|
-
}
|
|
192
|
+
skipPWA,
|
|
193
|
+
};
|
|
207
194
|
} catch (e) {
|
|
208
195
|
return {
|
|
209
196
|
path: `/${section.slug}`,
|
|
210
|
-
pageType:
|
|
197
|
+
pageType: "section-page",
|
|
211
198
|
exact: true,
|
|
212
199
|
params,
|
|
213
|
-
skipPWA
|
|
214
|
-
}
|
|
200
|
+
skipPWA,
|
|
201
|
+
};
|
|
215
202
|
}
|
|
216
203
|
}
|
|
@@ -375,24 +375,7 @@ describe("generateCommonRoutes", function () {
|
|
|
375
375
|
});
|
|
376
376
|
|
|
377
377
|
assert.deepEqual(
|
|
378
|
-
[
|
|
379
|
-
exact: true,
|
|
380
|
-
pageType: 'home-page-preview',
|
|
381
|
-
params: {
|
|
382
|
-
collectionSlug: 'home'
|
|
383
|
-
},
|
|
384
|
-
path: '/preview/:previewId/collection/home',
|
|
385
|
-
skipPWA: true
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
exact: true,
|
|
389
|
-
pageType: 'collection-page-preview',
|
|
390
|
-
params: {
|
|
391
|
-
collectionSlug: 'home'
|
|
392
|
-
},
|
|
393
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
394
|
-
skipPWA: false
|
|
395
|
-
},
|
|
378
|
+
[
|
|
396
379
|
{
|
|
397
380
|
path: "/photos",
|
|
398
381
|
pageType: "section-page",
|
|
@@ -408,24 +391,7 @@ describe("generateCommonRoutes", function () {
|
|
|
408
391
|
);
|
|
409
392
|
|
|
410
393
|
assert.deepEqual(
|
|
411
|
-
[
|
|
412
|
-
exact: true,
|
|
413
|
-
pageType: 'home-page-preview',
|
|
414
|
-
params: {
|
|
415
|
-
collectionSlug: 'home'
|
|
416
|
-
},
|
|
417
|
-
path: '/preview/:previewId/collection/home',
|
|
418
|
-
skipPWA: true
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
exact: true,
|
|
422
|
-
pageType: 'collection-page-preview',
|
|
423
|
-
params: {
|
|
424
|
-
collectionSlug: 'home'
|
|
425
|
-
},
|
|
426
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
427
|
-
skipPWA: false
|
|
428
|
-
},
|
|
394
|
+
[
|
|
429
395
|
{
|
|
430
396
|
path: "/photos(/.*)?/:storySlug",
|
|
431
397
|
pageType: "story-page",
|
|
@@ -448,24 +414,7 @@ describe("generateCommonRoutes", function () {
|
|
|
448
414
|
});
|
|
449
415
|
|
|
450
416
|
assert.deepEqual(
|
|
451
|
-
[
|
|
452
|
-
exact: true,
|
|
453
|
-
pageType: 'home-page-preview',
|
|
454
|
-
params: {
|
|
455
|
-
collectionSlug: 'home'
|
|
456
|
-
},
|
|
457
|
-
path: '/preview/:previewId/collection/home',
|
|
458
|
-
skipPWA: true
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
exact: true,
|
|
462
|
-
pageType: 'collection-page-preview',
|
|
463
|
-
params: {
|
|
464
|
-
collectionSlug: 'home'
|
|
465
|
-
},
|
|
466
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
467
|
-
skipPWA: false
|
|
468
|
-
},
|
|
417
|
+
[
|
|
469
418
|
{
|
|
470
419
|
path: "/photos",
|
|
471
420
|
pageType: "section-page",
|
|
@@ -473,7 +422,6 @@ describe("generateCommonRoutes", function () {
|
|
|
473
422
|
params: { sectionId: 42 },
|
|
474
423
|
skipPWA: true,
|
|
475
424
|
},
|
|
476
|
-
|
|
477
425
|
],
|
|
478
426
|
generateCommonRoutes(config, undefined, {
|
|
479
427
|
allRoutes: false,
|
|
@@ -490,23 +438,6 @@ describe("generateCommonRoutes", function () {
|
|
|
490
438
|
params: { collectionSlug: "home" },
|
|
491
439
|
exact: true,
|
|
492
440
|
skipPWA: true,
|
|
493
|
-
},{
|
|
494
|
-
exact: true,
|
|
495
|
-
pageType: 'home-page-preview',
|
|
496
|
-
params: {
|
|
497
|
-
collectionSlug: 'home'
|
|
498
|
-
},
|
|
499
|
-
path: '/preview/:previewId/collection/home',
|
|
500
|
-
skipPWA: true
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
exact: true,
|
|
504
|
-
pageType: 'collection-page-preview',
|
|
505
|
-
params: {
|
|
506
|
-
collectionSlug: 'home'
|
|
507
|
-
},
|
|
508
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
509
|
-
skipPWA: true
|
|
510
441
|
},
|
|
511
442
|
],
|
|
512
443
|
generateCommonRoutes(config, undefined, {
|
|
@@ -517,24 +448,7 @@ describe("generateCommonRoutes", function () {
|
|
|
517
448
|
);
|
|
518
449
|
|
|
519
450
|
assert.deepEqual(
|
|
520
|
-
[
|
|
521
|
-
exact: true,
|
|
522
|
-
pageType: 'home-page-preview',
|
|
523
|
-
params: {
|
|
524
|
-
collectionSlug: 'home'
|
|
525
|
-
},
|
|
526
|
-
path: '/preview/:previewId/collection/home',
|
|
527
|
-
skipPWA: true
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
exact: true,
|
|
531
|
-
pageType: 'collection-page-preview',
|
|
532
|
-
params: {
|
|
533
|
-
collectionSlug: 'home'
|
|
534
|
-
},
|
|
535
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
536
|
-
skipPWA: false
|
|
537
|
-
},
|
|
451
|
+
[
|
|
538
452
|
{
|
|
539
453
|
path: "/photos(/.*)?/:storySlug",
|
|
540
454
|
pageType: "story-page",
|
|
@@ -562,24 +476,7 @@ describe("generateCommonRoutes", function () {
|
|
|
562
476
|
});
|
|
563
477
|
|
|
564
478
|
assert.deepEqual(
|
|
565
|
-
[
|
|
566
|
-
exact: true,
|
|
567
|
-
pageType: 'home-page-preview',
|
|
568
|
-
params: {
|
|
569
|
-
collectionSlug: 'home'
|
|
570
|
-
},
|
|
571
|
-
path: '/preview/:previewId/collection/home',
|
|
572
|
-
skipPWA: true
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
exact: true,
|
|
576
|
-
pageType: 'collection-page-preview',
|
|
577
|
-
params: {
|
|
578
|
-
collectionSlug: 'home'
|
|
579
|
-
},
|
|
580
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
581
|
-
skipPWA: false
|
|
582
|
-
},
|
|
479
|
+
[
|
|
583
480
|
{
|
|
584
481
|
path: "/photos",
|
|
585
482
|
pageType: "section-page",
|
|
@@ -607,24 +504,7 @@ describe("generateCommonRoutes", function () {
|
|
|
607
504
|
});
|
|
608
505
|
|
|
609
506
|
assert.deepEqual(
|
|
610
|
-
[
|
|
611
|
-
exact: true,
|
|
612
|
-
pageType: 'home-page-preview',
|
|
613
|
-
params: {
|
|
614
|
-
collectionSlug: 'home'
|
|
615
|
-
},
|
|
616
|
-
path: '/preview/:previewId/collection/home',
|
|
617
|
-
skipPWA: true
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
exact: true,
|
|
621
|
-
pageType: 'collection-page-preview',
|
|
622
|
-
params: {
|
|
623
|
-
collectionSlug: 'home'
|
|
624
|
-
},
|
|
625
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
626
|
-
skipPWA: false
|
|
627
|
-
}],
|
|
507
|
+
[],
|
|
628
508
|
generateCommonRoutes(config, null, {
|
|
629
509
|
allRoutes: false,
|
|
630
510
|
sectionPageRoutes: true,
|
|
@@ -632,24 +512,7 @@ describe("generateCommonRoutes", function () {
|
|
|
632
512
|
);
|
|
633
513
|
|
|
634
514
|
assert.deepEqual(
|
|
635
|
-
[
|
|
636
|
-
exact: true,
|
|
637
|
-
pageType: 'home-page-preview',
|
|
638
|
-
params: {
|
|
639
|
-
collectionSlug: 'home'
|
|
640
|
-
},
|
|
641
|
-
path: '/preview/:previewId/collection/home',
|
|
642
|
-
skipPWA: true
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
exact: true,
|
|
646
|
-
pageType: 'collection-page-preview',
|
|
647
|
-
params: {
|
|
648
|
-
collectionSlug: 'home'
|
|
649
|
-
},
|
|
650
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
651
|
-
skipPWA: false
|
|
652
|
-
},
|
|
515
|
+
[
|
|
653
516
|
{
|
|
654
517
|
path: "/photos",
|
|
655
518
|
pageType: "section-page",
|
|
@@ -677,24 +540,7 @@ describe("generateCommonRoutes", function () {
|
|
|
677
540
|
});
|
|
678
541
|
|
|
679
542
|
assert.deepEqual(
|
|
680
|
-
[
|
|
681
|
-
exact: true,
|
|
682
|
-
pageType: 'home-page-preview',
|
|
683
|
-
params: {
|
|
684
|
-
collectionSlug: 'home'
|
|
685
|
-
},
|
|
686
|
-
path: '/preview/:previewId/collection/home',
|
|
687
|
-
skipPWA: true
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
exact: true,
|
|
691
|
-
pageType: 'collection-page-preview',
|
|
692
|
-
params: {
|
|
693
|
-
collectionSlug: 'home'
|
|
694
|
-
},
|
|
695
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
696
|
-
skipPWA: false
|
|
697
|
-
},
|
|
543
|
+
[
|
|
698
544
|
{
|
|
699
545
|
path: "/photos",
|
|
700
546
|
pageType: "section-page",
|
|
@@ -741,24 +587,7 @@ describe("generateCommonRoutes", function () {
|
|
|
741
587
|
});
|
|
742
588
|
|
|
743
589
|
assert.deepEqual(
|
|
744
|
-
[
|
|
745
|
-
exact: true,
|
|
746
|
-
pageType: 'home-page-preview',
|
|
747
|
-
params: {
|
|
748
|
-
collectionSlug: 'home'
|
|
749
|
-
},
|
|
750
|
-
path: '/preview/:previewId/collection/home',
|
|
751
|
-
skipPWA: true
|
|
752
|
-
},
|
|
753
|
-
{
|
|
754
|
-
exact: true,
|
|
755
|
-
pageType: 'collection-page-preview',
|
|
756
|
-
params: {
|
|
757
|
-
collectionSlug: 'home'
|
|
758
|
-
},
|
|
759
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
760
|
-
skipPWA: false
|
|
761
|
-
},
|
|
590
|
+
[
|
|
762
591
|
{
|
|
763
592
|
path: "/section/photos",
|
|
764
593
|
pageType: "section-page",
|
|
@@ -774,24 +603,7 @@ describe("generateCommonRoutes", function () {
|
|
|
774
603
|
);
|
|
775
604
|
|
|
776
605
|
assert.deepEqual(
|
|
777
|
-
[
|
|
778
|
-
exact: true,
|
|
779
|
-
pageType: 'home-page-preview',
|
|
780
|
-
params: {
|
|
781
|
-
collectionSlug: 'home'
|
|
782
|
-
},
|
|
783
|
-
path: '/preview/:previewId/collection/home',
|
|
784
|
-
skipPWA: true
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
exact: true,
|
|
788
|
-
pageType: 'collection-page-preview',
|
|
789
|
-
params: {
|
|
790
|
-
collectionSlug: 'home'
|
|
791
|
-
},
|
|
792
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
793
|
-
skipPWA: false
|
|
794
|
-
},
|
|
606
|
+
[
|
|
795
607
|
{
|
|
796
608
|
path: "/photos(/.*)?/:storySlug",
|
|
797
609
|
pageType: "story-page",
|
|
@@ -810,24 +622,7 @@ describe("generateCommonRoutes", function () {
|
|
|
810
622
|
const config = Config.build({ sections: [{ id: 42, slug: "photos" }] });
|
|
811
623
|
|
|
812
624
|
assert.deepEqual(
|
|
813
|
-
[
|
|
814
|
-
exact: true,
|
|
815
|
-
pageType: 'home-page-preview',
|
|
816
|
-
params: {
|
|
817
|
-
collectionSlug: 'home'
|
|
818
|
-
},
|
|
819
|
-
path: '/preview/:previewId/collection/home',
|
|
820
|
-
skipPWA: true
|
|
821
|
-
},
|
|
822
|
-
{
|
|
823
|
-
exact: true,
|
|
824
|
-
pageType: 'collection-page-preview',
|
|
825
|
-
params: {
|
|
826
|
-
collectionSlug: 'home'
|
|
827
|
-
},
|
|
828
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
829
|
-
skipPWA: false
|
|
830
|
-
},
|
|
625
|
+
[
|
|
831
626
|
{
|
|
832
627
|
path: "/photos(/.*)?/:storySlug",
|
|
833
628
|
pageType: "story-page",
|
|
@@ -842,24 +637,7 @@ describe("generateCommonRoutes", function () {
|
|
|
842
637
|
);
|
|
843
638
|
|
|
844
639
|
assert.deepEqual(
|
|
845
|
-
[
|
|
846
|
-
exact: true,
|
|
847
|
-
pageType: 'home-page-preview',
|
|
848
|
-
params: {
|
|
849
|
-
collectionSlug: 'home'
|
|
850
|
-
},
|
|
851
|
-
path: '/preview/:previewId/collection/home',
|
|
852
|
-
skipPWA: true
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
exact: true,
|
|
856
|
-
pageType: 'collection-page-preview',
|
|
857
|
-
params: {
|
|
858
|
-
collectionSlug: 'home'
|
|
859
|
-
},
|
|
860
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
861
|
-
skipPWA: false
|
|
862
|
-
},
|
|
640
|
+
[
|
|
863
641
|
{
|
|
864
642
|
path: "/photos",
|
|
865
643
|
pageType: "section-page",
|
|
@@ -877,7 +655,7 @@ describe("generateCommonRoutes", function () {
|
|
|
877
655
|
|
|
878
656
|
it("generates the home page route", function () {
|
|
879
657
|
const config = Config.build({
|
|
880
|
-
domains: [{ slug: "sub", "home-collection-id":
|
|
658
|
+
domains: [{ slug: "sub", "home-collection-id": 1234 }],
|
|
881
659
|
sections: [],
|
|
882
660
|
});
|
|
883
661
|
|
|
@@ -890,24 +668,6 @@ describe("generateCommonRoutes", function () {
|
|
|
890
668
|
params: { collectionSlug: "home" },
|
|
891
669
|
skipPWA: false,
|
|
892
670
|
},
|
|
893
|
-
{
|
|
894
|
-
exact: true,
|
|
895
|
-
pageType: 'home-page-preview',
|
|
896
|
-
params: {
|
|
897
|
-
collectionSlug: 'home'
|
|
898
|
-
},
|
|
899
|
-
path: '/preview/:previewId/collection/home',
|
|
900
|
-
skipPWA: true
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
exact: true,
|
|
904
|
-
pageType: 'collection-page-preview',
|
|
905
|
-
params: {
|
|
906
|
-
collectionSlug: 'home'
|
|
907
|
-
},
|
|
908
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
909
|
-
skipPWA: false
|
|
910
|
-
},
|
|
911
671
|
],
|
|
912
672
|
generateCommonRoutes(config, undefined, {
|
|
913
673
|
allRoutes: false,
|
|
@@ -924,24 +684,6 @@ describe("generateCommonRoutes", function () {
|
|
|
924
684
|
params: { collectionSlug: "home" },
|
|
925
685
|
skipPWA: false,
|
|
926
686
|
},
|
|
927
|
-
{
|
|
928
|
-
exact: true,
|
|
929
|
-
pageType: 'home-page-preview',
|
|
930
|
-
params: {
|
|
931
|
-
collectionSlug: 'home'
|
|
932
|
-
},
|
|
933
|
-
path: '/preview/:previewId/collection/home',
|
|
934
|
-
skipPWA: true
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
exact: true,
|
|
938
|
-
pageType: 'collection-page-preview',
|
|
939
|
-
params: {
|
|
940
|
-
collectionSlug: 'home'
|
|
941
|
-
},
|
|
942
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
943
|
-
skipPWA: false
|
|
944
|
-
},
|
|
945
687
|
],
|
|
946
688
|
generateCommonRoutes(config, null, {
|
|
947
689
|
allRoutes: false,
|
|
@@ -955,27 +697,9 @@ describe("generateCommonRoutes", function () {
|
|
|
955
697
|
path: "/",
|
|
956
698
|
pageType: "home-page",
|
|
957
699
|
exact: true,
|
|
958
|
-
params: { collectionSlug: "
|
|
700
|
+
params: { collectionSlug: "1234" },
|
|
959
701
|
skipPWA: false,
|
|
960
702
|
},
|
|
961
|
-
{
|
|
962
|
-
exact: true,
|
|
963
|
-
pageType: 'home-page-preview',
|
|
964
|
-
params: {
|
|
965
|
-
collectionSlug: 'home'
|
|
966
|
-
},
|
|
967
|
-
path: '/preview/:previewId/collection/home',
|
|
968
|
-
skipPWA: true
|
|
969
|
-
},
|
|
970
|
-
{
|
|
971
|
-
exact: true,
|
|
972
|
-
pageType: 'collection-page-preview',
|
|
973
|
-
params: {
|
|
974
|
-
collectionSlug: 'home'
|
|
975
|
-
},
|
|
976
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
977
|
-
skipPWA: false
|
|
978
|
-
},
|
|
979
703
|
],
|
|
980
704
|
generateCommonRoutes(config, "sub", {
|
|
981
705
|
allRoutes: false,
|
|
@@ -996,24 +720,7 @@ describe("generateCommonRoutes", function () {
|
|
|
996
720
|
});
|
|
997
721
|
|
|
998
722
|
assert.deepEqual(
|
|
999
|
-
[
|
|
1000
|
-
exact: true,
|
|
1001
|
-
pageType: 'home-page-preview',
|
|
1002
|
-
params: {
|
|
1003
|
-
collectionSlug: 'home'
|
|
1004
|
-
},
|
|
1005
|
-
path: '/preview/:previewId/collection/home',
|
|
1006
|
-
skipPWA: true
|
|
1007
|
-
},
|
|
1008
|
-
{
|
|
1009
|
-
exact: true,
|
|
1010
|
-
pageType: 'collection-page-preview',
|
|
1011
|
-
params: {
|
|
1012
|
-
collectionSlug: 'home'
|
|
1013
|
-
},
|
|
1014
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
1015
|
-
skipPWA: false
|
|
1016
|
-
},
|
|
723
|
+
[
|
|
1017
724
|
{
|
|
1018
725
|
path: "/photos",
|
|
1019
726
|
pageType: "section-page",
|
|
@@ -1029,24 +736,7 @@ describe("generateCommonRoutes", function () {
|
|
|
1029
736
|
);
|
|
1030
737
|
|
|
1031
738
|
assert.deepEqual(
|
|
1032
|
-
[
|
|
1033
|
-
exact: true,
|
|
1034
|
-
pageType: 'home-page-preview',
|
|
1035
|
-
params: {
|
|
1036
|
-
collectionSlug: 'home'
|
|
1037
|
-
},
|
|
1038
|
-
path: '/preview/:previewId/collection/home',
|
|
1039
|
-
skipPWA: true
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
exact: true,
|
|
1043
|
-
pageType: 'collection-page-preview',
|
|
1044
|
-
params: {
|
|
1045
|
-
collectionSlug: 'home'
|
|
1046
|
-
},
|
|
1047
|
-
path: '/preview/:previewId/collection/:collectionSlug',
|
|
1048
|
-
skipPWA: false
|
|
1049
|
-
},
|
|
739
|
+
[
|
|
1050
740
|
{
|
|
1051
741
|
path: "/photos(/.*)?/:storySlug",
|
|
1052
742
|
pageType: "story-page",
|