@everymatrix/casino-challenges-overlay 0.0.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.
- package/dist/casino-challenges-overlay/app-globals-0f993ce5.js +1 -0
- package/dist/casino-challenges-overlay/casino-challenges-overlay-6812eb27.js +1 -0
- package/dist/casino-challenges-overlay/casino-challenges-overlay.entry.js +1 -0
- package/dist/casino-challenges-overlay/casino-challenges-overlay.esm.js +1 -0
- package/dist/casino-challenges-overlay/index-23ccb586.js +2 -0
- package/dist/casino-challenges-overlay/index.esm.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-challenges-overlay-cbac4d0a.js +251 -0
- package/dist/cjs/casino-challenges-overlay.cjs.entry.js +10 -0
- package/dist/cjs/casino-challenges-overlay.cjs.js +25 -0
- package/dist/cjs/index-87f5caf5.js +1187 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/assets/bell.svg +108 -0
- package/dist/collection/assets/bg-icon.svg +9 -0
- package/dist/collection/assets/gift.svg +123 -0
- package/dist/collection/assets/shining.svg +9 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/casino-challenges-overlay/casino-challenges-overlay.css +140 -0
- package/dist/collection/components/casino-challenges-overlay/casino-challenges-overlay.js +265 -0
- package/dist/collection/components/casino-challenges-overlay/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +36 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-challenges-overlay-6812eb27.js +249 -0
- package/dist/esm/casino-challenges-overlay.entry.js +2 -0
- package/dist/esm/casino-challenges-overlay.js +20 -0
- package/dist/esm/index-23ccb586.js +1161 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/packages/stencil/casino-challenges-overlay/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/packages/stencil/casino-challenges-overlay/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/packages/stencil/casino-challenges-overlay/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/packages/stencil/casino-challenges-overlay/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/casino-challenges-overlay/casino-challenges-overlay.d.ts +41 -0
- package/dist/types/components/casino-challenges-overlay/index.d.ts +1 -0
- package/dist/types/components.d.ts +77 -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 +3 -0
- package/dist/types/utils/utils.d.ts +1 -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 +27 -0
@@ -0,0 +1,265 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
3
|
+
import bgIcon from "../../assets/bg-icon.svg";
|
4
|
+
import bellIcon from "../../assets/bell.svg";
|
5
|
+
import giftIcon from "../../assets/gift.svg";
|
6
|
+
import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
|
7
|
+
export class CasinoChallengesOverlay {
|
8
|
+
constructor() {
|
9
|
+
this.mbSource = undefined;
|
10
|
+
this.clientStyling = undefined;
|
11
|
+
this.clientStylingUrl = undefined;
|
12
|
+
this.translationUrl = '';
|
13
|
+
this.language = 'en';
|
14
|
+
this.progress = 50;
|
15
|
+
this.isGrayed = false;
|
16
|
+
this.isNew = false;
|
17
|
+
this.isGift = false;
|
18
|
+
this.isNotification = false;
|
19
|
+
}
|
20
|
+
handleClientStylingChange(newValue, oldValue) {
|
21
|
+
if (newValue != oldValue) {
|
22
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
26
|
+
if (newValue != oldValue) {
|
27
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
handleMbSourceChange(newValue, oldValue) {
|
31
|
+
if (newValue != oldValue) {
|
32
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
componentWillLoad() {
|
36
|
+
if (this.translationUrl) {
|
37
|
+
resolveTranslationUrl(this.translationUrl);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
componentDidLoad() {
|
41
|
+
if (this.stylingContainer) {
|
42
|
+
if (this.mbSource)
|
43
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
44
|
+
if (this.clientStyling)
|
45
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
46
|
+
if (this.clientStylingUrl)
|
47
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
disconnectedCallback() {
|
51
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
52
|
+
}
|
53
|
+
getCapsuleDotPosition(progress, width = 55, height = 32, borderWidth = 3) {
|
54
|
+
if (progress <= 0 || progress >= 100)
|
55
|
+
return null;
|
56
|
+
const r = (height - borderWidth) / 2;
|
57
|
+
const straight = width - 2 * r;
|
58
|
+
const arcLength = Math.PI * r;
|
59
|
+
const segments = [
|
60
|
+
{
|
61
|
+
type: 'arc',
|
62
|
+
length: arcLength / 2,
|
63
|
+
startTheta: Math.PI,
|
64
|
+
endTheta: Math.PI + 1.6,
|
65
|
+
cx: r + borderWidth / 2,
|
66
|
+
cy: height / 2
|
67
|
+
},
|
68
|
+
{
|
69
|
+
type: 'line',
|
70
|
+
length: straight,
|
71
|
+
x0: r + borderWidth / 2,
|
72
|
+
y0: borderWidth / 2,
|
73
|
+
x1: width - r - borderWidth / 2,
|
74
|
+
y1: borderWidth / 2
|
75
|
+
},
|
76
|
+
{
|
77
|
+
type: 'arc',
|
78
|
+
length: arcLength,
|
79
|
+
startTheta: -Math.PI / 2,
|
80
|
+
endTheta: Math.PI / 2,
|
81
|
+
cx: width - r - borderWidth / 2,
|
82
|
+
cy: height / 2
|
83
|
+
},
|
84
|
+
{
|
85
|
+
type: 'line',
|
86
|
+
length: straight,
|
87
|
+
x0: width - r - borderWidth / 2,
|
88
|
+
y0: height - borderWidth / 2,
|
89
|
+
x1: r + borderWidth / 2,
|
90
|
+
y1: height - borderWidth / 2
|
91
|
+
},
|
92
|
+
{
|
93
|
+
type: 'arc',
|
94
|
+
length: arcLength / 2,
|
95
|
+
startTheta: Math.PI / 2,
|
96
|
+
endTheta: Math.PI,
|
97
|
+
cx: r + borderWidth / 2,
|
98
|
+
cy: height / 2
|
99
|
+
}
|
100
|
+
];
|
101
|
+
const perimeter = segments.reduce((sum, s) => sum + s.length, 0);
|
102
|
+
const L = (progress / 100) * perimeter;
|
103
|
+
let traveled = 0;
|
104
|
+
let x = 0;
|
105
|
+
let y = 0;
|
106
|
+
for (const seg of segments) {
|
107
|
+
if (L <= traveled + seg.length) {
|
108
|
+
const t = (L - traveled) / seg.length;
|
109
|
+
if (seg.type === 'line') {
|
110
|
+
x = seg.x0 + t * (seg.x1 - seg.x0);
|
111
|
+
y = seg.y0 + t * (seg.y1 - seg.y0);
|
112
|
+
}
|
113
|
+
else if (seg.type === 'arc') {
|
114
|
+
const theta = seg.startTheta + t * (seg.endTheta - seg.startTheta);
|
115
|
+
x = seg.cx + r * Math.cos(theta);
|
116
|
+
y = seg.cy + r * Math.sin(theta);
|
117
|
+
}
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
traveled += seg.length;
|
121
|
+
}
|
122
|
+
return { x, y };
|
123
|
+
}
|
124
|
+
renderBadgeContent() {
|
125
|
+
if (this.isNew)
|
126
|
+
return h("div", { class: "gradient-text" }, translate('new', this.language));
|
127
|
+
const icon = this.isGift ? giftIcon : this.isNotification ? bellIcon : null;
|
128
|
+
if (icon)
|
129
|
+
return h("img", { class: "icon", src: icon });
|
130
|
+
return h("div", { class: "gradient-text" }, "1");
|
131
|
+
}
|
132
|
+
render() {
|
133
|
+
const dot = this.getCapsuleDotPosition(this.progress);
|
134
|
+
return (h("div", { key: '7af8930a4a36a295e68f38f3c30ae7543b8cc12d', class: "container" }, h("div", { key: '27d77b134ecd3a27309f1e5d84b9c1bd2bbf8bcb', class: `circle ${this.isGrayed ? 'grayed' : ''}`, style: {
|
135
|
+
'--progress': `${this.progress}%`
|
136
|
+
} }, h("img", { key: '42486b790d0c33022c2a4acb0ef2ad9b618a1fc2', class: "circle__img", src: bgIcon }), h("div", { key: 'eba633711d409a63ef91621759029d82b64a96b7', class: "circle__content" }, h("span", { key: 'fe466e281f00b217aae2c44be730131e1349eaa3' }, this.progress, "%")), dot && (h("div", { key: 'b76218c1769e78fd165f9a3b0e311ec16dfc67ed', class: "dot", style: {
|
137
|
+
left: `${dot.x}px`,
|
138
|
+
top: `${dot.y}px`
|
139
|
+
} }))), !this.isGrayed && h("div", { key: '59049b68efc9649973521afb1b05caa11a14a3b4', class: `badge ${this.isNew ? 'new' : ''}` }, this.renderBadgeContent())));
|
140
|
+
}
|
141
|
+
static get is() { return "casino-challenges-overlay"; }
|
142
|
+
static get encapsulation() { return "shadow"; }
|
143
|
+
static get originalStyleUrls() {
|
144
|
+
return {
|
145
|
+
"$": ["casino-challenges-overlay.scss"]
|
146
|
+
};
|
147
|
+
}
|
148
|
+
static get styleUrls() {
|
149
|
+
return {
|
150
|
+
"$": ["casino-challenges-overlay.css"]
|
151
|
+
};
|
152
|
+
}
|
153
|
+
static get properties() {
|
154
|
+
return {
|
155
|
+
"mbSource": {
|
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": "Client custom styling via message bus"
|
168
|
+
},
|
169
|
+
"attribute": "mb-source",
|
170
|
+
"reflect": true
|
171
|
+
},
|
172
|
+
"clientStyling": {
|
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": "Client custom styling via string"
|
185
|
+
},
|
186
|
+
"attribute": "client-styling",
|
187
|
+
"reflect": true
|
188
|
+
},
|
189
|
+
"clientStylingUrl": {
|
190
|
+
"type": "string",
|
191
|
+
"mutable": false,
|
192
|
+
"complexType": {
|
193
|
+
"original": "string",
|
194
|
+
"resolved": "string",
|
195
|
+
"references": {}
|
196
|
+
},
|
197
|
+
"required": false,
|
198
|
+
"optional": false,
|
199
|
+
"docs": {
|
200
|
+
"tags": [],
|
201
|
+
"text": "Client custom styling via css file url"
|
202
|
+
},
|
203
|
+
"attribute": "client-styling-url",
|
204
|
+
"reflect": true
|
205
|
+
},
|
206
|
+
"translationUrl": {
|
207
|
+
"type": "string",
|
208
|
+
"mutable": false,
|
209
|
+
"complexType": {
|
210
|
+
"original": "string",
|
211
|
+
"resolved": "string",
|
212
|
+
"references": {}
|
213
|
+
},
|
214
|
+
"required": false,
|
215
|
+
"optional": false,
|
216
|
+
"docs": {
|
217
|
+
"tags": [],
|
218
|
+
"text": "Client custom translation via json file url"
|
219
|
+
},
|
220
|
+
"attribute": "translation-url",
|
221
|
+
"reflect": true,
|
222
|
+
"defaultValue": "''"
|
223
|
+
},
|
224
|
+
"language": {
|
225
|
+
"type": "string",
|
226
|
+
"mutable": false,
|
227
|
+
"complexType": {
|
228
|
+
"original": "string",
|
229
|
+
"resolved": "string",
|
230
|
+
"references": {}
|
231
|
+
},
|
232
|
+
"required": false,
|
233
|
+
"optional": false,
|
234
|
+
"docs": {
|
235
|
+
"tags": [],
|
236
|
+
"text": "Client custom language for translation"
|
237
|
+
},
|
238
|
+
"attribute": "language",
|
239
|
+
"reflect": true,
|
240
|
+
"defaultValue": "'en'"
|
241
|
+
}
|
242
|
+
};
|
243
|
+
}
|
244
|
+
static get states() {
|
245
|
+
return {
|
246
|
+
"progress": {},
|
247
|
+
"isGrayed": {},
|
248
|
+
"isNew": {},
|
249
|
+
"isGift": {},
|
250
|
+
"isNotification": {}
|
251
|
+
};
|
252
|
+
}
|
253
|
+
static get watchers() {
|
254
|
+
return [{
|
255
|
+
"propName": "clientStyling",
|
256
|
+
"methodName": "handleClientStylingChange"
|
257
|
+
}, {
|
258
|
+
"propName": "clientStylingUrl",
|
259
|
+
"methodName": "handleClientStylingUrlChange"
|
260
|
+
}, {
|
261
|
+
"propName": "mbSource",
|
262
|
+
"methodName": "handleMbSourceChange"
|
263
|
+
}];
|
264
|
+
}
|
265
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { CasinoChallengesOverlay } from './casino-challenges-overlay';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/casino-challenges-overlay';
|
@@ -0,0 +1,36 @@
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
2
|
+
const TRANSLATIONS = {
|
3
|
+
en: {
|
4
|
+
new: 'new'
|
5
|
+
},
|
6
|
+
ro: {},
|
7
|
+
fr: {},
|
8
|
+
ar: {},
|
9
|
+
hr: {}
|
10
|
+
};
|
11
|
+
export const translate = (key, customLang) => {
|
12
|
+
const lang = customLang;
|
13
|
+
return TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
|
14
|
+
};
|
15
|
+
export const getTranslations = (data) => {
|
16
|
+
Object.keys(data).forEach((item) => {
|
17
|
+
for (let key in data[item]) {
|
18
|
+
TRANSLATIONS[item][key] = data[item][key];
|
19
|
+
}
|
20
|
+
});
|
21
|
+
};
|
22
|
+
export const resolveTranslationUrl = async (translationUrl) => {
|
23
|
+
if (translationUrl) {
|
24
|
+
try {
|
25
|
+
const response = await fetch(translationUrl);
|
26
|
+
if (!response.ok) {
|
27
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
28
|
+
}
|
29
|
+
const translations = await response.json();
|
30
|
+
getTranslations(translations);
|
31
|
+
}
|
32
|
+
catch (error) {
|
33
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
};
|