@everymatrix/general-slider-navigation 1.44.0 → 1.45.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.
Files changed (55) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/carousel-component_2.cjs.entry.js +392 -419
  3. package/dist/cjs/general-slider-navigation.cjs.js +17 -11
  4. package/dist/cjs/index-88d9137e.js +1269 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/collection/collection-manifest.json +4 -4
  7. package/dist/collection/components/carousel-component/carousel-component.css +0 -2
  8. package/dist/collection/components/carousel-component/carousel-component.js +360 -400
  9. package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +293 -310
  10. package/dist/collection/components/general-slider-navigation/index.js +1 -0
  11. package/dist/collection/utils/locale.utils.js +56 -56
  12. package/dist/collection/utils/utils.js +39 -39
  13. package/dist/esm/app-globals-0f993ce5.js +3 -0
  14. package/dist/esm/carousel-component_2.entry.js +392 -419
  15. package/dist/esm/general-slider-navigation.js +14 -11
  16. package/dist/esm/index-c749968b.js +1242 -0
  17. package/dist/esm/loader.js +7 -13
  18. package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -1
  19. package/dist/general-slider-navigation/p-8c0cd4b3.js +2 -0
  20. package/dist/general-slider-navigation/p-c1626bea.entry.js +1 -0
  21. package/dist/general-slider-navigation/p-e1255160.js +1 -0
  22. package/dist/stencil.config.dev.js +17 -0
  23. package/dist/stencil.config.js +14 -19
  24. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +2 -0
  25. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +2 -0
  26. package/dist/types/components/carousel-component/carousel-component.d.ts +70 -77
  27. package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +54 -54
  28. package/dist/types/components/general-slider-navigation/index.d.ts +1 -0
  29. package/dist/types/components.d.ts +0 -16
  30. package/dist/types/stencil-public-runtime.d.ts +142 -33
  31. package/loader/cdn.js +1 -3
  32. package/loader/index.cjs.js +1 -3
  33. package/loader/index.d.ts +13 -1
  34. package/loader/index.es2017.js +1 -3
  35. package/loader/index.js +1 -3
  36. package/loader/package.json +1 -0
  37. package/package.json +8 -1
  38. package/dist/cjs/index-d69ac031.js +0 -1269
  39. package/dist/components/carousel-component.d.ts +0 -11
  40. package/dist/components/carousel-component.js +0 -6
  41. package/dist/components/carousel-component2.js +0 -386
  42. package/dist/components/general-slider-navigation.d.ts +0 -11
  43. package/dist/components/general-slider-navigation.js +0 -144
  44. package/dist/components/index.d.ts +0 -26
  45. package/dist/components/index.js +0 -1
  46. package/dist/esm/index-a33109c0.js +0 -1243
  47. package/dist/esm/polyfills/core-js.js +0 -11
  48. package/dist/esm/polyfills/css-shim.js +0 -1
  49. package/dist/esm/polyfills/dom.js +0 -79
  50. package/dist/esm/polyfills/es5-html-element.js +0 -1
  51. package/dist/esm/polyfills/index.js +0 -34
  52. package/dist/esm/polyfills/system.js +0 -6
  53. package/dist/general-slider-navigation/p-6da4364f.entry.js +0 -1
  54. package/dist/general-slider-navigation/p-734ecc50.js +0 -1
  55. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-slider-navigation/.stencil/packages/general-slider-navigation/stencil.config.d.ts +0 -2
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface CarouselComponent extends Components.CarouselComponent, HTMLElement {}
4
- export const CarouselComponent: {
5
- prototype: CarouselComponent;
6
- new (): CarouselComponent;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,6 +0,0 @@
1
- import { C as CarouselComponent$1, d as defineCustomElement$1 } from './carousel-component2.js';
2
-
3
- const CarouselComponent = CarouselComponent$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { CarouselComponent, defineCustomElement };
@@ -1,386 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
-
3
- /**
4
- * @name isMobile
5
- * @description A method that returns if the browser used to access the app is from a mobile device or not
6
- * @param {String} userAgent window.navigator.userAgent
7
- * @returns {Boolean} true or false
8
- */
9
- const isMobile = (userAgent) => {
10
- return !!(userAgent.toLowerCase().match(/android/i) ||
11
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
12
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
13
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
14
- };
15
- const getDevice = () => {
16
- let userAgent = window.navigator.userAgent;
17
- if (userAgent.toLowerCase().match(/android/i)) {
18
- return 'Android';
19
- }
20
- if (userAgent.toLowerCase().match(/iphone/i)) {
21
- return 'iPhone';
22
- }
23
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
24
- return 'iPad';
25
- }
26
- return 'PC';
27
- };
28
- const getDevicePlatform = () => {
29
- const device = getDevice();
30
- if (device) {
31
- if (device === 'PC') {
32
- return 'dk';
33
- }
34
- else if (device === 'iPad' || device === 'iPhone') {
35
- return 'ios';
36
- }
37
- else {
38
- return 'mtWeb';
39
- }
40
- }
41
- };
42
- function checkDeviceType() {
43
- const userAgent = navigator.userAgent.toLowerCase();
44
- const width = screen.availWidth;
45
- const height = screen.availHeight;
46
- if (userAgent.includes('iphone')) {
47
- return 'mobile';
48
- }
49
- if (userAgent.includes('android')) {
50
- if (height > width && width < 800) {
51
- return 'mobile';
52
- }
53
- if (width > height && height < 800) {
54
- return 'tablet';
55
- }
56
- }
57
- return 'desktop';
58
- }
59
-
60
- const DEFAULT_LANGUAGE = 'en';
61
- const TRANSLATIONS = {
62
- en: {
63
- error: 'Error',
64
- noResults: 'Loading, please wait ...',
65
- joinNow: 'Join now'
66
- },
67
- hu: {
68
- error: 'Error',
69
- noResults: 'Loading, please wait ...',
70
- joinNow: 'Join now'
71
- },
72
- ro: {
73
- error: 'Eroare',
74
- noResults: 'Loading, please wait ...',
75
- joinNow: 'Join now'
76
- },
77
- fr: {
78
- error: 'Error',
79
- noResults: 'Loading, please wait ...',
80
- joinNow: 'Join now'
81
- },
82
- ar: {
83
- error: 'خطأ',
84
- noResults: 'Loading, please wait ...',
85
- joinNow: 'Join now'
86
- },
87
- hr: {
88
- error: 'Greška',
89
- noResults: 'Učitavanje, molimo pričekajte ...',
90
- joinNow: 'Join now'
91
- },
92
- 'pt-br': {
93
- 'error': 'Erro',
94
- 'noResults': 'Carregando, espere por favor…',
95
- 'joinNow': 'Join now'
96
- },
97
- 'es-mx': {
98
- 'error': 'Error',
99
- 'noResults': 'Cargando, espere por favor…',
100
- 'joinNow': 'Join now'
101
- }
102
- };
103
- const getTranslations = (url) => {
104
- return new Promise((resolve) => {
105
- fetch(url)
106
- .then((res) => res.json())
107
- .then((data) => {
108
- Object.keys(data).forEach((lang) => {
109
- if (!TRANSLATIONS[lang]) {
110
- TRANSLATIONS[lang] = {};
111
- }
112
- for (let key in data[lang]) {
113
- TRANSLATIONS[lang][key] = data[lang][key];
114
- }
115
- });
116
- resolve(true);
117
- });
118
- });
119
- };
120
- const translate = (key, customLang) => {
121
- const lang = customLang;
122
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
123
- };
124
-
125
- 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;height:400px}.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;height:470px}";
126
-
127
- const CarouselComponent = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
128
- constructor() {
129
- super();
130
- this.__registerHost();
131
- this.__attachShadow();
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
- this.calcInnerWidth();
233
- }
234
- componentDidRender() {
235
- if (!this.stylingAppends && this.stylingContainer) {
236
- if (this.clientStyling)
237
- this.setClientStyling();
238
- if (this.clientStylingUrl)
239
- this.setClientStylingURL();
240
- this.stylingAppends = true;
241
- }
242
- }
243
- init() {
244
- this.moveSliderIndex(Math.ceil(this.sliderData.length / 2));
245
- this.bindEvents();
246
- if (this.slideTimer > 0) {
247
- this.timer();
248
- }
249
- }
250
- calcInnerWidth() {
251
- const parent = this.el.parentElement;
252
- // Check if the parent element exists and then get its width
253
- if (parent) {
254
- this.innerWidth = parent.offsetWidth;
255
- }
256
- else {
257
- this.innerWidth = window.innerWidth;
258
- }
259
- this.resize();
260
- }
261
- resize() {
262
- if (this.isMobile) {
263
- this.width = Math.max(innerWidth * 0.3, this.sliderMobileWidth);
264
- }
265
- else {
266
- this.width = Math.max(this.innerWidth * 0.1, this.sliderDesktopWidth);
267
- }
268
- this.totalWidth = this.width * this.sliderData.length;
269
- //this is where the margin gap between slides is calculated with the animation
270
- this.margin = -5;
271
- const children = this.sliderElement.children;
272
- for (let i = 0; i < children.length; i++) {
273
- const item = children[i];
274
- item.style.margin = `0 ${this.margin}px`;
275
- item.style.width = `${this.width - (this.margin * 2)}px`;
276
- }
277
- if (this.sliderElement) {
278
- this.sliderElement.style.transform = this.getSliderTransformStyle();
279
- }
280
- }
281
- timer() {
282
- this.clearTimer();
283
- this.interval = setInterval(() => {
284
- this.moveSliderIndex(++this.currIndex);
285
- }, this.slideTimer * 1000);
286
- }
287
- disconnectedCallback() {
288
- this.clearTimer();
289
- }
290
- clearTimer() {
291
- if (this.interval) {
292
- clearInterval(this.interval);
293
- }
294
- }
295
- prev() {
296
- this.moveSliderIndex(--this.currIndex);
297
- if (this.slideTimer > 0) {
298
- this.timer();
299
- }
300
- }
301
- next() {
302
- this.moveSliderIndex(++this.currIndex);
303
- if (this.slideTimer > 0) {
304
- this.timer();
305
- }
306
- }
307
- bindEvents() {
308
- window.onresize = () => this.resize();
309
- this.el.addEventListener('touchstart', this.handleTouchStart, false);
310
- this.el.addEventListener('touchend', this.handleTouchEnd, false);
311
- }
312
- handleSwipe() {
313
- if (this.touchEndX < this.touchStartX) {
314
- this.next();
315
- }
316
- if (this.touchEndX > this.touchStartX) {
317
- this.prev();
318
- }
319
- }
320
- getTransformStyle(index) {
321
- const perspective = index === this.currIndex - 1 ? '1200px' : '900px';
322
- const rotateY = index < this.currIndex - 1 ? '20deg' : '-20deg';
323
- return index === this.currIndex - 1 ? `perspective(${perspective})` : `perspective(${perspective}) rotateY(${rotateY})`;
324
- }
325
- getSliderTransformStyle() {
326
- return `translate3d(${((this.currIndex * -this.width) + (this.width / 2) + this.innerWidth / 2)}px, 0, 0)`;
327
- }
328
- renderNavigation() {
329
- return (h("div", { class: "CarouselNavigation" }, this.sliderData.map((_item, index) => (h("div", { class: {
330
- 'CarouselNavigationBullet': true,
331
- 'CarouselNavigationBulletActive': index === this.currIndex - 1,
332
- }, onClick: this.moveSliderIndex.bind(this, index + 1) })))));
333
- }
334
- render() {
335
- return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "Carousel" }, h("div", { class: "CarouselBody" }, h("div", { class: "CarouselSlider", ref: el => this.sliderElement = el, style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.sliderData.map((item, index) => {
336
- const isActive = index === this.currIndex - 1;
337
- const buttonStyle = !isActive ? { cursor: 'unset' } : {};
338
- return (h("div", { class: {
339
- 'CarouselSliderItem': true,
340
- 'CarouselSliderItemActive': isActive,
341
- }, onClick: this.changeSlider.bind(this, index) }, h("div", { class: "Item3dFrame", style: { backgroundSize: 'cover', backgroundPosition: 'center', backgroundImage: `url(${this.setImage(item.image)})`, transform: this.getTransformStyle(index) } }, h("div", { class: "ItemSection" }, h("div", { class: "TopSection" }, h("button", { onClick: () => {
342
- if (isActive) {
343
- this.navigationTo(item.url, item.targetType, item.externalLink);
344
- }
345
- }, style: buttonStyle, class: "JoinButton" }, h("span", null, translate('joinNow', this.language)), h("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M5 3L10 8L5 13", stroke: "white", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))), h("hr", { class: "Divider" }), h("div", { class: "BottomSection" }, h("h3", null, item.title.toUpperCase()))))));
346
- }))), this.bulletNavigation ? this.renderNavigation() : null)));
347
- }
348
- get el() { return this; }
349
- static get watchers() { return {
350
- "translationUrl": ["handleNewTranslations"]
351
- }; }
352
- static get style() { return carouselComponentCss; }
353
- }, [1, "carousel-component", {
354
- "clientStyling": [513, "client-styling"],
355
- "clientStylingUrl": [513, "client-styling-url"],
356
- "sliderData": [16],
357
- "bulletNavigation": [516, "bullet-navigation"],
358
- "language": [513],
359
- "slideTimer": [514, "slide-timer"],
360
- "translationUrl": [513, "translation-url"],
361
- "sliderMobileWidth": [514, "slider-mobile-width"],
362
- "sliderDesktopWidth": [514, "slider-desktop-width"],
363
- "currIndex": [32],
364
- "width": [32],
365
- "margin": [32],
366
- "sliderElement": [32],
367
- "totalWidth": [32],
368
- "device": [32],
369
- "stylingAppends": [32],
370
- "innerWidth": [32]
371
- }]);
372
- function defineCustomElement() {
373
- if (typeof customElements === "undefined") {
374
- return;
375
- }
376
- const components = ["carousel-component"];
377
- components.forEach(tagName => { switch (tagName) {
378
- case "carousel-component":
379
- if (!customElements.get(tagName)) {
380
- customElements.define(tagName, CarouselComponent);
381
- }
382
- break;
383
- } });
384
- }
385
-
386
- export { CarouselComponent as C, getDevicePlatform as a, defineCustomElement as d, getTranslations as g, translate as t };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface GeneralSliderNavigation extends Components.GeneralSliderNavigation, HTMLElement {}
4
- export const GeneralSliderNavigation: {
5
- prototype: GeneralSliderNavigation;
6
- new (): GeneralSliderNavigation;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,144 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { g as getTranslations, a as getDevicePlatform, t as translate, d as defineCustomElement$2 } from './carousel-component2.js';
3
-
4
- const generalSliderNavigationCss = "";
5
-
6
- const GeneralSliderNavigation$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
11
- /**
12
- * Client custom styling via inline style
13
- */
14
- this.clientStyling = '';
15
- /**
16
- * Client custom styling via url
17
- */
18
- this.clientStylingUrl = '';
19
- /**
20
- * CMS Endpoint stage
21
- */
22
- this.cmsEnv = 'stage';
23
- /**
24
- * Language of the widget
25
- */
26
- this.language = 'en';
27
- /**
28
- * User roles
29
- */
30
- this.userRoles = 'everyone';
31
- /**
32
- * Show bullet navigation under slides
33
- */
34
- this.bulletNavigation = true;
35
- /**
36
- * Mobile width for sliders
37
- */
38
- this.sliderMobileWidth = 200;
39
- /**
40
- * Desktop width for sliders
41
- */
42
- this.sliderDesktopWidth = 300;
43
- /**
44
- * Translation via url
45
- */
46
- this.translationUrl = '';
47
- this.isLoading = true;
48
- this.hasErrors = false;
49
- this.device = '';
50
- }
51
- handleNewTranslations() {
52
- getTranslations(this.translationUrl);
53
- }
54
- watchEndpoint(newValue, oldValue) {
55
- if (newValue && newValue != oldValue && this.cmsEndpoint) {
56
- this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
57
- this.sliderData = GeneralSliderNavigation;
58
- });
59
- }
60
- }
61
- async componentWillLoad() {
62
- if (this.translationUrl.length > 2) {
63
- await getTranslations(this.translationUrl);
64
- }
65
- if (this.cmsEndpoint && this.language) {
66
- return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
67
- this.sliderData = GeneralSliderNavigation;
68
- });
69
- }
70
- }
71
- getGeneralSliderNavigation() {
72
- let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
73
- url.searchParams.append('env', this.cmsEnv);
74
- url.searchParams.append('userRoles', this.userRoles);
75
- url.searchParams.append('device', getDevicePlatform());
76
- return new Promise((resolve, reject) => {
77
- this.isLoading = true;
78
- fetch(url.href)
79
- .then((res) => res.json())
80
- .then((menuSliderData) => {
81
- resolve(menuSliderData.banners);
82
- })
83
- .catch((err) => {
84
- console.error(err);
85
- this.hasErrors = true;
86
- reject(err);
87
- }).finally(() => {
88
- this.isLoading = false;
89
- });
90
- });
91
- }
92
- render() {
93
- if (this.hasErrors) {
94
- return (h("div", { class: "PageError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
95
- }
96
- if (!this.isLoading) {
97
- return (h("div", null, h("carousel-component", { sliderData: this.sliderData, language: this.language, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, bulletNavigation: this.bulletNavigation, slideTimer: this.slideTimer, translationUrl: this.translationUrl, sliderMobileWidth: this.sliderMobileWidth, sliderDesktopWidth: this.sliderDesktopWidth })));
98
- }
99
- }
100
- static get watchers() { return {
101
- "translationUrl": ["handleNewTranslations"],
102
- "cmsEndpoint": ["watchEndpoint"],
103
- "language": ["watchEndpoint"]
104
- }; }
105
- static get style() { return generalSliderNavigationCss; }
106
- }, [1, "general-slider-navigation", {
107
- "clientStyling": [513, "client-styling"],
108
- "clientStylingUrl": [513, "client-styling-url"],
109
- "cmsEndpoint": [513, "cms-endpoint"],
110
- "cmsEnv": [513, "cms-env"],
111
- "language": [513],
112
- "userRoles": [513, "user-roles"],
113
- "bulletNavigation": [516, "bullet-navigation"],
114
- "slideTimer": [514, "slide-timer"],
115
- "sliderMobileWidth": [514, "slider-mobile-width"],
116
- "sliderDesktopWidth": [514, "slider-desktop-width"],
117
- "translationUrl": [513, "translation-url"],
118
- "isLoading": [32],
119
- "hasErrors": [32],
120
- "device": [32]
121
- }]);
122
- function defineCustomElement$1() {
123
- if (typeof customElements === "undefined") {
124
- return;
125
- }
126
- const components = ["general-slider-navigation", "carousel-component"];
127
- components.forEach(tagName => { switch (tagName) {
128
- case "general-slider-navigation":
129
- if (!customElements.get(tagName)) {
130
- customElements.define(tagName, GeneralSliderNavigation$1);
131
- }
132
- break;
133
- case "carousel-component":
134
- if (!customElements.get(tagName)) {
135
- defineCustomElement$2();
136
- }
137
- break;
138
- } });
139
- }
140
-
141
- const GeneralSliderNavigation = GeneralSliderNavigation$1;
142
- const defineCustomElement = defineCustomElement$1;
143
-
144
- export { GeneralSliderNavigation, defineCustomElement };
@@ -1,26 +0,0 @@
1
- /* GeneralSliderNavigation custom elements */
2
-
3
- import type { Components, JSX } from "../types/components";
4
-
5
- /**
6
- * Used to manually set the base path where assets can be found.
7
- * If the script is used as "module", it's recommended to use "import.meta.url",
8
- * such as "setAssetPath(import.meta.url)". Other options include
9
- * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
- * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
- * But do note that this configuration depends on how your script is bundled, or lack of
12
- * bundling, and where your assets can be loaded from. Additionally custom bundling
13
- * will have to ensure the static assets are copied to its build directory.
14
- */
15
- export declare const setAssetPath: (path: string) => void;
16
-
17
- export interface SetPlatformOptions {
18
- raf?: (c: FrameRequestCallback) => number;
19
- ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
- rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
- }
22
- export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
-
24
- export type { Components, JSX };
25
-
26
- export * from '../types';
@@ -1 +0,0 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';