gatsby-core-theme 44.28.0 → 44.30.0

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 (25) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/iframe/index.js +0 -8
  4. package/src/components/atoms/notifications/index.js +110 -38
  5. package/src/components/atoms/notifications/notification-items/bonuses/bonuses.test.js +63 -0
  6. package/src/components/atoms/notifications/notification-items/bonuses/index.js +168 -0
  7. package/src/components/atoms/notifications/notification-items/cards-v2/index.js +102 -90
  8. package/src/components/atoms/notifications/notification-items/cards-v2/notification-items.module.scss +165 -215
  9. package/src/components/atoms/notifications/notification-items/spotlight/index.js +111 -83
  10. package/src/components/atoms/notifications/notifications.module.scss +267 -19
  11. package/src/components/atoms/notifications/notifications.test.js +10 -4
  12. package/src/components/atoms/notifications/panel-header/index.js +45 -0
  13. package/src/components/atoms/notifications/panel-header/panel-header.module.scss +51 -0
  14. package/src/components/atoms/notifications/panel-tabs/index.js +79 -0
  15. package/src/components/atoms/notifications/panel-tabs/panel-tabs.module.scss +115 -0
  16. package/src/components/organisms/navigation/index.js +6 -1
  17. package/src/constants/pick-keys.mjs +2 -0
  18. package/src/images/icons/copyIcon.js +26 -0
  19. package/src/images/icons/countryFlag.js +19 -0
  20. package/src/images/icons/verifiedBadgeIcon.js +35 -0
  21. package/src/resolver/games.mjs +59 -17
  22. package/src/resolver/games.test.js +66 -0
  23. package/src/resolver/index.mjs +10 -7
  24. package/src/resolver/modules.mjs +11 -2
  25. package/src/components/atoms/notifications/notification-items/spotlight/notification-items.module.scss +0 -271
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /* eslint-disable react-hooks/rules-of-hooks */
3
- /* eslint-disable react/no-danger */
4
3
  import React from "react";
5
4
  import PropTypes from "prop-types";
6
5
  import LazyImage from "~hooks/lazy-image";
@@ -17,120 +16,133 @@ import useTranslate from "~hooks/useTranslate/useTranslate";
17
16
  import { getTimeAgo } from "~helpers/date-time";
18
17
  import styles from "./notification-items.module.scss";
19
18
 
