@everymatrix/casino-tournament-buttons 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-buttons/casino-tournament-buttons.esm.js +1 -0
  2. package/dist/casino-tournament-buttons/index.esm.js +0 -0
  3. package/dist/casino-tournament-buttons/p-6ef0312c.js +1 -0
  4. package/dist/casino-tournament-buttons/p-b8d8c801.entry.js +1 -0
  5. package/dist/cjs/casino-tournament-buttons.cjs.entry.js +491 -0
  6. package/dist/cjs/casino-tournament-buttons.cjs.js +19 -0
  7. package/dist/cjs/index-61ab317a.js +1152 -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-buttons/casino-tournament-buttons.css +50 -0
  12. package/dist/collection/components/casino-tournament-buttons/casino-tournament-buttons.js +424 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +313 -0
  15. package/dist/collection/utils/utils.js +13 -0
  16. package/dist/components/casino-tournament-buttons.d.ts +11 -0
  17. package/dist/components/casino-tournament-buttons.js +525 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-tournament-buttons.entry.js +487 -0
  21. package/dist/esm/casino-tournament-buttons.js +17 -0
  22. package/dist/esm/index-d7f0ce45.js +1127 -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-buttons/.stencil/packages/casino-tournament-buttons/stencil.config.d.ts +2 -0
  35. package/dist/types/components/casino-tournament-buttons/casino-tournament-buttons.d.ts +30 -0
  36. package/dist/types/components.d.ts +65 -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-61ab317a.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-buttons.cjs",[[1,"casino-tournament-buttons",{"language":[1],"tournamentId":[1,"tournament-id"],"session":[1],"loginEvent":[1,"login-event"],"loginUrl":[1,"login-url"],"registerEvent":[1,"register-event"],"registerUrl":[1,"register-url"],"endpoint":[1],"currency":[1],"bonusCode":[1,"bonus-code"],"enrolled":[4],"showReadMore":[4,"show-read-more"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"limitStylingAppends":[32],"stylingContainer":[32],"joinButtonLoading":[32],"errorJoin":[32],"errorJoinConcurrently":[32]}]]]], options);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/casino-tournament-buttons/casino-tournament-buttons.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,50 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .ButtonGroup {
