@everymatrix/general-tutorial-slider 1.55.0 → 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 +133 -44
- package/dist/cjs/general-tutorial-slider.cjs.js +3 -3
- package/dist/cjs/{index-e91cd3ca.js → index-bfd21506.js} +180 -77
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.js +124 -43
- package/dist/esm/general-tutorial-slider.entry.js +133 -44
- package/dist/esm/general-tutorial-slider.js +4 -4
- package/dist/esm/{index-8f6f886a.js → index-b8731ee9.js} +180 -77
- package/dist/esm/loader.js +3 -3
- 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/general-tutorial-slider/p-e2d02089.js +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.dev.d.ts +2 -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-61e877f0.entry.js +0 -1
- package/dist/general-tutorial-slider/p-f4302c55.js +0 -2
- package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.d.ts +0 -2
- package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.dev.d.ts +0 -2
- /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/index.d.ts +0 -0
- /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
- /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
- /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
|
@@ -1,57 +1,74 @@
|
|
|
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() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.xDown = null;
|
|
10
|
-
this.yDown = null;
|
|
11
|
-
this.resizeHandler = () => {
|
|
12
|
-
this.recalculateItemsPerPage();
|
|
13
|
-
};
|
|
14
|
-
this.orientationChangeHandler = () => {
|
|
15
|
-
setTimeout(() => {
|
|
16
|
-
this.recalculateItemsPerPage();
|
|
17
|
-
}, 10);
|
|
18
|
-
};
|
|
19
|
-
this.setClientStyling = () => {
|
|
20
|
-
let sheet = document.createElement('style');
|
|
21
|
-
sheet.innerHTML = this.clientStyling;
|
|
22
|
-
this.stylingContainer.prepend(sheet);
|
|
23
|
-
};
|
|
24
|
-
this.setClientStylingURL = () => {
|
|
25
|
-
let url = new URL(this.clientStylingUrl);
|
|
26
|
-
let cssFile = document.createElement('style');
|
|
27
|
-
fetch(url.href)
|
|
28
|
-
.then((res) => res.text())
|
|
29
|
-
.then((data) => {
|
|
30
|
-
cssFile.innerHTML = data;
|
|
31
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
32
|
-
})
|
|
33
|
-
.catch((err) => {
|
|
34
|
-
console.log('error ', err);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
7
|
+
/**
|
|
8
|
+
* Client custom styling via inline style
|
|
9
|
+
*/
|
|
37
10
|
this.clientStyling = '';
|
|
11
|
+
/**
|
|
12
|
+
* Client custom styling via url
|
|
13
|
+
*/
|
|
38
14
|
this.clientStylingUrl = '';
|
|
15
|
+
/**
|
|
16
|
+
* Language of the widget
|
|
17
|
+
*/
|
|
39
18
|
this.language = 'en';
|
|
40
|
-
|
|
19
|
+
/**
|
|
20
|
+
* User roles
|
|
21
|
+
*/
|
|
41
22
|
this.userRoles = 'everyone';
|
|
23
|
+
/**
|
|
24
|
+
* CMS Endpoint stage
|
|
25
|
+
*/
|
|
42
26
|
this.cmsEnv = 'stage';
|
|
27
|
+
/**
|
|
28
|
+
* Show slider dots
|
|
29
|
+
*/
|
|
43
30
|
this.showSliderDots = true;
|
|
31
|
+
/**
|
|
32
|
+
* Show slider navigate arrows
|
|
33
|
+
*/
|
|
44
34
|
this.showSliderArrows = true;
|
|
35
|
+
/**
|
|
36
|
+
* Show slider navigate arrows on mobile
|
|
37
|
+
*/
|
|
45
38
|
this.showSliderArrowsMobile = false;
|
|
39
|
+
/**
|
|
40
|
+
* Auto-scroll will only function if it is set to true, and otherwise it will be ignored.
|
|
41
|
+
*/
|
|
46
42
|
this.enableAutoScroll = false;
|
|
43
|
+
/**
|
|
44
|
+
* Set interval period for slider
|
|
45
|
+
*/
|
|
47
46
|
this.intervalPeriod = 5000;
|
|
47
|
+
/**
|
|
48
|
+
* Set the number of slides you wish to display.
|
|
49
|
+
*/
|
|
48
50
|
this.scrollItems = 1;
|
|
51
|
+
/**
|
|
52
|
+
* Set the number of slides you wish to display.
|
|
53
|
+
*/
|
|
49
54
|
this.itemsPerPage = 1;
|
|
50
55
|
this.hasErrors = false;
|
|
51
|
-
this.limitStylingAppends = false;
|
|
52
56
|
this.isLoading = true;
|
|
53
57
|
this.activeIndex = 0;
|
|
54
58
|
this.tutorialElementWidth = 0;
|
|
59
|
+
this.userAgent = window.navigator.userAgent;
|
|
60
|
+
this.isMobile = isMobile(this.userAgent);
|
|
61
|
+
this.allElementsWidth = 0;
|
|
62
|
+
this.xDown = null;
|
|
63
|
+
this.yDown = null;
|
|
64
|
+
this.resizeHandler = () => {
|
|
65
|
+
this.recalculateItemsPerPage();
|
|
66
|
+
};
|
|
67
|
+
this.orientationChangeHandler = () => {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
this.recalculateItemsPerPage();
|
|
70
|
+
}, 10);
|
|
71
|
+
};
|
|
55
72
|
}
|
|
56
73
|
watchEndpoint(newValue, oldValue) {
|
|
57
74
|
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
@@ -60,6 +77,17 @@ export class GeneralTutorialSlider {
|
|
|
60
77
|
});
|
|
61
78
|
}
|
|
62
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
|
+
}
|
|
63
91
|
connectedCallback() {
|
|
64
92
|
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
65
93
|
}
|
|
@@ -72,20 +100,22 @@ export class GeneralTutorialSlider {
|
|
|
72
100
|
}
|
|
73
101
|
componentDidLoad() {
|
|
74
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
|
+
}
|
|
75
114
|
}
|
|
76
115
|
componentDidRender() {
|
|
77
116
|
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
78
117
|
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
79
118
|
this.recalculateItemsPerPage();
|
|
80
|
-
// start custom styling area
|
|
81
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
82
|
-
if (this.clientStyling)
|
|
83
|
-
this.setClientStyling();
|
|
84
|
-
if (this.clientStylingUrl)
|
|
85
|
-
this.setClientStylingURL();
|
|
86
|
-
this.limitStylingAppends = true;
|
|
87
|
-
}
|
|
88
|
-
// end custom styling area
|
|
89
119
|
}
|
|
90
120
|
componentDidUpdate() {
|
|
91
121
|
this.recalculateItemsPerPage();
|
|
@@ -95,6 +125,7 @@ export class GeneralTutorialSlider {
|
|
|
95
125
|
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
96
126
|
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
97
127
|
window.removeEventListener('resize', this.resizeHandler);
|
|
128
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
98
129
|
}
|
|
99
130
|
getGeneralTutorialSlider() {
|
|
100
131
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
|
|
@@ -225,6 +256,25 @@ export class GeneralTutorialSlider {
|
|
|
225
256
|
}
|
|
226
257
|
static get properties() {
|
|
227
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
|
+
},
|
|
228
278
|
"clientStyling": {
|
|
229
279
|
"type": "string",
|
|
230
280
|
"mutable": false,
|
|
@@ -239,6 +289,8 @@ export class GeneralTutorialSlider {
|
|
|
239
289
|
"tags": [],
|
|
240
290
|
"text": "Client custom styling via inline style"
|
|
241
291
|
},
|
|
292
|
+
"getter": false,
|
|
293
|
+
"setter": false,
|
|
242
294
|
"attribute": "client-styling",
|
|
243
295
|
"reflect": true,
|
|
244
296
|
"defaultValue": "''"
|
|
@@ -257,6 +309,8 @@ export class GeneralTutorialSlider {
|
|
|
257
309
|
"tags": [],
|
|
258
310
|
"text": "Client custom styling via url"
|
|
259
311
|
},
|
|
312
|
+
"getter": false,
|
|
313
|
+
"setter": false,
|
|
260
314
|
"attribute": "client-styling-url",
|
|
261
315
|
"reflect": true,
|
|
262
316
|
"defaultValue": "''"
|
|
@@ -275,6 +329,8 @@ export class GeneralTutorialSlider {
|
|
|
275
329
|
"tags": [],
|
|
276
330
|
"text": "Language of the widget"
|
|
277
331
|
},
|
|
332
|
+
"getter": false,
|
|
333
|
+
"setter": false,
|
|
278
334
|
"attribute": "language",
|
|
279
335
|
"reflect": true,
|
|
280
336
|
"defaultValue": "'en'"
|
|
@@ -293,6 +349,8 @@ export class GeneralTutorialSlider {
|
|
|
293
349
|
"tags": [],
|
|
294
350
|
"text": "Endpoint URL for the source of data"
|
|
295
351
|
},
|
|
352
|
+
"getter": false,
|
|
353
|
+
"setter": false,
|
|
296
354
|
"attribute": "cms-endpoint",
|
|
297
355
|
"reflect": true
|
|
298
356
|
},
|
|
@@ -310,6 +368,8 @@ export class GeneralTutorialSlider {
|
|
|
310
368
|
"tags": [],
|
|
311
369
|
"text": "User roles"
|
|
312
370
|
},
|
|
371
|
+
"getter": false,
|
|
372
|
+
"setter": false,
|
|
313
373
|
"attribute": "user-roles",
|
|
314
374
|
"reflect": true,
|
|
315
375
|
"defaultValue": "'everyone'"
|
|
@@ -328,6 +388,8 @@ export class GeneralTutorialSlider {
|
|
|
328
388
|
"tags": [],
|
|
329
389
|
"text": "CMS Endpoint stage"
|
|
330
390
|
},
|
|
391
|
+
"getter": false,
|
|
392
|
+
"setter": false,
|
|
331
393
|
"attribute": "cms-env",
|
|
332
394
|
"reflect": true,
|
|
333
395
|
"defaultValue": "'stage'"
|
|
@@ -346,6 +408,8 @@ export class GeneralTutorialSlider {
|
|
|
346
408
|
"tags": [],
|
|
347
409
|
"text": "Show slider dots"
|
|
348
410
|
},
|
|
411
|
+
"getter": false,
|
|
412
|
+
"setter": false,
|
|
349
413
|
"attribute": "show-slider-dots",
|
|
350
414
|
"reflect": true,
|
|
351
415
|
"defaultValue": "true"
|
|
@@ -364,6 +428,8 @@ export class GeneralTutorialSlider {
|
|
|
364
428
|
"tags": [],
|
|
365
429
|
"text": "Show slider navigate arrows"
|
|
366
430
|
},
|
|
431
|
+
"getter": false,
|
|
432
|
+
"setter": false,
|
|
367
433
|
"attribute": "show-slider-arrows",
|
|
368
434
|
"reflect": true,
|
|
369
435
|
"defaultValue": "true"
|
|
@@ -382,6 +448,8 @@ export class GeneralTutorialSlider {
|
|
|
382
448
|
"tags": [],
|
|
383
449
|
"text": "Show slider navigate arrows on mobile"
|
|
384
450
|
},
|
|
451
|
+
"getter": false,
|
|
452
|
+
"setter": false,
|
|
385
453
|
"attribute": "show-slider-arrows-mobile",
|
|
386
454
|
"reflect": true,
|
|
387
455
|
"defaultValue": "false"
|
|
@@ -400,6 +468,8 @@ export class GeneralTutorialSlider {
|
|
|
400
468
|
"tags": [],
|
|
401
469
|
"text": "Auto-scroll will only function if it is set to true, and otherwise it will be ignored."
|
|
402
470
|
},
|
|
471
|
+
"getter": false,
|
|
472
|
+
"setter": false,
|
|
403
473
|
"attribute": "enable-auto-scroll",
|
|
404
474
|
"reflect": true,
|
|
405
475
|
"defaultValue": "false"
|
|
@@ -418,6 +488,8 @@ export class GeneralTutorialSlider {
|
|
|
418
488
|
"tags": [],
|
|
419
489
|
"text": "Set interval period for slider"
|
|
420
490
|
},
|
|
491
|
+
"getter": false,
|
|
492
|
+
"setter": false,
|
|
421
493
|
"attribute": "interval-period",
|
|
422
494
|
"reflect": true,
|
|
423
495
|
"defaultValue": "5000"
|
|
@@ -436,6 +508,8 @@ export class GeneralTutorialSlider {
|
|
|
436
508
|
"tags": [],
|
|
437
509
|
"text": "Set the number of slides you wish to display."
|
|
438
510
|
},
|
|
511
|
+
"getter": false,
|
|
512
|
+
"setter": false,
|
|
439
513
|
"attribute": "scroll-items",
|
|
440
514
|
"reflect": true,
|
|
441
515
|
"defaultValue": "1"
|
|
@@ -454,6 +528,8 @@ export class GeneralTutorialSlider {
|
|
|
454
528
|
"tags": [],
|
|
455
529
|
"text": "Set the number of slides you wish to display."
|
|
456
530
|
},
|
|
531
|
+
"getter": false,
|
|
532
|
+
"setter": false,
|
|
457
533
|
"attribute": "items-per-page",
|
|
458
534
|
"reflect": true,
|
|
459
535
|
"defaultValue": "1"
|
|
@@ -463,7 +539,6 @@ export class GeneralTutorialSlider {
|
|
|
463
539
|
static get states() {
|
|
464
540
|
return {
|
|
465
541
|
"hasErrors": {},
|
|
466
|
-
"limitStylingAppends": {},
|
|
467
542
|
"isLoading": {},
|
|
468
543
|
"activeIndex": {},
|
|
469
544
|
"tutorialElementWidth": {}
|
|
@@ -477,6 +552,12 @@ export class GeneralTutorialSlider {
|
|
|
477
552
|
}, {
|
|
478
553
|
"propName": "language",
|
|
479
554
|
"methodName": "watchEndpoint"
|
|
555
|
+
}, {
|
|
556
|
+
"propName": "clientStyling",
|
|
557
|
+
"methodName": "handleClientStylingChange"
|
|
558
|
+
}, {
|
|
559
|
+
"propName": "clientStylingUrl",
|
|
560
|
+
"methodName": "handleClientStylingChangeURL"
|
|
480
561
|
}];
|
|
481
562
|
}
|
|
482
563
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-b8731ee9.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
4
|
const TRANSLATIONS = {
|
|
@@ -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
|
|
@@ -86,55 +143,71 @@ const GeneralTutorialSliderStyle0 = generalTutorialSliderCss;
|
|
|
86
143
|
const GeneralTutorialSlider = class {
|
|
87
144
|
constructor(hostRef) {
|
|
88
145
|
registerInstance(this, hostRef);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.xDown = null;
|
|
93
|
-
this.yDown = null;
|
|
94
|
-
this.resizeHandler = () => {
|
|
95
|
-
this.recalculateItemsPerPage();
|
|
96
|
-
};
|
|
97
|
-
this.orientationChangeHandler = () => {
|
|
98
|
-
setTimeout(() => {
|
|
99
|
-
this.recalculateItemsPerPage();
|
|
100
|
-
}, 10);
|
|
101
|
-
};
|
|
102
|
-
this.setClientStyling = () => {
|
|
103
|
-
let sheet = document.createElement('style');
|
|
104
|
-
sheet.innerHTML = this.clientStyling;
|
|
105
|
-
this.stylingContainer.prepend(sheet);
|
|
106
|
-
};
|
|
107
|
-
this.setClientStylingURL = () => {
|
|
108
|
-
let url = new URL(this.clientStylingUrl);
|
|
109
|
-
let cssFile = document.createElement('style');
|
|
110
|
-
fetch(url.href)
|
|
111
|
-
.then((res) => res.text())
|
|
112
|
-
.then((data) => {
|
|
113
|
-
cssFile.innerHTML = data;
|
|
114
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
115
|
-
})
|
|
116
|
-
.catch((err) => {
|
|
117
|
-
console.log('error ', err);
|
|
118
|
-
});
|
|
119
|
-
};
|
|
146
|
+
/**
|
|
147
|
+
* Client custom styling via inline style
|
|
148
|
+
*/
|
|
120
149
|
this.clientStyling = '';
|
|
150
|
+
/**
|
|
151
|
+
* Client custom styling via url
|
|
152
|
+
*/
|
|
121
153
|
this.clientStylingUrl = '';
|
|
154
|
+
/**
|
|
155
|
+
* Language of the widget
|
|
156
|
+
*/
|
|
122
157
|
this.language = 'en';
|
|
123
|
-
|
|
158
|
+
/**
|
|
159
|
+
* User roles
|
|
160
|
+
*/
|
|
124
161
|
this.userRoles = 'everyone';
|
|
162
|
+
/**
|
|
163
|
+
* CMS Endpoint stage
|
|
164
|
+
*/
|
|
125
165
|
this.cmsEnv = 'stage';
|
|
166
|
+
/**
|
|
167
|
+
* Show slider dots
|
|
168
|
+
*/
|
|
126
169
|
this.showSliderDots = true;
|
|
170
|
+
/**
|
|
171
|
+
* Show slider navigate arrows
|
|
172
|
+
*/
|
|
127
173
|
this.showSliderArrows = true;
|
|
174
|
+
/**
|
|
175
|
+
* Show slider navigate arrows on mobile
|
|
176
|
+
*/
|
|
128
177
|
this.showSliderArrowsMobile = false;
|
|
178
|
+
/**
|
|
179
|
+
* Auto-scroll will only function if it is set to true, and otherwise it will be ignored.
|
|
180
|
+
*/
|
|
129
181
|
this.enableAutoScroll = false;
|
|
182
|
+
/**
|
|
183
|
+
* Set interval period for slider
|
|
184
|
+
*/
|
|
130
185
|
this.intervalPeriod = 5000;
|
|
186
|
+
/**
|
|
187
|
+
* Set the number of slides you wish to display.
|
|
188
|
+
*/
|
|
131
189
|
this.scrollItems = 1;
|
|
190
|
+
/**
|
|
191
|
+
* Set the number of slides you wish to display.
|
|
192
|
+
*/
|
|
132
193
|
this.itemsPerPage = 1;
|
|
133
194
|
this.hasErrors = false;
|
|
134
|
-
this.limitStylingAppends = false;
|
|
135
195
|
this.isLoading = true;
|
|
136
196
|
this.activeIndex = 0;
|
|
137
197
|
this.tutorialElementWidth = 0;
|
|
198
|
+
this.userAgent = window.navigator.userAgent;
|
|
199
|
+
this.isMobile = isMobile(this.userAgent);
|
|
200
|
+
this.allElementsWidth = 0;
|
|
201
|
+
this.xDown = null;
|
|
202
|
+
this.yDown = null;
|
|
203
|
+
this.resizeHandler = () => {
|
|
204
|
+
this.recalculateItemsPerPage();
|
|
205
|
+
};
|
|
206
|
+
this.orientationChangeHandler = () => {
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
this.recalculateItemsPerPage();
|
|
209
|
+
}, 10);
|
|
210
|
+
};
|
|
138
211
|
}
|
|
139
212
|
watchEndpoint(newValue, oldValue) {
|
|
140
213
|
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
@@ -143,6 +216,17 @@ const GeneralTutorialSlider = class {
|
|
|
143
216
|
});
|
|
144
217
|
}
|
|
145
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
|
+
}
|
|
146
230
|
connectedCallback() {
|
|
147
231
|
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
148
232
|
}
|
|
@@ -155,20 +239,22 @@ const GeneralTutorialSlider = class {
|
|
|
155
239
|
}
|
|
156
240
|
componentDidLoad() {
|
|
157
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
|
+
}
|
|
158
253
|
}
|
|
159
254
|
componentDidRender() {
|
|
160
255
|
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
161
256
|
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
162
257
|
this.recalculateItemsPerPage();
|
|
163
|
-
// start custom styling area
|
|
164
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
165
|
-
if (this.clientStyling)
|
|
166
|
-
this.setClientStyling();
|
|
167
|
-
if (this.clientStylingUrl)
|
|
168
|
-
this.setClientStylingURL();
|
|
169
|
-
this.limitStylingAppends = true;
|
|
170
|
-
}
|
|
171
|
-
// end custom styling area
|
|
172
258
|
}
|
|
173
259
|
componentDidUpdate() {
|
|
174
260
|
this.recalculateItemsPerPage();
|
|
@@ -178,6 +264,7 @@ const GeneralTutorialSlider = class {
|
|
|
178
264
|
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
179
265
|
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
180
266
|
window.removeEventListener('resize', this.resizeHandler);
|
|
267
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
181
268
|
}
|
|
182
269
|
getGeneralTutorialSlider() {
|
|
183
270
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
|
|
@@ -297,7 +384,9 @@ const GeneralTutorialSlider = class {
|
|
|
297
384
|
get el() { return getElement(this); }
|
|
298
385
|
static get watchers() { return {
|
|
299
386
|
"cmsEndpoint": ["watchEndpoint"],
|
|
300
|
-
"language": ["watchEndpoint"]
|
|
387
|
+
"language": ["watchEndpoint"],
|
|
388
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
389
|
+
"clientStylingUrl": ["handleClientStylingChangeURL"]
|
|
301
390
|
}; }
|
|
302
391
|
};
|
|
303
392
|
GeneralTutorialSlider.style = GeneralTutorialSliderStyle0;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-b8731ee9.js';
|
|
2
|
+
export { s as setNonce } from './index-b8731ee9.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v4.
|
|
6
|
+
Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
var patchBrowser = () => {
|
|
9
9
|
const importMeta = import.meta.url;
|
|
@@ -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
|
});
|