@everymatrix/casino-engagement-suite-challenges-list 1.39.3 → 1.41.0

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 (24) hide show
  1. package/dist/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.esm.js +1 -1
  2. package/dist/casino-engagement-suite-challenges-list/p-05d09457.entry.js +1 -0
  3. package/dist/casino-engagement-suite-challenges-list/p-fad4589e.js +1 -0
  4. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.js +2 -2
  5. package/dist/cjs/casino-engagement-suite-challenges-list_2.cjs.entry.js +2325 -8
  6. package/dist/cjs/{index-1216b764.js → index-0a011384.js} +57 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.css +245 -1
  9. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +71 -4
  10. package/dist/collection/models/challenge.js +8 -0
  11. package/dist/collection/renders/ChallengesHistory.js +55 -0
  12. package/dist/collection/utils/locale.utils.js +13 -1
  13. package/dist/components/casino-engagement-suite-challenges-list.js +2316 -7
  14. package/dist/components/casino-engagement-suite-progress-bar2.js +16 -3
  15. package/dist/esm/casino-engagement-suite-challenges-list.js +2 -2
  16. package/dist/esm/casino-engagement-suite-challenges-list_2.entry.js +2325 -8
  17. package/dist/esm/{index-ae2f8404.js → index-ddf7e990.js} +57 -0
  18. package/dist/esm/loader.js +2 -2
  19. package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +13 -2
  20. package/dist/types/models/challenge.d.ts +24 -0
  21. package/dist/types/renders/ChallengesHistory.d.ts +6 -0
  22. package/package.json +1 -1
  23. package/dist/casino-engagement-suite-challenges-list/p-349891dd.js +0 -1
  24. package/dist/casino-engagement-suite-challenges-list/p-64e72a20.entry.js +0 -1
@@ -47,6 +47,40 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
47
47
  return false;
48
48
  })()
49
49
  ;
50
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
51
+ if (listeners) {
52
+ listeners.map(([flags, name, method]) => {
53
+ const target = getHostListenerTarget(elm, flags) ;
54
+ const handler = hostListenerProxy(hostRef, method);
55
+ const opts = hostListenerOpts(flags);
56
+ plt.ael(target, name, handler, opts);
57
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
58
+ });
59
+ }
60
+ };
61
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
62
+ try {
63
+ {
64
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
65
+ // instance is ready, let's call it's member method for this event
66
+ hostRef.$lazyInstance$[methodName](ev);
67
+ }
68
+ else {
69
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
70
+ }
71
+ }
72
+ }
73
+ catch (e) {
74
+ consoleError(e);
75
+ }
76
+ };
77
+ const getHostListenerTarget = (elm, flags) => {
78
+ if (flags & 8 /* TargetWindow */)
79
+ return win;
80
+ return elm;
81
+ };
82
+ // prettier-ignore
83
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
50
84
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
85
  const createTime = (fnName, tagName = '') => {
52
86
  {
@@ -647,6 +681,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
647
681
  const instance = hostRef.$lazyInstance$ ;
648
682
  let promise;
649
683
  if (isInitialLoad) {
684
+ {
685
+ hostRef.$flags$ |= 256 /* isListenReady */;
686
+ if (hostRef.$queuedListeners$) {
687
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
688
+ hostRef.$queuedListeners$ = null;
689
+ }
690
+ }
650
691
  {
651
692
  promise = safeCall(instance, 'componentWillLoad');
652
693
  }
@@ -1081,6 +1122,12 @@ const connectedCallback = (elm) => {
1081
1122
  initializeComponent(elm, hostRef, cmpMeta);
1082
1123
  }
1083
1124
  }
1125
+ else {
1126
+ // not the first time this has connected
1127
+ // reattach any event listeners to the host
1128
+ // since they would have been removed when disconnected
1129
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1130
+ }
1084
1131
  endConnected();
1085
1132
  }
1086
1133
  };
