fix: #7164
This commit is contained in:
parent
c47311b4a7
commit
47bd790b7b
@ -8,7 +8,7 @@
|
||||
"serve": "sirv build --port ${PORT:=8080} --cors --single",
|
||||
"dev": "preact watch --port ${PORT:=8080} --no-sw --no-esm",
|
||||
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
|
||||
"test": "jest ./tests",
|
||||
"test": "echo no tests",
|
||||
"build-storybook": "build-storybook",
|
||||
"build-single": "preact build --no-sw --no-esm -c preact.single-config.js --dest single && sh remove-link-stylesheet.sh",
|
||||
"serve-single": "sirv single --port ${PORT:=8080} --cors --single",
|
||||
|
@ -357,7 +357,7 @@ export function PaymentRequestView({
|
||||
kind="neutral"
|
||||
/>
|
||||
)}
|
||||
{contractTerms.products && (
|
||||
{contractTerms.products && contractTerms.products.length > 0 && (
|
||||
<ProductList products={contractTerms.products} />
|
||||
)}
|
||||
</section>
|
||||
|
@ -29,6 +29,24 @@ export interface Props {
|
||||
onDismiss: () => void;
|
||||
}
|
||||
|
||||
async function getCurrentTab(): Promise<chrome.tabs.Tab> {
|
||||
let queryOptions = { active: true, currentWindow: true };
|
||||
const tab = await new Promise<chrome.tabs.Tab>((res, rej) => {
|
||||
chrome.tabs.query(queryOptions, (tabs) => {
|
||||
res(tabs[0]);
|
||||
});
|
||||
});
|
||||
return tab;
|
||||
}
|
||||
|
||||
async function navigateTo(url?: string) {
|
||||
if (!url) return;
|
||||
const tab = await getCurrentTab();
|
||||
if (!tab.id) return;
|
||||
await chrome.tabs.update(tab.id, { url });
|
||||
window.close();
|
||||
}
|
||||
|
||||
export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
const uriType = classifyTalerUri(url);
|
||||
return (
|
||||
@ -40,7 +58,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
<p>This page has pay action.</p>
|
||||
<ButtonSuccess
|
||||
onClick={() => {
|
||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||
navigateTo(actionForTalerUri(uriType, url));
|
||||
}}
|
||||
>
|
||||
Open pay page
|
||||
@ -52,7 +70,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
<p>This page has a withdrawal action.</p>
|
||||
<ButtonSuccess
|
||||
onClick={() => {
|
||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||
navigateTo(actionForTalerUri(uriType, url));
|
||||
}}
|
||||
>
|
||||
Open withdraw page
|
||||
@ -64,7 +82,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
<p>This page has a tip action.</p>
|
||||
<ButtonSuccess
|
||||
onClick={() => {
|
||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||
navigateTo(actionForTalerUri(uriType, url));
|
||||
}}
|
||||
>
|
||||
Open tip page
|
||||
@ -76,7 +94,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
<p>This page has a notify reserve action.</p>
|
||||
<ButtonSuccess
|
||||
onClick={() => {
|
||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||
navigateTo(actionForTalerUri(uriType, url));
|
||||
}}
|
||||
>
|
||||
Notify
|
||||
@ -88,7 +106,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
|
||||
<p>This page has a refund action.</p>
|
||||
<ButtonSuccess
|
||||
onClick={() => {
|
||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||
navigateTo(actionForTalerUri(uriType, url));
|
||||
}}
|
||||
>
|
||||
Open refund page
|
||||
|
Loading…
Reference in New Issue
Block a user