Skip to content

Commit

Permalink
Revert "feat: add auth dapp flow (#416)"
Browse files Browse the repository at this point in the history
This reverts commit 16f8d79.
  • Loading branch information
Melisa Anabella Rossi committed Jan 9, 2024
1 parent 4f355a0 commit 3d8a773
Show file tree
Hide file tree
Showing 21 changed files with 170 additions and 1,066 deletions.
3 changes: 1 addition & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# EXPLORER_PATH points to the browser-interface/static folder in your local filesystem

EXPLORER_PATH="../unity-renderer/browser-interface/static"
FAST_REFRESH=false
EXPLORER_PATH="../unity-renderer/browser-interface/static"
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
outputs:
public_url: ${{ steps.install.outputs.public_url }}
public_path: ${{ steps.install.outputs.public_path }}
env:
CI: false
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
Expand Down
458 changes: 140 additions & 318 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,21 @@
"@dcl/feature-flags": "^1.2.0",
"@dcl/kernel-interface": "^2.0.0-20230512115658.commit-b582e05",
"@dcl/schemas": "^9.10.0",
"@dcl/single-sign-on-client": "^0.1.0",
"@dcl/urn-resolver": "^1.4.0",
"@sentry/browser": "^7.91.0",
"@sentry/tracing": "^7.91.0",
"@sentry/browser": "^7.45.0",
"@sentry/tracing": "^7.45.0",
"decentraland-connect": "^5.3.5",
"decentraland-dapps": "^16.21.5",
"decentraland-dapps": "^16.21.4",
"decentraland-ui": "^4.31.0",
"detect-browser": "^5.2.0",
"eth-connect": "^6.2.4",
"eth-connect": "^6.1.0",
"md5-file": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.9",
"react-scripts": "^4.0.3",
"react-virtualized": "^9.22.5",
"redux": "^4.0.5",
"redux-saga": "^1.2.3",
"uuid": "^9.0.1",
"validator": "^13.7.0"
},
Expand All @@ -85,11 +83,10 @@
"babel-loader": "^8.1.0",
"customize-cra": "^1.0.0",
"fs-extra": "^10.0.0",
"http-proxy-middleware": "^2.0.6",
"react-app-rewired": "^2.2.1",
"react-is": "^17.0.2",
"react-test-renderer": "^17.0.2",
"redux-devtools-extension": "^2.13.8",
"typescript": "^4.5.5"
}
}
}
589 changes: 0 additions & 589 deletions src/__snapshots__/storybook.test.ts.snap

Large diffs are not rendered by default.

29 changes: 6 additions & 23 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useEffect, useMemo } from 'react'
import React, { useMemo } from 'react'
import { connect } from 'react-redux'
import { ApplicationName } from 'decentraland-dapps/dist/modules/features/types'
import { useMobileMediaQuery } from 'decentraland-ui/dist/components/Media'
import { isMobile } from '../integration/browser'
import { StoreType } from '../state/redux'
import { isElectron } from '../integration/desktop'
import { SHOW_WALLET_SELECTOR } from '../integration/url'
import {
FeatureFlags,
isWaitingForRenderer,
Expand All @@ -14,18 +13,16 @@ import {
getFeatureVariantValue,
isFeatureEnabled
} from '../state/selectors'
import { isMobile } from '../integration/browser'
import { SHOW_WALLET_SELECTOR } from '../integration/url'
import ErrorContainer from './errors/ErrorContainer'
import LoginContainer from './auth/LoginContainer'
import { BeginnersGuide } from './auth/BeginnersGuide'
import { BigFooter } from './common/Layout/BigFooter'
import { Navbar } from './common/Layout/Navbar'
import BannerContainer from './banners/BannerContainer'
import { LoadingRender } from './common/Loading/LoadingRender'
import { initializeKernel } from '../integration/kernel'
import { Navbar } from './common/Layout/Navbar'
import StreamContainer from './common/StreamContainer'
import ErrorContainer from './errors/ErrorContainer'
import LoginContainer from './auth/LoginContainer'
import { Audio } from './common/Audio'
import Start from './start'
import MobileContainer from './common/MobileContainer'
import CatalystWarningContainer from './warning/CatalystWarningContainer'
import { LoginWithAuthServerPage } from './auth/LoginWithAuthServerPage'
Expand Down Expand Up @@ -59,8 +56,6 @@ function mapStateToProps(state: StoreType): AppProps {
trustedCatalyst,
error,
sound,
featureFlagsLoaded: !!state.featureFlags.ready,
isAuthDappEnabled: isFeatureEnabled(state, FeatureFlags.AuthDapp),
isDesktopClientSignInWithAuthDappEnabled
}
}
Expand All @@ -76,21 +71,13 @@ export interface AppProps {
trustedCatalyst: boolean
error: boolean
sound: boolean
isAuthDappEnabled: boolean
featureFlagsLoaded: boolean
isDesktopClientSignInWithAuthDappEnabled: boolean
}

