diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-30 18:42:39 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-30 18:44:41 -0300 |
commit | f1967ab0baf825cdfa767d36bb7cce78521e4e4b (patch) | |
tree | 43650091b8542dfa750a69524efa3e5ff16b7201 /packages/demobank-ui/src | |
parent | fb4c172bb430936268bcebe34142d4206a0d422e (diff) | |
download | wallet-core-f1967ab0baf825cdfa767d36bb7cce78521e4e4b.tar.xz |
testing auto open feature
Diffstat (limited to 'packages/demobank-ui/src')
-rw-r--r-- | packages/demobank-ui/src/pages/OperationState/views.tsx | 56 | ||||
-rw-r--r-- | packages/demobank-ui/src/pages/QrCodeSection.tsx | 6 |
2 files changed, 35 insertions, 27 deletions
diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index b7d7e5520..4001fd093 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -105,30 +105,30 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon return } switch (hasError.case) { - case "previously-aborted": return notify({ - type: "error", - title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }) - case "no-exchange-or-reserve-selected": return notify({ - type: "error", - title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }) - case "invalid-id": return notify({ - type: "error", - title: i18n.str`The operation id is invalid.`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }); - case "not-found": return notify({ - type: "error", - title: i18n.str`The operation was not found.`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }); + case "previously-aborted": return notify({ + type: "error", + title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }) + case "no-exchange-or-reserve-selected": return notify({ + type: "error", + title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }) + case "invalid-id": return notify({ + type: "error", + title: i18n.str`The operation id is invalid.`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }); + case "not-found": return notify({ + type: "error", + title: i18n.str`The operation was not found.`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }); default: assertUnreachable(hasError) } }) @@ -408,6 +408,7 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { const { i18n } = useTranslationContext(); const [notification, notify, errorHandler] = useLocalNotification() + const talerWithdrawUri = stringifyWithdrawUri(uri); useEffect(() => { //Taler Wallet WebExtension is listening to headers response and tab updates. //In the SPA there is no header response with the Taler URI so @@ -415,8 +416,11 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { // WebExtension will be using // https://developer.chrome.com/docs/extensions/reference/tabs/#event-onUpdated document.title = `${document.title} ${uri.withdrawalOperationId}`; + const meta = document.createElement("meta") + meta.setAttribute("name", "taler-uri") + meta.setAttribute("content", talerWithdrawUri) + document.head.insertBefore(meta, document.head.children.length ? document.head.children[0] : null) }, []); - const talerWithdrawUri = stringifyWithdrawUri(uri); async function onClose() { errorHandler(async () => { @@ -447,7 +451,7 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { } return <Fragment> - <ShowLocalNotification notification={notification} /> + <ShowLocalNotification notification={notification} /> <div class="flex justify-end mt-4"> <button type="button" diff --git a/packages/demobank-ui/src/pages/QrCodeSection.tsx b/packages/demobank-ui/src/pages/QrCodeSection.tsx index ca2a89f48..22bf604f2 100644 --- a/packages/demobank-ui/src/pages/QrCodeSection.tsx +++ b/packages/demobank-ui/src/pages/QrCodeSection.tsx @@ -39,6 +39,7 @@ export function QrCodeSection({ onAborted: () => void; }): VNode { const { i18n } = useTranslationContext(); + const talerWithdrawUri = stringifyWithdrawUri(withdrawUri); useEffect(() => { //Taler Wallet WebExtension is listening to headers response and tab updates. //In the SPA there is no header response with the Taler URI so @@ -46,8 +47,11 @@ export function QrCodeSection({ // WebExtension will be using // https://developer.chrome.com/docs/extensions/reference/tabs/#event-onUpdated document.title = `${document.title} ${withdrawUri.withdrawalOperationId}`; + const meta = document.createElement("meta") + meta.setAttribute("name", "taler-uri") + meta.setAttribute("content", talerWithdrawUri) + document.head.insertBefore(meta, document.head.children.length ? document.head.children[0] : null) }, []); - const talerWithdrawUri = stringifyWithdrawUri(withdrawUri); const [notification, notify, handleError] = useLocalNotification() const { api } = useBankCoreApiContext() |