diff --git a/apps/console/src/__generated__/core/CompliancePageFileListFragment.graphql.ts b/apps/console/src/__generated__/core/CompliancePageFileListFragment.graphql.ts new file mode 100644 index 000000000..fda663837 --- /dev/null +++ b/apps/console/src/__generated__/core/CompliancePageFileListFragment.graphql.ts @@ -0,0 +1,173 @@ +/** + * @generated SignedSource<<6d08eaab8a421f1908e103b1343e72ac>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type CompliancePageFileListFragment$data = { + readonly compliancePage: { + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_compliancePageFragment">; + }; + readonly trustCenterFiles: { + readonly __id: string; + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">; + }; + }>; + }; + readonly " $fragmentType": "CompliancePageFileListFragment"; +}; +export type CompliancePageFileListFragment$key = { + readonly " $data"?: CompliancePageFileListFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListFragment">; +}; + +const node: ReaderFragment = { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "forward", + "path": [ + "trustCenterFiles" + ] + } + ] + }, + "name": "CompliancePageFileListFragment", + "selections": [ + { + "kind": "RequiredField", + "field": { + "alias": "compliancePage", + "args": null, + "concreteType": "TrustCenter", + "kind": "LinkedField", + "name": "trustCenter", + "plural": false, + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListItem_compliancePageFragment" + } + ], + "storageKey": null + }, + "action": "THROW" + }, + { + "alias": "trustCenterFiles", + "args": null, + "concreteType": "TrustCenterFileConnection", + "kind": "LinkedField", + "name": "__CompliancePageFileList_trustCenterFiles_connection", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFileEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListItem_fileFragment" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + } + ], + "type": "Organization", + "abstractKey": null +}; + +(node as any).hash = "ebbed925b4bbca03e906f63a2d18ab7b"; + +export default node; diff --git a/apps/console/src/__generated__/core/CompliancePageFileListItemMutation.graphql.ts b/apps/console/src/__generated__/core/CompliancePageFileListItemMutation.graphql.ts new file mode 100644 index 000000000..bc5f31f13 --- /dev/null +++ b/apps/console/src/__generated__/core/CompliancePageFileListItemMutation.graphql.ts @@ -0,0 +1,199 @@ +/** + * @generated SignedSource<> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; +export type UpdateTrustCenterFileInput = { + category?: string | null | undefined; + id: string; + name?: string | null | undefined; + trustCenterVisibility?: TrustCenterVisibility | null | undefined; +}; +export type CompliancePageFileListItemMutation$variables = { + input: UpdateTrustCenterFileInput; +}; +export type CompliancePageFileListItemMutation$data = { + readonly updateTrustCenterFile: { + readonly trustCenterFile: { + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">; + }; + }; +}; +export type CompliancePageFileListItemMutation = { + response: CompliancePageFileListItemMutation$data; + variables: CompliancePageFileListItemMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "CompliancePageFileListItemMutation", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": "UpdateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "updateTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "trustCenterFile", + "plural": false, + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListItem_fileFragment" + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "CompliancePageFileListItemMutation", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": "UpdateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "updateTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "trustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fileUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "trustCenterVisibility", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:delete\")" + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "963de1bddf6d9339854e8c147436ea36", + "id": null, + "metadata": {}, + "name": "CompliancePageFileListItemMutation", + "operationKind": "mutation", + "text": "mutation CompliancePageFileListItemMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n" + } +}; +})(); + +(node as any).hash = "e4f65173916a702e8e9ea587e0b560b2"; + +export default node; diff --git a/apps/console/src/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql.ts b/apps/console/src/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql.ts new file mode 100644 index 000000000..049265f0c --- /dev/null +++ b/apps/console/src/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql.ts @@ -0,0 +1,48 @@ +/** + * @generated SignedSource<> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type CompliancePageFileListItem_compliancePageFragment$data = { + readonly canUpdate: boolean; + readonly " $fragmentType": "CompliancePageFileListItem_compliancePageFragment"; +}; +export type CompliancePageFileListItem_compliancePageFragment$key = { + readonly " $data"?: CompliancePageFileListItem_compliancePageFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_compliancePageFragment">; +}; + +const node: ReaderFragment = { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": null, + "name": "CompliancePageFileListItem_compliancePageFragment", + "selections": [ + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center:update\")" + } + ], + "type": "TrustCenter", + "abstractKey": null +}; + +(node as any).hash = "83a20628bcc627902e29c5515741efc5"; + +export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterFilesCardFragment.graphql.ts b/apps/console/src/__generated__/core/CompliancePageFileListItem_fileFragment.graphql.ts similarity index 77% rename from apps/console/src/__generated__/core/TrustCenterFilesCardFragment.graphql.ts rename to apps/console/src/__generated__/core/CompliancePageFileListItem_fileFragment.graphql.ts index 3e2adefb4..10eee4466 100644 --- a/apps/console/src/__generated__/core/TrustCenterFilesCardFragment.graphql.ts +++ b/apps/console/src/__generated__/core/CompliancePageFileListItem_fileFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -11,7 +11,7 @@ import { ReaderFragment } from 'relay-runtime'; export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; import { FragmentRefs } from "relay-runtime"; -export type TrustCenterFilesCardFragment$data = { +export type CompliancePageFileListItem_fileFragment$data = { readonly canDelete: boolean; readonly canUpdate: boolean; readonly category: string; @@ -20,19 +20,18 @@ export type TrustCenterFilesCardFragment$data = { readonly id: string; readonly name: string; readonly trustCenterVisibility: TrustCenterVisibility; - readonly updatedAt: string; - readonly " $fragmentType": "TrustCenterFilesCardFragment"; + readonly " $fragmentType": "CompliancePageFileListItem_fileFragment"; }; -export type TrustCenterFilesCardFragment$key = { - readonly " $data"?: TrustCenterFilesCardFragment$data; - readonly " $fragmentSpreads": FragmentRefs<"TrustCenterFilesCardFragment">; +export type CompliancePageFileListItem_fileFragment$key = { + readonly " $data"?: CompliancePageFileListItem_fileFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">; }; const node: ReaderFragment = { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, - "name": "TrustCenterFilesCardFragment", + "name": "CompliancePageFileListItem_fileFragment", "selections": [ { "alias": null, @@ -76,13 +75,6 @@ const node: ReaderFragment = { "name": "createdAt", "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - }, { "alias": "canUpdate", "args": [ @@ -114,6 +106,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "7b9e482868fc5d815923fbefdbafc8bb"; +(node as any).hash = "0e5caf3d8c62ca0cd3ed8b37787e2b86"; export default node; diff --git a/apps/console/src/__generated__/core/CompliancePageFilesPageQuery.graphql.ts b/apps/console/src/__generated__/core/CompliancePageFilesPageQuery.graphql.ts new file mode 100644 index 000000000..d0ea24d27 --- /dev/null +++ b/apps/console/src/__generated__/core/CompliancePageFilesPageQuery.graphql.ts @@ -0,0 +1,327 @@ +/** + * @generated SignedSource<<43d75c2e4c035f883790d1d854b60bfc>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type CompliancePageFilesPageQuery$variables = { + organizationId: string; +}; +export type CompliancePageFilesPageQuery$data = { + readonly organization: { + readonly canCreateTrustCenterFile?: boolean; + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListFragment">; + }; +}; +export type CompliancePageFilesPageQuery = { + response: CompliancePageFilesPageQuery$data; + variables: CompliancePageFilesPageQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "organizationId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "organizationId" + } +], +v2 = { + "alias": "canCreateTrustCenterFile", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:create\")" +}, +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v5 = [ + { + "kind": "Literal", + "name": "first", + "value": 1000 + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "CompliancePageFilesPageQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/) + ], + "type": "Organization", + "abstractKey": null + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListFragment" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "CompliancePageFilesPageQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + { + "alias": "compliancePage", + "args": null, + "concreteType": "TrustCenter", + "kind": "LinkedField", + "name": "trustCenter", + "plural": false, + "selections": [ + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center:update\")" + }, + (v4/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": (v5/*: any*/), + "concreteType": "TrustCenterFileConnection", + "kind": "LinkedField", + "name": "trustCenterFiles", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFileEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v4/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fileUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "trustCenterVisibility", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:delete\")" + }, + (v3/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": "trustCenterFiles(first:1000)" + }, + { + "alias": null, + "args": (v5/*: any*/), + "filters": null, + "handle": "connection", + "key": "CompliancePageFileList_trustCenterFiles", + "kind": "LinkedHandle", + "name": "trustCenterFiles" + } + ], + "type": "Organization", + "abstractKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "115af8c7555ab3ab0277f16c8ec7ea6d", + "id": null, + "metadata": {}, + "name": "CompliancePageFilesPageQuery", + "operationKind": "query", + "text": "query CompliancePageFilesPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n }\n ...CompliancePageFileListFragment\n id\n }\n}\n\nfragment CompliancePageFileListFragment on Organization {\n compliancePage: trustCenter {\n ...CompliancePageFileListItem_compliancePageFragment\n id\n }\n trustCenterFiles(first: 1000) {\n edges {\n node {\n id\n ...CompliancePageFileListItem_fileFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment CompliancePageFileListItem_compliancePageFragment on TrustCenter {\n canUpdate: permission(action: \"core:trust-center:update\")\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n" + } +}; +})(); + +(node as any).hash = "77e598eaad239dcac7b5036c52442ed4"; + +export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterFileGraphDeleteMutation.graphql.ts b/apps/console/src/__generated__/core/DeleteCompliancePageFileDialogMutation.graphql.ts similarity index 74% rename from apps/console/src/__generated__/core/TrustCenterFileGraphDeleteMutation.graphql.ts rename to apps/console/src/__generated__/core/DeleteCompliancePageFileDialogMutation.graphql.ts index 368459c62..593d4dc0f 100644 --- a/apps/console/src/__generated__/core/TrustCenterFileGraphDeleteMutation.graphql.ts +++ b/apps/console/src/__generated__/core/DeleteCompliancePageFileDialogMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<883f3a053aa51e1c94ad7c75a2fb91d2>> * @lightSyntaxTransform * @nogrep */ @@ -12,18 +12,18 @@ import { ConcreteRequest } from 'relay-runtime'; export type DeleteTrustCenterFileInput = { id: string; }; -export type TrustCenterFileGraphDeleteMutation$variables = { +export type DeleteCompliancePageFileDialogMutation$variables = { connections: ReadonlyArray; input: DeleteTrustCenterFileInput; }; -export type TrustCenterFileGraphDeleteMutation$data = { +export type DeleteCompliancePageFileDialogMutation$data = { readonly deleteTrustCenterFile: { readonly deletedTrustCenterFileId: string; }; }; -export type TrustCenterFileGraphDeleteMutation = { - response: TrustCenterFileGraphDeleteMutation$data; - variables: TrustCenterFileGraphDeleteMutation$variables; +export type DeleteCompliancePageFileDialogMutation = { + response: DeleteCompliancePageFileDialogMutation$data; + variables: DeleteCompliancePageFileDialogMutation$variables; }; const node: ConcreteRequest = (function(){ @@ -59,7 +59,7 @@ return { ], "kind": "Fragment", "metadata": null, - "name": "TrustCenterFileGraphDeleteMutation", + "name": "DeleteCompliancePageFileDialogMutation", "selections": [ { "alias": null, @@ -84,7 +84,7 @@ return { (v0/*: any*/) ], "kind": "Operation", - "name": "TrustCenterFileGraphDeleteMutation", + "name": "DeleteCompliancePageFileDialogMutation", "selections": [ { "alias": null, @@ -117,16 +117,16 @@ return { ] }, "params": { - "cacheID": "ad78a064da9b58291653f8283012ffc6", + "cacheID": "d3d7dcdb4201d8f3eeaa66973545bed0", "id": null, "metadata": {}, - "name": "TrustCenterFileGraphDeleteMutation", + "name": "DeleteCompliancePageFileDialogMutation", "operationKind": "mutation", - "text": "mutation TrustCenterFileGraphDeleteMutation(\n $input: DeleteTrustCenterFileInput!\n) {\n deleteTrustCenterFile(input: $input) {\n deletedTrustCenterFileId\n }\n}\n" + "text": "mutation DeleteCompliancePageFileDialogMutation(\n $input: DeleteTrustCenterFileInput!\n) {\n deleteTrustCenterFile(input: $input) {\n deletedTrustCenterFileId\n }\n}\n" } }; })(); -(node as any).hash = "26c1ce69e74f3a4a39d060b38afbe3e0"; +(node as any).hash = "1bf5628f93e3ec6ee240290f5aaf5761"; export default node; diff --git a/apps/console/src/__generated__/core/EditCompliancePageFileDialogMutation.graphql.ts b/apps/console/src/__generated__/core/EditCompliancePageFileDialogMutation.graphql.ts new file mode 100644 index 000000000..6561cd911 --- /dev/null +++ b/apps/console/src/__generated__/core/EditCompliancePageFileDialogMutation.graphql.ts @@ -0,0 +1,199 @@ +/** + * @generated SignedSource<<4b69c7a9c52b20ca2556b68e16e87cc1>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; +export type UpdateTrustCenterFileInput = { + category?: string | null | undefined; + id: string; + name?: string | null | undefined; + trustCenterVisibility?: TrustCenterVisibility | null | undefined; +}; +export type EditCompliancePageFileDialogMutation$variables = { + input: UpdateTrustCenterFileInput; +}; +export type EditCompliancePageFileDialogMutation$data = { + readonly updateTrustCenterFile: { + readonly trustCenterFile: { + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">; + }; + }; +}; +export type EditCompliancePageFileDialogMutation = { + response: EditCompliancePageFileDialogMutation$data; + variables: EditCompliancePageFileDialogMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "EditCompliancePageFileDialogMutation", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": "UpdateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "updateTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "trustCenterFile", + "plural": false, + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListItem_fileFragment" + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "EditCompliancePageFileDialogMutation", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": "UpdateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "updateTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "trustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fileUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "trustCenterVisibility", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:delete\")" + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "7870997778d7b97e32afa90f4fd94e37", + "id": null, + "metadata": {}, + "name": "EditCompliancePageFileDialogMutation", + "operationKind": "mutation", + "text": "mutation EditCompliancePageFileDialogMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n" + } +}; +})(); + +(node as any).hash = "c49b56acdfa7d0764ced16a9f0b39c69"; + +export default node; diff --git a/apps/console/src/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql.ts b/apps/console/src/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql.ts new file mode 100644 index 000000000..403be1636 --- /dev/null +++ b/apps/console/src/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql.ts @@ -0,0 +1,250 @@ +/** + * @generated SignedSource<<50c909a6a1d81679625acf045c6ca1c2>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; +export type CreateTrustCenterFileInput = { + category: string; + file: any; + name: string; + organizationId: string; + trustCenterVisibility: TrustCenterVisibility; +}; +export type NewCompliancePageFileDialog_createMutation$variables = { + connections: ReadonlyArray; + input: CreateTrustCenterFileInput; +}; +export type NewCompliancePageFileDialog_createMutation$data = { + readonly createTrustCenterFile: { + readonly trustCenterFileEdge: { + readonly node: { + readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">; + }; + }; + }; +}; +export type NewCompliancePageFileDialog_createMutation = { + response: NewCompliancePageFileDialog_createMutation$data; + variables: NewCompliancePageFileDialog_createMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "connections" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" +}, +v2 = [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } +]; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "NewCompliancePageFileDialog_createMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "createTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFileEdge", + "kind": "LinkedField", + "name": "trustCenterFileEdge", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "CompliancePageFileListItem_fileFragment" + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v1/*: any*/), + (v0/*: any*/) + ], + "kind": "Operation", + "name": "NewCompliancePageFileDialog_createMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateTrustCenterFilePayload", + "kind": "LinkedField", + "name": "createTrustCenterFile", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFileEdge", + "kind": "LinkedField", + "name": "trustCenterFileEdge", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterFile", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fileUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "trustCenterVisibility", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center-file:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center-file:delete\")" + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "filters": null, + "handle": "prependEdge", + "key": "", + "kind": "LinkedHandle", + "name": "trustCenterFileEdge", + "handleArgs": [ + { + "kind": "Variable", + "name": "connections", + "variableName": "connections" + } + ] + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "337ae413f581adb0256b0b47f0514f43", + "id": null, + "metadata": {}, + "name": "NewCompliancePageFileDialog_createMutation", + "operationKind": "mutation", + "text": "mutation NewCompliancePageFileDialog_createMutation(\n $input: CreateTrustCenterFileInput!\n) {\n createTrustCenterFile(input: $input) {\n trustCenterFileEdge {\n node {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n" + } +}; +})(); + +(node as any).hash = "826c457285dd9890c39b9c11e600316f"; + +export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterFileGraphCreateMutation.graphql.ts b/apps/console/src/__generated__/core/TrustCenterFileGraphCreateMutation.graphql.ts deleted file mode 100644 index d72dd822f..000000000 --- a/apps/console/src/__generated__/core/TrustCenterFileGraphCreateMutation.graphql.ts +++ /dev/null @@ -1,211 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest } from 'relay-runtime'; -export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; -export type CreateTrustCenterFileInput = { - category: string; - file: any; - name: string; - organizationId: string; - trustCenterVisibility: TrustCenterVisibility; -}; -export type TrustCenterFileGraphCreateMutation$variables = { - connections: ReadonlyArray; - input: CreateTrustCenterFileInput; -}; -export type TrustCenterFileGraphCreateMutation$data = { - readonly createTrustCenterFile: { - readonly trustCenterFileEdge: { - readonly node: { - readonly category: string; - readonly createdAt: string; - readonly fileUrl: string; - readonly id: string; - readonly name: string; - readonly trustCenterVisibility: TrustCenterVisibility; - readonly updatedAt: string; - }; - }; - }; -}; -export type TrustCenterFileGraphCreateMutation = { - response: TrustCenterFileGraphCreateMutation$data; - variables: TrustCenterFileGraphCreateMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = { - "defaultValue": null, - "kind": "LocalArgument", - "name": "connections" -}, -v1 = { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" -}, -v2 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v3 = { - "alias": null, - "args": null, - "concreteType": "TrustCenterFileEdge", - "kind": "LinkedField", - "name": "trustCenterFileEdge", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFile", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "category", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fileUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "trustCenterVisibility", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "createdAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null -}; -return { - "fragment": { - "argumentDefinitions": [ - (v0/*: any*/), - (v1/*: any*/) - ], - "kind": "Fragment", - "metadata": null, - "name": "TrustCenterFileGraphCreateMutation", - "selections": [ - { - "alias": null, - "args": (v2/*: any*/), - "concreteType": "CreateTrustCenterFilePayload", - "kind": "LinkedField", - "name": "createTrustCenterFile", - "plural": false, - "selections": [ - (v3/*: any*/) - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": [ - (v1/*: any*/), - (v0/*: any*/) - ], - "kind": "Operation", - "name": "TrustCenterFileGraphCreateMutation", - "selections": [ - { - "alias": null, - "args": (v2/*: any*/), - "concreteType": "CreateTrustCenterFilePayload", - "kind": "LinkedField", - "name": "createTrustCenterFile", - "plural": false, - "selections": [ - (v3/*: any*/), - { - "alias": null, - "args": null, - "filters": null, - "handle": "prependEdge", - "key": "", - "kind": "LinkedHandle", - "name": "trustCenterFileEdge", - "handleArgs": [ - { - "kind": "Variable", - "name": "connections", - "variableName": "connections" - } - ] - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "57c42327b83556d36745cf8218eb01b1", - "id": null, - "metadata": {}, - "name": "TrustCenterFileGraphCreateMutation", - "operationKind": "mutation", - "text": "mutation TrustCenterFileGraphCreateMutation(\n $input: CreateTrustCenterFileInput!\n) {\n createTrustCenterFile(input: $input) {\n trustCenterFileEdge {\n node {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n }\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "fa3851bf4f5e38bc26d8a063d6afab4e"; - -export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterFileGraphUpdateMutation.graphql.ts b/apps/console/src/__generated__/core/TrustCenterFileGraphUpdateMutation.graphql.ts deleted file mode 100644 index 8df5325fe..000000000 --- a/apps/console/src/__generated__/core/TrustCenterFileGraphUpdateMutation.graphql.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @generated SignedSource<<981cc2a2716995f5e1f22d2554598992>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest } from 'relay-runtime'; -export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; -export type UpdateTrustCenterFileInput = { - category?: string | null | undefined; - id: string; - name?: string | null | undefined; - trustCenterVisibility?: TrustCenterVisibility | null | undefined; -}; -export type TrustCenterFileGraphUpdateMutation$variables = { - input: UpdateTrustCenterFileInput; -}; -export type TrustCenterFileGraphUpdateMutation$data = { - readonly updateTrustCenterFile: { - readonly trustCenterFile: { - readonly category: string; - readonly id: string; - readonly name: string; - readonly trustCenterVisibility: TrustCenterVisibility; - readonly updatedAt: string; - }; - }; -}; -export type TrustCenterFileGraphUpdateMutation = { - response: TrustCenterFileGraphUpdateMutation$data; - variables: TrustCenterFileGraphUpdateMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "alias": null, - "args": [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } - ], - "concreteType": "UpdateTrustCenterFilePayload", - "kind": "LinkedField", - "name": "updateTrustCenterFile", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFile", - "kind": "LinkedField", - "name": "trustCenterFile", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "category", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "trustCenterVisibility", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } -]; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "TrustCenterFileGraphUpdateMutation", - "selections": (v1/*: any*/), - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "TrustCenterFileGraphUpdateMutation", - "selections": (v1/*: any*/) - }, - "params": { - "cacheID": "9ad761d91cfe34e7fa905a3f6a4d9e37", - "id": null, - "metadata": {}, - "name": "TrustCenterFileGraphUpdateMutation", - "operationKind": "mutation", - "text": "mutation TrustCenterFileGraphUpdateMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n id\n name\n category\n trustCenterVisibility\n updatedAt\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "7306c3f9530a7636adc0b6a0cf28b67e"; - -export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts b/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts index 2336484f6..774d77942 100644 --- a/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts +++ b/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<0f4473cdf4275afaab6b6825f6b6d546>> + * @generated SignedSource<<2d62f164c109bbc5fa46add3bd2dbf23>> * @lightSyntaxTransform * @nogrep */ @@ -36,15 +36,6 @@ export type TrustCenterGraphQuery$data = { readonly ndaFileUrl: string | null | undefined; readonly updatedAt: string; } | null | undefined; - readonly trustCenterFiles?: { - readonly __id: string; - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"TrustCenterFilesCardFragment">; - }; - }>; - }; readonly vendors?: { readonly edges: ReadonlyArray<{ readonly node: { @@ -129,13 +120,6 @@ v6 = { "storageKey": null }, v7 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null -}, -v8 = { "alias": null, "args": null, "concreteType": "TrustCenter", @@ -166,7 +150,13 @@ v8 = { "storageKey": null }, (v6/*: any*/), - (v7/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, { "alias": "canUpdate", "args": [ @@ -248,71 +238,13 @@ v8 = { ], "storageKey": null }, -v9 = [ +v8 = [ { "kind": "Literal", "name": "first", "value": 100 } -], -v10 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v11 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null -}, -v12 = { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - } - ], - "storageKey": null -}, -v13 = { - "kind": "ClientExtension", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__id", - "storageKey": null - } - ] -}, -v14 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "category", - "storageKey": null -}; +]; return { "fragment": { "argumentDefinitions": (v0/*: any*/), @@ -335,10 +267,10 @@ return { (v3/*: any*/), (v4/*: any*/), (v5/*: any*/), - (v8/*: any*/), + (v7/*: any*/), { "alias": null, - "args": (v9/*: any*/), + "args": (v8/*: any*/), "concreteType": "VendorConnection", "kind": "LinkedField", "name": "vendors", @@ -374,49 +306,6 @@ return { } ], "storageKey": "vendors(first:100)" - }, - { - "alias": "trustCenterFiles", - "args": null, - "concreteType": "TrustCenterFileConnection", - "kind": "LinkedField", - "name": "__TrustCenterPage_trustCenterFiles_connection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFileEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFile", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "args": null, - "kind": "FragmentSpread", - "name": "TrustCenterFilesCardFragment" - }, - (v10/*: any*/) - ], - "storageKey": null - }, - (v11/*: any*/) - ], - "storageKey": null - }, - (v12/*: any*/), - (v13/*: any*/) - ], - "storageKey": null } ], "type": "Organization", @@ -443,7 +332,13 @@ return { "name": "node", "plural": false, "selections": [ - (v10/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, (v2/*: any*/), { "kind": "InlineFragment", @@ -451,10 +346,10 @@ return { (v3/*: any*/), (v4/*: any*/), (v5/*: any*/), - (v8/*: any*/), + (v7/*: any*/), { "alias": null, - "args": (v9/*: any*/), + "args": (v8/*: any*/), "concreteType": "VendorConnection", "kind": "LinkedField", "name": "vendors", @@ -478,7 +373,13 @@ return { "selections": [ (v2/*: any*/), (v3/*: any*/), - (v14/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, { "alias": null, "args": null, @@ -515,97 +416,6 @@ return { } ], "storageKey": "vendors(first:100)" - }, - { - "alias": null, - "args": (v9/*: any*/), - "concreteType": "TrustCenterFileConnection", - "kind": "LinkedField", - "name": "trustCenterFiles", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFileEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TrustCenterFile", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v14/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fileUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "trustCenterVisibility", - "storageKey": null - }, - (v6/*: any*/), - (v7/*: any*/), - { - "alias": "canUpdate", - "args": [ - { - "kind": "Literal", - "name": "action", - "value": "core:trust-center-file:update" - } - ], - "kind": "ScalarField", - "name": "permission", - "storageKey": "permission(action:\"core:trust-center-file:update\")" - }, - { - "alias": "canDelete", - "args": [ - { - "kind": "Literal", - "name": "action", - "value": "core:trust-center-file:delete" - } - ], - "kind": "ScalarField", - "name": "permission", - "storageKey": "permission(action:\"core:trust-center-file:delete\")" - }, - (v10/*: any*/) - ], - "storageKey": null - }, - (v11/*: any*/) - ], - "storageKey": null - }, - (v12/*: any*/), - (v13/*: any*/) - ], - "storageKey": "trustCenterFiles(first:100)" - }, - { - "alias": null, - "args": (v9/*: any*/), - "filters": null, - "handle": "connection", - "key": "TrustCenterPage_trustCenterFiles", - "kind": "LinkedHandle", - "name": "trustCenterFiles" } ], "type": "Organization", @@ -617,28 +427,16 @@ return { ] }, "params": { - "cacheID": "ae3ba021303da59b774b89df514bd91e", + "cacheID": "050ad842df04d5130394e7b0a052bf69", "id": null, - "metadata": { - "connection": [ - { - "count": null, - "cursor": null, - "direction": "forward", - "path": [ - "organization", - "trustCenterFiles" - ] - } - ] - }, + "metadata": {}, "name": "TrustCenterGraphQuery", "operationKind": "query", - "text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n canCreateReference: permission(action: \"core:trust-center-reference:create\")\n canCreateAccess: permission(action: \"core:trust-center-access:create\")\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n canUpdate: permission(action: \"core:vendor:update\")\n}\n" + "text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n canCreateReference: permission(action: \"core:trust-center-reference:create\")\n canCreateAccess: permission(action: \"core:trust-center-access:create\")\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n canUpdate: permission(action: \"core:vendor:update\")\n}\n" } }; })(); -(node as any).hash = "abd5b3222d2bd168213a8ede829b4881"; +(node as any).hash = "4804fdce46976e5597cb1fa263686b8e"; export default node; diff --git a/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx b/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx deleted file mode 100644 index 7354166e1..000000000 --- a/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx +++ /dev/null @@ -1,241 +0,0 @@ -import { formatDate, getTrustCenterVisibilityOptions, sprintf } from "@probo/helpers"; -import { useTranslate } from "@probo/i18n"; -import { - Badge, - Button, - Field, - IconArrowLink, - IconChevronDown, - IconPencil, - IconTrashCan, - Option, - Table, - Tbody, - Td, - Th, - Thead, - Tr, -} from "@probo/ui"; -import { useCallback, useMemo, useState } from "react"; -import { useFragment } from "react-relay"; -import { graphql } from "relay-runtime"; - -import type { - TrustCenterFilesCardFragment$data, - TrustCenterFilesCardFragment$key, -} from "#/__generated__/core/TrustCenterFilesCardFragment.graphql"; - -const trustCenterFileFragment = graphql` - fragment TrustCenterFilesCardFragment on TrustCenterFile { - id - name - category - fileUrl - trustCenterVisibility - createdAt - updatedAt - canUpdate: permission(action: "core:trust-center-file:update") - canDelete: permission(action: "core:trust-center-file:delete") - } -`; - -type Mutation = (p: { - variables: { - input: { - id: string; - trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC"; - } & Params; - }; -}) => Promise; - -type Props = { - files: TrustCenterFilesCardFragment$key[]; - params: Params; - disabled?: boolean; - onChangeVisibility: Mutation; - onEdit: (file: { id: string; name: string; category: string }) => void; - onDelete: (id: string) => void; - canUpdate: boolean; -}; - -export function TrustCenterFilesCard(props: Props) { - const { __ } = useTranslate(); - const [limit, setLimit] = useState(100); - const files = useMemo(() => { - return limit ? props.files.slice(0, limit) : props.files; - }, [props.files, limit]); - const showMoreButton = limit !== null && props.files.length > limit; - - const onChangeVisibility = async ( - fileId: string, - trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC", - ) => { - await props.onChangeVisibility({ - variables: { - input: { - id: fileId, - trustCenterVisibility, - ...props.params, - }, - }, - }); - }; - - return ( -
- - - - - - - - - - - - {files.length === 0 && ( - - - - )} - {files.map((fileFragmentRef, index) => ( - - ))} - -
{__("Name")}{__("Category")}{__("Upload Date")}{__("Visibility")}
- {__("No files available")} -
- {showMoreButton && ( - - )} -
- ); -} - -function FileRowWrapper(props: { - fileFragmentRef: TrustCenterFilesCardFragment$key; - onChangeVisibility: ( - fileId: string, - trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC", - ) => Promise; - onEdit: (file: { id: string; name: string; category: string }) => void; - onDelete: (id: string) => void; - disabled?: boolean; - canUpdate: boolean; -}) { - const file = useFragment(trustCenterFileFragment, props.fileFragmentRef); - return ( - - ); -} - -function FileRow(props: { - file: TrustCenterFilesCardFragment$data; - onChangeVisibility: ( - fileId: string, - trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC", - ) => Promise; - onEdit: (file: { id: string; name: string; category: string }) => void; - onDelete: (id: string) => void; - disabled?: boolean; - canUpdate: boolean; -}) { - const { file, onChangeVisibility, onEdit, onDelete, disabled, canUpdate } - = props; - const { __ } = useTranslate(); - - const handleValueChange = useCallback( - async (value: string) => { - const stringValue = typeof value === "string" ? value : ""; - const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC"; - await onChangeVisibility(file.id, typedValue); - }, - [file.id, onChangeVisibility], - ); - - const visibilityOptions = getTrustCenterVisibilityOptions(__); - - return ( - - -
{file.name}
- - {file.category} - {formatDate(file.createdAt)} - - void handleValueChange(value)} - disabled={disabled || !canUpdate} - className="w-[105px]" - > - {visibilityOptions.map(option => ( - - ))} - - - -
-
- - - ); -} diff --git a/apps/console/src/hooks/graph/TrustCenterFileGraph.ts b/apps/console/src/hooks/graph/TrustCenterFileGraph.ts deleted file mode 100644 index f15a4208d..000000000 --- a/apps/console/src/hooks/graph/TrustCenterFileGraph.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { graphql } from "relay-runtime"; - -import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; - -export const createTrustCenterFileMutation = graphql` - mutation TrustCenterFileGraphCreateMutation( - $input: CreateTrustCenterFileInput! - $connections: [ID!]! - ) { - createTrustCenterFile(input: $input) { - trustCenterFileEdge @prependEdge(connections: $connections) { - node { - id - name - category - fileUrl - trustCenterVisibility - createdAt - updatedAt - } - } - } - } -`; - -export function useCreateTrustCenterFileMutation() { - return useMutationWithToasts( - createTrustCenterFileMutation, - { - successMessage: "File uploaded successfully", - errorMessage: "Failed to upload file", - }, - ); -} - -export const updateTrustCenterFileMutation = graphql` - mutation TrustCenterFileGraphUpdateMutation($input: UpdateTrustCenterFileInput!) { - updateTrustCenterFile(input: $input) { - trustCenterFile { - id - name - category - trustCenterVisibility - updatedAt - } - } - } -`; - -export function useUpdateTrustCenterFileMutation() { - return useMutationWithToasts( - updateTrustCenterFileMutation, - { - successMessage: "File updated successfully", - errorMessage: "Failed to update file", - }, - ); -} - -export const deleteTrustCenterFileMutation = graphql` - mutation TrustCenterFileGraphDeleteMutation( - $input: DeleteTrustCenterFileInput! - $connections: [ID!]! - ) { - deleteTrustCenterFile(input: $input) { - deletedTrustCenterFileId @deleteEdge(connections: $connections) - } - } -`; - -export function useDeleteTrustCenterFileMutation() { - return useMutationWithToasts( - deleteTrustCenterFileMutation, - { - successMessage: "File deleted successfully", - errorMessage: "Failed to delete file", - }, - ); -} diff --git a/apps/console/src/hooks/graph/TrustCenterGraph.ts b/apps/console/src/hooks/graph/TrustCenterGraph.ts index c1711576e..d59b3a74b 100644 --- a/apps/console/src/hooks/graph/TrustCenterGraph.ts +++ b/apps/console/src/hooks/graph/TrustCenterGraph.ts @@ -40,16 +40,6 @@ export const trustCenterQuery = graphql` } } } - trustCenterFiles(first: 100) - @connection(key: "TrustCenterPage_trustCenterFiles") { - __id - edges { - node { - id - ...TrustCenterFilesCardFragment - } - } - } } } } diff --git a/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPage.tsx b/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPage.tsx new file mode 100644 index 000000000..5f0d885da --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPage.tsx @@ -0,0 +1,65 @@ +import { useTranslate } from "@probo/i18n"; +import { Button, IconPlusLarge, useDialogRef } from "@probo/ui"; +import { ConnectionHandler, graphql, type PreloadedQuery, usePreloadedQuery } from "react-relay"; + +import type { CompliancePageFilesPageQuery } from "#/__generated__/core/CompliancePageFilesPageQuery.graphql"; +import { useOrganizationId } from "#/hooks/useOrganizationId"; + +import { CompliancePageFileList } from "./_components/CompliancePageFileList"; +import { NewCompliancePageFileDialog } from "./_components/NewCompliancePageFileDialog"; + +export const compliancePageFilesPageQuery = graphql` + query CompliancePageFilesPageQuery($organizationId: ID!) { + organization: node(id: $organizationId) { + ... on Organization { + canCreateTrustCenterFile: permission(action: "core:trust-center-file:create") + } + ...CompliancePageFileListFragment + } + } +`; + +export function CompliancePageFilesPage(props: { + queryRef: PreloadedQuery; +}) { + const { queryRef } = props; + + const organizationId = useOrganizationId(); + const { __ } = useTranslate(); + const createDialogRef = useDialogRef(); + + const { organization } = usePreloadedQuery(compliancePageFilesPageQuery, queryRef); + + const filesConnectionId = ConnectionHandler.getConnectionID( + organizationId, + "CompliancePageFileList_trustCenterFiles", + ); + + return ( +
+
+
+

{__("Files")}

+

+ {__("Upload and manage files for your trust center")} +

+
+ {organization.canCreateTrustCenterFile && ( + + )} +
+ + + + +
+ ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPageLoader.tsx b/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPageLoader.tsx new file mode 100644 index 000000000..a457741c7 --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/CompliancePageFilesPageLoader.tsx @@ -0,0 +1,32 @@ +import { useEffect } from "react"; +import { useQueryLoader } from "react-relay"; + +import type { CompliancePageFilesPageQuery } from "#/__generated__/core/CompliancePageFilesPageQuery.graphql"; +import { LinkCardSkeleton } from "#/components/skeletons/LinkCardSkeleton"; +import { useOrganizationId } from "#/hooks/useOrganizationId"; +import { CoreRelayProvider } from "#/providers/CoreRelayProvider"; + +import { CompliancePageFilesPage, compliancePageFilesPageQuery } from "./CompliancePageFilesPage"; + +function CompliancePageFilesPageQueryLoader() { + const organizationId = useOrganizationId(); + const [queryRef, loadQuery] = useQueryLoader(compliancePageFilesPageQuery); + + useEffect(() => { + if (!queryRef) { + loadQuery({ organizationId }); + } + }); + + if (!queryRef) return ; + + return ; +} + +export default function CompliancePageFilesPageLoader() { + return ( + + + + ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileList.tsx b/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileList.tsx new file mode 100644 index 000000000..39da85db2 --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileList.tsx @@ -0,0 +1,116 @@ +import { sprintf } from "@probo/helpers"; +import { useTranslate } from "@probo/i18n"; +import { Button, IconChevronDown, Table, Tbody, Td, Th, Thead, Tr, useDialogRef } from "@probo/ui"; +import { useCallback, useState } from "react"; +import { useFragment } from "react-relay"; +import { graphql } from "relay-runtime"; + +import type { CompliancePageFileListFragment$key } from "#/__generated__/core/CompliancePageFileListFragment.graphql"; +import type { CompliancePageFileListItem_fileFragment$data } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql"; + +import { CompliancePageFileListItem } from "./CompliancePageFileListItem"; +import { DeleteCompliancePageFileDialog } from "./DeleteCompliancePageFileDialog"; +import { EditCompliancePageFileDialog } from "./EditCompliancePageFileDialog"; + +const fragment = graphql` + fragment CompliancePageFileListFragment on Organization { + compliancePage: trustCenter @required(action: THROW) { + ...CompliancePageFileListItem_compliancePageFragment + } + trustCenterFiles(first: 1000) + @connection(key: "CompliancePageFileList_trustCenterFiles") { + __id + edges { + node { + id + ...CompliancePageFileListItem_fileFragment + } + } + } + } +`; + +export function CompliancePageFileList(props: { fragmentRef: CompliancePageFileListFragment$key }) { + const { fragmentRef } = props; + + const { __ } = useTranslate(); + const deleteDialogRef = useDialogRef(); + + const { + compliancePage, + trustCenterFiles: files, + } = useFragment(fragment, fragmentRef); + + const [limit, setLimit] = useState(100); + const showMoreButton = limit !== null && files.edges.length > limit; + + const [editingFile, setEditingFile] = useState< + CompliancePageFileListItem_fileFragment$data | null>(null); + const [deletingFileId, setDeletingFileId] = useState(null); + + const handleDelete = useCallback( + (id: string) => { + setDeletingFileId(id); + deleteDialogRef.current?.open(); + }, + [deleteDialogRef], + ); + + return ( +
+ + + + + + + + + + + + {files.edges.length === 0 && ( + + + + )} + {files.edges.map(({ node: file }) => ( + + ))} + +
{__("Name")}{__("Category")}{__("Upload Date")}{__("Visibility")}
+ {__("No files available")} +
+ {showMoreButton && ( + + )} + + {editingFile + && ( + setEditingFile(null)} + /> + )} + setDeletingFileId(null)} + /> +
+ ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileListItem.tsx b/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileListItem.tsx new file mode 100644 index 000000000..94839690e --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/_components/CompliancePageFileListItem.tsx @@ -0,0 +1,138 @@ +import { formatDate, getTrustCenterVisibilityOptions } from "@probo/helpers"; +import { useTranslate } from "@probo/i18n"; +import { Badge, Button, Field, IconArrowLink, IconPencil, IconTrashCan, Option, Td, Tr } from "@probo/ui"; +import { useCallback } from "react"; +import { useFragment } from "react-relay"; +import { graphql } from "relay-runtime"; + +import type { CompliancePageFileListItem_compliancePageFragment$key } from "#/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql"; +import type { CompliancePageFileListItem_fileFragment$data, CompliancePageFileListItem_fileFragment$key } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql"; +import type { CompliancePageFileListItemMutation } from "#/__generated__/core/CompliancePageFileListItemMutation.graphql"; +import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; + +const compliancePageFragment = graphql` + fragment CompliancePageFileListItem_compliancePageFragment on TrustCenter { + canUpdate: permission(action: "core:trust-center:update") + } +`; + +const fileFragment = graphql` + fragment CompliancePageFileListItem_fileFragment on TrustCenterFile { + id + name + category + fileUrl + trustCenterVisibility + createdAt + canUpdate: permission(action: "core:trust-center-file:update") + canDelete: permission(action: "core:trust-center-file:delete") + } +`; + +const updateCompliancePageFileMutation = graphql` + mutation CompliancePageFileListItemMutation($input: UpdateTrustCenterFileInput!) { + updateTrustCenterFile(input: $input) { + trustCenterFile { + ...CompliancePageFileListItem_fileFragment + } + } + } +`; + +export function CompliancePageFileListItem(props: { + compliancePageFragmentRef: CompliancePageFileListItem_compliancePageFragment$key; + fileFragmentRef: CompliancePageFileListItem_fileFragment$key; + onEdit: (file: CompliancePageFileListItem_fileFragment$data) => void; + onDelete: (id: string) => void; +}) { + const { compliancePageFragmentRef, fileFragmentRef, onEdit, onDelete } = props; + + const { __ } = useTranslate(); + const visibilityOptions = getTrustCenterVisibilityOptions(__); + + const compliancePage = useFragment( + compliancePageFragment, + compliancePageFragmentRef, + ); + const file = useFragment(fileFragment, fileFragmentRef); + + const [updateFile, isUpdating] = useMutationWithToasts( + updateCompliancePageFileMutation, + { + successMessage: "File updated successfully", + errorMessage: "Failed to update file", + }, + ); + + const handleValueChange = useCallback( + async (value: string) => { + const stringValue = typeof value === "string" ? value : ""; + const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC"; + await updateFile({ + variables: { + input: { + id: file.id, + trustCenterVisibility: typedValue, + }, + }, + }); + }, + [file.id, updateFile], + ); + + return ( + + +
{file.name}
+ + {file.category} + {formatDate(file.createdAt)} + + void handleValueChange(value)} + disabled={isUpdating || !compliancePage.canUpdate} + className="w-[105px]" + > + {visibilityOptions.map(option => ( + + ))} + + + +
+
+ + + ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/_components/DeleteCompliancePageFileDialog.tsx b/apps/console/src/pages/organizations/compliance-page/files/_components/DeleteCompliancePageFileDialog.tsx new file mode 100644 index 000000000..d1d52f68b --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/_components/DeleteCompliancePageFileDialog.tsx @@ -0,0 +1,76 @@ +import { useTranslate } from "@probo/i18n"; +import { Button, Dialog, DialogContent, DialogFooter, type DialogRef, Spinner } from "@probo/ui"; +import { useCallback } from "react"; +import { type DataID, graphql } from "relay-runtime"; + +import type { DeleteCompliancePageFileDialogMutation } from "#/__generated__/core/DeleteCompliancePageFileDialogMutation.graphql"; +import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; + +const deleteCompliancePageFileMutation = graphql` + mutation DeleteCompliancePageFileDialogMutation( + $input: DeleteTrustCenterFileInput! + $connections: [ID!]! + ) { + deleteTrustCenterFile(input: $input) { + deletedTrustCenterFileId @deleteEdge(connections: $connections) + } + } +`; + +export function DeleteCompliancePageFileDialog(props: { + connectionId: DataID; + fileId: string | null; + ref: DialogRef; + onDelete: () => void; +}) { + const { connectionId, fileId, ref, onDelete } = props; + + const { __ } = useTranslate(); + + const [deleteFile, isDeleting] = useMutationWithToasts( + deleteCompliancePageFileMutation, + { + successMessage: "File deleted successfully", + errorMessage: "Failed to delete file", + }, + ); + + const handleDelete = useCallback(async () => { + if (!fileId) { + return; + } + + await deleteFile({ + variables: { + input: { id: fileId }, + connections: connectionId ? [connectionId] : [], + }, + onSuccess: () => { + ref.current?.close(); + onDelete(); + }, + }); + }, [fileId, deleteFile, ref, connectionId, onDelete]); + + return ( + + +

+ {__( + "Are you sure you want to delete this file? This action cannot be undone.", + )} +

+
+ + + +
+ ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/_components/EditCompliancePageFileDialog.tsx b/apps/console/src/pages/organizations/compliance-page/files/_components/EditCompliancePageFileDialog.tsx new file mode 100644 index 000000000..3e7de24fa --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/_components/EditCompliancePageFileDialog.tsx @@ -0,0 +1,86 @@ +import { useTranslate } from "@probo/i18n"; +import { Button, Dialog, DialogContent, DialogFooter, Field, Spinner } from "@probo/ui"; +import { graphql } from "relay-runtime"; +import { z } from "zod"; + +import type { CompliancePageFileListItem_fileFragment$data } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql"; +import type { EditCompliancePageFileDialogMutation } from "#/__generated__/core/EditCompliancePageFileDialogMutation.graphql"; +import { useFormWithSchema } from "#/hooks/useFormWithSchema"; +import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; + +const updateCompliancePageFileMutation = graphql` + mutation EditCompliancePageFileDialogMutation($input: UpdateTrustCenterFileInput!) { + updateTrustCenterFile(input: $input) { + trustCenterFile { + ...CompliancePageFileListItem_fileFragment + } + } + } +`; + +export function EditCompliancePageFileDialog(props: { + file: CompliancePageFileListItem_fileFragment$data; + onClose: () => void; +}) { + const { file, onClose } = props; + + const { __ } = useTranslate(); + + const editSchema = z.object({ + name: z.string().min(1, __("Name is required")), + category: z.string().min(1, __("Category is required")), + }); + const editForm = useFormWithSchema(editSchema, { + defaultValues: { name: file.name, category: file.category }, + }); + + const [updateFile, isUpdating] = useMutationWithToasts( + updateCompliancePageFileMutation, + { + successMessage: "File updated successfully", + errorMessage: "Failed to update file", + }, + ); + + const handleUpdate = async (data: z.infer) => { + await updateFile({ + variables: { + input: { + id: file.id, + name: data.name, + category: data.category, + }, + }, + onSuccess: () => { + onClose(); + }, + }); + }; + + return ( + +
void editForm.handleSubmit(handleUpdate)(e)}> + + + + + + + +
+
+ ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/files/_components/NewCompliancePageFileDialog.tsx b/apps/console/src/pages/organizations/compliance-page/files/_components/NewCompliancePageFileDialog.tsx new file mode 100644 index 000000000..1e40d02af --- /dev/null +++ b/apps/console/src/pages/organizations/compliance-page/files/_components/NewCompliancePageFileDialog.tsx @@ -0,0 +1,206 @@ +import { getTrustCenterVisibilityOptions } from "@probo/helpers"; +import { useTranslate } from "@probo/i18n"; +import { Badge, Button, Dialog, DialogContent, DialogFooter, type DialogRef, Dropzone, Field, Option, Spinner } from "@probo/ui"; +import { useCallback, useState } from "react"; +import { type DataID, graphql } from "relay-runtime"; +import { z } from "zod"; + +import type { NewCompliancePageFileDialog_createMutation } from "#/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql"; +import { useFormWithSchema } from "#/hooks/useFormWithSchema"; +import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; +import { useOrganizationId } from "#/hooks/useOrganizationId"; + +const acceptedFileTypes = { + "application/csv": [".csv"], + "application/json": [".json"], + "application/msword": [".doc"], + "application/pdf": [".pdf"], + "application/vnd.ms-excel": [".xls"], + "application/vnd.ms-powerpoint": [".ppt"], + "application/vnd.oasis.opendocument.presentation": [".odp"], + "application/vnd.oasis.opendocument.spreadsheet": [".ods"], + "application/vnd.oasis.opendocument.text": [".odt"], + "application/vnd.openxmlformats-officedocument.presentationml.presentation": [ + ".pptx", + ], + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [ + ".xlsx", + ], + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [ + ".docx", + ], + "application/yaml": [".yaml", ".yml"], + "image/gif": [".gif"], + "image/jpeg": [".jpeg", ".jpg"], + "image/png": [".png"], + "image/svg+xml": [".svg"], + "image/webp": [".webp"], + "text/csv": [".csv"], + "text/json": [".json"], + "text/markdown": [".md"], + "text/plain": [".txt"], + "text/uri-list; charset=utf-8": [".uri"], + "text/uri-list": [".uri"], + "text/x-log": [".log"], + "text/yaml": [".yaml", ".yml"], +}; + +const createCompliancePageFileMutation = graphql` + mutation NewCompliancePageFileDialog_createMutation( + $input: CreateTrustCenterFileInput! + $connections: [ID!]! + ) { + createTrustCenterFile(input: $input) { + trustCenterFileEdge @prependEdge(connections: $connections) { + node { + ...CompliancePageFileListItem_fileFragment + } + } + } + } +`; + +export function NewCompliancePageFileDialog(props: { + connectionId: DataID; + ref: DialogRef; +}) { + const { connectionId, ref } = props; + + const organizationId = useOrganizationId(); + const { __ } = useTranslate(); + + const [uploadedFile, setUploadedFile] = useState(null); + + const createSchema = z.object({ + name: z.string().min(1, __("Name is required")), + category: z.string().min(1, __("Category is required")), + trustCenterVisibility: z.enum(["NONE", "PRIVATE", "PUBLIC"]), + }); + const createForm = useFormWithSchema(createSchema, { + defaultValues: { name: "", category: "", trustCenterVisibility: "NONE" }, + }); + + const handleFileUpload = useCallback( + (acceptedFiles: File[]) => { + if (acceptedFiles.length > 0) { + const file = acceptedFiles[0]; + + if (!Object.keys(acceptedFileTypes).includes(file.type)) { + createForm.setError("root", { + type: "manual", + message: __("File type is not allowed"), + }); + return; + } + + setUploadedFile(file); + createForm.clearErrors("root"); + if (!createForm.getValues().name) { + createForm.setValue("name", file.name.replace(/\.[^/.]+$/, "")); + } + } + }, + [createForm, __], + ); + + const [createFile, isCreating] = useMutationWithToasts( + createCompliancePageFileMutation, { + successMessage: "File uploaded successfully", + errorMessage: "Failed to upload file", + }, + ); + const handleCreate = async (data: z.infer) => { + if (!uploadedFile) { + return; + } + + await createFile({ + variables: { + input: { + organizationId, + name: data.name, + category: data.category, + trustCenterVisibility: data.trustCenterVisibility, + file: null, + }, + connections: connectionId ? [connectionId] : [], + }, + uploadables: { + "input.file": uploadedFile, + }, + onSuccess: () => { + ref.current?.close(); + createForm.reset(); + setUploadedFile(null); + }, + }); + }; + + return ( + +
void createForm.handleSubmit(handleCreate)(e)}> + + + {uploadedFile && ( +
+ {__("Selected file")} + : + {uploadedFile.name} +
+ )} + {createForm.formState.errors.root && ( +

+ {createForm.formState.errors.root.message} +

+ )} + + + + createForm.setValue( + "trustCenterVisibility", + value as "NONE" | "PRIVATE" | "PUBLIC", + )} + error={createForm.formState.errors.trustCenterVisibility?.message} + > + {getTrustCenterVisibilityOptions(__).map(option => ( + + ))} + +
+ + + +
+
+ ); +} diff --git a/apps/console/src/pages/organizations/compliance-page/routes.ts b/apps/console/src/pages/organizations/compliance-page/routes.ts index bf937ffb4..549bb176b 100644 --- a/apps/console/src/pages/organizations/compliance-page/routes.ts +++ b/apps/console/src/pages/organizations/compliance-page/routes.ts @@ -29,6 +29,11 @@ export const compliancePageRoutes = [ Fallback: LinkCardSkeleton, Component: lazy(() => import("#/pages/organizations/compliance-page/documents/CompliancePageDocumentsPageLoader")), }, + { + path: "files", + Fallback: LinkCardSkeleton, + Component: lazy(() => import("#/pages/organizations/compliance-page/files/CompliancePageFilesPageLoader")), + }, ], }, ]; diff --git a/apps/console/src/pages/organizations/trustCenter/TrustCenterFilesTab.tsx b/apps/console/src/pages/organizations/trustCenter/TrustCenterFilesTab.tsx deleted file mode 100644 index b5e514c18..000000000 --- a/apps/console/src/pages/organizations/trustCenter/TrustCenterFilesTab.tsx +++ /dev/null @@ -1,384 +0,0 @@ -import { getTrustCenterVisibilityOptions } from "@probo/helpers"; -import { useTranslate } from "@probo/i18n"; -import { - Badge, - Button, - Dialog, - DialogContent, - DialogFooter, - Dropzone, - Field, - IconPlusLarge, - Option, - Spinner, - useDialogRef, -} from "@probo/ui"; -import { useCallback, useState } from "react"; -import { useOutletContext } from "react-router"; -import { z } from "zod"; - -import type { TrustCenterGraphQuery$data } from "#/__generated__/core/TrustCenterGraphQuery.graphql"; -import { TrustCenterFilesCard } from "#/components/trustCenter/TrustCenterFilesCard"; -import { - useCreateTrustCenterFileMutation, - useDeleteTrustCenterFileMutation, - useUpdateTrustCenterFileMutation, -} from "#/hooks/graph/TrustCenterFileGraph"; -import { useFormWithSchema } from "#/hooks/useFormWithSchema"; - -const acceptedFileTypes = { - "application/csv": [".csv"], - "application/json": [".json"], - "application/msword": [".doc"], - "application/pdf": [".pdf"], - "application/vnd.ms-excel": [".xls"], - "application/vnd.ms-powerpoint": [".ppt"], - "application/vnd.oasis.opendocument.presentation": [".odp"], - "application/vnd.oasis.opendocument.spreadsheet": [".ods"], - "application/vnd.oasis.opendocument.text": [".odt"], - "application/vnd.openxmlformats-officedocument.presentationml.presentation": [ - ".pptx", - ], - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [ - ".xlsx", - ], - "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [ - ".docx", - ], - "application/yaml": [".yaml", ".yml"], - "image/gif": [".gif"], - "image/jpeg": [".jpeg", ".jpg"], - "image/png": [".png"], - "image/svg+xml": [".svg"], - "image/webp": [".webp"], - "text/csv": [".csv"], - "text/json": [".json"], - "text/markdown": [".md"], - "text/plain": [".txt"], - "text/uri-list; charset=utf-8": [".uri"], - "text/uri-list": [".uri"], - "text/x-log": [".log"], - "text/yaml": [".yaml", ".yml"], -}; - -export default function TrustCenterFilesTab() { - const { __ } = useTranslate(); - const { organization } = useOutletContext(); - const createSchema = z.object({ - name: z.string().min(1, __("Name is required")), - category: z.string().min(1, __("Category is required")), - trustCenterVisibility: z.enum(["NONE", "PRIVATE", "PUBLIC"]), - }); - - const editSchema = z.object({ - name: z.string().min(1, __("Name is required")), - category: z.string().min(1, __("Category is required")), - }); - - const [createFile, isCreating] = useCreateTrustCenterFileMutation(); - const [updateFile, isUpdating] = useUpdateTrustCenterFileMutation(); - const [deleteFile, isDeleting] = useDeleteTrustCenterFileMutation(); - - const createDialogRef = useDialogRef(); - const editDialogRef = useDialogRef(); - const deleteDialogRef = useDialogRef(); - - const [editingFile, setEditingFile] = useState<{ - id: string; - name: string; - category: string; - } | null>(null); - const [deletingFileId, setDeletingFileId] = useState(null); - const [uploadedFile, setUploadedFile] = useState(null); - const [isUploading, setIsUploading] = useState(false); - - const createForm = useFormWithSchema(createSchema, { - defaultValues: { name: "", category: "", trustCenterVisibility: "NONE" }, - }); - - const editForm = useFormWithSchema(editSchema, { - defaultValues: { name: "", category: "" }, - }); - - const files - = organization.trustCenterFiles?.edges?.map(edge => edge.node) || []; - - const handleFileUpload = useCallback( - (acceptedFiles: File[]) => { - if (acceptedFiles.length > 0) { - const file = acceptedFiles[0]; - - if (!Object.keys(acceptedFileTypes).includes(file.type)) { - createForm.setError("root", { - type: "manual", - message: __("File type is not allowed"), - }); - return; - } - - setUploadedFile(file); - createForm.clearErrors("root"); - if (!createForm.getValues().name) { - createForm.setValue("name", file.name.replace(/\.[^/.]+$/, "")); - } - } - }, - [createForm, __], - ); - - const handleCreate = createForm.handleSubmit(async (data) => { - if (!uploadedFile) { - return; - } - - setIsUploading(true); - - const connectionId = organization.trustCenterFiles?.__id; - - try { - await createFile({ - variables: { - input: { - organizationId: organization.id, - name: data.name, - category: data.category, - trustCenterVisibility: data.trustCenterVisibility, - file: null, - }, - connections: connectionId ? [connectionId] : [], - }, - uploadables: { - "input.file": uploadedFile, - }, - onSuccess: () => { - createDialogRef.current?.close(); - createForm.reset(); - setUploadedFile(null); - }, - }); - } finally { - setIsUploading(false); - } - }); - - const handleEdit = useCallback( - (file: { id: string; name: string; category: string }) => { - setEditingFile(file); - editForm.reset({ name: file.name, category: file.category }); - editDialogRef.current?.open(); - }, - [editDialogRef, editForm], - ); - - const handleUpdate = editForm.handleSubmit(async (data) => { - if (!editingFile) { - return; - } - - await updateFile({ - variables: { - input: { - id: editingFile.id, - name: data.name, - category: data.category, - }, - }, - onSuccess: () => { - editDialogRef.current?.close(); - setEditingFile(null); - }, - }); - }); - - const handleDeleteClick = useCallback( - (id: string) => { - setDeletingFileId(id); - deleteDialogRef.current?.open(); - }, - [deleteDialogRef], - ); - - const handleDeleteConfirm = useCallback(async () => { - if (!deletingFileId) { - return; - } - - const connectionId = organization.trustCenterFiles?.__id; - - await deleteFile({ - variables: { - input: { id: deletingFileId }, - connections: connectionId ? [connectionId] : [], - }, - onSuccess: () => { - deleteDialogRef.current?.close(); - setDeletingFileId(null); - }, - }); - }, [ - deletingFileId, - deleteFile, - deleteDialogRef, - organization.trustCenterFiles?.__id, - ]); - - const handleChangeVisibility = useCallback( - async (params: { - variables: { - input: { - id: string; - trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC"; - }; - }; - }) => { - await updateFile(params); - }, - [updateFile], - ); - - return ( -
-
-
-

{__("Files")}

-

- {__("Upload and manage files for your trust center")} -

-
- {organization.canCreateTrustCenterFile && ( - - )} -
- {(isUpdating || isDeleting) && ( -
- -
- )} - - - -
void handleCreate(e)}> - - - {uploadedFile && ( -
- {__("Selected file")} - : - {uploadedFile.name} -
- )} - {createForm.formState.errors.root && ( -

- {createForm.formState.errors.root.message} -

- )} - - - - createForm.setValue( - "trustCenterVisibility", - value as "NONE" | "PRIVATE" | "PUBLIC", - )} - error={createForm.formState.errors.trustCenterVisibility?.message} - > - {getTrustCenterVisibilityOptions(__).map(option => ( - - ))} - -
- - - -
-
- - -
void handleUpdate(e)}> - - - - - - - -
-
- - - -

- {__( - "Are you sure you want to delete this file? This action cannot be undone.", - )} -

-
- - - -
-
- ); -} diff --git a/apps/console/src/routes/trustCenterRoutes.ts b/apps/console/src/routes/trustCenterRoutes.ts index e7e242adb..2af962a13 100644 --- a/apps/console/src/routes/trustCenterRoutes.ts +++ b/apps/console/src/routes/trustCenterRoutes.ts @@ -29,13 +29,6 @@ export const trustCenterRoutes = [ lazy(() => import("#/pages/organizations/trustCenter/TrustCenterPage")), ), children: [ - { - path: "files", - Fallback: LinkCardSkeleton, - Component: lazy( - () => import("#/pages/organizations/trustCenter/TrustCenterFilesTab"), - ), - }, { path: "vendors", Fallback: LinkCardSkeleton,