Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions frontends/web/src/routes/market/bitrefill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ const coinMapping: Readonly<Record<string, string>> = {
type TProps = {
accounts: IAccount[];
code: AccountCode;
region: string;
};

export const Bitrefill = ({ accounts, code }: TProps) => {
export const Bitrefill = ({
accounts,
code,
region,
}: TProps) => {
const { t } = useTranslation();
const { isDarkMode } = useDarkmode();
const account = findAccount(accounts, code);
Expand Down Expand Up @@ -113,12 +118,13 @@ export const Bitrefill = ({ accounts, code }: TProps) => {
refundAddress: bitrefillInfo.address,
// Option to keep pending payment information longer in session, defaults to 'false'
paymentPending: 'true',
region, // can be an empty string if user didnt select a region in market
// Option to show payment information in the widget, defaults to 'true'
showPaymentInfo: 'true'
}, {
targetOrigin: event.origin
});
}, [account, bitrefillInfo, isDarkMode]);
}, [account, bitrefillInfo, isDarkMode, region]);

const handlePaymentRequest = useCallback(async (event: MessageEvent) => {
if (!account || pendingPayment) {
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/routes/market/market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const Market = ({
if (!vendor) {
return;
}
navigate(`/market/${vendor}/${activeTab}/${code}`);
navigate(`/market/${vendor}/${activeTab}/${code}/${selectedRegion}`);
};

const handleChangeRegion = (newValue: SingleValue<TOption>) => {
Expand Down
10 changes: 8 additions & 2 deletions frontends/web/src/routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ export const AppRouter = ({ devices, deviceIDs, devicesKey, accounts, activeAcco
const BitrefillEl = (<InjectParams>
<Bitrefill
code={''}
accounts={activeAccounts} />
accounts={activeAccounts}
region={''} />
</InjectParams>);

const MarketEl = (<InjectParams>
Expand Down Expand Up @@ -223,7 +224,6 @@ export const AppRouter = ({ devices, deviceIDs, devicesKey, accounts, activeAcco
<MobileSettings
devices={devices}
hasAccounts={hasAccounts}

/>
</InjectParams>);

Expand Down Expand Up @@ -276,11 +276,17 @@ export const AppRouter = ({ devices, deviceIDs, devicesKey, accounts, activeAcco
<Route path=":code" element={MarketInfoEl} />
</Route>
<Route path="btcdirect/buy/:code" element={BTCDirectBuyEl} />
<Route path="btcdirect/buy/:code/:region" element={BTCDirectBuyEl} />
<Route path="btcdirect/sell/:code" element={BTCDirectSellEl} />
<Route path="btcdirect/sell/:code/:region" element={BTCDirectSellEl} />
<Route path="bitrefill/spend/:code" element={BitrefillEl} />
<Route path="bitrefill/spend/:code/:region" element={BitrefillEl} />
<Route path="moonpay/buy/:code" element={MoonpayEl} />
<Route path="moonpay/buy/:code/:region" element={MoonpayEl} />
<Route path="pocket/buy/:code" element={PocketBuyEl} />
<Route path="pocket/buy/:code/:region" element={PocketBuyEl} />
<Route path="pocket/sell/:code" element={PocketSellEl} />
<Route path="pocket/sell/:code/:region" element={PocketSellEl} />
<Route path="select/:code" element={MarketEl} />
<Route path="btcdirect-otc" element={<BTCDirectOTC/>} />
</Route>
Expand Down