Skip to content

Commit

Permalink
fix: organization prop contactPoint (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardolincetto committed Oct 30, 2022
1 parent e582244 commit 80dba3d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/organization.spec.js
Expand Up @@ -30,7 +30,7 @@ describe('Organization JSON-LD', () => {
postalCode: '95129',
addressCountry: 'US',
},
contactPoints: [
contactPoint: [
{
'@type': 'ContactPoint',
contactType: 'customer service',
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('Organization JSON-LD', () => {
addressCountry: 'France',
},
],
contactPoints: [
contactPoint: [
{
'@type': 'ContactPoint',
contactType: 'customer service',
Expand Down
4 changes: 2 additions & 2 deletions cypress/schemas/organization-schema.js
Expand Up @@ -49,7 +49,7 @@ const organization110 = {
description:
"Array of Organization's URL's, usually social urls like instagram, facebook etc.",
},
contactPoints: {
contactPoint: {
type: 'array',
items: {
...contactPoint100.schema,
Expand All @@ -73,7 +73,7 @@ const organization110 = {
legalName: 'Purple Fox LLC',
name: 'Purple Fox',
address: [address100.example],
contactPoints: [contactPoint100.example],
contactPoint: [contactPoint100.example],
sameAs: ['https://www.orange-fox.com'],
url: 'https://www.purpule-fox.io/',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/jsonld/organization/organization.tsx
Expand Up @@ -19,7 +19,7 @@ function Organization() {
postalCode: '95129',
addressCountry: 'US',
}}
contactPoints={[
contactPoint={[
{
contactType: 'customer service',
telephone: '+1-877-746-0909',
Expand Down
7 changes: 6 additions & 1 deletion src/jsonld/organization.tsx
Expand Up @@ -14,20 +14,25 @@ export interface OrganizationJsonLdProps extends JsonLdProps {
legalName?: string;
sameAs?: string[];
address?: Address | Address[];
/**
* @deprecated please use contactPoint instead. contactPoints will continue to work until next major release.
*/
contactPoints?: ContactPoint[];
contactPoint?: ContactPoint[];
}

function OrganizationJsonLd({
type = 'Organization',
keyOverride,
address,
contactPoints,
contactPoint,
...rest
}: OrganizationJsonLdProps) {
const data = {
...rest,
address: setAddress(address),
contactPoints: setContactPoints(contactPoints),
contactPoint: setContactPoints(contactPoint || contactPoints),
};
return (
<JsonLd
Expand Down

0 comments on commit 80dba3d

Please sign in to comment.