@@ -1088,6 +1135,12 @@ const disconnectedCallback = (elm) => {
1088
1135
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1089
1136
  const hostRef = getHostRef(elm);
1090
1137
  const instance = hostRef.$lazyInstance$ ;
1138
+ {
1139
+ if (hostRef.$rmListeners$) {
1140
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1141
+ hostRef.$rmListeners$ = undefined;
1142
+ }
1143
+ }
1091
1144
  {
1092
1145
  safeCall(instance, 'disconnectedCallback');
1093
1146
  }
@@ -1117,6 +1170,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1117
1170
  {
1118
1171
  cmpMeta.$members$ = compactMeta[2];
1119
1172
  }
1173
+ {
1174
+ cmpMeta.$listeners$ = compactMeta[3];
1175
+ }
1120
1176
  {
1121
1177
  cmpMeta.$attrsToReflect$ = [];
1122
1178
  }
@@ -1203,6 +1259,7 @@ const registerHost = (elm, cmpMeta) => {
1203
1259
  elm['s-p'] = [];
1204
1260
  elm['s-rc'] = [];
1205
1261
  }
1262
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1206
1263
  return hostRefs.set(elm, hostRef);
1207
1264
  };
1208
1265
  const isMemberInElement = (elm, memberName) => memberName in elm;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-1216b764.js');
