gatsby-core-theme 22.0.14 → 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,18 @@
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
+
1
16
  ## [22.0.14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.13...v22.0.14) (2023-06-19)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "22.0.14",
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');
@@ -288,7 +288,8 @@ export default {
288
288
  market,
289
289
  data,
290
290
  index,
291
- pageType === 'preview'
291
+ pageType === 'preview',
292
+ data.relations.translations[page.language]
292
293
  );
293
294
 
294
295
  // add author object to page
@@ -1,8 +1,5 @@
1
- /* eslint-disable no-prototype-builtins */
2
- /* eslint-disable camelcase */
3
- /* eslint-disable no-unused-expressions */
4
- /* eslint-disable import/prefer-default-export */
5
- /* eslint-disable no-shadow */
1
+ import { updateArrayTranslations } from '../getters';
2
+
6
3
  export const processRelations = (
7
4
  page,
8
5
  pageType,
@@ -10,7 +7,8 @@ export const processRelations = (
10
7
  market,
11
8
  data,
12
9
  index,
13
- isPreview
10
+ isPreview,
11
+ translations
14
12
  ) => {
15
13
  if (page.relation_type !== 'page' && page.relation_id) {
16
14
  const hasRelation =
@@ -18,12 +16,13 @@ export const processRelations = (
18
16
  data.relations[page.relation_type].hasOwnProperty(page.relation_id);
19
17
  transformedPages[market][isPreview ? 'preview' : page.relation_type][index].relation =
20
18
  hasRelation ? data.relations[page.relation_type][page.relation_id] : null;
19
+
21
20
  switch (page.relation_type) {
22
21
  // Add path for payment page from payment method
23
22
  case 'operator':
24
23
  if (page.relation && hasRelation) {
25
24
  // eslint-disable-next-line camelcase, prefer-const
26
- const { ribbons, extra_fields, bonus } = page.relation;
25
+ const { ribbons, extra_fields, bonus, selling_point_short_names } = page.relation;
27
26
  bonus &&
28
27
  bonus.deposit_methods &&
29
28
  bonus.deposit_methods.forEach((e) => {
@@ -36,6 +35,11 @@ export const processRelations = (
36
35
  page.relation.url = operator_url || page.relation.url;
37
36
  page.relation.email = support_email || page.relation.email;
38
37
  page.relation.name = operator_name || page.relation.name;
38
+ updateArrayTranslations(
39
+ page.relation.selling_points,
40
+ selling_point_short_names,
41
+ translations
42
+ );
39
43
  // eslint-disable-next-line no-unused-expressions
40
44
  ribbons &&
41
45
  ribbons.length > 0 &&
@@ -66,6 +70,15 @@ export const processRelations = (
66
70
  transformedPages[market][pageType][index].relation = data.authors[page.relation_id];
67
71
  }
68
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;
69
82
  default:
70
83
  break;
71
84
  }