6
+ display: flex;
7
+ gap: 4px;
8
+ }
9
+
10
+ .Button {
11
+ padding: 6px 8px;
12
+ border-radius: 2px;
13
+ border: 1px solid #fff;
14
+ color: #fff;
15
+ background: none;
16
+ position: relative;
17
+ cursor: pointer;
18
+ }
19
+ .Button.NoBorder {
20
+ border: 0;
21
+ padding: 7px 8px;
22
+ }
23
+
24
+ .Button::after {
25
+ content: "";
26
+ display: block;
27
+ position: absolute;
28
+ border-radius: 2px;
29
+ left: 0;
30
+ top: 0;
31
+ width: 100%;
32
+ height: 100%;
33
+ opacity: 0;
34
+ transition: all 0.5s;
35
+ box-shadow: 0 0 10px 10px white;
36
+ }
37
+
38
+ .Button:active::after {
39
+ box-shadow: 0 0 0 0 white;
40
+ position: absolute;
41
+ border-radius: 2px;
42
+ left: 0;
43
+ top: 0;
44
+ opacity: 1;
45
+ transition: 0s;
46
+ }
47
+
48
+ .Button:active {
49
+ top: 1px;
50
+ }
@@ -0,0 +1,424 @@
1
+ import { Component, Prop, h, State } from '@stencil/core';
2
+ import { getDevice } from '../../utils/utils';
3
+ import { translate } from '../../utils/locale.utils';
4
+ export class CasinoTournamentButtons {
5
+ constructor() {
6
+ this.enrolled = false;
7
+ this.showReadMore = false;
8
+ this.clientStyling = '';
9
+ this.clientStylingUrl = '';
10
+ this.limitStylingAppends = false;
11
+ this.joinButtonLoading = false;
12
+ this.errorJoin = false;
13
+ this.errorJoinConcurrently = false;
14
+ this.setClientStyling = () => {
15
+ let sheet = document.createElement('style');
16
+ sheet.innerHTML = this.clientStyling;
17
+ this.stylingContainer.prepend(sheet);
18
+ };
19
+ this.setClientStylingURL = () => {
20
+ let cssFile = document.createElement('style');
21
+ setTimeout(() => {
22
+ cssFile.innerHTML = this.clientStylingUrl;
23
+ this.stylingContainer.prepend(cssFile);
24
+ }, 1);
25
+ };
26
+ }
27
+ componentDidRender() {
28
+ if (!this.limitStylingAppends && this.stylingContainer) {
29
+ if (this.clientStyling)
30
+ this.setClientStyling();
31
+ if (this.clientStylingUrl)
32
+ this.setClientStylingURL();
33
+ this.limitStylingAppends = true;
34
+ }
35
+ }
36
+ loginAction() {
37
+ if (this.loginEvent) {
38
+ window.postMessage({ type: this.loginEvent, transition: 'Login' }, window.location.href);
39
+ // @ts-ignore Analytics event
40
+ if (typeof gtag == 'function') {
41
+ // @ts-ignore
42
+ gtag('event', 'OpenLoginModal', {
43
+ 'context': 'TournamentsThumbnailController'
44
+ });
45
+ }
46
+ }
47
+ if (this.loginUrl) {
48
+ location.href = this.loginUrl;
49
+ }
50
+ }
51
+ registerAction() {
52
+ if (this.registerEvent) {
53
+ window.postMessage({ type: this.registerEvent, transition: 'Register' }, window.location.href);
54
+ //@ts-ignoreAnalytics event
55
+ if (typeof gtag == 'function') {
56
+ //@ts-ignore
57
+ gtag('event', 'OpenRegisterModal', {
58
+ 'context': 'TournamentsThumbnailController'
59
+ });
60
+ }
61
+ }
62
+ if (this.registerUrl) {
63
+ location.href = this.registerUrl;
64
+ }
65
+ }
66
+ async joinAction(tournamentId, bonuscode) {
67
+ var _a;
68
+ this.errorJoin = false;
69
+ this.errorJoinConcurrently = false;
70
+ window.postMessage({ type: 'TournamentJoinRequest', tournamentId }, window.location.href);
71
+ this.joinButtonLoading = true;
72
+ let joinUrl = new URL(`${this.endpoint}/bonus/claim`);
73
+ let reqHeaders = new Headers();
74
+ let body = {};
75
+ joinUrl.searchParams.append('language', this.language);
76
+ joinUrl.searchParams.append('platform', getDevice());
77
+ reqHeaders.append('Content-Type', 'application/json');
78
+ reqHeaders.append("X-SessionID", this.session);
79
+ if (bonuscode) {
80
+ body = {
81
+ language: this.language,
82
+ bonusCode: bonuscode,
83
+ currency: this.currency
84
+ };
85
+ }
86
+ let requestOptions = {
87
+ method: 'PUT',
88
+ headers: reqHeaders,
89
+ body: JSON.stringify(body),
90
+ };
91
+ const handlerOnSuccess = () => {
92
+ this.joinButtonLoading = false;
93
+ this.enrolled = true;
94
+ window.postMessage({ type: 'TournamentUserEnrolled', userenrolled: this.enrolled }, window.location.href);
95
+ };
96
+ const handlerOnFail = () => {
97
+ this.joinButtonLoading = false;
98
+ this.errorJoin = true;
99
+ };
100
+ const fetcher = async () => {
101
+ let result;
102
+ try {
103
+ result = await fetch(`${this.endpoint}/bonus/claim?${joinUrl.searchParams.toString()}`, requestOptions);
104
+ result = await result.json();
105
+ }
106
+ catch (e) {
107
+ handlerOnFail();
108
+ }
109
+ return result;
110
+ };
111
+ const data = await fetcher();
112
+ if (!data)
113
+ return;
114
+ if (data.success == true) {
115
+ handlerOnSuccess();
116
+ }
117
+ else {
118
+ if (data.errorMessage.match("VersionMismatchException")) {
119
+ let resultDoubleCheck;
120
+ resultDoubleCheck = await fetch(`${this.endpoint}/tournaments/${this.tournamentId}`, {
121
+ headers: {
122
+ 'X-SessionID': this.session
123
+ }
124
+ });
125
+ resultDoubleCheck = await resultDoubleCheck.json();
126
+ if ((_a = resultDoubleCheck === null || resultDoubleCheck === void 0 ? void 0 : resultDoubleCheck.item) === null || _a === void 0 ? void 0 : _a.playerEnrolled) {
127
+ handlerOnSuccess();
128
+ }
129
+ else {
130
+ handlerOnFail();
131
+ this.errorJoinConcurrently = true;
132
+ this.errorJoin = false;
133
+ }
134
+ }
135
+ else {
136
+ handlerOnFail();
137
+ }
138
+ }
139
+ }
140
+ detailAction(tournamentId) {
141
+ window.postMessage({ type: 'TournamentDetailsClicked', tournamentId, showLeaderboard: true }, window.location.href);
142
+ }
143
+ moreAction(tournamentId) {
144
+ window.postMessage({ type: 'TournamentReadMoreClicked', tournamentId }, window.location.href);
145
+ }
146
+ render() {
147
+ return h("div", { ref: el => this.stylingContainer = el, class: "TournamentButtons" },
148
+ !this.session &&
149
+ h("div", { class: "ButtonGroup" },
150
+ h("button", { class: "LoginButton Button", part: "LoginButton", onClick: () => this.loginAction() }, translate('login', this.language)),
151
+ h("button", { class: "RegisterButton Button", part: "RegisterButton", onClick: () => this.registerAction() }, translate('register', this.language))),
152
+ this.session &&
153
+ h("div", null,
154
+ !this.enrolled &&
155
+ h("div", { class: "ButtonGroup" },
156
+ h("button", { class: "Button", onClick: () => this.joinAction(this.tournamentId, this.bonusCode) }, translate('join', this.language)),
157
+ this.showReadMore && h("button", { class: "Button NoBorder", onClick: () => this.moreAction(this.tournamentId) }, "Read more")),
158
+ this.enrolled &&
159
+ h("div", { class: "ButtonGroup" },
160
+ h("button", { class: "Button", onClick: () => this.detailAction(this.tournamentId) }, translate('details', this.language)),
161
+ this.showReadMore && h("button", { class: "Button NoBorder", onClick: () => this.moreAction(this.tournamentId) }, "Read more"))),
162
+ (this.errorJoin || this.errorJoinConcurrently) &&
163
+ h("span", { class: "ErrorText", part: "ErrorText" }, translate('joinerror', this.language)));
164
+ }
165
+ static get is() { return "casino-tournament-buttons"; }
166
+ static get encapsulation() { return "shadow"; }
167
+ static get originalStyleUrls() { return {
168
+ "$": ["casino-tournament-buttons.scss"]
169
+ }; }
170
+ static get styleUrls() { return {
171
+ "$": ["casino-tournament-buttons.css"]
172
+ }; }
173
+ static get properties() { return {
174
+ "language": {
175
+ "type": "string",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "string",
179
+ "resolved": "string",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": ""
187
+ },
188
+ "attribute": "language",
189
+ "reflect": false
190
+ },
191
+ "tournamentId": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": ""
204
+ },
205
+ "attribute": "tournament-id",
206
+ "reflect": false
207
+ },
208
+ "session": {
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": ""
221
+ },
222
+ "attribute": "session",
223
+ "reflect": false
224
+ },
225
+ "loginEvent": {
226
+ "type": "string",
227
+ "mutable": false,
228
+ "complexType": {
229
+ "original": "string",
230
+ "resolved": "string",
231
+ "references": {}
232
+ },
233
+ "required": false,
234
+ "optional": false,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": ""
238
+ },
239
+ "attribute": "login-event",
240
+ "reflect": false
241
+ },
242
+ "loginUrl": {
243
+ "type": "string",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "string",
247
+ "resolved": "string",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": ""
255
+ },
256
+ "attribute": "login-url",
257
+ "reflect": false
258
+ },
259
+ "registerEvent": {
260
+ "type": "string",
261
+ "mutable": false,
262
+ "complexType": {
263
+ "original": "string",
264
+ "resolved": "string",
265
+ "references": {}
266
+ },
267
+ "required": false,
268
+ "optional": false,
269
+ "docs": {
270
+ "tags": [],
271
+ "text": ""
272
+ },
273
+ "attribute": "register-event",
274
+ "reflect": false
275
+ },
276
+ "registerUrl": {
277
+ "type": "string",
278
+ "mutable": false,
279
+ "complexType": {
280
+ "original": "string",
281
+ "resolved": "string",
282
+ "references": {}
283
+ },
284
+ "required": false,
285
+ "optional": false,
286
+ "docs": {
287
+ "tags": [],
288
+ "text": ""
289
+ },
290
+ "attribute": "register-url",
291
+ "reflect": false
292
+ },
293
+ "endpoint": {
294
+ "type": "string",
295
+ "mutable": false,
296
+ "complexType": {
297
+ "original": "string",
298
+ "resolved": "string",
299
+ "references": {}
300
+ },
301
+ "required": false,
302
+ "optional": false,
303
+ "docs": {
304
+ "tags": [],
305
+ "text": ""
306
+ },
307
+ "attribute": "endpoint",
308
+ "reflect": false
309
+ },
310
+ "currency": {
311
+ "type": "string",
312
+ "mutable": false,
313
+ "complexType": {
314
+ "original": "string",
315
+ "resolved": "string",
316
+ "references": {}
317
+ },
318
+ "required": false,
319
+ "optional": false,
320
+ "docs": {
321
+ "tags": [],
322
+ "text": ""
323
+ },
324
+ "attribute": "currency",
325
+ "reflect": false
326
+ },
327
+ "bonusCode": {
328
+ "type": "string",
329
+ "mutable": false,
330
+ "complexType": {
331
+ "original": "string",
332
+ "resolved": "string",
333
+ "references": {}
334
+ },
335
+ "required": false,
336
+ "optional": false,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": ""
340
+ },
341
+ "attribute": "bonus-code",
342
+ "reflect": false
343
+ },
344
+ "enrolled": {
345
+ "type": "boolean",
346
+ "mutable": false,
347
+ "complexType": {
348
+ "original": "boolean",
349
+ "resolved": "boolean",
350
+ "references": {}
351
+ },
352
+ "required": false,
353
+ "optional": false,
354
+ "docs": {
355
+ "tags": [],
356
+ "text": ""
357
+ },
358
+ "attribute": "enrolled",
359
+ "reflect": false,
360
+ "defaultValue": "false"
361
+ },
362
+ "showReadMore": {
363
+ "type": "boolean",
364
+ "mutable": false,
365
+ "complexType": {
366
+ "original": "boolean",
367
+ "resolved": "boolean",
368
+ "references": {}
369
+ },
370
+ "required": false,
371
+ "optional": false,
372
+ "docs": {
373
+ "tags": [],
374
+ "text": ""
375
+ },
376
+ "attribute": "show-read-more",
377
+ "reflect": false,
378
+ "defaultValue": "false"
379
+ },
380
+ "clientStyling": {
381
+ "type": "string",
382
+ "mutable": false,
383
+ "complexType": {
384
+ "original": "string",
385
+ "resolved": "string",
386
+ "references": {}
387
+ },
388
+ "required": false,
389
+ "optional": false,
390
+ "docs": {
391
+ "tags": [],
392
+ "text": ""
393
+ },
394
+ "attribute": "client-styling",
395
+ "reflect": false,
396
+ "defaultValue": "''"
397
+ },
398
+ "clientStylingUrl": {
399
+ "type": "string",
400
+ "mutable": false,
401
+ "complexType": {
402
+ "original": "string",
403
+ "resolved": "string",
404
+ "references": {}
405
+ },
406
+ "required": false,
407
+ "optional": false,
408
+ "docs": {
409
+ "tags": [],
410
+ "text": ""
411
+ },
412
+ "attribute": "client-styling-url",
413
+ "reflect": false,
414
+ "defaultValue": "''"
415
+ }
416
+ }; }
417
+ static get states() { return {
418
+ "limitStylingAppends": {},
419
+ "stylingContainer": {},
420
+ "joinButtonLoading": {},
421
+ "errorJoin": {},
422
+ "errorJoinConcurrently": {}
423
+ }; }
424
+ }
@@ -0,0 +1 @@
1
+ export * from './components';