@everymatrix/general-tutorial-slider 1.31.2 → 1.32.4

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +3 -2
  3. package/dist/cjs/general-tutorial-slider.cjs.entry.js +0 -344
  4. package/dist/cjs/general-tutorial-slider.cjs.js +0 -19
  5. package/dist/cjs/index-18ec3908.js +0 -1282
  6. package/dist/cjs/index.cjs.js +0 -2
  7. package/dist/cjs/loader.cjs.js +0 -21
  8. package/dist/collection/collection-manifest.json +0 -12
  9. package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.css +0 -168
  10. package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.js +0 -526
  11. package/dist/collection/index.js +0 -1
  12. package/dist/collection/utils/locale.utils.js +0 -40
  13. package/dist/collection/utils/utils.js +0 -39
  14. package/dist/components/general-tutorial-slider.d.ts +0 -11
  15. package/dist/components/general-tutorial-slider.js +0 -377
  16. package/dist/components/index.d.ts +0 -26
  17. package/dist/components/index.js +0 -1
  18. package/dist/esm/general-tutorial-slider.entry.js +0 -340
  19. package/dist/esm/general-tutorial-slider.js +0 -17
  20. package/dist/esm/index-a2165162.js +0 -1256
  21. package/dist/esm/index.js +0 -1
  22. package/dist/esm/loader.js +0 -17
  23. package/dist/esm/polyfills/core-js.js +0 -11
  24. package/dist/esm/polyfills/css-shim.js +0 -1
  25. package/dist/esm/polyfills/dom.js +0 -79
  26. package/dist/esm/polyfills/es5-html-element.js +0 -1
  27. package/dist/esm/polyfills/index.js +0 -34
  28. package/dist/esm/polyfills/system.js +0 -6
  29. package/dist/general-tutorial-slider/general-tutorial-slider.esm.js +0 -1
  30. package/dist/general-tutorial-slider/index.esm.js +0 -0
  31. package/dist/general-tutorial-slider/p-a5ce3c59.entry.js +0 -1
  32. package/dist/general-tutorial-slider/p-a878ee14.js +0 -1
  33. package/dist/index.cjs.js +0 -1
  34. package/dist/index.js +0 -1
  35. package/dist/stencil.config.js +0 -22
  36. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/general-tutorial-slider/.stencil/packages/general-tutorial-slider/stencil.config.d.ts +0 -2
  37. package/dist/types/components/general-tutorial-slider/general-tutorial-slider.d.ts +0 -90
  38. package/dist/types/components.d.ts +0 -141
  39. package/dist/types/index.d.ts +0 -1
  40. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  41. package/dist/types/utils/locale.utils.d.ts +0 -1
  42. package/dist/types/utils/utils.d.ts +0 -9
  43. package/loader/cdn.js +0 -3
  44. package/loader/index.cjs.js +0 -3
  45. package/loader/index.d.ts +0 -12
  46. package/loader/index.es2017.js +0 -3
  47. package/loader/index.js +0 -4
  48. package/loader/package.json +0 -10
