Skip to main content

Module: frontend

CromwellCMS Frontend SDK

Exports Blocks, React components, API clients and frontend helpers.

Install#

npm i @cromwell/core-frontend

Use#

Example of usage

import { getGraphQLClient } from '@cromwell/core-frontend';
const products = await getGraphQLClient().getProducts();

Table of contents#

Classes#

Type aliases#

Variables#

Functions#

Type aliases#

CContainerProps#

Ƭ CContainerProps: { children?: React.ReactNode } & TCromwellBlockProps

Defined in#

system/core/frontend/src/components/CContainer/CContainer.tsx:6


SignInProps#

Ƭ SignInProps: Object

Type declaration#

NameTypeDescription
classes?Partial<Record<"root" | "resetPassInstructions" | "forgotPassButton" | "backToSignInButton", string>>CSS classes to pass to elements
elements?ObjectCustom components to override default ones
elements.Button?TBaseButton-
elements.CodeField?TBaseTextField-
elements.EmailField?TBaseTextField-
elements.PasswordField?TBaseTextField-
elements.TextField?TBaseTextField-
initialFormType?TSignInFromTypeType of form to open initially. sign-in by default;
text?ObjectTranslate/change text on elements
text.backToSignIn?string-
text.fieldRequired?string-
text.forgotPass?string-
text.forgotPassButton?string-
text.loginButton?string-
text.resetPassButton?string-
text.resetPassInstructions?string-
onForgotPasswordEmailSent?(email: string) => any-
onForgotPasswordFailure?(error: TAuthClientOperationResult) => any-
onResetPasswordFailure?(error: TAuthClientOperationResult) => any-
onResetPasswordSuccess?(email?: string, newPassword?: string) => any-
onSignInError?(error: TAuthClientOperationResult) => any-
onSignInSuccess?(user: TUser) => any-

Defined in#

system/core/frontend/src/components/SignIn/SignIn.tsx:14


SignUpProps#

Ƭ SignUpProps: Object

Type declaration#

NameTypeDescription
classes?Partial<Record<"root", string>>CSS classes to pass to elements
elements?ObjectCustom components to override default ones
elements.Button?TBaseButton-
elements.EmailField?TBaseTextField-
elements.NameField?TBaseTextField-
elements.PasswordField?TBaseTextField-
elements.TextField?TBaseTextField-
text?ObjectTranslate/change text on elements
text.fieldRequired?string-
text.signUpButton?string-
onSignUpError?(error: TAuthClientOperationResult) => any-
onSignUpSuccess?(user: TUser, password: string) => any-

Defined in#

system/core/frontend/src/components/SignUp/SignUp.tsx:12


TApiClient#

Ƭ TApiClient: Object

Type declaration#

NameType
getAttributes() => Promise<undefined | TAttribute[]>
getCouponsByCodes?(codes: string[]) => Promise<undefined | TCoupon[]>
getProductById(id: number) => Promise<undefined | TProduct>

Defined in#

system/core/frontend/src/helpers/CStore.ts:27


TAppPropsContext#

Ƭ TAppPropsContext<TProps>: Object

Type parameters#

NameType
TPropsunknown

Type declaration#

NameType
pageProps?TCromwellPageCoreProps & TProps
routeInfo?Object
routeInfo.fullUrl?string
routeInfo.origin?string
router?NextRouter
forceUpdatePage?() => void

Defined in#

system/core/frontend/src/constants.ts:81


TAuthClientOperationResult#

Ƭ TAuthClientOperationResult: Object

Common object with info about result of used operation.

Type declaration#

NameTypeDescription
codenumberAvailable codes: 200 - Sing in success; 201 - Sing out success; 202 - Reset password procedure initiation success (forgot pass); 203 - Reset password success. Password changed in DB; 204 - User registration (sign up) success. 400 - Empty email or password (frontend validation); 401 - Incorrect email or password (server validation); 402 - Already processing another request; 403 - Too many requests; 404 - Failed to sing out; 405 - Empty secret code (frontend validation); 406 - Exceeded reset password attempts; 407 - Missing user credentials on user registration operation;
error?any-
messagestring-
successboolean-
user?TUser-

Defined in#

system/core/frontend/src/helpers/AuthClient.ts:10


TBaseButton#

