gatsby-matrix-theme 37.0.10 → 37.0.12

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/footer/license/index.js +1 -1
  4. package/src/components/atoms/recommended-operators/index.js +64 -0
  5. package/src/components/atoms/recommended-operators/recommended-operators.module.scss +156 -0
  6. package/src/components/molecules/footer/variants/template-one/index.js +1 -3
  7. package/src/components/molecules/footer/variants/template-one/template-one.test.js +1 -3
  8. package/src/components/molecules/footer/variants/template-three/index.js +1 -3
  9. package/src/components/molecules/footer/variants/template-three/template-three.test.js +1 -3
  10. package/src/components/molecules/footer/variants/template-two/index.js +1 -3
  11. package/src/components/molecules/footer/variants/template-two/template-two.test.js +1 -3
  12. package/src/components/molecules/operator-details/index.js +26 -24
  13. package/src/components/molecules/wagering-calculator/index.js +25 -54
  14. package/src/components/molecules/wagering-calculator/wagering-calculator.module.scss +33 -97
  15. package/src/gatsby-core-theme/components/molecules/module/index.js +4 -1
  16. package/storybook/public/43.e9f1ed32.iframe.bundle.js +1 -0
  17. package/storybook/public/iframe.html +1 -1
  18. package/storybook/public/main.2724dc52.iframe.bundle.js +2 -0
  19. package/storybook/public/runtime~main.09121dcd.iframe.bundle.js +1 -0
  20. package/storybook/public/main.3d0e1fc9.iframe.bundle.js +0 -2
  21. package/storybook/public/runtime~main.b0842e70.iframe.bundle.js +0 -1
  22. /package/storybook/public/{main.3d0e1fc9.iframe.bundle.js.LICENSE.txt → main.2724dc52.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## [37.0.12](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v37.0.11...v37.0.12) (2023-11-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * module pageContext ([09b3fad](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/09b3fadf5d3d3593c992df0206d40d9ba3d1912a))
7
+ * updated Wagering Calculator + Added Recommended Operators as seperate component ([d50b457](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d50b457c5ce1b1b2f37edb86dec37888e8256921))
8
+
9
+
10
+ * Merge branch 'tm-3828-wagering-calculator' into 'master' ([2cb7907](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/2cb7907e2ed3a4410e24749ee88d9f5c3a6eaa3c))
11
+
12
+ ## [37.0.11](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v37.0.10...v37.0.11) (2023-11-24)
13
+
14
+
15
+ ### Code Refactoring
16
+
17
+ * remove unnecessary line breaks ([10f58f5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/10f58f5bcbb10825de11bf04752b527fd93b6b5b))
18
+
19
+
20
+ * Merge branch 'tm-3778-footer' into 'master' ([4c23a14](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4c23a14344f90343729ee309f57a920b3864781e))
21
+
22
+
23
+ ### Tests
24
+
25
+ * fix testing ([3df51bc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3df51bce4a4b1d510df4bb45da714699d109d658))
26
+
1
27
  ## [37.0.10](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v37.0.9...v37.0.10) (2023-11-23)
2
28
 
3
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "37.0.10",
3
+ "version": "37.0.12",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -49,7 +49,7 @@ const FooterLicense = ({
49
49
  {template !== 'templateOne' && gamblingText && (
50
50
  <div
51
51
  className={styles?.gamblingText || ''}
52
- dangerouslySetInnerHTML={{ __html: gamblingText?.replace(/\. /g, '.<br />') }}
52
+ dangerouslySetInnerHTML={{ __html: gamblingText }}
53
53
  />
54
54
  )}
55
55
  </div>
@@ -0,0 +1,64 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { prettyTracker, getExtraField } from 'gatsby-core-theme/src/helpers/getters';
5
+
6
+ import Bonus from 'gatsby-core-theme/src/components/molecules/bonus-box/template-four';
7
+ import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
8
+ import OperatorDetails from '../../molecules/operator-details';
9
+ import Coupon from '../coupon';
10
+ import styles from './recommended-operators.module.scss';
11
+
12
+ const RecommendedOperators = ({
13
+ showCouponCode = false,
14
+ showRating = false,
15
+ title = 'Recommended Casinos:',
16
+ buttonType = 'primary',
17
+ operators,
18
+ }) => (
19
+ <div className={styles.reccommendedCasinos}>
20
+ <h3>{title}</h3>
21
+ {operators.slice(0, 3).map((operator) => {
22
+ const prettyLink = prettyTracker(operator, 'main', false);
23
+ const couponCode = getExtraField(operator.extra_fields, 'coupon_code');
24
+
25
+ return (
26
+ <div>
27
+ <a
28
+ href={prettyLink}
29
+ aria-label={operator.name}
30
+ target="_blank"
31
+ rel="nofollow noreferrer sponsored"
32
+ >
33
+ <OperatorDetails
34
+ showRating={showRating}
35
+ item={operator}
36
+ showAuthor={false}
37
+ showReviewLink={false}
38
+ costumeStyle={styles.operatorDetails}
39
+ />
40
+ </a>
41
+ <div className={styles.operatorBonus}>
42
+ <Bonus item={operator} tracker="main" />
43
+ </div>
44
+ {showCouponCode && <Coupon code={couponCode} />}
45
+ <OperatorCta operator={operator} tracker="main" buttonType={buttonType} />
46
+ </div>
47
+ );
48
+ })}
49
+ </div>
50
+ );
51
+
52
+ export default RecommendedOperators;
53
+
54
+ RecommendedOperators.propTypes = {
55
+ showCouponCode: PropTypes.bool,
56
+ showRating: PropTypes.bool,
57
+ title: PropTypes.string,
58
+ buttonType: PropTypes.string,
59
+ operators: PropTypes.arrayOf([
60
+ PropTypes.shape({
61
+ name: PropTypes.string,
62
+ }),
63
+ ]),
64
+ };
@@ -0,0 +1,156 @@
1
+ .reccommendedCasinos {
2
+ background-color: #fff;
3
+ padding: 0.8rem;
4
+ border-radius: 1.6rem;
5
+ margin-top: 1.6rem;
6
+
7
+ @include min(tablet){
8
+ padding: 1.6rem;
9
+ }
10
+
11
+ > h3 {
12
+ margin-top: 0;
13
+ margin-bottom: 0.8rem;
14
+ font-size: 1.8rem;
15
+ font-weight: 700;
16
+
17
+ @include min(tablet) {
18
+ font-size: 2rem;
19
+ }
20
+ }
21
+
22
+ > div {
23
+ margin-bottom: 0.8rem;
24
+ background: #f4f4f4;
25
+ display: grid;
26
+ align-items: center;
27
+ grid-template-columns: 4rem 1fr;
28
+ row-gap: 0.8rem;
29
+ @include min(mobile){
30
+ grid-template-columns: 1fr 2fr 1fr 1fr;
31
+ }
32
+ @include min(tablet){
33
+ grid-template-columns: 2fr 3fr 1fr 1fr;
34
+ }
35
+ border-radius: 1.6rem;
36
+ color: #fff;
37
+ padding: 0.8rem;
38
+ column-gap: 0.8rem;
39
+ @include min(tablet) {
40
+ row-gap: 1.6rem;
41
+ padding: 1.2rem;
42
+ }
43
+
44
+ &:last-child {
45
+ margin-bottom: 0;
46
+ }
47
+
48
+ a:first-child{
49
+ .Logo.cta{
50
+ height: 4rem;
51
+ width: 4rem;
52
+ @include min(tablet) {
53
+ height: 6.4rem;
54
+ width: auto;
55
+ }
56
+ }
57
+ }
58
+
59
+
60
+ a:nth-child(2) {
61
+ width: unset;
62
+ > span{
63
+ color: #fff !important;
64
+ text-decoration: none !important;
65
+ @include min(tablet) {
66
+ &:last-child{
67
+ color: #CED0DD !important;
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ img {
74
+ border-radius: 0.8rem;
75
+ height: 100%;
76
+ }
77
+ a:last-child {
78
+ padding: 0.8rem 1.6rem;
79
+ font-size: 1.4rem;
80
+ font-weight: 700;
81
+ grid-column: 1/3;
82
+ @include min(mobile){
83
+ grid-column: auto;
84
+ }
85
+ @include min(tablet) {
86
+ padding: 0.9rem 3rem;
87
+ width: unset;
88
+ }
89
+ }
90
+
91
+ > div {
92
+ &.operatorBonus{
93
+ flex-grow: inherit;
94
+ @include flex-align(flex-start, center);
95
+ @include flex-direction(column);
96
+ @include min(tablet) {
97
+ flex-basis: auto;
98
+ flex-grow: 1;
99
+ @include flex-align(center, flex-start);
100
+ background-color: #fff;
101
+
102
+ min-height: 6.4rem;
103
+ align-items: center;
104
+ justify-content: center;
105
+ border-radius: 0.8rem;
106
+ }
107
+
108
+ > span {
109
+ font-weight: 700;
110
+ color: #515156;
111
+ font-size: 1.2rem;
112
+ line-height: 1.8rem;
113
+
114
+ @include min(tablet) {
115
+ @include flex-direction(row);
116
+ font-size: 1.4rem;
117
+ line-height: 2.2rem;
118
+ }
119
+ }
120
+ }
121
+ &:not(.operatorBonus){
122
+ width: 100%;
123
+ button {width: 100%;}
124
+ grid-column: 1/3;
125
+ @include min(mobile){
126
+ grid-column: auto;
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ .operatorDetails {
134
+ div{
135
+ display: none;
136
+ @include min(tablet){
137
+ display: inline-flex;
138
+ margin: auto 0;
139
+ a{font-size: 1.4rem; padding: 0 !important;}
140
+ }
141
+ }
142
+ > a {
143
+ width: 4rem;
144
+ height: 4rem;
145
+ img{
146
+ width: 100%;
147
+ height: 100%;
148
+ }
149
+ @include min(tablet){
150
+ width: 6.4rem;
151
+ height: 6.4rem;
152
+ }
153
+ }
154
+ }
155
+
156
+
@@ -68,9 +68,7 @@ const TemplateOne = ({
68
68
  <div
69
69
  className={styles?.copyrightDisclaimer || ''}
70
70
  // eslint-disable-next-line react/no-danger
71
- dangerouslySetInnerHTML={{
72
- __html: copyrightDisclaimer.replace(/\. /g, '.<br />'),
73
- }}
71
+ dangerouslySetInnerHTML={{ __html: copyrightDisclaimer }}
74
72
  />
75
73
  )}
76
74
  {showCopyright && <p className={styles?.copyrightText || ''}>{copyrightText()}</p>}
@@ -197,9 +197,7 @@ describe('Show template one', () => {
197
197
  await waitFor(() => {
198
198
  expect(container.querySelectorAll('.copyrightDisclaimer')).toBeTruthy();
199
199
 
200
- expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(
201
- copyrightDisclaimer.replace(/\. /g, '.<br>')
202
- );
200
+ expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(copyrightDisclaimer);
203
201
  });
204
202
  });
205
203
  test('show copyright', async () => {
@@ -73,9 +73,7 @@ const TemplateThree = ({
73
73
  <div
74
74
  className={styles?.copyrightDisclaimer || ''}
75
75
  // eslint-disable-next-line react/no-danger
76
- dangerouslySetInnerHTML={{
77
- __html: copyrightDisclaimer.replace(/\. /g, '.<br />'),
78
- }}
76
+ dangerouslySetInnerHTML={{ __html: copyrightDisclaimer }}
79
77
  />
80
78
  )}
81
79
  {showCopyright && <p className={styles.copyrightText}>{copyrightText()}</p>}
@@ -197,9 +197,7 @@ describe('Show template one', () => {
197
197
  await waitFor(() => {
198
198
  expect(container.querySelectorAll('.copyrightDisclaimer')).toBeTruthy();
199
199
 
200
- expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(
201
- copyrightDisclaimer.replace(/\. /g, '.<br>')
202
- );
200
+ expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(copyrightDisclaimer);
203
201
  });
204
202
  });
205
203
  test('show copyright', async () => {
@@ -70,9 +70,7 @@ const TemplateTwo = ({
70
70
  <div
71
71
  className={styles?.copyrightDisclaimer || ''}
72
72
  // eslint-disable-next-line react/no-danger
73
- dangerouslySetInnerHTML={{
74
- __html: copyrightDisclaimer.replace(/\. /g, '.<br />'),
75
- }}
73
+ dangerouslySetInnerHTML={{ __html: copyrightDisclaimer }}
76
74
  />
77
75
  )}
78
76
  {showCopyright && <p className={styles?.copyrightText || ''}>{copyrightText()}</p>}
@@ -196,9 +196,7 @@ describe('Show template one', () => {
196
196
  await waitFor(() => {
197
197
  expect(container.querySelectorAll('.copyrightDisclaimer')).toBeTruthy();
198
198
 
199
- expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(
200
- copyrightDisclaimer.replace(/\. /g, '.<br>')
201
- );
199
+ expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(copyrightDisclaimer);
202
200
  });
203
201
  });
204
202
  test('show copyright', async () => {
@@ -120,30 +120,32 @@ const OperatorDetails = ({
120
120
 
121
121
  <Tag classStyle={`${styles.operatorName} name-cta `}>{itemName}</Tag>
122
122
 
123
- <div
124
- className={`${styles.ratingAuthor}
125
- ${!useOneStarRating && styles.starRatings}
126
- ${showRatingLabel && useOneStarRating && styles.ratinglabel}`}
127
- >
128
- {showRating && (
129
- <StarRating
130
- numOfStars={5}
131
- rating={rating}
132
- showLabel={showRatingLabel}
133
- showDecimal={showRatingDecimal}
134
- />
135
- )}
136
- {showAuthor && (
137
- <Author
138
- label={translate(translations, 'byAuthor', 'By')}
139
- authorTemplateTwo={authorTemplateTwo}
140
- authorName={item?.authorName || item?.author?.name}
141
- authorPath={item?.authorPath || item?.author?.profile_page_path}
142
- authorImage={item?.authorImage || item?.author?.image}
143
- verify={icon}
144
- />
145
- )}
146
- </div>
123
+ {showAuthor && showRating && (
124
+ <div
125
+ className={`${styles.ratingAuthor}
126
+ ${(!useOneStarRating && styles.starRatings) || ''}
127
+ ${(showRatingLabel && useOneStarRating && styles.ratinglabel) || ''}`}
128
+ >
129
+ {showRating && (
130
+ <StarRating
131
+ numOfStars={5}
132
+ rating={rating}
133
+ showLabel={showRatingLabel}
134
+ showDecimal={showRatingDecimal}
135
+ />
136
+ )}
137
+ {showAuthor && (
138
+ <Author
139
+ label={translate(translations, 'byAuthor', 'By')}
140
+ authorTemplateTwo={authorTemplateTwo}
141
+ authorName={item?.authorName || item?.author?.name}
142
+ authorPath={item?.authorPath || item?.author?.profile_page_path}
143
+ authorImage={item?.authorImage || item?.author?.image}
144
+ verify={icon}
145
+ />
146
+ )}
147
+ </div>
148
+ )}
147
149
  {reviewPath && showReviewLink && (
148
150
  <ReviewLink
149
151
  className={`${styles?.reviewLink || ''} toplist-variant-one-gtm`}
@@ -3,19 +3,15 @@ import React, { useState, useContext, useRef } 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';
6
- import { Context } from 'gatsby-core-theme/src/context/MainProvider';
7
- import {
8
- translate,
9
- prettyTracker,
10
- getAltText,
11
- imagePrettyUrl,
12
- } from 'gatsby-core-theme/src/helpers/getters';
13
- import Bonus from 'gatsby-core-theme/src/components/molecules/bonus-box/template-one';
14
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
6
+
7
+ import { translate } from 'gatsby-core-theme/src/helpers/getters';
15
8
  import Button from 'gatsby-core-theme/src/components/atoms/button/button';
16
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
17
- import { getRecommendedToplist } from '../../../helpers/common';
9
+ import { Context } from 'gatsby-core-theme/src/context/MainProvider';
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
11
+ import loadable from '@loadable/component';
12
+
18
13
  import styles from './wagering-calculator.module.scss';
14
+ import { getRecommendedToplist } from '../../../helpers/common';
19
15
 
20
16
  const WageringCalculator = ({
21
17
  mainTitle = 'Wagering Requirement Calculator',
@@ -32,7 +28,7 @@ const WageringCalculator = ({
32
28
  const wgcWagering = useRef(null);
33
29
 
34
30
  const [isInfoOpen, setIsInfoOpen] = useState(false);
35
- const [isRecommendedOperators, setIsRecommendedOperators] = useState(false);
31
+ const [showRecommendedOperators, setShowRecommendedOperators] = useState(false);
36
32
  const [result, setResult] = useState(null);
37
33
  const { translations } = useContext(Context);
38
34
  const InfoIcon = infoIcon || AiOutlineQuestionCircle;
@@ -40,6 +36,9 @@ const WageringCalculator = ({
40
36
  ? getRecommendedToplist(pageContext.marketSections)
41
37
  : [];
42
38
 
39
+ const ReccommendedCasinos =
40
+ operators.length > 0 && loadable(() => import('../../atoms/recommended-operators'));
41
+
43
42
  const Calculate = () => {
44
43
  // eslint-disable-next-line
45
44
  wgcContribution.current.value && (wgcContribution.current.value = 100);
@@ -52,7 +51,7 @@ const WageringCalculator = ({
52
51
  (100 / Number(wgcContribution.current.value))
53
52
  )
54
53
  );
55
- setIsRecommendedOperators(true);
54
+ setShowRecommendedOperators(true);
56
55
  };
57
56
 
58
57
  return (
@@ -145,7 +144,7 @@ const WageringCalculator = ({
145
144
  onClick={Calculate}
146
145
  btnText={translate(translations, 'wagecalc_calculate', 'Calculate')}
147
146
  isInternalLink={false}
148
- buttonType="primary"
147
+ buttonType={buttonType}
149
148
  buttonSize="m"
150
149
  />
151
150
 
@@ -175,42 +174,17 @@ const WageringCalculator = ({
175
174
  </p>
176
175
  </div>
177
176
  )}
178
- {operators && operators.length > 0 && isRecommendedOperators && (
179
- <div className={styles.reccommendedCasinos}>
180
- <h3>
181
- {translate(translations, 'wagecalc_recommended_casinos', 'Recommended Casinos')}
182
- </h3>
183
- {operators.slice(0, 3).map((operator) => {
184
- const prettyLink = prettyTracker(operator, 'main', false);
185
- const imageObject =
186
- operator?.standardised_logo_url_object || operator?.logo_url_object;
187
-
188
- return (
189
- <div>
190
- <a
191
- href={prettyLink}
192
- aria-label={operator.name}
193
- target="_blank"
194
- rel="nofollow noreferrer sponsored"
195
- >
196
- <LazyImage
197
- alt={getAltText(imageObject, operator.name)}
198
- src={imagePrettyUrl(imageObject?.filename || operator?.logo_url, 64, 64)}
199
- width={64}
200
- height={64}
201
- />
202
- </a>
203
- <Bonus item={operator} tracker="main" />
204
- <OperatorCta
205
- module="wagering_calculator"
206
- operator={operator}
207
- tracker="main"
208
- buttonType={buttonType}
209
- />
210
- </div>
211
- );
212
- })}
213
- </div>
177
+ {ReccommendedCasinos && showRecommendedOperators && (
178
+ <ReccommendedCasinos
179
+ showCouponCode
180
+ showRating
181
+ title={translate(
182
+ translations,
183
+ 'wagecalc_recommended_casinos',
184
+ 'Recommeded Casinos for you: '
185
+ )}
186
+ operators={operators}
187
+ />
214
188
  )}
215
189
  </div>
216
190
  </div>
@@ -224,10 +198,7 @@ WageringCalculator.propTypes = {
224
198
  infoIcon: PropTypes.element,
225
199
  buttonType: PropTypes.string,
226
200
  pageContext: PropTypes.shape({
227
- marketSections: PropTypes.shape({
228
- // eslint-disable-next-line react/forbid-prop-types
229
- recommended_casinos: PropTypes.array,
230
- }),
201
+ marketSections: PropTypes.shape({}),
231
202
  }),
232
203
  };
233
204