@everymatrix/casino-challenge-details 0.22.32 → 0.22.34

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.
@@ -128,6 +128,9 @@ export class CasinoChallengeDetails {
128
128
  this.goBack();
129
129
  }
130
130
  }
131
+ else if (this.redirectIfNotFound) {
132
+ this.goBack();
133
+ }
131
134
  })
132
135
  .finally(() => {
133
136
  if (fetchId === this.currentFetchChallengeId) {
@@ -237,6 +240,10 @@ export class CasinoChallengeDetails {
237
240
  type: 'GoToDeposit'
238
241
  });
239
242
  };
243
+ this.showErrorToast = (message) => {
244
+ this.toast = { errored: true, message: message || translate('requestErrorMessage', this.language) };
245
+ setTimeout(() => (this.toast = null), 10000);
246
+ };
240
247
  this.handleActionButtonClick = async () => {
241
248
  var _a, _b, _c, _d, _e, _f, _g, _h;
242
249
  const isDepositTriggerType = (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Triggers) === null || _b === void 0 ? void 0 : _b.includes(EChallengeTriggerType.Deposit);
@@ -284,7 +291,11 @@ export class CasinoChallengeDetails {
284
291
  this.challenge.Status = EChallengeProgressStatus.Paused;
285
292
  }
286
293
  }
294
+ else {
295
+ this.showErrorToast(res.ErrorMessage);
296
+ }
287
297
  })
298
+ .catch(() => this.showErrorToast())
288
299
  .finally(() => (this.actionLoading = false));
289
300
  }
290
301
  }
@@ -662,14 +673,11 @@ export class CasinoChallengeDetails {
662
673
  };
663
674
  setTimeout(() => (this.toast = null), 10000);
664
675
  }
665
- else if (!res.Success) {
666
- this.toast = {
667
- errored: true,
668
- message: res.Message
669
- };
670
- setTimeout(() => (this.toast = null), 10000);
676
+ else {
677
+ this.showErrorToast(res.ErrorMessage);
671
678
  }
672
- });
679
+ })
680
+ .catch(() => this.showErrorToast());
673
681
  };
674
682
  this.mbSource = undefined;
675
683
  this.clientStyling = undefined;
@@ -906,13 +914,11 @@ export class CasinoChallengeDetails {
906
914
  window.postMessage({ type: 'GoToChallengesPage', tabIndex: EChallengesTabs.Active }, window.location.href);
907
915
  }
908
916
  else {
909
- this.toast = {
910
- errored: true,
911
- message: res.ErrorMessage
912
- };
917
+ this.showErrorToast(res.ErrorMessage);
913
918
  }
914
919
  return res;
915
920
  })
