@anywayseo/tools 5.11.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/components/game-demo/index.d.ts +2 -6
  2. package/dist/components/index.cjs +3 -3
  3. package/dist/components/index.mjs +3 -3
  4. package/dist/components/seo/href-langs/index.d.ts +8 -0
  5. package/dist/components/seo/index.d.ts +3 -2
  6. package/dist/components/seo/json-ld/index.d.ts +7 -0
  7. package/dist/components/seo/types.d.ts +4 -3
  8. package/dist/components/seo/utils.d.ts +1 -0
  9. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/external-image/index.d.ts +1 -1
  10. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/index.d.ts +1 -1
  11. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/rich-text/index.d.ts +2 -1
  12. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/utils.d.ts +1 -1
  13. package/dist/hooks/index.cjs +1 -1
  14. package/dist/hooks/index.mjs +1 -1
  15. package/dist/i18n/index.cjs +24 -12
  16. package/dist/i18n/index.mjs +24 -12
  17. package/dist/i18n/resources/bn/index.d.ts +331 -0
  18. package/dist/i18n/resources/cs/index.d.ts +331 -0
  19. package/dist/i18n/resources/el/index.d.ts +331 -0
  20. package/dist/i18n/resources/hu/index.d.ts +331 -0
  21. package/dist/i18n/resources/nb/index.d.ts +331 -0
  22. package/dist/i18n/resources/nl/index.d.ts +331 -0
  23. package/dist/i18n/resources/pl/index.d.ts +331 -0
  24. package/dist/i18n/resources/ro/index.d.ts +331 -0
  25. package/dist/i18n/resources/sr/index.d.ts +331 -0
  26. package/dist/i18n/resources/sv/index.d.ts +331 -0
  27. package/dist/i18n/resources/tr/index.d.ts +331 -0
  28. package/dist/i18n/resources/uz/index.d.ts +331 -0
  29. package/dist/{index-DqMBmwe5.mjs → index-2sU4ya6z.mjs} +5 -6
  30. package/dist/{index-B6wLLS6t.mjs → index-B5WurBlm.mjs} +2 -2
  31. package/dist/{index-Ca9tsjT8.js → index-BAxlqkw0.js} +2 -2
  32. package/dist/{index-CG7F6SYt.mjs → index-BBU_vIrY.mjs} +68 -30
  33. package/dist/{index-C1kr7Vd-.mjs → index-BS5T9Il4.mjs} +1 -1
  34. package/dist/{index-RzByAgHO.mjs → index-C6A-3gBz.mjs} +4577 -432
  35. package/dist/{index-hGzNO4AL.js → index-C93pA9Jv.js} +69 -31
  36. package/dist/{index-C3n63_nP.js → index-CAjUjAgI.js} +1 -1
  37. package/dist/{index-CBRFCYhV.js → index-CMLDQbgR.js} +4577 -432
  38. package/dist/{index-DSP348cK.mjs → index-CQC6DRGf.mjs} +1 -1
  39. package/dist/index-CnVcCa5O.js +151 -0
  40. package/dist/index-CoNbTY7l.mjs +152 -0
  41. package/dist/{index-CVv755RW.js → index-CuIVcnIS.js} +1 -1
  42. package/dist/{index-DhhGhwm2.js → index-CxuOu0E2.js} +5 -6
  43. package/dist/{index-D-jM-cHx.js → index-DAPaiozu.js} +2 -2
  44. package/dist/index-MnQnVvsM.mjs +198 -0
  45. package/dist/index-P_fDAJVz.js +197 -0
  46. package/dist/{index-CPbWQKoT.mjs → index-TcBorTSf.mjs} +2 -2
  47. package/dist/index.cjs +20 -9
  48. package/dist/index.mjs +31 -20
  49. package/dist/layout/header/locale-switcher/icons/bangladesh/index.d.ts +2 -0
  50. package/dist/layout/header/locale-switcher/icons/belgium/index.d.ts +2 -0
  51. package/dist/layout/header/locale-switcher/icons/canada/index.d.ts +2 -0
  52. package/dist/layout/header/locale-switcher/icons/czechia/index.d.ts +2 -0
  53. package/dist/layout/header/locale-switcher/icons/greece/index.d.ts +2 -0
  54. package/dist/layout/header/locale-switcher/icons/hungary/index.d.ts +2 -0
  55. package/dist/layout/header/locale-switcher/icons/index.d.ts +20 -1
  56. package/dist/layout/header/locale-switcher/icons/india/index.d.ts +2 -0
  57. package/dist/layout/header/locale-switcher/icons/morocco/index.d.ts +2 -0
  58. package/dist/layout/header/locale-switcher/icons/netherlands/index.d.ts +2 -0
  59. package/dist/layout/header/locale-switcher/icons/nigeria/index.d.ts +2 -0
  60. package/dist/layout/header/locale-switcher/icons/norway/index.d.ts +2 -0
  61. package/dist/layout/header/locale-switcher/icons/poland/index.d.ts +2 -0
  62. package/dist/layout/header/locale-switcher/icons/romania/index.d.ts +2 -0
  63. package/dist/layout/header/locale-switcher/icons/serbia/index.d.ts +2 -0
  64. package/dist/layout/header/locale-switcher/icons/south-africa/index.d.ts +2 -0
  65. package/dist/layout/header/locale-switcher/icons/sweden/index.d.ts +2 -0
  66. package/dist/layout/header/locale-switcher/icons/switzerland/index.d.ts +2 -0
  67. package/dist/layout/header/locale-switcher/icons/turkey/index.d.ts +2 -0
  68. package/dist/layout/header/locale-switcher/icons/uzbekistan/index.d.ts +2 -0
  69. package/dist/layout/index.cjs +396 -52
  70. package/dist/layout/index.mjs +396 -52
  71. package/dist/providers/index.cjs +2 -2
  72. package/dist/providers/index.mjs +2 -2
  73. package/dist/providers/site-provider/index.d.ts +2 -1
  74. package/dist/types/api/index.d.ts +2 -16
  75. package/dist/types/api/strapi-navigation.d.ts +16 -0
  76. package/dist/types/api/strapi-page.d.ts +46 -0
  77. package/dist/types/components/game-demo/index.d.ts +5 -0
  78. package/dist/types/components/index.d.ts +1 -1
  79. package/dist/types/content/seo/index.d.ts +38 -1
  80. package/dist/types/i18n/index.d.ts +1 -1
  81. package/dist/types/index.d.ts +1 -1
  82. package/dist/types/json-ld/index.d.ts +162 -0
  83. package/dist/types/site/index.d.ts +9 -4
  84. package/dist/utils/api/index.d.ts +4 -2
  85. package/dist/utils/api/strapi-guards.d.ts +5 -0
  86. package/dist/utils/api/strapi-navigation.d.ts +2 -0
  87. package/dist/utils/api/strapi-seo.d.ts +13 -0
  88. package/dist/utils/index.cjs +14 -3
  89. package/dist/utils/index.d.ts +1 -0
  90. package/dist/utils/index.mjs +25 -14
  91. package/dist/utils/json-ld/index.d.ts +70 -0
  92. package/dist/utils/navigation/index.d.ts +1 -1
  93. package/package.json +1 -1
  94. package/dist/components/strapi-content-renderer/utils.d.ts +0 -2
  95. package/dist/index-Ba_pXx_e.js +0 -97
  96. package/dist/index-BeJTy4iY.mjs +0 -26
  97. package/dist/index-BfITsKAr.js +0 -25
  98. package/dist/index-CJANSiM5.mjs +0 -98
  99. package/dist/types/components/strapi-component/index.d.ts +0 -5
  100. package/dist/types/page/index.d.ts +0 -7
