@everymatrix/casino-challenges-overlay-slider 0.0.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.
- package/dist/casino-challenges-overlay-slider/app-globals-0f993ce5.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-card_2.entry.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider-2eb80eb5.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider.esm.js +1 -0
- package/dist/casino-challenges-overlay-slider/index-9e63661c.js +2 -0
- package/dist/casino-challenges-overlay-slider/index.esm.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-challenges-overlay-card_2.cjs.entry.js +164 -0
- package/dist/cjs/casino-challenges-overlay-slider-bf3e8c30.js +412 -0
- package/dist/cjs/casino-challenges-overlay-slider.cjs.js +25 -0
- package/dist/cjs/index-180bdedd.js +1248 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/assets/left_arrow.svg +3 -0
- package/dist/collection/assets/right_arrow.svg +3 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.css +98 -0
- package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.js +450 -0
- package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.css +107 -0
- package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.js +260 -0
- package/dist/collection/components/casino-challenges-overlay-slider/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +48 -0
- package/dist/collection/utils/types.js +52 -0
- package/dist/collection/utils/utils.js +20 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-challenges-overlay-card_2.entry.js +160 -0
- package/dist/esm/casino-challenges-overlay-slider-2eb80eb5.js +409 -0
- package/dist/esm/casino-challenges-overlay-slider.js +20 -0
- package/dist/esm/index-9e63661c.js +1220 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.d.ts +53 -0
- package/dist/types/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.d.ts +22 -0
- package/dist/types/components/casino-challenges-overlay-slider/index.d.ts +1 -0
- package/dist/types/components.d.ts +118 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +3 -0
- package/dist/types/utils/types.d.ts +120 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-9e63661c.js';
|
|
2
|
+
|
|
3
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @name setClientStyling
|
|
7
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
8
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
9
|
+
* @param {string} clientStyling The style content
|
|
10
|
+
*/
|
|
11
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
12
|
+
if (stylingContainer) {
|
|
13
|
+
const sheet = document.createElement('style');
|
|
14
|
+
sheet.innerHTML = clientStyling;
|
|
15
|
+
stylingContainer.appendChild(sheet);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name setClientStylingURL
|
|
21
|
+
* @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
|
|
22
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
23
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
24
|
+
*/
|
|
25
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
26
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
27
|
+
|
|
28
|
+
const url = new URL(clientStylingUrl);
|
|
29
|
+
|
|
30
|
+
fetch(url.href)
|
|
31
|
+
.then((res) => res.text())
|
|
32
|
+
.then((data) => {
|
|
33
|
+
const cssFile = document.createElement('style');
|
|
34
|
+
cssFile.innerHTML = data;
|
|
35
|
+
if (stylingContainer) {
|
|
36
|
+
stylingContainer.appendChild(cssFile);
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
.catch((err) => {
|
|
40
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @name setStreamLibrary
|
|
46
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
47
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
48
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
49
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
50
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
51
|
+
*/
|
|
52
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
53
|
+
if (!window.emMessageBus) return;
|
|
54
|
+
|
|
55
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
56
|
+
|
|
57
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
58
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
59
|
+
|
|
60
|
+
return subscription;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!window[StyleCacheKey]) {
|
|
64
|
+
window[StyleCacheKey] = {};
|
|
65
|
+
}
|
|
66
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
67
|
+
|
|
68
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
69
|
+
const wrappedUnsubscribe = () => {
|
|
70
|
+
if (window[StyleCacheKey][domain]) {
|
|
71
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
72
|
+
cachedObject.refCount > 1
|
|
73
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
74
|
+
: delete window[StyleCacheKey][domain];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
originalUnsubscribe();
|
|
78
|
+
};
|
|
79
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
80
|
+
|
|
81
|
+
return subscription;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
85
|
+
const sheet = document.createElement('style');
|
|
86
|
+
|
|
87
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
88
|
+
if (stylingContainer) {
|
|
89
|
+
sheet.innerHTML = data;
|
|
90
|
+
stylingContainer.appendChild(sheet);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
96
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
97
|
+
if (!stylingContainer) return;
|
|
98
|
+
|
|
99
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
100
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
101
|
+
let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
|
|
102
|
+
|
|
103
|
+
if (!cachedStyle) {
|
|
104
|
+
cachedStyle = new CSSStyleSheet();
|
|
105
|
+
cachedStyle.replaceSync(data);
|
|
106
|
+
cacheStyleObject[domain] = {
|
|
107
|
+
sheet: cachedStyle,
|
|
108
|
+
refCount: 1
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
115
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
116
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
122
|
+
const TRANSLATIONS = {
|
|
123
|
+
en: {
|
|
124
|
+
endsIn: 'Ends In',
|
|
125
|
+
expired: 'Expired',
|
|
126
|
+
forfeited: 'Forfeited',
|
|
127
|
+
finished: 'Finished',
|
|
128
|
+
suspended: 'Suspended',
|
|
129
|
+
unavailable: 'Unavailable'
|
|
130
|
+
},
|
|
131
|
+
da: {
|
|
132
|
+
endsIn: 'Ends In',
|
|
133
|
+
expired: 'Expired',
|
|
134
|
+
forfeited: 'Forfeited',
|
|
135
|
+
finished: 'Finished',
|
|
136
|
+
suspended: 'Suspended',
|
|
137
|
+
unavailable: 'Unavailable'
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const translate = (key, customLang) => {
|
|
141
|
+
const lang = customLang;
|
|
142
|
+
return TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
|
|
143
|
+
};
|
|
144
|
+
const getTranslations = (data) => {
|
|
145
|
+
Object.keys(data).forEach((item) => {
|
|
146
|
+
if (!TRANSLATIONS[item]) {
|
|
147
|
+
TRANSLATIONS[item] = {};
|
|
148
|
+
}
|
|
149
|
+
for (let key in data[item]) {
|
|
150
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
const resolveTranslationUrl = async (translationUrl) => {
|
|
155
|
+
if (translationUrl) {
|
|
156
|
+
try {
|
|
157
|
+
const response = await fetch(translationUrl);
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
160
|
+
}
|
|
161
|
+
const translations = await response.json();
|
|
162
|
+
getTranslations(translations);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const rightArrowSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDggMTUiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0wLjUwMTk1MyAxMy44MzUzTDcuMTY4NjIgNy4xNjg2MkwwLjUwMTk1MyAwLjUwMTk1MyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjAwNDU5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==';
|
|
171
|
+
|
|
172
|
+
const leftArrowSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDggMTUiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik03LjE2ODk1IDEzLjgzNTNMMC41MDIyNzggNy4xNjg2Mkw3LjE2ODk1IDAuNTAxOTUzIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjEuMDA0NTkiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
173
|
+
|
|
174
|
+
const casinoChallengesOverlaySliderCss = "@import url(\"https://fonts.googleapis.com/css2?family=Teachers:ital,wght@0,400..800;1,400..800&display=swap\"); .one-slide .challenges__slider{justify-content:center;cursor:pointer;transition:none}.slider-container{position:relative}.challenges__slider-wrapper{overflow:hidden;width:100%}.challenges__slider{display:flex;transition:transform 0.25s ease;will-change:transform;touch-action:pan-y;user-select:none;cursor:grab}.challenges__slider.active{cursor:grabbing}.challenges__slider-dots{display:flex;justify-content:center;margin-top:10px}.challenges__slider-dot{width:7px;height:7px;border-radius:50%;background:var(--emw--dot-button-bg, rgba(255, 255, 255, 0.1490196078));margin:4px;cursor:pointer;transition:0.2s}.challenges__slider-dot.active{width:29px;border-radius:8px;background:var(--emw--dot-button-active-bg, rgba(255, 255, 255, 0.2))}.action-button{position:absolute;top:42%;transform:translateY(-50%);stroke:white;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:2px solid var(--emw--color-container-border, rgba(255, 255, 255, 0.0705882353));background:var(--emw--color-container-background, rgba(9, 9, 9, 0.5019607843));backdrop-filter:blur(9.5px);cursor:pointer}.action-button--prev{left:30px}.action-button--next{right:30px}.mobile .challenges__slider-dot{width:5px;height:5px;margin:2px}.mobile .challenges__slider-dot.active{width:18px}.mobile .challenges__slide__image-wrapper{width:240px;height:122px}.mobile .challenges__slide__title{bottom:8px;left:8px;font-size:var(--emw--font-size-small, 14px);max-width:224px}.mobile .challenges__slide__badge{top:8px;left:8px;font-size:var(--emw--font-size-2x-small, 11px)}.mobile .challenges__slide__badge .status{height:17px}.mobile .action-button{display:none}";
|
|
175
|
+
const CasinoChallengesOverlaySliderStyle0 = casinoChallengesOverlaySliderCss;
|
|
176
|
+
|
|
177
|
+
const CasinoChallengesOverlaySlider = class {
|
|
178
|
+
constructor(hostRef) {
|
|
179
|
+
registerInstance(this, hostRef);
|
|
180
|
+
this.activeChallengeChange = createEvent(this, "activeChallengeChange", 7);
|
|
181
|
+
this.slideGap = 0;
|
|
182
|
+
this.isDragging = false;
|
|
183
|
+
this.startX = 0;
|
|
184
|
+
this.currentTranslate = 0;
|
|
185
|
+
this.baseTranslate = 0;
|
|
186
|
+
this.slideWidthToContainer = 0.57; // 57%
|
|
187
|
+
this.slideHeightToContainer = 0.3; // 30%
|
|
188
|
+
this.next = () => {
|
|
189
|
+
this.currentIndex++;
|
|
190
|
+
this.setPositionByIndex();
|
|
191
|
+
const len = this.challenges.length;
|
|
192
|
+
if (this.currentIndex === len + 1) {
|
|
193
|
+
setTimeout(() => this.scheduleReset(1), 250);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
this.prev = () => {
|
|
197
|
+
this.currentIndex--;
|
|
198
|
+
this.setPositionByIndex();
|
|
199
|
+
const len = this.challenges.length;
|
|
200
|
+
if (this.currentIndex === 0) {
|
|
201
|
+
setTimeout(() => this.scheduleReset(len), 250);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
this.onPointerDown = (e) => {
|
|
205
|
+
var _a;
|
|
206
|
+
if (this.isOneSlide) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.isDragging = true;
|
|
210
|
+
this.startX = e.clientX;
|
|
211
|
+
this.baseTranslate = this.getBaseTranslate();
|
|
212
|
+
(_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.setPointerCapture(e.pointerId);
|
|
213
|
+
};
|
|
214
|
+
this.onPointerMove = (e) => {
|
|
215
|
+
if (!this.isDragging)
|
|
216
|
+
return;
|
|
217
|
+
this.currentTranslate = this.baseTranslate + (e.clientX - this.startX);
|
|
218
|
+
this.setSliderPosition(this.currentTranslate);
|
|
219
|
+
};
|
|
220
|
+
this.onPointerUp = (e) => {
|
|
221
|
+
var _a;
|
|
222
|
+
if (!this.isDragging)
|
|
223
|
+
return;
|
|
224
|
+
this.isDragging = false;
|
|
225
|
+
(_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.releasePointerCapture(e.pointerId);
|
|
226
|
+
const moved = this.currentTranslate - this.getBaseTranslate();
|
|
227
|
+
const threshold = 50;
|
|
228
|
+
if (moved < -threshold)
|
|
229
|
+
this.next();
|
|
230
|
+
else if (moved > threshold)
|
|
231
|
+
this.prev();
|
|
232
|
+
else
|
|
233
|
+
this.setPositionByIndex();
|
|
234
|
+
};
|
|
235
|
+
this.mbSource = undefined;
|
|
236
|
+
this.clientStyling = undefined;
|
|
237
|
+
this.clientStylingUrl = undefined;
|
|
238
|
+
this.translationUrl = '';
|
|
239
|
+
this.language = 'en';
|
|
240
|
+
this.isMobile = false;
|
|
241
|
+
this.challenges = undefined;
|
|
242
|
+
this.initialProgressId = '';
|
|
243
|
+
this.activeTabIndex = '';
|
|
244
|
+
this.currentIndex = null;
|
|
245
|
+
this.slideWidth = 0;
|
|
246
|
+
this.slideHeight = 0;
|
|
247
|
+
this.isOneSlide = false;
|
|
248
|
+
}
|
|
249
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
250
|
+
if (newValue != oldValue) {
|
|
251
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
255
|
+
if (newValue != oldValue) {
|
|
256
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
260
|
+
if (newValue != oldValue) {
|
|
261
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
onCurrentIndexChange(newValue, oldValue) {
|
|
265
|
+
if (oldValue !== null && newValue !== oldValue && newValue > 0) {
|
|
266
|
+
const activeChallenge = this.challenges[newValue - 1];
|
|
267
|
+
this.activeChallengeChange.emit(activeChallenge === null || activeChallenge === void 0 ? void 0 : activeChallenge.Id);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
onChallengesChange(newValue) {
|
|
271
|
+
this.isOneSlide = newValue.length === 1;
|
|
272
|
+
}
|
|
273
|
+
onInitialProgressIdChange(newValue, oldValue) {
|
|
274
|
+
if (newValue != oldValue) {
|
|
275
|
+
this.updateCurrentIndex();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
componentWillLoad() {
|
|
279
|
+
if (this.translationUrl) {
|
|
280
|
+
resolveTranslationUrl(this.translationUrl);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
componentDidLoad() {
|
|
284
|
+
var _a;
|
|
285
|
+
this.isOneSlide = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) === 1;
|
|
286
|
+
this.resizeObserver = new ResizeObserver(([entry]) => {
|
|
287
|
+
this.slideWidth = Math.round(entry.contentRect.width * this.slideWidthToContainer);
|
|
288
|
+
this.slideHeight = Math.round(entry.contentRect.width * this.slideHeightToContainer);
|
|
289
|
+
if (!this.isOneSlide) {
|
|
290
|
+
this.setPositionByIndex();
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
if (this.stylingContainer) {
|
|
294
|
+
if (this.mbSource)
|
|
295
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
296
|
+
if (this.clientStyling)
|
|
297
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
298
|
+
if (this.clientStylingUrl)
|
|
299
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
300
|
+
this.resizeObserver.observe(this.stylingContainer);
|
|
301
|
+
}
|
|
302
|
+
this.updateCurrentIndex();
|
|
303
|
+
}
|
|
304
|
+
disconnectedCallback() {
|
|
305
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
306
|
+
this.resizeObserver && this.resizeObserver.disconnect();
|
|
307
|
+
}
|
|
308
|
+
updateCurrentIndex() {
|
|
309
|
+
if (this.isOneSlide) {
|
|
310
|
+
this.currentIndex = 0;
|
|
311
|
+
this.setSliderPosition(0);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
requestAnimationFrame(() => {
|
|
315
|
+
var _a;
|
|
316
|
+
const index = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.findIndex((challenge) => (challenge === null || challenge === void 0 ? void 0 : challenge.Id) === this.initialProgressId)) || 0;
|
|
317
|
+
this.currentIndex = index + 1;
|
|
318
|
+
this.setPositionByIndex(false);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
setSliderPosition(value) {
|
|
323
|
+
if (!this.sliderContainer)
|
|
324
|
+
return;
|
|
325
|
+
this.sliderContainer.style.transform = `translateX(${value}px)`;
|
|
326
|
+
}
|
|
327
|
+
getCarouselItems() {
|
|
328
|
+
const items = this.challenges;
|
|
329
|
+
if (items.length <= 1)
|
|
330
|
+
return items;
|
|
331
|
+
return [items[items.length - 1], ...items, items[0]];
|
|
332
|
+
}
|
|
333
|
+
scheduleReset(index) {
|
|
334
|
+
if (!this.sliderContainer)
|
|
335
|
+
return;
|
|
336
|
+
requestAnimationFrame(() => {
|
|
337
|
+
requestAnimationFrame(() => {
|
|
338
|
+
const el = this.sliderContainer;
|
|
339
|
+
el.style.transition = 'none';
|
|
340
|
+
this.currentIndex = index;
|
|
341
|
+
this.setPositionByIndex(false);
|
|
342
|
+
requestAnimationFrame(() => {
|
|
343
|
+
el.style.transition = '';
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
setPositionByIndex(withTransition = true) {
|
|
349
|
+
if (!this.sliderContainer)
|
|
350
|
+
return;
|
|
351
|
+
const gap = this.slideGap;
|
|
352
|
+
const offset = (this.sliderContainer.clientWidth - this.slideWidth) / 2;
|
|
353
|
+
this.currentTranslate = -(this.slideWidth + gap) * this.currentIndex + offset;
|
|
354
|
+
if (!withTransition) {
|
|
355
|
+
this.disableTransition();
|
|
356
|
+
}
|
|
357
|
+
this.setSliderPosition(this.currentTranslate);
|
|
358
|
+
}
|
|
359
|
+
getBaseTranslate() {
|
|
360
|
+
var _a, _b;
|
|
361
|
+
const slide = (_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.querySelector('.challenges__slide');
|
|
362
|
+
const wrapper = (_b = this.sliderContainer) === null || _b === void 0 ? void 0 : _b.parentElement;
|
|
363
|
+
if (!slide || !wrapper)
|
|
364
|
+
return 0;
|
|
365
|
+
const slideWidth = slide.clientWidth;
|
|
366
|
+
const gap = this.slideGap;
|
|
367
|
+
const offset = (wrapper.clientWidth - slideWidth) / 2;
|
|
368
|
+
return -(slideWidth + gap) * this.currentIndex + offset;
|
|
369
|
+
}
|
|
370
|
+
disableTransition() {
|
|
371
|
+
if (!this.sliderContainer)
|
|
372
|
+
return;
|
|
373
|
+
this.sliderContainer.style.transition = 'none';
|
|
374
|
+
requestAnimationFrame(() => {
|
|
375
|
+
this.sliderContainer.style.transition = '';
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
goToSlide(index) {
|
|
379
|
+
this.currentIndex = index + 1;
|
|
380
|
+
this.setPositionByIndex();
|
|
381
|
+
}
|
|
382
|
+
getRealIndex() {
|
|
383
|
+
const len = this.challenges.length;
|
|
384
|
+
if (this.currentIndex === 0)
|
|
385
|
+
return len - 1;
|
|
386
|
+
if (this.currentIndex === len + 1)
|
|
387
|
+
return 0;
|
|
388
|
+
return this.currentIndex - 1;
|
|
389
|
+
}
|
|
390
|
+
render() {
|
|
391
|
+
return (h("div", { key: '25e34524b9a1fb6fcd4b164f5f3d58a58173ed09', class: { 'slider-container': true, mobile: this.isMobile, 'one-slide': this.isOneSlide }, ref: (el) => (this.stylingContainer = el) }, h("div", { key: '1f77218efd7201eb0de40405d7128168d5bb2a64', class: "challenges__slider-wrapper", onPointerDown: this.onPointerDown, onPointerMove: this.onPointerMove, onPointerUp: this.onPointerUp, onPointerLeave: this.onPointerUp }, h("div", { key: '623e0d69197edea0a4a01a670bc678e2c99af735', class: "challenges__slider", ref: (el) => (this.sliderContainer = el) }, this.getCarouselItems().map((item, index, arr) => (h("casino-challenges-overlay-card", { challenge: item, index: index, arrLength: arr.length, currentIndex: this.currentIndex, slideWidth: this.slideWidth, slideHeight: this.slideHeight }))))), this.challenges.length > 1 && (h("div", { key: 'ffc80e15f608761c6b830dd6f8ed19ebf7a2498e' }, h("button", { key: '0403fb4615605c33ef596c74ae2427b5e823b7d9', class: "action-button action-button--prev", onClick: this.prev }, h("img", { key: 'de3536ec00f15de6240d3c7da032b9584fffbc92', src: leftArrowSvg, alt: "" })), h("button", { key: '84cc6967ded946264bde8db938c8e5541ace145c', class: "action-button action-button--next", onClick: this.next }, h("img", { key: 'f6e8d44662f3ca55866001d90d41f66c4a5f6f04', src: rightArrowSvg, alt: "" })), h("div", { key: '25124a8bb6d0fc72086e69e20b6fc2f41986999e', class: "challenges__slider-dots" }, this.challenges.map((_, i) => (h("span", { class: {
|
|
392
|
+
'challenges__slider-dot': true,
|
|
393
|
+
active: i === this.getRealIndex()
|
|
394
|
+
}, onClick: () => {
|
|
395
|
+
this.goToSlide(i);
|
|
396
|
+
} }))))))));
|
|
397
|
+
}
|
|
398
|
+
static get watchers() { return {
|
|
399
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
400
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
401
|
+
"mbSource": ["handleMbSourceChange"],
|
|
402
|
+
"currentIndex": ["onCurrentIndexChange"],
|
|
403
|
+
"challenges": ["onChallengesChange"],
|
|
404
|
+
"initialProgressId": ["onInitialProgressIdChange"]
|
|
405
|
+
}; }
|
|
406
|
+
};
|
|
407
|
+
CasinoChallengesOverlaySlider.style = CasinoChallengesOverlaySliderStyle0;
|
|
408
|
+
|
|
409
|
+
export { CasinoChallengesOverlaySlider as C, translate as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-9e63661c.js';
|
|
2
|
+
export { s as setNonce } from './index-9e63661c.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
var patchBrowser = () => {
|
|
9
|
+
const importMeta = import.meta.url;
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== "") {
|
|
12
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(async (options) => {
|
|
18
|
+
await globalScripts();
|
|
19
|
+
return bootstrapLazy([["casino-challenges-overlay-card_2",[[1,"casino-challenges-overlay-slider",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"isMobile":[516,"is-mobile"],"challenges":[16],"initialProgressId":[1,"initial-progress-id"],"activeTabIndex":[1,"active-tab-index"],"currentIndex":[32],"slideWidth":[32],"slideHeight":[32],"isOneSlide":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"currentIndex":["onCurrentIndexChange"],"challenges":["onChallengesChange"],"initialProgressId":["onInitialProgressIdChange"]}],[0,"casino-challenges-overlay-card",{"challenge":[16],"index":[2],"arrLength":[2,"arr-length"],"currentIndex":[2,"current-index"],"language":[1],"isOptedOut":[4,"is-opted-out"],"slideWidth":[2,"slide-width"],"slideHeight":[2,"slide-height"],"timeLeft":[32]}]]]], options);
|
|
20
|
+
});
|