Rename policy into document

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Jonathan
2025-06-01 21:57:47 +02:00
committed by Sacha Al Himdani
parent 1870e050ce
commit b6aec0b14a
43 changed files with 636 additions and 631 deletions

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<6a680118da31fa610f9638d27a9b48d1>> * @generated SignedSource<<95aa70195a3e90acb366441fd037c2f2>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,9 +10,11 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type VendorCategory = "ANALYTICS" | "CLOUD_MONITORING" | "CLOUD_PROVIDER" | "COLLABORATION" | "CUSTOMER_SUPPORT" | "DATA_STORAGE_AND_PROCESSING" | "DOCUMENT_MANAGEMENT" | "EMPLOYEE_MANAGEMENT" | "ENGINEERING" | "FINANCE" | "IDENTITY_PROVIDER" | "IT" | "MARKETING" | "OFFICE_OPERATIONS" | "OTHER" | "PASSWORD_MANAGEMENT" | "PRODUCT_AND_DESIGN" | "PROFESSIONAL_SERVICES" | "RECRUITING" | "SALES" | "SECURITY" | "VERSION_CONTROL";
export type UpdateVendorInput = { export type UpdateVendorInput = {
businessAssociateAgreementUrl?: string | null | undefined;
businessOwnerId?: string | null | undefined; businessOwnerId?: string | null | undefined;
category?: string | null | undefined; category?: VendorCategory | null | undefined;
certifications?: ReadonlyArray<string> | null | undefined; certifications?: ReadonlyArray<string> | null | undefined;
dataProcessingAgreementUrl?: string | null | undefined; dataProcessingAgreementUrl?: string | null | undefined;
description?: string | null | undefined; description?: string | null | undefined;
@@ -25,6 +27,7 @@ export type UpdateVendorInput = {
securityPageUrl?: string | null | undefined; securityPageUrl?: string | null | undefined;
serviceLevelAgreementUrl?: string | null | undefined; serviceLevelAgreementUrl?: string | null | undefined;
statusPageUrl?: string | null | undefined; statusPageUrl?: string | null | undefined;
subprocessorsListUrl?: string | null | undefined;
termsOfServiceUrl?: string | null | undefined; termsOfServiceUrl?: string | null | undefined;
trustPageUrl?: string | null | undefined; trustPageUrl?: string | null | undefined;
websiteUrl?: string | null | undefined; websiteUrl?: string | null | undefined;

View File

@@ -1,12 +1,12 @@
import { z } from "zod"; import { z } from "zod";
import { useFormWithSchema } from "../useFormWithSchema"; import { useFormWithSchema } from "../useFormWithSchema";
export const policySchema = z.object({ export const documentSchema = z.object({
title: z.string(), title: z.string(),
content: z.string(), content: z.string(),
ownerId: z.string(), ownerId: z.string(),
}); });
export const usePolicyForm = () => { export const useDocumentForm = () => {
return useFormWithSchema(policySchema, {}); return useFormWithSchema(documentSchema, {});
}; };

View File

@@ -0,0 +1,48 @@
import { useTranslate } from "@probo/i18n";
import { graphql } from "relay-runtime";
import { useMutationWithToasts } from "../useMutationWithToasts";
import type { DocumentGraphDeleteMutation } from "./__generated__/DocumentGraphDeleteMutation.graphql";
export const documentsQuery = graphql`
query DocumentGraphListQuery($organizationId: ID!) {
organization: node(id: $organizationId) {
id
...DocumentsPageListFragment
}
}
`;
export const DocumentsConnectionKey = "DocumentsPageFragment_documents";
const deleteDocumentMutation = graphql`
mutation DocumentGraphDeleteMutation(
$input: DeleteDocumentInput!
$connections: [ID!]!
) {
deleteDocument(input: $input) {
deletedDocumentId @deleteEdge(connections: $connections)
}
}
`;
export function useDeleteDocumentMutation() {
const { __ } = useTranslate();
return useMutationWithToasts<DocumentGraphDeleteMutation>(
deleteDocumentMutation,
{
successMessage: __("Document deleted successfully."),
errorMessage: __("Failed to delete document. Please try again."),
}
);
}
export const documentNodeQuery = graphql`
query DocumentGraphNodeQuery($documentId: ID!) {
node(id: $documentId) {
... on Document {
...DocumentPageDocumentFragment
}
}
}
`;

View File

@@ -40,13 +40,10 @@ export const useDeleteFrameworkMutation = (
framework: { id: string; name: string }, framework: { id: string; name: string },
connectionId: string connectionId: string
) => { ) => {
const [commitDelete, isDeleting] = useMutationWithToasts( const [commitDelete] = useMutationWithToasts(deleteFrameworkMutation, {
deleteFrameworkMutation, errorMessage: "Failed to delete framework",
{ successMessage: "Framework deleted successfully",
errorMessage: "Failed to delete framework", });
successMessage: "Framework deleted successfully",
}
);
const confirm = useConfirm(); const confirm = useConfirm();
const { __ } = useTranslate(); const { __ } = useTranslate();

View File

@@ -1,48 +0,0 @@
import { useTranslate } from "@probo/i18n";
import { graphql } from "relay-runtime";
import { useMutationWithToasts } from "../useMutationWithToasts";
import type { PolicyGraphDeleteMutation } from "./__generated__/PolicyGraphDeleteMutation.graphql";
export const policiesQuery = graphql`
query PolicyGraphListQuery($organizationId: ID!) {
organization: node(id: $organizationId) {
id
...PoliciesPageListFragment
}
}
`;
export const PoliciesConnectionKey = "PoliciesPageFragment_policies";
const deletePolicyMutation = graphql`
mutation PolicyGraphDeleteMutation(
$input: DeletePolicyInput!
$connections: [ID!]!
) {
deletePolicy(input: $input) {
deletedPolicyId @deleteEdge(connections: $connections)
}
}
`;
export function useDeletePolicyMutation() {
const { __ } = useTranslate();
return useMutationWithToasts<PolicyGraphDeleteMutation>(
deletePolicyMutation,
{
successMessage: __("Policy deleted successfully."),
errorMessage: __("Failed to delete policy. Please try again."),
}
);
}
export const policyNodeQuery = graphql`
query PolicyGraphNodeQuery($policyId: ID!) {
node(id: $policyId) {
... on Policy {
...PolicyPagePolicyFragment
}
}
}
`;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<baab5b247999631abac20d0f5ab13925>> * @generated SignedSource<<64c2c92a2a0806f34243f8fc9904167c>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,21 +9,21 @@
// @ts-nocheck // @ts-nocheck
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type DeletePolicyInput = { export type DeleteDocumentInput = {
policyId: string; documentId: string;
}; };
export type PolicyGraphDeleteMutation$variables = { export type DocumentGraphDeleteMutation$variables = {
connections: ReadonlyArray<string>; connections: ReadonlyArray<string>;
input: DeletePolicyInput; input: DeleteDocumentInput;
}; };
export type PolicyGraphDeleteMutation$data = { export type DocumentGraphDeleteMutation$data = {
readonly deletePolicy: { readonly deleteDocument: {
readonly deletedPolicyId: string; readonly deletedDocumentId: string;
}; };
}; };
export type PolicyGraphDeleteMutation = { export type DocumentGraphDeleteMutation = {
response: PolicyGraphDeleteMutation$data; response: DocumentGraphDeleteMutation$data;
variables: PolicyGraphDeleteMutation$variables; variables: DocumentGraphDeleteMutation$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -48,7 +48,7 @@ v3 = {
"alias": null, "alias": null,
"args": null, "args": null,
"kind": "ScalarField", "kind": "ScalarField",
"name": "deletedPolicyId", "name": "deletedDocumentId",
"storageKey": null "storageKey": null
}; };
return { return {
@@ -59,14 +59,14 @@ return {
], ],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicyGraphDeleteMutation", "name": "DocumentGraphDeleteMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "DeletePolicyPayload", "concreteType": "DeleteDocumentPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "deletePolicy", "name": "deleteDocument",
"plural": false, "plural": false,
"selections": [ "selections": [
(v3/*: any*/) (v3/*: any*/)
@@ -84,14 +84,14 @@ return {
(v0/*: any*/) (v0/*: any*/)
], ],
"kind": "Operation", "kind": "Operation",
"name": "PolicyGraphDeleteMutation", "name": "DocumentGraphDeleteMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "DeletePolicyPayload", "concreteType": "DeleteDocumentPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "deletePolicy", "name": "deleteDocument",
"plural": false, "plural": false,
"selections": [ "selections": [
(v3/*: any*/), (v3/*: any*/),
@@ -102,7 +102,7 @@ return {
"handle": "deleteEdge", "handle": "deleteEdge",
"key": "", "key": "",
"kind": "ScalarHandle", "kind": "ScalarHandle",
"name": "deletedPolicyId", "name": "deletedDocumentId",
"handleArgs": [ "handleArgs": [
{ {
"kind": "Variable", "kind": "Variable",
@@ -117,16 +117,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "d635ed7113bd8ad32056f5b4fbb95b22", "cacheID": "84c747138470346796393f93a85b7127",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PolicyGraphDeleteMutation", "name": "DocumentGraphDeleteMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation PolicyGraphDeleteMutation(\n $input: DeletePolicyInput!\n) {\n deletePolicy(input: $input) {\n deletedPolicyId\n }\n}\n" "text": "mutation DocumentGraphDeleteMutation(\n $input: DeleteDocumentInput!\n) {\n deleteDocument(input: $input) {\n deletedDocumentId\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "f5178185f41864d20506abc44b37fa67"; (node as any).hash = "355f3a70caecabb2146075657665633e";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<b9027c9c44291af1bebb38760fd96fc8>> * @generated SignedSource<<db2f3c23a3ecbb61ac692a46e93da44a>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,18 +10,18 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicyGraphListQuery$variables = { export type DocumentGraphListQuery$variables = {
organizationId: string; organizationId: string;
}; };
export type PolicyGraphListQuery$data = { export type DocumentGraphListQuery$data = {
readonly organization: { readonly organization: {
readonly id: string; readonly id: string;
readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageListFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageListFragment">;
}; };
}; };
export type PolicyGraphListQuery = { export type DocumentGraphListQuery = {
response: PolicyGraphListQuery$data; response: DocumentGraphListQuery$data;
variables: PolicyGraphListQuery$variables; variables: DocumentGraphListQuery$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -65,7 +65,7 @@ return {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicyGraphListQuery", "name": "DocumentGraphListQuery",
"selections": [ "selections": [
{ {
"alias": "organization", "alias": "organization",
@@ -79,7 +79,7 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PoliciesPageListFragment" "name": "DocumentsPageListFragment"
} }
], ],
"storageKey": null "storageKey": null
@@ -92,7 +92,7 @@ return {
"operation": { "operation": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Operation", "kind": "Operation",
"name": "PolicyGraphListQuery", "name": "DocumentGraphListQuery",
"selections": [ "selections": [
{ {
"alias": "organization", "alias": "organization",
@@ -110,15 +110,15 @@ return {
{ {
"alias": null, "alias": null,
"args": (v4/*: any*/), "args": (v4/*: any*/),
"concreteType": "PolicyConnection", "concreteType": "DocumentConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policies", "name": "documents",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyEdge", "concreteType": "DocumentEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -126,7 +126,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "Policy", "concreteType": "Document",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -181,7 +181,7 @@ return {
"value": 1 "value": 1
} }
], ],
"concreteType": "PolicyVersionConnection", "concreteType": "DocumentVersionConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "versions", "name": "versions",
"plural": false, "plural": false,
@@ -189,7 +189,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -197,7 +197,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -213,7 +213,7 @@ return {
{ {
"alias": null, "alias": null,
"args": (v4/*: any*/), "args": (v4/*: any*/),
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
@@ -221,7 +221,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -229,7 +229,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -312,16 +312,16 @@ return {
] ]
} }
], ],
"storageKey": "policies(first:100)" "storageKey": "documents(first:100)"
}, },
{ {
"alias": null, "alias": null,
"args": (v4/*: any*/), "args": (v4/*: any*/),
"filters": null, "filters": null,
"handle": "connection", "handle": "connection",
"key": "PoliciesPageFragment_policies", "key": "DocumentsPageFragment_documents",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "policies" "name": "documents"
} }
], ],
"type": "Organization", "type": "Organization",
@@ -333,16 +333,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "b0b3546b418ff2cfd5dd7678d3b0be14", "cacheID": "d567583accd89d49f0c40fe1bac5ed84",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PolicyGraphListQuery", "name": "DocumentGraphListQuery",
"operationKind": "query", "operationKind": "query",
"text": "query PolicyGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ...PoliciesPageListFragment\n }\n}\n\nfragment PoliciesPageListFragment on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n ...PoliciesPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PoliciesPageRowFragment on Policy {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n" "text": "query DocumentGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ...DocumentsPageListFragment\n }\n}\n\nfragment DocumentsPageListFragment on Organization {\n documents(first: 100) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "29761736de791476004e17ad21659a59"; (node as any).hash = "63de39eb2c87fc45b83eeee047ddd36c";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<b7defae939287f936c1eb687fe2d9bfe>> * @generated SignedSource<<2cb115c83f67688124df197a8f944329>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,17 +10,17 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicyGraphNodeQuery$variables = { export type DocumentGraphNodeQuery$variables = {
policyId: string; documentId: string;
}; };
export type PolicyGraphNodeQuery$data = { export type DocumentGraphNodeQuery$data = {
readonly node: { readonly node: {
readonly " $fragmentSpreads": FragmentRefs<"PolicyPagePolicyFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentPageDocumentFragment">;
}; };
}; };
export type PolicyGraphNodeQuery = { export type DocumentGraphNodeQuery = {
response: PolicyGraphNodeQuery$data; response: DocumentGraphNodeQuery$data;
variables: PolicyGraphNodeQuery$variables; variables: DocumentGraphNodeQuery$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -28,14 +28,14 @@ var v0 = [
{ {
"defaultValue": null, "defaultValue": null,
"kind": "LocalArgument", "kind": "LocalArgument",
"name": "policyId" "name": "documentId"
} }
], ],
v1 = [ v1 = [
{ {
"kind": "Variable", "kind": "Variable",
"name": "id", "name": "id",
"variableName": "policyId" "variableName": "documentId"
} }
], ],
v2 = { v2 = {
@@ -122,7 +122,7 @@ return {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicyGraphNodeQuery", "name": "DocumentGraphNodeQuery",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -138,10 +138,10 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PolicyPagePolicyFragment" "name": "DocumentPageDocumentFragment"
} }
], ],
"type": "Policy", "type": "Document",
"abstractKey": null "abstractKey": null
} }
], ],
@@ -155,7 +155,7 @@ return {
"operation": { "operation": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Operation", "kind": "Operation",
"name": "PolicyGraphNodeQuery", "name": "DocumentGraphNodeQuery",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -193,7 +193,7 @@ return {
{ {
"alias": null, "alias": null,
"args": (v5/*: any*/), "args": (v5/*: any*/),
"concreteType": "PolicyVersionConnection", "concreteType": "DocumentVersionConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "versions", "name": "versions",
"plural": false, "plural": false,
@@ -201,7 +201,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -209,7 +209,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -253,7 +253,7 @@ return {
{ {
"alias": null, "alias": null,
"args": (v6/*: any*/), "args": (v6/*: any*/),
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
@@ -261,7 +261,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -269,7 +269,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -334,7 +334,7 @@ return {
"args": (v6/*: any*/), "args": (v6/*: any*/),
"filters": null, "filters": null,
"handle": "connection", "handle": "connection",
"key": "PolicyPage_signatures", "key": "DocumentPage_signatures",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "signatures" "name": "signatures"
}, },
@@ -376,12 +376,12 @@ return {
"args": (v5/*: any*/), "args": (v5/*: any*/),
"filters": null, "filters": null,
"handle": "connection", "handle": "connection",
"key": "PolicyPage_versions", "key": "DocumentPage_versions",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "versions" "name": "versions"
} }
], ],
"type": "Policy", "type": "Document",
"abstractKey": null "abstractKey": null
} }
], ],
@@ -390,16 +390,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "e9c0e78ebbf62684edbfa11ac1ee5d25", "cacheID": "671e1a9b133593847c68af3abd9a721f",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PolicyGraphNodeQuery", "name": "DocumentGraphNodeQuery",
"operationKind": "query", "operationKind": "query",
"text": "query PolicyGraphNodeQuery(\n $policyId: ID!\n) {\n node(id: $policyId) {\n __typename\n ... on Policy {\n ...PolicyPagePolicyFragment\n }\n id\n }\n}\n\nfragment PolicyPagePolicyFragment on Policy {\n id\n title\n owner {\n id\n fullName\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...PolicySignaturesDialog_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n ...PolicyVersionHistoryDialogFragment\n ...PolicySignaturesDialog_version\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PolicySignaturesDialog_signature on PolicyVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment PolicySignaturesDialog_version on PolicyVersion {\n version\n status\n publishedAt\n updatedAt\n}\n\nfragment PolicyVersionHistoryDialogFragment on PolicyVersion {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n}\n" "text": "query DocumentGraphNodeQuery(\n $documentId: ID!\n) {\n node(id: $documentId) {\n __typename\n ... on Document {\n ...DocumentPageDocumentFragment\n }\n id\n }\n}\n\nfragment DocumentPageDocumentFragment on Document {\n id\n title\n owner {\n id\n fullName\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesDialog_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n ...DocumentVersionHistoryDialogFragment\n ...DocumentSignaturesDialog_version\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentSignaturesDialog_signature on DocumentVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment DocumentSignaturesDialog_version on DocumentVersion {\n version\n status\n publishedAt\n updatedAt\n}\n\nfragment DocumentVersionHistoryDialogFragment on DocumentVersion {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "c06b24e46b33741678e07787ab1c69f3"; (node as any).hash = "d6f55d4636b86d853b97b44e68e435f2";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<bbf8c99c9d2d556129349cfe82d26582>> * @generated SignedSource<<b798b75c1d930af818109fd819d5cef3>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -12,9 +12,12 @@ import { ConcreteRequest } from 'relay-runtime';
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type UpdatePeopleInput = { export type UpdatePeopleInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined; additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
contractEndDate?: any | null | undefined;
contractStartDate?: any | null | undefined;
fullName?: string | null | undefined; fullName?: string | null | undefined;
id: string; id: string;
kind?: PeopleKind | null | undefined; kind?: PeopleKind | null | undefined;
position?: string | null | undefined;
primaryEmailAddress?: string | null | undefined; primaryEmailAddress?: string | null | undefined;
}; };
export type PeopleGraphUpdateMutation$variables = { export type PeopleGraphUpdateMutation$variables = {

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<7c5151b921734cd14b58af145eba7267>> * @generated SignedSource<<6369aba92b58ca2a67d57110a829bde4>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -11,7 +11,7 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type OrderDirection = "ASC" | "DESC"; export type OrderDirection = "ASC" | "DESC";
export type RiskOrderField = "CATEGORY" | "CREATED_AT" | "INITIAL_RISK_SCORE" | "NAME" | "RESIDUAL_RISK_SCORE" | "TREATMENT" | "UPDATED_AT"; export type RiskOrderField = "CATEGORY" | "CREATED_AT" | "INHERENT_RISK_SCORE" | "NAME" | "RESIDUAL_RISK_SCORE" | "TREATMENT" | "UPDATED_AT";
export type RiskOrder = { export type RiskOrder = {
direction: OrderDirection; direction: OrderDirection;
field: RiskOrderField; field: RiskOrderField;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<37dd4db659813ffa6fab65ffec643844>> * @generated SignedSource<<8ef289e99926f279eb0e2d5ea955cb32>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,9 +9,11 @@
// @ts-nocheck // @ts-nocheck
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type VendorCategory = "ANALYTICS" | "CLOUD_MONITORING" | "CLOUD_PROVIDER" | "COLLABORATION" | "CUSTOMER_SUPPORT" | "DATA_STORAGE_AND_PROCESSING" | "DOCUMENT_MANAGEMENT" | "EMPLOYEE_MANAGEMENT" | "ENGINEERING" | "FINANCE" | "IDENTITY_PROVIDER" | "IT" | "MARKETING" | "OFFICE_OPERATIONS" | "OTHER" | "PASSWORD_MANAGEMENT" | "PRODUCT_AND_DESIGN" | "PROFESSIONAL_SERVICES" | "RECRUITING" | "SALES" | "SECURITY" | "VERSION_CONTROL";
export type CreateVendorInput = { export type CreateVendorInput = {
businessAssociateAgreementUrl?: string | null | undefined;
businessOwnerId?: string | null | undefined; businessOwnerId?: string | null | undefined;
category?: string | null | undefined; category?: VendorCategory | null | undefined;
certifications?: ReadonlyArray<string> | null | undefined; certifications?: ReadonlyArray<string> | null | undefined;
dataProcessingAgreementUrl?: string | null | undefined; dataProcessingAgreementUrl?: string | null | undefined;
description?: string | null | undefined; description?: string | null | undefined;
@@ -24,6 +26,7 @@ export type CreateVendorInput = {
securityPageUrl?: string | null | undefined; securityPageUrl?: string | null | undefined;
serviceLevelAgreementUrl?: string | null | undefined; serviceLevelAgreementUrl?: string | null | undefined;
statusPageUrl?: string | null | undefined; statusPageUrl?: string | null | undefined;
subprocessorsListUrl?: string | null | undefined;
termsOfServiceUrl?: string | null | undefined; termsOfServiceUrl?: string | null | undefined;
trustPageUrl?: string | null | undefined; trustPageUrl?: string | null | undefined;
websiteUrl?: string | null | undefined; websiteUrl?: string | null | undefined;

View File

@@ -111,9 +111,9 @@ export function MainLayout() {
to={`${prefix}/vendors`} to={`${prefix}/vendors`}
/> />
<SidebarItem <SidebarItem
label={__("Policies")} label={__("Documents")}
icon={IconPageTextLine} icon={IconPageTextLine}
to={`${prefix}/policies`} to={`${prefix}/documents`}
/> />
<SidebarItem <SidebarItem
label={__("Settings")} label={__("Settings")}

View File

@@ -1,5 +1,5 @@
import type { PreloadedQuery } from "react-relay"; import type { PreloadedQuery } from "react-relay";
import type { PolicyGraphNodeQuery } from "/hooks/graph/__generated__/PolicyGraphNodeQuery.graphql"; import type { DocumentGraphNodeQuery } from "/hooks/graph/__generated__/DocumentGraphNodeQuery.graphql";
import { import {
ConnectionHandler, ConnectionHandler,
graphql, graphql,
@@ -8,12 +8,12 @@ import {
usePreloadedQuery, usePreloadedQuery,
} from "react-relay"; } from "react-relay";
import { import {
PoliciesConnectionKey, DocumentsConnectionKey,
policyNodeQuery, documentNodeQuery,
useDeletePolicyMutation, useDeleteDocumentMutation,
} from "/hooks/graph/PolicyGraph"; } from "/hooks/graph/DocumentGraph";
import { usePageTitle } from "@probo/hooks"; import { usePageTitle } from "@probo/hooks";
import type { PolicyPagePolicyFragment$key } from "./__generated__/PolicyPagePolicyFragment.graphql"; import type { DocumentPageDocumentFragment$key } from "./__generated__/DocumentPageDocumentFragment.graphql";
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { import {
PageHeader, PageHeader,
@@ -39,22 +39,22 @@ import { sprintf } from "@probo/helpers";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import UpdateVersionDialog from "./dialogs/UpdateVersionDialog"; import UpdateVersionDialog from "./dialogs/UpdateVersionDialog";
import { useRef } from "react"; import { useRef } from "react";
import { PolicyVersionHistoryDialog } from "./dialogs/PolicyVersionHistoryDialog"; import { DocumentVersionHistoryDialog } from "./dialogs/DocumentVersionHistoryDialog";
import { PolicySignaturesDialog } from "./dialogs/PolicySignaturesDialog"; import { DocumentSignaturesDialog } from "./dialogs/DocumentSignaturesDialog";
type Props = { type Props = {
queryRef: PreloadedQuery<PolicyGraphNodeQuery>; queryRef: PreloadedQuery<DocumentGraphNodeQuery>;
}; };
const policyFragment = graphql` const documentFragment = graphql`
fragment PolicyPagePolicyFragment on Policy { fragment DocumentPageDocumentFragment on Document {
id id
title title
owner { owner {
id id
fullName fullName
} }
versions(first: 20) @connection(key: "PolicyPage_versions") { versions(first: 20) @connection(key: "DocumentPage_versions") {
__id __id
edges { edges {
node { node {
@@ -64,7 +64,7 @@ const policyFragment = graphql`
publishedAt publishedAt
version version
updatedAt updatedAt
signatures(first: 100) @connection(key: "PolicyPage_signatures") { signatures(first: 100) @connection(key: "DocumentPage_signatures") {
__id __id
edges { edges {
node { node {
@@ -73,61 +73,61 @@ const policyFragment = graphql`
signedBy { signedBy {
id id
} }
...PolicySignaturesDialog_signature ...DocumentSignaturesDialog_signature
} }
} }
} }
...PolicyVersionHistoryDialogFragment ...DocumentVersionHistoryDialogFragment
...PolicySignaturesDialog_version ...DocumentSignaturesDialog_version
} }
} }
} }
} }
`; `;
const publishPolicyVersionMutation = graphql` const publishDocumentVersionMutation = graphql`
mutation PolicyPagePublishMutation($input: PublishPolicyVersionInput!) { mutation DocumentPagePublishMutation($input: PublishDocumentVersionInput!) {
publishPolicyVersion(input: $input) { publishDocumentVersion(input: $input) {
policy { document {
id id
} }
} }
} }
`; `;
export default function PolicyPage(props: Props) { export default function DocumentPage(props: Props) {
const node = usePreloadedQuery(policyNodeQuery, props.queryRef).node; const node = usePreloadedQuery(documentNodeQuery, props.queryRef).node;
const policy = useFragment( const document = useFragment(
policyFragment, documentFragment,
node as PolicyPagePolicyFragment$key node as DocumentPageDocumentFragment$key
); );
const { __, dateFormat } = useTranslate(); const { __, dateFormat } = useTranslate();
const organizationId = useOrganizationId(); const organizationId = useOrganizationId();
const navigate = useNavigate(); const navigate = useNavigate();
const lastVersion = policy.versions.edges[0].node; const lastVersion = document.versions.edges[0].node;
const isDraft = lastVersion.status === "DRAFT"; const isDraft = lastVersion.status === "DRAFT";
const [publishPolicyVersion, isPublishing] = useMutationWithToasts( const [publishDocumentVersion, isPublishing] = useMutationWithToasts(
publishPolicyVersionMutation, publishDocumentVersionMutation,
{ {
successMessage: __("Policy published successfully."), successMessage: __("Document published successfully."),
errorMessage: __("Failed to publish policy. Please try again."), errorMessage: __("Failed to publish document. Please try again."),
} }
); );
const [deletePolicy, isDeleting] = useDeletePolicyMutation(); const [deleteDocument, isDeleting] = useDeleteDocumentMutation();
const versionConnectionId = policy.versions.__id; const versionConnectionId = document.versions.__id;
usePageTitle(policy.title); usePageTitle(document.title);
const handlePublish = () => { const handlePublish = () => {
publishPolicyVersion({ publishDocumentVersion({
variables: { variables: {
input: { policyId: policy.id }, input: { documentId: document.id },
}, },
onSuccess: () => { onSuccess: () => {
// Refresh the whole query to get the new version // Refresh the whole query to get the new version
loadQuery( loadQuery(
props.queryRef.environment, props.queryRef.environment,
policyNodeQuery, documentNodeQuery,
props.queryRef.variables, props.queryRef.variables,
{ fetchPolicy: "network-only" } { fetchPolicy: "network-only" }
); );
@@ -143,15 +143,15 @@ export default function PolicyPage(props: Props) {
new Promise<void>((resolve) => { new Promise<void>((resolve) => {
const connectionId = ConnectionHandler.getConnectionID( const connectionId = ConnectionHandler.getConnectionID(
organizationId, organizationId,
PoliciesConnectionKey DocumentsConnectionKey
); );
deletePolicy({ deleteDocument({
variables: { variables: {
input: { policyId: policy.id }, input: { documentId: document.id },
connections: [connectionId], connections: [connectionId],
}, },
onSuccess() { onSuccess() {
navigate(`/organizations/${organizationId}/policies`); navigate(`/organizations/${organizationId}/documents`);
}, },
onError: () => resolve(), onError: () => resolve(),
}); });
@@ -159,9 +159,9 @@ export default function PolicyPage(props: Props) {
{ {
message: sprintf( message: sprintf(
__( __(
'This will permanently delete the policy "%s". This action cannot be undone.' 'This will permanently delete the document "%s". This action cannot be undone.'
), ),
policy.title document.title
), ),
} }
); );
@@ -173,7 +173,7 @@ export default function PolicyPage(props: Props) {
<> <>
<UpdateVersionDialog <UpdateVersionDialog
ref={updateDialogRef} ref={updateDialogRef}
policy={policy} document={document}
connectionId={versionConnectionId} connectionId={versionConnectionId}
/> />
<div className="space-y-6"> <div className="space-y-6">
@@ -181,11 +181,11 @@ export default function PolicyPage(props: Props) {
<Breadcrumb <Breadcrumb
items={[ items={[
{ {
label: __("Policies"), label: __("Documents"),
to: `/organizations/${organizationId}/policies`, to: `/organizations/${organizationId}/documents`,
}, },
{ {
label: policy.title, label: document.title,
}, },
]} ]}
/> />
@@ -199,23 +199,23 @@ export default function PolicyPage(props: Props) {
{__("Publish")} {__("Publish")}
</Button> </Button>
)} )}
<PolicyVersionHistoryDialog policy={policy}> <DocumentVersionHistoryDialog document={document}>
<Button icon={IconClock} variant="secondary"> <Button icon={IconClock} variant="secondary">
{__("Version history")} {__("Version history")}
</Button> </Button>
</PolicyVersionHistoryDialog> </DocumentVersionHistoryDialog>
<PolicySignaturesDialog policy={policy}> <DocumentSignaturesDialog document={document}>
<Button icon={IconSignature} variant="secondary"> <Button icon={IconSignature} variant="secondary">
{__("Signatures history")} {__("Signatures history")}
</Button> </Button>
</PolicySignaturesDialog> </DocumentSignaturesDialog>
<ActionDropdown variant="secondary"> <ActionDropdown variant="secondary">
<DropdownItem <DropdownItem
onClick={() => updateDialogRef.current?.open()} onClick={() => updateDialogRef.current?.open()}
icon={IconPencil} icon={IconPencil}
> >
{isDraft ? __("Edit draft policy") : __("Create new draft")} {isDraft ? __("Edit draft document") : __("Create new draft")}
</DropdownItem> </DropdownItem>
<DropdownItem <DropdownItem
variant="danger" variant="danger"
@@ -228,7 +228,7 @@ export default function PolicyPage(props: Props) {
</ActionDropdown> </ActionDropdown>
</div> </div>
</div> </div>
<PageHeader title={policy.title} /> <PageHeader title={document.title} />
<Markdown content={lastVersion.content} /> <Markdown content={lastVersion.content} />
</div> </div>
<Drawer> <Drawer>
@@ -237,8 +237,8 @@ export default function PolicyPage(props: Props) {
</div> </div>
<PropertyRow label={__("Owner")}> <PropertyRow label={__("Owner")}>
<Badge variant="highlight" size="md" className="gap-2"> <Badge variant="highlight" size="md" className="gap-2">
<Avatar name={policy.owner?.fullName ?? ""} /> <Avatar name={document.owner?.fullName ?? ""} />
{policy.owner?.fullName} {document.owner?.fullName}
</Badge> </Badge>
</PropertyRow> </PropertyRow>
<PropertyRow label={__("Status")}> <PropertyRow label={__("Status")}>

View File

@@ -22,25 +22,25 @@ import {
type PreloadedQuery, type PreloadedQuery,
} from "react-relay"; } from "react-relay";
import { graphql } from "relay-runtime"; import { graphql } from "relay-runtime";
import type { PolicyGraphListQuery } from "/hooks/graph/__generated__/PolicyGraphListQuery.graphql"; import type { DocumentGraphListQuery } from "/hooks/graph/__generated__/DocumentGraphListQuery.graphql";
import { import {
policiesQuery, documentsQuery,
useDeletePolicyMutation, useDeleteDocumentMutation,
} from "/hooks/graph/PolicyGraph"; } from "/hooks/graph/DocumentGraph";
import type { PoliciesPageListFragment$key } from "./__generated__/PoliciesPageListFragment.graphql"; import type { DocumentsPageListFragment$key } from "./__generated__/DocumentsPageListFragment.graphql";
import { usePageTitle } from "@probo/hooks"; import { usePageTitle } from "@probo/hooks";
import { sprintf } from "@probo/helpers"; import { sprintf } from "@probo/helpers";
import { CreatePolicyDialog } from "./dialogs/CreatePolicyDialog"; import { CreateDocumentDialog } from "./dialogs/CreateDocumentDialog";
import type { PoliciesPageRowFragment$key } from "./__generated__/PoliciesPageRowFragment.graphql"; import type { DocumentsPageRowFragment$key } from "./__generated__/DocumentsPageRowFragment.graphql";
const policiesFragment = graphql` const documentsFragment = graphql`
fragment PoliciesPageListFragment on Organization { fragment DocumentsPageListFragment on Organization {
policies(first: 100) @connection(key: "PoliciesPageFragment_policies") { documents(first: 100) @connection(key: "DocumentsPageFragment_documents") {
__id __id
edges { edges {
node { node {
id id
...PoliciesPageRowFragment ...DocumentsPageRowFragment
} }
} }
} }
@@ -48,34 +48,34 @@ const policiesFragment = graphql`
`; `;
type Props = { type Props = {
queryRef: PreloadedQuery<PolicyGraphListQuery>; queryRef: PreloadedQuery<DocumentGraphListQuery>;
}; };
export default function PoliciesPage(props: Props) { export default function DocumentsPage(props: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
const organization = usePreloadedQuery( const organization = usePreloadedQuery(
policiesQuery, documentsQuery,
props.queryRef props.queryRef
).organization; ).organization;
const data = useFragment<PoliciesPageListFragment$key>( const data = useFragment<DocumentsPageListFragment$key>(
policiesFragment, documentsFragment,
organization organization
); );
const policies = data.policies.edges.map((edge) => edge.node); const documents = data.documents.edges.map((edge) => edge.node);
const connectionId = data.policies.__id; const connectionId = data.documents.__id;
usePageTitle(__("Policies")); usePageTitle(__("Documents"));
return ( return (
<div className="space-y-6"> <div className="space-y-6">
<PageHeader <PageHeader
title={__("Policies")} title={__("Documents")}
description={__("Manage your organization’s policies")} description={__("Manage your organization’s documents")}
> >
<CreatePolicyDialog <CreateDocumentDialog
connection={connectionId} connection={connectionId}
trigger={<Button icon={IconPlusLarge}>{__("New policy")}</Button>} trigger={<Button icon={IconPlusLarge}>{__("New document")}</Button>}
/> />
</PageHeader> </PageHeader>
<Table> <Table>
@@ -90,10 +90,10 @@ export default function PoliciesPage(props: Props) {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{policies.map((policy) => ( {documents.map((document) => (
<PolicyRow <DocumentRow
key={policy.id} key={document.id}
policy={policy} document={document}
organizationId={organization.id} organizationId={organization.id}
connectionId={connectionId} connectionId={connectionId}
/> />
@@ -105,7 +105,7 @@ export default function PoliciesPage(props: Props) {
} }
const rowFragment = graphql` const rowFragment = graphql`
fragment PoliciesPageRowFragment on Policy { fragment DocumentsPageRowFragment on Document {
id id
title title
description description
@@ -133,61 +133,61 @@ const rowFragment = graphql`
} }
`; `;
function PolicyRow({ function DocumentRow({
policy: policyKey, document: documentKey,
organizationId, organizationId,
connectionId, connectionId,
}: { }: {
policy: PoliciesPageRowFragment$key; document: DocumentsPageRowFragment$key;
organizationId: string; organizationId: string;
connectionId: string; connectionId: string;
}) { }) {
const policy = useFragment<PoliciesPageRowFragment$key>( const document = useFragment<DocumentsPageRowFragment$key>(
rowFragment, rowFragment,
policyKey documentKey
); );
const lastVersion = policy.versions.edges[0].node; const lastVersion = document.versions.edges[0].node;
const isDraft = lastVersion.status === "DRAFT"; const isDraft = lastVersion.status === "DRAFT";
const { __, dateFormat } = useTranslate(); const { __, dateFormat } = useTranslate();
const signatures = lastVersion.signatures.edges.map((edge) => edge.node); const signatures = lastVersion.signatures.edges.map((edge) => edge.node);
const signedCount = signatures.filter( const signedCount = signatures.filter(
(signature) => signature.state === "SIGNED" (signature) => signature.state === "SIGNED"
).length; ).length;
const [deletePolicy, isDeleting] = useDeletePolicyMutation(); const [deleteDocument] = useDeleteDocumentMutation();
const confirm = useConfirm(); const confirm = useConfirm();
const handleDelete = () => { const handleDelete = () => {
confirm( confirm(
() => () =>
deletePolicy({ deleteDocument({
variables: { variables: {
input: { policyId: policy.id }, input: { documentId: document.id },
connections: [connectionId], connections: [connectionId],
}, },
}), }),
{ {
message: sprintf( message: sprintf(
__( __(
'This will permanently delete the policy "%s". This action cannot be undone.' 'This will permanently delete the document "%s". This action cannot be undone.'
), ),
policy.title document.title
), ),
} }
); );
}; };
return ( return (
<Tr to={`/organizations/${organizationId}/policies/${policy.id}`}> <Tr to={`/organizations/${organizationId}/documents/${document.id}`}>
<Td> <Td>
<div className="flex gap-4 items-center"> <div className="flex gap-4 items-center">
<img <img
src="/policy.png" src="/document.png"
alt="" alt=""
width={28} width={28}
height={36} height={36}
className="border-4 border-highlight rounded box-content" className="border-4 border-highlight rounded box-content"
/> />
{policy.title} {document.title}
</div> </div>
</Td> </Td>
<Td> <Td>
@@ -197,12 +197,12 @@ function PolicyRow({
</Td> </Td>
<Td> <Td>
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<Avatar name={policy.owner.fullName} /> <Avatar name={document.owner.fullName} />
{policy.owner.fullName} {document.owner.fullName}
</div> </div>
</Td> </Td>
<Td> <Td>
{dateFormat(policy.updatedAt, { {dateFormat(document.updatedAt, {
year: "numeric", year: "numeric",
month: "short", month: "short",
day: "numeric", day: "numeric",

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<088b04713ff854ffccb30532513bb093>> * @generated SignedSource<<c182ef1b9491681644676e99e0b07ee7>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,10 +9,10 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PolicyStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicyPagePolicyFragment$data = { export type DocumentPageDocumentFragment$data = {
readonly id: string; readonly id: string;
readonly owner: { readonly owner: {
readonly fullName: string; readonly fullName: string;
@@ -34,23 +34,23 @@ export type PolicyPagePolicyFragment$data = {
readonly signedBy: { readonly signedBy: {
readonly id: string; readonly id: string;
}; };
readonly state: PolicyVersionSignatureState; readonly state: DocumentVersionSignatureState;
readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_signature">; readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_signature">;
}; };
}>; }>;
}; };
readonly status: PolicyStatus; readonly status: DocumentStatus;
readonly updatedAt: any; readonly updatedAt: any;
readonly version: number; readonly version: number;
readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_version" | "PolicyVersionHistoryDialogFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_version" | "DocumentVersionHistoryDialogFragment">;
}; };
}>; }>;
}; };
readonly " $fragmentType": "PolicyPagePolicyFragment"; readonly " $fragmentType": "DocumentPageDocumentFragment";
}; };
export type PolicyPagePolicyFragment$key = { export type DocumentPageDocumentFragment$key = {
readonly " $data"?: PolicyPagePolicyFragment$data; readonly " $data"?: DocumentPageDocumentFragment$data;
readonly " $fragmentSpreads": FragmentRefs<"PolicyPagePolicyFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentPageDocumentFragment">;
}; };
const node: ReaderFragment = (function(){ const node: ReaderFragment = (function(){
@@ -133,7 +133,7 @@ return {
} }
] ]
}, },
"name": "PolicyPagePolicyFragment", "name": "DocumentPageDocumentFragment",
"selections": [ "selections": [
(v0/*: any*/), (v0/*: any*/),
{ {
@@ -165,15 +165,15 @@ return {
{ {
"alias": "versions", "alias": "versions",
"args": null, "args": null,
"concreteType": "PolicyVersionConnection", "concreteType": "DocumentVersionConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "__PolicyPage_versions_connection", "name": "__DocumentPage_versions_connection",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -181,7 +181,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -225,15 +225,15 @@ return {
{ {
"alias": "signatures", "alias": "signatures",
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "__PolicyPage_signatures_connection", "name": "__DocumentPage_signatures_connection",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -241,7 +241,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -269,7 +269,7 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PolicySignaturesDialog_signature" "name": "DocumentSignaturesDialog_signature"
}, },
(v1/*: any*/) (v1/*: any*/)
], ],
@@ -287,12 +287,12 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PolicyVersionHistoryDialogFragment" "name": "DocumentVersionHistoryDialogFragment"
}, },
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PolicySignaturesDialog_version" "name": "DocumentSignaturesDialog_version"
}, },
(v1/*: any*/) (v1/*: any*/)
], ],
@@ -308,11 +308,11 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"type": "Policy", "type": "Document",
"abstractKey": null "abstractKey": null
}; };
})(); })();
(node as any).hash = "b53b22a05e1abd608ecd688b6a9d5bad"; (node as any).hash = "b42e98e8e26bc94a2d412bd73cd601f2";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<c68450dee24a94b20d5c4985a83511e0>> * @generated SignedSource<<3ef23505e9378ce7ea92943b394ba290>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,22 +9,22 @@
// @ts-nocheck // @ts-nocheck
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type PublishPolicyVersionInput = { export type PublishDocumentVersionInput = {
policyId: string; documentId: string;
}; };
export type PolicyPagePublishMutation$variables = { export type DocumentPagePublishMutation$variables = {
input: PublishPolicyVersionInput; input: PublishDocumentVersionInput;
}; };
export type PolicyPagePublishMutation$data = { export type DocumentPagePublishMutation$data = {
readonly publishPolicyVersion: { readonly publishDocumentVersion: {
readonly policy: { readonly document: {
readonly id: string; readonly id: string;
}; };
}; };
}; };
export type PolicyPagePublishMutation = { export type DocumentPagePublishMutation = {
response: PolicyPagePublishMutation$data; response: DocumentPagePublishMutation$data;
variables: PolicyPagePublishMutation$variables; variables: DocumentPagePublishMutation$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -45,17 +45,17 @@ v1 = [
"variableName": "input" "variableName": "input"
} }
], ],
"concreteType": "PublishPolicyVersionPayload", "concreteType": "PublishDocumentVersionPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "publishPolicyVersion", "name": "publishDocumentVersion",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "Policy", "concreteType": "Document",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policy", "name": "document",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
@@ -77,7 +77,7 @@ return {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicyPagePublishMutation", "name": "DocumentPagePublishMutation",
"selections": (v1/*: any*/), "selections": (v1/*: any*/),
"type": "Mutation", "type": "Mutation",
"abstractKey": null "abstractKey": null
@@ -86,20 +86,20 @@ return {
"operation": { "operation": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
"kind": "Operation", "kind": "Operation",
"name": "PolicyPagePublishMutation", "name": "DocumentPagePublishMutation",
"selections": (v1/*: any*/) "selections": (v1/*: any*/)
}, },
"params": { "params": {
"cacheID": "4279dd7a9a12d8d5fb6e07c1875de00a", "cacheID": "fad75c1a396f60d6d13e1605fe85f33e",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PolicyPagePublishMutation", "name": "DocumentPagePublishMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation PolicyPagePublishMutation(\n $input: PublishPolicyVersionInput!\n) {\n publishPolicyVersion(input: $input) {\n policy {\n id\n }\n }\n}\n" "text": "mutation DocumentPagePublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "8ee6cdf68342db34ec04aab82313eff0"; (node as any).hash = "488029ccd88b4c637b63cd11d1bef986";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<89063899241b0557e2a6df4ff74ecea1>> * @generated SignedSource<<5d1d855cd444dbaa6fc92493bc333dd4>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,21 +10,21 @@
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PoliciesPageListFragment$data = { export type DocumentsPageListFragment$data = {
readonly policies: { readonly documents: {
readonly __id: string; readonly __id: string;
readonly edges: ReadonlyArray<{ readonly edges: ReadonlyArray<{
readonly node: { readonly node: {
readonly id: string; readonly id: string;
readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageRowFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageRowFragment">;
}; };
}>; }>;
}; };
readonly " $fragmentType": "PoliciesPageListFragment"; readonly " $fragmentType": "DocumentsPageListFragment";
}; };
export type PoliciesPageListFragment$key = { export type DocumentsPageListFragment$key = {
readonly " $data"?: PoliciesPageListFragment$data; readonly " $data"?: DocumentsPageListFragment$data;
readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageListFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageListFragment">;
}; };
const node: ReaderFragment = { const node: ReaderFragment = {
@@ -37,25 +37,25 @@ const node: ReaderFragment = {
"cursor": null, "cursor": null,
"direction": "forward", "direction": "forward",
"path": [ "path": [
"policies" "documents"
] ]
} }
] ]
}, },
"name": "PoliciesPageListFragment", "name": "DocumentsPageListFragment",
"selections": [ "selections": [
{ {
"alias": "policies", "alias": "documents",
"args": null, "args": null,
"concreteType": "PolicyConnection", "concreteType": "DocumentConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "__PoliciesPageFragment_policies_connection", "name": "__DocumentsPageFragment_documents_connection",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyEdge", "concreteType": "DocumentEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -63,7 +63,7 @@ const node: ReaderFragment = {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "Policy", "concreteType": "Document",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -78,7 +78,7 @@ const node: ReaderFragment = {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PoliciesPageRowFragment" "name": "DocumentsPageRowFragment"
}, },
{ {
"alias": null, "alias": null,
@@ -145,6 +145,6 @@ const node: ReaderFragment = {
"abstractKey": null "abstractKey": null
}; };
(node as any).hash = "1c1fa3340a1fe9de3995ffcb374c9124"; (node as any).hash = "f6098fe2da00c369d0386e3854cd894b";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<3d1854151a950f0b4b85faf16c995c61>> * @generated SignedSource<<394470df6f042c06c640caad2df537cc>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,10 +9,10 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PolicyStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PoliciesPageRowFragment$data = { export type DocumentsPageRowFragment$data = {
readonly description: string; readonly description: string;
readonly id: string; readonly id: string;
readonly owner: { readonly owner: {
@@ -29,19 +29,19 @@ export type PoliciesPageRowFragment$data = {
readonly edges: ReadonlyArray<{ readonly edges: ReadonlyArray<{
readonly node: { readonly node: {
readonly id: string; readonly id: string;
readonly state: PolicyVersionSignatureState; readonly state: DocumentVersionSignatureState;
}; };
}>; }>;
}; };
readonly status: PolicyStatus; readonly status: DocumentStatus;
}; };
}>; }>;
}; };
readonly " $fragmentType": "PoliciesPageRowFragment"; readonly " $fragmentType": "DocumentsPageRowFragment";
}; };
export type PoliciesPageRowFragment$key = { export type DocumentsPageRowFragment$key = {
readonly " $data"?: PoliciesPageRowFragment$data; readonly " $data"?: DocumentsPageRowFragment$data;
readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageRowFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageRowFragment">;
}; };
const node: ReaderFragment = (function(){ const node: ReaderFragment = (function(){
@@ -56,7 +56,7 @@ return {
"argumentDefinitions": [], "argumentDefinitions": [],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PoliciesPageRowFragment", "name": "DocumentsPageRowFragment",
"selections": [ "selections": [
(v0/*: any*/), (v0/*: any*/),
{ {
@@ -108,7 +108,7 @@ return {
"value": 1 "value": 1
} }
], ],
"concreteType": "PolicyVersionConnection", "concreteType": "DocumentVersionConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "versions", "name": "versions",
"plural": false, "plural": false,
@@ -116,7 +116,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -124,7 +124,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -146,7 +146,7 @@ return {
"value": 100 "value": 100
} }
], ],
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
@@ -154,7 +154,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -162,7 +162,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -194,11 +194,11 @@ return {
"storageKey": "versions(first:1)" "storageKey": "versions(first:1)"
} }
], ],
"type": "Policy", "type": "Document",
"abstractKey": null "abstractKey": null
}; };
})(); })();
(node as any).hash = "b50c23e038e757685dfc7535825a389c"; (node as any).hash = "b5339e945b607000f177036cad41e0d4";
export default node; export default node;

View File

@@ -15,25 +15,25 @@ import {
import { type ReactNode } from "react"; import { type ReactNode } from "react";
import { graphql } from "relay-runtime"; import { graphql } from "relay-runtime";
import { useOrganizationId } from "/hooks/useOrganizationId"; import { useOrganizationId } from "/hooks/useOrganizationId";
import { usePolicyForm } from "/hooks/forms/usePolicyForm"; import { useDocumentForm } from "/hooks/forms/useDocumentForm";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts"; import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import { PeopleSelectField } from "/components/form/PeopleSelectField"; import { PeopleSelectField } from "/components/form/PeopleSelectField";
import type { CreatePolicyDialogMutation } from "./__generated__/CreatePolicyDialogMutation.graphql"; import type { CreateDocumentDialogMutation } from "./__generated__/CreateDocumentDialogMutation.graphql";
type Props = { type Props = {
trigger?: ReactNode; trigger?: ReactNode;
connection: string; connection: string;
}; };
const createPolicyMutation = graphql` const createDocumentMutation = graphql`
mutation CreatePolicyDialogMutation( mutation CreateDocumentDialogMutation(
$input: CreatePolicyInput! $input: CreateDocumentInput!
$connections: [ID!]! $connections: [ID!]!
) { ) {
createPolicy(input: $input) { createDocument(input: $input) {
policyEdge @prependEdge(connections: $connections) { documentEdge @prependEdge(connections: $connections) {
node { node {
...PoliciesPageRowFragment ...DocumentsPageRowFragment
} }
} }
} }
@@ -41,28 +41,30 @@ const createPolicyMutation = graphql`
`; `;
/** /**
* Dialog to create or update a policy * Dialog to create or update a document
*/ */
export function CreatePolicyDialog({ trigger, connection }: Props) { export function CreateDocumentDialog({ trigger, connection }: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
const organizationId = useOrganizationId(); const organizationId = useOrganizationId();
const { control, handleSubmit, register, formState, reset } = usePolicyForm(); const { control, handleSubmit, register, formState, reset } =
useDocumentForm();
const errors = formState.errors ?? {}; const errors = formState.errors ?? {};
const [createPolicy, isLoading] = const [createDocument, isLoading] =
useMutationWithToasts<CreatePolicyDialogMutation>(createPolicyMutation); useMutationWithToasts<CreateDocumentDialogMutation>(createDocumentMutation);
const onSubmit = handleSubmit((data) => { const onSubmit = handleSubmit((data) => {
createPolicy({ createDocument({
variables: { variables: {
input: { input: {
...data, ...data,
organizationId, organizationId,
documentType: "POLICY",
}, },
connections: [connection!], connections: [connection!],
}, },
successMessage: __("Policy created successfully."), successMessage: __("Document created successfully."),
errorMessage: __("Failed to create policy. Please try again."), errorMessage: __("Failed to create document. Please try again."),
onSuccess: () => { onSuccess: () => {
dialogRef.current?.close(); dialogRef.current?.close();
reset(); reset();
@@ -76,7 +78,7 @@ export function CreatePolicyDialog({ trigger, connection }: Props) {
<Dialog <Dialog
ref={dialogRef} ref={dialogRef}
trigger={trigger} trigger={trigger}
title={<Breadcrumb items={[__("Policies"), __("New Policy")]} />} title={<Breadcrumb items={[__("Documents"), __("New Document")]} />}
> >
<form onSubmit={onSubmit}> <form onSubmit={onSubmit}>
<DialogContent className="grid grid-cols-[1fr_420px]"> <DialogContent className="grid grid-cols-[1fr_420px]">
@@ -86,7 +88,7 @@ export function CreatePolicyDialog({ trigger, connection }: Props) {
aria-label={__("Title")} aria-label={__("Title")}
required required
variant="title" variant="title"
placeholder={__("Policy title")} placeholder={__("Document title")}
{...register("title")} {...register("title")}
/> />
<Textarea <Textarea
@@ -122,7 +124,7 @@ export function CreatePolicyDialog({ trigger, connection }: Props) {
</DialogContent> </DialogContent>
<DialogFooter> <DialogFooter>
<Button type="submit" disabled={isLoading}> <Button type="submit" disabled={isLoading}>
{__("Create policy")} {__("Create document")}
</Button> </Button>
</DialogFooter> </DialogFooter>
</form> </form>

View File

@@ -8,32 +8,32 @@ import {
DialogTitle, DialogTitle,
IconCircleCheck, IconCircleCheck,
IconClock, IconClock,
PolicyVersionBadge, DocumentVersionBadge,
Spinner, Spinner,
} from "@probo/ui"; } from "@probo/ui";
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { useState, type ReactNode, Suspense } from "react"; import { useState, type ReactNode, Suspense } from "react";
import type { PolicyPagePolicyFragment$data } from "../__generated__/PolicyPagePolicyFragment.graphql"; import type { DocumentPageDocumentFragment$data } from "../__generated__/DocumentPageDocumentFragment.graphql";
import clsx from "clsx"; import clsx from "clsx";
import type { ItemOf, NodeOf } from "/types"; import type { ItemOf, NodeOf } from "/types";
import { graphql, useFragment } from "react-relay"; import { graphql, useFragment } from "react-relay";
import type { PolicySignaturesDialog_version$key } from "./__generated__/PolicySignaturesDialog_version.graphql"; import type { DocumentSignaturesDialog_version$key } from "./__generated__/DocumentSignaturesDialog_version.graphql";
import type { PolicySignaturesDialog_signature$key } from "./__generated__/PolicySignaturesDialog_signature.graphql"; import type { DocumentSignaturesDialog_signature$key } from "./__generated__/DocumentSignaturesDialog_signature.graphql";
import { usePeople } from "/hooks/graph/PeopleGraph.ts"; import { usePeople } from "/hooks/graph/PeopleGraph.ts";
import { useOrganizationId } from "/hooks/useOrganizationId.ts"; import { useOrganizationId } from "/hooks/useOrganizationId.ts";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts.ts"; import { useMutationWithToasts } from "/hooks/useMutationWithToasts.ts";
import { sprintf } from "@probo/helpers"; import { sprintf } from "@probo/helpers";
type Props = { type Props = {
policy: PolicyPagePolicyFragment$data; document: DocumentPageDocumentFragment$data;
children?: ReactNode; children?: ReactNode;
}; };
type Version = NodeOf<PolicyPagePolicyFragment$data["versions"]>; type Version = NodeOf<DocumentPageDocumentFragment$data["versions"]>;
export function PolicySignaturesDialog(props: Props) { export function DocumentSignaturesDialog(props: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
const versions = props.policy.versions.edges.map((edge) => edge.node); const versions = props.document.versions.edges.map((edge) => edge.node);
const [selectedVersionId, setSelectedVersionId] = useState<string>( const [selectedVersionId, setSelectedVersionId] = useState<string>(
versions[0].id versions[0].id
); );
@@ -79,7 +79,7 @@ export function PolicySignaturesDialog(props: Props) {
} }
const versionFragment = graphql` const versionFragment = graphql`
fragment PolicySignaturesDialog_version on PolicyVersion { fragment DocumentSignaturesDialog_version on DocumentVersion {
version version
status status
publishedAt publishedAt
@@ -93,7 +93,7 @@ function VersionItem(props: {
onSelect: (v: string) => void; onSelect: (v: string) => void;
}) { }) {
const { dateTimeFormat, __ } = useTranslate(); const { dateTimeFormat, __ } = useTranslate();
const version = useFragment<PolicySignaturesDialog_version$key>( const version = useFragment<DocumentSignaturesDialog_version$key>(
versionFragment, versionFragment,
props.version props.version
); );
@@ -109,7 +109,7 @@ function VersionItem(props: {
<span> <span>
{__("Version")} {version.version} {__("Version")} {version.version}
</span> </span>
<PolicyVersionBadge state={version.status} /> <DocumentVersionBadge state={version.status} />
</div> </div>
<div className="text-xs text-txt-secondary"> <div className="text-xs text-txt-secondary">
{dateTimeFormat(version.publishedAt ?? version.updatedAt)} {dateTimeFormat(version.publishedAt ?? version.updatedAt)}
@@ -152,7 +152,7 @@ function SignatureList(props: { version: Version }) {
* Fragments * Fragments
*/ */
const signatureFragment = graphql` const signatureFragment = graphql`
fragment PolicySignaturesDialog_signature on PolicyVersionSignature { fragment DocumentSignaturesDialog_signature on DocumentVersionSignature {
id id
state state
signedAt signedAt
@@ -168,19 +168,19 @@ const signatureFragment = graphql`
* Mutations * Mutations
*/ */
const requestSignatureMutation = graphql` const requestSignatureMutation = graphql`
mutation PolicySignaturesDialog_requestSignatureMutation( mutation DocumentSignaturesDialog_requestSignatureMutation(
$input: RequestSignatureInput! $input: RequestSignatureInput!
$connections: [ID!]! $connections: [ID!]!
) { ) {
requestSignature(input: $input) { requestSignature(input: $input) {
policyVersionSignatureEdge @prependEdge(connections: $connections) { documentVersionSignatureEdge @prependEdge(connections: $connections) {
node { node {
id id
state state
signedBy { signedBy {
id id
} }
...PolicySignaturesDialog_signature ...DocumentSignaturesDialog_signature
} }
} }
} }
@@ -189,7 +189,7 @@ const requestSignatureMutation = graphql`
function SignatureItem(props: { function SignatureItem(props: {
versionId: string; versionId: string;
signature?: PolicySignaturesDialog_signature$key; signature?: DocumentSignaturesDialog_signature$key;
people: ItemOf<ReturnType<typeof usePeople>>; people: ItemOf<ReturnType<typeof usePeople>>;
connectionId: string; connectionId: string;
}) { }) {
@@ -224,7 +224,7 @@ function SignatureItem(props: {
requestSignature({ requestSignature({
variables: { variables: {
input: { input: {
policyVersionId: props.versionId, documentVersionId: props.versionId,
signatoryId: props.people.id, signatoryId: props.people.id,
}, },
connections: [props.connectionId], connections: [props.connectionId],

View File

@@ -9,14 +9,14 @@ import {
import { graphql } from "relay-runtime"; import { graphql } from "relay-runtime";
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { useState, type ReactNode } from "react"; import { useState, type ReactNode } from "react";
import type { PolicyPagePolicyFragment$data } from "../__generated__/PolicyPagePolicyFragment.graphql"; import type { DocumentPageDocumentFragment$data } from "../__generated__/DocumentPageDocumentFragment.graphql";
import { useFragment } from "react-relay"; import { useFragment } from "react-relay";
import type { PolicyVersionHistoryDialogFragment$key } from "./__generated__/PolicyVersionHistoryDialogFragment.graphql"; import type { DocumentVersionHistoryDialogFragment$key } from "./__generated__/DocumentVersionHistoryDialogFragment.graphql";
import clsx from "clsx"; import clsx from "clsx";
import type { NodeOf } from "/types"; import type { NodeOf } from "/types";
const historyFragment = graphql` const historyFragment = graphql`
fragment PolicyVersionHistoryDialogFragment on PolicyVersion { fragment DocumentVersionHistoryDialogFragment on DocumentVersion {
id id
version version
status status
@@ -31,15 +31,15 @@ const historyFragment = graphql`
`; `;
type Props = { type Props = {
policy: PolicyPagePolicyFragment$data; document: DocumentPageDocumentFragment$data;
children?: ReactNode; children?: ReactNode;
}; };
type Version = NodeOf<PolicyPagePolicyFragment$data["versions"]>; type Version = NodeOf<DocumentPageDocumentFragment$data["versions"]>;
export function PolicyVersionHistoryDialog(props: Props) { export function DocumentVersionHistoryDialog(props: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
const versions = props.policy.versions.edges.map((edge) => edge.node); const versions = props.document.versions.edges.map((edge) => edge.node);
const [selectedVersion, setSelectedVersion] = useState<Version>(versions[0]); const [selectedVersion, setSelectedVersion] = useState<Version>(versions[0]);
return ( return (
<Dialog trigger={props.children}> <Dialog trigger={props.children}>
@@ -51,7 +51,7 @@ export function PolicyVersionHistoryDialog(props: Props) {
{versions.map((version) => ( {versions.map((version) => (
<VersionItem <VersionItem
key={version.id} key={version.id}
policy={props.policy} document={props.document}
version={version} version={version}
active={selectedVersion === version} active={selectedVersion === version}
onSelect={setSelectedVersion} onSelect={setSelectedVersion}
@@ -68,12 +68,12 @@ export function PolicyVersionHistoryDialog(props: Props) {
} }
function VersionItem(props: { function VersionItem(props: {
policy: PolicyPagePolicyFragment$data; document: DocumentPageDocumentFragment$data;
version: Version; version: Version;
active?: boolean; active?: boolean;
onSelect: (v: Version) => void; onSelect: (v: Version) => void;
}) { }) {
const version = useFragment<PolicyVersionHistoryDialogFragment$key>( const version = useFragment<DocumentVersionHistoryDialogFragment$key>(
historyFragment, historyFragment,
props.version props.version
); );
@@ -87,12 +87,12 @@ function VersionItem(props: {
)} )}
> >
<Avatar <Avatar
name={version.publishedBy?.fullName ?? props.policy.owner.fullName} name={version.publishedBy?.fullName ?? props.document.owner.fullName}
size="l" size="l"
/> />
<div className="text-start space-y-[2px] w-full overflow-hidden"> <div className="text-start space-y-[2px] w-full overflow-hidden">
<div className="text-sm text-txt-primary whitespace-nowrap overflow-hidden text-ellipsis"> <div className="text-sm text-txt-primary whitespace-nowrap overflow-hidden text-ellipsis">
{version.publishedBy?.fullName ?? props.policy.owner.fullName} {version.publishedBy?.fullName ?? props.document.owner.fullName}
</div> </div>
<div className="text-xs text-txt-secondary whitespace-nowrap overflow-hidden text-ellipsis"> <div className="text-xs text-txt-secondary whitespace-nowrap overflow-hidden text-ellipsis">
{dateTimeFormat(version.publishedAt ?? version.updatedAt)} {dateTimeFormat(version.publishedAt ?? version.updatedAt)}

View File

@@ -13,20 +13,20 @@ import {
import { type RefObject } from "react"; import { type RefObject } from "react";
import { graphql } from "relay-runtime"; import { graphql } from "relay-runtime";
import { useMutation } from "react-relay"; import { useMutation } from "react-relay";
import type { PolicyPagePolicyFragment$data } from "../__generated__/PolicyPagePolicyFragment.graphql"; import type { DocumentPageDocumentFragment$data } from "../__generated__/DocumentPageDocumentFragment.graphql";
import type { UpdateVersionDialogCreateMutation } from "./__generated__/UpdateVersionDialogCreateMutation.graphql"; import type { UpdateVersionDialogCreateMutation } from "./__generated__/UpdateVersionDialogCreateMutation.graphql";
import type { UpdateVersionDialogUpdateMutation } from "./__generated__/UpdateVersionDialogUpdateMutation.graphql"; import type { UpdateVersionDialogUpdateMutation } from "./__generated__/UpdateVersionDialogUpdateMutation.graphql";
import { z } from "zod"; import { z } from "zod";
import { useFormWithSchema } from "/hooks/useFormWithSchema"; import { useFormWithSchema } from "/hooks/useFormWithSchema";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts"; import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
const createDraftPolicy = graphql` const createDraftDocument = graphql`
mutation UpdateVersionDialogCreateMutation( mutation UpdateVersionDialogCreateMutation(
$input: CreateDraftPolicyVersionInput! $input: CreateDraftDocumentVersionInput!
$connections: [ID!]! $connections: [ID!]!
) { ) {
createDraftPolicyVersion(input: $input) { createDraftDocumentVersion(input: $input) {
policyVersionEdge @prependEdge(connections: $connections) { documentVersionEdge @prependEdge(connections: $connections) {
node { node {
id id
content content
@@ -48,12 +48,12 @@ const createDraftPolicy = graphql`
} }
`; `;
const UpdatePolicyMutation = graphql` const UpdateDocumentMutation = graphql`
mutation UpdateVersionDialogUpdateMutation( mutation UpdateVersionDialogUpdateMutation(
$input: UpdatePolicyVersionInput! $input: UpdateDocumentVersionInput!
) { ) {
updatePolicyVersion(input: $input) { updateDocumentVersion(input: $input) {
policyVersion { documentVersion {
id id
content content
} }
@@ -62,7 +62,7 @@ const UpdatePolicyMutation = graphql`
`; `;
type Props = { type Props = {
policy: PolicyPagePolicyFragment$data; document: DocumentPageDocumentFragment$data;
connectionId: string; connectionId: string;
ref: RefObject<{ open: () => void } | null>; ref: RefObject<{ open: () => void } | null>;
}; };
@@ -72,7 +72,7 @@ const versionSchema = z.object({
}); });
export default function UpdateVersionDialog({ export default function UpdateVersionDialog({
policy, document,
connectionId, connectionId,
ref, ref,
}: Props) { }: Props) {
@@ -80,16 +80,16 @@ export default function UpdateVersionDialog({
const { toast } = useToast(); const { toast } = useToast();
const dialogRef = useDialogRef(); const dialogRef = useDialogRef();
const version = policy.versions.edges[0].node; const version = document.versions.edges[0].node;
const isDraft = version?.status === "DRAFT"; const isDraft = version?.status === "DRAFT";
const [createDraftPolicyVersion, isCreatingDraft] = const [createDraftDocumentVersion, isCreatingDraft] =
useMutation<UpdateVersionDialogCreateMutation>(createDraftPolicy); useMutation<UpdateVersionDialogCreateMutation>(createDraftDocument);
const [updatePolicyVersion, isUpdating] = const [updateDocumentVersion, isUpdating] =
useMutationWithToasts<UpdateVersionDialogUpdateMutation>( useMutationWithToasts<UpdateVersionDialogUpdateMutation>(
UpdatePolicyMutation, UpdateDocumentMutation,
{ {
successMessage: __("Policy updated successfully."), successMessage: __("Document updated successfully."),
errorMessage: __("Failed to update policy. Please try again."), errorMessage: __("Failed to update document. Please try again."),
} }
); );
const { handleSubmit, register } = useFormWithSchema(versionSchema, { const { handleSubmit, register } = useFormWithSchema(versionSchema, {
@@ -102,10 +102,10 @@ export default function UpdateVersionDialog({
open: () => { open: () => {
dialogRef.current?.open(); dialogRef.current?.open();
if (!isDraft) { if (!isDraft) {
createDraftPolicyVersion({ createDraftDocumentVersion({
variables: { variables: {
input: { input: {
policyID: policy.id, documentID: document.id,
}, },
connections: [connectionId], connections: [connectionId],
}, },
@@ -131,10 +131,10 @@ export default function UpdateVersionDialog({
} }
const onSubmit = handleSubmit((data) => { const onSubmit = handleSubmit((data) => {
updatePolicyVersion({ updateDocumentVersion({
variables: { variables: {
input: { input: {
policyVersionId: version.id, documentVersionId: version.id,
content: data.content, content: data.content,
}, },
}, },
@@ -147,7 +147,7 @@ export default function UpdateVersionDialog({
return ( return (
<Dialog <Dialog
ref={dialogRef} ref={dialogRef}
title={<Breadcrumb items={[__("Policies"), __("Edit policy")]} />} title={<Breadcrumb items={[__("Documents"), __("Edit document")]} />}
> >
{isCreatingDraft && <Spinner centered />} {isCreatingDraft && <Spinner centered />}
<form onSubmit={onSubmit}> <form onSubmit={onSubmit}>
@@ -165,7 +165,7 @@ export default function UpdateVersionDialog({
</DialogContent> </DialogContent>
<DialogFooter> <DialogFooter>
<Button disabled={isUpdating} type="submit"> <Button disabled={isUpdating} type="submit">
{__("Update policy")} {__("Update document")}
</Button> </Button>
</DialogFooter> </DialogFooter>
</form> </form>

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<0471409a1735c49fc0b05b5e63e97853>> * @generated SignedSource<<828dc0f47cb0d218fc437848beac7878>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,28 +10,30 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type CreatePolicyInput = { export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type CreateDocumentInput = {
content: string; content: string;
documentType: DocumentType;
organizationId: string; organizationId: string;
ownerId: string; ownerId: string;
title: string; title: string;
}; };
export type CreatePolicyDialogMutation$variables = { export type CreateDocumentDialogMutation$variables = {
connections: ReadonlyArray<string>; connections: ReadonlyArray<string>;
input: CreatePolicyInput; input: CreateDocumentInput;
}; };
export type CreatePolicyDialogMutation$data = { export type CreateDocumentDialogMutation$data = {
readonly createPolicy: { readonly createDocument: {
readonly policyEdge: { readonly documentEdge: {
readonly node: { readonly node: {
readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageRowFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageRowFragment">;
}; };
}; };
}; };
}; };
export type CreatePolicyDialogMutation = { export type CreateDocumentDialogMutation = {
response: CreatePolicyDialogMutation$data; response: CreateDocumentDialogMutation$data;
variables: CreatePolicyDialogMutation$variables; variables: CreateDocumentDialogMutation$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -67,28 +69,28 @@ return {
], ],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "CreatePolicyDialogMutation", "name": "CreateDocumentDialogMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "CreatePolicyPayload", "concreteType": "CreateDocumentPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "createPolicy", "name": "createDocument",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyEdge", "concreteType": "DocumentEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyEdge", "name": "documentEdge",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "Policy", "concreteType": "Document",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -96,7 +98,7 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PoliciesPageRowFragment" "name": "DocumentsPageRowFragment"
} }
], ],
"storageKey": null "storageKey": null
@@ -118,28 +120,28 @@ return {
(v0/*: any*/) (v0/*: any*/)
], ],
"kind": "Operation", "kind": "Operation",
"name": "CreatePolicyDialogMutation", "name": "CreateDocumentDialogMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "CreatePolicyPayload", "concreteType": "CreateDocumentPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "createPolicy", "name": "createDocument",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyEdge", "concreteType": "DocumentEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyEdge", "name": "documentEdge",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "Policy", "concreteType": "Document",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -194,7 +196,7 @@ return {
"value": 1 "value": 1
} }
], ],
"concreteType": "PolicyVersionConnection", "concreteType": "DocumentVersionConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "versions", "name": "versions",
"plural": false, "plural": false,
@@ -202,7 +204,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -210,7 +212,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -232,7 +234,7 @@ return {
"value": 100 "value": 100
} }
], ],
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
@@ -240,7 +242,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -248,7 +250,7 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -292,7 +294,7 @@ return {
"handle": "prependEdge", "handle": "prependEdge",
"key": "", "key": "",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "policyEdge", "name": "documentEdge",
"handleArgs": [ "handleArgs": [
{ {
"kind": "Variable", "kind": "Variable",
@@ -307,16 +309,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "7ca1b2811e06da7ba97064950fb8f632", "cacheID": "bedd217ae32d45e8ac183a38e5624618",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "CreatePolicyDialogMutation", "name": "CreateDocumentDialogMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation CreatePolicyDialogMutation(\n $input: CreatePolicyInput!\n) {\n createPolicy(input: $input) {\n policyEdge {\n node {\n ...PoliciesPageRowFragment\n id\n }\n }\n }\n}\n\nfragment PoliciesPageRowFragment on Policy {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n" "text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n ...DocumentsPageRowFragment\n id\n }\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "6c749af4def68b742bc5eb80dd120c8a"; (node as any).hash = "f3792f9bd5524dd1e7656908c2774069";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<af123c927212dd99fbaeb81e3b2f2bd9>> * @generated SignedSource<<fa604130d8725651770072b638fc5926>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -10,32 +10,32 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
export type RequestSignatureInput = { export type RequestSignatureInput = {
policyVersionId: string; documentVersionId: string;
signatoryId: string; signatoryId: string;
}; };
export type PolicySignaturesDialog_requestSignatureMutation$variables = { export type DocumentSignaturesDialog_requestSignatureMutation$variables = {
connections: ReadonlyArray<string>; connections: ReadonlyArray<string>;
input: RequestSignatureInput; input: RequestSignatureInput;
}; };
export type PolicySignaturesDialog_requestSignatureMutation$data = { export type DocumentSignaturesDialog_requestSignatureMutation$data = {
readonly requestSignature: { readonly requestSignature: {
readonly policyVersionSignatureEdge: { readonly documentVersionSignatureEdge: {
readonly node: { readonly node: {
readonly id: string; readonly id: string;
readonly signedBy: { readonly signedBy: {
readonly id: string; readonly id: string;
}; };
readonly state: PolicyVersionSignatureState; readonly state: DocumentVersionSignatureState;
readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_signature">; readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_signature">;
}; };
}; };
}; };
}; };
export type PolicySignaturesDialog_requestSignatureMutation = { export type DocumentSignaturesDialog_requestSignatureMutation = {
response: PolicySignaturesDialog_requestSignatureMutation$data; response: DocumentSignaturesDialog_requestSignatureMutation$data;
variables: PolicySignaturesDialog_requestSignatureMutation$variables; variables: DocumentSignaturesDialog_requestSignatureMutation$variables;
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
@@ -78,7 +78,7 @@ return {
], ],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicySignaturesDialog_requestSignatureMutation", "name": "DocumentSignaturesDialog_requestSignatureMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -91,15 +91,15 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyVersionSignatureEdge", "name": "documentVersionSignatureEdge",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -121,7 +121,7 @@ return {
{ {
"args": null, "args": null,
"kind": "FragmentSpread", "kind": "FragmentSpread",
"name": "PolicySignaturesDialog_signature" "name": "DocumentSignaturesDialog_signature"
} }
], ],
"storageKey": null "storageKey": null
@@ -143,7 +143,7 @@ return {
(v0/*: any*/) (v0/*: any*/)
], ],
"kind": "Operation", "kind": "Operation",
"name": "PolicySignaturesDialog_requestSignatureMutation", "name": "DocumentSignaturesDialog_requestSignatureMutation",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -156,15 +156,15 @@ return {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyVersionSignatureEdge", "name": "documentVersionSignatureEdge",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -224,7 +224,7 @@ return {
"handle": "prependEdge", "handle": "prependEdge",
"key": "", "key": "",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "policyVersionSignatureEdge", "name": "documentVersionSignatureEdge",
"handleArgs": [ "handleArgs": [
{ {
"kind": "Variable", "kind": "Variable",
@@ -239,16 +239,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "20c460adbc3480622c4c91220a6e54fe", "cacheID": "6a5413db69a07e0eef99245e949cf4b2",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PolicySignaturesDialog_requestSignatureMutation", "name": "DocumentSignaturesDialog_requestSignatureMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation PolicySignaturesDialog_requestSignatureMutation(\n $input: RequestSignatureInput!\n) {\n requestSignature(input: $input) {\n policyVersionSignatureEdge {\n node {\n id\n state\n signedBy {\n id\n }\n ...PolicySignaturesDialog_signature\n }\n }\n }\n}\n\nfragment PolicySignaturesDialog_signature on PolicyVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n" "text": "mutation DocumentSignaturesDialog_requestSignatureMutation(\n $input: RequestSignatureInput!\n) {\n requestSignature(input: $input) {\n documentVersionSignatureEdge {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesDialog_signature\n }\n }\n }\n}\n\nfragment DocumentSignaturesDialog_signature on DocumentVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "24825b1c4040debb7edda76c8ad3d662"; (node as any).hash = "6c51f681411cd3de162c78a3db20ec30";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<4bda7ac839740680ea31b4c20299d9d4>> * @generated SignedSource<<71e44f5802c3eaba88dde399af20ed89>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,9 +9,9 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicySignaturesDialog_signature$data = { export type DocumentSignaturesDialog_signature$data = {
readonly id: string; readonly id: string;
readonly requestedAt: any; readonly requestedAt: any;
readonly signedAt: any | null | undefined; readonly signedAt: any | null | undefined;
@@ -19,19 +19,19 @@ export type PolicySignaturesDialog_signature$data = {
readonly fullName: string; readonly fullName: string;
readonly primaryEmailAddress: string; readonly primaryEmailAddress: string;
}; };
readonly state: PolicyVersionSignatureState; readonly state: DocumentVersionSignatureState;
readonly " $fragmentType": "PolicySignaturesDialog_signature"; readonly " $fragmentType": "DocumentSignaturesDialog_signature";
}; };
export type PolicySignaturesDialog_signature$key = { export type DocumentSignaturesDialog_signature$key = {
readonly " $data"?: PolicySignaturesDialog_signature$data; readonly " $data"?: DocumentSignaturesDialog_signature$data;
readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_signature">; readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_signature">;
}; };
const node: ReaderFragment = { const node: ReaderFragment = {
"argumentDefinitions": [], "argumentDefinitions": [],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicySignaturesDialog_signature", "name": "DocumentSignaturesDialog_signature",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -87,10 +87,10 @@ const node: ReaderFragment = {
"storageKey": null "storageKey": null
} }
], ],
"type": "PolicyVersionSignature", "type": "DocumentVersionSignature",
"abstractKey": null "abstractKey": null
}; };
(node as any).hash = "b2e435dc6db3a0df223af98251adcb30"; (node as any).hash = "0db843d4ebd21f44a3d126e85da8cf26";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<efbbec863b7456c271e408fb553f9ea1>> * @generated SignedSource<<dc19ab6bedc70a5b4546a2edb922b97f>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,25 +9,25 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PolicyStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicySignaturesDialog_version$data = { export type DocumentSignaturesDialog_version$data = {
readonly publishedAt: any | null | undefined; readonly publishedAt: any | null | undefined;
readonly status: PolicyStatus; readonly status: DocumentStatus;
readonly updatedAt: any; readonly updatedAt: any;
readonly version: number; readonly version: number;
readonly " $fragmentType": "PolicySignaturesDialog_version"; readonly " $fragmentType": "DocumentSignaturesDialog_version";
}; };
export type PolicySignaturesDialog_version$key = { export type DocumentSignaturesDialog_version$key = {
readonly " $data"?: PolicySignaturesDialog_version$data; readonly " $data"?: DocumentSignaturesDialog_version$data;
readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_version">; readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_version">;
}; };
const node: ReaderFragment = { const node: ReaderFragment = {
"argumentDefinitions": [], "argumentDefinitions": [],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicySignaturesDialog_version", "name": "DocumentSignaturesDialog_version",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -58,10 +58,10 @@ const node: ReaderFragment = {
"storageKey": null "storageKey": null
} }
], ],
"type": "PolicyVersion", "type": "DocumentVersion",
"abstractKey": null "abstractKey": null
}; };
(node as any).hash = "cdec8e3244fd6329a86b5825a4133c44"; (node as any).hash = "564746ce584a834e25a5a341155d6b2c";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<45feb21e3f613b3818af04725831a427>> * @generated SignedSource<<dd89afd13dd17b29485a3fdaf840cd42>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,9 +9,9 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PolicyStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PolicyVersionHistoryDialogFragment$data = { export type DocumentVersionHistoryDialogFragment$data = {
readonly changelog: string; readonly changelog: string;
readonly content: string; readonly content: string;
readonly id: string; readonly id: string;
@@ -19,21 +19,21 @@ export type PolicyVersionHistoryDialogFragment$data = {
readonly publishedBy: { readonly publishedBy: {
readonly fullName: string; readonly fullName: string;
} | null | undefined; } | null | undefined;
readonly status: PolicyStatus; readonly status: DocumentStatus;
readonly updatedAt: any; readonly updatedAt: any;
readonly version: number; readonly version: number;
readonly " $fragmentType": "PolicyVersionHistoryDialogFragment"; readonly " $fragmentType": "DocumentVersionHistoryDialogFragment";
}; };
export type PolicyVersionHistoryDialogFragment$key = { export type DocumentVersionHistoryDialogFragment$key = {
readonly " $data"?: PolicyVersionHistoryDialogFragment$data; readonly " $data"?: DocumentVersionHistoryDialogFragment$data;
readonly " $fragmentSpreads": FragmentRefs<"PolicyVersionHistoryDialogFragment">; readonly " $fragmentSpreads": FragmentRefs<"DocumentVersionHistoryDialogFragment">;
}; };
const node: ReaderFragment = { const node: ReaderFragment = {
"argumentDefinitions": [], "argumentDefinitions": [],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "PolicyVersionHistoryDialogFragment", "name": "DocumentVersionHistoryDialogFragment",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
@@ -103,10 +103,10 @@ const node: ReaderFragment = {
"storageKey": null "storageKey": null
} }
], ],
"type": "PolicyVersion", "type": "DocumentVersion",
"abstractKey": null "abstractKey": null
}; };
(node as any).hash = "63ce12a876b10889d9ff2e4ee20af968"; (node as any).hash = "947253287039236aa413ee33879a6e4b";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<7b7cbab5e73007ace1e7d07970b633e8>> * @generated SignedSource<<8c2484ed8e582d28aab0aa0b4cf30ebe>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,18 +9,18 @@
// @ts-nocheck // @ts-nocheck
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type PolicyStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
export type CreateDraftPolicyVersionInput = { export type CreateDraftDocumentVersionInput = {
policyID: string; documentID: string;
}; };
export type UpdateVersionDialogCreateMutation$variables = { export type UpdateVersionDialogCreateMutation$variables = {
connections: ReadonlyArray<string>; connections: ReadonlyArray<string>;
input: CreateDraftPolicyVersionInput; input: CreateDraftDocumentVersionInput;
}; };
export type UpdateVersionDialogCreateMutation$data = { export type UpdateVersionDialogCreateMutation$data = {
readonly createDraftPolicyVersion: { readonly createDraftDocumentVersion: {
readonly policyVersionEdge: { readonly documentVersionEdge: {
readonly node: { readonly node: {
readonly content: string; readonly content: string;
readonly id: string; readonly id: string;
@@ -29,11 +29,11 @@ export type UpdateVersionDialogCreateMutation$data = {
readonly edges: ReadonlyArray<{ readonly edges: ReadonlyArray<{
readonly node: { readonly node: {
readonly id: string; readonly id: string;
readonly state: PolicyVersionSignatureState; readonly state: DocumentVersionSignatureState;
}; };
}>; }>;
}; };
readonly status: PolicyStatus; readonly status: DocumentStatus;
readonly updatedAt: any; readonly updatedAt: any;
readonly version: number; readonly version: number;
}; };
@@ -73,15 +73,15 @@ v3 = {
v4 = { v4 = {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionEdge", "concreteType": "DocumentVersionEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyVersionEdge", "name": "documentVersionEdge",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -131,7 +131,7 @@ v4 = {
"value": 100 "value": 100
} }
], ],
"concreteType": "PolicyVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
@@ -139,7 +139,7 @@ v4 = {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignatureEdge", "concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField", "kind": "LinkedField",
"name": "edges", "name": "edges",
"plural": true, "plural": true,
@@ -147,7 +147,7 @@ v4 = {
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersionSignature", "concreteType": "DocumentVersionSignature",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "node",
"plural": false, "plural": false,
@@ -188,9 +188,9 @@ return {
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "CreateDraftPolicyVersionPayload", "concreteType": "CreateDraftDocumentVersionPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "createDraftPolicyVersion", "name": "createDraftDocumentVersion",
"plural": false, "plural": false,
"selections": [ "selections": [
(v4/*: any*/) (v4/*: any*/)
@@ -213,9 +213,9 @@ return {
{ {
"alias": null, "alias": null,
"args": (v2/*: any*/), "args": (v2/*: any*/),
"concreteType": "CreateDraftPolicyVersionPayload", "concreteType": "CreateDraftDocumentVersionPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "createDraftPolicyVersion", "name": "createDraftDocumentVersion",
"plural": false, "plural": false,
"selections": [ "selections": [
(v4/*: any*/), (v4/*: any*/),
@@ -226,7 +226,7 @@ return {
"handle": "prependEdge", "handle": "prependEdge",
"key": "", "key": "",
"kind": "LinkedHandle", "kind": "LinkedHandle",
"name": "policyVersionEdge", "name": "documentVersionEdge",
"handleArgs": [ "handleArgs": [
{ {
"kind": "Variable", "kind": "Variable",
@@ -241,16 +241,16 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "c5b0f449a70a4043368de55bba176329", "cacheID": "1a0f515ea5c0ca4fd3ab1ae969025ca0",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "UpdateVersionDialogCreateMutation", "name": "UpdateVersionDialogCreateMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation UpdateVersionDialogCreateMutation(\n $input: CreateDraftPolicyVersionInput!\n) {\n createDraftPolicyVersion(input: $input) {\n policyVersionEdge {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n" "text": "mutation UpdateVersionDialogCreateMutation(\n $input: CreateDraftDocumentVersionInput!\n) {\n createDraftDocumentVersion(input: $input) {\n documentVersionEdge {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "6a451392a86776d33c376bfdcea7613c"; (node as any).hash = "a78a88558effc43ceab6746d8a4fea46";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<6cbec0c0b675969ecdebebf74c7465ab>> * @generated SignedSource<<2b90fd4d14e86e5547d7b790a20242c9>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,16 +9,16 @@
// @ts-nocheck // @ts-nocheck
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type UpdatePolicyVersionInput = { export type UpdateDocumentVersionInput = {
content: string; content: string;
policyVersionId: string; documentVersionId: string;
}; };
export type UpdateVersionDialogUpdateMutation$variables = { export type UpdateVersionDialogUpdateMutation$variables = {
input: UpdatePolicyVersionInput; input: UpdateDocumentVersionInput;
}; };
export type UpdateVersionDialogUpdateMutation$data = { export type UpdateVersionDialogUpdateMutation$data = {
readonly updatePolicyVersion: { readonly updateDocumentVersion: {
readonly policyVersion: { readonly documentVersion: {
readonly content: string; readonly content: string;
readonly id: string; readonly id: string;
}; };
@@ -47,17 +47,17 @@ v1 = [
"variableName": "input" "variableName": "input"
} }
], ],
"concreteType": "UpdatePolicyVersionPayload", "concreteType": "UpdateDocumentVersionPayload",
"kind": "LinkedField", "kind": "LinkedField",
"name": "updatePolicyVersion", "name": "updateDocumentVersion",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "PolicyVersion", "concreteType": "DocumentVersion",
"kind": "LinkedField", "kind": "LinkedField",
"name": "policyVersion", "name": "documentVersion",
"plural": false, "plural": false,
"selections": [ "selections": [
{ {
@@ -99,16 +99,16 @@ return {
"selections": (v1/*: any*/) "selections": (v1/*: any*/)
}, },
"params": { "params": {
"cacheID": "374557bf1319583b7d590f5bea438e63", "cacheID": "527e45a341f2f991e30e8689ac24403c",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "UpdateVersionDialogUpdateMutation", "name": "UpdateVersionDialogUpdateMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation UpdateVersionDialogUpdateMutation(\n $input: UpdatePolicyVersionInput!\n) {\n updatePolicyVersion(input: $input) {\n policyVersion {\n id\n content\n }\n }\n}\n" "text": "mutation UpdateVersionDialogUpdateMutation(\n $input: UpdateDocumentVersionInput!\n) {\n updateDocumentVersion(input: $input) {\n documentVersion {\n id\n content\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "d863d893bfa969b02768096e024275a4"; (node as any).hash = "ffd885c021e9fd91522a494e16e6830d";
export default node; export default node;

View File

@@ -3,14 +3,10 @@ import { useTranslate } from "@probo/i18n";
import { import {
ActionDropdown, ActionDropdown,
Avatar, Avatar,
Button,
Card, Card,
Dropdown,
DropdownItem, DropdownItem,
FileButton, FileButton,
FrameworkSelector, FrameworkSelector,
IconChevronDown,
IconPlusLarge,
IconTrashCan, IconTrashCan,
IconUpload, IconUpload,
PageHeader, PageHeader,

View File

@@ -7,13 +7,10 @@ import {
Dialog, Dialog,
DialogContent, DialogContent,
DialogFooter, DialogFooter,
Field,
Input, Input,
Textarea, Textarea,
useDialogRef,
type DialogRef, type DialogRef,
} from "@probo/ui"; } from "@probo/ui";
import type { RefObject } from "react";
import { z } from "zod"; import { z } from "zod";
import { useFormWithSchema } from "/hooks/useFormWithSchema"; import { useFormWithSchema } from "/hooks/useFormWithSchema";
@@ -46,12 +43,7 @@ const schema = z.object({
export function CreateFrameworkDialog(props: Props) { export function CreateFrameworkDialog(props: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
const { const { register, handleSubmit, reset } = useFormWithSchema(schema, {});
register,
handleSubmit,
formState: { errors },
reset,
} = useFormWithSchema(schema, {});
const [commitCreate, isCreating] = useMutationWithToasts( const [commitCreate, isCreating] = useMutationWithToasts(
createFrameworkMutation, createFrameworkMutation,
{ {

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<aa74d7b1c9c34a3780220590119aa78f>> * @generated SignedSource<<fce211be2cfe7f4b313cf2db7f4f127c>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -12,9 +12,12 @@ import { ConcreteRequest } from 'relay-runtime';
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type CreatePeopleInput = { export type CreatePeopleInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined; additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
contractEndDate?: any | null | undefined;
contractStartDate?: any | null | undefined;
fullName: string; fullName: string;
kind: PeopleKind; kind: PeopleKind;
organizationId: string; organizationId: string;
position?: string | null | undefined;
primaryEmailAddress: string; primaryEmailAddress: string;
}; };
export type CreatePeopleDialogMutation$variables = { export type CreatePeopleDialogMutation$variables = {

View File

@@ -37,6 +37,7 @@ export function CreateVendorDialog({
organizationId, organizationId,
name: vendor, name: vendor,
description: "", description: "",
category: null,
} }
: { : {
organizationId, organizationId,

View File

@@ -26,7 +26,7 @@ export default function VendorOverviewTab() {
[ [
{ name: "statusPageUrl", label: __("Status page URL") }, { name: "statusPageUrl", label: __("Status page URL") },
{ name: "termsOfServiceUrl", label: __("Terms of service URL") }, { name: "termsOfServiceUrl", label: __("Terms of service URL") },
{ name: "privacyPolicyUrl", label: __("Privacy policy URL") }, { name: "privacyPolicyUrl", label: __("Privacy document URL") },
{ {
name: "serviceLevelAgreementUrl", name: "serviceLevelAgreementUrl",
label: __("Service level agreement URL"), label: __("Service level agreement URL"),

View File

@@ -17,7 +17,7 @@ import { loadQuery, type PreloadedQuery } from "react-relay";
import { useCleanup } from "./hooks/useDelayedEffect.ts"; import { useCleanup } from "./hooks/useDelayedEffect.ts";
import { riskRoutes } from "./routes/riskRoutes.ts"; import { riskRoutes } from "./routes/riskRoutes.ts";
import { measureRoutes } from "./routes/measureRoutes.ts"; import { measureRoutes } from "./routes/measureRoutes.ts";
import { policiesRoutes } from "./routes/policiesRoutes.ts"; import { documentsRoutes } from "./routes/documentsRoutes.ts";
import { vendorRoutes } from "./routes/vendorRoutes.ts"; import { vendorRoutes } from "./routes/vendorRoutes.ts";
import { organizationViewQuery } from "./hooks/graph/OrganizationGraph.ts"; import { organizationViewQuery } from "./hooks/graph/OrganizationGraph.ts";
import { peopleRoutes } from "./routes/peopleRoutes.ts"; import { peopleRoutes } from "./routes/peopleRoutes.ts";
@@ -83,7 +83,7 @@ const routes = [
}, },
...riskRoutes, ...riskRoutes,
...measureRoutes, ...measureRoutes,
...policiesRoutes, ...documentsRoutes,
...peopleRoutes, ...peopleRoutes,
...vendorRoutes, ...vendorRoutes,
...frameworkRoutes, ...frameworkRoutes,

View File

@@ -0,0 +1,28 @@
import { lazy } from "react";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";
import { documentsQuery } from "/hooks/graph/DocumentGraph";
import { documentNodeQuery } from "/hooks/graph/DocumentGraph";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
export const documentsRoutes = [
{
path: "documents",
fallback: PageSkeleton,
queryLoader: ({ organizationId }) =>
loadQuery(relayEnvironment, documentsQuery, { organizationId }),
Component: lazy(
() => import("/pages/organizations/documents/DocumentsPage")
),
},
{
path: "documents/:documentId",
fallback: PageSkeleton,
queryLoader: ({ documentId }) =>
loadQuery(relayEnvironment, documentNodeQuery, { documentId }),
Component: lazy(
() => import("/pages/organizations/documents/DocumentPage")
),
},
] satisfies AppRoute[];

View File

@@ -1,24 +0,0 @@
import { lazy } from "react";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";
import { policiesQuery } from "/hooks/graph/PolicyGraph";
import { policyNodeQuery } from "/hooks/graph/PolicyGraph";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
export const policiesRoutes = [
{
path: "policies",
fallback: PageSkeleton,
queryLoader: ({ organizationId }) =>
loadQuery(relayEnvironment, policiesQuery, { organizationId }),
Component: lazy(() => import("/pages/organizations/policies/PoliciesPage")),
},
{
path: "policies/:policyId",
fallback: PageSkeleton,
queryLoader: ({ policyId }) =>
loadQuery(relayEnvironment, policyNodeQuery, { policyId }),
Component: lazy(() => import("/pages/organizations/policies/PolicyPage")),
},
] satisfies AppRoute[];

View File

@@ -0,0 +1,21 @@
import { DocumentVersionBadge } from "./DocumentVersionBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
title: "Molecules/Badges/DocumentVersionBadge",
component: DocumentVersionBadge,
argTypes: {},
} satisfies Meta<typeof DocumentVersionBadge>;
type Story = StoryObj<typeof DocumentVersionBadge>;
export const Default: Story = {
render() {
return (
<div className="flex gap-2">
<DocumentVersionBadge state="DRAFT" />
<DocumentVersionBadge state="PUBLISHED" />
</div>
);
},
};

View File

@@ -5,7 +5,7 @@ type Props = {
state: "DRAFT" | "PUBLISHED"; state: "DRAFT" | "PUBLISHED";
}; };
export function PolicyVersionBadge(props: Props) { export function DocumentVersionBadge(props: Props) {
const { __ } = useTranslate(); const { __ } = useTranslate();
return ( return (
<Badge variant={props.state === "DRAFT" ? "neutral" : "success"}> <Badge variant={props.state === "DRAFT" ? "neutral" : "success"}>

View File

@@ -1,21 +0,0 @@
import { PolicyVersionBadge } from "./PolicyVersionBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
title: "Molecules/Badges/PolicyVersionBadge",
component: PolicyVersionBadge,
argTypes: {},
} satisfies Meta<typeof PolicyVersionBadge>;
type Story = StoryObj<typeof PolicyVersionBadge>;
export const Default: Story = {
render() {
return (
<div className="flex gap-2">
<PolicyVersionBadge state="DRAFT" />
<PolicyVersionBadge state="PUBLISHED" />
</div>
);
},
};

View File

@@ -52,7 +52,7 @@ export {
export { useConfirm } from "./Molecules/Dialog/ConfirmDialog"; export { useConfirm } from "./Molecules/Dialog/ConfirmDialog";
export { RiskBadge } from "./Molecules/Badge/RiskBadge"; export { RiskBadge } from "./Molecules/Badge/RiskBadge";
export { SeverityBadge } from "./Molecules/Badge/SeverityBadge.tsx"; export { SeverityBadge } from "./Molecules/Badge/SeverityBadge.tsx";
export { PolicyVersionBadge } from "./Molecules/Badge/PolicyVersionBadge.tsx"; export { DocumentVersionBadge } from "./Molecules/Badge/DocumentVersionBadge.tsx";
export { RisksChart } from "./Molecules/Risks/RisksChart"; export { RisksChart } from "./Molecules/Risks/RisksChart";
export { RiskOverview } from "./Molecules/Risks/RiskOverview"; export { RiskOverview } from "./Molecules/Risks/RiskOverview";
export { Combobox, ComboboxItem } from "./Molecules/Combobox/Combobox"; export { Combobox, ComboboxItem } from "./Molecules/Combobox/Combobox";

View File

@@ -6,28 +6,28 @@
* Category types for vendors * Category types for vendors
*/ */
export type VendorCategory = export type VendorCategory =
| 'Analytics' | "ANALYTICS"
| 'Cloud monitoring' | "CLOUD_MONITORING"
| 'Cloud provider' | "CLOUD_PROVIDER"
| 'Collaboration' | "COLLABORATION"
| 'Customer support' | "CUSTOMER_SUPPORT"
| 'Data storage and processing' | "DATA_STORAGE_AND_PROCESSING"
| 'Document management' | "DOCUMENT_MANAGEMENT"
| 'Employee management' | "EMPLOYEE_MANAGEMENT"
| 'Engineering' | "ENGINEERING"
| 'Finance' | "FINANCE"
| 'Identity provider' | "IDENTITY_PROVIDER"
| 'IT' | "IT"
| 'Marketing' | "MARKETING"
| 'Office operations' | "OFFICE_OPERATIONS"
| 'Other' | "OTHER"
| 'Password management' | "PASSWORD_MANAGEMENT"
| 'Product and design' | "PRODUCT_AND_DESIGN"
| 'Professional services' | "PROFESSIONAL_SERVICES"
| 'Recruiting' | "RECRUITING"
| 'Sales' | "SALES"
| 'Security' | "SECURITY"
| 'Version control'; | "VERSION_CONTROL";
/** /**
* Represents a software vendor or service provider with associated metadata * Represents a software vendor or service provider with associated metadata
@@ -35,52 +35,52 @@ export type VendorCategory =
export interface Vendor { export interface Vendor {
/** Display name of the vendor */ /** Display name of the vendor */
name: string; name: string;
/** Legal business name of the vendor */ /** Legal business name of the vendor */
legalName?: string; legalName?: string;
/** Physical headquarters address */ /** Physical headquarters address */
headquarterAddress?: string; headquarterAddress?: string;
/** Vendor's website URL */ /** Vendor's website URL */
websiteUrl: string; websiteUrl: string;
/** URL to vendor's privacy policy */ /** URL to vendor's privacy policy */
privacyPolicyUrl?: string; privacyPolicyUrl?: string;
/** URL to vendor's terms of service */ /** URL to vendor's terms of service */
termsOfServiceUrl?: string; termsOfServiceUrl?: string;
/** URL to vendor's service level agreement */ /** URL to vendor's service level agreement */
serviceLevelAgreementUrl?: string; serviceLevelAgreementUrl?: string;
/** URL to service software agreement */ /** URL to service software agreement */
serviceSoftwareAgreementUrl?: string; serviceSoftwareAgreementUrl?: string;
/** URL to vendor's data processing agreement */ /** URL to vendor's data processing agreement */
dataProcessingAgreementUrl?: string; dataProcessingAgreementUrl?: string;
/** URL to vendor's list of subprocessors */ /** URL to vendor's list of subprocessors */
subprocessorsListUrl?: string; subprocessorsListUrl?: string;
/** URL to vendor's business associate agreement */ /** URL to vendor's business associate agreement */
businessAssociateAgreementUrl?: string; businessAssociateAgreementUrl?: string;
/** Short description of the vendor/service */ /** Short description of the vendor/service */
description?: string; description?: string;
/** Primary category for the vendor */ /** Primary category for the vendor */
category?: VendorCategory; category?: VendorCategory;
/** Security or compliance certifications held by the vendor */ /** Security or compliance certifications held by the vendor */
certifications?: string[]; certifications?: string[];
/** URL to vendor's security page */ /** URL to vendor's security page */
securityPageUrl?: string; securityPageUrl?: string;
/** URL to vendor's trust page */ /** URL to vendor's trust page */
trustPageUrl?: string; trustPageUrl?: string;
/** URL to vendor's status page */ /** URL to vendor's status page */
statusPageUrl?: string; statusPageUrl?: string;
} }
@@ -90,7 +90,6 @@ export interface Vendor {
*/ */
export type Vendors = Vendor[]; export type Vendors = Vendor[];
/** /**
* Default export representing the entire vendor dataset * Default export representing the entire vendor dataset
*/ */