@everymatrix/bonus-powerups-ingame-list 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/assets/Info-circle.svg +10 -0
- package/dist/assets/clock.svg +3 -0
- package/dist/assets/close.svg +4 -0
- package/dist/assets/double-right.svg +4 -0
- package/dist/assets/energe.svg +9 -0
- package/dist/assets/fire.svg +3 -0
- package/dist/bonus-powerups-ingame-list/app-globals-0f993ce5.js +1 -0
- package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list-a8638981.js +3 -0
- package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list.esm.js +1 -0
- package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list_2.entry.js +1 -0
- package/dist/bonus-powerups-ingame-list/index-20f17dc8.js +2 -0
- package/dist/bonus-powerups-ingame-list/index.esm.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/bonus-powerups-ingame-list-c9172936.js +6114 -0
- package/dist/cjs/bonus-powerups-ingame-list.cjs.js +25 -0
- package/dist/cjs/bonus-powerups-ingame-list_2.cjs.entry.js +82 -0
- package/dist/cjs/index-f60c43c6.js +1284 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/assets/Info-circle.svg +10 -0
- package/dist/collection/components/assets/clock.svg +3 -0
- package/dist/collection/components/assets/close.svg +4 -0
- package/dist/collection/components/assets/double-right.svg +4 -0
- package/dist/collection/components/assets/energe.svg +9 -0
- package/dist/collection/components/assets/fire.svg +3 -0
- package/dist/collection/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.css +208 -0
- package/dist/collection/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.js +436 -0
- package/dist/collection/components/bonus-powerups-ingame-list/index.js +1 -0
- package/dist/collection/components/time-count/time-count.js +143 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +44 -0
- package/dist/collection/utils/utils.js +21 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/bonus-powerups-ingame-list-a8638981.js +6110 -0
- package/dist/esm/bonus-powerups-ingame-list.js +20 -0
- package/dist/esm/bonus-powerups-ingame-list_2.entry.js +78 -0
- package/dist/esm/index-20f17dc8.js +1257 -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 +20 -0
- package/dist/stencil.config.js +20 -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/bonus-powerups-ingame-list/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/libs/common/src/types/casino/powerups.d.ts +60 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/packages/stencil/bonus-powerups-ingame-list/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/packages/stencil/bonus-powerups-ingame-list/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/packages/stencil/bonus-powerups-ingame-list/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/packages/stencil/bonus-powerups-ingame-list/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.d.ts +36 -0
- package/dist/types/components/bonus-powerups-ingame-list/index.d.ts +1 -0
- package/dist/types/components/time-count/time-count.d.ts +16 -0
- package/dist/types/components.d.ts +106 -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 +2 -0
- package/dist/types/utils/utils.d.ts +14 -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,436 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
|
+
import { getTranslations, translate } from "../../utils/locale.utils";
|
|
4
|
+
import { BoostingPeriodMode, MultiplierMode, PowerUpStatus } from "../../../../../../../../libs/common/src/types/casino/powerups";
|
|
5
|
+
import { getActivedExpireTime, powerUpWithoutGamesSearchConditions } from "../../utils/utils";
|
|
6
|
+
import CloseSvg from "../assets/close.svg";
|
|
7
|
+
import EnergySvg from "../assets/energe.svg";
|
|
8
|
+
import FireSvg from "../assets/fire.svg";
|
|
9
|
+
import ClockSvg from "../assets/clock.svg";
|
|
10
|
+
import DetailArrow from "../assets/double-right.svg";
|
|
11
|
+
import InfoSvg from "../assets/Info-circle.svg";
|
|
12
|
+
import moment from "moment";
|
|
13
|
+
export class BonusPowerupsIngameList {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.mbSource = undefined;
|
|
16
|
+
this.clientStyling = undefined;
|
|
17
|
+
this.clientStylingUrl = undefined;
|
|
18
|
+
this.translationUrl = undefined;
|
|
19
|
+
this.language = 'en';
|
|
20
|
+
this.endpoint = undefined;
|
|
21
|
+
this.session = undefined;
|
|
22
|
+
this.limit = 10;
|
|
23
|
+
this.isLoading = true;
|
|
24
|
+
this.isActivating = false;
|
|
25
|
+
this.powerups = [];
|
|
26
|
+
this.isPowering = false;
|
|
27
|
+
}
|
|
28
|
+
reloadPowerupsHandler() {
|
|
29
|
+
this.loadData();
|
|
30
|
+
}
|
|
31
|
+
powerupTimeCountDownHandler(e) {
|
|
32
|
+
if (e.detail.timeLeft <= 0) {
|
|
33
|
+
this.loadData();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async loadData() {
|
|
38
|
+
if (!this.endpoint || !this.session) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.isLoading = true;
|
|
42
|
+
if (this.abortController) {
|
|
43
|
+
this.abortController.abort();
|
|
44
|
+
}
|
|
45
|
+
this.abortController = new AbortController();
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(`${this.endpoint}/v1/elevate/powerups?pagination=offset=0,limit=${this.limit}`);
|
|
48
|
+
const options = {
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'x-SessionId': this.session
|
|
52
|
+
},
|
|
53
|
+
method: 'GET',
|
|
54
|
+
signal: this.abortController.signal
|
|
55
|
+
};
|
|
56
|
+
Object.entries(powerUpWithoutGamesSearchConditions).forEach(([key, value]) => {
|
|
57
|
+
url.searchParams.append(key, value);
|
|
58
|
+
});
|
|
59
|
+
url.searchParams.append('language', this.language);
|
|
60
|
+
const response = await fetch(url, options);
|
|
61
|
+
if (!response.ok) {
|
|
62
|
+
window.postMessage({ type: 'errorWhenLoadPowerups', status: response.status });
|
|
63
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
64
|
+
}
|
|
65
|
+
const { data } = await response.json();
|
|
66
|
+
this.powerups = data;
|
|
67
|
+
this.isPowering = this.powerups.filter(e => e.status === PowerUpStatus.ACTIVATED).length > 0;
|
|
68
|
+
this.powerupsLoadEvent.emit({ powerups: this.powerups });
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error.name !== 'AbortError') {
|
|
72
|
+
console.error("Failed to load powerups:", error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
if (!this.abortController.signal.aborted) {
|
|
77
|
+
this.isLoading = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async activePowerUp(powerUp) {
|
|
82
|
+
if (!this.endpoint || !this.session || this.isActivating || this.isPowering) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.isActivating = true;
|
|
86
|
+
this.powerups.forEach(p => {
|
|
87
|
+
if (p.id === powerUp.id) {
|
|
88
|
+
p.status = PowerUpStatus.ACTIVATING;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (this.abortController) {
|
|
92
|
+
this.abortController.abort();
|
|
93
|
+
}
|
|
94
|
+
this.abortController = new AbortController();
|
|
95
|
+
try {
|
|
96
|
+
const url = new URL(`${this.endpoint}/v1/elevate/activatepowerup`);
|
|
97
|
+
let options = {
|
|
98
|
+
headers: {
|
|
99
|
+
'Content-Type': 'application/json',
|
|
100
|
+
'x-SessionId': this.session
|
|
101
|
+
},
|
|
102
|
+
method: 'PUT',
|
|
103
|
+
signal: this.abortController.signal,
|
|
104
|
+
body: JSON.stringify({ powerUpId: powerUp.id })
|
|
105
|
+
};
|
|
106
|
+
const response = await fetch(url.href, options);
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
109
|
+
}
|
|
110
|
+
const res = await response.json();
|
|
111
|
+
if (res === null || res === void 0 ? void 0 : res.success) {
|
|
112
|
+
powerUp = Object.assign(Object.assign({}, powerUp), { status: PowerUpStatus.ACTIVATED, activatedAt: moment(new Date()).format('YYYY-MM-DD HH:mm:ssZ') });
|
|
113
|
+
const activedIdx = this.powerups.findIndex((e) => e.id === powerUp.id);
|
|
114
|
+
this.powerups[activedIdx] = Object.assign({}, powerUp);
|
|
115
|
+
this.powerups = [...this.powerups];
|
|
116
|
+
this.isPowering = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
console.error(e);
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
if (!this.abortController.signal.aborted) {
|
|
124
|
+
this.isActivating = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
onClose() {
|
|
129
|
+
this.closePowerupsEvent.emit({ powerups: this.powerups });
|
|
130
|
+
}
|
|
131
|
+
showDetail(id) {
|
|
132
|
+
this.showDetailsEvent.emit({ id });
|
|
133
|
+
}
|
|
134
|
+
render() {
|
|
135
|
+
return (h("div", { key: 'eedb6e5b3bfca30d017bb077e4bf41001f1e07d7', class: 'IngamePowerUpsContainer', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'bfd1a61b883761d084057f4d2fee8473198b6cea', class: 'TopBar' }, h("span", { key: 'a3a0b4a6d4249d331cf9d4dc36ef07253d820758', class: 'BarTitle' }, translate('powerups', this.language)), h("div", { key: '0be0d805aaaaa5982e8243c227d3f49d4371fb33', class: 'IconBtn CircleLinearBorder', onClick: this.onClose.bind(this), innerHTML: CloseSvg })), this.isLoading
|
|
136
|
+
? h("smart-loader", null)
|
|
137
|
+
: h("div", { class: 'Cards' }, this.isPowering &&
|
|
138
|
+
h("div", { class: 'Card PoweringDesc' }, h("div", { class: 'FlexRow' }, h("div", { class: 'Icon', innerHTML: InfoSvg }), h("div", { class: 'Text' }, translate('poweringTooltip', this.language)))), this.powerups.map(powerup => h("div", { class: 'Card' }, h("div", { class: 'PowerupTitle FlexRow' }, h("div", { class: 'LeftOfRow' }, h("div", { class: 'EnergyIcon', innerHTML: EnergySvg }), h("div", { class: 'Name' }, powerup.powerUpName)), h("div", { class: 'DetailIcon', onClick: this.showDetail.bind(this, powerup.id) }, h("div", { class: 'IconBtn CircleLinearBorder', innerHTML: DetailArrow }))), h("div", { class: 'ExpireTime Status CircleLinearBorder' }, powerup.status === PowerUpStatus.ACTIVATED
|
|
139
|
+
? h("time-count", { language: this.language, "expire-time": getActivedExpireTime(powerup) })
|
|
140
|
+
: h("time-count", { language: this.language, "expire-time": powerup.expireTime })), h("div", { class: 'MultiplierInfo FlexRow' }, h("div", { class: 'LeftOfRow' }, h("div", { class: 'MultiplierIcon', innerHTML: FireSvg }), h("div", { class: 'MultiplierValue' }, powerup.multiplier.coefficient, "x "), h("div", { class: 'MultiplierMode' }, powerup.multiplier.mode === MultiplierMode.COINS ? translate('coins', this.language) : translate('xp', this.language)), h("div", { class: 'MultiplierIcon', innerHTML: ClockSvg }), h("div", { class: 'MultiplierValue' }, powerup.boostingPeriod[powerup.boostingPeriod.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS ? 'numberOfRounds' : 'minutes']), h("div", { class: 'MultiplierMode' }, powerup.boostingPeriod.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS ? translate('rounds', this.language) : translate('minutes', this.language))), (powerup.status === PowerUpStatus.ACTIVE || powerup.status === PowerUpStatus.ACTIVATING) &&
|
|
141
|
+
h("div", { class: `ActiveBtn CircleLinearBorder ${this.isPowering ? 'Disabled' : ''} ${this.isActivating ? 'Activating' : ''}`, onClick: this.activePowerUp.bind(this, powerup) }, h("div", { class: 'content' }, " ", translate('activate', this.language)))))))));
|
|
142
|
+
}
|
|
143
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
144
|
+
if (newValue != oldValue) {
|
|
145
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
149
|
+
if (newValue != oldValue) {
|
|
150
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
154
|
+
if (newValue != oldValue) {
|
|
155
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
handleNewTranslations() {
|
|
159
|
+
getTranslations(this.translationUrl);
|
|
160
|
+
}
|
|
161
|
+
async componentWillLoad() {
|
|
162
|
+
if (this.translationUrl) {
|
|
163
|
+
await getTranslations(this.translationUrl);
|
|
164
|
+
}
|
|
165
|
+
this.loadData();
|
|
166
|
+
}
|
|
167
|
+
componentDidLoad() {
|
|
168
|
+
if (this.stylingContainer) {
|
|
169
|
+
if (this.mbSource)
|
|
170
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
171
|
+
if (this.clientStyling)
|
|
172
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
173
|
+
if (this.clientStylingUrl)
|
|
174
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
disconnectedCallback() {
|
|
178
|
+
if (this.abortController) {
|
|
179
|
+
this.abortController.abort();
|
|
180
|
+
}
|
|
181
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
182
|
+
}
|
|
183
|
+
static get is() { return "bonus-powerups-ingame-list"; }
|
|
184
|
+
static get encapsulation() { return "shadow"; }
|
|
185
|
+
static get originalStyleUrls() {
|
|
186
|
+
return {
|
|
187
|
+
"$": ["bonus-powerups-ingame-list.scss"]
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
static get styleUrls() {
|
|
191
|
+
return {
|
|
192
|
+
"$": ["bonus-powerups-ingame-list.css"]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
196
|
+
static get properties() {
|
|
197
|
+
return {
|
|
198
|
+
"mbSource": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "string",
|
|
203
|
+
"resolved": "string",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": false,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": ""
|
|
211
|
+
},
|
|
212
|
+
"attribute": "mb-source",
|
|
213
|
+
"reflect": true
|
|
214
|
+
},
|
|
215
|
+
"clientStyling": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "string",
|
|
220
|
+
"resolved": "string",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"attribute": "client-styling",
|
|
230
|
+
"reflect": true
|
|
231
|
+
},
|
|
232
|
+
"clientStylingUrl": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"mutable": false,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "string",
|
|
237
|
+
"resolved": "string",
|
|
238
|
+
"references": {}
|
|
239
|
+
},
|
|
240
|
+
"required": false,
|
|
241
|
+
"optional": false,
|
|
242
|
+
"docs": {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": ""
|
|
245
|
+
},
|
|
246
|
+
"attribute": "client-styling-url",
|
|
247
|
+
"reflect": true
|
|
248
|
+
},
|
|
249
|
+
"translationUrl": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"mutable": false,
|
|
252
|
+
"complexType": {
|
|
253
|
+
"original": "string",
|
|
254
|
+
"resolved": "string",
|
|
255
|
+
"references": {}
|
|
256
|
+
},
|
|
257
|
+
"required": false,
|
|
258
|
+
"optional": false,
|
|
259
|
+
"docs": {
|
|
260
|
+
"tags": [],
|
|
261
|
+
"text": ""
|
|
262
|
+
},
|
|
263
|
+
"attribute": "translation-url",
|
|
264
|
+
"reflect": true
|
|
265
|
+
},
|
|
266
|
+
"language": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "string",
|
|
271
|
+
"resolved": "string",
|
|
272
|
+
"references": {}
|
|
273
|
+
},
|
|
274
|
+
"required": false,
|
|
275
|
+
"optional": false,
|
|
276
|
+
"docs": {
|
|
277
|
+
"tags": [],
|
|
278
|
+
"text": ""
|
|
279
|
+
},
|
|
280
|
+
"attribute": "language",
|
|
281
|
+
"reflect": true,
|
|
282
|
+
"defaultValue": "'en'"
|
|
283
|
+
},
|
|
284
|
+
"endpoint": {
|
|
285
|
+
"type": "string",
|
|
286
|
+
"mutable": false,
|
|
287
|
+
"complexType": {
|
|
288
|
+
"original": "string",
|
|
289
|
+
"resolved": "string",
|
|
290
|
+
"references": {}
|
|
291
|
+
},
|
|
292
|
+
"required": true,
|
|
293
|
+
"optional": false,
|
|
294
|
+
"docs": {
|
|
295
|
+
"tags": [],
|
|
296
|
+
"text": ""
|
|
297
|
+
},
|
|
298
|
+
"attribute": "endpoint",
|
|
299
|
+
"reflect": true
|
|
300
|
+
},
|
|
301
|
+
"session": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "string",
|
|
306
|
+
"resolved": "string",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": true,
|
|
310
|
+
"optional": false,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": ""
|
|
314
|
+
},
|
|
315
|
+
"attribute": "session",
|
|
316
|
+
"reflect": true
|
|
317
|
+
},
|
|
318
|
+
"limit": {
|
|
319
|
+
"type": "number",
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"complexType": {
|
|
322
|
+
"original": "number",
|
|
323
|
+
"resolved": "number",
|
|
324
|
+
"references": {}
|
|
325
|
+
},
|
|
326
|
+
"required": false,
|
|
327
|
+
"optional": false,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": ""
|
|
331
|
+
},
|
|
332
|
+
"attribute": "limit",
|
|
333
|
+
"reflect": true,
|
|
334
|
+
"defaultValue": "10"
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
static get states() {
|
|
339
|
+
return {
|
|
340
|
+
"isLoading": {},
|
|
341
|
+
"isActivating": {},
|
|
342
|
+
"powerups": {},
|
|
343
|
+
"isPowering": {}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
static get events() {
|
|
347
|
+
return [{
|
|
348
|
+
"method": "showDetailsEvent",
|
|
349
|
+
"name": "showPowerupDetails",
|
|
350
|
+
"bubbles": true,
|
|
351
|
+
"cancelable": true,
|
|
352
|
+
"composed": true,
|
|
353
|
+
"docs": {
|
|
354
|
+
"tags": [],
|
|
355
|
+
"text": ""
|
|
356
|
+
},
|
|
357
|
+
"complexType": {
|
|
358
|
+
"original": "any",
|
|
359
|
+
"resolved": "any",
|
|
360
|
+
"references": {}
|
|
361
|
+
}
|
|
362
|
+
}, {
|
|
363
|
+
"method": "powerupsLoadEvent",
|
|
364
|
+
"name": "powerupsLoad",
|
|
365
|
+
"bubbles": true,
|
|
366
|
+
"cancelable": true,
|
|
367
|
+
"composed": true,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": ""
|
|
371
|
+
},
|
|
372
|
+
"complexType": {
|
|
373
|
+
"original": "any",
|
|
374
|
+
"resolved": "any",
|
|
375
|
+
"references": {}
|
|
376
|
+
}
|
|
377
|
+
}, {
|
|
378
|
+
"method": "closePowerupsEvent",
|
|
379
|
+
"name": "closePowerupsList",
|
|
380
|
+
"bubbles": true,
|
|
381
|
+
"cancelable": true,
|
|
382
|
+
"composed": true,
|
|
383
|
+
"docs": {
|
|
384
|
+
"tags": [],
|
|
385
|
+
"text": ""
|
|
386
|
+
},
|
|
387
|
+
"complexType": {
|
|
388
|
+
"original": "any",
|
|
389
|
+
"resolved": "any",
|
|
390
|
+
"references": {}
|
|
391
|
+
}
|
|
392
|
+
}];
|
|
393
|
+
}
|
|
394
|
+
static get watchers() {
|
|
395
|
+
return [{
|
|
396
|
+
"propName": "session",
|
|
397
|
+
"methodName": "loadData"
|
|
398
|
+
}, {
|
|
399
|
+
"propName": "endpoint",
|
|
400
|
+
"methodName": "loadData"
|
|
401
|
+
}, {
|
|
402
|
+
"propName": "limit",
|
|
403
|
+
"methodName": "loadData"
|
|
404
|
+
}, {
|
|
405
|
+
"propName": "language",
|
|
406
|
+
"methodName": "loadData"
|
|
407
|
+
}, {
|
|
408
|
+
"propName": "clientStyling",
|
|
409
|
+
"methodName": "handleClientStylingChange"
|
|
410
|
+
}, {
|
|
411
|
+
"propName": "clientStylingUrl",
|
|
412
|
+
"methodName": "handleClientStylingUrlChange"
|
|
413
|
+
}, {
|
|
414
|
+
"propName": "mbSource",
|
|
415
|
+
"methodName": "handleMbSourceChange"
|
|
416
|
+
}, {
|
|
417
|
+
"propName": "translationUrl",
|
|
418
|
+
"methodName": "handleNewTranslations"
|
|
419
|
+
}];
|
|
420
|
+
}
|
|
421
|
+
static get listeners() {
|
|
422
|
+
return [{
|
|
423
|
+
"name": "reloadPowerups",
|
|
424
|
+
"method": "reloadPowerupsHandler",
|
|
425
|
+
"target": "body",
|
|
426
|
+
"capture": false,
|
|
427
|
+
"passive": false
|
|
428
|
+
}, {
|
|
429
|
+
"name": "powerupTimeCountDown",
|
|
430
|
+
"method": "powerupTimeCountDownHandler",
|
|
431
|
+
"target": undefined,
|
|
432
|
+
"capture": false,
|
|
433
|
+
"passive": false
|
|
434
|
+
}];
|
|
435
|
+
}
|
|
436
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BonusPowerupsIngameList } from './bonus-powerups-ingame-list';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import { translate } from "../../utils/locale.utils";
|
|
4
|
+
export class TimeCount {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.expireTime = undefined;
|
|
7
|
+
this.language = 'en';
|
|
8
|
+
this.displayTime = undefined;
|
|
9
|
+
this.isExpireInDay1 = false;
|
|
10
|
+
this.timeLeft = undefined;
|
|
11
|
+
}
|
|
12
|
+
componentWillLoad() {
|
|
13
|
+
this.timer = setInterval(() => this.updateDisplayTime(), 1000);
|
|
14
|
+
this.updateDisplayTime();
|
|
15
|
+
}
|
|
16
|
+
disconnectedCallback() {
|
|
17
|
+
clearInterval(this.timer);
|
|
18
|
+
}
|
|
19
|
+
timeLeftChanged() {
|
|
20
|
+
if (this.timeLeft > 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.timeCountDownEvent.emit({ type: 'powerupTimeCountDown', timeLeft: this.timeLeft });
|
|
24
|
+
}
|
|
25
|
+
startTimeChanged() {
|
|
26
|
+
// Reset the timer and update the display when the input time changes
|
|
27
|
+
clearInterval(this.timer);
|
|
28
|
+
this.timer = setInterval(() => this.updateDisplayTime(), 1000);
|
|
29
|
+
this.updateDisplayTime();
|
|
30
|
+
}
|
|
31
|
+
updateDisplayTime() {
|
|
32
|
+
const now = moment();
|
|
33
|
+
const start = moment(this.expireTime);
|
|
34
|
+
if (!start.isValid()) {
|
|
35
|
+
this.displayTime = 'Invalid date';
|
|
36
|
+
clearInterval(this.timer);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const duration = moment.duration(start.diff(now));
|
|
40
|
+
this.isExpireInDay1 = true; //duration.asDays() > 1;
|
|
41
|
+
this.timeLeft = duration.asMinutes();
|
|
42
|
+
// If the time has already passed
|
|
43
|
+
if (duration.asMilliseconds() <= 0) {
|
|
44
|
+
this.displayTime = '00:00:00';
|
|
45
|
+
clearInterval(this.timer);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const hours = Math.floor(duration.asHours());
|
|
49
|
+
if (hours >= 48) {
|
|
50
|
+
this.displayTime = `${Math.floor(duration.asDays())} ${translate('days', this.language)}`;
|
|
51
|
+
}
|
|
52
|
+
else if (hours >= 24) {
|
|
53
|
+
this.displayTime = '1 day';
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const h = hours;
|
|
57
|
+
const m = duration.minutes();
|
|
58
|
+
const s = duration.seconds();
|
|
59
|
+
this.displayTime = [h, m, s].map(val => String(val).padStart(2, '0')).join(':');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return [
|
|
64
|
+
this.isExpireInDay1 &&
|
|
65
|
+
h("span", { key: '11ec5e6887c3e0b3e3178f8323f9a7937a855651', class: 'Label' }, translate('expiresIn', this.language), " "),
|
|
66
|
+
h("span", { key: 'bbaee9a13552ae932823245d6dc99a5ebd494e46', class: 'TimeCountDown' }, this.displayTime)
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
static get is() { return "time-count"; }
|
|
70
|
+
static get properties() {
|
|
71
|
+
return {
|
|
72
|
+
"expireTime": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "string",
|
|
77
|
+
"resolved": "string",
|
|
78
|
+
"references": {}
|
|
79
|
+
},
|
|
80
|
+
"required": false,
|
|
81
|
+
"optional": false,
|
|
82
|
+
"docs": {
|
|
83
|
+
"tags": [],
|
|
84
|
+
"text": ""
|
|
85
|
+
},
|
|
86
|
+
"attribute": "expire-time",
|
|
87
|
+
"reflect": false
|
|
88
|
+
},
|
|
89
|
+
"language": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "string",
|
|
94
|
+
"resolved": "string",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"attribute": "language",
|
|
104
|
+
"reflect": false,
|
|
105
|
+
"defaultValue": "'en'"
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
static get states() {
|
|
110
|
+
return {
|
|
111
|
+
"displayTime": {},
|
|
112
|
+
"isExpireInDay1": {},
|
|
113
|
+
"timeLeft": {}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static get events() {
|
|
117
|
+
return [{
|
|
118
|
+
"method": "timeCountDownEvent",
|
|
119
|
+
"name": "powerupTimeCountDown",
|
|
120
|
+
"bubbles": true,
|
|
121
|
+
"cancelable": true,
|
|
122
|
+
"composed": true,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "any",
|
|
129
|
+
"resolved": "any",
|
|
130
|
+
"references": {}
|
|
131
|
+
}
|
|
132
|
+
}];
|
|
133
|
+
}
|
|
134
|
+
static get watchers() {
|
|
135
|
+
return [{
|
|
136
|
+
"propName": "timeLeft",
|
|
137
|
+
"methodName": "timeLeftChanged"
|
|
138
|
+
}, {
|
|
139
|
+
"propName": "expireTime",
|
|
140
|
+
"methodName": "startTimeChanged"
|
|
141
|
+
}];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/bonus-powerups-ingame-list';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const TRANSLATIONS = {
|
|
3
|
+
en: {
|
|
4
|
+
powerups: 'Power-ups',
|
|
5
|
+
activate: 'Activate',
|
|
6
|
+
expiresIn: 'Expires in - ',
|
|
7
|
+
xp: 'Points',
|
|
8
|
+
coins: 'Coins',
|
|
9
|
+
minutes: 'min',
|
|
10
|
+
rounds: 'rounds',
|
|
11
|
+
days: 'Days',
|
|
12
|
+
nothingHere: 'Nothing here -- yet!',
|
|
13
|
+
noPowerUps: 'No power-ups have been used at the moment.',
|
|
14
|
+
poweringTooltip: 'Power-ups are currently unavailable as you have already activated one power-up. Only one power-up can be active at a time.'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const getTranslations = (url) => {
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
fetch(url)
|
|
20
|
+
.then((res) => res.json())
|
|
21
|
+
.then((data) => {
|
|
22
|
+
Object.keys(data).forEach((lang) => {
|
|
23
|
+
if (!TRANSLATIONS[lang]) {
|
|
24
|
+
TRANSLATIONS[lang] = {};
|
|
25
|
+
}
|
|
26
|
+
for (let key in data[lang]) {
|
|
27
|
+
TRANSLATIONS[lang][key] = data[lang][key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
resolve(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const translate = (key, customLang, values) => {
|
|
35
|
+
const lang = customLang;
|
|
36
|
+
let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
37
|
+
if (values !== undefined) {
|
|
38
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
39
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
40
|
+
translation = translation.replace(regex, value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return translation;
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PowerUpStatus } from "../../../../../../../libs/common/src/types/casino/powerups";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
export const powerUpWithoutGamesSearchConditions = {
|
|
4
|
+
fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,currentTime,expireTime,activatedAt",
|
|
5
|
+
status: `${PowerUpStatus.ACTIVE},${PowerUpStatus.ACTIVATED}`
|
|
6
|
+
};
|
|
7
|
+
export const powerUpSearchConditions = {
|
|
8
|
+
expand: "games",
|
|
9
|
+
fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,currentTime,expireTime,activatedAt,games(id,gameId,name,thumbnail,launchUrl)",
|
|
10
|
+
status: `${PowerUpStatus.ACTIVE},${PowerUpStatus.ACTIVATED}`
|
|
11
|
+
};
|
|
12
|
+
export const powerUpGameSearchConditions = {
|
|
13
|
+
expand: "games",
|
|
14
|
+
fields: "id,powerUpID,games(id,gameId,name,thumbnail,launchUrl)"
|
|
15
|
+
};
|
|
16
|
+
export const getActivedExpireTime = (powerUp) => {
|
|
17
|
+
if (!powerUp.activatedAt || powerUp.status != PowerUpStatus.ACTIVATED) {
|
|
18
|
+
return powerUp.expireTime;
|
|
19
|
+
}
|
|
20
|
+
return moment(powerUp.activatedAt).add(powerUp.boostingPeriod.minutes, 'minute').format('YYYY-MM-DDTHH:mm:ssZ');
|
|
21
|
+
};
|