921
+ .catch(() => this.showErrorToast())
916
922
  .finally(() => {
917
923
  this.actionLoading = false;
918
924
  setTimeout(() => (this.toast = null), 10000);
@@ -999,7 +1005,7 @@ export class CasinoChallengeDetails {
999
1005
  return (h("casino-challenges-modal", { isOpen: this.isOptOutModalOpen, onClose: this.toggleOptOutModal(false), showBackdrop: true, showCloseButton: true }, h("div", { slot: "header" }, h("img", { class: "warning-icon", src: alertIcon, height: 21, width: 21 }), h("h2", { class: "modal-header-title" }, translate('optOutModalTitle', this.language))), h("div", { slot: "body" }, h("p", { class: "modal-body-description" }, translate('optOudModalDescription', this.language))), h("div", { class: "modal-footer", slot: "footer" }, h("button", { class: "modal-footer-button cancel", onClick: this.confirmOptOut }, translate('optOutModalConfirm', this.language)), h("button", { class: "modal-footer-button confirm", onClick: this.toggleOptOutModal(false) }, translate('optOutModalCancel', this.language)))));
1000
1006
  }
1001
1007
  render() {
1002
- return (h("div", { key: 'd04e81989cf2a0cbe116d6c5b45f7dbcf6efb972', ref: (el) => (this.stylingContainer = el), class: "container-wrapper" }, h("div", { key: '271208d56c7e182ae953679b27a900e3622a1642', class: "container" }, this.pageHeader(), this.loading ? (h("div", { class: "lds-dual-ring" })) : (h("div", null, h("button", { class: "back-button", onClick: this.goBack }, h("img", { class: "back-button__icon", src: backIcon }), this.getBackButtonText()), this.forfeitedNofitication(), this.completedNotification(), this.expiredNotification(), this.optedOutNofitication(), this.renderToast(), h("div", { class: "details" }, this.cardGeneralInfo(), h("div", { class: "details__tabs-container" }, this.challengeTabs(), this.challengeTabContent()), this.footer()))), this.renderOptOutModal())));
1008
+ return (h("div", { key: 'f4987327fc9395ffaa0f94a545968f068b24d32a', ref: (el) => (this.stylingContainer = el), class: "container-wrapper" }, h("div", { key: '209b73697f5e83cd214a511a9d5d86ba57a663ea', class: "container" }, this.pageHeader(), this.loading ? (h("div", { class: "lds-dual-ring" })) : (h("div", null, h("button", { class: "back-button", onClick: this.goBack }, h("img", { class: "back-button__icon", src: backIcon }), this.getBackButtonText()), this.forfeitedNofitication(), this.completedNotification(), this.expiredNotification(), this.optedOutNofitication(), this.renderToast(), h("div", { class: "details" }, this.cardGeneralInfo(), h("div", { class: "details__tabs-container" }, this.challengeTabs(), this.challengeTabContent()), this.footer()))), this.renderOptOutModal())));
1003
1009
  }
1004
1010
  static get is() { return "casino-challenge-details"; }
1005
1011
  static get encapsulation() { return "shadow"; }
@@ -38,6 +38,7 @@ const TRANSLATIONS = {
38
38
  claimByButton: 'Claim',
39
39
  claimDescription: 'Click Claim button to unlock the Challenge',
40
40
  grantClaimByButtonSuccessMessage: 'Challenge has been triggered successfully and is now available on the Active tab',
41
+ requestErrorMessage: 'Something went wrong. Please try again.',
41
42
  launchGame: 'Launch Game',
42
43
  launchDescription: 'Launch any game from the Games tab to unlock the Challenge',
43
44
  depositAmountDescription: 'to unlock the Challenge',
@@ -158,6 +158,7 @@ const TRANSLATIONS = {
158
158
  claimByButton: 'Claim',
159
159
  claimDescription: 'Click Claim button to unlock the Challenge',
160
160
  grantClaimByButtonSuccessMessage: 'Challenge has been triggered successfully and is now available on the Active tab',
161
+ requestErrorMessage: 'Something went wrong. Please try again.',
161
162
  launchGame: 'Launch Game',
162
163
  launchDescription: 'Launch any game from the Games tab to unlock the Challenge',
163
164
  depositAmountDescription: 'to unlock the Challenge',
@@ -3775,6 +3776,9 @@ const CasinoChallengeDetails = class {
3775
3776
  this.goBack();
3776
3777
  }
3777
3778
  }
3779
+ else if (this.redirectIfNotFound) {
3780
+ this.goBack();
3781
+ }
3778
3782
  })
3779
3783
  .finally(() => {
3780
3784
  if (fetchId === this.currentFetchChallengeId) {
@@ -3884,6 +3888,10 @@ const CasinoChallengeDetails = class {
3884
3888
  type: 'GoToDeposit'
3885
3889
  });
3886
3890
  };
3891
+ this.showErrorToast = (message) => {
3892
+ this.toast = { errored: true, message: message || translate('requestErrorMessage', this.language) };
3893
+ setTimeout(() => (this.toast = null), 10000);
3894
+ };
3887
3895
  this.handleActionButtonClick = async () => {
3888
3896
  var _a, _b, _c, _d, _e, _f, _g, _h;
3889
3897
  const isDepositTriggerType = (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Triggers) === null || _b === void 0 ? void 0 : _b.includes(EChallengeTriggerType.Deposit);
@@ -3931,7 +3939,11 @@ const CasinoChallengeDetails = class {
3931
3939
  this.challenge.Status = EChallengeProgressStatus.Paused;
3932
3940
  }
3933
3941
  }
3942
+ else {
3943
+ this.showErrorToast(res.ErrorMessage);
3944
+ }
3934
3945
  })