5
+ const index = require('./index-0a011384.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"pausedChallengeIds":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]}],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
17
+ return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"pausedChallengeIds":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32],"activeTab":[32],"historyLoading":[32],"challengesHistory":[32],"openedHistoryIds":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"indeterminate":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,4 +1,3 @@
1
- @import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap");
2
1
  :host {
3
2
  display: block;
4
3
  font-family: inherit;
@@ -55,11 +54,13 @@ button:focus {
55
54
  line-height: 14px;
56
55
  }
57
56
 
57
+ .HistoryList,
58
58
  .ChallengesListWrapper {
59
59
  overflow-y: auto;
60
60
  -ms-overflow-style: none;
61
61
  scrollbar-width: none;
62
62
  }
63
+ .HistoryList::-webkit-scrollbar,
63
64
  .ChallengesListWrapper::-webkit-scrollbar {
64
65
  display: none;
65
66
  }
@@ -213,6 +214,161 @@ button:focus {
213
214
  position: absolute;
214
215
  }
215
216
 
217
+ .Tabs::after,
218
+ .HistoryCols::after,
219
+ .HistoryListItem.Opened .HistoryListItemBody::after {
220
+ content: "";
221
+ position: absolute;
222
+ bottom: 0;
223
+ left: 0;
224
+ width: 100%;
225
+ height: 1px;
226
+ background-color: var(--emw--color-typography, #FFF);
227
+ opacity: 0.1;
228
+ }
229
+
230
+ .TabsWrapper {
231
+ padding: 0 20px;
232
+ margin: 8px 0;
233
+ }
234
+ .TabsWrapper .Tabs {
235
+ display: flex;
236
+ position: relative;
237
+ }
238
+ .TabsWrapper .Tabs .Tab {
239
+ padding: 9px 16px 7px;
240
+ font-weight: 500;
241
+ font-size: 12px;
242
+ line-height: 15px;
243
+ color: var(--emw--color-background, #666178);
244
+ border-bottom: 2px solid transparent;
245
+ cursor: pointer;
246
+ }
247
+ .TabsWrapper .Tabs .Tab.Active {
248
+ color: var(--emw--color-typography, #FFF);
249
+ border-color: var(--emw--color-typography, #FFF);
250
+ }
251
+
252
+ .HistoryWrapper {
253
+ padding: 0 20px;
254
+ display: flex;
255
+ flex-direction: column;
256
+ height: 100%;
257
+ overflow: hidden;
258
+ }
259
+ .HistoryWrapper .HistoryEmptyMessage {
260
+ margin-top: 8px;
261
+ font-size: var(--emw--font-size-x-small, 14px);
262
+ color: var(--emw--color-gray-100, #BBB9C3);
263
+ line-height: 30px;
264
+ }
265
+ .HistoryWrapper .HistoryCols {
266
+ padding: 12px 0;
267
+ position: relative;
268
+ display: flex;
269
+ }
270
+ .HistoryWrapper .HistoryCols .HistoryColName {
271
+ padding: 0 5px;
272
+ font-size: var(--emw--font-size-x-small, 12px);
273
+ color: var(--emw--color-gray-100, #BBB9C3);
274
+ }
275
+ .HistoryWrapper .HistoryCols .HistoryColName.Level {
276
+ flex-basis: 90px;
277
+ }
278
+ .HistoryWrapper .HistoryCols .HistoryColName.Status {
279
+ flex-basis: 100px;
280
+ }
281
+ .HistoryWrapper .HistoryLoader {
282
+ display: flex;
283
+ flex-direction: column;
284
+ justify-content: center;
285
+ align-items: center;
286
+ height: inherit;
287
+ font-size: var(--emw--font-size-x-small, 12px);
288
+ color: var(--emw--color-primary, #8F8B9C);
289
+ }
290
+ .HistoryWrapper .HistoryLoader casino-engagement-suite-progress-bar {
291
+ margin-bottom: 8px;
292
+ width: 100px;
293
+ }
294
+ .HistoryWrapper .HistoryListItem {
295
+ margin-top: 8px;
296
+ }
297
+ .HistoryWrapper .HistoryListItem.Opened .HistoryListItemButton {
298
+ transform: rotate(180deg);
299
+ }
300
+ .HistoryWrapper .HistoryListItem.Opened .HistoryListItemBody {
301
+ padding-bottom: 8px;
302
+ grid-template-rows: 1fr;
303
+ }
304
+ .HistoryWrapper .HistoryListItem .HistoryListItemHeader {
305
+ padding: 16px 0;
306
+ display: flex;
307
+ justify-content: space-between;
308
+ align-items: center;
309
+ color: var(--emw--color-typography, #FFFFFF);
310
+ font-size: var(--emw--font-size-small, 14px);
311
+ }
312
+ .HistoryWrapper .HistoryListItem .HistoryListItemButton {
313
+ transition: transform 0.3s ease-out;
314
+ width: 16px;
315
+ height: 16px;
316
+ background: center/100% url(https://static.everymatrix.com/gic/img/engagement-suite/arrow-down.svg) no-repeat;
317
+ }
318
+ .HistoryWrapper .HistoryListItem .HistoryListItemBody {
319
+ position: relative;
320
+ display: grid;
321
+ grid-template-rows: 0fr;
322
+ transition: grid-template-rows 0.3s ease-out;
323
+ }
324
+ .HistoryWrapper .HistoryListItem .HistoryListItemBody > div {
325
+ overflow: hidden;
326
+ }
327
+ .HistoryWrapper .HistoryListItem .HistoryListItemLevelCard {
328
+ padding: 12px 0;
329
+ }
330
+ .HistoryWrapper .HistoryListItem .HistoryLevelInfo {
331
+ display: flex;
332
+ font-size: var(--emw--font-size-x-small, 12px);
333
+ color: var(--emw--color-gray-100, #BBB9C3);
334
+ }
335
+ .HistoryWrapper .HistoryListItem .HistoryLevelInfo .Level {
336
+ flex-basis: 70px;
337
+ }
338
+ .HistoryWrapper .HistoryListItem .HistoryLevelInfo .Time {
339
+ flex-grow: 1;
340
+ text-align: right;
341
+ }
342
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList {
343
+ margin-top: 8px;
344
+ display: flex;
345
+ flex-wrap: wrap;
346
+ gap: 8px;
347
+ align-items: center;
348
+ font-size: var(--emw--font-size-x-small, 10px);
349
+ font-weight: var(--emw--font-weight-bold, 700);
350
+ }
351
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardStatusIcon,
352
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsIcon {
353
+ height: 14px;
354
+ width: 14px;
355
+ }
356
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsItem {
357
+ display: flex;
358
+ align-items: center;
359
+ gap: 2px;
360
+ color: var(--emw--color-typography, #FFF);
361
+ }
362
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsItem .HistoryRewardStatusIcon {
363
+ background: center/100% url(https://static.everymatrix.com/gic/img/engagement-suite/check.svg) no-repeat;
364
+ }
365
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsItem.IsNotRewarded {
366
+ color: var(--emw--color-background, #666178);
367
+ }
368
+ .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsItem.IsNotRewarded .HistoryRewardStatusIcon {
369
+ background-image: url(https://static.everymatrix.com/gic/img/engagement-suite/close.svg);
370
+ }
371
+
216
372
  .ChallengesListPopup.Tablet .ChallengesListPopupHeader,
217
373
  .ChallengesListPopup.Desktop .ChallengesListPopupHeader {
218
374
  padding-top: 16px;
@@ -277,4 +433,92 @@ button:focus {
277
433
  .ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton {
278
434
  top: 24px;
279
435
  right: 24px;
436
+ }
437
+ .ChallengesListPopup.Tablet .TabsWrapper,
438
+ .ChallengesListPopup.Desktop .TabsWrapper {
439
+ padding: 0 24px;
440
+ margin: 20px 0;
441
+ }
442
+ .ChallengesListPopup.Tablet .TabsWrapper .Tabs .Tab,
443
+ .ChallengesListPopup.Desktop .TabsWrapper .Tabs .Tab {
444
+ font-size: var(--emw--font-size-small, 16px);
445
+ }
446
+ .ChallengesListPopup.Tablet .HistoryWrapper,
447
+ .ChallengesListPopup.Desktop .HistoryWrapper {
448
+ padding: 0 24px;
449
+ }
450
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryEmptyMessage,
451
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryEmptyMessage {
452
+ margin-top: 20px;
453
+ font-size: var(--emw--font-size-small, 16px);
454
+ line-height: 20px;
455
+ }
456
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryCols,
457
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryCols {
458
+ gap: 15px;
459
+ }
460
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryCols .HistoryColName,
461
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryCols .HistoryColName {
462
+ padding: 0 12px;
463
+ font-size: var(--emw--font-size-small, 16px);
464
+ }
465
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryCols .HistoryColName.Level,
466
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryCols .HistoryColName.Level {
467
+ flex-basis: 140px;
468
+ }
469
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryCols .HistoryColName.Status,
470
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryCols .HistoryColName.Status {
471
+ flex-basis: 200px;
472
+ }
473
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryLoader,
474
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryLoader {
475
+ font-size: var(--emw--font-size-small, 16px);
476
+ }
477
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryLoader casino-engagement-suite-progress-bar,
478
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryLoader casino-engagement-suite-progress-bar {
479
+ margin-bottom: 10px;
480
+ width: 150px;
481
+ }
482
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem,
483
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem {
484
+ margin-top: 20px;
485
+ }
486
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem.Opened .HistoryListItemBody,
487
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem.Opened .HistoryListItemBody {
488
+ padding-bottom: 24px;
489
+ }
490
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryListItemHeader,
491
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryListItemHeader {
492
+ padding: 17px 5px;
493
+ font-size: var(--emw--font-size-small, 16px);
494
+ }
495
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryListItemButton,
496
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryListItemButton {
497
+ width: 24px;
498
+ height: 24px;
499
+ }
500
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryListItemLevelCard,
501
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryListItemLevelCard {
502
+ padding: 12px;
503
+ }
504
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryLevelInfo,
505
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryLevelInfo {
506
+ font-size: var(--emw--font-size-small, 16px);
507
+ gap: 70px;
508
+ }
509
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryLevelInfo .Level,
510
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryLevelInfo .Level {
511
+ flex-basis: 80px;
512
+ }
513
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryRewardsList,
514
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryRewardsList {
515
+ margin-top: 12px;
516
+ gap: 12px;
517
+ font-size: var(--emw--font-size-small, 14px);
518
+ align-items: flex-end;
519
+ }
520
+ .ChallengesListPopup.Tablet .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsIcon,
521
+ .ChallengesListPopup.Desktop .HistoryWrapper .HistoryListItem .HistoryRewardsList .HistoryRewardsIcon {
522
+ height: 24px;
523
+ flex-basis: 24px;
280
524
  }
@@ -1,7 +1,8 @@
1
- import { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core';
1
+ import { Component, Element, Event, h, Listen, Prop, State, Watch } from '@stencil/core';
2
2
  import { ChallengeLevelProgressStatus, ChallengeProgressStatus } from '../../models/challenge';
3
3
  import { translate } from '../../utils/locale.utils';
4
4
  import '@everymatrix/casino-engagement-suite-progress-bar';
5
+ import { getChallengesHistoryTemplate, getHistoryLoaderTemplate } from '../../renders/ChallengesHistory';
5
6
  export class CasinoEngagementSuiteChallengesList {
6
7
  constructor() {
7
8
  /**
@@ -31,6 +32,9 @@ export class CasinoEngagementSuiteChallengesList {
31
32
  this.tooltip = false;
32
33
  this.timers = {};
33
34
  this.limitStylingAppends = false;
35
+ this.activeTab = 1;
36
+ this.historyLoading = false;
37
+ this.openedHistoryIds = [];
34
38
  this.setClientStyling = () => {
35
39
  let sheet = document.createElement('style');
36
40
  sheet.innerHTML = this.clientStyling;
@@ -49,6 +53,23 @@ export class CasinoEngagementSuiteChallengesList {
49
53
  console.log('Error ', err);
50
54
  });
51
55
  };
56
+ this.handleTabChange = (e) => {
57
+ this.activeTab = +(e.target.getAttribute('data-index'));
58
+ if (this.activeTab === 2) {
59
+ this.sendHistoryRequest();
60
+ }
61
+ };
62
+ this.toggleChallengeHistory = (ev) => {
63
+ const id = ev.currentTarget.getAttribute('data-id');
64
+ const index = this.openedHistoryIds.findIndex(historyId => historyId === id);
65
+ if (index > -1) {
66
+ this.openedHistoryIds.splice(index, 1);
67
+ }
68
+ else {
69
+ this.openedHistoryIds.push(id);
70
+ }
71
+ this.openedHistoryIds = [...this.openedHistoryIds];
72
+ };
52
73
  this.handleCloseClick = () => {
53
74
  this.close.emit();
54
75
  this.tooltip = false;
@@ -91,6 +112,13 @@ export class CasinoEngagementSuiteChallengesList {
91
112
  });
92
113
  };
93
114
  }
115
+ handleEvent(e) {
116
+ const { type } = e === null || e === void 0 ? void 0 : e.data;
117
+ if (type === 'ChallengesHistoryResponse') {
118
+ this.challengesHistory = e.data.data;
119
+ this.historyLoading = false;
120
+ }
121
+ }
94
122
  challengesPropHandler(value) {
95
123
  if (!this.interval && value.length) {
96
124
  this.updateTimers();
@@ -115,6 +143,12 @@ export class CasinoEngagementSuiteChallengesList {
115
143
  disconnectedCallback() {
116
144
  this.interval && clearInterval(this.interval);
117
145
  }
146
+ sendHistoryRequest() {
147
+ this.historyLoading = true;
148
+ window.postMessage({
149
+ type: 'ChallengesHistoryRequest'
150
+ });
151
+ }
118
152
  startCountdown() {
119
153
  this.interval = setInterval(() => {
120
154
  this.updateTimers();
@@ -226,7 +260,7 @@ export class CasinoEngagementSuiteChallengesList {
226
260
  h("button", { class: "ChallengesIconButton", onClick: this.handleCloseClick },
227
261
  h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close missions list" })));
228
262
  }
229
- getListTemplate() {
263
+ getListTabTemplate() {
230
264
  if (this.challenges.length) {
231
265
  return h("div", { class: "ChallengesListWrapper" },
232
266
  h("div", { class: "ChallengesList" }, this.challenges.map(challenge => this.getChallengeTemplate(challenge))));
@@ -244,10 +278,32 @@ export class CasinoEngagementSuiteChallengesList {
244
278
  h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })),
245
279
  translate('tooltip', this.language)));
246
280
  }
281
+ getHistoryTabTemplate() {
282
+ return h("div", { class: "HistoryWrapper" },
283
+ h("div", { class: "HistoryCols" },
284
+ h("div", { class: "HistoryColName Level" }, translate('level', this.language)),
285
+ h("div", { class: "HistoryColName Status" }, translate('status', this.language)),
286
+ h("div", { class: "HistoryColName Time" }, translate('time', this.language))),
287
+ this.historyLoading
288
+ ? getHistoryLoaderTemplate(this.language)
289
+ : getChallengesHistoryTemplate(this.challengesHistory, this.openedHistoryIds, this.toggleChallengeHistory, this.language));
290
+ }
291
+ getTabsTemplate() {
292
+ return h("div", { class: "TabsWrapper" },
293
+ h("div", { class: "Tabs" },
294
+ h("div", { "data-index": "1", onClick: this.handleTabChange, class: `Tab ${this.activeTab === 1 ? 'Active' : ''}` }, translate('missions', this.language)),
295
+ h("div", { "data-index": "2", onClick: this.handleTabChange, class: `Tab ${this.activeTab === 2 ? 'Active' : ''}` }, translate('history', this.language))));
296
+ }
297
+ getTabsContentTemplate() {
298
+ return this.activeTab === 1
299
+ ? this.getListTabTemplate()
300
+ : this.getHistoryTabTemplate();
301
+ }
247
302
  render() {
248
303
  return h("div", { class: `ChallengesListPopup ${this.device}` },
249
304
  this.getHeaderTemplate(),
250
- this.getListTemplate(),
305
+ this.getTabsTemplate(),
306
+ this.getTabsContentTemplate(),
251
307
  this.tooltip && this.getTooltipTemplate());
252
308
  }
253
309
  static get is() { return "casino-engagement-suite-challenges-list"; }
@@ -415,7 +471,11 @@ export class CasinoEngagementSuiteChallengesList {
415
471
  static get states() { return {
416
472
  "tooltip": {},
417
473
  "timers": {},
418
- "limitStylingAppends": {}
474
+ "limitStylingAppends": {},
475
+ "activeTab": {},
476
+ "historyLoading": {},
477
+ "challengesHistory": {},
478
+ "openedHistoryIds": {}
419
479
  }; }
420
480
  static get events() { return [{
421
481
  "method": "close",
@@ -453,4 +513,11 @@ export class CasinoEngagementSuiteChallengesList {
453
513
  "propName": "challenges",
454
514
  "methodName": "challengesPropHandler"
455
515
  }]; }
516
+ static get listeners() { return [{
517
+ "name": "message",
518
+ "method": "handleEvent",
519
+ "target": "window",
520
+ "capture": false,
521
+ "passive": false
522
+ }]; }
456
523
  }
@@ -1,3 +1,11 @@
1
+ export var ChallengeRewardType;
2
+ (function (ChallengeRewardType) {
3
+ ChallengeRewardType[ChallengeRewardType["FreeSpins"] = 0] = "FreeSpins";
4
+ ChallengeRewardType[ChallengeRewardType["LuckyWheel"] = 1] = "LuckyWheel";
5
+ ChallengeRewardType[ChallengeRewardType["Leaderboard"] = 2] = "Leaderboard";
6
+ ChallengeRewardType[ChallengeRewardType["Challenge"] = 3] = "Challenge";
7
+ ChallengeRewardType[ChallengeRewardType["Custom"] = 4] = "Custom";
8
+ })(ChallengeRewardType || (ChallengeRewardType = {}));
1
9
  export var ChallengeLevelProgressStatus;
2
10
  (function (ChallengeLevelProgressStatus) {
3
11
  ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
@@ -0,0 +1,55 @@
1
+ import { ChallengeRewardType } from '../models/challenge';
2
+ import { h } from '@stencil/core';
3
+ import { translate } from '../utils/locale.utils';
4
+ import { format } from 'date-fns';
5
+ export const getHistoryLoaderTemplate = (lang) => {
6
+ return h("div", { class: "HistoryLoader" },
7
+ h("casino-engagement-suite-progress-bar", { indeterminate: true }),
8
+ h("span", null, translate('loading', lang)));
9
+ };
10
+ const getRewardNameByType = (type, lang) => {
11
+ switch (type) {
12
+ case 0: return translate('freeSpins', lang);
13
+ case 1: return translate('luckyWheel', lang);
14
+ case 2: return translate('leaderboard', lang);
15
+ case 3: return translate('mission', lang);
16
+ }
17
+ };
18
+ export const getRewardTemplate = (reward, lang) => {
19
+ const isCustom = reward.Type === ChallengeRewardType.Custom;
20
+ const rewardName = isCustom ? reward.RewardDescription : getRewardNameByType(reward.Type, lang);
21
+ const isRewarded = isCustom || reward.IsRewarded;
22
+ return h("div", { class: `HistoryRewardsItem ${isRewarded || isCustom ? 'IsRewarded' : 'IsNotRewarded'}` },
23
+ h("span", { class: "HistoryRewardsItemName" }, rewardName),
24
+ !isCustom && h("div", { class: "HistoryRewardStatusIcon" }));
25
+ };
26
+ export const getHistoryLevelRewardsTemplate = (level, lang) => {
27
+ return h("div", { class: "HistoryRewardsList" },
28
+ h("img", { class: "HistoryRewardsIcon", src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-reward-list.svg", alt: "Reward" }),
29
+ Object.values(level.Rewards).map(reward => getRewardTemplate(reward, lang)));
30
+ };
31
+ export const getHistoryLevelTemplate = (level, index, lang) => {
32
+ return h("div", { class: "HistoryLevelInfo" },
33
+ h("span", { class: "Level" }, `${translate('level', lang)} ${index + 1}`),
34
+ h("span", { class: "Status" }, level.IsCompleted
35
+ ? translate('completed', lang)
36
+ : translate('expired', lang)),
37
+ h("span", { class: "Time" }, format(new Date(level.Time), 'LLL d, yyyy HH:mm:ss')));
38
+ };
39
+ export const getChallengesHistoryTemplate = (histories, openedHistoryIds, toggleChallengeHistory, lang) => {
40
+ if (histories.length === 0) {
41
+ return h("p", { class: "HistoryEmptyMessage" }, translate('noHistory', lang));
42
+ }
43
+ return h("div", { class: "HistoryList" }, histories.map((history) => {
44
+ return h("div", { key: history.ProgressId, class: `HistoryListItem ${openedHistoryIds.includes(history.ProgressId) ? 'Opened' : 'Closed'}` },
45
+ h("header", { class: "HistoryListItemHeader" },
46
+ history.Name,
47
+ h("button", { onClick: toggleChallengeHistory, "data-id": history.ProgressId, class: "HistoryListItemButton" })),
48
+ h("div", { class: "HistoryListItemBody" },
49
+ h("div", null, history.Levels.map((level, index) => {
50
+ return h("div", { class: "HistoryListItemLevelCard" },
51
+ getHistoryLevelTemplate(level, index, lang),
52
+ level.Rewards && getHistoryLevelRewardsTemplate(level, lang));
53
+ }))));
54
+ }));
55
+ };
@@ -8,7 +8,19 @@ const TRANSLATIONS = {
8
8
  new: 'new',
9
9
  noMissions: 'No Missions yet',
10
10
  tryOtherGames: 'Try winning Missions as rewards or launching other booster games',
11
- tooltip: 'Mission where your real money bets contribute towards the level progress to achieve the level reward'
11
+ tooltip: 'Mission where your real money bets contribute towards the level progress to achieve the level reward',
12
+ history: 'History',
13
+ level: 'Level',
14
+ status: 'Status',
15
+ time: 'Time',
16
+ loading: 'Loading...',
17
+ completed: 'Completed',
18
+ expired: 'Expired',
19
+ noHistory: 'No missions’ history available (last 30 days)',
20
+ freeSpins: 'Free Spins',
21
+ luckyWheel: 'Lucky Wheel',
22
+ leaderboard: 'Leaderboard',
23
+ mission: 'Mission'
12
24
  }
13
25
  };
14
26
  export const translate = (key, customLang) => {