gatsby-core-theme 5.1.1 → 5.1.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/.ci.yml +6 -3
- package/CHANGELOG.md +73 -0
- package/gatsby-node.esm.js +3 -1
- package/package.json +1 -1
- package/src/components/atoms/spotlights/index.js +8 -6
- package/src/constants/settings.js +5 -0
- package/src/helpers/generators.js +4 -0
- package/src/helpers/generators.test.js +33 -3
- package/src/helpers/processor/index.js +25 -12
- package/src/helpers/processor/index.test.js +5 -1
- package/src/helpers/processor/modules.js +8 -0
- package/src/helpers/processor/modules.test.js +9 -0
- package/src/helpers/schedule.js +5 -7
- package/src/helpers/strings.js +4 -1
- package/tests/factories/modules/modules.factory.js +40 -0
- package/tests/factories/pages/pages.factory.js +96 -0
package/.ci.yml
CHANGED
|
@@ -9,9 +9,14 @@ Theme Tests:
|
|
|
9
9
|
- yarn config set cache-folder .yarn
|
|
10
10
|
- yarn
|
|
11
11
|
- yarn workspace gatsby-core-theme test
|
|
12
|
+
artifacts:
|
|
13
|
+
paths:
|
|
14
|
+
- gatsby-theme/coverage/
|
|
12
15
|
coverage: /All files\s*\|\s*([\d\.]+)/
|
|
13
16
|
rules:
|
|
14
17
|
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
|
|
18
|
+
- if: '$CI_COMMIT_BRANCH == "master" && $PIPELINE == "automated"'
|
|
19
|
+
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
|
|
15
20
|
|
|
16
21
|
Theme Publish:
|
|
17
22
|
image: git.ilcd.rocks:4567/team-floyd/themes/gatsby-themes:node14
|
|
@@ -28,11 +33,9 @@ Theme Publish:
|
|
|
28
33
|
- yarn
|
|
29
34
|
- cd gatsby-theme/
|
|
30
35
|
- npx semantic-release -b $CI_COMMIT_REF_NAME
|
|
31
|
-
when:
|
|
32
|
-
manual
|
|
36
|
+
when: manual
|
|
33
37
|
only:
|
|
34
38
|
refs:
|
|
35
39
|
- master
|
|
36
40
|
variables:
|
|
37
41
|
- $PIPELINE != "content-trigger"
|
|
38
|
-
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
+
## [5.1.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.3...v5.1.4) (2022-03-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add default 12 items on archive module ([6c9edf9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c9edf999f64825ba688bb0f35158d6d534aca9d))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* update build array func ([842477e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/842477eb0c04d6e123066c14609f0426b6802989))
|
|
12
|
+
* update generate array func ([ec69c52](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ec69c522f9ae7bba63e50368f849873349db0e9b))
|
|
13
|
+
* update generate array tests ([2edbfeb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2edbfeb3ddad10d5043555b71c1ab69e11ee1638))
|
|
14
|
+
* update header component test ([3e191e7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3e191e70cc08fa132e36b3f84f0cf0b731ddc7b0))
|
|
15
|
+
* update prefilled module generation ([10365c7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/10365c722aee002d69c93db3db3e309c21e19e03))
|
|
16
|
+
* update prefilled module generation ([7eedb0d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7eedb0d6de7baff62315c71284e20cb21228f30d))
|
|
17
|
+
* update prefilled module generation ([e76c655](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e76c655217a5b62d42bcf987aa3d641520a11030))
|
|
18
|
+
* update saved prefilled module func check ([adfcf82](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/adfcf82e738248ed51730445a29d60a9f3836eda))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
* Merge branch 'tm-2795-update-build-array-func' into 'master' ([cc21cf2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc21cf288b0fb796e0b1afac1cebae1e7419006d))
|
|
22
|
+
* Merge branch 'tm-2729-update-prefilled-module-generation' into 'master' ([73a094c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/73a094c7b8fdd1e07f0469c8ef78eb2a4f617ace))
|
|
23
|
+
|
|
24
|
+
## [5.1.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.2...v5.1.3) (2022-03-16)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* calculate number of items default ([ef72a91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef72a91e7de83f08a6ef9869d40629fd05714554))
|
|
30
|
+
* check no columns specified default add 3 columns ([c94b18c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c94b18cf4466d875ee58f7f0e14aece922aa4c03))
|
|
31
|
+
* reorder pipeline stages ([aa21ba3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/aa21ba36f81e8270d071c87e5c661d9e2978b1be))
|
|
32
|
+
* reorder pipeline stages ([b52d2c8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b52d2c8892f2cb829714c691956df29f04a6ff6a))
|
|
33
|
+
* show full items in the archive page ([c1f0ff1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1f0ff133d62a95a9457411a6012557886e69fed))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
* Merge branch 'fix-lighthouse-order' into 'master' ([e0f459a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e0f459a0a2fd3f7e4757fdee6bf9237cc7ba3ef7))
|
|
37
|
+
* Merge branch 'tm-2763-archive-module' into 'master' ([fd0d258](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fd0d25811cecc14bc054c0fd06e2434ee7f168b8))
|
|
38
|
+
|
|
39
|
+
## [5.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.1...v5.1.2) (2022-03-10)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* add artifacts and move back stage of lighthouse ([ea69601](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ea696013e650505ae1e90b51c261e819c9eaa351))
|
|
45
|
+
* content module gif image and spotlight image ([a54a5a9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a54a5a9614be85f7e6dcd90b371b5dbe2713390e))
|
|
46
|
+
* return back assertions ([0cefa07](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0cefa07edd2c9f6ea73086fe7622c683aa857adf))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Code Refactoring
|
|
50
|
+
|
|
51
|
+
* add flag for docker issue ([b4120b2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b4120b2d417f6cccedda7187ccb911c17949d97a))
|
|
52
|
+
* add max assertion for testing ([04e4361](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/04e4361a3858e56b9a9e59b1491d3cb1197051b8))
|
|
53
|
+
* add max assertion for testing ([78d375f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/78d375f61806140fb7fe860436f7e7b9d3a3bf30))
|
|
54
|
+
* fix error on ci file ([37cc845](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/37cc84555a8a0a62e4036621c45eb89fe5bb1aa0))
|
|
55
|
+
* fix error on ci file ([e78536f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e78536ff1f2acf6beaabf8f31435b9845dd3f9d1))
|
|
56
|
+
* fix error on ci file ([f02439a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f02439a15ebee6088dfee42ff84c55c380410286))
|
|
57
|
+
* remove unnecessary line in ci yml ([8e041be](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e041be54d13593f721a909614515367c4f04819))
|
|
58
|
+
* replace image ([6aacf01](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6aacf0164c03f3ec153e996b6f2117a095a920a6))
|
|
59
|
+
* replace lighthouse ci with google chrome lighthouse ([aa579c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/aa579c15b30f275b2bc151a781181e9b1ec4612f))
|
|
60
|
+
* replace lighthouse ci with google chrome lighthouse ([fef864b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fef864bb9182003d7b496d6bfa54f211b3b64036))
|
|
61
|
+
* replace lighthouse ci with google chrome lighthouse ([847e99d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/847e99d6f63784d63e20bc4ac76b65fcab1714f2))
|
|
62
|
+
* return image ([38e3c74](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/38e3c7467638faae7c0c56d1a26f0e4caaa58896))
|
|
63
|
+
* test lighthouse upgrade ([764656d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/764656d9dd6511e2ef25c53d7f84b206a7ed5f1d))
|
|
64
|
+
* uncomment lighthouse for testing ([633f6c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/633f6c6a95fe84e6771212912a317940d563b73f))
|
|
65
|
+
* uncomment lighthouse for testing ([b288b1a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b288b1a9c7ac885a0c7cbb7fcfa1ce2ed46bfb05))
|
|
66
|
+
* undo changes to check pipeline ([45083a5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/45083a52fc6fbc7913b0cc0b25116bac742cff39))
|
|
67
|
+
* undo changes to check pipeline ([79041a2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/79041a23aba7fbb58954bd460721b6378c007a4c))
|
|
68
|
+
* upgrade version lighthouse ci ([a5279da](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a5279da1d2318ca3fe93a9c3170872d5ebeda979))
|
|
69
|
+
* upload coverage as artifact on test pipeline ([6e5d98b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6e5d98b7a62bc8326c8e14046ee61d077a3fce7e))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
* Merge branch 'tm-2758-lighthouse' into 'master' ([57d659c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/57d659cb8f56f690564bc225e55836b23e9d8a37))
|
|
73
|
+
|
|
1
74
|
## [5.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.0...v5.1.1) (2022-03-09)
|
|
2
75
|
|
|
3
76
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -52,9 +52,11 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (archiveModule.pagination_type !== 'load_more') {
|
|
55
|
+
const numOfColumns = archiveModule.desktop_num_of_columns;
|
|
56
|
+
const calDefaultNrOfItems = (numOfColumns !== null ? numOfColumns : 4) * 3;
|
|
55
57
|
const numOfItemsPerPage = Math.sign(archiveModule.num_of_items)
|
|
56
58
|
? archiveModule.num_of_items
|
|
57
|
-
:
|
|
59
|
+
: calDefaultNrOfItems;
|
|
58
60
|
const chunked = chunk(cloneDeep(archivePages), numOfItemsPerPage);
|
|
59
61
|
const numOfPages = chunked.length;
|
|
60
62
|
chunked.forEach((value, index) => {
|
package/package.json
CHANGED
|
@@ -21,12 +21,14 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
{img && (
|
|
25
|
+
<LazyImage
|
|
26
|
+
width={100}
|
|
27
|
+
height={50}
|
|
28
|
+
alt={item.label || item?.link_text || fileName}
|
|
29
|
+
src={imageSrc}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
30
32
|
<label>{item.label}</label>
|
|
31
33
|
{item.subtitle && <span>{item.subtitle}</span>}
|
|
32
34
|
</>
|
|
@@ -4,6 +4,11 @@ export default {
|
|
|
4
4
|
'norskespilleautomater.com': true,
|
|
5
5
|
'playcasino.co.za': true,
|
|
6
6
|
},
|
|
7
|
+
dynamic_prefilled_modules: {
|
|
8
|
+
'Irishluck.ie': ['cards', 'cards_v2'],
|
|
9
|
+
'norskespilleautomater.com': ['cards', 'cards_v2'],
|
|
10
|
+
'playcasino.co.za': ['cards', 'cards_v2'],
|
|
11
|
+
},
|
|
7
12
|
keep_page_extra_fields: {
|
|
8
13
|
operator: {
|
|
9
14
|
'norskespilleautomater.com': true, // needed for inoperative / placeholder fields
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateTrackerLink, generatePlaceholderString } from './generators';
|
|
1
|
+
import { generateTrackerLink, generatePlaceholderString, generateArray } from './generators';
|
|
2
2
|
import { months } from '~constants/common';
|
|
3
3
|
|
|
4
4
|
describe('Generate Tracker Link Helper', () => {
|
|
@@ -14,13 +14,18 @@ describe('Generate Tracker Link Helper', () => {
|
|
|
14
14
|
expect(typeof trackerLink).toEqual('string');
|
|
15
15
|
expect(trackerLink).toEqual('/no/visit/bet365/casino/non_main');
|
|
16
16
|
});
|
|
17
|
+
test('generateTrackerLink no tracker format', () => {
|
|
18
|
+
process.env.TRACKER_LINK_FORMAT_MAIN = '';
|
|
19
|
+
process.env.TRACKER_LINK_FORMAT_NON_MAIN = '';
|
|
20
|
+
const trackerLink = generateTrackerLink({ type: 'casino', short_name: 'bet365' }, 'main');
|
|
21
|
+
expect(trackerLink).not.toBeTruthy();
|
|
22
|
+
});
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
describe('Generate Placeholders String', () => {
|
|
20
26
|
test('generatePlaceholderString uppercase', () => {
|
|
21
27
|
const string = generatePlaceholderString('Some title [MONTH] [YEAR]');
|
|
22
28
|
const date = new Date();
|
|
23
|
-
|
|
24
29
|
expect(string).not.toContain('[MONTH]');
|
|
25
30
|
expect(string).not.toContain('[YEAR]');
|
|
26
31
|
expect(string).toContain(date.getFullYear());
|
|
@@ -36,7 +41,6 @@ describe('Generate Placeholders String', () => {
|
|
|
36
41
|
}
|
|
37
42
|
);
|
|
38
43
|
const date = new Date();
|
|
39
|
-
|
|
40
44
|
expect(string).not.toContain('[currentdate]');
|
|
41
45
|
expect(string).not.toContain('[currentmonth]');
|
|
42
46
|
expect(string).not.toContain('[currentyear]');
|
|
@@ -59,4 +63,30 @@ describe('Generate Placeholders String', () => {
|
|
|
59
63
|
expect(string).not.toContain('[MONTH]');
|
|
60
64
|
expect(string).toContain(translateMonths[months[date.getMonth()]]);
|
|
61
65
|
});
|
|
66
|
+
test('generatePlaceholderString empty', () => {
|
|
67
|
+
const string = generatePlaceholderString();
|
|
68
|
+
expect(string).not.toBeTruthy();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('Generate Array From Object', () => {
|
|
73
|
+
test('generateArray empty', () => {
|
|
74
|
+
const output = generateArray();
|
|
75
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
76
|
+
expect(output.length).toEqual(0);
|
|
77
|
+
});
|
|
78
|
+
test('generateArray array', () => {
|
|
79
|
+
const output = generateArray(['a', 'b']);
|
|
80
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
81
|
+
expect(output.length).toEqual(2);
|
|
82
|
+
expect(output[0]).toEqual('a');
|
|
83
|
+
expect(output[1]).toEqual('b');
|
|
84
|
+
});
|
|
85
|
+
test('generateArray object', () => {
|
|
86
|
+
const output = generateArray({ a: 'a', b: 'b' });
|
|
87
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
88
|
+
expect(output.length).toEqual(2);
|
|
89
|
+
expect(output[0]).toEqual('a');
|
|
90
|
+
expect(output[1]).toEqual('b');
|
|
91
|
+
});
|
|
62
92
|
});
|
|
@@ -10,7 +10,7 @@ import SearchTypesEnable from '../../constants/search-types-enable';
|
|
|
10
10
|
import { pickHTMLSitemapPageKeys } from '../../constants/pick-keys';
|
|
11
11
|
import { generatePlaceholderString } from '../generators';
|
|
12
12
|
// eslint-disable-next-line import/no-cycle
|
|
13
|
-
import { processModule } from './modules';
|
|
13
|
+
import { shouldSavePrefilled, processModule } from './modules';
|
|
14
14
|
// eslint-disable-next-line import/no-cycle
|
|
15
15
|
import { clonePageForCards, groupBy, removeTags } from './common';
|
|
16
16
|
import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
|
|
@@ -75,6 +75,7 @@ export function transform(response) {
|
|
|
75
75
|
return transformed;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const savedModules = {};
|
|
78
79
|
export function processSections(sections, skipPost = false, page) {
|
|
79
80
|
let minutes = 0;
|
|
80
81
|
let seconds = 0;
|
|
@@ -88,15 +89,26 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
88
89
|
}
|
|
89
90
|
if (sections[sectionKey] && sections[sectionKey].modules) {
|
|
90
91
|
sections[sectionKey].modules.forEach((module, key) => {
|
|
91
|
-
|
|
92
|
-
module,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
if (
|
|
93
|
+
shouldSavePrefilled(module, page && page.siteInfo && page.siteInfo.site_name) &&
|
|
94
|
+
savedModules[module.module_value_id]
|
|
95
|
+
) {
|
|
96
|
+
module = savedModules[module.module_value_id];
|
|
97
|
+
} else {
|
|
98
|
+
sections[sectionKey].modules[module[key]] = processModule(
|
|
99
|
+
module,
|
|
100
|
+
pages,
|
|
101
|
+
pagesCloned,
|
|
102
|
+
relations,
|
|
103
|
+
pagesMappedById,
|
|
104
|
+
menus,
|
|
105
|
+
previewMode
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (shouldSavePrefilled(module, page && page.siteInfo && page.siteInfo.site_name)) {
|
|
109
|
+
savedModules[module.module_value_id] = module;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
100
112
|
|
|
101
113
|
// calculate reading time
|
|
102
114
|
if (module.name === 'content') {
|
|
@@ -305,12 +317,13 @@ export default {
|
|
|
305
317
|
// pre NSA launch dirty loop to add prefilled modules as normal modules (as actual value)
|
|
306
318
|
Object.keys(page.sections).forEach((sectionKey) => {
|
|
307
319
|
if (page.sections[sectionKey] && page.sections[sectionKey].modules) {
|
|
308
|
-
page.sections[sectionKey].modules.forEach((sectionModule,
|
|
320
|
+
page.sections[sectionKey].modules.forEach((sectionModule, i) => {
|
|
309
321
|
if (
|
|
310
322
|
sectionModule.value_type === ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET
|
|
311
323
|
) {
|
|
312
324
|
const rawValue = prefilledMarketModulesRaw[sectionModule.value_id];
|
|
313
|
-
|
|
325
|
+
rawValue.value_type = sectionModule.value_type;
|
|
326
|
+
page.sections[sectionKey].modules[i] = rawValue;
|
|
314
327
|
}
|
|
315
328
|
});
|
|
316
329
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transform, processExtraFields } from './index';
|
|
1
|
+
import { transform, processExtraFields, processSections } from './index';
|
|
2
2
|
import pages from '~tests/factories/pages/pages.factory.js';
|
|
3
3
|
|
|
4
4
|
describe('Index Processor', () => {
|
|
@@ -18,4 +18,8 @@ describe('Index Processor', () => {
|
|
|
18
18
|
const result = processExtraFields(false);
|
|
19
19
|
expect(result).toBeFalsy();
|
|
20
20
|
});
|
|
21
|
+
test('processSections', () => {
|
|
22
|
+
const result = processSections(pages.prefilled_market_modules);
|
|
23
|
+
expect(result).toBeTruthy();
|
|
24
|
+
});
|
|
21
25
|
});
|
|
@@ -2,6 +2,8 @@ import { cloneDeep, pick, sampleSize } from 'lodash';
|
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line import/no-cycle
|
|
4
4
|
import { clonePageForCards, groupBy, removeDuplicates } from './common';
|
|
5
|
+
import settings from '../../constants/settings';
|
|
6
|
+
import ModuleValue from '../../constants/module-value';
|
|
5
7
|
import { topListPickKeys } from '../../constants/pick-keys';
|
|
6
8
|
|
|
7
9
|
const pagesGroupedByTemplateId = [];
|
|
@@ -213,6 +215,12 @@ export function processTopListModule(module, relations) {
|
|
|
213
215
|
});
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
export function shouldSavePrefilled(module = {}, siteName) {
|
|
219
|
+
return module.value_type === ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET &&
|
|
220
|
+
((settings.dynamic_prefilled_modules[siteName] && !settings.dynamic_prefilled_modules[siteName].includes(module.name)) ||
|
|
221
|
+
module.sort_by !== 'random');
|
|
222
|
+
}
|
|
223
|
+
|
|
216
224
|
export function processModule(
|
|
217
225
|
module,
|
|
218
226
|
pages,
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
filterOperators,
|
|
7
7
|
processBonus,
|
|
8
8
|
processTopListModule,
|
|
9
|
+
shouldSavePrefilled,
|
|
9
10
|
} from './modules';
|
|
11
|
+
import { objectsHolder } from '~tests/factories/modules/modules.factory';
|
|
10
12
|
import getPageDataList from '~tests/factories/pages/list.factory';
|
|
11
13
|
import {
|
|
12
14
|
getSampleCardsV2ModuleManual,
|
|
@@ -93,4 +95,11 @@ describe('Modules Helper', () => {
|
|
|
93
95
|
expect(singleToplistData.items[0].items[0].short_name).toEqual('slotum');
|
|
94
96
|
expect(singleToplistData.items[0].items[0].bonus.deposit_methods).toHaveLength(1);
|
|
95
97
|
});
|
|
98
|
+
|
|
99
|
+
test('Should Generate Prefilled', () => {
|
|
100
|
+
const objects = objectsHolder('prefilledModules');
|
|
101
|
+
objects.forEach((prefilled) => {
|
|
102
|
+
expect(shouldSavePrefilled(prefilled.module, prefilled.siteName)).toEqual(prefilled.expected);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
96
105
|
});
|
package/src/helpers/schedule.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
return Object.keys(obj).map((key) => obj[key]);
|
|
3
|
-
}
|
|
1
|
+
import { generateArray } from './generators';
|
|
4
2
|
|
|
5
3
|
export function reverseDate(date) {
|
|
6
4
|
return date.split('-').reverse().join('-');
|
|
@@ -17,9 +15,9 @@ export function filterScheduleByTournaments(schedule, relationIds) {
|
|
|
17
15
|
tournamentIds = [relationIds];
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
const scheduleArray =
|
|
18
|
+
const scheduleArray = generateArray(schedule);
|
|
21
19
|
for (let i = 0; i < scheduleArray.length; i += 1) {
|
|
22
|
-
const tournaments =
|
|
20
|
+
const tournaments = generateArray(scheduleArray[i].tournaments);
|
|
23
21
|
const filteredByTournament = tournaments.filter((tournament) =>
|
|
24
22
|
tournamentIds.includes(tournament.id)
|
|
25
23
|
);
|
|
@@ -69,9 +67,9 @@ export function getSortedEvents(tournaments, sportEvents) {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
export function filterScheduleByTeam(schedule, eventsArray) {
|
|
72
|
-
const scheduleArray =
|
|
70
|
+
const scheduleArray = generateArray(schedule);
|
|
73
71
|
for (let i = 0; i < scheduleArray.length; i += 1) {
|
|
74
|
-
const tournaments =
|
|
72
|
+
const tournaments = generateArray(scheduleArray[i].tournaments);
|
|
75
73
|
|
|
76
74
|
for (let j = 0; j < tournaments.length; j += 1) {
|
|
77
75
|
const filteredByTeam = tournaments[j].events.filter((event) =>
|
package/src/helpers/strings.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { imagePrettyUrl } from './getters';
|
|
2
|
+
|
|
1
3
|
export function capitalize(string) {
|
|
2
4
|
return string.replace(/^\w/, (c) => c.toUpperCase());
|
|
3
5
|
}
|
|
@@ -60,7 +62,8 @@ export function parseContentImageUrl(src) {
|
|
|
60
62
|
const srcArr = src && src.split('//');
|
|
61
63
|
if (srcArr && srcArr.length === 2) {
|
|
62
64
|
const refUrl = srcArr[1].substring(srcArr[1].indexOf('/'));
|
|
63
|
-
|
|
65
|
+
|
|
66
|
+
return imagePrettyUrl(refUrl.substring(1));
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
return src;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import ModuleValue from '../../../src/constants/module-value';
|
|
2
3
|
import { getListContentData } from '~tests/factories/modules/content.factory';
|
|
3
4
|
// import { sampleGameCards } from '~tests/factories/modules/card.factory.js';
|
|
4
5
|
import { getSpotlightItems } from '~tests/factories/modules/spotlights.factory.js';
|
|
@@ -131,6 +132,44 @@ const imageProps = {
|
|
|
131
132
|
},
|
|
132
133
|
};
|
|
133
134
|
|
|
135
|
+
const prefilledModules = [
|
|
136
|
+
{
|
|
137
|
+
module: { name: 'cards_v2', sort_by: 'random' },
|
|
138
|
+
siteName: 'no_site',
|
|
139
|
+
expected: false,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'cards_v2', sort_by: 'random' },
|
|
143
|
+
siteName: 'playcasino.co.za',
|
|
144
|
+
expected: false,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'module', sort_by: 'asc' },
|
|
148
|
+
siteName: 'playcasino.co.za',
|
|
149
|
+
expected: true,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'module', sort_by: 'random' },
|
|
153
|
+
siteName: 'playcasino.co.za',
|
|
154
|
+
expected: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'cards', sort_by: 'asc' },
|
|
158
|
+
siteName: 'playcasino.co.za',
|
|
159
|
+
expected: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'cards', sort_by: 'random' },
|
|
163
|
+
siteName: 'playcasino.co.za',
|
|
164
|
+
expected: false,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
module: { value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET, name: 'cards_v2', sort_by: 'random' },
|
|
168
|
+
siteName: 'playcasino.co.za',
|
|
169
|
+
expected: false,
|
|
170
|
+
},
|
|
171
|
+
];
|
|
172
|
+
|
|
134
173
|
// eslint-disable-next-line import/prefer-default-export
|
|
135
174
|
export function objectsHolder(elm) {
|
|
136
175
|
if (!elm || elm == null || undefined) {
|
|
@@ -147,6 +186,7 @@ export function objectsHolder(elm) {
|
|
|
147
186
|
bonus: BonusProps,
|
|
148
187
|
image: imageProps,
|
|
149
188
|
spotlights: getSpotlightItems(2),
|
|
189
|
+
prefilledModules: prefilledModules,
|
|
150
190
|
};
|
|
151
191
|
return data[elm];
|
|
152
192
|
}
|
|
@@ -189,4 +189,100 @@ export default {
|
|
|
189
189
|
},
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
|
+
prefilled_market_modules: {
|
|
193
|
+
post_main: {
|
|
194
|
+
1059: {
|
|
195
|
+
title: 'More casino reviews',
|
|
196
|
+
link_label: null,
|
|
197
|
+
link_value: null,
|
|
198
|
+
model_type: 'operator',
|
|
199
|
+
display_input: 'automatic',
|
|
200
|
+
display_type: 'default',
|
|
201
|
+
sort_by: 'random',
|
|
202
|
+
sort_order: 'ascending',
|
|
203
|
+
num_of_items: 3,
|
|
204
|
+
desktop_num_of_columns: 3,
|
|
205
|
+
tablet_num_of_columns: 3,
|
|
206
|
+
mobile_num_of_columns: 1,
|
|
207
|
+
featured_index: null,
|
|
208
|
+
show_load_more: false,
|
|
209
|
+
extra_data: null,
|
|
210
|
+
module_value_id: 1059,
|
|
211
|
+
name: 'cards',
|
|
212
|
+
anchored: 0,
|
|
213
|
+
anchor_label: null,
|
|
214
|
+
anchor_slug: null,
|
|
215
|
+
module_title: 'More Casino Reviews',
|
|
216
|
+
module_title_tag: null,
|
|
217
|
+
background_color: null,
|
|
218
|
+
style: null,
|
|
219
|
+
style_id: null,
|
|
220
|
+
see_more_link: {
|
|
221
|
+
type: 'page',
|
|
222
|
+
value: null,
|
|
223
|
+
title: null,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
1061: {
|
|
227
|
+
title: 'More slots reviews',
|
|
228
|
+
link_label: null,
|
|
229
|
+
link_value: null,
|
|
230
|
+
model_type: 'game',
|
|
231
|
+
display_input: 'automatic',
|
|
232
|
+
display_type: 'default',
|
|
233
|
+
sort_by: 'created_at',
|
|
234
|
+
sort_order: 'ascending',
|
|
235
|
+
num_of_items: 3,
|
|
236
|
+
desktop_num_of_columns: 3,
|
|
237
|
+
tablet_num_of_columns: 3,
|
|
238
|
+
mobile_num_of_columns: 1,
|
|
239
|
+
featured_index: null,
|
|
240
|
+
show_load_more: false,
|
|
241
|
+
extra_data: null,
|
|
242
|
+
module_value_id: 1061,
|
|
243
|
+
name: 'cards',
|
|
244
|
+
anchored: 0,
|
|
245
|
+
anchor_label: null,
|
|
246
|
+
anchor_slug: null,
|
|
247
|
+
module_title: 'More Game Reviews',
|
|
248
|
+
module_title_tag: null,
|
|
249
|
+
background_color: null,
|
|
250
|
+
style: null,
|
|
251
|
+
style_id: null,
|
|
252
|
+
see_more_link: {
|
|
253
|
+
type: 'page',
|
|
254
|
+
value: null,
|
|
255
|
+
title: null,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
1063: {
|
|
259
|
+
title: 'Latest news',
|
|
260
|
+
link_label: null,
|
|
261
|
+
link_value: null,
|
|
262
|
+
model_type: 'article',
|
|
263
|
+
display_input: 'automatic',
|
|
264
|
+
display_type: 'default',
|
|
265
|
+
sort_by: 'created_at',
|
|
266
|
+
sort_order: 'ascending',
|
|
267
|
+
num_of_items: 3,
|
|
268
|
+
desktop_num_of_columns: 3,
|
|
269
|
+
tablet_num_of_columns: 3,
|
|
270
|
+
mobile_num_of_columns: 1,
|
|
271
|
+
featured_index: null,
|
|
272
|
+
show_load_more: false,
|
|
273
|
+
extra_data: null,
|
|
274
|
+
module_value_id: 1063,
|
|
275
|
+
name: 'cards',
|
|
276
|
+
anchored: 0,
|
|
277
|
+
anchor_label: null,
|
|
278
|
+
anchor_slug: null,
|
|
279
|
+
module_title: null,
|
|
280
|
+
module_title_tag: null,
|
|
281
|
+
background_color: null,
|
|
282
|
+
style: null,
|
|
283
|
+
style_id: null,
|
|
284
|
+
see_more_link: null,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
192
288
|
};
|