3946
+ .catch(() => this.showErrorToast())
3935
3947
  .finally(() => (this.actionLoading = false));
3936
3948
  }
3937
3949
  }
@@ -4307,14 +4319,11 @@ const CasinoChallengeDetails = class {
4307
4319
  };
4308
4320
  setTimeout(() => (this.toast = null), 10000);
4309
4321
  }
4310
- else if (!res.Success) {
4311
- this.toast = {
4312
- errored: true,
4313
- message: res.Message
4314
- };
4315
- setTimeout(() => (this.toast = null), 10000);
4322
+ else {
4323
+ this.showErrorToast(res.ErrorMessage);
4316
4324
  }
4317
- });
4325
+ })
4326
+ .catch(() => this.showErrorToast());
4318
4327
  };
4319
4328
  this.mbSource = undefined;
4320
4329
  this.clientStyling = undefined;
@@ -4551,13 +4560,11 @@ const CasinoChallengeDetails = class {
4551
4560
  window.postMessage({ type: 'GoToChallengesPage', tabIndex: EChallengesTabs.Active }, window.location.href);
4552
4561
  }
4553
4562
  else {
4554
- this.toast = {
4555
- errored: true,
4556
- message: res.ErrorMessage
4557
- };
4563
+ this.showErrorToast(res.ErrorMessage);
4558
4564
  }
4559
4565
  return res;
4560
4566
  })