const App: React.FC<AppProps> = (props) => {
const mobile = useMemo(() => isMobile(), [])
const small = useMobileMediaQuery()

useEffect(() => {
if (isElectron() || (props.featureFlagsLoaded && !props.isAuthDappEnabled)) {
initializeKernel()
}
}, [props.isAuthDappEnabled, props.featureFlagsLoaded])

if (!props.trustedCatalyst) {
return <CatalystWarningContainer />
}
Expand All @@ -115,10 +102,6 @@ const App: React.FC<AppProps> = (props) => {
return <LoadingRender />
}

if (props.isAuthDappEnabled && !isElectron()) {
return <Start />
}

if (isElectron() && props.isDesktopClientSignInWithAuthDappEnabled) {
return <LoginWithAuthServerPage />
}
Expand Down
9 changes: 3 additions & 6 deletions src/components/common/MobileContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ export default React.memo(function MobileContainer() {

<section>
<h2>Get a reminder</h2>
<p>
Get an email reminder to jump into Decentraland the next time you are back at a computer. You will also be
added to the Decentraland Weekly newsletter to receive the latest news and events.
</p>
<p>Get an email reminder to jump into Decentraland the next time you are back at a computer. You will also be added to the Decentraland Weekly newsletter to receive the latest news and events.</p>
<iframe
title="subscribe"
className="MobileSubscribe"
title='subscribe'
className='MobileSubscribe'
src="https://embeds.beehiiv.com/d7d652da-adc8-422f-9176-4b653a244020?slim=true"
data-test-id="beehiiv-embed"
></iframe>
Expand Down
15 changes: 0 additions & 15 deletions src/components/start/Start.container.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/start/Start.types.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/start/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/warning/CatalystWarningContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { track } from '../../utils/tracking'
import { CatalystWarning } from '../common/Icon/CatalystWarning'
import { Container } from '../common/Layout/Container'
import Main from '../common/Layout/Main'
import { Navbar } from '../common/Layout/Navbar'

import './CatalystWarningContainer.css'

Expand Down Expand Up @@ -44,6 +45,7 @@ export const CatalystWarningContainer = React.memo((props: CatalystWarningProps)
}, [ props.catalyst ])

return <Main withDarkLayer>
<Navbar />
<Container>
<div className="catalyst-warning-container">
<div className="catalyst-warning-content">
Expand Down
2 changes: 1 addition & 1 deletion src/eth/provider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ConnectionResponse, Provider } from 'decentraland-connect/dist/types'
import { connection } from 'decentraland-connect/dist/ConnectionManager'
import { ProviderAdapter } from 'decentraland-connect/dist/ProviderAdapter'
import { WebSocketProvider } from 'eth-connect'
import { WebSocketProvider } from 'eth-connect/providers/WebSocketProvider'
import { ChainId } from '@dcl/schemas/dist/dapps/chain-id'
import { ProviderType } from '@dcl/schemas/dist/dapps/provider-type'
import { switchProviderChainId } from 'decentraland-dapps/dist/modules/wallet/utils/switchProviderChainId'
Expand Down
32 changes: 0 additions & 32 deletions src/images/simple-logo.svg

This file was deleted.

10 changes: 4 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import WalletProvider from 'decentraland-dapps/dist/providers/WalletProvider'
import 'semantic-ui-css/semantic.min.css'
// import 'semantic-ui-css/semantic.min.css'
import './index.css'
import 'semantic-ui-css/components/site.min.css'
import 'semantic-ui-css/components/modal.min.css'
Expand All @@ -18,7 +17,7 @@ import 'decentraland-ui/dist/themes/alternative/light-theme.css'

import { configureSegment, configureSentry } from './integration/analytics'
import { store } from './state/redux'
import { configureKernel } from './integration/kernel'
import { configureKernel, initializeKernel } from './integration/kernel'
import { initializeBrowserRecommendation } from './integration/browser'
import { initializeDesktopApp } from './integration/desktop'
import { initializeFeatureFlags } from './integration/featureFlags'
Expand All @@ -31,13 +30,12 @@ configureKernel(store)
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<WalletProvider>
<App />
</WalletProvider>
<App />
</Provider>
</React.StrictMode>,
document.getElementById('root')!,
() => {
initializeKernel()
initializeBrowserRecommendation()
initializeFeatureFlags()
initializeDesktopApp()
Expand Down
2 changes: 1 addition & 1 deletion src/integration/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ function hideRoot (state: StoreType) {
ROOT_HIDDEN = false
document.getElementById('root')!.style.display = 'block'
}
}
}
4 changes: 1 addition & 3 deletions src/integration/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export const RENDERER_TYPE = qs.get('ws') ? 'native' : 'web'
export const CATALYST = addHttpsIfNoProtocolIsSet(qs.get('CATALYST'))
export const PLATFORM = (navigator as any)?.userAgentData?.platform || navigator?.platform || 'unknown'
export const HOSTNAME = document.location.hostname
export const SKIP_SETUP = qs.has('skipSetup')
export const LOGIN_AS_GUEST = qs.get('guest') === 'true'

