gatsby-core-theme 20.0.10 → 20.0.12

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,24 @@
1
+ ## [20.0.12](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.11...v20.0.12) (2023-04-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added geo tracking location ([c548d85](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c548d858a3ffdf9dcc2cc57526cd035ff48a1350))
7
+ * added geotargetted tracker links ([a1019e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a1019e6a5fbfe3a331f1da556f4ff04aa6d8e111))
8
+
9
+
10
+ * Merge branch 'geo-tracker' into 'master' ([78b4e95](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/78b4e958a7dfa4318ebb1fb4ef52e70d590b229c))
11
+
12
+ ## [20.0.11](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.10...v20.0.11) (2023-04-19)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * added new param with border gradient ([1592f6a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1592f6aa9b6154a8c5dc5a7a0f835dd1b1112224))
18
+
19
+
20
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([5e10f1a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5e10f1acb9d6a59227cba0ff2c2ce0233bcee04e))
21
+
1
22
  ## [20.0.10](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.9...v20.0.10) (2023-04-19)
2
23
 
3
24
 
@@ -11,6 +11,7 @@ import { generateTrackerLink } from './src/helpers/generators';
11
11
  import processor, { processSitemapPages } from './src/helpers/processor';
12
12
  import { pickAuthorsPageKeys } from './src/constants/pick-keys';
13
13
  import { translate } from './src/helpers/getters';
14
+ import { groupBy } from './src/helpers/processor/common';
14
15
 
15
16
  const fs = require('fs');
16
17
 
@@ -322,40 +323,92 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
322
323
  });
323
324
  }
324
325
 
