gatsby-core-theme 30.0.46 → 30.0.48
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 +19 -0
- package/package.json +1 -1
- package/src/components/molecules/carousel/default-slide/index.js +8 -2
- package/src/components/organisms/head/index.js +1 -0
- package/src/components/pages/tracker/index-ssr.js +2 -1
- package/src/helpers/tracker.mjs +19 -2
- package/src/helpers/tracker.test.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [30.0.48](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.47...v30.0.48) (2024-01-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* tracker params ([3047a28](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3047a289212ecad77bb74391908d5e508a95e0f7))
|
|
7
|
+
|
|
8
|
+
## [30.0.47](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.46...v30.0.47) (2024-01-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* added lang value to .env ([3571ad7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3571ad7b0f9b929c13e546a654e313e056b733cf))
|
|
14
|
+
* added prop to hide captions ([ce903f6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ce903f67e1f8ff2de59ed976440802633e78e7b3))
|
|
15
|
+
* remove quote marks ([0c5b5d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0c5b5d6e9b85bd8072d3a6bbd18c85968ee44058))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* Merge branch 'tm-3969-html-lang' into 'master' ([b94b620](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b94b62097c889162e9b18915ef3e4239397971a8))
|
|
19
|
+
|
|
1
20
|
## [30.0.46](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.45...v30.0.46) (2024-01-08)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -7,10 +7,15 @@ import LazyImage from '~hooks/lazy-image';
|
|
|
7
7
|
import { imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
8
8
|
import styles from './default-slide.module.scss';
|
|
9
9
|
|
|
10
|
-
const Slide = ({
|
|
10
|
+
const Slide = ({
|
|
11
|
+
item = {},
|
|
12
|
+
imageSizes = { width: null, height: 930 },
|
|
13
|
+
slideTitle = '',
|
|
14
|
+
hideCaptions = false,
|
|
15
|
+
}) => {
|
|
11
16
|
return (
|
|
12
17
|
<>
|
|
13
|
-
{item.title && <span className={styles.title || ''}>{item.title}</span>}
|
|
18
|
+
{item.title && !hideCaptions && <span className={styles.title || ''}>{item.title}</span>}
|
|
14
19
|
{item.image && (
|
|
15
20
|
<LazyImage
|
|
16
21
|
className={styles.image || ''}
|
|
@@ -35,6 +40,7 @@ Slide.propTypes = {
|
|
|
35
40
|
}),
|
|
36
41
|
primaryBtnText: PropTypes.string,
|
|
37
42
|
secondaryBtnText: PropTypes.string,
|
|
43
|
+
hideCaptions: PropTypes.bool,
|
|
38
44
|
imageSizes: PropTypes.shape({ width: PropTypes.any, height: PropTypes.any }),
|
|
39
45
|
slideTitle: PropTypes.string,
|
|
40
46
|
};
|
|
@@ -6,6 +6,7 @@ import { getUrl, getPageImage, imagePrettyUrl } from '~helpers/getters';
|
|
|
6
6
|
import keygen from '~helpers/keygen';
|
|
7
7
|
|
|
8
8
|
export function getLanguage(language) {
|
|
9
|
+
if (process.env.GATSBY_SITE_LANG) return process.env.GATSBY_SITE_LANG;
|
|
9
10
|
if (language === 'no') return 'nb-NO';
|
|
10
11
|
return language || 'en';
|
|
11
12
|
}
|
package/src/helpers/tracker.mjs
CHANGED
|
@@ -39,11 +39,20 @@ function isJsonString(str) {
|
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function deparam(paramStr) {
|
|
43
|
+
const paramArr = paramStr.split('&');
|
|
44
|
+
const paramObj = {};
|
|
45
|
+
paramArr.forEach(e=>{
|
|
46
|
+
const param = e.split('=');
|
|
47
|
+
paramObj[param[0]] = decodeURIComponent(param[1]);
|
|
48
|
+
});
|
|
49
|
+
return paramObj;
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
/* eslint-disable no-return-assign */
|
|
43
53
|
/* eslint-disable import/prefer-default-export */
|
|
44
|
-
export async function getAffiliateLink(operator, path, page, headers) {
|
|
54
|
+
export async function getAffiliateLink(operator, path, page, headers, url) {
|
|
45
55
|
const trackerName = await getTrackerName(operator, page, path);
|
|
46
|
-
|
|
47
56
|
const cookie =
|
|
48
57
|
headers && headers.get('cookie')
|
|
49
58
|
? headers
|
|
@@ -53,6 +62,12 @@ export async function getAffiliateLink(operator, path, page, headers) {
|
|
|
53
62
|
.reduce((acc, [k, v]) => (acc[k.trim().replace('"', '')] = v) && acc, {})
|
|
54
63
|
: { affObject: JSON.stringify({}) };
|
|
55
64
|
|
|
65
|
+
|
|
66
|
+
let extraParams = null
|
|
67
|
+
if(url && url.split('?').length === 2) {
|
|
68
|
+
extraParams = deparam(`${url.split('?')[1]}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
const urlParam = {
|
|
57
72
|
site_id: process.env.SITE_ID,
|
|
58
73
|
operator_short_name: operator.short_name,
|
|
@@ -62,7 +77,9 @@ export async function getAffiliateLink(operator, path, page, headers) {
|
|
|
62
77
|
market_short_code: operator.market,
|
|
63
78
|
ip_address: headers ? headers.get('x-real-ip') || headers.get('host') : '127.0.0.1',
|
|
64
79
|
...(isJsonString(cookie.affObject) ? JSON.parse(cookie.affObject) : {}),
|
|
80
|
+
...(extraParams || {})
|
|
65
81
|
};
|
|
82
|
+
|
|
66
83
|
const res = await fetch(
|
|
67
84
|
`${process.env.GATSBY_TRACKING_API_URL}?${new URLSearchParams(urlParam).toString()}`
|
|
68
85
|
).catch((err) => null);
|
|
@@ -73,4 +73,33 @@ describe('Tracker Helper', () => {
|
|
|
73
73
|
`${process.env.GATSBY_TRACKING_API_URL}?${new URLSearchParams(urlParam).toString()}`
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
|
+
|
|
77
|
+
test('getAffiliateLink url params extras', async () => {
|
|
78
|
+
await Tracker.getAffiliateLink(
|
|
79
|
+
operator,
|
|
80
|
+
'/no/visit/rizk',
|
|
81
|
+
{ template: 'default' },
|
|
82
|
+
null,
|
|
83
|
+
'/path?extraparam=val&extraparam2=val2'
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const tracker = Tracker.getTrackerName(operator, 'default', '/no/visit/rizk');
|
|
87
|
+
|
|
88
|
+
const urlParam = {
|
|
89
|
+
site_id: process.env.SITE_ID,
|
|
90
|
+
operator_short_name: operator.short_name,
|
|
91
|
+
operator_type: operator.type,
|
|
92
|
+
language: operator.market.split('_')[1],
|
|
93
|
+
tracker_name: tracker.name,
|
|
94
|
+
market_short_code: operator.market,
|
|
95
|
+
ip_address: '127.0.0.1',
|
|
96
|
+
extraparam: 'val',
|
|
97
|
+
extraparam2: 'val2',
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
expect(fetch).toBeCalledTimes(1);
|
|
101
|
+
expect(fetch).toBeCalledWith(
|
|
102
|
+
`${process.env.GATSBY_TRACKING_API_URL}?${new URLSearchParams(urlParam).toString()}`
|
|
103
|
+
);
|
|
104
|
+
});
|
|
76
105
|
});
|