Ƭ TBaseButton: React.ComponentType<TBaseButtonProps>

Defined in#

system/core/frontend/src/components/BaseElements/BaseButton.tsx:16


TBaseButtonProps#

Ƭ TBaseButtonProps: Object

Type declaration#

NameType
aria-label?string
className?string
color?"primary"
disabled?boolean
id?string
onClick?React.MouseEventHandler
size?"small" | "medium" | "large"
startIcon?React.ReactNode
style?React.CSSProperties
type?string
variant?"outlined" | "text" | "contained"

Defined in#

system/core/frontend/src/components/BaseElements/BaseButton.tsx:3


TBaseTextField#

Ƭ TBaseTextField: React.ComponentType<TBaseTextFieldProps>

Defined in#

system/core/frontend/src/components/BaseElements/BaseTextField.tsx:24


TBaseTextFieldProps#

Ƭ TBaseTextFieldProps: Object

Type declaration#

NameType
className?string
disabled?boolean
error?boolean
fullWidth?boolean
helperText?React.ReactNode
id?string
label?React.ReactNode
maxRows?string | number
minRows?string | number
multiline?boolean
name?string
onChange?React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>
placeholder?string
rows?string | number
size?"small" | "medium"
style?React.CSSProperties
type?string
value?any
variant?"outlined" | "filled" | "standard"

Defined in#

system/core/frontend/src/components/BaseElements/BaseTextField.tsx:3


TCGalleryProps#

Ƭ TCGalleryProps: { className?: string ; shouldComponentUpdate?: boolean } & TCromwellBlockProps

Defined in#

system/core/frontend/src/components/CGallery/CGallery.tsx:27


TCGraphQLClient#

Ƭ TCGraphQLClient: CGraphQLClient

Defined in#

system/core/frontend/src/api/CGraphQLClient.ts:1210


TCList#

Ƭ TCList<DataType, ListItemProps>: Object

Public API of CList instance

Type parameters#

NameType
DataTypeany
ListItemPropsany

Type declaration#

NameType
addListener(type: "componentDidUpdate", cb: () => void) => void
clearState() => void
getPagedParams() => TPagedParams<DataType>
getProps() => TCListProps<DataType, ListItemProps>
getScrollboxEl() => null | HTMLDivElement
init() => void
openPage(pageNumber: number) => void
setPagedParams(val: TPagedParams<DataType>) => void
setProps(props: null | TCListProps<DataType, ListItemProps>) => void
updateData() => Promise<void>

Defined in#

system/core/frontend/src/components/CList/types.ts:105


TCListProps#

Ƭ TCListProps<DataType, ListItemProps>: Object

Type parameters#

Name
DataType
ListItemProps

Type declaration#

NameTypeDescription
ListItemReact.ComponentType<TListItemProps<DataType, ListItemProps>>Component that will display items
className?stringHTML Class attribute for wrapper container
cssClasses?TCssClasses-
dataList?DataType[]Array of data to create components for each piece and virtualize. Won't work with "loader" prop
disableCaching?booleanDisable caching of loaded pages from "loader" prop when open a new page by pagination. Caching is working by default
elements?TElements-
firstBatch?TPagedList<DataType> | nullFirst batch / page. Can be used with "loader". Supposed to be used in SSR to prerender page
idstringCBlock id
isLoading?booleanForce to show preloader instead of a list
listItemProps?ListItemPropsProp object to pass for each component in a list
maxDomPages?numberMax pages to render at screen. 10 by default
minRangeToLoad?numberThreshold in px where automatically request next or prev page. 200 by default. Use with useAutoLoading
noDataLabel?stringLabel to show when data array is empty. "No data" by default
pageSize?numberPage size to first use in TPagedParams of "loader". After first batch recieved will use pageSize from pagedMeta if pagedMeta has it
paginationButtonsNum?numberMax number of page links to display. 10 by default
pathname?stringwindow.location.pathname for SSR to prerender pagination links
scrollContainerSelector?stringWhen useShowMoreButton and usePagination enabled CList needs to know container that scrolls pages to define current page during scrolling
useAutoLoading?booleanAuto load more pages when scroll reached end of start in minRangeToLoad (px)
usePagination?booleanDisplay pagination
useQueryPagination?booleanParse and set pageNumber in url as query param
useShowMoreButton?booleanIf useAutoLoading disabled can show button to load next page in the same container
loader?(params: TPagedParams<DataType>) => undefined | null | Promise<undefined | null | TPagedList<DataType> | DataType[]>-

