@react-pakistan/util-functions 1.25.11 → 1.25.13

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 (73) hide show
  1. package/constants/cache-time.d.ts +2 -0
  2. package/constants/cache-time.js +3 -1
  3. package/general/generate-article-schema.d.ts +49 -0
  4. package/general/generate-article-schema.js +100 -0
  5. package/general/generate-blog-schema.d.ts +7 -5
  6. package/general/generate-blog-schema.js +7 -5
  7. package/general/generate-book-schema.d.ts +57 -0
  8. package/general/generate-book-schema.js +109 -0
  9. package/general/generate-breadcrumb-schema.d.ts +22 -6
  10. package/general/generate-breadcrumb-schema.js +15 -4
  11. package/general/generate-carousel-schema.d.ts +51 -0
  12. package/general/generate-carousel-schema.js +172 -0
  13. package/general/generate-course-schema.d.ts +52 -0
  14. package/general/generate-course-schema.js +124 -0
  15. package/general/generate-dataset-schema.d.ts +64 -0
  16. package/general/generate-dataset-schema.js +156 -0
  17. package/general/generate-discussion-forum-schema.d.ts +38 -0
  18. package/general/generate-discussion-forum-schema.js +67 -0
  19. package/general/generate-education-schema.d.ts +67 -0
  20. package/general/generate-education-schema.js +137 -0
  21. package/general/generate-employer-aggregate-rating-schema.d.ts +28 -0
  22. package/general/generate-employer-aggregate-rating-schema.js +64 -0
  23. package/general/generate-event-schema.d.ts +62 -0
  24. package/general/generate-event-schema.js +214 -0
  25. package/general/generate-faq-schema.d.ts +15 -11
  26. package/general/generate-faq-schema.js +18 -6
  27. package/general/generate-image-metadata-schema.d.ts +35 -0
  28. package/general/generate-image-metadata-schema.js +73 -0
  29. package/general/generate-job-posting-schema.d.ts +48 -0
  30. package/general/generate-job-posting-schema.js +120 -0
  31. package/general/generate-local-business-schema.d.ts +41 -0
  32. package/general/generate-local-business-schema.js +75 -0
  33. package/general/generate-math-solver-schema.d.ts +44 -0
  34. package/general/generate-math-solver-schema.js +83 -0
  35. package/general/generate-movie-carousel-schema.d.ts +50 -0
  36. package/general/generate-movie-carousel-schema.js +160 -0
  37. package/general/generate-organization-schema.d.ts +9 -5
  38. package/general/generate-organization-schema.js +9 -5
  39. package/general/generate-profile-page-schema.d.ts +36 -0
  40. package/general/generate-profile-page-schema.js +82 -0
  41. package/general/generate-qa-page-schema.d.ts +33 -0
  42. package/general/generate-qa-page-schema.js +67 -0
  43. package/general/generate-recipe-schema.d.ts +48 -0
  44. package/general/generate-recipe-schema.js +104 -0
  45. package/general/generate-review-snippet-schema.d.ts +51 -0
  46. package/general/generate-review-snippet-schema.js +137 -0
  47. package/general/generate-shopping-loyalty-program-schema.d.ts +37 -0
  48. package/general/generate-shopping-loyalty-program-schema.js +59 -0
  49. package/general/generate-shopping-merchant-listing-schema.d.ts +52 -0
  50. package/general/generate-shopping-merchant-listing-schema.js +153 -0
  51. package/general/generate-shopping-merchant-return-policy-schema.d.ts +31 -0
  52. package/general/generate-shopping-merchant-return-policy-schema.js +68 -0
  53. package/general/generate-shopping-merchant-shipping-policy-schema.d.ts +35 -0
  54. package/general/generate-shopping-merchant-shipping-policy-schema.js +74 -0
  55. package/general/generate-shopping-overview-schema.d.ts +51 -0
  56. package/general/generate-shopping-overview-schema.js +157 -0
  57. package/general/generate-shopping-product-snippet-schema.d.ts +56 -0
  58. package/general/generate-shopping-product-snippet-schema.js +167 -0
  59. package/general/generate-shopping-variants-schema.d.ts +45 -0
  60. package/general/generate-shopping-variants-schema.js +143 -0
  61. package/general/generate-software-app-schema.d.ts +61 -0
  62. package/general/generate-software-app-schema.js +143 -0
  63. package/general/generate-speakable-schema.d.ts +63 -0
  64. package/general/generate-speakable-schema.js +139 -0
  65. package/general/generate-subscription-schema.d.ts +59 -0
  66. package/general/generate-subscription-schema.js +133 -0
  67. package/general/generate-vacation-rental-schema.d.ts +66 -0
  68. package/general/generate-vacation-rental-schema.js +135 -0
  69. package/general/generate-video-schema.d.ts +74 -0
  70. package/general/generate-video-schema.js +163 -0
  71. package/general/index.d.ts +30 -0
  72. package/general/index.js +30 -0
  73. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Generate schema.org `Course` JSON-LD.
