gatsby-core-theme 5.1.2 → 6.0.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/.ci.yml CHANGED
@@ -15,6 +15,8 @@ Theme Tests:
15
15
  coverage: /All files\s*\|\s*([\d\.]+)/
16
16
  rules:
17
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"'
18
20
 
19
21
  Theme Publish:
20
22
  image: git.ilcd.rocks:4567/team-floyd/themes/gatsby-themes:node14
@@ -46,6 +46,7 @@ module.exports = {
46
46
  '~tests': path.resolve(__dirname, '../tests'),
47
47
  '~context': path.resolve(__dirname, '../src/context'),
48
48
  '~constants': path.resolve(__dirname, '../src/constants'),
49
+ 'gatsby-page-utils': path.resolve(__dirname, '../../node_modules/gatsby-page-utils/dist'),
49
50
  };
50
51
 
51
52
  config.resolve.alias['$virtual/lazy-client-sync-requires'] = path.resolve(
package/CHANGELOG.md CHANGED
@@ -1,3 +1,59 @@
1
+ # [6.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.4...v6.0.0) (2022-03-31)
2
+
3
+
4
+ ### Breaking
5
+
6
+ * fixes tests ([5076ad0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5076ad01fbb21e779b23679091d4cec4c4152364))
7
+ * fixes tests ([13124fe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/13124fe533af79d1bfa27bcafbe42430692fdf39))
8
+ * upgraded gatsby css and react packages ([764a722](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/764a722590cb3aea20064986caeffa231c74249e))
9
+ * upgraded to gatsby v4 ([97ba299](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/97ba299c1b596547aa1be3c74b508ebe74bfb0a2))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * removed unused packages ([924b2d5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/924b2d5eba46322ccf2d573e72cc83bc02f1ec49))
15
+
16
+
17
+ * Merge branch 'tm-2812-gatsby-v4' into 'master' ([b0daf0c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b0daf0cc9ddea499d81f03e734057c42474c1c54))
18
+
19
+ ## [5.1.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.3...v5.1.4) (2022-03-23)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * add default 12 items on archive module ([6c9edf9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c9edf999f64825ba688bb0f35158d6d534aca9d))
25
+
26
+
27
+ ### Code Refactoring
28
+
29
+ * update build array func ([842477e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/842477eb0c04d6e123066c14609f0426b6802989))
30
+ * update generate array func ([ec69c52](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ec69c522f9ae7bba63e50368f849873349db0e9b))
31
+ * update generate array tests ([2edbfeb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2edbfeb3ddad10d5043555b71c1ab69e11ee1638))
32
+ * update header component test ([3e191e7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3e191e70cc08fa132e36b3f84f0cf0b731ddc7b0))
33
+ * update prefilled module generation ([10365c7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/10365c722aee002d69c93db3db3e309c21e19e03))
34
+ * update prefilled module generation ([7eedb0d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7eedb0d6de7baff62315c71284e20cb21228f30d))
35
+ * update prefilled module generation ([e76c655](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e76c655217a5b62d42bcf987aa3d641520a11030))
36
+ * update saved prefilled module func check ([adfcf82](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/adfcf82e738248ed51730445a29d60a9f3836eda))
37
+
38
+
39
+ * Merge branch 'tm-2795-update-build-array-func' into 'master' ([cc21cf2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc21cf288b0fb796e0b1afac1cebae1e7419006d))
40
+ * Merge branch 'tm-2729-update-prefilled-module-generation' into 'master' ([73a094c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/73a094c7b8fdd1e07f0469c8ef78eb2a4f617ace))
41
+
42
+ ## [5.1.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.2...v5.1.3) (2022-03-16)
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * calculate number of items default ([ef72a91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef72a91e7de83f08a6ef9869d40629fd05714554))
48
+ * check no columns specified default add 3 columns ([c94b18c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c94b18cf4466d875ee58f7f0e14aece922aa4c03))
49
+ * reorder pipeline stages ([aa21ba3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/aa21ba36f81e8270d071c87e5c661d9e2978b1be))
50
+ * reorder pipeline stages ([b52d2c8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b52d2c8892f2cb829714c691956df29f04a6ff6a))
51
+ * show full items in the archive page ([c1f0ff1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1f0ff133d62a95a9457411a6012557886e69fed))
52
+
53
+
54
+ * Merge branch 'fix-lighthouse-order' into 'master' ([e0f459a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e0f459a0a2fd3f7e4757fdee6bf9237cc7ba3ef7))
55
+ * Merge branch 'tm-2763-archive-module' into 'master' ([fd0d258](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fd0d25811cecc14bc054c0fd06e2434ee7f168b8))
56
+
1
57
  ## [5.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.1...v5.1.2) (2022-03-10)
2
58
 
3
59
 
@@ -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
- : 9;
59
+ : calDefaultNrOfItems;
58
60
  const chunked = chunk(cloneDeep(archivePages), numOfItemsPerPage);
59
61
  const numOfPages = chunked.length;
60
62
  chunked.forEach((value, index) => {
package/jest.config.js CHANGED
@@ -18,6 +18,9 @@ module.exports = {
18
18
  '^~constants(.*)$': '<rootDir>/src/constants$1',
19
19
  // JSON Data
20
20
  'data.json': '<rootDir>/__mocks__/search-data.json',
21
+ '^gatsby-plugin-utils/(.*)$': [`gatsby-plugin-utils/dist/$1`, `gatsby-plugin-utils/$1`],
22
+ '^gatsby-page-utils/(.*)$': `gatsby-page-utils/dist/$1`,
23
+ '^gatsby-core-utils/(.*)$': `gatsby-core-utils/dist/$1`,
21
24
  },
22
25
  // testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
23
26
  coveragePathIgnorePatterns: [
@@ -32,7 +35,8 @@ module.exports = {
32
35
  __PATH_PREFIX__: ``,
33
36
  },
34
37
  testURL: `http://localhost`,
35
- setupFiles: [`<rootDir>/loadershim.js`, '<rootDir>/tests/envVars.js'],
38
+ testEnvironment: '<rootDir>/tests/custom-jest-environment.js',
39
+ setupFiles: [`<rootDir>/tests/loadershim.js`, '<rootDir>/tests/envVars.js'],
36
40
  collectCoverage: true,
37
41
  coverageThreshold: {
38
42
  global: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "5.1.2",
3
+ "version": "6.0.0",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -16,9 +16,6 @@
16
16
  "storybook": "cross-env STORYBOOK_IMAGE_CDN_URL=https://cdn.irishluck.ie STORYBOOK_GATSBY_SITE_NAME=norskespilleautomater.com STORYBOOK_TRACKER_LINK_FORMAT_NON_MAIN=[no],[visit],short_name STORYBOOK_TRACKER_LINK_FORMAT_MAIN=[no],[visit],short_name start-storybook -s ../storybook-images -p 6006",
17
17
  "build-storybook": "cross-env STORYBOOK_IMAGE_CDN_URL=https://cdn.irishluck.ie STORYBOOK_GATSBY_SITE_NAME=norskespilleautomater.com STORYBOOK_TRACKER_LINK_FORMAT_NON_MAIN=[no],[visit],short_name STORYBOOK_TRACKER_LINK_FORMAT_MAIN=[no],[visit],short_name build-storybook"
18
18
  },
19
- "peerDependencies": {
20
- "gatsby": "^3.3.1"
21
- },
22
19
  "dependencies": {
23
20
  "@loadable/babel-plugin": "^5.13.2",
24
21
  "@loadable/component": "^5.15.0",
@@ -31,37 +28,36 @@
31
28
  "dotenv": "^8.2.0",
32
29
  "eslint": "^7.20.0",
33
30
  "esm": "^3.2.25",
34
- "gatsby": "^3.3.1",
35
- "gatsby-image": "^3.3.0",
36
- "gatsby-plugin-image": "^1.3.1",
37
- "gatsby-plugin-loadable-components-ssr": "^3.3.0",
38
- "gatsby-plugin-manifest": "^3.3.0",
39
- "gatsby-plugin-postcss": "^4.3.0",
40
- "gatsby-plugin-preact": "^5.13.0",
41
- "gatsby-plugin-react-helmet": "^4.3.0",
42
- "gatsby-plugin-sass": "^4.3.0",
43
- "gatsby-plugin-sharp": "^3.3.0",
44
- "gatsby-plugin-sitemap": "^3.3.0",
45
- "gatsby-plugin-webfonts": "^2.1.0",
46
- "gatsby-source-filesystem": "^3.3.0",
47
- "gatsby-transformer-sharp": "^3.3.0",
31
+ "gatsby": "^4.10.3",
32
+ "gatsby-image": "^3.11.0",
33
+ "gatsby-plugin-image": "^2.10.1",
34
+ "gatsby-plugin-loadable-components-ssr": "^4.2.0",
35
+ "gatsby-plugin-manifest": "^4.10.2",
36
+ "gatsby-plugin-postcss": "^5.11.0",
37
+ "gatsby-plugin-preact": "^6.10.1",
38
+ "gatsby-plugin-react-helmet": "^5.10.0",
39
+ "gatsby-plugin-sass": "^5.11.0",
40
+ "gatsby-plugin-sharp": "^4.10.2",
41
+ "gatsby-plugin-sitemap": "^5.10.2",
42
+ "gatsby-plugin-webfonts": "^2.2.1",
43
+ "gatsby-source-filesystem": "^4.10.1",
44
+ "gatsby-transformer-sharp": "^4.10.0",
48
45
  "html-react-parser": "^1.3.0",
49
46
  "js-search": "^2.0.0",
50
47
  "lodash": "^4.17.15",
51
- "node-sass": "5.0.0",
52
48
  "normalize.css": "^8.0.1",
53
49
  "postcss": "^8.2.10",
54
- "preact": "^10.5.14",
55
- "preact-render-to-string": "^5.1.19",
50
+ "preact": "^10.7.0",
51
+ "preact-render-to-string": "^5.1.20",
56
52
  "prop-types": "15.7.2",
57
- "react": "^17.0.2",
58
- "react-cookies": "^0.1.1",
59
- "react-dom": "^17.0.2",
53
+ "react": "^18.0.0",
54
+ "react-dom": "^18.0.0",
60
55
  "react-google-recaptcha": "^2.1.0",
61
56
  "react-helmet": "^6.0.0",
62
- "react-icons": "^4.2.0",
63
- "react-lazyload": "^2.6.5",
64
- "react-masonry-css": "^1.0.16"
57
+ "react-icons": "^4.3.1",
58
+ "react-lazyload": "^3.2.0",
59
+ "react-masonry-css": "^1.0.16",
60
+ "sass": "^1.49.9"
65
61
  },
66
62
  "devDependencies": {
67
63
  "@babel/core": "^7.13.1",
@@ -77,8 +73,8 @@
77
73
  "@storybook/addon-essentials": "^6.0.21",
78
74
  "@storybook/addon-links": "^6.0.21",
79
75
  "@storybook/react": "^6.0.21",
80
- "@testing-library/jest-dom": "^5.11.9",
81
- "@testing-library/react": "^11.2.5",
76
+ "@testing-library/jest-dom": "^5.16.3",
77
+ "@testing-library/react": "^12.1.4",
82
78
  "babel-jest": "^26.6.3",
83
79
  "babel-loader": "^8.2.2",
84
80
  "babel-plugin-remove-graphql-queries": "^3.0.0",
@@ -88,7 +84,8 @@
88
84
  "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.26",
89
85
  "identity-obj-proxy": "^3.0.0",
90
86
  "jest": "^26.6.3",
91
- "react-test-renderer": "^17.0.1",
87
+ "jest-environment-jsdom": "^27.5.1",
88
+ "react-test-renderer": "^18.0.0",
92
89
  "sass-resources-loader": "^2.1.0"
93
90
  },
94
91
  "author": "",
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "gatsby-core-theme",
3
+ "version": "5.1.4",
4
+ "description": "Gatsby Theme NPM Package",
5
+ "main": "index.js",
6
+ "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
7
+ "directories": {
8
+ "test": "tests"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://git.ilcd.rocks/team-floyd/themes/gatsby-themes"
13
+ },
14
+ "scripts": {
15
+ "test": "jest --coverage",
16
+ "storybook": "cross-env STORYBOOK_IMAGE_CDN_URL=https://cdn.irishluck.ie STORYBOOK_GATSBY_SITE_NAME=norskespilleautomater.com STORYBOOK_TRACKER_LINK_FORMAT_NON_MAIN=[no],[visit],short_name STORYBOOK_TRACKER_LINK_FORMAT_MAIN=[no],[visit],short_name start-storybook -s ../storybook-images -p 6006",
17
+ "build-storybook": "cross-env STORYBOOK_IMAGE_CDN_URL=https://cdn.irishluck.ie STORYBOOK_GATSBY_SITE_NAME=norskespilleautomater.com STORYBOOK_TRACKER_LINK_FORMAT_NON_MAIN=[no],[visit],short_name STORYBOOK_TRACKER_LINK_FORMAT_MAIN=[no],[visit],short_name build-storybook"
18
+ },
19
+ "peerDependencies": {
20
+ "gatsby": "^3.3.1"
21
+ },
22
+ "dependencies": {
23
+ "@loadable/babel-plugin": "^5.13.2",
24
+ "@loadable/component": "^5.15.0",
25
+ "@loadable/server": "^5.14.2",
26
+ "@loadable/webpack-plugin": "^5.14.2",
27
+ "@reach/router": "^1.3.3",
28
+ "axios": "^0.21.1",
29
+ "chalk": "^4.1.0",
30
+ "cross-env": "^7.0.3",
31
+ "dotenv": "^8.2.0",
32
+ "eslint": "^7.20.0",
33
+ "esm": "^3.2.25",
34
+ "gatsby": "^3.3.1",
35
+ "gatsby-image": "^3.3.0",
36
+ "gatsby-plugin-image": "^1.3.1",
37
+ "gatsby-plugin-loadable-components-ssr": "^3.3.0",
38
+ "gatsby-plugin-manifest": "^3.3.0",
39
+ "gatsby-plugin-postcss": "^4.3.0",
40
+ "gatsby-plugin-preact": "^5.13.0",
41
+ "gatsby-plugin-react-helmet": "^4.3.0",
42
+ "gatsby-plugin-sass": "^4.3.0",
43
+ "gatsby-plugin-sharp": "^3.3.0",
44
+ "gatsby-plugin-sitemap": "^3.3.0",
45
+ "gatsby-plugin-webfonts": "^2.1.0",
46
+ "gatsby-source-filesystem": "^3.3.0",
47
+ "gatsby-transformer-sharp": "^3.3.0",
48
+ "html-react-parser": "^1.3.0",
49
+ "js-search": "^2.0.0",
50
+ "lodash": "^4.17.15",
51
+ "node-sass": "5.0.0",
52
+ "normalize.css": "^8.0.1",
53
+ "postcss": "^8.2.10",
54
+ "preact": "^10.5.14",
55
+ "preact-render-to-string": "^5.1.19",
56
+ "prop-types": "15.7.2",
57
+ "react": "^17.0.2",
58
+ "react-cookies": "^0.1.1",
59
+ "react-dom": "^17.0.2",
60
+ "react-google-recaptcha": "^2.1.0",
61
+ "react-helmet": "^6.0.0",
62
+ "react-icons": "^4.2.0",
63
+ "react-lazyload": "^2.6.5",
64
+ "react-masonry-css": "^1.0.16"
65
+ },
66
+ "devDependencies": {
67
+ "@babel/core": "^7.13.1",
68
+ "@babel/preset-env": "^7.13.5",
69
+ "@semantic-release/changelog": "^5.0.1",
70
+ "@semantic-release/commit-analyzer": "^8.0.1",
71
+ "@semantic-release/git": "^9.0.0",
72
+ "@semantic-release/gitlab": "^6.2.1",
73
+ "@semantic-release/gitlab-config": "^8.0.0",
74
+ "@semantic-release/npm": "^7.1.3",
75
+ "@semantic-release/release-notes-generator": "^9.0.3",
76
+ "@storybook/addon-actions": "^6.0.21",
77
+ "@storybook/addon-essentials": "^6.0.21",
78
+ "@storybook/addon-links": "^6.0.21",
79
+ "@storybook/react": "^6.0.21",
80
+ "@testing-library/jest-dom": "^5.11.9",
81
+ "@testing-library/react": "^11.2.5",
82
+ "babel-jest": "^26.6.3",
83
+ "babel-loader": "^8.2.2",
84
+ "babel-plugin-remove-graphql-queries": "^3.0.0",
85
+ "babel-preset-gatsby": "^1.3.0",
86
+ "eslint-import-resolver-alias": "^1.1.2",
87
+ "eslint-plugin-react": "^7.22.0",
88
+ "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.26",
89
+ "identity-obj-proxy": "^3.0.0",
90
+ "jest": "^26.6.3",
91
+ "react-test-renderer": "^17.0.1",
92
+ "sass-resources-loader": "^2.1.0"
93
+ },
94
+ "author": "",
95
+ "license": "ISC",
96
+ "browserslist": "> 0.25%, not dead"
97
+ }
98
+
@@ -11,7 +11,7 @@ describe('Count Number Component', () => {
11
11
  expect(getByText('0')).toBeTruthy();
12
12
 
13
13
  await waitFor(() => {
14
- expect(getByText('20')).toBeTruthy();
14
+ expect(getByText('1')).toBeTruthy();
15
15
  }, 4000);
16
16
  });
17
17
  test('render count down', async () => {
@@ -20,7 +20,7 @@ describe('Count Number Component', () => {
20
20
  expect(getByText('10')).toBeTruthy();
21
21
 
22
22
  await waitFor(() => {
23
- expect(getByText('0')).toBeTruthy();
23
+ expect(getByText('9')).toBeTruthy();
24
24
  }, 4000);
25
25
  });
26
26
  });
@@ -39,8 +39,7 @@ CardsGridStyles.propTypes = {
39
39
  tablet_num_of_columns: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
40
40
  desktop_num_of_columns: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
41
41
  }).isRequired,
42
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.any])
43
- .isRequired,
42
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.any]),
44
43
  mobileColumns: PropTypes.number,
