@everymatrix/general-preview-social-posts 1.44.0 → 1.45.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 (49) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/general-preview-social-posts.cjs.entry.js +271 -312
  3. package/dist/cjs/general-preview-social-posts.cjs.js +17 -11
  4. package/dist/cjs/index-3a1dd540.js +1200 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.css +4 -6
  8. package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.js +516 -563
  9. package/dist/collection/components/general-preview-social-posts/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +52 -52
  11. package/dist/collection/utils/utils.js +31 -31
  12. package/dist/esm/app-globals-0f993ce5.js +3 -0
  13. package/dist/esm/general-preview-social-posts.entry.js +271 -312
  14. package/dist/esm/general-preview-social-posts.js +14 -11
  15. package/dist/esm/index-16f33f52.js +1173 -0
  16. package/dist/esm/loader.js +7 -13
  17. package/dist/general-preview-social-posts/general-preview-social-posts.esm.js +1 -1
  18. package/dist/general-preview-social-posts/p-1f296318.js +2 -0
  19. package/dist/general-preview-social-posts/{p-6826d836.entry.js → p-2080a6e8.entry.js} +1 -1
  20. package/dist/general-preview-social-posts/p-e1255160.js +1 -0
  21. package/dist/stencil.config.dev.js +17 -0
  22. package/dist/stencil.config.js +14 -19
  23. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-preview-social-posts/.stencil/packages/stencil/general-preview-social-posts/stencil.config.d.ts +2 -0
  24. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-preview-social-posts/.stencil/packages/stencil/general-preview-social-posts/stencil.config.dev.d.ts +2 -0
  25. package/dist/types/components/general-preview-social-posts/general-preview-social-posts.d.ts +80 -80
  26. package/dist/types/components/general-preview-social-posts/index.d.ts +1 -0
  27. package/dist/types/components.d.ts +20 -3
  28. package/dist/types/stencil-public-runtime.d.ts +142 -33
  29. package/loader/cdn.js +1 -3
  30. package/loader/index.cjs.js +1 -3
  31. package/loader/index.d.ts +13 -1
  32. package/loader/index.es2017.js +1 -3
  33. package/loader/index.js +1 -3
  34. package/loader/package.json +1 -0
  35. package/package.json +8 -1
  36. package/dist/cjs/index-e178764e.js +0 -1223
  37. package/dist/components/general-preview-social-posts.d.ts +0 -11
  38. package/dist/components/general-preview-social-posts.js +0 -392
  39. package/dist/components/index.d.ts +0 -26
  40. package/dist/components/index.js +0 -1
  41. package/dist/esm/index-8a671ab9.js +0 -1197
  42. package/dist/esm/polyfills/core-js.js +0 -11
  43. package/dist/esm/polyfills/css-shim.js +0 -1
  44. package/dist/esm/polyfills/dom.js +0 -79
  45. package/dist/esm/polyfills/es5-html-element.js +0 -1
  46. package/dist/esm/polyfills/index.js +0 -34
  47. package/dist/esm/polyfills/system.js +0 -6
  48. package/dist/general-preview-social-posts/p-c682801c.js +0 -1
  49. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-preview-social-posts/.stencil/packages/general-preview-social-posts/stencil.config.d.ts +0 -2
