@everymatrix/casino-engagement-suite-container 1.72.1 → 1.72.2
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.
- package/dist/casino-engagement-suite-container/casino-engagement-suite-bar_17.entry.js +1 -1
- package/dist/casino-engagement-suite-container/casino-engagement-suite-container.esm.js +1 -1
- package/dist/casino-engagement-suite-container/tournament-item-title_2.entry.js +1 -1
- package/dist/casino-engagement-suite-container/tournament-item.entry.js +1 -1
- package/dist/casino-engagement-suite-container/util.date-bda58828.js +15 -0
- package/dist/casino-engagement-suite-container/utils-25141486.js +1 -0
- package/dist/cjs/casino-engagement-suite-bar_17.cjs.entry.js +30 -24
- package/dist/cjs/casino-engagement-suite-container.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tournament-item-title_2.cjs.entry.js +5 -5
- package/dist/cjs/tournament-item.cjs.entry.js +3 -3
- package/dist/cjs/{util.date-40f8083f.js → util.date-785bd504.js} +88 -1
- package/dist/cjs/utils-22119cc1.js +55 -0
- package/dist/esm/casino-engagement-suite-bar_17.entry.js +19 -13
- package/dist/esm/casino-engagement-suite-container.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tournament-item-title_2.entry.js +5 -5
- package/dist/esm/tournament-item.entry.js +3 -3
- package/dist/esm/{util.date-5e8800dd.js → util.date-bda58828.js} +86 -2
- package/dist/esm/utils-25141486.js +51 -0
- package/package.json +1 -1
- package/dist/casino-engagement-suite-container/util.date-5e8800dd.js +0 -15
- package/dist/casino-engagement-suite-container/utils-7de165b6.js +0 -1
- package/dist/cjs/utils-5e0824b8.js +0 -88
- package/dist/esm/utils-7de165b6.js +0 -82
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from './index-58fe1cb7.js';
|
|
2
|
-
import { c as classnames } from './utils-
|
|
2
|
+
import { c as classnames } from './utils-25141486.js';
|
|
3
3
|
|
|
4
4
|
/*! *****************************************************************************
|
|
5
5
|
Copyright (c) Microsoft Corporation.
|
|
@@ -28,6 +28,90 @@ function __rest(s, e) {
|
|
|
28
28
|
return t;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
var Tab;
|
|
32
|
+
(function (Tab) {
|
|
33
|
+
Tab["info"] = "info";
|
|
34
|
+
Tab["leaderboard"] = "leaderboard";
|
|
35
|
+
Tab["games"] = "games";
|
|
36
|
+
})(Tab || (Tab = {}));
|
|
37
|
+
var Time;
|
|
38
|
+
(function (Time) {
|
|
39
|
+
Time["Starts"] = "Starts";
|
|
40
|
+
Time["Ends"] = "Ends";
|
|
41
|
+
})(Time || (Time = {}));
|
|
42
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
43
|
+
const SUPPORTED_LANGUAGES = ['en', 'zh'];
|
|
44
|
+
const localePostprocess = (translationText, props) => {
|
|
45
|
+
Object.keys(props).map((key) => {
|
|
46
|
+
translationText = translationText.replace(`{${key}}`, props[key]);
|
|
47
|
+
});
|
|
48
|
+
return translationText;
|
|
49
|
+
};
|
|
50
|
+
const TRANSLATIONS = {
|
|
51
|
+
en: Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Places: 'places', Prizes: 'Rewards', Player: 'Player', Rank: 'Rank', Score: 'Score', Prize: 'Prize', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
|
|
52
|
+
Title: 'Quit Leaderboard?',
|
|
53
|
+
Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
|
|
54
|
+
ButtonYes: 'Yes, I want to quit leaderboard',
|
|
55
|
+
ButtonNo: 'No, Stay on the leaderboard'
|
|
56
|
+
}, WinDialog: {
|
|
57
|
+
Title: 'Congratulations!',
|
|
58
|
+
Description: 'You won <span>{rewards}</span>!',
|
|
59
|
+
ButtonContinue: 'Continue',
|
|
60
|
+
FailedTitle: 'Reward cannot be issued',
|
|
61
|
+
FailedDescription: 'Please contact support.',
|
|
62
|
+
FailedButtonContinue: 'Ok, continue',
|
|
63
|
+
}, 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>', TipPrizeWithoutReward: 'You took <span>{place}</span> place</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!', NoGameConfiged: 'No game configed', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' }),
|
|
64
|
+
zh: {
|
|
65
|
+
Join: '加入',
|
|
66
|
+
Unjoin: '取消',
|
|
67
|
+
info: '信息',
|
|
68
|
+
leaderboard: '排行榜',
|
|
69
|
+
games: '游戏',
|
|
70
|
+
Starts: '开始',
|
|
71
|
+
Ends: '结束',
|
|
72
|
+
TC: '条款与条件',
|
|
73
|
+
ScoreCriteria: '积分规则',
|
|
74
|
+
MinimumBetCriteria: '最低投注要求',
|
|
75
|
+
Place: '名次',
|
|
76
|
+
Places: '名次',
|
|
77
|
+
Prizes: '奖励',
|
|
78
|
+
Player: '玩家',
|
|
79
|
+
Rank: '排名',
|
|
80
|
+
Score: '积分',
|
|
81
|
+
Prize: '奖品',
|
|
82
|
+
LeaderboardDetails: '排行榜详情',
|
|
83
|
+
UnjoinDialog: {
|
|
84
|
+
Title: '退出排行榜?',
|
|
85
|
+
Description: '当前排行榜的进度将不会被保留,且您无法再次加入该排行榜。 <br /><br />您确定要退出吗?',
|
|
86
|
+
ButtonYes: '是的,我要退出排行榜',
|
|
87
|
+
ButtonNo: '不,留在排行榜'
|
|
88
|
+
},
|
|
89
|
+
WinDialog: {
|
|
90
|
+
Title: '恭喜!',
|
|
91
|
+
Description: '您赢得了 <span>{rewards}</span>!',
|
|
92
|
+
ButtonContinue: '继续',
|
|
93
|
+
FailedTitle: '奖励无法发放',
|
|
94
|
+
FailedDescription: '请联系客服。',
|
|
95
|
+
FailedButtonContinue: '好的,继续'
|
|
96
|
+
},
|
|
97
|
+
NoLeaderboards: '暂无排行榜',
|
|
98
|
+
NoLeaderboardsTip: '尝试通过赢得奖品或启动其他增强游戏来获得排行榜',
|
|
99
|
+
Leaderboards: '排行榜',
|
|
100
|
+
TipPrize: '您获得 <span>{place}</span> 名,并赢得 <span>{prize}</span>',
|
|
101
|
+
TipPrizeWithoutReward: '您获得 <span>{place}</span> 名',
|
|
102
|
+
Tip: '您的真实资金投注将计入排行榜积分计算,以赢得排行榜奖励。',
|
|
103
|
+
TournamentNotStarted: '排行榜尚未开始。 <br> 它将在 {startTime} 开始。',
|
|
104
|
+
BeOne: '目前暂无赢家。成为其中之一!',
|
|
105
|
+
NoGameConfiged: '没有配置游戏',
|
|
106
|
+
FailedToJoin: '哦哦!发生了一些意外错误,请再试一次。',
|
|
107
|
+
FailedToUnjoin: '哦哦!发生了一些意外错误,请再试一次。'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const translate = (key, customLang) => {
|
|
111
|
+
const lang = customLang;
|
|
112
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
113
|
+
};
|
|
114
|
+
|
|
31
115
|
var LeaderboardPage;
|
|
32
116
|
(function (LeaderboardPage) {
|
|
33
117
|
LeaderboardPage["list"] = "list";
|
|
@@ -133,4 +217,4 @@ function getTimeDifference(startDate, endDate, progress = 0) {
|
|
|
133
217
|
return `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(min).padStart(2, '0')}m`;
|
|
134
218
|
}
|
|
135
219
|
|
|
136
|
-
export { DialogType as D, LeaderboardPage as L, __rest as _, getRewardNameByType as a, getTimeDifference as b,
|
|
220
|
+
export { DialogType as D, LeaderboardPage as L, Tab as T, __rest as _, getRewardNameByType as a, getTimeDifference as b, TRANSLATIONS as c, isTournamentEnded as d, DEFAULT_PAGE_SIZE as e, getProgress as f, getMaxRankStr as g, formatDate as h, isTournamentClosed as i, localePostprocess as l, renderGradientRoundedButton as r, translate as t };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const classnames = (...args) => {
|
|
2
|
+
let classnameArray = ['Tab'];
|
|
3
|
+
args.map((arg) => {
|
|
4
|
+
switch (typeof arg) {
|
|
5
|
+
case 'string':
|
|
6
|
+
classnameArray.push(arg);
|
|
7
|
+
break;
|
|
8
|
+
case 'object':
|
|
9
|
+
Object.keys(arg).map((k) => {
|
|
10
|
+
if (arg[k]) {
|
|
11
|
+
classnameArray.push(k);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return classnameArray.join(' ');
|
|
18
|
+
};
|
|
19
|
+
const getNewItems = (newList, oldList, getCondition) => {
|
|
20
|
+
return newList.filter(newItem => !oldList.some(oldItem => getCondition(newItem, oldItem)));
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Truncate number to specified decimal places (without rounding)
|
|
24
|
+
* @param {number|string} value - The number to be truncated, can be number or string
|
|
25
|
+
* @param {number} decimals - Number of decimal places to truncate to
|
|
26
|
+
* @returns {string|number} - Truncated value, returns string to preserve trailing zeros if has decimals, otherwise returns number
|
|
27
|
+
* @param {boolean} isInteger - Whether to force return integer
|
|
28
|
+
*/
|
|
29
|
+
const truncateNumber = (value, decimals, isInteger = false) => {
|
|
30
|
+
// Try to convert input to number
|
|
31
|
+
const numValue = Number(value);
|
|
32
|
+
// Check if valid number
|
|
33
|
+
if (isNaN(numValue)) {
|
|
34
|
+
throw new Error('Input must be a valid number or string that can be converted to number');
|
|
35
|
+
}
|
|
36
|
+
if (isInteger && !numValue.toString().includes('.')) {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
// When decimals is 0, return integer part directly
|
|
40
|
+
if (decimals === 0) {
|
|
41
|
+
return Math.floor(numValue);
|
|
42
|
+
}
|
|
43
|
+
// Calculate factor for given decimal places
|
|
44
|
+
const factor = Math.pow(10, decimals);
|
|
45
|
+
// Multiply by factor, truncate integer part, then divide by factor
|
|
46
|
+
const truncated = Math.floor(numValue * factor) / factor;
|
|
47
|
+
// Return string representation with fixed decimals to preserve trailing zeros
|
|
48
|
+
return truncated.toFixed(decimals);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { classnames as c, getNewItems as g, truncateNumber as t };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{h as n}from"./index-58fe1cb7.js";import{c as t}from"./utils-7de165b6.js";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function e(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(n);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(n,r[a])&&(e[r[a]]=n[r[a]])}return e}var r,a,i,s;!function(n){n.list="list",n.item="item"}(r||(r={})),function(n){n.Running="Running",n.Unstarted="Unstarted",n.Closed="Closed",n.Closing="Closing"}(a||(a={})),function(n){n.FreeSpin="FreeSpin",n.Mission="Challenge",n.Leaderboard="TournamentTicket",n.Custom="Custom",n.LuckyWheel="PrizeEngine"}(i||(i={})),function(n){n.unjoin="unjoin",n.tip="tip",n.gift="gift",n.error="error"}(s||(s={}));const o=0,u=n=>{let t=null;return(n||[]).map((n=>{var e;const{leaderBoard:{rank:r}}=n;r&&(t=!t||(null===(e=t.leaderBoard)||void 0===e?void 0:e.rank)>r?n:t)})),{rank:t?`${t.leaderBoard.rank} / ${t.endRank}`:"-",detail:t?{playerRank:t.leaderBoard.rank,total:t.endRank}:null}},c=n=>[a.Closed].includes(n.state),l=n=>[a.Closed,a.Closing].includes(n.state),d=n=>{switch(n.type){case i.FreeSpin:return n.campaignName;case i.Mission:return n.challengeName;case i.Leaderboard:return n.ticketProgramName;case i.LuckyWheel:return n.prizeEngineProgramName;case i.Custom:return n.value;default:return n.name}},f=r=>{var{statedClasses:a,innerHTML:i}=r,s=e(r,["statedClasses","innerHTML"]);const{isHollow:o,isPending:u}=a;return n("button",Object.assign({class:t("GradientRoundedButton","GradientRounded",{Hollow:o||!1,Pending:u||!1})},s),n("span",null,i))};function g(n){return n.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).replace(" at",",")}function m(n,t){return(new Date).getTime()>=t.getTime()?100:Math.floor(100*((new Date).getTime()-n.getTime())/(t.getTime()-n.getTime()))}function h(n,t,e=0){const r=Math.abs(t.getTime()-n.getTime()),a=Math.floor(r/864e5),i=Math.floor(r%864e5/36e5),s=Math.floor(r%36e5/6e4),o=100===e?0:0===s?1:s;return`${String(a).padStart(2,"0")}d:${String(i).padStart(2,"0")}h:${String(o).padStart(2,"0")}m`}export{s as D,r as L,e as _,d as a,h as b,l as c,o as d,m as e,g as f,u as g,c as i,f as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e,a;!function(e){e.info="info",e.leaderboard="leaderboard",e.games="games"}(e||(e={})),function(e){e.Starts="Starts",e.Ends="Ends"}(a||(a={}));const t=(e,a)=>(Object.keys(a).map((t=>{e=e.replace(`{${t}}`,a[t])})),e),r=Object.assign(Object.assign(Object.assign({Join:"Join",Unjoin:"Unjoin"},e),a),{TC:"Terms & Conditions",ScoreCriteria:"Score Criteria",MinimumBetCriteria:"Minimum bet criteria",Place:"place",Places:"places",Prizes:"Rewards",LeaderboardDetails:"Leaderboard Details",UnjoinDialog:{Title:"Quit Leaderboard?",Description:"Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?",ButtonYes:"Yes, I want to quit leaderboard",ButtonNo:"No, Stay on the leaderboard"},WinDialog:{Title:"Congratulations!",Description:"You won <span>{rewards}</span>!",ButtonContinue:"Continue",FailedTitle:"Reward cannot be issued",FailedDescription:"Please contact support.",FailedButtonContinue:"Ok, continue"},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>",TipPrizeWithoutReward:"You took <span>{place}</span> place</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!",NoGameConfiged:"No game configed",FailedToJoin:"Oops! some unexpected error happened, please try it again.",FailedToUnjoin:"Oops! some unexpected error happened, please try it again."}),o=(...e)=>{let a=["Tab"];return e.map((e=>{switch(typeof e){case"string":a.push(e);break;case"object":Object.keys(e).map((t=>{e[t]&&a.push(t)}))}})),a.join(" ")},n=(e,a,t)=>e.filter((e=>!a.some((a=>t(e,a))))),i=(e,a,t=!1)=>{const r=Number(e);if(isNaN(r))throw new Error("Input must be a valid number or string that can be converted to number");if(t&&!r.toString().includes("."))return e;if(0===a)return Math.floor(r);const o=Math.pow(10,a);return(Math.floor(r*o)/o).toFixed(a)};export{e as T,r as a,o as c,n as g,t as l,i as t}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.Tab = void 0;
|
|
4
|
-
(function (Tab) {
|
|
5
|
-
Tab["info"] = "info";
|
|
6
|
-
Tab["leaderboard"] = "leaderboard";
|
|
7
|
-
Tab["games"] = "games";
|
|
8
|
-
})(exports.Tab || (exports.Tab = {}));
|
|
9
|
-
var Time;
|
|
10
|
-
(function (Time) {
|
|
11
|
-
Time["Starts"] = "Starts";
|
|
12
|
-
Time["Ends"] = "Ends";
|
|
13
|
-
})(Time || (Time = {}));
|
|
14
|
-
const localePostprocess = (translationText, props) => {
|
|
15
|
-
Object.keys(props).map((key) => {
|
|
16
|
-
translationText = translationText.replace(`{${key}}`, props[key]);
|
|
17
|
-
});
|
|
18
|
-
return translationText;
|
|
19
|
-
};
|
|
20
|
-
const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, exports.Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Places: 'places', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
|
|
21
|
-
Title: 'Quit Leaderboard?',
|
|
22
|
-
Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
|
|
23
|
-
ButtonYes: 'Yes, I want to quit leaderboard',
|
|
24
|
-
ButtonNo: 'No, Stay on the leaderboard'
|
|
25
|
-
}, WinDialog: {
|
|
26
|
-
Title: 'Congratulations!',
|
|
27
|
-
Description: 'You won <span>{rewards}</span>!',
|
|
28
|
-
ButtonContinue: 'Continue',
|
|
29
|
-
FailedTitle: 'Reward cannot be issued',
|
|
30
|
-
FailedDescription: 'Please contact support.',
|
|
31
|
-
FailedButtonContinue: 'Ok, continue',
|
|
32
|
-
}, 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>', TipPrizeWithoutReward: 'You took <span>{place}</span> place</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!', NoGameConfiged: 'No game configed', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' });
|
|
33
|
-
|
|
34
|
-
const classnames = (...args) => {
|
|
35
|
-
let classnameArray = ['Tab'];
|
|
36
|
-
args.map((arg) => {
|
|
37
|
-
switch (typeof arg) {
|
|
38
|
-
case 'string':
|
|
39
|
-
classnameArray.push(arg);
|
|
40
|
-
break;
|
|
41
|
-
case 'object':
|
|
42
|
-
Object.keys(arg).map((k) => {
|
|
43
|
-
if (arg[k]) {
|
|
44
|
-
classnameArray.push(k);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return classnameArray.join(' ');
|
|
51
|
-
};
|
|
52
|
-
const getNewItems = (newList, oldList, getCondition) => {
|
|
53
|
-
return newList.filter(newItem => !oldList.some(oldItem => getCondition(newItem, oldItem)));
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Truncate number to specified decimal places (without rounding)
|
|
57
|
-
* @param {number|string} value - The number to be truncated, can be number or string
|
|
58
|
-
* @param {number} decimals - Number of decimal places to truncate to
|
|
59
|
-
* @returns {string|number} - Truncated value, returns string to preserve trailing zeros if has decimals, otherwise returns number
|
|
60
|
-
* @param {boolean} isInteger - Whether to force return integer
|
|
61
|
-
*/
|
|
62
|
-
const truncateNumber = (value, decimals, isInteger = false) => {
|
|
63
|
-
// Try to convert input to number
|
|
64
|
-
const numValue = Number(value);
|
|
65
|
-
// Check if valid number
|
|
66
|
-
if (isNaN(numValue)) {
|
|
67
|
-
throw new Error('Input must be a valid number or string that can be converted to number');
|
|
68
|
-
}
|
|
69
|
-
if (isInteger && !numValue.toString().includes('.')) {
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
// When decimals is 0, return integer part directly
|
|
73
|
-
if (decimals === 0) {
|
|
74
|
-
return Math.floor(numValue);
|
|
75
|
-
}
|
|
76
|
-
// Calculate factor for given decimal places
|
|
77
|
-
const factor = Math.pow(10, decimals);
|
|
78
|
-
// Multiply by factor, truncate integer part, then divide by factor
|
|
79
|
-
const truncated = Math.floor(numValue * factor) / factor;
|
|
80
|
-
// Return string representation with fixed decimals to preserve trailing zeros
|
|
81
|
-
return truncated.toFixed(decimals);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
exports.TRANSLATIONS = TRANSLATIONS;
|
|
85
|
-
exports.classnames = classnames;
|
|
86
|
-
exports.getNewItems = getNewItems;
|
|
87
|
-
exports.localePostprocess = localePostprocess;
|
|
88
|
-
exports.truncateNumber = truncateNumber;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
var Tab;
|
|
2
|
-
(function (Tab) {
|
|
3
|
-
Tab["info"] = "info";
|
|
4
|
-
Tab["leaderboard"] = "leaderboard";
|
|
5
|
-
Tab["games"] = "games";
|
|
6
|
-
})(Tab || (Tab = {}));
|
|
7
|
-
var Time;
|
|
8
|
-
(function (Time) {
|
|
9
|
-
Time["Starts"] = "Starts";
|
|
10
|
-
Time["Ends"] = "Ends";
|
|
11
|
-
})(Time || (Time = {}));
|
|
12
|
-
const localePostprocess = (translationText, props) => {
|
|
13
|
-
Object.keys(props).map((key) => {
|
|
14
|
-
translationText = translationText.replace(`{${key}}`, props[key]);
|
|
15
|
-
});
|
|
16
|
-
return translationText;
|
|
17
|
-
};
|
|
18
|
-
const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Places: 'places', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
|
|
19
|
-
Title: 'Quit Leaderboard?',
|
|
20
|
-
Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
|
|
21
|
-
ButtonYes: 'Yes, I want to quit leaderboard',
|
|
22
|
-
ButtonNo: 'No, Stay on the leaderboard'
|
|
23
|
-
}, WinDialog: {
|
|
24
|
-
Title: 'Congratulations!',
|
|
25
|
-
Description: 'You won <span>{rewards}</span>!',
|
|
26
|
-
ButtonContinue: 'Continue',
|
|
27
|
-
FailedTitle: 'Reward cannot be issued',
|
|
28
|
-
FailedDescription: 'Please contact support.',
|
|
29
|
-
FailedButtonContinue: 'Ok, continue',
|
|
30
|
-
}, 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>', TipPrizeWithoutReward: 'You took <span>{place}</span> place</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!', NoGameConfiged: 'No game configed', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' });
|
|
31
|
-
|
|
32
|
-
const classnames = (...args) => {
|
|
33
|
-
let classnameArray = ['Tab'];
|
|
34
|
-
args.map((arg) => {
|
|
35
|
-
switch (typeof arg) {
|
|
36
|
-
case 'string':
|
|
37
|
-
classnameArray.push(arg);
|
|
38
|
-
break;
|
|
39
|
-
case 'object':
|
|
40
|
-
Object.keys(arg).map((k) => {
|
|
41
|
-
if (arg[k]) {
|
|
42
|
-
classnameArray.push(k);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return classnameArray.join(' ');
|
|
49
|
-
};
|
|
50
|
-
const getNewItems = (newList, oldList, getCondition) => {
|
|
51
|
-
return newList.filter(newItem => !oldList.some(oldItem => getCondition(newItem, oldItem)));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Truncate number to specified decimal places (without rounding)
|
|
55
|
-
* @param {number|string} value - The number to be truncated, can be number or string
|
|
56
|
-
* @param {number} decimals - Number of decimal places to truncate to
|
|
57
|
-
* @returns {string|number} - Truncated value, returns string to preserve trailing zeros if has decimals, otherwise returns number
|
|
58
|
-
* @param {boolean} isInteger - Whether to force return integer
|
|
59
|
-
*/
|
|
60
|
-
const truncateNumber = (value, decimals, isInteger = false) => {
|
|
61
|
-
// Try to convert input to number
|
|
62
|
-
const numValue = Number(value);
|
|
63
|
-
// Check if valid number
|
|
64
|
-
if (isNaN(numValue)) {
|
|
65
|
-
throw new Error('Input must be a valid number or string that can be converted to number');
|
|
66
|
-
}
|
|
67
|
-
if (isInteger && !numValue.toString().includes('.')) {
|
|
68
|
-
return value;
|
|
69
|
-
}
|
|
70
|
-
// When decimals is 0, return integer part directly
|
|
71
|
-
if (decimals === 0) {
|
|
72
|
-
return Math.floor(numValue);
|
|
73
|
-
}
|
|
74
|
-
// Calculate factor for given decimal places
|
|
75
|
-
const factor = Math.pow(10, decimals);
|
|
76
|
-
// Multiply by factor, truncate integer part, then divide by factor
|
|
77
|
-
const truncated = Math.floor(numValue * factor) / factor;
|
|
78
|
-
// Return string representation with fixed decimals to preserve trailing zeros
|
|
79
|
-
return truncated.toFixed(decimals);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export { Tab as T, TRANSLATIONS as a, classnames as c, getNewItems as g, localePostprocess as l, truncateNumber as t };
|