@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-preview-social-posts",
3
- "version": "1.31.2",
3
+ "version": "1.32.4",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -15,5 +15,6 @@
15
15
  ],
16
16
  "publishConfig": {
17
17
  "access": "public"
18
- }
18
+ },
19
+ "gitHead": "69a4e0bb1b0460c07baef352d283492a6e2dc4b0"
19
20
  }
@@ -1,363 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e178764e.js');
6
-
7
- const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['de', 'en', 'hr'];
9
- let TRANSLATIONS = {
10
- en: {
11
- loading: 'loading...',
12
- viewAll: 'View All ...',
13
- moreInfo: 'MORE INFO',
14
- playNow: 'PLAY NOW',
15
- },
16
- de: {
17
- loading: 'loading...',
18
- viewAll: 'View All ...',
19
- moreInfo: 'MORE INFO',
20
- playNow: 'PLAY NOW',
21
- },
22
- ro: {
23
- loading: 'loading...',
24
- viewAll: 'View All ...',
25
- moreInfo: 'MORE INFO',
26
- playNow: 'PLAY NOW',
27
- },
28
- fr: {
29
- loading: 'loading...',
30
- viewAll: 'View All ...',
31
- moreInfo: 'MORE INFO',
32
- playNow: 'PLAY NOW',
33
- },
34
- ar: {
35
- loading: 'loading...',
36
- viewAll: 'View All ...',
37
- moreInfo: 'MORE INFO',
38
- playNow: 'PLAY NOW',
39
- },
40
- hr: {
41
- loading: 'Učitavanje…',
42
- viewAll: 'Pogledaj sve …',
43
- moreInfo: 'VIŠE INFORMACIJA',
44
- playNow: 'IGRAJ SADA'
45
- }
46
- };
47
- const getTranslations = (url) => {
48
- // fetch url, get the data, replace the TRANSLATIONS content
49
- return new Promise((resolve) => {
50
- fetch(url)
51
- .then((res) => res.json())
52
- .then((data) => {
53
- Object.keys(data).forEach((item) => {
54
- for (let key in data[item]) {
55
- TRANSLATIONS[item][key] = data[item][key];
56
- }
57
- });
58
- resolve(true);
59
- });
60
- });
61
- };
62
- const translate = (key, customLang, values) => {
63
- const lang = customLang;
64
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
65
- if (values !== undefined) {
66
- for (const [key, value] of Object.entries(values.values)) {
67
- const regex = new RegExp(`{${key}}`, 'g');
68
- translation = translation.replace(regex, value);
69
- }
70
- }
71
- return translation;
72
- };
73
-
74
- /**
75
- * @name isMobile
76
- * @description A method that returns if the browser used to access the app is from a mobile device or not
77
- * @param {String} userAgent window.navigator.userAgent
78
- * @returns {Boolean} true or false
79
- */
80
- const getDevice = () => {
81
- let userAgent = window.navigator.userAgent;
82
- if (userAgent.toLowerCase().match(/android/i)) {
83
- return 'Android';
84
- }
85
- if (userAgent.toLocaleLowerCase().match(/customnative:ios/)) {
86
- return 'nativeIOS';
87
- }
88
- if (userAgent.toLowerCase().match(/iphone/i)) {
89
- return 'iPhone';
90
- }
91
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
92
- return 'iPad';
93
- }
94
- return 'PC';
95
- };
96
- const getDevicePlatform = () => {
97
- const device = getDevice();
98
- if (device) {
99
- if (device === 'PC') {
100
- return 'dk';
101
- }
102
- else if (device == 'nativeIOS') {
103
- return 'ios';
104
- }
105
- else if (device === 'iPad' || device === 'iPhone') {
106
- return 'mtWeb';
107
- }
108
- else {
109
- return 'mtWeb';
110
- }
111
- }
112
- };
113
-
114
- 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}";
115
-
116
- const SocialSlider = class {
117
- constructor(hostRef) {
118
- index.registerInstance(this, hostRef);
119
- this.moreInfo = index.createEvent(this, "moreInfo", 7);
120
- this.playNow = index.createEvent(this, "playNow", 7);
121
- this.viewAll = index.createEvent(this, "viewAll", 7);
122
- /**
123
- * The userId
124
- */
125
- this.userId = '';
126
- /**
127
- * The session
128
- */
129
- this.session = '';
130
- /**
131
- * The Posts Title
132
- */
133
- this.postsTitle = '';
134
- /**
135
- * The max cards displayed
136
- */
137
- this.maxCards = '';
138
- /**
139
- * The language
140
- */
141
- this.language = 'en';
142
- /**
143
- * The datasource
144
- */
145
- this.datasource = '';
146
- /**
147
- * The NorWAy endpoint
148
- */
149
- this.endpoint = '';
150
- /**
151
- * The NorWAy endpoint
152
- */
153
- this.cmsEndpoint = '';
154
- /**
155
- * The userRoles
156
- */
157
- this.userRoles = '';
158
- /**
159
- * The translationurl
160
- */
161
- this.translationUrl = '';
162
- /**
163
- * Client custom styling via string
164
- */
165
- this.clientStyling = '';
166
- /**
167
- * Client custom styling via url content
168
- */
169
- this.clientStylingUrl = '';
170
- /**
171
- * CMS Endpoint stage
172
- */
173
- this.cmsEnv = 'stage';
174
- /**
175
- * The page parameter for the cms call
176
- */
177
- this.pageName = 'casino';
178
- this.posts = []; // State to store fetched posts
179
- this.stylingAppends = false;
180
- this.isLoading = false;
181
- this.isLoggedIn = false;
182
- this.dataImages = []; // State to store fetched images
183
- this.gameIds = ''; // State to store fetched images
184
- this.platform = getDevicePlatform();
185
- this.setClientStyling = () => {
186
- let sheet = document.createElement('style');
187
- sheet.innerHTML = this.clientStyling;
188
- this.stylingContainer.prepend(sheet);
189
- };
190
- this.setClientStylingURL = () => {
191
- let url = new URL(this.clientStylingUrl);
192
- let cssFile = document.createElement('style');
193
- fetch(url.href)
194
- .then((res) => res.text())
195
- .then((data) => {
196
- cssFile.innerHTML = data;
197
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
198
- })
199
- .catch((err) => {
200
- console.log('error ', err);
201
- });
202
- };
203
- }
204
- handleNewTranslations() {
205
- this.isLoading = true;
206
- getTranslations(this.translationUrl).then(() => {
207
- this.isLoading = false;
208
- });
209
- }
210
- async componentWillLoad() {
211
- if (this.translationUrl.length > 2) {
212
- await getTranslations(this.translationUrl);
213
- }
214
- }
215
- watchSession(newValue, oldValue) {
216
- if (newValue !== oldValue) {
217
- this.isLoggedIn = newValue !== '';
218
- }
219
- }
220
- connectedCallback() {
221
- if (this.session) {
222
- this.isLoggedIn = true;
223
- }
224
- }
225
- componentDidRender() {
226
- // start custom styling area
227
- if (!this.stylingAppends && this.stylingContainer) {
228
- if (this.clientStyling)
229
- this.setClientStyling();
230
- if (this.clientStylingUrl)
231
- this.setClientStylingURL();
232
- this.stylingAppends = true;
233
- }
234
- // end custom styling area
235
- }
236
- getDataImage(ids) {
237
- try {
238
- let url = new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);
239
- url.searchParams.append("language", this.language);
240
- url.searchParams.append("expand", 'games');
241
- url.searchParams.append("fields", 'games(id,thumbnail,launchUrl)');
242
- url.searchParams.append("filter", ids);
243
- url.searchParams.append('device', this.platform);
244
- const options = {
245
- 'method': 'GET',
246
- 'Content-Type': 'application/json'
247
- };
248
- fetch(url.href, options)
249
- .then((res) => {
250
- if (res.status === 200) {
251
- return res.json();
252
- }
253
- else {
254
- throw new Error("HTTP status " + res.status);
255
- }
256
- })
257
- .then((data) => {
258
- data.items.forEach((item) => {
259
- item.games.items.forEach(element => {
260
- let { id, launchUrl, thumbnail } = element;
261
- this.dataImages = [{ id, launchUrl, thumbnail }];
262
- let index = this.posts.findIndex(post => post.gameId === id);
263
- if (index !== -1) {
264
- this.posts[index].images = this.dataImages;
265
- }
266
- });
267
- });
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
- }
277
- }
278
- async componentDidLoad() {
279
- try {
280
- let url = new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);
281
- url.searchParams.append("device", this.platform);
282
- url.searchParams.append("page", this.pageName);
283
- url.searchParams.append("language", this.language);
284
- url.searchParams.append("userRoles", this.userRoles);
285
- url.searchParams.append('env', this.cmsEnv);
286
- const options = {
287
- 'method': 'GET',
288
- 'Content-Type': 'application/json'
289
- };
290
- fetch(url.href, options)
291
- .then((res) => {
292
- if (res.status === 200) {
293
- return res.json();
294
- }
295
- else {
296
- throw new Error("HTTP status " + res.status);
297
- }
298
- })
299
- .then((data) => {
300
- data.forEach(element => {
301
- var _a;
302
- const slug = element.slug;
303
- const postId = element.id;
304
- const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
305
- if (gameId) {
306
- this.gameIds += `games(id=${gameId}),`;
307
- }
308
- this.posts.push({ postId, gameId, title, description, subtitle, slug });
309
- });
310
- if (this.gameIds.length > 0) {
311
- this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
312
- this.gameIds = '$or(' + this.gameIds + ')';
313
- }
314
- this.getDataImage(this.gameIds);
315
- })
316
- .catch((err) => {
317
- // Handle any errors
318
- console.error(err);
319
- });
320
- }
321
- catch (error) {
322
- console.error('Error fetching verification types:', error);
323
- }
324
- }
325
- hasUndefinedValues(obj) {
326
- return Object.values(obj).some((value) => value === undefined);
327
- }
328
- render() {
329
- if (this.isLoading) {
330
- return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
331
- }
332
- else {
333
- 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
334
- .filter((post) => !this.hasUndefinedValues(post)) // Filter out posts with undefined values
335
- .slice(0, +(this.maxCards || this.posts.length))
336
- .map((post) => {
337
- var _a, _b, _c, _d;
338
- 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" })))
339
- : null, index.h("div", { class: "titleSubtitle" }, post.title && index.h("h3", null, post.title), post.subtitle && index.h("p", { innerHTML: post.subtitle }))), post.description &&
340
- 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)))));
341
- })))));
342
- }
343
- }
344
- onViewAllClick() {
345
- this.viewAll.emit();
346
- window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
347
- }
348
- onMoreInfoClick(gameId, postId, postTitle, slug) {
349
- this.moreInfo.emit();
350
- window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
351
- }
352
- onPlayNowClick(gameId) {
353
- this.playNow.emit(gameId);
354
- window.postMessage({ type: 'playNowSocialPost', gameId: gameId }, window.location.href);
355
- }
356
- static get watchers() { return {
357
- "translationUrl": ["handleNewTranslations"],
358
- "session": ["watchSession"]
359
- }; }
360
- };
361
- SocialSlider.style = generalPreviewSocialPostsCss;
362
-
363
- exports.general_preview_social_posts = SocialSlider;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-e178764e.js');
4
-
5
- /*
6
- Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
- */
8
- const patchBrowser = () => {
9
- const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-preview-social-posts.cjs.js', document.baseURI).href));
10
- const opts = {};
11
- if (importMeta !== '') {
12
- opts.resourcesUrl = new URL('.', importMeta).href;
13
- }
14
- return index.promiseResolve(opts);
15
- };
16
-
17
- patchBrowser().then(options => {
18
- return index.bootstrapLazy([["general-preview-social-posts.cjs",[[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);
19
- });