@everymatrix/casino-challenges-list 1.77.21 → 1.77.22
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/casino-challenges-list/casino-challenge-card_3.entry.js +1 -1
- package/dist/casino-challenges-list/casino-challenges-list-7f47d912.js +1 -0
- package/dist/casino-challenges-list/index.esm.js +1 -1
- package/dist/cjs/casino-challenge-card_3.cjs.entry.js +13 -11
- package/dist/cjs/casino-challenges-list-6195a490.js +185 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/collection/assets/empty-state.svg +9 -0
- package/dist/collection/components/casino-challenges-list/casino-challenges-list.css +23 -1
- package/dist/collection/components/casino-challenges-list/casino-challenges-list.js +6 -1
- package/dist/collection/utils/locale.utils.js +37 -0
- package/dist/esm/casino-challenge-card_3.entry.js +14 -12
- package/dist/esm/casino-challenges-list-7f47d912.js +180 -0
- package/dist/esm/index.js +1 -1
- package/dist/types/components/casino-challenges-list/casino-challenges-list.d.ts +1 -0
- package/dist/types/utils/locale.utils.d.ts +3 -0
- package/package.json +1 -1
- package/dist/casino-challenges-list/casino-challenges-list-d0d9a1e1.js +0 -1
- package/dist/cjs/casino-challenges-list-b4bc1590.js +0 -164
- package/dist/esm/casino-challenges-list-d0d9a1e1.js +0 -159
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-d84ca385.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @name setClientStyling
|
|
5
|
-
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
6
|
-
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
7
|
-
* @param {string} clientStyling The style content
|
|
8
|
-
*/
|
|
9
|
-
function setClientStyling(stylingContainer, clientStyling) {
|
|
10
|
-
if (stylingContainer) {
|
|
11
|
-
const sheet = document.createElement('style');
|
|
12
|
-
sheet.innerHTML = clientStyling;
|
|
13
|
-
stylingContainer.appendChild(sheet);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @name setClientStylingURL
|
|
19
|
-
* @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
|
|
20
|
-
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
21
|
-
* @param {string} clientStylingUrl The URL of the style content
|
|
22
|
-
*/
|
|
23
|
-
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
24
|
-
const url = new URL(clientStylingUrl);
|
|
25
|
-
|
|
26
|
-
fetch(url.href)
|
|
27
|
-
.then((res) => res.text())
|
|
28
|
-
.then((data) => {
|
|
29
|
-
const cssFile = document.createElement('style');
|
|
30
|
-
cssFile.innerHTML = data;
|
|
31
|
-
if (stylingContainer) {
|
|
32
|
-
stylingContainer.appendChild(cssFile);
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
.catch((err) => {
|
|
36
|
-
console.error('There was an error while trying to load client styling from URL', err);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @name setStreamLibrary
|
|
42
|
-
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
43
|
-
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
44
|
-
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
45
|
-
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
46
|
-
*/
|
|
47
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
48
|
-
if (window.emMessageBus) {
|
|
49
|
-
const sheet = document.createElement('style');
|
|
50
|
-
|
|
51
|
-
window.emMessageBus.subscribe(domain, (data) => {
|
|
52
|
-
sheet.innerHTML = data;
|
|
53
|
-
if (stylingContainer) {
|
|
54
|
-
stylingContainer.appendChild(sheet);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const casinoChallengesListCss = ".challenges-list {\n display: flex;\n flex-wrap: wrap;\n gap: 30px;\n width: 100%;\n}\n\n.loader {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .loader {\n width: 100%;\n }\n}\n.loader:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.loader .SkeletonRows .SkeletonContainer {\n padding: 0 20px 0 20px;\n}\n.loader .SkeletonButton .Skeleton.Text {\n margin: 0;\n height: 28px;\n margin: 0 20px 20px 20px;\n border-radius: var(--emw--button-border-radius, 99px);\n width: auto;\n}\n.loader .Skeleton.Image {\n border-radius: 16px 16px 0 0;\n}\n.loader .Skeleton.Text {\n margin: 20px 0;\n}";
|
|
61
|
-
const CasinoChallengesListStyle0 = casinoChallengesListCss;
|
|
62
|
-
|
|
63
|
-
const skeletons = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
64
|
-
const CasinoChallengeList = class {
|
|
65
|
-
constructor(hostRef) {
|
|
66
|
-
registerInstance(this, hostRef);
|
|
67
|
-
this.loadMore = createEvent(this, "loadMore", 7);
|
|
68
|
-
this.timerExpired = createEvent(this, "timerExpired", 7);
|
|
69
|
-
this.setLastItemRef = (el) => {
|
|
70
|
-
if (this.lastItemRef && this.observer) {
|
|
71
|
-
this.observer.unobserve(this.lastItemRef);
|
|
72
|
-
}
|
|
73
|
-
this.lastItemRef = el;
|
|
74
|
-
if (el && this.observer && !this.loading) {
|
|
75
|
-
this.observer.observe(el);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
this.mbSource = undefined;
|
|
79
|
-
this.clientStyling = undefined;
|
|
80
|
-
this.clientStylingUrl = undefined;
|
|
81
|
-
this.language = 'en';
|
|
82
|
-
this.translationUrl = undefined;
|
|
83
|
-
this.challenges = [];
|
|
84
|
-
this.loading = false;
|
|
85
|
-
this.hasMore = false;
|
|
86
|
-
this.activeTabIndex = 0;
|
|
87
|
-
}
|
|
88
|
-
handleClientStylingChange(newValue, oldValue) {
|
|
89
|
-
if (newValue != oldValue) {
|
|
90
|
-
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
handleClientStylingUrlChange(newValue, oldValue) {
|
|
94
|
-
if (newValue != oldValue) {
|
|
95
|
-
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
handleMbSourceChange(newValue, oldValue) {
|
|
99
|
-
if (newValue != oldValue) {
|
|
100
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
setupObserver() {
|
|
104
|
-
if (!this.lastItemRef || this.loading || !this.hasMore)
|
|
105
|
-
return;
|
|
106
|
-
if (!this.observer) {
|
|
107
|
-
this.observer = new IntersectionObserver(([entry]) => {
|
|
108
|
-
if (entry.isIntersecting && !this.loading && this.hasMore) {
|
|
109
|
-
this.observer.unobserve(entry.target);
|
|
110
|
-
this.loadMore.emit();
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
root: null,
|
|
114
|
-
rootMargin: '0px',
|
|
115
|
-
threshold: 0.1
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
this.observer.disconnect();
|
|
119
|
-
this.observer.observe(this.lastItemRef);
|
|
120
|
-
}
|
|
121
|
-
componentDidRender() {
|
|
122
|
-
this.setupObserver();
|
|
123
|
-
}
|
|
124
|
-
disconnectedCallback() {
|
|
125
|
-
var _a;
|
|
126
|
-
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
127
|
-
this.observer = undefined;
|
|
128
|
-
}
|
|
129
|
-
componentDidLoad() {
|
|
130
|
-
if (this.stylingContainer) {
|
|
131
|
-
if (this.mbSource)
|
|
132
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
133
|
-
if (this.clientStyling)
|
|
134
|
-
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
135
|
-
if (this.clientStylingUrl)
|
|
136
|
-
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
renderSkeletons() {
|
|
140
|
-
return skeletons.map((skeleton) => (h("div", { class: "loader", key: skeleton }, h("ui-skeleton", { structure: "image", height: "200px", "border-radius": "16px 16px 0 0" }), h("ui-skeleton", { class: "SkeletonRows", structure: "text", width: "220px", height: "16px", rows: "3" }), h("ui-skeleton", { class: "SkeletonButton", structure: "text", width: "100%" }))));
|
|
141
|
-
}
|
|
142
|
-
onTimerExpired(e) {
|
|
143
|
-
if (this.timerExpired) {
|
|
144
|
-
this.timerExpired.emit(e.detail);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
render() {
|
|
148
|
-
return (h("div", { key: 'a86f75428a1ada59409164e3c83582794d186c5c', ref: (el) => (this.stylingContainer = el), class: "challenges-list" }, this.challenges.map((challenge, index) => (h("div", { key: challenge.Id, ref: index === this.challenges.length - 1 ? this.setLastItemRef : null }, h("casino-challenge-card", { challenge: challenge, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, translationUrl: this.translationUrl, onTimerExpired: this.onTimerExpired, activeTabIndex: this.activeTabIndex })))), this.loading && this.renderSkeletons()));
|
|
149
|
-
}
|
|
150
|
-
get el() { return getElement(this); }
|
|
151
|
-
static get watchers() { return {
|
|
152
|
-
"clientStyling": ["handleClientStylingChange"],
|
|
153
|
-
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
154
|
-
"mbSource": ["handleMbSourceChange"]
|
|
155
|
-
}; }
|
|
156
|
-
};
|
|
157
|
-
CasinoChallengeList.style = CasinoChallengesListStyle0;
|
|
158
|
-
|
|
159
|
-
export { CasinoChallengeList as C, setClientStylingURL as a, setStreamStyling as b, setClientStyling as s };
|