From 34e5271d3adcc2d51cfbb40f019c266d0aad61fa Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 25 Nov 2023 10:09:54 -0300 Subject: settings doc --- packages/demobank-ui/README.md | 48 +++++----------------------------- packages/demobank-ui/src/settings.json | 6 ++--- packages/demobank-ui/src/settings.ts | 25 ++++++++++-------- 3 files changed, 23 insertions(+), 56 deletions(-) (limited to 'packages/demobank-ui') diff --git a/packages/demobank-ui/README.md b/packages/demobank-ui/README.md index 109b6196b..e7019620b 100644 --- a/packages/demobank-ui/README.md +++ b/packages/demobank-ui/README.md @@ -4,20 +4,13 @@ Web-based user interface for the libeufin demobank. ## CLI Commands -- `pnpm install`: Installs dependencies - -- `pnpm run build`: Create a production-ready build under `dist/`. - -- `pnpm run check`: Run type checker - -- `pnpm run lint`: Pass TypeScript files using ESLint +- `./dev.mjs` development setup. Will listen in :8080 and reload every time a file is save. +- `./build.mjs` build for production. +- `./test.mjs` build and run unit test ## Testing -By default, the demobank-ui points to `https://bank.demo.taler.net/demobanks/default/` -as the bank access API base URL. - -This can be changed for testing by setting the URL via local storage (via your browser's devtools): +By default, the demobank-ui will expect the backend to be in `window.origin` but that can be overriden using the `settings.json` file or by session in the localStorage. ``` localStorage.setItem("bank-base-url", OTHER_URL); @@ -26,35 +19,6 @@ localStorage.setItem("bank-base-url", OTHER_URL); ## Customizing Per-Deployment Settings To customize per-deployment settings, make sure that the -`bank-ui-settings.js` file is served alongside the UI. +`settings.json` file is served alongside the UI. -This file is loaded before the SPA and can do customizations by -changing `globalThis.`. - -For example, the following settings would correspond -to the default settings: - -``` -globalThis.talerBankSettings = { - // location of libeufin server - backendBaseURL: "https://bank.demo.taler.net/", - allowRegistrations: true, - bankName: "Taler Bank", - // Show explainer text and navbar to other demo sites - showDemoNav: true, - // href value of the icon in the top left - iconLinkURL: "https://demo.taler.net/", - // show the button "create random user" in registration form - allowRandomAccountCreation: true, - // do not create random password for random users - simplePasswordForRandomAccounts: true, - // Names and links for other demo sites to show in the navbar - demoSites: [ - ["Landing", "https://demo.taler.net/"], - ["Bank", "https://bank.demo.taler.net/"], - ["Essay Shop", "https://shop.demo.taler.net/"], - ["Donations", "https://donations.demo.taler.net/"], - ["Survey", "https://donations.demo.taler.net/"], - ], -}; -``` +For more information about the values check the file `settings.ts` in the src folder. diff --git a/packages/demobank-ui/src/settings.json b/packages/demobank-ui/src/settings.json index 8d5b149b5..9c0f1f001 100644 --- a/packages/demobank-ui/src/settings.json +++ b/packages/demobank-ui/src/settings.json @@ -5,8 +5,8 @@ "allowRandomAccountCreation": true, "bankName": "Taler DEVELOPMENT Bank", "demoSites": [ - ["Exchange", "https://Exchnage.taler.test/"], - ["Bank", "https://bank-ui.taler.test/"], - ["Merchant", "https://merchant.taler.test/"] + ["Exchange", "http://Exchnage.taler.test:1180/"], + ["Bank", "http://bank-ui.taler.test:1180/"], + ["Merchant", "http://merchant.taler.test:1180/"] ] } diff --git a/packages/demobank-ui/src/settings.ts b/packages/demobank-ui/src/settings.ts index a9c63857b..3a60c48a5 100644 --- a/packages/demobank-ui/src/settings.ts +++ b/packages/demobank-ui/src/settings.ts @@ -17,31 +17,34 @@ import { Codec, buildCodecForObject, codecForBoolean, codecForList, codecForString, codecOptional } from "@gnu-taler/taler-util"; export interface BankUiSettings { + // location of the backend API backendBaseURL?: string; + // where the user is going to be redirected after clicking the Taler icon iconLinkURL?: string; + // show demo nav showDemoNav?: boolean; - simplePasswordForRandomAccounts?: boolean; + // links of the demo nav. Array of tuples that contains [name,url] + demoSites?: Array>; + // show a button "create random account" allowRandomAccountCreation?: boolean; + // every random account will have password "123" + simplePasswordForRandomAccounts?: boolean; + // bank name in the top bankName?: string; - demoSites?: Array>; } /** * Global settings for the bank UI. */ const defaultSettings: BankUiSettings = { - backendBaseURL: "https://bank.demo.taler.net/demobanks/default/", - iconLinkURL: "https://demo.taler.net/", - bankName: "Taler Bank", - showDemoNav: true, + backendBaseURL: undefined, + iconLinkURL: undefined, + bankName: "Taler TESTING Bank", + showDemoNav: false, simplePasswordForRandomAccounts: true, allowRandomAccountCreation: true, demoSites: [ - ["Landing", "https://demo.taler.net/"], - ["Bank", "https://bank.demo.taler.net/"], - ["Essay Shop", "https://shop.demo.taler.net/"], - ["Donations", "https://donations.demo.taler.net/"], - ["Survey", "https://survey.demo.taler.net/"], + ["Demo", "https://demo.taler.net/"], ], }; -- cgit v1.2.3