@everymatrix/general-tutorial-slider 1.44.0 → 1.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/general-tutorial-slider.cjs.entry.js +267 -301
  3. package/dist/cjs/general-tutorial-slider.cjs.js +17 -11
  4. package/dist/cjs/index-42afbd98.js +1243 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.css +0 -2
  8. package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.js +466 -510
  9. package/dist/collection/components/general-tutorial-slider/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +34 -34
  11. package/dist/collection/utils/utils.js +26 -26
  12. package/dist/esm/app-globals-0f993ce5.js +3 -0
  13. package/dist/esm/general-tutorial-slider.entry.js +267 -301
  14. package/dist/esm/general-tutorial-slider.js +14 -11
  15. package/dist/esm/index-a6815b2c.js +1216 -0
  16. package/dist/esm/loader.js +7 -13
  17. package/dist/general-tutorial-slider/general-tutorial-slider.esm.js +1 -1
  18. package/dist/general-tutorial-slider/p-5bac4bfc.entry.js +1 -0
  19. package/dist/general-tutorial-slider/p-87756a93.js +2 -0
  20. package/dist/general-tutorial-slider/p-e1255160.js +1 -0
  21. package/dist/stencil.config.dev.js +17 -0
  22. package/dist/stencil.config.js +14 -19
  23. 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
  24. 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
  25. package/dist/types/components/general-tutorial-slider/general-tutorial-slider.d.ts +88 -88
  26. package/dist/types/components/general-tutorial-slider/index.d.ts +1 -0
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +8 -1
  35. package/dist/cjs/index-18ec3908.js +0 -1282
  36. package/dist/components/general-tutorial-slider.d.ts +0 -11
  37. package/dist/components/general-tutorial-slider.js +0 -376
  38. package/dist/components/index.d.ts +0 -26
  39. package/dist/components/index.js +0 -1
  40. package/dist/esm/index-a2165162.js +0 -1256
  41. package/dist/esm/polyfills/core-js.js +0 -11
  42. package/dist/esm/polyfills/css-shim.js +0 -1
  43. package/dist/esm/polyfills/dom.js +0 -79
  44. package/dist/esm/polyfills/es5-html-element.js +0 -1
  45. package/dist/esm/polyfills/index.js +0 -34
  46. package/dist/esm/polyfills/system.js +0 -6
  47. package/dist/general-tutorial-slider/p-4e4fd5b7.entry.js +0 -1
  48. package/dist/general-tutorial-slider/p-a878ee14.js +0 -1
  49. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-tutorial-slider/.stencil/packages/general-tutorial-slider/stencil.config.d.ts +0 -2
@@ -1,43 +1,43 @@
1
- import { r as registerInstance, h, g as getElement } from './index-a2165162.js';
1
+ import { r as registerInstance, h, g as getElement } from './index-a6815b2c.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
4
  const TRANSLATIONS = {
5
- en: {
6
- error: 'Error',
7
- noResults: 'Loading, please wait ...',
8
- },
9
- hu: {
10
- error: 'Error',
11
- noResults: 'Loading, please wait ...',
12
- },
13
- ro: {
14
- error: 'Eroare',
15
- noResults: 'Loading, please wait ...',
16
- },
17
- fr: {
18
- error: 'Error',
19
- noResults: 'Loading, please wait ...',
20
- },
21
- ar: {
22
- error: 'خطأ',
23
- noResults: 'Loading, please wait ...',
24
- },
25
- hr: {
26
- error: 'Greška',
27
- noResults: 'Učitavanje, molimo pričekajte ...',
28
- },
29
- 'es-mx': {
30
- 'error': 'Error',
31
- 'noResults': 'Cargando, espere por favor…'
32
- },
33
- 'pt-br': {
34
- 'error': 'Erro',
35
- 'noResults': 'Carregando, espere por favor…'
36
- }
5
+ en: {
6
+ error: 'Error',
7
+ noResults: 'Loading, please wait ...',
8
+ },
9
+ hu: {
10
+ error: 'Error',
11
+ noResults: 'Loading, please wait ...',
12
+ },
13
+ ro: {
14
+ error: 'Eroare',
15
+ noResults: 'Loading, please wait ...',
16
+ },
17
+ fr: {
18
+ error: 'Error',
19
+ noResults: 'Loading, please wait ...',
20
+ },
21
+ ar: {
22
+ error: 'خطأ',
23
+ noResults: 'Loading, please wait ...',
24
+ },
25
+ hr: {
26
+ error: 'Greška',
27
+ noResults: 'Učitavanje, molimo pričekajte ...',
28
+ },
29
+ 'es-mx': {
30
+ 'error': 'Error',
31
+ 'noResults': 'Cargando, espere por favor…'
32
+ },
33
+ 'pt-br': {
34
+ 'error': 'Erro',
35
+ 'noResults': 'Carregando, espere por favor…'
36
+ }
37
37
  };
