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