@@ -0,0 +1,16 @@
1
+ export interface IStrapiNavigation {
2
+ readonly items: ReadonlyArray<IStrapiNavigationGroup | null> | null;
3
+ }
4
+ export interface IStrapiNavigationGroup {
5
+ readonly locale: string | null;
6
+ readonly slug: string | null;
7
+ readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
8
+ }
9
+ export interface IStrapiNavigationItem {
10
+ readonly type: string | null;
11
+ readonly title: string | null;
12
+ readonly slug: string | null;
13
+ readonly path: string | null;
14
+ readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
15
+ readonly menuAttached?: boolean | null;
16
+ }
@@ -0,0 +1,46 @@
1
+ import { Nullable } from '../common';
2
+ import { IGatsbyImageData } from '../components';
3
+ import { IHrefLang } from '../content';
4
+ export interface IStrapiAuthor {
5
+ readonly name: string;
6
+ readonly role: string;
7
+ readonly bio: string;
8
+ readonly avatar: {
9
+ readonly localFile: {
10
+ readonly childImageSharp: {
11
+ readonly gatsbyImageData: IGatsbyImageData | null;
12
+ } | null;
13
+ } | null;
14
+ };
15
+ readonly socialNetworks: {
16
+ readonly items: ReadonlyArray<{
17
+ readonly kind: string;
18
+ readonly url: string;
19
+ }> | null;
20
+ } | null;
21
+ }
22
+ export type StrapiComponentType = 'STRAPI__COMPONENT_CONTENT_ACTION_BUTTON' | 'STRAPI__COMPONENT_CONTENT_ARTICLE_CARDS' | 'STRAPI__COMPONENT_CONTENT_ARTICLE_INFO' | 'STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE' | 'STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE' | 'STRAPI__COMPONENT_CONTENT_FAQ' | 'STRAPI__COMPONENT_CONTENT_FEATURES' | 'STRAPI__COMPONENT_CONTENT_GAME_CARDS' | 'STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS' | 'STRAPI__COMPONENT_CONTENT_GAME_DEMO' | 'STRAPI__COMPONENT_CONTENT_GAME_INFO' | 'STRAPI__COMPONENT_CONTENT_HOW_TO' | 'STRAPI__COMPONENT_CONTENT_INFORMER' | 'STRAPI__COMPONENT_CONTENT_LIST' | 'STRAPI__COMPONENT_CONTENT_MEDIA' | 'STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE' | 'STRAPI__COMPONENT_CONTENT_PROS_CONS' | 'STRAPI__COMPONENT_CONTENT_RICH_TEXT' | 'STRAPI__COMPONENT_CONTENT_TABLE' | 'STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE' | 'STRAPI__COMPONENT_CONTENT_TIP';
23
+ export interface IStrapiComponentFragment {
24
+ __typename: StrapiComponentType;
25
+ [prop: string]: unknown;
26
+ }
27
+ export interface IStrapiRichText {
28
+ readonly data: {
29
+ readonly content: Nullable<string>;
30
+ };
31
+ }
32
+ export interface IStrapiPageData {
33
+ readonly locale: Nullable<string>;
34
+ readonly createdAt: Nullable<string>;
35
+ readonly updatedAt: Nullable<string>;
36
+ readonly canonicalUrl: Nullable<string>;
37
+ readonly seo: Nullable<{
38
+ readonly metaTitle: Nullable<string>;
39
+ readonly metaDescription: Nullable<string>;
40
+ }>;
41
+ readonly author: Nullable<IStrapiAuthor>;
42
+ readonly content: Nullable<Nullable<IStrapiComponentFragment>[]>;
43
+ }
44
+ export interface IStrapiPageContext {
45
+ hrefLangs?: IHrefLang[];
46
+ }
@@ -0,0 +1,5 @@
1
+ export interface IGameDemo {
2
+ name: string;
3
+ src?: string;
4
+ refLink?: string;
5
+ }
@@ -7,6 +7,7 @@ export * from './common';
7
7
  export * from './external-image';
