


const scriptsInEvents = {

	async Gamesheet_Event2_Act17(runtime, localVars)
	{
		timepass.sendProgressionEvent({status: "Start", progression01: "Level", value: runtime.globalVars.Level})
	},

	async Gamesheet_Event198_Act2(runtime, localVars)
	{
		timepass.userPlayStarted()
	},

	async Gamesheet_Event358_Act2(runtime, localVars)
	{
		timepass.showPurchaseOptions("dc9ea700-25ad-4740-937d-0fdb9f5f8bab",runtime.globalVars.hintGrowthFactor)
	},

	async Gamesheet_Event358_Act5(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"ShufflesHint",design03:"IGPClicked"})
	},

	async Gamesheet_Event422_Act2(runtime, localVars)
	{
		timepass.showPurchaseOptions("dc9ea700-25ad-4740-937d-0fdb9f5f8bab",runtime.globalVars.hintGrowthFactor)
	},

	async Gamesheet_Event422_Act5(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"BoardHint",design03:"IGPClicked"})
	},

	async Gamesheet_Event437_Act2(runtime, localVars)
	{
		timepass.showPurchaseOptions("dc9ea700-25ad-4740-937d-0fdb9f5f8bab",runtime.globalVars.hintGrowthFactor)
	},

	async Gamesheet_Event437_Act5(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"LetterHint",design03:"IGPClicked"})
	},

	async Gamesheet_Event452_Act11(runtime, localVars)
	{
		timepass.updateCurrentStats(runtime.globalVars.Level,true, null)
	},

	async Gamesheet_Event452_Act12(runtime, localVars)
	{
		timepass.sendProgressionEvent({status: "complete", progression01: "Level", value: runtime.globalVars.Level})
	},

	async Gamesheet_Event583_Act1(runtime, localVars)
	{
		timepass.updateCurrentStats(runtime.globalVars.Level,false, null)
	},

	async Gamesheet_Event587_Act1(runtime, localVars)
	{
		timepass.updateCurrentStats(runtime.globalVars.Level,false, null)
	},

	async Gamesheet_Event590_Act1(runtime, localVars)
	{
		timepass.updateCurrentStats(runtime.globalVars.Level,false, null)
	},

	async Gamesheet_Event611_Act4(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"UseShuffle",design03:"Purchased"})
	},

	async Gamesheet_Event612_Act4(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"UseBoardHint",design03:"Purchased"})
	},

	async Gamesheet_Event613_Act4(runtime, localVars)
	{
		timepass.sendDesignEvent({design01: "GamePlay",design02:"UseLetterHint",design03:"Purchased"})
	},

	async Menusheet_Event90_Act3(runtime, localVars)
	{
		timepass.sendDesignEvent({design01:"Exit"})
	},

	async Menusheet_Event90_Act4(runtime, localVars)
	{
		timepass.exitGame()
	},

	async Menusheet_Event91_Act3(runtime, localVars)
	{
		timepass.sendDesignEvent({design01:"Share"})
	},

	async Menusheet_Event91_Act4(runtime, localVars)
	{
		timepass.shareGame("I've Mastered " + runtime.globalVars.pass_level +" Levels on Word Swipe. Think you can do Better?")
	},

	async Menusheet_Event92_Act2(runtime, localVars)
	{
		timepass.sendDesignEvent({design01:"LeaderBoard"})
	},

	async Menusheet_Event92_Act3(runtime, localVars)
	{
		timepass.showLeaderboard()
	},

	async Game_api_Event1_Act1(runtime, localVars)
	{
		runtime.globalVars.StateSyncEnabled = timepass.getStateSyncEnabled()
	},

	async Game_api_Event1_Act2(runtime, localVars)
	{
		runtime.globalVars.ScoreSyncEnabled = timepass.getScoreSyncEnabled()
	},

	async Game_api_Event1_Act3(runtime, localVars)
	{
		runtime.globalVars.ShowShareButton = timepass.getShareButtonFlag()
	},

	async Game_api_Event1_Act4(runtime, localVars)
	{
		runtime.globalVars.showPurchaseOptions = timepass.getshowPurchaseOptionFlag();
	},

	async Game_api_Event1_Act5(runtime, localVars)
	{
		runtime.globalVars.InGameControlsFlag = timepass.getInGameControlsFlag()
	},

	async Game_api_Event1_Act6(runtime, localVars)
	{
		runtime.globalVars.IsBusinessPlatform = timepass.getIsBusinessPlatform()
	},

	async Game_api_Event1_Act9(runtime, localVars)
	{
		const uid = timepass.getUserId();
		    timepass.analytics.configureGameAnalyticsUserId(uid);
		    timepass.analytics.initializeGameAnalytics(
		      "779e18fd17daa3dcc0afb5790ae4a111",
		      "68bcfa17e25361e05cc8ea59ed34fb39621b1fd4"
		    );
	},

	async Game_api_Event2_Act1(runtime, localVars)
	{
		
		const fetchAdFrequency = async()=>{
		   runtime.globalVars.AdFrequency = await timepass.analytics.getGameAnalyticsRemoteConfigs("ad_frequency", "2")
		   console.log("Ad Frequency",runtime.globalVars.AdFrequency)
		}
		fetchAdFrequency();
		
	},

	async Game_api_Event3_Act1(runtime, localVars)
	{
		
		const fetchAdFrequency = async()=>{
		   runtime.globalVars.AdFrequency = await timepass.analytics.getGameAnalyticsRemoteConfigs("b2b_ad_frequency", "2")
		   console.log("Ad Frequency",runtime.globalVars.AdFrequency)
		}
		fetchAdFrequency();
		
	},

	async Game_api_Event4_Act2(runtime, localVars)
	{
		timepass.pageReady()
	},

	async Game_api_Event6_Act1(runtime, localVars)
	{
		timepass.syncScore(runtime.globalVars.Level)
	},

	async Game_api_Event7_Act1(runtime, localVars)
	{
		timepass.syncState({
		"passedlevel" : runtime.globalVars.PassedLevels,
		"wordSwipe_LSHint" : runtime.globalVars.LSHint,
		"wordSwipe_BoardHint": runtime.globalVars.BoardHint,
		"wordSwipe_Shuffle" : runtime.globalVars.Shuffle,
		"sound": runtime.globalVars.Sound,
		"music" : runtime.globalVars.Music,
		"coins" : runtime.globalVars.Coins,
		"giftnum" : runtime.globalVars.GiftNum,
		"allFoundWords" : runtime.globalVars.AllFoundWords,
		"levelFoundWords" : runtime.globalVars.LevelFoundWords,
		"foundWordsNum" : runtime.globalVars.FoundWordsNum
		
		})
	},

	async Game_api_Event9_Act1(runtime, localVars)
	{
		timepass.showAds()
	},

	async Game_api_Event10_Act1(runtime, localVars)
	{
		var getState = await timepass.getState()
		console.log("best score get state response"+ JSON.stringify(getState) )
		console.log(getState["status"]);
		if(getState["success"] === false || getState['status'] === "FAILED") {
		   console.log("ENTERED FAILED CASE");
		//    runtime.globalVars.
		       runtime.storage.removeItem("WordSwipe_PassedLevels");
			   runtime.storage.removeItem("WordSwipe_Shuffle");
			   runtime.storage.removeItem("WordSwipe_BoardHint");
			   runtime.storage.removeItem("WordSwipe_LSHint");
			   runtime.storage.removeItem("WordSwipe_Coin");
			   runtime.storage.removeItem("WordSwipe_GiftNum");
			   runtime.storage.removeItem("WordSwipe_AllFoundWords");
			   runtime.storage.removeItem("WordSwipe_LevelFoundWords");
			   runtime.storage.removeItem("WordSwipe_FoundWordsNum");
			   runtime.storage.removeItem("WordSwipe_Sound");
			   runtime.storage.removeItem("WordSwipe_Music");
		}
		else {
			runtime.globalVars.PassedLevels = getState["passedlevel"] || ",1,"
			runtime.storage.setItem("WordSwipe_PassedLevels", runtime.globalVars.PassedLevels)
			runtime.globalVars.Shuffle = getState["wordSwipe_Shuffle"] 
			runtime.storage.setItem("WordSwipe_Shuffle", runtime.globalVars.Shuffle)
			runtime.globalVars.BoardHint = getState["wordSwipe_BoardHint"]
			runtime.storage.setItem("WordSwipe_BoardHint", runtime.globalVars.BoardHint)
			runtime.globalVars.LSHint = getState["wordSwipe_LSHint"]
			runtime.storage.setItem("WordSwipe_LSHint", runtime.globalVars.LSHint)
			runtime.globalVars.Sound = getState["sound"] || 0
			runtime.storage.setItem("sound", getState["sound"] || 0)
			runtime.globalVars.music = getState["music"] || 0
		    runtime.storage.setItem("music", getState["music"] || 0)
			runtime.globalVars.Coins = getState["coins"] || 0
		    runtime.storage.setItem("WordSwipe_Coin", runtime.globalVars.Coins)
			runtime.globalVars.GiftNum = getState["giftnum"] || 0
			runtime.storage.setItem("WordSwipe_GiftNum",runtime.globalVars.GiftNum)
			runtime.globalVars.AllFoundWords = getState["allFoundWords"] 
			runtime.storage.setItem("WordSwipe_AllFoundWords", runtime.globalVars.AllFoundWords)
			//runtime.globalVars.LevelFoundWords = getState["levelFoundWords"] 
			runtime.globalVars.LevelFoundWords = runtime.globalVars.AllFoundWords
			runtime.storage.setItem("WordSwipe_LevelFoundWords", runtime.globalVars.AllFoundWords)
			runtime.globalVars.FoundWordsNum = getState["foundWordsNum"] 
			runtime.storage.setItem("WordSwipe_FoundWordsNum", runtime.globalVars.FoundWordsNum)
		}
		
	}

};

self.C3.ScriptsInEvents = scriptsInEvents;

