gatsby-matrix-theme 53.7.0 → 53.7.1
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 +11 -0
- package/package.json +2 -2
- package/src/gatsby-core-theme/helpers/server-data.js +107 -92
- package/storybook/public/{384.e6992774.iframe.bundle.js → 384.9e1fdc9b.iframe.bundle.js} +3 -3
- package/storybook/public/{384.e6992774.iframe.bundle.js.map → 384.9e1fdc9b.iframe.bundle.js.map} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/project.json +1 -1
- /package/storybook/public/{384.e6992774.iframe.bundle.js.LICENSE.txt → 384.9e1fdc9b.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [53.7.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.7.0...v53.7.1) (2025-12-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* search accent sensitivity ([aba1d5c](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/aba1d5c39f0ef6af5ea976b4b48d3dcba81ed580))
|
|
7
|
+
* update gatsby theme version ([2870bd4](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/2870bd40884a5c2be88b83a1478ab24ce6c666ca))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'en-145-search-accent-sensitivity' into 'master' ([0c94845](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/0c94845d49714419b4a31fd5c5e45077be2e91f2))
|
|
11
|
+
|
|
1
12
|
# [53.7.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.6.0...v53.7.0) (2025-11-25)
|
|
2
13
|
|
|
3
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "53.7.
|
|
3
|
+
"version": "53.7.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Matrix Theme NPM Package",
|
|
6
6
|
"author": "",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@react-icons/all-files": "^4.1.0",
|
|
27
27
|
"gatsby": "^5.11.0",
|
|
28
|
-
"gatsby-core-theme": "44.9.
|
|
28
|
+
"gatsby-core-theme": "44.9.2",
|
|
29
29
|
"gatsby-plugin-sharp": "^5.11.0",
|
|
30
30
|
"gatsby-transformer-sharp": "^5.11.0",
|
|
31
31
|
"gatsby-plugin-sitemap": "^6.13.1",
|
|
@@ -7,18 +7,22 @@ import processor from 'gatsby-core-theme/src/resolver/index';
|
|
|
7
7
|
import { fetchSiteSettings } from 'gatsby-core-theme/src/services/fetch.mjs';
|
|
8
8
|
import { getApiQueryParams } from './sportstake';
|
|
9
9
|
import { getApiBasedNames } from './lotto';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getResultsById,
|
|
12
|
+
getLatestResults,
|
|
13
|
+
getAvailableDrawDays,
|
|
14
|
+
getLottoUKdata,
|
|
15
|
+
getCalendarData,
|
|
16
|
+
} from './services';
|
|
11
17
|
import loadSource from '~helpers/search-source';
|
|
12
18
|
import { deparam } from '~helpers/strings';
|
|
13
19
|
import { groupBy } from '~helpers/getters';
|
|
14
20
|
|
|
15
|
-
|
|
16
21
|
export async function getAPIData(page, url, header, preview) {
|
|
17
|
-
|
|
18
22
|
if (preview) {
|
|
19
23
|
const start = new Date();
|
|
20
24
|
const siteName = process.env.GATSBY_SITE_NAME;
|
|
21
|
-
const params = deparam(url.split(
|
|
25
|
+
const params = deparam(url.split('?')[1]);
|
|
22
26
|
|
|
23
27
|
const {
|
|
24
28
|
siteSettingsData,
|
|
@@ -65,15 +69,11 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
65
69
|
const previewPageData = pagePreviewProcessed[0];
|
|
66
70
|
const end = new Date() - start;
|
|
67
71
|
|
|
68
|
-
console.log(
|
|
69
|
-
chalk.green("success") + chalk.whiteBright(` Preview Feature - %ds`),
|
|
70
|
-
end / 1000
|
|
71
|
-
);
|
|
72
|
+
console.log(chalk.green('success') + chalk.whiteBright(` Preview Feature - %ds`), end / 1000);
|
|
72
73
|
return {
|
|
73
74
|
props: {
|
|
74
75
|
marketSections: processed.market_sections[previewPageData.market],
|
|
75
|
-
prefilledModules:
|
|
76
|
-
processed.prefilled_market_modules[previewPageData.market],
|
|
76
|
+
prefilledModules: processed.prefilled_market_modules[previewPageData.market],
|
|
77
77
|
page: previewPageData,
|
|
78
78
|
allMarkets: processed.site_markets,
|
|
79
79
|
siteInfo: processed.general,
|
|
@@ -81,14 +81,17 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
console.log(
|
|
85
|
-
chalk.red("error") +
|
|
86
|
-
chalk.whiteBright(` Preview Page Not Found ${params?.path}`)
|
|
87
|
-
);
|
|
84
|
+
console.log(chalk.red('error') + chalk.whiteBright(` Preview Page Not Found ${params?.path}`));
|
|
88
85
|
|
|
89
86
|
return { props: {} };
|
|
90
87
|
}
|
|
91
88
|
|
|
89
|
+
function normalizeString(str) {
|
|
90
|
+
return str
|
|
91
|
+
.normalize('NFD')
|
|
92
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
93
|
+
.toLowerCase();
|
|
94
|
+
}
|
|
92
95
|
|
|
93
96
|
if (page.path.endsWith('/s') || page.path === 's' || page.template === 'search') {
|
|
94
97
|
const results = await loadSource(page.market);
|
|
@@ -102,7 +105,7 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
102
105
|
? urlParams.hasOwnProperty('s')
|
|
103
106
|
? groupBy(
|
|
104
107
|
results.filter((item) =>
|
|
105
|
-
item.title
|
|
108
|
+
normalizeString(item.title).includes(normalizeString(urlParams.s))
|
|
106
109
|
),
|
|
107
110
|
'pageType'
|
|
108
111
|
)
|
|
@@ -135,15 +138,24 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
135
138
|
'sportstakerugbyfixturesweekend',
|
|
136
139
|
'lotto',
|
|
137
140
|
'daily_lotto',
|
|
138
|
-
'powerball'
|
|
141
|
+
'powerball',
|
|
139
142
|
];
|
|
140
143
|
|
|
141
|
-
const containsFixtures =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
const containsFixtures =
|
|
145
|
+
(page?.categories &&
|
|
146
|
+
page?.categories.filter((category) => category.short_name === 'fixtures')) ||
|
|
147
|
+
[];
|
|
148
|
+
const containsResults =
|
|
149
|
+
(page?.categories &&
|
|
150
|
+
page?.categories.filter((category) => category.short_name === 'results')) ||
|
|
151
|
+
[];
|
|
152
|
+
const containsLotto =
|
|
153
|
+
(page?.categories && page?.categories.filter((category) => category.short_name === 'lotto')) ||
|
|
154
|
+
[];
|
|
155
|
+
const conatinsLottoUK49 =
|
|
156
|
+
(page?.categories &&
|
|
157
|
+
page?.categories.filter((category) => category.short_name === 'lotto_uk_49')) ||
|
|
158
|
+
[];
|
|
147
159
|
let responseFixtures = {};
|
|
148
160
|
let responseResults = {};
|
|
149
161
|
let responseLotto = {};
|
|
@@ -155,50 +167,54 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
155
167
|
);
|
|
156
168
|
|
|
157
169
|
const date = new Date();
|
|
158
|
-
const fixtureData =
|
|
159
|
-
await Promise.all(
|
|
170
|
+
const fixtureData = await Promise.all(
|
|
160
171
|
filteredArray.map(async (module) => {
|
|
161
172
|
const moduleName = module.name;
|
|
162
173
|
// return if fixtures to avoid duplicates
|
|
163
174
|
if (moduleName.includes('results')) return;
|
|
164
175
|
const query = getApiQueryParams(moduleName);
|
|
165
|
-
const month =
|
|
176
|
+
const month = date.getMonth() + 1;
|
|
166
177
|
const previousMonth = month === 1 ? 12 : month - 1;
|
|
167
178
|
|
|
168
179
|
const calendarData = await getCalendarData(query.lotteryName, month, date.getFullYear());
|
|
169
180
|
|
|
170
|
-
const prevMonth =
|
|
181
|
+
const prevMonth =
|
|
182
|
+
calendarData.length <= 2
|
|
183
|
+
? await getCalendarData(query.lotteryName, previousMonth, date.getFullYear())
|
|
184
|
+
: [];
|
|
171
185
|
|
|
172
|
-
const orderedPrevMonth =
|
|
173
|
-
|
|
174
|
-
prevMonth[prevMonth.length - 1],
|
|
175
|
-
|
|
176
|
-
] : prevMonth;
|
|
186
|
+
const orderedPrevMonth =
|
|
187
|
+
calendarData.length === 0
|
|
188
|
+
? [prevMonth[prevMonth.length - 1], ...prevMonth.slice(0, prevMonth.length - 1)]
|
|
189
|
+
: prevMonth;
|
|
177
190
|
|
|
178
191
|
const reorderedResultData = [
|
|
179
192
|
calendarData[calendarData.length - 1],
|
|
180
193
|
...calendarData.slice(0, calendarData.length - 1),
|
|
181
|
-
...orderedPrevMonth
|
|
182
|
-
].filter(item => item && !Array.isArray(item));
|
|
183
|
-
|
|
194
|
+
...orderedPrevMonth,
|
|
195
|
+
].filter((item) => item && !Array.isArray(item));
|
|
196
|
+
|
|
184
197
|
reorderedResultData.sort((a, b) => {
|
|
185
198
|
const dateA = new Date(a.drawDate);
|
|
186
199
|
const dateB = new Date(b.drawDate);
|
|
187
200
|
return dateB.getTime() - dateA.getTime();
|
|
188
201
|
});
|
|
189
202
|
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
reorderedResultData[0] = reorderedResultData[0]
|
|
204
|
+
? // eslint-disable-next-line no-underscore-dangle
|
|
205
|
+
await getResultsById(reorderedResultData[0]._id)
|
|
206
|
+
: {};
|
|
192
207
|
|
|
193
208
|
return { [moduleName]: reorderedResultData };
|
|
194
|
-
|
|
195
|
-
})
|
|
209
|
+
})
|
|
196
210
|
);
|
|
197
211
|
|
|
198
212
|
responseFixtures = {
|
|
199
213
|
data: Object.assign({}, ...fixtureData.filter(Boolean)),
|
|
200
214
|
};
|
|
201
|
-
}else
|
|
215
|
+
} else {
|
|
216
|
+
responseFixtures = { data: [] };
|
|
217
|
+
}
|
|
202
218
|
|
|
203
219
|
if (containsResults.length >= 1) {
|
|
204
220
|
const filteredArray = page?.sections?.main?.modules.filter(
|
|
@@ -206,33 +222,34 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
206
222
|
);
|
|
207
223
|
|
|
208
224
|
const date = new Date();
|
|
209
|
-
const resultData =
|
|
210
|
-
await Promise.all(
|
|
225
|
+
const resultData = await Promise.all(
|
|
211
226
|
filteredArray.map(async (module) => {
|
|
212
227
|
const moduleName = module.name;
|
|
213
228
|
// return if fixtures to avoid duplicates
|
|
214
229
|
if (moduleName.includes('fixtures')) return;
|
|
215
230
|
const query = getApiQueryParams(moduleName);
|
|
216
|
-
const month =
|
|
231
|
+
const month = date.getMonth() + 1;
|
|
217
232
|
const previousMonth = month === 1 ? 12 : month - 1;
|
|
218
|
-
|
|
233
|
+
|
|
219
234
|
const calendarData = await getCalendarData(query.lotteryName, month, date.getFullYear());
|
|
220
235
|
|
|
221
|
-
if(!calendarData) return;
|
|
236
|
+
if (!calendarData) return;
|
|
222
237
|
|
|
223
|
-
const prevMonth =
|
|
238
|
+
const prevMonth =
|
|
239
|
+
calendarData.length <= 2
|
|
240
|
+
? await getCalendarData(query.lotteryName, previousMonth, date.getFullYear())
|
|
241
|
+
: [];
|
|
224
242
|
|
|
225
|
-
const orderedPrevMonth =
|
|
226
|
-
|
|
227
|
-
prevMonth[prevMonth.length - 1],
|
|
228
|
-
|
|
229
|
-
] : prevMonth;
|
|
243
|
+
const orderedPrevMonth =
|
|
244
|
+
calendarData.length === 0
|
|
245
|
+
? [prevMonth[prevMonth.length - 1], ...prevMonth.slice(0, prevMonth.length - 1)]
|
|
246
|
+
: prevMonth;
|
|
230
247
|
|
|
231
248
|
const reorderedResultData = [
|
|
232
249
|
calendarData[calendarData.length - 1],
|
|
233
250
|
...calendarData.slice(0, calendarData.length - 1),
|
|
234
|
-
...orderedPrevMonth
|
|
235
|
-
].filter(item => item && !Array.isArray(item));
|
|
251
|
+
...orderedPrevMonth,
|
|
252
|
+
].filter((item) => item && !Array.isArray(item));
|
|
236
253
|
|
|
237
254
|
reorderedResultData.sort((a, b) => {
|
|
238
255
|
const dateA = new Date(a.drawDate);
|
|
@@ -240,17 +257,21 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
240
257
|
return dateB.getTime() - dateA.getTime();
|
|
241
258
|
});
|
|
242
259
|
|
|
243
|
-
|
|
244
|
-
|
|
260
|
+
reorderedResultData[0] = reorderedResultData[0]
|
|
261
|
+
? // eslint-disable-next-line no-underscore-dangle
|
|
262
|
+
await getResultsById(reorderedResultData[0]._id)
|
|
263
|
+
: null;
|
|
245
264
|
|
|
246
265
|
return { [moduleName]: reorderedResultData };
|
|
247
|
-
})
|
|
266
|
+
})
|
|
248
267
|
);
|
|
249
268
|
|
|
250
269
|
responseResults = {
|
|
251
270
|
data: Object.assign({}, ...resultData.filter(Boolean)),
|
|
252
271
|
};
|
|
253
|
-
}else
|
|
272
|
+
} else {
|
|
273
|
+
responseResults = { data: [] };
|
|
274
|
+
}
|
|
254
275
|
|
|
255
276
|
if (containsLotto.length >= 1) {
|
|
256
277
|
const filteredArray = page?.sections?.main?.modules.filter(
|
|
@@ -262,41 +283,32 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
262
283
|
const moduleName = module.name;
|
|
263
284
|
const apiBaseNames = getApiBasedNames(moduleName);
|
|
264
285
|
|
|
265
|
-
if(apiBaseNames.length === 0) return;
|
|
286
|
+
if (apiBaseNames.length === 0) return;
|
|
266
287
|
|
|
267
288
|
const date = new Date();
|
|
268
|
-
const month =
|
|
289
|
+
const month = date.getMonth() + 1;
|
|
269
290
|
const previousMonth = month === 1 ? 12 : month - 1;
|
|
270
291
|
const year = date.getFullYear();
|
|
271
292
|
|
|
272
|
-
const availableDates = await getAvailableDrawDays(
|
|
273
|
-
apiBaseNames[0],
|
|
274
|
-
'WEEKEND',
|
|
275
|
-
month,
|
|
276
|
-
year
|
|
277
|
-
);
|
|
293
|
+
const availableDates = await getAvailableDrawDays(apiBaseNames[0], 'WEEKEND', month, year);
|
|
278
294
|
|
|
279
|
-
if(!availableDates) return;
|
|
295
|
+
if (!availableDates) return;
|
|
280
296
|
|
|
281
|
-
const prevMonth =
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
year
|
|
286
|
-
) : [];
|
|
297
|
+
const prevMonth =
|
|
298
|
+
availableDates.length <= 2
|
|
299
|
+
? await getAvailableDrawDays(apiBaseNames[0], 'WEEKEND', previousMonth, year)
|
|
300
|
+
: [];
|
|
287
301
|
|
|
288
|
-
const orderedPrevMonth =
|
|
289
|
-
|
|
290
|
-
prevMonth[prevMonth.length - 1],
|
|
291
|
-
|
|
292
|
-
] : prevMonth;
|
|
293
|
-
|
|
302
|
+
const orderedPrevMonth =
|
|
303
|
+
availableDates.length === 0
|
|
304
|
+
? [prevMonth[prevMonth.length - 1], ...prevMonth.slice(0, prevMonth.length - 1)]
|
|
305
|
+
: prevMonth;
|
|
294
306
|
|
|
295
307
|
const reorderedDates = [
|
|
296
308
|
availableDates[availableDates.length - 1],
|
|
297
309
|
...availableDates.slice(0, availableDates.length - 1),
|
|
298
|
-
...orderedPrevMonth
|
|
299
|
-
].filter(item => item && !Array.isArray(item));
|
|
310
|
+
...orderedPrevMonth,
|
|
311
|
+
].filter((item) => item && !Array.isArray(item));
|
|
300
312
|
|
|
301
313
|
reorderedDates.sort((a, b) => {
|
|
302
314
|
const dateA = new Date(a.drawDate);
|
|
@@ -315,38 +327,41 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
315
327
|
responseLotto = {
|
|
316
328
|
data: responseArray.filter((n) => n),
|
|
317
329
|
};
|
|
318
|
-
}else
|
|
330
|
+
} else {
|
|
331
|
+
responseLotto = { data: [] };
|
|
332
|
+
}
|
|
319
333
|
|
|
320
334
|
if (conatinsLottoUK49.length >= 1) {
|
|
321
335
|
const types = ['lunchtime', 'teatime'];
|
|
322
336
|
const date = new Date();
|
|
323
|
-
const month =
|
|
337
|
+
const month = date.getMonth() + 1;
|
|
324
338
|
const previousMonth = month === 1 ? 12 : month - 1;
|
|
325
339
|
const year = date.getFullYear();
|
|
326
340
|
|
|
327
341
|
const responseArray = await Promise.all(
|
|
328
|
-
|
|
329
342
|
types.map(async (type) => {
|
|
330
343
|
const data = await getLottoUKdata(true, false, type);
|
|
331
344
|
const calendarData = await getCalendarData(type, month, year);
|
|
332
|
-
const prevMonth =
|
|
345
|
+
const prevMonth =
|
|
346
|
+
calendarData.length <= 2 ? await getCalendarData(type, previousMonth, year) : [];
|
|
333
347
|
|
|
334
|
-
const reorderedDates = [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
].filter(item => item && !Array.isArray(item));
|
|
348
|
+
const reorderedDates = [...calendarData, ...prevMonth].filter(
|
|
349
|
+
(item) => item && !Array.isArray(item)
|
|
350
|
+
);
|
|
338
351
|
|
|
339
352
|
return {
|
|
340
353
|
data,
|
|
341
|
-
tabs: reorderedDates
|
|
354
|
+
tabs: reorderedDates,
|
|
342
355
|
};
|
|
343
356
|
})
|
|
344
357
|
);
|
|
345
358
|
lottoUK49 = {
|
|
346
|
-
tabs:[...responseArray[0].tabs, ...responseArray[1].tabs],
|
|
347
|
-
data: [...responseArray[0].data, ...responseArray[1].data]
|
|
348
|
-
}
|
|
349
|
-
}else
|
|
359
|
+
tabs: [...responseArray[0].tabs, ...responseArray[1].tabs],
|
|
360
|
+
data: [...responseArray[0].data, ...responseArray[1].data],
|
|
361
|
+
};
|
|
362
|
+
} else {
|
|
363
|
+
lottoUK49 = { data: [], tabs: [] };
|
|
364
|
+
}
|
|
350
365
|
|
|
351
366
|
return {
|
|
352
367
|
props: {
|