@@ -1,526 +0,0 @@
1
- import { Component, State, Prop, Element, Watch, h } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import { isMobile, getDevicePlatform } from '../../utils/utils';
4
- export class GeneralTutorialSlider {
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
- * Language of the widget
16
- */
17
- this.language = 'en';
18
- /**
19
- * User roles
20
- */
21
- this.userRoles = 'everyone';
22
- /**
23
- * CMS Endpoint stage
24
- */
25
- this.cmsEnv = 'stage';
26
- /**
27
- * Show slider dots
28
- */
29
- this.showSliderDots = true;
30
- /**
31
- * Show slider navigate arrows
32
- */
33
- this.showSliderArrows = true;
34
- /**
35
- * Show slider navigate arrows on mobile
36
- */
37
- this.showSliderArrowsMobile = false;
38
- /**
39
- * Auto-scroll will only function if it is set to true, and otherwise it will be ignored.
40
- */
41
- this.enableAutoScroll = false;
42
- /**
43
- * Set interval period for slider
44
- */
45
- this.intervalPeriod = 5000;
46
- /**
47
- * Set the number of slides you wish to display.
48
- */
49
- this.scrollItems = 1;
50
- /**
51
- * Set the number of slides you wish to display.
52
- */
53
- this.itemsPerPage = 1;
54
- this.hasErrors = false;
55
- this.limitStylingAppends = false;
56
- this.isLoading = true;
57
- this.activeIndex = 0;
58
- this.tutorialElementWidth = 0;
59
- this.userAgent = window.navigator.userAgent;
60
- this.isMobile = isMobile(this.userAgent);
61
- this.allElementsWidth = 0;
62
- this.xDown = null;
63
- this.yDown = null;
64
- this.resizeHandler = () => {
65
- this.recalculateItemsPerPage();
66
- };
67
- this.orientationChangeHandler = () => {
68
- setTimeout(() => {
69
- this.recalculateItemsPerPage();
70
- }, 10);
71
- };
72
- this.setClientStyling = () => {
73
- let sheet = document.createElement('style');
74
- sheet.innerHTML = this.clientStyling;
75
- this.stylingContainer.prepend(sheet);
76
- };
77
- this.setClientStylingURL = () => {
78
- let url = new URL(this.clientStylingUrl);
79
- let cssFile = document.createElement('style');
80
- fetch(url.href)
81
- .then((res) => res.text())
82
- .then((data) => {
83
- cssFile.innerHTML = data;
84
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
85
- })
86
- .catch((err) => {
87
- console.log('error ', err);
88
- });
89
- };
90
- }
91
- watchEndpoint(newValue, oldValue) {
92
- if (newValue && newValue != oldValue && this.cmsEndpoint) {
93
- this.getGeneralTutorialSlider().then((tutorialContent) => {
94
- this.tutorialData = tutorialContent;
95
- });
96
- }
97
- }
98
- connectedCallback() {
99
- window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
100
- }
101
- componentWillLoad() {
102
- if (this.cmsEndpoint && this.language) {
103
- return this.getGeneralTutorialSlider().then((tutorialContent) => {
104
- this.tutorialData = tutorialContent;
105
- });
106
- }
107
- }
108
- componentDidLoad() {
109
- window.addEventListener('resize', this.resizeHandler);
110
- }
111
- componentDidRender() {
112
- this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
113
- this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
114
- this.recalculateItemsPerPage();
115
- // start custom styling area
116
- if (!this.limitStylingAppends && this.stylingContainer) {
117
- if (this.clientStyling)
118
- this.setClientStyling();
119
- if (this.clientStylingUrl)
120
- this.setClientStylingURL();
121
- this.limitStylingAppends = true;
122
- }
123
- // end custom styling area
124
- }
125
- componentDidUpdate() {
126
- this.recalculateItemsPerPage();
127
- }
128
- disconnectedCallback() {
129
- this.el.removeEventListener('touchstart', this.handleTouchStart);
130
- this.el.removeEventListener('touchmove', this.handleTouchMove);
131
- window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
132
- window.removeEventListener('resize', this.resizeHandler);
133
- }
134
- getGeneralTutorialSlider() {
135
- let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
136
- url.searchParams.append('env', this.cmsEnv);
137
- url.searchParams.append('userRoles', this.userRoles);
138
- url.searchParams.append('device', getDevicePlatform());
139
- return new Promise((resolve, reject) => {
140
- this.isLoading = true;
141
- fetch(url.href)
142
- .then((res) => res.json())
143
- .then((tutorialContent) => {
144
- resolve(tutorialContent);
145
- }).catch((err) => {
146
- console.error(err);
147
- this.hasErrors = true;
148
- reject(err);
149
- }).finally(() => {
150
- this.isLoading = false;
151
- });
152
- });
153
- }
154
- move(direction) {
155
- this.setActive(this.activeIndex + direction);
156
- }
157
- ;
158
- //calculate itemsperpage by tutorials length to avoid empty in the tutorials end
159
- recalculateItemsPerPage() {
160
- if (!this.tutorialsElement)
161
- return;
162
- this.tutorialElementWidth = this.tutorialsElement.clientWidth;
163
- this.allElementsWidth = (this.tutorialData.length - 1) * this.tutorialElementWidth;
164
- }
165
- ;
166
- goTo(index) {
167
- let diff = this.activeIndex - index;
168
- if (diff > 0) {
169
- for (let i = 0; i < diff; i++) {
170
- this.move(-1);
171
- }
172
- }
173
- else {
174
- for (let i = 0; i > diff; i--) {
175
- this.move(1);
176
- }
177
- }
178
- }
179
- handleTouchStart(evt) {
180
- const firstTouch = this.getTouches(evt)[0];
181
- this.xDown = firstTouch.clientX;
182
- this.yDown = firstTouch.clientY;
183
- }
184
- getTouches(evt) {
185
- return evt.touches || evt.originalEvent.touches;
186
- }
187
- handleTouchMove(evt) {
188
- if (!this.xDown || !this.yDown)
189
- return;
190
- let xUp = evt.touches[0].clientX;
191
- let yUp = evt.touches[0].clientY;
192
- let xDiff = this.xDown - xUp;
193
- let yDiff = this.yDown - yUp;
194
- if (Math.abs(xDiff) > Math.abs(yDiff)) {
195
- if (xDiff > 0) {
196
- this.move(1);
197
- }
198
- else {
199
- this.move(-1);
200
- }
201
- }
202
- this.xDown = null;
203
- this.yDown = null;
204
- }
205
- ;
206
- setActive(index) {
207
- const maxLength = this.tutorialData.length;
208
- if (index >= 0) {
209
- if (index >= maxLength - 1) {
210
- this.activeIndex = maxLength - 1;
211
- }
212
- else {
213
- this.activeIndex = index;
214
- }
215
- }
216
- else {
217
- this.activeIndex = 0;
218
- }
219
- }
220
- renderDots() {
221
- const dots = [];
222
- for (let index = 0; index < this.tutorialData.length / this.itemsPerPage; index++) {
223
- dots.push(h("li", { class: index == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index); this.setActive(index); } }));
224
- }
225
- return dots;
226
- }
227
- render() {
228
- const styles = {
229
- transform: `translate(${(this.allElementsWidth / (this.tutorialData.length - 1) * this.activeIndex) * -1}px, 0px)`
230
- };
231
- const itemStyle = {
232
- width: `${this.tutorialElementWidth / this.itemsPerPage}px`
233
- };
234
- if (this.hasErrors) {
235
- return (h("div", { class: "GeneralTutorialSliderError" },
236
- h("div", { class: "TitleError" }, translate('error', this.language))));
237
- }
238
- if (!this.isLoading) {
239
- return (h("div", { ref: el => this.stylingContainer = el },
240
- h("div", { class: "TutorialWrapper" },
241
- h("div", { class: "TutorialContent", ref: (el) => this.slider = el },
242
- ((this.showSliderArrows && !this.isMobile) ||
243
- (this.showSliderArrowsMobile && this.isMobile)) &&
244
- h("div", { class: this.activeIndex === 0 ? 'SliderNavButton DisabledArrow' : 'SliderNavButton', onClick: () => this.move(-1) },
245
- h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
246
- h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))),
247
- h("main", null,
248
- h("div", { style: styles, ref: (el) => this.tutorialsElement = el, class: "TutorialItems" }, this.tutorialData.map((data) => {
249
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
250
- return h("div", { class: "TutorialItem", style: itemStyle },
251
- h("div", { class: "ItemTitle", innerHTML: data === null || data === void 0 ? void 0 : data.title }),
252
- ((_a = data === null || data === void 0 ? void 0 : data.media) === null || _a === void 0 ? void 0 : _a.images) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("img", { src: (_e = (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data.media) === null || _b === void 0 ? void 0 : _b.images[0]) === null || _c === void 0 ? void 0 : _c.sources) === null || _d === void 0 ? void 0 : _d.find((source) => source.media === 'mobile')) === null || _e === void 0 ? void 0 : _e.src, alt: data === null || data === void 0 ? void 0 : data.slug })) : (h("img", { src: (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.media) === null || _f === void 0 ? void 0 : _f.images[0]) === null || _g === void 0 ? void 0 : _g.sources) === null || _h === void 0 ? void 0 : _h.find((source) => source.media === 'desktop')) === null || _j === void 0 ? void 0 : _j.src, alt: data === null || data === void 0 ? void 0 : data.slug })))) : ((_k = data === null || data === void 0 ? void 0 : data.media) === null || _k === void 0 ? void 0 : _k.video) ? (h("div", { class: "ItemImage" }, this.isMobile ? (h("video", { controls: true, loop: true, autoplay: true },
253
- h("source", { src: (_p = (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.media) === null || _l === void 0 ? void 0 : _l.video[0]) === null || _m === void 0 ? void 0 : _m.sources) === null || _o === void 0 ? void 0 : _o.find((source) => source.media === 'mobile')) === null || _p === void 0 ? void 0 : _p.src, type: "video/mp4" }))) : (h("video", { controls: true, loop: true, autoplay: true },
254
- h("source", { src: (_t = (_s = (_r = (_q = data === null || data === void 0 ? void 0 : data.media) === null || _q === void 0 ? void 0 : _q.video[0]) === null || _r === void 0 ? void 0 : _r.sources) === null || _s === void 0 ? void 0 : _s.find((source) => source.media === 'desktop')) === null || _t === void 0 ? void 0 : _t.src, type: "video/mp4" }))))) : null,
255
- h("div", { class: "ItemDescription", innerHTML: data === null || data === void 0 ? void 0 : data.content }));
256
- }))),
257
- ((this.showSliderArrows && !this.isMobile) ||
258
- (this.showSliderArrowsMobile && this.isMobile)) &&
259
- h("div", { class: this.activeIndex === this.tutorialData.length - 1 ? ' SliderNavButton DisabledArrow disabled' : 'SliderNavButton', onClick: () => this.move(1) },
260
- h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
261
- h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }))),
262
- h("div", null)),
263
- this.showSliderDots &&
264
- h("div", { class: "DotsWrapper" },
265
- h("ul", { class: "Dots" }, this.renderDots())))));
266
- }
267
- }
268
- static get is() { return "general-tutorial-slider"; }
269
- static get encapsulation() { return "shadow"; }
270
- static get originalStyleUrls() { return {
271
- "$": ["general-tutorial-slider.scss"]
272
- }; }
273
- static get styleUrls() { return {
274
- "$": ["general-tutorial-slider.css"]
275
- }; }
276
- static get properties() { return {
277
- "clientStyling": {
278
- "type": "string",
279
- "mutable": false,
280
- "complexType": {
281
- "original": "string",
282
- "resolved": "string",
283
- "references": {}
284
- },
285
- "required": false,
286
- "optional": false,
287
- "docs": {
288
- "tags": [],
289
- "text": "Client custom styling via inline style"
290
- },
291
- "attribute": "client-styling",
292
- "reflect": true,
293
- "defaultValue": "''"
294
- },
295
- "clientStylingUrl": {
296
- "type": "string",
297
- "mutable": false,
298
- "complexType": {
299
- "original": "string",
300
- "resolved": "string",
301
- "references": {}
302
- },
303
- "required": false,
304
- "optional": false,
305
- "docs": {
306
- "tags": [],
307
- "text": "Client custom styling via url"
308
- },
309
- "attribute": "client-styling-url",
310
- "reflect": true,
311
- "defaultValue": "''"
312
- },
313
- "language": {
314
- "type": "string",
315
- "mutable": false,
316
- "complexType": {
317
- "original": "string",
318
- "resolved": "string",
319
- "references": {}
320
- },
321
- "required": false,
322
- "optional": false,
323
- "docs": {
324
- "tags": [],
325
- "text": "Language of the widget"
326
- },
327
- "attribute": "language",
328
- "reflect": true,
329
- "defaultValue": "'en'"
330
- },
331
- "cmsEndpoint": {
332
- "type": "string",
333
- "mutable": false,
334
- "complexType": {
335
- "original": "string",
336
- "resolved": "string",
337
- "references": {}
338
- },
339
- "required": true,
340
- "optional": false,
341
- "docs": {
342
- "tags": [],
343
- "text": "Endpoint URL for the source of data"
344
- },
345
- "attribute": "cms-endpoint",
346
- "reflect": true
347
- },
348
- "userRoles": {
349
- "type": "string",
350
- "mutable": false,
351
- "complexType": {
352
- "original": "string",
353
- "resolved": "string",
354
- "references": {}
355
- },
356
- "required": false,
357
- "optional": false,
358
- "docs": {
359
- "tags": [],
360
- "text": "User roles"
361
- },
362
- "attribute": "user-roles",
363
- "reflect": true,
364
- "defaultValue": "'everyone'"
365
- },
366
- "cmsEnv": {
367
- "type": "string",
368
- "mutable": false,
369
- "complexType": {
370
- "original": "string",
371
- "resolved": "string",
372
- "references": {}
373
- },
374
- "required": false,
375
- "optional": false,
376
- "docs": {
377
- "tags": [],
378
- "text": "CMS Endpoint stage"
379
- },
380
- "attribute": "cms-env",
381
- "reflect": true,
382
- "defaultValue": "'stage'"
383
- },
384
- "showSliderDots": {
385
- "type": "boolean",
386
- "mutable": false,
387
- "complexType": {
388
- "original": "boolean",
389
- "resolved": "boolean",
390
- "references": {}
391
- },
392
- "required": false,
393
- "optional": false,
394
- "docs": {
395
- "tags": [],
396
- "text": "Show slider dots"
397
- },
398
- "attribute": "show-slider-dots",
399
- "reflect": true,
400
- "defaultValue": "true"
401
- },
402
- "showSliderArrows": {
403
- "type": "boolean",
404
- "mutable": false,
405
- "complexType": {
406
- "original": "boolean",
407
- "resolved": "boolean",
408
- "references": {}
409
- },
410
- "required": false,
411
- "optional": false,
412
- "docs": {
413
- "tags": [],
414
- "text": "Show slider navigate arrows"
415
- },
416
- "attribute": "show-slider-arrows",
417
- "reflect": true,
418
- "defaultValue": "true"
419
- },
420
- "showSliderArrowsMobile": {
421
- "type": "boolean",
422
- "mutable": false,
423
- "complexType": {
424
- "original": "boolean",
425
- "resolved": "boolean",
426
- "references": {}
427
- },
428
- "required": false,
429
- "optional": false,
430
- "docs": {
431
- "tags": [],
432
- "text": "Show slider navigate arrows on mobile"
433
- },
434
- "attribute": "show-slider-arrows-mobile",
435
- "reflect": true,
436
- "defaultValue": "false"
437
- },
438
- "enableAutoScroll": {
439
- "type": "boolean",
440
- "mutable": false,
441
- "complexType": {
442
- "original": "boolean",
443
- "resolved": "boolean",
444
- "references": {}
445
- },
446
- "required": false,
447
- "optional": false,
448
- "docs": {
449
- "tags": [],
450
- "text": "Auto-scroll will only function if it is set to true, and otherwise it will be ignored."
451
- },
452
- "attribute": "enable-auto-scroll",
453
- "reflect": true,
454
- "defaultValue": "false"
455
- },
456
- "intervalPeriod": {
457
- "type": "number",
458
- "mutable": false,
459
- "complexType": {
460
- "original": "number",
461
- "resolved": "number",
462
- "references": {}
463
- },
464
- "required": false,
465
- "optional": false,
466
- "docs": {
467
- "tags": [],
468
- "text": "Set interval period for slider"
469
- },
470
- "attribute": "interval-period",
471
- "reflect": true,
472
- "defaultValue": "5000"
473
- },
474
- "scrollItems": {
475
- "type": "any",
476
- "mutable": false,
477
- "complexType": {
478
- "original": "any",
479
- "resolved": "any",
480
- "references": {}
481
- },
482
- "required": false,
483
- "optional": false,
484
- "docs": {
485
- "tags": [],
486
- "text": "Set the number of slides you wish to display."
487
- },
488
- "attribute": "scroll-items",
489
- "reflect": true,
490
- "defaultValue": "1"
491
- },
492
- "itemsPerPage": {
493
- "type": "number",
494
- "mutable": false,
495
- "complexType": {
496
- "original": "number",
497
- "resolved": "number",
498
- "references": {}
499
- },
500
- "required": false,
501
- "optional": false,
502
- "docs": {
503
- "tags": [],
504
- "text": "Set the number of slides you wish to display."
505
- },
506
- "attribute": "items-per-page",
507
- "reflect": true,
508
- "defaultValue": "1"
509
- }
510
- }; }
511
- static get states() { return {
512
- "hasErrors": {},
513
- "limitStylingAppends": {},
514
- "isLoading": {},
515
- "activeIndex": {},
516
- "tutorialElementWidth": {}
517
- }; }
518
- static get elementRef() { return "el"; }
519
- static get watchers() { return [{
520
- "propName": "cmsEndpoint",
521
- "methodName": "watchEndpoint"
522
- }, {
523
- "propName": "language",
524
- "methodName": "watchEndpoint"
525
- }]; }
526
- }
@@ -1 +0,0 @@
1
- export * from './components';
@@ -1,40 +0,0 @@
1
- const DEFAULT_LANGUAGE = 'en';
2
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
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
- hr: {
25
- error: 'Greška',
26
- noResults: 'Učitavanje, molimo pričekajte ...',
27
- },
28
- 'es-mx': {
29
- 'error': 'Error',
30
- 'noResults': 'Cargando, espere por favor…'
31
- },
32
- 'pt-br': {
33
- 'error': 'Erro',
34
- 'noResults': 'Carregando, espere por favor…'
35
- }
36
- };
37
- export const translate = (key, customLang) => {
38
- const lang = customLang;
39
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
40
- };
@@ -1,39 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface GeneralTutorialSlider extends Components.GeneralTutorialSlider, HTMLElement {}
4
- export const GeneralTutorialSlider: {
5
- prototype: GeneralTutorialSlider;
6
- new (): GeneralTutorialSlider;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;