@@ -1,64 +1,64 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-8a671ab9.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-16f33f52.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
4
  let TRANSLATIONS = {
5
- en: {
6
- loading: 'loading...',
7
- viewAll: 'View All ...',
8
- moreInfo: 'MORE INFO',
9
- playNow: 'PLAY NOW',
10
- },
11
- de: {
12
- loading: 'loading...',
13
- viewAll: 'View All ...',
14
- moreInfo: 'MORE INFO',
15
- playNow: 'PLAY NOW',
16
- },
17
- ro: {
18
- loading: 'loading...',
19
- viewAll: 'View All ...',
20
- moreInfo: 'MORE INFO',
21
- playNow: 'PLAY NOW',
22
- },
23
- fr: {
24
- loading: 'loading...',
25
- viewAll: 'View All ...',
26
- moreInfo: 'MORE INFO',
27
- playNow: 'PLAY NOW',
28
- },
29
- ar: {
30
- loading: 'loading...',
31
- viewAll: 'View All ...',
32
- moreInfo: 'MORE INFO',
33
- playNow: 'PLAY NOW',
34
- },
35
- hr: {
36
- loading: 'Učitavanje…',
37
- viewAll: 'Pogledaj sve …',
38
- moreInfo: 'VIŠE INFORMACIJA',
39
- playNow: 'IGRAJ SADA'
40
- }
5
+ en: {
6
+ loading: 'loading...',
7
+ viewAll: 'View All ...',
8
+ moreInfo: 'MORE INFO',
9
+ playNow: 'PLAY NOW',
10
+ },
11
+ de: {
12
+ loading: 'loading...',
13
+ viewAll: 'View All ...',
14
+ moreInfo: 'MORE INFO',
15
+ playNow: 'PLAY NOW',
16
+ },
17
+ ro: {
18
+ loading: 'loading...',
19
+ viewAll: 'View All ...',
20
+ moreInfo: 'MORE INFO',
21
+ playNow: 'PLAY NOW',
22
+ },
23
+ fr: {
24
+ loading: 'loading...',
25
+ viewAll: 'View All ...',
26
+ moreInfo: 'MORE INFO',
27
+ playNow: 'PLAY NOW',
28
+ },
29
+ ar: {
30
+ loading: 'loading...',
31
+ viewAll: 'View All ...',
32
+ moreInfo: 'MORE INFO',
33
+ playNow: 'PLAY NOW',
34
+ },
35
+ hr: {
36
+ loading: 'Učitavanje…',
37
+ viewAll: 'Pogledaj sve …',
38
+ moreInfo: 'VIŠE INFORMACIJA',
39
+ playNow: 'IGRAJ SADA'
40
+ }
41
41
  };