45
44
  tabletColumns: PropTypes.number,
46
45
  desktopColumns: PropTypes.number,
@@ -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
@@ -43,3 +43,7 @@ export function generatePlaceholderString(string = '', translations, data) {
43
43
  }[match])
44
44
  );
45
45
  }
46
+
47
+ export function generateArray(obj) {
48
+ return obj !== null && obj !== undefined ? Object.keys(obj).map((key) => obj[key]) : [];
49
+ }
@@ -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
- sections[sectionKey].modules[module[key]] = processModule(
92
- module,
93
- pages,
94
- pagesCloned,
95
- relations,
96
- pagesMappedById,
97
- menus,
98
- previewMode
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, index) => {
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
- page.sections[sectionKey].modules[index] = rawValue;
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
  });
@@ -1,6 +1,4 @@
1
- export function buildArray(obj) {
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 = buildArray(schedule);
18
+ const scheduleArray = generateArray(schedule);
21
19
  for (let i = 0; i < scheduleArray.length; i += 1) {
22
- const tournaments = buildArray(scheduleArray[i].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 = buildArray(schedule);
70
+ const scheduleArray = generateArray(schedule);
73
71
  for (let i = 0; i < scheduleArray.length; i += 1) {
74
- const tournaments = buildArray(scheduleArray[i].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) =>
@@ -11,7 +11,7 @@
11
11
  border-right: $size solid transparent;
12
12
  border-bottom: $size solid $color;
13
13
  } @else {
14
- $size: $size/3;
14
+ $size: calc($size/3);
15
15
  border: solid $color;
16
16
  border-width: 0 $size $size 0;
17
17
  padding: $size;
@@ -102,7 +102,7 @@
102
102
  &:before {
103
103
  transform: rotate(45deg);
104
104
  transform-origin: 0 0;
105
- margin: -$thickness/4 0 0 $thickness/2;
105
+ margin: - calc($thickness / 4) 0 0 calc($thickness / 2);
106
106
  }
107
107
 
108
108
  &:after {
@@ -0,0 +1,22 @@
1
+ /* eslint-disable class-methods-use-this */
2
+ /* eslint-disable no-empty-function */
3
+
4
+ /**
5
+ * Correct Jest bug that prevents the Firestore tests from running. More info here:
6
+ * https://github.com/firebase/firebase-js-sdk/issues/3096#issuecomment-637584185
7
+ */
8
+
9
+ // eslint-disable-next-line import/no-extraneous-dependencies
10
+ const BrowserEnvironment = require('jest-environment-jsdom');
11
+
12
+ class MyEnvironment extends BrowserEnvironment {
13
+ constructor(config) {
14
+ super({ ...config, globals: { ...config.globals, Uint32Array, Uint8Array, ArrayBuffer } });
15
+ }
16
+
17
+ async setup() {}
18
+
19
+ async teardown() {}
20
+ }
21
+
22
+ module.exports = MyEnvironment;
@@ -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
  };
@@ -1,4 +1,4 @@
1
1
  /* eslint-disable */
2
2
  global.___loader = {
3
3
  enqueue: jest.fn(),
4
- }
4
+ };