@everymatrix/bonus-powerups-ingame-list 0.0.25 → 0.0.26

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 (37) hide show
  1. package/dist/bonus-powerups-ingame-list/active-confirm-modal_3.entry.js +1 -0
  2. package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list-01fff0bc.js +3 -0
  3. package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list.esm.js +1 -1
  4. package/dist/bonus-powerups-ingame-list/index-e015b33d.js +2 -0
  5. package/dist/bonus-powerups-ingame-list/index.esm.js +1 -1
  6. package/dist/cjs/active-confirm-modal_3.cjs.entry.js +121 -0
  7. package/dist/cjs/{bonus-powerups-ingame-list-c9172936.js → bonus-powerups-ingame-list-db296f5c.js} +100 -28
  8. package/dist/cjs/bonus-powerups-ingame-list.cjs.js +2 -2
  9. package/dist/cjs/{index-f60c43c6.js → index-1c45277e.js} +9 -3
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/active-confirm-modal/active-confirm-modal.component.js +105 -0
  14. package/dist/collection/components/active-confirm-modal/active-confirm-modal.css +50 -0
  15. package/dist/collection/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.css +45 -4
  16. package/dist/collection/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.js +89 -23
  17. package/dist/collection/components/time-count/time-count.js +73 -5
  18. package/dist/collection/utils/locale.utils.js +9 -3
  19. package/dist/collection/utils/utils.js +10 -2
  20. package/dist/esm/active-confirm-modal_3.entry.js +116 -0
  21. package/dist/esm/{bonus-powerups-ingame-list-a8638981.js → bonus-powerups-ingame-list-01fff0bc.js} +98 -27
  22. package/dist/esm/bonus-powerups-ingame-list.js +3 -3
  23. package/dist/esm/{index-20f17dc8.js → index-e015b33d.js} +9 -3
  24. package/dist/esm/index.js +2 -2
  25. package/dist/esm/loader.js +3 -3
  26. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-powerups-ingame-list/.stencil/libs/common/src/types/casino/powerups.d.ts +1 -0
  27. package/dist/types/components/active-confirm-modal/active-confirm-modal.component.d.ts +10 -0
  28. package/dist/types/components/bonus-powerups-ingame-list/bonus-powerups-ingame-list.d.ts +13 -0
  29. package/dist/types/components/time-count/time-count.d.ts +3 -0
  30. package/dist/types/components.d.ts +41 -0
  31. package/dist/types/utils/utils.d.ts +1 -0
  32. package/package.json +1 -1
  33. package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list-a8638981.js +0 -3
  34. package/dist/bonus-powerups-ingame-list/bonus-powerups-ingame-list_2.entry.js +0 -1
  35. package/dist/bonus-powerups-ingame-list/index-20f17dc8.js +0 -2
  36. package/dist/cjs/bonus-powerups-ingame-list_2.cjs.entry.js +0 -82
  37. package/dist/esm/bonus-powerups-ingame-list_2.entry.js +0 -78
@@ -9,6 +9,7 @@
9
9
 
10
10
  .IngamePowerUpsContainer {
11
11
  display: block;
12
+ transition: opacity 200ms ease-in-out;
12
13
  height: 100%;
13
14
  padding: var(--emw--ingame-power-container-padding, 8px);
14
15
  /* 内容区域样式 */
@@ -17,6 +18,10 @@
17
18
  width: 26px;
18
19
  height: 26px;
19
20
  }
21
+ .IngamePowerUpsContainer .Hidden {
22
+ opacity: 0 !important;
23
+ display: none;
24
+ }
20
25
  .IngamePowerUpsContainer .CircleLinearBorder {
21
26
  position: relative;
22
27
  border-radius: 20px;
@@ -46,6 +51,8 @@
46
51
  background: linear-gradient(0deg, var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.0666666667)), var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.0666666667))), linear-gradient(35.22deg, var(--emw--ingame-color-white10, rgba(255, 255, 255, 0)), var(--emw--ingame-color-white30, rgba(255, 255, 255, 0.5490196078)) 89.19%);
47
52
  }
48
53
  .IngamePowerUpsContainer .TopBar {
54
+ opacity: 1;
55
+ transition: all 0.5s ease-in-out;
49
56
  display: flex;
50
57
  justify-content: space-between;
51
58
  align-items: center;
@@ -59,6 +66,8 @@
59
66
  vertical-align: middle;
60
67
  }
