@everymatrix/casino-engagement-suite-tournament 1.60.1 → 1.61.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 (51) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +1 -1
  3. package/dist/casino-engagement-suite-tournament/{p-10e1f844.entry.js → p-2dd35709.entry.js} +1 -1
  4. package/dist/casino-engagement-suite-tournament/p-2de8ee45.js +15 -0
  5. package/dist/casino-engagement-suite-tournament/{p-7dd52ef4.js → p-bfca9e2a.js} +2 -2
  6. package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +2 -2
  7. package/dist/cjs/{casino-engagement-suite-tournament-9276045b.js → casino-engagement-suite-tournament-49cebf14.js} +163 -55
  8. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +2 -2
  9. package/dist/cjs/{index-9b5a5304.js → index-982cd594.js} +5 -1
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/assets/reward.svg +11 -0
  13. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +135 -32
  14. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +67 -9
  15. package/dist/collection/shared/icons.js +2 -1
  16. package/dist/collection/shared/renders.dialog.js +2 -2
  17. package/dist/collection/shared/renders.page.js +11 -9
  18. package/dist/collection/shared/renders.tab.js +4 -2
  19. package/dist/collection/shared/renders.util.js +3 -4
  20. package/dist/collection/utils/api.apdater.js +1 -1
  21. package/dist/collection/utils/bussiness.js +15 -0
  22. package/dist/collection/utils/message.js +37 -20
  23. package/dist/collection/utils/translations.js +1 -1
  24. package/dist/collection/utils/types.js +1 -0
  25. package/dist/collection/utils/utils.js +38 -1
  26. package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +2 -2
  27. package/dist/esm/{casino-engagement-suite-tournament-e9186545.js → casino-engagement-suite-tournament-bd7c9cdd.js} +163 -55
  28. package/dist/esm/casino-engagement-suite-tournament.js +3 -3
  29. package/dist/esm/{index-e8e1e68e.js → index-ac437a77.js} +5 -1
  30. package/dist/esm/index.js +2 -2
  31. package/dist/esm/loader.js +3 -3
  32. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
  33. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +2 -0
  34. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +24 -9
  35. package/dist/types/utils/api.apdater.d.ts +3 -1
  36. package/dist/types/utils/bussiness.d.ts +15 -1
  37. package/dist/types/utils/message.d.ts +4 -1
  38. package/dist/types/utils/translations.d.ts +2 -0
  39. package/dist/types/utils/types.d.ts +21 -3
  40. package/dist/types/utils/utils.d.ts +6 -0
  41. package/package.json +1 -1
  42. package/dist/casino-engagement-suite-tournament/p-94a5935e.js +0 -15
  43. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +0 -2
  44. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +0 -2
  45. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/libs/common/src/storybook/storybook-utils.d.ts +0 -0
  46. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/storybook/main.d.ts +0 -0
  47. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/storybook/preview.d.ts +0 -0
  48. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/tools/plugins/index.d.ts +0 -0
  49. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  50. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  51. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -1,13 +1,27 @@
1
1
  import { leaderboardsAdapter, tournamentAdapter } from "./api.apdater";
2
2
  import { getMaxRankStr } from "./bussiness";
3
- import { LeaderboardPage } from "./types";
3
+ import { DialogType } from "./types";
4
4
  export const messageSender = {
5
+ InitTournamentList: (queryParams) => {
6
+ window.postMessage(Object.assign({ type: 'InitTournamentList' }, queryParams));
7
+ },
8
+ post: (options) => {
9
+ window.postMessage(Object.assign({}, options));
10
+ },
5
11
  UpdateSuiteBarState: (labels) => window.postMessage({ type: 'UpdateLeaderboardState', labels }),
6
- JoinTournamentReq: (tournament) => { var _a, _b; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_b = (_a = tournament.wallets) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code }); },
12
+ JoinTournamentReq: (tournament) => {
13
+ var _a, _b;
14
+ return window.postMessage({
15
+ type: 'JoinTournamentReq',
16
+ id: tournament.id,
17
+ bonusCode: tournament.id || ((_b = (_a = tournament.wallets) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code)
18
+ });
19
+ },
7
20
  UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
8
21
  UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
9
22
  UpdateLeaderboardsReq: (tournament, query) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id, query }),
