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F,GAAe,IAAIpF,EAAYgB,MAAM,KAAKqE,KAAK,OAG7CnF,IACFkF,GAAelF,GAIfV,EAAAA,GAAcE,0BACbF,EAAAA,GAAc4E,uBAEfgB,GAAe,eAAe5F,EAAAA,GAAc8F,4BAGvCF,CAAW,C","sources":["utils/generic/game-url.ts"],"sourcesContent":["import i18n from 'i18next';\nimport qs from 'qs';\nimport LocalStorage from 'utils/bom-dom-manipulation/local-storage';\nimport { clearCasinoPopupQuery } from 'utils/casino/casino';\nimport { CUSTOM_CATEGORIES } from 'utils/constants/casino/custom-categories';\nimport SpringConfigs, {\n  androidWrapperApp,\n  iOSWrapperApp\n} from 'utils/constants/swarm/spring-configs';\nimport { getMountPath, mountPoint } from 'utils/generic/route-manipulation';\nimport { showToastError } from 'utils/generic/show-toast-error';\nimport { storageKeyName } from 'utils/generic/storage-key-name';\nimport { isMobile } from 'utils/is-mobile';\nimport { getDomain } from './get-domain';\nimport { GLOBALS } from './global-variables';\nimport { getSavedLocation } from 'components/QueryRoute';\nimport { ReservedRoutes } from '../constants/app/app-routes';\nimport { CASINO_LANG_EXCEPTIONS } from '../constants/languages/language-format';\n\nexport const deviceIdApp = {\n  ANDROID_WRAPPER_APP: 4,\n  IOS_WRAPPER_APP: 3\n};\n\ntype GameURLParams = {\n  partnerId: number;\n  devicetypeid: number;\n  gameId: number | string;\n  language: string;\n  openType: 'fun' | 'real';\n  isMobile: boolean;\n  exitUrl?: string;\n  token?: string;\n  deposit_url?: string;\n  browserUrl?: string;\n  gameOptions?: null | string;\n  logoSource?: string;\n};\n\nconst LAUNCH_TYPE =\n  SpringConfigs.CASINO_LAUNCH_TYPE === 0\n    ? 'Launch'\n    : 'Inner/authorization.php/';\n\nconst LOUNCH_GAME_URL = `${LAUNCH_TYPE}${\n  SpringConfigs.SHOW_GAMBLING_WITH_LOGO && isMobile() ? 'Uk' : ''\n}${SpringConfigs.CASINO_LAUNCH_TYPE === 0 ? 'Game' : ''}`;\n\ntype TGameUrlProps = {\n  gameId: string;\n  gameType?: 'real' | 'fun';\n  gameOptions?: null | string;\n  scroll?: boolean;\n  extraParams?: string;\n  language?: string;\n  exitUrlParams?: {\n    includePreviousRoute?: boolean;\n    exitUrlAsHomepage?: boolean;\n    selectedCategory?: string;\n    path?: string;\n  };\n};\n\nexport const gameUrl = ({\n  gameId,\n  gameType = 'fun',\n  gameOptions = null,\n  scroll,\n  extraParams,\n  language,\n  exitUrlParams\n}: TGameUrlProps): string => {\n  const lang = document.documentElement.lang;\n  const mainDomain = getDomain();\n\n  const savedLocation = getSavedLocation('casinoSingleGame', false, false);\n\n  const queryParams = clearCasinoPopupQuery();\n\n  const [beforeLocationQuery, afterLocationQuery] = savedLocation.split('?');\n  let previousUrl = '';\n\n  if (exitUrlParams) {\n    previousUrl = `${\n      beforeLocationQuery ||\n      `${\n        isMobile()\n          ? getMountPath(exitUrlParams.path || '')\n          : mountPoint(exitUrlParams.path || '', false, true)\n      }/${exitUrlParams.selectedCategory || CUSTOM_CATEGORIES.all.id}`\n    }?${\n      !afterLocationQuery && queryParams?.size\n        ? queryParams.toString()\n        : afterLocationQuery || ''\n    }`;\n  }\n\n  const exitUrl = exitUrlParams?.includePreviousRoute\n    ? `${window.location.origin}${previousUrl}`\n    : exitUrlParams?.exitUrlAsHomepage\n    ? window.location.origin\n    : window.location.href;\n\n  const [urlPathnamePath, urlQueryPart] = exitUrl.split('?');\n\n  let filteredExitUrl = exitUrl;\n\n  if (urlQueryPart) {\n    filteredExitUrl = `${urlPathnamePath}${qs.stringify(\n      {\n        ...qs.parse(urlQueryPart, {\n          ignoreQueryPrefix: true\n        }),\n        ...{\n          accounts: undefined,\n          login: undefined\n        }\n      },\n      { addQueryPrefix: true }\n    )}`;\n  }\n\n  const mainUrl = `https://${\n    SpringConfigs.CASINO_GAME_URL_PREFIX\n  }.${mainDomain}/${!extraParams ? LOUNCH_GAME_URL : ''}?`;\n\n  let deviceId = 1;\n\n  if (androidWrapperApp) {\n    deviceId = deviceIdApp.ANDROID_WRAPPER_APP;\n  } else if (iOSWrapperApp) {\n    deviceId = deviceIdApp.IOS_WRAPPER_APP;\n  } else if (isMobile()) {\n    deviceId = 2;\n  }\n\n  const params: GameURLParams = {\n    partnerId:\n      SpringConfigs.DECENTRALIZED_CASINO_PARTNER_ID || SpringConfigs.PARTNER_ID,\n    devicetypeid: deviceId,\n    gameId: gameId,\n    language:\n      language ||\n      GLOBALS.languageConfigs.casinoLangPrefix ||\n      CASINO_LANG_EXCEPTIONS[lang] ||\n      CASINO_LANG_EXCEPTIONS[lang.slice(0, 2)] ||\n      SpringConfigs.CURRENT_LANGUAGE.slice(0, 2),\n    openType: gameType,\n    isMobile: isMobile(),\n    deposit_url:\n      SpringConfigs.CURRENT_LANGUAGE_PREFIX ===\n      SpringConfigs.DEFAULT_LANGUAGE_PREFIX\n        ? `${window.location.origin}${ReservedRoutes.deposit}`\n        : `${window.location.origin}/${SpringConfigs.CURRENT_LANGUAGE_PREFIX}${ReservedRoutes.deposit}`,\n    browserUrl: window.location.href,\n    logoSource: SpringConfigs.SITE_LOGO_URL || undefined,\n    exitUrl: filteredExitUrl\n  };\n\n  if (\n    SpringConfigs.CASINO_MOBILE_IFRAME &&\n    isMobile() &&\n    document.body.style.overflow !== 'hidden' &&\n    !scroll\n  ) {\n    document.body.classList.add('no-scroll');\n  }\n\n  if (gameType === 'real') {\n    const token = JSON.parse(\n      LocalStorage.getItem(storageKeyName('account', 'AUTH_DATA'))\n    )?.auth_token;\n\n    if (token) {\n      params.token = token;\n    } else {\n      isMobile() && showToastError(i18n.t('casino.notLoggedInForPlayingReal'));\n    }\n  }\n\n  let returnedUrl = `${mainUrl}${qs.stringify(params)}`;\n\n  if (gameOptions) {\n    returnedUrl += `&${gameOptions.split('\"').join('')}`;\n  }\n\n  if (extraParams) {\n    returnedUrl += extraParams;\n  }\n\n  if (\n    SpringConfigs.SHOW_GAMBLING_WITH_LOGO &&\n    !SpringConfigs.CASINO_MOBILE_IFRAME\n  ) {\n    returnedUrl += `&gambcomURL=${SpringConfigs.CASINO_GAMBLING_LOGO_URL}`;\n  }\n\n  return returnedUrl;\n};\n"],"names":["deviceIdApp","LOUNCH_GAME_URL","SpringConfigs","CASINO_LAUNCH_TYPE","SHOW_GAMBLING_WITH_LOGO","isMobile","gameUrl","_ref","gameId","gameType","gameOptions","scroll","extraParams","language","exitUrlParams","lang","document","documentElement","mainDomain","getDomain","savedLocation","getSavedLocation","queryParams","clearCasinoPopupQuery","beforeLocationQuery","afterLocationQuery","split","previousUrl","getMountPath","path","mountPoint","selectedCategory","CUSTOM_CATEGORIES","all","id","size","toString","exitUrl","includePreviousRoute","window","location","origin","exitUrlAsHomepage","href","urlPathnamePath","urlQueryPart","filteredExitUrl","qs","ignoreQueryPrefix","accounts","undefined","login","addQueryPrefix","mainUrl","CASINO_GAME_URL_PREFIX","deviceId","androidWrapperApp","iOSWrapperApp","params","partnerId","DECENTRALIZED_CASINO_PARTNER_ID","PARTNER_ID","devicetypeid","GLOBALS","languageConfigs","casinoLangPrefix","CASINO_LANG_EXCEPTIONS","slice","CURRENT_LANGUAGE","openType","deposit_url","CURRENT_LANGUAGE_PREFIX","DEFAULT_LANGUAGE_PREFIX","ReservedRoutes","deposit","browserUrl","logoSource","SITE_LOGO_URL","CASINO_MOBILE_IFRAME","body","style","overflow","classList","add","_JSON$parse","token","JSON","parse","LocalStorage","getItem","storageKeyName","auth_token","showToastError","i18n","returnedUrl","join","CASINO_GAMBLING_LOGO_URL"],"sourceRoot":""}