gatsby-core-theme 30.0.96 → 30.0.97

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,21 @@
1
+ ## [30.0.97](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.96...v30.0.97) (2024-03-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * tracking api fixes ([17303d9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/17303d9502fa3e9f6f48d9ce3209ce931421766a))
7
+ * tracking api fixes ([8b116ad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8b116add66f52811cd6e721f2fd94287c7116354))
8
+ * tracking api fixes ([c38630b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c38630baa4e7bf70c00a3ff01871472166031ea3))
9
+ * tracking api fixes ([d617eab](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d617eabc1655285564e0e89199dea2d25a189fb3))
10
+
11
+
12
+ ### Code Refactoring
13
+
14
+ * change to mixin ([df19dfb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/df19dfbe1ae4a0b0bc27a0d28902d957a308c558))
15
+
16
+
17
+ * Merge branch 'mixin-change' into 'master' ([83d5ade](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/83d5ade0c58222e4a138fbec9a830245d25afb5e))
18
+
1
19
  ## [30.0.96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.95...v30.0.96) (2024-03-06)
2
20
 
3
21
 
package/gatsby-node.mjs CHANGED
@@ -391,9 +391,12 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
391
391
  path: trackerLinkPath,
392
392
  meta_robots: ['noindex', 'nofollow'],
393
393
  };