4567
+ .catch(() => this.showErrorToast())
4561
4568
  .finally(() => {
4562
4569
  this.actionLoading = false;
4563
4570
  setTimeout(() => (this.toast = null), 10000);
@@ -4644,7 +4651,7 @@ const CasinoChallengeDetails = class {
4644
4651
  return (h("casino-challenges-modal", { isOpen: this.isOptOutModalOpen, onClose: this.toggleOptOutModal(false), showBackdrop: true, showCloseButton: true }, h("div", { slot: "header" }, h("img", { class: "warning-icon", src: alertSvg, height: 21, width: 21 }), h("h2", { class: "modal-header-title" }, translate('optOutModalTitle', this.language))), h("div", { slot: "body" }, h("p", { class: "modal-body-description" }, translate('optOudModalDescription', this.language))), h("div", { class: "modal-footer", slot: "footer" }, h("button", { class: "modal-footer-button cancel", onClick: this.confirmOptOut }, translate('optOutModalConfirm', this.language)), h("button", { class: "modal-footer-button confirm", onClick: this.toggleOptOutModal(false) }, translate('optOutModalCancel', this.language)))));
4645
4652
  }
4646
4653
  render() {
4647
- return (h("div", { key: 'd04e81989cf2a0cbe116d6c5b45f7dbcf6efb972', ref: (el) => (this.stylingContainer = el), class: "container-wrapper" }, h("div", { key: '271208d56c7e182ae953679b27a900e3622a1642', class: "container" }, this.pageHeader(), this.loading ? (h("div", { class: "lds-dual-ring" })) : (h("div", null, h("button", { class: "back-button", onClick: this.goBack }, h("img", { class: "back-button__icon", src: backArrowSvg }), this.getBackButtonText()), this.forfeitedNofitication(), this.completedNotification(), this.expiredNotification(), this.optedOutNofitication(), this.renderToast(), h("div", { class: "details" }, this.cardGeneralInfo(), h("div", { class: "details__tabs-container" }, this.challengeTabs(), this.challengeTabContent()), this.footer()))), this.renderOptOutModal())));
4654
+ return (h("div", { key: 'f4987327fc9395ffaa0f94a545968f068b24d32a', ref: (el) => (this.stylingContainer = el), class: "container-wrapper" }, h("div", { key: '209b73697f5e83cd214a511a9d5d86ba57a663ea', class: "container" }, this.pageHeader(), this.loading ? (h("div", { class: "lds-dual-ring" })) : (h("div", null, h("button", { class: "back-button", onClick: this.goBack }, h("img", { class: "back-button__icon", src: backArrowSvg }), this.getBackButtonText()), this.forfeitedNofitication(), this.completedNotification(), this.expiredNotification(), this.optedOutNofitication(), this.renderToast(), h("div", { class: "details" }, this.cardGeneralInfo(), h("div", { class: "details__tabs-container" }, this.challengeTabs(), this.challengeTabContent()), this.footer()))), this.renderOptOutModal())));
4648
4655
  }
4649
4656
  static get watchers() { return {
4650
4657
  "clientStyling": ["handleClientStylingChange"],
@@ -1,5 +1,5 @@
1
- import { E as EChallengeProgressLevelStatus, a as EChallengeStatus, b as EChallengeProgressStatus, t as translate, s as setClientStyling, c as setClientStylingURL, d as setStreamStyling } from './casino-challenge-details-3854d3ba.js';
2
- export { C as casino_challenge_details } from './casino-challenge-details-3854d3ba.js';
1
+ import { E as EChallengeProgressLevelStatus, a as EChallengeStatus, b as EChallengeProgressStatus, t as translate, s as setClientStyling, c as setClientStylingURL, d as setStreamStyling } from './casino-challenge-details-0ae391a0.js';
2
+ export { C as casino_challenge_details } from './casino-challenge-details-0ae391a0.js';
3
3
  import { r as registerInstance, h, g as getElement, H as Host, c as createEvent } from './index-a44346bc.js';
4
4
 
5
5
  const activeChevronSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMC40MTA4MjYgMC45MTEwN0MwLjczNjI2MyAwLjU4NTYzMyAxLjI2MzkgMC41ODU2MzMgMS41ODkzNCAwLjkxMTA3TDYuMDAwMDggNS4zMjE4MUwxMC40MTA4IDAuOTExMDdDMTAuNzM2MyAwLjU4NTYzMyAxMS4yNjM5IDAuNTg1NjMzIDExLjU4OTMgMC45MTEwN0MxMS45MTQ4IDEuMjM2NTEgMTEuOTE0OCAxLjc2NDE0IDExLjU4OTMgMi4wODk1OEw2LjU4OTM0IDcuMDg5NThDNi4yNjM5IDcuNDE1MDIgNS43MzYyNiA3LjQxNTAyIDUuNDEwODMgNy4wODk1OEwwLjQxMDgyNiAyLjA4OTU4QzAuMDg1Mzg4OCAxLjc2NDE0IDAuMDg1Mzg4OCAxLjIzNjUxIDAuNDEwODI2IDAuOTExMDdaIiBmaWxsPSIjMDBCNzRGIi8+Cjwvc3ZnPgo=';
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { C as CasinoChallengeDetails } from './casino-challenge-details-3854d3ba.js';
1
+ export { C as CasinoChallengeDetails } from './casino-challenge-details-0ae391a0.js';
2
2
  import './index-a44346bc.js';
@@ -123,6 +123,7 @@ export declare class CasinoChallengeDetails {
123
123
  private checkAttrs;
124
124
  private openLoginRegisterModal;
125
125
  private openDepositPage;
126
+ private showErrorToast;
126
127
  grantClaimByButton(): Promise<any>;
127
128
  private handleActionButtonClick;
128
129
  private fetchGames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-challenge-details",
3
- "version": "0.22.32",
3
+ "version": "0.22.34",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",