Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Cenadros committed Oct 17, 2024
1 parent a1f1eb4 commit f92510a
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
ui-src/.env
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"main": "dist/code.js",
"ui": "dist/index.html",
"editorType": ["figma"],
"networkAccess": { "allowedDomains": ["none"] },
"networkAccess": { "allowedDomains": ["https://bam.eu01.nr-data.net"] },
"documentAccess": "dynamic-page"
}
101 changes: 94 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"license": "MPL2.0",
"dependencies": {
"@create-figma-plugin/ui": "^3.2",
"@newrelic/browser-agent": "^1.269.0",
"base64-js": "^1.5",
"classnames": "^2.5",
"lru-cache": "^11.0",
Expand Down
7 changes: 7 additions & 0 deletions ui-src/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VITE_ACCOUNT_ID=
VITE_TRUST_KEY=
VITE_AGENT_ID=
VITE_LICENSE_KEY=
VITE_APPLICATION_ID=
VITE_BEACON=
VITE_ERROR_BEACON=
2 changes: 2 additions & 0 deletions ui-src/context/useFigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export const useFigma = (): UseFigmaHook => {
setExporting(false);
setStep(undefined);

window.newrelic.addPageAction('document-exported');

break;
}
case 'CUSTOM_FONTS': {
Expand Down
33 changes: 33 additions & 0 deletions ui-src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent';
import 'node_modules/@create-figma-plugin/ui/lib/css/base.css';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
Expand All @@ -6,6 +7,38 @@ import { App } from './App';
import './main.css';
import './reset.css';

const options = {
init: {
distributed_tracing: { enabled: false },
privacy: { cookies_enabled: true },
ajax: { deny_list: [import.meta.env.VITE_BEACON] }
},
loader_config: {
accountID: import.meta.env.VITE_ACCOUNT_ID,
trustKey: import.meta.env.VITE_TRUST_KEY,
agentID: import.meta.env.VITE_AGENT_ID,
licenseKey: import.meta.env.VITE_LICENSE_KEY,
applicationID: import.meta.env.VITE_APPLICATION_ID
},
info: {
beacon: import.meta.env.VITE_BEACON,
errorBeacon: import.meta.env.VITE_ERROR_BEACON,
licenseKey: import.meta.env.VITE_LICENSE_KEY,
applicationID: import.meta.env.VITE_APPLICATION_ID,
sa: 1
}
};

new BrowserAgent(options);

declare global {
interface Window {
newrelic: BrowserAgent;
}
}

window.newrelic.addPageAction('plugin-loaded');

createRoot(document.getElementById('root') as HTMLElement).render(
<StrictMode>
<App />
Expand Down
9 changes: 9 additions & 0 deletions ui-src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
declare module ViteEnv {
interface ImportMetaEnv {
VITE_NR_ACCOUNT_ID: string;
VITE_NR_TRUST_KEY: string;
VITE_NR_AGENT_ID: string;
VITE_NR_LICENSE_KEY: string;
VITE_NR_APPLICATION_ID: string;
}
}

0 comments on commit f92510a

Please sign in to comment.