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AKL,SAAUF,EACnE,KAAC,EA9EY,CAtSsB+L,EAAAA,IAAW,yCAiP7CC,EAAAA,IAAQ,sMAMoB,CAAM,KAAD,uPAON,EAAG,KAAD,kW","sources":["app-react/services/game-search/game-search-result.ts","app-react/services/game-search/game-search.service.tsx"],"sourcesContent":["import {GameInfo, OpenGameParameters} from '../games/game-info';\nimport {IServiceFactoryExtended} from '../service-factory-extended.interface';\nimport {SuggestedLinkConfiguration} from '../configurations/config-data-sections/game-search-box.configuration';\nimport {OrbitUserFlowAnalyticsCategory} from \"../analytics/analytics.service.interface\";\n\nexport interface ISearchSuggestion {\n readonly key: string;\n readonly text: string;\n readonly linkIconClass: string;\n readonly type: string;\n readonly gameInfo: GameInfo | null;\n executeAction(): Promise;\n}\n\nexport const SUGGESTED_CATEGORIES = \"Suggested_Categories\";\n\n\nexport class GameSuggestion implements ISearchSuggestion {\n constructor(private services: IServiceFactoryExtended,\n private _gameInfo: GameInfo,\n private _analyticsLabel: string,\n private _index?: number,\n private _aiSortingType?: string) {\n\n }\n\n get gameInfo(): GameInfo {\n return this._gameInfo;\n }\n\n get type(): string {\n return this._analyticsLabel;\n }\n\n get key(): string {\n return this._gameInfo.gameType + '_' + this._gameInfo.title;\n }\n\n get text(): string {\n return this._gameInfo.title;\n }\n\n get linkIconClass(): string {\n return this._gameInfo.gameCategory;\n }\n\n async executeAction(): Promise {\n\n const openGameParams: OpenGameParameters = {\n isRealMode: true,\n pageName: 'Search',\n gameIndex: this._index,\n listTitle: this.type,\n aiSortingType: this._aiSortingType,\n showIntermediatePage: (await this.services.cmsSegmentation).isCstatus === false //Show intermediate page only for user with cStatus == false, TASK 1832892\n };\n\n await this._gameInfo.open(openGameParams);\n }\n}\n\n\nexport class SearchLinkSuggestion implements ISearchSuggestion {\n constructor(private _linkConfig: SuggestedLinkConfiguration,\n private services: IServiceFactoryExtended,\n private _analyticsAction: string) {\n if (this._linkConfig.menuItemKey) {\n\n }\n }\n\n\n\n get gameInfo(): GameInfo | null {\n return null;\n }\n\n get type(): string {\n return this._analyticsAction;\n }\n\n get key(): string {\n return this._linkConfig.text;\n }\n\n get text(): string {\n return this.services.translation.translate(this._linkConfig.text);\n }\n\n get linkIconClass(): string {\n return 'link';\n }\n\n async executeAction(): Promise {\n this.services.analytics.sendOrbitUserFlowEvent(OrbitUserFlowAnalyticsCategory.Search, this.type, this.text);\n if (this._linkConfig.linkId) {\n await this.services.linksNavigation.navigateLink({\n linkId: this._linkConfig.linkId,\n linkHash: this._linkConfig.linkHash\n });\n }\n else if (this._linkConfig.menuItemKey) {\n const menuItem = (await this.services.gameSearch).getMenuItemAction(this._linkConfig.menuItemKey);\n if (menuItem) {\n await menuItem.execute({\n linkHash: this._linkConfig.linkHash\n });\n } else {\n this.services.logger.error(`Could not find menu item action ${this._linkConfig.menuItemKey} for search suggestion link ${this.key}`);\n }\n } else {\n this.services.logger.error(`Navigation for search suggestion link ${this.key} not specified`)\n }\n\n }\n}\n\n\n\nexport class VideoSlidesFilterPreviewSuggestion implements ISearchSuggestion {\n constructor(private services: IServiceFactoryExtended,\n private _gameInfo: GameInfo,\n private _videoSlidesFilterPreviewId: string,\n private _analyticsAction: string) {\n\n }\n\n get gameInfo(): GameInfo | null {\n return this._gameInfo;\n }\n\n get type(): string {\n return this._analyticsAction;\n }\n\n get key(): string {\n return \"VideoSlidesFilterPreviewSuggestion\" + this._videoSlidesFilterPreviewId;\n }\n\n get text(): string {\n return this.services.gamesFilter.getFiltersDefinitions([this._videoSlidesFilterPreviewId])[this._videoSlidesFilterPreviewId]?.text ?? this._videoSlidesFilterPreviewId;\n }\n\n get linkIconClass(): string {\n return 'explore';\n }\n\n async executeAction(): Promise {\n this.services.analytics.sendOrbitUserFlowEvent('navigation', 'videoSlidesOpenFromSearch', this._videoSlidesFilterPreviewId);\n this.services.videoSlides.navigateToFilter(this._videoSlidesFilterPreviewId);\n }\n}\n\nexport class GameSearchResult {\n constructor(private _games: ISearchSuggestion[], private _suggestedCategories: ISearchSuggestion[], private _suggestedGames: ISearchSuggestion[], private _suggestedVideoSlidesFilterListPreview: ISearchSuggestion[]) {}\n\n get suggestedGames(): ISearchSuggestion[] {\n return this._suggestedGames;\n }\n\n get games(): ISearchSuggestion[] {\n return this._games;\n }\n\n get suggestedCategories(): ISearchSuggestion[] {\n return this._suggestedCategories;\n }\n\n get suggestedVideoSlidesFilterListPreview(): ISearchSuggestion[] {\n return this._suggestedVideoSlidesFilterListPreview;\n }\n}\n","import React, {createRef} from \"react\";\nimport {ServiceBase} from '../ServiceBase';\nimport {IGameSearchService} from './game-search.service.interface';\nimport {DomEventSubscription} from '../../../utils/event-listener-registration';\nimport {action, computed, observable, makeObservable} from 'mobx';\nimport {\n SearchLinkSuggestion,\n GameSearchResult,\n GameSuggestion,\n ISearchSuggestion,\n SUGGESTED_CATEGORIES,\n VideoSlidesFilterPreviewSuggestion\n} from './game-search-result';\nimport {SuggestedLinkConfiguration} from '../configurations/config-data-sections/game-search-box.configuration';\nimport {Check} from '@sparkware/app-utils';\nimport {IServiceFactoryExtended} from '../service-factory-extended.interface';\nimport {GameInfo, gameInfoComparerByTitle} from '../games/game-info';\nimport {IModalDialogHandler} from \"../dialog/dialog.service.interface\";\nimport {GameSearchComponent} from \"../../components/game-search/game-search.component\";\nimport {removeSpecialCharacters} from \"../../../utils/string-helpers\";\nimport {LIST_TYPE_ID} from \"../../../common/const/ai-trending-list-ids-map\";\nimport {IOverlayConsumer} from \"../overlay/overlay-consumer.interface\";\nimport {MenuItemKey} from \"../configurations/config-data-sections/generated-config-const\";\nimport {IMenuItemAction} from \"../menu-item-action-factory/menu-item-action.interface\";\nimport {\n MenuItemDefaultConfigReader\n} from \"../menu-items-common/menu-item-config-reader/menu-item-default-config-reader\";\nimport {OrbitUserFlowAnalyticsCategory} from \"../analytics/analytics.service.interface\";\nimport {IMenuItemActionFactoryService} from \"../menu-item-action-factory/menu-item-action-factory.service.interface\";\n\nexport class GameSearchService extends ServiceBase implements IGameSearchService, IOverlayConsumer {\n\n private _closeMobileSideMenuOnSearchClose: boolean = false;\n\n constructor(services: IServiceFactoryExtended,\n private readonly menuItemActionFactory: IMenuItemActionFactoryService) {\n super(services);\n\n makeObservable(this);\n\n this.services.overlay.registerConsumer(this);\n\n this._menuItemConfigReader = new MenuItemDefaultConfigReader(services);\n\n\n this.reaction(() => this.services.games.gamesMap,\n () => {\n //this is to avoid circular dependency between this service and ISearchSuggestion implementations\n setTimeout(() => {\n this._resetGamesSearchListCache();\n this.search(this.currentSearchText);\n });\n\n }, {\n fireImmediately: true\n });\n\n this.reaction(() => {\n return {\n trendingRecommendedGamesForPlayerByBets: this.services.aiEngine.trendingRecommendedGamesForPlayerByBets,\n aiRecommendedGames: this.services.aiEngine.aiRecommendedGames\n }\n },\n () => {\n if (!this.isSearchInProgress) {\n this._setDefaultSearchResult();\n }\n });\n\n this._setDefaultSearchResult();\n }\n\n private readonly _menuItemConfigReader: MenuItemDefaultConfigReader;\n\n private _miniOrbitSearchBoxDialogHandler: IModalDialogHandler | null = null;\n\n private _searchInputRef: React.RefObject = createRef();\n private _searchComponentRef: React.RefObject = createRef();\n private _searchResultComponentRef: React.RefObject = createRef();\n\n private _gamesSearchListCache: GameInfo[] | null = null;\n private get gamesSearchList(): GameInfo[] {\n if (!this._gamesSearchListCache) {\n this._gamesSearchListCache = this._buildGamesSearchList()\n }\n\n return this._gamesSearchListCache;\n }\n\n getMenuItemAction(key: MenuItemKey): IMenuItemAction {\n return this.menuItemActionFactory.getMenuItemAction(key, this._menuItemConfigReader);\n }\n _resetGamesSearchListCache() {\n this._gamesSearchListCache = null;\n }\n\n private _buildGamesSearchList(): GameInfo[] {\n return Object.values(this.services.games.gamesMap).sort(gameInfoComparerByTitle);\n }\n\n private _openMiniOrbitSearchDialog(): void {\n this.services.dialog.showModal((dialogHandler) => {\n this._miniOrbitSearchBoxDialogHandler = dialogHandler;\n return ();\n }, {\n title: ' ',\n onClosed: () => this.closeSearchResult(),\n forceFullscreenTablet: true\n });\n }\n\n get needsOverlay(): boolean {\n return this.isSearchBoxOpened;\n }\n\n getOverlayZIndex(): number | undefined {\n return undefined;\n }\n\n onOverlayClicked() {\n this.closeSearchResult();\n }\n\n private _openFullOrbitSearchResult() {\n this._disposeDocumentClickSubscription();\n /*\n * Handle search result close on document click\n * Wonder why we use setTimeout? From React 17 the events are bound to react-dom root element instead of window.document\n * Read more here: https://github.com/facebook/react/issues/20636\n */\n setTimeout(() => {\n this._documentClickSubscription = this.services.dom.subscribeTo.click(this._handleClickOutsideSearchComponent);\n });\n\n }\n\n get searchInputRef() {\n return this._searchInputRef;\n }\n\n get searchComponentRef() {\n return this._searchComponentRef;\n }\n\n get searchResultComponentRef() {\n return this._searchResultComponentRef;\n }\n\n async openSearchResult(): Promise {\n if (this.isSearchBoxOpened) { //No need to open it if is already opened\n return;\n }\n\n if (this.services.miniOrbit.isEnabled) {\n this._openMiniOrbitSearchDialog();\n } else {\n this._openFullOrbitSearchResult();\n }\n\n this._setIsSearchBoxOpened(true);\n\n this.searchInputRef?.current?.focus();\n\n if (this.services.device.isMobile) {\n const sideMenu = await this.services.sideMenu;\n this._closeMobileSideMenuOnSearchClose = !sideMenu.isMobileMenuOpen;\n if (!sideMenu.isMobileMenuOpen) {\n sideMenu.openMobileMenu();\n }\n }\n\n this.services.analytics.sendOrbitUserFlowEvent(\"Navigation\", this.services.routing.currentRoute?.data?.arenaType || 'Header', 'Search_Open');\n }\n\n\n private _documentClickSubscription: DomEventSubscription | null = null;\n\n private _disposeDocumentClickSubscription() {\n if (this._documentClickSubscription) {\n this._documentClickSubscription.dispose();\n this._documentClickSubscription = null;\n }\n }\n\n\n private _closeMiniOrbitSearchDialog = () => {\n if (this._miniOrbitSearchBoxDialogHandler) {\n this._miniOrbitSearchBoxDialogHandler.close();\n this._miniOrbitSearchBoxDialogHandler = null;\n }\n };\n\n\n private _closeFullOrbitSearchResult = () => {\n this._disposeDocumentClickSubscription();\n };\n\n private _handleClickOutsideSearchComponent = (event) => {\n if (this._searchComponentRef.current && !this._searchComponentRef.current.contains(event.target)) {\n this.closeSearchResult();\n }\n }\n\n closeSearchResult = async () => {\n if (!this.isSearchBoxOpened) { //if is already closed don't close it again\n return;\n }\n if (this.services.miniOrbit.isEnabled) {\n this._closeMiniOrbitSearchDialog();\n } else {\n this._closeFullOrbitSearchResult();\n }\n\n if (this._closeMobileSideMenuOnSearchClose) {\n this._closeMobileSideMenuOnSearchClose = false;\n (await this.services.sideMenu).closeMobileMenu();\n }\n\n this._setIsSearchBoxOpened(false);\n\n //Will called when search box close or when game is selected (And closing the results as well)\n if (this.isSearchInProgress)\n this.services.analytics.sendOrbitUserFlowEvent(OrbitUserFlowAnalyticsCategory.Search, 'Entry', this.currentSearchText);\n\n this._setCurrentSearchText('');\n this._setDefaultSearchResult();\n };\n\n private _getGameSuggestion() {\n const gamesSuggestions: GameSuggestion[] = [];\n let aiSortingTypeForAnalytics: string = \"byactiveusers\";\n let aiGames = this.services.aiEngine.trendingRecommendedGamesForPlayerByActiveUsers;\n\n if (!(aiGames?.length > 0)) {\n aiSortingTypeForAnalytics = 'config';\n aiGames = this.services.configuration.data.search.suggestedGames;\n }\n\n aiGames.forEach(gameType => {\n const gameInfo = this.services.games.gamesMap[gameType];\n\n if (!Check.isNullOrUndefined(gameInfo)) {\n gamesSuggestions.push(new GameSuggestion(this.services, gameInfo, `Suggested_Games_${aiSortingTypeForAnalytics}`, gamesSuggestions.length, aiSortingTypeForAnalytics))\n }\n });\n\n return gamesSuggestions.slice(0, 6);\n }\n\n private _getDefaultVideoSlidesFilterListPreviewSuggestion() {\n const VideoSlidesFilterPreviewSuggestions: VideoSlidesFilterPreviewSuggestion[] = [];\n let videoSlidesFilterPreviewIds = this.services.configuration.data.search.videoSlidesFilterPreviewIds;\n if (!Check.isNullOrUndefined(videoSlidesFilterPreviewIds)) {\n videoSlidesFilterPreviewIds.forEach(id => {\n const gameInfo = this.services.videoSlides.firstGameForFilter(id);\n if (!Check.isNullOrUndefined(gameInfo)) {\n VideoSlidesFilterPreviewSuggestions.push(new VideoSlidesFilterPreviewSuggestion(this.services, gameInfo, id, \"???\"))\n }\n })\n }\n\n return VideoSlidesFilterPreviewSuggestions;\n }\n\n private _setDefaultSearchResult() {\n const quickLinks = this.services.configuration.data.search.quickLinks\n .map(quickLinkConfig => new SearchLinkSuggestion(quickLinkConfig, this.services, 'Quick_Links'));\n\n this._setSearchResult(new GameSearchResult([], quickLinks, this._getGameSuggestion(), this._getDefaultVideoSlidesFilterListPreviewSuggestion()));\n }\n\n @computed\n get isSearchInProgress(): boolean {\n return this.currentSearchText.length >= 2;\n }\n\n @observable.ref\n isSearchBoxOpened: boolean = false;\n @action.bound\n private _setIsSearchBoxOpened(value: boolean) {\n this.isSearchBoxOpened = value;\n }\n\n @observable.ref\n currentSearchText: string = '';\n\n @action.bound\n private _setCurrentSearchText(value: string): void {\n this.currentSearchText = value;\n }\n\n search(text: string): void {\n text = text || '';\n\n if (!this.isSearchBoxOpened && text.length > 0) {\n this.openSearchResult();\n }\n\n this._setCurrentSearchText(text);\n\n if (this.isSearchInProgress) { //we only search if there are at least 2 characters typed in the search box\n let regEx = new RegExp(removeSpecialCharacters(text), 'gi');\n this._setSearchResult(this._getSearchResult(regEx));\n } else {\n this._setDefaultSearchResult();\n }\n }\n\n\n private _getSearchResult(regEx: RegExp): GameSearchResult {\n let games = this._searchForGames(regEx);\n let suggestedCategories: ISearchSuggestion[];\n if (games.length === 0) {\n suggestedCategories = this._getDefaultSuggestedCategories();\n } else {\n suggestedCategories = this._searchForSuggestedCategories(regEx);\n }\n\n return new GameSearchResult(games, suggestedCategories, this._getGameSuggestion(), this._getDefaultVideoSlidesFilterListPreviewSuggestion());\n }\n\n @observable.ref\n searchResult: GameSearchResult;\n\n @action.bound\n private _setSearchResult(value: GameSearchResult) {\n this.searchResult = value;\n }\n\n private _searchForGames(regEx: RegExp): ISearchSuggestion[] {\n\n const result: GameInfo[] = [];\n const gameTypeToGameInfoObj = {};\n const themesIds = this.services.gamesTheme.findThemes(regEx);\n const vendorsIds = this.services.gamesVendor.findVendors(regEx);\n\n this.gamesSearchList.forEach((gameInfo) => {\n if (removeSpecialCharacters(gameInfo.title).match(regEx)\n || this._matchGameByTheme(gameInfo, themesIds)\n || this._matchGameByVendor(gameInfo, vendorsIds)) {\n result.push(gameInfo);\n gameTypeToGameInfoObj[gameInfo.gameType] = gameInfo;\n }\n });\n\n const sortedResultGameTypes = this.services.aiEngine.sortGamesByAI(result.map(gameInfo => gameInfo.gameType), LIST_TYPE_ID.ACTIVE_USERS);\n return sortedResultGameTypes.map((gameType, index) => new GameSuggestion(this.services, gameTypeToGameInfoObj[gameType], `Search_Results`, index, 'byactiveusers'));\n }\n\n private _matchGameByTheme(gameInfo: GameInfo, themesIds: number[]) {\n for (let themeId of gameInfo.themeIds) {\n if (themesIds.includes(themeId)) {\n return true;\n }\n }\n return false;\n }\n\n private _matchGameByVendor(gameInfo: GameInfo, vendorsIds: number[]) {\n return vendorsIds.includes(gameInfo.vendorId)\n }\n\n private _searchForSuggestedCategories(regEx: RegExp): ISearchSuggestion[] {\n let suggestedCategoriesOptions = this.services.configuration.data.search.suggestedCategories.suggestedCategoriesOptions;\n if (!suggestedCategoriesOptions) {\n return this._getDefaultSuggestedCategories();\n }\n\n for (let i = 0; i < suggestedCategoriesOptions.length; i++) {\n let option = suggestedCategoriesOptions[i];\n let result: ISearchSuggestion[] = [];\n if (option.search.match(regEx) && option.categories && option.categories.length > 0) {\n result = option.categories.map(categoryConfig => this._createSuggestedCategory(categoryConfig))\n // TODO: Remove this after updating the Check signatures. Let type inference do the magic\n .filter((categorySuggestion): categorySuggestion is ISearchSuggestion => !Check.isNullOrUndefined(categorySuggestion));\n }\n\n if (result.length > 0) {\n return result;\n }\n }\n\n return this._getDefaultSuggestedCategories();\n }\n\n private _getDefaultSuggestedCategories(): ISearchSuggestion[] {\n return this.services.configuration.data.search.suggestedCategories.defaultSuggestedCategories\n .map(suggestedCategory => this._createSuggestedCategory(suggestedCategory))\n // TODO: Remove this after updating the Check signatures. Let type inference do the magic\n .filter((suggestion): suggestion is ISearchSuggestion => !Check.isNullOrUndefined(suggestion));\n }\n\n _createSuggestedCategory(categoryConfig: SuggestedLinkConfiguration): ISearchSuggestion | null {\n if (categoryConfig.gameID) {\n let gameInfo = this.services.games.gamesMap[categoryConfig.gameID];\n if (!gameInfo) {\n this.services.logger.error(`Game type ${categoryConfig.gameID} is in the search suggested categories but this game is not configured to be in this site!`);\n return null;\n }\n return new GameSuggestion(this.services, gameInfo, SUGGESTED_CATEGORIES);\n }\n return new SearchLinkSuggestion(categoryConfig, this.services, SUGGESTED_CATEGORIES);\n }\n}\n"],"names":["SUGGESTED_CATEGORIES","GameSuggestion","services","_gameInfo","_analyticsLabel","_index","_aiSortingType","this","gameType","title","gameCategory","type","cmsSegmentation","isCstatus","openGameParams","isRealMode","pageName","gameIndex","listTitle","aiSortingType","showIntermediatePage","open","SearchLinkSuggestion","_linkConfig","_analyticsAction","menuItemKey","text","translation","translate","analytics","sendOrbitUserFlowEvent","OrbitUserFlowAnalyticsCategory","linkId","linksNavigation","navigateLink","linkHash","gameSearch","menuItem","getMenuItemAction","execute","logger","error","key","VideoSlidesFilterPreviewSuggestion","_videoSlidesFilterPreviewId","gamesFilter","getFiltersDefinitions","videoSlides","navigateToFilter","GameSearchResult","_games","_suggestedCategories","_suggestedGames","_suggestedVideoSlidesFilterListPreview","GameSearchService","observable","action","menuItemActionFactory","_closeMobileSideMenuOnSearchClose","_menuItemConfigReader","_miniOrbitSearchBoxDialogHandler","_searchInputRef","createRef","_searchComponentRef","_searchResultComponentRef","_gamesSearchListCache","_documentClickSubscription","_closeMiniOrbitSearchDialog","close","_closeFullOrbitSearchResult","_disposeDocumentClickSubscription","_handleClickOutsideSearchComponent","event","current","contains","target","closeSearchResult","isSearchBoxOpened","miniOrbit","isEnabled","sideMenu","closeMobileMenu","_setIsSearchBoxOpened","isSearchInProgress","currentSearchText","_setCurrentSearchText","_setDefaultSearchResult","makeObservable","overlay","registerConsumer","MenuItemDefaultConfigReader","reaction","games","gamesMap","setTimeout","_resetGamesSearchListCache","search","fireImmediately","trendingRecommendedGamesForPlayerByBets","aiEngine","aiRecommendedGames","_buildGamesSearchList","Object","values","sort","gameInfoComparerByTitle","dialog","showModal","dialogHandler","onClosed","forceFullscreenTablet","dom","subscribeTo","click","_openMiniOrbitSearchDialog","_openFullOrbitSearchResult","searchInputRef","focus","device","isMobile","isMobileMenuOpen","openMobileMenu","routing","currentRoute","data","arenaType","dispose","gamesSuggestions","aiSortingTypeForAnalytics","aiGames","trendingRecommendedGamesForPlayerByActiveUsers","length","configuration","suggestedGames","forEach","gameInfo","Check","push","slice","VideoSlidesFilterPreviewSuggestions","videoSlidesFilterPreviewIds","id","firstGameForFilter","quickLinks","map","quickLinkConfig","_setSearchResult","_getGameSuggestion","_getDefaultVideoSlidesFilterListPreviewSuggestion","value","openSearchResult","regEx","RegExp","removeSpecialCharacters","_getSearchResult","suggestedCategories","_searchForGames","_getDefaultSuggestedCategories","_searchForSuggestedCategories","searchResult","result","gameTypeToGameInfoObj","themesIds","gamesTheme","findThemes","vendorsIds","gamesVendor","findVendors","gamesSearchList","match","_matchGameByTheme","_matchGameByVendor","sortGamesByAI","LIST_TYPE_ID","index","themeIds","themeId","includes","vendorId","suggestedCategoriesOptions","i","option","categories","categoryConfig","_createSuggestedCategory","filter","categorySuggestion","defaultSuggestedCategories","suggestedCategory","suggestion","gameID","ServiceBase","computed"],"sourceRoot":""}