function addHttpsIfNoProtocolIsSet(domain: string | null) {
if (!domain) return null
Expand Down Expand Up @@ -44,4 +42,4 @@ export function ensureOrigin(url: string | URL) {
default:
return url.toString()
}
}
}
7 changes: 1 addition & 6 deletions src/kernel-loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { resolveUrlFromUrn } from '@dcl/urn-resolver'
import { defaultWebsiteErrorTracker, defaultKernelErrorTracker, track } from '../utils/tracking'
import { injectVersions } from '../utils/rolloutVersions'
import { KernelError, KernelResult } from '@dcl/kernel-interface'
import { ENV, NETWORK, withOrigin, ensureOrigin, CATALYST, RENDERER_TYPE, SHOW_WALLET_SELECTOR, LOGIN_AS_GUEST } from '../integration/url'
import { ENV, NETWORK, withOrigin, ensureOrigin, CATALYST, RENDERER_TYPE, SHOW_WALLET_SELECTOR } from '../integration/url'
import { isElectron, launchDesktopApp } from '../integration/desktop'
import { isMobile, setAsRecentlyLoggedIn } from '../integration/browser'
import { FeatureFlags, isFeatureVariantEnabled } from '../state/selectors'
Expand Down Expand Up @@ -308,11 +308,6 @@ async function initKernel() {

async function initLogin(kernel: KernelResult) {
if (!isElectron()) {
if (LOGIN_AS_GUEST) {
authenticate(null).catch(defaultWebsiteErrorTracker)
return
}

const provider = await restoreConnection()
if (provider && provider.account) {
const providerChainId = await getProviderChainId(provider.provider)
Expand Down
12 changes: 1 addition & 11 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
const path = require('path')
const { createProxyMiddleware } = require('http-proxy-middleware');

/**
* This module set ups routes to serve static content directly from NPM modules.
* It aims to imitate the production environment, but on the local machine, for the preview mode.
*/
module.exports = function (app) {
app.use(
'/auth',
createProxyMiddleware({
target: 'https://decentraland.zone/auth',
changeOrigin: true,
followRedirects: true,
secure: false
})
);
createStaticRoutes(app, '/cdn/packages/website/:version/*', `./public`)
createStaticRoutes(app, '/cdn/packages/explorer/:version/*', `./node_modules/@dcl/explorer`)
// createStaticRoutes(app, '/cdn/packages/explorer/:version/*', path.resolve(process.env.EXPLORER_PATH))
//createStaticRoutes(app, '/cdn/packages/explorer/:version/*', path.resolve(process.env.EXPLORER_PATH))
}

function createStaticRoutes(app, route, localFolder) {
Expand Down
26 changes: 4 additions & 22 deletions src/state/redux.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
import { applyMiddleware, combineReducers, createStore } from 'redux'
import createSagasMiddleware from 'redux-saga'
import { combineReducers, createStore } from 'redux'
import type { KernelAccountState, KernelResult, KernelLoadingProgress } from '@dcl/kernel-interface'
import type { FeatureFlagsResult } from '@dcl/feature-flags'
import { WalletState, walletReducer } from 'decentraland-dapps/dist/modules/wallet/reducer'
import {
kernelReducer,
sessionReducer,
rendererReducer,
errorReducer,
bannerReducer,
downloadReducer,
featureFlagsReducer,
catalystReducer,
decktopReducer
} from './reducers'
import { kernelReducer, sessionReducer, rendererReducer, errorReducer, bannerReducer, downloadReducer, featureFlagsReducer, catalystReducer, decktopReducer } from './reducers'
import { composeWithDevTools } from 'redux-devtools-extension'
import { ConnectionData } from 'decentraland-connect/dist/types'
import { rootSaga } from './sagas'

export type DesktopState = {
detected: boolean
Expand Down Expand Up @@ -73,7 +60,7 @@ export type BannerState = {
}

export enum BannerType {
NOT_RECOMMENDED = 'notrecommended'
NOT_RECOMMENDED = 'notrecommended',
}

export enum DownloadCurrentState {
Expand Down Expand Up @@ -105,7 +92,6 @@ export type StoreType = {
banner: BannerState
download: DownloadState
featureFlags: FeatureFlagsState
wallet: WalletState
}

const reducers = combineReducers<StoreType>({
Expand All @@ -118,13 +104,9 @@ const reducers = combineReducers<StoreType>({
banner: bannerReducer,
download: downloadReducer,
featureFlags: featureFlagsReducer,
wallet: walletReducer
})

const sagasMiddleware = createSagasMiddleware()

const middleware: typeof composeWithDevTools =
process.env.NODE_ENV !== 'production' ? composeWithDevTools : (x: any) => x

export const store = createStore(reducers, {}, middleware(applyMiddleware(sagasMiddleware)))
sagasMiddleware.run(rootSaga)
export const store = createStore(reducers, {}, middleware())
Loading

0 comments on commit 3d8a773

Please sign in to comment.