@everymatrix/general-preview-social-posts 1.16.1

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 (47) hide show
  1. package/dist/cjs/general-preview-social-posts.cjs.entry.js +349 -0
  2. package/dist/cjs/general-preview-social-posts.cjs.js +19 -0
  3. package/dist/cjs/index-e178764e.js +1223 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.css +114 -0
  8. package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.js +578 -0
  9. package/dist/collection/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +60 -0
  11. package/dist/collection/utils/utils.js +39 -0
  12. package/dist/components/general-preview-social-posts.d.ts +11 -0
  13. package/dist/components/general-preview-social-posts.js +384 -0
  14. package/dist/components/index.d.ts +26 -0
  15. package/dist/components/index.js +1 -0
  16. package/dist/esm/general-preview-social-posts.entry.js +345 -0
  17. package/dist/esm/general-preview-social-posts.js +17 -0
  18. package/dist/esm/index-8a671ab9.js +1197 -0
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/loader.js +17 -0
  21. package/dist/esm/polyfills/core-js.js +11 -0
  22. package/dist/esm/polyfills/css-shim.js +1 -0
  23. package/dist/esm/polyfills/dom.js +79 -0
  24. package/dist/esm/polyfills/es5-html-element.js +1 -0
  25. package/dist/esm/polyfills/index.js +34 -0
  26. package/dist/esm/polyfills/system.js +6 -0
  27. package/dist/general-preview-social-posts/general-preview-social-posts.esm.js +1 -0
  28. package/dist/general-preview-social-posts/index.esm.js +0 -0
  29. package/dist/general-preview-social-posts/p-b79fd2fe.entry.js +1 -0
  30. package/dist/general-preview-social-posts/p-c682801c.js +1 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. 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 +2 -0
  35. package/dist/types/components/general-preview-social-posts/general-preview-social-posts.d.ts +84 -0
  36. package/dist/types/components.d.ts +152 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +2 -0
  40. package/dist/types/utils/utils.d.ts +9 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +19 -0
