-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
b-2716-add-billings-profile-column-and-popover (#669)
- Loading branch information
1 parent
5f3e673
commit d228c89
Showing
17 changed files
with
299 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ export type TableColumns = | |
| "languages" | ||
| "repos" | ||
| "issues" | ||
| "billingProfile" | ||
| "actions"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/application/react-query-adapter/me/client/use-get-my-payout-preferences.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
import { | ||
UseQueryFacadeParams, | ||
useQueryAdapter, | ||
} from "@/core/application/react-query-adapter/helpers/use-query-adapter"; | ||
import { bootstrap } from "@/core/bootstrap"; | ||
import { MeFacadePort } from "@/core/domain/me/inputs/me-facade-port"; | ||
import { GetMyPayoutPreferencesModel } from "@/core/domain/me/me-contract.types"; | ||
|
||
export function useGetMyPayoutPreferences({ | ||
options, | ||
}: UseQueryFacadeParams<MeFacadePort["getMyPayoutPreferences"], GetMyPayoutPreferencesModel>) { | ||
const meStoragePort = bootstrap.getMeStoragePortForClient(); | ||
|
||
return useQuery( | ||
useQueryAdapter({ | ||
...meStoragePort.getMyPayoutPreferences({}), | ||
options, | ||
}) | ||
); | ||
} |
61 changes: 61 additions & 0 deletions
61
core/application/react-query-adapter/me/client/use-set-my-preference-for-project.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
|
||
import { | ||
UseMutationFacadeParams, | ||
useMutationAdapter, | ||
} from "@/core/application/react-query-adapter/helpers/use-mutation-adapter"; | ||
import { bootstrap } from "@/core/bootstrap"; | ||
import { MeFacadePort } from "@/core/domain/me/inputs/me-facade-port"; | ||
import { SetMyPayoutPreferenceForProjectBody } from "@/core/domain/me/me-contract.types"; | ||
|
||
export function useSetMyPreferenceForProject({ | ||
options, | ||
}: UseMutationFacadeParams< | ||
MeFacadePort["setMyPayoutPreferenceForProject"], | ||
undefined, | ||
never, | ||
SetMyPayoutPreferenceForProjectBody | ||
> = {}) { | ||
const meStoragePort = bootstrap.getMeStoragePortForClient(); | ||
const rewardStoragePort = bootstrap.getRewardStoragePortForClient(); | ||
const billingProfileStoragePort = bootstrap.getBillingProfileStoragePortForClient(); | ||
|
||
const queryClient = useQueryClient(); | ||
|
||
return useMutation( | ||
useMutationAdapter({ | ||
...meStoragePort.setMyPayoutPreferenceForProject({}), | ||
options: { | ||
...options, | ||
onSuccess: async (data, variables, context) => { | ||
await queryClient.invalidateQueries({ | ||
queryKey: meStoragePort.getMe({}).tag, | ||
exact: false, | ||
}); | ||
|
||
await queryClient.invalidateQueries({ | ||
queryKey: meStoragePort.getMyProjectsAsContributor({}).tag, | ||
exact: false, | ||
}); | ||
|
||
await queryClient.invalidateQueries({ | ||
queryKey: meStoragePort.getMyPayoutPreferences({}).tag, | ||
exact: false, | ||
}); | ||
|
||
await queryClient.invalidateQueries({ | ||
queryKey: rewardStoragePort.getRewards({}).tag, | ||
exact: false, | ||
}); | ||
|
||
await queryClient.invalidateQueries({ | ||
queryKey: billingProfileStoragePort.getMyBillingProfiles({}).tag, | ||
exact: false, | ||
}); | ||
|
||
options?.onSuccess?.(data, variables, context); | ||
}, | ||
}, | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { components } from "@/core/infrastructure/marketplace-api-client-adapter/__generated/api"; | ||
|
||
export type ProjectShortResponse = components["schemas"]["ProjectShortResponse"]; | ||
|
||
export interface ProjectShortInterface extends ProjectShortResponse {} | ||
|
||
export class ProjectShort implements ProjectShortInterface { | ||
shortDescription!: ProjectShortResponse["shortDescription"]; | ||
id!: ProjectShortResponse["id"]; | ||
languages!: ProjectShortResponse["languages"]; | ||
logoUrl!: ProjectShortResponse["logoUrl"]; | ||
name!: ProjectShortResponse["name"]; | ||
slug!: ProjectShortResponse["slug"]; | ||
visibility!: ProjectShortResponse["visibility"]; | ||
|
||
constructor(props: ProjectShortResponse) { | ||
Object.assign(this, props); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"cellLeadsAvatars": { | ||
"projectLead": "Project lead" | ||
}, | ||
"cellBillingProfile": { | ||
"pendingBillingProfile": "Pending billing profile" | ||
} | ||
} |
Oops, something went wrong.