@@ -3,28 +3,28 @@ import { IGoogleStoreResult } from '../interfaces'
33import { ResponseHelper } from './'
44
55export class GooglePlayHelper {
6- static getAppInfos ( bundleId , countryCode ?) {
6+ static getAppInfos ( bundleId : string , countryCode ?: string ) : Promise < IGoogleStoreResult > {
77 return GooglePlayHelper . _getAppPage ( bundleId , countryCode )
88 . then ( ResponseHelper . handleErrorStatus )
99 . then ( response => response . text ( ) )
1010 . then ( GooglePlayHelper . _parseResource )
1111 }
1212
13- private static _getAppPage ( bundleId , countryCode ?) {
13+ private static _getAppPage ( bundleId : string , countryCode ?: string ) : Promise < Response > {
1414 return fetch ( GooglePlayHelper . _getStoreAppUrl ( bundleId , countryCode ) )
1515 }
1616
17- private static _parseResource ( page ) : IGoogleStoreResult {
17+ private static _parseResource ( page : string ) : IGoogleStoreResult {
1818 const infos : any = { }
1919 Object . keys ( GooglePlayConstants . REGEX ) . map ( key => {
2020 // we force a new regex creation to allow multiple calls on the same regex
21- const regEx = new RegExp ( GooglePlayConstants . REGEX [ key ] . source , 'gm' ) . exec ( page )
21+ const regEx = new RegExp ( GooglePlayConstants . REGEX [ key as keyof typeof GooglePlayConstants . REGEX ] . source , 'gm' ) . exec ( page )
2222 infos [ key . toLowerCase ( ) ] = regEx ? regEx [ 1 ] : null
2323 } )
2424 return infos
2525 }
2626
27- private static _getStoreAppUrl ( bundleId , countryCode ?) : string {
27+ private static _getStoreAppUrl ( bundleId : string , countryCode ?: string ) : string {
2828 let url = `${ GooglePlayConstants . PLAY_STORE_ROOT_WEB } ?id=${ bundleId } `
2929 if ( countryCode ) {
3030 url += `&hl=${ countryCode } `
0 commit comments