Defined in#

system/core/frontend/src/components/CList/types.ts:34


TCRestApiClient#

Ƭ TCRestApiClient: typeof CRestApiClient

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:880


TCStoreOperationResult#

Ƭ TCStoreOperationResult: Object

Result of cstore operation with lists. E.g. "add to cart", "remove from wishlist", etc. Codes: 0 - add success 1 - add failed, already in the list 3 - add failed, invalid product 4 - add failed, missing required attributes 6 - remove failed, no such item in the list 7 - remove success

Type declaration#

NameType
codenumber
message?string
successboolean

Defined in#

system/core/frontend/src/helpers/CStore.ts:44


TCssClasses#

Ƭ TCssClasses: Object

Type declaration#

NameType
contentWrapper?string
page?string
pagination?string
paginationActiveLink?string
paginationArrowLink?string
paginationDisabledLink?string
paginationLink?string
scrollBox?string

Defined in#

system/core/frontend/src/components/CList/types.ts:4


TDynamicLoader#

Ƭ TDynamicLoader: (func: () => Promise<ComponentType>, options?: any) => ComponentType

Type declaration#

â–¸ (func, options?): ComponentType

Parameters#
NameType
func() => Promise<ComponentType>
options?any
Returns#

ComponentType

Defined in#

system/core/frontend/src/constants.ts:64


TElements#

Ƭ TElements: Object

Type declaration#

NameTypeDescription
arrowFirst?React.ReactNode-
arrowLast?React.ReactNode-
arrowLeft?React.ReactNode-
arrowRight?React.ReactNode-
pagination?React.ComponentType<TPaginationProps>-
preloader?React.ReactNodePreloader to show during first data request
showMore?React.ComponentType<Object>-

Defined in#

system/core/frontend/src/components/CList/types.ts:21


TErrorInfo#

Ƭ TErrorInfo: Object

Type declaration#

NameType
disableLog?boolean
messagestring
routestring
statusCodenumber

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:32


TGetCStoreOptions#

Ƭ TGetCStoreOptions: Object

Type declaration#

NameTypeDescription
apiClient?TApiClientProvide custom apiClient instance. CGraphQLClient by default. Be careful, if local: true is not provided, then this client will be saved globally and used for all subsequent calls.
local?booleanIf true, create and return a new CStore instance instead of returning one (singleton) from the global store. False by default.

Defined in#

system/core/frontend/src/helpers/CStore.ts:764


TGetFilteredOptions#

Ƭ TGetFilteredOptions<TEntity, TFilter>: Object

Type parameters#

Name
TEntity
TFilter

Type declaration#

NameType
customFragment?DocumentNode
customFragmentName?string
filterParams?TFilter
pagedParams?TPagedParams<TEntity>

Defined in#

system/core/frontend/src/api/CGraphQLClient.ts:66


TGraphQLErrorInfo#

Ƭ TGraphQLErrorInfo: Object

Type declaration#

NameType
message?string
path?string
stacktrace?string
status?string
statusCode?number

Defined in#

system/core/frontend/src/api/CGraphQLClient.ts:58


TImageComponent#

Ƭ TImageComponent: React.ComponentClass<Partial<ImageProps>>

Defined in#

system/core/frontend/src/components/CGallery/CGallery.tsx:32


TListItemProps#

Ƭ TListItemProps<DataType, ListItemProps>: Object

Type parameters#

Name
DataType
ListItemProps

Type declaration#

NameType
data?DataType
listItemProps?ListItemProps

Defined in#

system/core/frontend/src/components/CList/types.ts:131


TListenerType#

Ƭ TListenerType: "componentDidUpdate"

Defined in#

system/core/frontend/src/components/CList/types.ts:129


TPaginationProps#

Ƭ TPaginationProps: Object

Type declaration#

NameType
countnumber
pagenumber
onChange(page: number) => void

Defined in#

system/core/frontend/src/components/CList/types.ts:15


TRequestOptions#

Ƭ TRequestOptions: Object

Type declaration#

