Module: frontend
CromwellCMS Frontend SDK
Exports Blocks, React components, API clients and frontend helpers.
Install#
npm i @cromwell/core-frontendUse#
Example of usage
import { getGraphQLClient } from '@cromwell/core-frontend';
const products = await getGraphQLClient().getProducts();Table of contents#
Classes#
- CContainer
- CEditor
- CGallery
- CGraphQLClient
- CHTML
- CImage
- CList
- CPlugin
- CRestApiClient
- CStore
- CText
- CentralServerClient
- Importer
Type aliases#
- CContainerProps
- SignInProps
- SignUpProps
- TApiClient
- TAppPropsContext
- TAuthClientOperationResult
- TBaseButton
- TBaseButtonProps
- TBaseTextField
- TBaseTextFieldProps
- TCGalleryProps
- TCGraphQLClient
- TCList
- TCListProps
- TCRestApiClient
- TCStoreOperationResult
- TCssClasses
- TDynamicLoader
- TElements
- TErrorInfo
- TGetCStoreOptions
- TGetFilteredOptions
- TGraphQLErrorInfo
- TImageComponent
- TListItemProps
- TListenerType
- TPaginationProps
- TRequestOptions
- TSignInFromType
- WidgetNames
- WidgetTypes
- Widget_DashboardProps
- Widget_EntityActions
- Widget_PostActions
Variables#
- AppPropsContext
- BaseButton
- BaseTextField
- BlockContentConsumer
- BlockContentProvider
- BlockStoreConsumer
- BlockStoreProvider
- blockCssClass
- pageRootContainerId
Functions#
- AdminPanelWidgetPlace
- EntityHead
- Link
- LoadBox
- SignIn
- SignUp
- awaitImporter
- cleanParseContext
- fetch
- getAuthClient
- getBlockById
- getBlockData
- getBlockDataById
- getBlockElementById
- getBlockHtmlId
- getBlockHtmlType
- getBlockIdFromHtml
- getBlockTypeFromHtml
- getCStore
- getCentralServerClient
- getDynamicLoader
- getGraphQLClient
- getHtmlPluginBlockName
- getLoadableFrontendBundle
- getModuleImporter
- getNamedWidgetForPlace
- getParserTransform
- getPluginStaticUrl
- getRestApiClient
- getServiceSecret
- getWidgets
- getWidgetsForPlace
- iconFromPath
- isAdminPanel
- loadFrontendBundle
- makeParserContext
- onWidgetRegister
- parseHtml
- registerPluginSSR
- registerWidget
- useAppPropsContext
- useAuthClient
- useCart
- useCmsSettings
- useCurrency
- useForceUpdate
- useUserInfo
- useViewedItems
- useWishlist
Type aliases#
CContainerProps#
Ƭ CContainerProps: { children?: React.ReactNode } & TCromwellBlockProps
Defined in#
system/core/frontend/src/components/CContainer/CContainer.tsx:6
SignInProps#
Ƭ SignInProps: Object
Type declaration#
| Name | Type | Description |
|---|---|---|
classes? | Partial<Record<"root" | "resetPassInstructions" | "forgotPassButton" | "backToSignInButton", string>> | CSS classes to pass to elements |
elements? | Object | Custom components to override default ones |
elements.Button? | TBaseButton | - |
elements.CodeField? | TBaseTextField | - |
elements.EmailField? | TBaseTextField | - |
elements.PasswordField? | TBaseTextField | - |
elements.TextField? | TBaseTextField | - |
initialFormType? | TSignInFromType | Type of form to open initially. sign-in by default; |
text? | Object | Translate/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#
| Name | Type | Description |
|---|---|---|
classes? | Partial<Record<"root", string>> | CSS classes to pass to elements |
elements? | Object | Custom components to override default ones |
elements.Button? | TBaseButton | - |
elements.EmailField? | TBaseTextField | - |
elements.NameField? | TBaseTextField | - |
elements.PasswordField? | TBaseTextField | - |
elements.TextField? | TBaseTextField | - |
text? | Object | Translate/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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
TProps | unknown |
Type declaration#
| Name | Type |
|---|---|
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#
| Name | Type | Description |
|---|---|---|
code | number | Available 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 | - |
message | string | - |
success | boolean | - |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
DataType | any |
ListItemProps | any |
Type declaration#
| Name | Type |
|---|---|
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#
| Name | Type | Description |
|---|---|---|
ListItem | React.ComponentType<TListItemProps<DataType, ListItemProps>> | Component that will display items |
className? | string | HTML 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? | boolean | Disable caching of loaded pages from "loader" prop when open a new page by pagination. Caching is working by default |
elements? | TElements | - |
firstBatch? | TPagedList<DataType> | null | First batch / page. Can be used with "loader". Supposed to be used in SSR to prerender page |
id | string | CBlock id |
isLoading? | boolean | Force to show preloader instead of a list |
listItemProps? | ListItemProps | Prop object to pass for each component in a list |
maxDomPages? | number | Max pages to render at screen. 10 by default |
minRangeToLoad? | number | Threshold in px where automatically request next or prev page. 200 by default. Use with useAutoLoading |
noDataLabel? | string | Label to show when data array is empty. "No data" by default |
pageSize? | number | Page size to first use in TPagedParams of "loader". After first batch recieved will use pageSize from pagedMeta if pagedMeta has it |
paginationButtonsNum? | number | Max number of page links to display. 10 by default |
pathname? | string | window.location.pathname for SSR to prerender pagination links |
scrollContainerSelector? | string | When useShowMoreButton and usePagination enabled CList needs to know container that scrolls pages to define current page during scrolling |
useAutoLoading? | boolean | Auto load more pages when scroll reached end of start in minRangeToLoad (px) |
usePagination? | boolean | Display pagination |
useQueryPagination? | boolean | Parse and set pageNumber in url as query param |
useShowMoreButton? | boolean | If 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#
| Name | Type |
|---|---|
code | number |
message? | string |
success | boolean |
Defined in#
system/core/frontend/src/helpers/CStore.ts:44
TCssClasses#
Ƭ TCssClasses: Object
Type declaration#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
func | () => Promise<ComponentType> |
options? | any |
Returns#
ComponentType
Defined in#
system/core/frontend/src/constants.ts:64
TElements#
Ƭ TElements: Object
Type declaration#
| Name | Type | Description |
|---|---|---|
arrowFirst? | React.ReactNode | - |
arrowLast? | React.ReactNode | - |
arrowLeft? | React.ReactNode | - |
arrowRight? | React.ReactNode | - |
pagination? | React.ComponentType<TPaginationProps> | - |
preloader? | React.ReactNode | Preloader 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#
| Name | Type |
|---|---|
disableLog? | boolean |
message | string |
route | string |
statusCode | number |
Defined in#
system/core/frontend/src/api/CRestApiClient.ts:32
TGetCStoreOptions#
Ƭ TGetCStoreOptions: Object
Type declaration#
| Name | Type | Description |
|---|---|---|
apiClient? | TApiClient | Provide 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? | boolean | If 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#
| Name | Type |
|---|---|
customFragment? | DocumentNode |
customFragmentName? | string |
filterParams? | TFilter |
pagedParams? | TPagedParams<TEntity> |
Defined in#
system/core/frontend/src/api/CGraphQLClient.ts:66
TGraphQLErrorInfo#
Ƭ TGraphQLErrorInfo: Object
Type declaration#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
count | number |
page | number |
onChange | (page: number) => void |
Defined in#
system/core/frontend/src/components/CList/types.ts:15
TRequestOptions#
Ƭ TRequestOptions: Object
Type declaration#
| Name | Type | Description |
|---|---|---|
disableLog? | boolean | Disable error logging |
headers? | Record<string, string> | Add headers |
input? | any | Body for 'post' and 'put' requests |
method? | string | HTTP 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#
| Name | Type |
|---|---|
CategoryActions | Widget_EntityActions<TProductCategory> |
Dashboard | Widget_DashboardProps |
OrderActions | Widget_EntityActions<TOrder> |
PluginSettings | TPluginSettingsProps |
PostActions | Widget_PostActions |
ProductActions | Widget_EntityActions<TProduct> |
TagActions | Widget_EntityActions<TTag> |
ThemeEditor | Object |
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#
| Name | Type |
|---|---|
stats | TCmsStats | 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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
props | Object |
props.pluginName? | string |
props.widgetName | T |
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#
| Name | Type | Description |
|---|---|---|
__namedParameters | Object | - |
__namedParameters.entity? | TBasePageEntity | null | - |
__namedParameters.image? | string | null | - |
__namedParameters.useFallback? | boolean | If 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#
| Name | Type |
|---|---|
props | TLinkProps |
Returns#
Element
Defined in#
system/core/frontend/src/components/Link/Link.tsx:11
LoadBox#
â–¸ Const LoadBox(props): Element
Parameters#
| Name | Type |
|---|---|
props | LoadBoxProps |
Returns#
Element
Defined in#
system/core/frontend/src/components/loadBox/Loadbox.tsx:13
SignIn#
â–¸ SignIn(props): Element
Parameters#
| Name | Type |
|---|---|
props | SignInProps |
Returns#
Element
Defined in#
system/core/frontend/src/components/SignIn/SignIn.tsx:83
SignUp#
â–¸ SignUp(props): Element
Parameters#
| Name | Type |
|---|---|
props | SignUpProps |
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#
| Name | Type |
|---|---|
contextName | string |
Returns#
void
Defined in#
system/core/frontend/src/helpers/parserTransform.tsx:48
fetch#
â–¸ Const fetch(...args): any
Isomorphic fetch
Parameters#
| Name | Type |
|---|---|
...args | any[] |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
block | Node | ParentNode | Element | HTMLElement |
Returns#
undefined | TCromwellBlockData
Defined in#
system/core/frontend/src/constants.ts:43
getBlockDataById#
â–¸ Const getBlockDataById(blockId): undefined | TCromwellBlockData
Parameters#
| Name | Type |
|---|---|
blockId | string |
Returns#
undefined | TCromwellBlockData
Defined in#
system/core/frontend/src/constants.ts:36
getBlockElementById#
â–¸ Const getBlockElementById(id?): undefined | null | HTMLElement
Parameters#
| Name | Type |
|---|---|
id? | string |
Returns#
undefined | null | HTMLElement
Defined in#
system/core/frontend/src/constants.ts:48
getBlockHtmlId#
â–¸ Const getBlockHtmlId(id): string
Parameters#
| Name | Type |
|---|---|
id | string |
Returns#
string
Defined in#
system/core/frontend/src/constants.ts:17
getBlockHtmlType#
â–¸ Const getBlockHtmlType(type): string
Parameters#
| Name | Type |
|---|---|
type | TCromwellBlockType |
Returns#
string
Defined in#
system/core/frontend/src/constants.ts:19
getBlockIdFromHtml#
â–¸ Const getBlockIdFromHtml(htmlId): string
Parameters#
| Name | Type |
|---|---|
htmlId | string |
Returns#
string
Defined in#
system/core/frontend/src/constants.ts:18
getBlockTypeFromHtml#
â–¸ Const getBlockTypeFromHtml(className): null | TCromwellBlockType
Parameters#
| Name | Type |
|---|---|
className | string |
Returns#
null | TCromwellBlockType
Defined in#
system/core/frontend/src/constants.ts:20
getCStore#
â–¸ Const getCStore(options?): CStore
Get CStore instance
Parameters#
| Name | Type |
|---|---|
options? | TGetCStoreOptions |
Returns#
Defined in#
system/core/frontend/src/helpers/CStore.ts:782
getCentralServerClient#
â–¸ Const getCentralServerClient(): CentralServerClient
Get CentralServerClient instance from global store (singleton)
Returns#
Defined in#
system/core/frontend/src/api/CentralServerClient.ts:209
getDynamicLoader#
â–¸ Const getDynamicLoader(): TDynamicLoader
Returns#
Defined in#
system/core/frontend/src/constants.ts:65
getGraphQLClient#
â–¸ Const getGraphQLClient(fetch?): CGraphQLClient
Get CGraphQLClient instance from global store (singleton)
Parameters#
| Name | Type |
|---|---|
fetch? | any |
Returns#
Defined in#
system/core/frontend/src/api/CGraphQLClient.ts:1215
getHtmlPluginBlockName#
â–¸ Const getHtmlPluginBlockName(name): string
Parameters#
| Name | Type |
|---|---|
name | string |
Returns#
string
Defined in#
system/core/frontend/src/constants.ts:27
getLoadableFrontendBundle#
â–¸ Const getLoadableFrontendBundle(bundleName, loader, loadable?, fallbackComponent?, dynamicLoaderProps?): ComponentType<Object>
Parameters#
| Name | Type |
|---|---|
bundleName | string |
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#
| Name | Type |
|---|---|
serverPublicDir? | string |
serverSide? | boolean |
Returns#
Defined in#
system/core/frontend/src/helpers/importer.ts:447
getNamedWidgetForPlace#
â–¸ Const getNamedWidgetForPlace<T>(widgetName, pluginName, widgetProps?): null | Element
Type parameters#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
widgetName | T |
pluginName | string |
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#
| Name | Type |
|---|---|
contextName | string |
options? | TParserTransformOptions |
Returns#
fn
â–¸ (node): null | void | ReactElement<any, string | JSXElementConstructor<any>>
Parameters#
| Name | Type |
|---|---|
node | Element |
Returns#
null | void | ReactElement<any, string | JSXElementConstructor<any>>
Defined in#
system/core/frontend/src/helpers/parserTransform.tsx:61
getPluginStaticUrl#
â–¸ Const getPluginStaticUrl(pluginName): string
Parameters#
| Name | Type |
|---|---|
pluginName | string |
Returns#
string
Defined in#
system/core/frontend/src/helpers/contentGetters.ts:2
getRestApiClient#
â–¸ Const getRestApiClient(): CRestApiClient
Get CRestApiClient instance from global store (singleton)
Returns#
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#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
widgetName | T |
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#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
widgetName | T |
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#
| Name | Type |
|---|---|
path | any |
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#
| Name | Type |
|---|---|
bundleName | string |
loader | () => Promise<undefined | null | TFrontendBundle> |
Returns#
Promise<any>
Defined in#
system/core/frontend/src/helpers/loadFrontendBundle.ts:10
makeParserContext#
â–¸ Const makeParserContext(contextName): void
Parameters#
| Name | Type |
|---|---|
contextName | string |
Returns#
void
Defined in#
system/core/frontend/src/helpers/parserTransform.tsx:40
onWidgetRegister#
â–¸ Const onWidgetRegister<T>(widgetName, callback): void
Type parameters#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
widgetName | T |
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#
| Name | Type |
|---|---|
html | string |
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#
| Name | Type | Description |
|---|---|---|
pluginName | string | name in package.json on the plugin |
pageRoute | string | see 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#
| Name | Type |
|---|---|
T | extends keyof WidgetTypes |
Parameters#
| Name | Type |
|---|---|
options | Object |
options.component | ComponentType<WidgetTypes[T]> |
options.pluginName | string |
options.widgetName | T |
Returns#
void
Defined in#
system/core/frontend/src/helpers/registerWidget.ts:6
useAppPropsContext#
â–¸ Const useAppPropsContext<TProps>(): TAppPropsContext<TProps>
Type parameters#
| Name | Type |
|---|---|
TProps | unknown |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
options? | TUseCStorePropertyOptions |
Returns#
TStoreListItem[]
Defined in#
system/core/frontend/src/helpers/hooks.ts:43
useWishlist#
â–¸ Const useWishlist(options?): TStoreListItem[]
Parameters#
| Name | Type |
|---|---|
options? | TUseCStorePropertyOptions |
Returns#
TStoreListItem[]