@everymatrix/casino-challenges-overlay 0.17.103 → 0.17.105

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 (31) hide show
  1. package/dist/casino-challenges-overlay/casino-challenge-details-events_23.entry.js +1 -0
  2. package/dist/casino-challenges-overlay/casino-challenges-overlay-ef3af896.js +1 -0
  3. package/dist/casino-challenges-overlay/casino-challenges-overlay.esm.js +1 -1
  4. package/dist/casino-challenges-overlay/index-b4a452f5.js +2 -0
  5. package/dist/casino-challenges-overlay/index.esm.js +1 -1
  6. package/dist/cjs/casino-challenge-details-events_23.cjs.entry.js +5574 -0
  7. package/dist/cjs/{casino-challenges-overlay-929886ef.js → casino-challenges-overlay-79eca2f8.js} +77 -49
  8. package/dist/cjs/casino-challenges-overlay.cjs.js +2 -2
  9. package/dist/cjs/{index-d610a063.js → index-6300a889.js} +305 -11
  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 +41 -0
  13. package/dist/collection/components/casino-challenges-overlay/casino-challenges-overlay.css +2 -3
  14. package/dist/collection/components/casino-challenges-overlay/casino-challenges-overlay.js +86 -54
  15. package/dist/collection/utils/locale.utils.js +1 -0
  16. package/dist/collection/utils/types.js +14 -0
  17. package/dist/esm/casino-challenge-details-events_23.entry.js +5549 -0
  18. package/dist/esm/{casino-challenges-overlay-cfb57143.js → casino-challenges-overlay-ef3af896.js} +77 -49
  19. package/dist/esm/casino-challenges-overlay.js +3 -3
  20. package/dist/esm/{index-be60b13e.js → index-b4a452f5.js} +303 -12
  21. package/dist/esm/index.js +2 -2
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/casino-challenges-overlay/casino-challenges-overlay.d.ts +12 -8
  24. package/dist/types/components.d.ts +11 -3
  25. package/dist/types/utils/types.d.ts +17 -0
  26. package/package.json +1 -1
  27. package/dist/casino-challenges-overlay/casino-challenges-overlay-cfb57143.js +0 -1
  28. package/dist/casino-challenges-overlay/casino-challenges-overlay_2.entry.js +0 -1
  29. package/dist/casino-challenges-overlay/index-be60b13e.js +0 -2
  30. package/dist/cjs/casino-challenges-overlay_2.cjs.entry.js +0 -249
  31. package/dist/esm/casino-challenges-overlay_2.entry.js +0 -245
@@ -4,11 +4,11 @@ import bgIcon from "../../assets/bg-icon.svg";
4
4
  import bellIcon from "../../assets/bell.svg";
5
5
  import giftIcon from "../../assets/gift.svg";
6
6
  import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
7
- import { EChallengeProgressLevelStatus, EChallengeProgressStatus, EChallengeRewardType } from "../../utils/types";
7
+ import { EChallengeProgressLevelStatus, EChallengeProgressStatus, EChallengeRewardType, EChallengesTabs } from "../../utils/types";
8
8
  import "../../../../../casino-challenges-overlay-modal/dist/types/index";
