@everymatrix/general-preview-social-posts 1.44.0 → 1.45.2

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