3
+ *
4
+ * Accepts metadata for a course and optional `CourseInstance` objects
5
+ * including offers and locations. Provider can be a string or a structured
6
+ * object with `logo` support. Only provided fields are emitted.
7
+ *
8
+ * See `CourseSchema` and `CourseInstance` for field details.
9
+ * @returns A JSON-LD compatible `Course` object
10
+ */
11
+ interface CourseProvider {
12
+ name: string;
13
+ url?: string;
14
+ logo?: {
15
+ url: string;
16
+ width?: number;
17
+ height?: number;
18
+ };
19
+ }
20
+ interface CourseImage {
21
+ url: string;
22
+ width?: number;
23
+ height?: number;
24
+ }
25
+ interface CourseInstanceOffer {
26
+ price?: string | number;
27
+ priceCurrency?: string;
28
+ availability?: string;
29
+ url?: string;
30
+ }
31
+ interface CourseInstance {
32
+ name?: string;
33
+ description?: string;
34
+ courseMode?: string;
35
+ startDate?: string;
36
+ endDate?: string;
37
+ location?: string;
38
+ offers?: CourseInstanceOffer | CourseInstanceOffer[];
39
+ }
40
+ interface CourseSchema {
41
+ name: string;
42
+ description?: string;
43
+ courseCode?: string;
44
+ educationalCredentialAwarded?: string;
45
+ provider: string | CourseProvider;
46
+ image?: string | CourseImage | Array<string | CourseImage>;
47
+ url?: string;
48
+ hasCourseInstance?: CourseInstance | CourseInstance[];
49
+ keywords?: string[];
50
+ }
51
+ export declare const generateCourseSchema: ({ name, description, courseCode, educationalCredentialAwarded, provider, image, url, hasCourseInstance, keywords, }: CourseSchema) => any;
52
+ export {};
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Generate schema.org `Course` JSON-LD.
4
+ *
5
+ * Accepts metadata for a course and optional `CourseInstance` objects
6
+ * including offers and locations. Provider can be a string or a structured
7
+ * object with `logo` support. Only provided fields are emitted.
8
+ *
9
+ * See `CourseSchema` and `CourseInstance` for field details.
10
+ * @returns A JSON-LD compatible `Course` object
11
+ */
12
+ var __assign = (this && this.__assign) || function () {
13
+ __assign = Object.assign || function(t) {
14
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
15
+ s = arguments[i];
16
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
17
+ t[p] = s[p];
18
+ }
19
+ return t;
20
+ };
21
+ return __assign.apply(this, arguments);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.generateCourseSchema = void 0;
25
+ var formatProvider = function (provider) {
26
+ if (typeof provider === 'string') {
27
+ return {
28
+ '@type': 'Organization',
29
+ name: provider,
30
+ };
31
+ }
32
+ var out = {
33
+ '@type': 'Organization',
34
+ name: provider.name,
35
+ };
36
+ if (provider.url)
37
+ out.url = provider.url;
38
+ if (provider.logo) {
39
+ out.logo = __assign(__assign({ '@type': 'ImageObject', url: provider.logo.url }, (provider.logo.width && { width: provider.logo.width })), (provider.logo.height && { height: provider.logo.height }));
40
+ }
41
+ return out;
42
+ };
43
+ var formatImage = function (img) {
44
+ if (!img)
45
+ return undefined;
46
+ if (typeof img === 'string')
47
+ return img;
48
+ if (Array.isArray(img)) {
49
+ return img.map(function (i) {
50
+ return typeof i === 'string'
51
+ ? i
52
+ : __assign(__assign({ '@type': 'ImageObject', url: i.url }, (i.width && { width: i.width })), (i.height && { height: i.height }));
53
+ });
54
+ }
55
+ return __assign(__assign({ '@type': 'ImageObject', url: img.url }, (img.width && { width: img.width })), (img.height && { height: img.height }));
56
+ };
57
+ var formatOffer = function (o) {
58
+ if (!o)
59
+ return undefined;
60
+ var mk = function (x) {
61
+ var out = { '@type': 'Offer' };
62
+ if (x.price !== undefined)
63
+ out.price = x.price;
64
+ if (x.priceCurrency)
65
+ out.priceCurrency = x.priceCurrency;
66
+ if (x.availability)
67
+ out.availability = x.availability;
68
+ if (x.url)
69
+ out.url = x.url;
70
+ return out;
71
+ };
72
+ if (Array.isArray(o))
73
+ return o.map(mk);
74
+ return mk(o);
75
+ };
76
+ var generateCourseSchema = function (_a) {
77
+ var name = _a.name, description = _a.description, courseCode = _a.courseCode, educationalCredentialAwarded = _a.educationalCredentialAwarded, provider = _a.provider, image = _a.image, url = _a.url, hasCourseInstance = _a.hasCourseInstance, keywords = _a.keywords;
78
+ var schema = {
79
+ '@context': 'https://schema.org',
80
+ '@type': 'Course',
81
+ name: name,
82
+ };
83
+ if (description)
84
+ schema.description = description;
85
+ if (courseCode)
86
+ schema.courseCode = courseCode;
87
+ if (educationalCredentialAwarded)
88
+ schema.educationalCredentialAwarded = educationalCredentialAwarded;
89
+ schema.provider = formatProvider(provider);
90
+ var img = formatImage(image);
91
+ if (img)
92
+ schema.image = img;
93
+ if (url)
94
+ schema.url = url;
95
+ if (keywords && keywords.length > 0)
96
+ schema.keywords = keywords.join(', ');
97
+ if (hasCourseInstance) {
98
+ var fmtInstance = function (inst) {
99
+ var out = { '@type': 'CourseInstance' };
100
+ if (inst.name)
101
+ out.name = inst.name;
102
+ if (inst.description)
103
+ out.description = inst.description;
104
+ if (inst.courseMode)
105
+ out.courseMode = inst.courseMode;
106
+ if (inst.startDate)
107
+ out.startDate = inst.startDate;
108
+ if (inst.endDate)
109
+ out.endDate = inst.endDate;
110
+ if (inst.location)
111
+ out.location = inst.location;
112
+ var offers = formatOffer(inst.offers);
113
+ if (offers)
114
+ out.offers = offers;
115
+ return out;
116
+ };
117
+ if (Array.isArray(hasCourseInstance))
118
+ schema.hasCourseInstance = hasCourseInstance.map(fmtInstance);
119
+ else
120
+ schema.hasCourseInstance = fmtInstance(hasCourseInstance);
121
+ }
122
+ return schema;
123
+ };
124
+ exports.generateCourseSchema = generateCourseSchema;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Generate schema.org JSON-LD for `Dataset`, `DataCatalog`, or
3
+ * `DataDownload` distributions.
4
+ *
5
+ * Supports publisher formatting, distribution normalization (including
6
+ * encoding format validation with `skipInvalidEncoding`), variable
7
+ * measurement metadata and nested datasets for `DataCatalog`.
8
+ *
9
+ * See `DatasetOptions` for the input shape and available flags.
10
+ * @returns A JSON-LD compatible `Dataset` or `DataCatalog` object
11
+ */
12
+ interface PublisherLogo {
13
+ url: string;
14
+ width?: number;
15
+ height?: number;
16
+ }
17
+ interface Publisher {
18
+ name: string;
19
+ url?: string;
20
+ logo?: PublisherLogo;
21
+ }
22
+ interface Distribution {
23
+ name?: string;
24
+ contentUrl: string;
25
+ encodingFormat?: string;
26
+ byteSize?: number | string;
27
+ datePublished?: string;
28
+ license?: string;
29
+ measurementTechnique?: string;
30
+ }
31
+ interface DatasetOptions {
32
+ type?: 'Dataset' | 'DataCatalog';
33
+ name?: string;
34
+ description?: string;
35
+ url?: string;
36
+ datePublished?: string;
37
+ dateModified?: string;
38
+ publisher: string | Publisher;
39
+ keywords?: string[];
40
+ license?: string;
41
+ version?: string;
42
+ variableMeasured?: string | string[] | Array<{
43
+ name: string;
44
+ value?: string | number;
45
+ unitText?: string;
46
+ }>;
47
+ spatialCoverage?: string;
48
+ distribution?: Distribution | Distribution[];
49
+ citation?: string | {
50
+ text?: string;
51
+ url?: string;
52
+ };
53
+ funding?: string | {
54
+ name: string;
55
+ funder?: string;
56
+ } | Array<string | {
57
+ name: string;
58
+ funder?: string;
59
+ }>;
60
+ skipInvalidEncoding?: boolean;
61
+ datasets?: DatasetOptions[];
62
+ }
63
+ export declare const generateDatasetSchema: ({ type, name, description, url, datePublished, dateModified, publisher, keywords, license, version, variableMeasured, spatialCoverage, distribution, datasets, skipInvalidEncoding, }: DatasetOptions) => any;
64
+ export {};
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ /**
3
+ * Generate schema.org JSON-LD for `Dataset`, `DataCatalog`, or
4
+ * `DataDownload` distributions.
5
+ *
6
+ * Supports publisher formatting, distribution normalization (including
7
+ * encoding format validation with `skipInvalidEncoding`), variable
8
+ * measurement metadata and nested datasets for `DataCatalog`.
9
+ *
10
+ * See `DatasetOptions` for the input shape and available flags.
11
+ * @returns A JSON-LD compatible `Dataset` or `DataCatalog` object
12
+ */
13
+ var __assign = (this && this.__assign) || function () {
14
+ __assign = Object.assign || function(t) {
15
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
16
+ s = arguments[i];
17
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
18
+ t[p] = s[p];
19
+ }
20
+ return t;
21
+ };
22
+ return __assign.apply(this, arguments);
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.generateDatasetSchema = void 0;
26
+ var formatPublisher = function (p) {
27
+ if (typeof p === 'string')
28
+ return { '@type': 'Organization', name: p };
29
+ var out = { '@type': 'Organization', name: p.name };
30
+ if (p.url)
31
+ out.url = p.url;
32
+ if (p.logo) {
33
+ out.logo = { '@type': 'ImageObject', url: p.logo.url };
34
+ if (p.logo.width)
35
+ out.logo.width = p.logo.width;
36
+ if (p.logo.height)
37
+ out.logo.height = p.logo.height;
38
+ }
39
+ return out;
40
+ };
41
+ var formatDistribution = function (d, skipInvalidEncoding) {
42
+ if (skipInvalidEncoding === void 0) { skipInvalidEncoding = false; }
43
+ var out = {
44
+ '@type': 'DataDownload',
45
+ contentUrl: d.contentUrl,
46
+ };
47
+ if (d.name)
48
+ out.name = d.name;
49
+ if (d.encodingFormat) {
50
+ var enc = normalizeEncodingFormat(d.encodingFormat, skipInvalidEncoding);
51
+ if (enc)
52
+ out.encodingFormat = enc;
53
+ }
54
+ if (d.byteSize != null)
55
+ out.byteSize = d.byteSize;
56
+ if (d.datePublished)
57
+ out.datePublished = d.datePublished;
58
+ if (d.license)
59
+ out.license = d.license;
60
+ if (d.measurementTechnique)
61
+ out.measurementTechnique = d.measurementTechnique;
62
+ return out;
63
+ };
64
+ var ENCODING_ALIASES = {
65
+ csv: 'text/csv',
66
+ json: 'application/json',
67
+ geojson: 'application/geo+json',
68
+ xml: 'application/xml',
69
+ txt: 'text/plain',
70
+ zip: 'application/zip',
71
+ gzip: 'application/gzip',
72
+ };
73
+ var isValidMime = function (v) {
74
+ return /^[a-z0-9!#$&.+\-_]+\/[a-z0-9!#$&.+\-_]+$/i.test(v);
75
+ };
76
+ var normalizeEncodingFormat = function (val, skipInvalid) {
77
+ if (skipInvalid === void 0) { skipInvalid = false; }
78
+ if (!val)
79
+ return undefined;
80
+ var s = String(val).trim();
81
+ var lower = s.toLowerCase();
82
+ if (ENCODING_ALIASES[lower])
83
+ return ENCODING_ALIASES[lower];
84
+ if (isValidMime(s))
85
+ return s;
86
+ if (skipInvalid)
87
+ return undefined;
88
+ throw new Error("Invalid encodingFormat: ".concat(val));
89
+ };
90
+ var generateDatasetSchema = function (_a) {
91
+ var _b = _a.type, type = _b === void 0 ? 'Dataset' : _b, name = _a.name, description = _a.description, url = _a.url, datePublished = _a.datePublished, dateModified = _a.dateModified, publisher = _a.publisher, keywords = _a.keywords, license = _a.license, version = _a.version, variableMeasured = _a.variableMeasured, spatialCoverage = _a.spatialCoverage, distribution = _a.distribution, datasets = _a.datasets,
92
+ // citation,
93
+ // funding,
94
+ _c = _a.skipInvalidEncoding,
95
+ // citation,
96
+ // funding,
97
+ skipInvalidEncoding = _c === void 0 ? false : _c;
98
+ if (type === 'DataCatalog') {
99
+ var catalog = {
100
+ '@context': 'https://schema.org',
101
+ '@type': 'DataCatalog',
102
+ };
103
+ if (name)
104
+ catalog.name = name;
105
+ if (description)
106
+ catalog.description = description;
107
+ if (url)
108
+ catalog.url = url;
109
+ if (publisher)
110
+ catalog.publisher = formatPublisher(publisher);
111
+ if (keywords && keywords.length)
112
+ catalog.keywords = keywords.join(', ');
113
+ if (datasets && Array.isArray(datasets)) {
114
+ catalog.dataset = datasets.map(function (ds) {
115
+ var out = (0, exports.generateDatasetSchema)(__assign(__assign({}, ds), { type: 'Dataset', skipInvalidEncoding: skipInvalidEncoding }));
116
+ return out;
117
+ });
118
+ }
119
+ return catalog;
120
+ }
121
+ // default Dataset
122
+ var schema = {
123
+ '@context': 'https://schema.org',
124
+ '@type': 'Dataset',
125
+ };
126
+ if (name)
127
+ schema.name = name;
128
+ if (description)
129
+ schema.description = description;
130
+ if (url)
131
+ schema.url = url;
132
+ if (datePublished)
133
+ schema.datePublished = datePublished;
134
+ if (dateModified)
135
+ schema.dateModified = dateModified;
136
+ if (publisher)
137
+ schema.publisher = formatPublisher(publisher);
138
+ if (keywords && keywords.length)
139
+ schema.keywords = keywords.join(', ');
140
+ if (license)
141
+ schema.license = license;
142
+ if (version)
143
+ schema.version = version;
144
+ if (variableMeasured)
145
+ schema.variableMeasured = variableMeasured;
146
+ if (spatialCoverage)
147
+ schema.spatialCoverage = spatialCoverage;
148
+ if (distribution) {
149
+ var dists = Array.isArray(distribution) ? distribution : [distribution];
150
+ schema.distribution = dists.map(function (d) {
151
+ return formatDistribution(d, skipInvalidEncoding);
152
+ });
153
+ }
154
+ return schema;
155
+ };
156
+ exports.generateDatasetSchema = generateDatasetSchema;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Generate schema.org JSON-LD for `DiscussionForumPosting`.
3
+ *
4
+ * Formats author and publisher references, optional interaction statistics,
5
+ * and content fields into a compact `DiscussionForumPosting` object ready
6
+ * for JSON-LD embedding.
7
+ *
8
+ * See `DiscussionForumOptions` for supported inputs.
9
+ * @returns A JSON-LD compatible `DiscussionForumPosting` object
10
+ */
11
+ interface PersonRef {
12
+ name?: string;
13
+ url?: string;
14
+ }
15
+ interface DiscussionForumOptions {
16
+ headline?: string;
17
+ articleBody?: string;
18
+ url?: string;
19
+ datePublished?: string;
20
+ dateModified?: string;
21
+ author?: string | PersonRef;
22
+ publisher?: string | {
23
+ name: string;
24
+ url?: string;
25
+ };
26
+ about?: string | {
27
+ '@type': string;
28
+ name?: string;
29
+ };
30
+ discussionUrl?: string;
31
+ interactionStatistic?: Array<{
32
+ '@type': string;
33
+ interactionType?: string;
34
+ userInteractionCount?: number;
35
+ }>;
36
+ }
37
+ export declare const generateDiscussionForumSchema: ({ headline, articleBody, url, datePublished, dateModified, author, publisher, about, discussionUrl, interactionStatistic, }?: DiscussionForumOptions) => any;
38
+ export default generateDiscussionForumSchema;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Generate schema.org JSON-LD for `DiscussionForumPosting`.
4
+ *
5
+ * Formats author and publisher references, optional interaction statistics,
6
+ * and content fields into a compact `DiscussionForumPosting` object ready
7
+ * for JSON-LD embedding.
8
+ *
9
+ * See `DiscussionForumOptions` for supported inputs.
10
+ * @returns A JSON-LD compatible `DiscussionForumPosting` object
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.generateDiscussionForumSchema = void 0;
14
+ var formatPerson = function (p) {
15
+ if (!p)
16
+ return undefined;
17
+ if (typeof p === 'string')
18
+ return { '@type': 'Person', name: p };
19
+ var out = { '@type': 'Person' };
20
+ if (p.name)
21
+ out.name = p.name;
22
+ if (p.url)
23
+ out.url = p.url;
24
+ return out;
25
+ };
26
+ var formatPublisher = function (p) {
27
+ if (!p)
28
+ return undefined;
29
+ if (typeof p === 'string')
30
+ return { '@type': 'Organization', name: p };
31
+ var out = { '@type': 'Organization', name: p.name };
32
+ if (p.url)
33
+ out.url = p.url;
34
+ return out;
35
+ };
36
+ var generateDiscussionForumSchema = function (_a) {
37
+ var _b = _a === void 0 ? {} : _a, headline = _b.headline, articleBody = _b.articleBody, url = _b.url, datePublished = _b.datePublished, dateModified = _b.dateModified, author = _b.author, publisher = _b.publisher, about = _b.about, discussionUrl = _b.discussionUrl, interactionStatistic = _b.interactionStatistic;
38
+ var schema = {
39
+ '@context': 'https://schema.org',
40
+ '@type': 'DiscussionForumPosting',
41
+ };
42
+ if (headline)
43
+ schema.headline = headline;
44
+ if (articleBody)
45
+ schema.articleBody = articleBody;
46
+ if (url)
47
+ schema.url = url;
48
+ if (datePublished)
49
+ schema.datePublished = datePublished;
50
+ if (dateModified)
51
+ schema.dateModified = dateModified;
52
+ var a = formatPerson(author);
53
+ if (a)
54
+ schema.author = a;
55
+ var pub = formatPublisher(publisher);
56
+ if (pub)
57
+ schema.publisher = pub;
58
+ if (about)
59
+ schema.about = about;
60
+ if (discussionUrl)
61
+ schema.discussionUrl = discussionUrl;
62
+ if (interactionStatistic && Array.isArray(interactionStatistic))
63
+ schema.interactionStatistic = interactionStatistic;
64
+ return schema;
65
+ };
66
+ exports.generateDiscussionForumSchema = generateDiscussionForumSchema;
67
+ exports.default = exports.generateDiscussionForumSchema;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Generate schema.org JSON-LD for a Quiz (Question and Answer items).
3
+ *
4
+ * Supports author and publisher metadata along with detailed `Question`
5
+ * and `Answer` structures (including accepted/suggested answers,
6
+ * feedback and scoring fields). Only provided values are emitted.
7
+ *
8
+ * See `QuizOptions`, `Question`, and `Answer` types for the available
9
+ * fields and formats.
10
+ * @returns A JSON-LD compatible `Quiz` object
11
+ */
12
+ interface PersonRef {
13
+ name?: string;
14
+ url?: string;
15
+ }
16
+ interface PublisherRef {
17
+ name: string;
18
+ url?: string;
19
+ }
20
+ interface Answer {
21
+ text: string;
22
+ url?: string;
23
+ author?: string | PersonRef;
24
+ upvoteCount?: number;
25
+ feedback?: string | {
26
+ text?: string;
27
+ score?: number;
28
+ };
29
+ }
30
+ interface Question {
31
+ name?: string;
32
+ text?: string;
33
+ acceptedAnswer?: Answer | Answer[];
34
+ suggestedAnswer?: Answer | Answer[];
35
+ answerCount?: number;
36
+ upvoteCount?: number;
37
+ difficulty?: string;
38
+ points?: number;
39
+ score?: number;
40
+ timeLimit?: string;
41
+ attempts?: number;
42
+ tags?: string[];
43
+ hints?: string[];
44
+ learningObjective?: string | string[];
45
+ timeRecommended?: string;
46
+ isRequired?: boolean;
47
+ }
48
+ interface QuizOptions {
49
+ name?: string;
50
+ description?: string;
51
+ url?: string;
52
+ datePublished?: string;
53
+ author?: string | PersonRef;
54
+ publisher?: string | PublisherRef;
55
+ difficulty?: string;
56
+ learningResourceType?: string;
57
+ educationalLevel?: string;
58
+ timeRequired?: string;
59
+ typicalAgeRange?: string | number;
60
+ inLanguage?: string;
61
+ keywords?: string[];
62
+ learningOutcome?: string | string[];
63
+ isAccessibleForFree?: boolean;
64
+ questions?: Question[];
65
+ }
66
+ export declare const generateEducationSchema: ({ name, description, url, datePublished, author, publisher, difficulty, learningResourceType, educationalLevel, timeRequired, typicalAgeRange, inLanguage, keywords, learningOutcome, isAccessibleForFree, questions, }?: QuizOptions) => any;
67
+ export default generateEducationSchema;