@everymatrix/bonus-powerups-ingame-detail 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/bonus-powerups-ingame-detail/app-globals-0f993ce5.js +1 -0
- package/dist/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail-78a50d3f.js +11 -0
- package/dist/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail.esm.js +1 -0
- package/dist/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail_5.entry.js +1 -0
- package/dist/bonus-powerups-ingame-detail/index-334a1114.js +2 -0
- package/dist/bonus-powerups-ingame-detail/index.esm.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/bonus-powerups-ingame-detail-33f5b380.js +11826 -0
- package/dist/cjs/bonus-powerups-ingame-detail.cjs.js +25 -0
- package/dist/cjs/bonus-powerups-ingame-detail_5.cjs.entry.js +334 -0
- package/dist/cjs/index-956ad213.js +1306 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/assets/Arrow Curve Left.svg +11 -0
- package/dist/collection/assets/double-right.svg +4 -0
- package/dist/collection/assets/gotoPage.svg +3 -0
- package/dist/collection/assets/return.svg +15 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail.css +304 -0
- package/dist/collection/components/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail.js +483 -0
- package/dist/collection/components/bonus-powerups-ingame-detail/index.js +1 -0
- package/dist/collection/components/smart-loader/smart-loader.css +84 -0
- package/dist/collection/components/smart-loader/smart-loader.js +17 -0
- package/dist/collection/components/time-count/time-count.js +159 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/constants.js +10 -0
- package/dist/collection/utils/locale.utils.js +46 -0
- package/dist/collection/utils/utils.js +11 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/bonus-powerups-ingame-detail-78a50d3f.js +11822 -0
- package/dist/esm/bonus-powerups-ingame-detail.js +20 -0
- package/dist/esm/bonus-powerups-ingame-detail_5.entry.js +327 -0
- package/dist/esm/index-334a1114.js +1277 -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-detail/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/libs/common/src/types/casino/powerups.d.ts +60 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/packages/stencil/bonus-powerups-ingame-detail/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/packages/stencil/bonus-powerups-ingame-detail/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/packages/stencil/bonus-powerups-ingame-detail/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/packages/stencil/bonus-powerups-ingame-detail/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-detail/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/bonus-powerups-ingame-detail/bonus-powerups-ingame-detail.d.ts +40 -0
- package/dist/types/components/bonus-powerups-ingame-detail/index.d.ts +1 -0
- package/dist/types/components/smart-loader/smart-loader.d.ts +3 -0
- package/dist/types/components/time-count/time-count.d.ts +17 -0
- package/dist/types/components.d.ts +123 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/constants.d.ts +9 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +2 -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,159 @@
|
|
|
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.pid = undefined;
|
|
9
|
+
this.displayTime = undefined;
|
|
10
|
+
this.isExpireInDay1 = false;
|
|
11
|
+
this.timeLeft = undefined;
|
|
12
|
+
}
|
|
13
|
+
componentWillLoad() {
|
|
14
|
+
this.timer = setInterval(() => this.updateDisplayTime(), 1000);
|
|
15
|
+
this.updateDisplayTime();
|
|
16
|
+
}
|
|
17
|
+
disconnectedCallback() {
|
|
18
|
+
clearInterval(this.timer);
|
|
19
|
+
}
|
|
20
|
+
startTimeChanged() {
|
|
21
|
+
// Reset the timer and update the display when the input time changes
|
|
22
|
+
clearInterval(this.timer);
|
|
23
|
+
this.timer = setInterval(() => this.updateDisplayTime(), 1000);
|
|
24
|
+
this.updateDisplayTime();
|
|
25
|
+
}
|
|
26
|
+
timeLeftChanged() {
|
|
27
|
+
this.timeCountDownEvent.emit({ type: 'powerupTimeCountDown', timeLeft: this.timeLeft, pid: this.pid });
|
|
28
|
+
}
|
|
29
|
+
updateDisplayTime() {
|
|
30
|
+
const now = moment();
|
|
31
|
+
const start = moment(this.expireTime);
|
|
32
|
+
if (!start.isValid()) {
|
|
33
|
+
this.displayTime = 'Invalid date';
|
|
34
|
+
clearInterval(this.timer);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const duration = moment.duration(start.diff(now));
|
|
38
|
+
this.isExpireInDay1 = true; //duration.asDays() > 1
|
|
39
|
+
this.timeLeft = duration.asMinutes();
|
|
40
|
+
// If the time has already passed
|
|
41
|
+
if (duration.asMilliseconds() <= 0) {
|
|
42
|
+
this.displayTime = '00:00:00';
|
|
43
|
+
clearInterval(this.timer);
|
|
44
|
+
this.timeCountDownEvent.emit({ type: 'powerupTimeCountDown', timeLeft: 0, pid: this.pid });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const hours = Math.floor(duration.asHours());
|
|
48
|
+
if (hours >= 48) {
|
|
49
|
+
this.displayTime = `${Math.floor(duration.asDays())} ${translate('days', this.language)}`;
|
|
50
|
+
}
|
|
51
|
+
else if (hours >= 24) {
|
|
52
|
+
this.displayTime = '1 day';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const h = hours;
|
|
56
|
+
const m = duration.minutes();
|
|
57
|
+
const s = duration.seconds();
|
|
58
|
+
this.displayTime = [h, m, s].map(val => String(val).padStart(2, '0')).join(':');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return [
|
|
63
|
+
this.isExpireInDay1 &&
|
|
64
|
+
h("span", { key: '832c9d6dce83414d8d0fac874c2dfd7c0d0742bd', class: 'Label' }, translate('expiresIn', this.language), " "),
|
|
65
|
+
h("span", { key: '3f68f1ddc0f710cded68ba52305f44fc95603e1d', class: 'TimeCountDown' }, this.displayTime)
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
static get is() { return "time-count-detail"; }
|
|
69
|
+
static get properties() {
|
|
70
|
+
return {
|
|
71
|
+
"expireTime": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "string",
|
|
76
|
+
"resolved": "string",
|
|
77
|
+
"references": {}
|
|
78
|
+
},
|
|
79
|
+
"required": false,
|
|
80
|
+
"optional": false,
|
|
81
|
+
"docs": {
|
|
82
|
+
"tags": [],
|
|
83
|
+
"text": ""
|
|
84
|
+
},
|
|
85
|
+
"attribute": "expire-time",
|
|
86
|
+
"reflect": false
|
|
87
|
+
},
|
|
88
|
+
"language": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"mutable": false,
|
|
91
|
+
"complexType": {
|
|
92
|
+
"original": "string",
|
|
93
|
+
"resolved": "string",
|
|
94
|
+
"references": {}
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"optional": false,
|
|
98
|
+
"docs": {
|
|
99
|
+
"tags": [],
|
|
100
|
+
"text": ""
|
|
101
|
+
},
|
|
102
|
+
"attribute": "language",
|
|
103
|
+
"reflect": false,
|
|
104
|
+
"defaultValue": "'en'"
|
|
105
|
+
},
|
|
106
|
+
"pid": {
|
|
107
|
+
"type": "any",
|
|
108
|
+
"mutable": false,
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "number | string",
|
|
111
|
+
"resolved": "number | string",
|
|
112
|
+
"references": {}
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"optional": false,
|
|
116
|
+
"docs": {
|
|
117
|
+
"tags": [],
|
|
118
|
+
"text": ""
|
|
119
|
+
},
|
|
120
|
+
"attribute": "pid",
|
|
121
|
+
"reflect": true
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
static get states() {
|
|
126
|
+
return {
|
|
127
|
+
"displayTime": {},
|
|
128
|
+
"isExpireInDay1": {},
|
|
129
|
+
"timeLeft": {}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
static get events() {
|
|
133
|
+
return [{
|
|
134
|
+
"method": "timeCountDownEvent",
|
|
135
|
+
"name": "powerupTimeCountDown",
|
|
136
|
+
"bubbles": true,
|
|
137
|
+
"cancelable": true,
|
|
138
|
+
"composed": true,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"complexType": {
|
|
144
|
+
"original": "any",
|
|
145
|
+
"resolved": "any",
|
|
146
|
+
"references": {}
|
|
147
|
+
}
|
|
148
|
+
}];
|
|
149
|
+
}
|
|
150
|
+
static get watchers() {
|
|
151
|
+
return [{
|
|
152
|
+
"propName": "expireTime",
|
|
153
|
+
"methodName": "startTimeChanged"
|
|
154
|
+
}, {
|
|
155
|
+
"propName": "timeLeft",
|
|
156
|
+
"methodName": "timeLeftChanged"
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/bonus-powerups-ingame-detail';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PowerUpStatus } from "../../../../../../../libs/common/src/types/casino/powerups";
|
|
2
|
+
export const powerUpSearchConditions = {
|
|
3
|
+
expand: "games",
|
|
4
|
+
fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,currentTime,activatedAt,expireTime,games(id,gameId,name,slug,thumbnail)",
|
|
5
|
+
status: `${PowerUpStatus.ACTIVE},${PowerUpStatus.ACTIVATED}`
|
|
6
|
+
};
|
|
7
|
+
export const powerUpGameSearchConditions = {
|
|
8
|
+
expand: "games",
|
|
9
|
+
fields: "id,powerUpID,games(id,gameId,slug,name,thumbnail)"
|
|
10
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const TRANSLATIONS = {
|
|
3
|
+
en: {
|
|
4
|
+
playNow: 'Play Now',
|
|
5
|
+
history: 'History',
|
|
6
|
+
available: 'Available',
|
|
7
|
+
duration: 'Duration',
|
|
8
|
+
multiplier: 'Multiplier',
|
|
9
|
+
endDate: 'End date',
|
|
10
|
+
days: 'Days',
|
|
11
|
+
termsAndConditions: 'Terms & Conditions ',
|
|
12
|
+
playResponsibly: 'Terms & Conditions apply. 18+. Play responsibly.',
|
|
13
|
+
seeAll: 'See All',
|
|
14
|
+
games: 'Games',
|
|
15
|
+
activateTips: 'In case of activation the countdown starts immediately.',
|
|
16
|
+
activate: 'Activate'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const getTranslations = (url) => {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
fetch(url)
|
|
22
|
+
.then((res) => res.json())
|
|
23
|
+
.then((data) => {
|
|
24
|
+
Object.keys(data).forEach((lang) => {
|
|
25
|
+
if (!TRANSLATIONS[lang]) {
|
|
26
|
+
TRANSLATIONS[lang] = {};
|
|
27
|
+
}
|
|
28
|
+
for (let key in data[lang]) {
|
|
29
|
+
TRANSLATIONS[lang][key] = data[lang][key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
resolve(true);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export const translate = (key, customLang, values) => {
|
|
37
|
+
const lang = customLang;
|
|
38
|
+
let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
39
|
+
if (values !== undefined) {
|
|
40
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
41
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
42
|
+
translation = translation.replace(regex, value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return translation;
|
|
46
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PowerUpStatus } from "../../../../../../../libs/common/src/types/casino/powerups";
|
|
2
|
+
import moment from "moment/moment";
|
|
3
|
+
export function format(first, middle, last) {
|
|
4
|
+
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
5
|
+
}
|
|
6
|
+
export const getActivedExpireTime = (powerUp) => {
|
|
7
|
+
if (!powerUp.activatedAt || powerUp.status != PowerUpStatus.ACTIVATED) {
|
|
8
|
+
return powerUp.expireTime;
|
|
9
|
+
}
|
|
10
|
+
return moment(powerUp.activatedAt).add(powerUp.boostingPeriod.minutes, 'minute').format('YYYY-MM-DDTHH:mm:ssZ');
|
|
11
|
+
};
|