8
8
  export * from './faq';
9
9
  export * from './game-card';
10
+ export * from './game-demo';
10
11
  export * from './game-info';
11
12
  export * from './grid';
12
13
  export * from './how-to';
@@ -18,5 +19,4 @@ export * from './locale-switcher';
18
19
  export * from './navigation';
19
20
  export * from './pros-cons';
20
21
  export * from './social-network';
21
- export * from './strapi-component';
22
22
  export * from './tabs';
@@ -1,4 +1,41 @@
1
- export interface ISeo {
1
+ export interface ISeoMetadata {
2
2
  title: string;
3
3
  description: string;
4
4
  }
5
+ export interface IHrefLang {
6
+ href: string;
7
+ hrefLang: string;
8
+ }
9
+ interface IStructuredDataAuthor {
10
+ name: string;
11
+ url?: string;
12
+ }
13
+ interface IStructuredDataRating {
14
+ value: number;
15
+ min?: number;
16
+ max?: number;
17
+ }
18
+ interface IStructuredDataReview {
19
+ title: string;
20
+ description: string;
21
+ publishedAt: string;
22
+ updatedAt?: string;
23
+ rating?: IStructuredDataRating;
24
+ }
25
+ interface IStructuredDataGame {
26
+ name: string;
27
+ genre?: string;
28
+ }
29
+ export interface IStructuredDataContent {
30
+ author?: IStructuredDataAuthor;
31
+ review?: IStructuredDataReview;
32
+ game?: IStructuredDataGame;
33
+ }
34
+ type StructuredDataFormat = 'json-ld';
35
+ type StructuredDataEntity = 'game-review';
36
+ export interface IStructuredData {
37
+ format: StructuredDataFormat;
38
+ entity: StructuredDataEntity;
39
+ content: IStructuredDataContent;
40
+ }
41
+ export {};
@@ -1,4 +1,4 @@
1
- export type LanguageCode = 'en' | 'es' | 'it' | 'de' | 'fr' | 'ru' | 'pt' | 'ka' | 'fi' | 'bg' | 'da';
1
+ export type LanguageCode = 'en' | 'es' | 'it' | 'de' | 'fr' | 'ru' | 'pt' | 'ka' | 'fi' | 'bg' | 'da' | 'bn' | 'nl' | 'hu' | 'el' | 'nb' | 'pl' | 'ro' | 'sr' | 'tr' | 'uz' | 'cs' | 'sv';
2
2
  type SpanishSpeakingCurrencyCode = 'ARS' | 'BOB' | 'CLP' | 'COP' | 'CRC' | 'CUP' | 'DOP' | 'USD' | 'BTC' | 'XAF' | 'GTQ' | 'HNL' | 'MXN' | 'NIO' | 'PAB' | 'PYG' | 'PEN' | 'EUR' | 'UYU' | 'VES';
3
3
  export type Currency = 'USD' | 'EUR' | 'GBP' | 'RUB' | 'BRL' | SpanishSpeakingCurrencyCode;
4
4
  type LocaleCode = string;
@@ -3,6 +3,6 @@ export * from './common';
3
3
  export * from './components';
4
4
  export * from './content';
5
5
  export * from './i18n';
6
- export * from './page';
6
+ export * from './json-ld';
7
7
  export * from './site';
8
8
  export * from './theme';
@@ -0,0 +1,162 @@
1
+ /** Values */
2
+ type URL = string;
3
+ type Date = string;
4
+ type DateTime = string;
5
+ type Language = string;
6
+ /** Schema */
7
+ type SchemaId = string;
8
+ type SchemaType = ThingType | OrganizationType | PersonType | IntangibleType | CreativeWorkType;
9
+ export interface Schema<T extends SchemaType = SchemaType> {
10
+ '@type': T;
11
+ '@id'?: SchemaId;
12
+ }
13
+ export type SchemaRef<T extends Schema = Schema> = Required<Pick<T, '@id'>>;
14
+ /** Root Schema */
15
+ export interface Schemas {
16
+ website?: WebSiteSchema;
17
+ organization?: OrganizationSchema;
18
+ webpage?: WebPageSchema<Schema>;
19
+ }
20
+ export type JsonLdSchema = {
21
+ '@context': 'https://schema.org';
22
+ '@graph': Schema[];
23
+ };
24
+ /**
25
+ * --------------------------------------------------------------------
26
+ * ENTITIES
27
+ * --------------------------------------------------------------------
28
+ */
29
+ /** Thing Schema */
30
+ type ThingType = 'Thing';
31
+ interface Thing<T extends SchemaType> extends Schema<T> {
32
+ name?: string;
33
+ description?: string;
34
+ url?: URL;
35
+ image?: URL | ImageObjectSchema;
36
+ sameAs?: URL | URL[];
37
+ }
38
+ export interface ThingSchema extends Thing<'Thing'> {
39
+ }
40
+ /** Organization Schemas */
41
+ type OrganizationType = 'Organization';
42
+ interface Organization<T extends OrganizationType> extends Thing<T> {
43
+ logo?: URL | ImageObjectSchema;
44
+ }
45
+ export interface OrganizationSchema extends Organization<'Organization'> {
46
+ }
47
+ /** Person Schema */
48
+ type PersonType = 'Person';
49
+ interface Person<T extends PersonType> extends Thing<T> {
50
+ givenName?: string;
51
+ familyName?: string;
52
+ email?: string;
53
+ jobTitle?: string;
54
+ }
55
+ export interface PersonSchema extends Person<'Person'> {
56
+ }
57
+ /** Intangible Schemas */
58
+ type IntangibleType = 'DefinedTerm' | StructuredValueType | RatingType | 'ItemList' | 'ListItem' | 'HowToSection' | 'HowToStep';
59
+ interface Intangible<T extends IntangibleType> extends Thing<T> {
60
+ }
61
+ type StructuredValueType = 'StructuredValue';
62
+ interface StructuredValue extends Intangible<'StructuredValue'> {
63
+ }
64
+ interface DefinedTerm extends Intangible<'DefinedTerm'> {
65
+ about?: string;
66
+ }
67
+ type RatingType = 'Rating' | 'AggregateRating';
68
+ interface Rating<T extends RatingType> extends Intangible<T> {
69
+ ratingValue?: number | string;
70
+ bestRating?: number | string;
71
+ worstRating?: number | string;
72
+ ratingExplanation?: string;
73
+ reviewAspect?: string;
74
+ }
75
+ export interface RatingSchema extends Rating<'Rating'> {
76
+ }
77
+ export interface AggregateRatingSchema extends Rating<'AggregateRating'> {
78
+ itemReviewed: Thing<SchemaType>;
79
+ ratingCount?: number;
80
+ reviewCount?: number;
81
+ }
82
+ type ItemListOrderType = 'https://schema.org/ItemListOrderAscending' | 'https://schema.org/ItemListOrderDescending' | 'https://schema.org/ItemListUnordered' | 'ItemListOrderAscending' | 'ItemListOrderDescending' | 'ItemListUnordered';
83
+ interface ItemList extends Intangible<'ItemList'> {
84
+ itemListElement?: ListItem[];
85
+ itemListOrder?: ItemListOrderType | string;
86
+ numberOfItems?: number;
87
+ aggregateElement?: Thing<SchemaType>;
88
+ }
89
+ interface ListItem extends Intangible<'ListItem'> {
90
+ item?: Thing<SchemaType>;
91
+ position?: number | string;
92
+ nextItem?: SchemaRef<ListItem>;
93
+ previousItem?: SchemaRef<ListItem>;
94
+ }
95
+ interface HowToSection extends Intangible<'HowToSection'> {
96
+ steps?: ItemList | HowToStep | string;
97
+ }
98
+ export interface HowToSectionSchema extends HowToSection {
99
+ }
100
+ interface HowToStep extends Intangible<'HowToStep'> {
101
+ text?: string;
102
+ position?: number | string;
103
+ }
104
+ /** Creative Work Schemas */
105
+ type CreativeWorkType = 'CreativeWork' | MediaObjectType | 'WebSite' | 'WebPage' | 'Review' | GameType | 'Article';
106
+ interface CreativeWork<T extends CreativeWorkType> extends Thing<T> {
107
+ author?: Person<PersonType> | Person<PersonType>[] | Organization<OrganizationType> | Organization<OrganizationType>[];
108
+ datePublished?: Date | DateTime;
109
+ dateCreated?: Date | DateTime;
110
+ dateModified?: Date | DateTime;
111
+ headline?: string;
112
+ abstract?: string;
113
+ inLanguage?: Language | string;
114
+ keywords?: string | DefinedTerm | URL | Array<string | DefinedTerm | URL>;
115
+ license?: CreativeWork<CreativeWorkType> | URL;
116
+ publisher?: Organization<OrganizationType> | Person<PersonType> | SchemaRef<OrganizationSchema> | SchemaRef<PersonSchema>;
117
+ editor?: Person<PersonType>;
118
+ creator?: Organization<OrganizationType> | Person<PersonType>;
119
+ about?: Thing<SchemaType>;
120
+ text?: string;
121
+ thumbnailUrl?: URL;
122
+ copyrightHolder?: Organization<OrganizationType> | Person<PersonType>;
123
+ copyrightYear?: number;
124
+ genre?: DefinedTerm | string | URL;
125
+ aggregateRating?: AggregateRatingSchema;
126
+ review?: ReviewSchema<Schema<SchemaType>> | ReviewSchema<Schema<SchemaType>>[];
127
+ version?: number | string;
128
+ }
129
+ type MediaObjectType = ImageObjectType;
130
+ interface MediaObject<T extends MediaObjectType> extends CreativeWork<T> {
131
+ contentUrl?: URL;
132
+ width?: number | string;
133
+ height?: number | string;
134
+ }
135
+ type ImageObjectType = 'ImageObject';
136
+ interface ImageObject<T extends ImageObjectType> extends MediaObject<T> {
137
+ caption?: string;
138
+ }
139
+ export interface ImageObjectSchema extends ImageObject<'ImageObject'> {
140
+ }
141
+ export interface ReviewSchema<T extends Schema<SchemaType>> extends CreativeWork<'Review'> {
142
+ itemReviewed: T;
143
+ reviewBody?: string;
144
+ reviewRating?: RatingSchema;
145
+ reviewAspect?: StructuredValue | string;
146
+ positiveNotes?: ItemList | ListItem | string;
147
+ negativeNotes?: ItemList | ListItem | string;
148
+ }
149
+ type GameType = 'Game';
150
+ interface Game<T extends GameType> extends CreativeWork<T> {
151
+ characterAttribute?: Thing<SchemaType>;
152
+ gameItem?: Thing<SchemaType> | Thing<SchemaType>[];
153
+ }
154
+ export interface GameSchema extends Game<'Game'> {
155
+ }
156
+ export interface WebSiteSchema extends CreativeWork<'WebSite'> {
157
+ }
158
+ export interface WebPageSchema<T extends Schema<SchemaType>> extends CreativeWork<'WebPage'> {
159
+ isPartOf: SchemaRef<WebSiteSchema>;
160
+ mainEntity?: T;
161
+ }
162
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { GridColumns, ImageType, INavigation, ISocialNetwork } from '../components';
3
- import { ISeo } from '../content';
3
+ import { ISeoMetadata } from '../content';
4
4
  import { Currency, ILocale } from '../i18n';
5
5
  interface ISiteHeaderConfig {
6
6
  toolbar?: ReactNode;
@@ -27,11 +27,16 @@ export interface ISiteLocalization {
27
27
  defaultLocale: ILocale;
28
28
  locales: ILocale[];
29
29
  }
30
+ export interface ISiteLogo {
31
+ src: ImageType;
32
+ alt: string;
33
+ url: string;
34
+ width: number;
35
+ height: number;
36
+ }
30
37
  export interface ISiteMetadata {
31
38
  name: string;
32
- lang: ILocale['code'];
33
- seo: ISeo;
34
- logo: ImageType;
39
+ seo: ISeoMetadata;
35
40
  socialNetworks?: ISocialNetwork[];
36
41
  /** Planned */
37
42
  favicon?: ImageType;
@@ -1,5 +1,7 @@
1
- import { ILocale, ISiteNavigation, IStrapiNavigation } from '../../types';
2
- export declare function getNavigation(fallback: ISiteNavigation, strapiNavigation?: IStrapiNavigation | null): ISiteNavigation;
1
+ import { ILocale } from '../../types';
2
+ export * from './strapi-guards';
3
+ export * from './strapi-navigation';
4
+ export * from './strapi-seo';
3
5
  export declare function getSiteName(url?: string | null): string;
4
6
  export declare function getLocale(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale;
5
7
  export declare function getLocales(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale[];
@@ -0,0 +1,5 @@
1
+ import { IStrapiComponentFragment, IStrapiPageContext, IStrapiPageData, IStrapiRichText } from '../../types';
2
+ export declare function isStrapiContent(array: unknown): array is IStrapiComponentFragment[];
3
+ export declare function isStrapiRichText(value?: unknown): value is IStrapiRichText;
4
+ export declare function isStrapiPageData(data: unknown): data is Partial<IStrapiPageData>;
5
+ export declare function isStrapiPageContext(context: unknown): context is Partial<IStrapiPageContext>;
@@ -0,0 +1,2 @@
1
+ import { ISiteNavigation, IStrapiNavigation } from '../../types';
2
+ export declare function getNavigation(fallback: ISiteNavigation, strapiNavigation?: IStrapiNavigation | null): ISiteNavigation;
@@ -0,0 +1,13 @@
1
+ import { IHrefLang, ILocale, ISeoMetadata, IStructuredData, Nullable } from '../../types';
2
+ interface ISeoData {
3
+ locale: Nullable<ILocale['code']>;
4
+ meta: {
5
+ title: Nullable<ISeoMetadata['title']>;
6
+ description: Nullable<ISeoMetadata['description']>;
7
+ };
8
+ canonicalUrl: Nullable<string>;
9
+ hrefLangs: IHrefLang[];
10
+ structuredData: Nullable<IStructuredData>;
11
+ }
12
+ export declare function extractSeoData(pageData: unknown, pageContext?: unknown): ISeoData;
13
+ export {};
@@ -1,18 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const index = require("../index-C6MG_f24.js");
4
- const index$1 = require("../index-Ba_pXx_e.js");
5
- const index$2 = require("../index-BfITsKAr.js");
4
+ const index$1 = require("../index-P_fDAJVz.js");
5
+ const index$2 = require("../index-CnVcCa5O.js");
6
6
  const index$3 = require("../index-ov4J7p3D.js");
7
- const index$4 = require("../index-C3n63_nP.js");
7
+ const index$4 = require("../index-CAjUjAgI.js");
8
8
  const index$5 = require("../index-CbuiYkSg.js");
9
9
  exports.Animation = index.Animation;
10
+ exports.extractSeoData = index$1.extractSeoData;
10
11
  exports.getLocale = index$1.getLocale;
11
12
  exports.getLocales = index$1.getLocales;
12
13
  exports.getNavigation = index$1.getNavigation;
13
14
  exports.getSiteName = index$1.getSiteName;
15
+ exports.buildGameReviewSchema = index$2.buildGameReviewSchema;
16
+ exports.buildGraph = index$2.buildGraph;
17
+ exports.buildOrganizationSchema = index$2.buildOrganizationSchema;
18
+ exports.buildWebpageSchema = index$2.buildWebpageSchema;
19
+ exports.buildWebsiteSchema = index$2.buildWebsiteSchema;
14
20
  exports.getCurrencySymbol = index$2.getCurrencySymbol;
21
+ exports.getEntitySchema = index$2.getEntitySchema;
15
22
  exports.getSeededRandomComparator = index$2.getSeededRandomComparator;
23
+ exports.isStrapiContent = index$2.isStrapiContent;
24
+ exports.isStrapiPageContext = index$2.isStrapiPageContext;
25
+ exports.isStrapiPageData = index$2.isStrapiPageData;
26
+ exports.isStrapiRichText = index$2.isStrapiRichText;
16
27
  exports.randomComparator = index$2.randomComparator;
17
28
  exports.formatDate = index$3.formatDate;
18
29
  exports.formatNumber = index$3.formatNumber;
@@ -2,6 +2,7 @@ export * from './animation';
2
2
  export * from './api';
3
3
  export * from './currency';
4
4
  export * from './date';
5
+ export * from './json-ld';
5
6
  export * from './navigation';
6
7
  export * from './numbers';
7
8
  export * from './sorting';
@@ -1,27 +1,38 @@
1
1
  import { A } from "../index-BJRvnR8Q.mjs";
2
- import { b, c, g, a } from "../index-CJANSiM5.mjs";
3
- import { g as g2, a as a2, r } from "../index-BeJTy4iY.mjs";
4
- import { f, b as b2, a as a3, g as g3, r as r2, t } from "../index-BPthShL-.mjs";
5
- import { a as a4, b as b3, c as c2, i } from "../index-DSP348cK.mjs";
2
+ import { e, a, b, c, g } from "../index-MnQnVvsM.mjs";
3
+ import { k, d, e as e2, j, f, g as g2, h, l, i, c as c2, b as b2, a as a2, r } from "../index-CoNbTY7l.mjs";
4
+ import { f as f2, b as b3, a as a3, g as g3, r as r2, t } from "../index-BPthShL-.mjs";
5
+ import { a as a4, b as b4, c as c3, i as i2 } from "../index-CQC6DRGf.mjs";
6
6
  import { D, L } from "../index-BRVKhbs6.mjs";
7
7
  export {
8
8
  A as Animation,
9
9
  D as DARK_THEME_COLOR,
10
10
  L as LIGHT_THEME_COLOR,
11
11
  a4 as buildCanonicalUrl,
12
- b3 as buildPath,
13
- f as formatDate,
14
- b2 as formatNumber,
12
+ k as buildGameReviewSchema,
13
+ d as buildGraph,
14
+ e2 as buildOrganizationSchema,
15
+ b4 as buildPath,
16
+ j as buildWebpageSchema,
17
+ f as buildWebsiteSchema,
18
+ e as extractSeoData,
19
+ f2 as formatDate,
20
+ b3 as formatNumber,
15
21
  g2 as getCurrencySymbol,
16
22
  a3 as getCurrentMonth,
17
23
  g3 as getCurrentYear,
18
- b as getLocale,
19
- c as getLocales,
20
- g as getNavigation,
21
- a2 as getSeededRandomComparator,
22
- a as getSiteName,
23
- c2 as isAbsolutePath,
24
- i as isRelativePath,
24
+ h as getEntitySchema,
25
+ a as getLocale,
26
+ b as getLocales,
27
+ c as getNavigation,
28
+ l as getSeededRandomComparator,
29
+ g as getSiteName,
30
+ c3 as isAbsolutePath,
31
+ i2 as isRelativePath,
32
+ i as isStrapiContent,
33
+ c2 as isStrapiPageContext,
34
+ b2 as isStrapiPageData,
35
+ a2 as isStrapiRichText,
25
36
  r as randomComparator,
26
37
  r2 as round,
27
38
  t as toFixedTwo
@@ -0,0 +1,70 @@
1
+ import { GameSchema, ILocale, ISiteLogo, IStructuredData, Nullable, OrganizationSchema, ReviewSchema, Schema, Schemas, WebPageSchema, WebSiteSchema } from '../../types';
2
+ export declare function buildGraph(schemas: Schemas): Schema[];
3
+ interface BuildOrganizationSchemaParams {
4
+ site: {
5
+ url: string;
6
+ name: string;
7
+ logo: ISiteLogo;
8
+ };
9
+ lang: ILocale['code'];
10
+ }
11
+ export declare function buildOrganizationSchema(params: BuildOrganizationSchemaParams): OrganizationSchema;
12
+ interface BuildWebsiteSchemaParams {
13
+ site: {
14
+ url: string;
15
+ name: string;
16
+ };
17
+ lang: ILocale['code'];
18
+ }
19
+ export declare function buildWebsiteSchema(params: BuildWebsiteSchemaParams): WebSiteSchema;
20
+ interface GetEntitySchemaParams {
21
+ site: {
22
+ url: string;
23
+ };
24
+ page: {
25
+ url: string;
26
+ };
27
+ structuredData?: Nullable<IStructuredData>;
28
+ }
29
+ export declare function getEntitySchema({ site, page, structuredData }: GetEntitySchemaParams): Nullable<Schema>;
30
+ interface BuildWebpageSchemaParams {
31
+ site: {
32
+ url: string;
33
+ };
34
+ page: {
35
+ url: string;
36
+ title: string;
37
+ description?: string;
38
+ };
39
+ lang: ILocale['code'];
40
+ }
41
+ export declare function buildWebpageSchema<Entity extends Schema>(params: BuildWebpageSchemaParams, mainEntity?: Entity | null): WebPageSchema<Entity>;
42
+ interface BuildGameReviewSchemaParams {
43
+ site: {
44
+ url: string;
45
+ };
46
+ page: {
47
+ url: string;
48
+ };
49
+ author?: {
50
+ name: string;
51
+ url?: string;
52
+ };
53
+ review: {
54
+ title: string;
55
+ description: string;
56
+ publishedAt: string;
57
+ updatedAt?: string;
58
+ rating?: {
59
+ value: number;
60
+ min?: number;
61
+ max?: number;
62
+ };
63
+ };
64
+ game: {
65
+ name: string;
66
+ genre?: string;
67
+ };
68
+ }
69
+ export declare function buildGameReviewSchema(params: BuildGameReviewSchemaParams): ReviewSchema<GameSchema>;
70
+ export {};
@@ -1,4 +1,4 @@
1
1
  export declare function buildPath(slug: string, parentSlug: string): string;
2
- export declare function buildCanonicalUrl(domain: string, path: string): string;
2
+ export declare function buildCanonicalUrl(domain: string, path?: string): string;
3
3
  export declare function isRelativePath(path?: string): boolean;
4
4
  export declare function isAbsolutePath(path?: string): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "5.11.0",
4
+ "version": "6.1.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -1,2 +0,0 @@
1
- import { IStrapiComponentFragment } from '../../types';
2
- export declare function isStrapiContent(array: unknown): array is IStrapiComponentFragment[];
@@ -1,97 +0,0 @@
1
- "use strict";
2
- const index = require("./index-C3n63_nP.js");
3
- const DUMMY_PAGE_TYPE = "DUMMY";
4
- const NavigationSlug = {
5
- HEADER: "header-navigation",
6
- FOOTER: "footer-navigation"
7
- };
8
- function isValidPath(value) {
9
- return typeof value === "string" && (value === "" || index.isRelativePath(value));
10
- }
11
- function isValidType(value) {
12
- return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
13
- }
14
- function isValidTitle(value) {
15
- return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
16
- }
17
- function transformNavItems(items) {
18
- if (!items || !items.length) {
19
- return [];
20
- }
21
- const transformed = [];
22
- items.forEach((item) => {
23
- var _a;
24
- if (item && isValidTitle(item.title) && isValidType(item.type) && isValidPath(item.path)) {
25
- const isNavGroup = (_a = item.items) == null ? void 0 : _a.length;
26
- transformed.push({
27
- label: item.title,
28
- slug: isNavGroup ? "" : item.path.slice(1),
29
- ...isNavGroup && { children: transformNavItems(item.items) }
30
- });
31
- }
32
- });
33
- return transformed;
34
- }
35
- function transformSiteNavigation(strapiNavigation) {
36
- const siteNavigation = {
37
- header: {},
38
- footer: {}
39
- };
40
- if (!strapiNavigation) {
41
- return siteNavigation;
42
- }
43
- const groups = strapiNavigation.items;
44
- for (const group of groups ?? []) {
45
- const { slug, locale, items } = group ?? {};
46
- if (locale && slug === NavigationSlug.HEADER) {
47
- siteNavigation.header[locale] = transformNavItems(items ?? []);
48
- }
49
- if (locale && slug === NavigationSlug.FOOTER) {
50
- siteNavigation.footer[locale] = transformNavItems(items ?? []);
51
- }
52
- }
53
- return siteNavigation;
54
- }
55
- function getNavigation(fallback, strapiNavigation) {
56
- const siteNavigation = {
57
- header: fallback.header,
58
- footer: fallback.footer
59
- };
60
- if (!strapiNavigation) {
61
- return siteNavigation;
62
- }
63
- const navigation = transformSiteNavigation(strapiNavigation);
64
- siteNavigation.header = { ...siteNavigation.header, ...navigation.header };
65
- siteNavigation.footer = { ...siteNavigation.footer, ...navigation.footer };
66
- return siteNavigation;
67
- }
68
- function getSiteName(url) {
69
- if (!url) {
70
- return "";
71
- }
72
- return url.replace(/^https?:\/\//, "");
73
- }
74
- function getLocale(defaultLocaleCode, locales) {
75
- let locale = { code: "en", name: "Default" };
76
- if (defaultLocaleCode && (locales == null ? void 0 : locales.length)) {
77
- const foundLocale = locales.find(({ code }) => code === defaultLocaleCode);
78
- if (foundLocale) {
79
- locale = foundLocale;
80
- }
81
- }
82
- return locale;
83
- }
84
- function getLocales(defaultLocaleCode, locales) {
85
- if (!locales) {
86
- return [];
87
- }
88
- return [...locales].sort((a, b) => {
89
- if (a.code === defaultLocaleCode) return -1;
90
- if (b.code === defaultLocaleCode) return 1;
91
- return 0;
92
- });
93
- }
94
- exports.getLocale = getLocale;
95
- exports.getLocales = getLocales;
96
- exports.getNavigation = getNavigation;
97
- exports.getSiteName = getSiteName;