gatsby-matrix-theme 23.0.5 → 24.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/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # [24.0.0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v23.0.5...v24.0.0) (2023-05-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add facebook pixel ([cd571b3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/cd571b3dcb73726ac09eefb81bddc0cd78651837))
7
+ * test fix ([80a6399](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/80a63991dc219f7d93a4535fbda1adb04390d499))
8
+
9
+
10
+ ### Code Refactoring
11
+
12
+ * change link text ([7e93fc0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7e93fc03611125ae95d1fc03d174a95d44d0dbda))
13
+ * changes to generate link fn for email and link ([56e16d6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/56e16d6f331ebcc9f4e1c2c8a9a8892accc322fc))
14
+ * update wagering calculator calculation ([aa44124](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/aa44124025161c602a137d75af3b83ea129e8f74))
15
+
16
+
17
+ * Merge branch 'master' of https://git.ilcd.rocks/team-floyd/themes/matrix-theme ([df3098e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/df3098ec289c5a35574cc16a4cf80bd7021e49c2))
18
+ * Merge branch 'tm-3404-facebook-pixel' into 'master' ([f5fe05e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f5fe05e3a281a9e29a11f119ea6d2e7f5077b524))
19
+ * Merge branch 'master' into info-grid-email ([8d0f00d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8d0f00d0c12adcb41a0a813832595870555fc86d))
20
+ * Merge branch 'info-grid-email' into 'master' ([ae2dada](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ae2dada06b4ff34ec421f4e48b93bafbbb8c4b77))
21
+ * revert temp change ([a510d09](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a510d092060bf98eb4e13cf0c5d566e31b1f01f2))
22
+ * Merge branch 'master' into info-grid-email ([7d233af](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7d233afe9deae4bc05a4134a4695c8d2d5b904dd))
23
+ * Merge branch 'tm-3094-wagering-calculator' into 'master' ([34c187e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/34c187ece4c78aeee50b755151a83bf3adf3e50a))
24
+
25
+
26
+ ### Tests
27
+
28
+ * changes to test 1/2 ([f24f1cc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f24f1cc4ef2f95ecdaaca592120e6ee964d724b1))
29
+ * fix test 2/2 ([e7e846a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e7e846a875a7e04cae487d3e7f3e3fc67535938e))
30
+
1
31
  ## [23.0.5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v23.0.4...v23.0.5) (2023-05-24)
2
32
 
3
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "23.0.5",
3
+ "version": "24.0.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -25,9 +25,11 @@ const WageringCalculator = ({
25
25
  (Number(elements.bonus.value) +
26
26
  (elements.calc_select.value !== 'bonus' ? Number(elements.deposit.value) : 0)) *
27
27
  Number(elements.wagering.value) *
28
- (100 / (Number(elements.contribution.value) || 1))
28
+ (100 / Number(elements.contribution.value))
29
29
  )
30
30
  );
31
+ // eslint-disable-next-line
32
+ !elements.contribution.value && (elements.contribution.value = 100);
31
33
  };
32
34
 
