@everymatrix/general-slider-navigation 1.0.69
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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/carousel-component_2.cjs.entry.js +431 -0
- package/dist/cjs/general-slider-navigation.cjs.js +25 -0
- package/dist/cjs/index-88d9137e.js +1269 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/carousel-component/carousel-component.css +167 -0
- package/dist/collection/components/carousel-component/carousel-component.js +381 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.css +0 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +301 -0
- package/dist/collection/components/general-slider-navigation/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +62 -0
- package/dist/collection/utils/utils.js +56 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/carousel-component_2.entry.js +426 -0
- package/dist/esm/general-slider-navigation.js +20 -0
- package/dist/esm/index-c749968b.js +1242 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -0
- package/dist/general-slider-navigation/index.esm.js +0 -0
- package/dist/general-slider-navigation/p-8c0cd4b3.js +2 -0
- package/dist/general-slider-navigation/p-a4458d8c.entry.js +1 -0
- package/dist/general-slider-navigation/p-e1255160.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/carousel-component/carousel-component.d.ts +72 -0
- package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +56 -0
- package/dist/types/components/general-slider-navigation/index.d.ts +1 -0
- package/dist/types/components.d.ts +194 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +10 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88d9137e.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name isMobile
|
|
9
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
10
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
11
|
+
* @returns {Boolean} true or false
|
|
12
|
+
*/
|
|
13
|
+
const isMobile = (userAgent) => {
|
|
14
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
15
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
16
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
17
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
18
|
+
};
|
|
19
|
+
const getDevice = () => {
|
|
20
|
+
let userAgent = window.navigator.userAgent;
|
|
21
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
22
|
+
return 'Android';
|
|
23
|
+
}
|
|
24
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
25
|
+
return 'iPhone';
|
|
26
|
+
}
|
|
27
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
28
|
+
return 'iPad';
|
|
29
|
+
}
|
|
30
|
+
return 'PC';
|
|
31
|
+
};
|
|
32
|
+
const getDevicePlatform = () => {
|
|
33
|
+
const device = getDevice();
|
|
34
|
+
if (device) {
|
|
35
|
+
if (device === 'PC') {
|
|
36
|
+
return 'dk';
|
|
37
|
+
}
|
|
38
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
39
|
+
return 'ios';
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return 'mtWeb';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
function checkDeviceType() {
|
|
47
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
48
|
+
const width = screen.availWidth;
|
|
49
|
+
const height = screen.availHeight;
|
|
50
|
+
if (userAgent.includes('iphone')) {
|
|
51
|
+
return 'mobile';
|
|
52
|
+
}
|
|
53
|
+
if (userAgent.includes('android')) {
|
|
54
|
+
if (height > width && width < 800) {
|
|
55
|
+
return 'mobile';
|
|
56
|
+
}
|
|
57
|
+
if (width > height && height < 800) {
|
|
58
|
+
return 'tablet';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return 'desktop';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
65
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
|
|
66
|
+
const TRANSLATIONS = {
|
|
67
|
+
en: {
|
|
68
|
+
error: 'Error',
|
|
69
|
+
noResults: 'Loading, please wait ...',
|
|
70
|
+
joinNow: 'Join now'
|
|
71
|
+
},
|
|
72
|
+
hu: {
|
|
73
|
+
error: 'Error',
|
|
74
|
+
noResults: 'Loading, please wait ...',
|
|
75
|
+
joinNow: 'Join now'
|
|
76
|
+
},
|
|
77
|
+
ro: {
|
|
78
|
+
error: 'Eroare',
|
|
79
|
+
noResults: 'Loading, please wait ...',
|
|
80
|
+
joinNow: 'Join now'
|
|
81
|
+
},
|
|
82
|
+
fr: {
|
|
83
|
+
error: 'Error',
|
|
84
|
+
noResults: 'Loading, please wait ...',
|
|
85
|
+
joinNow: 'Join now'
|
|
86
|
+
},
|
|
87
|
+
ar: {
|
|
88
|
+
error: 'خطأ',
|
|
89
|
+
noResults: 'Loading, please wait ...',
|
|
90
|
+
joinNow: 'Join now'
|
|
91
|
+
},
|
|
92
|
+
hr: {
|
|
93
|
+
error: 'Greška',
|
|
94
|
+
noResults: 'Učitavanje, molimo pričekajte ...',
|
|
95
|
+
joinNow: 'Join now'
|
|
96
|
+
},
|
|
97
|
+
'pt-br': {
|
|
98
|
+
'error': 'Erro',
|
|
99
|
+
'noResults': 'Carregando, espere por favor…',
|
|
100
|
+
'joinNow': 'Join now'
|
|
101
|
+
},
|
|
102
|
+
'es-mx': {
|
|
103
|
+
'error': 'Error',
|
|
104
|
+
'noResults': 'Cargando, espere por favor…',
|
|
105
|
+
'joinNow': 'Join now'
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const getTranslations = (url) => {
|
|
109
|
+
return new Promise((resolve) => {
|
|
110
|
+
fetch(url)
|
|
111
|
+
.then((res) => res.json())
|
|
112
|
+
.then((data) => {
|
|
113
|
+
Object.keys(data).forEach((item) => {
|
|
114
|
+
for (let key in data[item]) {
|
|
115
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
resolve(true);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
const translate = (key, customLang) => {
|
|
123
|
+
const lang = customLang;
|
|
124
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const carouselComponentCss = ":host{display:block;font-family:\"Roboto\", sans-serif}html,body{padding:0;margin:0;width:100%;height:100%}.Carousel{position:relative;display:block;width:100%}.carousel__prev,.carousel__next{position:absolute;bottom:-15%;transition:transform 0.25s ease}.carousel__prev i,.carousel__next i{font-size:var(--emw--font-size-x-large, 60px);color:var(--emw-color-white, #FFFFFF);cursor:pointer}.carousel__prev:hover,.carousel__next:hover{transform:scale(1.25)}.carousel__prev{left:40%}.carousel__next{right:40%}.CarouselBody{width:100%;padding:80px 0px;overflow:hidden}.CarouselSlider{position:relative;transition:transform 1s ease-in-out;background:transparent;display:flex;align-items:center}.CarouselSliderItem{opacity:0.7;position:relative;display:block;float:left;box-sizing:border-box}.Item3dFrame{position:relative;width:100%;height:100%;transition:transform 1s ease-in-out, box-shadow 0.5s ease-in-out;transform-style:preserve-3d;display:flex;flex-direction:column;justify-content:flex-end;border-radius:var(--emw--button-border-radius, 20px)}.CarouselSliderItemActive .Item3dFrame{animation:glow 4s linear infinite}@keyframes glow{0%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}50%{box-shadow:0 0 50px 5px var(--emfe-w-color-secondary, #F2711C)}100%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}}.TopSection{display:flex;justify-content:flex-start;align-items:center}.JoinButton{background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, var(--emw-color-white, #FFFFFF) 30%));color:var(--emw--color-typography, #FFFFFF);height:42px;width:110px;border-radius:var(--emw--button-border-radius, 20px);cursor:pointer;font-size:var(--emw--size-small, 14px);border:2px solid var(--emw--button-border-color, #0E5924);display:flex;align-items:center;justify-content:center;gap:2px}.ItemSection{padding:12px 20px;display:flex;flex-direction:column;gap:2px}.Divider{border:none;border-top:2px solid var(--emw-color-white, #FFFFFF);width:100%;opacity:0.3}.BottomSection{display:flex;justify-content:flex-start;align-items:flex-start;width:50%;height:60px}.BottomSection h3{font-size:var(--emw--size-large, 24px);margin:0;color:var(--emw--color-typography, #FFFFFF)}.CarouselNavigation{display:flex;justify-content:center;align-items:center;position:absolute;bottom:20px;left:50%;transform:translateX(-50%)}.CarouselNavigationBullet{width:12px;height:12px;background-color:var(--emw-color-grey-100, rgba(255, 255, 255, 0.5));border-radius:50%;margin:0 5px;cursor:pointer;transition:background-color 0.3s}.CarouselNavigationBulletActive{background-color:var(--emw--color-primary, #22B04E)}.CarouselSliderItemActive{opacity:1}";
|
|
128
|
+
const CarouselComponentStyle0 = carouselComponentCss;
|
|
129
|
+
|
|
130
|
+
const CarouselComponent = class {
|
|
131
|
+
constructor(hostRef) {
|
|
132
|
+
index.registerInstance(this, hostRef);
|
|
133
|
+
this.userAgent = window.navigator.userAgent;
|
|
134
|
+
this.isMobile = isMobile(this.userAgent);
|
|
135
|
+
this.touchStartX = 0;
|
|
136
|
+
this.touchEndX = 0;
|
|
137
|
+
this.setClientStylingURL = () => {
|
|
138
|
+
let url = new URL(this.clientStylingUrl);
|
|
139
|
+
let cssFile = document.createElement('style');
|
|
140
|
+
fetch(url.href)
|
|
141
|
+
.then((res) => res.text())
|
|
142
|
+
.then((data) => {
|
|
143
|
+
cssFile.innerHTML = data;
|
|
144
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
145
|
+
})
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
console.log('error ', err);
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
this.setClientStyling = () => {
|
|
151
|
+
let sheet = document.createElement('style');
|
|
152
|
+
sheet.innerHTML = this.clientStyling;
|
|
153
|
+
this.stylingContainer.prepend(sheet);
|
|
154
|
+
};
|
|
155
|
+
this.moveSliderIndex = (index) => {
|
|
156
|
+
if (index < 1)
|
|
157
|
+
index = this.sliderData.length;
|
|
158
|
+
if (index > this.sliderData.length)
|
|
159
|
+
index = 1;
|
|
160
|
+
this.currIndex = index;
|
|
161
|
+
if (this.sliderElement) {
|
|
162
|
+
this.sliderElement.style.transform = this.getSliderTransformStyle();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
this.handleTouchStart = (event) => {
|
|
166
|
+
this.touchStartX = event.changedTouches[0].screenX;
|
|
167
|
+
};
|
|
168
|
+
this.handleTouchEnd = (event) => {
|
|
169
|
+
this.touchEndX = event.changedTouches[0].screenX;
|
|
170
|
+
this.handleSwipe();
|
|
171
|
+
};
|
|
172
|
+
this.navigationTo = (url, target, isExternal) => {
|
|
173
|
+
window.postMessage({ type: 'NavigateTo', path: url, target: target || null, externalLink: isExternal || false }, window.location.href);
|
|
174
|
+
};
|
|
175
|
+
this.changeSlider = (index) => {
|
|
176
|
+
if (index > this.currIndex - 1) {
|
|
177
|
+
this.next();
|
|
178
|
+
}
|
|
179
|
+
else if (index < this.currIndex - 1) {
|
|
180
|
+
this.prev();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
this.setImage = (image) => {
|
|
184
|
+
let source = '';
|
|
185
|
+
this.device = checkDeviceType();
|
|
186
|
+
switch (this.device) {
|
|
187
|
+
case 'mobile':
|
|
188
|
+
source = image.srcMobile;
|
|
189
|
+
break;
|
|
190
|
+
case 'tablet':
|
|
191
|
+
source = image.srcTablet;
|
|
192
|
+
break;
|
|
193
|
+
case 'desktop':
|
|
194
|
+
source = image.srcDesktop;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
return source;
|
|
198
|
+
};
|
|
199
|
+
this.clientStyling = '';
|
|
200
|
+
this.clientStylingUrl = '';
|
|
201
|
+
this.sliderData = undefined;
|
|
202
|
+
this.bulletNavigation = true;
|
|
203
|
+
this.language = 'en';
|
|
204
|
+
this.slideTimer = undefined;
|
|
205
|
+
this.translationUrl = '';
|
|
206
|
+
this.currIndex = 0;
|
|
207
|
+
this.width = undefined;
|
|
208
|
+
this.height = undefined;
|
|
209
|
+
this.margin = undefined;
|
|
210
|
+
this.sliderElement = undefined;
|
|
211
|
+
this.totalWidth = undefined;
|
|
212
|
+
this.device = '';
|
|
213
|
+
this.stylingAppends = false;
|
|
214
|
+
this.innerWidth = undefined;
|
|
215
|
+
}
|
|
216
|
+
handleNewTranslations() {
|
|
217
|
+
getTranslations(this.translationUrl);
|
|
218
|
+
}
|
|
219
|
+
async componentWillLoad() {
|
|
220
|
+
if (this.translationUrl.length > 2) {
|
|
221
|
+
await getTranslations(this.translationUrl);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
componentDidLoad() {
|
|
225
|
+
this.init();
|
|
226
|
+
this.calcInnerWidth();
|
|
227
|
+
}
|
|
228
|
+
componentDidRender() {
|
|
229
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
230
|
+
if (this.clientStyling)
|
|
231
|
+
this.setClientStyling();
|
|
232
|
+
if (this.clientStylingUrl)
|
|
233
|
+
this.setClientStylingURL();
|
|
234
|
+
this.stylingAppends = true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
init() {
|
|
238
|
+
this.moveSliderIndex(Math.floor(this.sliderData.length / 2));
|
|
239
|
+
this.bindEvents();
|
|
240
|
+
if (this.slideTimer > 0) {
|
|
241
|
+
this.timer();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
calcInnerWidth() {
|
|
245
|
+
const parent = this.el.parentElement;
|
|
246
|
+
// Check if the parent element exists and then get its width
|
|
247
|
+
if (parent) {
|
|
248
|
+
this.innerWidth = parent.offsetWidth;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.innerWidth = window.innerWidth;
|
|
252
|
+
}
|
|
253
|
+
this.resize();
|
|
254
|
+
}
|
|
255
|
+
resize() {
|
|
256
|
+
if (this.isMobile) {
|
|
257
|
+
this.width = Math.max(innerWidth * 0.3, 200);
|
|
258
|
+
this.height = window.innerHeight * 0.40;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
this.width = this.innerWidth > 1200 ? Math.max(this.innerWidth * 0.1, 300) : Math.max(this.innerWidth * 0.2, 200);
|
|
262
|
+
this.height = window.innerHeight * 0.55;
|
|
263
|
+
}
|
|
264
|
+
this.totalWidth = this.width * this.sliderData.length;
|
|
265
|
+
//this is where the margin gap between slides is calculated with the animation
|
|
266
|
+
this.margin = -5;
|
|
267
|
+
const children = this.sliderElement.children;
|
|
268
|
+
for (let i = 0; i < children.length; i++) {
|
|
269
|
+
const item = children[i];
|
|
270
|
+
item.style.margin = `0 ${this.margin}px`;
|
|
271
|
+
item.style.width = `${this.width - (this.margin * 2)}px`;
|
|
272
|
+
}
|
|
273
|
+
if (this.sliderElement) {
|
|
274
|
+
this.sliderElement.style.transform = this.getSliderTransformStyle();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
timer() {
|
|
278
|
+
this.clearTimer();
|
|
279
|
+
this.interval = setInterval(() => {
|
|
280
|
+
this.moveSliderIndex(++this.currIndex);
|
|
281
|
+
}, this.slideTimer * 1000);
|
|
282
|
+
}
|
|
283
|
+
disconnectedCallback() {
|
|
284
|
+
this.clearTimer();
|
|
285
|
+
}
|
|
286
|
+
clearTimer() {
|
|
287
|
+
if (this.interval) {
|
|
288
|
+
clearInterval(this.interval);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
prev() {
|
|
292
|
+
this.moveSliderIndex(--this.currIndex);
|
|
293
|
+
if (this.slideTimer > 0) {
|
|
294
|
+
this.timer();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
next() {
|
|
298
|
+
this.moveSliderIndex(++this.currIndex);
|
|
299
|
+
if (this.slideTimer > 0) {
|
|
300
|
+
this.timer();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
bindEvents() {
|
|
304
|
+
window.onresize = () => this.resize();
|
|
305
|
+
this.el.addEventListener('touchstart', this.handleTouchStart, false);
|
|
306
|
+
this.el.addEventListener('touchend', this.handleTouchEnd, false);
|
|
307
|
+
}
|
|
308
|
+
handleSwipe() {
|
|
309
|
+
if (this.touchEndX < this.touchStartX) {
|
|
310
|
+
this.next();
|
|
311
|
+
}
|
|
312
|
+
if (this.touchEndX > this.touchStartX) {
|
|
313
|
+
this.prev();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
getTransformStyle(index) {
|
|
317
|
+
const perspective = index === this.currIndex - 1 ? '1200px' : '900px';
|
|
318
|
+
const rotateY = index < this.currIndex - 1 ? '20deg' : '-20deg';
|
|
319
|
+
return index === this.currIndex - 1 ? `perspective(${perspective})` : `perspective(${perspective}) rotateY(${rotateY})`;
|
|
320
|
+
}
|
|
321
|
+
getSliderTransformStyle() {
|
|
322
|
+
return `translate3d(${((this.currIndex * -this.width) + (this.width / 2) + this.innerWidth / 2)}px, 0, 0)`;
|
|
323
|
+
}
|
|
324
|
+
renderNavigation() {
|
|
325
|
+
return (index.h("div", { class: "CarouselNavigation" }, this.sliderData.map((_item, index$1) => (index.h("div", { class: {
|
|
326
|
+
'CarouselNavigationBullet': true,
|
|
327
|
+
'CarouselNavigationBulletActive': index$1 === this.currIndex - 1,
|
|
328
|
+
}, onClick: this.moveSliderIndex.bind(this, index$1 + 1) })))));
|
|
329
|
+
}
|
|
330
|
+
render() {
|
|
331
|
+
return (index.h("div", { key: '09a6305f1745c24ac709c50cdb18218c5dd616d1', ref: el => this.stylingContainer = el }, index.h("div", { key: '1b61677ab956428b710c16b7bf71d5919e9aadf5', class: "Carousel" }, index.h("div", { key: '8f0c4f36f45695ee7c15c2435a39ded15abd39bf', class: "CarouselBody" }, index.h("div", { key: '341403c4164c1c24f39f050f37cc42b1cefee512', class: "CarouselSlider", ref: el => this.sliderElement = el, style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.sliderData.map((item, index$1) => {
|
|
332
|
+
const isActive = index$1 === this.currIndex - 1;
|
|
333
|
+
const buttonStyle = !isActive ? { cursor: 'unset' } : {};
|
|
334
|
+
const activeItemHeight = !isActive ? { height: `${this.height - 70}px` } : { height: `${this.height}px` };
|
|
335
|
+
return (index.h("div", { class: {
|
|
336
|
+
'CarouselSliderItem': true,
|
|
337
|
+
'CarouselSliderItemActive': isActive,
|
|
338
|
+
}, onClick: this.changeSlider.bind(this, index$1), style: activeItemHeight }, index.h("div", { class: "Item3dFrame", style: { backgroundSize: 'cover', backgroundPosition: 'center', backgroundImage: `url(${this.setImage(item.image)})`, transform: this.getTransformStyle(index$1) } }, index.h("div", { class: "ItemSection" }, index.h("div", { class: "TopSection" }, index.h("button", { onClick: () => {
|
|
339
|
+
if (isActive) {
|
|
340
|
+
this.navigationTo(item.url, item.targetType, item.externalLink);
|
|
341
|
+
}
|
|
342
|
+
}, style: buttonStyle, class: "JoinButton" }, index.h("span", null, translate('joinNow', this.language)), index.h("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M5 3L10 8L5 13", stroke: "white", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))), index.h("hr", { class: "Divider" }), index.h("div", { class: "BottomSection" }, index.h("h3", null, item.title.toUpperCase()))))));
|
|
343
|
+
}))), this.bulletNavigation ? this.renderNavigation() : null)));
|
|
344
|
+
}
|
|
345
|
+
get el() { return index.getElement(this); }
|
|
346
|
+
static get watchers() { return {
|
|
347
|
+
"translationUrl": ["handleNewTranslations"]
|
|
348
|
+
}; }
|
|
349
|
+
};
|
|
350
|
+
CarouselComponent.style = CarouselComponentStyle0;
|
|
351
|
+
|
|
352
|
+
const generalSliderNavigationCss = "";
|
|
353
|
+
const GeneralSliderNavigationStyle0 = generalSliderNavigationCss;
|
|
354
|
+
|
|
355
|
+
const GeneralSliderNavigation = class {
|
|
356
|
+
constructor(hostRef) {
|
|
357
|
+
index.registerInstance(this, hostRef);
|
|
358
|
+
this.clientStyling = '';
|
|
359
|
+
this.clientStylingUrl = '';
|
|
360
|
+
this.cmsEndpoint = undefined;
|
|
361
|
+
this.cmsEnv = 'stage';
|
|
362
|
+
this.language = 'en';
|
|
363
|
+
this.userRoles = 'everyone';
|
|
364
|
+
this.bulletNavigation = true;
|
|
365
|
+
this.slideTimer = undefined;
|
|
366
|
+
this.sliderMobileWidth = 200;
|
|
367
|
+
this.sliderDesktopWidth = 300;
|
|
368
|
+
this.translationUrl = '';
|
|
369
|
+
this.isLoading = true;
|
|
370
|
+
this.hasErrors = false;
|
|
371
|
+
this.device = '';
|
|
372
|
+
}
|
|
373
|
+
handleNewTranslations() {
|
|
374
|
+
getTranslations(this.translationUrl);
|
|
375
|
+
}
|
|
376
|
+
watchEndpoint(newValue, oldValue) {
|
|
377
|
+
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
378
|
+
this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
379
|
+
this.sliderData = GeneralSliderNavigation;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async componentWillLoad() {
|
|
384
|
+
if (this.translationUrl.length > 2) {
|
|
385
|
+
await getTranslations(this.translationUrl);
|
|
386
|
+
}
|
|
387
|
+
if (this.cmsEndpoint && this.language) {
|
|
388
|
+
return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
389
|
+
this.sliderData = GeneralSliderNavigation;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
getGeneralSliderNavigation() {
|
|
394
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
|
|
395
|
+
url.searchParams.append('env', this.cmsEnv);
|
|
396
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
397
|
+
url.searchParams.append('device', getDevicePlatform());
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
this.isLoading = true;
|
|
400
|
+
fetch(url.href)
|
|
401
|
+
.then((res) => res.json())
|
|
402
|
+
.then((menuSliderData) => {
|
|
403
|
+
resolve(menuSliderData.banners);
|
|
404
|
+
})
|
|
405
|
+
.catch((err) => {
|
|
406
|
+
console.error(err);
|
|
407
|
+
this.hasErrors = true;
|
|
408
|
+
reject(err);
|
|
409
|
+
}).finally(() => {
|
|
410
|
+
this.isLoading = false;
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
render() {
|
|
415
|
+
if (this.hasErrors) {
|
|
416
|
+
return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
|
|
417
|
+
}
|
|
418
|
+
if (!this.isLoading) {
|
|
419
|
+
return (index.h("div", null, index.h("carousel-component", { "slider-data": this.sliderData, language: this.language, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "slider-mobile-width": this.sliderMobileWidth, "slider-desktop-width": this.sliderDesktopWidth })));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
static get watchers() { return {
|
|
423
|
+
"translationUrl": ["handleNewTranslations"],
|
|
424
|
+
"cmsEndpoint": ["watchEndpoint"],
|
|
425
|
+
"language": ["watchEndpoint"]
|
|
426
|
+
}; }
|
|
427
|
+
};
|
|
428
|
+
GeneralSliderNavigation.style = GeneralSliderNavigationStyle0;
|
|
429
|
+
|
|
430
|
+
exports.carousel_component = CarouselComponent;
|
|
431
|
+
exports.general_slider_navigation = GeneralSliderNavigation;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88d9137e.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
|
|
10
|
+
*/
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-slider-navigation.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"sliderMobileWidth":[514,"slider-mobile-width"],"sliderDesktopWidth":[514,"slider-desktop-width"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"sliderData":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"stylingAppends":[32],"innerWidth":[32]},null,{"translationUrl":["handleNewTranslations"]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|