394
+
395
+ const trackerComp = process.env.IS_TRACKING_SSR === 'true' ? `${__dirname}/src/components/pages/tracker-geo/index-ssr.js` : `${__dirname}/src/components/pages/tracker-geo/index.js`;
396
+
394
397
  createPage({
395
398
  path: trackerLinkPath,
396
- component: `${__dirname}/src/components/pages/tracker-geo/index.js`,
399
+ component: trackerComp,
397
400
  context: {
398
401
  page: trackerPageObject,
399
402
  siteInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "30.0.96",
3
+ "version": "30.0.97",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -0,0 +1,196 @@
1
+ /* eslint-disable react/prop-types */
2
+ /* eslint-disable react/forbid-prop-types */
3
+ import React, { useEffect } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import { imagePrettyUrl, getAltText } from '~helpers/getters';
7
+ import { getTrackerName, getAffiliateLink } from '~helpers/tracker';
8
+ import styles from './tracker.module.scss';
9
+ import HeadData from '~organisms/head';
10
+
11
+ export default function TrackerGeo({
12
+ pageContext,
13
+ path,
14
+ mainText = 'One sec, while we load [operator_name] for you..',
15
+ redirectText = 'If the casino has not loaded within a few seconds',
16
+ btnText = 'Click Here!',
17
+ bgImage = '',
18
+ bgVideo = '',
19
+ redirectTimer = 5000,
20
+ logo = '../../../../../images/logo.svg',
21
+ counter = false,
22
+ operatorLogo = false,
23
+ operatorLogoWidth = '80',
24
+ operatorLogoHeight = '80',
25
+ }) {
26
+ const { page, operatorsByMarket } = pageContext;
27
+ const operator = operatorsByMarket[Object.keys(operatorsByMarket)[0]][0];
28
+ // eslint-disable-next-line dot-notation
29
+ const defaultMarketOperator = operatorsByMarket[`us_en`] || null;
30
+ const showSplashScreen = typeof window !== 'undefined';
31
+
32
+ const getData = async () => {
33
+ if (serverData.success && serverData.result.link) {
34
+ console.log('FROM API');
35
+ window.location.replace(serverData.result.link);
36
+ } else {
37
+ console.log('FROM LOCAL');
38
+ await fetch('https://geolocation-db.com/json/', {
39
+ method: 'GET',
40
+ })
41
+ .then((response) => response.json())
42
+ .then(async (data) => {
43
+ const ipAddress = data.IPv4;
44
+ const apiUrl = `https://pro.ip-api.com/json/${ipAddress}?key=sQhiSjgnSScSHqR&fields=status,countryCode,region,city,zip,lat,lon`;
45
+
46
+ await fetch(apiUrl, {})
47
+ .then((response) => response.json())
48
+ .then((data) => {
49
+ if (data.countryCode) {
50
+ const userMarketOperator =
51
+ operatorsByMarket[`us_en_${data.region.toLowerCase()}`] || null;
52
+
53
+ const trackerRedirect =
54
+ (userMarketOperator && userMarketOperator[0]) || defaultMarketOperator[0];
55
+
56
+ if (trackerRedirect) {
57
+ setTimeout(
58
+ () => window.location.replace(getTrackerName(trackerRedirect, page, path)),
59
+ redirectTimer
60
+ );
61
+ } else {
62
+ console.log('No Valid Tracker');
63
+ }
64
+ }
65
+ })
66
+ .catch((err) => {
67
+ console.log(`Error ${err}`);
68
+ setTimeout(
69
+ () => window.location.replace(getTrackerName(defaultMarketOperator[0], page, path)),
70
+ redirectTimer
71
+ );
72
+ });
73
+ })
74
+ .catch((err) => {
75
+ console.log(`Error ${err}`);
76
+ setTimeout(
77
+ () => window.location.replace(getTrackerName(defaultMarketOperator[0], page, path)),
78
+ redirectTimer
79
+ );
80
+ });
81
+ }
82
+ };
83
+
84
+ useEffect(() => {
85
+ window.loadGTM = false;
86
+ getData();
87
+ }, []);
88
+
89
+ let background = <></>;
90
+ if (bgVideo) {
91
+ background = (
92
+ <video muted autoPlay loop className={styles.background} poster={bgImage && bgImage}>
93
+ <source src={bgVideo} type="video/webm" />
94
+ </video>
95
+ );
96
+ } else if (bgImage) {
97
+ background = <LazyImage className={styles.background} src={bgImage} alt="background image" />;
98
+ }
99
+
100
+ const imageObject = operator?.standardised_logo_url_object || operator?.logo_url_object;
101
+
102
+ return (
103
+ <>
104
+ {showSplashScreen && (
105
+ <>
106
+ <div className={styles.container}>
107
+ {background}
108
+ <div className={styles.content}>
109
+ <LazyImage alt="Site logo" src={logo} />
110
+ <p
111
+ className={`${styles.mainText} ${operatorLogo && styles.mainTextWithlogo}`}
112
+ >{`${mainText.replace(
113
+ '[operator_name]',
114
+ operator?.bonus?.operator_name || operator.name
115
+ )}`}</p>
116
+ {operatorLogo && (
117
+ <LazyImage
118
+ src={imagePrettyUrl(
119
+ imageObject?.filename || operator?.logo_url,
120
+ operatorLogoWidth,
121
+ operatorLogoHeight
122
+ )}
123
+ alt={getAltText(imageObject, operator.name)}
124
+ loading="eager"
125
+ width={operatorLogoWidth}
126
+ height={operatorLogoHeight}
127
+ className={styles.operatorlogo}
128
+ />
129
+ )}
130
+ <div className={styles.bar} />
131
+ {counter ? (
132
+ redirectText
133
+ ) : (
134
+ <div
135
+ className={styles.redirectText}
136
+ // eslint-disable-next-line react/no-danger
137
+ dangerouslySetInnerHTML={{ __html: redirectText }}
138
+ />
139
+ )}
140
+ </div>
141
+ </div>
142
+ </>
143
+ )}
144
+ </>
145
+ );
146
+ }
147
+
148
+ export const Head = ({ pageContext }) => (
149
+ <HeadData page={pageContext.page} siteInfo={pageContext.siteInfo} />
150
+ );
151
+
152
+ TrackerGeo.propTypes = {
153
+ redirectText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
154
+ mainText: PropTypes.string,
155
+ btnText: PropTypes.string,
156
+ bgImage: PropTypes.string,
157
+ bgVideo: PropTypes.string,
158
+ path: PropTypes.string,
159
+ logo: PropTypes.string,
160
+ counter: PropTypes.bool,
161
+ redirectTimer: PropTypes.number,
162
+ operatorLogo: PropTypes.bool,
163
+ operatorLogoWidth: PropTypes.string,
164
+ operatorLogoHeight: PropTypes.string,
165
+ pageContext: PropTypes.shape({
166
+ operatorsByMarket: PropTypes.shape({
167
+ bonus: PropTypes.shape({
168
+ operator_name: PropTypes.string,
169
+ }),
170
+ name: PropTypes.string,
171
+ standardised_logo_url_object: PropTypes.shape({}),
172
+ logo_url_object: PropTypes.shape({}),
173
+ logo_url: PropTypes.string,
174
+ links: PropTypes.shape({
175
+ main: PropTypes.string,
176
+ terms_and_conditions: PropTypes.string,
177
+ }),
178
+ }).isRequired,
179
+ page: PropTypes.shape({
180
+ template: PropTypes.string,
181
+ }),
182
+ }),
183
+ styles: PropTypes.shape({}),
184
+ };
185
+
186
+ export async function getServerData({ pageContext, headers, url }) {
187
+ let res = '';
188
+ res = await getAffiliateLink(
189
+ pageContext.operator,
190
+ pageContext.page.path,
191
+ pageContext.page,
192
+ headers,
193
+ url
194
+ );
195
+ return res;
196
+ }
@@ -78,6 +78,7 @@ export async function getAffiliateLink(operator, path, page, headers, url) {
78
78
  extraURLParams = deparam(`${url.split('?')[1]}`);
79
79
  }
80
80
 
81
+ console.log(headers);
81
82
 
82
83
  const urlParam = {
83
84
  site_id: process.env.SITE_ID,
@@ -128,7 +128,7 @@
128
128
  }
129
129
  }
130
130
 
131
- @mixin border-gradient($color-1, $color-2, $bgcolor, $radius: 0.8rem) {
131
+ @mixin border-gradient($color-1, $color-2, $bgcolor, $radius: 0.8rem, $border-width: 2px) {
132
132
  background: $bgcolor;
133
133
  &:before {
134
134
  content: '';
@@ -138,7 +138,7 @@
138
138
  right: 0;
139
139
  bottom: 0;
140
140
  border-radius: $radius;
141
- border: 2px solid transparent;
141
+ border: $border-width solid transparent;
142
142
  background: $color-1, $color-2 border-box;
143
143
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
144
144
  -webkit-mask-composite: destination-out;