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