@everymatrix/general-about-us 1.29.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 (49) hide show
  1. package/dist/cjs/general-about-us.cjs.entry.js +244 -0
  2. package/dist/cjs/general-about-us.cjs.js +19 -0
  3. package/dist/cjs/index-f09c74e2.js +1223 -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/about-us/general-about-us.css +137 -0
  8. package/dist/collection/components/about-us/general-about-us.js +282 -0
  9. package/dist/collection/components/about-us/general-about-us.types.js +2 -0
  10. package/dist/collection/index.js +1 -0
  11. package/dist/collection/utils/locale.utils.js +32 -0
  12. package/dist/collection/utils/utils.js +56 -0
  13. package/dist/components/general-about-us.d.ts +11 -0
  14. package/dist/components/general-about-us.js +269 -0
  15. package/dist/components/index.d.ts +26 -0
  16. package/dist/components/index.js +1 -0
  17. package/dist/esm/general-about-us.entry.js +240 -0
  18. package/dist/esm/general-about-us.js +17 -0
  19. package/dist/esm/index-b262ca21.js +1198 -0
  20. package/dist/esm/index.js +1 -0
  21. package/dist/esm/loader.js +17 -0
  22. package/dist/esm/polyfills/core-js.js +11 -0
  23. package/dist/esm/polyfills/css-shim.js +1 -0
  24. package/dist/esm/polyfills/dom.js +79 -0
  25. package/dist/esm/polyfills/es5-html-element.js +1 -0
  26. package/dist/esm/polyfills/index.js +34 -0
  27. package/dist/esm/polyfills/system.js +6 -0
  28. package/dist/general-about-us/general-about-us.esm.js +1 -0
  29. package/dist/general-about-us/index.esm.js +0 -0
  30. package/dist/general-about-us/p-0c90e5ab.js +1 -0
  31. package/dist/general-about-us/p-4f27291f.entry.js +1 -0
  32. package/dist/index.cjs.js +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/stencil.config.js +22 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-about-us/.stencil/packages/general-about-us/stencil.config.d.ts +2 -0
  36. package/dist/types/components/about-us/general-about-us.d.ts +43 -0
  37. package/dist/types/components/about-us/general-about-us.types.d.ts +17 -0
  38. package/dist/types/components.d.ts +85 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  41. package/dist/types/utils/locale.utils.d.ts +1 -0
  42. package/dist/types/utils/utils.d.ts +3 -0
  43. package/loader/cdn.js +3 -0
  44. package/loader/index.cjs.js +3 -0
  45. package/loader/index.d.ts +12 -0
  46. package/loader/index.es2017.js +3 -0
  47. package/loader/index.js +4 -0
  48. package/loader/package.json +10 -0
  49. package/package.json +19 -0
