Add console useMutation and rename compliance graphs
Introduce the app-bound useMutation primitive and rename the trust center graph and reference hooks to compliance page, moving the shared reference dialogs alongside them. Sweep the compliance page subpages onto the new mutation hook and the compliance-portal permission strings, and strip the profile fields from the organization settings form. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -20,34 +20,40 @@
|
||||
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { TrustCenterGraphUpdateMutation } from "#/__generated__/core/TrustCenterGraphUpdateMutation.graphql";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import type { CompliancePageGraphDeleteNDAMutation } from "#/__generated__/core/CompliancePageGraphDeleteNDAMutation.graphql";
|
||||
import type { CompliancePageGraphUpdateMutation } from "#/__generated__/core/CompliancePageGraphUpdateMutation.graphql";
|
||||
import type { CompliancePageGraphUploadNDAMutation } from "#/__generated__/core/CompliancePageGraphUploadNDAMutation.graphql";
|
||||
import { useMutation } from "#/lib/relay/useMutation";
|
||||
|
||||
const updateTrustCenterMutation = graphql`
|
||||
mutation TrustCenterGraphUpdateMutation($input: UpdateTrustCenterInput!) {
|
||||
const updateCompliancePageMutation = graphql`
|
||||
mutation CompliancePageGraphUpdateMutation($input: UpdateTrustCenterInput!) {
|
||||
updateTrustCenter(input: $input) {
|
||||
trustCenter {
|
||||
id
|
||||
active
|
||||
searchEngineIndexing
|
||||
description
|
||||
websiteUrl
|
||||
email
|
||||
headquarterAddress
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useUpdateTrustCenterMutation() {
|
||||
return useMutationWithToasts<TrustCenterGraphUpdateMutation>(
|
||||
updateTrustCenterMutation,
|
||||
export function useUpdateCompliancePageMutation() {
|
||||
return useMutation<CompliancePageGraphUpdateMutation>(
|
||||
updateCompliancePageMutation,
|
||||
{
|
||||
successMessage: "Compliance Page updated successfully",
|
||||
errorMessage: "Failed to update compliance page",
|
||||
errorToast: "Failed to update compliance page",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const uploadTrustCenterNDAMutation = graphql`
|
||||
mutation TrustCenterGraphUploadNDAMutation(
|
||||
const uploadCompliancePageNDAMutation = graphql`
|
||||
mutation CompliancePageGraphUploadNDAMutation(
|
||||
$input: UploadTrustCenterNDAInput!
|
||||
) {
|
||||
uploadTrustCenterNDA(input: $input) {
|
||||
@@ -63,15 +69,15 @@ const uploadTrustCenterNDAMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export function useUploadTrustCenterNDAMutation() {
|
||||
return useMutationWithToasts(uploadTrustCenterNDAMutation, {
|
||||
export function useUploadCompliancePageNDAMutation() {
|
||||
return useMutation<CompliancePageGraphUploadNDAMutation>(uploadCompliancePageNDAMutation, {
|
||||
successMessage: "NDA uploaded successfully",
|
||||
errorMessage: "Failed to upload NDA",
|
||||
errorToast: "Failed to upload NDA",
|
||||
});
|
||||
}
|
||||
|
||||
const deleteTrustCenterNDAMutation = graphql`
|
||||
mutation TrustCenterGraphDeleteNDAMutation(
|
||||
const deleteCompliancePageNDAMutation = graphql`
|
||||
mutation CompliancePageGraphDeleteNDAMutation(
|
||||
$input: DeleteTrustCenterNDAInput!
|
||||
) {
|
||||
deleteTrustCenterNDA(input: $input) {
|
||||
@@ -87,9 +93,9 @@ const deleteTrustCenterNDAMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export function useDeleteTrustCenterNDAMutation() {
|
||||
return useMutationWithToasts(deleteTrustCenterNDAMutation, {
|
||||
export function useDeleteCompliancePageNDAMutation() {
|
||||
return useMutation<CompliancePageGraphDeleteNDAMutation>(deleteCompliancePageNDAMutation, {
|
||||
successMessage: "NDA deleted successfully",
|
||||
errorMessage: "Failed to delete NDA",
|
||||
errorToast: "Failed to delete NDA",
|
||||
});
|
||||
}
|
||||
135
apps/console/src/hooks/graph/CompliancePageReferenceGraph.ts
Normal file
135
apps/console/src/hooks/graph/CompliancePageReferenceGraph.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import type { CompliancePageReferenceGraphCreateMutation } from "#/__generated__/core/CompliancePageReferenceGraphCreateMutation.graphql";
|
||||
import type { CompliancePageReferenceGraphDeleteMutation } from "#/__generated__/core/CompliancePageReferenceGraphDeleteMutation.graphql";
|
||||
import type { CompliancePageReferenceGraphUpdateMutation } from "#/__generated__/core/CompliancePageReferenceGraphUpdateMutation.graphql";
|
||||
import type { CompliancePageReferenceGraphUpdateRankMutation } from "#/__generated__/core/CompliancePageReferenceGraphUpdateRankMutation.graphql";
|
||||
import { useMutation } from "#/lib/relay/useMutation";
|
||||
|
||||
export const createCompliancePageReferenceMutation = graphql`
|
||||
mutation CompliancePageReferenceGraphCreateMutation(
|
||||
$input: CreateTrustCenterReferenceInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
createTrustCenterReference(input: $input) {
|
||||
trustCenterReferenceEdge @appendEdge(connections: $connections) {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
logo {
|
||||
downloadUrl
|
||||
}
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "compliance-portal:portal-reference:update")
|
||||
canDelete: permission(action: "compliance-portal:portal-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const updateCompliancePageReferenceMutation = graphql`
|
||||
mutation CompliancePageReferenceGraphUpdateMutation(
|
||||
$input: UpdateTrustCenterReferenceInput!
|
||||
) {
|
||||
updateTrustCenterReference(input: $input) {
|
||||
trustCenterReference {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
logo {
|
||||
downloadUrl
|
||||
}
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "compliance-portal:portal-reference:update")
|
||||
canDelete: permission(action: "compliance-portal:portal-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const deleteCompliancePageReferenceMutation = graphql`
|
||||
mutation CompliancePageReferenceGraphDeleteMutation(
|
||||
$input: DeleteTrustCenterReferenceInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
deleteTrustCenterReference(input: $input) {
|
||||
deletedTrustCenterReferenceId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useCreateCompliancePageReferenceMutation() {
|
||||
return useMutation<CompliancePageReferenceGraphCreateMutation>(
|
||||
createCompliancePageReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference created successfully",
|
||||
errorToast: "Failed to create reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useUpdateCompliancePageReferenceMutation() {
|
||||
return useMutation<CompliancePageReferenceGraphUpdateMutation>(
|
||||
updateCompliancePageReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference updated successfully",
|
||||
errorToast: "Failed to update reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const updateCompliancePageReferenceRankMutation = graphql`
|
||||
mutation CompliancePageReferenceGraphUpdateRankMutation(
|
||||
$input: UpdateTrustCenterReferenceInput!
|
||||
) {
|
||||
updateTrustCenterReference(input: $input) {
|
||||
trustCenterReference {
|
||||
id
|
||||
rank
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useUpdateCompliancePageReferenceRankMutation() {
|
||||
return useMutation<CompliancePageReferenceGraphUpdateRankMutation>(
|
||||
updateCompliancePageReferenceRankMutation,
|
||||
{
|
||||
successMessage: "Order updated successfully",
|
||||
errorToast: "Failed to update order",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useDeleteCompliancePageReferenceMutation() {
|
||||
return useMutation<CompliancePageReferenceGraphDeleteMutation>(
|
||||
deleteCompliancePageReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference deleted successfully",
|
||||
errorToast: "Failed to delete reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { graphql } from "react-relay";
|
||||
|
||||
import type { TrustCenterReferenceGraphCreateMutation } from "#/__generated__/core/TrustCenterReferenceGraphCreateMutation.graphql";
|
||||
import type { TrustCenterReferenceGraphDeleteMutation } from "#/__generated__/core/TrustCenterReferenceGraphDeleteMutation.graphql";
|
||||
import type { TrustCenterReferenceGraphUpdateMutation } from "#/__generated__/core/TrustCenterReferenceGraphUpdateMutation.graphql";
|
||||
import type { TrustCenterReferenceGraphUpdateRankMutation } from "#/__generated__/core/TrustCenterReferenceGraphUpdateRankMutation.graphql";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
|
||||
export const createTrustCenterReferenceMutation = graphql`
|
||||
mutation TrustCenterReferenceGraphCreateMutation(
|
||||
$input: CreateTrustCenterReferenceInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
createTrustCenterReference(input: $input) {
|
||||
trustCenterReferenceEdge @appendEdge(connections: $connections) {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
logo {
|
||||
downloadUrl
|
||||
}
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "core:trust-center-reference:update")
|
||||
canDelete: permission(action: "core:trust-center-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const updateTrustCenterReferenceMutation = graphql`
|
||||
mutation TrustCenterReferenceGraphUpdateMutation(
|
||||
$input: UpdateTrustCenterReferenceInput!
|
||||
) {
|
||||
updateTrustCenterReference(input: $input) {
|
||||
trustCenterReference {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
logo {
|
||||
downloadUrl
|
||||
}
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "core:trust-center-reference:update")
|
||||
canDelete: permission(action: "core:trust-center-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const deleteTrustCenterReferenceMutation = graphql`
|
||||
mutation TrustCenterReferenceGraphDeleteMutation(
|
||||
$input: DeleteTrustCenterReferenceInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
deleteTrustCenterReference(input: $input) {
|
||||
deletedTrustCenterReferenceId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useCreateTrustCenterReferenceMutation() {
|
||||
return useMutationWithToasts<TrustCenterReferenceGraphCreateMutation>(
|
||||
createTrustCenterReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference created successfully",
|
||||
errorMessage: "Failed to create reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useUpdateTrustCenterReferenceMutation() {
|
||||
return useMutationWithToasts<TrustCenterReferenceGraphUpdateMutation>(
|
||||
updateTrustCenterReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference updated successfully",
|
||||
errorMessage: "Failed to update reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const updateTrustCenterReferenceRankMutation = graphql`
|
||||
mutation TrustCenterReferenceGraphUpdateRankMutation(
|
||||
$input: UpdateTrustCenterReferenceInput!
|
||||
) {
|
||||
updateTrustCenterReference(input: $input) {
|
||||
trustCenterReference {
|
||||
id
|
||||
rank
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useUpdateTrustCenterReferenceRankMutation() {
|
||||
return useMutationWithToasts<TrustCenterReferenceGraphUpdateRankMutation>(
|
||||
updateTrustCenterReferenceRankMutation,
|
||||
{
|
||||
successMessage: "Order updated successfully",
|
||||
errorMessage: "Failed to update order",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useDeleteTrustCenterReferenceMutation() {
|
||||
return useMutationWithToasts<TrustCenterReferenceGraphDeleteMutation>(
|
||||
deleteTrustCenterReferenceMutation,
|
||||
{
|
||||
successMessage: "Reference deleted successfully",
|
||||
errorMessage: "Failed to delete reference",
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user