@everymatrix/general-slider-navigation 1.36.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/carousel-component_2.cjs.entry.js +442 -0
- package/dist/cjs/general-slider-navigation.cjs.js +2 -2
- package/dist/cjs/{index-3420513e.js → index-d69ac031.js} +0 -13
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/carousel-component/carousel-component.css +167 -0
- package/dist/collection/components/carousel-component/carousel-component.js +379 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.css +0 -282
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +34 -307
- package/dist/collection/utils/locale.utils.js +24 -2
- package/dist/components/carousel-component.d.ts +11 -0
- package/dist/components/carousel-component.js +6 -0
- package/dist/components/carousel-component2.js +374 -0
- package/dist/components/general-slider-navigation.js +25 -294
- package/dist/esm/carousel-component_2.entry.js +437 -0
- package/dist/esm/general-slider-navigation.js +2 -2
- package/dist/esm/{index-22e4ccbc.js → index-a33109c0.js} +0 -13
- package/dist/esm/loader.js +2 -2
- package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -1
- package/dist/general-slider-navigation/p-734ecc50.js +1 -0
- package/dist/general-slider-navigation/p-88323bff.entry.js +1 -0
- package/dist/types/components/carousel-component/carousel-component.d.ts +70 -0
- package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +7 -51
- package/dist/types/components.d.ts +77 -40
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/general-slider-navigation.cjs.entry.js +0 -369
- package/dist/esm/general-slider-navigation.entry.js +0 -365
- package/dist/general-slider-navigation/p-2f9afaa5.entry.js +0 -1
- package/dist/general-slider-navigation/p-b72fe935.js +0 -1
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-d69ac031.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:20px 0 50px 0;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
|
+
|
|
129
|
+
const CarouselComponent = class {
|
|
130
|
+
constructor(hostRef) {
|
|
131
|
+
index.registerInstance(this, hostRef);
|
|
132
|
+
/**
|
|
133
|
+
* Client custom styling via inline style
|
|
134
|
+
*/
|
|
135
|
+
this.clientStyling = '';
|
|
136
|
+
/**
|
|
137
|
+
* Client custom styling via url
|
|
138
|
+
*/
|
|
139
|
+
this.clientStylingUrl = '';
|
|
140
|
+
/**
|
|
141
|
+
* Show bullet navigation under slides
|
|
142
|
+
*/
|
|
143
|
+
this.bulletNavigation = true;
|
|
144
|
+
/**
|
|
145
|
+
* Language of the widget
|
|
146
|
+
*/
|
|
147
|
+
this.language = 'en';
|
|
148
|
+
/**
|
|
149
|
+
* Translation via url
|
|
150
|
+
*/
|
|
151
|
+
this.translationUrl = '';
|
|
152
|
+
this.currIndex = 0;
|
|
153
|
+
this.device = '';
|
|
154
|
+
this.stylingAppends = false;
|
|
155
|
+
this.userAgent = window.navigator.userAgent;
|
|
156
|
+
this.isMobile = isMobile(this.userAgent);
|
|
157
|
+
this.touchStartX = 0;
|
|
158
|
+
this.touchEndX = 0;
|
|
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
|
+
this.setClientStyling = () => {
|
|
173
|
+
let sheet = document.createElement('style');
|
|
174
|
+
sheet.innerHTML = this.clientStyling;
|
|
175
|
+
this.stylingContainer.prepend(sheet);
|
|
176
|
+
};
|
|
177
|
+
this.moveSliderIndex = (index) => {
|
|
178
|
+
if (index < 1)
|
|
179
|
+
index = this.sliderData.length;
|
|
180
|
+
if (index > this.sliderData.length)
|
|
181
|
+
index = 1;
|
|
182
|
+
this.currIndex = index;
|
|
183
|
+
if (this.sliderElement) {
|
|
184
|
+
this.sliderElement.style.transform = this.getSliderTransformStyle();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
this.handleTouchStart = (event) => {
|
|
188
|
+
this.touchStartX = event.changedTouches[0].screenX;
|
|
189
|
+
};
|
|
190
|
+
this.handleTouchEnd = (event) => {
|
|
191
|
+
this.touchEndX = event.changedTouches[0].screenX;
|
|
192
|
+
this.handleSwipe();
|
|
193
|
+
};
|
|
194
|
+
this.navigationTo = (url, target, isExternal) => {
|
|
195
|
+
window.postMessage({ type: 'NavigateTo', path: url, target: target || null, externalLink: isExternal || false }, window.location.href);
|
|
196
|
+
};
|
|
197
|
+
this.changeSlider = (index) => {
|
|
198
|
+
if (index > this.currIndex - 1) {
|
|
199
|
+
this.next();
|
|
200
|
+
}
|
|
201
|
+
else if (index < this.currIndex - 1) {
|
|
202
|
+
this.prev();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
this.setImage = (image) => {
|
|
206
|
+
let source = '';
|
|
207
|
+
this.device = checkDeviceType();
|
|
208
|
+
switch (this.device) {
|
|
209
|
+
case 'mobile':
|
|
210
|
+
source = image.srcMobile;
|
|
211
|
+
break;
|
|
212
|
+
case 'tablet':
|
|
213
|
+
source = image.srcTablet;
|
|
214
|
+
break;
|
|
215
|
+
case 'desktop':
|
|
216
|
+
source = image.srcDesktop;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
return source;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
handleNewTranslations() {
|
|
223
|
+
getTranslations(this.translationUrl);
|
|
224
|
+
}
|
|
225
|
+
async componentWillLoad() {
|
|
226
|
+
if (this.translationUrl.length > 2) {
|
|
227
|
+
await getTranslations(this.translationUrl);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
componentDidLoad() {
|
|
231
|
+
this.init();
|
|
232
|
+
}
|
|
233
|
+
componentDidRender() {
|
|
234
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
235
|
+
if (this.clientStyling)
|
|
236
|
+
this.setClientStyling();
|
|
237
|
+
if (this.clientStylingUrl)
|
|
238
|
+
this.setClientStylingURL();
|
|
239
|
+
this.stylingAppends = true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
init() {
|
|
243
|
+
this.resize();
|
|
244
|
+
this.moveSliderIndex(Math.floor(this.sliderData.length / 2));
|
|
245
|
+
this.bindEvents();
|
|
246
|
+
if (this.slideTimer > 0) {
|
|
247
|
+
this.timer();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
resize() {
|
|
251
|
+
if (this.isMobile) {
|
|
252
|
+
this.width = Math.max(window.innerWidth * 0.3, 200);
|
|
253
|
+
this.height = window.innerHeight * 0.40;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
this.width = Math.max(window.innerWidth * 0.2, 275);
|
|
257
|
+
this.height = window.innerHeight * 0.55;
|
|
258
|
+
}
|
|
259
|
+
this.totalWidth = this.width * this.sliderData.length;
|
|
260
|
+
//this is where the margin gap between slides is calculated with the animation
|
|
261
|
+
this.margin = -5;
|
|
262
|
+
const children = this.sliderElement.children;
|
|
263
|
+
for (let i = 0; i < children.length; i++) {
|
|
264
|
+
const item = children[i];
|
|
265
|
+
item.style.margin = `0 ${this.margin}px`;
|
|
266
|
+
item.style.width = `${this.width - (this.margin * 2)}px`;
|
|
267
|
+
}
|
|
268
|
+
if (this.sliderElement) {
|
|
269
|
+
this.sliderElement.style.transform = this.getSliderTransformStyle();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
timer() {
|
|
273
|
+
this.clearTimer();
|
|
274
|
+
this.interval = setInterval(() => {
|
|
275
|
+
this.moveSliderIndex(++this.currIndex);
|
|
276
|
+
}, this.slideTimer * 1000);
|
|
277
|
+
}
|
|
278
|
+
disconnectedCallback() {
|
|
279
|
+
this.clearTimer();
|
|
280
|
+
}
|
|
281
|
+
clearTimer() {
|
|
282
|
+
if (this.interval) {
|
|
283
|
+
clearInterval(this.interval);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
prev() {
|
|
287
|
+
this.moveSliderIndex(--this.currIndex);
|
|
288
|
+
if (this.slideTimer > 0) {
|
|
289
|
+
this.timer();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
next() {
|
|
293
|
+
this.moveSliderIndex(++this.currIndex);
|
|
294
|
+
if (this.slideTimer > 0) {
|
|
295
|
+
this.timer();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
bindEvents() {
|
|
299
|
+
window.onresize = () => this.resize();
|
|
300
|
+
this.el.addEventListener('touchstart', this.handleTouchStart, false);
|
|
301
|
+
this.el.addEventListener('touchend', this.handleTouchEnd, false);
|
|
302
|
+
}
|
|
303
|
+
handleSwipe() {
|
|
304
|
+
if (this.touchEndX < this.touchStartX) {
|
|
305
|
+
this.next();
|
|
306
|
+
}
|
|
307
|
+
if (this.touchEndX > this.touchStartX) {
|
|
308
|
+
this.prev();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
getTransformStyle(index) {
|
|
312
|
+
const perspective = index === this.currIndex - 1 ? '1200px' : '900px';
|
|
313
|
+
const rotateY = index < this.currIndex - 1 ? '20deg' : '-20deg';
|
|
314
|
+
return index === this.currIndex - 1 ? `perspective(${perspective})` : `perspective(${perspective}) rotateY(${rotateY})`;
|
|
315
|
+
}
|
|
316
|
+
getSliderTransformStyle() {
|
|
317
|
+
return `translate3d(${((this.currIndex * -this.width) + (this.width / 2) + window.innerWidth / 2)}px, 0, 0)`;
|
|
318
|
+
}
|
|
319
|
+
renderNavigation() {
|
|
320
|
+
return (index.h("div", { class: "CarouselNavigation" }, this.sliderData.map((_item, index$1) => (index.h("div", { class: {
|
|
321
|
+
'CarouselNavigationBullet': true,
|
|
322
|
+
'CarouselNavigationBulletActive': index$1 === this.currIndex - 1,
|
|
323
|
+
}, onClick: this.moveSliderIndex.bind(this, index$1 + 1) })))));
|
|
324
|
+
}
|
|
325
|
+
render() {
|
|
326
|
+
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "Carousel" }, index.h("div", { class: "CarouselBody" }, index.h("div", { class: "CarouselSlider", ref: el => this.sliderElement = el, style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.sliderData.map((item, index$1) => {
|
|
327
|
+
const isActive = index$1 === this.currIndex - 1;
|
|
328
|
+
const buttonStyle = !isActive ? { cursor: 'unset' } : {};
|
|
329
|
+
const activeItemHeight = !isActive ? { height: `${this.height - 70}px` } : { height: `${this.height}px` };
|
|
330
|
+
return (index.h("div", { class: {
|
|
331
|
+
'CarouselSliderItem': true,
|
|
332
|
+
'CarouselSliderItemActive': isActive,
|
|
333
|
+
}, 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: () => {
|
|
334
|
+
if (isActive) {
|
|
335
|
+
this.navigationTo(item.url, item.targetType, item.externalLink);
|
|
336
|
+
}
|
|
337
|
+
}, 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()))))));
|
|
338
|
+
}))), this.bulletNavigation ? this.renderNavigation() : null)));
|
|
339
|
+
}
|
|
340
|
+
get el() { return index.getElement(this); }
|
|
341
|
+
static get watchers() { return {
|
|
342
|
+
"translationUrl": ["handleNewTranslations"]
|
|
343
|
+
}; }
|
|
344
|
+
};
|
|
345
|
+
CarouselComponent.style = carouselComponentCss;
|
|
346
|
+
|
|
347
|
+
const generalSliderNavigationCss = "";
|
|
348
|
+
|
|
349
|
+
const GeneralSliderNavigation = class {
|
|
350
|
+
constructor(hostRef) {
|
|
351
|
+
index.registerInstance(this, hostRef);
|
|
352
|
+
/**
|
|
353
|
+
* Client custom styling via inline style
|
|
354
|
+
*/
|
|
355
|
+
this.clientStyling = '';
|
|
356
|
+
/**
|
|
357
|
+
* Client custom styling via url
|
|
358
|
+
*/
|
|
359
|
+
this.clientStylingUrl = '';
|
|
360
|
+
/**
|
|
361
|
+
* CMS Endpoint stage
|
|
362
|
+
*/
|
|
363
|
+
this.cmsEnv = 'stage';
|
|
364
|
+
/**
|
|
365
|
+
* Language of the widget
|
|
366
|
+
*/
|
|
367
|
+
this.language = 'en';
|
|
368
|
+
/**
|
|
369
|
+
* User roles
|
|
370
|
+
*/
|
|
371
|
+
this.userRoles = 'everyone';
|
|
372
|
+
/**
|
|
373
|
+
* Show bullet navigation under slides
|
|
374
|
+
*/
|
|
375
|
+
this.bulletNavigation = true;
|
|
376
|
+
/**
|
|
377
|
+
* Translation via url
|
|
378
|
+
*/
|
|
379
|
+
this.translationUrl = '';
|
|
380
|
+
this.isLoading = true;
|
|
381
|
+
this.hasErrors = false;
|
|
382
|
+
this.device = '';
|
|
383
|
+
}
|
|
384
|
+
handleNewTranslations() {
|
|
385
|
+
getTranslations(this.translationUrl);
|
|
386
|
+
}
|
|
387
|
+
watchEndpoint(newValue, oldValue) {
|
|
388
|
+
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
389
|
+
this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
390
|
+
this.sliderData = GeneralSliderNavigation;
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
async componentWillLoad() {
|
|
395
|
+
if (this.translationUrl.length > 2) {
|
|
396
|
+
await getTranslations(this.translationUrl);
|
|
397
|
+
}
|
|
398
|
+
if (this.cmsEndpoint && this.language) {
|
|
399
|
+
return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
400
|
+
this.sliderData = GeneralSliderNavigation;
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
getGeneralSliderNavigation() {
|
|
405
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
|
|
406
|
+
url.searchParams.append('env', this.cmsEnv);
|
|
407
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
408
|
+
url.searchParams.append('device', getDevicePlatform());
|
|
409
|
+
return new Promise((resolve, reject) => {
|
|
410
|
+
this.isLoading = true;
|
|
411
|
+
fetch(url.href)
|
|
412
|
+
.then((res) => res.json())
|
|
413
|
+
.then((menuSliderData) => {
|
|
414
|
+
resolve(menuSliderData.banners);
|
|
415
|
+
})
|
|
416
|
+
.catch((err) => {
|
|
417
|
+
console.error(err);
|
|
418
|
+
this.hasErrors = true;
|
|
419
|
+
reject(err);
|
|
420
|
+
}).finally(() => {
|
|
421
|
+
this.isLoading = false;
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
render() {
|
|
426
|
+
if (this.hasErrors) {
|
|
427
|
+
return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
|
|
428
|
+
}
|
|
429
|
+
if (!this.isLoading) {
|
|
430
|
+
return (index.h("div", null, index.h("carousel-component", { sliderData: this.sliderData, language: this.language, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, bulletNavigation: this.bulletNavigation, slideTimer: this.slideTimer, translationUrl: this.translationUrl })));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
static get watchers() { return {
|
|
434
|
+
"translationUrl": ["handleNewTranslations"],
|
|
435
|
+
"cmsEndpoint": ["watchEndpoint"],
|
|
436
|
+
"language": ["watchEndpoint"]
|
|
437
|
+
}; }
|
|
438
|
+
};
|
|
439
|
+
GeneralSliderNavigation.style = generalSliderNavigationCss;
|
|
440
|
+
|
|
441
|
+
exports.carousel_component = CarouselComponent;
|
|
442
|
+
exports.general_slider_navigation = GeneralSliderNavigation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-d69ac031.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["
|
|
18
|
+
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"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]}],[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]}]]]], options);
|
|
19
19
|
});
|
|
@@ -729,9 +729,6 @@ const postUpdateComponent = (hostRef) => {
|
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
else {
|
|
732
|
-
{
|
|
733
|
-
safeCall(instance, 'componentDidUpdate');
|
|
734
|
-
}
|
|
735
732
|
endPostUpdate();
|
|
736
733
|
}
|
|
737
734
|
// load events fire from bottom to top
|
|
@@ -1009,7 +1006,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1009
1006
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1010
1007
|
}
|
|
1011
1008
|
endNewInstance();
|
|
1012
|
-
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1013
1009
|
}
|
|
1014
1010
|
if (Cstr.style) {
|
|
1015
1011
|
// this component has styles but we haven't registered them yet
|
|
@@ -1038,11 +1034,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1038
1034
|
schedule();
|
|
1039
1035
|
}
|
|
1040
1036
|
};
|
|
1041
|
-
const fireConnectedCallback = (instance) => {
|
|
1042
|
-
{
|
|
1043
|
-
safeCall(instance, 'connectedCallback');
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
1037
|
const connectedCallback = (elm) => {
|
|
1047
1038
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1048
1039
|
const hostRef = getHostRef(elm);
|
|
@@ -1081,10 +1072,6 @@ const connectedCallback = (elm) => {
|
|
|
1081
1072
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
1082
1073
|
}
|
|
1083
1074
|
}
|
|
1084
|
-
else {
|
|
1085
|
-
// fire off connectedCallback() on component instance
|
|
1086
|
-
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1087
|
-
}
|
|
1088
1075
|
endConnected();
|
|
1089
1076
|
}
|
|
1090
1077
|
};
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-d69ac031.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["
|
|
17
|
+
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"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]}],[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]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|