summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx14
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
index f24da1e13..4a0296baa 100644
--- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
@@ -60,11 +60,19 @@ export const ReviewingHTML = createExample(TestedComponent, {
});
function toBase64(str: string): string {
- return btoa(
- encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
+ const encoded = encodeURIComponent(str).replace(
+ /%([0-9A-F]{2})/g,
+ function (match, p1) {
return String.fromCharCode(parseInt(p1, 16));
- }),
+ },
);
+ if (typeof btoa === "undefined") {
+ //nodejs
+ return Buffer.from(encoded).toString("base64");
+ } else {
+ //browser
+ return btoa(encoded);
+ }
}
export const ReviewingPDF = createExample(TestedComponent, {