@everymatrix/casino-tournament-prizes 1.16.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.
Files changed (47) hide show
  1. package/dist/casino-tournament-prizes/casino-tournament-prizes.esm.js +1 -0
  2. package/dist/casino-tournament-prizes/index.esm.js +0 -0
  3. package/dist/casino-tournament-prizes/p-33431b85.entry.js +1 -0
  4. package/dist/casino-tournament-prizes/p-77e12a29.js +1 -0
  5. package/dist/cjs/casino-tournament-prizes.cjs.entry.js +164 -0
  6. package/dist/cjs/casino-tournament-prizes.cjs.js +19 -0
  7. package/dist/cjs/index-e93b78a6.js +1206 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-tournament-prizes/casino-tournament-prizes.css +100 -0
  12. package/dist/collection/components/casino-tournament-prizes/casino-tournament-prizes.js +312 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +53 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/components/casino-tournament-prizes.d.ts +11 -0
  17. package/dist/components/casino-tournament-prizes.js +193 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-tournament-prizes.entry.js +160 -0
  21. package/dist/esm/casino-tournament-prizes.js +17 -0
  22. package/dist/esm/index-dbfbefa7.js +1181 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-prizes/.stencil/packages/casino-tournament-prizes/stencil.config.d.ts +2 -0
  35. package/dist/types/components/casino-tournament-prizes/casino-tournament-prizes.d.ts +24 -0
  36. package/dist/types/components.d.ts +55 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +1 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. 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-e93b78a6.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([["casino-tournament-prizes.cjs",[[1,"casino-tournament-prizes",{"language":[1],"useGroup":[4,"use-group"],"useEvent":[4,"use-event"],"endpoint":[1],"session":[1],"rawPrizes":[1,"raw-prizes"],"tournamentId":[1,"tournament-id"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"limitStylingAppends":[32],"stylingContainer":[32],"prizes":[32],"prizeGroups":[32],"initialLoad":[32]},[[10,"getTournamentInfoCompleted","infoCompletedHandler"]]]]]], options);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/casino-tournament-prizes/casino-tournament-prizes.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,100 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .PrizeGroups {
6
+ color: #fff;
7
+ display: flex;
8
+ gap: 20px;
9
+ font-size: 14px;
10
+ }
11
+
12
+ .PrizeGroup {
13
+ flex: 1;
14
+ background: #153A5C;
15
+ }
16
+
17
+ .PrizeTitle {
18
+ text-align: center;
19
+ width: 100%;
20
+ }
21
+
22
+ .GroupPrizeTitle {
23
+ width: 100%;
24
+ display: flex;
25
+ padding: 8px 6px;
26
+ gap: 8px;
27
+ justify-content: center;
28
+ }
29
+
30
+ .PrizeView {
31
+ display: flex;
32
+ gap: 10px;
33
+ font-size: 12px;
34
+ }
35
+ .PrizeView .PrizeTitle {
36
+ display: inline-block;
37
+ width: auto;
38
+ }
39
+ .PrizeView .PrizeGroups {
40
+ display: inline-flex;
41
+ }
42
+
43
+ .Title {
44
+ text-align: center;
45
+ color: #fff;
46
+ }
47
+
48
+ .PrizeIcon path {
49
+ fill: #fff;
50
+ }
51
+
52
+ .PrizeRow {
53
+ padding: 8px;
54
+ border-bottom: 1px solid rgba(206, 210, 214, 0.15);
55
+ }
56
+
57
+ .PrizeItem {
58
+ display: flex;
59
+ justify-content: space-between;
60
+ padding: 6px;
61
+ font-size: 12px;
62
+ border-radius: 2px;
63
+ }
64
+
65
+ .Group1 .Rank1 {
66
+ background: #7e6c22;
67
+ }
68
+ .Group1 .Rank2 {
69
+ background: #666;
70
+ }
71
+ .Group1 .Rank3 {
72
+ background: #6a5446;
73
+ }
74
+
75
+ .Prizes {
76
+ padding-left: 20px;
77
+ flex-wrap: wrap;
78
+ display: flex;
79
+ gap: 20px;
80
+ width: 100%;
81
+ min-height: 50px;
82
+ padding-top: 8px;
83
+ }
84
+
85
+ .Prize {
86
+ flex-grow: 1;
87
+ color: var(--emfe-w-color-gray-300, #58586B);
88
+ }
89
+ .Prize.Prize0 span {
90
+ color: #FECF00;
91
+ }
92
+ .Prize.Prize1 span {
93
+ color: #D9B206;
94
+ }
95
+ .Prize.Prize2 span {
96
+ color: #9B8007;
97
+ }
98
+ .Prize p {
99
+ color: var(--emfe-w-color-white, #FFFFFF);
100
+ }
@@ -0,0 +1,312 @@
1
+ import { Component, Prop, h, State, Listen } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ export class CasinoTournamentPrizes {
4
+ constructor() {
5
+ this.useGroup = false;
6
+ this.useEvent = false;
7
+ this.clientStyling = '';
8
+ this.clientStylingUrl = '';
9
+ this.limitStylingAppends = false;
10
+ this.prizes = [];
11
+ this.prizeGroups = [];
12
+ this.initialLoad = false;
13
+ this.setClientStyling = () => {
14
+ let sheet = document.createElement('style');
15
+ sheet.innerHTML = this.clientStyling;
16
+ this.stylingContainer.prepend(sheet);
17
+ };
18
+ this.setClientStylingURL = () => {
19
+ let cssFile = document.createElement('style');
20
+ setTimeout(() => {
21
+ cssFile.innerHTML = this.clientStylingUrl;
22
+ this.stylingContainer.prepend(cssFile);
23
+ }, 1);
24
+ };
25
+ }
26
+ infoCompletedHandler(event) {
27
+ if (event.detail) {
28
+ this.prizes = event.detail.prizes;
29
+ this.formatGroup();
30
+ this.initialLoad = true;
31
+ }
32
+ }
33
+ formatGroup() {
34
+ const prizes = this.prizes;
35
+ prizes.forEach(prize => {
36
+ let array = [];
37
+ if (prize.count > 0) {
38
+ for (let index = 0; index < prize.count; index++) {
39
+ const element = { name: prize.name, rank: prize.rank + index };
40
+ array.push(element);
41
+ }
42
+ }
43
+ this.prizeGroups.push(array);
44
+ });
45
+ }
46
+ getTournamentInfo() {
47
+ let url = new URL(this.endpoint + `/tournaments/${this.tournamentId}`);
48
+ let reqHeaders = new Headers();
49
+ url.searchParams.append('expand', 'games');
50
+ url.searchParams.append('language', this.language);
51
+ url.searchParams.append('fields', 'playerEnrolled,games(id,name,thumbnail)');
52
+ if (this.session) {
53
+ reqHeaders.append('X-SessionId', this.session);
54
+ }
55
+ let requestOptions = {
56
+ method: 'GET',
57
+ headers: reqHeaders,
58
+ };
59
+ fetch(url.href, requestOptions).then((res) => res.json())
60
+ .then((res) => {
61
+ this.prizes = res.item.prizes;
62
+ if (this.useGroup) {
63
+ this.formatGroup();
64
+ }
65
+ this.initialLoad = true;
66
+ });
67
+ }
68
+ componentWillLoad() {
69
+ if (!this.useEvent && this.rawPrizes) {
70
+ this.prizes = JSON.parse(this.rawPrizes);
71
+ if (this.useGroup) {
72
+ this.formatGroup();
73
+ }
74
+ this.initialLoad = true;
75
+ }
76
+ if (!this.useEvent && this.endpoint && this.tournamentId) {
77
+ this.getTournamentInfo();
78
+ }
79
+ }
80
+ componentDidRender() {
81
+ if (!this.limitStylingAppends && this.stylingContainer) {
82
+ if (this.clientStyling)
83
+ this.setClientStyling();
84
+ if (this.clientStylingUrl)
85
+ this.setClientStylingURL();
86
+ this.limitStylingAppends = true;
87
+ }
88
+ }
89
+ render() {
90
+ {
91
+ this.prizes && this.prizes.length > 0;
92
+ return h("div", { ref: el => this.stylingContainer = el, class: `TournamentPrizes ${this.useGroup ? '' : 'PrizeView'}` },
93
+ this.initialLoad && !this.useGroup && h("div", { class: "PrizeTitle" },
94
+ h("svg", { class: "PrizeIcon", xmlns: "http://www.w3.org/2000/svg", width: "30", height: "27.454", viewBox: "0 0 30 27.454" },
95
+ h("path", { d: "M35.84,12.887a1.023,1.023,0,0,0-.853-.481h-5.2l.242-1.456a1.023,1.023,0,0,0-1.023-1.19H12.977a1.023,1.023,0,0,0-1.023,1.19l.242,1.456H7.022a1.023,1.023,0,0,0-.921,1.47l2.967,6.077a6.48,6.48,0,0,0,5.163,3.581,7.227,7.227,0,0,0,3.7,3.963v2.667h-.426a3.525,3.525,0,1,0,0,7.049H24.5a3.525,3.525,0,1,0,0-7.049h-.426V27.5a7.227,7.227,0,0,0,3.7-3.963,6.48,6.48,0,0,0,5.167-3.581L35.9,13.876a1.023,1.023,0,0,0-.058-.989ZM10.914,19.05l-2.241-4.6h3.891l1.153,6.916A4.406,4.406,0,0,1,10.914,19.05ZM25.977,33.687A1.477,1.477,0,0,1,24.5,35.164H17.509a1.478,1.478,0,0,1,0-2.957H24.5A1.48,1.48,0,0,1,25.977,33.687Zm-3.949-3.526H19.982V28.094a6.729,6.729,0,0,0,2.046,0Zm4.123-8.383a5.218,5.218,0,0,1-10.293,0L14.184,11.8H27.826ZM31.1,19.05a4.406,4.406,0,0,1-2.8,2.309l1.153-6.916h3.891Z", transform: "translate(-5.999 -9.76)" })),
96
+ h("div", { class: "Title" }, translate('prizes', this.language))),
97
+ this.initialLoad && this.useGroup && h("div", { class: "GroupPrizeTitle" },
98
+ h("svg", { class: "PrizeIcon", xmlns: "http://www.w3.org/2000/svg", width: "19", height: "16", viewBox: "0 0 19 16", fill: "none" },
99
+ h("g", { "clip-path": "url(#clip0_2459_42455)" },
100
+ h("path", { d: "M14.7476 2.84132V0.664551H4.03327V2.84132H0.818359V5.01946C0.818359 6.8229 2.2568 8.28496 4.0326 8.28496C4.36862 8.28496 4.69326 8.23192 4.99647 8.13399C5.76958 9.25604 6.94898 10.07 8.31782 10.3516V13.7266H7.24685C6.06276 13.7266 5.1029 14.701 5.1029 15.9026H13.6753C13.6753 14.7004 12.7168 13.7266 11.5327 13.7266H10.4611V10.3516C11.8293 10.07 13.0087 9.25672 13.7818 8.13399C14.0863 8.23124 14.4116 8.28496 14.7463 8.28496C16.5214 8.28496 17.9612 6.8229 17.9612 5.01946V2.84132H14.7476ZM4.03327 6.99222C2.9623 6.99222 2.0908 6.10751 2.0908 5.01946V3.93005H4.03327V5.01946C4.03327 5.70221 4.15844 6.3564 4.38401 6.9589C4.27089 6.9793 4.15175 6.99086 4.03327 6.99086V6.99222ZM11.0207 5.88989L12.0414 9.06223L9.38945 7.09355L6.7368 9.06223L7.75757 5.88989L5.09688 3.93481L8.3814 3.94229L9.38945 0.767235L10.3968 3.94229L13.6814 3.93481L11.0207 5.88989ZM16.6901 5.01946C16.6901 6.10683 15.8193 6.99222 14.7483 6.99222C14.6285 6.99222 14.512 6.9793 14.3982 6.95958C14.6245 6.3564 14.7483 5.70357 14.7483 5.02014V3.93073H16.6901V5.02014V5.01946Z", fill: "white" })),
101
+ h("defs", null,
102
+ h("clipPath", { id: "clip0_2459_42455" },
103
+ h("rect", { width: "18.2857", height: "16", fill: "white", transform: "translate(0.5)" })))),
104
+ h("div", { class: "Title" }, translate('prizes', this.language))),
105
+ h("div", { class: "PrizeGroups" },
106
+ this.useGroup == true && this.prizeGroups && this.prizeGroups.map((group, groupIndex) => {
107
+ return h("div", { class: `PrizeGroup Group${groupIndex + 1}` }, group && group.map((prize, prizeIndex) => {
108
+ return h("div", { class: "PrizeRow" },
109
+ h("div", { class: `PrizeItem Rank${prizeIndex + 1}` },
110
+ h("span", { class: "PrizeRank" },
111
+ prize.rank,
112
+ " ",
113
+ translate('place', this.language),
114
+ " "),
115
+ h("span", { class: "PrizeName" }, prize.name)));
116
+ }));
117
+ }),
118
+ this.useGroup == false && this.prizes && this.prizes.map((prize, prizeIndex) => {
119
+ return h("div", { class: `Prize Prize${prizeIndex}` },
120
+ h("p", { class: "PrizeText" },
121
+ h("span", { class: "PrizeRank" }, prize.count > 1 ? (`${prize.rank}~${prize.rank + prize.count - 1}`) : (prize.rank)),
122
+ " ",
123
+ translate('place', this.language),
124
+ ": ",
125
+ prize.name));
126
+ }),
127
+ !this.prizes && h("p", null, translate('noprizes', this.language))));
128
+ }
129
+ ;
130
+ }
131
+ static get is() { return "casino-tournament-prizes"; }
132
+ static get encapsulation() { return "shadow"; }
133
+ static get originalStyleUrls() { return {
134
+ "$": ["casino-tournament-prizes.scss"]
135
+ }; }
136
+ static get styleUrls() { return {
137
+ "$": ["casino-tournament-prizes.css"]
138
+ }; }
139
+ static get properties() { return {
140
+ "language": {
141
+ "type": "string",
142
+ "mutable": false,
143
+ "complexType": {
144
+ "original": "string",
145
+ "resolved": "string",
146
+ "references": {}
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [],
152
+ "text": ""
153
+ },
154
+ "attribute": "language",
155
+ "reflect": false
156
+ },
157
+ "useGroup": {
158
+ "type": "boolean",
159
+ "mutable": false,
160
+ "complexType": {
161
+ "original": "boolean",
162
+ "resolved": "boolean",
163
+ "references": {}
164
+ },
165
+ "required": false,
166
+ "optional": false,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": ""
170
+ },
171
+ "attribute": "use-group",
172
+ "reflect": false,
173
+ "defaultValue": "false"
174
+ },
175
+ "useEvent": {
176
+ "type": "boolean",
177
+ "mutable": false,
178
+ "complexType": {
179
+ "original": "boolean",
180
+ "resolved": "boolean",
181
+ "references": {}
182
+ },
183
+ "required": false,
184
+ "optional": false,
185
+ "docs": {
186
+ "tags": [],
187
+ "text": ""
188
+ },
189
+ "attribute": "use-event",
190
+ "reflect": false,
191
+ "defaultValue": "false"
192
+ },
193
+ "endpoint": {
194
+ "type": "string",
195
+ "mutable": false,
196
+ "complexType": {
197
+ "original": "string",
198
+ "resolved": "string",
199
+ "references": {}
200
+ },
201
+ "required": false,
202
+ "optional": false,
203
+ "docs": {
204
+ "tags": [],
205
+ "text": ""
206
+ },
207
+ "attribute": "endpoint",
208
+ "reflect": false
209
+ },
210
+ "session": {
211
+ "type": "string",
212
+ "mutable": false,
213
+ "complexType": {
214
+ "original": "string",
215
+ "resolved": "string",
216
+ "references": {}
217
+ },
218
+ "required": false,
219
+ "optional": false,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": ""
223
+ },
224
+ "attribute": "session",
225
+ "reflect": false
226
+ },
227
+ "rawPrizes": {
228
+ "type": "string",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "string",
232
+ "resolved": "string",
233
+ "references": {}
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [],
239
+ "text": ""
240
+ },
241
+ "attribute": "raw-prizes",
242
+ "reflect": false
243
+ },
244
+ "tournamentId": {
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": ""
257
+ },
258
+ "attribute": "tournament-id",
259
+ "reflect": false
260
+ },
261
+ "clientStyling": {
262
+ "type": "string",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "string",
266
+ "resolved": "string",
267
+ "references": {}
268
+ },
269
+ "required": false,
270
+ "optional": false,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": ""
274
+ },
275
+ "attribute": "client-styling",
276
+ "reflect": false,
277
+ "defaultValue": "''"
278
+ },
279
+ "clientStylingUrl": {
280
+ "type": "string",
281
+ "mutable": false,
282
+ "complexType": {
283
+ "original": "string",
284
+ "resolved": "string",
285
+ "references": {}
286
+ },
287
+ "required": false,
288
+ "optional": false,
289
+ "docs": {
290
+ "tags": [],
291
+ "text": ""
292
+ },
293
+ "attribute": "client-styling-url",
294
+ "reflect": false,
295
+ "defaultValue": "''"
296
+ }
297
+ }; }
298
+ static get states() { return {
299
+ "limitStylingAppends": {},
300
+ "stylingContainer": {},
301
+ "prizes": {},
302
+ "prizeGroups": {},
303
+ "initialLoad": {}
304
+ }; }
305
+ static get listeners() { return [{
306
+ "name": "getTournamentInfoCompleted",
307
+ "method": "infoCompletedHandler",
308
+ "target": "window",
309
+ "capture": true,
310
+ "passive": false
311
+ }]; }
312
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,53 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'zh-hk', 'fr', 'hu', 'tr', 'el', 'es', 'pt'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ prizes: 'Prizes',
6
+ noprizes: 'No available prizes',
7
+ place: 'place',
8
+ },
9
+ 'zh-hk': {
10
+ prizes: '獎品',
11
+ noprizes: '沒有可用的獎品',
12
+ place: 'place', // need translation
13
+ },
14
+ fr: {
15
+ prizes: 'Prix',
16
+ noprizes: 'Aucun prix disponible',
17
+ place: 'place', // need translation
18
+ },
19
+ ro: {
20
+ prizes: 'Premii',
21
+ noprizes: 'Nu sunt disponibile premii',
22
+ place: 'poziție',
23
+ },
24
+ tr: {
25
+ prizes: 'Ödüller',
26
+ noprizes: 'Geçerli ödül yok',
27
+ place: 'Sıra',
28
+ },
29
+ el: {
30
+ prizes: 'Έπαθλα',
31
+ noprizes: 'Μη διαθέσιμα έπαθλα',
32
+ place: 'θέση',
33
+ },
34
+ es: {
35
+ prizes: 'Premios',
36
+ noprizes: 'No hay premios disponibles',
37
+ place: 'posición',
38
+ },
39
+ hu: {
40
+ prizes: 'Nyeremények',
41
+ noprizes: 'Nincs elérhető nyeremény',
42
+ place: 'helyezés',
43
+ },
44
+ pt: {
45
+ prizes: 'Prêmios',
46
+ noprizes: 'Não há prêmios disponíveis',
47
+ place: 'place', // need translation
48
+ }
49
+ };
50
+ export const translate = (key, customLang) => {
51
+ const lang = customLang;
52
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
53
+ };
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
+ }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface CasinoTournamentPrizes extends Components.CasinoTournamentPrizes, HTMLElement {}
4
+ export const CasinoTournamentPrizes: {
5
+ prototype: CasinoTournamentPrizes;
6
+ new (): CasinoTournamentPrizes;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;