9
+ import "../../../../../casino-challenges-overlay-drawer/dist/types/index";
9
10
  export class CasinoChallengesOverlay {
10
11
  constructor() {
11
- this.activeChallengesTabIndex = 1;
12
12
  this.updateChallengesArray = (challengeId, isEnabled, isExpired) => {
13
13
  this.challenges = this.challenges.map((challenge) => {
14
14
  if (challenge.ChallengeId !== challengeId) {
@@ -29,28 +29,42 @@ export class CasinoChallengesOverlay {
29
29
  this.modalIsFreeSpinsGranted = false;
30
30
  this.modalBonusProgramGames = [];
31
31
  };
32
- this.goToDetailsPage = () => {
33
- window.parent.postMessage({
34
- type: 'GoToDetailsPage',
35
- info: {
36
- challengeId: this.activeChallenge,
37
- activeChallengesTabIndex: this.activeChallengesTabIndex
38
- }
39
- }, '*');
32
+ this.handleClick = () => {
33
+ var _a;
34
+ if (this.extendedIngameWidget) {
35
+ this.showDrawer = true;
36
+ return;
37
+ }
38
+ if (this.inProgressCount > 0 && ((_a = this.activeChallenge) === null || _a === void 0 ? void 0 : _a.ChallengeId)) {
39
+ window.parent.postMessage({
40
+ type: 'GoToDetailsPage',
41
+ info: {
42
+ challengeId: this.activeChallenge.ChallengeId,
43
+ activeChallengesTabIndex: EChallengesTabs.Active
44
+ }
45
+ }, '*');
46
+ }
47
+ else {
48
+ window.postMessage({ type: 'GoToChallengesPage', tab: EChallengesTabs.Promo }, '*');
49
+ }
40
50
  };
51
+ this.closeDrawer = () => {
52
+ this.showDrawer = false;
53
+ };
54
+ this.isActiveChallenge = ({ Status }) => Status === EChallengeProgressStatus.Started || Status === EChallengeProgressStatus.Paused;
41
55
  this.mbSource = undefined;
42
56
  this.clientStyling = undefined;
43
57
  this.clientStylingUrl = undefined;
44
58
  this.translationUrl = '';
45
59
  this.language = 'en';
46
60
  this.challenges = undefined;
61
+ this.extendedIngameWidget = false;
47
62
  this.progress = 0;
48
- this.isGrayed = false;
49
63
  this.isNew = false;
50
64
  this.isGift = false;
51
65
  this.isNotification = false;
52
66
  this.inProgressCount = 0;
53
- this.activeChallenge = '';
67
+ this.activeChallenge = undefined;
54
68
  this.completedLevelId = '';
55
69
  this.prevUpdateEvent = undefined;
56
70
  this.showModal = false;
@@ -60,6 +74,7 @@ export class CasinoChallengesOverlay {
60
74
  this.modalOrderNumber = 1;
61
75
  this.modalIsFreeSpinsGranted = false;
62
76
  this.modalBonusProgramGames = [];
77
+ this.showDrawer = false;
63
78
  }
64
79
  handleClientStylingChange(newValue, oldValue) {
65
80
  if (newValue != oldValue) {
@@ -90,8 +105,7 @@ export class CasinoChallengesOverlay {
90
105
  if (level.ProgressStatus === EChallengeProgressLevelStatus.InProgress) {
91
106
  if (level.ProgressPercentage >= maxPercentage) {
92
107
  maxPercentage = level.ProgressPercentage;
93
- this.activeChallenge = challenge.ChallengeId;
94
- this.isGrayed = false;
108
+ this.activeChallenge = challenge;
95
109
  }
96
110
  }
97
111
  }
@@ -178,17 +192,15 @@ export class CasinoChallengesOverlay {
178
192
  break;
179
193
  }
180
194
  case 'ChangeChallengeProgressStatus': {
181
- const currentProgress = (_g = this.challenges) === null || _g === void 0 ? void 0 : _g.find((x) => (x === null || x === void 0 ? void 0 : x.ChallengeId) === this.activeChallenge);
182
- this.challenges = (_h = this.challenges) === null || _h === void 0 ? void 0 : _h.map((x) => {
183
- if (this.isGrayed &&
184
- this.inProgressCount === 1 &&
185
- currentProgress &&
186
- (currentProgress === null || currentProgress === void 0 ? void 0 : currentProgress.Id) !== (data === null || data === void 0 ? void 0 : data.ChallengeProgressId) &&
187
- (currentProgress === null || currentProgress === void 0 ? void 0 : currentProgress.Id) === x.Id) {
188
- return Object.assign(Object.assign({}, x), { Status: EChallengeProgressStatus.Forfeited });
189
- }
190
- return x.Id === (data === null || data === void 0 ? void 0 : data.ChallengeProgressId) ? Object.assign(Object.assign({}, x), { Status: data === null || data === void 0 ? void 0 : data.ChallengeProgressStatus }) : x;
191
- });
195
+ this.challenges = (_g = this.challenges) === null || _g === void 0 ? void 0 : _g.map((x) => x.Id === (data === null || data === void 0 ? void 0 : data.ChallengeProgressId) ? Object.assign(Object.assign({}, x), { Status: data === null || data === void 0 ? void 0 : data.ChallengeProgressStatus }) : x);
196
+ break;
197
+ }
198
+ case 'NewChallengeProgressGranted': {
199
+ const newChallenge = data;
200
+ if ((_h = this.challenges) === null || _h === void 0 ? void 0 : _h.some((x) => x.Id === (newChallenge === null || newChallenge === void 0 ? void 0 : newChallenge.Id)))
201
+ break;
202
+ this.challenges = [...this.challenges, newChallenge];
203
+ break;
192
204
  }
193
205
  }
194
206
  }
@@ -211,31 +223,17 @@ export class CasinoChallengesOverlay {
211
223
  return false;
212
224
  }
213
225
  handleStatusEvent(data, isExpired) {
226
+ var _a;
214
227
  const isChallengeExist = this.challenges.find((challenge) => challenge.ChallengeId === (data === null || data === void 0 ? void 0 : data.ChallengeId));
215
228
  if (!isChallengeExist) {
216
229
  return;
217
230
  }
218
- if ((data === null || data === void 0 ? void 0 : data.ChallengeId) === this.activeChallenge && !(data === null || data === void 0 ? void 0 : data.IsEnabled)) {
231
+ if ((data === null || data === void 0 ? void 0 : data.ChallengeId) === ((_a = this.activeChallenge) === null || _a === void 0 ? void 0 : _a.ChallengeId) && !(data === null || data === void 0 ? void 0 : data.IsEnabled)) {
219
232
  this.isNotification = true;
220
- if (this.inProgressCount === 1) {
221
- this.statusTimeoutId = setTimeout(() => {
222
- if ((data === null || data === void 0 ? void 0 : data.ChallengeId) === this.activeChallenge) {
223
- if (this.inProgressCount === 1) {
224
- this.isGrayed = true;
225
- }
226
- else {
227
- this.updateChallengesArray(data === null || data === void 0 ? void 0 : data.ChallengeId, data === null || data === void 0 ? void 0 : data.IsEnabled, isExpired);
228
- }
229
- }
230
- this.isNotification = false;
231
- }, 10000);
232
- }
233
- else if (this.inProgressCount > 1) {
234
- this.statusTimeoutId = setTimeout(() => {
235
- this.updateChallengesArray(data === null || data === void 0 ? void 0 : data.ChallengeId, data === null || data === void 0 ? void 0 : data.IsEnabled, isExpired);
236
- this.isNotification = false;
237
- }, 10000);
238
- }
233
+ this.statusTimeoutId = setTimeout(() => {
234
+ this.updateChallengesArray(data === null || data === void 0 ? void 0 : data.ChallengeId, data === null || data === void 0 ? void 0 : data.IsEnabled, isExpired);
235
+ this.isNotification = false;
236
+ }, 10000);
239
237
  }
240
238
  else {
241
239
  this.updateChallengesArray(data === null || data === void 0 ? void 0 : data.ChallengeId, data === null || data === void 0 ? void 0 : data.IsEnabled, isExpired);
@@ -245,6 +243,13 @@ export class CasinoChallengesOverlay {
245
243
  if (this.translationUrl) {
246
244
  resolveTranslationUrl(this.translationUrl);
247
245
  }
246
+ if (!document.getElementById('cherry-bomb-font')) {
247
+ const link = document.createElement('link');
248
+ link.id = 'cherry-bomb-font';
249
+ link.rel = 'stylesheet';
250
+ link.href = 'https://fonts.googleapis.com/css2?family=Cherry+Bomb+One&display=swap';
251
+ document.head.appendChild(link);
252
+ }
248
253
  }
249
254
  componentDidLoad() {
250
255
  if (this.stylingContainer) {
@@ -365,16 +370,25 @@ export class CasinoChallengesOverlay {
365
370
  */
366
371
  async init(config) {
367
372
  this.challenges = config.challenges;
373
+ this.extendedIngameWidget = String(config === null || config === void 0 ? void 0 : config.extendedIngameWidget).toLowerCase() === 'true';
368
374
  }
369
375
  render() {
376
+ var _a, _b, _c;
370
377
  const currProgress = this.completedLevelId ? 100 : this.progress;
371
378
  const dot = this.getCapsuleDotPosition(currProgress);
372
- return (h("div", { key: '639d5d2272af4364490409a540e8a43b860aa21e', ref: (el) => (this.stylingContainer = el) }, this.inProgressCount > 0 && (h("div", { key: '1908b6c7642a44c845b5835a530c755de5a66ddb', class: "container", onClick: this.goToDetailsPage }, h("div", { key: '27119842af3826143d1b1c092dfbc822265a12f1', class: `circle ${this.isGrayed ? 'grayed' : ''}`, style: {
379
+ const hasActiveProgress = this.inProgressCount > 0;
380
+ const activeProgressId = hasActiveProgress
381
+ ? (_a = this.activeChallenge) === null || _a === void 0 ? void 0 : _a.Id
382
+ : (_c = (_b = this.challenges) === null || _b === void 0 ? void 0 : _b.find(this.isActiveChallenge)) === null || _c === void 0 ? void 0 : _c.Id;
383
+ return (h("div", { key: '018163dcf771c05058f5031cd8cfc280821967c3', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '2371f5fde52da2459ec2a8bd3d07b8a63212de00', class: "container", onClick: this.handleClick }, h("div", { key: '3db9cf35ccd29acefe7df6cadbfb129c896669dd', class: "circle", style: {
373
384
  '--progress': `${currProgress}%`
374
- } }, h("img", { key: '52467d911cc7934708605b2c4ba8f284c7c2268d', class: "circle__img", src: bgIcon }), h("div", { key: '6b53bb87e026fdc18b72f35e9feb24f3ed640d19', class: "circle__content" }, h("span", { key: '1bcf879a911b0032c59c9972ae3197315cec4cfb' }, Math.floor(currProgress), "%")), dot && (h("div", { key: '6377568c12a5c0999a46f8320f27249d2d3c9efa', class: "dot", style: {
385
+ } }, h("img", { key: '8ef7b99fc1ef49fde9616283b7bdfb21dcc175ba', class: "circle__img", src: bgIcon }), h("div", { key: '31211661c353641b9f81810c395ab23d069919ce', class: "circle__content" }, hasActiveProgress ? (h("span", null, Math.floor(currProgress), "%")) : (h("span", null, translate('join', this.language)))), dot && (h("div", { key: '5ee00b99b0ad5abe5d7c0d38a2e3cb5bfede3d81', class: "dot", style: {
375
386
  left: `${dot.x}px`,
376
387
  top: `${dot.y}px`
377
- } }))), !this.isGrayed && h("div", { key: '98744b4743572ea10e578bf595c0b6df690d0afe', class: `badge ${this.isNew ? 'new' : ''}` }, this.renderBadgeContent()))), h("casino-challenges-overlay-modal", { key: '1f91b25bd3b4538cdd16312741e2c8b62bd57607', isOpen: this.showModal, handleClick: this.closeModal, reward: this.modalReward, addition: this.modalAddition, isFreeSpinsGranted: this.modalIsFreeSpinsGranted, bonusProgramGames: this.modalBonusProgramGames, errored: this.modalErrored, orderNumber: this.modalOrderNumber, translationUrl: this.translationUrl, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl })));
388
+ } }))), hasActiveProgress && (h("div", { key: '016411269e205666af6a0ee8b5213e313715a9e7', class: {
389
+ badge: true,
390
+ new: this.isNew
391
+ } }, this.renderBadgeContent()))), h("casino-challenges-overlay-modal", { key: 'c5b6a2cf21e7a3828c22bb05342c0d0258448c16', isOpen: this.showModal, handleClick: this.closeModal, reward: this.modalReward, addition: this.modalAddition, isFreeSpinsGranted: this.modalIsFreeSpinsGranted, bonusProgramGames: this.modalBonusProgramGames, errored: this.modalErrored, orderNumber: this.modalOrderNumber, translationUrl: this.translationUrl, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl }), this.extendedIngameWidget && (h("casino-challenges-overlay-drawer", { key: '932823367fae1026297948d0ac85fbb449f96265', mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, translationUrl: this.translationUrl, language: this.language, isOpen: this.showDrawer, handleClose: this.closeDrawer, challenges: this.challenges, initialProgressId: activeProgressId }))));
378
392
  }
379
393
  static get is() { return "casino-challenges-overlay"; }
380
394
  static get encapsulation() { return "shadow"; }
@@ -497,13 +511,30 @@ export class CasinoChallengesOverlay {
497
511
  "tags": [],
498
512
  "text": "User challenges list"
499
513
  }
514
+ },
515
+ "extendedIngameWidget": {
516
+ "type": "boolean",
517
+ "mutable": false,
518
+ "complexType": {
519
+ "original": "boolean",
520
+ "resolved": "boolean",
521
+ "references": {}
522
+ },
523
+ "required": false,
524
+ "optional": false,
525
+ "docs": {
526
+ "tags": [],
527
+ "text": "Extended widget version feature flag"
528
+ },
529
+ "attribute": "extended-ingame-widget",
530
+ "reflect": true,
531
+ "defaultValue": "false"
500
532
  }
501
533
  };
502
534
  }
503
535
  static get states() {
504
536
  return {
505
537
  "progress": {},
506
- "isGrayed": {},
507
538
  "isNew": {},
508
539
  "isGift": {},
509
540
  "isNotification": {},
@@ -517,17 +548,18 @@ export class CasinoChallengesOverlay {
517
548
  "modalAddition": {},
518
549
  "modalOrderNumber": {},
519
550
  "modalIsFreeSpinsGranted": {},
520
- "modalBonusProgramGames": {}
551
+ "modalBonusProgramGames": {},
552
+ "showDrawer": {}
521
553
  };
522
554
  }
523
555
  static get methods() {
524
556
  return {
525
557
  "init": {
526
558
  "complexType": {
527
- "signature": "(config: { challenges: IChallenge[]; }) => Promise<void>",
559
+ "signature": "(config: ICasinoChallengesOverlayInitProps) => Promise<void>",
528
560
  "parameters": [{
529
561
  "name": "config",
530
- "type": "{ challenges: IChallenge[]; }",
562
+ "type": "ICasinoChallengesOverlayInitProps",
531
563
  "docs": ""
532
564
  }],
533
565
  "references": {
@@ -535,10 +567,10 @@ export class CasinoChallengesOverlay {
535
567
  "location": "global",
536
568
  "id": "global::Promise"
537
569
  },
538
- "IChallenge": {
570
+ "ICasinoChallengesOverlayInitProps": {
539
571
  "location": "import",
540
572
  "path": "../../utils/types",
541
- "id": "../../../../packages/stencil/casino-challenges-overlay/src/utils/types.ts::IChallenge"
573
+ "id": "../../../../packages/stencil/casino-challenges-overlay/src/utils/types.ts::ICasinoChallengesOverlayInitProps"
542
574
  }
543
575
  },
544
576
  "return": "Promise<void>"
@@ -3,6 +3,7 @@ const DEFAULT_LANGUAGE = 'en';
3
3
  export const TRANSLATIONS = {
4
4
  en: {
5
5
  new: 'new',
6
+ join: 'Join',
6
7
  // casino-challenges-overlay-modal
7
8
  congrats: 'Congratulations!',
8
9
  continue: 'Continue',
@@ -34,9 +34,23 @@ export var EChallengeProgressStatus;
34
34
  EChallengeProgressStatus[EChallengeProgressStatus["Awaiting"] = 6] = "Awaiting";
35
35
  EChallengeProgressStatus[EChallengeProgressStatus["Paused"] = 7] = "Paused";
36
36
  })(EChallengeProgressStatus || (EChallengeProgressStatus = {}));
37
+ export var EChallengesTabs;
38
+ (function (EChallengesTabs) {
39
+ EChallengesTabs[EChallengesTabs["Promo"] = 0] = "Promo";
40
+ EChallengesTabs[EChallengesTabs["Active"] = 1] = "Active";
41
+ EChallengesTabs[EChallengesTabs["Pending"] = 2] = "Pending";
42
+ EChallengesTabs[EChallengesTabs["Finished"] = 3] = "Finished";
43
+ EChallengesTabs[EChallengesTabs["Code"] = 4] = "Code";
44
+ })(EChallengesTabs || (EChallengesTabs = {}));
37
45
  export var EChallengeLevelTargetType;
38
46
  (function (EChallengeLevelTargetType) {
39
47
  EChallengeLevelTargetType[EChallengeLevelTargetType["Accumulative"] = 0] = "Accumulative";
40
48
  EChallengeLevelTargetType[EChallengeLevelTargetType["SingleBet"] = 1] = "SingleBet";
41
49
  EChallengeLevelTargetType[EChallengeLevelTargetType["MultipleOneBetSize"] = 2] = "MultipleOneBetSize";
42
50
  })(EChallengeLevelTargetType || (EChallengeLevelTargetType = {}));
51
+ export var EContributedFrom;
52
+ (function (EContributedFrom) {
53
+ EContributedFrom[EContributedFrom["Casino"] = 0] = "Casino";
54
+ EContributedFrom[EContributedFrom["Any"] = 1] = "Any";
55
+ EContributedFrom[EContributedFrom["Sportsbook"] = 2] = "Sportsbook";
56
+ })(EContributedFrom || (EContributedFrom = {}));