diff --git a/extensions/billing-demo/media/styles.css b/extensions/billing-demo/media/styles.css new file mode 100644 index 0000000000000..a6aabe8797ea9 --- /dev/null +++ b/extensions/billing-demo/media/styles.css @@ -0,0 +1 @@ +*{box-sizing:border-box} body{font-family:var(--vscode-font-family,-apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,Ubuntu,Droid Sans,Arial,sans-serif);padding:16px;color:var(--vscode-foreground);background:var(--vscode-editor-background)} h1{font-size:20px;margin:0 0 12px} .plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px} .card{border:1px solid var(--vscode-editorGroup-border);background:var(--vscode-sideBar-background);border-radius:8px;box-shadow:0 1px 0 rgba(0,0,0,.05);display:flex;flex-direction:column;overflow:hidden} .card header{padding:12px 14px;background:var(--vscode-editor-inactiveSelectionBackground);font-weight:600} .card .body{padding:12px 14px;flex:1} .price{font-size:22px;font-weight:700;margin:4px 0 8px} ul{padding-left:18px;margin:8px 0} li{margin:4px 0} button{appearance:none;border:1px solid var(--vscode-button-border,transparent);background:var(--vscode-button-background);color:var(--vscode-button-foreground);border-radius:6px;padding:8px 12px;font-weight:600;cursor:pointer} button:hover{filter:brightness(1.05)} .footer{margin-top:12px;color:var(--vscode-descriptionForeground);font-size:12px} .status{margin-bottom:8px;padding:8px 10px;border-radius:6px;border:1px dashed var(--vscode-editorGroup-border);background:var(--vscode-editor-background)} \ No newline at end of file diff --git a/extensions/billing-demo/package.json b/extensions/billing-demo/package.json new file mode 100644 index 0000000000000..0b03e165b8ad5 --- /dev/null +++ b/extensions/billing-demo/package.json @@ -0,0 +1,40 @@ +{ + "name": "billing-demo", + "displayName": "Billing Demo", + "description": "Minimal demo billing UI with plans and fake upgrade button.", + "version": "0.0.1", + "publisher": "vscode", + "license": "MIT", + "engines": { + "vscode": "^1.70.0" + }, + "main": "./out/extension", + "categories": [ + "Other" + ], + "extensionKind": [ + "ui" + ], + "activationEvents": [ + "onCommand:billing.open", + "onCommand:billing.upgrade" + ], + "contributes": { + "commands": [ + { + "command": "billing.open", + "title": "Open Billing", + "category": "Billing" + }, + { + "command": "billing.upgrade", + "title": "Upgrade", + "category": "Billing" + } + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/vscode.git" + } +} diff --git a/extensions/billing-demo/src/extension.ts b/extensions/billing-demo/src/extension.ts new file mode 100644 index 0000000000000..37d598a7d5244 --- /dev/null +++ b/extensions/billing-demo/src/extension.ts @@ -0,0 +1,109 @@ +import * as vscode from 'vscode'; + +function nonce() { + let text = ''; + const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (let i = 0; i < 32; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; +} + +function getWebviewContent(webview: vscode.Webview, extensionUri: vscode.Uri) { + const n = nonce(); + const styleUri = webview.asWebviewUri(vscode.Uri.joinPath(extensionUri, 'media', 'styles.css')); + return ` + +
+ + + +