NameTypeDescription
disableLog?booleanDisable error logging
headers?Record<string, string>Add headers
input?anyBody for 'post' and 'put' requests
method?stringHTTP method: 'get', 'post', 'put', etc.

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:39


TSignInFromType#

Ƭ TSignInFromType: "sign-in" | "forgot-pass" | "reset-pass"

Defined in#

system/core/frontend/src/components/SignIn/SignIn.tsx:10


WidgetNames#

Ƭ WidgetNames: keyof WidgetTypes

Defined in#

system/core/frontend/src/widget-types.ts:35


WidgetTypes#

Ƭ WidgetTypes: Object

Type declaration#

NameType
CategoryActionsWidget_EntityActions<TProductCategory>
DashboardWidget_DashboardProps
OrderActionsWidget_EntityActions<TOrder>
PluginSettingsTPluginSettingsProps
PostActionsWidget_PostActions
ProductActionsWidget_EntityActions<TProduct>
TagActionsWidget_EntityActions<TTag>
ThemeEditorObject
ThemeEditor.block?TCromwellBlock
ThemeEditor.instanceSettings?any
ThemeEditor.addNewBlockAfter?[object Object]
ThemeEditor.changeInstanceSettings?[object Object]
ThemeEditor.deleteBlock?[object Object]
ThemeEditor.forceUpdate?[object Object]
ThemeEditor.modifyData?[object Object]
ThemeEditor.updateFramesPosition?[object Object]

Defined in#

system/core/frontend/src/widget-types.ts:15


Widget_DashboardProps#

Ƭ Widget_DashboardProps: Object

Type declaration#

NameType
statsTCmsStats | undefined
setSize(pluginName: string, layouts: { lg: { h?: number ; w?: number ; x?: number ; y?: number } ; md: { h?: number ; w?: number ; x?: number ; y?: number } ; sm: { h?: number ; w?: number ; x?: number ; y?: number } ; xs: { h?: number ; w?: number ; x?: number ; y?: number } ; xxs: { h?: number ; w?: number ; x?: number ; y?: number } }) => any

Defined in#

system/core/frontend/src/widget-types.ts:37


Widget_EntityActions#

Ƭ Widget_EntityActions<T>: Object

Type parameters#

Name
T

Type declaration#

NameType
data?T
setData?(data: T) => any

Defined in#

system/core/frontend/src/widget-types.ts:48


Widget_PostActions#

Ƭ Widget_PostActions: Widget_EntityActions<TPost> & { editorInstance: any }

Defined in#

system/core/frontend/src/widget-types.ts:53

Variables#

AppPropsContext#

• Const AppPropsContext: Context<TAppPropsContext<unknown>>

Defined in#

system/core/frontend/src/constants.ts:91


BaseButton#

• Const BaseButton: TBaseButton

Defined in#

system/core/frontend/src/components/BaseElements/BaseButton.tsx:18


BaseTextField#

• Const BaseTextField: TBaseTextField

Defined in#

system/core/frontend/src/components/BaseElements/BaseTextField.tsx:26


BlockContentConsumer#

• BlockContentConsumer: Consumer<null | TBlockContentProvider>


BlockContentProvider#

• BlockContentProvider: Provider<null | TBlockContentProvider>


BlockStoreConsumer#

• BlockStoreConsumer: Consumer<null | TBlockStoreProvider>


BlockStoreProvider#

• BlockStoreProvider: Provider<null | TBlockStoreProvider>


blockCssClass#

• Const blockCssClass: "CB"

Defined in#

system/core/frontend/src/constants.ts:16


pageRootContainerId#

• Const pageRootContainerId: "root"

Defined in#

system/core/frontend/src/constants.ts:68

Functions#

AdminPanelWidgetPlace#

â–¸ Const AdminPanelWidgetPlace<T>(props): null | Element

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
propsObject
props.pluginName?string
props.widgetNameT
props.widgetProps?WidgetTypes[T]

Returns#

null | Element

Defined in#

system/core/frontend/src/components/AdminPanelWidget/AdminPanelWidgetPlace.tsx:7


EntityHead#

â–¸ EntityHead(__namedParameters): null | Element

Creates a default head (SEO meta tags) for any BaseEntity (e.g. Post, Product, etc. See EDBEntity)

Parameters#

