aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Tip
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-08-31 11:46:39 -0300
committerSebastian <sebasjm@gmail.com>2022-08-31 11:46:39 -0300
commite759684fd0658b4a3ba241744424ceda11bd500b (patch)
tree31e3e8998aada76bf49df1dd9988021fb67bb856 /packages/taler-wallet-webextension/src/cta/Tip
parentd84424202dca22fff22cb1d304286f627642187b (diff)
downloadwallet-core-e759684fd0658b4a3ba241744424ceda11bd500b.tar.xz
invoice and transfer details
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Tip')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Tip/index.ts4
-rw-r--r--packages/taler-wallet-webextension/src/cta/Tip/state.ts6
-rw-r--r--packages/taler-wallet-webextension/src/cta/Tip/test.ts8
3 files changed, 10 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/index.ts b/packages/taler-wallet-webextension/src/cta/Tip/index.ts
index b174d5160..53c890b2c 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Tip/index.ts
@@ -30,7 +30,7 @@ import { AcceptedView, IgnoredView, LoadingUriView, ReadyView } from "./views.js
export interface Props {
talerTipUri?: string;
- cancel: () => Promise<void>;
+ onCancel: () => Promise<void>;
}
export type State =
@@ -58,6 +58,7 @@ export namespace State {
amount: AmountJson;
exchangeBaseUrl: string;
error: undefined;
+ cancel: ButtonHandler;
}
export interface Ignored extends BaseInfo {
@@ -70,7 +71,6 @@ export namespace State {
export interface Ready extends BaseInfo {
status: "ready";
accept: ButtonHandler;
- cancel: () => Promise<void>;
}
}
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/state.ts b/packages/taler-wallet-webextension/src/cta/Tip/state.ts
index f18911f65..aa62bd5e3 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Tip/state.ts
@@ -22,7 +22,7 @@ import * as wxApi from "../../wxApi.js";
import { Props, State } from "./index.js";
export function useComponentState(
- { talerTipUri, cancel }: Props,
+ { talerTipUri, onCancel }: Props,
api: typeof wxApi,
): State {
const [tipIgnored, setTipIgnored] = useState(false);
@@ -58,6 +58,9 @@ export function useComponentState(
exchangeBaseUrl: tip.exchangeBaseUrl,
amount: Amounts.parseOrThrow(tip.tipAmountEffective),
error: undefined,
+ cancel: {
+ onClick: onCancel
+ }
}
if (tipIgnored) {
@@ -80,7 +83,6 @@ export function useComponentState(
accept: {
onClick: doAccept,
},
- cancel,
};
}
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/test.ts b/packages/taler-wallet-webextension/src/cta/Tip/test.ts
index 363652e47..ccb36572e 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip/test.ts
+++ b/packages/taler-wallet-webextension/src/cta/Tip/test.ts
@@ -30,7 +30,7 @@ describe("Tip CTA states", () => {
it("should tell the user that the URI is missing", async () => {
const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } =
mountHook(() =>
- useComponentState({ talerTipUri: undefined, cancel: async () => { null } }, {
+ useComponentState({ talerTipUri: undefined, onCancel: async () => { null } }, {
prepareTip: async () => ({}),
acceptTip: async () => ({}),
} as any),
@@ -62,7 +62,7 @@ describe("Tip CTA states", () => {
const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } =
mountHook(() =>
- useComponentState({ talerTipUri: "taler://tip/asd", cancel: async () => { null } }, {
+ useComponentState({ talerTipUri: "taler://tip/asd", onCancel: async () => { null } }, {
prepareTip: async () =>
({
accepted: tipAccepted,
@@ -114,7 +114,7 @@ describe("Tip CTA states", () => {
it("should be ignored after clicking the ignore button", async () => {
const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } =
mountHook(() =>
- useComponentState({ talerTipUri: "taler://tip/asd", cancel: async () => { null } }, {
+ useComponentState({ talerTipUri: "taler://tip/asd", onCancel: async () => { null } }, {
prepareTip: async () =>
({
exchangeBaseUrl: "exchange url",
@@ -160,7 +160,7 @@ describe("Tip CTA states", () => {
it("should render accepted if the tip has been used previously", async () => {
const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } =
mountHook(() =>
- useComponentState({ talerTipUri: "taler://tip/asd", cancel: async () => { null } }, {
+ useComponentState({ talerTipUri: "taler://tip/asd", onCancel: async () => { null } }, {
prepareTip: async () =>
({
accepted: true,