@everymatrix/general-preview-social-posts 1.43.0 → 1.43.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.
- package/dist/cjs/general-preview-social-posts.cjs.entry.js +8 -14
- package/dist/collection/utils/locale.utils.js +8 -14
- package/dist/components/general-preview-social-posts.js +8 -14
- package/dist/esm/general-preview-social-posts.entry.js +8 -14
- package/dist/general-preview-social-posts/general-preview-social-posts.esm.js +1 -1
- package/dist/general-preview-social-posts/p-6826d836.entry.js +1 -0
- package/dist/types/utils/locale.utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/general-preview-social-posts/p-e80aaa1d.entry.js +0 -1
- /package/dist/types/Users/{sebastian.strulea/Documents/work → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-preview-social-posts/.stencil/packages/general-preview-social-posts/stencil.config.d.ts +0 -0
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-e178764e.js');
|
|
6
6
|
|
|
7
7
|
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
-
const SUPPORTED_LANGUAGES = ['de', 'en', 'hr'];
|
|
9
8
|
let TRANSLATIONS = {
|
|
10
9
|
en: {
|
|
11
10
|
loading: 'loading...',
|
|
@@ -45,30 +44,25 @@ let TRANSLATIONS = {
|
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
const getTranslations = (url) => {
|
|
48
|
-
// fetch url, get the data, replace the TRANSLATIONS content
|
|
49
47
|
return new Promise((resolve) => {
|
|
50
48
|
fetch(url)
|
|
51
49
|
.then((res) => res.json())
|
|
52
50
|
.then((data) => {
|
|
53
|
-
Object.keys(data).forEach((
|
|
54
|
-
|
|
55
|
-
TRANSLATIONS[
|
|
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];
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
resolve(true);
|
|
59
60
|
});
|
|
60
61
|
});
|
|
61
62
|
};
|
|
62
|
-
const translate = (key, customLang
|
|
63
|
+
const translate = (key, customLang) => {
|
|
63
64
|
const lang = customLang;
|
|
64
|
-
|
|
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;
|
|
65
|
+
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
72
66
|
};
|
|
73
67
|
|
|
74
68
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
-
const SUPPORTED_LANGUAGES = ['de', 'en', 'hr'];
|
|
3
2
|
let TRANSLATIONS = {
|
|
4
3
|
en: {
|
|
5
4
|
loading: 'loading...',
|
|
@@ -39,28 +38,23 @@ let TRANSLATIONS = {
|
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
export const getTranslations = (url) => {
|
|
42
|
-
// fetch url, get the data, replace the TRANSLATIONS content
|
|
43
41
|
return new Promise((resolve) => {
|
|
44
42
|
fetch(url)
|
|
45
43
|
.then((res) => res.json())
|
|
46
44
|
.then((data) => {
|
|
47
|
-
Object.keys(data).forEach((
|
|
48
|
-
|
|
49
|
-
TRANSLATIONS[
|
|
45
|
+
Object.keys(data).forEach((lang) => {
|
|
46
|
+
if (!TRANSLATIONS[lang]) {
|
|
47
|
+
TRANSLATIONS[lang] = {};
|
|
48
|
+
}
|
|
49
|
+
for (let key in data[lang]) {
|
|
50
|
+
TRANSLATIONS[lang][key] = data[lang][key];
|
|
50
51
|
}
|
|
51
52
|
});
|
|
52
53
|
resolve(true);
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
|
-
export const translate = (key, customLang
|
|
57
|
+
export const translate = (key, customLang) => {
|
|
57
58
|
const lang = customLang;
|
|
58
|
-
|
|
59
|
-
if (values !== undefined) {
|
|
60
|
-
for (const [key, value] of Object.entries(values.values)) {
|
|
61
|
-
const regex = new RegExp(`{${key}}`, 'g');
|
|
62
|
-
translation = translation.replace(regex, value);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return translation;
|
|
59
|
+
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
66
60
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
-
const SUPPORTED_LANGUAGES = ['de', 'en', 'hr'];
|
|
5
4
|
let TRANSLATIONS = {
|
|
6
5
|
en: {
|
|
7
6
|
loading: 'loading...',
|
|
@@ -41,30 +40,25 @@ let TRANSLATIONS = {
|
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
42
|
const getTranslations = (url) => {
|
|
44
|
-
// fetch url, get the data, replace the TRANSLATIONS content
|
|
45
43
|
return new Promise((resolve) => {
|
|
46
44
|
fetch(url)
|
|
47
45
|
.then((res) => res.json())
|
|
48
46
|
.then((data) => {
|
|
49
|
-
Object.keys(data).forEach((
|
|
50
|
-
|
|
51
|
-
TRANSLATIONS[
|
|
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];
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
resolve(true);
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
|
-
const translate = (key, customLang
|
|
59
|
+
const translate = (key, customLang) => {
|
|
59
60
|
const lang = customLang;
|
|
60
|
-
|
|
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;
|
|
61
|
+
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
68
62
|
};
|
|
69
63
|
|
|
70
64
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-8a671ab9.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
-
const SUPPORTED_LANGUAGES = ['de', 'en', 'hr'];
|
|
5
4
|
let TRANSLATIONS = {
|
|
6
5
|
en: {
|
|
7
6
|
loading: 'loading...',
|
|
@@ -41,30 +40,25 @@ let TRANSLATIONS = {
|
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
42
|
const getTranslations = (url) => {
|
|
44
|
-
// fetch url, get the data, replace the TRANSLATIONS content
|
|
45
43
|
return new Promise((resolve) => {
|
|
46
44
|
fetch(url)
|
|
47
45
|
.then((res) => res.json())
|
|
48
46
|
.then((data) => {
|
|
49
|
-
Object.keys(data).forEach((
|
|
50
|
-
|
|
51
|
-
TRANSLATIONS[
|
|
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];
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
resolve(true);
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
|
-
const translate = (key, customLang
|
|
59
|
+
const translate = (key, customLang) => {
|
|
59
60
|
const lang = customLang;
|
|
60
|
-
|
|
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;
|
|
61
|
+
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
68
62
|
};
|
|
69
63
|
|
|
70
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as s,b as e}from"./p-c682801c.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),s(n)})().then((s=>e([["p-
|
|
1
|
+
import{p as s,b as e}from"./p-c682801c.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),s(n)})().then((s=>e([["p-6826d836",[[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]}]]]],s)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as t,h as n}from"./p-c682801c.js";let e={en:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},de:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},ro:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},fr:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},ar:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},hr:{loading:"Učitavanje…",viewAll:"Pogledaj sve …",moreInfo:"VIŠE INFORMACIJA",playNow:"IGRAJ SADA"}};const s=i=>new Promise((t=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((t=>{e[t]||(e[t]={});for(let n in i[t])e[t][n]=i[t][n]})),t(!0)}))})),o=(i,t)=>e[void 0!==t&&t in e?t:"en"][i],l=class{constructor(n){i(this,n),this.moreInfo=t(this,"moreInfo",7),this.playNow=t(this,"playNow",7),this.viewAll=t(this,"viewAll",7),this.userId="",this.session="",this.postsTitle="",this.maxCards="",this.language="en",this.datasource="",this.endpoint="",this.cmsEndpoint="",this.userRoles="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.cmsEnv="stage",this.pageName="casino",this.posts=[],this.stylingAppends=!1,this.isLoading=!1,this.isLoggedIn=!1,this.dataImages=[],this.gameIds="",this.platform=(()=>{const i=(()=>{let i=window.navigator.userAgent;return i.toLowerCase().match(/android/i)?"Android":i.toLocaleLowerCase().match(/customnative:ios/)?"nativeIOS":i.toLowerCase().match(/iphone/i)?"iPhone":i.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(i)return"PC"===i?"dk":"nativeIOS"==i?"ios":"mtWeb"})(),this.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.prepend(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{t.innerHTML=i,setTimeout((()=>{this.stylingContainer.prepend(t)}),1)})).catch((i=>{console.log("error ",i)}))}}handleNewTranslations(){this.isLoading=!0,s(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await s(this.translationUrl)}watchSession(i,t){i!==t&&(this.isLoggedIn=""!==i)}connectedCallback(){this.session&&(this.isLoggedIn=!0)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}getDataImage(i){try{let t=new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);t.searchParams.append("language",this.language),t.searchParams.append("expand","games"),t.searchParams.append("fields","games(id,thumbnail,launchUrl)"),t.searchParams.append("filter",i),t.searchParams.append("device",this.platform),fetch(t.href,{method:"GET","Content-Type":"application/json"}).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{i.items.forEach((i=>{i.games.items.forEach((i=>{let{id:t,launchUrl:n,thumbnail:e}=i;this.dataImages=[{id:t,launchUrl:n,thumbnail:e}];let s=this.posts.findIndex((i=>i.gameId===t));-1!==s&&(this.posts[s].images=this.dataImages)}))}))})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}async componentDidLoad(){try{let i=new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);i.searchParams.append("device",this.platform),i.searchParams.append("page",this.pageName),i.searchParams.append("language",this.language),i.searchParams.append("userRoles",this.userRoles),i.searchParams.append("env",this.cmsEnv),fetch(i.href,{method:"GET","Content-Type":"application/json"}).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{i.forEach((i=>{var t;const n=i.slug,e=i.id,{gameId:s,title:o,description:l,subtitle:r}=null!==(t=i.previewCard)&&void 0!==t?t:{};s&&(this.gameIds+=`games(id=${s}),`),this.posts.push({postId:e,gameId:s,title:o,description:l,subtitle:r,slug:n})})),this.gameIds.length>0&&(this.gameIds=this.gameIds.slice(0,-1),this.gameIds="$or("+this.gameIds+")"),this.getDataImage(this.gameIds)})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}hasUndefinedValues(i){return Object.values(i).some((i=>void 0===i))}render(){return this.isLoading?n("div",null,n("p",null,o("loading",this.language))):n("div",{class:"ModalContainer",ref:i=>this.stylingContainer=i},n("div",{class:"sliderWidget"},n("div",{class:"headerHontainer"},this.postsTitle&&n("h2",null,this.postsTitle),n("div",{class:"viewAllButton",onClick:()=>this.onViewAllClick()},o("viewAll",this.language))),n("div",{class:"postSlider"},this.posts.filter((i=>!this.hasUndefinedValues(i))).slice(0,+(this.maxCards||this.posts.length)).map((i=>{var t,e,s,l;return n("div",{class:"postCard"},n("div",{class:"imageTitle"},(null==i?void 0:i.images)?n("a",{href:(null===(e=null===(t=i.images)||void 0===t?void 0:t[0])||void 0===e?void 0:e.launchUrl)||"",target:"_blank",rel:"noopener noreferrer"},n("img",{src:(null===(l=null===(s=i.images)||void 0===s?void 0:s[0])||void 0===l?void 0:l.thumbnail)||"",alt:"Game Image"})):null,n("div",{class:"titleSubtitle"},i.title&&n("h3",null,i.title),i.subtitle&&n("p",{innerHTML:i.subtitle}))),i.description&&n("div",{class:"Description"},n("p",{innerHTML:i.description})),n("div",{class:"buttons"},n("button",{class:"moreInfoButton",onClick:()=>this.onMoreInfoClick(i.gameId,i.postId,i.title,i.slug)},o("moreInfo",this.language)),this.isLoggedIn&&i.gameId&&n("button",{class:"playNowButton",onClick:()=>this.onPlayNowClick(i.gameId)},o("playNow",this.language))))})))))}onViewAllClick(){this.viewAll.emit(),window.postMessage({type:"viewAllSocialPosts"},window.location.href)}onMoreInfoClick(i,t,n,e){this.moreInfo.emit(),window.postMessage({type:"moreInfoSocialPost",gameId:i,postId:t,postTitle:n,slug:e},window.location.href)}onPlayNowClick(i){this.playNow.emit(i),window.postMessage({type:"playNowSocialPost",gameId:i},window.location.href)}static get watchers(){return{translationUrl:["handleNewTranslations"],session:["watchSession"]}}};l.style=':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}';export{l as general_preview_social_posts}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getTranslations: (url: string) => Promise<unknown>;
|
|
2
|
-
export declare const translate: (key: string, customLang?: any
|
|
2
|
+
export declare const translate: (key: string, customLang?: any) => string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as t,h as n}from"./p-c682801c.js";const e=["de","en","hr"];let o={en:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},de:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},ro:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},fr:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},ar:{loading:"loading...",viewAll:"View All ...",moreInfo:"MORE INFO",playNow:"PLAY NOW"},hr:{loading:"Učitavanje…",viewAll:"Pogledaj sve …",moreInfo:"VIŠE INFORMACIJA",playNow:"IGRAJ SADA"}};const s=i=>new Promise((t=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((t=>{for(let n in i[t])o[t][n]=i[t][n]})),t(!0)}))})),l=(i,t,n)=>{const s=t;let l=o[void 0!==s&&e.includes(s)?s:"en"][i];if(void 0!==n)for(const[i,t]of Object.entries(n.values)){const n=new RegExp(`{${i}}`,"g");l=l.replace(n,t)}return l},r=class{constructor(n){i(this,n),this.moreInfo=t(this,"moreInfo",7),this.playNow=t(this,"playNow",7),this.viewAll=t(this,"viewAll",7),this.userId="",this.session="",this.postsTitle="",this.maxCards="",this.language="en",this.datasource="",this.endpoint="",this.cmsEndpoint="",this.userRoles="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.cmsEnv="stage",this.pageName="casino",this.posts=[],this.stylingAppends=!1,this.isLoading=!1,this.isLoggedIn=!1,this.dataImages=[],this.gameIds="",this.platform=(()=>{const i=(()=>{let i=window.navigator.userAgent;return i.toLowerCase().match(/android/i)?"Android":i.toLocaleLowerCase().match(/customnative:ios/)?"nativeIOS":i.toLowerCase().match(/iphone/i)?"iPhone":i.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(i)return"PC"===i?"dk":"nativeIOS"==i?"ios":"mtWeb"})(),this.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.prepend(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{t.innerHTML=i,setTimeout((()=>{this.stylingContainer.prepend(t)}),1)})).catch((i=>{console.log("error ",i)}))}}handleNewTranslations(){this.isLoading=!0,s(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await s(this.translationUrl)}watchSession(i,t){i!==t&&(this.isLoggedIn=""!==i)}connectedCallback(){this.session&&(this.isLoggedIn=!0)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}getDataImage(i){try{let t=new URL(`${this.endpoint}/v2/casino/groups/${this.datasource}`);t.searchParams.append("language",this.language),t.searchParams.append("expand","games"),t.searchParams.append("fields","games(id,thumbnail,launchUrl)"),t.searchParams.append("filter",i),t.searchParams.append("device",this.platform),fetch(t.href,{method:"GET","Content-Type":"application/json"}).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{i.items.forEach((i=>{i.games.items.forEach((i=>{let{id:t,launchUrl:n,thumbnail:e}=i;this.dataImages=[{id:t,launchUrl:n,thumbnail:e}];let o=this.posts.findIndex((i=>i.gameId===t));-1!==o&&(this.posts[o].images=this.dataImages)}))}))})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}async componentDidLoad(){try{let i=new URL(`${this.cmsEndpoint}/${this.language}/content/social-posts`);i.searchParams.append("device",this.platform),i.searchParams.append("page",this.pageName),i.searchParams.append("language",this.language),i.searchParams.append("userRoles",this.userRoles),i.searchParams.append("env",this.cmsEnv),fetch(i.href,{method:"GET","Content-Type":"application/json"}).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{i.forEach((i=>{var t;const n=i.slug,e=i.id,{gameId:o,title:s,description:l,subtitle:r}=null!==(t=i.previewCard)&&void 0!==t?t:{};o&&(this.gameIds+=`games(id=${o}),`),this.posts.push({postId:e,gameId:o,title:s,description:l,subtitle:r,slug:n})})),this.gameIds.length>0&&(this.gameIds=this.gameIds.slice(0,-1),this.gameIds="$or("+this.gameIds+")"),this.getDataImage(this.gameIds)})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}hasUndefinedValues(i){return Object.values(i).some((i=>void 0===i))}render(){return this.isLoading?n("div",null,n("p",null,l("loading",this.language))):n("div",{class:"ModalContainer",ref:i=>this.stylingContainer=i},n("div",{class:"sliderWidget"},n("div",{class:"headerHontainer"},this.postsTitle&&n("h2",null,this.postsTitle),n("div",{class:"viewAllButton",onClick:()=>this.onViewAllClick()},l("viewAll",this.language))),n("div",{class:"postSlider"},this.posts.filter((i=>!this.hasUndefinedValues(i))).slice(0,+(this.maxCards||this.posts.length)).map((i=>{var t,e,o,s;return n("div",{class:"postCard"},n("div",{class:"imageTitle"},(null==i?void 0:i.images)?n("a",{href:(null===(e=null===(t=i.images)||void 0===t?void 0:t[0])||void 0===e?void 0:e.launchUrl)||"",target:"_blank",rel:"noopener noreferrer"},n("img",{src:(null===(s=null===(o=i.images)||void 0===o?void 0:o[0])||void 0===s?void 0:s.thumbnail)||"",alt:"Game Image"})):null,n("div",{class:"titleSubtitle"},i.title&&n("h3",null,i.title),i.subtitle&&n("p",{innerHTML:i.subtitle}))),i.description&&n("div",{class:"Description"},n("p",{innerHTML:i.description})),n("div",{class:"buttons"},n("button",{class:"moreInfoButton",onClick:()=>this.onMoreInfoClick(i.gameId,i.postId,i.title,i.slug)},l("moreInfo",this.language)),this.isLoggedIn&&i.gameId&&n("button",{class:"playNowButton",onClick:()=>this.onPlayNowClick(i.gameId)},l("playNow",this.language))))})))))}onViewAllClick(){this.viewAll.emit(),window.postMessage({type:"viewAllSocialPosts"},window.location.href)}onMoreInfoClick(i,t,n,e){this.moreInfo.emit(),window.postMessage({type:"moreInfoSocialPost",gameId:i,postId:t,postTitle:n,slug:e},window.location.href)}onPlayNowClick(i){this.playNow.emit(i),window.postMessage({type:"playNowSocialPost",gameId:i},window.location.href)}static get watchers(){return{translationUrl:["handleNewTranslations"],session:["watchSession"]}}};r.style=':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}';export{r as general_preview_social_posts}
|