20
- const CardsItems = ({ module, onClose, wordLimit = 12 }) => {
21
- const { items } = module;
22
- const noNewUpdates = useTranslate("noNewUpdates", "No new items");
19
+ const CategoryTag = ({ category }) => {
20
+ const label = useTranslate(
21
+ `category_${category.short_name}`,
22
+ category?.name || ""
23
+ );
23
24
 
24
- const Content = ({ item }) => {
25
- const isDefaultOrArticlePage = ["article", "page"].includes(
26
- item?.relation_type
27
- );
25
+ if (!label) return null;
28
26
 
29
- const img = item?.relation?.logo?.filename;
27
+ return <span className={styles.tag}>{label}</span>;
28
+ };
29
+
30
+ const CardsItems = ({ module, wordLimit = 12, showUnread = false }) => {
31
+ const { items } = module || {};
32
+ const noNewUpdates = useTranslate("noNewUpdates", "No new items");
33
+ const updatedLabel = useTranslate("updated", "Updated");
30
34
 
35
+ const renderItem = (item) => {
36
+ const isArticleOrPage = ["article", "page"].includes(item?.relation_type);
37
+ const img = isArticleOrPage
38
+ ? item?.banner
39
+ : item?.relation?.logo?.filename;
31
40
  const imageSrc = imagePrettyUrl(img, 40, 40);
32
41
  const fileName = getImageFilename(imageSrc);
33
-
34
42
  const TitleTag = item?.title_tag || "label";
35
-
36
-
37
43
  const ribbon = getExtraField(item?.extra_fields, "notification_ribbon");
38
44
  const title = getExtraField(item?.extra_fields, "notification_title");
39
45
  const subtitle = getExtraField(item?.extra_fields, "notification_subtitle");
40
-
46
+ const categories = item?.categories || [];
47
+ const description =
48
+ subtitle || item?.short_description || item?.description || "";
41
49
  const timeData =
42
50
  getTimeAgo(
43
- item?.manual_updated_at ||
51
+ item?.manual_updated_date ||
44
52
  item?.updated_at ||
45
- item?.manual_created_at ||
53
+ item?.manual_published_date ||
46
54
  item?.created_at
47
55
  ) || {};
48
-
49
- const timeAgo = timeData
50
- ? `${timeData?.value} ${useTranslate(
51
- timeData?.key,
52
- timeData?.key?.replace("_", " ")
56
+ const timeAgo = timeData.value
57
+ ? `${updatedLabel} ${timeData.value} ${useTranslate(
58
+ timeData.key,
59
+ timeData.key?.replace(/_/g, " ")
53
60
  )}`
54
61
  : "";
55
62
 
63
+ const thumbnail = img ? (
64
+ <LazyImage
65
+ width={40}
66
+ height={40}
67
+ alt={getAltText(
68
+ item?.image_object,
69
+ item?.title || item?.label || item?.link_text || fileName
70
+ )}
71
+ src={imageSrc}
72
+ />
73
+ ) : (
74
+ isArticleOrPage && <ArticleIcon />
75
+ );
76
+
56
77
  return (
57
78
  <div className={styles.notificationContent}>
58
- {!isDefaultOrArticlePage ? img && (
59
- <LazyImage
60
- width={40}
61
- height={40}
62
- alt={getAltText(
63
- item?.image_object,
64
- item?.label || item?.link_text || fileName
79
+ {showUnread && <span className={styles.unreadDot} />}
80
+ <div className={styles.topRow}>
81
+ <div className={styles.thumbnail}>{thumbnail}</div>
82
+ <div className={styles.text}>
83
+ {(item?.title || title) && (
84
+ <TitleTag className={styles.title}>
85
+ {title || item?.title}
86
+ </TitleTag>
87
+ )}
88
+ {description && (
89
+ <p className={styles.subtitle}>
90
+ {textWordsLimit(
91
+ description.replace(/<\/?[^>]+(>|$)/g, ""),
92
+ wordLimit
93
+ )}
94
+ </p>
65
95
  )}
66
- src={imageSrc}
67
- />
68
- ) : <ArticleIcon />}
69
- <div className={styles.innerContent}>
70
- {(item?.title || title) && (
71
- <TitleTag>{title || item?.title}</TitleTag>
72
- )}
73
- {(item?.description || subtitle) && (
74
- <p className={styles.subtitle}>
75
- {textWordsLimit(
76
- (subtitle || item?.description || "").replace(
77
- /<\/?[^>]+(>|$)/g,
78
- ""
79
- ),
80
- wordLimit
81
- )}
82
- </p>
83
- )}
84
- {item?.template && (
85
- <div className={styles.ribbonAndTime}>
86
- {ribbon && <span className={styles.ribbon}>{ribbon}</span>}
87
- <span className={styles.extraContent}>{timeAgo}</span>
88
- </div>
89
- )}
96
+ </div>
97
+ <span className={styles.cta} aria-hidden="true" />
90
98
  </div>
99
+ {(categories.length > 0 || ribbon || timeAgo) && (
100
+ <div className={styles.meta}>
101
+ {(categories.length > 0 || ribbon) && (
102
+ <div className={styles.tags}>
103
+ {categories.length > 0
104
+ ? categories.map((category) => (
105
+ <CategoryTag
106
+ key={category.short_name || category.name}
107
+ category={category}
108
+ />
109
+ ))
110
+ : (
111
+ <span className={styles.tag}>
112
+ {useTranslate(ribbon, ribbon)}
113
+ </span>
114
+ )}
115
+ </div>
116
+ )}
117
+ {timeAgo && <span className={styles.timestamp}>{timeAgo}</span>}
118
+ </div>
119
+ )}
91
120
  </div>
92
121
  );
93
122
  };
94
123
 
124
+ if (!items?.length) {
125
+ return <p className={styles.empty}>{noNewUpdates}</p>;
126
+ }
127
+
95
128
  return (
96
- <div className={styles.container || ""}>
97
- <div className={styles.notificationsContainer || ""}>
98
- <span>{useTranslate("latestUpdates", "Latest Updates")}</span>
99
- {items?.length ? (
100
- <ul className={styles.notifications || ""}>
101
- {items.map((item) => (
102
- <li
103
- className={`${styles.notification} notification-item-gtm`}
104
- key={keygen()}
105
- >
106
- <Link
107
- to={item?.path}
108
- title={item?.title}
109
- className={`${styles.notificationLink} cards-gtm`}
110
- aria-label={`${item?.title} Link`}
111
- >
112
- <Content item={item} />
113
- </Link>
114
- </li>
115
- ))}
116
- </ul>
117
- ) : (
118
- <>{noNewUpdates}</>
119
- )}
120
- </div>
121
- <div className={styles.triangle} />
122
- <div
123
- className={styles.overlay}
124
- onKeyDown={onClose}
125
- onClick={onClose}
126
- role="button"
127
- aria-label={useTranslate(
128
- "ariaLabel-notificationBellIcon",
129
- "Notification Bell Icon"
130
- )}
131
- tabIndex={0}
132
- />
133
- </div>
129
+ <ul className={`${styles.notifications} ${styles.embeddedList}`}>
130
+ {items.map((item) => (
131
+ <li
132
+ className={`${styles.notification} ${styles.embedded} notification-item-gtm`}
133
+ key={keygen()}
134
+ >
135
+ <Link
136
+ to={item?.path}
137
+ title={item?.title}
138
+ className={`${styles.notificationLink} cards-gtm`}
139
+ aria-label={`${item?.title} Link`}
140
+ >
141
+ {renderItem(item)}
142
+ </Link>
143
+ </li>
144
+ ))}
145
+ </ul>
134
146
  );
135
147
  };
136
148
 
@@ -138,7 +150,7 @@ CardsItems.propTypes = {
138
150
  module: PropTypes.shape({
139
151
  items: PropTypes.arrayOf(PropTypes.shape({})),
140
152
  }),
141
- onClose: PropTypes.func,
153
+ showUnread: PropTypes.bool,
142
154
  };
143
155
 
144
156
  export default CardsItems;
@@ -1,270 +1,220 @@
1
- .container {
2
- position: relative;
3
- position: fixed;
4
- left: 0;
5
- top: 7.6rem;
6
- background: #fff;
7
-
8
- @include min(tablet) {
9
- left: auto;
10
- top: calc(100% + 8px);
11
- right: 3.8rem;
12
- border-radius: 1rem;
13
- box-shadow: 0 8px 8px -4px rgb(27 27 28 / 4%),
14
- 0 20px 24px -4px rgb(27 27 28 / 7%);
15
- padding-bottom: 1px;
16
- }
17
-
18
- @include min(tablet) {
19
- position: absolute;
20
- right: 0;
21
- }
22
- }
23
-
24
- .notificationsContainer {
25
- width: 100vw;
26
- max-height: 58.4rem;
27
- padding: 1.6rem 1.6rem 2.4rem;
28
-
29
- @include flex-align(stretch, stretch);
1
+ .notifications {
30
2
  @include flex-direction(column);
31
3
 
32
4
  gap: 0.8rem;
33
- transition: 0.5s ease-in;
34
- overflow-y: hidden;
5
+ margin: 0;
6
+ padding: 0;
7
+ list-style: none;
8
+ }
35
9
 
36
- &::-webkit-scrollbar {
37
- width: 4px;
38
- }
10
+ .notification {
11
+ position: relative;
12
+ isolation: isolate;
13
+ }
39
14
 
40
- &::-webkit-scrollbar-track {
41
- background: #e0e0e2;
15
+ .notificationLink {
16
+ display: block;
17
+ width: 100%;
18
+ color: inherit;
19
+ text-decoration: none;
20
+ }
42
21
 
43
- @include min(tablet) {
44
- border-radius: 0 10px 10px 0;
45
- }
46
- }
22
+ .notificationContent {
23
+ @include flex-direction(column);
24
+ }
47
25
 
48
- &::-webkit-scrollbar-thumb {
49
- background-color: #515156;
26
+ .topRow {
27
+ @include flex-align(flex-start, flex-start);
50
28
 
51
- @include min(tablet) {
52
- border-radius: 0 10px 10px 0;
53
- }
54
- }
29
+ gap: 0.8rem;
30
+ }
55
31
 
56
- @include min(tablet) {
57
- border-radius: 4px;
58
- padding: 1.6rem;
59
- font-size: 1rem;
60
- z-index: 100;
61
- white-space: wrap;
62
- max-width: 40.6rem;
63
- width: 40.6rem;
64
- max-height: 60rem;
65
- }
32
+ .unreadDot {
33
+ position: absolute;
34
+ z-index: 3;
35
+ width: 0.7rem;
36
+ height: 0.7rem;
37
+ border-radius: 100%;
38
+ background: var(--notification-unread-dot, #f55d41);
39
+ }
66
40
 
67
- span {
68
- font-size: 1.8rem;
69
- font-weight: 600;
70
- color: #1b1b1c;
71
- line-height: 2.8rem;
72
- margin: 0;
73
- height: 3.2rem;
41
+ .thumbnail {
42
+ @include flex-align(center, center);
74
43
 
75
- @include flex-align(center, space-between);
44
+ flex-shrink: 0;
45
+ overflow: hidden;
46
+
47
+ img,
48
+ svg {
49
+ display: block;
50
+ width: 4rem;
51
+ height: 4rem;
52
+ border-radius: 0.4rem;
76
53
  }
77
54
  }
78
55
 
79
- .notifications {
80
- @include flex-align(stretch, flex-start);
56
+ .text {
81
57
  @include flex-direction(column);
82
58
 
83
- gap: 0.8rem;
84
- overflow-y: auto;
59
+ flex: 1;
60
+ min-width: 0;
61
+ gap: 0.4rem;
62
+ }
85
63
 
86
- &::-webkit-scrollbar {
87
- width: 4px;
88
- }
64
+ .title {
65
+ margin: 0;
66
+ font-size: 1.4rem;
67
+ font-weight: 600;
68
+ line-height: 2.2rem;
69
+ color: #1b1b1c;
70
+ }
89
71
 
90
- &::-webkit-scrollbar-track {
91
- background: #e0e0e2;
92
- border-radius: 1rem;
93
- }
72
+ .subtitle {
73
+ margin: 0;
74
+ font-size: 1.2rem;
75
+ font-weight: 400;
76
+ line-height: 1.8rem;
77
+ color: #515156;
78
+ }
94
79
 
95
- &::-webkit-scrollbar-thumb {
96
- background-color: #515156;
97
- border-radius: 1rem;
98
- }
80
+ .meta {
81
+ @include flex-align(center, flex-start);
99
82
 
100
- @include min(tablet) {
101
- max-height: 50.4rem;
102
- }
83
+ gap: 0.5rem;
84
+ font-weight: 500;
103
85
  }
104
86
 
105
- .close {
106
- align-self: flex-start;
107
- padding-right: 1.6rem;
87
+ .tags {
88
+ @include flex-align(center, flex-start);
89
+
90
+ flex-wrap: wrap;
91
+ gap: 0.5rem;
92
+ min-width: 0;
108
93
  }
109
94
 
110
- .triangle {
111
- @include min(tablet) {
112
- display: block;
113
- position: absolute;
114
- bottom: 99%;
115
- left: 50%;
116
- margin-top: -9px;
117
- background-color: #fff;
118
- width: 20px;
119
- height: 20px;
120
- border-top-right-radius: 5px;
121
- transform: rotate(300deg) skewX(-30deg) scale(1, 0.866);
122
- z-index: -1;
123
-
124
- &::before,
125
- &::after {
126
- content: "";
127
- position: absolute;
128
- background-color: inherit;
129
- width: 20px;
130
- height: 20px;
131
- border-top-right-radius: 5px;
132
- }
95
+ .tag {
96
+ @include flex-align(center, center);
97
+
98
+ padding: 0.4rem 0.8rem;
99
+ border-radius: 10rem;
100
+ background: var(--primary-button-color, #6e33e5);
101
+ color: #fff;
102
+ font-size: 0.9rem;
103
+ font-weight: 700;
104
+ line-height: 1.1rem;
105
+ letter-spacing: 0.05rem;
106
+ text-transform: uppercase;
107
+ }
133
108
 
134
- &::before {
135
- transform: rotate(-135deg) skewX(-45deg) scale(1.414, 0.707)
136
- translate(0, -50%);
137
- }
109
+ .timestamp {
110
+ color: #64646d;
111
+ font-size: 1.2rem;
112
+ font-weight: 500;
113
+ line-height: 1.8rem;
114
+ }
138
115
 
139
- &::after {
140
- transform: rotate(135deg) skewY(-45deg) scale(0.707, 1.414) translate(50%);
141
- }
142
- }
116
+ .empty {
117
+ margin: 0;
118
+ font-size: 1.4rem;
119
+ color: var(--notification-empty-color, #515156);
143
120
  }
144
121
 
145
- .notification {
146
- border-radius: 8px;
147
- background: #f4f4f4;
148
- gap: 0 0.8rem;
149
- position: relative;
150
- border: 1px solid transparent;
122
+ .embedded {
123
+ background: transparent;
151
124
 
152
- &:hover {
153
- border-color: var(--primary-button-color, #6e33e5);
154
- background-color: #fbfaf9;
125
+ .notificationLink {
126
+ padding: 0 0 0.8rem;
127
+ border-bottom: 1px solid
128
+ var(--notification-trending-item-border, var(--notification-item-border, #e3e6ef));
155
129
  }
156
130
 
157
- &::after {
158
- display: block;
159
- content: "";
160
- width: 6px;
161
- height: 6px;
162
- position: absolute;
163
- right: 1.6rem;
164
- top: 50%;
165
- transform: translateY(-50%);
166
- background-color: var(--primary-button-color, #6e33e5);
167
- border-radius: 100%;
131
+ .notificationContent {
132
+ position: relative;
133
+ gap: 0.8rem;
168
134
  }
169
- }
170
135
 
171
- .notificationLink {
172
- padding: 1.2rem;
173
- width: 100%;
174
- }
136
+ .unreadDot {
137
+ left: -1.2rem;
138
+ top: -0.8rem;
139
+ }
175
140
 
176
- .overlay {
177
- position: fixed;
178
- width: 100vw;
179
- height: calc(100vh);
180
- z-index: -1;
181
- opacity: 0.45;
182
- background: #0a0e19;
141
+ .thumbnail {
142
+ box-sizing: border-box;
143
+ overflow: hidden;
144
+ width: 5.2rem;
145
+ height: 5.2rem;
146
+ border: 1px solid var(--notification-logo-border, #dedede);
147
+ border-radius: var(--notification-logo-border-radius, 0.8rem);
183
148
 
184
- @include min(tablet) {
185
- display: none;
149
+ img,
150
+ svg {
151
+ display: block;
152
+ width: 100%;
153
+ height: 100%;
154
+ border: 0;
155
+ border-radius: 0;
156
+ object-fit: cover;
157
+ }
186
158
  }
187
- }
188
159
 
189
- .notificationContent {
190
- @include flex-align(stretch, stretch);
191
- @include flex-direction(row);
160
+ .text {
161
+ padding-right: 2.4rem;
162
+ }
192
163
 
193
- column-gap: 0.8rem;
164
+ .title {
165
+ font-weight: 700;
166
+ color: var(--notification-oneliner-color, #1b1b1c);
167
+ }
194
168
 
195
- img, svg {
196
- width: 4rem;
197
- height: 4rem;
198
- grid-row: 1 / span 2;
199
- border-radius: 4px;
169
+ .subtitle {
170
+ display: -webkit-box;
171
+ overflow: hidden;
172
+ color: var(--notification-trending-description-color, #6e6e84);
200
173
  }
201
174
 
202
- h2,
203
- h3,
204
- h4,
205
- h5,
206
- label {
207
- color: #1b1b1c;
208
- font-size: 1.4rem;
209
- font-weight: 600;
210
- line-height: 2.2rem;
211
- margin: 0;
175
+ .meta {
176
+ @include flex-align(center, space-between);
177
+
178
+ min-height: 2.4rem;
212
179
  }
213
180
 
214
- > div {
215
- color: #f4f4f4;
181
+ .tag {
182
+ height: 2.4rem;
183
+ border-radius: var(--notification-trending-tag-border-radius, 0.8rem);
184
+ background: var(--notification-trending-tag-bg, #f4f4f4);
185
+ color: var(--notification-trending-tag-color, #515156);
216
186
  font-size: 1.2rem;
217
187
  font-weight: 400;
218
188
  line-height: 1.8rem;
189
+ letter-spacing: normal;
190
+ text-transform: none;
219
191
  }
220
- }
221
-
222
- .innerContent {
223
- @include flex-direction(column);
224
- }
225
192
 
226
- .subtitle {
227
- margin-bottom: 0.8rem;
228
- grid-column: 2;
229
- width: 26rem;
230
- text-overflow: ellipsis;
231
- color: rgb(81 81 86);
232
-
233
- @include max(mobile-m) {
234
- width: 20rem;
193
+ .timestamp {
194
+ flex-shrink: 0;
195
+ margin-left: auto;
196
+ color: var(--notification-meta-color, #515156);
197
+ font-size: 1rem;
198
+ font-weight: 400;
199
+ line-height: 1.4rem;
200
+ white-space: nowrap;
235
201
  }
236
- }
237
-
238
- .ribbonAndTime {
239
- @include flex-align(center, flex-start);
240
-
241
- gap: 0.5rem;
242
- font-weight: 500;
243
- grid-column: 2;
244
- height: 1.9rem;
245
-
246
- .ribbon {
247
- border-radius: 100px;
248
- background: var(--primary-button-color, #6e33e5);
249
- padding: 4px 8px;
250
202
 
203
+ .cta {
251
204
  @include flex-align(center, center);
252
205
 
253
- color: #fff;
254
- text-align: center;
255
- font-size: 0.9rem;
256
- font-weight: 700;
257
- line-height: 1.1rem;
258
- letter-spacing: 0.5px;
259
- text-transform: uppercase;
260
- height: 1.9rem;
206
+ flex-shrink: 0;
207
+ width: 3.6rem;
208
+ height: 3.6rem;
209
+ border-radius: var(--notification-cta-border-radius, 4.8rem);
210
+ background: var(--notification-trending-cta-bg, #f4f4f4)
211
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M4.5 2.5L8 6L4.5 9.5' stroke='%236B6A72' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
212
+ no-repeat center;
213
+ pointer-events: none;
261
214
  }
215
+ }
262
216
 
263
- .extraContent {
264
- background: transparent;
265
- color: #64646d;
266
- font-size: 1.2rem;
267
- font-weight: 500;
268
- line-height: 1.8rem;
269
- }
217
+ .embeddedList {
218
+ gap: 1.2rem;
219
+ padding: 0.8rem 0 0 1.2rem;
270
220
  }