61
68
  .IngamePowerUpsContainer .Cards {
69
+ opacity: 1;
70
+ transition: all 0.5s ease-in-out;
62
71
  width: 100%;
63
72
  height: calc(100% - 70px);
64
73
  gap: 16px;
@@ -99,6 +108,15 @@
99
108
  .IngamePowerUpsContainer .Cards .Card .PowerupTitle {
100
109
  font-weight: bold;
101
110
  }
111
+ .IngamePowerUpsContainer .Cards .Card .PowerupTitle .LeftOfRow {
112
+ width: calc(100% - 40px);
113
+ }
114
+ .IngamePowerUpsContainer .Cards .Card .PowerupTitle .Name {
115
+ width: calc(100% - 40px);
116
+ text-overflow: ellipsis;
117
+ overflow: hidden;
118
+ white-space: nowrap;
119
+ }
102
120
  .IngamePowerUpsContainer .Cards .Card .MultiplierInfo {
103
121
  align-items: flex-end;
104
122
  height: 37.6px;
@@ -125,8 +143,6 @@
125
143
  width: max-content;
126
144
  height: 25px;
127
145
  backdrop-filter: blur(4.6px);
128
- flex: none;
129
- order: 1;
130
146
  flex-grow: 0;
131
147
  border: 0px solid;
132
148
  opacity: 1;
@@ -135,6 +151,13 @@
135
151
  .IngamePowerUpsContainer .Cards .Card .Status::before {
136
152
  background: linear-gradient(97.6deg, var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.2)) 11.03%, var(--emw--ingame-color-white00, rgba(255, 255, 255, 0)) 95.17%), linear-gradient(0deg, var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.2)), var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.2)));
137
153
  }
