@masters-ws/react-seo 1.1.0 → 1.2.1

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.
@@ -0,0 +1,538 @@
1
+ interface SiteConfig {
2
+ name: string;
3
+ description: string;
4
+ url: string;
5
+ logo?: string;
6
+ publisher?: string;
7
+ twitterHandle?: string;
8
+ facebookAppId?: string;
9
+ language?: string;
10
+ socialLinks?: string[];
11
+ googleAnalyticsId?: string;
12
+ gtmId?: string;
13
+ facebookPixelId?: string;
14
+ yandexMetricaId?: string;
15
+ themeColor?: string;
16
+ manifest?: string;
17
+ }
18
+ interface SEOData {
19
+ title?: string;
20
+ description?: string;
21
+ image?: string;
22
+ canonical?: string;
23
+ type?: 'website' | 'article' | 'product' | 'profile' | 'video' | 'faq';
24
+ robots?: string;
25
+ noindex?: boolean;
26
+ keywords?: string[];
27
+ prev?: string;
28
+ next?: string;
29
+ alternates?: Array<{
30
+ hreflang: string;
31
+ href: string;
32
+ }>;
33
+ ogTitle?: string;
34
+ ogDescription?: string;
35
+ ogImage?: string;
36
+ ogImageWidth?: number;
37
+ ogImageHeight?: number;
38
+ ogImageAlt?: string;
39
+ ogType?: string;
40
+ ogLocale?: string;
41
+ twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player';
42
+ twitterTitle?: string;
43
+ twitterDescription?: string;
44
+ twitterImage?: string;
45
+ twitterImageAlt?: string;
46
+ publishedTime?: string;
47
+ modifiedTime?: string;
48
+ author?: {
49
+ name: string;
50
+ url?: string;
51
+ image?: string;
52
+ };
53
+ tags?: string[];
54
+ section?: string;
55
+ readingTime?: number;
56
+ product?: {
57
+ sku?: string;
58
+ brand?: string;
59
+ price?: number;
60
+ currency?: string;
61
+ availability?: string;
62
+ rating?: number;
63
+ reviewCount?: number;
64
+ };
65
+ dnsPrefetch?: string[];
66
+ preconnect?: string[];
67
+ prefetch?: string[];
68
+ preload?: Array<{
69
+ href: string;
70
+ as: string;
71
+ type?: string;
72
+ }>;
73
+ whatsappImage?: string;
74
+ whatsappDescription?: string;
75
+ schema?: any;
76
+ }
77
+ interface BreadcrumbItem {
78
+ name: string;
79
+ item: string;
80
+ }
81
+
82
+ /**
83
+ * Generate Organization Schema
84
+ */
85
+ declare function generateOrganizationSchema(config: SiteConfig): {
86
+ "@context": string;
87
+ "@type": string;
88
+ name: string;
89
+ url: string;
90
+ logo: string | undefined;
91
+ sameAs: string[];
92
+ };
93
+ /**
94
+ * Generate WebSite Schema with SearchAction
95
+ */
96
+ declare function generateWebSiteSchema(config: SiteConfig): {
97
+ "@context": string;
98
+ "@type": string;
99
+ name: string;
100
+ url: string;
101
+ potentialAction: {
102
+ "@type": string;
103
+ target: string;
104
+ "query-input": string;
105
+ };
106
+ };
107
+ /**
108
+ * Generate NewsArticle Schema
109
+ */
110
+ declare function generateArticleSchema(data: {
111
+ title: string;
112
+ description: string;
113
+ image?: string;
114
+ publishedTime?: string;
115
+ modifiedTime?: string;
116
+ author?: {
117
+ name: string;
118
+ url?: string;
119
+ };
120
+ url?: string;
121
+ }, config: SiteConfig): {
122
+ "@context": string;
123
+ "@type": string;
124
+ headline: string;
125
+ description: string;
126
+ image: string | undefined;
127
+ datePublished: string | undefined;
128
+ dateModified: string | undefined;
129
+ mainEntityOfPage: string | undefined;
130
+ author: {
131
+ "@context": string;
132
+ "@type": string;
133
+ name: string;
134
+ url: string;
135
+ logo: string | undefined;
136
+ sameAs: string[];
137
+ } | {
138
+ "@type": string;
139
+ name: string;
140
+ url: string | undefined;
141
+ };
142
+ publisher: {
143
+ "@context": string;
144
+ "@type": string;
145
+ name: string;
146
+ url: string;
147
+ logo: string | undefined;
148
+ sameAs: string[];
149
+ };
150
+ };
151
+ /**
152
+ * Generate Product Schema
153
+ */
154
+ declare function generateProductSchema(data: {
155
+ name: string;
156
+ description: string;
157
+ image?: string;
158
+ sku?: string;
159
+ brand?: string;
160
+ price?: number;
161
+ currency?: string;
162
+ availability?: string;
163
+ rating?: number;
164
+ reviewCount?: number;
165
+ url?: string;
166
+ }): {
167
+ "@context": string;
168
+ "@type": string;
169
+ name: string;
170
+ description: string;
171
+ image: string | undefined;
172
+ sku: string | undefined;
173
+ brand: {
174
+ "@type": string;
175
+ name: string;
176
+ } | undefined;
177
+ offers: {
178
+ "@type": string;
179
+ url: string | undefined;
180
+ priceCurrency: string;
181
+ price: number | undefined;
182
+ availability: string;
183
+ };
184
+ aggregateRating: {
185
+ "@type": string;
186
+ ratingValue: number;
187
+ reviewCount: number;
188
+ } | undefined;
189
+ };
190
+ /**
191
+ * Generate FAQ Schema
192
+ */
193
+ declare function generateFAQSchema(questions: Array<{
194
+ q: string;
195
+ a: string;
196
+ }>): {
197
+ "@context": string;
198
+ "@type": string;
199
+ mainEntity: {
200
+ "@type": string;
201
+ name: string;
202
+ acceptedAnswer: {
203
+ "@type": string;
204
+ text: string;
205
+ };
206
+ }[];
207
+ };
208
+ /**
209
+ * Generate Breadcrumb Schema
210
+ */
211
+ declare function generateBreadcrumbSchema(items: Array<{
212
+ name: string;
213
+ item: string;
214
+ }>): {
215
+ "@context": string;
216
+ "@type": string;
217
+ itemListElement: {
218
+ "@type": string;
219
+ position: number;
220
+ name: string;
221
+ item: string;
222
+ }[];
223
+ };
224
+ /**
225
+ * Generate Video Schema
226
+ */
227
+ declare function generateVideoSchema(data: {
228
+ name: string;
229
+ description: string;
230
+ thumbnailUrl: string;
231
+ uploadDate: string;
232
+ duration?: string;
233
+ contentUrl?: string;
234
+ embedUrl?: string;
235
+ }): {
236
+ "@context": string;
237
+ "@type": string;
238
+ name: string;
239
+ description: string;
240
+ thumbnailUrl: string;
241
+ uploadDate: string;
242
+ duration: string | undefined;
243
+ contentUrl: string | undefined;
244
+ embedUrl: string | undefined;
245
+ };
246
+ /**
247
+ * Generate Event Schema
248
+ */
249
+ declare function generateEventSchema(data: {
250
+ name: string;
251
+ description: string;
252
+ startDate: string;
253
+ endDate?: string;
254
+ location?: {
255
+ name: string;
256
+ address: string;
257
+ } | {
258
+ url: string;
259
+ };
260
+ image?: string;
261
+ offers?: {
262
+ price: number;
263
+ currency: string;
264
+ url: string;
265
+ };
266
+ }): {
267
+ "@context": string;
268
+ "@type": string;
269
+ name: string;
270
+ description: string;
271
+ startDate: string;
272
+ endDate: string | undefined;
273
+ eventAttendanceMode: string;
274
+ location: {
275
+ "@type": string;
276
+ url: string;
277
+ name?: undefined;
278
+ address?: undefined;
279
+ } | {
280
+ "@type": string;
281
+ name: string;
282
+ address: string;
283
+ url?: undefined;
284
+ } | undefined;
285
+ image: string | undefined;
286
+ offers: {
287
+ "@type": string;
288
+ price: number;
289
+ priceCurrency: string;
290
+ url: string;
291
+ } | undefined;
292
+ };
293
+ /**
294
+ * Generate LocalBusiness Schema
295
+ */
296
+ declare function generateLocalBusinessSchema(data: {
297
+ name: string;
298
+ description: string;
299
+ image?: string;
300
+ telephone?: string;
301
+ address: {
302
+ street: string;
303
+ city: string;
304
+ region?: string;
305
+ postalCode?: string;
306
+ country: string;
307
+ };
308
+ geo?: {
309
+ lat: number;
310
+ lng: number;
311
+ };
312
+ openingHours?: string[];
313
+ priceRange?: string;
314
+ }): {
315
+ "@context": string;
316
+ "@type": string;
317
+ name: string;
318
+ description: string;
319
+ image: string | undefined;
320
+ telephone: string | undefined;
321
+ address: {
322
+ "@type": string;
323
+ streetAddress: string;
324
+ addressLocality: string;
325
+ addressRegion: string | undefined;
326
+ postalCode: string | undefined;
327
+ addressCountry: string;
328
+ };
329
+ geo: {
330
+ "@type": string;
331
+ latitude: number;
332
+ longitude: number;
333
+ } | undefined;
334
+ openingHours: string[] | undefined;
335
+ priceRange: string | undefined;
336
+ };
337
+ /**
338
+ * Generate SoftwareApplication Schema
339
+ */
340
+ declare function generateSoftwareSchema(data: {
341
+ name: string;
342
+ description: string;
343
+ operatingSystem?: string;
344
+ applicationCategory?: string;
345
+ offers?: {
346
+ price: number;
347
+ currency: string;
348
+ };
349
+ rating?: number;
350
+ reviewCount?: number;
351
+ downloadUrl?: string;
352
+ screenshot?: string;
353
+ }): {
354
+ "@context": string;
355
+ "@type": string;
356
+ name: string;
357
+ description: string;
358
+ operatingSystem: string | undefined;
359
+ applicationCategory: string | undefined;
360
+ offers: {
361
+ "@type": string;
362
+ price: number;
363
+ priceCurrency: string;
364
+ } | undefined;
365
+ aggregateRating: {
366
+ "@type": string;
367
+ ratingValue: number;
368
+ reviewCount: number;
369
+ } | undefined;
370
+ downloadUrl: string | undefined;
371
+ screenshot: string | undefined;
372
+ };
373
+ /**
374
+ * Generate Book Schema
375
+ */
376
+ declare function generateBookSchema(data: {
377
+ name: string;
378
+ author: string | {
379
+ name: string;
380
+ url?: string;
381
+ };
382
+ description: string;
383
+ isbn?: string;
384
+ numberOfPages?: number;
385
+ publisher?: string;
386
+ datePublished?: string;
387
+ image?: string;
388
+ inLanguage?: string;
389
+ genre?: string;
390
+ }): {
391
+ "@context": string;
392
+ "@type": string;
393
+ name: string;
394
+ author: {
395
+ "@type": string;
396
+ name: string;
397
+ url?: undefined;
398
+ } | {
399
+ "@type": string;
400
+ name: string;
401
+ url: string | undefined;
402
+ };
403
+ description: string;
404
+ isbn: string | undefined;
405
+ numberOfPages: number | undefined;
406
+ publisher: {
407
+ "@type": string;
408
+ name: string;
409
+ } | undefined;
410
+ datePublished: string | undefined;
411
+ image: string | undefined;
412
+ inLanguage: string | undefined;
413
+ genre: string | undefined;
414
+ };
415
+ /**
416
+ * Generate Movie Schema
417
+ */
418
+ declare function generateMovieSchema(data: {
419
+ name: string;
420
+ description: string;
421
+ image?: string;
422
+ director?: string;
423
+ actor?: string[];
424
+ dateCreated?: string;
425
+ duration?: string;
426
+ genre?: string[];
427
+ rating?: number;
428
+ reviewCount?: number;
429
+ }): {
430
+ "@context": string;
431
+ "@type": string;
432
+ name: string;
433
+ description: string;
434
+ image: string | undefined;
435
+ director: {
436
+ "@type": string;
437
+ name: string;
438
+ } | undefined;
439
+ actor: {
440
+ "@type": string;
441
+ name: string;
442
+ }[] | undefined;
443
+ dateCreated: string | undefined;
444
+ duration: string | undefined;
445
+ genre: string[] | undefined;
446
+ aggregateRating: {
447
+ "@type": string;
448
+ ratingValue: number;
449
+ reviewCount: number;
450
+ } | undefined;
451
+ };
452
+ /**
453
+ * Generate Podcast Schema (PodcastSeries)
454
+ */
455
+ declare function generatePodcastSchema(data: {
456
+ name: string;
457
+ description: string;
458
+ image?: string;
459
+ author?: string;
460
+ webFeed?: string;
461
+ url?: string;
462
+ genre?: string;
463
+ }): {
464
+ "@context": string;
465
+ "@type": string;
466
+ name: string;
467
+ description: string;
468
+ image: string | undefined;
469
+ author: {
470
+ "@type": string;
471
+ name: string;
472
+ } | undefined;
473
+ webFeed: string | undefined;
474
+ url: string | undefined;
475
+ genre: string | undefined;
476
+ };
477
+ /**
478
+ * Generate PodcastEpisode Schema
479
+ */
480
+ declare function generatePodcastEpisodeSchema(data: {
481
+ name: string;
482
+ description: string;
483
+ datePublished: string;
484
+ duration?: string;
485
+ url?: string;
486
+ audio?: string;
487
+ partOfSeries?: {
488
+ name: string;
489
+ url: string;
490
+ };
491
+ }): {
492
+ "@context": string;
493
+ "@type": string;
494
+ name: string;
495
+ description: string;
496
+ datePublished: string;
497
+ timeRequired: string | undefined;
498
+ url: string | undefined;
499
+ associatedMedia: {
500
+ "@type": string;
501
+ contentUrl: string;
502
+ } | undefined;
503
+ partOfSeries: {
504
+ "@type": string;
505
+ name: string;
506
+ url: string;
507
+ } | undefined;
508
+ };
509
+
510
+ /**
511
+ * Converts SEOData and SiteConfig to a Next.js compatible Metadata object.
512
+ * This is designed to be used in Server Components (App Router).
513
+ *
514
+ * @example
515
+ * // In page.tsx
516
+ * import { toNextMetadata } from '@masters-ws/react-seo';
517
+ *
518
+ * export async function generateMetadata({ params }) {
519
+ * const post = await getPost(params.id);
520
+ * return toNextMetadata({ title: post.title, ... }, siteConfig);
521
+ * }
522
+ */
523
+ declare function toNextMetadata(props: SEOData, config: SiteConfig): any;
524
+ /**
525
+ * Generates pagination links for category/tag pages.
526
+ * Returns { prev, next, canonical } URLs.
527
+ */
528
+ declare function generatePaginationLinks(baseUrl: string, currentPage: number, totalPages: number): {
529
+ next: string | undefined;
530
+ prev: string | undefined;
531
+ canonical: string;
532
+ };
533
+ /**
534
+ * Generates title with page number suffix for paginated pages.
535
+ */
536
+ declare function generatePaginatedTitle(title: string, page: number, suffix?: string): string;
537
+
538
+ export { type BreadcrumbItem as B, type SiteConfig as S, type SEOData as a, generateBookSchema as b, generateBreadcrumbSchema as c, generateEventSchema as d, generateFAQSchema as e, generateLocalBusinessSchema as f, generateArticleSchema as g, generateMovieSchema as h, generateOrganizationSchema as i, generatePaginatedTitle as j, generatePaginationLinks as k, generatePodcastEpisodeSchema as l, generatePodcastSchema as m, generateProductSchema as n, generateSoftwareSchema as o, generateVideoSchema as p, generateWebSiteSchema as q, toNextMetadata as t };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SiteConfig, a as SEOData, B as BreadcrumbItem } from './index-CGVLxGDj.mjs';
2
- export { g as generateArticleSchema, b as generateBreadcrumbSchema, c as generateEventSchema, d as generateFAQSchema, e as generateLocalBusinessSchema, f as generateOrganizationSchema, h as generatePaginatedTitle, i as generatePaginationLinks, j as generateProductSchema, k as generateVideoSchema, l as generateWebSiteSchema, t as toNextMetadata } from './index-CGVLxGDj.mjs';
1
+ import { S as SiteConfig, a as SEOData, B as BreadcrumbItem } from './index-BEY3UKjK.mjs';
2
+ export { g as generateArticleSchema, b as generateBookSchema, c as generateBreadcrumbSchema, d as generateEventSchema, e as generateFAQSchema, f as generateLocalBusinessSchema, h as generateMovieSchema, i as generateOrganizationSchema, j as generatePaginatedTitle, k as generatePaginationLinks, l as generatePodcastEpisodeSchema, m as generatePodcastSchema, n as generateProductSchema, o as generateSoftwareSchema, p as generateVideoSchema, q as generateWebSiteSchema, t as toNextMetadata } from './index-BEY3UKjK.mjs';
3
3
  import React from 'react';