325
- Object.keys(operators || {}).forEach((operatorId) => {
326
- const operator = operators[operatorId];
327
- const trackerLinks = Object.keys(operator.links);
328
- const tracker = trackerLinks.map((key) =>
329
- operator.links[key]
330
- ? generateTrackerLink(operator, key, false, pageTemplate).toLowerCase().replace(' ', '_')
331
- : null
332
- );
333
- tracker.forEach((trackerPath) => {
334
- // Create splash page
335
- if (trackerPath) {
326
+ if (process.env.GEO_TRACKING) {
327
+ const operatorsShortName = groupBy(operators, 'short_name');
328
+ const trackerNames = [];
329
+ Object.keys(operatorsShortName).forEach((shortname) => {
330
+ const operatorsAllMarket = operatorsShortName[shortname];
331
+
332
+ Object.keys(operatorsAllMarket).forEach((operator) => {
333
+ Object.keys(operatorsAllMarket[operator].links).forEach((link) => {
334
+ if (!trackerNames.includes(link)) {
335
+ trackerNames.push(link);
336
+ }
337
+ });
338
+ });
339
+ console.log('=====');
340
+
341
+ const operatorsByMarket = groupBy(operatorsAllMarket, 'market');
342
+
343
+ trackerNames.forEach((link) => {
344
+ const trackerLinkPath = generateTrackerLink(
345
+ operatorsAllMarket[0],
346
+ link,
347
+ false,
348
+ pageTemplate
349
+ )
350
+ .toLowerCase()
351
+ .replace(' ', '_');
352
+ console.log(trackerLinkPath);
353
+
336
354
  const trackerPageObject = {
337
355
  meta_title: 'Tracker',
338
356
  template: pageTemplate,
339
357
  title: 'Tracker',
340
358
  relation_type: 'page',
341
359
  language: languageKey,
342
- path: trackerPath,
360
+ path: trackerLinkPath,
343
361
  meta_robots: ['noindex', 'nofollow'],
344
362
  };
345
363
  createPage({
346
- path: trackerPath,
364
+ path: trackerLinkPath,
347
365
  component: require.resolve('./src/components/app.js'),
348
366
  context: {
349
367
  page: trackerPageObject,
350
368
  siteInfo,
351
- operator,
352
- isTracker: true,
369
+ operatorsByMarket,
370
+ isTrackeGeo: true,
353
371
  isLiveStreamProvider: false,
354
372
  },
355
373
  });
356
- }
374
+ });
357
375
  });
358
- });
376
+ } else {
377
+ Object.keys(operators || {}).forEach((operatorId) => {
378
+ const operator = operators[operatorId];
379
+ const trackerLinks = Object.keys(operator.links);
380
+ const tracker = trackerLinks.map((key) =>
381
+ operator.links[key]
382
+ ? generateTrackerLink(operator, key, false, pageTemplate).toLowerCase().replace(' ', '_')
383
+ : null
384
+ );
385
+ tracker.forEach((trackerPath) => {
386
+ // Create splash page
387
+ if (trackerPath) {
388
+ const trackerPageObject = {
389
+ meta_title: 'Tracker',
390
+ template: pageTemplate,
391
+ title: 'Tracker',
392
+ relation_type: 'page',
393
+ language: languageKey,
394
+ path: trackerPath,
395
+ meta_robots: ['noindex', 'nofollow'],
396
+ };
397
+ createPage({
398
+ path: trackerPath,
399
+ component: require.resolve('./src/components/app.js'),
400
+ context: {
401
+ page: trackerPageObject,
402
+ siteInfo,
403
+ operator,
404
+ isTracker: true,
405
+ isLiveStreamProvider: false,
406
+ },
407
+ });
408
+ }
409
+ });
410
+ });
411
+ }
359
412
  };
360
413
 
361
414
  exports.onCreatePage = ({ page, actions }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "20.0.10",
3
+ "version": "20.0.12",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -9,7 +9,7 @@ import Body from '~pages/body';
9
9
  import HeadData from '~organisms/head';
10
10
 
11
11
  const App = ({ pageContext }) => {
12
- const { translations = {}, isTracker, isPreview } = pageContext;
12
+ const { translations = {}, isTracker, isTrackeGeo, isPreview } = pageContext;
13
13
  const [previewContext, setPreviewContext] = useState({});
14
14
  const [isLoading, setIsLoading] = useState({});
15
15
 
@@ -56,6 +56,15 @@ const App = ({ pageContext }) => {
56
56
  }
57
57
 
58
58
  const TrackerContent = isTracker ? loadable(() => import(`~pages/tracker`)) : null;
59
+ const TrackerGeoContent = isTrackeGeo ? loadable(() => import(`~pages/tracker-geo`)) : null;
60
+
61
+ if (TrackerGeoContent) {
62
+ return (
63
+ <>
64
+ <TrackerGeoContent pageContext={pageContext} path={pageContext.page.path} />
65
+ </>
66
+ );
67
+ }
59
68
 
60
69
  return isTracker ? (
61
70
  <>
@@ -0,0 +1,187 @@
1
+ import React, { useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Button from '~atoms/button';
4
+ import LazyImage from '~hooks/lazy-image';
5
+ import { prettyTracker, imagePrettyUrl, getAltText } from '~helpers/getters';
6
+ import { generateTrackerLink } from '~helpers/generators';
7
+ import styles from './tracker.module.scss';
8
+
9
+ export default function TrackerGeo({
10
+ pageContext,
11
+ path,
12
+ mainText = 'One sec, while we load [operator_name] for you..',
13
+ redirectText = 'If the casino has not loaded within a few seconds',
14
+ btnText = 'Click Here!',
15
+ bgImage = '',
16
+ bgVideo = '',
17
+ redirectTimer = 5000,
18
+ logo = '../../../../../images/logo.svg',
19
+ counter = false,
20
+ operatorLogo = false,
21
+ operatorLogoWidth = '80',
22
+ operatorLogoHeight = '80',
23
+ }) {
24
+ const { page, operatorsByMarket } = pageContext;
25
+ const operator = operatorsByMarket[Object.keys(operatorsByMarket)[0]];
26
+ const showSplashScreen = typeof window !== 'undefined';
27
+
28
+ const getTracker = (operator) => {
29
+ let tracker = '';
30
+ const trackerLinks = operator ? Object.keys(operator.links) : [];
31
+ for (let i = 0; i < trackerLinks.length; i += 1) {
32
+ const trackerLink = trackerLinks[i].toLowerCase().replace(' ', '_');
33
+ if (generateTrackerLink(operator, trackerLink, false, page.template) === path) {
34
+ tracker =
35
+ operator.links[
36
+ Object.keys(operator.links).find(
37
+ (key) => key.toLowerCase() === trackerLink.toLowerCase()
38
+ )
39
+ ];
40
+ break;
41
+ }
42
+
43
+ tracker = operator.links.main;
44
+ }
45
+ return tracker;
46
+ };
47
+
48
+ const getData = async () => {
49
+ await fetch('https://geolocation-db.com/json/', {
50
+ method: 'GET',
51
+ })
52
+ .then((response) => response.json())
53
+ .then(async (data) => {
54
+ const ipAddress = data.IPv4;
55
+ const apiUrl = `http://ip-api.com/json/${ipAddress}?fields=status,countryCode,region,city,zip,lat,lon`;
56
+
57
+ await fetch(apiUrl, {})
58
+ .then((response) => response.json())
59
+ .then((data) => {
60
+ if (data.countryCode) {
61
+ const userMarketOperator =
62
+ operatorsByMarket[`us_en_${data.region.toLowerCase()}`] || null;
63
+ const defaultMarketOperator = operatorsByMarket[`us_en`] || null;
64
+
65
+ const trackerRedirect =
66
+ (userMarketOperator && userMarketOperator[0]) || defaultMarketOperator[0];
67
+
68
+ if (trackerRedirect) {
69
+ setTimeout(
70
+ () => window.location.replace(getTracker(trackerRedirect)),
71
+ redirectTimer
72
+ );
73
+ } else {
74
+ console.log('No Valid Tracker');
75
+ }
76
+ }
77
+ })
78
+ .catch((err) => {
79
+ console.log(`Error ${err}`);
80
+ });
81
+ })
82
+ .catch((err) => {
83
+ console.log(`Error ${err}`);
84
+ });
85
+ };
86
+
87
+ useEffect(() => {
88
+ window.loadGTM = false;
89
+ getData();
90
+ }, []);
91
+
92
+ let background = <></>;
93
+ if (bgVideo) {
94
+ background = (
95
+ <video muted autoPlay loop className={styles.background} poster={bgImage && bgImage}>
96
+ <source src={bgVideo} type="video/webm" />
97
+ </video>
98
+ );
99
+ } else if (bgImage) {
100
+ background = <LazyImage className={styles.background} src={bgImage} alt="background image" />;
101
+ }
102
+
103
+ return (
104
+ <>
105
+ {showSplashScreen && (
106
+ <>
107
+ <div className={styles.container}>
108
+ {background}
109
+ <div className={styles.content}>
110
+ <LazyImage alt="Site logo" src={logo} />
111
+ <p
112
+ className={`${styles.mainText} ${operatorLogo && styles.mainTextWithlogo}`}
113
+ >{`${mainText.replace('[operator_name]', operator.name)}`}</p>
114
+ {operatorLogo && (
115
+ <LazyImage
116
+ src={imagePrettyUrl(
117
+ imageObject?.filename || operator?.logo_url,
118
+ operatorLogoWidth,
119
+ operatorLogoHeight
120
+ )}
121
+ alt={getAltText(imageObject, operator.name)}
122
+ loading="eager"
123
+ width={operatorLogoWidth}
124
+ height={operatorLogoHeight}
125
+ className={styles.operatorlogo}
126
+ />
127
+ )}
128
+ <div className={styles.bar} />
129
+ {counter ? (
130
+ redirectText
131
+ ) : (
132
+ <div
133
+ className={styles.redirectText}
134
+ // eslint-disable-next-line react/no-danger
135
+ dangerouslySetInnerHTML={{ __html: redirectText }}
136
+ />
137
+ )}
138
+ <Button
139
+ onClick={(e) => manualRedirect(e)}
140
+ btnText={btnText}
141
+ primaryColor
142
+ to={prettyTracker(operator, 'main', false, page?.template)}
143
+ targetBlank={false}
144
+ isInternalLink={false}
145
+ gtmClass="tracker-gtm btn-cta"
146
+ />
147
+ </div>
148
+ </div>
149
+ </>
150
+ )}
151
+ </>
152
+ );
153
+ }
154
+
155
+ TrackerGeo.propTypes = {
156
+ redirectText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
157
+ mainText: PropTypes.string,
158
+ btnText: PropTypes.string,
159
+ bgImage: PropTypes.string,
160
+ bgVideo: PropTypes.string,
161
+ path: PropTypes.string,
162
+ logo: PropTypes.string,
163
+ counter: PropTypes.bool,
164
+ redirectTimer: PropTypes.number,
165
+ operatorLogo: PropTypes.bool,
166
+ operatorLogoWidth: PropTypes.string,
167
+ operatorLogoHeight: PropTypes.string,
168
+ pageContext: PropTypes.shape({
169
+ operatorsByMarket: PropTypes.shape({
170
+ bonus: PropTypes.shape({
171
+ operator_name: PropTypes.string,
172
+ }),
173
+ name: PropTypes.string,
174
+ standardised_logo_url_object: PropTypes.shape({}),
175
+ logo_url_object: PropTypes.shape({}),
176
+ logo_url: PropTypes.string,
177
+ links: PropTypes.shape({
178
+ main: PropTypes.string,
179
+ terms_and_conditions: PropTypes.string,
180
+ }),
181
+ }).isRequired,
182
+ page: PropTypes.shape({
183
+ template: PropTypes.string,
184
+ }),
185
+ }),
186
+ styles: PropTypes.shape({}),
187
+ };
@@ -0,0 +1,105 @@
1
+ .container {
2
+ width: 100%;
3
+ height: 100vh;
4
+ @include flex-align(center, center);
5
+
6
+ .background {
7
+ position: absolute;
8
+ top: 0;
9
+ width: 100%;
10
+ height: 100%;
11
+ object-fit: cover;
12
+ }
13
+
14
+ @keyframes load {
15
+ 0% { width: 0; }
16
+ 100% { width: 100%; }
17
+ }
18
+
19
+ .content {
20
+ width: 90%;
21
+ background: var(--color-16);
22
+ box-shadow: 0 0.8rem 1.6rem rgba(0, 0, 0, 0.2);
23
+ border-radius: 1.6rem;
24
+ text-align: center;
25
+ @include flex-direction(column);
26
+ align-items: center;
27
+ padding: 2.8rem 0 2rem 0;
28
+ color: var(--color-22);
29
+ position: relative;
30
+
31
+ @include min(tablet) {
32
+ width: 50%;
33
+ }
34
+
35
+ @include min(laptop) {
36
+ width: 35%;
37
+ }
38
+
39
+ img {
40
+ width: 80%;
41
+
42
+ @include min(tablet) {
43
+ width: 50%;
44
+ }
45
+ }
46
+
47
+ p {
48
+ margin: 2rem 0;
49
+ width: 70%;
50
+ font-size: 2rem;
51
+ font-weight: 700;
52
+
53
+ @include min(tablet) {
54
+ font-size: 2.4rem;
55
+ }
56
+ }
57
+
58
+ .mainTextWithlogo {
59
+ margin: 2rem 0rem 1rem;
60
+ }
61
+
62
+ .operatorlogo {
63
+ width: 80px;
64
+ height: 80px;
65
+ object-fit: contain;
66
+ margin-bottom: 1rem;
67
+ }
68
+
69
+ .bar {
70
+ height: 0.8rem;
71
+ background: #e1dbdb;
72
+ border-radius: 10rem;
73
+ width: 80%;
74
+
75
+ &:before {
76
+ content: ' ';
77
+ height: 0.8rem;
78
+ width: 0;
79
+ background: linear-gradient(270deg, #17d6cc 0.34%, #17d68a 86.37%);
80
+ border-radius: 10rem;
81
+ display: block;
82
+ animation: load 5s normal forwards;
83
+ }
84
+ }
85
+
86
+ .redirectText {
87
+ padding: 2.8rem;
88
+ font-size: 1.6rem;
89
+
90
+ @include min(tablet) {
91
+ font-size: 1.8rem;
92
+ }
93
+ }
94
+
95
+ a {
96
+ position: absolute;
97
+ bottom: -2rem;
98
+ font-size: 1.4rem;
99
+
100
+ @include min(tablet) {
101
+ font-size: 2rem;
102
+ }
103
+ }
104
+ }
105
+ }
@@ -127,7 +127,7 @@
127
127
  }
128
128
 
129
129
 
130
- @mixin border-gradient($color-1, $color-2, $bgcolor) {
130
+ @mixin border-gradient($color-1, $color-2, $bgcolor, $radius: .8rem) {
131
131
  background: $bgcolor;
132
132
  &:before {
133
133
  content: '';
@@ -136,7 +136,7 @@
136
136
  left: 0;
137
137
  right: 0;
138
138
  bottom: 0;
139
- border-radius: 8px;
139
+ border-radius: $radius;
140
140
  border: 2px solid transparent;
141
141
  background: $color-1, $color-2 border-box;
142
142
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);