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CCI7B,IAAKQ,EAA8B,SAA9BA,GAA8B,OAA9BA,EAA8B,wCAA9BA,EAA8B,8BAA9BA,EAA8B,8BAA9BA,EAA8B,gCAA9BA,EAA8B,oCAA9BA,CAA8B,K","sources":["newelements/_Betslip/providers/configs-provider.tsx","newelements/_Betslip/providers/index.tsx","newelements/_Betslip/types/configs.ts"],"sourcesContent":["import {\n createContext,\n PropsWithChildren,\n ReactElement,\n useContext,\n useId,\n useMemo,\n useState\n} from 'react';\nimport { EBetslipType } from 'interfaces/betslip';\nimport {\n EBetslipConfigsDispatchActions,\n TBetslipComputedConfigs,\n TBetslipStaticConfigs\n} from 'newelements/_Betslip/types/configs';\nimport { TBetslipConfigsContext } from 'newelements/_Betslip/types/context';\nimport { useEventbus } from 'newhooks/generic/useEventbus';\n\nconst staticConfigsInitialValue = {\n betslipFixedHeight: false,\n floatingMode: false,\n betslipRootId: ''\n};\n\nconst computedConfigsInitialValue: TBetslipComputedConfigs = {\n isOpened: false,\n mustOpen: false,\n mustClose: false,\n betslipType: EBetslipType.BASIC\n};\n\nconst betslipConfigsContextInitialValue: TBetslipConfigsContext = {\n static: staticConfigsInitialValue,\n computed: computedConfigsInitialValue\n};\n\nexport const BetslipConfigsContext = createContext(\n betslipConfigsContextInitialValue\n);\n\nexport const BetslipConfigsContextProvider = ({\n children\n}: PropsWithChildren): ReactElement => {\n const betslipRootId = useId();\n const [staticConfigs, setStaticConfigs] = useState({\n ...staticConfigsInitialValue,\n betslipRootId\n });\n\n const [computedConfigs, setComputedConfigs] =\n useState(computedConfigsInitialValue);\n\n // const setOpen = useCallback(\n // (open: boolean) => {\n // dispatch(setBetslipOpen(open));\n //\n // if (!open && isMobile()) {\n // dispatch(setFreezeTabChange(false));\n //\n // if (!allLsBets.length && isLoggedIn) {\n // dispatch(setActiveTabPage(EBetslipPage.OPEN_BETS));\n // } else {\n // dispatch(setActiveTabPage(EBetslipPage.BETSLIP));\n // }\n // }\n // },\n // [allLsBets, isLoggedIn]\n // );\n\n useEventbus({\n /* eslint-disable */\n // [EBetslipConfigsDispatchActions.SET_IS_OPENED]: (_, v?: boolean) => changeComputedConfigByKey('isOpened', v),\n // [EBetslipConfigsDispatchActions.SET_MUST_OPEN]: (_, v?: boolean) => changeComputedConfigByKey('mustOpen', v),\n // [EBetslipConfigsDispatchActions.SET_MUST_CLOSE]: (_, v?: boolean) => changeComputedConfigByKey('mustClose', v),\n [EBetslipConfigsDispatchActions.SET_BETSLIP_TYPE]: ({ payload }) =>\n changeComputedConfigByKey('betslipType', payload),\n [EBetslipConfigsDispatchActions.SET_STATIC_CONFIGS]: ({\n payload\n }: {\n payload: TBetslipStaticConfigs;\n }) => setStaticConfigs(p => ({ ...p, ...payload }))\n /* eslint-enable */\n });\n\n const configsContextValue = useMemo(\n () => ({\n static: staticConfigs,\n computed: computedConfigs\n }),\n [staticConfigs, computedConfigs]\n );\n\n /**\n * Competition ids that must hide game info\n * @param {key: keyof TBetslipComputedConfigs} key the key of property we want to change\n * @param {value: TBetslipComputedConfigs[k]} value updated value, if you do not pass the value then the function works like toggle\n */\n const changeComputedConfigByKey = (\n key: T,\n // value?: TBetslipStaticConfigs[T]\n value?: any\n ) => {\n setComputedConfigs(prev => {\n return {\n ...prev,\n [key]: value !== undefined ? value : !prev[key]\n };\n });\n };\n\n return (\n \n {children}\n \n );\n};\n\nexport const useBetslipConfigsContext = (): TBetslipConfigsContext =>\n useContext(BetslipConfigsContext);\n","import { ReactElement } from 'react';\nimport { BetslipGlobalStateProvider } from 'newelements/_Betslip/providers/BetslipGlobalStateProvider';\nimport { BetslipConfigsContextProvider } from 'newelements/_Betslip/providers/configs-provider';\n\nexport const BetslipRootProvider = ({\n children\n}: PropsWithChildren): ReactElement => {\n return (\n \n {children}\n \n );\n};\n","import { EBetslipType } from 'interfaces/betslip';\n\nexport type TBetslipStaticConfigs = {\n betslipFixedHeight: boolean;\n floatingMode: boolean;\n betslipRootId: string;\n};\nexport type TBetslipComputedConfigs = {\n isOpened: boolean;\n mustOpen: boolean;\n mustClose: boolean;\n betslipType: EBetslipType;\n};\n\nexport enum EBetslipConfigsDispatchActions {\n SET_STATIC_CONFIGS = 'SET_STATIC_CONFIGS',\n /*Toggle States start*/\n SET_IS_OPENED = 'SET_IS_OPENED',\n SET_MUST_OPEN = 'SET_MUST_OPEN',\n SET_MUST_CLOSE = 'SET_MUST_CLOSE',\n /*Toggle States end*/\n\n SET_BETSLIP_TYPE = 'SET_BETSLIP_TYPE'\n}\n"],"names":["staticConfigsInitialValue","betslipFixedHeight","floatingMode","betslipRootId","computedConfigsInitialValue","isOpened","mustOpen","mustClose","betslipType","EBetslipType","BASIC","betslipConfigsContextInitialValue","static","computed","BetslipConfigsContext","createContext","BetslipConfigsContextProvider","_ref","children","useId","staticConfigs","setStaticConfigs","useState","computedConfigs","setComputedConfigs","useEventbus","EBetslipConfigsDispatchActions","SET_BETSLIP_TYPE","_ref2","payload","changeComputedConfigByKey","SET_STATIC_CONFIGS","_ref3","p","configsContextValue","useMemo","key","value","prev","undefined","_jsx","Provider","useBetslipConfigsContext","useContext","BetslipRootProvider","BetslipGlobalStateProvider"],"sourceRoot":""}