@@ -0,0 +1,244 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f09c74e2.js');
6
+
7
+ const DEFAULT_LANGUAGE = 'en';
8
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
9
+ const TRANSLATIONS = {
10
+ en: {
11
+ error: 'Error',
12
+ noResults: 'Loading, please wait ...',
13
+ },
14
+ hu: {
15
+ error: 'Error',
16
+ noResults: 'Loading, please wait ...',
17
+ },
18
+ ro: {
19
+ error: 'Eroare',
20
+ noResults: 'Loading, please wait ...',
21
+ },
22
+ fr: {
23
+ error: 'Error',
24
+ noResults: 'Loading, please wait ...',
25
+ },
26
+ ar: {
27
+ error: 'خطأ',
28
+ noResults: 'Loading, please wait ...',
29
+ },
30
+ hr: {
31
+ error: 'Greška',
32
+ noResults: 'Učitavanje, molimo pričekajte ...',
33
+ }
34
+ };
35
+ const translate = (key, customLang) => {
36
+ const lang = customLang;
37
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
38
+ };
39
+
40
+ 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
+ }
57
+ function checkCustomDeviceWidth() {
58
+ const width = screen.availWidth;
59
+ if (width < 600) {
60
+ return 'mobile';
61
+ }
62
+ else if (width >= 600 && width < 1100) {
63
+ return 'tablet';
64
+ }
65
+ }
66
+ function getDeviceCustom() {
67
+ const userAgent = navigator.userAgent.toLowerCase();
68
+ let source = '';
69
+ source = (userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) ? checkCustomDeviceWidth() : 'desktop';
70
+ return source;
71
+ }
72
+ const getDevice = () => {
73
+ let userAgent = window.navigator.userAgent.toLocaleLowerCase();
74
+ if (userAgent.includes('android/i'))
75
+ return 'android';
76
+ if (userAgent.includes('iphone/i'))
77
+ return 'iPhone';
78
+ if (userAgent.includes('ipad/i') || userAgent.includes('ipod/i'))
79
+ return 'iPad';
80
+ return 'PC';
81
+ };
82
+ const getDevicePlatform = () => {
83
+ const device = getDevice();
84
+ if (device) {
85
+ if (device === 'PC') {
86
+ return 'dk';
87
+ }
88
+ else if (device === 'iPad' || device === 'iPhone') {
89
+ return 'mtWeb';
90
+ }
91
+ else {
92
+ return 'mtWeb';
93
+ }
94
+ }
95
+ };
96
+
97
+ const generalAboutUsCss = ":host {\n display: block;\n font-family: inherit;\n}\n\np {\n margin: 0;\n padding: 0;\n font-family: inherit;\n}\n\nbutton {\n font-family: inherit;\n}\n\n.AboutUsError .ErrorInfo {\n color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));\n}\n\n.AboutUsWrapper {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n background-color: var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A));\n animation: fadeInAnimation ease 1.5s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n}\n\n@keyframes fadeInAnimation {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.ItemImage {\n flex: auto;\n max-width: 50%;\n height: 300px;\n border-radius: 5px;\n}\n\n.ItemDetails {\n flex: 1 1 0;\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n border-radius: 5px;\n margin: 0 20px;\n}\n\n.Title {\n font-size: 24px;\n font-weight: 700;\n -webkit-text-fill-color: transparent;\n color: var(--emfe-w-casino-typography, var(--emfe-w-color-contrast, #FFFFFF));\n background: linear-gradient(to top, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-categories-color-primary, var(--emfe-w-color-primary, #D0046C)));\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n}\n\n.Description {\n font-size: 16px;\n color: var(--emfe-w-casino-typography, var(--emfe-w-color-contrast, #FFFFFF));\n}\n\nbutton {\n width: 160px;\n padding: 10px 15px;\n background: linear-gradient(to top, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-categories-color-primary, var(--emfe-w-color-primary, #D0046C)));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n font-size: 16px;\n border: 2px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n border-radius: 5px;\n line-height: 24px;\n transition: all 1s;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\nbutton:hover {\n background: linear-gradient(to bottom, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-categories-color-primary, var(--emfe-w-color-primary, #D0046C)));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n transition: all 0.5s;\n transform: translateY(-10px);\n}\nbutton button::after {\n content: \"\";\n display: block;\n background-color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n mask-image: url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yMS44ODMgMTJsLTcuNTI3IDYuMjM1LjY0NC43NjUgOS03LjUyMS05LTcuNDc5LS42NDUuNzY0IDcuNTI5IDYuMjM2aC0yMS44ODR2MWgyMS44ODN6Ii8+PC9zdmc+\");\n width: 24px;\n height: 24px;\n margin: 0 10px;\n}\n\n@container (max-width: 475px) {\n .AboutUsWrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n gap: 20px;\n padding-bottom: 20px;\n background-color: var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A));\n animation: fadeInAnimation ease 1.5s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n }\n\n .ItemImage {\n flex: auto;\n width: 100%;\n max-width: unset;\n flex-grow: 1;\n }\n\n .ItemDetails {\n flex: 1 1 0;\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n border-radius: 5px;\n gap: 20px;\n margin: 0 20px;\n }\n\n .Description {\n text-align: center;\n }\n}";
98
+
99
+ const GeneralAboutUs = class {
100
+ constructor(hostRef) {
101
+ index.registerInstance(this, hostRef);
102
+ /**
103
+ * Language of the widget
104
+ */
105
+ this.language = 'en';
106
+ /**
107
+ * User roles
108
+ */
109
+ this.userRoles = 'everyone';
110
+ /**
111
+ * CMS Endpoint stage
112
+ */
113
+ this.cmsEnv = 'stage';
114
+ /**
115
+ * Client custom styling via inline style
116
+ */
117
+ this.clientStyling = '';
118
+ /**
119
+ * Client custom styling via url
120
+ */
121
+ this.clientStylingUrl = '';
122
+ this.hasErrors = false;
123
+ this.isLoading = true;
124
+ this.limitStylingAppends = false;
125
+ this.device = '';
126
+ this.handleClick = (url, target, location, isExternal) => {
127
+ window.postMessage({ type: 'AboutUsClicked', buttonUrl: url, targetType: target, locations: location, externalLink: isExternal || false }, window.location.href);
128
+ // @ts-ignore Analytics event
129
+ if (typeof gtag == 'function') {
130
+ // @ts-ignore
131
+ gtag('event', 'GeneralAboutUs', {
132
+ 'context': 'AboutUsContent'
133
+ });
134
+ }
135
+ };
136
+ this.setImage = (image) => {
137
+ let source = '';
138
+ this.device = checkDeviceType();
139
+ switch (this.device) {
140
+ case 'mobile':
141
+ source = image.imageMobile;
142
+ break;
143
+ case 'tablet':
144
+ source = image.imageTablet;
145
+ break;
146
+ case 'desktop':
147
+ source = image.imageDesktop;
148
+ break;
149
+ }
150
+ return source;
151
+ };
152
+ this.setClientStyling = () => {
153
+ let sheet = document.createElement('style');
154
+ sheet.innerHTML = this.clientStyling;
155
+ this.stylingContainer.prepend(sheet);
156
+ };
157
+ this.setClientStylingURL = () => {
158
+ let url = new URL(this.clientStylingUrl);
159
+ let cssFile = document.createElement('style');
160
+ fetch(url.href)
161
+ .then((res) => res.text())
162
+ .then((data) => {
163
+ cssFile.innerHTML = data;
164
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
165
+ })
166
+ .catch((err) => {
167
+ console.log('error ', err);
168
+ });
169
+ };
170
+ }
171
+ watchEndpoint(newValue, oldValue) {
172
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
173
+ this.getAboutUs();
174
+ }
175
+ }
176
+ componentWillLoad() {
177
+ if (this.cmsEndpoint && this.language) {
178
+ return this.getAboutUs();
179
+ }
180
+ }
181
+ componentDidLoad() {
182
+ this.device = getDeviceCustom();
183
+ }
184
+ getAboutUs() {
185
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
186
+ url.searchParams.append('env', this.cmsEnv);
187
+ url.searchParams.append('userRoles', this.userRoles);
188
+ url.searchParams.append('device', getDevicePlatform());
189
+ return new Promise((resolve, reject) => {
190
+ this.isLoading = true;
191
+ fetch(url.href)
192
+ .then((res) => res.json())
193
+ .then((aboutUsContent) => {
194
+ const keysToKeep = ['title', 'description', 'images', 'button', 'externalLink', 'targetType', 'locations'];
195
+ const aboutUsArrContent = Object.entries(aboutUsContent)
196
+ .filter(([key]) => keysToKeep.includes(key))
197
+ .reduce((acc, [key, value]) => {
198
+ acc[key] = value;
199
+ return acc;
200
+ }, {});
201
+ this.aboutUsData = aboutUsArrContent;
202
+ resolve(aboutUsArrContent);
203
+ }).catch((err) => {
204
+ console.error(err);
205
+ this.hasErrors = true;
206
+ reject(err);
207
+ }).finally(() => {
208
+ this.isLoading = false;
209
+ });
210
+ });
211
+ }
212
+ componentDidRender() {
213
+ // start custom styling area
214
+ if (!this.limitStylingAppends && this.stylingContainer) {
215
+ if (this.clientStyling)
216
+ this.setClientStyling();
217
+ if (this.clientStylingUrl)
218
+ this.setClientStylingURL();
219
+ this.limitStylingAppends = true;
220
+ }
221
+ }
222
+ // end custom styling area
223
+ render() {
224
+ var _a, _b, _c, _d;
225
+ if (this.hasErrors) {
226
+ return (index.h("div", { class: "AboutUsError" }, index.h("div", { class: "ErrorInfo" }, translate('error', this.language))));
227
+ }
228
+ if (!this.isLoading) {
229
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "AboutUsWrapper" }, index.h("div", { class: "ItemImage", style: { background: `url(${this.setImage(this.aboutUsData.images)}) no-repeat center center / cover` } }), index.h("div", { class: "ItemDetails" }, index.h("div", { class: "Title", innerHTML: (_a = this.aboutUsData) === null || _a === void 0 ? void 0 : _a.title }), index.h("div", { class: "Description", innerHTML: (_b = this.aboutUsData) === null || _b === void 0 ? void 0 : _b.description }), index.h("button", { class: "Button", onClick: () => {
230
+ var _a, _b, _c, _d, _e;
231
+ return this.handleClick((_b = (_a = this.aboutUsData) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.buttonUrl, (_c = this.aboutUsData) === null || _c === void 0 ? void 0 : _c.targetType, (_d = this.aboutUsData) === null || _d === void 0 ? void 0 : _d.locations, (_e = this.aboutUsData) === null || _e === void 0 ? void 0 : _e.externalLink);
232
+ } }, (_d = (_c = this.aboutUsData) === null || _c === void 0 ? void 0 : _c.button) === null || _d === void 0 ? void 0 : _d.buttonText)))));
233
+ }
234
+ }
235
+ static get watchers() { return {
236
+ "cmsEndpoint": ["watchEndpoint"],
237
+ "language": ["watchEndpoint"],
238
+ "userRoles": ["watchEndpoint"],
239
+ "device": ["watchEndpoint"]
240
+ }; }
241
+ };
242
+ GeneralAboutUs.style = generalAboutUsCss;
243
+
244
+ exports.general_about_us = GeneralAboutUs;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-f09c74e2.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-about-us.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["general-about-us.cjs",[[1,"general-about-us",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"hasErrors":[32],"isLoading":[32],"limitStylingAppends":[32],"device":[32]}]]]], options);
19
+ });