diff --git a/apps/trust/src/components/VendorRow.tsx b/apps/trust/src/components/VendorRow.tsx index cb52c7b05..836193191 100644 --- a/apps/trust/src/components/VendorRow.tsx +++ b/apps/trust/src/components/VendorRow.tsx @@ -1,6 +1,6 @@ import { faviconUrl, getCountryName } from "@probo/helpers"; import { useTranslate } from "@probo/i18n"; -import { IconPin, IconShield } from "@probo/ui"; +import { IconPin } from "@probo/ui"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; @@ -8,11 +8,9 @@ import type { VendorRowFragment$key } from "./__generated__/VendorRowFragment.gr const vendorRowFragment = graphql` fragment VendorRowFragment on Vendor { - id name - category + description websiteUrl - privacyPolicyUrl countries } `; @@ -22,48 +20,37 @@ export function VendorRow(props: { vendor: VendorRowFragment$key; hasAnyCountrie const logo = faviconUrl(vendor.websiteUrl); const { __ } = useTranslate(); - const gridCols = props.hasAnyCountries ? "grid-cols-[1fr_1fr_1fr]" : "grid-cols-[1fr_1fr]"; - return ( -
+
{logo ? ( ) : ( -
+
+ )} +
+ {vendor.name} +
{vendor.description}
+ {props.hasAnyCountries + && ( +
+ {vendor.countries.length > 0 && ( + <> + + + {vendor.countries + .map(country => getCountryName(__, country)) + .join(", ")} + + + )} +
)} -
-
{vendor.name}
- {vendor.privacyPolicyUrl - ? ( - - - {__("Privacy")} - - ) - : ( -
- )} - {vendor.countries.length > 0 && ( -
- - - {vendor.countries - .map(country => getCountryName(__, country)) - .join(", ")} - -
- )}
); diff --git a/apps/trust/src/components/__generated__/VendorRowFragment.graphql.ts b/apps/trust/src/components/__generated__/VendorRowFragment.graphql.ts index 63fc97212..2d5488b3f 100644 --- a/apps/trust/src/components/__generated__/VendorRowFragment.graphql.ts +++ b/apps/trust/src/components/__generated__/VendorRowFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<93ab4de166540c22f47f2cf5fe51c009>> * @lightSyntaxTransform * @nogrep */ @@ -10,14 +10,11 @@ import { ReaderFragment } from 'relay-runtime'; export type CountryCode = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "EU" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW"; -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"; import { FragmentRefs } from "relay-runtime"; export type VendorRowFragment$data = { - readonly category: VendorCategory; readonly countries: ReadonlyArray; - readonly id: string; + readonly description: string | null | undefined; readonly name: string; - readonly privacyPolicyUrl: string | null | undefined; readonly websiteUrl: string | null | undefined; readonly " $fragmentType": "VendorRowFragment"; }; @@ -32,13 +29,6 @@ const node: ReaderFragment = { "metadata": null, "name": "VendorRowFragment", "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, { "alias": null, "args": null, @@ -50,7 +40,7 @@ const node: ReaderFragment = { "alias": null, "args": null, "kind": "ScalarField", - "name": "category", + "name": "description", "storageKey": null }, { @@ -60,13 +50,6 @@ const node: ReaderFragment = { "name": "websiteUrl", "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "privacyPolicyUrl", - "storageKey": null - }, { "alias": null, "args": null, @@ -79,6 +62,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "eba669a2b65ef7b9990799516b7d9932"; +(node as any).hash = "deaa52007cf14fbc93ca5a82f6dbba42"; export default node; diff --git a/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts b/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts index 2faccd99a..8a0b14806 100644 --- a/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts +++ b/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<6ca2f281af2d0dfbe388980e05bc8d0c>> + * @generated SignedSource<<006540288cfca33589264e1f596e1028>> * @lightSyntaxTransform * @nogrep */ @@ -181,28 +181,21 @@ v15 = [ "value": 50 } ], -v16 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "category", - "storageKey": null -}, -v17 = [ +v16 = [ { "kind": "Literal", "name": "first", "value": 5 } ], -v18 = { +v17 = { "alias": null, "args": null, "kind": "ScalarField", "name": "isUserAuthorized", "storageKey": null }, -v19 = { +v18 = { "alias": null, "args": null, "kind": "ScalarField", @@ -454,15 +447,8 @@ return { "storageKey": null }, (v10/*: any*/), - (v16/*: any*/), - (v12/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "privacyPolicyUrl", - "storageKey": null - } + (v11/*: any*/), + (v12/*: any*/) ], "storageKey": null } @@ -474,7 +460,7 @@ return { }, { "alias": null, - "args": (v17/*: any*/), + "args": (v16/*: any*/), "concreteType": "DocumentConnection", "kind": "LinkedField", "name": "documents", @@ -504,8 +490,8 @@ return { "name": "title", "storageKey": null }, + (v17/*: any*/), (v18/*: any*/), - (v19/*: any*/), { "alias": null, "args": null, @@ -524,7 +510,7 @@ return { }, { "alias": null, - "args": (v17/*: any*/), + "args": (v16/*: any*/), "concreteType": "TrustCenterFileConnection", "kind": "LinkedField", "name": "trustCenterFiles", @@ -547,10 +533,16 @@ return { "plural": false, "selections": [ (v2/*: any*/), - (v16/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "category", + "storageKey": null + }, (v10/*: any*/), - (v18/*: any*/), - (v19/*: any*/) + (v17/*: any*/), + (v18/*: any*/) ], "storageKey": null } @@ -602,8 +594,8 @@ return { "name": "filename", "storageKey": null }, - (v18/*: any*/), - (v19/*: any*/) + (v17/*: any*/), + (v18/*: any*/) ], "storageKey": null }, @@ -649,12 +641,12 @@ return { ] }, "params": { - "cacheID": "f0861cffe9c1b2e60c6408a69ce5690f", + "cacheID": "af3118fae0bbc255713aae845ab83032", "id": null, "metadata": {}, "name": "TrustGraphCurrentQuery", "operationKind": "query", - "text": "query TrustGraphCurrentQuery {\n viewer {\n email\n fullName\n id\n }\n currentTrustCenter {\n id\n slug\n isViewerMember\n hasAcceptedNonDisclosureAgreement\n logoFileUrl\n darkLogoFileUrl\n ndaFileName\n ndaFileUrl\n organization {\n name\n description\n websiteUrl\n email\n headquarterAddress\n id\n }\n ...OverviewPageFragment\n vendorInfo: vendors(first: 0) {\n totalCount\n }\n audits(first: 50) {\n edges {\n node {\n id\n ...AuditRowFragment\n }\n }\n }\n }\n}\n\nfragment AuditRowFragment on Audit {\n report {\n id\n filename\n isUserAuthorized\n hasUserRequestedAccess\n }\n framework {\n id\n name\n lightLogoURL\n darkLogoURL\n }\n}\n\nfragment DocumentRowFragment on Document {\n id\n title\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment OverviewPageFragment on TrustCenter {\n references(first: 14) {\n edges {\n node {\n id\n name\n logoUrl\n websiteUrl\n }\n }\n }\n vendors(first: 3) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n documents(first: 5) {\n edges {\n node {\n id\n ...DocumentRowFragment\n documentType\n }\n }\n }\n trustCenterFiles(first: 5) {\n edges {\n node {\n id\n category\n ...TrustCenterFileRowFragment\n }\n }\n }\n}\n\nfragment TrustCenterFileRowFragment on TrustCenterFile {\n id\n name\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment VendorRowFragment on Vendor {\n id\n name\n category\n websiteUrl\n privacyPolicyUrl\n countries\n}\n" + "text": "query TrustGraphCurrentQuery {\n viewer {\n email\n fullName\n id\n }\n currentTrustCenter {\n id\n slug\n isViewerMember\n hasAcceptedNonDisclosureAgreement\n logoFileUrl\n darkLogoFileUrl\n ndaFileName\n ndaFileUrl\n organization {\n name\n description\n websiteUrl\n email\n headquarterAddress\n id\n }\n ...OverviewPageFragment\n vendorInfo: vendors(first: 0) {\n totalCount\n }\n audits(first: 50) {\n edges {\n node {\n id\n ...AuditRowFragment\n }\n }\n }\n }\n}\n\nfragment AuditRowFragment on Audit {\n report {\n id\n filename\n isUserAuthorized\n hasUserRequestedAccess\n }\n framework {\n id\n name\n lightLogoURL\n darkLogoURL\n }\n}\n\nfragment DocumentRowFragment on Document {\n id\n title\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment OverviewPageFragment on TrustCenter {\n references(first: 14) {\n edges {\n node {\n id\n name\n logoUrl\n websiteUrl\n }\n }\n }\n vendors(first: 3) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n documents(first: 5) {\n edges {\n node {\n id\n ...DocumentRowFragment\n documentType\n }\n }\n }\n trustCenterFiles(first: 5) {\n edges {\n node {\n id\n category\n ...TrustCenterFileRowFragment\n }\n }\n }\n}\n\nfragment TrustCenterFileRowFragment on TrustCenterFile {\n id\n name\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment VendorRowFragment on Vendor {\n name\n description\n websiteUrl\n countries\n}\n" } }; })(); diff --git a/apps/trust/src/queries/__generated__/TrustGraphCurrentVendorsQuery.graphql.ts b/apps/trust/src/queries/__generated__/TrustGraphCurrentVendorsQuery.graphql.ts index 0b9949bd0..7a7d38d10 100644 --- a/apps/trust/src/queries/__generated__/TrustGraphCurrentVendorsQuery.graphql.ts +++ b/apps/trust/src/queries/__generated__/TrustGraphCurrentVendorsQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<185bfb58c14dbcc1d372726d2f435475>> * @lightSyntaxTransform * @nogrep */ @@ -197,7 +197,7 @@ return { "alias": null, "args": null, "kind": "ScalarField", - "name": "category", + "name": "description", "storageKey": null }, { @@ -206,13 +206,6 @@ return { "kind": "ScalarField", "name": "websiteUrl", "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "privacyPolicyUrl", - "storageKey": null } ], "storageKey": null @@ -229,12 +222,12 @@ return { ] }, "params": { - "cacheID": "9fde94112be0665245d50a25fd166d85", + "cacheID": "cb54aef75c2c7696abeea7ef139d99ce", "id": null, "metadata": {}, "name": "TrustGraphCurrentVendorsQuery", "operationKind": "query", - "text": "query TrustGraphCurrentVendorsQuery {\n currentTrustCenter {\n id\n organization {\n name\n id\n }\n vendors(first: 50) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n }\n}\n\nfragment VendorRowFragment on Vendor {\n id\n name\n category\n websiteUrl\n privacyPolicyUrl\n countries\n}\n" + "text": "query TrustGraphCurrentVendorsQuery {\n currentTrustCenter {\n id\n organization {\n name\n id\n }\n vendors(first: 50) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n }\n}\n\nfragment VendorRowFragment on Vendor {\n name\n description\n websiteUrl\n countries\n}\n" } }; })(); diff --git a/packages/helpers/src/countries.ts b/packages/helpers/src/countries.ts index 1af2de71b..5f1e3ac22 100644 --- a/packages/helpers/src/countries.ts +++ b/packages/helpers/src/countries.ts @@ -101,7 +101,7 @@ const countryNames: Record string> = { "ER": (__) => __("Eritrea"), "ES": (__) => __("Spain"), "ET": (__) => __("Ethiopia"), - "EU": (__) => __("European Union"), + "EU": (__) => __("EU"), "FI": (__) => __("Finland"), "FJ": (__) => __("Fiji"), "FK": (__) => __("Falkland Islands"), @@ -264,7 +264,7 @@ const countryNames: Record string> = { "UA": (__) => __("Ukraine"), "UG": (__) => __("Uganda"), "UM": (__) => __("United States Minor Outlying Islands"), - "US": (__) => __("United States"), + "US": (__) => __("USA"), "UY": (__) => __("Uruguay"), "UZ": (__) => __("Uzbekistan"), "VA": (__) => __("Vatican City"), diff --git a/pkg/server/api/trust/v1/schema.graphql b/pkg/server/api/trust/v1/schema.graphql index 93373b64b..05c93c638 100644 --- a/pkg/server/api/trust/v1/schema.graphql +++ b/pkg/server/api/trust/v1/schema.graphql @@ -431,6 +431,7 @@ enum VendorCategory type Vendor implements Node { id: ID! name: String! + description: String category: VendorCategory! websiteUrl: String privacyPolicyUrl: String diff --git a/pkg/server/api/trust/v1/schema/schema.go b/pkg/server/api/trust/v1/schema/schema.go index 88018e4c6..817496e57 100644 --- a/pkg/server/api/trust/v1/schema/schema.go +++ b/pkg/server/api/trust/v1/schema/schema.go @@ -247,6 +247,7 @@ type ComplexityRoot struct { Vendor struct { Category func(childComplexity int) int Countries func(childComplexity int) int + Description func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int PrivacyPolicyURL func(childComplexity int) int @@ -1051,6 +1052,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.complexity.Vendor.Countries(childComplexity), true + case "Vendor.description": + if e.complexity.Vendor.Description == nil { + break + } + + return e.complexity.Vendor.Description(childComplexity), true case "Vendor.id": if e.complexity.Vendor.ID == nil { break @@ -1662,6 +1669,7 @@ enum VendorCategory type Vendor implements Node { id: ID! name: String! + description: String category: VendorCategory! websiteUrl: String privacyPolicyUrl: String @@ -5881,6 +5889,35 @@ func (ec *executionContext) fieldContext_Vendor_name(_ context.Context, field gr return fc, nil } +func (ec *executionContext) _Vendor_description(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Vendor_description, + func(ctx context.Context) (any, error) { + return obj.Description, nil + }, + nil, + ec.marshalOString2áš–string, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Vendor_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Vendor_category(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -6157,6 +6194,8 @@ func (ec *executionContext) fieldContext_VendorEdge_node(_ context.Context, fiel return ec.fieldContext_Vendor_id(ctx, field) case "name": return ec.fieldContext_Vendor_name(ctx, field) + case "description": + return ec.fieldContext_Vendor_description(ctx, field) case "category": return ec.fieldContext_Vendor_category(ctx, field) case "websiteUrl": @@ -7976,7 +8015,11 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj } return ec._Audit(ctx, sel, obj) default: - panic(fmt.Errorf("unexpected type %T", obj)) + if typedObj, ok := obj.(graphql.Marshaler); ok { + return typedObj + } else { + panic(fmt.Errorf("unexpected type %T; non-generated variants of Node must implement graphql.Marshaler", obj)) + } } } @@ -10161,6 +10204,8 @@ func (ec *executionContext) _Vendor(ctx context.Context, sel ast.SelectionSet, o if out.Values[i] == graphql.Null { out.Invalids++ } + case "description": + out.Values[i] = ec._Vendor_description(ctx, field, obj) case "category": out.Values[i] = ec._Vendor_category(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/pkg/server/api/trust/v1/types/types.go b/pkg/server/api/trust/v1/types/types.go index f693cb6a0..72e380461 100644 --- a/pkg/server/api/trust/v1/types/types.go +++ b/pkg/server/api/trust/v1/types/types.go @@ -247,6 +247,7 @@ type TrustCenterReferenceEdge struct { type Vendor struct { ID gid.GID `json:"id"` Name string `json:"name"` + Description *string `json:"description,omitempty"` Category coredata.VendorCategory `json:"category"` WebsiteURL *string `json:"websiteUrl,omitempty"` PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` diff --git a/pkg/server/api/trust/v1/types/vendor.go b/pkg/server/api/trust/v1/types/vendor.go index fdc94bfe9..f737fabed 100644 --- a/pkg/server/api/trust/v1/types/vendor.go +++ b/pkg/server/api/trust/v1/types/vendor.go @@ -54,6 +54,7 @@ func NewVendor(v *coredata.Vendor) *Vendor { return &Vendor{ ID: v.ID, Name: v.Name, + Description: v.Description, Category: v.Category, WebsiteURL: v.WebsiteURL, PrivacyPolicyURL: v.PrivacyPolicyURL, diff --git a/pkg/server/api/trust/v1/v1_resolver.go b/pkg/server/api/trust/v1/v1_resolver.go index 90d3bab25..6c8025b95 100644 --- a/pkg/server/api/trust/v1/v1_resolver.go +++ b/pkg/server/api/trust/v1/v1_resolver.go @@ -3,7 +3,7 @@ package trust_v1 // This file will be automatically regenerated based on the schema, any resolver // implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.84 +// Code generated by github.com/99designs/gqlgen version v0.17.86 import ( "context"