42
42
  const getTranslations = (url) => {
43
- return new Promise((resolve) => {
44
- fetch(url)
45
- .then((res) => res.json())
46
- .then((data) => {
47
- Object.keys(data).forEach((lang) => {
48
- if (!TRANSLATIONS[lang]) {
49
- TRANSLATIONS[lang] = {};
50
- }
51
- for (let key in data[lang]) {
52
- TRANSLATIONS[lang][key] = data[lang][key];
53
- }
54
- });
55
- resolve(true);
43
+ return new Promise((resolve) => {
44
+ fetch(url)
45
+ .then((res) => res.json())
46
+ .then((data) => {
47
+ Object.keys(data).forEach((lang) => {
48
+ if (!TRANSLATIONS[lang]) {
49
+ TRANSLATIONS[lang] = {};
50
+ }
51
+ for (let key in data[lang]) {
52
+ TRANSLATIONS[lang][key] = data[lang][key];
53
+ }
54
+ });
55
+ resolve(true);
56
+ });
56
57
  });
57
- });
58
58
  };
59
59
  const translate = (key, customLang) => {
60
- const lang = customLang;
61
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
60
+ const lang = customLang;
61
+ return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
62
62
  };
63
63
 
64
64
  /**
@@ -68,286 +68,245 @@ const translate = (key, customLang) => {
68
68
  * @returns {Boolean} true or false
69
69
  */
70
70
  const getDevice = () => {
71
- let userAgent = window.navigator.userAgent;
72
- if (userAgent.toLowerCase().match(/android/i)) {
73
- return 'Android';
74
- }
75
- if (userAgent.toLocaleLowerCase().match(/customnative:ios/)) {
76
- return 'nativeIOS';
77
- }
78
- if (userAgent.toLowerCase().match(/iphone/i)) {
79
- return 'iPhone';
80
- }
81
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
82
- return 'iPad';
83
- }
84
- return 'PC';
85
- };
86
- const getDevicePlatform = () => {
87
- const device = getDevice();
88
- if (device) {
89
- if (device === 'PC') {
90
- return 'dk';
71
+ let userAgent = window.navigator.userAgent;
72
+ if (userAgent.toLowerCase().match(/android/i)) {
73
+ return 'Android';
91
74
  }
92
- else if (device == 'nativeIOS') {
93
- return 'ios';
75
+ if (userAgent.toLocaleLowerCase().match(/customnative:ios/)) {
76
+ return 'nativeIOS';
94
77
  }
95
- else if (device === 'iPad' || device === 'iPhone') {
96
- return 'mtWeb';
78
+ if (userAgent.toLowerCase().match(/iphone/i)) {
79
+ return 'iPhone';
97
80
  }
98
- else {
99
- return 'mtWeb';
81
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
82
+ return 'iPad';
83
+ }
84
+ return 'PC';
85
+ };
86
+ const getDevicePlatform = () => {
87
+ const device = getDevice();
88
+ if (device) {
89
+ if (device === 'PC') {
90
+ return 'dk';
91
+ }
92
+ else if (device == 'nativeIOS') {
93
+ return 'ios';
94
+ }
95
+ else if (device === 'iPad' || device === 'iPhone') {
96
+ return 'mtWeb';
97
+ }
98
+ else {
99
+ return 'mtWeb';
100
+ }
100
101
  }
101
- }
102
102
  };
103
103
 
104
- const generalPreviewSocialPostsCss = ":host {\n font-family: \"Roboto\", sans-serif;\n display: block;\n}\n\n.ModalContainer {\n container-type: inline-size;\n}\n\n.sliderWidget {\n display: block;\n max-width: 780px;\n margin: 0 auto;\n padding: 16px;\n max-height: 500px;\n}\n.sliderWidget h2 {\n font-size: 20px;\n}\n.sliderWidget .headerHontainer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.sliderWidget .headerHontainer .viewAllButton {\n cursor: pointer;\n font-weight: bold;\n color: #8e8e8e;\n}\n.sliderWidget .postSlider {\n display: flex;\n overflow-x: auto;\n scroll-snap-type: x mandatory;\n gap: 24px;\n}\n.sliderWidget .postSlider .postCard {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n scroll-snap-align: start;\n padding: 20px;\n border-radius: 6px;\n min-width: 360px;\n background-color: #f4f4f4;\n}\n.sliderWidget .postSlider .postCard .Description {\n display: -webkit-box;\n -webkit-line-clamp: 5;\n -webkit-box-orient: vertical;\n overflow: hidden;\n margin-bottom: 14px;\n}\n.sliderWidget .postSlider .postCard .imageTitle {\n display: flex;\n justify-content: flex-start;\n gap: 20px;\n}\n.sliderWidget .postSlider .postCard .imageTitle img {\n height: 120px;\n width: 120px;\n border-radius: 6px;\n}\n.sliderWidget .postSlider .postCard .imageTitle .titleSubtitle {\n display: flex;\n flex-direction: column;\n}\n.sliderWidget .postSlider .postCard .buttons {\n display: flex;\n justify-content: center;\n gap: 12px;\n}\n.sliderWidget .postSlider .postCard .buttons .moreInfoButton, .sliderWidget .postSlider .postCard .buttons .playNowButton {\n width: 172px;\n display: block;\n padding: 8px 16px;\n border: 3px solid #63B250;\n border-radius: 6px;\n cursor: pointer;\n font-weight: bold;\n}\n.sliderWidget .postSlider .postCard .buttons .moreInfoButton {\n background-color: #f4f4f4;\n color: #63B250;\n}\n.sliderWidget .postSlider .postCard .buttons .playNowButton {\n background-color: #63B250;\n color: #fff;\n}\n\nh3, h4 {\n font-size: 18px;\n}\n\np {\n font-size: 14px;\n color: #5b5b5b;\n}\n\n@container (max-width: 480px) {\n .sliderWidget h2 {\n font-size: 18px;\n }\n .sliderWidget .postSlider .postCard {\n min-width: 250px;\n }\n\n h3, h4 {\n font-size: 16px;\n }\n\n p {\n font-size: 12px;\n }\n}";
104
+ const generalPreviewSocialPostsCss = ":host {\n font-family: \"Roboto\", sans-serif;\n display: block;\n}\n\n.ModalContainer {\n container-type: inline-size;\n}\n\n.sliderWidget {\n display: block;\n max-width: 780px;\n margin: 0 auto;\n padding: 16px;\n max-height: 500px;\n}\n.sliderWidget h2 {\n font-size: 20px;\n}\n.sliderWidget .headerHontainer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.sliderWidget .headerHontainer .viewAllButton {\n cursor: pointer;\n font-weight: bold;\n color: rgb(142, 142, 142);\n}\n.sliderWidget .postSlider {\n display: flex;\n overflow-x: auto;\n scroll-snap-type: x mandatory;\n gap: 24px;\n}\n.sliderWidget .postSlider .postCard {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n scroll-snap-align: start;\n padding: 20px;\n border-radius: 6px;\n min-width: 360px;\n background-color: rgb(244, 244, 244);\n}\n.sliderWidget .postSlider .postCard .Description {\n display: -webkit-box;\n -webkit-line-clamp: 5;\n -webkit-box-orient: vertical;\n overflow: hidden;\n margin-bottom: 14px;\n}\n.sliderWidget .postSlider .postCard .imageTitle {\n display: flex;\n justify-content: flex-start;\n gap: 20px;\n}\n.sliderWidget .postSlider .postCard .imageTitle img {\n height: 120px;\n width: 120px;\n border-radius: 6px;\n}\n.sliderWidget .postSlider .postCard .imageTitle .titleSubtitle {\n display: flex;\n flex-direction: column;\n}\n.sliderWidget .postSlider .postCard .buttons {\n display: flex;\n justify-content: center;\n gap: 12px;\n}\n.sliderWidget .postSlider .postCard .buttons .moreInfoButton, .sliderWidget .postSlider .postCard .buttons .playNowButton {\n width: 172px;\n display: block;\n padding: 8px 16px;\n border: 3px solid #63B250;\n border-radius: 6px;\n cursor: pointer;\n font-weight: bold;\n}\n.sliderWidget .postSlider .postCard .buttons .moreInfoButton {\n background-color: rgb(244, 244, 244);\n color: #63B250;\n}\n.sliderWidget .postSlider .postCard .buttons .playNowButton {\n background-color: #63B250;\n color: #fff;\n}\n\nh3, h4 {\n font-size: 18px;\n}\n\np {\n font-size: 14px;\n color: rgb(91, 91, 91);\n}\n\n@container (max-width: 480px) {\n .sliderWidget h2 {\n font-size: 18px;\n }\n .sliderWidget .postSlider .postCard {\n min-width: 250px;\n }\n h3, h4 {\n font-size: 16px;\n }\n p {\n font-size: 12px;\n }\n}";
105
+ const GeneralPreviewSocialPostsStyle0 = generalPreviewSocialPostsCss;
105
106
 
106
- const SocialSlider = class {
107
- constructor(hostRef) {
108
- registerInstance(this, hostRef);
109
- this.moreInfo = createEvent(this, "moreInfo", 7);
110
- this.playNow = createEvent(this, "playNow", 7);
111
- this.viewAll = createEvent(this, "viewAll", 7);
112
- /**
113
- * The userId
114
- */
115
- this.userId = '';
116
- /**
117
- * The session
118
- */
119
- this.session = '';
120
- /**
121
- * The Posts Title
122
- */
123
- this.postsTitle = '';
124
- /**
125
- * The max cards displayed
126
- */
127
- this.maxCards = '';
128
- /**
129
- * The language
130
- */
131
- this.language = 'en';
132
- /**
133
- * The datasource
134
- */
135
- this.datasource = '';
136
- /**
137
- * The NorWAy endpoint
138
- */
139
- this.endpoint = '';
140
- /**
141
- * The NorWAy endpoint
142
- */
143
- this.cmsEndpoint = '';
144
- /**
145
- * The userRoles
146
- */
147
- this.userRoles = '';
148
- /**
149
- * The translationurl
150
- */
151
- this.translationUrl = '';
152
- /**
153
- * Client custom styling via string
154
- */
155
- this.clientStyling = '';
156
- /**
157
- * Client custom styling via url content
158
- */
159
- this.clientStylingUrl = '';
160
- /**
161
- * CMS Endpoint stage
162
- */
163
- this.cmsEnv = 'stage';
164
- /**
165
- * The page parameter for the cms call
166
- */
167
- this.pageName = 'casino';
168
- this.posts = []; // State to store fetched posts
169
- this.stylingAppends = false;
170
- this.isLoading = false;
171
- this.isLoggedIn = false;
172
- this.dataImages = []; // State to store fetched images
173
- this.gameIds = ''; // State to store fetched images
174
- this.platform = getDevicePlatform();
175
- this.setClientStyling = () => {
176
- let sheet = document.createElement('style');
177
- sheet.innerHTML = this.clientStyling;
178
- this.stylingContainer.prepend(sheet);
179
- };
180
- this.setClientStylingURL = () => {
181
- let url = new URL(this.clientStylingUrl);
182
- let cssFile = document.createElement('style');
183
- fetch(url.href)
184
- .then((res) => res.text())
185
- .then((data) => {
186
- cssFile.innerHTML = data;
187
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
188
- })
189
- .catch((err) => {
190
- console.log('error ', err);
191
- });
192
- };
193
- }
194
- handleNewTranslations() {
195
- this.isLoading = true;
196
- getTranslations(this.translationUrl).then(() => {
197
- this.isLoading = false;
198
- });
199
- }
200
- async componentWillLoad() {
201
- if (this.translationUrl.length > 2) {
202
- await getTranslations(this.translationUrl);
107
+ const GeneralPreviewSocialPosts = class {
108
+ constructor(hostRef) {
109
+ registerInstance(this, hostRef);
110
+ this.moreInfo = createEvent(this, "moreInfo", 7);
111
+ this.playNow = createEvent(this, "playNow", 7);
112
+ this.viewAll = createEvent(this, "viewAll", 7);
113
+ this.platform = getDevicePlatform();
114
+ this.setClientStyling = () => {
115
+ let sheet = document.createElement('style');
116
+ sheet.innerHTML = this.clientStyling;
117
+ this.stylingContainer.prepend(sheet);
118
+ };
119
+ this.setClientStylingURL = () => {
120
+ let url = new URL(this.clientStylingUrl);
121
+ let cssFile = document.createElement('style');
122
+ fetch(url.href)
123
+ .then((res) => res.text())
124
+ .then((data) => {
125
+ cssFile.innerHTML = data;
126
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
127
+ })
128
+ .catch((err) => {
129
+ console.log('error ', err);
130
+ });
131
+ };
132
+ this.userId = '';
133
+ this.session = '';
134
+ this.postsTitle = '';
135
+ this.maxCards = '';
136
+ this.language = 'en';
137
+ this.datasource = '';
138
+ this.endpoint = '';
139
+ this.cmsEndpoint = '';
140
+ this.userRoles = '';
141
+ this.translationUrl = '';
142
+ this.clientStyling = '';
143
+ this.clientStylingUrl = '';
144
+ this.cmsEnv = 'stage';
145
+ this.pageName = 'casino';
146
+ this.posts = [];
147
+ this.stylingAppends = false;
148
+ this.isLoading = false;
149
+ this.isLoggedIn = false;
150
+ this.dataImages = [];
151
+ this.gameIds = '';
203
152
  }
204
- }
205
- watchSession(newValue, oldValue) {
206
- if (newValue !== oldValue) {
207
- this.isLoggedIn = newValue !== '';
153
+ handleNewTranslations() {
154
+ this.isLoading = true;
155
+ getTranslations(this.translationUrl).then(() => {
156
+ this.isLoading = false;
157
+ });
208
158
  }
209
- }
210
- connectedCallback() {
211
- if (this.session) {
212
- this.isLoggedIn = true;
159
+ async componentWillLoad() {
160
+ if (this.translationUrl.length > 2) {
161
+ await getTranslations(this.translationUrl);
162
+ }
213
163
  }
214
- }
215
- componentDidRender() {
216
- // start custom styling area
217
- if (!this.stylingAppends && this.stylingContainer) {
218
- if (this.clientStyling)
219
- this.setClientStyling();
220
- if (this.clientStylingUrl)
221
- this.setClientStylingURL();
222
- this.stylingAppends = true;
164
+ watchSession(newValue, oldValue) {
165
+ if (newValue !== oldValue) {
166
+ this.isLoggedIn = newValue !== '';
167
+ }
223
168
  }
224
- // end custom styling area
225
- }
226
- getDataImage(ids) {
227
- try {
228
- let url = new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);
229
- url.searchParams.append("language", this.language);
230
- url.searchParams.append("expand", 'games');
231
- url.searchParams.append("fields", 'games(id,thumbnail,launchUrl)');
232
- url.searchParams.append("filter", ids);
233
- url.searchParams.append('device', this.platform);
234
- const options = {
235
- 'method': 'GET',
236
- 'Content-Type': 'application/json'
237
- };
238
- fetch(url.href, options)
239
- .then((res) => {
240
- if (res.status === 200) {
241
- return res.json();
169
+ connectedCallback() {
170
+ if (this.session) {
171
+ this.isLoggedIn = true;
242
172
  }
243
- else {
244
- throw new Error("HTTP status " + res.status);
173
+ }
174
+ componentDidRender() {
175
+ // start custom styling area
176
+ if (!this.stylingAppends && this.stylingContainer) {
177
+ if (this.clientStyling)
178
+ this.setClientStyling();
179
+ if (this.clientStylingUrl)
180
+ this.setClientStylingURL();
181
+ this.stylingAppends = true;
182
+ }
183
+ // end custom styling area
184
+ }
185
+ getDataImage(ids) {
186
+ try {
187
+ let url = new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);
188
+ url.searchParams.append("language", this.language);
189
+ url.searchParams.append("expand", 'games');
190
+ url.searchParams.append("fields", 'games(id,thumbnail,launchUrl)');
191
+ url.searchParams.append("filter", ids);
192
+ url.searchParams.append('device', this.platform);
193
+ const options = {
194
+ 'method': 'GET',
195
+ 'Content-Type': 'application/json'
196
+ };
197
+ fetch(url.href, options)
198
+ .then((res) => {
199
+ if (res.status === 200) {
200
+ return res.json();
201
+ }
202
+ else {
203
+ throw new Error("HTTP status " + res.status);
204
+ }
205
+ })
206
+ .then((data) => {
207
+ data.items.forEach((item) => {
208
+ item.games.items.forEach(element => {
209
+ let { id, launchUrl, thumbnail } = element;
210
+ this.dataImages = [{ id, launchUrl, thumbnail }];
211
+ let index = this.posts.findIndex(post => post.gameId === id);
212
+ if (index !== -1) {
213
+ this.posts[index].images = this.dataImages;
214
+ }
215
+ });
216
+ });
217
+ })
218
+ .catch((err) => {
219
+ // Handle any errors
220
+ console.error(err);
221
+ });
222
+ }
223
+ catch (error) {
224
+ console.error('Error fetching verification types:', error);
245
225
  }
246
- })
247
- .then((data) => {
248
- data.items.forEach((item) => {
249
- item.games.items.forEach(element => {
250
- let { id, launchUrl, thumbnail } = element;
251
- this.dataImages = [{ id, launchUrl, thumbnail }];
252
- let index = this.posts.findIndex(post => post.gameId === id);
253
- if (index !== -1) {
254
- this.posts[index].images = this.dataImages;
255
- }
256
- });
257
- });
258
- })
259
- .catch((err) => {
260
- // Handle any errors
261
- console.error(err);
262
- });
263
226
  }
264
- catch (error) {
265
- console.error('Error fetching verification types:', error);
227
+ async componentDidLoad() {
228
+ try {
229
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);
230
+ url.searchParams.append("device", this.platform);
231
+ url.searchParams.append("page", this.pageName);
232
+ url.searchParams.append("language", this.language);
233
+ url.searchParams.append("userRoles", this.userRoles);
234
+ url.searchParams.append('env', this.cmsEnv);
235
+ const options = {
236
+ 'method': 'GET',
237
+ 'Content-Type': 'application/json'
238
+ };
239
+ fetch(url.href, options)
240
+ .then((res) => {
241
+ if (res.status === 200) {
242
+ return res.json();
243
+ }
244
+ else {
245
+ throw new Error("HTTP status " + res.status);
246
+ }
247
+ })
248
+ .then((data) => {
249
+ data.forEach(element => {
250
+ var _a;
251
+ const slug = element.slug;
252
+ const postId = element.id;
253
+ const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
254
+ if (gameId) {
255
+ this.gameIds += `games(id=${gameId}),`;
256
+ }
257
+ this.posts.push({ postId, gameId, title, description, subtitle, slug });
258
+ });
259
+ if (this.gameIds.length > 0) {
260
+ this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
261
+ this.gameIds = '$or(' + this.gameIds + ')';
262
+ }
263
+ this.getDataImage(this.gameIds);
264
+ })
265
+ .catch((err) => {
266
+ // Handle any errors
267
+ console.error(err);
268
+ });
269
+ }
270
+ catch (error) {
271
+ console.error('Error fetching verification types:', error);
272
+ }
266
273
  }
267
- }
268
- async componentDidLoad() {
269
- try {
270
- let url = new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);
271
- url.searchParams.append("device", this.platform);
272
- url.searchParams.append("page", this.pageName);
273
- url.searchParams.append("language", this.language);
274
- url.searchParams.append("userRoles", this.userRoles);
275
- url.searchParams.append('env', this.cmsEnv);
276
- const options = {
277
- 'method': 'GET',
278
- 'Content-Type': 'application/json'
279
- };
280
- fetch(url.href, options)
281
- .then((res) => {
282
- if (res.status === 200) {
283
- return res.json();
274
+ hasUndefinedValues(obj) {
275
+ return Object.values(obj).some((value) => value === undefined);
276
+ }
277
+ render() {
278
+ if (this.isLoading) {
279
+ return (h("div", null, h("p", null, translate('loading', this.language))));
284
280
  }
285
281
  else {
286
- throw new Error("HTTP status " + res.status);
287
- }
288
- })
289
- .then((data) => {
290
- data.forEach(element => {
291
- var _a;
292
- const slug = element.slug;
293
- const postId = element.id;
294
- const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
295
- if (gameId) {
296
- this.gameIds += `games(id=${gameId}),`;
297
- }
298
- this.posts.push({ postId, gameId, title, description, subtitle, slug });
299
- });
300
- if (this.gameIds.length > 0) {
301
- this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
302
- this.gameIds = '$or(' + this.gameIds + ')';
282
+ return (h("div", { class: "ModalContainer", ref: el => this.stylingContainer = el }, h("div", { class: "sliderWidget" }, h("div", { class: "headerHontainer" }, this.postsTitle && h("h2", null, this.postsTitle), h("div", { class: "viewAllButton", onClick: () => this.onViewAllClick() }, translate('viewAll', this.language))), h("div", { class: "postSlider" }, this.posts
283
+ .filter((post) => !this.hasUndefinedValues(post)) // Filter out posts with undefined values
284
+ .slice(0, +(this.maxCards || this.posts.length))
285
+ .map((post) => {
286
+ var _a, _b, _c, _d;
287
+ return (h("div", { class: "postCard" }, h("div", { class: "imageTitle" }, (post === null || post === void 0 ? void 0 : post.images) ? (h("a", { href: ((_b = (_a = post.images) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.launchUrl) || '', target: "_blank", rel: "noopener noreferrer" }, h("img", { src: ((_d = (_c = post.images) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.thumbnail) || '', alt: "Game Image" })))
288
+ : null, h("div", { class: "titleSubtitle" }, post.title && h("h3", null, post.title), post.subtitle && h("p", { innerHTML: post.subtitle }))), post.description &&
289
+ h("div", { class: "Description" }, h("p", { innerHTML: post.description })), h("div", { class: "buttons" }, h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, post.postId, post.title, post.slug) }, translate('moreInfo', this.language)), this.isLoggedIn && post.gameId && h("button", { class: "playNowButton", onClick: () => this.onPlayNowClick(post.gameId) }, translate('playNow', this.language)))));
290
+ })))));
303
291
  }
304
- this.getDataImage(this.gameIds);
305
- })
306
- .catch((err) => {
307
- // Handle any errors
308
- console.error(err);
309
- });
310
292
  }
311
- catch (error) {
312
- console.error('Error fetching verification types:', error);
293
+ onViewAllClick() {
294
+ this.viewAll.emit();
295
+ window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
313
296
  }
314
- }
315
- hasUndefinedValues(obj) {
316
- return Object.values(obj).some((value) => value === undefined);
317
- }
318
- render() {
319
- if (this.isLoading) {
320
- return (h("div", null, h("p", null, translate('loading', this.language))));
297
+ onMoreInfoClick(gameId, postId, postTitle, slug) {
298
+ this.moreInfo.emit();
299
+ window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
321
300
  }
322
- else {
323
- return (h("div", { class: "ModalContainer", ref: el => this.stylingContainer = el }, h("div", { class: "sliderWidget" }, h("div", { class: "headerHontainer" }, this.postsTitle && h("h2", null, this.postsTitle), h("div", { class: "viewAllButton", onClick: () => this.onViewAllClick() }, translate('viewAll', this.language))), h("div", { class: "postSlider" }, this.posts
324
- .filter((post) => !this.hasUndefinedValues(post)) // Filter out posts with undefined values
325
- .slice(0, +(this.maxCards || this.posts.length))
326
- .map((post) => {
327
- var _a, _b, _c, _d;
328
- return (h("div", { class: "postCard" }, h("div", { class: "imageTitle" }, (post === null || post === void 0 ? void 0 : post.images) ? (h("a", { href: ((_b = (_a = post.images) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.launchUrl) || '', target: "_blank", rel: "noopener noreferrer" }, h("img", { src: ((_d = (_c = post.images) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.thumbnail) || '', alt: "Game Image" })))
329
- : null, h("div", { class: "titleSubtitle" }, post.title && h("h3", null, post.title), post.subtitle && h("p", { innerHTML: post.subtitle }))), post.description &&
330
- h("div", { class: "Description" }, h("p", { innerHTML: post.description })), h("div", { class: "buttons" }, h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, post.postId, post.title, post.slug) }, translate('moreInfo', this.language)), this.isLoggedIn && post.gameId && h("button", { class: "playNowButton", onClick: () => this.onPlayNowClick(post.gameId) }, translate('playNow', this.language)))));
331
- })))));
301
+ onPlayNowClick(gameId) {
302
+ this.playNow.emit(gameId);
303
+ window.postMessage({ type: 'playNowSocialPost', gameId: gameId }, window.location.href);
332
304
  }
333
- }
334
- onViewAllClick() {
335
- this.viewAll.emit();
336
- window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
337
- }
338
- onMoreInfoClick(gameId, postId, postTitle, slug) {
339
- this.moreInfo.emit();
340
- window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
341
- }
342
- onPlayNowClick(gameId) {
343
- this.playNow.emit(gameId);
344
- window.postMessage({ type: 'playNowSocialPost', gameId: gameId }, window.location.href);
345
- }
346
- static get watchers() { return {
347
- "translationUrl": ["handleNewTranslations"],
348
- "session": ["watchSession"]
349
- }; }
305
+ static get watchers() { return {
306
+ "translationUrl": ["handleNewTranslations"],
307
+ "session": ["watchSession"]
308
+ }; }
350
309
  };
351
- SocialSlider.style = generalPreviewSocialPostsCss;
310
+ GeneralPreviewSocialPosts.style = GeneralPreviewSocialPostsStyle0;
352
311
 
353
- export { SocialSlider as general_preview_social_posts };
312
+ export { GeneralPreviewSocialPosts as general_preview_social_posts };