@everymatrix/general-slider-navigation 1.16.1

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 (47) hide show
  1. package/dist/cjs/general-slider-navigation.cjs.entry.js +362 -0
  2. package/dist/cjs/general-slider-navigation.cjs.js +19 -0
  3. package/dist/cjs/index-3420513e.js +1282 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/general-slider-navigation/general-slider-navigation.css +282 -0
  8. package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +586 -0
  9. package/dist/collection/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +28 -0
  11. package/dist/collection/utils/utils.js +56 -0
  12. package/dist/components/general-slider-navigation.d.ts +11 -0
  13. package/dist/components/general-slider-navigation.js +398 -0
  14. package/dist/components/index.d.ts +26 -0
  15. package/dist/components/index.js +1 -0
  16. package/dist/esm/general-slider-navigation.entry.js +358 -0
  17. package/dist/esm/general-slider-navigation.js +17 -0
  18. package/dist/esm/index-22e4ccbc.js +1256 -0
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/loader.js +17 -0
  21. package/dist/esm/polyfills/core-js.js +11 -0
  22. package/dist/esm/polyfills/css-shim.js +1 -0
  23. package/dist/esm/polyfills/dom.js +79 -0
  24. package/dist/esm/polyfills/es5-html-element.js +1 -0
  25. package/dist/esm/polyfills/index.js +34 -0
  26. package/dist/esm/polyfills/system.js +6 -0
  27. package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -0
  28. package/dist/general-slider-navigation/index.esm.js +0 -0
  29. package/dist/general-slider-navigation/p-b72fe935.js +1 -0
  30. package/dist/general-slider-navigation/p-c80bf480.entry.js +1 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-slider-navigation/.stencil/packages/general-slider-navigation/stencil.config.d.ts +2 -0
  35. package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +100 -0
  36. package/dist/types/components.d.ts +157 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +10 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +19 -0