NameTypeDescription
__namedParametersObject-
__namedParameters.entity?TBasePageEntity | null-
__namedParameters.image?string | null-
__namedParameters.useFallback?booleanIf pageTitle is not defined, try to lookup for other known properties to use as pageTitle. For example, name in Product entity.

Returns#

null | Element

Defined in#

system/core/frontend/src/components/EntityHead/EntityHead.tsx:9


Link#

â–¸ Const Link(props): Element

Parameters#

NameType
propsTLinkProps

Returns#

Element

Defined in#

system/core/frontend/src/components/Link/Link.tsx:11


LoadBox#

â–¸ Const LoadBox(props): Element

Parameters#

NameType
propsLoadBoxProps

Returns#

Element

Defined in#

system/core/frontend/src/components/loadBox/Loadbox.tsx:13


SignIn#

â–¸ SignIn(props): Element

Parameters#

NameType
propsSignInProps

Returns#

Element

Defined in#

system/core/frontend/src/components/SignIn/SignIn.tsx:83


SignUp#

â–¸ SignUp(props): Element

Parameters#

NameType
propsSignUpProps

Returns#

Element

Defined in#

system/core/frontend/src/components/SignUp/SignUp.tsx:51


awaitImporter#

â–¸ Const awaitImporter(): Promise<void>

Returns#

Promise<void>

Defined in#

system/core/frontend/src/constants.ts:70


cleanParseContext#

â–¸ Const cleanParseContext(contextName): void

Parameters#

NameType
contextNamestring

Returns#

void

Defined in#

system/core/frontend/src/helpers/parserTransform.tsx:48


fetch#

â–¸ Const fetch(...args): any

Isomorphic fetch

Parameters#

NameType
...argsany[]

Returns#

any

Defined in#

system/core/frontend/src/helpers/isomorphicFetch.ts:7


getAuthClient#

â–¸ Const getAuthClient(): AuthClient

Returns#

AuthClient

Defined in#

system/core/frontend/src/helpers/AuthClient.ts:444


getBlockById#

â–¸ Const getBlockById(blockId?): undefined | null | TCromwellBlock<Component<TCromwellBlockProps<Component<Object, Object, any>>, Object, any>>

Parameters#

NameType
blockId?string

Returns#

undefined | null | TCromwellBlock<Component<TCromwellBlockProps<Component<Object, Object, any>>, Object, any>>

Defined in#

system/core/frontend/src/constants.ts:29


getBlockData#

â–¸ Const getBlockData(block): undefined | TCromwellBlockData

Parameters#

NameType
blockNode | ParentNode | Element | HTMLElement

Returns#

undefined | TCromwellBlockData

Defined in#

system/core/frontend/src/constants.ts:43


getBlockDataById#

â–¸ Const getBlockDataById(blockId): undefined | TCromwellBlockData

Parameters#

NameType
blockIdstring

Returns#

undefined | TCromwellBlockData

Defined in#

system/core/frontend/src/constants.ts:36


getBlockElementById#

â–¸ Const getBlockElementById(id?): undefined | null | HTMLElement

Parameters#

NameType
id?string

Returns#

undefined | null | HTMLElement

Defined in#

system/core/frontend/src/constants.ts:48


getBlockHtmlId#

â–¸ Const getBlockHtmlId(id): string

Parameters#

NameType
idstring

Returns#

string

Defined in#

system/core/frontend/src/constants.ts:17


getBlockHtmlType#

â–¸ Const getBlockHtmlType(type): string

Parameters#

NameType
typeTCromwellBlockType

Returns#

string

Defined in#

system/core/frontend/src/constants.ts:19


getBlockIdFromHtml#

â–¸ Const getBlockIdFromHtml(htmlId): string

Parameters#

NameType
htmlIdstring

Returns#

string

Defined in#

system/core/frontend/src/constants.ts:18


getBlockTypeFromHtml#

â–¸ Const getBlockTypeFromHtml(className): null | TCromwellBlockType

Parameters#

NameType
classNamestring

Returns#

null | TCromwellBlockType

Defined in#

system/core/frontend/src/constants.ts:20


getCStore#

â–¸ Const getCStore(options?): CStore

Get CStore instance

Parameters#

NameType
options?TGetCStoreOptions

Returns#

CStore

Defined in#

system/core/frontend/src/helpers/CStore.ts:782


getCentralServerClient#