4
4
 
5
5
  interface SEOProviderProps {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SiteConfig, a as SEOData, B as BreadcrumbItem } from './index-CGVLxGDj.js';
2
- export { g as generateArticleSchema, b as generateBreadcrumbSchema, c as generateEventSchema, d as generateFAQSchema, e as generateLocalBusinessSchema, f as generateOrganizationSchema, h as generatePaginatedTitle, i as generatePaginationLinks, j as generateProductSchema, k as generateVideoSchema, l as generateWebSiteSchema, t as toNextMetadata } from './index-CGVLxGDj.js';
1
+ import { S as SiteConfig, a as SEOData, B as BreadcrumbItem } from './index-BEY3UKjK.js';
2
+ export { g as generateArticleSchema, b as generateBookSchema, c as generateBreadcrumbSchema, d as generateEventSchema, e as generateFAQSchema, f as generateLocalBusinessSchema, h as generateMovieSchema, i as generateOrganizationSchema, j as generatePaginatedTitle, k as generatePaginationLinks, l as generatePodcastEpisodeSchema, m as generatePodcastSchema, n as generateProductSchema, o as generateSoftwareSchema, p as generateVideoSchema, q as generateWebSiteSchema, t as toNextMetadata } from './index-BEY3UKjK.js';
3
3
  import React from 'react';
4
4
 
5
5
  interface SEOProviderProps {