diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index eefa5be96d..603ac1048a 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -339,7 +339,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const hiddenPanel = new HiddenPanel() const pluginManagerComponent = new PluginManagerComponent(appManager, engine) const filePanel = new FilePanel(appManager) - const landingPage = new LandingPage(appManager, menuicons, fileManager, filePanel) + const landingPage = new LandingPage(appManager, menuicons, fileManager, filePanel, contentImport) const settings = new SettingsTab( registry.get('config').api, editor, diff --git a/apps/remix-ide/src/app/ui/landing-page/landing-page.js b/apps/remix-ide/src/app/ui/landing-page/landing-page.js index 7085a04649..60d762472f 100644 --- a/apps/remix-ide/src/app/ui/landing-page/landing-page.js +++ b/apps/remix-ide/src/app/ui/landing-page/landing-page.js @@ -1,7 +1,6 @@ import * as packageJson from '../../../../../../package.json' import { ViewPlugin } from '@remixproject/engine-web' import { migrateToWorkspace } from '../../../migrateFileSystem' -import { CompilerImports } from '@remix-project/core-plugin' import JSZip from 'jszip' const yo = require('yo-yo') @@ -119,11 +118,12 @@ const profile = { } export class LandingPage extends ViewPlugin { - constructor (appManager, verticalIcons, fileManager, filePanel) { + constructor (appManager, verticalIcons, fileManager, filePanel, contentImport) { super(profile) this.profile = profile this.fileManager = fileManager this.filePanel = filePanel + this.contentImport = contentImport this.appManager = appManager this.verticalIcons = verticalIcons this.gistHandler = new GistHandler() @@ -240,7 +240,7 @@ export class LandingPage extends ViewPlugin { render () { const load = (service, item, examples, info) => { - const compilerImport = new CompilerImports() + const contentImport = this.contentImport const fileProviders = globalRegistry.get('fileproviders').api const msg = yo`
@@ -252,7 +252,7 @@ export class LandingPage extends ViewPlugin { const title = `Import from ${service}` modalDialogCustom.prompt(title, msg, null, (target) => { if (target !== '') { - compilerImport.import( + contentImport.import( target, (loadingMsg) => { tooltip(loadingMsg) }, (error, content, cleanUrl, type, url) => { diff --git a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts index ea4eae6958..edb512a7ed 100644 --- a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts +++ b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts @@ -21,9 +21,14 @@ export class CompilerImports extends Plugin { } async setToken () { - const protocol = typeof window !== 'undefined' && window.location.protocol - const token = await this.call('settings', 'get', 'settings/gist-access-token') - this.urlResolver.setGistToken(token, protocol) + try { + const protocol = typeof window !== 'undefined' && window.location.protocol + const token = await this.call('settings', 'get', 'settings/gist-access-token') + + this.urlResolver.setGistToken(token, protocol) + } catch (error) { + console.log(error) + } } isRelativeImport (url) { diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx index a8a31fd6c8..3d85829294 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx @@ -4,6 +4,13 @@ import { action, FileExplorerContextMenuProps } from './types' import './css/file-explorer-context-menu.css' import { customAction } from '@remixproject/plugin-api/lib/file-system/file-panel' +declare global { + interface Window { + _paq: any + } +} +const _paq = window._paq = window._paq || [] //eslint-disable-line + export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => { const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props const contextMenuRef = useRef(null) @@ -76,15 +83,19 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => deletePath(getPath()) break case 'Push changes to gist': + _paq.push(['trackEvent', 'fileExplorer', 'pushToChangesoGist']) pushChangesToGist(path, type) break case 'Publish folder to gist': + _paq.push(['trackEvent', 'fileExplorer', 'publishFolderToGist']) publishFolderToGist(path, type) break case 'Publish file to gist': + _paq.push(['trackEvent', 'fileExplorer', 'publishFileToGist']) publishFileToGist(path, type) break case 'Run': + _paq.push(['trackEvent', 'fileExplorer', 'runScript']) runScript(path) break case 'Copy': @@ -97,6 +108,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => deletePath(getPath()) break default: + _paq.push(['trackEvent', 'fileExplorer', 'customAction', item.name]) emit && emit({ ...item, path: [path] } as customAction) break } diff --git a/package-lock.json b/package-lock.json index 35f47a3615..2a3685ee9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "remix-project", - "version": "0.16.1", + "version": "0.17.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -11385,6 +11385,17 @@ } } }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } + }, "glob-parent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", @@ -12197,6 +12208,16 @@ "to-regex-range": "^2.1.0" } }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } + }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -17676,16 +17697,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, "fstream": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", @@ -30261,6 +30272,17 @@ } } }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } + }, "glob-parent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", diff --git a/package.json b/package.json index f9d2f78bb3..511f75fffb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "remix-project", - "version": "0.16.1", + "version": "0.17.0-dev", "license": "MIT", "description": "Ethereum Remix Monorepo", "keywords": [