10
- UpdateLeaderboardsPlayerReq: () => window.postMessage({ type: 'UpdateLeaderboardsPlayerReq' })
23
+ UpdateLeaderboardsPlayerReq: () => window.postMessage({ type: 'UpdateLeaderboardsPlayerReq' }),
24
+ GameClickReq: (game) => window.postMessage({ type: 'EngagementSuiteGameRedirect', data: { Slug: game.slug } }),
11
25
  };
12
26
  export const messageReceiver = (instance) => {
13
27
  const receiver = {
@@ -23,15 +37,13 @@ export const messageReceiver = (instance) => {
23
37
  instance.tournamentItem = tournamentNew;
24
38
  updateTournamentListByItem(instance, tournamentNew);
25
39
  },
26
- UpdateLeaderboardsRes: (rest) => {
27
- instance.leaderboards = leaderboardsAdapter(rest.data);
28
- },
40
+ UpdateLeaderboardsRes: (rest) => processLeaderboardTableData(instance, rest),
29
41
  JoinTournamentRes: (rest) => commonJoinRes(instance, rest),
30
42
  UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest),
31
43
  // listen to LeaderboardLiveEvent event, handle update
32
44
  LeaderboardLiveEvent: (rest) => {
33
45
  handleLeaderboardLiveEvent(instance, rest);
34
- }
46
+ },
35
47
  };
36
48
  return receiver;
37
49
  };
@@ -109,25 +121,30 @@ const handleLeaderboardLiveEvent = (instance, rest) => {
109
121
  }
110
122
  }
111
123
  };
124
+ const showErrorMessage = (instance, type) => {
125
+ instance.dialog = Object.assign(Object.assign({}, instance.dialog), { isOpen: true, type });
126
+ };
112
127
  const commonJoinRes = (instance, rest) => {
113
- const { success } = rest;
114
- if (success) {
115
- instance.tournamentItem = Object.assign(Object.assign({}, instance.tournamentItem), { isPlayerAcknowledged: !!!instance.tournamentItem.isPlayerAcknowledged });
116
- switch (instance.page) {
117
- case LeaderboardPage.item: {
118
- break;
119
- }
120
- case LeaderboardPage.list: {
121
- updateTournamentListByItem(instance, instance.tournamentItem);
122
- break;
123
- }
124
- }
128
+ const { success, data } = rest;
129
+ let tournamentIdx = instance.tournamentList.findIndex((tournament) => tournament.id === (data.tournamentId || data.id || data.bonusCode)), current = instance.tournamentList[tournamentIdx];
130
+ current.isActionJoinPending = false;
131
+ if (!success) {
132
+ instance.tournamentList[tournamentIdx] = current;
133
+ instance.tournamentList = [...instance.tournamentList];
134
+ showErrorMessage(instance, DialogType.error);
135
+ return;
125
136
  }
137
+ current = Object.assign(Object.assign({}, current), { isUnjoined: current.isPlayerAcknowledged ? true : false, isPlayerAcknowledged: !!!current.isPlayerAcknowledged });
138
+ instance.tournamentList[tournamentIdx] = current;
139
+ instance.tournamentList = [...instance.tournamentList];
126
140
  if (instance.nextPage) {
127
141
  instance.setPage(instance.nextPage);
128
142
  instance.nextPage = undefined;
129
143
  }
130
- instance.isActionJoinPending = false;
144
+ };
145
+ const processLeaderboardTableData = (instance, rest) => {
146
+ instance.leaderboards = leaderboardsAdapter(rest.data);
147
+ instance.currentPlyerRank = rest.data.item ? rest.data.item.rank : -1;
131
148
  };
132
149
  const updateTournamentListByItem = (instance, tournament) => {
133
150
  instance.tournamentList = instance.tournamentList.map((_tournament) => {
@@ -24,4 +24,4 @@ export const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'J
24
24
  Tile: 'Congratulations!',
25
25
  Description: 'You won <span>{tournamentName}</span>!',
26
26
  ButtonContinue: 'Continue'
27
- }, NoLeaderboards: 'No Leaderboards yet', NoLeaderboardsTip: 'Try winning tickets to Leaderboards as rewards or launching other booster games', Leaderboards: 'Leaderboards', TipPrize: 'You took <span>{place}</span> place and win <span>{prize}</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.', TournamentNotStarted: 'The leaderboard is not started yet. <br> It will start in {startTime}.', BeOne: 'No winners for the time being. Be one of them!' });
27
+ }, NoLeaderboards: 'No Leaderboards yet', NoLeaderboardsTip: 'Try winning tickets to Leaderboards as rewards or launching other booster games', Leaderboards: 'Leaderboards', TipPrize: 'You took <span>{place}</span> place and win <span>{prize}</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.', TournamentNotStarted: 'The leaderboard is not started yet. <br> It will start in {startTime}.', BeOne: 'No winners for the time being. Be one of them!', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' });
@@ -15,4 +15,5 @@ export var DialogType;
15
15
  DialogType["unjoin"] = "unjoin";
