gatsby-core-theme 42.0.1 → 42.0.2

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,18 @@
1
+ ## [42.0.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v42.0.1...v42.0.2) (2025-02-05)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * changes to crypto endpoints ([5edcb95](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5edcb95842d1e37d2f366a2fa784b29f049eba91))
7
+
8
+
9
+ * Merge branch 'crypto-endpoints' into 'master' ([1a3f8b5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1a3f8b59901ea066c9352e59f1cc4d81ad83e165))
10
+
11
+
12
+ ### Tests
13
+
14
+ * add test ([c10989c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c10989cf8a0a2200dc09f626a913426d6713be57))
15
+
1
16
  ## [42.0.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v42.0.0...v42.0.1) (2025-02-04)
2
17
 
3
18
 
package/gatsby-node.mjs CHANGED
@@ -46,6 +46,8 @@ let gamesData = null;
46
46
  let sportsData = null;
47
47
  let ribbonsData = null;
48
48
  let operatorData = null;
49
+ let cryptoExchangesData = null;
50
+ let cryptoBrokersData = null;
49
51
  let paymentData = null;
50
52
  let allMarketPrefixes = [];
51
53
  let allMarketSectionsData = null;
@@ -263,7 +265,9 @@ export const createPages = async (
263
265
  payment_method: paymentData,
264
266
  software_provider: providersData,
265
267
  game: gamesData,
266
- sports_data: sportsData
268
+ sports_data: sportsData,
269
+ crypto_exchanges: cryptoExchangesData,
270
+ crypto_brokers: cryptoBrokersData,
267
271
  },
268
272
  },
269
273
  themeOptions,
@@ -505,7 +509,9 @@ export const onPreBootstrap = async () => {
505
509
  paymentData,
506
510
  providersData,
507
511
  gamesData,
508
- sportsData
512
+ sportsData,
513
+ cryptoExchangesData,
514
+ cryptoBrokersData,
509
515
  } = await fetchSiteSettings(process.env.GATSBY_SITE_NAME));
510
516
  };
511
517
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "42.0.1",
3
+ "version": "42.0.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -166,6 +166,31 @@ export const pickRelationKeys = {
166
166
  payment_method: ["name", "rating", "logo", "selling_points", "id", "payout_time", "min_deposit", "support_types", "short_name", "iso_code", ],
167
167
  country: ["id", "iso_code", "logo", "name", "code"],
168
168
  currency: ["id", "name", "iso_code", "symbol", "crypto", "logo"],
169
+ crypto: [
170
+ "logo",
171
+ "id",
172
+ "selling_points",
173
+ "founded",
174
+ "name",
175
+ "rating_security",
176
+ "rating_fees",
177
+ "rating_usability",
178
+ "rating_features",
179
+ "rating_support",
180
+ "rating_average",
181
+ "short_name",
182
+ "links",
183
+ "email",
184
+ "url",
185
+ "markets_amount",
186
+ "support_types",
187
+ "headquarters",
188
+ "crypto_currencies",
189
+ "min_deposit",
190
+ "max_withdrawal",
191
+ "licences",
192
+ "services",
193
+ ]
169
194
  };
170
195
 
171
196
  export const pickHTMLSitemapPageKeys = ["title", "path", "template_id"];
@@ -130,6 +130,19 @@ export async function getSports(siteName) {
130
130
  return callAPIV2(`v0.1/sports/sorted/sorted-v2/${siteName}`);
131
131
  }
132
132
 
