gatsby-core-theme 22.0.13 → 22.0.15

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,28 @@
1
+ ## [22.0.15](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.14...v22.0.15) (2023-06-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added filter for nat casino ([bcbe238](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bcbe2387da1a62064dc02be2648685fdfff0ec8a))
7
+ * build error ([06e7743](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/06e7743a5922bb1f4ed8d3496505639b9cc5b419))
8
+ * fix: conflict ([eded074](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eded074fee4031fe33be3ae0034122b544ee3e1e))
9
+ * selling point translatable ([fa9647a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fa9647a753ae74240e283e66713403a00350e3f8))
10
+ * selling points ([b879906](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b879906f1925ac90e9f8c3180b8e12dce967ea64))
11
+ * test ([7da942d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7da942d4e2547072634945183c571a7fe66e390e))
12
+
13
+
14
+ * Merge branch 'tm-3525-selling-points' into 'master' ([009723a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/009723ad18be8c28f4360e24025c8efae7e55f8c))
15
+
16
+ ## [22.0.14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.13...v22.0.14) (2023-06-19)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * add realtion data for the preview page ([f77cb00](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f77cb00b528ca23eb596e86f97b7845aa77b73ce))
22
+
23
+
24
+ * Merge branch 'tm-3451-cards' into 'master' ([06265c9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/06265c9a0a83f2bf9739370ff06659fe7ff5adbc))
25
+
1
26
  ## [22.0.13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.12...v22.0.13) (2023-06-16)
2
27
 
3
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "22.0.13",
3
+ "version": "22.0.15",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -21,6 +21,7 @@ export default {
21
21
  'sporttheme.com': ['inactive', 'blacklisted'],
22
22
  'partnerships.gigmedia.com': ['inactive', 'blacklisted'],
23
23
  'habibibet.org': ['inactive', 'blacklisted'],
24
+ 'xn--nt-casino-v2a.se': ['inactive', 'blacklisted'],
24
25
  },
25
26
  keep_page_extra_fields: {
26
27
  operator: {
@@ -393,6 +393,16 @@ export function getAltText(imageObject, defaultAlt = 'missing alt') {
393
393
  return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
394
394
  }
395
395
 
396
+ export function updateArrayTranslations(array, keysArray, translations) {
397
+ if (array && array.length > 0 && keysArray && keysArray.length > 0) {
398
+ array.forEach((elm, index) => {
399
+ array[index] = translate(translations, keysArray[index], elm);
400
+ });
401
+
402
+ return array;
403
+ }
404
+ }
405
+
396
406
  export function getObjectValue(obj, path) {
397
407
  if (!path) return obj;
398
408
  const properties = path.split('.');
@@ -310,6 +310,30 @@ describe('Getters Helper', () => {
310
310
  expect(altText).toEqual('default');
311
311
  });
312
312
 
313
+ const array = ['apple', 'banana', 'cherry'];
314
+ const keysArray = ['fruit_apple', 'fruit_banana', 'fruit_cherry'];
315
+ const translations = {
316
+ fruit_apple: 'manzana',
317
+ fruit_banana: 'plátano',
318
+ fruit_cherry: 'cereza',
319
+ };
320
+
321
+ test('updateArrayTranslations with the data', () => {
322
+ const result = Getters.updateArrayTranslations(array, keysArray, translations);
323
+
324
+ expect(result).toEqual(['manzana', 'plátano', 'cereza']);
325
+ });
326
+
327
+ test('updateArrayTranslations with array missing', () => {
328
+ const result = Getters.updateArrayTranslations(undefined, keysArray, translations);
329
+ expect(result).toEqual(undefined);
330
+ });
331
+
332
+ test('updateArrayTranslations with arrayKeys missing', () => {
333
+ const result = Getters.updateArrayTranslations(array, undefined, translations);
334
+ expect(result).toEqual(undefined);
335
+ });
336
+
313
337
  test('getObjectvalue recursive function to get value', () => {
314
338
  const getObjValue = Getters.getObjectValue({ name: 'test' }, 'name');
315
339
  expect(getObjValue).toEqual('test');
@@ -281,7 +281,16 @@ export default {
281
281
  updatePlaceholders(page, data);
282
282
 
283
283
  // set page relation
284
- processRelations(page, pageType, transformedPages, market, data, index);
284
+ processRelations(
285
+ page,
286
+ pageType,
287
+ transformedPages,
288
+ market,
289
+ data,
290
+ index,
291
+ pageType === 'preview',
292
+ data.relations.translations[page.language]
293
+ );
285
294
 
286
295
  // add author object to page
287
296
  if (page.author_id !== null && data.authors[page.author_id]) {
@@ -1,17 +1,28 @@
1
- export const processRelations = (page, pageType, transformedPages, market, data, index) => {
1
+ import { updateArrayTranslations } from '../getters';
2
+
3
+ export const processRelations = (
4
+ page,
5
+ pageType,
6
+ transformedPages,
7
+ market,
8
+ data,
9
+ index,
10
+ isPreview,
11
+ translations
12
+ ) => {
2
13
  if (page.relation_type !== 'page' && page.relation_id) {
3
14
  const hasRelation =
4
15
  data.relations[page.relation_type] &&
5
16
  data.relations[page.relation_type].hasOwnProperty(page.relation_id);
6
- transformedPages[market][page.relation_type][index].relation = hasRelation
7
- ? data.relations[page.relation_type][page.relation_id]
8
- : null;
17
+ transformedPages[market][isPreview ? 'preview' : page.relation_type][index].relation =
18
+ hasRelation ? data.relations[page.relation_type][page.relation_id] : null;
19
+
9
20
  switch (page.relation_type) {
10
21
  // Add path for payment page from payment method
11
22
  case 'operator':
12
23
  if (page.relation && hasRelation) {
13
24
  // eslint-disable-next-line camelcase, prefer-const
14
- const { ribbons, extra_fields, bonus } = page.relation;
25
+ const { ribbons, extra_fields, bonus, selling_point_short_names } = page.relation;
15
26
  bonus &&
16
27
  bonus.deposit_methods &&
17
28
  bonus.deposit_methods.forEach((e) => {
@@ -24,6 +35,11 @@ export const processRelations = (page, pageType, transformedPages, market, data,
24
35
  page.relation.url = operator_url || page.relation.url;
25
36
  page.relation.email = support_email || page.relation.email;
26
37
  page.relation.name = operator_name || page.relation.name;
38
+ updateArrayTranslations(
39
+ page.relation.selling_points,
40
+ selling_point_short_names,
41
+ translations
42
+ );
27
43
  // eslint-disable-next-line no-unused-expressions
28
44
  ribbons &&
29
45
  ribbons.length > 0 &&
@@ -54,6 +70,15 @@ export const processRelations = (page, pageType, transformedPages, market, data,
54
70
  transformedPages[market][pageType][index].relation = data.authors[page.relation_id];
55
71
  }
56
72
  break;
73
+ case 'payment_method':
74
+ if (page.relation && hasRelation) {
75
+ updateArrayTranslations(
76
+ page.relation.selling_points,
77
+ page.relation.selling_point_short_names,
78
+ translations
79
+ );
80
+ }
81
+ break;
57
82
  default:
58
83
  break;
59
84
  }