gatsby-core-theme 44.2.0 → 44.2.2
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 +29 -0
- package/package.json +1 -1
- package/src/components/molecules/bonus-box/template-one/index.js +41 -24
- package/src/constants/pick-keys.mjs +2 -0
- package/src/helpers/processor/index.mjs +18 -5
- package/src/helpers/processor/modules.mjs +71 -52
- package/src/helpers/processor/modules.test.js +35 -21
- package/tests/factories/modules/card.factory.js +2 -1
- package/tests/factories/pages/default.factory.js +1 -0
- package/tests/factories/pages/list.factory.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [44.2.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.1...v44.2.2) (2025-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add id on relation ([698e1fd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/698e1fd3f1a7cc09eefaaf5b973f5701a4ac5056))
|
|
7
|
+
* added author_title and author_same_as to toplist ([0482c89](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0482c8995ccc4e9e7f18f18e2b979d16d987366a))
|
|
8
|
+
* added condition if the itemd dont have relation ([6942f04](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6942f04cdbadef6ab3185e42e1c14c2706118ce3))
|
|
9
|
+
* filter out cards items that are on the same relation as the current page ([418692e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/418692e48662aab5b72af25eaacffbff5a0a2530))
|
|
10
|
+
* jest ([2d8291f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2d8291f47d26cafdfd92d79979657a39d46875c4))
|
|
11
|
+
* jest ([43e82e4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/43e82e44236be358a70e7dae79539be95e7bae58))
|
|
12
|
+
* jest ([8b3ce52](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/8b3ce527f8c0b421cddf29c86ca49b8d9c693b9a))
|
|
13
|
+
* modules ([4cd9671](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4cd9671f06dd8140738a07a7dac647f8c6d1ffab))
|
|
14
|
+
* prefilled module cards on the same page as the relation ([675de03](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/675de0392384b6a3d036aa1b9f19e64f603c846d))
|
|
15
|
+
* remove comments ([e3fc17e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e3fc17e7a6204ffd3642a888be60d3faa460dade))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* Merge branch 'tm-5515-prefilled-module-cards' into 'master' ([b8364fc](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b8364fca1d5579536a9b261ba9cca36291d8d82e))
|
|
19
|
+
|
|
20
|
+
## [44.2.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.0...v44.2.1) (2025-06-10)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* enable coupon code on bonus box template one ([9bde912](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9bde912a4ae8de2489f05880da286ba5735766bf))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* Merge branch 'tm-5469-enable-coupon-code' into 'master' ([780db9f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/780db9f15a9949870d3767874819cef3b7220c3c))
|
|
29
|
+
|
|
1
30
|
# [44.2.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.1.8...v44.2.0) (2025-06-09)
|
|
2
31
|
|
|
3
32
|
|
package/package.json
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { getBonusData } from
|
|
4
|
-
import PrettyLink from
|
|
5
|
-
import styles from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { getBonusData } from "~helpers/getters.mjs";
|
|
4
|
+
import PrettyLink from "~atoms/pretty-link";
|
|
5
|
+
import styles from "./bonus-box.module.scss";
|
|
6
|
+
import VariableComponent from "../variables";
|
|
6
7
|
|
|
7
8
|
export default function BonusBox({
|
|
8
9
|
item,
|
|
9
10
|
tracker,
|
|
11
|
+
showVariablesComponent = false,
|
|
10
12
|
pageTemplate = null,
|
|
11
|
-
splitBy =
|
|
12
|
-
feSeparator =
|
|
13
|
+
splitBy = "+",
|
|
14
|
+
feSeparator = "+",
|
|
13
15
|
moduleName = null,
|
|
14
16
|
clickedElement = "bonusBox",
|
|
15
17
|
titleSuffix,
|
|
16
18
|
modulePosition,
|
|
17
|
-
itemPosition
|
|
19
|
+
itemPosition,
|
|
18
20
|
}) {
|
|
19
21
|
const data = getBonusData(item, tracker, splitBy);
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
|
|
25
|
+
<PrettyLink
|
|
26
|
+
operator={item}
|
|
27
|
+
pageTemplate={pageTemplate}
|
|
28
|
+
moduleName={moduleName}
|
|
29
|
+
tracker={tracker}
|
|
30
|
+
titleSuffix={titleSuffix}
|
|
31
|
+
clickedElement={clickedElement}
|
|
32
|
+
className={`${styles.detailsBox} ${"bonus-box-gtm"}`}
|
|
33
|
+
modulePosition={modulePosition}
|
|
34
|
+
itemPosition={itemPosition}
|
|
35
|
+
>
|
|
36
|
+
{data?.mainLine && (
|
|
37
|
+
<span className={styles.firstPart}>{data.mainLine}</span>
|
|
38
|
+
)}
|
|
39
|
+
{data?.secondLine && (
|
|
40
|
+
<span
|
|
41
|
+
className={styles.secondPart}
|
|
42
|
+
>{`${feSeparator}${data.secondLine}`}</span>
|
|
43
|
+
)}
|
|
44
|
+
{showVariablesComponent && (
|
|
45
|
+
<VariableComponent
|
|
46
|
+
item={item}
|
|
47
|
+
moduleName={moduleName}
|
|
48
|
+
modulePosition={modulePosition}
|
|
49
|
+
itemPosition={itemPosition}
|
|
50
|
+
clickedElement={clickedElement}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
</PrettyLink>
|
|
38
54
|
);
|
|
39
55
|
}
|
|
40
56
|
|
|
@@ -49,4 +65,5 @@ BonusBox.propTypes = {
|
|
|
49
65
|
titleSuffix: PropTypes.string,
|
|
50
66
|
modulePosition: PropTypes.number,
|
|
51
67
|
itemPosition: PropTypes.number,
|
|
68
|
+
showVariablesComponent: PropTypes.bool,
|
|
52
69
|
};
|
|
@@ -140,7 +140,7 @@ export function processSections(
|
|
|
140
140
|
toplists,
|
|
141
141
|
content
|
|
142
142
|
) {
|
|
143
|
-
//
|
|
143
|
+
// pageId we will use it just on operator review pages
|
|
144
144
|
const pageId = page ? page.id : null;
|
|
145
145
|
const relationData = page && page.relation;
|
|
146
146
|
|
|
@@ -165,7 +165,18 @@ export function processSections(
|
|
|
165
165
|
shouldSavePrefilled(module, siteName) &&
|
|
166
166
|
savedModules[module.module_value_id]
|
|
167
167
|
) {
|
|
168
|
-
|
|
168
|
+
const filteredModule = cloneDeep(savedModules[module.module_value_id]);
|
|
169
|
+
|
|
170
|
+
const relationID = pagesMappedById[pageId]?.relation_id;
|
|
171
|
+
if (filteredModule.name === 'cards_v2' &&
|
|
172
|
+
relationID && filteredModule.items
|
|
173
|
+
) {
|
|
174
|
+
filteredModule.items = filteredModule.items.filter((item) => {
|
|
175
|
+
return !item.relation || item.relation.id !== relationID;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Object.assign(module, filteredModule);
|
|
169
180
|
} else {
|
|
170
181
|
if (
|
|
171
182
|
module.value_type === ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET
|
|
@@ -511,9 +522,11 @@ export default {
|
|
|
511
522
|
...minimalPage,
|
|
512
523
|
...(filteredRelation && { relation: filteredRelation }),
|
|
513
524
|
...(filteredAuthorRelation && { author: filteredAuthorRelation }),
|
|
514
|
-
...operatorExtraFileds && {
|
|
515
|
-
|
|
516
|
-
|
|
525
|
+
...operatorExtraFileds && {
|
|
526
|
+
extra_fields: {
|
|
527
|
+
operator: operatorExtraFileds
|
|
528
|
+
}
|
|
529
|
+
},
|
|
517
530
|
})
|
|
518
531
|
);
|
|
519
532
|
}
|
|
@@ -187,7 +187,7 @@ export function processCardsV2(
|
|
|
187
187
|
// Populate pagesList if page type and template exists
|
|
188
188
|
pagesList =
|
|
189
189
|
!pagesGroupedByTemplateId[`${cardType}_${market}`] ||
|
|
190
|
-
|
|
190
|
+
!pagesGroupedByTemplateId[`${cardType}_${market}`][pageTemplateId]
|
|
191
191
|
? []
|
|
192
192
|
: pagesGroupedByTemplateId[`${cardType}_${market}`][pageTemplateId];
|
|
193
193
|
} else {
|
|
@@ -279,6 +279,18 @@ export function processCardsV2(
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
|
|
283
|
+
if (styleName !== "comparison_table") {
|
|
284
|
+
const relationID = pagesMappedById[pageId]?.relation_id;
|
|
285
|
+
|
|
286
|
+
if (module.items && module.items.length > 0 && relationID) {
|
|
287
|
+
module.items = module.items.filter(
|
|
288
|
+
(item) => !item.relation || item.relation.id !== relationID
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
282
294
|
if (
|
|
283
295
|
styleName === "comparison_table" &&
|
|
284
296
|
pageId !== null &&
|
|
@@ -341,53 +353,60 @@ export function processTopListModule(
|
|
|
341
353
|
|
|
342
354
|
listItem.items = listItem.items
|
|
343
355
|
? listItem.items.map((item) => {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
356
|
+
const operatorRelation = cloneDeep(
|
|
357
|
+
Object.values(relations.operator).find(
|
|
358
|
+
(operator) =>
|
|
359
|
+
operator.operator_id === item.operator_id &&
|
|
360
|
+
operator.market === listItem.market &&
|
|
361
|
+
type === operator.type
|
|
362
|
+
)
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
if (operatorRelation) {
|
|
366
|
+
operatorRelation.ribbons =
|
|
367
|
+
item.ribbon_ids && item.ribbon_ids.length === 0
|
|
368
|
+
? operatorRelation.ribbons
|
|
369
|
+
: item.ribbon_ids;
|
|
370
|
+
|
|
371
|
+
operatorRelation.selling_points =
|
|
372
|
+
item.selling_points && item.selling_points.length === 0
|
|
373
|
+
? operatorRelation.selling_points
|
|
374
|
+
: item.selling_points;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
operatorRelation.updated_at = item.updated_at;
|
|
378
|
+
operatorRelation.toplist_bonus = item.bonus_name;
|
|
379
|
+
|
|
380
|
+
const operatorPage =
|
|
381
|
+
pages && pages.operator && operatorRelation
|
|
382
|
+
? pages.operator.filter(
|
|
383
|
+
(page) =>
|
|
384
|
+
page.relation &&
|
|
385
|
+
page.relation.operator_id ===
|
|
386
|
+
operatorRelation.operator_id &&
|
|
387
|
+
page.relation.type === operatorRelation.type
|
|
350
388
|
)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
page.relation &&
|
|
373
|
-
page.relation.operator_id ===
|
|
374
|
-
operatorRelation.operator_id &&
|
|
375
|
-
page.relation.type === operatorRelation.type
|
|
376
|
-
)
|
|
377
|
-
: [];
|
|
378
|
-
|
|
379
|
-
const reviewLink =
|
|
380
|
-
operatorPage.length > 0 ? operatorPage[0].path : null;
|
|
381
|
-
|
|
382
|
-
const clone = sanitizeOperatorData(
|
|
383
|
-
cloneDeep(operatorRelation),
|
|
384
|
-
operatorPage,
|
|
385
|
-
data,
|
|
386
|
-
toplists && toplists[listItem.id].label
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
return Object.assign(clone, { review_link: reviewLink });
|
|
390
|
-
})
|
|
389
|
+
: [];
|
|
390
|
+
|
|
391
|
+
const reviewLink = operatorPage.length > 0 ? operatorPage[0].path : null;
|
|
392
|
+
const authorTitle = operatorPage[0] && operatorPage[0]?.author?.author_title;
|
|
393
|
+
const authorSameAs = operatorPage[0] && operatorPage[0]?.author?.knows_abouts && operatorPage[0].author.knows_abouts.map(knowsAboutItem =>
|
|
394
|
+
knowsAboutItem.links.map((link) => link.link)[0]
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
const clone = sanitizeOperatorData(
|
|
398
|
+
cloneDeep(operatorRelation),
|
|
399
|
+
operatorPage,
|
|
400
|
+
data,
|
|
401
|
+
toplists && toplists[listItem.id].label
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
return Object.assign(clone, {
|
|
405
|
+
review_link: reviewLink,
|
|
406
|
+
author_title: authorTitle,
|
|
407
|
+
author_same_as: authorSameAs
|
|
408
|
+
});
|
|
409
|
+
})
|
|
391
410
|
: [];
|
|
392
411
|
|
|
393
412
|
const latestItems = listItem.items
|
|
@@ -415,10 +434,10 @@ export function processTopListModule(
|
|
|
415
434
|
// eslint-disable-next-line no-restricted-globals
|
|
416
435
|
latestUpdatedDate instanceof Date && !isNaN(latestUpdatedDate)
|
|
417
436
|
? new Intl.DateTimeFormat("en-US", {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
437
|
+
year: "numeric",
|
|
438
|
+
month: "long",
|
|
439
|
+
day: "numeric",
|
|
440
|
+
}).format(latestUpdatedDate)
|
|
422
441
|
: null;
|
|
423
442
|
|
|
424
443
|
listItem.latest_items = formattedLatestItems;
|
|
@@ -497,7 +516,7 @@ export function processFaq(module = {}, content, relationData) {
|
|
|
497
516
|
null,
|
|
498
517
|
relationData
|
|
499
518
|
)) ||
|
|
500
|
-
|
|
519
|
+
item.question
|
|
501
520
|
);
|
|
502
521
|
item.answer = trailingSlash(
|
|
503
522
|
(content && content[item.answer]) || item.answer
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
processBonus,
|
|
10
10
|
processTopListModule,
|
|
11
11
|
shouldSavePrefilled,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
processContentModule,
|
|
13
|
+
processAnchor
|
|
14
14
|
} from "./modules.mjs";
|
|
15
15
|
import { objectsHolder } from "~tests/factories/modules/modules.factory";
|
|
16
16
|
import getPageDataList from "~tests/factories/pages/list.factory";
|
|
@@ -61,15 +61,15 @@ describe("Modules Helper", () => {
|
|
|
61
61
|
const pageList = getPageDataList(pagesNum).map((page, i) =>
|
|
62
62
|
i % 2
|
|
63
63
|
? {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
...page,
|
|
65
|
+
relation_type: "operator",
|
|
66
|
+
relation: { ...page.relation, status: "inactive" },
|
|
67
|
+
}
|
|
68
68
|
: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
...page,
|
|
70
|
+
relation_type: "operator",
|
|
71
|
+
relation: { ...page.relation, status: "active" },
|
|
72
|
+
}
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
processCardsV2(
|
|
@@ -114,6 +114,20 @@ describe("Modules Helper", () => {
|
|
|
114
114
|
expect(moduleData.items).toHaveLength(4);
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
test("Cards V2 with Comparison Style", () => {
|
|
118
|
+
const pagesNum = 3;
|
|
119
|
+
const moduleData = getSampleCardsV2ModuleManual("comparison_table");
|
|
120
|
+
const pageList = getPageDataList(pagesNum);
|
|
121
|
+
processCardsV2(
|
|
122
|
+
moduleData,
|
|
123
|
+
groupBy(pageList, "relation_type"),
|
|
124
|
+
groupBy(pageList, "id", true),
|
|
125
|
+
1
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
expect(moduleData.items).toHaveLength(2);
|
|
129
|
+
});
|
|
130
|
+
|
|
117
131
|
test("Cards V2 FIltered inactive", () => {
|
|
118
132
|
process.env.GATSBY_SITE_NAME = "irishluck.ie";
|
|
119
133
|
const pagesNum = 10;
|
|
@@ -124,15 +138,15 @@ describe("Modules Helper", () => {
|
|
|
124
138
|
const pageList = getPageDataList(pagesNum).map((page, i) =>
|
|
125
139
|
i === 1
|
|
126
140
|
? {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
...page,
|
|
142
|
+
relation_type: "operator",
|
|
143
|
+
relation: { ...page.relation, status: "inactive" },
|
|
144
|
+
}
|
|
131
145
|
: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
...page,
|
|
147
|
+
relation_type: "operator",
|
|
148
|
+
relation: { ...page.relation, status: "active" },
|
|
149
|
+
}
|
|
136
150
|
);
|
|
137
151
|
|
|
138
152
|
processCardsV2(
|
|
@@ -271,13 +285,13 @@ describe("Modules Helper", () => {
|
|
|
271
285
|
expect(toplistData.items[0].latest_updated_date).toBe(undefined);
|
|
272
286
|
|
|
273
287
|
processTopListModule(toplistData, relationData);
|
|
274
|
-
|
|
288
|
+
|
|
275
289
|
expect(toplistData.items[0].latest_items).toBe('Slotum, Risk and Casoola');
|
|
276
290
|
expect(toplistData.items[0].latest_updated_date).toBe('January 14, 2025');
|
|
277
291
|
});
|
|
278
292
|
|
|
279
293
|
|
|
280
|
-
test("Process Anchor module", () => {
|
|
294
|
+
test("Process Anchor module", () => {
|
|
281
295
|
const module = {
|
|
282
296
|
items: [
|
|
283
297
|
{ slug: 'section-one-year', label: 'Section one [YEAR]' },
|
|
@@ -291,7 +305,7 @@ describe("Modules Helper", () => {
|
|
|
291
305
|
expect(processedAnchor.items[2].slug).toBe('section-three');
|
|
292
306
|
expect(processedAnchor.items[3].id).toBe('section-four');
|
|
293
307
|
});
|
|
294
|
-
test("Process Anchor module with shortcodes", () => {
|
|
308
|
+
test("Process Anchor module with shortcodes", () => {
|
|
295
309
|
const module = {
|
|
296
310
|
items: [
|
|
297
311
|
{ slug: 'section-one-year', label: 'Section one [YEAR]' },
|
|
@@ -446,7 +446,7 @@ export function getSampleOperatorCards(type) {
|
|
|
446
446
|
return sampleOperatorCards;
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
export function getSampleCardsV2ModuleManual() {
|
|
449
|
+
export function getSampleCardsV2ModuleManual(ModuleStyle = '') {
|
|
450
450
|
const sampleOperatorCards = {
|
|
451
451
|
cards_page_type: 'operator',
|
|
452
452
|
cards_page_type_id: 5,
|
|
@@ -465,6 +465,7 @@ export function getSampleCardsV2ModuleManual() {
|
|
|
465
465
|
module_title: `Operator Cards`,
|
|
466
466
|
link_label: 'View more',
|
|
467
467
|
link_value: '/sample',
|
|
468
|
+
style: ModuleStyle,
|
|
468
469
|
num_of_items: 3,
|
|
469
470
|
};
|
|
470
471
|
|