133
+ export async function getCryptoBrokers() {
134
+ return callAPIV2(`v0.1/cryptos/brokers/sorted`);
135
+ }
136
+
137
+ export async function getCryptoExchanges() {
138
+ return callAPIV2(`v0.1/cryptos/exchanges/sorted`);
139
+ }
140
+
141
+ // NOTE To be done later
142
+ export async function getCryptoWallets() {
143
+ return callAPIV2(`v0.1/cryptos/wallets/sorted`);
144
+ }
145
+
133
146
  export async function getTeamJerseys(teamIds) {
134
147
  const path = `https://enigma.micro7s.com/v1/sports-api/participants/teamkits?page_size=200`;
135
148
 
@@ -15,10 +15,14 @@ import {
15
15
  getProviders,
16
16
  getSports,
17
17
  getTeamJerseys,
18
- getGamesJackpot
18
+ getGamesJackpot,
19
+ getCryptoBrokers,
20
+ getCryptoExchanges,
21
+ getCryptoWallets,
19
22
  } from "./api.mjs";
20
23
  import { groupBy } from "./getters.mjs";
21
24
  import { transformOperators } from "./processor/operators.mjs";
25
+ import { transformCryptosData } from "./processor/cryptos.mjs";
22
26
  import { transformGames, transformGamesJackpot } from "./processor/games.mjs";
23
27
  import { transformPayments } from "./processor/payment.mjs";
24
28
  import { transformProvider } from "./processor/providers.mjs";
@@ -32,6 +36,11 @@ export const fetchSiteSettings = async (siteName) => {
32
36
  const providersPromise = getProviders();
33
37
  const gamblingCompaniesPromise = getGamblingCompanies();
34
38
 
39
+ // NOTE Crypto data
40
+ const cryptoBrokersPromise = getCryptoBrokers();
41
+ const cryptoExchangesPromise = getCryptoExchanges();
42
+ const cryptoWalletsPromise = getCryptoWallets();
43
+
35
44
  // Wait for siteSettings to get siteId and then chain other requests
36
45
  const siteSettingsData = await siteSettingsPromise;
37
46
  const siteId = Object.keys(siteSettingsData.general)[0];
@@ -72,7 +81,10 @@ export const fetchSiteSettings = async (siteName) => {
72
81
  providers,
73
82
  games,
74
83
  gamesJackpotData,
75
- sportsData
84
+ sportsData,
85
+ cryptoBrokers,
86
+ cryptoExchanges,
87
+ cryptoWallets
76
88
  ] = await Promise.all([
77
89
  ribbonsPromise,
78
90
  responsableGamingPromise,
@@ -87,7 +99,10 @@ export const fetchSiteSettings = async (siteName) => {
87
99
  providersPromise,
88
100
  gamesPromise,
89
101
  gamesJackpotPromise,
90
- sportsPromise
102
+ sportsPromise,
103
+ cryptoBrokersPromise,
104
+ cryptoExchangesPromise,
105
+ cryptoWalletsPromise
91
106
  ]);
92
107
 
93
108
  const allMarketPrefixes = Object.keys(allMarketsData)
@@ -116,6 +131,19 @@ export const fetchSiteSettings = async (siteName) => {
116
131
  jackpot_data: transformGamesJackpot(gamesJackpotData)
117
132
  });
118
133
 
134
+ const cryptoExchangesData = transformCryptosData(cryptoExchanges, {
135
+ countries: countriesData,
136
+ currencies: currenciesData,
137
+ payments: paymentData,
138
+ })
139
+
140
+ const cryptoBrokersData = transformCryptosData(cryptoBrokers, {
141
+ countries: countriesData,
142
+ currencies: currenciesData,
143
+ payments: paymentData,
144
+ })
145
+
146
+
119
147
  if(["rage_seo", "rage_ppc", "sports"].includes(siteSettingsData.general[siteId].type)) {
120
148
  const teamIds = Object.values(sportsData.teams).map((team) => String(team.livegoals_v2_id));
121
149
  const teamKits = await getTeamJerseys(teamIds);
@@ -143,6 +171,8 @@ export const fetchSiteSettings = async (siteName) => {
143
171
  paymentData,
144
172
  providersData,
145
173
  gamesData,
146
- sportsData
174
+ sportsData,
175
+ cryptoExchangesData,
176
+ cryptoBrokersData
147
177
  };
148
178
  };
@@ -0,0 +1,71 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import loadash from "lodash/index.js";
3
+ import {
4
+ processLogo,
5
+ processCountries,
6
+ processCurrencies,
7
+ processPaymentMethods,
8
+ } from "./relations.mjs";
9
+ import { pickRelationKeys } from "../../constants/pick-keys.mjs";
10
+
11
+ const { cloneDeep, pick } = loadash;
12
+
13
+ export function sanitizeCryptoData(data) {
14
+ const cryptoClone = cloneDeep(data);
15
+
16
+ return pick(cryptoClone, pickRelationKeys.crypto);
17
+ // return cryptoClone;
18
+ }
19
+
20
+ export function transformCryptosData(jsonData, relationsData) {
21
+ const cryptos = {};
22
+
23
+ Object.values(jsonData).forEach(crypto => {
24
+ const newCryptoData = {
25
+ ...crypto,
26
+ }
27
+
28
+ // OPERATOR LOGO (temp fix included and will be removed)
29
+ newCryptoData.logo = processLogo(
30
+ newCryptoData.logo,
31
+ newCryptoData.standardised_logo
32
+ );
33
+
34
+ // DEPOSIT METHODS
35
+ if (newCryptoData.deposit_methods && Object.values(relationsData.payments).length) {
36
+ newCryptoData.deposit_methods = processPaymentMethods(
37
+ newCryptoData.deposit_methods,
38
+ newCryptoData.market,
39
+ relationsData.payments
40
+ );
41
+ }
42
+
43
+ // CRYRPTO CURRENCIES
44
+ if ((newCryptoData.crypto_currencies || newCryptoData.currencies) && Object.values(relationsData.currencies).length) {
45
+ newCryptoData.crypto_currencies = processCurrencies(
46
+ newCryptoData.crypto_currencies || newCryptoData.currencies,
47
+ relationsData.currencies
48
+ );
49
+ }
50
+
51
+ // FIAT CURRENCIES
52
+ if (newCryptoData.fiat_currencies && Object.values(relationsData.currencies).length) {
53
+ newCryptoData.fiat_currencies = processCurrencies(
54
+ newCryptoData.fiat_currencies,
55
+ relationsData.currencies
56
+ );
57
+ }
58
+
59
+ // COUNTRIES
60
+ if (newCryptoData.restricted_countries && Object.values(relationsData.countries).length) {
61
+ newCryptoData.restricted_countries = processCountries(
62
+ newCryptoData.restricted_countries,
63
+ relationsData.countries
64
+ );
65
+ }
66
+
67
+ cryptos[crypto.id] = sanitizeCryptoData(newCryptoData);
68
+ });
69
+
70
+ return cryptos;
71
+ }
@@ -0,0 +1,27 @@
1
+ import { cleanup, } from '@testing-library/react';
2
+ import { transformCryptosData } from './cryptos.mjs';
3
+ import { getCryptoExchangesList } from '../../../tests/factories/crypto-exchanges/crypto-exchanges.factory';
4
+ import getCurrenciesData from '../../../tests/factories/currencies/currencies.factory';
5
+
6
+ describe("Transform Cryptos Data", () => {
7
+ test('Transform Cryptos', () => {
8
+ const exchangesData = getCryptoExchangesList({ count: 3 });
9
+ // const operatorPage = getPageDataList(1);
10
+
11
+ const transformedCryptoExchanges = transformCryptosData(exchangesData, {payments: {}, currencies: getCurrenciesData(), countries: {}});
12
+
13
+ // values before transforming
14
+ expect(Object.values(exchangesData)[0].name).toBe('Crypto Exchange 1');
15
+ expect(Object.values(exchangesData)[2].name).toBe('Crypto Exchange 3');
16
+ expect(Object.values(exchangesData)[1].crypto_currencies.length).toBe(2);
17
+ expect(Object.values(exchangesData)[1].crypto_currencies[0]).toBe(1);
18
+
19
+ // values after transforming
20
+ expect(Object.values(transformedCryptoExchanges)[0].name).toBe('Crypto Exchange 1');
21
+ expect(Object.values(transformedCryptoExchanges)[1].crypto_currencies.length).toBe(2);
22
+ expect(Object.values(transformedCryptoExchanges)[1].crypto_currencies[0].name).toBe('Bitcoin');
23
+ });
24
+ });
25
+ afterEach(() => {
26
+ cleanup();
27
+ });
@@ -54,6 +54,18 @@ export const processRelations = (
54
54
  );
55
55
  }
56
56
  break;
57
+ case "crypto_exchanges":
58
+ if (!hasRelation) {
59
+ transformedPages[market][pageType][index].relation =
60
+ data.relations.crypto_exchanges[page.relation_id];
61
+ }
62
+ break;
63
+ case "crypto_brokers":
64
+ if (!hasRelation) {
65
+ transformedPages[market][pageType][index].relation =
66
+ data.relations.crypto_brokers[page.relation_id];
67
+ }
68
+ break;
57
69
  default:
58
70
  break;
59
71
  }
