@everymatrix/general-preview-social-posts 1.27.0 → 1.27.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 +5 -4
- package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.js +5 -4
- package/dist/components/general-preview-social-posts.js +5 -4
- package/dist/esm/general-preview-social-posts.entry.js +5 -4
- package/dist/general-preview-social-posts/general-preview-social-posts.esm.js +1 -1
- package/dist/general-preview-social-posts/p-f92cf9f8.entry.js +1 -0
- package/dist/types/components/general-preview-social-posts/general-preview-social-posts.d.ts +1 -1
- package/package.json +1 -1
- package/dist/general-preview-social-posts/p-0a06de98.entry.js +0 -1
|
@@ -294,11 +294,12 @@ const SocialSlider = class {
|
|
|
294
294
|
data.forEach(element => {
|
|
295
295
|
var _a;
|
|
296
296
|
const slug = element.slug;
|
|
297
|
+
const postId = element.id;
|
|
297
298
|
const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
|
|
298
299
|
if (gameId) {
|
|
299
300
|
this.gameIds += `games(id=${gameId}),`;
|
|
300
301
|
}
|
|
301
|
-
this.posts.push({ gameId, title, description, subtitle, slug });
|
|
302
|
+
this.posts.push({ postId, gameId, title, description, subtitle, slug });
|
|
302
303
|
});
|
|
303
304
|
if (this.gameIds.length > 0) {
|
|
304
305
|
this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
|
|
@@ -330,7 +331,7 @@ const SocialSlider = class {
|
|
|
330
331
|
var _a, _b, _c, _d;
|
|
331
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" })))
|
|
332
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 &&
|
|
333
|
-
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.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)))));
|
|
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)))));
|
|
334
335
|
})))));
|
|
335
336
|
}
|
|
336
337
|
}
|
|
@@ -338,9 +339,9 @@ const SocialSlider = class {
|
|
|
338
339
|
this.viewAll.emit();
|
|
339
340
|
window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
|
|
340
341
|
}
|
|
341
|
-
onMoreInfoClick(postId, postTitle, slug) {
|
|
342
|
+
onMoreInfoClick(gameId, postId, postTitle, slug) {
|
|
342
343
|
this.moreInfo.emit();
|
|
343
|
-
window.postMessage({ type: 'moreInfoSocialPost',
|
|
344
|
+
window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
|
|
344
345
|
}
|
|
345
346
|
onPlayNowClick(gameId) {
|
|
346
347
|
this.playNow.emit(gameId);
|
package/dist/collection/components/general-preview-social-posts/general-preview-social-posts.js
CHANGED
|
@@ -184,11 +184,12 @@ export class SocialSlider {
|
|
|
184
184
|
data.forEach(element => {
|
|
185
185
|
var _a;
|
|
186
186
|
const slug = element.slug;
|
|
187
|
+
const postId = element.id;
|
|
187
188
|
const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
|
|
188
189
|
if (gameId) {
|
|
189
190
|
this.gameIds += `games(id=${gameId}),`;
|
|
190
191
|
}
|
|
191
|
-
this.posts.push({ gameId, title, description, subtitle, slug });
|
|
192
|
+
this.posts.push({ postId, gameId, title, description, subtitle, slug });
|
|
192
193
|
});
|
|
193
194
|
if (this.gameIds.length > 0) {
|
|
194
195
|
this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
|
|
@@ -236,7 +237,7 @@ export class SocialSlider {
|
|
|
236
237
|
h("div", { class: "Description" },
|
|
237
238
|
h("p", { innerHTML: post.description })),
|
|
238
239
|
h("div", { class: "buttons" },
|
|
239
|
-
h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, post.title, post.slug) }, translate('moreInfo', this.language)),
|
|
240
|
+
h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, post.postId, post.title, post.slug) }, translate('moreInfo', this.language)),
|
|
240
241
|
this.isLoggedIn && post.gameId && h("button", { class: "playNowButton", onClick: () => this.onPlayNowClick(post.gameId) }, translate('playNow', this.language)))));
|
|
241
242
|
})))));
|
|
242
243
|
}
|
|
@@ -245,9 +246,9 @@ export class SocialSlider {
|
|
|
245
246
|
this.viewAll.emit();
|
|
246
247
|
window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
|
|
247
248
|
}
|
|
248
|
-
onMoreInfoClick(postId, postTitle, slug) {
|
|
249
|
+
onMoreInfoClick(gameId, postId, postTitle, slug) {
|
|
249
250
|
this.moreInfo.emit();
|
|
250
|
-
window.postMessage({ type: 'moreInfoSocialPost',
|
|
251
|
+
window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
|
|
251
252
|
}
|
|
252
253
|
onPlayNowClick(gameId) {
|
|
253
254
|
this.playNow.emit(gameId);
|
|
@@ -292,11 +292,12 @@ const SocialSlider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
292
292
|
data.forEach(element => {
|
|
293
293
|
var _a;
|
|
294
294
|
const slug = element.slug;
|
|
295
|
+
const postId = element.id;
|
|
295
296
|
const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
|
|
296
297
|
if (gameId) {
|
|
297
298
|
this.gameIds += `games(id=${gameId}),`;
|
|
298
299
|
}
|
|
299
|
-
this.posts.push({ gameId, title, description, subtitle, slug });
|
|
300
|
+
this.posts.push({ postId, gameId, title, description, subtitle, slug });
|
|
300
301
|
});
|
|
301
302
|
if (this.gameIds.length > 0) {
|
|
302
303
|
this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
|
|
@@ -328,7 +329,7 @@ const SocialSlider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
328
329
|
var _a, _b, _c, _d;
|
|
329
330
|
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" })))
|
|
330
331
|
: null, h("div", { class: "titleSubtitle" }, post.title && h("h3", null, post.title), post.subtitle && h("p", { innerHTML: post.subtitle }))), post.description &&
|
|
331
|
-
h("div", { class: "Description" }, h("p", { innerHTML: post.description })), h("div", { class: "buttons" }, h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, 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)))));
|
|
332
|
+
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)))));
|
|
332
333
|
})))));
|
|
333
334
|
}
|
|
334
335
|
}
|
|
@@ -336,9 +337,9 @@ const SocialSlider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
336
337
|
this.viewAll.emit();
|
|
337
338
|
window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
|
|
338
339
|
}
|
|
339
|
-
onMoreInfoClick(postId, postTitle, slug) {
|
|
340
|
+
onMoreInfoClick(gameId, postId, postTitle, slug) {
|
|
340
341
|
this.moreInfo.emit();
|
|
341
|
-
window.postMessage({ type: 'moreInfoSocialPost',
|
|
342
|
+
window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
|
|
342
343
|
}
|
|
343
344
|
onPlayNowClick(gameId) {
|
|
344
345
|
this.playNow.emit(gameId);
|
|
@@ -290,11 +290,12 @@ const SocialSlider = class {
|
|
|
290
290
|
data.forEach(element => {
|
|
291
291
|
var _a;
|
|
292
292
|
const slug = element.slug;
|
|
293
|
+
const postId = element.id;
|
|
293
294
|
const { gameId, title, description, subtitle } = (_a = element.previewCard) !== null && _a !== void 0 ? _a : {};
|
|
294
295
|
if (gameId) {
|
|
295
296
|
this.gameIds += `games(id=${gameId}),`;
|
|
296
297
|
}
|
|
297
|
-
this.posts.push({ gameId, title, description, subtitle, slug });
|
|
298
|
+
this.posts.push({ postId, gameId, title, description, subtitle, slug });
|
|
298
299
|
});
|
|
299
300
|
if (this.gameIds.length > 0) {
|
|
300
301
|
this.gameIds = this.gameIds.slice(0, -1); // Removes the last comma
|
|
@@ -326,7 +327,7 @@ const SocialSlider = class {
|
|
|
326
327
|
var _a, _b, _c, _d;
|
|
327
328
|
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" })))
|
|
328
329
|
: null, h("div", { class: "titleSubtitle" }, post.title && h("h3", null, post.title), post.subtitle && h("p", { innerHTML: post.subtitle }))), post.description &&
|
|
329
|
-
h("div", { class: "Description" }, h("p", { innerHTML: post.description })), h("div", { class: "buttons" }, h("button", { class: "moreInfoButton", onClick: () => this.onMoreInfoClick(post.gameId, 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)))));
|
|
330
|
+
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)))));
|
|
330
331
|
})))));
|
|
331
332
|
}
|
|
332
333
|
}
|
|
@@ -334,9 +335,9 @@ const SocialSlider = class {
|
|
|
334
335
|
this.viewAll.emit();
|
|
335
336
|
window.postMessage({ type: 'viewAllSocialPosts' }, window.location.href);
|
|
336
337
|
}
|
|
337
|
-
onMoreInfoClick(postId, postTitle, slug) {
|
|
338
|
+
onMoreInfoClick(gameId, postId, postTitle, slug) {
|
|
338
339
|
this.moreInfo.emit();
|
|
339
|
-
window.postMessage({ type: 'moreInfoSocialPost',
|
|
340
|
+
window.postMessage({ type: 'moreInfoSocialPost', gameId, postId, postTitle, slug }, window.location.href);
|
|
340
341
|
}
|
|
341
342
|
onPlayNowClick(gameId) {
|
|
342
343
|
this.playNow.emit(gameId);
|
|
@@ -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-f92cf9f8",[[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";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.toLowerCase().match(/iphone/i)?"iPhone":i.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(i)return"PC"===i?"dk":"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}
|
package/dist/types/components/general-preview-social-posts/general-preview-social-posts.d.ts
CHANGED
|
@@ -79,6 +79,6 @@ export declare class SocialSlider {
|
|
|
79
79
|
hasUndefinedValues(obj: object): boolean;
|
|
80
80
|
render(): any;
|
|
81
81
|
onViewAllClick(): void;
|
|
82
|
-
onMoreInfoClick(
|
|
82
|
+
onMoreInfoClick(gameId: string, postId: number, postTitle: string, slug: string): void;
|
|
83
83
|
onPlayNowClick(gameId: any): void;
|
|
84
84
|
}
|
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.toLowerCase().match(/iphone/i)?"iPhone":i.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(i)return"PC"===i?"dk":"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,{gameId:e,title:o,description:s,subtitle:l}=null!==(t=i.previewCard)&&void 0!==t?t:{};e&&(this.gameIds+=`games(id=${e}),`),this.posts.push({gameId:e,title:o,description:s,subtitle:l,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.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){this.moreInfo.emit(),window.postMessage({type:"moreInfoSocialPost",postId:i,postTitle:t,slug:n},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}
|