@groww-tech/ella
Version:
Ella is a utility-belt library for JavaScript that provides general purpose methods used in day to day programming.
124 lines (120 loc) • 4.28 kB
TypeScript
import { WebpageSchema, ArticleSchema, ProductSchema, FaqSchema, BreadcrumbSchema } from '../utils/types/index';
/**
* @module JSX
*/
/**
* This method can be used to insert Organization Schema in any page necessary for SEO.
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getOrganizationSchema() // Use in render method
* ```
*/
declare function getOrganizationSchema(): JSX.Element;
/**
* This method can be used to insert rich snippet webpage schema in any page.
*
* @param {WebpageSchema} schemaObject - Schema object for web page schema
* @param {string} web_host - Current domain based on environment .... like - https://groww.in
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getWebpageSchema(schemaObject, config.host) // Use in render method
* ```
*/
declare const getWebpageSchema: (schemaObject: WebpageSchema, web_host: string) => JSX.Element;
/**
* This method can be used to insert rich snippet article schema in any page.
*
* @param {ArticleSchema} schemaObject - Schema object for article schema
* @param {string} web_host - Current domain based on environment .... like - https://groww.in
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getArticleSchema(schemaObject, config.host); // Use in render method
* ```
*/
declare function getArticleSchema(schemaObject: ArticleSchema, web_host: string): JSX.Element;
/**
* This method can be used to insert rich snippet product schema in any page.
*
* @param {ProductSchema} schemaObject - Schema object for product schema
* @param {string} web_host - Current domain based on environment .... like - https://groww.in
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getProductSchema(schemaObject, config.host); // Use in render method
* ```
*/
declare function getProductSchema(schemaObject: ProductSchema, web_host: string): JSX.Element;
/**
* This method can be used to insert rich snippet FAQ schema in any page.
*
* @param {FaqSchema[]} faqData - Schema object for FAQ schema
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getFaqSchema(faqData); // Use in render method
* ```
*/
declare function getFaqSchema(faqData: FaqSchema[]): JSX.Element;
/**
* This method can be used to insert rich snippet breadcrumb schema in any page.
*
* @param {BreadcrumbSchema[]} schemaObject - Schema object for breadcrumb schema
* @param {string} web_host - Current domain based on environment .... like - https://groww.in
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getBreadcrumbSchema(schemaData, config.host); // Use in render method
* ```
*/
declare const getBreadcrumbSchema: (schema: BreadcrumbSchema[], web_host: string) => JSX.Element;
/**
* This method can be used to insert Search Schema for SEO.
*
* @remarks
* This method should be present in the first render otherwise SEO will not happen.
*
* @example
* ```
* getSearchSchema() // Use in render method
* ```
*/
declare const getSearchSchema: () => JSX.Element;
/**
* This method can be used to highlight the searched part.
* This function returns the text as an element with highlightedText as bold and rest normal.
* Casing is ignored in the text
*
* @param {string} eventName - Name of the event that you want to listen or subscribe
* @param {Function} callback - Callback function which will be called upon dispatching of that event
*
* @remarks
* Ignores casing when matching the text
*
* @example
* ```
* getHighlightedText('My name is Khan', 'name', arrayIndexHere, styleObject, 'bold'); // last 2 arguments are optional
* ```
*/
declare function getHighlightedText(text: string, higlightText: string, index?: number, style?: {}, fontWeight?: string): JSX.Element | undefined;
export { getArticleSchema, getBreadcrumbSchema, getFaqSchema, getHighlightedText, getOrganizationSchema, getProductSchema, getSearchSchema, getWebpageSchema };