gatsby-matrix-theme 53.13.1 → 53.13.3
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 +2 -2
- package/src/components/molecules/wagering-calculator/index.js +106 -97
- package/src/constants/wagering-calculator.js +39 -0
- package/src/helpers/wagering-calculator.js +11 -0
- package/src/helpers/wagering-calculator.test.js +67 -0
- package/storybook/public/{384.c9a7d3cb.iframe.bundle.js → 384.273e9ea0.iframe.bundle.js} +3 -3
- package/storybook/public/{384.c9a7d3cb.iframe.bundle.js.map → 384.273e9ea0.iframe.bundle.js.map} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.eaa38ea7.iframe.bundle.js +1 -0
- package/storybook/public/project.json +1 -1
- package/storybook/public/main.d7a32f6f.iframe.bundle.js +0 -1
- /package/storybook/public/{384.c9a7d3cb.iframe.bundle.js.LICENSE.txt → 384.273e9ea0.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [53.13.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.13.2...v53.13.3) (2026-04-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add rtp fol calculator ([c1b0a35](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/c1b0a35f67bb91669f32ea265a71d5fde8e5b729))
|
|
7
|
+
* improve code ([ed93f35](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/ed93f35975fe55162c88beb3e802655b496b1972))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'en-405-wagering-calculator' into 'master' ([f1e794a](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/f1e794a3519135383c4f13ea5877d8a2ec531a2f))
|
|
11
|
+
|
|
12
|
+
## [53.13.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.13.1...v53.13.2) (2026-04-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Config
|
|
16
|
+
|
|
17
|
+
* update core theme ([a54b9e1](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/a54b9e1453ce36ff4cf6a15dd92dbb8ec12c51dd))
|
|
18
|
+
* update gatsby theme version ([4fce504](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/4fce504de245594bbd6709049249020fcd53e5b6))
|
|
19
|
+
|
|
1
20
|
## [53.13.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.13.0...v53.13.1) (2026-04-01)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "53.13.
|
|
3
|
+
"version": "53.13.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Matrix Theme NPM Package",
|
|
6
6
|
"author": "",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@react-icons/all-files": "^4.1.0",
|
|
27
27
|
"gatsby": "^5.11.0",
|
|
28
|
-
"gatsby-core-theme": "^44.
|
|
28
|
+
"gatsby-core-theme": "^44.20.0",
|
|
29
29
|
"gatsby-plugin-sharp": "^5.11.0",
|
|
30
30
|
"gatsby-plugin-sitemap": "^6.13.1",
|
|
31
31
|
"gatsby-transformer-sharp": "^5.11.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import React, { useState,
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { MdClose } from '@react-icons/all-files/md/MdClose';
|
|
5
5
|
import { AiOutlineQuestionCircle } from '@react-icons/all-files/ai/AiOutlineQuestionCircle';
|
|
@@ -10,22 +10,25 @@ import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
|
10
10
|
import RecomendedOperators from '../../atoms/recommended-operators';
|
|
11
11
|
import styles from './wagering-calculator.module.scss';
|
|
12
12
|
import { getRecommendedToplist } from '../../../helpers/common';
|
|
13
|
+
import wageringCalculator from '../../../helpers/wagering-calculator';
|
|
14
|
+
import WAGERING_INPUT_FIELDS from '../../../constants/wagering-calculator';
|
|
13
15
|
|
|
14
16
|
const WageringCalculator = ({
|
|
15
|
-
mainTitle = 'Wagering
|
|
17
|
+
mainTitle = 'Wagering RTP Calculator',
|
|
16
18
|
infoIcon,
|
|
17
19
|
infoTitle = 'Example: 20x Wagering Requirement',
|
|
18
20
|
infoText = 'Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat.',
|
|
19
21
|
pageContext = {},
|
|
20
22
|
buttonType = 'primary',
|
|
21
|
-
modulePosition
|
|
23
|
+
modulePosition,
|
|
24
|
+
currency = '€'
|
|
22
25
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
26
|
+
const [depositAmount, setDepositAmount] = useState('');
|
|
27
|
+
const [bonusAmount, setBonusAmount] = useState('');
|
|
28
|
+
const [type, setType] = useState('bonus');
|
|
29
|
+
const [contribution, setContribution] = useState('');
|
|
30
|
+
const [rtp, setRtp] = useState('');
|
|
31
|
+
const [rolloverTerms, setRolloverTerms] = useState('');
|
|
29
32
|
const [isInfoOpen, setIsInfoOpen] = useState(false);
|
|
30
33
|
const [showRecommendedOperators, setShowRecommendedOperators] = useState(false);
|
|
31
34
|
const [result, setResult] = useState(null);
|
|
@@ -35,25 +38,58 @@ const WageringCalculator = ({
|
|
|
35
38
|
? getRecommendedToplist(pageContext.marketSections)
|
|
36
39
|
: [];
|
|
37
40
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const capValue = (value, max) => {
|
|
42
|
+
const num = Number(value);
|
|
43
|
+
if (value === '' || Number.isNaN(num)) return value;
|
|
44
|
+
return num > max ? String(max) : value;
|
|
45
|
+
};
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const stateByKey = {
|
|
48
|
+
depositAmount: [depositAmount, setDepositAmount],
|
|
49
|
+
bonusAmount: [bonusAmount, setBonusAmount],
|
|
50
|
+
contribution: [contribution, setContribution],
|
|
51
|
+
rtp: [rtp, setRtp],
|
|
52
|
+
rolloverTerms: [rolloverTerms, setRolloverTerms],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const deposit = Number(depositAmount);
|
|
57
|
+
const bonus = Number(bonusAmount);
|
|
58
|
+
const contrib = Number(contribution);
|
|
59
|
+
const rtpVal = Number(rtp);
|
|
60
|
+
const rollover = Number(rolloverTerms);
|
|
61
|
+
|
|
62
|
+
if (bonus && contrib && rtpVal && rollover) {
|
|
63
|
+
const effectiveRTP = wageringCalculator({
|
|
64
|
+
depositAmount: deposit || 0,
|
|
65
|
+
bonusAmount: bonus,
|
|
66
|
+
type,
|
|
67
|
+
contribution: contrib,
|
|
68
|
+
rtp: rtpVal,
|
|
69
|
+
rolloverTerms: rollover,
|
|
70
|
+
});
|
|
71
|
+
setResult(effectiveRTP);
|
|
72
|
+
setShowRecommendedOperators(true);
|
|
73
|
+
} else {
|
|
74
|
+
setResult(null);
|
|
75
|
+
}
|
|
76
|
+
}, [depositAmount, bonusAmount, type, contribution, rtp, rolloverTerms]);
|
|
77
|
+
|
|
78
|
+
const resetFields = () => {
|
|
79
|
+
setDepositAmount('');
|
|
80
|
+
setBonusAmount('');
|
|
81
|
+
setType('bonus');
|
|
82
|
+
setContribution('');
|
|
83
|
+
setRtp('');
|
|
84
|
+
setRolloverTerms('');
|
|
85
|
+
setResult(null);
|
|
86
|
+
setShowRecommendedOperators(false);
|
|
51
87
|
};
|
|
52
88
|
|
|
53
89
|
return (
|
|
54
90
|
<div>
|
|
55
91
|
<div className={styles.container}>
|
|
56
|
-
<form target="_self">
|
|
92
|
+
<form target="_self" onSubmit={(e) => e.preventDefault()}>
|
|
57
93
|
<span className={styles.mainTitle}>
|
|
58
94
|
{useTranslate('wagecalc_main_title', mainTitle)}
|
|
59
95
|
{infoTitle && infoText && (
|
|
@@ -65,80 +101,52 @@ const WageringCalculator = ({
|
|
|
65
101
|
/>
|
|
66
102
|
)}
|
|
67
103
|
</span>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
onChange={({ target }) => {
|
|
112
|
-
const deposit = document.getElementById('wgc_deposit');
|
|
113
|
-
deposit.required = target.value !== 'bonus';
|
|
114
|
-
deposit.checkValidity();
|
|
115
|
-
}}
|
|
116
|
-
aria-label={useTranslate('wagecalc_select_label', 'Select an option')}
|
|
117
|
-
>
|
|
118
|
-
<option value="bonus">{useTranslate('wagecalc_bonus', 'Bonus')}</option>
|
|
119
|
-
<option value="bonus_deposit">
|
|
120
|
-
{useTranslate('wagecalc_deposit_bonus', 'Deposit + Bonus')}
|
|
121
|
-
</option>
|
|
122
|
-
</select>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div className={styles.inputContainer}>
|
|
126
|
-
<label className={styles.label} htmlFor="contribution">
|
|
127
|
-
{useTranslate('wagecalc_contribution', 'Contribution %')}
|
|
128
|
-
</label>
|
|
129
|
-
<input
|
|
130
|
-
className={styles.input}
|
|
131
|
-
ref={wgcContribution}
|
|
132
|
-
type="number"
|
|
133
|
-
min={0}
|
|
134
|
-
max={100}
|
|
135
|
-
id="contribution"
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
104
|
+
{WAGERING_INPUT_FIELDS.map((field) => {
|
|
105
|
+
if (field.id === 'type') {
|
|
106
|
+
return (
|
|
107
|
+
<div key="type" className={styles.inputContainer}>
|
|
108
|
+
<label className={styles.label} htmlFor="wgcCalcSelect">
|
|
109
|
+
{useTranslate('wagecalc_type', 'Type')}
|
|
110
|
+
</label>
|
|
111
|
+
<select
|
|
112
|
+
id="wgcCalcSelect"
|
|
113
|
+
className={styles.select}
|
|
114
|
+
value={type}
|
|
115
|
+
onChange={(e) => setType(e.target.value)}
|
|
116
|
+
aria-label={useTranslate('wagecalc_select_label', 'Select an option')}
|
|
117
|
+
>
|
|
118
|
+
<option value="bonus">{useTranslate('wagecalc_bonus', 'Bonus')}</option>
|
|
119
|
+
<option value="bonus_deposit">
|
|
120
|
+
{useTranslate('wagecalc_deposit_bonus', 'Deposit + Bonus')}
|
|
121
|
+
</option>
|
|
122
|
+
</select>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
const [value, setValue] = stateByKey[field.stateKey];
|
|
127
|
+
return (
|
|
128
|
+
<div key={field.id} className={styles.inputContainer}>
|
|
129
|
+
<label className={styles.label} htmlFor={field.id}>
|
|
130
|
+
{useTranslate(field.translationKey, field.defaultLabel)}
|
|
131
|
+
</label>
|
|
132
|
+
<input
|
|
133
|
+
id={field.id}
|
|
134
|
+
className={styles.input}
|
|
135
|
+
value={value}
|
|
136
|
+
onChange={(e) => setValue(
|
|
137
|
+
field.max ? capValue(e.target.value, field.max) : e.target.value,
|
|
138
|
+
)}
|
|
139
|
+
type="number"
|
|
140
|
+
min={0}
|
|
141
|
+
max={field.max}
|
|
142
|
+
required={field.required}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
})}
|
|
139
147
|
<Button
|
|
140
|
-
onClick={
|
|
141
|
-
btnText={useTranslate('
|
|
148
|
+
onClick={resetFields}
|
|
149
|
+
btnText={useTranslate('wagecalc_reset', 'Reset')}
|
|
142
150
|
isInternalLink={false}
|
|
143
151
|
buttonType={buttonType}
|
|
144
152
|
buttonSize="m"
|
|
@@ -146,9 +154,9 @@ const WageringCalculator = ({
|
|
|
146
154
|
|
|
147
155
|
{!!result && !isInfoOpen && (
|
|
148
156
|
<div className={styles.resultContainer}>
|
|
149
|
-
<span>{useTranslate('wagecalc_result', '
|
|
157
|
+
<span>{useTranslate('wagecalc_result', 'Effective RTP:')}</span>
|
|
150
158
|
<span>
|
|
151
|
-
{
|
|
159
|
+
{currency}
|
|
152
160
|
{result}
|
|
153
161
|
</span>
|
|
154
162
|
</div>
|
|
@@ -189,6 +197,7 @@ WageringCalculator.propTypes = {
|
|
|
189
197
|
marketSections: PropTypes.shape({}),
|
|
190
198
|
}),
|
|
191
199
|
modulePosition: PropTypes.number,
|
|
200
|
+
currency: PropTypes.string,
|
|
192
201
|
};
|
|
193
202
|
|
|
194
203
|
export default WageringCalculator;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const WAGERING_INPUT_FIELDS = [
|
|
2
|
+
{
|
|
3
|
+
id: 'wgc_deposit',
|
|
4
|
+
stateKey: 'depositAmount',
|
|
5
|
+
translationKey: 'wagecalc_deposit_amount',
|
|
6
|
+
defaultLabel: 'Deposit amount',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: 'bonus',
|
|
10
|
+
stateKey: 'bonusAmount',
|
|
11
|
+
translationKey: 'wagecalc_bonus_amount',
|
|
12
|
+
defaultLabel: 'Bonus amount',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
{ id: 'type' },
|
|
16
|
+
{
|
|
17
|
+
id: 'contribution',
|
|
18
|
+
stateKey: 'contribution',
|
|
19
|
+
translationKey: 'wagecalc_contribution',
|
|
20
|
+
defaultLabel: 'Game Contribution %',
|
|
21
|
+
max: 100,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'rtp',
|
|
25
|
+
stateKey: 'rtp',
|
|
26
|
+
translationKey: 'wagecalc_rtp',
|
|
27
|
+
defaultLabel: 'RTP %',
|
|
28
|
+
max: 100,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'wagering',
|
|
32
|
+
stateKey: 'rolloverTerms',
|
|
33
|
+
translationKey: 'wagecalc_wagering',
|
|
34
|
+
defaultLabel: 'Rollover Terms',
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export default WAGERING_INPUT_FIELDS;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const wageringCalculator = ({ depositAmount, bonusAmount, type, contribution, rtp, rolloverTerms }) => {
|
|
2
|
+
const effectiveContribution = contribution === 0 ? 0 : contribution / 100;
|
|
3
|
+
if (effectiveContribution === 0) return 0;
|
|
4
|
+
const originalAmount = type === 'bonus'
|
|
5
|
+
? (bonusAmount * rolloverTerms) / effectiveContribution
|
|
6
|
+
: ((bonusAmount + depositAmount) * rolloverTerms) / effectiveContribution;
|
|
7
|
+
const effectiveRTP = rtp ? Number((originalAmount / (rtp / 100)).toFixed(2)) : originalAmount;
|
|
8
|
+
return effectiveRTP;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = wageringCalculator;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const wageringCalculator = require('./wagering-calculator');
|
|
2
|
+
|
|
3
|
+
describe('wageringCalculator', () => {
|
|
4
|
+
it('returns 0 when contribution is 0', () => {
|
|
5
|
+
const result = wageringCalculator({
|
|
6
|
+
depositAmount: 100,
|
|
7
|
+
bonusAmount: 50,
|
|
8
|
+
type: 'bonus',
|
|
9
|
+
contribution: 0,
|
|
10
|
+
rtp: 96,
|
|
11
|
+
rolloverTerms: 20,
|
|
12
|
+
});
|
|
13
|
+
expect(result).toBe(0);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('calculates correctly for bonus type', () => {
|
|
17
|
+
const result = wageringCalculator({
|
|
18
|
+
depositAmount: 100,
|
|
19
|
+
bonusAmount: 50,
|
|
20
|
+
type: 'bonus',
|
|
21
|
+
contribution: 100,
|
|
22
|
+
rtp: 96,
|
|
23
|
+
rolloverTerms: 20,
|
|
24
|
+
});
|
|
25
|
+
// (50 * 20) / 1 = 1000, then 1000 / (96/100) = 1041.67
|
|
26
|
+
expect(result).toBe(1041.67);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('calculates correctly for bonus_deposit type', () => {
|
|
30
|
+
const result = wageringCalculator({
|
|
31
|
+
depositAmount: 100,
|
|
32
|
+
bonusAmount: 50,
|
|
33
|
+
type: 'bonus_deposit',
|
|
34
|
+
contribution: 100,
|
|
35
|
+
rtp: 96,
|
|
36
|
+
rolloverTerms: 20,
|
|
37
|
+
});
|
|
38
|
+
// ((50 + 100) * 20) / 1 = 3000, then 3000 / (96/100) = 3125
|
|
39
|
+
expect(result).toBe(3125);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('returns originalAmount when rtp is 0', () => {
|
|
43
|
+
const result = wageringCalculator({
|
|
44
|
+
depositAmount: 100,
|
|
45
|
+
bonusAmount: 50,
|
|
46
|
+
type: 'bonus',
|
|
47
|
+
contribution: 100,
|
|
48
|
+
rtp: 0,
|
|
49
|
+
rolloverTerms: 20,
|
|
50
|
+
});
|
|
51
|
+
// (50 * 20) / 1 = 1000, rtp is falsy so returns 1000
|
|
52
|
+
expect(result).toBe(1000);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('handles partial contribution percentage', () => {
|
|
56
|
+
const result = wageringCalculator({
|
|
57
|
+
depositAmount: 0,
|
|
58
|
+
bonusAmount: 100,
|
|
59
|
+
type: 'bonus',
|
|
60
|
+
contribution: 50,
|
|
61
|
+
rtp: 96,
|
|
62
|
+
rolloverTerms: 30,
|
|
63
|
+
});
|
|
64
|
+
// (100 * 30) / 0.5 = 6000, then 6000 / (96/100) = 6250
|
|
65
|
+
expect(result).toBe(6250);
|
|
66
|
+
});
|
|
67
|
+
});
|