@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,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f09c74e2.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ 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);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/about-us/general-about-us.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "2.15.2",
8
+ "typescriptVersion": "4.5.4"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,137 @@
1
+ :host {
2
+ display: block;
3
+ font-family: inherit;
4
+ }
5
+
6
+ p {
7
+ margin: 0;
8
+ padding: 0;
9
+ font-family: inherit;
10
+ }
11
+
12
+ button {
13
+ font-family: inherit;
14
+ }
15
+
16
+ .AboutUsError .ErrorInfo {
17
+ color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));
18
+ }
19
+
20
+ .AboutUsWrapper {
21
+ display: flex;
22
+ flex-direction: row;
23
+ justify-content: space-between;
24
+ width: 100%;
25
+ background-color: var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A));
26
+ animation: fadeInAnimation ease 1.5s;
27
+ animation-iteration-count: 1;
28
+ animation-fill-mode: forwards;
29
+ }
30
+
31
+ @keyframes fadeInAnimation {
32
+ 0% {
33
+ opacity: 0;
34
+ }
35
+ 100% {
36
+ opacity: 1;
37
+ }
38
+ }
39
+ .ItemImage {
40
+ flex: auto;
41
+ max-width: 50%;
42
+ height: 300px;
43
+ border-radius: 5px;
44
+ }
45
+
46
+ .ItemDetails {
47
+ flex: 1 1 0;
48
+ display: flex;
49
+ flex-direction: column;
50
+ justify-content: space-around;
51
+ border-radius: 5px;
52
+ margin: 0 20px;
53
+ }
54
+
55
+ .Title {
56
+ font-size: 24px;
57
+ font-weight: 700;
58
+ -webkit-text-fill-color: transparent;
59
+ color: var(--emfe-w-casino-typography, var(--emfe-w-color-contrast, #FFFFFF));
60
+ 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)));
61
+ -webkit-background-clip: text;
62
+ -webkit-text-fill-color: transparent;
63
+ }
64
+
65
+ .Description {
66
+ font-size: 16px;
67
+ color: var(--emfe-w-casino-typography, var(--emfe-w-color-contrast, #FFFFFF));
68
+ }
69
+
70
+ button {
71
+ width: 160px;
72
+ padding: 10px 15px;
73
+ 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)));
74
+ color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
75
+ font-size: 16px;
76
+ border: 2px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));
77
+ border-radius: 5px;
78
+ line-height: 24px;
79
+ transition: all 1s;
80
+ display: flex;
81
+ justify-content: center;
82
+ align-items: center;
83
+ cursor: pointer;
84
+ }
85
+ button:hover {
86
+ 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)));
87
+ color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
88
+ transition: all 0.5s;
89
+ transform: translateY(-10px);
90
+ }
91
+ button button::after {
92
+ content: "";
93
+ display: block;
94
+ background-color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
95
+ mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yMS44ODMgMTJsLTcuNTI3IDYuMjM1LjY0NC43NjUgOS03LjUyMS05LTcuNDc5LS42NDUuNzY0IDcuNTI5IDYuMjM2aC0yMS44ODR2MWgyMS44ODN6Ii8+PC9zdmc+");
96
+ width: 24px;
97
+ height: 24px;
98
+ margin: 0 10px;
99
+ }
100
+
101
+ @container (max-width: 475px) {
102
+ .AboutUsWrapper {
103
+ display: flex;
104
+ flex-direction: column;
105
+ justify-content: space-between;
106
+ flex-wrap: wrap;
107
+ width: 100%;
108
+ gap: 20px;
109
+ padding-bottom: 20px;
110
+ background-color: var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A));
111
+ animation: fadeInAnimation ease 1.5s;
112
+ animation-iteration-count: 1;
113
+ animation-fill-mode: forwards;
114
+ }
115
+
116
+ .ItemImage {
117
+ flex: auto;
118
+ width: 100%;
119
+ max-width: unset;
120
+ flex-grow: 1;
121
+ }
122
+
123
+ .ItemDetails {
124
+ flex: 1 1 0;
125
+ display: flex;
126
+ flex-direction: column;
127
+ justify-content: space-around;
128
+ align-items: center;
129
+ border-radius: 5px;
130
+ gap: 20px;
131
+ margin: 0 20px;
132
+ }
133
+
134
+ .Description {
135
+ text-align: center;
136
+ }
137
+ }
@@ -0,0 +1,282 @@
1
+ import { Component, Prop, State, Watch, h } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ import { getDeviceCustom, checkDeviceType, getDevicePlatform } from '../../utils/utils';
4
+ export class GeneralAboutUs {
5
+ constructor() {
6
+ /**
7
+ * Language of the widget
8
+ */
9
+ this.language = 'en';
10
+ /**
11
+ * User roles
12
+ */
13
+ this.userRoles = 'everyone';
14
+ /**
15
+ * CMS Endpoint stage
16
+ */
17
+ this.cmsEnv = 'stage';
18
+ /**
19
+ * Client custom styling via inline style
20
+ */
21
+ this.clientStyling = '';
22
+ /**
23
+ * Client custom styling via url
24
+ */
25
+ this.clientStylingUrl = '';
26
+ this.hasErrors = false;
27
+ this.isLoading = true;
28
+ this.limitStylingAppends = false;
29
+ this.device = '';
30
+ this.handleClick = (url, target, location, isExternal) => {
31
+ window.postMessage({ type: 'AboutUsClicked', buttonUrl: url, targetType: target, locations: location, externalLink: isExternal || false }, window.location.href);
32
+ // @ts-ignore Analytics event
33
+ if (typeof gtag == 'function') {
34
+ // @ts-ignore
35
+ gtag('event', 'GeneralAboutUs', {
36
+ 'context': 'AboutUsContent'
37
+ });
38
+ }
39
+ };
40
+ this.setImage = (image) => {
41
+ let source = '';
42
+ this.device = checkDeviceType();
43
+ switch (this.device) {
44
+ case 'mobile':
45
+ source = image.imageMobile;
46
+ break;
47
+ case 'tablet':
48
+ source = image.imageTablet;
49
+ break;
50
+ case 'desktop':
51
+ source = image.imageDesktop;
52
+ break;
53
+ }
54
+ return source;
55
+ };
56
+ this.setClientStyling = () => {
57
+ let sheet = document.createElement('style');
58
+ sheet.innerHTML = this.clientStyling;
59
+ this.stylingContainer.prepend(sheet);
60
+ };
61
+ this.setClientStylingURL = () => {
62
+ let url = new URL(this.clientStylingUrl);
63
+ let cssFile = document.createElement('style');
64
+ fetch(url.href)
65
+ .then((res) => res.text())
66
+ .then((data) => {
67
+ cssFile.innerHTML = data;
68
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
69
+ })
70
+ .catch((err) => {
71
+ console.log('error ', err);
72
+ });
73
+ };
74
+ }
75
+ watchEndpoint(newValue, oldValue) {
76
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
77
+ this.getAboutUs();
78
+ }
79
+ }
80
+ componentWillLoad() {
81
+ if (this.cmsEndpoint && this.language) {
82
+ return this.getAboutUs();
83
+ }
84
+ }
85
+ componentDidLoad() {
86
+ this.device = getDeviceCustom();
87
+ }
88
+ getAboutUs() {
89
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
90
+ url.searchParams.append('env', this.cmsEnv);
91
+ url.searchParams.append('userRoles', this.userRoles);
92
+ url.searchParams.append('device', getDevicePlatform());
93
+ return new Promise((resolve, reject) => {
94
+ this.isLoading = true;
95
+ fetch(url.href)
96
+ .then((res) => res.json())
97
+ .then((aboutUsContent) => {
98
+ const keysToKeep = ['title', 'description', 'images', 'button', 'externalLink', 'targetType', 'locations'];
99
+ const aboutUsArrContent = Object.entries(aboutUsContent)
100
+ .filter(([key]) => keysToKeep.includes(key))
101
+ .reduce((acc, [key, value]) => {
102
+ acc[key] = value;
103
+ return acc;
104
+ }, {});
105
+ this.aboutUsData = aboutUsArrContent;
106
+ resolve(aboutUsArrContent);
107
+ }).catch((err) => {
108
+ console.error(err);
109
+ this.hasErrors = true;
110
+ reject(err);
111
+ }).finally(() => {
112
+ this.isLoading = false;
113
+ });
114
+ });
115
+ }
116
+ componentDidRender() {
117
+ // start custom styling area
118
+ if (!this.limitStylingAppends && this.stylingContainer) {
119
+ if (this.clientStyling)
120
+ this.setClientStyling();
121
+ if (this.clientStylingUrl)
122
+ this.setClientStylingURL();
123
+ this.limitStylingAppends = true;
124
+ }
125
+ }
126
+ // end custom styling area
127
+ render() {
128
+ var _a, _b, _c, _d;
129
+ if (this.hasErrors) {
130
+ return (h("div", { class: "AboutUsError" },
131
+ h("div", { class: "ErrorInfo" }, translate('error', this.language))));
132
+ }
133
+ if (!this.isLoading) {
134
+ return (h("div", { ref: el => this.stylingContainer = el },
135
+ h("div", { class: "AboutUsWrapper" },
136
+ h("div", { class: "ItemImage", style: { background: `url(${this.setImage(this.aboutUsData.images)}) no-repeat center center / cover` } }),
137
+ h("div", { class: "ItemDetails" },
138
+ h("div", { class: "Title", innerHTML: (_a = this.aboutUsData) === null || _a === void 0 ? void 0 : _a.title }),
139
+ h("div", { class: "Description", innerHTML: (_b = this.aboutUsData) === null || _b === void 0 ? void 0 : _b.description }),
140
+ h("button", { class: "Button", onClick: () => {
141
+ var _a, _b, _c, _d, _e;
142
+ 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);
143
+ } }, (_d = (_c = this.aboutUsData) === null || _c === void 0 ? void 0 : _c.button) === null || _d === void 0 ? void 0 : _d.buttonText)))));
144
+ }
145
+ }
146
+ static get is() { return "general-about-us"; }
147
+ static get encapsulation() { return "shadow"; }
148
+ static get originalStyleUrls() { return {
149
+ "$": ["general-about-us.scss"]
150
+ }; }
151
+ static get styleUrls() { return {
152
+ "$": ["general-about-us.css"]
153
+ }; }
154
+ static get properties() { return {
155
+ "cmsEndpoint": {
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": "Endpoint URL for the source of data"
168
+ },
169
+ "attribute": "cms-endpoint",
170
+ "reflect": true
171
+ },
172
+ "language": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Language of the widget"
185
+ },
186
+ "attribute": "language",
187
+ "reflect": true,
188
+ "defaultValue": "'en'"
189
+ },
190
+ "userRoles": {
191
+ "type": "string",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "string",
195
+ "resolved": "string",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": "User roles"
203
+ },
204
+ "attribute": "user-roles",
205
+ "reflect": true,
206
+ "defaultValue": "'everyone'"
207
+ },
208
+ "cmsEnv": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "string",
213
+ "resolved": "string",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "CMS Endpoint stage"
221
+ },
222
+ "attribute": "cms-env",
223
+ "reflect": true,
224
+ "defaultValue": "'stage'"
225
+ },
226
+ "clientStyling": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "string",
231
+ "resolved": "string",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Client custom styling via inline style"
239
+ },
240
+ "attribute": "client-styling",
241
+ "reflect": true,
242
+ "defaultValue": "''"
243
+ },
244
+ "clientStylingUrl": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Client custom styling via url"
257
+ },
258
+ "attribute": "client-styling-url",
259
+ "reflect": true,
260
+ "defaultValue": "''"
261
+ }
262
+ }; }
263
+ static get states() { return {
264
+ "hasErrors": {},
265
+ "isLoading": {},
266
+ "limitStylingAppends": {},
267
+ "device": {}
268
+ }; }
269
+ static get watchers() { return [{
270
+ "propName": "cmsEndpoint",
271
+ "methodName": "watchEndpoint"
272
+ }, {
273
+ "propName": "language",
274
+ "methodName": "watchEndpoint"
275
+ }, {
276
+ "propName": "userRoles",
277
+ "methodName": "watchEndpoint"
278
+ }, {
279
+ "propName": "device",
280
+ "methodName": "watchEndpoint"
281
+ }]; }
282
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,32 @@
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
+ };
29
+ export const translate = (key, customLang) => {
30
+ const lang = customLang;
31
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
32
+ };
@@ -0,0 +1,56 @@
1
+ export function checkDeviceType() {
2
+ const userAgent = navigator.userAgent.toLowerCase();
3
+ const width = screen.availWidth;
4
+ const height = screen.availHeight;
5
+ if (userAgent.includes('iphone')) {
6
+ return 'mobile';
7
+ }
8
+ if (userAgent.includes('android')) {
9
+ if (height > width && width < 800) {
10
+ return 'mobile';
11
+ }
12
+ if (width > height && height < 800) {
13
+ return 'tablet';
14
+ }
15
+ }
16
+ return 'desktop';
17
+ }
18
+ function checkCustomDeviceWidth() {
19
+ const width = screen.availWidth;
20
+ if (width < 600) {
21
+ return 'mobile';
22
+ }
23
+ else if (width >= 600 && width < 1100) {
24
+ return 'tablet';
25
+ }
26
+ }
27
+ export function getDeviceCustom() {
28
+ const userAgent = navigator.userAgent.toLowerCase();
29
+ let source = '';
30
+ source = (userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) ? checkCustomDeviceWidth() : 'desktop';
31
+ return source;
32
+ }
33
+ const getDevice = () => {
34
+ let userAgent = window.navigator.userAgent.toLocaleLowerCase();
35
+ if (userAgent.includes('android/i'))
36
+ return 'android';
37
+ if (userAgent.includes('iphone/i'))
38
+ return 'iPhone';
39
+ if (userAgent.includes('ipad/i') || userAgent.includes('ipod/i'))
40
+ return 'iPad';
41
+ return 'PC';
42
+ };
43
+ export const getDevicePlatform = () => {
44
+ const device = getDevice();
45
+ if (device) {
46
+ if (device === 'PC') {
47
+ return 'dk';
48
+ }
49
+ else if (device === 'iPad' || device === 'iPhone') {
50
+ return 'mtWeb';
51
+ }
52
+ else {
53
+ return 'mtWeb';
54
+ }
55
+ }
56
+ };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GeneralAboutUs extends Components.GeneralAboutUs, HTMLElement {}
4
+ export const GeneralAboutUs: {
5
+ prototype: GeneralAboutUs;
6
+ new (): GeneralAboutUs;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;