@@ -0,0 +1,586 @@
1
+ import { Component, Element, Prop, State, Watch, h } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ import { isMobile, checkDeviceType, getDevicePlatform } from '../../utils/utils';
4
+ export class GeneralSliderNavigation {
5
+ constructor() {
6
+ /**
7
+ * Client custom styling via inline style
8
+ */
9
+ this.clientStyling = '';
10
+ /**
11
+ * Client custom styling via url
12
+ */
13
+ this.clientStylingUrl = '';
14
+ /**
15
+ * CMS Endpoint stage
16
+ */
17
+ this.cmsEnv = 'stage';
18
+ /**
19
+ * Language of the widget
20
+ */
21
+ this.language = 'en';
22
+ /**
23
+ * User roles
24
+ */
25
+ this.userRoles = 'everyone';
26
+ /**
27
+ * Show slider navigate arrows
28
+ */
29
+ this.showSliderArrows = true;
30
+ /**
31
+ * Show slider navigate arrows on mobile
32
+ */
33
+ this.showSliderArrowsMobile = true;
34
+ /**
35
+ * You will see a fixed grid without a slider when using a mobile device.
36
+ */
37
+ this.showMobileGrid = false;
38
+ /**
39
+ * Set if you want to have a slider on mobile device.
40
+ */
41
+ this.showNavigationSliderMobile = true;
42
+ /**
43
+ * Set if you want to have a slider on desktop.
44
+ */
45
+ this.showNavigationSliderDesktop = true;
46
+ /**
47
+ * Specify the number of items you would like to be displayed on desktop.
48
+ */
49
+ this.itemsPerPageDesktop = 3;
50
+ /**
51
+ * Specify the number of items you would like to be displayed on mobile devices.
52
+ */
53
+ this.itemsPerPageMobile = 2;
54
+ this.isLoading = true;
55
+ this.limitStylingAppends = false;
56
+ this.hasErrors = false;
57
+ this.device = '';
58
+ this.activeIndex = 0;
59
+ this.sliderMenuElementWidth = 0;
60
+ this.userAgent = window.navigator.userAgent;
61
+ this.isMobile = isMobile(this.userAgent);
62
+ this.allElementsWidth = 0;
63
+ this.xDown = null;
64
+ this.yDown = null;
65
+ this.resizeHandler = () => {
66
+ this.calculateSliderWidth();
67
+ };
68
+ this.orientationChangeHandler = () => {
69
+ setTimeout(() => {
70
+ this.calculateSliderWidth();
71
+ }, 10);
72
+ };
73
+ this.navigationTo = (url, type, isExternal) => {
74
+ if (isExternal) { // if link is external, inform FE
75
+ window.postMessage({ type: 'ExternalLinkNavigation', externalUrl: url, target: isExternal, linkType: type }, window.location.href);
76
+ }
77
+ else { // if link is internal, inform FE
78
+ window.postMessage({ type: 'LinkNavigation', navUrl: url, target: isExternal }, window.location.href);
79
+ }
80
+ };
81
+ this.setImage = (image) => {
82
+ let source = '';
83
+ this.device = checkDeviceType();
84
+ switch (this.device) {
85
+ case 'mobile':
86
+ source = image.srcMobile;
87
+ break;
88
+ case 'tablet':
89
+ source = image.srcTablet;
90
+ break;
91
+ case 'desktop':
92
+ source = image.srcDesktop;
93
+ break;
94
+ }
95
+ return source;
96
+ };
97
+ this.setClientStyling = () => {
98
+ let sheet = document.createElement('style');
99
+ sheet.innerHTML = this.clientStyling;
100
+ this.stylingContainer.prepend(sheet);
101
+ };
102
+ this.setClientStylingURL = () => {
103
+ let url = new URL(this.clientStylingUrl);
104
+ let cssFile = document.createElement('style');
105
+ fetch(url.href)
106
+ .then((res) => res.text())
107
+ .then((data) => {
108
+ cssFile.innerHTML = data;
109
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
110
+ })
111
+ .catch((err) => {
112
+ console.log('error ', err);
113
+ });
114
+ };
115
+ }
116
+ watchEndpoint(newValue, oldValue) {
117
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
118
+ this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
119
+ this.sliderData = GeneralSliderNavigation;
120
+ });
121
+ }
122
+ }
123
+ connectedCallback() {
124
+ window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
125
+ }
126
+ componentWillLoad() {
127
+ if (this.cmsEndpoint && this.language) {
128
+ return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
129
+ this.sliderData = GeneralSliderNavigation;
130
+ });
131
+ }
132
+ }
133
+ componentDidLoad() {
134
+ window.addEventListener('resize', this.resizeHandler);
135
+ }
136
+ componentDidRender() {
137
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
138
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
139
+ // start custom styling area
140
+ if (!this.limitStylingAppends && this.stylingContainer) {
141
+ if (this.clientStyling)
142
+ this.setClientStyling();
143
+ this.limitStylingAppends = true;
144
+ }
145
+ // end custom styling area
146
+ }
147
+ componentDidUpdate() {
148
+ this.calculateSliderWidth();
149
+ }
150
+ disconnectedCallback() {
151
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
152
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
153
+ window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
154
+ window.removeEventListener('resize', this.resizeHandler);
155
+ }
156
+ getGeneralSliderNavigation() {
157
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
158
+ url.searchParams.append('env', this.cmsEnv);
159
+ url.searchParams.append('userRoles', this.userRoles);
160
+ url.searchParams.append('device', getDevicePlatform());
161
+ return new Promise((resolve, reject) => {
162
+ this.isLoading = true;
163
+ fetch(url.href)
164
+ .then((res) => res.json())
165
+ .then((menuSliderData) => {
166
+ resolve(menuSliderData.banners);
167
+ })
168
+ .catch((err) => {
169
+ console.error(err);
170
+ this.hasErrors = true;
171
+ reject(err);
172
+ }).finally(() => {
173
+ this.isLoading = false;
174
+ });
175
+ });
176
+ }
177
+ handleTouchStart(evt) {
178
+ const firstTouch = this.getTouches(evt)[0];
179
+ this.xDown = firstTouch.clientX;
180
+ this.yDown = firstTouch.clientY;
181
+ }
182
+ handleTouchMove(evt) {
183
+ if (!this.xDown || !this.yDown)
184
+ return;
185
+ let xUp = evt.touches[0].clientX;
186
+ let yUp = evt.touches[0].clientY;
187
+ let xDiff = this.xDown - xUp;
188
+ let yDiff = this.yDown - yUp;
189
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
190
+ if (xDiff > 0) {
191
+ this.move(1);
192
+ }
193
+ else {
194
+ this.move(-1);
195
+ }
196
+ }
197
+ this.xDown = null;
198
+ this.yDown = null;
199
+ }
200
+ ;
201
+ calculateSliderWidth() {
202
+ if (!this.sliderMenuElement)
203
+ return;
204
+ this.sliderMenuElementWidth = this.sliderMenuElement.clientWidth;
205
+ }
206
+ ;
207
+ getTouches(evt) {
208
+ return evt.touches || evt.originalEvent.touches;
209
+ }
210
+ setActive(index) {
211
+ const maxLength = Math.ceil(this.sliderData.length / (!this.isMobile ? this.itemsPerPageDesktop : this.itemsPerPageMobile));
212
+ if (index >= 0) {
213
+ if (index >= maxLength - 1) {
214
+ this.activeIndex = maxLength - 1;
215
+ }
216
+ else {
217
+ this.activeIndex = index;
218
+ }
219
+ }
220
+ else {
221
+ this.activeIndex = 0;
222
+ }
223
+ }
224
+ move(direction) {
225
+ this.setActive(this.activeIndex + direction);
226
+ }
227
+ ;
228
+ goTo(index) {
229
+ let diff = this.activeIndex - index;
230
+ if (diff > 0) {
231
+ for (let i = 0; i < diff; i++) {
232
+ this.move(-1);
233
+ }
234
+ }
235
+ else {
236
+ for (let i = 0; i > diff; i--) {
237
+ this.move(1);
238
+ }
239
+ }
240
+ }
241
+ render() {
242
+ const styles = {
243
+ transform: `translate(${(+this.sliderMenuElementWidth * this.activeIndex) * -1}px, 0px)`
244
+ };
245
+ const itemStyleDesktop = {
246
+ width: `${this.sliderMenuElementWidth / Math.ceil(this.itemsPerPageDesktop)}px`
247
+ };
248
+ const itemStyleMobile = {
249
+ width: `${this.sliderMenuElementWidth / this.itemsPerPageMobile}px`
250
+ };
251
+ if (this.hasErrors) {
252
+ return (h("div", { class: "PageError" },
253
+ h("div", { class: "TitleError" }, translate('error', this.language))));
254
+ }
255
+ if (!this.isLoading) {
256
+ return (h("div", { ref: el => this.stylingContainer = el },
257
+ h("div", { class: "SliderWrapper" },
258
+ h("div", { class: "SliderWrapperContent", ref: (el) => this.slider = el },
259
+ ((this.showSliderArrows && !this.isMobile) || (this.showSliderArrowsMobile && this.isMobile)) &&
260
+ h("div", { class: this.activeIndex === 0 ? 'SliderNavButton DisabledArrow' : 'SliderNavButton', onClick: () => this.move(-1) },
261
+ h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
262
+ h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))),
263
+ this.showNavigationSliderMobile && this.isMobile ? (h("main", null,
264
+ h("div", { style: styles, ref: (el) => this.sliderMenuElement = el, class: "SliderItems" }, this.sliderData.map((data) => h("div", { class: "SliderItem", style: itemStyleMobile },
265
+ h("div", { class: "GridContainer", onClick: () => data.externalLink ? this.navigationTo(data.url, data.targetType, data.externalLink) : this.navigationTo(data.url, data.targetType, false) },
266
+ h("div", { class: "SliderImage" },
267
+ h("img", { src: this.setImage(data.image), alt: data.title })),
268
+ h("div", { class: "SliderContent" },
269
+ h("div", { class: "DividerElement" }),
270
+ h("div", { class: "Title" }, data.title)))))))) : (this.showNavigationSliderDesktop && !this.isMobile &&
271
+ h("main", null,
272
+ h("div", { class: "SliderItems", style: styles, ref: (el) => this.sliderMenuElement = el },
273
+ h("div", { class: "SliderItemsWrapper" }, this.sliderData.map((data) => h("div", { class: "SliderItem", style: itemStyleDesktop },
274
+ h("div", { class: "GridContainer", onClick: () => data.externalLink ? this.navigationTo(data.url, data.targetType, data.externalLink) : this.navigationTo(data.url, data.targetType, false) },
275
+ h("div", { class: "SliderImage" },
276
+ h("img", { src: this.setImage(data.image), alt: data.title })),
277
+ h("div", { class: "SliderContent" },
278
+ h("div", { class: "DividerElement" }),
279
+ h("div", { class: "Title" }, data.title))))))))),
280
+ ((this.showSliderArrows && !this.isMobile) || (this.showSliderArrowsMobile && this.isMobile)) &&
281
+ h("div", { class: this.activeIndex === Math.ceil(this.sliderData.length / (!this.isMobile ? this.itemsPerPageDesktop : this.itemsPerPageMobile)) - 1 ? ' SliderNavButton DisabledArrow disabled' : 'SliderNavButton', onClick: () => this.move(1) },
282
+ h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
283
+ h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }))))),
284
+ (this.showMobileGrid && this.isMobile) &&
285
+ h("main", { class: "GridItems GridMobile" }, this.sliderData.map((dataMobile) => h("div", { class: "GridContainerMobile", onClick: () => dataMobile.externalLink ? this.navigationTo(dataMobile.url, dataMobile.targetType, dataMobile.externalLink) : this.navigationTo(dataMobile.url, dataMobile.targetType, false) },
286
+ h("div", { class: "SliderImage" },
287
+ h("img", { src: this.setImage(dataMobile.image), alt: dataMobile.title })),
288
+ h("div", { class: "SliderContent" },
289
+ h("div", { class: "DividerElement" }),
290
+ h("div", { class: "Title" }, dataMobile.title)))))));
291
+ }
292
+ }
293
+ static get is() { return "general-slider-navigation"; }
294
+ static get encapsulation() { return "shadow"; }
295
+ static get originalStyleUrls() { return {
296
+ "$": ["general-slider-navigation.scss"]
297
+ }; }
298
+ static get styleUrls() { return {
299
+ "$": ["general-slider-navigation.css"]
300
+ }; }
301
+ static get properties() { return {
302
+ "clientStyling": {
303
+ "type": "string",
304
+ "mutable": false,
305
+ "complexType": {
306
+ "original": "string",
307
+ "resolved": "string",
308
+ "references": {}
309
+ },
310
+ "required": false,
311
+ "optional": false,
312
+ "docs": {
313
+ "tags": [],
314
+ "text": "Client custom styling via inline style"
315
+ },
316
+ "attribute": "client-styling",
317
+ "reflect": true,
318
+ "defaultValue": "''"
319
+ },
320
+ "clientStylingUrl": {
321
+ "type": "string",
322
+ "mutable": false,
323
+ "complexType": {
324
+ "original": "string",
325
+ "resolved": "string",
326
+ "references": {}
327
+ },
328
+ "required": false,
329
+ "optional": false,
330
+ "docs": {
331
+ "tags": [],
332
+ "text": "Client custom styling via url"
333
+ },
334
+ "attribute": "client-styling-url",
335
+ "reflect": true,
336
+ "defaultValue": "''"
337
+ },
338
+ "cmsEndpoint": {
339
+ "type": "string",
340
+ "mutable": false,
341
+ "complexType": {
342
+ "original": "string",
343
+ "resolved": "string",
344
+ "references": {}
345
+ },
346
+ "required": true,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [],
350
+ "text": "Endpoint URL for the source of data"
351
+ },
352
+ "attribute": "cms-endpoint",
353
+ "reflect": true
354
+ },
355
+ "cmsEnv": {
356
+ "type": "string",
357
+ "mutable": false,
358
+ "complexType": {
359
+ "original": "string",
360
+ "resolved": "string",
361
+ "references": {}
362
+ },
363
+ "required": false,
364
+ "optional": false,
365
+ "docs": {
366
+ "tags": [],
367
+ "text": "CMS Endpoint stage"
368
+ },
369
+ "attribute": "cms-env",
370
+ "reflect": true,
371
+ "defaultValue": "'stage'"
372
+ },
373
+ "language": {
374
+ "type": "string",
375
+ "mutable": false,
376
+ "complexType": {
377
+ "original": "string",
378
+ "resolved": "string",
379
+ "references": {}
380
+ },
381
+ "required": false,
382
+ "optional": false,
383
+ "docs": {
384
+ "tags": [],
385
+ "text": "Language of the widget"
386
+ },
387
+ "attribute": "language",
388
+ "reflect": true,
389
+ "defaultValue": "'en'"
390
+ },
391
+ "userRoles": {
392
+ "type": "string",
393
+ "mutable": false,
394
+ "complexType": {
395
+ "original": "string",
396
+ "resolved": "string",
397
+ "references": {}
398
+ },
399
+ "required": false,
400
+ "optional": false,
401
+ "docs": {
402
+ "tags": [],
403
+ "text": "User roles"
404
+ },
405
+ "attribute": "user-roles",
406
+ "reflect": true,
407
+ "defaultValue": "'everyone'"
408
+ },
409
+ "showSliderArrows": {
410
+ "type": "boolean",
411
+ "mutable": false,
412
+ "complexType": {
413
+ "original": "boolean",
414
+ "resolved": "boolean",
415
+ "references": {}
416
+ },
417
+ "required": false,
418
+ "optional": false,
419
+ "docs": {
420
+ "tags": [],
421
+ "text": "Show slider navigate arrows"
422
+ },
423
+ "attribute": "show-slider-arrows",
424
+ "reflect": true,
425
+ "defaultValue": "true"
426
+ },
427
+ "showSliderArrowsMobile": {
428
+ "type": "boolean",
429
+ "mutable": false,
430
+ "complexType": {
431
+ "original": "boolean",
432
+ "resolved": "boolean",
433
+ "references": {}
434
+ },
435
+ "required": false,
436
+ "optional": false,
437
+ "docs": {
438
+ "tags": [],
439
+ "text": "Show slider navigate arrows on mobile"
440
+ },
441
+ "attribute": "show-slider-arrows-mobile",
442
+ "reflect": true,
443
+ "defaultValue": "true"
444
+ },
445
+ "showMobileGrid": {
446
+ "type": "boolean",
447
+ "mutable": false,
448
+ "complexType": {
449
+ "original": "boolean",
450
+ "resolved": "boolean",
451
+ "references": {}
452
+ },
453
+ "required": false,
454
+ "optional": false,
455
+ "docs": {
456
+ "tags": [],
457
+ "text": "You will see a fixed grid without a slider when using a mobile device."
458
+ },
459
+ "attribute": "show-mobile-grid",
460
+ "reflect": true,
461
+ "defaultValue": "false"
462
+ },
463
+ "showNavigationSliderMobile": {
464
+ "type": "boolean",
465
+ "mutable": false,
466
+ "complexType": {
467
+ "original": "boolean",
468
+ "resolved": "boolean",
469
+ "references": {}
470
+ },
471
+ "required": false,
472
+ "optional": false,
473
+ "docs": {
474
+ "tags": [],
475
+ "text": "Set if you want to have a slider on mobile device."
476
+ },
477
+ "attribute": "show-navigation-slider-mobile",
478
+ "reflect": true,
479
+ "defaultValue": "true"
480
+ },
481
+ "showNavigationSliderDesktop": {
482
+ "type": "boolean",
483
+ "mutable": false,
484
+ "complexType": {
485
+ "original": "boolean",
486
+ "resolved": "boolean",
487
+ "references": {}
488
+ },
489
+ "required": false,
490
+ "optional": false,
491
+ "docs": {
492
+ "tags": [],
493
+ "text": "Set if you want to have a slider on desktop."
494
+ },
495
+ "attribute": "show-navigation-slider-desktop",
496
+ "reflect": true,
497
+ "defaultValue": "true"
498
+ },
499
+ "itemsPerPageDesktop": {
500
+ "type": "number",
501
+ "mutable": false,
502
+ "complexType": {
503
+ "original": "number",
504
+ "resolved": "number",
505
+ "references": {}
506
+ },
507
+ "required": false,
508
+ "optional": false,
509
+ "docs": {
510
+ "tags": [],
511
+ "text": "Specify the number of items you would like to be displayed on desktop."
512
+ },
513
+ "attribute": "items-per-page-desktop",
514
+ "reflect": true,
515
+ "defaultValue": "3"
516
+ },
517
+ "itemsPerPageMobile": {
518
+ "type": "number",
519
+ "mutable": false,
520
+ "complexType": {
521
+ "original": "number",
522
+ "resolved": "number",
523
+ "references": {}
524
+ },
525
+ "required": false,
526
+ "optional": false,
527
+ "docs": {
528
+ "tags": [],
529
+ "text": "Specify the number of items you would like to be displayed on mobile devices."
530
+ },
531
+ "attribute": "items-per-page-mobile",
532
+ "reflect": true,
533
+ "defaultValue": "2"
534
+ },
535
+ "externalLinkActive": {
536
+ "type": "boolean",
537
+ "mutable": true,
538
+ "complexType": {
539
+ "original": "boolean",
540
+ "resolved": "boolean",
541
+ "references": {}
542
+ },
543
+ "required": false,
544
+ "optional": false,
545
+ "docs": {
546
+ "tags": [],
547
+ "text": "Customize external link active"
548
+ },
549
+ "attribute": "external-link-active",
550
+ "reflect": true
551
+ },
552
+ "internalLinkActive": {
553
+ "type": "boolean",
554
+ "mutable": true,
555
+ "complexType": {
556
+ "original": "boolean",
557
+ "resolved": "boolean",
558
+ "references": {}
559
+ },
560
+ "required": false,
561
+ "optional": false,
562
+ "docs": {
563
+ "tags": [],
564
+ "text": "Customize internal link active"
565
+ },
566
+ "attribute": "internal-link-active",
567
+ "reflect": true
568
+ }
569
+ }; }
570
+ static get states() { return {
571
+ "isLoading": {},
572
+ "limitStylingAppends": {},
573
+ "hasErrors": {},
574
+ "device": {},
575
+ "activeIndex": {},
576
+ "sliderMenuElementWidth": {}
577
+ }; }
578
+ static get elementRef() { return "el"; }
579
+ static get watchers() { return [{
580
+ "propName": "cmsEndpoint",
581
+ "methodName": "watchEndpoint"
582
+ }, {
583
+ "propName": "language",
584
+ "methodName": "watchEndpoint"
585
+ }]; }
586
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,28 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ error: 'Error',
6
+ noResults: 'Loading, please wait ...',
7
+ },
8
+ hu: {
9
+ error: 'Error',
10
+ noResults: 'Loading, please wait ...',
11
+ },
12
+ ro: {
13
+ error: 'Eroare',
14
+ noResults: 'Loading, please wait ...',
15
+ },
16
+ fr: {
17
+ error: 'Error',
18
+ noResults: 'Loading, please wait ...',
19
+ },
20
+ ar: {
21
+ error: 'خطأ',
22
+ noResults: 'Loading, please wait ...',
23
+ }
24
+ };
25
+ export const translate = (key, customLang) => {
26
+ const lang = customLang;
27
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
28
+ };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @name isMobile
3
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
4
+ * @param {String} userAgent window.navigator.userAgent
5
+ * @returns {Boolean} true or false
6
+ */
7
+ export const isMobile = (userAgent) => {
8
+ return !!(userAgent.toLowerCase().match(/android/i) ||
9
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
10
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
11
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
12
+ };
13
+ export const getDevice = () => {
14
+ let userAgent = window.navigator.userAgent;
15
+ if (userAgent.toLowerCase().match(/android/i)) {
16
+ return 'Android';
17
+ }
18
+ if (userAgent.toLowerCase().match(/iphone/i)) {
19
+ return 'iPhone';
20
+ }
21
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
22
+ return 'iPad';
23
+ }
24
+ return 'PC';
25
+ };
26
+ export const getDevicePlatform = () => {
27
+ const device = getDevice();
28
+ if (device) {
29
+ if (device === 'PC') {
30
+ return 'dk';
31
+ }
32
+ else if (device === 'iPad' || device === 'iPhone') {
33
+ return 'ios';
34
+ }
35
+ else {
36
+ return 'mtWeb';
37
+ }
38
+ }
39
+ };
40
+ export function checkDeviceType() {
41
+ const userAgent = navigator.userAgent.toLowerCase();
42
+ const width = screen.availWidth;
43
+ const height = screen.availHeight;
44
+ if (userAgent.includes('iphone')) {
45
+ return 'mobile';
46
+ }
47
+ if (userAgent.includes('android')) {
48
+ if (height > width && width < 800) {
49
+ return 'mobile';
50
+ }
51
+ if (width > height && height < 800) {
52
+ return 'tablet';
53
+ }
54
+ }
55
+ return 'desktop';
56
+ }
@@ -0,0 +1,11 @@
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;