@@ -0,0 +1,578 @@
1
+ import { Component, h, Prop, State, Event, Watch } from '@stencil/core';
2
+ import { getTranslations, translate } from '../../utils/locale.utils';
3
+ import { getDevicePlatform } from '../../utils/utils';
4
+ export class SocialSlider {
5
+ constructor() {
6
+ /**
7
+ * The userId
8
+ */
9
+ this.userId = '';
10
+ /**
11
+ * The session
12
+ */
13
+ this.session = '';
14
+ /**
15
+ * The Posts Title
16
+ */
17
+ this.postsTitle = '';
18
+ /**
19
+ * The max cards displayed
20
+ */
21
+ this.maxCards = '';
22
+ /**
23
+ * The language
24
+ */
25
+ this.language = 'en';
26
+ /**
27
+ * The datasource
28
+ */
29
+ this.datasource = '';
30
+ /**
31
+ * The NorWAy endpoint
32
+ */
33
+ this.endpoint = '';
34
+ /**
35
+ * The NorWAy endpoint
36
+ */
37
+ this.cmsEndpoint = '';
38
+ /**
39
+ * The userRoles
40
+ */
41
+ this.userRoles = '';
42
+ /**
43
+ * The translationurl
44
+ */
45
+ this.translationUrl = '';
46
+ /**
47
+ * Client custom styling via string
48
+ */
49
+ this.clientStyling = '';
50
+ /**
51
+ * Client custom styling via url content
52
+ */
53
+ this.clientStylingUrl = '';
54
+ /**
55
+ * CMS Endpoint stage
56
+ */
57
+ this.cmsEnv = 'stage';
58
+ /**
59
+ * The page parameter for the cms call
60
+ */
61
+ this.pageName = 'casino';
62
+ this.posts = []; // State to store fetched posts
63
+ this.stylingAppends = false;
64
+ this.isLoading = false;
65
+ this.isLoggedIn = false;
66
+ this.dataImages = []; // State to store fetched images
67
+ this.gameIds = ''; // State to store fetched images
68
+ this.platform = getDevicePlatform();
69
+ this.setClientStyling = () => {
70
+ let sheet = document.createElement('style');
71
+ sheet.innerHTML = this.clientStyling;
72
+ this.stylingContainer.prepend(sheet);
73
+ };
74
+ this.setClientStylingURL = () => {
75
+ let url = new URL(this.clientStylingUrl);
76
+ let cssFile = document.createElement('style');
77
+ fetch(url.href)
78
+ .then((res) => res.text())
79
+ .then((data) => {
80
+ cssFile.innerHTML = data;
81
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
82
+ })
83
+ .catch((err) => {
84
+ console.log('error ', err);
85
+ });
86
+ };
87
+ }
88
+ handleNewTranslations() {
89
+ this.isLoading = true;
90
+ getTranslations(this.translationUrl).then(() => {
91
+ this.isLoading = false;
92
+ });
93
+ }
94
+ async componentWillLoad() {
95
+ if (this.translationUrl.length > 2) {
96
+ await getTranslations(this.translationUrl);
97
+ }
98
+ }
99
+ watchSession(newValue, oldValue) {
100
+ if (newValue !== oldValue) {
101
+ this.isLoggedIn = newValue !== '';
102
+ }
103
+ }
104
+ connectedCallback() {
105
+ if (this.session) {
106
+ this.isLoggedIn = true;
107
+ }
108
+ }
109
+ componentDidRender() {
110
+ // start custom styling area
111
+ if (!this.stylingAppends && this.stylingContainer) {
112
+ if (this.clientStyling)
113
+ this.setClientStyling();
114
+ if (this.clientStylingUrl)
115
+ this.setClientStylingURL();
116
+ this.stylingAppends = true;
117
+ }
118
+ // end custom styling area
119
+ }
120
+ getDataImage(ids) {
121
+ try {
122
+ let url = new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);
123
+ url.searchParams.append("language", this.language);
124
+ url.searchParams.append("expand", 'games');
125
+ url.searchParams.append("fields", 'games(id,thumbnail,launchUrl)');
126
+ url.searchParams.append("filter", ids);
127
+ url.searchParams.append('device', this.platform);
128
+ const options = {
129
+ 'method': 'GET',
130
+ 'Content-Type': 'application/json'
131
+ };
132
+ fetch(url.href, options)
133
+ .then((res) => {
134
+ if (res.status === 200) {
135
+ return res.json();
136
+ }
137
+ else {
138
+ throw new Error("HTTP status " + res.status);
139
+ }
140
+ })
141
+ .then((data) => {
142
+ data.items.forEach((item) => {
143
+ item.games.items.forEach(element => {
144
+ let { id, launchUrl, thumbnail } = element;
145
+ this.dataImages = [{ id, launchUrl, thumbnail }];
146
+ let index = this.posts.findIndex(post => post.gameId === id);
147
+ if (index !== -1) {
148
+ this.posts[index].images = this.dataImages;
149
+ }
150
+ });
151
+ });
152
+ })
153
+ .catch((err) => {
154
+ // Handle any errors
155
+ console.error(err);
156
+ });
157
+ }
158
+ catch (error) {
159
+ console.error('Error fetching verification types:', error);
160
+ }
161
+ }
162
+ async componentDidLoad() {
163
+ try {
164
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);
165
+ url.searchParams.append("device", this.platform);
166
+ url.searchParams.append("page", this.pageName);
167
+ url.searchParams.append("language", this.language);
168
+ url.searchParams.append("userRoles", this.userRoles);
169
+ url.searchParams.append('env', this.cmsEnv);
170
+ const options = {
171
+ 'method': 'GET',
172
+ 'Content-Type': 'application/json'
173
+ };
174
+ fetch(url.href, options)
175
+ .then((res) => {
176
+ if (res.status === 200) {
177
+ return res.json();
178
+ }
179
+ else {
180
+ throw new Error("HTTP status " + res.status);
181
+ }
182
+ })
183
+ .then((data) => {
184
+ data.forEach(element => {
185
+ var _a;
186
+ const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
187
+ if (gameId) {
188
+ this.gameIds += `games(id=${gameId}),`;
189
+ }
190
+ this.posts.push({ gameId, title, description, subtitle });
191
+ });
192
+ if (this.gameIds.length > 0) {
193
+ this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
194
+ this.gameIds = '$or(' + this.gameIds + ')';
195
+ }
196
+ this.getDataImage(this.gameIds);
197
+ })
198
+ .catch((err) => {
199
+ // Handle any errors
200
+ console.error(err);
201
+ });
202
+ }
203
+ catch (error) {
204
+ console.error('Error fetching verification types:', error);
205
+ }
206
+ }
207
+ hasUndefinedValues(obj) {
208
+ return Object.values(obj).some((value) => value === undefined);
209
+ }
210
+ render() {
211
+ if (this.isLoading) {
212
+ return (h("div", null,
213
+ h("p", null, translate('loading', this.language))));
214
+ }
215
+ else {
216
+ return (h("div", { class: "ModalContainer", ref: el => this.stylingContainer = el },
217
+ h("div", { class: "sliderWidget" },
218
+ h("div", { class: "headerHontainer" },
219
+ this.postsTitle && h("h2", null, this.postsTitle),
220
+ h("div", { class: "viewAllButton", onClick: () => this.onViewAllClick() }, translate('viewAll', this.language))),
221
+ h("div", { class: "postSlider" }, this.posts
222
+ .filter((post) => !this.hasUndefinedValues(post)) // Filter out posts with undefined values
223
+ .slice(0, +(this.maxCards || this.posts.length))
224
+ .map((post) => {
225
+ var _a, _b, _c, _d;
226
+ return (h("div", { class: "postCard" },
227
+ h("div", { class: "imageTitle" },
228
+ (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" },
229
+ 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" })))
230
+ : null,
231
+ h("div", { class: "titleSubtitle" },
232
+ post.title && h("h3", null, post.title),
233
+ post.subtitle && h("p", { innerHTML: post.subtitle }))),
234
+ post.description &&
235
+ h("div", { class: "Description" },
236
+ h("p", { innerHTML: post.description })),
237
+ h("div", { class: "buttons" },
238
+ h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick() }, translate('moreInfo', this.language)),
239
+ this.isLoggedIn && post.gameId && h("button", { class: "playNowButton", onClick: () => this.onPlayNowClick(post.gameId) }, translate('playNow', this.language)))));
240
+ })))));
241
+ }
242
+ }
243
+ onViewAllClick() {
244
+ this.viewAll.emit();
245
+ window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
246
+ }
247
+ onMoreInfoClick() {
248
+ this.moreInfo.emit();
249
+ window.postMessage({ type: 'moreInfoSocialPost' }, window.location.href);
250
+ }
251
+ onPlayNowClick(gameId) {
252
+ this.playNow.emit(gameId);
253
+ window.postMessage({ type: 'playNowSocialPost', gameId: gameId }, window.location.href);
254
+ }
255
+ static get is() { return "general-preview-social-posts"; }
256
+ static get encapsulation() { return "shadow"; }
257
+ static get originalStyleUrls() { return {
258
+ "$": ["general-preview-social-posts.scss"]
259
+ }; }
260
+ static get styleUrls() { return {
261
+ "$": ["general-preview-social-posts.css"]
262
+ }; }
263
+ static get properties() { return {
264
+ "userId": {
265
+ "type": "string",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "string",
269
+ "resolved": "string",
270
+ "references": {}
271
+ },
272
+ "required": false,
273
+ "optional": false,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": "The userId"
277
+ },
278
+ "attribute": "user-id",
279
+ "reflect": true,
280
+ "defaultValue": "''"
281
+ },
282
+ "session": {
283
+ "type": "string",
284
+ "mutable": false,
285
+ "complexType": {
286
+ "original": "string",
287
+ "resolved": "string",
288
+ "references": {}
289
+ },
290
+ "required": false,
291
+ "optional": false,
292
+ "docs": {
293
+ "tags": [],
294
+ "text": "The session"
295
+ },
296
+ "attribute": "session",
297
+ "reflect": true,
298
+ "defaultValue": "''"
299
+ },
300
+ "postsTitle": {
301
+ "type": "string",
302
+ "mutable": false,
303
+ "complexType": {
304
+ "original": "string",
305
+ "resolved": "string",
306
+ "references": {}
307
+ },
308
+ "required": false,
309
+ "optional": false,
310
+ "docs": {
311
+ "tags": [],
312
+ "text": "The Posts Title"
313
+ },
314
+ "attribute": "posts-title",
315
+ "reflect": true,
316
+ "defaultValue": "''"
317
+ },
318
+ "maxCards": {
319
+ "type": "string",
320
+ "mutable": false,
321
+ "complexType": {
322
+ "original": "string",
323
+ "resolved": "string",
324
+ "references": {}
325
+ },
326
+ "required": false,
327
+ "optional": false,
328
+ "docs": {
329
+ "tags": [],
330
+ "text": "The max cards displayed"
331
+ },
332
+ "attribute": "max-cards",
333
+ "reflect": true,
334
+ "defaultValue": "''"
335
+ },
336
+ "language": {
337
+ "type": "string",
338
+ "mutable": false,
339
+ "complexType": {
340
+ "original": "string",
341
+ "resolved": "string",
342
+ "references": {}
343
+ },
344
+ "required": false,
345
+ "optional": false,
346
+ "docs": {
347
+ "tags": [],
348
+ "text": "The language"
349
+ },
350
+ "attribute": "language",
351
+ "reflect": true,
352
+ "defaultValue": "'en'"
353
+ },
354
+ "datasource": {
355
+ "type": "string",
356
+ "mutable": false,
357
+ "complexType": {
358
+ "original": "string",
359
+ "resolved": "string",
360
+ "references": {}
361
+ },
362
+ "required": false,
363
+ "optional": false,
364
+ "docs": {
365
+ "tags": [],
366
+ "text": "The datasource"
367
+ },
368
+ "attribute": "datasource",
369
+ "reflect": true,
370
+ "defaultValue": "''"
371
+ },
372
+ "endpoint": {
373
+ "type": "string",
374
+ "mutable": false,
375
+ "complexType": {
376
+ "original": "string",
377
+ "resolved": "string",
378
+ "references": {}
379
+ },
380
+ "required": false,
381
+ "optional": false,
382
+ "docs": {
383
+ "tags": [],
384
+ "text": "The NorWAy endpoint"
385
+ },
386
+ "attribute": "endpoint",
387
+ "reflect": true,
388
+ "defaultValue": "''"
389
+ },
390
+ "cmsEndpoint": {
391
+ "type": "string",
392
+ "mutable": false,
393
+ "complexType": {
394
+ "original": "string",
395
+ "resolved": "string",
396
+ "references": {}
397
+ },
398
+ "required": false,
399
+ "optional": false,
400
+ "docs": {
401
+ "tags": [],
402
+ "text": "The NorWAy endpoint"
403
+ },
404
+ "attribute": "cms-endpoint",
405
+ "reflect": true,
406
+ "defaultValue": "''"
407
+ },
408
+ "userRoles": {
409
+ "type": "string",
410
+ "mutable": false,
411
+ "complexType": {
412
+ "original": "string",
413
+ "resolved": "string",
414
+ "references": {}
415
+ },
416
+ "required": false,
417
+ "optional": false,
418
+ "docs": {
419
+ "tags": [],
420
+ "text": "The userRoles"
421
+ },
422
+ "attribute": "user-roles",
423
+ "reflect": true,
424
+ "defaultValue": "''"
425
+ },
426
+ "translationUrl": {
427
+ "type": "string",
428
+ "mutable": false,
429
+ "complexType": {
430
+ "original": "string",
431
+ "resolved": "string",
432
+ "references": {}
433
+ },
434
+ "required": false,
435
+ "optional": false,
436
+ "docs": {
437
+ "tags": [],
438
+ "text": "The translationurl"
439
+ },
440
+ "attribute": "translation-url",
441
+ "reflect": true,
442
+ "defaultValue": "''"
443
+ },
444
+ "clientStyling": {
445
+ "type": "string",
446
+ "mutable": false,
447
+ "complexType": {
448
+ "original": "string",
449
+ "resolved": "string",
450
+ "references": {}
451
+ },
452
+ "required": false,
453
+ "optional": false,
454
+ "docs": {
455
+ "tags": [],
456
+ "text": "Client custom styling via string"
457
+ },
458
+ "attribute": "client-styling",
459
+ "reflect": true,
460
+ "defaultValue": "''"
461
+ },
462
+ "clientStylingUrl": {
463
+ "type": "string",
464
+ "mutable": false,
465
+ "complexType": {
466
+ "original": "string",
467
+ "resolved": "string",
468
+ "references": {}
469
+ },
470
+ "required": false,
471
+ "optional": false,
472
+ "docs": {
473
+ "tags": [],
474
+ "text": "Client custom styling via url content"
475
+ },
476
+ "attribute": "client-styling-url",
477
+ "reflect": true,
478
+ "defaultValue": "''"
479
+ },
480
+ "cmsEnv": {
481
+ "type": "string",
482
+ "mutable": false,
483
+ "complexType": {
484
+ "original": "string",
485
+ "resolved": "string",
486
+ "references": {}
487
+ },
488
+ "required": false,
489
+ "optional": false,
490
+ "docs": {
491
+ "tags": [],
492
+ "text": "CMS Endpoint stage"
493
+ },
494
+ "attribute": "cms-env",
495
+ "reflect": true,
496
+ "defaultValue": "'stage'"
497
+ },
498
+ "pageName": {
499
+ "type": "string",
500
+ "mutable": false,
501
+ "complexType": {
502
+ "original": "string",
503
+ "resolved": "string",
504
+ "references": {}
505
+ },
506
+ "required": false,
507
+ "optional": false,
508
+ "docs": {
509
+ "tags": [],
510
+ "text": "The page parameter for the cms call"
511
+ },
512
+ "attribute": "page-name",
513
+ "reflect": true,
514
+ "defaultValue": "'casino'"
515
+ }
516
+ }; }
517
+ static get states() { return {
518
+ "posts": {},
519
+ "stylingAppends": {},
520
+ "isLoading": {},
521
+ "isLoggedIn": {},
522
+ "dataImages": {},
523
+ "gameIds": {}
524
+ }; }
525
+ static get events() { return [{
526
+ "method": "moreInfo",
527
+ "name": "moreInfo",
528
+ "bubbles": true,
529
+ "cancelable": true,
530
+ "composed": true,
531
+ "docs": {
532
+ "tags": [],
533
+ "text": ""
534
+ },
535
+ "complexType": {
536
+ "original": "any",
537
+ "resolved": "any",
538
+ "references": {}
539
+ }
540
+ }, {
541
+ "method": "playNow",
542
+ "name": "playNow",
543
+ "bubbles": true,
544
+ "cancelable": true,
545
+ "composed": true,
546
+ "docs": {
547
+ "tags": [],
548
+ "text": ""
549
+ },
550
+ "complexType": {
551
+ "original": "any",
552
+ "resolved": "any",
553
+ "references": {}
554
+ }
555
+ }, {
556
+ "method": "viewAll",
557
+ "name": "viewAll",
558
+ "bubbles": true,
559
+ "cancelable": true,
560
+ "composed": true,
561
+ "docs": {
562
+ "tags": [],
563
+ "text": ""
564
+ },
565
+ "complexType": {
566
+ "original": "any",
567
+ "resolved": "any",
568
+ "references": {}
569
+ }
570
+ }]; }
571
+ static get watchers() { return [{
572
+ "propName": "translationUrl",
573
+ "methodName": "handleNewTranslations"
574
+ }, {
575
+ "propName": "session",
576
+ "methodName": "watchSession"
577
+ }]; }
578
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,60 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['de', 'en'];
3
+ let TRANSLATIONS = {
4
+ en: {
5
+ loading: 'loading...',
6
+ viewAll: 'View All ...',
7
+ moreInfo: 'MORE INFO',
8
+ playNow: 'PLAY NOW',
9
+ },
10
+ de: {
11
+ loading: 'loading...',
12
+ viewAll: 'View All ...',
13
+ moreInfo: 'MORE INFO',
14
+ playNow: 'PLAY NOW',
15
+ },
16
+ ro: {
17
+ loading: 'loading...',
18
+ viewAll: 'View All ...',
19
+ moreInfo: 'MORE INFO',
20
+ playNow: 'PLAY NOW',
21
+ },
22
+ fr: {
23
+ loading: 'loading...',
24
+ viewAll: 'View All ...',
25
+ moreInfo: 'MORE INFO',
26
+ playNow: 'PLAY NOW',
27
+ },
28
+ ar: {
29
+ loading: 'loading...',
30
+ viewAll: 'View All ...',
31
+ moreInfo: 'MORE INFO',
32
+ playNow: 'PLAY NOW',
33
+ }
34
+ };
35
+ export const getTranslations = (url) => {
36
+ // fetch url, get the data, replace the TRANSLATIONS content
37
+ return new Promise((resolve) => {
38
+ fetch(url)
39
+ .then((res) => res.json())
40
+ .then((data) => {
41
+ Object.keys(data).forEach((item) => {
42
+ for (let key in data[item]) {
43
+ TRANSLATIONS[item][key] = data[item][key];
44
+ }
45
+ });
46
+ resolve(true);
47
+ });
48
+ });
49
+ };
50
+ export const translate = (key, customLang, values) => {
51
+ const lang = customLang;
52
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
53
+ if (values !== undefined) {
54
+ for (const [key, value] of Object.entries(values.values)) {
55
+ const regex = new RegExp(`{${key}}`, 'g');
56
+ translation = translation.replace(regex, value);
57
+ }
58
+ }
59
+ return translation;
60
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @name isMobile
3
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
4
+ * @param {String} userAgent window.navigator.userAgent
5
+ * @returns {Boolean} true or false
6
+ */
7
+ export const isMobile = (userAgent) => {
8
+ return !!(userAgent.toLowerCase().match(/android/i) ||
9
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
10
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
11
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
12
+ };
13
+ export const getDevice = () => {
14
+ let userAgent = window.navigator.userAgent;
15
+ if (userAgent.toLowerCase().match(/android/i)) {
16
+ return 'Android';
17
+ }
18
+ if (userAgent.toLowerCase().match(/iphone/i)) {
19
+ return 'iPhone';
20
+ }
21
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
22
+ return 'iPad';
23
+ }
24
+ return 'PC';
25
+ };
26
+ export const getDevicePlatform = () => {
27
+ const device = getDevice();
28
+ if (device) {
29
+ if (device === 'PC') {
30
+ return 'dk';
31
+ }
32
+ else if (device === 'iPad' || device === 'iPhone') {
33
+ return 'mtWeb';
34
+ }
35
+ else {
36
+ return 'mtWeb';
37
+ }
38
+ }
39
+ };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GeneralPreviewSocialPosts extends Components.GeneralPreviewSocialPosts, HTMLElement {}
4
+ export const GeneralPreviewSocialPosts: {
5
+ prototype: GeneralPreviewSocialPosts;
6
+ new (): GeneralPreviewSocialPosts;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;