Skip to content

Commit

Permalink
feat: add onramper widget react component
Browse files Browse the repository at this point in the history
  • Loading branch information
chambits committed Oct 31, 2022
1 parent 041527e commit 4b1fb63
Show file tree
Hide file tree
Showing 4 changed files with 1,190 additions and 76 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"dependencies": {
"@babel/runtime": "^7.14.0",
"@onramper/widget": "^2.2.25",
"advanced-css-reset": "^1.2.2",
"emoji-log": "^1.0.2",
"react": "^17.0.2",
Expand Down
62 changes: 15 additions & 47 deletions source/Popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,22 @@
import * as React from 'react';
import {browser, Tabs} from 'webextension-polyfill-ts';

import './styles.scss';

function openWebPage(url: string): Promise<Tabs.Tab> {
return browser.tabs.create({url});
}
import OnramperWidget from '@onramper/widget';

const Popup: React.FC = () => {
return (
<section id="popup">
<h2>WEB-EXTENSION-STARTER</h2>
<button
id="options__button"
type="button"
onClick={(): Promise<Tabs.Tab> => {
return openWebPage('options.html');
}}
>
Options Page
</button>
<div className="links__holder">
<ul>
<li>
<button
type="button"
onClick={(): Promise<Tabs.Tab> => {
return openWebPage(
'https://github.com/abhijithvijayan/web-extension-starter'
);
}}
>
GitHub
</button>
</li>
<li>
<button
type="button"
onClick={(): Promise<Tabs.Tab> => {
return openWebPage(
'https://www.buymeacoffee.com/abhijithvijayan'
);
}}
>
Buy Me A Coffee
</button>
</li>
</ul>
</div>
</section>
<div
style={{
width: '440px',
height: '595px',
boxShadow: '0 2px 10px 0 rgba(0, 0, 0, 0.1)',
borderRadius: '10px',
margin: 'auto',
}}
>
<OnramperWidget
API_KEY="pk_test_ass3gtLSWQpI11IWUZLJdrfyQhj7bTw_3xwLvhEvH6Q0"
supportSell
/>
</div>
);
};

Expand Down
30 changes: 10 additions & 20 deletions source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
"homepage_url": "https://github.com/abhijithvijayan/web-extension-starter",
"short_name": "Sample Name",

"permissions": [
"activeTab",
"storage",
"http://*/*",
"https://*/*"
],
"permissions": ["activeTab", "storage", "http://*/*", "https://*/*"],

"content_security_policy": "script-src 'self'; object-src 'self'",
"content_security_policy": "script-src 'self' 'sha256-DhtVAr5uwMtIg/acmGl848KzTlWw6e7HEmKM8P8oqdg='; object-src 'self'",

"__chrome|firefox__author": "abhijithvijayan",
"__opera__developer": {
Expand Down Expand Up @@ -57,19 +52,14 @@
},

"background": {
"scripts": [
"js/background.bundle.js"
],
"scripts": ["js/background.bundle.js"],
"__chrome|opera__persistent": false
},

"content_scripts": [{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"js/contentScript.bundle.js"
]
}]
}
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["js/contentScript.bundle.js"]
}
]
}
Loading

0 comments on commit 4b1fb63

Please sign in to comment.