@@ -82,7 +82,38 @@ describe('Processor Relations', () => {
82
82
  });
83
83
  expect(pages[market][relation_type]).toHaveLength(1);
84
84
  });
85
+ test('Crypto Exchanges', () => {
86
+ const relation_type = 'crypto_exchanges';
87
+ const market = 'ie_en';
88
+ const data = getData({ template: relation_type, count: 3 });
89
+ const pages = {
90
+ [market]: {
91
+ [relation_type]: getPageList({ template: relation_type, count: 3, relation_id: 2 })
92
+ },
93
+ };
85
94
 
95
+ pages[market][relation_type].forEach((page, index) => {
96
+ processRelations(page, relation_type, pages, market, data, index);
97
+ expect(page.relation_type).toEqual(relation_type);
98
+ });
99
+ expect(pages[market][relation_type]).toHaveLength(3);
100
+ });
101
+ test('Crypto Brokers', () => {
102
+ const relation_type = 'crypto_brokers';
103
+ const market = 'ie_en';
104
+ const data = getData({ template: relation_type, count: 3 });
105
+ const pages = {
106
+ [market]: {
107
+ [relation_type]: getPageList({ template: relation_type, count: 3, relation_id: 2 })
108
+ },
109
+ };
110
+
111
+ pages[market][relation_type].forEach((page, index) => {
112
+ processRelations(page, relation_type, pages, market, data, index);
113
+ expect(page.relation_type).toEqual(relation_type);
114
+ });
115
+ expect(pages[market][relation_type]).toHaveLength(3);
116
+ });
86
117
  test('processCurrencies maps currencies with logos', () => {
87
118
  const ids = [1, 2];
88
119
  const currencies = {
@@ -0,0 +1,50 @@
1
+ export const getDefaultCryptoBrokersProps = (index = 1) => ({
2
+ id: index,
3
+ name: `test broker ${index}`,
4
+ short_name: `test_broker_${index}`,
5
+ url: "www.testbroker.com",
6
+ affiliate_link: "www.testbroker.com",
7
+ min_deposit: "1",
8
+ regulation: "test",
9
+ has_mobile_app: null,
10
+ user_amount: "test",
11
+ risk_warning: "test",
12
+ currencies: [
13
+ 289
14
+ ],
15
+ selling_points: [
16
+ "bingo"
17
+ ],
18
+ deposit_methods: [
19
+ 219
20
+ ],
21
+ trading_fees: [
22
+ "Spread",
23
+ "Overnight fees"
24
+ ],
25
+ logo: {
26
+ title: "Viperwin logo",
27
+ filename: "1719825945/viperwin-logo",
28
+ extension: ".png",
29
+ url: "https://assets-srv.s3.eu-west-1.amazonaws.com/1719825945/viperwin-logo.png",
30
+ width: "412",
31
+ height: "412",
32
+ alt: "Image for Viperwin",
33
+ color: "#060b26",
34
+ id: 139721,
35
+ raw_filename: "1719825945/viperwin-logo"
36
+ }
37
+ })
38
+
39
+ export default function getCryptoBrokersList({ template, count = 1, id = 1, ...customProps }) {
40
+ const cryptosList = {};
41
+ // eslint-disable-next-line no-plusplus
42
+ for (let index = id; index < id + count; index++) {
43
+ cryptosList[index] = {
44
+ id: index,
45
+ ...getDefaultCryptoBrokersProps(index),
46
+ ...customProps,
47
+ };
48
+ }
49
+ return cryptosList;
50
+ }
@@ -0,0 +1,76 @@
1
+ export const getDefaultCryptoExchangesProps = (index = 1) => ({
2
+ id: index,
3
+ name: `Crypto Exchange ${index}`,
4
+ short_name: `crypto_exchange_${index}`,
5
+ founded: "2022-11-01 00:00:00",
6
+ headquarters: `Headquarters ${index}`,
7
+ best_for: "Selling",
8
+ url: "http://google.com/test222",
9
+ markets_amount: "3000 +",
10
+ currencies_amount: "3 including 25+",
11
+ rating_security: 1,
12
+ rating_fees: 3,
13
+ rating_usability: 3,
14
+ rating_features: 3,
15
+ rating_support: 3,
16
+ rating_average: 2.6,
17
+ exchange_type: "Decentralized",
18
+ crypto_currencies: [
19
+ 1,
20
+ 2
21
+ ],
22
+ fiat_currencies: [
23
+ 3,
24
+ 9
25
+ ],
26
+ restricted_countries: [
27
+ 1,
28
+ 254
29
+ ],
30
+ selling_points: [
31
+ "800games",
32
+ "1000_games"
33
+ ],
34
+ services: [
35
+ {
36
+ name: "g test",
37
+ short_name: "crypto_services_g",
38
+ id: 7
39
+ },
40
+ {
41
+ name: "kripo",
42
+ short_name: "crypto_services_kripo",
43
+ id: 8
44
+ }
45
+ ],
46
+ licences: [],
47
+ support_types: [
48
+ "support_type_facebook",
49
+ "support_type_faq_section"
50
+ ],
51
+ logo: {
52
+ title: "Picking Betting Sites - Step 3: markets",
53
+ filename: "1668091295/step-3-markets-casinotopsonline",
54
+ extension: ".png",
55
+ url: "https://assets-srv.s3.eu-west-1.amazonaws.com/1668091295/step-3-markets-casinotopsonline.png",
56
+ width: "512",
57
+ height: "512",
58
+ alt: "Picking Betting Sites - Step 3: markets",
59
+ color: null,
60
+ id: 97121,
61
+ raw_filename: "1668091295/step-3-markets-casinotopsonline"
62
+ }
63
+ })
64
+
65
+ export function getCryptoExchangesList({ template, count = 1, id = 1, ...customProps }) {
66
+ const cryptosList = {};
67
+ // eslint-disable-next-line no-plusplus
68
+ for (let index = id; index < id + count; index++) {
69
+ cryptosList[index] = {
70
+ id: index,
71
+ ...getDefaultCryptoExchangesProps(index),
72
+ ...customProps,
73
+ };
74
+ }
75
+ return cryptosList;
76
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @name getCurrenciesData
3
+ * @description Mock data related to currencies
4
+ * @return {Object} currencies mock data
5
+ */
6
+ export default function getCurrenciesData() {
7
+ const currencies = {
8
+ 1: {
9
+ id: 1,
10
+ name: "Bitcoin",
11
+ iso_code: "BTC",
12
+ symbol: "฿",
13
+ crypto: 1,
14
+ active: 1,
15
+ standardised_logo_asset_id: 97753,
16
+ standardised_logo: {
17
+ title: "Bitcoin logo",
18
+ filename: "1669211251/bitcoin",
19
+ extension: ".svg",
20
+ url: "https://assets-srv.s3.eu-west-1.amazonaws.com/1669211251/bitcoin.svg",
21
+ width: "72",
22
+ height: "48",
23
+ alt: "Logo image for Bitcoin",
24
+ color: null,
25
+ id: 97753,
26
+ raw_filename: "1669211251/bitcoin"
27
+ }
28
+ },
29
+ 2: {
30
+ id: 2,
31
+ name: "Euro",
32
+ iso_code: "EUR",
33
+ symbol: "€",
34
+ crypto: 0,
35
+ active: 1,
36
+ standardised_logo_asset_id: 122591,
37
+ standardised_logo: {
38
+ title: "Euro logo",
39
+ filename: "1700584770/euro-logo",
40
+ extension: ".png",
41
+ url: "https://assets-srv.s3.eu-west-1.amazonaws.com/1700584770/euro-logo.png",
42
+ width: "412",
43
+ height: "275",
44
+ alt: "Image for euro",
45
+ color: "#ffffff",
46
+ id: 122591,
47
+ raw_filename: "1700584770/euro-logo"
48
+ }
49
+ },
50
+ 3: {
51
+ id: 3,
52
+ name: "Fiji Dollar",
53
+ iso_code: "FJD",
54
+ symbol: "$",
55
+ crypto: 0,
56
+ active: 1,
57
+ standardised_logo_asset_id: null,
58
+ standardised_logo: null
59
+ },
60
+ };
61
+ return currencies;
62
+ }
@@ -76,6 +76,12 @@ const getTemplateProps = (template) =>
76
76
  author: {
77
77
  relation_type: 'author',
78
78
  },
79
+ crypto_exchanges: {
80
+ relation_type: 'crypto_exchanges',
81
+ },
82
+ crypto_brokers: {
83
+ relation_type: 'crypto_brokers',
84
+ },
79
85
  }[template] || {});
80
86
 
81
87
  export default function getPageList({ template = 'page', count = 1, id = 1, ...customProps } = {}) {
@@ -1,3 +1,6 @@
1
+ import { getDefaultCryptoExchangesProps } from '../crypto-exchanges/crypto-exchanges.factory';
2
+ import { getDefaultCryptoBrokersProps } from '../crypto-brokers/crypto-brokers.factory';
3
+
1
4
  const getDefaultProps = (index = 1) => ({
2
5
  status: 'active',
3
6
  name: `Relation ${index} Name`,
@@ -33,6 +36,14 @@ const getTemplateProps = (template) =>
33
36
  author: {
34
37
  relation_type: 'author',
35
38
  },
39
+ crypto_exchanges: {
40
+ relation_type: 'crypto_exchanges',
41
+ ...getDefaultCryptoExchangesProps(1),
42
+ },
43
+ crypto_brokers: {
44
+ relation_type: 'crypto_brokers',
45
+ ...getDefaultCryptoBrokersProps(1),
46
+ },
36
47
  }[template] || {});
37
48
 
38
49
  export default function getRealationList({ template, count = 1, id = 1, ...customProps } = {}) {