@react-pakistan/util-functions 1.22.12 → 1.22.14

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,34 @@
1
+ /**
2
+ * A util function to create Rich Schema for FAQ
3
+ *
4
+ * @returns formatted date - Saturday, 11/01/2020
5
+ * @author Taimoor Khan
6
+ * @remarks AppCorp
7
+ */
8
+ /** End file docs */
9
+ interface Blog {
10
+ authorImage: string;
11
+ authorName: string;
12
+ banner: string;
13
+ createdAt: string;
14
+ excerpt: string;
15
+ title: string;
16
+ updatedAt: string;
17
+ url: string;
18
+ }
19
+ export declare const generateBlogSchema: ({ authorImage, authorName, banner, createdAt, excerpt, title, updatedAt, url, }: Blog) => {
20
+ "@context": string;
21
+ "@type": string;
22
+ headline: string;
23
+ dateModified: string;
24
+ datePublished: string;
25
+ description: string;
26
+ image: string;
27
+ url: string;
28
+ author: {
29
+ "@type": string;
30
+ name: string;
31
+ url: string;
32
+ };
33
+ };
34
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateBlogSchema = void 0;
5
+ const generateBlogSchema = ({ authorImage, authorName, banner, createdAt, excerpt, title, updatedAt, url, }) => {
6
+ return {
7
+ "@context": "https://schema.org",
8
+ "@type": "BlogPosting",
9
+ "headline": `${title}`,
10
+ "dateModified": `${updatedAt}`,
11
+ "datePublished": `${createdAt}`,
12
+ "description": `${excerpt}`,
13
+ "image": `${banner}`,
14
+ "url": `${url}`,
15
+ "author": {
16
+ "@type": "Person",
17
+ "name": `${authorName}`,
18
+ "url": `${authorImage}`,
19
+ },
20
+ };
21
+ };
22
+ exports.generateBlogSchema = generateBlogSchema;
@@ -6,7 +6,11 @@
6
6
  * @remarks AppCorp
7
7
  */
8
8
  /** End file docs */
9
- export declare const generateBreadcrumbSchema: (arr: Array<string>, baseUrl: string) => {
9
+ interface Props {
10
+ data: Array<string>;
11
+ baseUrl: string;
12
+ }
13
+ export declare const generateBreadcrumbSchema: ({ data, baseUrl, }: Props) => {
10
14
  "@context": string;
11
15
  "@type": string;
12
16
  itemListElement: {
@@ -16,3 +20,4 @@ export declare const generateBreadcrumbSchema: (arr: Array<string>, baseUrl: str
16
20
  item: string;
17
21
  }[];
18
22
  };
23
+ export {};
@@ -2,16 +2,8 @@
2
2
  /* eslint-disable */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.generateBreadcrumbSchema = void 0;
5
- /**
6
- * A util function to create Rich Schema for Breadcrumbs
7
- *
8
- * @returns formatted date - Saturday, 11/01/2020
9
- * @author Taimoor Khan
10
- * @remarks AppCorp
11
- */
12
- /** End file docs */
13
- const generateBreadcrumbSchema = (arr, baseUrl) => {
14
- const items = arr.map((text, index) => {
5
+ const generateBreadcrumbSchema = ({ data, baseUrl, }) => {
6
+ const items = data.map((text, index) => {
15
7
  let urlItem = '';
16
8
  if (text === 'Home') {
17
9
  urlItem = baseUrl;
@@ -7,10 +7,12 @@
7
7
  */
8
8
  /** End file docs */
9
9
  interface FAQ {
10
- answer: string;
11
- question: string;
10
+ data: Array<{
11
+ answer: string;
12
+ question: string;
13
+ }>;
12
14
  }
13
- export declare const generateFAQSchema: (arr: Array<FAQ>) => {
15
+ export declare const generateFAQSchema: ({ data, }: FAQ) => {
14
16
  "@context": string;
15
17
  "@type": string;
16
18
  mainEntity: {
@@ -2,8 +2,8 @@
2
2
  /* eslint-disable */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.generateFAQSchema = void 0;
5
- const generateFAQSchema = (arr) => {
6
- const items = arr.map(({ answer, question }) => {
5
+ const generateFAQSchema = ({ data, }) => {
6
+ const items = data.map(({ answer, question }) => {
7
7
  return ({
8
8
  "@type": "Question",
9
9
  "name": question,
@@ -5,9 +5,11 @@ export * from './check-even-odd-length';
5
5
  export * from './countries';
6
6
  export * from './currencies';
7
7
  export * from './format-date';
8
+ export * from './generate-blog-schema';
8
9
  export * from './generate-breadcrumb-schema';
9
10
  export * from './generate-faq-schema';
10
11
  export * from './generate-grid';
12
+ export * from './generate-organization-schema';
11
13
  export * from './get-day-name';
12
14
  export * from './get-href';
13
15
  export * from './get-month-name';
package/general/index.js CHANGED
@@ -22,9 +22,11 @@ __exportStar(require("./check-even-odd-length"), exports);
22
22
  __exportStar(require("./countries"), exports);
23
23
  __exportStar(require("./currencies"), exports);
24
24
  __exportStar(require("./format-date"), exports);
25
+ __exportStar(require("./generate-blog-schema"), exports);
25
26
  __exportStar(require("./generate-breadcrumb-schema"), exports);
26
27
  __exportStar(require("./generate-faq-schema"), exports);
27
28
  __exportStar(require("./generate-grid"), exports);
29
+ __exportStar(require("./generate-organization-schema"), exports);
28
30
  __exportStar(require("./get-day-name"), exports);
29
31
  __exportStar(require("./get-href"), exports);
30
32
  __exportStar(require("./get-month-name"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.12",
3
+ "version": "1.22.14",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {