@everymatrix/general-preview-social-posts 1.31.2 → 1.32.4

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