@everymatrix/general-tutorial-slider 1.54.12 → 1.56.0
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-tutorial-slider.cjs.entry.js +83 -29
- package/dist/cjs/general-tutorial-slider.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.js +49 -29
- package/dist/esm/general-tutorial-slider.entry.js +83 -29
- package/dist/esm/general-tutorial-slider.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/general-tutorial-slider/general-tutorial-slider.esm.js +1 -1
- package/dist/general-tutorial-slider/p-d3024419.entry.js +1 -0
- package/dist/types/components/general-tutorial-slider/general-tutorial-slider.d.ts +7 -3
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/general-tutorial-slider/p-a5407119.entry.js +0 -1
|
@@ -44,6 +44,63 @@ const translate = (key, customLang) => {
|
|
|
44
44
|
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @name setClientStyling
|
|
49
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
50
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
51
|
+
* @param {string} clientStyling The style content
|
|
52
|
+
*/
|
|
53
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
54
|
+
if (stylingContainer) {
|
|
55
|
+
const sheet = document.createElement('style');
|
|
56
|
+
sheet.innerHTML = clientStyling;
|
|
57
|
+
stylingContainer.appendChild(sheet);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @name setClientStylingURL
|
|
63
|
+
* @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
|
|
64
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
65
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
66
|
+
*/
|
|
67
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
68
|
+
const url = new URL(clientStylingUrl);
|
|
69
|
+
|
|
70
|
+
fetch(url.href)
|
|
71
|
+
.then((res) => res.text())
|
|
72
|
+
.then((data) => {
|
|
73
|
+
const cssFile = document.createElement('style');
|
|
74
|
+
cssFile.innerHTML = data;
|
|
75
|
+
if (stylingContainer) {
|
|
76
|
+
stylingContainer.appendChild(cssFile);
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
.catch((err) => {
|
|
80
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @name setStreamLibrary
|
|
86
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
87
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
88
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
89
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
90
|
+
*/
|
|
91
|
+
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
92
|
+
if (window.emMessageBus) {
|
|
93
|
+
const sheet = document.createElement('style');
|
|
94
|
+
|
|
95
|
+
window.emMessageBus.subscribe(domain, (data) => {
|
|
96
|
+
sheet.innerHTML = data;
|
|
97
|
+
if (stylingContainer) {
|
|
98
|
+
stylingContainer.appendChild(sheet);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
47
104
|
/**
|
|
48
105
|
* @name isMobile
|
|
49
106
|
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
@@ -139,7 +196,6 @@ const GeneralTutorialSlider = class {
|
|
|
139
196
|
*/
|
|
140
197
|
this.itemsPerPage = 1;
|
|
141
198
|
this.hasErrors = false;
|
|
142
|
-
this.limitStylingAppends = false;
|
|
143
199
|
this.isLoading = true;
|
|
144
200
|
this.activeIndex = 0;
|
|
145
201
|
this.tutorialElementWidth = 0;
|
|
@@ -156,24 +212,6 @@ const GeneralTutorialSlider = class {
|
|
|
156
212
|
this.recalculateItemsPerPage();
|
|
157
213
|
}, 10);
|
|
158
214
|
};
|
|
159
|
-
this.setClientStyling = () => {
|
|
160
|
-
let sheet = document.createElement('style');
|
|
161
|
-
sheet.innerHTML = this.clientStyling;
|
|
162
|
-
this.stylingContainer.prepend(sheet);
|
|
163
|
-
};
|
|
164
|
-
this.setClientStylingURL = () => {
|
|
165
|
-
let url = new URL(this.clientStylingUrl);
|
|
166
|
-
let cssFile = document.createElement('style');
|
|
167
|
-
fetch(url.href)
|
|
168
|
-
.then((res) => res.text())
|
|
169
|
-
.then((data) => {
|
|
170
|
-
cssFile.innerHTML = data;
|
|
171
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
172
|
-
})
|
|
173
|
-
.catch((err) => {
|
|
174
|
-
console.log('error ', err);
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
215
|
}
|
|
178
216
|
watchEndpoint(newValue, oldValue) {
|
|
179
217
|
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
@@ -182,6 +220,17 @@ const GeneralTutorialSlider = class {
|
|
|
182
220
|
});
|
|
183
221
|
}
|
|
184
222
|
}
|
|
223
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
224
|
+
if (newValue != oldValue) {
|
|
225
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
handleClientStylingChangeURL(newValue, oldValue) {
|
|
229
|
+
if (newValue != oldValue) {
|
|
230
|
+
if (this.clientStylingUrl)
|
|
231
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
185
234
|
connectedCallback() {
|
|
186
235
|
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
187
236
|
}
|
|
@@ -194,20 +243,22 @@ const GeneralTutorialSlider = class {
|
|
|
194
243
|
}
|
|
195
244
|
componentDidLoad() {
|
|
196
245
|
window.addEventListener('resize', this.resizeHandler);
|
|
246
|
+
if (this.stylingContainer) {
|
|
247
|
+
if (window.emMessageBus != undefined) {
|
|
248
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
if (this.clientStyling)
|
|
252
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
253
|
+
if (this.clientStylingUrl)
|
|
254
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
197
257
|
}
|
|
198
258
|
componentDidRender() {
|
|
199
259
|
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
200
260
|
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
201
261
|
this.recalculateItemsPerPage();
|
|
202
|
-
// start custom styling area
|
|
203
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
204
|
-
if (this.clientStyling)
|
|
205
|
-
this.setClientStyling();
|
|
206
|
-
if (this.clientStylingUrl)
|
|
207
|
-
this.setClientStylingURL();
|
|
208
|
-
this.limitStylingAppends = true;
|
|
209
|
-
}
|
|
210
|
-
// end custom styling area
|
|
211
262
|
}
|
|
212
263
|
componentDidUpdate() {
|
|
213
264
|
this.recalculateItemsPerPage();
|
|
@@ -217,6 +268,7 @@ const GeneralTutorialSlider = class {
|
|
|
217
268
|
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
218
269
|
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
219
270
|
window.removeEventListener('resize', this.resizeHandler);
|
|
271
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
220
272
|
}
|
|
221
273
|
getGeneralTutorialSlider() {
|
|
222
274
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
|
|
@@ -336,7 +388,9 @@ const GeneralTutorialSlider = class {
|
|
|
336
388
|
get el() { return index.getElement(this); }
|
|
337
389
|
static get watchers() { return {
|
|
338
390
|
"cmsEndpoint": ["watchEndpoint"],
|
|
339
|
-
"language": ["watchEndpoint"]
|
|
391
|
+
"language": ["watchEndpoint"],
|
|
392
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
393
|
+
"clientStylingUrl": ["handleClientStylingChangeURL"]
|
|
340
394
|
}; }
|
|
341
395
|
};
|
|
342
396
|
GeneralTutorialSlider.style = GeneralTutorialSliderStyle0;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"
|
|
22
|
+
return index.bootstrapLazy([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"
|
|
11
|
+
return index.bootstrapLazy([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
4
|
import { isMobile, getDevicePlatform } from "../../utils/utils";
|
|
4
5
|
export class GeneralTutorialSlider {
|
|
5
6
|
constructor() {
|
|
@@ -52,7 +53,6 @@ export class GeneralTutorialSlider {
|
|
|
52
53
|
*/
|
|
53
54
|
this.itemsPerPage = 1;
|
|
54
55
|
this.hasErrors = false;
|
|
55
|
-
this.limitStylingAppends = false;
|
|
56
56
|
this.isLoading = true;
|
|
57
57
|
this.activeIndex = 0;
|
|
58
58
|
this.tutorialElementWidth = 0;
|
|
@@ -69,24 +69,6 @@ export class GeneralTutorialSlider {
|
|
|
69
69
|
this.recalculateItemsPerPage();
|
|
70
70
|
}, 10);
|
|
71
71
|
};
|
|
72
|
-
this.setClientStyling = () => {
|
|
73
|
-
let sheet = document.createElement('style');
|
|
74
|
-
sheet.innerHTML = this.clientStyling;
|
|
75
|
-
this.stylingContainer.prepend(sheet);
|
|
76
|
-
};
|
|
77
|
-
this.setClientStylingURL = () => {
|
|
78
|
-
let url = new URL(this.clientStylingUrl);
|
|
79
|
-
let cssFile = document.createElement('style');
|
|
80
|
-
fetch(url.href)
|
|
81
|
-
.then((res) => res.text())
|
|
82
|
-
.then((data) => {
|
|
83
|
-
cssFile.innerHTML = data;
|
|
84
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
85
|
-
})
|
|
86
|
-
.catch((err) => {
|
|
87
|
-
console.log('error ', err);
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
72
|
}
|
|
91
73
|
watchEndpoint(newValue, oldValue) {
|
|
92
74
|
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
@@ -95,6 +77,17 @@ export class GeneralTutorialSlider {
|
|
|
95
77
|
});
|
|
96
78
|
}
|
|
97
79
|
}
|
|
80
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
81
|
+
if (newValue != oldValue) {
|
|
82
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
handleClientStylingChangeURL(newValue, oldValue) {
|
|
86
|
+
if (newValue != oldValue) {
|
|
87
|
+
if (this.clientStylingUrl)
|
|
88
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
98
91
|
connectedCallback() {
|
|
99
92
|
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
100
93
|
}
|
|
@@ -107,20 +100,22 @@ export class GeneralTutorialSlider {
|
|
|
107
100
|
}
|
|
108
101
|
componentDidLoad() {
|
|
109
102
|
window.addEventListener('resize', this.resizeHandler);
|
|
103
|
+
if (this.stylingContainer) {
|
|
104
|
+
if (window.emMessageBus != undefined) {
|
|
105
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (this.clientStyling)
|
|
109
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
110
|
+
if (this.clientStylingUrl)
|
|
111
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
componentDidRender() {
|
|
112
116
|
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
113
117
|
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
114
118
|
this.recalculateItemsPerPage();
|
|
115
|
-
// start custom styling area
|
|
116
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
117
|
-
if (this.clientStyling)
|
|
118
|
-
this.setClientStyling();
|
|
119
|
-
if (this.clientStylingUrl)
|
|
120
|
-
this.setClientStylingURL();
|
|
121
|
-
this.limitStylingAppends = true;
|
|
122
|
-
}
|
|
123
|
-
// end custom styling area
|
|
124
119
|
}
|
|
125
120
|
componentDidUpdate() {
|
|
126
121
|
this.recalculateItemsPerPage();
|
|
@@ -130,6 +125,7 @@ export class GeneralTutorialSlider {
|
|
|
130
125
|
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
131
126
|
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
132
127
|
window.removeEventListener('resize', this.resizeHandler);
|
|
128
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
133
129
|
}
|
|
134
130
|
getGeneralTutorialSlider() {
|
|
135
131
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
|
|
@@ -260,6 +256,25 @@ export class GeneralTutorialSlider {
|
|
|
260
256
|
}
|
|
261
257
|
static get properties() {
|
|
262
258
|
return {
|
|
259
|
+
"mbSource": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "string",
|
|
264
|
+
"resolved": "string",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Client custom styling via streamStyling"
|
|
272
|
+
},
|
|
273
|
+
"getter": false,
|
|
274
|
+
"setter": false,
|
|
275
|
+
"attribute": "mb-source",
|
|
276
|
+
"reflect": false
|
|
277
|
+
},
|
|
263
278
|
"clientStyling": {
|
|
264
279
|
"type": "string",
|
|
265
280
|
"mutable": false,
|
|
@@ -524,7 +539,6 @@ export class GeneralTutorialSlider {
|
|
|
524
539
|
static get states() {
|
|
525
540
|
return {
|
|
526
541
|
"hasErrors": {},
|
|
527
|
-
"limitStylingAppends": {},
|
|
528
542
|
"isLoading": {},
|
|
529
543
|
"activeIndex": {},
|
|
530
544
|
"tutorialElementWidth": {}
|
|
@@ -538,6 +552,12 @@ export class GeneralTutorialSlider {
|
|
|
538
552
|
}, {
|
|
539
553
|
"propName": "language",
|
|
540
554
|
"methodName": "watchEndpoint"
|
|
555
|
+
}, {
|
|
556
|
+
"propName": "clientStyling",
|
|
557
|
+
"methodName": "handleClientStylingChange"
|
|
558
|
+
}, {
|
|
559
|
+
"propName": "clientStylingUrl",
|
|
560
|
+
"methodName": "handleClientStylingChangeURL"
|
|
541
561
|
}];
|
|
542
562
|
}
|
|
543
563
|
}
|
|
@@ -40,6 +40,63 @@ const translate = (key, customLang) => {
|
|
|
40
40
|
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @name setClientStyling
|
|
45
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
46
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
47
|
+
* @param {string} clientStyling The style content
|
|
48
|
+
*/
|
|
49
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
50
|
+
if (stylingContainer) {
|
|
51
|
+
const sheet = document.createElement('style');
|
|
52
|
+
sheet.innerHTML = clientStyling;
|
|
53
|
+
stylingContainer.appendChild(sheet);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @name setClientStylingURL
|
|
59
|
+
* @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
|
|
60
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
61
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
62
|
+
*/
|
|
63
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
64
|
+
const url = new URL(clientStylingUrl);
|
|
65
|
+
|
|
66
|
+
fetch(url.href)
|
|
67
|
+
.then((res) => res.text())
|
|
68
|
+
.then((data) => {
|
|
69
|
+
const cssFile = document.createElement('style');
|
|
70
|
+
cssFile.innerHTML = data;
|
|
71
|
+
if (stylingContainer) {
|
|
72
|
+
stylingContainer.appendChild(cssFile);
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @name setStreamLibrary
|
|
82
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
83
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
84
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
85
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
86
|
+
*/
|
|
87
|
+
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
88
|
+
if (window.emMessageBus) {
|
|
89
|
+
const sheet = document.createElement('style');
|
|
90
|
+
|
|
91
|
+
window.emMessageBus.subscribe(domain, (data) => {
|
|
92
|
+
sheet.innerHTML = data;
|
|
93
|
+
if (stylingContainer) {
|
|
94
|
+
stylingContainer.appendChild(sheet);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
43
100
|
/**
|
|
44
101
|
* @name isMobile
|
|
45
102
|
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
@@ -135,7 +192,6 @@ const GeneralTutorialSlider = class {
|
|
|
135
192
|
*/
|
|
136
193
|
this.itemsPerPage = 1;
|
|
137
194
|
this.hasErrors = false;
|
|
138
|
-
this.limitStylingAppends = false;
|
|
139
195
|
this.isLoading = true;
|
|
140
196
|
this.activeIndex = 0;
|
|
141
197
|
this.tutorialElementWidth = 0;
|
|
@@ -152,24 +208,6 @@ const GeneralTutorialSlider = class {
|
|
|
152
208
|
this.recalculateItemsPerPage();
|
|
153
209
|
}, 10);
|
|
154
210
|
};
|
|
155
|
-
this.setClientStyling = () => {
|
|
156
|
-
let sheet = document.createElement('style');
|
|
157
|
-
sheet.innerHTML = this.clientStyling;
|
|
158
|
-
this.stylingContainer.prepend(sheet);
|
|
159
|
-
};
|
|
160
|
-
this.setClientStylingURL = () => {
|
|
161
|
-
let url = new URL(this.clientStylingUrl);
|
|
162
|
-
let cssFile = document.createElement('style');
|
|
163
|
-
fetch(url.href)
|
|
164
|
-
.then((res) => res.text())
|
|
165
|
-
.then((data) => {
|
|
166
|
-
cssFile.innerHTML = data;
|
|
167
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
168
|
-
})
|
|
169
|
-
.catch((err) => {
|
|
170
|
-
console.log('error ', err);
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
211
|
}
|
|
174
212
|
watchEndpoint(newValue, oldValue) {
|
|
175
213
|
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
@@ -178,6 +216,17 @@ const GeneralTutorialSlider = class {
|
|
|
178
216
|
});
|
|
179
217
|
}
|
|
180
218
|
}
|
|
219
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
220
|
+
if (newValue != oldValue) {
|
|
221
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
handleClientStylingChangeURL(newValue, oldValue) {
|
|
225
|
+
if (newValue != oldValue) {
|
|
226
|
+
if (this.clientStylingUrl)
|
|
227
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
181
230
|
connectedCallback() {
|
|
182
231
|
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
183
232
|
}
|
|
@@ -190,20 +239,22 @@ const GeneralTutorialSlider = class {
|
|
|
190
239
|
}
|
|
191
240
|
componentDidLoad() {
|
|
192
241
|
window.addEventListener('resize', this.resizeHandler);
|
|
242
|
+
if (this.stylingContainer) {
|
|
243
|
+
if (window.emMessageBus != undefined) {
|
|
244
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
if (this.clientStyling)
|
|
248
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
249
|
+
if (this.clientStylingUrl)
|
|
250
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
193
253
|
}
|
|
194
254
|
componentDidRender() {
|
|
195
255
|
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
196
256
|
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
197
257
|
this.recalculateItemsPerPage();
|
|
198
|
-
// start custom styling area
|
|
199
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
200
|
-
if (this.clientStyling)
|
|
201
|
-
this.setClientStyling();
|
|
202
|
-
if (this.clientStylingUrl)
|
|
203
|
-
this.setClientStylingURL();
|
|
204
|
-
this.limitStylingAppends = true;
|
|
205
|
-
}
|
|
206
|
-
// end custom styling area
|
|
207
258
|
}
|
|
208
259
|
componentDidUpdate() {
|
|
209
260
|
this.recalculateItemsPerPage();
|
|
@@ -213,6 +264,7 @@ const GeneralTutorialSlider = class {
|
|
|
213
264
|
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
214
265
|
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
215
266
|
window.removeEventListener('resize', this.resizeHandler);
|
|
267
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
216
268
|
}
|
|
217
269
|
getGeneralTutorialSlider() {
|
|
218
270
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
|
|
@@ -332,7 +384,9 @@ const GeneralTutorialSlider = class {
|
|
|
332
384
|
get el() { return getElement(this); }
|
|
333
385
|
static get watchers() { return {
|
|
334
386
|
"cmsEndpoint": ["watchEndpoint"],
|
|
335
|
-
"language": ["watchEndpoint"]
|
|
387
|
+
"language": ["watchEndpoint"],
|
|
388
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
389
|
+
"clientStylingUrl": ["handleClientStylingChangeURL"]
|
|
336
390
|
}; }
|
|
337
391
|
};
|
|
338
392
|
GeneralTutorialSlider.style = GeneralTutorialSliderStyle0;
|
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["general-tutorial-slider",[[1,"general-tutorial-slider",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"
|
|
19
|
+
return bootstrapLazy([["general-tutorial-slider",[[1,"general-tutorial-slider",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
20
20
|
});
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["general-tutorial-slider",[[1,"general-tutorial-slider",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"
|
|
8
|
+
return bootstrapLazy([["general-tutorial-slider",[[1,"general-tutorial-slider",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as
|
|
1
|
+
import{p as e,b as l}from"./p-e2d02089.js";export{s as setNonce}from"./p-e2d02089.js";import{g as t}from"./p-e1255160.js";(()=>{const l=import.meta.url,s={};return""!==l&&(s.resourcesUrl=new URL(".",l).href),e(s)})().then((async e=>(await t(),l([["p-d3024419",[[1,"general-tutorial-slider",{mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[513],cmsEndpoint:[513,"cms-endpoint"],userRoles:[513,"user-roles"],cmsEnv:[513,"cms-env"],showSliderDots:[516,"show-slider-dots"],showSliderArrows:[516,"show-slider-arrows"],showSliderArrowsMobile:[516,"show-slider-arrows-mobile"],enableAutoScroll:[516,"enable-auto-scroll"],intervalPeriod:[514,"interval-period"],scrollItems:[520,"scroll-items"],itemsPerPage:[514,"items-per-page"],hasErrors:[32],isLoading:[32],activeIndex:[32],tutorialElementWidth:[32]},null,{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}]]]],e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as n,g as i}from"./p-e2d02089.js";const e={en:{error:"Error",noResults:"Loading, please wait ..."},hu:{error:"Error",noResults:"Loading, please wait ..."},ro:{error:"Eroare",noResults:"Loading, please wait ..."},fr:{error:"Error",noResults:"Loading, please wait ..."},ar:{error:"خطأ",noResults:"Loading, please wait ..."},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ..."},"es-mx":{error:"Error",noResults:"Cargando, espere por favor…"},"pt-br":{error:"Erro",noResults:"Carregando, espere por favor…"}};function o(t,n){if(t){const i=document.createElement("style");i.innerHTML=n,t.appendChild(i)}}function s(t,n){const i=new URL(n);fetch(i.href).then((t=>t.text())).then((n=>{const i=document.createElement("style");i.innerHTML=n,t&&t.appendChild(i)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const r=class{constructor(n){var i;t(this,n),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.showSliderDots=!0,this.showSliderArrows=!0,this.showSliderArrowsMobile=!1,this.enableAutoScroll=!1,this.intervalPeriod=5e3,this.scrollItems=1,this.itemsPerPage=1,this.hasErrors=!1,this.isLoading=!0,this.activeIndex=0,this.tutorialElementWidth=0,this.userAgent=window.navigator.userAgent,this.isMobile=!!((i=this.userAgent).toLowerCase().match(/android/i)||i.toLowerCase().match(/blackberry|bb/i)||i.toLowerCase().match(/iphone|ipad|ipod/i)||i.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.allElementsWidth=0,this.xDown=null,this.yDown=null,this.resizeHandler=()=>{this.recalculateItemsPerPage()},this.orientationChangeHandler=()=>{setTimeout((()=>{this.recalculateItemsPerPage()}),10)}}watchEndpoint(t,n){t&&t!=n&&this.cmsEndpoint&&this.getGeneralTutorialSlider().then((t=>{this.tutorialData=t}))}handleClientStylingChange(t,n){t!=n&&o(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,n){t!=n&&this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)}connectedCallback(){window.screen.orientation.addEventListener("change",this.orientationChangeHandler)}componentWillLoad(){if(this.cmsEndpoint&&this.language)return this.getGeneralTutorialSlider().then((t=>{this.tutorialData=t}))}componentDidLoad(){window.addEventListener("resize",this.resizeHandler),this.stylingContainer&&(null!=window.emMessageBus?function(t,n){if(window.emMessageBus){const i=document.createElement("style");window.emMessageBus.subscribe(n,(n=>{i.innerHTML=n,t&&t.appendChild(i)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)))}componentDidRender(){this.el.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!0}),this.el.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!0}),this.recalculateItemsPerPage()}componentDidUpdate(){this.recalculateItemsPerPage()}disconnectedCallback(){this.el.removeEventListener("touchstart",this.handleTouchStart),this.el.removeEventListener("touchmove",this.handleTouchMove),window.screen.orientation.removeEventListener("change",this.orientationChangeHandler),window.removeEventListener("resize",this.resizeHandler),this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getGeneralTutorialSlider(){let t=new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"iPad"===t||"iPhone"===t?"ios":"mtWeb"})()),new Promise(((n,i)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{n(t)})).catch((t=>{console.error(t),this.hasErrors=!0,i(t)})).finally((()=>{this.isLoading=!1}))}))}move(t){this.setActive(this.activeIndex+t)}recalculateItemsPerPage(){this.tutorialsElement&&(this.tutorialElementWidth=this.tutorialsElement.clientWidth,this.allElementsWidth=(this.tutorialData.length-1)*this.tutorialElementWidth)}goTo(t){let n=this.activeIndex-t;if(n>0)for(let t=0;t<n;t++)this.move(-1);else for(let t=0;t>n;t--)this.move(1)}handleTouchStart(t){const n=this.getTouches(t)[0];this.xDown=n.clientX,this.yDown=n.clientY}getTouches(t){return t.touches||t.originalEvent.touches}handleTouchMove(t){if(!this.xDown||!this.yDown)return;let n=this.xDown-t.touches[0].clientX,i=this.yDown-t.touches[0].clientY;Math.abs(n)>Math.abs(i)&&this.move(n>0?1:-1),this.xDown=null,this.yDown=null}setActive(t){const n=this.tutorialData.length;this.activeIndex=t>=0?t>=n-1?n-1:t:0}renderDots(){const t=[];for(let i=0;i<this.tutorialData.length/this.itemsPerPage;i++)t.push(n("li",{class:i==this.activeIndex?"active":"default",onClick:()=>{this.goTo(i),this.setActive(i)}}));return t}render(){const t={transform:`translate(${this.allElementsWidth/(this.tutorialData.length-1)*this.activeIndex*-1}px, 0px)`},i={width:this.tutorialElementWidth/this.itemsPerPage+"px"};return this.hasErrors?n("div",{class:"GeneralTutorialSliderError"},n("div",{class:"TitleError"},e[void 0!==(o=this.language)&&o in e?o:"en"].error)):this.isLoading?void 0:n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"TutorialWrapper"},n("div",{class:"TutorialContent",ref:t=>this.slider=t},(this.showSliderArrows&&!this.isMobile||this.showSliderArrowsMobile&&this.isMobile)&&n("div",{class:0===this.activeIndex?"SliderNavButton DisabledArrow":"SliderNavButton",onClick:()=>this.move(-1)},n("svg",{fill:"none",stroke:"var(--emw--color-secondary, #FD2839)",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"}))),n("main",null,n("div",{style:t,ref:t=>this.tutorialsElement=t,class:"TutorialItems"},this.tutorialData.map((t=>{var e,o,s,r,l,a,d,h,c,u,p,v,m,g,w,f,x,y;return n("div",{class:"TutorialItem",style:i},n("div",{class:"ItemTitle",innerHTML:null==t?void 0:t.title}),(null===(e=null==t?void 0:t.media)||void 0===e?void 0:e.images)?n("div",{class:"ItemImage"},n("img",this.isMobile?{src:null===(l=null===(r=null===(s=null===(o=null==t?void 0:t.media)||void 0===o?void 0:o.images[0])||void 0===s?void 0:s.sources)||void 0===r?void 0:r.find((t=>"mobile"===t.media)))||void 0===l?void 0:l.src,alt:null==t?void 0:t.slug}:{src:null===(c=null===(h=null===(d=null===(a=null==t?void 0:t.media)||void 0===a?void 0:a.images[0])||void 0===d?void 0:d.sources)||void 0===h?void 0:h.find((t=>"desktop"===t.media)))||void 0===c?void 0:c.src,alt:null==t?void 0:t.slug})):(null===(u=null==t?void 0:t.media)||void 0===u?void 0:u.video)?n("div",{class:"ItemImage"},n("video",{controls:!0,loop:!0,autoplay:!0},n("source",this.isMobile?{src:null===(g=null===(m=null===(v=null===(p=null==t?void 0:t.media)||void 0===p?void 0:p.video[0])||void 0===v?void 0:v.sources)||void 0===m?void 0:m.find((t=>"mobile"===t.media)))||void 0===g?void 0:g.src,type:"video/mp4"}:{src:null===(y=null===(x=null===(f=null===(w=null==t?void 0:t.media)||void 0===w?void 0:w.video[0])||void 0===f?void 0:f.sources)||void 0===x?void 0:x.find((t=>"desktop"===t.media)))||void 0===y?void 0:y.src,type:"video/mp4"}))):null,n("div",{class:"ItemDescription",innerHTML:null==t?void 0:t.content}))})))),(this.showSliderArrows&&!this.isMobile||this.showSliderArrowsMobile&&this.isMobile)&&n("div",{class:this.activeIndex===this.tutorialData.length-1?" SliderNavButton DisabledArrow disabled":"SliderNavButton",onClick:()=>this.move(1)},n("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"}))),n("div",null)),this.showSliderDots&&n("div",{class:"DotsWrapper"},n("ul",{class:"Dots"},this.renderDots()))));var o}get el(){return i(this)}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};r.style=":host {\n display: block;\n}\n\n.GeneralTutorialSliderError {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.GeneralTutorialSliderError.TitleError {\n color: red;\n}\n\nmain {\n width: 100%;\n overflow: hidden;\n}\n\n.TutorialWrapper {\n width: 100%;\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n flex-direction: column;\n overflow: auto;\n}\n\n.TutorialContent {\n display: flex;\n justify-content: center;\n flex-direction: row;\n}\n\n.TutorialItems {\n display: flex;\n transition: transform 0.4s ease-in-out;\n transform: translateX(0px);\n}\n\n.TutorialItem {\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n color: #000;\n background-color: #f5f5f5;\n border-radius: 5px;\n user-select: none;\n}\n.TutorialItem .ItemTitle {\n padding: 25px 15px;\n font-size: 18px;\n font-weight: 600;\n color: var(--emw--color-secondary, #FD2839);\n}\n.TutorialItem .ItemImage {\n overflow: hidden;\n}\n.TutorialItem .ItemImage img, .TutorialItem .ItemImage video {\n height: auto;\n width: 450px;\n}\n.TutorialItem .ItemDescription {\n font-size: 14px;\n padding: 25px 15px;\n font-weight: 400;\n color: #000;\n}\n\n.SliderNavButton {\n border: 0px;\n width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.SliderNavButton svg {\n width: 20px;\n stroke: var(--emw--color-secondary, #FD2839);\n}\n\n.DisabledArrow svg {\n opacity: 0.2;\n stroke: var(--emw--color-secondary, #FD2839);\n pointer-events: none;\n}\n\n.DotsWrapper {\n width: 100%;\n margin: 0 auto;\n margin-top: 20px;\n height: 30px;\n}\n.DotsWrapper ul.Dots {\n display: flex;\n justify-content: center;\n padding: 0;\n}\n.DotsWrapper ul.Dots li {\n height: 10px;\n width: 10px;\n background: #ccc;\n border-radius: 50%;\n margin-left: 3px;\n margin-right: 3px;\n list-style: none;\n cursor: pointer;\n}\n.DotsWrapper ul.Dots li:hover {\n background: #bbb;\n}\n.DotsWrapper ul.Dots li.active {\n border: solid 1px var(--emw--color-secondary, #FD2839);\n background: var(--emw--color-secondary, #FD2839);\n}\n.DotsWrapper ul.Dots li.default {\n border: solid 1px var(--emw--color-secondary, #FD2839);\n background-color: #FFF;\n}\n\n@container (max-width: 475px) {\n @media screen and (orientation: landscape) {\n .TutorialItem {\n width: 100%;\n }\n }\n main {\n height: 90cqh;\n }\n .TutorialItems {\n height: inherit;\n }\n .TutorialItem {\n min-width: 100%;\n max-height: 800px;\n overflow: auto;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n color: #000;\n background-color: #f5f5f5;\n border-radius: 5px;\n user-select: none;\n }\n .TutorialItem .ItemTitle {\n padding: 25px 15px;\n font-size: 18px;\n font-weight: 600;\n color: var(--emw--color-secondary, #FD2839);\n }\n .TutorialItem .ItemImage {\n min-height: 200px;\n }\n .TutorialItem .ItemImage img, .TutorialItem .ItemImage video {\n height: auto;\n width: 100%;\n }\n .TutorialItem .ItemDescription {\n font-size: 14px;\n padding: 25px 15px;\n font-weight: 400;\n color: #000;\n }\n}";export{r as general_tutorial_slider}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare class GeneralTutorialSlider {
|
|
2
|
+
/**
|
|
3
|
+
* Client custom styling via streamStyling
|
|
4
|
+
*/
|
|
5
|
+
mbSource: string;
|
|
2
6
|
/**
|
|
3
7
|
* Client custom styling via inline style
|
|
4
8
|
*/
|
|
@@ -53,12 +57,12 @@ export declare class GeneralTutorialSlider {
|
|
|
53
57
|
itemsPerPage: number;
|
|
54
58
|
el: HTMLElement;
|
|
55
59
|
hasErrors: boolean;
|
|
56
|
-
private limitStylingAppends;
|
|
57
60
|
private isLoading;
|
|
58
61
|
activeIndex: number;
|
|
59
62
|
tutorialElementWidth: number;
|
|
60
63
|
private userAgent;
|
|
61
64
|
private stylingContainer;
|
|
65
|
+
private stylingSubscription;
|
|
62
66
|
private tutorialData;
|
|
63
67
|
isMobile: boolean;
|
|
64
68
|
allElementsWidth: number;
|
|
@@ -67,6 +71,8 @@ export declare class GeneralTutorialSlider {
|
|
|
67
71
|
xDown: any;
|
|
68
72
|
yDown: any;
|
|
69
73
|
watchEndpoint(newValue: string, oldValue: string): void;
|
|
74
|
+
handleClientStylingChange(newValue: any, oldValue: any): void;
|
|
75
|
+
handleClientStylingChangeURL(newValue: any, oldValue: any): void;
|
|
70
76
|
connectedCallback(): void;
|
|
71
77
|
componentWillLoad(): Promise<void>;
|
|
72
78
|
componentDidLoad(): void;
|
|
@@ -83,8 +89,6 @@ export declare class GeneralTutorialSlider {
|
|
|
83
89
|
handleTouchMove(evt: any): void;
|
|
84
90
|
setActive(index: number): void;
|
|
85
91
|
orientationChangeHandler: () => void;
|
|
86
|
-
setClientStyling: () => void;
|
|
87
|
-
setClientStylingURL: () => void;
|
|
88
92
|
renderDots(): Array<HTMLElement>;
|
|
89
93
|
render(): void;
|
|
90
94
|
}
|
|
@@ -39,6 +39,10 @@ export namespace Components {
|
|
|
39
39
|
* Language of the widget
|
|
40
40
|
*/
|
|
41
41
|
"language": string;
|
|
42
|
+
/**
|
|
43
|
+
* Client custom styling via streamStyling
|
|
44
|
+
*/
|
|
45
|
+
"mbSource": string;
|
|
42
46
|
/**
|
|
43
47
|
* Set the number of slides you wish to display.
|
|
44
48
|
*/
|
|
@@ -106,6 +110,10 @@ declare namespace LocalJSX {
|
|
|
106
110
|
* Language of the widget
|
|
107
111
|
*/
|
|
108
112
|
"language"?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Client custom styling via streamStyling
|
|
115
|
+
*/
|
|
116
|
+
"mbSource"?: string;
|
|
109
117
|
/**
|
|
110
118
|
* Set the number of slides you wish to display.
|
|
111
119
|
*/
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,g as n}from"./p-e2d02089.js";const e={en:{error:"Error",noResults:"Loading, please wait ..."},hu:{error:"Error",noResults:"Loading, please wait ..."},ro:{error:"Eroare",noResults:"Loading, please wait ..."},fr:{error:"Error",noResults:"Loading, please wait ..."},ar:{error:"خطأ",noResults:"Loading, please wait ..."},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ..."},"es-mx":{error:"Error",noResults:"Cargando, espere por favor…"},"pt-br":{error:"Erro",noResults:"Carregando, espere por favor…"}},o=class{constructor(i){var n;t(this,i),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.showSliderDots=!0,this.showSliderArrows=!0,this.showSliderArrowsMobile=!1,this.enableAutoScroll=!1,this.intervalPeriod=5e3,this.scrollItems=1,this.itemsPerPage=1,this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.activeIndex=0,this.tutorialElementWidth=0,this.userAgent=window.navigator.userAgent,this.isMobile=!!((n=this.userAgent).toLowerCase().match(/android/i)||n.toLowerCase().match(/blackberry|bb/i)||n.toLowerCase().match(/iphone|ipad|ipod/i)||n.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.allElementsWidth=0,this.xDown=null,this.yDown=null,this.resizeHandler=()=>{this.recalculateItemsPerPage()},this.orientationChangeHandler=()=>{setTimeout((()=>{this.recalculateItemsPerPage()}),10)},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))}}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getGeneralTutorialSlider().then((t=>{this.tutorialData=t}))}connectedCallback(){window.screen.orientation.addEventListener("change",this.orientationChangeHandler)}componentWillLoad(){if(this.cmsEndpoint&&this.language)return this.getGeneralTutorialSlider().then((t=>{this.tutorialData=t}))}componentDidLoad(){window.addEventListener("resize",this.resizeHandler)}componentDidRender(){this.el.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!0}),this.el.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!0}),this.recalculateItemsPerPage(),!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}componentDidUpdate(){this.recalculateItemsPerPage()}disconnectedCallback(){this.el.removeEventListener("touchstart",this.handleTouchStart),this.el.removeEventListener("touchmove",this.handleTouchMove),window.screen.orientation.removeEventListener("change",this.orientationChangeHandler),window.removeEventListener("resize",this.resizeHandler)}getGeneralTutorialSlider(){let t=new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"iPad"===t||"iPhone"===t?"ios":"mtWeb"})()),new Promise(((i,n)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{i(t)})).catch((t=>{console.error(t),this.hasErrors=!0,n(t)})).finally((()=>{this.isLoading=!1}))}))}move(t){this.setActive(this.activeIndex+t)}recalculateItemsPerPage(){this.tutorialsElement&&(this.tutorialElementWidth=this.tutorialsElement.clientWidth,this.allElementsWidth=(this.tutorialData.length-1)*this.tutorialElementWidth)}goTo(t){let i=this.activeIndex-t;if(i>0)for(let t=0;t<i;t++)this.move(-1);else for(let t=0;t>i;t--)this.move(1)}handleTouchStart(t){const i=this.getTouches(t)[0];this.xDown=i.clientX,this.yDown=i.clientY}getTouches(t){return t.touches||t.originalEvent.touches}handleTouchMove(t){if(!this.xDown||!this.yDown)return;let i=this.xDown-t.touches[0].clientX,n=this.yDown-t.touches[0].clientY;Math.abs(i)>Math.abs(n)&&this.move(i>0?1:-1),this.xDown=null,this.yDown=null}setActive(t){const i=this.tutorialData.length;this.activeIndex=t>=0?t>=i-1?i-1:t:0}renderDots(){const t=[];for(let n=0;n<this.tutorialData.length/this.itemsPerPage;n++)t.push(i("li",{class:n==this.activeIndex?"active":"default",onClick:()=>{this.goTo(n),this.setActive(n)}}));return t}render(){const t={transform:`translate(${this.allElementsWidth/(this.tutorialData.length-1)*this.activeIndex*-1}px, 0px)`},n={width:this.tutorialElementWidth/this.itemsPerPage+"px"};return this.hasErrors?i("div",{class:"GeneralTutorialSliderError"},i("div",{class:"TitleError"},e[void 0!==(o=this.language)&&o in e?o:"en"].error)):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("div",{class:"TutorialWrapper"},i("div",{class:"TutorialContent",ref:t=>this.slider=t},(this.showSliderArrows&&!this.isMobile||this.showSliderArrowsMobile&&this.isMobile)&&i("div",{class:0===this.activeIndex?"SliderNavButton DisabledArrow":"SliderNavButton",onClick:()=>this.move(-1)},i("svg",{fill:"none",stroke:"var(--emw--color-secondary, #FD2839)",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"}))),i("main",null,i("div",{style:t,ref:t=>this.tutorialsElement=t,class:"TutorialItems"},this.tutorialData.map((t=>{var e,o,s,r,l,a,d,h,u,c,p,v,m,w,g,f,x,I;return i("div",{class:"TutorialItem",style:n},i("div",{class:"ItemTitle",innerHTML:null==t?void 0:t.title}),(null===(e=null==t?void 0:t.media)||void 0===e?void 0:e.images)?i("div",{class:"ItemImage"},i("img",this.isMobile?{src:null===(l=null===(r=null===(s=null===(o=null==t?void 0:t.media)||void 0===o?void 0:o.images[0])||void 0===s?void 0:s.sources)||void 0===r?void 0:r.find((t=>"mobile"===t.media)))||void 0===l?void 0:l.src,alt:null==t?void 0:t.slug}:{src:null===(u=null===(h=null===(d=null===(a=null==t?void 0:t.media)||void 0===a?void 0:a.images[0])||void 0===d?void 0:d.sources)||void 0===h?void 0:h.find((t=>"desktop"===t.media)))||void 0===u?void 0:u.src,alt:null==t?void 0:t.slug})):(null===(c=null==t?void 0:t.media)||void 0===c?void 0:c.video)?i("div",{class:"ItemImage"},i("video",{controls:!0,loop:!0,autoplay:!0},i("source",this.isMobile?{src:null===(w=null===(m=null===(v=null===(p=null==t?void 0:t.media)||void 0===p?void 0:p.video[0])||void 0===v?void 0:v.sources)||void 0===m?void 0:m.find((t=>"mobile"===t.media)))||void 0===w?void 0:w.src,type:"video/mp4"}:{src:null===(I=null===(x=null===(f=null===(g=null==t?void 0:t.media)||void 0===g?void 0:g.video[0])||void 0===f?void 0:f.sources)||void 0===x?void 0:x.find((t=>"desktop"===t.media)))||void 0===I?void 0:I.src,type:"video/mp4"}))):null,i("div",{class:"ItemDescription",innerHTML:null==t?void 0:t.content}))})))),(this.showSliderArrows&&!this.isMobile||this.showSliderArrowsMobile&&this.isMobile)&&i("div",{class:this.activeIndex===this.tutorialData.length-1?" SliderNavButton DisabledArrow disabled":"SliderNavButton",onClick:()=>this.move(1)},i("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"}))),i("div",null)),this.showSliderDots&&i("div",{class:"DotsWrapper"},i("ul",{class:"Dots"},this.renderDots()))));var o}get el(){return n(this)}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};o.style=":host {\n display: block;\n}\n\n.GeneralTutorialSliderError {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.GeneralTutorialSliderError.TitleError {\n color: red;\n}\n\nmain {\n width: 100%;\n overflow: hidden;\n}\n\n.TutorialWrapper {\n width: 100%;\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n flex-direction: column;\n overflow: auto;\n}\n\n.TutorialContent {\n display: flex;\n justify-content: center;\n flex-direction: row;\n}\n\n.TutorialItems {\n display: flex;\n transition: transform 0.4s ease-in-out;\n transform: translateX(0px);\n}\n\n.TutorialItem {\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n color: #000;\n background-color: #f5f5f5;\n border-radius: 5px;\n user-select: none;\n}\n.TutorialItem .ItemTitle {\n padding: 25px 15px;\n font-size: 18px;\n font-weight: 600;\n color: var(--emw--color-secondary, #FD2839);\n}\n.TutorialItem .ItemImage {\n overflow: hidden;\n}\n.TutorialItem .ItemImage img, .TutorialItem .ItemImage video {\n height: auto;\n width: 450px;\n}\n.TutorialItem .ItemDescription {\n font-size: 14px;\n padding: 25px 15px;\n font-weight: 400;\n color: #000;\n}\n\n.SliderNavButton {\n border: 0px;\n width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.SliderNavButton svg {\n width: 20px;\n stroke: var(--emw--color-secondary, #FD2839);\n}\n\n.DisabledArrow svg {\n opacity: 0.2;\n stroke: var(--emw--color-secondary, #FD2839);\n pointer-events: none;\n}\n\n.DotsWrapper {\n width: 100%;\n margin: 0 auto;\n margin-top: 20px;\n height: 30px;\n}\n.DotsWrapper ul.Dots {\n display: flex;\n justify-content: center;\n padding: 0;\n}\n.DotsWrapper ul.Dots li {\n height: 10px;\n width: 10px;\n background: #ccc;\n border-radius: 50%;\n margin-left: 3px;\n margin-right: 3px;\n list-style: none;\n cursor: pointer;\n}\n.DotsWrapper ul.Dots li:hover {\n background: #bbb;\n}\n.DotsWrapper ul.Dots li.active {\n border: solid 1px var(--emw--color-secondary, #FD2839);\n background: var(--emw--color-secondary, #FD2839);\n}\n.DotsWrapper ul.Dots li.default {\n border: solid 1px var(--emw--color-secondary, #FD2839);\n background-color: #FFF;\n}\n\n@container (max-width: 475px) {\n @media screen and (orientation: landscape) {\n .TutorialItem {\n width: 100%;\n }\n }\n main {\n height: 90cqh;\n }\n .TutorialItems {\n height: inherit;\n }\n .TutorialItem {\n min-width: 100%;\n max-height: 800px;\n overflow: auto;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n color: #000;\n background-color: #f5f5f5;\n border-radius: 5px;\n user-select: none;\n }\n .TutorialItem .ItemTitle {\n padding: 25px 15px;\n font-size: 18px;\n font-weight: 600;\n color: var(--emw--color-secondary, #FD2839);\n }\n .TutorialItem .ItemImage {\n min-height: 200px;\n }\n .TutorialItem .ItemImage img, .TutorialItem .ItemImage video {\n height: auto;\n width: 100%;\n }\n .TutorialItem .ItemDescription {\n font-size: 14px;\n padding: 25px 15px;\n font-weight: 400;\n color: #000;\n }\n}";export{o as general_tutorial_slider}
|