diff --git a/src/gameEvents.js b/src/gameEvents.js index e18b7fc..4f212f1 100644 --- a/src/gameEvents.js +++ b/src/gameEvents.js @@ -9,3 +9,4 @@ export const START_NEXT_LEVEL = 'snl'; export const ARCADIAN_HEAD_SELECTED = 'ahs'; export const NEAR_TOKENS_ADDED = 'n'; export const NFT_MINT = 'nm'; +export const MONETIZATION_PROGRESS = 'mp'; diff --git a/src/index.html b/src/index.html index 1d3d3c2..f1354a7 100644 --- a/src/index.html +++ b/src/index.html @@ -4,6 +4,7 @@ Skeleton rope +
@@ -13,7 +14,7 @@
- +
diff --git a/src/index.js b/src/index.js index bd4c673..984187b 100644 --- a/src/index.js +++ b/src/index.js @@ -10,12 +10,14 @@ import { } from './near/nearConnection'; import { initMenu } from './menu'; import { setNftTokens } from './store'; +import { initMonetization } from './monetization'; const init = () => { addStyles(); new Game(); initNear(); initMenu(); + initMonetization(); }; const addStyles = () => { diff --git a/src/monetization.js b/src/monetization.js new file mode 100644 index 0000000..9d7c896 --- /dev/null +++ b/src/monetization.js @@ -0,0 +1,13 @@ +import { MONETIZATION_PROGRESS } from './gameEvents'; + +export const initMonetization = () => { + if (document && document.monetization) { + document.monetization.addEventListener('monetizationprogress', (evt) => + emit(MONETIZATION_PROGRESS, evt) + ); + } else { + window.addEventListener('monetizationprogress', (evt) => + emit(MONETIZATION_PROGRESS, evt) + ); + } +}; diff --git a/src/near/nearLogin.js b/src/near/nearLogin.js index 0fa49e8..464c2b6 100644 --- a/src/near/nearLogin.js +++ b/src/near/nearLogin.js @@ -17,6 +17,8 @@ export const initLoginLogout = (nearConnection) => { nearConnection.walletConnection.isSignedIn() ) { loginoutEl.innerHTML = 'Logout from NEAR wallet'; + const nearLevelBtn = document.getElementById('nearLevelBtn'); + nearLevelBtn.removeAttribute('disabled'); } else { loginoutEl.innerHTML = 'Login to NEAR wallet'; }