Skip to content

Commit

Permalink
Merge pull request #127 from release/2.1.0
Browse files Browse the repository at this point in the history
Release `2.1.0` to `main`
  • Loading branch information
marcelosalloum authored Jul 30, 2024
2 parents 2eab2f3 + 2ac7b00 commit 217f816
Show file tree
Hide file tree
Showing 36 changed files with 1,009 additions and 261 deletions.
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "02:00"
open-pull-requests-limit: 2
groups:
minor-and-patch:
applies-to: version-updates
update-types:
- "patch"
- "minor"
major:
applies-to: version-updates
update-types:
- "major"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "02:00"
open-pull-requests-limit: 2
groups:
all-actions:
applies-to: version-updates
patterns: [ "*" ]
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "02:00"
open-pull-requests-limit: 2
groups:
all-docker:
applies-to: version-updates
patterns: [ "*" ]
8 changes: 5 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ name: Test and build

on:
push:
branches: [main]
branches:
- main
- develop
pull_request:
workflow_call: # allows this workflow to be called from another workflow

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: yarn install
Expand Down
50 changes: 44 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

> Place unreleased changes here.
## [2.1.0](https://github.com/stellar/stellar-disbursement-platform-frontend/releases/tag/2.1.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/2.0.0...2.1.0))

Release of the Stellar Disbursement Platform v2.1.0. This release introduces the
option to set different distribution account signers per tenant, as well as
Circle support, so the tenant can choose to run their payments through the
Circle API rather than directly on the Stellar network.

> [!Warning] This version is only compatible with the
> [stellar/stellar-disbursement-platform-backend] version `2.1.0`.
### Added