16
16
  DialogType["tip"] = "tip";
17
17
  DialogType["gift"] = "gift";
18
+ DialogType["error"] = "error";
18
19
  })(DialogType || (DialogType = {}));
@@ -1,5 +1,5 @@
1
1
  export const classnames = (...args) => {
2
- let classnameArray = [];
2
+ let classnameArray = ['Tab'];
3
3
  args.map((arg) => {
4
4
  switch (typeof arg) {
5
5
  case 'string':
@@ -48,3 +48,40 @@ export const truncateNumber = (value, decimals, isInteger = false) => {
48
48
  // Return string representation with fixed decimals to preserve trailing zeros
49
49
  return truncated.toFixed(decimals);
50
50
  };
51
+ /**
52
+ * custom rules for component types
53
+ */
54
+ export const isMobile = () => {
55
+ let userAgent = window.navigator.userAgent;
56
+ return !!(userAgent.toLowerCase().match(/android/i) ||
57
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
58
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
59
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
60
+ };
61
+ export const getDevice = () => {
62
+ let userAgent = window.navigator.userAgent;
63
+ if (userAgent.toLowerCase().match(/android/i)) {
64
+ return 'Android';
65
+ }
66
+ if (userAgent.toLowerCase().match(/iphone/i)) {
67
+ return 'iPhone';
68
+ }
69
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
70
+ return 'iPad';
71
+ }
72
+ return 'PC';
73
+ };
74
+ export const getDevicePlatform = () => {
75
+ const device = getDevice();
76
+ if (device) {
77
+ if (device === 'PC') {
78
+ return 'dk';
79
+ }
80
+ else if (device === 'iPad' || device === 'iPhone') {
81
+ return 'ios';
82
+ }
83
+ else {
84
+ return 'mtWeb';
85
+ }
86
+ }
87
+ };
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, g as getElement } from './index-e8e1e68e.js';
2
- export { C as casino_engagement_suite_tournament } from './casino-engagement-suite-tournament-e9186545.js';
1
+ import { r as registerInstance, h, g as getElement } from './index-ac437a77.js';
2
+ export { C as casino_engagement_suite_tournament } from './casino-engagement-suite-tournament-bd7c9cdd.js';
3
3
  import '@everymatrix/general-animation-loading/dist';
4
4
 
5
5
  const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:var(--emw--font-size-small, 14px);line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-gray-300, #666178);border-radius:var(--emw--border-radius-small, 4px);position:relative;overflow:hidden}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:var(--emw--border-radius-small, 4px);background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));transition:width ease-out 0.3s}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-x-small, 12px);line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-gray-300, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";