diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx index dee063637..eb18251fd 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx @@ -136,9 +136,7 @@ export const TermsReviewingHTML = createExample(TestedComponent, { terms: { content: { type: "html", - href: new URL( - `data:text/html;base64,${Buffer.from(termsHtml).toString("base64")}`, - ), + href: new URL(`data:text/html;base64,${toBase64(termsHtml)}`), }, version: "", status: "new", @@ -146,6 +144,14 @@ export const TermsReviewingHTML = createExample(TestedComponent, { reviewing: true, }); +function toBase64(str: string): string { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + return String.fromCharCode(parseInt(p1, 16)); + }), + ); +} + export const TermsReviewingPDF = createExample(TestedComponent, { knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", @@ -166,9 +172,7 @@ export const TermsReviewingPDF = createExample(TestedComponent, { terms: { content: { type: "pdf", - location: new URL( - `data:text/html;base64,${Buffer.from(termsPdf).toString("base64")}`, - ), + location: new URL(`data:text/html;base64,${toBase64(termsPdf)}`), }, status: "new", version: "", |