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,MAAO,CACLN,KAAMM,EACN2E,cAAAA,EACAR,iBAAAA,EACA9F,IAAAA,CACF,CACF,qBC3HAuG,EAAAC,OAAA,EAAkB,oSCAlBD,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/./src/components/core/Games/GamesVictoryBanner/Bet/index.tsx","webpack://_N_E/./src/components/core/Games/GamesVictoryBanner/Renderer/V1/index.tsx","webpack://_N_E/./src/components/core/Games/GamesVictoryBanner/variants.ts","webpack://_N_E/./src/utils/bets/groupBetsByCoin.ts","webpack://_N_E/./src/utils/bets/mergeGroupedBetsByCoin.ts","webpack://_N_E/./src/hooks/useMergedBetsByCoin.ts","webpack://_N_E/./src/components/core/Games/GamesVictoryBanner/Bet/styles.module.scss","webpack://_N_E/./src/components/core/Games/GamesVictoryBanner/Renderer/V1/styles.module.scss"],"sourcesContent":["import { GamesVictoryBannerBetProps } from './props';\nimport styles from './styles.module.scss';\nimport { useMemo } from 'react';\nimport { WalletService } from '@starsoft/common/services';\nimport { BetStatusId } from '@/models/bet/status/id';\n\nfunction GamesVictoryBannerBet({ bet }: GamesVictoryBannerBetProps) {\n const won: boolean =\n bet?.status?.id?.toString() === BetStatusId.Won?.toString();\n\n function getPayout(): string {\n return WalletService.maskCurrency({\n amount: bet?.payout?.toNumber(),\n coin: bet?.coin,\n });\n }\n\n const payout: string = useMemo(getPayout, [won, bet?.coin, bet?.payout]);\n\n return (\n
\n \n {!won && '-'}\n {payout}\n
\n \n );\n}\n\nexport default GamesVictoryBannerBet;\n","import useTranslation from 'next-translate/useTranslation';\nimport { useEffect, useMemo, useState } from 'react';\nimport styles from './styles.module.scss';\nimport { m } from 'framer-motion';\nimport { useMergedBetsByCoin } from '@/hooks/useMergedBetsByCoin';\nimport { useIsMobile, useLottiePlayer } from '@starsoft/common/hooks';\nimport { GamesVictoryBannerProps } from '../../props';\nimport GamesVictoryBannerBet from '../../Bet';\nimport { gameBannerVariant, gameSmallVariant } from '../../variants';\n\nfunction GameVictoryBannerV1({\n isTimed,\n bets,\n className,\n variant = 'default',\n}: GamesVictoryBannerProps) {\n const isMobile: boolean = useIsMobile();\n const { t } = useTranslation('common');\n\n const { won, bets: mergedBetsByCoin } = useMergedBetsByCoin(bets);\n const [victoryBannerShowAt] = useState(new Date(new Date().getTime() + 5000));\n const [currentDate, setCurrentDate] = useState(new Date());\n const showVictoryBanner: boolean = victoryBannerShowAt > currentDate;\n const { lottieAnimationRef } = useLottiePlayer({\n path: '/game-won.json',\n loop: false,\n dependecyArray: [won],\n });\n\n const Bets: JSX.Element[] = useMemo(\n () =>\n mergedBetsByCoin.map(bet => (\n \n )),\n [mergedBetsByCoin],\n );\n\n function handleMount() {\n let intervalId: NodeJS.Timeout;\n\n intervalId = setInterval(() => setCurrentDate(new Date()), 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }\n\n useEffect(handleMount, []);\n\n if (isTimed && !showVictoryBanner) {\n return null;\n }\n\n if (!won) {\n return null;\n }\n\n return (\n <>\n \n \n \n {t(won ? 'won_title' : 'lost_title')}\n \n

\n {t(won ? 'won_description' : 'lost_description')}\n

\n
{Bets}
\n \n \n );\n}\n\nexport default GameVictoryBannerV1;\n","export const gameBannerVariant = {\n hidden: {\n transform: 'scale(0), translate(-50%, -50%)',\n opacity: 0,\n zIndex: 0,\n },\n visible: {\n transform: 'scale(1), translate(-50%, -50%)',\n zIndex: 3,\n opacity: 1,\n transition: {\n duration: 0.25,\n },\n },\n exit: {\n transform: 'scale(0), translate(-50%, -50%)',\n opacity: 0,\n zIndex: 0,\n transition: {\n duration: 0.25,\n },\n },\n};\n\nexport const gameSmallVariant = {\n hidden: {\n transform: 'translate(-50%, 200%)',\n opacity: 0,\n },\n visible: (isMobile: boolean) => ({\n transform: `translate(-50%, ${isMobile ? '-50%' : '0%'})`,\n opacity: 1,\n transition: {\n duration: 0.25,\n },\n }),\n exit: {\n transform: 'translate(-50%, 200%)',\n opacity: 0,\n transition: {\n duration: 0.25,\n },\n },\n};\n","import { Bet } from '@/models/bet';\n\nexport function groupBetsByCoin(bets: Bet[]): Map {\n const groupedBets: Map = new Map();\n\n for (const bet of bets) {\n if (!groupedBets.has(bet?.coin?.id)) {\n groupedBets.set(bet?.coin?.id, []);\n }\n\n groupedBets.set(\n bet?.coin?.id,\n (groupedBets.get(bet?.coin?.id) ?? []).concat(bet),\n );\n }\n\n return groupedBets;\n}\n","import { Bet } from '@/models/bet';\nimport { Decimal } from '@starsoft/common/services/Decimal';\nimport { getMoneyOrAmount } from '@starsoft/common/utils';\n\nfunction mergeBets(bets: Bet[]): Bet {\n let summedAmount: Decimal = new Decimal(0, {\n scale: bets?.[0]?.coin?.decimals,\n });\n let summedProfit: Decimal = new Decimal(0, {\n scale: bets?.[0]?.coin?.decimals,\n });\n\n for (let bet of bets) {\n summedAmount = summedAmount.add(getMoneyOrAmount(bet?.amount));\n summedProfit = summedProfit.add(getMoneyOrAmount(bet?.profit));\n }\n\n const mergedBet = {\n ...bets[0],\n amount: summedAmount,\n profit: summedProfit,\n };\n\n return mergedBet;\n}\n\nexport function mergeGroupedBetsByCoin(groupedBetsByCoin: Map) {\n const mergedBets: Bet[] = [];\n\n for (let groupedBets of groupedBetsByCoin.values()) {\n const mergedBet = mergeBets(groupedBets);\n mergedBets.push(mergedBet);\n }\n\n return mergedBets;\n}\n","import { DetailedBet } from '@/models/detailed-bet';\nimport { BetStatusId } from '@/models/bet/status/id';\nimport { groupBetsByCoin } from '@/utils/bets/groupBetsByCoin';\nimport { mergeGroupedBetsByCoin } from '@/utils/bets/mergeGroupedBetsByCoin';\nimport { Nullable } from '@starsoft/common/interfaces/nullable';\nimport { Decimal } from '@starsoft/common/services/Decimal';\nimport { getMoneyOrAmount } from '@starsoft/common/utils';\nimport { useMemo } from 'react';\n\nexport function useMergedBetsByCoin(bets: DetailedBet[]) {\n const wonBets: DetailedBet[] = useMemo(\n () =>\n bets?.filter(\n bet => bet?.status?.id?.toString() == BetStatusId.Won?.toString(),\n ),\n [bets],\n );\n const lossBets: DetailedBet[] = useMemo(\n () =>\n bets?.filter(\n bet => bet?.status?.id?.toString() == BetStatusId.Lost?.toString(),\n ),\n [bets],\n );\n const won: boolean = wonBets.length > 0;\n const currentBets: DetailedBet[] = won ? wonBets : lossBets;\n\n const mergedBetsByCoin: DetailedBet[] = useMemo(() => {\n if (currentBets.length < 2) {\n return currentBets;\n }\n\n const groupedBetsByCoin: Map =\n groupBetsByCoin(currentBets);\n const mergedBets = mergeGroupedBetsByCoin(groupedBetsByCoin);\n\n return mergedBets;\n }, [currentBets]);\n\n const usdtProfitAmount: Decimal = useMemo(\n () =>\n mergedBetsByCoin\n .filter(\n bet => bet?.status?.id?.toString() == BetStatusId.Won?.toString(),\n )\n .reduce((accumulator: Nullable, bet: DetailedBet) => {\n const payout: Decimal = bet?.amount\n ?.copyWith({\n options: {\n scale: bet?.coin?.decimals,\n },\n })\n .add(\n bet?.profit?.copyWith({\n options: {\n scale: bet?.coin?.decimals,\n },\n }),\n );\n\n const amountInDollars: Decimal = payout\n .multiply(\n new Decimal(getMoneyOrAmount(bet?.coin?.price)).copyWith({\n options: {\n scale: bet?.coin?.decimals,\n },\n }),\n )\n .copyWith({\n options: {\n scale: 2,\n },\n });\n\n if (accumulator === null) {\n return amountInDollars;\n }\n\n return accumulator.add(amountInDollars);\n }, null),\n [mergedBetsByCoin],\n );\n\n const usdtBetAmount: Decimal = useMemo(() => {\n return mergedBetsByCoin.reduce(\n (accumulator: Nullable, bet: DetailedBet) => {\n const payout: Decimal = new Decimal(\n getMoneyOrAmount(bet?.amount) ?? '0',\n {\n scale: bet?.coin?.decimals,\n },\n );\n\n const amountInDollars: Decimal = payout\n .multiply(\n new Decimal(getMoneyOrAmount(bet?.coin?.price)).copyWith({\n options: {\n scale: bet?.coin?.decimals,\n },\n }),\n )\n .copyWith({\n options: {\n scale: 8,\n },\n });\n\n if (accumulator === null) {\n return amountInDollars;\n }\n\n const newAccumulator = accumulator.add(amountInDollars);\n return newAccumulator;\n },\n null,\n );\n }, [mergedBetsByCoin]);\n\n return {\n bets: mergedBetsByCoin,\n usdtBetAmount,\n usdtProfitAmount,\n won,\n };\n}\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__EnAmP\",\"container__profit\":\"styles_container__profit__EVXBC\",\"container__profit--won\":\"styles_container__profit--won__oNMR_\",\"container__profit__coin\":\"styles_container__profit__coin__DHJJb\",\"skeleton-animation\":\"styles_skeleton-animation__zgYXr\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"lottie\":\"styles_lottie__MkZxC\",\"spin\":\"styles_spin__kOVSJ\",\"lottie--visible\":\"styles_lottie--visible__joB3F\",\"container\":\"styles_container__VfdSv\",\"container--open\":\"styles_container--open__9fbKl\",\"container--small\":\"styles_container--small___0u_S\",\"container__title\":\"styles_container__title__v1V5J\",\"container__title--won\":\"styles_container__title--won__m9j0f\",\"container__title--secondary\":\"styles_container__title--secondary__YbNK6\",\"container__description\":\"styles_container__description__4DTj8\",\"container__column\":\"styles_container__column__aSalW\",\"container__row\":\"styles_container__row__NZXTE\",\"skeleton-animation\":\"styles_skeleton-animation__ownQI\"};"],"names":["__webpack_exports__","Z","param","bet","BetStatusId","won","status","id","toString","Won","payout","useMemo","WalletService","maskCurrency","amount","toNumber","coin","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","div","className","styles","jsxs","concat","data-text","isTimed","bets","variant","isMobile","useIsMobile","t","useTranslation","mergedBetsByCoin","useMergedBetsByCoin","victoryBannerShowAt","useState","Date","getTime","currentDate","setCurrentDate","lottieAnimationRef","useLottiePlayer","path","loop","dependecyArray","Bets","map","GamesVictoryBannerBet","useEffect","intervalId","setInterval","clearInterval","showVictoryBanner","Fragment","ref","m","initial","animate","exit","variants","gameBannerVariant","gameSmallVariant","custom","span","p","hidden","transform","opacity","zIndex","visible","transition","duration","wonBets","filter","lossBets","Lost","length","currentBets","mergeGroupedBetsByCoin","groupedBetsByCoin","mergedBets","groupedBets","values","mergedBet","mergeBets","summedAmount","Decimal","scale","decimals","summedProfit","add","getMoneyOrAmount","profit","push","groupBetsByCoin","Map","has","set","get","usdtProfitAmount","reduce","accumulator","amountInDollars","copyWith","options","multiply","price","usdtBetAmount","module","exports"],"sourceRoot":""}