154
+ .IngamePowerUpsContainer .Cards .Card .Status .InprogressLabel {
155
+ width: fit-content;
156
+ min-width: 100px;
157
+ }
158
+ .IngamePowerUpsContainer .Cards .Card .Status time-count {
159
+ min-width: 172px;
160
+ }
138
161
  .IngamePowerUpsContainer .Cards .Card .Status time-count {
139
162
  background-color: var(--emw--ingame-color-black-middle, #020308);
140
163
  width: calc(100% - 4px);
@@ -146,7 +169,7 @@
146
169
  justify-content: center;
147
170
  padding: 2.2px;
148
171
  z-index: 1;
149
- min-width: 172px;
172
+ padding-right: 10px;
150
173
  }
151
174
  .IngamePowerUpsContainer .Cards .Card .ActiveButton.Activating {
152
175
  background-color: var(--emw--ingame-color-white30, rgba(255, 255, 255, 0.3019607843));
@@ -155,9 +178,27 @@
155
178
  .IngamePowerUpsContainer .Cards .Card time-count .Label {
156
179
  margin-right: 5px;
157
180
  }
181
+ .IngamePowerUpsContainer .Cards .Card time-count .InprogressLabel {
182
+ text-align: left;
183
+ width: fit-content;
184
+ padding: 0 5px;
185
+ border-radius: 18px;
186
+ border: 1px solid rgba(175, 165, 165, 0.5098039216);
187
+ line-height: 21px;
188
+ margin-right: 10px;
189
+ }
190
+ .IngamePowerUpsContainer .Cards .Card time-count .InprogressLabel .Icon {
191
+ height: 5px;
192
+ width: 5px;
193
+ background-color: var(--New-Indicator-Yellow, #FFB801);
194
+ border-radius: 3px;
195
+ display: inline-block;
196
+ margin-right: 5px;
197
+ }
158
198
  .IngamePowerUpsContainer .Cards .Card time-count .TimeCountDown {
159
199
  letter-spacing: 1.5px;
160
200
  font-weight: bold;
201
+ text-transform: capitalize;
161
202
  }
162
203
  .IngamePowerUpsContainer .ActiveBtn {
163
204
  color: var(--emw--ingame-color-black, #090909);
@@ -191,7 +232,7 @@
191
232
  bottom: -1px;
192
233
  z-index: 1;
193
234
  border-radius: 18px;
194
- background: linear-gradient(218deg, var(--emw--ingame-color-white60, rgba(255, 255, 255, 0.568627451)), var(--emw--ingame-color-white30, rgba(255, 255, 255, 0.3019607843))), linear-gradient(93deg, var(--emw--ingame-color-white60, rgba(255, 255, 255, 0.6588235294)) 33.61%, var(--emw--ingame-color-white60, rgba(255, 255, 255, 0.5411764706)) 89.19%);
235
+ background: linear-gradient(to top right, var(--emw--ingame-color-powerup-brightgreen, #00FA5A), var(--emw--ingame-color-powerup-brightblue, rgba(50, 237, 221, 0.8901960784)));
195
236
  }
196
237
  .IngamePowerUpsContainer .ActiveBtn .content {
197
238
  line-height: 1.6;
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
2
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
3
  import { getTranslations, translate } from "../../utils/locale.utils";
4
4
  import { BoostingPeriodMode, MultiplierMode, PowerUpStatus } from "../../../../../../../../libs/common/src/types/casino/powerups";
5
- import { getActivedExpireTime, powerUpWithoutGamesSearchConditions } from "../../utils/utils";
5
+ import { getActivedExpireTime, powerUpWithoutGamesSearchConditions, debounce } from "../../utils/utils";
6
6
  import CloseSvg from "../assets/close.svg";
7
7
  import EnergySvg from "../assets/energe.svg";
8
8
  import FireSvg from "../assets/fire.svg";
@@ -19,23 +19,41 @@ export class BonusPowerupsIngameList {
19
19
  this.language = 'en';
20
20
  this.endpoint = undefined;
21
21
  this.session = undefined;
22
- this.limit = 10;
23
- this.isLoading = true;
22
+ this.limit = 30;
23
+ this.isLoading = false;
24
24
  this.isActivating = false;
25
25
  this.powerups = [];
26
+ this.total = 0;
26
27
  this.isPowering = false;
28
+ this.showConfirmModal = false;
29
+ this.currentPowerup = undefined;
30
+ this.debouncedReload = debounce(this.reloadPowerups, 100);
27
31
  }
28
32
  reloadPowerupsHandler() {
29
- this.loadData();
33
+ this.reloadPowerups();
34
+ }
35
+ activePowerupHandler(e) {
36
+ if (e.detail.id === this.currentPowerup.id) {
37
+ this.activePowerUp(this.currentPowerup);
38
+ }
39
+ this.showConfirmModal = false;
30
40
  }
31
41
  powerupTimeCountDownHandler(e) {
32
42
  if (e.detail.timeLeft <= 0) {
33
- this.loadData();
43
+ this.reloadPowerups();
34
44
  return;
35
45
  }
36
46
  }
47
+ reloadPowerups() {
48
+ this.powerups = [];
49
+ this.total = 0;
50
+ this.loadData();
51
+ }
52
+ handleConfigChange() {
53
+ this.debouncedReload();
54
+ }
37
55
  async loadData() {
38
- if (!this.endpoint || !this.session) {
56
+ if (this.isLoading || (this.total > 0 && this.powerups.length >= this.total)) {
39
57
  return;
40
58
  }
41
59
  this.isLoading = true;
@@ -44,7 +62,8 @@ export class BonusPowerupsIngameList {
44
62
  }
45
63
  this.abortController = new AbortController();
46
64
  try {
47
- const url = new URL(`${this.endpoint}/v1/elevate/powerups?pagination=offset=0,limit=${this.limit}`);
65
+ const offset = this.powerups.length;
66
+ const url = new URL(`${this.endpoint}/v1/elevate/powerups?pagination=offset=${offset},limit=${this.limit}`);
48
67
  const options = {
49
68
  headers: {
50
69
  'Content-Type': 'application/json',
@@ -62,10 +81,11 @@ export class BonusPowerupsIngameList {
62
81
  window.postMessage({ type: 'errorWhenLoadPowerups', status: response.status });
63
82
  throw new Error(`HTTP error! status: ${response.status}`);
64
83
  }
65
- const { data } = await response.json();
66
- this.powerups = data;
84
+ const { data, total } = await response.json();
85
+ this.powerups = [...this.powerups, ...data];
86
+ this.total = total;
67
87
  this.isPowering = this.powerups.filter(e => e.status === PowerUpStatus.ACTIVATED).length > 0;
68
- this.powerupsLoadEvent.emit({ powerups: this.powerups });
88
+ this.powerupsLoadEvent.emit({ powerups: this.powerups, total });
69
89
  }
70
90
  catch (error) {
71
91
  if (error.name !== 'AbortError') {
@@ -78,6 +98,21 @@ export class BonusPowerupsIngameList {
78
98
  }
79
99
  }
80
100
  }
101
+ initializeObserver() {
102
+ if (this.loadMoreObserver) {
103
+ this.loadMoreObserver.disconnect();
104
+ }
105
+ this.loadMoreObserver = new IntersectionObserver((entries) => {
106
+ entries.forEach((entry) => {
107
+ if (entry.isIntersecting) {
108
+ this.loadData().catch(console.error);
109
+ }
110
+ });
111
+ });
112
+ if (this.lastItemElement) {
113
+ this.loadMoreObserver.observe(this.lastItemElement);
114
+ }
115
+ }
81
116
  async activePowerUp(powerUp) {
82
117
  if (!this.endpoint || !this.session || this.isActivating || this.isPowering) {
83
118
  return;
@@ -114,6 +149,7 @@ export class BonusPowerupsIngameList {
114
149
  this.powerups[activedIdx] = Object.assign({}, powerUp);
115
150
  this.powerups = [...this.powerups];
116
151
  this.isPowering = true;
152
+ this.reloadPowerups();
117
153
  }
118
154
  }
119
155
  catch (e) {
@@ -131,14 +167,32 @@ export class BonusPowerupsIngameList {
131
167
  showDetail(id) {
132
168
  this.showDetailsEvent.emit({ id });
133
169
  }
170
+ onActiveBtnClick(powerup) {
171
+ if (this.isPowering || this.isActivating) {
172
+ return;
173
+ }
174
+ this.currentPowerup = powerup;
175
+ this.showConfirmModal = true;
176
+ }
177
+ componentDidUpdate() {
178
+ if (this.powerups.length < this.total) {
179
+ this.initializeObserver();
180
+ }
181
+ }
134
182
  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
183
+ var _a;
184
+ return (h("div", { key: '755e95625116000407991e3349c2f896335515a0', class: 'IngamePowerUpsContainer', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'c0bf175b4af979d505014ef1d92ff6f9c2bf7b3f', class: `TopBar ${this.showConfirmModal ? 'Hidden' : ''}` }, h("span", { key: 'e46b6e4f52170d857bedf55837b60fb471b61e0d', class: 'BarTitle' }, translate('powerups', this.language)), h("div", { key: 'c69769c036192c91410363a14c70648625cabbe8', class: 'IconBtn CircleLinearBorder', onClick: this.onClose.bind(this), innerHTML: CloseSvg })), this.isLoading && this.powerups.length === 0
136
185
  ? 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)))))))));
186
+ : h("div", { class: `Cards ${this.showConfirmModal ? 'Hidden' : ''}` }, this.isPowering &&
187
+ 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, index) => {
188
+ const isLastItem = index === this.powerups.length - 1;
189
+ return (h("div", { class: `Card ${powerup.status === PowerUpStatus.ACTIVATED ? 'Actived' : ''}`, ref: isLastItem ? (el) => (this.lastItemElement = el) : null }, 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
190
+ ?
191
+ h("time-count", { "in-progress": true, mode: powerup.boostingPeriod.mode, "left-rounds": (powerup.boostingPeriod.numberOfRounds || 0) - (powerup.usedNumberOfRounds || 0), language: this.language, "expire-time": getActivedExpireTime(powerup) })
192
+ :
193
+ h("time-count", { language: this.language, mode: powerup.boostingPeriod.mode, "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) &&
194
+ h("div", { class: `ActiveBtn CircleLinearBorder ${this.isPowering ? 'Disabled' : ''} ${this.isActivating ? 'Activating' : ''}`, onClick: () => this.onActiveBtnClick(powerup) }, h("div", { class: 'content' }, " ", translate('activate', this.language))))));
195
+ }), this.isLoading && this.powerups.length > 0 && h("smart-loader", null)), h("active-confirm-modal", { key: '4c94dfcd5865ee4fb41791a4e69b33dfc1dd7be0', "is-open": this.showConfirmModal, "powerup-id": (_a = this.currentPowerup) === null || _a === void 0 ? void 0 : _a.id, language: this.language })));
142
196
  }
143
197
  handleClientStylingChange(newValue, oldValue) {
144
198
  if (newValue != oldValue) {
@@ -162,7 +216,7 @@ export class BonusPowerupsIngameList {
162
216
  if (this.translationUrl) {
163
217
  await getTranslations(this.translationUrl);
164
218
  }
165
- this.loadData();
219
+ this.handleConfigChange();
166
220
  }
167
221
  componentDidLoad() {
168
222
  if (this.stylingContainer) {
@@ -178,6 +232,9 @@ export class BonusPowerupsIngameList {
178
232
  if (this.abortController) {
179
233
  this.abortController.abort();
180
234
  }
235
+ if (this.loadMoreObserver) {
236
+ this.loadMoreObserver.disconnect();
237
+ }
181
238
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
182
239
  }
183
240
  static get is() { return "bonus-powerups-ingame-list"; }
@@ -331,7 +388,7 @@ export class BonusPowerupsIngameList {
331
388
  },
332
389
  "attribute": "limit",
333
390
  "reflect": true,
334
- "defaultValue": "10"
391
+ "defaultValue": "30"
335
392
  }
336
393
  };
337
394
  }
@@ -340,7 +397,10 @@ export class BonusPowerupsIngameList {
340
397
  "isLoading": {},
341
398
  "isActivating": {},
342
399
  "powerups": {},
343
- "isPowering": {}
400
+ "total": {},
401
+ "isPowering": {},
402
+ "showConfirmModal": {},
403
+ "currentPowerup": {}
344
404
  };
345
405
  }
346
406
  static get events() {
@@ -394,16 +454,16 @@ export class BonusPowerupsIngameList {
394
454
  static get watchers() {
395
455
  return [{
396
456
  "propName": "session",
397
- "methodName": "loadData"
457
+ "methodName": "handleConfigChange"
398
458
  }, {
399
459
  "propName": "endpoint",
400
- "methodName": "loadData"
460
+ "methodName": "handleConfigChange"
401
461
  }, {
402
462
  "propName": "limit",
403
- "methodName": "loadData"
463
+ "methodName": "handleConfigChange"
404
464
  }, {
405
465
  "propName": "language",
406
- "methodName": "loadData"
466
+ "methodName": "handleConfigChange"
407
467
  }, {
408
468
  "propName": "clientStyling",
409
469
  "methodName": "handleClientStylingChange"
@@ -425,6 +485,12 @@ export class BonusPowerupsIngameList {
425
485
  "target": "body",
426
486
  "capture": false,
427
487
  "passive": false
488
+ }, {
489
+ "name": "activePowerupEvent",
490
+ "method": "activePowerupHandler",
491
+ "target": "body",
492
+ "capture": false,
493
+ "passive": false
428
494
  }, {
429
495
  "name": "powerupTimeCountDown",
430
496
  "method": "powerupTimeCountDownHandler",
@@ -1,15 +1,22 @@
1
1
  import { h } from "@stencil/core";
2
2
  import moment from "moment";
3
3
  import { translate } from "../../utils/locale.utils";
4
+ import { BoostingPeriodMode } from "../../../../../../../../libs/common/src/types/casino/powerups";
4
5
  export class TimeCount {
5
6
  constructor() {
6
7
  this.expireTime = undefined;
7
8
  this.language = 'en';
9
+ this.mode = 'timePeriod';
10
+ this.inProgress = false;
11
+ this.leftRounds = undefined;
8
12
  this.displayTime = undefined;
9
13
  this.isExpireInDay1 = false;
10
14
  this.timeLeft = undefined;
11
15
  }
12
16
  componentWillLoad() {
17
+ if (this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS) {
18
+ return;
19
+ }
13
20
  this.timer = setInterval(() => this.updateDisplayTime(), 1000);
14
21
  this.updateDisplayTime();
15
22
  }
@@ -17,12 +24,15 @@ export class TimeCount {
17
24
  clearInterval(this.timer);
18
25
  }
19
26
  timeLeftChanged() {
20
- if (this.timeLeft > 0) {
27
+ if (this.timeLeft > 0 || this.timeLeft < -10) { // it is a data error if timeLeft is negative
21
28
  return;
22
29
  }
23
30
  this.timeCountDownEvent.emit({ type: 'powerupTimeCountDown', timeLeft: this.timeLeft });
24
31
  }
25
32
  startTimeChanged() {
33
+ if (this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS) {
34
+ return;
35
+ }
26
36
  // Reset the timer and update the display when the input time changes
27
37
  clearInterval(this.timer);
28
38
  this.timer = setInterval(() => this.updateDisplayTime(), 1000);
@@ -42,6 +52,7 @@ export class TimeCount {
42
52
  // If the time has already passed
43
53
  if (duration.asMilliseconds() <= 0) {
44
54
  this.displayTime = '00:00:00';
55
+ this.timeLeft = 0;
45
56
  clearInterval(this.timer);
46
57
  return;
47
58
  }
@@ -61,9 +72,13 @@ export class TimeCount {
61
72
  }
62
73
  render() {
63
74
  return [
75
+ this.inProgress &&
76
+ h("div", { key: '28ad398a10a6d917d62178b308660228a8e6909c', class: 'InprogressLabel' }, h("span", { key: 'b1717807c6ab470e9aaa9ae820179aed18821c56', class: 'Icon' }), translate('inProgress', this.language)),
64
77
  this.isExpireInDay1 &&
65
- h("span", { key: '11ec5e6887c3e0b3e3178f8323f9a7937a855651', class: 'Label' }, translate('expiresIn', this.language), " "),
66
- h("span", { key: 'bbaee9a13552ae932823245d6dc99a5ebd494e46', class: 'TimeCountDown' }, this.displayTime)
78
+ h("span", { key: '8113731d28d1ab0df026f61557b1e35f0ea96f53', class: 'Label' }, translate(this.inProgress ? 'endsIn' : 'expiresIn', this.language), " "),
79
+ this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS
80
+ ? h("span", { class: 'TimeCountDown' }, this.leftRounds, " ", translate('rounds', this.language))
81
+ : h("span", { class: 'TimeCountDown' }, this.displayTime)
67
82
  ];
68
83
  }
69
84
  static get is() { return "time-count"; }
@@ -84,7 +99,7 @@ export class TimeCount {
84
99
  "text": ""
85
100
  },
86
101
  "attribute": "expire-time",
87
- "reflect": false
102
+ "reflect": true
88
103
  },
89
104
  "language": {
90
105
  "type": "string",
@@ -101,8 +116,61 @@ export class TimeCount {
101
116
  "text": ""
102
117
  },
103
118
  "attribute": "language",
104
- "reflect": false,
119
+ "reflect": true,
105
120
  "defaultValue": "'en'"
121
+ },
122
+ "mode": {
123
+ "type": "string",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "string",
127
+ "resolved": "string",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": ""
135
+ },
136
+ "attribute": "mode",
137
+ "reflect": true,
138
+ "defaultValue": "'timePeriod'"
139
+ },
140
+ "inProgress": {
141
+ "type": "boolean",
142
+ "mutable": false,
143
+ "complexType": {
144
+ "original": "boolean",
145
+ "resolved": "boolean",
146
+ "references": {}
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [],
152
+ "text": ""
153
+ },
154
+ "attribute": "in-progress",
155
+ "reflect": true,
156
+ "defaultValue": "false"
157
+ },
158
+ "leftRounds": {
159
+ "type": "number",
160
+ "mutable": false,
161
+ "complexType": {
162
+ "original": "number",
163
+ "resolved": "number",
164
+ "references": {}
165
+ },
166
+ "required": false,
167
+ "optional": false,
168
+ "docs": {
169
+ "tags": [],
170
+ "text": ""
171
+ },
172
+ "attribute": "left-rounds",
173
+ "reflect": true
106
174
  }
107
175
  };
108
176
  }
@@ -4,14 +4,20 @@ const TRANSLATIONS = {
4
4
  powerups: 'Power-ups',
5
5
  activate: 'Activate',
6
6
  expiresIn: 'Expires in - ',
7
- xp: 'Points',
7
+ inProgress: 'In Progress',
8
+ endsIn: 'Ends in - ',
9
+ xp: 'XP',
8
10
  coins: 'Coins',
9
11
  minutes: 'min',
10
- rounds: 'rounds',
12
+ rounds: 'Rounds',
11
13
  days: 'Days',
12
14
  nothingHere: 'Nothing here -- yet!',
13
15
  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.'
16
+ poweringTooltip: 'Power-ups are currently unavailable as you have already activated one power-up. Only one power-up can be active at a time.',
17
+ later: 'Later',
18
+ activateNow: 'Activate Now',
19
+ activeTitle: 'Activate power-up?',
20
+ activeContent: 'In case of activation the countdown starts immediately.\n Are you sure you want to activate?'
15
21
  }
16
22
  };
17
23
  export const getTranslations = (url) => {
@@ -1,12 +1,12 @@
1
1
  import { PowerUpStatus } from "../../../../../../../libs/common/src/types/casino/powerups";
2
2
  import moment from "moment";
3
3
  export const powerUpWithoutGamesSearchConditions = {
4
- fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,currentTime,expireTime,activatedAt",
4
+ fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,usedNumberOfRounds,currentTime,expireTime,activatedAt",
5
5
  status: `${PowerUpStatus.ACTIVE},${PowerUpStatus.ACTIVATED}`
6
6
  };
7
7
  export const powerUpSearchConditions = {
8
8
  expand: "games",
9
- fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,currentTime,expireTime,activatedAt,games(id,gameId,name,thumbnail,launchUrl)",
9
+ fields: "id,powerUpID,displayName,termsUrl,description,status,multiplier,boostingPeriod,usedNumberOfRounds,currentTime,expireTime,activatedAt,games(id,gameId,name,thumbnail,launchUrl)",
10
10
  status: `${PowerUpStatus.ACTIVE},${PowerUpStatus.ACTIVATED}`
11
11
  };
12
12
  export const powerUpGameSearchConditions = {
@@ -19,3 +19,11 @@ export const getActivedExpireTime = (powerUp) => {
19
19
  }
20
20
  return moment(powerUp.activatedAt).add(powerUp.boostingPeriod.minutes, 'minute').format('YYYY-MM-DDTHH:mm:ssZ');
21
21
  };
22
+ export function debounce(func, wait) {
23
+ let timeout;
24
+ return function (...args) {
25
+ const context = this;
26
+ clearTimeout(timeout);
27
+ timeout = setTimeout(() => func.apply(context, args), wait);
28
+ };
29
+ }
@@ -0,0 +1,116 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-e015b33d.js';
2
+ import { t as translate, C as CloseSvg, a as BoostingPeriodMode, h as hooks } from './bonus-powerups-ingame-list-01fff0bc.js';
3
+ export { B as bonus_powerups_ingame_list } from './bonus-powerups-ingame-list-01fff0bc.js';
4
+
5
+ const activeConfirmModalCss = ".ModalContainer{position:absolute;top:calc(50% - 200px);left:0;width:calc(100% - 120px);margin:40px;max-width:400px;height:260px;text-align:center;padding:20px;display:flex;gap:30px;flex-direction:column;border:1px solid var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.0784313725));transition:opacity 200ms ease-in-out;opacity:1;background:var(--emw--ingame-color-black40, rgba(9, 9, 9, 0.5019607843));border-radius:20px;backdrop-filter:blur(22.9411773682px);justify-content:flex-start}.ModalContainer.Hidden{opacity:0 !important}.ModalContainer.Shown .TopBar{justify-content:flex-end;padding:0px}.ModalContainer .Title{font-weight:bold;font-size:1.2rem}.ModalContainer .Btns{display:flex;justify-content:space-evenly}.ModalContainer .PowupBtn{background:linear-gradient(49deg, var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.1019607843)) 33.61%, var(--emw--ingame-color-white50, rgba(255, 255, 255, 0.1019607843)) 89.19%);border:1px solid rgba(70, 69, 69, 0.5);border-radius:10px;padding:5px 15px;color:var(--emw--color-powup-light-green, #00FA5A);font-weight:bold;cursor:pointer}.ModalContainer .PowupBtn.Active{background:var(--emw--color-powup-light-green, #00FA5A);box-shadow:0px 0px 6px 10px var(--emw--ingame-color-white10, rgba(255, 255, 255, 0.1019607843));color:#0A0A17}";
6
+ const ActiveConfirmModalStyle0 = activeConfirmModalCss;
7
+
8
+ const ActiveConfirmModal = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.activePowerupEvent = createEvent(this, "activePowerupEvent", 7);
12
+ this.powerupId = undefined;
13
+ this.language = 'en';
14
+ this.isOpen = undefined;
15
+ }
16
+ activeNow() {
17
+ this.closeModal(this.powerupId);
18
+ }
19
+ closeModal(id) {
20
+ this.isOpen = false;
21
+ this.activePowerupEvent.emit({ id });
22
+ }
23
+ render() {
24
+ return h("div", { key: '68efb916139aa66bb559ece109864e2241f096c5', class: `ModalContainer ${this.isOpen ? 'Shown' : 'Hidden'}` }, h("div", { key: '55f46fa812d04c10cb35807aeaa9dd6701b9b6d9', class: 'TopBar' }, h("div", { key: '7daafa1b57f421052aecc6c64cadc8b4d439646a', class: 'IconBtn CircleLinearBorder', onClick: () => this.closeModal(), innerHTML: CloseSvg })), h("div", { key: 'cbb64eff123333949155bccf6856e674b93f412e', class: 'Title' }, translate('activeTitle', this.language)), h("div", { key: '69b64ab2f9809d0ca222e29d4157f76bd11cb9f4', class: 'ActivePowerupContent' }, translate("activeContent", this.language)), h("div", { key: 'fb2b80ab2ffbf16446de273744094e0e3c38ba69', class: 'Btns' }, h("div", { key: '6f421ad422d76ef2a6a8ec3b8096c32f001ace44', class: 'LaterBtn PowupBtn', onClick: () => this.closeModal() }, " ", translate('later', this.language), " "), h("div", { key: '22ac06fefcc50356616b5c16817833e2973ab3bb', class: 'Active PowupBtn', onClick: () => this.activeNow() }, " ", translate('activateNow', this.language), " ")));
25
+ }
26
+ };
27
+ ActiveConfirmModal.style = ActiveConfirmModalStyle0;
28
+
29
+ const TimeCount = class {
30
+ constructor(hostRef) {
31
+ registerInstance(this, hostRef);
32
+ this.timeCountDownEvent = createEvent(this, "powerupTimeCountDown", 7);
33
+ this.expireTime = undefined;
34
+ this.language = 'en';
35
+ this.mode = 'timePeriod';
36
+ this.inProgress = false;
37
+ this.leftRounds = undefined;
38
+ this.displayTime = undefined;
39
+ this.isExpireInDay1 = false;
40
+ this.timeLeft = undefined;
41
+ }
42
+ componentWillLoad() {
43
+ if (this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS) {
44
+ return;
45
+ }
46
+ this.timer = setInterval(() => this.updateDisplayTime(), 1000);
47
+ this.updateDisplayTime();
48
+ }
49
+ disconnectedCallback() {
50
+ clearInterval(this.timer);
51
+ }
52
+ timeLeftChanged() {
53
+ if (this.timeLeft > 0 || this.timeLeft < -10) { // it is a data error if timeLeft is negative
54
+ return;
55
+ }
56
+ this.timeCountDownEvent.emit({ type: 'powerupTimeCountDown', timeLeft: this.timeLeft });
57
+ }
58
+ startTimeChanged() {
59
+ if (this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS) {
60
+ return;
61
+ }
62
+ // Reset the timer and update the display when the input time changes
63
+ clearInterval(this.timer);
64
+ this.timer = setInterval(() => this.updateDisplayTime(), 1000);
65
+ this.updateDisplayTime();
66
+ }
67
+ updateDisplayTime() {
68
+ const now = hooks();
69
+ const start = hooks(this.expireTime);
70
+ if (!start.isValid()) {
71
+ this.displayTime = 'Invalid date';
72
+ clearInterval(this.timer);
73
+ return;
74
+ }
75
+ const duration = hooks.duration(start.diff(now));
76
+ this.isExpireInDay1 = true; //duration.asDays() > 1;
77
+ this.timeLeft = duration.asMinutes();
78
+ // If the time has already passed
79
+ if (duration.asMilliseconds() <= 0) {
80
+ this.displayTime = '00:00:00';
81
+ this.timeLeft = 0;
82
+ clearInterval(this.timer);
83
+ return;
84
+ }
85
+ const hours = Math.floor(duration.asHours());
86
+ if (hours >= 48) {
87
+ this.displayTime = `${Math.floor(duration.asDays())} ${translate('days', this.language)}`;
88
+ }
89
+ else if (hours >= 24) {
90
+ this.displayTime = '1 day';
91
+ }
92
+ else {
93
+ const h = hours;
94
+ const m = duration.minutes();
95
+ const s = duration.seconds();
96
+ this.displayTime = [h, m, s].map(val => String(val).padStart(2, '0')).join(':');
97
+ }
98
+ }
99
+ render() {
100
+ return [
101
+ this.inProgress &&
102
+ h("div", { key: '28ad398a10a6d917d62178b308660228a8e6909c', class: 'InprogressLabel' }, h("span", { key: 'b1717807c6ab470e9aaa9ae820179aed18821c56', class: 'Icon' }), translate('inProgress', this.language)),
103
+ this.isExpireInDay1 &&
104
+ h("span", { key: '8113731d28d1ab0df026f61557b1e35f0ea96f53', class: 'Label' }, translate(this.inProgress ? 'endsIn' : 'expiresIn', this.language), " "),
105
+ this.inProgress && this.mode === BoostingPeriodMode.NUMBER_OF_ROUNDS
106
+ ? h("span", { class: 'TimeCountDown' }, this.leftRounds, " ", translate('rounds', this.language))
107
+ : h("span", { class: 'TimeCountDown' }, this.displayTime)
108
+ ];
109
+ }
110
+ static get watchers() { return {
111
+ "timeLeft": ["timeLeftChanged"],
112
+ "expireTime": ["startTimeChanged"]
113
+ }; }
114
+ };
115
+
116
+ export { ActiveConfirmModal as active_confirm_modal, TimeCount as time_count };