@abtnode/webapp 1.6.9 → 1.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +5 -5
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +18 -18
- package/build/index.html +1 -1
- package/build/{precache-manifest.d77c71fa590027f941a9b90889c41ebc.js → precache-manifest.4ebb2e70b7f40bbffcb9c15b4a0a3567.js} +16 -16
- package/build/service-worker.js +1 -1
- package/build/static/js/11.f9ceb4b3.chunk.js +2 -0
- package/build/static/js/11.f9ceb4b3.chunk.js.map +1 -0
- package/build/static/js/{22.cdd3d1a4.chunk.js → 22.0f55f82b.chunk.js} +2 -2
- package/build/static/js/22.0f55f82b.chunk.js.map +1 -0
- package/build/static/js/{23.4208ebea.chunk.js → 23.32485069.chunk.js} +2 -2
- package/build/static/js/23.32485069.chunk.js.map +1 -0
- package/build/static/js/{28.9b1197ca.chunk.js → 28.40163b1b.chunk.js} +2 -2
- package/build/static/js/28.40163b1b.chunk.js.map +1 -0
- package/build/static/js/8.378ea0cc.chunk.js +3 -0
- package/build/static/js/{8.8084d3ca.chunk.js.LICENSE.txt → 8.378ea0cc.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/8.378ea0cc.chunk.js.map +1 -0
- package/build/static/js/main.11941b8b.chunk.js +2 -0
- package/build/static/js/main.11941b8b.chunk.js.map +1 -0
- package/build/static/js/{runtime-main.278e8ea4.js → runtime-main.eb2b4e6c.js} +2 -2
- package/build/static/js/{runtime-main.278e8ea4.js.map → runtime-main.eb2b4e6c.js.map} +1 -1
- package/package.json +1 -1
- package/build/static/js/11.ec811533.chunk.js +0 -2
- package/build/static/js/11.ec811533.chunk.js.map +0 -1
- package/build/static/js/22.cdd3d1a4.chunk.js.map +0 -1
- package/build/static/js/23.4208ebea.chunk.js.map +0 -1
- package/build/static/js/28.9b1197ca.chunk.js.map +0 -1
- package/build/static/js/8.8084d3ca.chunk.js +0 -3
- package/build/static/js/8.8084d3ca.chunk.js.map +0 -1
- package/build/static/js/main.ce53947b.chunk.js +0 -2
- package/build/static/js/main.ce53947b.chunk.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/blocklet-purchase.js","components/blocklet/purchase.js","components/blocklet/install.js","components/blocklet/stats.js","components/code.js","components/render-ast.js","pages/store/detail.js","../../../blocklet/meta/lib/util.js"],"names":["useBlockletPurchase","did","query","useQuery","history","useHistory","useLocalStorage","sessionId","setSessionId","useState","hasCompleted","setCompleted","session","setSession","doRedirect","URL","window","location","href","pathname","searchParams","prefix","env","apiPrefix","get","replace","hasPurchased","useSubscription","BlockletEvents","purchaseChange","e","includes","status","setTimeout","useEffect","id","useStyles","makeStyles","dialogAuth","padding","textAlign","marginBottom","iconRoot","minWidth","forwardRef","meta","mode","onCancel","useLocaleContext","t","locale","useNodeContext","info","gql","api","useSessionContext","classes","action","setAction","step","setStep","webWalletUrl","getWebWalletUrl","onSelect","act","a","onNext","payload","JSON","stringify","blockletDid","registryUrl","blockletRegistry","startSession","input","data","initial","cb","delete","set","callback","encodeURIComponent","nw","joinURL","nextWorkflow","url","nftFactory","onClose","options","title","description","popup","open","className","checkFn","checkTimeout","socketUrl","extraParams","sid","onSuccess","showDownload","messages","scan","confirm","success","disableBackdropClick","disableEscapeKeyDown","fullWidth","style","List","tabPanel","map","x","ListItem","button","key","selected","onClick","ListItemIcon","color","colors","primary","main","fontSize","ListItemText","secondary","rounded","disabled","variant","marginTop","Typography","component","message","getMessage","InstallOrUpgrade","lastVersion","buttonText","rest","enqueueSnackbar","useSnackbar","useBlockletContext","state","find","d","installed","useMemo","installedVersion","version","requirePurchase","isFreeBlocklet","loading","setLoading","showPurchaseDialog","setShowPurchaseDialog","loadingText","isInstalling","needUpgrade","gt","btnTxt","upgrade","purchase","install","showInstallBtn","onAction","preventDefault","stopPropagation","fn","formatError","autoHideDuration","console","error","InstallButton","size","Boolean","data-cy","marginRight","defaultProps","permission","hasPermission","push","configs","some","required","value","marginLeft","Stats","stats","useContext","LocaleContext","downloads","Div","name","star","styled","CodeBlock","propTypes","children","PropTypes","node","isRequired","components","pre","Array","isArray","props","code","language","split","pop","alert","Alert","p","h2","h3","h4","h5","h6","RehypeReact","createElement","Tag","BlockletStoreDetail","useParams","setLastVersion","currentRegistry","blockletRegistryList","useAsyncRetry","getBlockletMeta","onSubmit","blocklet","retry","content","priceList","formatFactoryPrice","keywords","htmlAst","screenshots","author","documentation","repository","community","support","lastPublishedAt","changeImgSrc","forEach","child","tagName","properties","src","startsWith","srcSet","item","length","titleInfo","join","type","keyword","Grid","container","spacing","xs","md","lazyLoad","showNav","showThumbnails","showPlayButton","showFullscreenButton","showBullets","items","original","formatRegistryScreenshotPath","thumbnail","PostContent","renderAst","formatPerson","parseRegistryUrl","target","formatToDatetime","formatTimeFromNow","Breadcrumbs","separator","aria-label","to","codeFont","div","theme","palette","text","breakpoints","values","sm","require","forEachBlocklet","parallel","sync","tasks","Promise","all","module","exports","payment","price","every","isAuthServiceEnabled","s","getRequiredMissingConfigs","missingConfigs","y","wipeSensitiveData","secure","environments","configObj","environmentObj"],"mappings":"6WASe,SAASA,EAAoBC,GAC1C,IAAMC,EAAQC,cACRC,EAAUC,cAChB,EAAkCC,IAAgB,yBAAD,OAA0BL,IAA3E,mBAAOM,EAAP,KAAkBC,EAAlB,KACA,EAAqCC,oBAAS,GAA9C,mBAAOC,EAAP,KAAqBC,EAArB,KACA,EAA8BF,mBAAS,MAAvC,mBAAOG,EAAP,KAAgBC,EAAhB,KAEMC,EAAa,WACjB,MAAmC,IAAIC,IAAIC,OAAOC,SAASC,MAAnDC,EAAR,EAAQA,SAAUC,EAAlB,EAAkBA,aACZC,EAASL,OAAOM,KAAON,OAAOM,IAAIC,UAAYP,OAAOM,IAAIC,UAAY,IACvEH,EAAaI,IAAI,SACnBhB,EAAa,IACbJ,EAAQqB,QAAQN,EAASM,QAAQJ,EAAQ,QAIvCK,KAAkBxB,EAAMsB,IA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SACJpM,EAAEuE,MAAQvE,EAAEuE,MAAQ,gBAAkB,QAGzCxC,EAAEsK,cAAgB,IAAIlE,SAAQ,SAACnI,GAC1B,CAAC,mBAAmBjF,SAASiF,EAAEG,OACjCH,EAAEuE,MAAQ,2BAIP6C,EAASkF,iBACTlF,EAASmF,iBAElB,CAAElB,MAAM,IAGHjE,GAvBEA","file":"static/js/23.4208ebea.chunk.js","sourcesContent":["import { useState, useEffect } from 'react';\nimport { useHistory } from 'react-router-dom';\nimport useLocalStorage from 'react-use/lib/useLocalStorage';\n\nimport { BlockletEvents } from '@blocklet/meta/lib/constants';\n\nimport useQuery from './query';\nimport { useSubscription } from '../libs/ws';\n\nexport default function useBlockletPurchase(did) {\n const query = useQuery();\n const history = useHistory();\n const [sessionId, setSessionId] = useLocalStorage(`sid:blocklet:purchase:${did}`);\n const [hasCompleted, setCompleted] = useState(false);\n const [session, setSession] = useState(null);\n\n const doRedirect = () => {\n const { pathname, searchParams } = new URL(window.location.href);\n const prefix = window.env && window.env.apiPrefix ? window.env.apiPrefix : '/';\n if (searchParams.get('sid')) {\n setSessionId('');\n history.replace(pathname.replace(prefix, '/'));\n }\n };\n\n const hasPurchased = !!(query.get('assetDid') && sessionId && query.get('sid') === sessionId);\n\n useSubscription(BlockletEvents.purchaseChange, e => {\n if (e.did === did) {\n setSession(e.session);\n\n if (['declined', 'confirmed', 'error'].includes(e.session.status)) {\n setCompleted(true);\n setTimeout(doRedirect, 2000);\n }\n }\n });\n\n useEffect(() => {\n if (session && session.id !== sessionId) {\n setSessionId(session.id);\n }\n }, [session]); // eslint-disable-line\n\n return {\n hasCompleted,\n hasPurchased,\n session,\n setSession,\n doRedirect,\n };\n}\n","/* eslint-disable react/jsx-one-expression-per-line */\nimport React, { forwardRef, useState } from 'react';\nimport joinURL from 'url-join';\nimport PropTypes from 'prop-types';\n\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport Spinner from '@arcblock/ux/lib/Spinner';\nimport Dialog from '@arcblock/ux/lib/Dialog';\nimport Typography from '@material-ui/core/Typography';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\n\nimport IconPurchase from '@material-ui/icons/ShoppingCart';\nimport IconVerify from '@material-ui/icons/VerifiedUser';\n\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport Button from '@arcblock/ux/lib/Button';\nimport DidConnect from '@arcblock/did-connect/lib/Connect';\nimport colors from '@arcblock/ux/lib/Colors';\n\nimport { useSessionContext } from '../../contexts/session';\nimport { useNodeContext } from '../../contexts/node';\nimport { getWebWalletUrl } from '../../libs/util';\nimport useBlockletPurchase from '../../hooks/blocklet-purchase';\n\nconst useStyles = makeStyles(() => ({\n dialogAuth: {\n padding: '0 0 24px !important',\n '& .auth-title': {\n textAlign: 'center !important',\n marginBottom: '4px !important',\n },\n '& .auth-tip--scan': {\n textAlign: 'center !important',\n },\n },\n iconRoot: {\n minWidth: 48,\n },\n}));\n\nfunction BlockletPurchase({ meta, mode, onCancel }) {\n const { t, locale } = useLocaleContext();\n const { info, api: gql } = useNodeContext();\n const { api } = useSessionContext();\n const classes = useStyles();\n const [action, setAction] = useState(mode !== 'both' ? mode : '');\n const [step, setStep] = useState(mode !== 'both' ? 2 : 1);\n const { session, setSession, hasCompleted, doRedirect } = useBlockletPurchase(meta.did);\n\n const webWalletUrl = getWebWalletUrl(info);\n const prefix = window.env && window.env.apiPrefix ? window.env.apiPrefix : '/';\n\n const onSelect = async act => {\n if (act === action) {\n return;\n }\n\n setAction(act);\n };\n\n const onNext = async () => {\n if (!action) {\n return;\n }\n if (step === 2) {\n return;\n }\n\n // Start a new session and persist session id to local storage\n const payload = JSON.stringify({ blockletDid: meta.did, registryUrl: info.blockletRegistry, action });\n const { session: initial } = await gql.startSession({ input: { data: payload } });\n setSession(initial);\n\n setStep(2);\n\n if (action === 'purchase') {\n setTimeout(async () => {\n const cb = new URL(window.location.href);\n cb.searchParams.delete('assetDid');\n cb.searchParams.set('sid', initial.id);\n cb.searchParams.set('locale', locale);\n const callback = encodeURIComponent(cb.href);\n\n const nw = new URL(window.location.href);\n nw.pathname = joinURL(prefix, '/api/did/verify-purchase/token');\n nw.searchParams.set('sid', initial.id);\n nw.searchParams.set('locale', locale);\n nw.searchParams.set('autoConnect', 'false');\n const { data } = await api.get(nw.href);\n const nextWorkflow = encodeURIComponent(data.url);\n\n window.location.href = joinURL(\n info.blockletRegistry,\n `/store/purchase/${meta.nftFactory}?cb=${callback}&nw=${nextWorkflow}`\n );\n }, 100);\n }\n };\n\n const onClose = () => {\n doRedirect();\n onCancel();\n setStep(1);\n };\n\n const onVerifySuccess = () => {\n setTimeout(onCancel, 2000);\n };\n\n const options = [\n {\n action: 'purchase',\n title: t('store.purchase.purchase.title'),\n description: t('store.purchase.purchase.description'),\n },\n {\n action: 'verify',\n title: t('store.purchase.verify.title'),\n description: t('store.purchase.verify.description'),\n },\n ];\n\n const getMessage = () => {\n if (session) {\n if (session.status === 'confirmed') {\n return t('store.purchase.confirmed');\n }\n if (session.status === 'declined') {\n return t('store.purchase.declined');\n }\n if (session.status === 'error') {\n return session.message;\n }\n }\n\n return t('store.purchase.waiting');\n };\n\n if (step === 2 && action === 'verify' && session) {\n return (\n <DidConnect\n popup\n open\n className={classes.dialogAuth}\n action=\"verify-purchase\"\n checkFn={api.get}\n checkTimeout={10 * 60 * 1000}\n socketUrl={api.socketUrl}\n webWalletUrl={webWalletUrl}\n extraParams={{ locale, sid: session.id }}\n onSuccess={onVerifySuccess}\n onClose={onClose}\n showDownload={false}\n locale={locale}\n messages={{\n title: t('store.purchase.auth.title'),\n scan: t('store.purchase.auth.scan'),\n confirm: t('store.purchase.auth.confirm'),\n success: t('store.purchase.auth.success'),\n }}\n />\n );\n }\n\n return (\n <Dialog\n title={action && step === 2 ? t(`store.purchase.${action}.title`) : t('store.purchase.title')}\n disableBackdropClick\n disableEscapeKeyDown\n open\n fullWidth\n onClose={onClose}>\n {step === 1 && (\n <div style={{ marginBottom: 16 }}>\n <List className={classes.tabPanel}>\n {options.map(x => (\n <ListItem button key={x.action} selected={action === x.action} onClick={() => onSelect(x.action)}>\n <ListItemIcon className={classes.iconRoot}>\n {x.action === 'purchase' ? (\n <IconPurchase\n style={{ color: action === 'purchase' ? colors.primary.main : '#AAA', fontSize: 32 }}\n />\n ) : (\n <IconVerify style={{ color: action === 'verify' ? colors.primary.main : '#AAA', fontSize: 32 }} />\n )}\n </ListItemIcon>\n <ListItemText primary={x.title} secondary={x.description} />\n </ListItem>\n ))}\n </List>\n <Button\n rounded\n fullWidth\n disabled={!action}\n variant=\"contained\"\n color=\"primary\"\n style={{ marginTop: 16 }}\n onClick={onNext}>\n {t('common.next')}\n </Button>\n </div>\n )}\n {step === 2 && action === 'purchase' && (\n <div style={{ textAlign: 'center' }}>\n {!hasCompleted && <Spinner />}\n <Typography component=\"p\">{getMessage()}</Typography>\n </div>\n )}\n </Dialog>\n );\n}\n\nBlockletPurchase.propTypes = {\n meta: PropTypes.object.isRequired,\n mode: PropTypes.oneOf(['both', 'verify']).isRequired,\n onCancel: PropTypes.func.isRequired,\n};\n\nexport default forwardRef(BlockletPurchase);\n","/* eslint-disable react/jsx-one-expression-per-line */\nimport React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { useHistory } from 'react-router-dom';\nimport { isFreeBlocklet } from '@blocklet/meta/lib/util';\nimport { useSnackbar } from 'notistack';\n\nimport Spinner from '@arcblock/ux/lib/Spinner';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@arcblock/ux/lib/Button';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport { gt } from 'semver';\n\nimport { useBlockletContext } from '../../contexts/blocklets';\nimport { isInstalling, formatError } from '../../libs/util';\nimport useBlockletPurchase from '../../hooks/blocklet-purchase';\nimport Permission from '../permission';\nimport PurchaseDialog from './purchase';\n\nexport default function InstallOrUpgrade({ meta, lastVersion, buttonText, registryUrl, ...rest }) {\n const { enqueueSnackbar } = useSnackbar();\n const { t } = useLocaleContext();\n const history = useHistory();\n\n const { api, data: installedBlocklets } = useBlockletContext();\n const state = installedBlocklets.find(d => d.meta.did === meta.did) || {};\n\n const installed = useMemo(() => !!state.status, [state.status]);\n const installedVersion = useMemo(() => (installed ? state.meta?.version : null), [installed, state.meta]);\n const requirePurchase = isFreeBlocklet(meta) === false;\n\n const [loading, setLoading] = useState(false);\n const { hasPurchased } = useBlockletPurchase(meta.did);\n const [showPurchaseDialog, setShowPurchaseDialog] = useState(false);\n\n const loadingText = useMemo(() => {\n if (loading) {\n if (installed) {\n return t('blocklet.status.upgrading');\n }\n if (requirePurchase) {\n return t('blocklet.status.purchasing');\n }\n return t('blocklet.status.waiting');\n }\n if (isInstalling(state.status)) return t(`common.${state.status}`);\n return '';\n }, [loading, state.status, installed, t, requirePurchase]);\n\n const needUpgrade = useMemo(() => {\n if (!lastVersion || !installedVersion) {\n return false;\n }\n\n if (lastVersion) {\n if (gt(lastVersion, installedVersion)) {\n return true;\n }\n }\n\n return false;\n }, [lastVersion, installedVersion]);\n\n const btnTxt = useMemo(() => {\n if (needUpgrade) return buttonText.upgrade;\n if (installed) return buttonText.open;\n if (requirePurchase) return buttonText.purchase;\n return buttonText.install;\n }, [installed, needUpgrade, requirePurchase, buttonText]);\n\n // only installed without upgrade show open button\n const showInstallBtn = useMemo(() => !(installed && !needUpgrade), [installed, needUpgrade]);\n\n const onAction = async e => {\n e.preventDefault();\n e.stopPropagation();\n\n try {\n setLoading(true);\n // The purchase dialog should only show on install\n if (!installed && requirePurchase) {\n setShowPurchaseDialog(true);\n return;\n }\n\n const fn = !installed ? 'installBlocklet' : 'upgradeBlocklet';\n await api[fn]({ input: { did: meta.did, registryUrl } });\n } catch (err) {\n enqueueSnackbar(formatError(err), { autoHideDuration: 5000, variant: 'error' });\n console.error('Blocklet installed failed', err);\n } finally {\n setLoading(false);\n }\n };\n\n const InstallButton = ({ disabled }) => (\n <Button\n key={meta.did}\n onClick={onAction}\n size=\"small\"\n disabled={Boolean(loadingText || disabled)}\n variant=\"contained\"\n color=\"primary\"\n data-cy=\"install-blocklet\"\n rounded\n {...rest}>\n {loadingText ? (\n <>\n <Spinner size={[16, 10]} style={{ marginRight: 3 }} />\n {loadingText}\n </>\n ) : (\n btnTxt\n )}\n </Button>\n );\n\n InstallButton.propTypes = {\n disabled: PropTypes.bool,\n };\n\n InstallButton.defaultProps = {\n disabled: false,\n };\n\n const getTab = d => {\n if (d) {\n return (d.configs || []).some(x => x.required && !x.value) ? 'configuration' : 'overview';\n }\n\n return 'overview';\n };\n\n const onGoDetail = e => {\n e.preventDefault();\n e.stopPropagation();\n history.push(`/blocklets/${meta.did}/${getTab(state)}`);\n };\n\n const onCancelPurchase = () => {\n setLoading(false);\n setShowPurchaseDialog(false);\n };\n\n return (\n <>\n <div>\n {showInstallBtn ? (\n <Permission permission=\"mutate_blocklet\">\n {hasPermission => <InstallButton disabled={!hasPermission} />}\n </Permission>\n ) : (\n <Button\n rounded\n className=\"action-button\"\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n disabled={Boolean(loadingText)}\n data-cy=\"open-blocklet\"\n onClick={onGoDetail}>\n {loadingText ? (\n <>\n <Spinner size={[16, 10]} style={{ marginRight: 3 }} />\n {loadingText}\n </>\n ) : (\n btnTxt\n )}\n </Button>\n )}\n\n {installed && requirePurchase && (\n <Typography component=\"small\" style={{ fontSize: 12, color: '#666', marginLeft: 4 }}>\n {t('blocklet.status.purchased')}\n </Typography>\n )}\n </div>\n {((hasPurchased && !installed) || showPurchaseDialog) && (\n <PurchaseDialog meta={meta} mode={hasPurchased ? 'purchase' : 'both'} onCancel={onCancelPurchase} />\n )}\n </>\n );\n}\n\nInstallOrUpgrade.propTypes = {\n meta: PropTypes.object.isRequired,\n lastVersion: PropTypes.string,\n buttonText: PropTypes.shape({\n purchase: PropTypes.string.isRequired,\n open: PropTypes.string.isRequired,\n install: PropTypes.string.isRequired,\n upgrade: PropTypes.string.isRequired,\n }).isRequired,\n registryUrl: PropTypes.string.isRequired,\n};\n\nInstallOrUpgrade.defaultProps = {\n lastVersion: '',\n};\n","import React, { useContext } from 'react';\nimport styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport Typography from '@material-ui/core/Typography';\nimport Icon from '@arcblock/ux/lib/Icon';\nimport { LocaleContext } from '@arcblock/ux/lib/Locale/context';\n\nexport default function Stats({ stats, ...rest }) {\n const { t } = useContext(LocaleContext);\n stats.downloads = stats.downloads || 0;\n return (\n <Div component=\"p\" {...rest}>\n {\n <span className=\"blocklet__stat\" title={t('blocklet.list.download')}>\n <Icon name=\"arrow-to-bottom\" size={14} className=\"blocklet__stat__icon\" />\n {stats.downloads}\n </span>\n }\n {/* star 暂未开放 */}\n {!!stats.star && (\n <span className=\"blocklet__stat\" title={t('blocklet.list.star')}>\n <Icon name=\"heart\" size={14} className=\"blocklet__stat__icon\" />\n {stats.star}\n </span>\n )}\n </Div>\n );\n}\n\nStats.propTypes = {\n stats: PropTypes.object.isRequired,\n};\n\nconst Div = styled(Typography)`\n .blocklet__stat {\n margin-right: 16px;\n font-size: 14px;\n font-weight: 500;\n color: #999;\n &:last-child {\n // 理论上需要设置成0,但视觉效果不是很好,加上了一个小的间距\n margin-right: 5px;\n }\n\n .blocklet__stat__icon {\n margin-right: 4px;\n color: inherit !important;\n }\n }\n`;\n","/* eslint-disable react/prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport get from 'lodash/get';\n\nimport CodeBlock from '@arcblock/ux/lib/CodeBlock';\n\nexport default function CodeBlockWrapper({ children }) {\n if (!Array.isArray(get(children, '[0].props.children'))) {\n return null;\n }\n\n const {\n className,\n children: [code],\n } = children[0].props;\n const language = (className || '').split('-').pop();\n\n if (!code) {\n return null;\n }\n\n return <CodeBlock language={language || 'shell'} code={code} />;\n}\n\nCodeBlock.propTypes = {\n children: PropTypes.node.isRequired,\n};\n","/* eslint-disable operator-linebreak */\nimport React from 'react';\nimport RehypeReact from 'rehype-react';\n\nimport Typography from '@material-ui/core/Typography';\nimport Alert from '@arcblock/ux/lib/Alert';\n\nimport CodeBlock from './code';\n\nconst components = {\n pre: CodeBlock,\n alert: Alert,\n p: props => <Typography variant=\"body1\" {...props} />,\n h2: props => <Typography variant=\"h3\" {...props} />,\n h3: props => <Typography variant=\"h4\" {...props} />,\n h4: props => <Typography variant=\"h5\" {...props} />,\n h5: props => <Typography variant=\"h5\" {...props} />,\n h6: props => <Typography variant=\"h6\" {...props} />,\n};\n\nfunction createElement(component, props, children) {\n const Tag =\n (components && component && components[component]) || // Get component from map if present\n component || // Otherwise just the string\n 'div'; // Default to div\n\n // And return the formed component\n return <Tag {...props}>{children}</Tag>;\n}\n\nexport default new RehypeReact({ createElement }).Compiler;\n","/* eslint-disable operator-linebreak */\n/* eslint-disable react/jsx-one-expression-per-line */\n/* eslint-disable react/jsx-no-target-blank */\nimport React, { useMemo, useState } from 'react';\nimport styled from 'styled-components';\nimport useAsyncRetry from 'react-use/lib/useAsyncRetry';\nimport { useParams, Link } from 'react-router-dom';\nimport joinURL from 'url-join';\n\nimport Spinner from '@arcblock/ux/lib/Spinner';\nimport Typography from '@material-ui/core/Typography';\nimport Breadcrumbs from '@material-ui/core/Breadcrumbs';\nimport Grid from '@material-ui/core/Grid';\nimport Tag from '@arcblock/ux/lib/Tag';\nimport ImageGallery from 'react-image-gallery';\n\nimport Alert from '@arcblock/ux/lib/Alert';\nimport { isFreeBlocklet } from '@blocklet/meta/lib/util';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\n\nimport 'github-markdown-css/github-markdown.css';\nimport 'react-image-gallery/styles/css/image-gallery.css';\n\nimport Stats from '../../components/blocklet/stats';\nimport renderAst from '../../components/render-ast';\nimport InstallOrUpgrade from '../../components/blocklet/install';\n\nimport { useNodeContext } from '../../contexts/node';\nimport {\n formatError,\n formatFactoryPrice,\n formatPerson,\n formatRegistryScreenshotPath,\n formatTimeFromNow,\n formatToDatetime,\n parseRegistryUrl,\n} from '../../libs/util';\n\nconst changeImgSrc = (children, blockletRegistry) => {\n children.forEach(child => {\n if (\n child.tagName &&\n child.tagName === 'img' &&\n child.properties &&\n child.properties.src &&\n !child.properties.src.startsWith('http')\n ) {\n child.properties.src = joinURL(blockletRegistry, `/${child.properties.src}`);\n if (child.properties.srcSet && Array.isArray(child.properties.srcSet)) {\n child.properties.srcSet = child.properties.srcSet.map(item => {\n if (!item.startsWith('http')) {\n return joinURL(blockletRegistry, item);\n }\n return item;\n });\n }\n }\n if (child.children && Array.isArray(child.children) && child.children.length > 0) {\n changeImgSrc(child.children, blockletRegistry);\n }\n });\n};\n\nexport default function BlockletStoreDetail() {\n const { did } = useParams();\n const { api, info } = useNodeContext();\n const { t } = useLocaleContext();\n const [lastVersion, setLastVersion] = useState([]);\n\n const currentRegistry = info.blockletRegistryList.find(x => x.selected);\n\n const state = useAsyncRetry(async () => {\n const { meta } = await api.getBlockletMeta({ input: { did, registryUrl: info.blockletRegistry } });\n\n setLastVersion(meta.version);\n\n return meta;\n });\n\n const onSubmit = async ({ action, version, blocklet }) => {\n try {\n const fn = action === 'install' ? 'installBlocklet' : 'upgradeBlocklet';\n await api[fn]({ input: { did: blocklet.did, version } });\n state.retry();\n } catch (err) {\n console.error(`Blocklet ${action} failed`, err);\n }\n };\n\n let content = null;\n const priceList = useMemo(() => formatFactoryPrice(state.value), [state.value]);\n if (state.value) {\n const {\n name,\n version,\n keywords,\n htmlAst,\n stats,\n screenshots = [],\n author,\n documentation,\n repository,\n community,\n support,\n title,\n lastPublishedAt,\n color = 'primary',\n } = state.value;\n\n if (htmlAst && htmlAst.children && Array.isArray(htmlAst.children)) {\n changeImgSrc(htmlAst.children, info.blockletRegistry);\n }\n\n const titleInfo = title || name;\n content = (\n <Div color={color}>\n <div className=\"meta\">\n <Typography component=\"h2\" variant=\"h2\" className=\"title\">\n {titleInfo}\n <span className=\"payment\">\n <span className=\"payment__price\">\n {isFreeBlocklet(state.value)\n ? t('common.free')\n : priceList.map(item => `${item.value} ${item.name}`).join(' + ')}\n </span>\n <span className=\"payment__tip\">\n {isFreeBlocklet(state.value) ? 'This blocklet is free to use' : 'You need to pay to use this blocklet'}\n </span>\n </span>\n </Typography>\n <Stats stats={stats} className=\"blocklet__stats\" />\n <Typography component=\"p\" className=\"tags\">\n <Tag className=\"tag\" type=\"reverse\">\n v{version}\n </Tag>\n {Array.isArray(keywords) &&\n keywords.length > 0 &&\n keywords.map(keyword => (\n <Tag className=\"tag\" key={keyword}>\n {keyword}\n </Tag>\n ))}\n </Typography>\n </div>\n <div className=\"markdown-body\">\n <Grid container spacing={4}>\n {screenshots.length > 0 ? (\n <Grid item xs={12} md={8}>\n <ImageGallery\n lazyLoad\n showNav={false}\n showThumbnails\n showPlayButton={false}\n showFullscreenButton={false}\n showBullets\n items={screenshots.map(x => ({\n original: joinURL(info.blockletRegistry, formatRegistryScreenshotPath(did, x)),\n thumbnail: joinURL(info.blockletRegistry, formatRegistryScreenshotPath(did, x)),\n }))}\n />\n </Grid>\n ) : (\n <Grid item xs={12} md={8}>\n <PostContent component=\"div\" className=\"content-wrapper post-content\">\n {renderAst(htmlAst)}\n </PostContent>\n </Grid>\n )}\n <Grid item xs={12} md={4}>\n <InstallOrUpgrade\n meta={state.value}\n lastVersion={lastVersion}\n onSubmit={onSubmit}\n className=\"action-button\"\n buttonText={{\n purchase: t('store.detail.purchase', { name: titleInfo }),\n open: t('store.detail.open', { name: titleInfo }),\n install: t('store.detail.install', { name: titleInfo }),\n upgrade: t('store.detail.upgrade', { name: titleInfo }),\n }}\n registryUrl={currentRegistry.url}\n />\n <Typography component=\"ul\" className=\"meta-info\">\n {!!author && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.author')}</span>\n <span className=\"info-row__value\">{formatPerson(author)}</span>\n </li>\n )}\n {!!repository && !!repository.url && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.repository')}</span>\n <a\n href={parseRegistryUrl(repository.url)}\n target=\"_blank\"\n className=\"info-row__value\"\n title={repository.type}>\n {parseRegistryUrl(repository.url)}\n </a>\n </li>\n )}\n {!!community && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.community')}</span>\n <a href={community} target=\"_blank\" className=\"info-row__value\">\n {community}\n </a>\n </li>\n )}\n {!!documentation && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.documentation')}</span>\n <a href={documentation} target=\"_blank\" className=\"info-row__value\">\n {documentation}\n </a>\n </li>\n )}\n {!!support && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.support')}</span>\n <a href={`mailto:${support}`} target=\"_blank\" className=\"info-row__value\">\n {support}\n </a>\n </li>\n )}\n {lastPublishedAt && (\n <li className=\"meta-info__row\">\n <span className=\"info-row__key\">{t('common.lastPublishedAt')}</span>\n <span className=\"info-row__value\" title={formatToDatetime(lastPublishedAt)}>\n {formatTimeFromNow(lastPublishedAt)}\n </span>\n </li>\n )}\n </Typography>\n </Grid>\n </Grid>\n {screenshots.length > 0 && (\n <PostContent component=\"div\" className=\"content-wrapper post-content\">\n {renderAst(htmlAst)}\n </PostContent>\n )}\n </div>\n </Div>\n );\n } else if (state.error) {\n content = (\n <Alert type=\"error\" variant=\"icon\">\n {formatError(state.error)}\n </Alert>\n );\n } else {\n content = <Spinner />;\n }\n\n return (\n <main>\n <Breadcrumbs separator=\"›\" aria-label=\"breadcrumb\" className=\"page-breadcrumb\">\n <Link color=\"secondary\" to=\"/store\">\n <Typography color=\"secondary\">{t('common.store')}</Typography>\n </Link>\n <Typography color=\"textPrimary\">{currentRegistry.name}</Typography>\n <Typography color=\"textPrimary\">{t('common.detail')}</Typography>\n </Breadcrumbs>\n {content}\n </main>\n );\n}\n\nconst codeFont = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important';\nconst Div = styled.div`\n margin: 24px 0;\n\n .title {\n font-size: 40px;\n font-weight: bold;\n color: ${props => props.theme.palette.text.primary};\n margin-bottom: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n @media (max-width: ${props => props.theme.breakpoints.values.sm}px) {\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n }\n }\n\n .payment {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n @media (max-width: ${props => props.theme.breakpoints.values.sm}px) {\n margin-top: 16px;\n align-items: flex-start;\n }\n\n .payment__price {\n margin-bottom: 8px;\n color: ${props => props.theme.palette.primary.main};\n }\n\n .payment__tip {\n font-size: 14px;\n color: ${props => props.theme.palette.text.primary};\n font-weight: normal;\n }\n }\n\n .blocklet__stats {\n margin-bottom: 16px;\n }\n\n .tags {\n margin: 16px 0 48px;\n @media (max-width: ${props => props.theme.breakpoints.values.sm}px) {\n margin-bottom: 32px;\n }\n\n .tag {\n margin-right: 8px;\n text-transform: capitalize;\n &:last-of-type {\n margin-right: 0;\n }\n }\n }\n\n .action-button {\n width: 100%;\n padding: 8px 22px;\n border-radius: 0 !important;\n }\n\n .meta-info {\n list-style: none;\n padding: 0;\n margin: 24px 0;\n\n .meta-info__row {\n display: flex;\n line-height: 2;\n }\n\n .info-row__key {\n width: 130px;\n flex-shrink: 0;\n font-weight: 500;\n }\n .info-row__value {\n white-space: break-word;\n word-break: break-all;\n }\n }\n\n .sidebar-buttons {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .use-button {\n width: 100%;\n }\n\n .image-gallery {\n .image-gallery-thumbnail.active {\n border-color: ${props => props.theme.palette.primary.main};\n }\n .image-gallery-bullets .image-gallery-bullet {\n border-color: ${props => props.theme.palette.primary.main};\n box-shadow: none;\n }\n .image-gallery-bullets .image-gallery-bullet.active {\n background-color: ${props => props.theme.palette.primary.main};\n }\n .image-gallery-slide {\n .image-gallery-image {\n display: flex;\n justify-content: center;\n img {\n max-height: 600px !important;\n width: auto;\n margin: 0 auto;\n @media (max-width: ${props => props.theme.breakpoints.values.sm}px) {\n height: auto;\n max-height: auto;\n }\n }\n }\n }\n }\n\n .markdown-body .highlight pre,\n .markdown-body pre {\n background-color: #222;\n border-radius: 5px;\n }\n .markdown-body code {\n font-family: ${codeFont};\n }\n .markdown-body pre code {\n color: #fff;\n font-size: 14px;\n font-family: ${codeFont};\n }\n\n .markdown-body h1,\n .markdown-body h2,\n .markdown-body h3,\n .markdown-body h4,\n .markdown-body h5,\n .markdown-body h6 {\n font-weight: 600;\n line-height: 1.25;\n margin-bottom: 16px;\n margin-top: 24px;\n border-bottom: none;\n }\n\n .markdown-body .CodeMirror pre {\n background: #f6f8fa !important;\n }\n\n .markdown-body .anchor {\n display: none;\n }\n`;\n\nconst PostContent = styled(Typography)`\n width: 100%;\n word-wrap: break-word;\n word-break: break-word;\n line-height: 1.5em;\n\n .alert-content {\n max-width: 100%;\n p:last-of-type {\n margin-bottom: 0;\n }\n }\n\n iframe {\n width: 100% !important;\n }\n\n a {\n color: ${props => props.theme.palette.primary.main};\n }\n`;\n","/* eslint-disable no-await-in-loop */\nconst get = require('lodash/get');\n\nconst forEachBlocklet = (blocklet, cb, { parallel = false, sync } = {}) => {\n // sync\n if (sync) {\n cb(blocklet);\n if (blocklet.children) {\n for (const child of blocklet.children) {\n cb(child);\n }\n }\n return null;\n }\n\n // serial\n if (!parallel) {\n return (async () => {\n await cb(blocklet);\n if (blocklet.children) {\n for (const child of blocklet.children) {\n await cb(child);\n }\n }\n return null;\n })();\n }\n\n // parallel\n const tasks = [];\n tasks.push(cb(blocklet));\n if (blocklet.children) {\n for (const child of blocklet.children) {\n tasks.push(cb(child));\n }\n }\n return Promise.all(tasks);\n};\n\nconst isAuthServiceEnabled = (blocklet) => {\n const interfaces = get(blocklet, 'meta.interfaces') || [];\n const isRootEnabled = interfaces.some((x) => {\n const services = get(x, 'services') || [];\n return services.some((s) => s.name === '@abtnode/auth-service');\n });\n\n if (isRootEnabled) {\n return true;\n }\n\n const children = get(blocklet, 'children') || [];\n for (const child of children) {\n if (isAuthServiceEnabled(child)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst getRequiredMissingConfigs = (blocklet) => {\n const missingConfigs = [];\n const configs = blocklet.configs || [];\n configs.forEach((item) => {\n if (item.required && !item.value) {\n missingConfigs.push({ did: blocklet.meta.did, key: item.key });\n }\n });\n\n // eslint-disable-next-line no-restricted-syntax\n for (const child of blocklet.children || []) {\n const childConfigs = child.configs || [];\n // configProp does not exist in root blocklet config\n // or value of configProp in root blocklet config is empty.\n childConfigs.forEach((x) => {\n if (x.required && !x.value && !configs.some((y) => y.key === x.key && y.value)) {\n missingConfigs.push({ did: child.meta.did, key: x.key });\n }\n });\n }\n\n return missingConfigs;\n};\n\nconst isFreeBlocklet = (meta) => {\n if (!meta.payment) {\n return true;\n }\n\n const priceList = (meta.payment.price || []).map((x) => x.value || 0);\n return priceList.every((x) => x === 0);\n};\n\nconst wipeSensitiveData = (blocklet) => {\n if (!blocklet) {\n return blocklet;\n }\n\n forEachBlocklet(\n blocklet,\n (d) => {\n (d.configs || []).forEach((x) => {\n if (x.secure) {\n x.value = x.value ? '__encrypted__' : '';\n }\n });\n (d.environments || []).forEach((x) => {\n if (['BLOCKLET_APP_SK'].includes(x.key)) {\n x.value = '__encrypted__';\n }\n });\n\n delete blocklet.configObj;\n delete blocklet.environmentObj;\n },\n { sync: true }\n );\n\n return blocklet;\n};\n\nmodule.exports = {\n isFreeBlocklet,\n forEachBlocklet,\n isAuthServiceEnabled,\n getRequiredMissingConfigs,\n wipeSensitiveData,\n};\n"],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["components/launch-blocklet/content-layout.js","components/launch-blocklet/button.js","components/launch-blocklet/complete.js","components/launch-blocklet/app-logo.js","components/launch-blocklet/status/upgrade-available.js","components/launch-blocklet/status/not-running.js","components/launch-blocklet/status/error.js","components/launch-blocklet/install.js","components/launch-blocklet/agreement-app.js","components/launch-blocklet/agreement.js","components/launch-blocklet/center.js","pages/launch-blocklet/purchase-app.js","pages/launch-blocklet/index.js","../../../blocklet/meta/lib/util.js"],"names":["ContentLayout","children","props","Container","styled","div","theme","breakpoints","up","down","WrappedButton","rounded","variant","color","React","forwardRef","ref","forwardedRef","palette","error","main","success","Complete","blockletMeta","t","useLocaleContext","info","useNodeContext","query","useQuery","accessUrl","decodeURIComponent","get","Typography","component","className","appName","title","serverName","name","href","AppLogo","blockletMetaUrl","src","getBlockletLogoUrl","did","logoPath","logo","baseUrl","URL","origin","width","size","placeholder","Upgrade","onCancel","onUpgrade","Body","Footer","onClick","defaultProps","NotRunning","useTheme","isBreakpointsDownSm","useMediaQuery","style","Link","to","fullWidth","Error","message","actions","capitalize","SESSION_KEY","getSessionToken","localStorage","getItem","Waiting","Install","api","locale","useState","openAuth","setOpenAuth","launching","setLaunching","existed","status","upgradeAvailable","blocklet","launchState","setLaunchState","history","useHistory","meta","loading","blockletState","setBlockletState","blockletRegistryUrl","wsClient","useEffect","isConnected","disconnect","redirectToBlockletOverview","push","encodeURIComponent","handleInstalled","a","getRequiredMissingConfigs","length","setTimeout","handleRunningBlocklet","blockletInterface","interfaces","find","item","url","hostname","endsWith","didDomain","getBlockletName","handleSuccessEvent","nodeClient","createNewClient","getBlocklet","input","result","handleLaunchState","handleStartFailed","pre","createLaunchFailedHandler","errorMessage","createBlockletEventHandler","handler","handleBlockletExisted","includes","handleUpgradeAvailable","handleUpgrade","version","registryUrl","upgradeBlocklet","handleAuthorized","sessionToken","createWsClient","connect","on","BlockletEvents","installed","started","startFailed","downloadFailed","installFailed","handleConnectSuccess","value","setItem","token","semver","gt","appDidEnv","environments","e","key","appDid","currentVersion","removeItem","console","func","type","marginTop","textAlign","window","env","apiPrefix","isFree","b","disabled","Hidden","smDown","mdUp","open","popup","action","checkFn","axios","create","baseURL","checkTimeout","socketUrl","webWalletUrl","getWebWalletUrl","onSuccess","onClose","messages","scan","confirm","extraParams","AgreementApp","Agreement","currentTab","setCurrentTab","tabMap","Map","label","AgreementNode","tabs","values","TabContent","Content","current","onChange","location","search","Center","AppInfo","pay","setPay","toNextStep","priceList","formatFactoryPrice","author","map","index","Fragment","display","alignItems","margin","fontSize","marginLeft","joinUrl","factory","nftFactory","disableClose","showDownload","Launcher","path","useRouteMatch","trim","state","useAsync","getBlockletMetaFromUrl","checkPrice","wordBreak","firstPageUrl","basePath","getPathPrefix","steps","optional","headerEndAddons","showText","logoUrl","exact","PropTypes","object","isRequired","BlockletLauncher","require","forEachBlocklet","cb","parallel","sync","child","tasks","Promise","all","module","exports","isFreeBlocklet","payment","price","x","every","isAuthServiceEnabled","some","s","missingConfigs","configs","forEach","required","y","wipeSensitiveData","d","secure","configObj","environmentObj"],"mappings":"yaAIe,SAASA,EAAT,GAAgD,IAAvBC,EAAsB,EAAtBA,SAAaC,EAAS,iBAC5D,OAAO,kBAACC,EAAcD,EAAQD,GAOhC,IAAME,EAAYC,UAAOC,IAAV,ynBAmBT,SAAAH,GAAK,OAAIA,EAAMI,MAAMC,YAAYC,GAAG,SAIpC,SAAAN,GAAK,OAAIA,EAAMI,MAAMC,YAAYE,KAAK,SAUtC,SAAAP,GAAK,OAAIA,EAAMI,MAAMC,YAAYC,GAAG,SAIpC,SAAAN,GAAK,OAAIA,EAAMI,MAAMC,YAAYE,KAAK,S,iCC7C5C,SAASC,EAAT,GAAgD,IAAvBT,EAAsB,EAAtBA,SAAaC,EAAS,iBAC7C,OACE,kBAAC,IAAD,eAAQS,SAAO,EAACC,QAAQ,YAAYC,MAAM,WAAcX,GACrDD,GASQa,I,EAAAA,MAAMC,YAAW,SAACb,EAAOc,GAAR,OAAgB,kBAACN,EAAD,iBAAmBR,EAAnB,CAA0Be,aAAcD,QCyBxF,IAAMb,EAAYC,kBAAOJ,EAAPI,CAAH,6WAcX,SAAAF,GACA,OAAOA,EAAMI,MAAMC,YAAYE,KAAK,SAS3B,SAAAP,GAAK,MAAuB,UAAlBA,EAAMU,QAAsBV,EAAMI,MAAMY,QAAQC,MAAMC,KAAOlB,EAAMI,MAAMY,QAAQG,QAAQD,QAQjGE,EA7Df,YAAqC,IAAjBC,EAAg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G,EAAEpH,MAAQ,2BAIPhE,EAASiM,iBACTjM,EAASkM,iBAElB,CAAExB,MAAM,IAGH1K,GAvBEA","file":"static/js/28.9b1197ca.chunk.js","sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nexport default function ContentLayout({ children, ...props }) {\n return <Container {...props}>{children}</Container>;\n}\n\nContentLayout.propTypes = {\n children: PropTypes.any.isRequired,\n};\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n\n .header {\n text-align: center;\n }\n\n .body {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-top: 30px;\n width: 100%;\n min-height: 200px;\n\n ${props => props.theme.breakpoints.up('md')} {\n padding: 24px;\n }\n\n ${props => props.theme.breakpoints.down('sm')} {\n flex: 1;\n padding: 0 16px 16px;\n }\n }\n\n .footer {\n display: flex;\n justify-content: center;\n\n ${props => props.theme.breakpoints.up('sm')} {\n padding-bottom: 34px;\n }\n\n ${props => props.theme.breakpoints.down('sm')} {\n margin-top: auto;\n padding-bottom: 10px;\n }\n }\n`;\n","import React from 'react';\nimport Button from '@arcblock/ux/lib/Button';\nimport PropTypes from 'prop-types';\n\nfunction WrappedButton({ children, ...props }) {\n return (\n <Button rounded variant=\"contained\" color=\"primary\" {...props}>\n {children}\n </Button>\n );\n}\n\nWrappedButton.propTypes = {\n children: PropTypes.any.isRequired,\n};\n\nexport default React.forwardRef((props, ref) => <WrappedButton {...props} forwardedRef={ref} />);\n","import React from 'react';\nimport styled from 'styled-components';\nimport PropTypes from 'prop-types';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport { Typography } from '@material-ui/core';\nimport CheckCircle from '@material-ui/icons/CheckCircle';\nimport { useNodeContext } from '../../contexts/node';\n\nimport useQuery from '../../hooks/query';\nimport ContentLayout from './content-layout';\nimport Button from './button';\n\nfunction Complete({ blockletMeta }) {\n const { t } = useLocaleContext();\n const { info } = useNodeContext();\n const query = useQuery();\n const accessUrl = decodeURIComponent(query.get('accessUrl') || '');\n\n return (\n <Container>\n <Typography component=\"h5\" variant=\"h5\">\n {t('launchBlocklet.complete')}\n </Typography>\n <div className=\"body\">\n <CheckCircle className=\"circle_icon\" />\n <Typography className=\"app-info_desc\" component=\"span\">\n {t('launchBlocklet.installSuccess', {\n appName: blockletMeta ? blockletMeta.title : '',\n serverName: info.name,\n })}\n </Typography>\n </div>\n <div className=\"footer\">\n <Button href={accessUrl} className=\"bottom-button\">\n {t('common.open')}\n </Button>\n </div>\n </Container>\n );\n}\n\nconst Container = styled(ContentLayout)`\n .app-info_desc {\n font-weight: 400;\n margin-top: 40px;\n font-size: 18px;\n line-height: 21px;\n color: #222222;\n }\n\n .body {\n margin-top: 70px;\n text-align: center;\n }\n\n ${props => {\n return props.theme.breakpoints.down('sm');\n }} {\n .app-info_desc {\n font-size: 16px;\n }\n }\n\n .circle_icon {\n font-size: 58px;\n color: ${props => (props.variant === 'error' ? props.theme.palette.error.main : props.theme.palette.success.main)};\n }\n`;\n\nComplete.propTypes = {\n blockletMeta: PropTypes.object.isRequired,\n};\n\nexport default Complete;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Img from '@arcblock/ux/lib/Img';\nimport { getBlockletLogoUrl } from '../../libs/util';\n\nexport default function AppLogo({ blockletMeta, blockletMetaUrl }) {\n return (\n <Img\n src={getBlockletLogoUrl({\n did: blockletMeta.did,\n logoPath: blockletMeta.logo,\n baseUrl: new URL(blockletMetaUrl).origin,\n })}\n width={64}\n size=\"contain\"\n placeholder=\"application logo\"\n />\n );\n}\n\nAppLogo.propTypes = {\n blockletMeta: PropTypes.object.isRequired,\n blockletMetaUrl: PropTypes.string.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport AutorenewIcon from '@material-ui/icons/AutorenewOutlined';\nimport Button from '../button';\nimport ContentLayout from '../content-layout';\n\nexport default function Upgrade({ onCancel, onUpgrade }) {\n const { t } = useLocaleContext();\n return (\n <>\n <Body className=\"body\">\n <div className=\"upgrade-wrapper\">\n <AutorenewIcon className=\"upgrade-wrapper_icon\" />\n </div>\n <div className=\"status_title\">{t('launchBlocklet.newVersion')}</div>\n <div className=\"status_desc\">{t('launchBlocklet.newVersionDesc')}</div>\n </Body>\n <Footer className=\"footer\">\n <Button onClick={onCancel} variant=\"outlined\">\n {t('launchBlocklet.later')}\n </Button>\n <Button className=\"upgrade-button\" onClick={onUpgrade}>\n {t('launchBlocklet.upgradeNow')}\n </Button>\n </Footer>\n </>\n );\n}\n\nUpgrade.propTypes = {\n onCancel: PropTypes.func,\n onUpgrade: PropTypes.func,\n};\n\nUpgrade.defaultProps = {\n onCancel: () => {},\n onUpgrade: () => {},\n};\n\nconst Body = styled(ContentLayout)`\n .upgrade-wrapper {\n background-color: #4f6af6;\n border-radius: 50%;\n padding: 5px;\n width: 48px;\n height: 48px;\n\n .upgrade-wrapper_icon {\n color: white;\n width: 100%;\n height: 100%;\n }\n }\n`;\n\nconst Footer = styled.div`\n .upgrade-button {\n margin-left: 24px;\n }\n`;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router-dom';\nimport { useTheme } from 'styled-components';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport Button from '../button';\n\nexport default function NotRunning({ did }) {\n const { t } = useLocaleContext();\n const theme = useTheme();\n const isBreakpointsDownSm = useMediaQuery(theme.breakpoints.down('sm'));\n\n return (\n <>\n <div className=\"body\">\n <WarningIcon className=\"status_icon\" />\n <div className=\"status_title\">{t('launchBlocklet.error.installedButStopped')}</div>\n </div>\n <div className=\"footer\">\n <Button\n style={{ width: '300px' }}\n className=\"footer-item\"\n component={Link}\n to={`/blocklets/${did}/overview`}\n fullWidth={isBreakpointsDownSm}\n rounded\n color=\"primary\"\n variant=\"contained\">\n {t('launchBlocklet.viewApplication')}\n </Button>\n </div>\n </>\n );\n}\n\nNotRunning.propTypes = {\n did: PropTypes.string.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport capitalize from 'lodash/capitalize';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport CancelIcon from '@material-ui/icons/Cancel';\nimport styled from 'styled-components';\n\nexport default function Error({ message, actions }) {\n const { t } = useLocaleContext();\n\n return (\n <>\n <Body className=\"body\">\n <CancelIcon className=\"status_icon status_error\" />\n <div className=\"status_title status_error\">{capitalize(t('common.failed'))}</div>\n <div className=\"status_desc\">{message}</div>\n </Body>\n {actions && <div className=\"footer\">{actions}</div>}\n </>\n );\n}\n\nError.propTypes = {\n actions: PropTypes.any.isRequired,\n message: PropTypes.string.isRequired,\n};\n\nconst Body = styled.div`\n .status_error {\n color: #f16e6e;\n }\n`;\n","import React, { useEffect, useState } from 'react';\nimport { useHistory, Link } from 'react-router-dom';\nimport axios from 'axios';\nimport semver from 'semver';\nimport PropTypes from 'prop-types';\nimport styled, { useTheme } from 'styled-components';\nimport { Typography, useMediaQuery } from '@material-ui/core';\nimport ArrowForward from '@material-ui/icons/ArrowForward';\nimport Alert from '@arcblock/ux/lib/Alert';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport Spinner from '@arcblock/ux/lib/Spinner';\nimport Connect from '@arcblock/did-connect/lib/Connect';\nimport ABTNodeIcon from '@arcblock/icons/lib/ABTNode';\nimport { getRequiredMissingConfigs } from '@blocklet/meta/lib/util';\nimport { BlockletEvents } from '@blocklet/meta/lib/constants';\nimport Hidden from '@material-ui/core/Hidden';\nimport { useNodeContext } from '../../contexts/node';\nimport { getBlockletName, getWebWalletUrl } from '../../libs/util';\nimport { create as createWsClient } from '../../libs/ws';\nimport { create as createNewClient } from '../../libs/node';\nimport useQuery from '../../hooks/query';\nimport Button from './button';\nimport ContentLayout from './content-layout';\nimport AppLogo from './app-logo';\nimport StatusUpgrade from './status/upgrade-available';\nimport StatusNotRunning from './status/not-running';\nimport StatusError from './status/error';\n\nconst SESSION_KEY = 'abtnode_launch_blocklet_key';\nconst getSessionToken = () => localStorage.getItem(SESSION_KEY);\nconst setSessionToken = value => localStorage.setItem(SESSION_KEY, value);\nconst clearSessionToken = () => localStorage.removeItem(SESSION_KEY);\n\nfunction Install({ blockletMeta }) {\n const { api, info } = useNodeContext();\n const { t, locale } = useLocaleContext();\n const [openAuth, setOpenAuth] = useState(false);\n const [launching, setLaunching] = useState(false);\n const [launchState, setLaunchState] = useState({\n existed: false,\n status: t('launchBlocklet.installing'),\n upgradeAvailable: null,\n blocklet: null,\n error: null,\n });\n const theme = useTheme();\n const isBreakpointsDownSm = useMediaQuery(theme.breakpoints.down('sm'));\n const history = useHistory();\n const [blockletState, setBlockletState] = useState({\n meta: null,\n loading: true,\n error: null,\n });\n const query = useQuery();\n const blockletMetaUrl = query.get('blocklet_meta_url');\n const blockletRegistryUrl = new URL(blockletMetaUrl).origin;\n let wsClient = null;\n\n useEffect(() => {\n return () => {\n if (wsClient && wsClient.isConnected()) {\n wsClient.disconnect();\n }\n };\n }, [wsClient]);\n\n const redirectToBlockletOverview = blocklet => {\n const accessUrl = `/blocklets/${blocklet.meta.did}/configuration`;\n history.push(\n `/launch-blocklet/complete?status=installed&name=${encodeURIComponent(\n blocklet.meta.title\n )}&accessUrl=${encodeURIComponent(accessUrl)}&blocklet_meta_url=${blockletMetaUrl}`\n );\n };\n\n const handleInstalled = async blocklet => {\n setLaunchState({ ...launchState, status: t('blocklet.status.installed') });\n\n if (getRequiredMissingConfigs(blocklet).length > 0) {\n setTimeout(() => {\n redirectToBlockletOverview(blocklet);\n }, 1500);\n }\n };\n\n const handleRunningBlocklet = async blocklet => {\n const blockletInterface = blocklet.interfaces.find(item => {\n const urlObj = new URL(item.url);\n return urlObj.hostname.endsWith(info.didDomain);\n });\n\n let accessUrl = '';\n if (blockletInterface) {\n accessUrl = blockletInterface.url;\n }\n\n setLaunchState({\n ...launchState,\n status: `${t('blocklet.status.running')}, ${t('common.redirecting')}`,\n });\n\n setTimeout(() => {\n history.push(\n `/launch-blocklet/complete?name=${encodeURIComponent(\n getBlockletName(blocklet.meta)\n )}&accessUrl=${encodeURIComponent(accessUrl)}&blocklet_meta_url=${blockletMetaUrl}`\n );\n }, 1500);\n };\n\n const handleSuccessEvent = async blocklet => {\n const nodeClient = createNewClient(getSessionToken());\n const result = await nodeClient.getBlocklet({ input: { did: blocklet.meta.did } });\n\n await handleLaunchState(result.blocklet);\n };\n\n const handleErrored = () => {\n setLaunching(false);\n setLaunchState(pre => ({ ...pre, existed: true, error: new Error(t('launchBlocklet.error.installedButError')) }));\n };\n\n const handleUpgradeAvailable = (blocklet, upgradeAvailable) => {\n setLaunching(false);\n setLaunchState(pre => ({ ...pre, upgradeAvailable }));\n };\n\n const handleStopped = () => {\n setLaunching(false);\n setLaunchState(pre => ({ ...pre, existed: true }));\n };\n\n const handleStartFailed = async blocklet => {\n setLaunching(pre => ({ ...pre, error: new Error(t('launchBlocklet.error.startFailed')) }));\n await handleInstalled(blocklet);\n };\n\n const createLaunchFailedHandler = errorMessage => () => {\n setLaunchState({\n ...launchState,\n error: new Error(errorMessage),\n });\n };\n\n const createBlockletEventHandler = handler => blocklet => {\n if (blocklet.meta.did === blockletMeta.did) {\n handler(blocklet);\n }\n };\n\n const handleBlockletExisted = (blocklet, upgradeAvailable) => {\n if (upgradeAvailable) {\n handleUpgradeAvailable(blocklet, upgradeAvailable);\n return;\n }\n\n if (['stopped', 'stopping'].includes(blocklet.status)) {\n handleStopped(blocklet);\n return;\n }\n\n if (['error', 'corrupted'].includes(blocklet.status)) {\n handleErrored(blocklet);\n return;\n }\n\n if (blocklet.status === 'running') {\n handleRunningBlocklet(blocklet);\n return;\n }\n\n if (blocklet.status === 'installed') {\n handleInstalled(blocklet);\n }\n };\n\n const handleLaunchState = async (blocklet, upgradeAvailable) => {\n if (!blocklet) {\n setLaunching(false);\n setLaunchState({ ...launchState, error: new Error(t('launchBlocklet.error.launchFailed')) });\n return;\n }\n\n setLaunchState({ ...launchState, blocklet });\n handleBlockletExisted(blocklet, upgradeAvailable);\n };\n\n const handleCancelUpgrade = b => {\n if (b.status === 'running') {\n handleRunningBlocklet(b);\n return;\n }\n\n redirectToBlockletOverview(b);\n };\n\n const handleUpgrade = async (blocklet, upgradeAvailable) => {\n try {\n const input = {\n did: blocklet.meta.did,\n version: upgradeAvailable.version,\n registryUrl: blockletRegistryUrl,\n };\n\n setLaunching(true);\n setLaunchState({ ...launchState, status: t('common.upgrading') });\n await api.upgradeBlocklet({ input });\n } catch (error) {\n setLaunchState({ ...launchState, error: new Error(t('launchBlocklet.error.upgradeFailed')) });\n }\n };\n\n const handleAuthorized = async sessionToken => {\n wsClient = createWsClient(sessionToken);\n wsClient.connect();\n\n wsClient.on(BlockletEvents.installed, createBlockletEventHandler(handleSuccessEvent));\n wsClient.on(BlockletEvents.started, createBlockletEventHandler(handleSuccessEvent));\n wsClient.on(BlockletEvents.startFailed, createBlockletEventHandler(handleStartFailed));\n\n wsClient.on(\n BlockletEvents.downloadFailed,\n createBlockletEventHandler(createLaunchFailedHandler(t('launchBlocklet.error.downloadFailed')))\n );\n wsClient.on(\n BlockletEvents.installFailed,\n createBlockletEventHandler(createLaunchFailedHandler(t('launchBlocklet.error.installFailed')))\n );\n };\n\n const handleConnectSuccess = async ({ sessionToken, upgradeAvailable }) => {\n setSessionToken(sessionToken);\n await handleAuthorized(sessionToken);\n setLaunching(true);\n setOpenAuth(false);\n\n // 上面的事件成功订阅之前,Blocklet 可能已经安装成功了,所以这里重新获取一下 Blocklet 的状态,确保状态是正确的\n const nodeClient = createNewClient(sessionToken);\n const result = await nodeClient.getBlocklet({ input: { did: blockletMeta.did } });\n await handleLaunchState(result.blocklet, upgradeAvailable);\n };\n\n const handleClose = () => setOpenAuth(false);\n\n useEffect(() => {\n const func = async () => {\n try {\n const token = getSessionToken();\n if (token) {\n // 这里是为了校验 token 是否依然有效\n try {\n const nodeClient = createNewClient(token);\n const { blocklet } = await nodeClient.getBlocklet({ input: { did: blockletMeta.did } });\n\n handleAuthorized(token);\n\n if (blocklet) {\n setLaunching(true);\n if (semver.gt(blockletMeta.version, blocklet.meta.version)) {\n const appDidEnv = blocklet.environments.find(e => e.key === 'BLOCKLET_APP_ID');\n await handleLaunchState(blocklet, {\n appDid: appDidEnv ? appDidEnv.value : '',\n did: blocklet.meta.did,\n currentVersion: blocklet.meta.version,\n version: blockletMeta.version,\n });\n } else {\n await handleLaunchState(blocklet);\n }\n }\n\n setBlockletState(pre => ({ ...pre, loading: false }));\n return;\n } catch (error) {\n clearSessionToken();\n }\n }\n\n setBlockletState(pre => ({ ...pre, loading: false }));\n } catch (error) {\n console.error(error);\n setBlockletState(pre => ({\n ...pre,\n loading: false,\n error: new Error(t('launchBlocklet.error.loadMetaFailed')),\n }));\n }\n };\n\n func();\n }, []); // eslint-disable-line\n\n if (blockletState.error) {\n return (\n <Alert variant=\"icon\" type=\"error\">\n {blockletState.error.message}\n </Alert>\n );\n }\n\n if (blockletState.loading) {\n return (\n <div style={{ marginTop: '100px', textAlign: 'center', width: '100%' }}>\n <Spinner />\n </div>\n );\n }\n\n let baseUrl = '/';\n if (window.env && window.env.apiPrefix) {\n baseUrl = window.env.apiPrefix;\n }\n\n const { did, isFree } = blockletMeta;\n\n if (!launching && launchState.upgradeAvailable) {\n return (\n <Container>\n <StatusUpgrade\n onCancel={() => handleCancelUpgrade(launchState.blocklet)}\n onUpgrade={() => handleUpgrade(launchState.blocklet, launchState.upgradeAvailable)}\n />\n </Container>\n );\n }\n\n if (!launching && launchState.existed) {\n return (\n <Container>\n <StatusNotRunning did={blockletMeta.did} />\n </Container>\n );\n }\n\n if (launchState.error) {\n return (\n <Container>\n <StatusError\n message={launchState.error.message}\n actions={\n <Button\n className=\"bottom-button\"\n disabled={openAuth}\n fullWidth={isBreakpointsDownSm}\n onClick={() => setOpenAuth(true)}>\n {openAuth && <Spinner size={[16, 10]} />}\n {t('common.retry')}\n </Button>\n }\n />\n </Container>\n );\n }\n\n return (\n <Container>\n {!launchState.upgradeAvailable && (\n <div className=\"header\">\n <Typography component=\"h5\" variant=\"h5\">\n {launching ? t('launchBlocklet.start') : t('common.launch')}\n </Typography>\n <Typography color=\"textSecondary\">\n {launching\n ? t('launchBlocklet.installingSubTitle', { appName: blockletMeta.title, serverName: info.name })\n : t('launchBlocklet.subTitle', { appName: blockletMeta.title, serverName: info.name })}\n </Typography>\n </div>\n )}\n <div className=\"body\">\n {!launching && !launchState.error && (\n <div className=\"illustrations\">\n <div className=\"ills_block\">\n <AppLogo className=\"i_icon\" blockletMeta={blockletMeta} blockletMetaUrl={blockletMetaUrl} />\n <div className=\"i_name\">{blockletMeta.title}</div>\n </div>\n <ArrowForward className=\"arrow-icon\" />\n <div className=\"ills_block\">\n <ABTNodeIcon className=\"i_icon\" color=\"#BFBFBF\" />\n <div className=\"i_name\">{info.name}</div>\n </div>\n </div>\n )}\n {!launching && !launchState.existed && (\n <Hidden smDown>\n <Button\n className=\"bottom-button\"\n disabled={openAuth}\n fullWidth={isBreakpointsDownSm}\n onClick={() => setOpenAuth(true)}>\n {openAuth && <Spinner size={[16, 10]} />}\n {t('common.install')}\n </Button>\n </Hidden>\n )}\n {launching && !launchState.error && (\n <Waiting>\n <Spinner className=\"spinner\" />\n <div className=\"text\">{launchState.status}</div>\n </Waiting>\n )}\n </div>\n <div className=\"footer\">\n {!launching && launchState.existed && (\n <Button\n className=\"footer-item bottom-button\"\n component={Link}\n to={`/blocklets/${did}/overview`}\n fullWidth={isBreakpointsDownSm}\n rounded\n color=\"primary\"\n variant=\"contained\">\n {t('launchBlocklet.viewApplication')}\n </Button>\n )}\n {!launching && !launchState.existed && (\n <Hidden mdUp>\n <Button\n className=\"bottom-button\"\n disabled={openAuth}\n fullWidth={isBreakpointsDownSm}\n onClick={() => setOpenAuth(true)}>\n {openAuth && <Spinner size={[16, 10]} />}\n {t('common.install')}\n </Button>\n </Hidden>\n )}\n </div>\n <Connect\n open={openAuth}\n popup\n className=\"connect\"\n action={isFree ? 'launch-free-blocklet' : 'launch-paid-blocklet'}\n checkFn={axios.create({ baseURL: baseUrl }).get}\n checkTimeout={10 * 60 * 1000}\n socketUrl={api.socketUrl}\n webWalletUrl={getWebWalletUrl(info)}\n onSuccess={handleConnectSuccess}\n onClose={handleClose}\n locale={locale}\n messages={{\n title: `${t('launchBlocklet.authDialog.title')}`,\n scan: isFree\n ? t('launchBlocklet.authDialog.freeDescription')\n : t('launchBlocklet.authDialog.nonFreeDescription'),\n confirm: t('launchBlocklet.authDialog.confirm'),\n success: t('launchBlocklet.authDialog.success'),\n }}\n extraParams={{ blockletMetaUrl }}\n />\n </Container>\n );\n}\n\nInstall.propTypes = {\n blockletMeta: PropTypes.object.isRequired,\n};\n\nconst Waiting = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #4f6af6;\n\n .spinner {\n color: inherit !important;\n }\n\n .text {\n font-size: 20px;\n margin-top: 24px;\n }\n`;\n\nconst Container = styled(ContentLayout)`\n .body {\n margin-bottom: 50px;\n justify-content: center;\n align-items: center;\n }\n\n .illustrations {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: start;\n text-align: center;\n margin-bottom: 80px;\n width: 100%;\n }\n\n .ills_block {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n .i_icon {\n width: 64px;\n height: 64px;\n }\n\n .i_name {\n margin-top: 32px;\n font-weight: 500;\n font-size: 18px;\n color: #222222;\n }\n\n .i_sub_name {\n color: #999999;\n }\n }\n\n ${props => props.theme.breakpoints.down('sm')} {\n .ills_block {\n flex: 1;\n flex-shrink: 0;\n }\n }\n\n .arrow-icon {\n align-self: start;\n color: #d3e7fe;\n margin: 25px 40px 0;\n ${props => props.theme.breakpoints.down('sm')} {\n margin: 25px 24px 0;\n }\n }\n\n .status_icon {\n width: 48px;\n height: 48px;\n }\n\n .status_title {\n margin-top: 16px;\n text-align: center;\n font-size: 24px;\n line-height: 28px;\n }\n\n .status_desc {\n text-align: center;\n margin-top: 16px;\n color: #999999;\n font-size: 16px;\n line-height: 28px;\n }\n`;\n\nexport default Install;\n","import React from 'react';\n\nexport default function AgreementApp({ ...props }) {\n return (\n <div {...props} style={{ width: '100%' }}>\n <h3>End User License Agreement for Application</h3>\n <p>Blocklet Server License Agreement ArcBlock, Inc. version 2020-08-28</p>\n <p>BLOCKLET SERVER LICENSE AGREEMENT</p>\n <p>暂无</p>\n </div>\n );\n}\n","import React, { useState } from 'react';\nimport { useHistory } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { Typography } from '@material-ui/core';\nimport Tabs from '@arcblock/ux/lib/Tabs';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport Button from './button';\nimport AgreementNode from '../node/eula-content'; // eslint-disable-line\nimport AgreementApp from './agreement-app';\nimport ContentLayout from './content-layout';\n\nexport default function Agreement() {\n const history = useHistory();\n const [currentTab, setCurrentTab] = useState('application');\n const { t } = useLocaleContext();\n // TODO: 加载 Blocklet 定义的 Agreement\n\n const handleAgree = () => {\n history.push(`/launch-blocklet/install${window.location.search}`);\n };\n\n const tabMap = new Map([\n [\n 'application',\n {\n label: t('launchBlocklet.appLicenseName'),\n value: 'application',\n component: AgreementApp,\n },\n ],\n [\n 'abtnode',\n {\n label: t('launchBlocklet.abtnodeLicenseName'),\n value: 'abtnode',\n component: AgreementNode,\n },\n ],\n ]);\n\n const tabs = [];\n for (const value of tabMap.values()) {\n tabs.push({\n label: value.label,\n value: value.value,\n });\n }\n\n const TabContent = tabMap.get(currentTab).component;\n\n return (\n <Content>\n <Typography component=\"h5\" variant=\"h5\">\n {t('launchBlocklet.agreement')}\n </Typography>\n <div className=\"body\">\n <Tabs tabs={tabs} current={currentTab} onChange={setCurrentTab} />\n <div className=\"agreement\">\n <div className=\"agreement_content\">\n <TabContent style={{ width: '100%' }} />\n </div>\n </div>\n </div>\n <div className=\"footer\">\n <Button className=\"bottom-button\" onClick={handleAgree}>\n {t('launchBlocklet.agreeAll')}\n </Button>\n </div>\n </Content>\n );\n}\n\nconst Content = styled(ContentLayout)`\n .body {\n justify-content: center;\n }\n .agreement {\n position: relative;\n flex: 1;\n display: flex;\n flex-direction: column;\n width: 100%;\n min-height: 300px;\n border: 1px solid #f0f0f0;\n border-radius: 12px;\n\n ${props => props.theme.breakpoints.up('md')} {\n margin-top: 24px;\n }\n\n ${props => props.theme.breakpoints.down('sm')} {\n margin-top: 16px;\n }\n\n .agreement_content {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow-y: auto;\n\n ${props => props.theme.breakpoints.up('md')} {\n padding: 0 24px;\n }\n\n ${props => props.theme.breakpoints.down('sm')} {\n padding: 0 16px;\n }\n }\n }\n`;\n","import styled from 'styled-components';\n\nconst Center = styled.div`\n width: 100%;\n min-height: 100vh;\n padding: 20px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nexport default Center;\n","import React, { useState } from 'react';\nimport { useHistory } from 'react-router-dom';\nimport axios from 'axios';\nimport get from 'lodash/get';\nimport joinUrl from 'url-join';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\nimport { Typography } from '@material-ui/core';\nimport AddIcon from '@material-ui/icons/Add';\nimport Button from '@arcblock/ux/lib/Button';\nimport Connect from '@arcblock/did-connect/lib/Connect';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\n\nimport { formatFactoryPrice, getWebWalletUrl } from '../../libs/util';\nimport { useNodeContext } from '../../contexts/node';\nimport useQuery from '../../hooks/query';\nimport ContentLayout from '../../components/launch-blocklet/content-layout';\nimport AppLogo from '../../components/launch-blocklet/app-logo';\n\nfunction AppInfo({ blockletMeta }) {\n const [pay, setPay] = useState(false);\n const history = useHistory();\n const query = useQuery();\n const { info } = useNodeContext();\n const { t } = useLocaleContext();\n const blockletMetaUrl = query.get('blocklet_meta_url');\n const registryUrl = new URL(blockletMetaUrl).origin;\n\n const handleStartPay = () => {\n setPay(true);\n };\n\n const toNextStep = () => {\n history.push(`/launch-blocklet/agreement${window.location.search}`);\n };\n\n const handlePaySuccess = () => {\n setPay(false);\n toNextStep();\n };\n\n const handleAlreadyPurchased = () => toNextStep();\n\n const handleClose = () => {\n setPay(false);\n };\n\n let priceList = [];\n if (!blockletMeta.isFree) {\n priceList = formatFactoryPrice(blockletMeta);\n }\n\n return (\n <Container>\n <div className=\"header\">\n <Typography component=\"h5\" variant=\"h5\">\n {t('launchBlocklet.purchaseApp')}\n </Typography>\n <Typography color=\"textSecondary\" style={{ marginTop: '8px' }}>\n {t('launchBlocklet.appInfoDesc')}\n </Typography>\n </div>\n <div className=\"body\">\n <AppLogo blockletMetaUrl={blockletMetaUrl} blockletMeta={blockletMeta} />\n <div className=\"app-desc\">\n <div className=\"app-desc_name\">{blockletMeta.title}</div>\n <div className=\"app-desc_author\">\n {t('launchBlocklet.author', { author: get(blockletMeta, 'author.name') })}\n </div>\n </div>\n {!blockletMeta.isFree && (\n <div className=\"price\">\n {priceList.map((item, index) => (\n <React.Fragment key={item.name}>\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span className=\"price-value\">{item.value}</span>\n <span className=\"price-symbol\">{item.name}</span>\n </div>\n {index < priceList.length - 1 && <AddIcon style={{ margin: '11px auto' }} fontSize=\"18px\" />}\n </React.Fragment>\n ))}\n </div>\n )}\n </div>\n <div className=\"footer\">\n {blockletMeta.isFree && (\n <Button\n style={{ marginTop: '80px' }}\n className=\"bottom-button\"\n rounded\n color=\"primary\"\n variant=\"contained\"\n onClick={toNextStep}>\n {t('launchBlocklet.nextStep')}\n </Button>\n )}\n {!blockletMeta.isFree && (\n <div style={{ marginTop: '80px' }}>\n <Button variant=\"outlined\" rounded color=\"primary\" onClick={handleAlreadyPurchased}>\n {t('launchBlocklet.purchased')}\n </Button>\n <Button style={{ marginLeft: '20px' }} rounded color=\"primary\" variant=\"contained\" onClick={handleStartPay}>\n {t('launchBlocklet.purchase')}\n </Button>\n </div>\n )}\n </div>\n <Connect\n open={pay}\n popup\n baseUrl={registryUrl}\n action=\"acquire-asset\"\n checkFn={axios.create({ baseURL: joinUrl(registryUrl, '/store') }).get}\n onSuccess={handlePaySuccess}\n onClose={handleClose}\n checkTimeout={60 * 5000}\n extraParams={{ factory: blockletMeta.nftFactory }}\n webWalletUrl={getWebWalletUrl(info)}\n disableClose\n showDownload={false}\n messages={{\n title: `购买 ${blockletMeta.title}`,\n scan: '使用 DID 钱包扫码',\n confirm: '在您的 DID 钱包上确认',\n success: '成功',\n }}\n />\n </Container>\n );\n}\n\nAppInfo.propTypes = {\n blockletMeta: PropTypes.object.isRequired,\n};\n\nconst Container = styled(ContentLayout)`\n .app-desc {\n text-align: center;\n margin-top: 40px;\n\n .app-desc_name {\n font-weight: 500;\n font-size: 18px;\n line-height: 21px;\n color: #222222;\n }\n\n .app-desc_author {\n margin-top: 8px;\n font-weight: 500;\n font-size: 16px;\n line-height: 19px;\n color: #666666;\n }\n }\n\n .price {\n margin-top: 40px;\n color: #222222;\n text-align: center;\n\n .price-value {\n font-size: 36px;\n line-height: 42px;\n }\n\n .price-symbol {\n margin-left: 8px;\n font-size: 18px;\n line-height: 21px;\n }\n }\n`;\n\nexport default AppInfo;\n","import React from 'react';\nimport { useRouteMatch, useHistory, Switch, Route, Redirect } from 'react-router-dom';\nimport { useAsync } from 'react-use';\nimport PropTypes from 'prop-types';\nimport joinUrl from 'url-join';\nimport styled from 'styled-components';\nimport Alert from '@arcblock/ux/lib/Alert';\nimport { useLocaleContext } from '@arcblock/ux/lib/Locale/context';\nimport { StepProvider, Layout } from '@arcblock/abt-launcher';\nimport Spinner from '@arcblock/ux/lib/Spinner';\nimport LocaleSelector from '@arcblock/ux/lib/Locale/selector';\nimport { useNodeContext } from '../../contexts/node';\nimport useQuery from '../../hooks/query';\n\nimport Complete from '../../components/launch-blocklet/complete';\nimport Install from '../../components/launch-blocklet/install';\nimport Agreement from '../../components/launch-blocklet/agreement';\nimport Center from '../../components/launch-blocklet/center';\nimport AppInfo from './purchase-app';\nimport { getBlockletLogoUrl, getPathPrefix } from '../../libs/util';\n\nfunction RedirectPage({ blockletMeta }) {\n const { path } = useRouteMatch();\n const history = useHistory();\n const query = window.location.search;\n\n if (blockletMeta.isFree) {\n history.push(`${path}/agreement${query}`);\n return null;\n }\n\n history.push(`${path}/agreement${query}`);\n return null;\n}\n\nRedirectPage.propTypes = {\n blockletMeta: PropTypes.object.isRequired,\n};\n\nfunction Launcher() {\n const { path } = useRouteMatch();\n const { t, locale } = useLocaleContext();\n const query = useQuery();\n const { api } = useNodeContext();\n let url = (query.get('blocklet_meta_url') || '').trim();\n url = decodeURIComponent(url);\n\n const state = useAsync(async () => {\n if (!url) {\n throw new Error(t('common.invalidParam'));\n }\n\n const { meta } = await api.getBlockletMetaFromUrl({ input: { url, checkPrice: true } });\n if (!meta) {\n throw new Error(t('launchBlocklet.error.loadMetaFailed'));\n }\n\n return meta;\n });\n\n if (state.loading) {\n return (\n <Center>\n <Spinner />\n </Center>\n );\n }\n\n if (state.error) {\n return (\n <Center>\n <div>\n <Alert style={{ width: '100%', wordBreak: 'break-all' }} variant=\"icon\" type=\"error\">\n {state.error.message}\n </Alert>\n </div>\n </Center>\n );\n }\n\n const blockletMeta = state.value;\n let firstPageUrl = blockletMeta.isFree ? `${path}/agreement` : `${path}/purchase-app`;\n firstPageUrl = `${firstPageUrl}${window.location.search}`;\n const basePath = joinUrl(getPathPrefix(), path);\n\n const steps = [\n {\n key: 'app-info',\n name: t('launchBlocklet.purchaseApp'),\n path: joinUrl(basePath, 'purchase-app'),\n optional: true,\n },\n {\n key: 'agreement',\n name: t('launchBlocklet.agreement'),\n path: joinUrl(basePath, 'agreement'),\n },\n {\n key: 'install',\n name: t('launchBlocklet.launch'),\n path: joinUrl(basePath, 'install'),\n },\n {\n key: 'complete',\n name: t('launchBlocklet.complete'),\n path: joinUrl(basePath, 'complete'),\n },\n ];\n blockletMeta.registryUrl = new URL(url).origin;\n\n return (\n <StepProvider steps={steps}>\n <Layout\n locale={locale}\n blockletMeta={blockletMeta}\n headerEndAddons={\n <>\n <LocaleSelector size={26} showText={false} className=\"locale-addon\" />\n </>\n }\n logoUrl={getBlockletLogoUrl({\n did: blockletMeta.did,\n baseUrl: blockletMeta.registryUrl,\n logoPath: blockletMeta.logo,\n })}>\n <Content>\n <Switch>\n <Redirect exact path={path} to={firstPageUrl} />\n <Route exact path={`${path}/purchase-app`}>\n <AppInfo blockletMeta={blockletMeta} />\n </Route>\n <Route exact path={`${path}/agreement`}>\n <Agreement />\n </Route>\n <Route exact path={`${path}/install`}>\n <Install blockletMeta={blockletMeta} />\n </Route>\n <Route exact path={`${path}/complete`}>\n <Complete blockletMeta={blockletMeta} />\n </Route>\n </Switch>\n </Content>\n </Layout>\n </StepProvider>\n );\n}\n\nconst Content = styled.div`\n padding-top: 34px;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n\n .bottom-button {\n width: 300px;\n }\n`;\n\nexport default function BlockletLauncher() {\n return <Launcher />;\n}\n","/* eslint-disable no-await-in-loop */\nconst get = require('lodash/get');\n\nconst forEachBlocklet = (blocklet, cb, { parallel = false, sync } = {}) => {\n // sync\n if (sync) {\n cb(blocklet);\n if (blocklet.children) {\n for (const child of blocklet.children) {\n cb(child);\n }\n }\n return null;\n }\n\n // serial\n if (!parallel) {\n return (async () => {\n await cb(blocklet);\n if (blocklet.children) {\n for (const child of blocklet.children) {\n await cb(child);\n }\n }\n return null;\n })();\n }\n\n // parallel\n const tasks = [];\n tasks.push(cb(blocklet));\n if (blocklet.children) {\n for (const child of blocklet.children) {\n tasks.push(cb(child));\n }\n }\n return Promise.all(tasks);\n};\n\nconst isAuthServiceEnabled = (blocklet) => {\n const interfaces = get(blocklet, 'meta.interfaces') || [];\n const isRootEnabled = interfaces.some((x) => {\n const services = get(x, 'services') || [];\n return services.some((s) => s.name === '@abtnode/auth-service');\n });\n\n if (isRootEnabled) {\n return true;\n }\n\n const children = get(blocklet, 'children') || [];\n for (const child of children) {\n if (isAuthServiceEnabled(child)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst getRequiredMissingConfigs = (blocklet) => {\n const missingConfigs = [];\n const configs = blocklet.configs || [];\n configs.forEach((item) => {\n if (item.required && !item.value) {\n missingConfigs.push({ did: blocklet.meta.did, key: item.key });\n }\n });\n\n // eslint-disable-next-line no-restricted-syntax\n for (const child of blocklet.children || []) {\n const childConfigs = child.configs || [];\n // configProp does not exist in root blocklet config\n // or value of configProp in root blocklet config is empty.\n childConfigs.forEach((x) => {\n if (x.required && !x.value && !configs.some((y) => y.key === x.key && y.value)) {\n missingConfigs.push({ did: child.meta.did, key: x.key });\n }\n });\n }\n\n return missingConfigs;\n};\n\nconst isFreeBlocklet = (meta) => {\n if (!meta.payment) {\n return true;\n }\n\n const priceList = (meta.payment.price || []).map((x) => x.value || 0);\n return priceList.every((x) => x === 0);\n};\n\nconst wipeSensitiveData = (blocklet) => {\n if (!blocklet) {\n return blocklet;\n }\n\n forEachBlocklet(\n blocklet,\n (d) => {\n (d.configs || []).forEach((x) => {\n if (x.secure) {\n x.value = x.value ? '__encrypted__' : '';\n }\n });\n (d.environments || []).forEach((x) => {\n if (['BLOCKLET_APP_SK'].includes(x.key)) {\n x.value = '__encrypted__';\n }\n });\n\n delete blocklet.configObj;\n delete blocklet.environmentObj;\n },\n { sync: true }\n );\n\n return blocklet;\n};\n\nmodule.exports = {\n isFreeBlocklet,\n forEachBlocklet,\n isAuthServiceEnabled,\n getRequiredMissingConfigs,\n wipeSensitiveData,\n};\n"],"sourceRoot":""}
|