â–¸ Const getCentralServerClient(): CentralServerClient

Get CentralServerClient instance from global store (singleton)

Returns#

CentralServerClient

Defined in#

system/core/frontend/src/api/CentralServerClient.ts:209


getDynamicLoader#

â–¸ Const getDynamicLoader(): TDynamicLoader

Returns#

TDynamicLoader

Defined in#

system/core/frontend/src/constants.ts:65


getGraphQLClient#

â–¸ Const getGraphQLClient(fetch?): CGraphQLClient

Get CGraphQLClient instance from global store (singleton)

Parameters#

NameType
fetch?any

Returns#

CGraphQLClient

Defined in#

system/core/frontend/src/api/CGraphQLClient.ts:1215


getHtmlPluginBlockName#

â–¸ Const getHtmlPluginBlockName(name): string

Parameters#

NameType
namestring

Returns#

string

Defined in#

system/core/frontend/src/constants.ts:27


getLoadableFrontendBundle#

â–¸ Const getLoadableFrontendBundle(bundleName, loader, loadable?, fallbackComponent?, dynamicLoaderProps?): ComponentType<Object>

Parameters#

NameType
bundleNamestring
loader() => Promise<undefined | null | TFrontendBundle>
loadable?TDynamicLoader
fallbackComponent?ComponentType<Object>
dynamicLoaderProps?Record<string, any>

Returns#

ComponentType<Object>

Defined in#

system/core/frontend/src/helpers/loadFrontendBundle.ts:86


getModuleImporter#

â–¸ Const getModuleImporter(serverPublicDir?, serverSide?): Importer

Parameters#

NameType
serverPublicDir?string
serverSide?boolean

Returns#

Importer

Defined in#

system/core/frontend/src/helpers/importer.ts:447


getNamedWidgetForPlace#

â–¸ Const getNamedWidgetForPlace<T>(widgetName, pluginName, widgetProps?): null | Element

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
widgetNameT
pluginNamestring
widgetProps?WidgetTypes[T]

Returns#

null | Element

Defined in#

system/core/frontend/src/components/AdminPanelWidget/AdminPanelWidgetPlace.tsx:30


getParserTransform#

â–¸ Const getParserTransform(contextName, options?): (node: Element) => null | void | ReactElement<any, string | JSXElementConstructor<any>>

Parameters#

NameType
contextNamestring
options?TParserTransformOptions

Returns#

fn

â–¸ (node): null | void | ReactElement<any, string | JSXElementConstructor<any>>

Parameters#
NameType
nodeElement
Returns#

null | void | ReactElement<any, string | JSXElementConstructor<any>>

Defined in#

system/core/frontend/src/helpers/parserTransform.tsx:61


getPluginStaticUrl#

â–¸ Const getPluginStaticUrl(pluginName): string

Parameters#

NameType
pluginNamestring

Returns#

string

Defined in#

system/core/frontend/src/helpers/contentGetters.ts:2


getRestApiClient#

â–¸ Const getRestApiClient(): CRestApiClient

Get CRestApiClient instance from global store (singleton)

Returns#

CRestApiClient

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:869


getServiceSecret#

â–¸ Const getServiceSecret(): Promise<undefined | string>

Returns#

Promise<undefined | string>

Defined in#

system/core/frontend/src/helpers/getServiceSecret.ts:3


getWidgets#

â–¸ Const getWidgets<T>(widgetName): Record<string, ComponentType<WidgetTypes[T]>>

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
widgetNameT

Returns#

Record<string, ComponentType<WidgetTypes[T]>>

Defined in#

system/core/frontend/src/helpers/registerWidget.ts:32


getWidgetsForPlace#

â–¸ Const getWidgetsForPlace<T>(widgetName, widgetProps?): (null | Element)[]

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
widgetNameT
widgetProps?WidgetTypes[T]

Returns#

(null | Element)[]

Defined in#

system/core/frontend/src/components/AdminPanelWidget/AdminPanelWidgetPlace.tsx:41


iconFromPath#

â–¸ Const iconFromPath(path): ComponentType<SVGProps<SVGSVGElement>>

Parameters#

NameType
pathany

Returns#

ComponentType<SVGProps<SVGSVGElement>>

Defined in#

system/core/frontend/src/helpers/iconFromPath.tsx:3


isAdminPanel#

