@everymatrix/general-slider-navigation 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/carousel-component_2.cjs.entry.js +431 -0
- package/dist/cjs/general-slider-navigation.cjs.js +25 -0
- package/dist/cjs/index-88d9137e.js +1269 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/carousel-component/carousel-component.css +167 -0
- package/dist/collection/components/carousel-component/carousel-component.js +381 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.css +0 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +301 -0
- package/dist/collection/components/general-slider-navigation/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +62 -0
- package/dist/collection/utils/utils.js +56 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/carousel-component_2.entry.js +426 -0
- package/dist/esm/general-slider-navigation.js +20 -0
- package/dist/esm/index-c749968b.js +1242 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -0
- package/dist/general-slider-navigation/index.esm.js +0 -0
- package/dist/general-slider-navigation/p-8c0cd4b3.js +2 -0
- package/dist/general-slider-navigation/p-a4458d8c.entry.js +1 -0
- package/dist/general-slider-navigation/p-e1255160.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/carousel-component/carousel-component.d.ts +72 -0
- package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +56 -0
- package/dist/types/components/general-slider-navigation/index.d.ts +1 -0
- package/dist/types/components.d.ts +194 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +10 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { getDevicePlatform } from "../../utils/utils";
|
|
3
|
+
import { getTranslations, translate } from "../../utils/locale.utils";
|
|
4
|
+
export class GeneralSliderNavigation {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.clientStyling = '';
|
|
7
|
+
this.clientStylingUrl = '';
|
|
8
|
+
this.cmsEndpoint = undefined;
|
|
9
|
+
this.cmsEnv = 'stage';
|
|
10
|
+
this.language = 'en';
|
|
11
|
+
this.userRoles = 'everyone';
|
|
12
|
+
this.bulletNavigation = true;
|
|
13
|
+
this.slideTimer = undefined;
|
|
14
|
+
this.sliderMobileWidth = 200;
|
|
15
|
+
this.sliderDesktopWidth = 300;
|
|
16
|
+
this.translationUrl = '';
|
|
17
|
+
this.isLoading = true;
|
|
18
|
+
this.hasErrors = false;
|
|
19
|
+
this.device = '';
|
|
20
|
+
}
|
|
21
|
+
handleNewTranslations() {
|
|
22
|
+
getTranslations(this.translationUrl);
|
|
23
|
+
}
|
|
24
|
+
watchEndpoint(newValue, oldValue) {
|
|
25
|
+
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
26
|
+
this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
27
|
+
this.sliderData = GeneralSliderNavigation;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async componentWillLoad() {
|
|
32
|
+
if (this.translationUrl.length > 2) {
|
|
33
|
+
await getTranslations(this.translationUrl);
|
|
34
|
+
}
|
|
35
|
+
if (this.cmsEndpoint && this.language) {
|
|
36
|
+
return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
37
|
+
this.sliderData = GeneralSliderNavigation;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
getGeneralSliderNavigation() {
|
|
42
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
|
|
43
|
+
url.searchParams.append('env', this.cmsEnv);
|
|
44
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
45
|
+
url.searchParams.append('device', getDevicePlatform());
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
this.isLoading = true;
|
|
48
|
+
fetch(url.href)
|
|
49
|
+
.then((res) => res.json())
|
|
50
|
+
.then((menuSliderData) => {
|
|
51
|
+
resolve(menuSliderData.banners);
|
|
52
|
+
})
|
|
53
|
+
.catch((err) => {
|
|
54
|
+
console.error(err);
|
|
55
|
+
this.hasErrors = true;
|
|
56
|
+
reject(err);
|
|
57
|
+
}).finally(() => {
|
|
58
|
+
this.isLoading = false;
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
if (this.hasErrors) {
|
|
64
|
+
return (h("div", { class: "PageError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
|
|
65
|
+
}
|
|
66
|
+
if (!this.isLoading) {
|
|
67
|
+
return (h("div", null, h("carousel-component", { "slider-data": this.sliderData, language: this.language, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "slider-mobile-width": this.sliderMobileWidth, "slider-desktop-width": this.sliderDesktopWidth })));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static get is() { return "general-slider-navigation"; }
|
|
71
|
+
static get encapsulation() { return "shadow"; }
|
|
72
|
+
static get originalStyleUrls() {
|
|
73
|
+
return {
|
|
74
|
+
"$": ["general-slider-navigation.scss"]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static get styleUrls() {
|
|
78
|
+
return {
|
|
79
|
+
"$": ["general-slider-navigation.css"]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static get properties() {
|
|
83
|
+
return {
|
|
84
|
+
"clientStyling": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "string",
|
|
89
|
+
"resolved": "string",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": "Client custom styling via inline style"
|
|
97
|
+
},
|
|
98
|
+
"attribute": "client-styling",
|
|
99
|
+
"reflect": true,
|
|
100
|
+
"defaultValue": "''"
|
|
101
|
+
},
|
|
102
|
+
"clientStylingUrl": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "string",
|
|
107
|
+
"resolved": "string",
|
|
108
|
+
"references": {}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": "Client custom styling via url"
|
|
115
|
+
},
|
|
116
|
+
"attribute": "client-styling-url",
|
|
117
|
+
"reflect": true,
|
|
118
|
+
"defaultValue": "''"
|
|
119
|
+
},
|
|
120
|
+
"cmsEndpoint": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"mutable": false,
|
|
123
|
+
"complexType": {
|
|
124
|
+
"original": "string",
|
|
125
|
+
"resolved": "string",
|
|
126
|
+
"references": {}
|
|
127
|
+
},
|
|
128
|
+
"required": true,
|
|
129
|
+
"optional": false,
|
|
130
|
+
"docs": {
|
|
131
|
+
"tags": [],
|
|
132
|
+
"text": "Endpoint URL for the source of data"
|
|
133
|
+
},
|
|
134
|
+
"attribute": "cms-endpoint",
|
|
135
|
+
"reflect": true
|
|
136
|
+
},
|
|
137
|
+
"cmsEnv": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"mutable": false,
|
|
140
|
+
"complexType": {
|
|
141
|
+
"original": "string",
|
|
142
|
+
"resolved": "string",
|
|
143
|
+
"references": {}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"optional": false,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [],
|
|
149
|
+
"text": "CMS Endpoint stage"
|
|
150
|
+
},
|
|
151
|
+
"attribute": "cms-env",
|
|
152
|
+
"reflect": true,
|
|
153
|
+
"defaultValue": "'stage'"
|
|
154
|
+
},
|
|
155
|
+
"language": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "string",
|
|
160
|
+
"resolved": "string",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": "Language of the widget"
|
|
168
|
+
},
|
|
169
|
+
"attribute": "language",
|
|
170
|
+
"reflect": true,
|
|
171
|
+
"defaultValue": "'en'"
|
|
172
|
+
},
|
|
173
|
+
"userRoles": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"mutable": false,
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "string",
|
|
178
|
+
"resolved": "string",
|
|
179
|
+
"references": {}
|
|
180
|
+
},
|
|
181
|
+
"required": false,
|
|
182
|
+
"optional": false,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": "User roles"
|
|
186
|
+
},
|
|
187
|
+
"attribute": "user-roles",
|
|
188
|
+
"reflect": true,
|
|
189
|
+
"defaultValue": "'everyone'"
|
|
190
|
+
},
|
|
191
|
+
"bulletNavigation": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"mutable": false,
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "boolean",
|
|
196
|
+
"resolved": "boolean",
|
|
197
|
+
"references": {}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": "Show bullet navigation under slides"
|
|
204
|
+
},
|
|
205
|
+
"attribute": "bullet-navigation",
|
|
206
|
+
"reflect": true,
|
|
207
|
+
"defaultValue": "true"
|
|
208
|
+
},
|
|
209
|
+
"slideTimer": {
|
|
210
|
+
"type": "number",
|
|
211
|
+
"mutable": false,
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "number",
|
|
214
|
+
"resolved": "number",
|
|
215
|
+
"references": {}
|
|
216
|
+
},
|
|
217
|
+
"required": false,
|
|
218
|
+
"optional": false,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": "Timer for auto sliding"
|
|
222
|
+
},
|
|
223
|
+
"attribute": "slide-timer",
|
|
224
|
+
"reflect": true
|
|
225
|
+
},
|
|
226
|
+
"sliderMobileWidth": {
|
|
227
|
+
"type": "number",
|
|
228
|
+
"mutable": false,
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "number",
|
|
231
|
+
"resolved": "number",
|
|
232
|
+
"references": {}
|
|
233
|
+
},
|
|
234
|
+
"required": false,
|
|
235
|
+
"optional": false,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": "Mobile width for sliders"
|
|
239
|
+
},
|
|
240
|
+
"attribute": "slider-mobile-width",
|
|
241
|
+
"reflect": true,
|
|
242
|
+
"defaultValue": "200"
|
|
243
|
+
},
|
|
244
|
+
"sliderDesktopWidth": {
|
|
245
|
+
"type": "number",
|
|
246
|
+
"mutable": false,
|
|
247
|
+
"complexType": {
|
|
248
|
+
"original": "number",
|
|
249
|
+
"resolved": "number",
|
|
250
|
+
"references": {}
|
|
251
|
+
},
|
|
252
|
+
"required": false,
|
|
253
|
+
"optional": false,
|
|
254
|
+
"docs": {
|
|
255
|
+
"tags": [],
|
|
256
|
+
"text": "Desktop width for sliders"
|
|
257
|
+
},
|
|
258
|
+
"attribute": "slider-desktop-width",
|
|
259
|
+
"reflect": true,
|
|
260
|
+
"defaultValue": "300"
|
|
261
|
+
},
|
|
262
|
+
"translationUrl": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"mutable": false,
|
|
265
|
+
"complexType": {
|
|
266
|
+
"original": "string",
|
|
267
|
+
"resolved": "string",
|
|
268
|
+
"references": {}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": false,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [],
|
|
274
|
+
"text": "Translation via url"
|
|
275
|
+
},
|
|
276
|
+
"attribute": "translation-url",
|
|
277
|
+
"reflect": true,
|
|
278
|
+
"defaultValue": "''"
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
static get states() {
|
|
283
|
+
return {
|
|
284
|
+
"isLoading": {},
|
|
285
|
+
"hasErrors": {},
|
|
286
|
+
"device": {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
static get watchers() {
|
|
290
|
+
return [{
|
|
291
|
+
"propName": "translationUrl",
|
|
292
|
+
"methodName": "handleNewTranslations"
|
|
293
|
+
}, {
|
|
294
|
+
"propName": "cmsEndpoint",
|
|
295
|
+
"methodName": "watchEndpoint"
|
|
296
|
+
}, {
|
|
297
|
+
"propName": "language",
|
|
298
|
+
"methodName": "watchEndpoint"
|
|
299
|
+
}];
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GeneralSliderNavigation } from './general-slider-navigation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
joinNow: 'Join now'
|
|
8
|
+
},
|
|
9
|
+
hu: {
|
|
10
|
+
error: 'Error',
|
|
11
|
+
noResults: 'Loading, please wait ...',
|
|
12
|
+
joinNow: 'Join now'
|
|
13
|
+
},
|
|
14
|
+
ro: {
|
|
15
|
+
error: 'Eroare',
|
|
16
|
+
noResults: 'Loading, please wait ...',
|
|
17
|
+
joinNow: 'Join now'
|
|
18
|
+
},
|
|
19
|
+
fr: {
|
|
20
|
+
error: 'Error',
|
|
21
|
+
noResults: 'Loading, please wait ...',
|
|
22
|
+
joinNow: 'Join now'
|
|
23
|
+
},
|
|
24
|
+
ar: {
|
|
25
|
+
error: 'خطأ',
|
|
26
|
+
noResults: 'Loading, please wait ...',
|
|
27
|
+
joinNow: 'Join now'
|
|
28
|
+
},
|
|
29
|
+
hr: {
|
|
30
|
+
error: 'Greška',
|
|
31
|
+
noResults: 'Učitavanje, molimo pričekajte ...',
|
|
32
|
+
joinNow: 'Join now'
|
|
33
|
+
},
|
|
34
|
+
'pt-br': {
|
|
35
|
+
'error': 'Erro',
|
|
36
|
+
'noResults': 'Carregando, espere por favor…',
|
|
37
|
+
'joinNow': 'Join now'
|
|
38
|
+
},
|
|
39
|
+
'es-mx': {
|
|
40
|
+
'error': 'Error',
|
|
41
|
+
'noResults': 'Cargando, espere por favor…',
|
|
42
|
+
'joinNow': 'Join now'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const getTranslations = (url) => {
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
fetch(url)
|
|
48
|
+
.then((res) => res.json())
|
|
49
|
+
.then((data) => {
|
|
50
|
+
Object.keys(data).forEach((item) => {
|
|
51
|
+
for (let key in data[item]) {
|
|
52
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
resolve(true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export const translate = (key, customLang) => {
|
|
60
|
+
const lang = customLang;
|
|
61
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
62
|
+
};
|
|
@@ -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
|
+
}
|