38
38
  const translate = (key, customLang) => {
39
- const lang = customLang;
40
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
39
+ const lang = customLang;
40
+ return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
41
41
  };
42
42
 
43
43
  /**
@@ -47,293 +47,259 @@ const translate = (key, customLang) => {
47
47
  * @returns {Boolean} true or false
48
48
  */
49
49
  const isMobile = (userAgent) => {
50
- return !!(userAgent.toLowerCase().match(/android/i) ||
51
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
52
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
53
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
50
+ return !!(userAgent.toLowerCase().match(/android/i) ||
51
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
52
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
53
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
54
54
  };
55
55
  const getDevice = () => {
56
- let userAgent = window.navigator.userAgent;
57
- if (userAgent.toLowerCase().match(/android/i)) {
58
- return 'Android';
59
- }
60
- if (userAgent.toLowerCase().match(/iphone/i)) {
61
- return 'iPhone';
62
- }
63
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
64
- return 'iPad';
65
- }
66
- return 'PC';
67
- };
68
- const getDevicePlatform = () => {
69
- const device = getDevice();
70
- if (device) {
71
- if (device === 'PC') {
72
- return 'dk';
56
+ let userAgent = window.navigator.userAgent;
57
+ if (userAgent.toLowerCase().match(/android/i)) {
58
+ return 'Android';
73
59
  }
74
- else if (device === 'iPad' || device === 'iPhone') {
75
- return 'ios';
60
+ if (userAgent.toLowerCase().match(/iphone/i)) {
61
+ return 'iPhone';
76
62
  }
77
- else {
78
- return 'mtWeb';
63
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
64
+ return 'iPad';
65
+ }
66
+ return 'PC';
67
+ };
68
+ const getDevicePlatform = () => {
69
+ const device = getDevice();
70
+ if (device) {
71
+ if (device === 'PC') {
72
+ return 'dk';
73
+ }
74
+ else if (device === 'iPad' || device === 'iPhone') {
75
+ return 'ios';
76
+ }
77
+ else {
78
+ return 'mtWeb';
79
+ }
79
80
  }
80
- }
81
81
  };
82
82
 
83
- const generalTutorialSliderCss = ":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(--emfe-w-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(--emfe-w-color-secondary, #FD2839);\n}\n\n.DisabledArrow svg {\n opacity: 0.2;\n stroke: var(--emfe-w-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(--emfe-w-color-secondary, #FD2839);\n background: var(--emfe-w-color-secondary, #FD2839);\n}\n.DotsWrapper ul.Dots li.default {\n border: solid 1px var(--emfe-w-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\n .TutorialItems {\n height: inherit;\n }\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(--emfe-w-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}";
83
+ const generalTutorialSliderCss = ":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(--emfe-w-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(--emfe-w-color-secondary, #FD2839);\n}\n\n.DisabledArrow svg {\n opacity: 0.2;\n stroke: var(--emfe-w-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(--emfe-w-color-secondary, #FD2839);\n background: var(--emfe-w-color-secondary, #FD2839);\n}\n.DotsWrapper ul.Dots li.default {\n border: solid 1px var(--emfe-w-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(--emfe-w-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}";
84
+ const GeneralTutorialSliderStyle0 = generalTutorialSliderCss;
84
85
 
85
86
  const GeneralTutorialSlider = class {
86
- constructor(hostRef) {
87
- registerInstance(this, hostRef);
88
- /**
89
- * Client custom styling via inline style
90
- */
91
- this.clientStyling = '';
92
- /**
93
- * Client custom styling via url
94
- */
95
- this.clientStylingUrl = '';
96
- /**
97
- * Language of the widget
98
- */
99
- this.language = 'en';
100
- /**
101
- * User roles
102
- */
103
- this.userRoles = 'everyone';
104
- /**
105
- * CMS Endpoint stage
106
- */
107
- this.cmsEnv = 'stage';
108
- /**
109
- * Show slider dots
110
- */
111
- this.showSliderDots = true;
112
- /**
113
- * Show slider navigate arrows
114
- */
115
- this.showSliderArrows = true;
116
- /**
117
- * Show slider navigate arrows on mobile
118
- */
119
- this.showSliderArrowsMobile = false;
120
- /**
121
- * Auto-scroll will only function if it is set to true, and otherwise it will be ignored.
122
- */
123
- this.enableAutoScroll = false;
124
- /**
125
- * Set interval period for slider
126
- */
127
- this.intervalPeriod = 5000;
128
- /**
129
- * Set the number of slides you wish to display.
130
- */
131
- this.scrollItems = 1;
132
- /**
133
- * Set the number of slides you wish to display.
134
- */
135
- this.itemsPerPage = 1;
136
- this.hasErrors = false;
137
- this.limitStylingAppends = false;
138
- this.isLoading = true;
139
- this.activeIndex = 0;
140
- this.tutorialElementWidth = 0;
141
- this.userAgent = window.navigator.userAgent;
142
- this.isMobile = isMobile(this.userAgent);
143
- this.allElementsWidth = 0;
144
- this.xDown = null;
145
- this.yDown = null;
146
- this.resizeHandler = () => {
147
- this.recalculateItemsPerPage();
148
- };
149
- this.orientationChangeHandler = () => {
150
- setTimeout(() => {
87
+ constructor(hostRef) {
88
+ registerInstance(this, hostRef);
89
+ this.userAgent = window.navigator.userAgent;
90
+ this.isMobile = isMobile(this.userAgent);
91
+ this.allElementsWidth = 0;
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
+ };
120
+ this.clientStyling = '';
121
+ this.clientStylingUrl = '';
122
+ this.language = 'en';
123
+ this.cmsEndpoint = undefined;
124
+ this.userRoles = 'everyone';
125
+ this.cmsEnv = 'stage';
126
+ this.showSliderDots = true;
127
+ this.showSliderArrows = true;
128
+ this.showSliderArrowsMobile = false;
129
+ this.enableAutoScroll = false;
130
+ this.intervalPeriod = 5000;
131
+ this.scrollItems = 1;
132
+ this.itemsPerPage = 1;
133
+ this.hasErrors = false;
134
+ this.limitStylingAppends = false;
135
+ this.isLoading = true;
136
+ this.activeIndex = 0;
137
+ this.tutorialElementWidth = 0;
138
+ }
139
+ watchEndpoint(newValue, oldValue) {
140
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
141
+ this.getGeneralTutorialSlider().then((tutorialContent) => {
142
+ this.tutorialData = tutorialContent;
143
+ });
144
+ }
145
+ }
146
+ connectedCallback() {
147
+ window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
148
+ }
149
+ componentWillLoad() {
150
+ if (this.cmsEndpoint && this.language) {
151
+ return this.getGeneralTutorialSlider().then((tutorialContent) => {
152
+ this.tutorialData = tutorialContent;
153
+ });
154
+ }
155
+ }
156
+ componentDidLoad() {
157
+ window.addEventListener('resize', this.resizeHandler);
158
+ }
159
+ componentDidRender() {
160
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
161
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
151
162
  this.recalculateItemsPerPage();
152
- }, 10);
153
- };
154
- this.setClientStyling = () => {
155
- let sheet = document.createElement('style');
156
- sheet.innerHTML = this.clientStyling;
157
- this.stylingContainer.prepend(sheet);
158
- };
159
- this.setClientStylingURL = () => {
160
- let url = new URL(this.clientStylingUrl);
161
- let cssFile = document.createElement('style');
162
- fetch(url.href)
163
- .then((res) => res.text())
164
- .then((data) => {
165
- cssFile.innerHTML = data;
166
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
167
- })
168
- .catch((err) => {
169
- console.log('error ', err);
170
- });
171
- };
172
- }
173
- watchEndpoint(newValue, oldValue) {
174
- if (newValue && newValue != oldValue && this.cmsEndpoint) {
175
- this.getGeneralTutorialSlider().then((tutorialContent) => {
176
- this.tutorialData = tutorialContent;
177
- });
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
+ }
173
+ componentDidUpdate() {
174
+ this.recalculateItemsPerPage();
175
+ }
176
+ disconnectedCallback() {
177
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
178
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
179
+ window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
180
+ window.removeEventListener('resize', this.resizeHandler);
178
181
  }
179
- }
180
- connectedCallback() {
181
- window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
182
- }
183
- componentWillLoad() {
184
- if (this.cmsEndpoint && this.language) {
185
- return this.getGeneralTutorialSlider().then((tutorialContent) => {
186
- this.tutorialData = tutorialContent;
187
- });
182
+ getGeneralTutorialSlider() {
183
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
184
+ url.searchParams.append('env', this.cmsEnv);
185
+ url.searchParams.append('userRoles', this.userRoles);
186
+ url.searchParams.append('device', getDevicePlatform());
187
+ return new Promise((resolve, reject) => {
188
+ this.isLoading = true;
189
+ fetch(url.href)
190
+ .then((res) => res.json())
191
+ .then((tutorialContent) => {
192
+ resolve(tutorialContent);
193
+ }).catch((err) => {
194
+ console.error(err);
195
+ this.hasErrors = true;
196
+ reject(err);
197
+ }).finally(() => {
198
+ this.isLoading = false;
199
+ });
200
+ });
188
201
  }
189
- }
190
- componentDidLoad() {
191
- window.addEventListener('resize', this.resizeHandler);
192
- }
193
- componentDidRender() {
194
- this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
195
- this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
196
- this.recalculateItemsPerPage();
197
- // start custom styling area
198
- if (!this.limitStylingAppends && this.stylingContainer) {
199
- if (this.clientStyling)
200
- this.setClientStyling();
201
- if (this.clientStylingUrl)
202
- this.setClientStylingURL();
203
- this.limitStylingAppends = true;
202
+ move(direction) {
203
+ this.setActive(this.activeIndex + direction);
204
204
  }
205
- // end custom styling area
206
- }
207
- componentDidUpdate() {
208
- this.recalculateItemsPerPage();
209
- }
210
- disconnectedCallback() {
211
- this.el.removeEventListener('touchstart', this.handleTouchStart);
212
- this.el.removeEventListener('touchmove', this.handleTouchMove);
213
- window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
214
- window.removeEventListener('resize', this.resizeHandler);
215
- }
216
- getGeneralTutorialSlider() {
217
- let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
218
- url.searchParams.append('env', this.cmsEnv);
219
- url.searchParams.append('userRoles', this.userRoles);
220
- url.searchParams.append('device', getDevicePlatform());
221
- return new Promise((resolve, reject) => {
222
- this.isLoading = true;
223
- fetch(url.href)
224
- .then((res) => res.json())
225
- .then((tutorialContent) => {
226
- resolve(tutorialContent);
227
- }).catch((err) => {
228
- console.error(err);
229
- this.hasErrors = true;
230
- reject(err);
231
- }).finally(() => {
232
- this.isLoading = false;
233
- });
234
- });
235
- }
236
- move(direction) {
237
- this.setActive(this.activeIndex + direction);
238
- }
239
- ;
240
- //calculate itemsperpage by tutorials length to avoid empty in the tutorials end
241
- recalculateItemsPerPage() {
242
- if (!this.tutorialsElement)
243
- return;
244
- this.tutorialElementWidth = this.tutorialsElement.clientWidth;
245
- this.allElementsWidth = (this.tutorialData.length - 1) * this.tutorialElementWidth;
246
- }
247
- ;
248
- goTo(index) {
249
- let diff = this.activeIndex - index;
250
- if (diff > 0) {
251
- for (let i = 0; i < diff; i++) {
252
- this.move(-1);
253
- }
205
+ ;
206
+ //calculate itemsperpage by tutorials length to avoid empty in the tutorials end
207
+ recalculateItemsPerPage() {
208
+ if (!this.tutorialsElement)
209
+ return;
210
+ this.tutorialElementWidth = this.tutorialsElement.clientWidth;
211
+ this.allElementsWidth = (this.tutorialData.length - 1) * this.tutorialElementWidth;
254
212
  }
255
- else {
256
- for (let i = 0; i > diff; i--) {
257
- this.move(1);
258
- }
213
+ ;
214
+ goTo(index) {
215
+ let diff = this.activeIndex - index;
216
+ if (diff > 0) {
217
+ for (let i = 0; i < diff; i++) {
218
+ this.move(-1);
219
+ }
220
+ }
221
+ else {
222
+ for (let i = 0; i > diff; i--) {
223
+ this.move(1);
224
+ }
225
+ }
259
226
  }
260
- }
261
- handleTouchStart(evt) {
262
- const firstTouch = this.getTouches(evt)[0];
263
- this.xDown = firstTouch.clientX;
264
- this.yDown = firstTouch.clientY;
265
- }
266
- getTouches(evt) {
267
- return evt.touches || evt.originalEvent.touches;
268
- }
269
- handleTouchMove(evt) {
270
- if (!this.xDown || !this.yDown)
271
- return;
272
- let xUp = evt.touches[0].clientX;
273
- let yUp = evt.touches[0].clientY;
274
- let xDiff = this.xDown - xUp;
275
- let yDiff = this.yDown - yUp;
276
- if (Math.abs(xDiff) > Math.abs(yDiff)) {
277
- if (xDiff > 0) {
278
- this.move(1);
279
- }
280
- else {
281
- this.move(-1);
282
- }
227
+ handleTouchStart(evt) {
228
+ const firstTouch = this.getTouches(evt)[0];
229
+ this.xDown = firstTouch.clientX;
230
+ this.yDown = firstTouch.clientY;
283
231
  }
284
- this.xDown = null;
285
- this.yDown = null;
286
- }
287
- ;
288
- setActive(index) {
289
- const maxLength = this.tutorialData.length;
290
- if (index >= 0) {
291
- if (index >= maxLength - 1) {
292
- this.activeIndex = maxLength - 1;
293
- }
294
- else {
295
- this.activeIndex = index;
296
- }
232
+ getTouches(evt) {
233
+ return evt.touches || evt.originalEvent.touches;
297
234
  }
298
- else {
299
- this.activeIndex = 0;
235
+ handleTouchMove(evt) {
236
+ if (!this.xDown || !this.yDown)
237
+ return;
238
+ let xUp = evt.touches[0].clientX;
239
+ let yUp = evt.touches[0].clientY;
240
+ let xDiff = this.xDown - xUp;
241
+ let yDiff = this.yDown - yUp;
242
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
243
+ if (xDiff > 0) {
244
+ this.move(1);
245
+ }
246
+ else {
247
+ this.move(-1);
248
+ }
249
+ }
250
+ this.xDown = null;
251
+ this.yDown = null;
300
252
  }
301
- }
302
- renderDots() {
303
- const dots = [];
304
- for (let index = 0; index < this.tutorialData.length / this.itemsPerPage; index++) {
305
- dots.push(h("li", { class: index == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index); this.setActive(index); } }));
253
+ ;
254
+ setActive(index) {
255
+ const maxLength = this.tutorialData.length;
256
+ if (index >= 0) {
257
+ if (index >= maxLength - 1) {
258
+ this.activeIndex = maxLength - 1;
259
+ }
260
+ else {
261
+ this.activeIndex = index;
262
+ }
263
+ }
264
+ else {
265
+ this.activeIndex = 0;
266
+ }
306
267
  }
307
- return dots;
308
- }
309
- render() {
310
- const styles = {
311
- transform: `translate(${(this.allElementsWidth / (this.tutorialData.length - 1) * this.activeIndex) * -1}px, 0px)`
312
- };
313
- const itemStyle = {
314
- width: `${this.tutorialElementWidth / this.itemsPerPage}px`
315
- };
316
- if (this.hasErrors) {
317
- return (h("div", { class: "GeneralTutorialSliderError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
268
+ renderDots() {
269
+ const dots = [];
270
+ for (let index = 0; index < this.tutorialData.length / this.itemsPerPage; index++) {
271
+ dots.push(h("li", { class: index == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index); this.setActive(index); } }));
272
+ }
273
+ return dots;
318
274
  }
319
- if (!this.isLoading) {
320
- return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TutorialWrapper" }, h("div", { class: "TutorialContent", ref: (el) => this.slider = el }, ((this.showSliderArrows && !this.isMobile) ||
321
- (this.showSliderArrowsMobile && this.isMobile)) &&
322
- h("div", { class: this.activeIndex === 0 ? 'SliderNavButton DisabledArrow' : 'SliderNavButton', onClick: () => this.move(-1) }, h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), h("main", null, h("div", { style: styles, ref: (el) => this.tutorialsElement = el, class: "TutorialItems" }, this.tutorialData.map((data) => {
323
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
324
- return h("div", { class: "TutorialItem", style: itemStyle }, h("div", { class: "ItemTitle", innerHTML: data === null || data === void 0 ? void 0 : data.title }), ((_a = data === null || data === void 0 ? void 0 : data.media) === null || _a === void 0 ? void 0 : _a.images) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("img", { src: (_e = (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data.media) === null || _b === void 0 ? void 0 : _b.images[0]) === null || _c === void 0 ? void 0 : _c.sources) === null || _d === void 0 ? void 0 : _d.find((source) => source.media === 'mobile')) === null || _e === void 0 ? void 0 : _e.src, alt: data === null || data === void 0 ? void 0 : data.slug })) : (h("img", { src: (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.media) === null || _f === void 0 ? void 0 : _f.images[0]) === null || _g === void 0 ? void 0 : _g.sources) === null || _h === void 0 ? void 0 : _h.find((source) => source.media === 'desktop')) === null || _j === void 0 ? void 0 : _j.src, alt: data === null || data === void 0 ? void 0 : data.slug })))) : ((_k = data === null || data === void 0 ? void 0 : data.media) === null || _k === void 0 ? void 0 : _k.video) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("video", { controls: true, loop: true, autoplay: true }, h("source", { src: (_p = (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.media) === null || _l === void 0 ? void 0 : _l.video[0]) === null || _m === void 0 ? void 0 : _m.sources) === null || _o === void 0 ? void 0 : _o.find((source) => source.media === 'mobile')) === null || _p === void 0 ? void 0 : _p.src, type: "video/mp4" }))) : (h("video", { controls: true, loop: true, autoplay: true }, h("source", { src: (_t = (_s = (_r = (_q = data === null || data === void 0 ? void 0 : data.media) === null || _q === void 0 ? void 0 : _q.video[0]) === null || _r === void 0 ? void 0 : _r.sources) === null || _s === void 0 ? void 0 : _s.find((source) => source.media === 'desktop')) === null || _t === void 0 ? void 0 : _t.src, type: "video/mp4" }))))) : null, h("div", { class: "ItemDescription", innerHTML: data === null || data === void 0 ? void 0 : data.content }));
325
- }))), ((this.showSliderArrows && !this.isMobile) ||
326
- (this.showSliderArrowsMobile && this.isMobile)) &&
327
- h("div", { class: this.activeIndex === this.tutorialData.length - 1 ? ' SliderNavButton DisabledArrow disabled' : 'SliderNavButton', onClick: () => this.move(1) }, h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }))), h("div", null)), this.showSliderDots &&
328
- h("div", { class: "DotsWrapper" }, h("ul", { class: "Dots" }, this.renderDots())))));
275
+ render() {
276
+ const styles = {
277
+ transform: `translate(${(this.allElementsWidth / (this.tutorialData.length - 1) * this.activeIndex) * -1}px, 0px)`
278
+ };
279
+ const itemStyle = {
280
+ width: `${this.tutorialElementWidth / this.itemsPerPage}px`
281
+ };
282
+ if (this.hasErrors) {
283
+ return (h("div", { class: "GeneralTutorialSliderError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
284
+ }
285
+ if (!this.isLoading) {
286
+ return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TutorialWrapper" }, h("div", { class: "TutorialContent", ref: (el) => this.slider = el }, ((this.showSliderArrows && !this.isMobile) ||
287
+ (this.showSliderArrowsMobile && this.isMobile)) &&
288
+ h("div", { class: this.activeIndex === 0 ? 'SliderNavButton DisabledArrow' : 'SliderNavButton', onClick: () => this.move(-1) }, h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), h("main", null, h("div", { style: styles, ref: (el) => this.tutorialsElement = el, class: "TutorialItems" }, this.tutorialData.map((data) => {
289
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
290
+ return h("div", { class: "TutorialItem", style: itemStyle }, h("div", { class: "ItemTitle", innerHTML: data === null || data === void 0 ? void 0 : data.title }), ((_a = data === null || data === void 0 ? void 0 : data.media) === null || _a === void 0 ? void 0 : _a.images) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("img", { src: (_e = (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data.media) === null || _b === void 0 ? void 0 : _b.images[0]) === null || _c === void 0 ? void 0 : _c.sources) === null || _d === void 0 ? void 0 : _d.find((source) => source.media === 'mobile')) === null || _e === void 0 ? void 0 : _e.src, alt: data === null || data === void 0 ? void 0 : data.slug })) : (h("img", { src: (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.media) === null || _f === void 0 ? void 0 : _f.images[0]) === null || _g === void 0 ? void 0 : _g.sources) === null || _h === void 0 ? void 0 : _h.find((source) => source.media === 'desktop')) === null || _j === void 0 ? void 0 : _j.src, alt: data === null || data === void 0 ? void 0 : data.slug })))) : ((_k = data === null || data === void 0 ? void 0 : data.media) === null || _k === void 0 ? void 0 : _k.video) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("video", { controls: true, loop: true, autoplay: true }, h("source", { src: (_p = (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.media) === null || _l === void 0 ? void 0 : _l.video[0]) === null || _m === void 0 ? void 0 : _m.sources) === null || _o === void 0 ? void 0 : _o.find((source) => source.media === 'mobile')) === null || _p === void 0 ? void 0 : _p.src, type: "video/mp4" }))) : (h("video", { controls: true, loop: true, autoplay: true }, h("source", { src: (_t = (_s = (_r = (_q = data === null || data === void 0 ? void 0 : data.media) === null || _q === void 0 ? void 0 : _q.video[0]) === null || _r === void 0 ? void 0 : _r.sources) === null || _s === void 0 ? void 0 : _s.find((source) => source.media === 'desktop')) === null || _t === void 0 ? void 0 : _t.src, type: "video/mp4" }))))) : null, h("div", { class: "ItemDescription", innerHTML: data === null || data === void 0 ? void 0 : data.content }));
291
+ }))), ((this.showSliderArrows && !this.isMobile) ||
292
+ (this.showSliderArrowsMobile && this.isMobile)) &&
293
+ h("div", { class: this.activeIndex === this.tutorialData.length - 1 ? ' SliderNavButton DisabledArrow disabled' : 'SliderNavButton', onClick: () => this.move(1) }, h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }))), h("div", null)), this.showSliderDots &&
294
+ h("div", { class: "DotsWrapper" }, h("ul", { class: "Dots" }, this.renderDots())))));
295
+ }
329
296
  }
330
- }
331
- get el() { return getElement(this); }
332
- static get watchers() { return {
333
- "cmsEndpoint": ["watchEndpoint"],
334
- "language": ["watchEndpoint"]
335
- }; }
297
+ get el() { return getElement(this); }
298
+ static get watchers() { return {
299
+ "cmsEndpoint": ["watchEndpoint"],
300
+ "language": ["watchEndpoint"]
301
+ }; }
336
302
  };
337
- GeneralTutorialSlider.style = generalTutorialSliderCss;
303
+ GeneralTutorialSlider.style = GeneralTutorialSliderStyle0;
338
304
 
339
305
  export { GeneralTutorialSlider as general_tutorial_slider };