â–¸ Const isAdminPanel(): boolean

Returns#

boolean

Defined in#

system/core/frontend/src/constants.ts:55


loadFrontendBundle#

â–¸ Const loadFrontendBundle(bundleName, loader): Promise<any>

Parameters#

NameType
bundleNamestring
loader() => Promise<undefined | null | TFrontendBundle>

Returns#

Promise<any>

Defined in#

system/core/frontend/src/helpers/loadFrontendBundle.ts:10


makeParserContext#

â–¸ Const makeParserContext(contextName): void

Parameters#

NameType
contextNamestring

Returns#

void

Defined in#

system/core/frontend/src/helpers/parserTransform.tsx:40


onWidgetRegister#

â–¸ Const onWidgetRegister<T>(widgetName, callback): void

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
widgetNameT
callback(pluginName: string, component: ComponentType<WidgetTypes[T]>) => any

Returns#

void

Defined in#

system/core/frontend/src/helpers/registerWidget.ts:26


parseHtml#

â–¸ Const parseHtml(html, options?): ReactElement<any, string | JSXElementConstructor<any>>[]

Parameters#

NameType
htmlstring
options?TParserTransformOptions

Returns#

ReactElement<any, string | JSXElementConstructor<any>>[]

Defined in#

system/core/frontend/src/helpers/parserTransform.tsx:103


registerPluginSSR#

â–¸ Const registerPluginSSR(pluginName, pageRoute): void

Registers a Plugin on a specific page for frontend (Next.js server) so a plugin will be able to receive its server-side props. If you don't need those props, then you can just use CPlugin without registering.

Parameters#

NameTypeDescription
pluginNamestringname in package.json on the plugin
pageRoutestringsee route in https://cromwellcms.com/docs/development/theme-development#page-config-properties pageRoute also can have * value to register on all pages.

Returns#

void

Defined in#

system/core/frontend/src/helpers/registerPlugin.ts:9


registerWidget#

â–¸ Const registerWidget<T>(options): void

Type parameters#

NameType
Textends keyof WidgetTypes

Parameters#

NameType
optionsObject
options.componentComponentType<WidgetTypes[T]>
options.pluginNamestring
options.widgetNameT

Returns#

void

Defined in#

system/core/frontend/src/helpers/registerWidget.ts:6


useAppPropsContext#

â–¸ Const useAppPropsContext<TProps>(): TAppPropsContext<TProps>

Type parameters#

NameType
TPropsunknown

Returns#

TAppPropsContext<TProps>

Defined in#

system/core/frontend/src/constants.ts:93


useAuthClient#

â–¸ Const useAuthClient(): AuthClient

Returns#

AuthClient

Defined in#

system/core/frontend/src/helpers/AuthClient.ts:449


useCart#

â–¸ Const useCart(options?): TStoreListItem[]

Parameters#

NameType
options?TUseCStorePropertyOptions

Returns#

TStoreListItem[]

Defined in#

system/core/frontend/src/helpers/hooks.ts:11


useCmsSettings#

â–¸ Const useCmsSettings(): undefined | TCmsSettings

Returns#

undefined | TCmsSettings

Defined in#

system/core/frontend/src/helpers/hooks.ts:81


useCurrency#

â–¸ Const useCurrency(): undefined | string

Returns#

undefined | string

Defined in#

system/core/frontend/src/helpers/hooks.ts:80


useForceUpdate#

â–¸ useForceUpdate(): () => void

Returns#

fn

â–¸ (): void

Returns#

void

Defined in#

system/core/frontend/src/helpers/forceUpdate.ts:3


useUserInfo#

â–¸ Const useUserInfo(): undefined | TUser

Returns#

undefined | TUser

Defined in#

system/core/frontend/src/helpers/hooks.ts:79


useViewedItems#

â–¸ Const useViewedItems(options?): TStoreListItem[]

Parameters#

NameType
options?TUseCStorePropertyOptions

Returns#

TStoreListItem[]

Defined in#

system/core/frontend/src/helpers/hooks.ts:43


useWishlist#

â–¸ Const useWishlist(options?): TStoreListItem[]

Parameters#

NameType
options?TUseCStorePropertyOptions

Returns#

TStoreListItem[]

Defined in#

system/core/frontend/src/helpers/hooks.ts:27