33
35
  return (
@@ -76,7 +78,7 @@ const WageringCalculator = ({
76
78
  <p className={styles.infoText}>{infoText}</p>
77
79
  </div>
78
80
  )}
79
- {typeof result === 'number' && (
81
+ {!!result && (
80
82
  <div className={styles.resultContainer}>
81
83
  <span>{translate(translations, 'wagecalc_result', 'Result')}</span>
82
84
  <span>{result}</span>
@@ -16,21 +16,9 @@ export const defaultInfoGrid = {
16
16
  game_provider: ['game_provider.name', '🎮 Game Provider'],
17
17
  launch_date: ['launch_date', '✅ Launched', (value) => formatDate(value)],
18
18
  rtp: ['rtp', '🎮 RTP', (value) => generateRtp(value)],
19
- volatility: [
20
- 'volatility',
21
- '🎲 Volatility',
22
- (value, translations) => generateVolatility(value, translations),
23
- ],
24
- freespins: [
25
- 'freespins',
26
- '🎲 Freespins',
27
- (value, translations) => generateYesorNo(value, translations),
28
- ],
29
- jackpot: [
30
- 'jackpots',
31
- '✅ Jackpot',
32
- (value, translations) => generateYesorNo(value, translations),
33
- ],
19
+ volatility: ['volatility', '🎲 Volatility', (value, props) => generateVolatility(value, props)],
20
+ freespins: ['freespins', '🎲 Freespins', (value, props) => generateYesorNo(value, props)],
21
+ jackpot: ['jackpots', '✅ Jackpot', (value, props) => generateYesorNo(value, props)],
34
22
  winning_lines: ['winning_lines', '🎲 Paylines'],
35
23
  number_of_reels: ['number_of_reels', '🎲 Wheels'],
36
24
  slot_type: ['game_categories.0.name', '🎲 Slot Type'],
@@ -39,21 +27,9 @@ export const defaultInfoGrid = {
39
27
  game_provider: ['game_provider.name', '🎮 Game Provider'],
40
28
  launch_date: ['launch_date', '✅ Launched', (value) => formatGameDate(value)],
41
29
  rtp: ['rtp', 'RTP', (value) => generateRtp(value)],
42
- volatility: [
43
- 'volatility',
44
- '🎲 Volatility',
45
- (value, translations) => generateVolatility(value, translations),
46
- ],
47
- freespins: [
48
- 'freespins',
49
- '🎲 Freespins',
50
- (value, translations) => generateYesorNo(value, translations),
51
- ],
52
- jackpot: [
53
- 'jackpots',
54
- '✅ Jackpot',
55
- (value, translations) => generateYesorNo(value, translations),
56
- ],
30
+ volatility: ['volatility', '🎲 Volatility', (value, props) => generateVolatility(value, props)],
31
+ freespins: ['freespins', '🎲 Freespins', (value, props) => generateYesorNo(value, props)],
32
+ jackpot: ['jackpots', '✅ Jackpot', (value, props) => generateYesorNo(value, props)],
57
33
  winning_lines: ['winning_lines', '🎮 Paylines'],
58
34
  number_of_reels: ['number_of_reels', '🎲 Wheels'],
59
35
  slot_type: ['game_categories.0.name', '🎮 Slot Type'],
@@ -75,7 +51,7 @@ export const twoColInfoGrid = {
75
51
  '✅ Support Types',
76
52
  (value) => generateLicenseAndSupportTypes(value, null, 3),
77
53
  ],
78
- email: ['email', '📧 Email', (value) => generateLink(value)],
54
+ email: ['', '📧 Email', (value, props) => generateLink(value, props)],
79
55
  },
80
56
  details: {
81
57
  software: ['software', '🎮 Game Providers', (value) => latestItems(value, null)],
@@ -108,7 +84,7 @@ export const twoColInfoGrid = {
108
84
  'Support Types',
109
85
  (value) => generateLicenseAndSupportTypes(value, null, 3),
110
86
  ],
111
- email: ['email', 'Email', (value) => generateLink(value)],
87
+ email: ['', 'Email', (value, props) => generateLink(value, props)],
112
88
  currencies: [
113
89
  'bonus.currencies',
114
90
  'Accepted Currencies',
@@ -116,11 +92,7 @@ export const twoColInfoGrid = {
116
92
  ],
117
93
  },
118
94
  details: {
119
- software: [
120
- 'software',
121
- 'Live Games',
122
- (value, translations) => generateYesorNo(value, translations),
123
- ],
95
+ software: ['software', 'Live Games', (value, props) => generateYesorNo(value, props)],
124
96
  deposit_methods: [
125
97
  'bonus.deposit_methods',
126
98
  'Payment Methods',
@@ -134,21 +106,9 @@ export const twoColInfoGrid = {
134
106
  rtp: ['rtp', 'RTP', (value) => generateRtp(value)],
135
107
  },
136
108
  details: {
137
- volatility: [
138
- 'volatility',
139
- 'Volatility',
140
- (value, translations) => generateVolatility(value, translations),
141
- ],
142
- respins: [
143
- 'freespins',
144
- 'Freespins',
145
- (value, translations) => generateYesorNo(value, translations),
146
- ],
147
- jackpot: [
148
- 'jackpots',
149
- 'Jackpot',
150
- (value, translations) => generateYesorNo(value, translations),
151
- ],
109
+ volatility: ['volatility', 'Volatility', (value, props) => generateVolatility(value, props)],
110
+ respins: ['freespins', 'Freespins', (value, props) => generateYesorNo(value, props)],
111
+ jackpot: ['jackpots', 'Jackpot', (value, props) => generateYesorNo(value, props)],
152
112
  winning_lines: ['winning_lines', 'Paylines'],
153
113
  number_of_reels: ['number_of_reels', 'Wheels/Reels'],
154
114
  },
@@ -51,7 +51,7 @@ const InfoGrid = ({
51
51
  <div ref={ref} className={styles.grid}>
52
52
  {Object.keys(gridItems).map((key) => {
53
53
  const labelTitle = translate(translations, key, gridLabels[key][1]);
54
- const value = generateLabel(key, gridItems[key], gridLabels[key][2], translations);
54
+ const value = generateLabel(key, gridItems[key], gridLabels[key][2], { translations });
55
55
  return gridItem(labelTitle, value);
56
56
  })}
57
57
  </div>
@@ -95,7 +95,7 @@ const InfoGrid = ({
95
95
  valueKey,
96
96
  gridItems[itemKey][valueKey],
97
97
  gridLabels[itemKey][valueKey][2],
98
- translations
98
+ { translations, template }
99
99
  );
100
100
  const isSoftware = valueKey === 'software';
101
101
  const splitProviders =
@@ -272,4 +272,4 @@ describe('Show Info Grid Component', () => {
272
272
  });
273
273
  afterEach(() => {
274
274
  cleanup();
275
- });
275
+ });
@@ -3,7 +3,7 @@
3
3
  import React from 'react';
4
4
  import parse from 'html-react-parser';
5
5
  import PropTypes from 'prop-types';
6
-
6
+ import FacebookPixel from '../../../helpers/facebookPixel';
7
7
  import { schemaGenerator } from '~helpers/schema';
8
8
  import { getUrl, getPageImage, imagePrettyUrl } from '~helpers/getters';
9
9
  import keygen from '~helpers/keygen';
@@ -68,6 +68,7 @@ const HeadData = ({ page = {}, siteInfo }) => {
68
68
  <title>{metaTitle}</title>
69
69
  <html lang={getLanguage(isIL || page.language)} />
70
70
  <meta name="description" content={parsedMetaDescr} />
71
+ <FacebookPixel />
71
72
  {page.meta_robots && process.env.GATSBY_ACTIVE_ENV !== 'development' && (
72
73
  <meta name="robots" content={page.meta_robots.join()} />
73
74
  )}
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Script } from 'gatsby';
3
+
4
+ const FacebookPixel = () => (
5
+ <>
6
+ {process.env.ENABLE_PIXEL && (
7
+ <>
8
+ <meta name="facebook-domain-verification" content={process.env.FBVERIFACTION} />
9
+
10
+ <Script strategy="idle">
11
+ {`
12
+ !function(f,b,e,v,n,t,s)
13
+ {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
14
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};
15
+ if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
16
+ n.queue=[];t=b.createElement(e);t.async=!0;
17
+ t.src=v;s=b.getElementsByTagName(e)[0];
18
+ s.parentNode.insertBefore(t,s)}(window, document,'script',
19
+ 'https://connect.facebook.net/en_US/fbevents.js');
20
+ fbq('init', ${process.env.PIXEL_ID});
21
+ fbq('track', 'PageView');
22
+ `}
23
+ </Script>
24
+ <Script strategy="idle">
25
+ {`
26
+ if (typeof window !== 'undefined') {
27
+ document.querySelector('noscript').innerHTML = \`
28
+ <img
29
+ height="1"
30
+ width="1"
31
+ style={{ display: 'none' }}
32
+ src="https://www.facebook.com/tr?id=${process.env.PIXEL_ID}&ev=PageView&noscript=1"
33
+ />
34
+ \`;
35
+ }
36
+ `}
37
+ </Script>
38
+ </>
39
+ )}
40
+ </>
41
+ );
42
+
43
+ export default FacebookPixel;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable array-callback-return */
2
2
  /* eslint-disable no-nested-ternary */
3
3
  import React from 'react';
4
- import { translate } from 'gatsby-core-theme/src/helpers/getters';
4
+ import { prettyTracker, translate } from 'gatsby-core-theme/src/helpers/getters';
5
5
 
6
6
  export function getObjectValue(obj, path) {
7
7
  if (!obj) return null;
@@ -42,9 +42,9 @@ export const getKeyValues = (relation, data, market) => {
42
42
  return obj;
43
43
  };
44
44
 
45
- export const generateLabel = (key, value, fnc, translations) => {
45
+ export const generateLabel = (key, value, fnc, props) => {
46
46
  if (fnc) {
47
- return fnc(value, translations);
47
+ return fnc(value, props);
48
48
  }
49
49
 
50
50
  if (typeof value === 'string') {
@@ -80,7 +80,8 @@ export const formatGameDate = (value) => {
80
80
  return acc.replace(/^/, current + prefix);
81
81
  }, '');
82
82
  };
83
- export const generateVolatility = (value, translations) => {
83
+ export const generateVolatility = (value, props) => {
84
+ const translations = props?.translations || null;
84
85
  if (value === null) return translate(translations, 'low', 'Low');
85
86
  return value === 0
86
87
  ? translate(translations, 'low', 'Low')
@@ -89,8 +90,10 @@ export const generateVolatility = (value, translations) => {
89
90
  : translate(translations, 'high', 'High');
90
91
  };
91
92
  export const formatDate = (value) => value?.slice(0, 4);
92
- export const generateYesorNo = (value, translations) =>
93
- value ? translate(translations, 'yes', 'Yes') : translate(translations, 'no', 'No');
93
+ export const generateYesorNo = (value, props) => {
94
+ const translations = props?.translations || null;
95
+ return value ? translate(translations, 'yes', 'Yes') : translate(translations, 'no', 'No');
96
+ };
94
97
  export const generateRtp = (value) => (value ? `${value}%` : null);
95
98
  export const latestItems = (items, translations, limit = null) => {
96
99
  if (items === null) return null;
@@ -114,7 +117,8 @@ export const generateLicenseAndSupportTypes = (value, translations, limit) => {
114
117
  return acc + prefix + current;
115
118
  }, '');
116
119
  };
117
- export const isLiveCasino = (value, translations) => {
120
+ export const isLiveCasino = (value, props) => {
121
+ const translations = props?.translations || null;
118
122
  if (value === null) return translate(translations, 'no', 'No');
119
123
 
120
124
  return generateYesorNo(
@@ -129,13 +133,21 @@ export const getCurrencies = (value) => {
129
133
  ?.slice(0, 5)
130
134
  ?.map((elm) => elm?.iso_code);
131
135
  };
132
- export const generateLink = (value) => {
136
+ export const generateLink = (value, props) => {
133
137
  if (value === null) return null;
134
- return (
135
- <a href={/\b[a-z0-9-_.]+@[a-z0-9-_.]+(\.[a-z0-9]+)+/i.test(value) ? `mailto:${value}` : value}>
136
- {value}
137
- </a>
138
- );
138
+
139
+ const template = props?.template || null;
140
+ let link;
141
+ let text;
142
+
143
+ if (/\b[a-z0-9-_.]+@[a-z0-9-_.]+/i.test(value)) {
144
+ link = `mailto:${value}`;
145
+ text = value;
146
+ } else {
147
+ link = prettyTracker(value, 'main', false, template);
148
+ text = value.url;
149
+ }
150
+ return <a href={link}>{text}</a>;
139
151
  };
140
152
  export const getMaxWin = (value) => (value ? `${value}x innsatsen` : null);
141
153
  export const getMaxStake = (value) => (value ? `${value} kroner` : null);
@@ -132,9 +132,9 @@ describe('Info Grid helper component', () => {
132
132
  });
133
133
  test('Generate link for email', () => {
134
134
  const email = () => <a href="mailto:hey@casumo.com">hey@casumo.com</a>;
135
- const url = () => <a href="www.google.com">www.google.com</a>;
135
+ const url = () => <a href="/ice-casino">www.ice-casino.com</a>;
136
136
 
137
137
  expect(generateLink(data.relation.email)).toStrictEqual(email());
138
- expect(generateLink(data.relation.url)).toStrictEqual(url());
138
+ expect(generateLink(data.relation, { template: 'operator_review' })).toStrictEqual(url());
139
139
  });
140
140
  });
@@ -345,4 +345,4 @@
345
345
 
346
346
 
347
347
 
348
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"},{"titlePrefix":"","directory":"./src","files":"**/**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"},{"titlePrefix":"","directory":"./src","files":"**/**/**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"}];</script><script src="runtime~main.23bfd16b.iframe.bundle.js"></script><script src="134.f050c17b.iframe.bundle.js"></script><script src="main.b202a57c.iframe.bundle.js"></script></body></html>
348
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"},{"titlePrefix":"","directory":"./src","files":"**/**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"},{"titlePrefix":"","directory":"./src","files":"**/**/**/**/**/*.stories.js","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.js)$"}];</script><script src="runtime~main.23bfd16b.iframe.bundle.js"></script><script src="134.f050c17b.iframe.bundle.js"></script><script src="main.0c3946da.iframe.bundle.js"></script></body></html>