- Implement support for Circle distribution accounts
[#114](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/114),
[#119](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/119).
- When the account is of type Circle and it's status is not Active, a banner
is displayed to direct the user through the Circle setup.
- A new flow was added to allow the user to set up the Circle account.
- When the account is of type Circle, balances are fetched from the SDP
backend rather than the Stellar network.
- The payment details page now shows the Circle transaction ID, when
available.
- Support the new verification type `YEAR_MONTH`
[#121](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/121)
- Added dependabot extra features
[#118](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/118)

### Fix

- Update some fields usage to optional, since they may not be present on the
payload comming from the backend
[#120](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/120)

### Security

- Update the `ws` and `braces` dependencies to fix security vulnerabilities.
[#117](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/117)

## [2.0.0](https://github.com/stellar/stellar-disbursement-platform-frontend/releases/tag/2.0.0)

### Added
Expand Down Expand Up @@ -37,10 +75,10 @@ Each organization has its own set of users, receivers, disbursements, etc.
- Ability for users to add/update verification info for receivers.
[#78](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/78)

## [1.1.2](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.1.1...1.1.2)
## [1.1.2](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/1.1.1...1.1.2)

Attention, this version is compatible with the backend version
[1.1.6](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/1.1.6).
[1.1.6](https://github.com/stellar/stellar-disbursement-platform-frontend/releases/tag/1.1.6).

### Added

Expand All @@ -62,14 +100,14 @@ Attention, this version is compatible with the backend version
identify the account that needs to be funded.
[#80](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/80)

## [1.1.1](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.1.0...1.1.1)
## [1.1.1](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/1.1.0...1.1.1)

### Fixed

- Retry payment button was not showing up on failed payments
[#72](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/72).

## [1.1.0](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.0.1...1.1.0)
## [1.1.0](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/1.0.1...1.1.0)

### Added

Expand Down Expand Up @@ -126,7 +164,7 @@ Attention, this version is compatible with the backend version
- Fix table overflow crop
[#55](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/55)

## [1.0.0](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.0.0-rc2...1.0.0)
## [1.0.0](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/1.0.0-rc2...1.0.0)

### Added

Expand Down Expand Up @@ -155,7 +193,7 @@ Attention, this version is compatible with the backend version
- Add warning message about Distribution account funds
[#11](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/11)

## [1.0.0.rc2](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.0.0-rc1...1.0.0-rc2)
## [1.0.0.rc2](https://github.com/stellar/stellar-disbursement-platform-frontend/compare/1.0.0-rc1...1.0.0-rc2)

### Added

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stellar-disbursement-platform-frontend",
"version": "2.0.0",
"version": "2.1.0",
"license": "Apache-2.0",
"engines": {
"node": ">=18.x"
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Routes } from "constants/settings";
import { PrivateRoute } from "components/PrivateRoute";
import { InnerPage } from "components/InnerPage";
import { UserSession } from "components/UserSession";
import { GlobalBanner } from "components/GlobalBanner";

import { SignIn } from "pages/SignIn";
import { MFAuth } from "pages/MFAuth";
Expand Down Expand Up @@ -60,6 +61,7 @@ export const App = () => {
<QueryClientProvider client={queryClient}>
<UserSession />
<BrowserRouter>
<GlobalBanner />
<RouterRoutes>
{/* Sign in */}
<Route
Expand Down
16 changes: 0 additions & 16 deletions src/api/getStellarAccountInfo.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/apiQueries/useBalanceTrustline.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from "@tanstack/react-query";
import { API_URL } from "constants/envVariables";
import { fetchApi } from "helpers/fetchApi";
import { ApiAsset, AppError, StellarAccountBalance } from "types";
import { ApiAsset, AppError, AccountBalanceItem } from "types";

type Trustline = {
id: string | null;
Expand All @@ -12,7 +12,7 @@ type Trustline = {
};

export const useBalanceTrustline = (
balances?: StellarAccountBalance[] | undefined,
balances?: AccountBalanceItem[] | undefined,
) => {
const query = useQuery<Trustline[] | undefined, AppError>({
queryKey: ["trustlines", { balances }],
Expand Down
33 changes: 33 additions & 0 deletions src/apiQueries/useCircleBalances.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useQuery } from "@tanstack/react-query";
import { API_URL } from "constants/envVariables";
import { fetchApi } from "helpers/fetchApi";
import { AppError } from "types";

type BalancesApi = {
account: {
circle_wallet_id: string;
status: string;
type: string;
};
balances: {
amount: string;
asset_code: string;
asset_issuer: string;
}[];
};

export const useCircleBalances = (
walletId: string,
isActive: boolean = true,
) => {
const query = useQuery<BalancesApi, AppError>({
queryKey: ["circle", "balances", { walletId }],
queryFn: async () => {
return await fetchApi(`${API_URL}/balances`);
},
keepPreviousData: true,
enabled: Boolean(isActive && walletId),
});

return query;
};
5 changes: 1 addition & 4 deletions src/apiQueries/useStellarAccountInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useQuery } from "@tanstack/react-query";
import { HORIZON_URL } from "constants/envVariables";
import { fetchStellarApi } from "helpers/fetchStellarApi";
import { shortenAccountKey } from "helpers/shortenAccountKey";
import { ApiStellarAccount, AppError } from "types";

export const useStellarAccountInfo = (stellarAddress: string | undefined) => {
Expand All @@ -16,9 +15,7 @@ export const useStellarAccountInfo = (stellarAddress: string | undefined) => {
`${HORIZON_URL}/accounts/${stellarAddress}`,
undefined,
{
notFoundMessage: `${shortenAccountKey(
stellarAddress,
)} address was not found.`,
notFoundMessage: `${stellarAddress} address was not found.`,
},
);
},
Expand Down
29 changes: 29 additions & 0 deletions src/apiQueries/useUpdateCircleConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useQuery } from "@tanstack/react-query";
import { API_URL } from "constants/envVariables";
import { fetchApi } from "helpers/fetchApi";
import { sanitizeObject } from "helpers/sanitizeObject";
import { AppError } from "types";

export const useUpdateCircleConfig = ({
api_key,
wallet_id,
}: {
api_key?: string;
wallet_id?: string;
}) => {
const sanitizeObj = sanitizeObject({ api_key, wallet_id });

const query = useQuery<{ message: string }, AppError>({
queryKey: ["organization", "circle", "config", { api_key, wallet_id }],
queryFn: async () => {
return await fetchApi(`${API_URL}/organization/circle-config`, {
method: "PATCH",
body: JSON.stringify(sanitizeObj),
});
},
// Don't fire the query on mount
enabled: false,
});

return query;
};
2 changes: 2 additions & 0 deletions src/apiQueries/useUpdateReceiverDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ReceiverDetailsUpdate {
email: string;
externalId: string;
dataOfBirth: string;
yearMonth: string;
pin: string;
nationalId: string;
}
Expand All @@ -19,6 +20,7 @@ export const useUpdateReceiverDetails = (receiverId: string | undefined) => {
email: fields.email,
external_id: fields.externalId,
date_of_birth: fields.dataOfBirth,
year_month: fields.yearMonth,
pin: fields.pin,
national_id: fields.nationalId,
});
Expand Down
10 changes: 5 additions & 5 deletions src/components/AccountBalances.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { AssetAmount } from "components/AssetAmount";
import { StellarAccountInfo } from "types";
import { AccountBalanceItem } from "types";

interface AccountBalancesProps {
accountInfo: StellarAccountInfo | undefined;
accountBalances: AccountBalanceItem[] | undefined;
}

export const AccountBalances = ({ accountInfo }: AccountBalancesProps) => {
if (accountInfo?.balances?.length === 0) {
export const AccountBalances = ({ accountBalances }: AccountBalancesProps) => {
if (!accountBalances || accountBalances?.length === 0) {
return <div className="Note">There are no balances on this account</div>;
}

return (
<>
{accountInfo?.balances.map((b) => (
{accountBalances.map((b) => (
<AssetAmount
key={`${b.assetCode}-${b.assetIssuer}`}
amount={b.balance}
Expand Down
46 changes: 46 additions & 0 deletions src/components/Box/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";
import "./styles.scss";

export const Box = ({
gap,
children,
customValue,
addlClassName,
direction = "column",
justify = "baseline",
align = "stretch",
...props
}: (
| { gap: "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; customValue?: undefined }
| { gap: "custom"; customValue: string }
) & {
children: React.ReactElement | React.ReactElement[] | null;
addlClassName?: string;
direction?: "column" | "row" | "column-reverse" | "row-reverse";
justify?:
| "center"
| "space-between"
| "space-around"
| "end"
| "left"
| "right"
| "baseline";
align?: "center" | "end" | "start" | "baseline" | "stretch";
}) => {
const customStyle = {
"--Box-direction": direction,
"--Box-justify": justify,
"--Box-align": align,
} as React.CSSProperties;

return (
<div
className={`Box Box--${gap} ${addlClassName ?? ""}`}
{...(gap === "custom" ? { gap: customValue } : {})}
style={customStyle}
{...props}
>
{children}
</div>
);
};
Loading

0 comments on commit 217f816

Please sign in to comment.