Module: frontend
CromwellCMS Frontend SDK
Exports Blocks, React components, API clients and frontend helpers.
#
Installnpm i @cromwell/core-frontend
#
UseExample 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 insystem/core/frontend/src/components/CContainer/CContainer.tsx:6
#
SignInPropsƬ SignInProps: Object
#
Type declarationName | 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 insystem/core/frontend/src/components/SignIn/SignIn.tsx:14
#
SignUpPropsƬ SignUpProps: Object
#
Type declarationName | 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 insystem/core/frontend/src/components/SignUp/SignUp.tsx:12
#
TApiClientƬ TApiClient: Object
#
Type declarationName | Type |
---|---|
getAttributes | () => Promise <undefined | TAttribute []> |
getCouponsByCodes? | (codes : string []) => Promise <undefined | TCoupon []> |
getProductById | (id : number ) => Promise <undefined | TProduct > |
#
Defined insystem/core/frontend/src/helpers/CStore.ts:27
#
TAppPropsContextƬ TAppPropsContext<TProps
>: Object
#
Type parametersName | Type |
---|---|
TProps | unknown |
#
Type declarationName | Type |
---|---|
pageProps? | TCromwellPageCoreProps & TProps |
routeInfo? | Object |
routeInfo.fullUrl? | string |
routeInfo.origin? | string |
router? | NextRouter |
forceUpdatePage? | () => void |
#
Defined insystem/core/frontend/src/constants.ts:81
#
TAuthClientOperationResultƬ TAuthClientOperationResult: Object
Common object with info about result of used operation.
#
Type declarationName | 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 insystem/core/frontend/src/helpers/AuthClient.ts:10
#
TBaseButtonƬ TBaseButton: React.ComponentType
<TBaseButtonProps
>
#
Defined insystem/core/frontend/src/components/BaseElements/BaseButton.tsx:16
#
TBaseButtonPropsƬ TBaseButtonProps: Object
#
Type declarationName | 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 insystem/core/frontend/src/components/BaseElements/BaseButton.tsx:3
#
TBaseTextFieldƬ TBaseTextField: React.ComponentType
<TBaseTextFieldProps
>
#
Defined insystem/core/frontend/src/components/BaseElements/BaseTextField.tsx:24
#
TBaseTextFieldPropsƬ TBaseTextFieldProps: Object
#
Type declarationName | 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 insystem/core/frontend/src/components/BaseElements/BaseTextField.tsx:3
#
TCGalleryPropsƬ TCGalleryProps: { className?
: string
; shouldComponentUpdate?
: boolean
} & TCromwellBlockProps
#
Defined insystem/core/frontend/src/components/CGallery/CGallery.tsx:27
#
TCGraphQLClientƬ TCGraphQLClient: CGraphQLClient
#
Defined insystem/core/frontend/src/api/CGraphQLClient.ts:1210
#
TCListƬ TCList<DataType
, ListItemProps
>: Object
Public API of CList instance
#
Type parametersName | Type |
---|---|
DataType | any |
ListItemProps | any |
#
Type declarationName | 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 insystem/core/frontend/src/components/CList/types.ts:105
#
TCListPropsƬ TCListProps<DataType
, ListItemProps
>: Object
#
Type parametersName |
---|
DataType |
ListItemProps |
#
Type declarationName | 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 insystem/core/frontend/src/components/CList/types.ts:34
#
TCRestApiClientƬ TCRestApiClient: typeof CRestApiClient
#
Defined insystem/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 declarationName | Type |
---|---|
code | number |
message? | string |
success | boolean |
#
Defined insystem/core/frontend/src/helpers/CStore.ts:44
#
TCssClassesƬ TCssClasses: Object
#
Type declarationName | Type |
---|---|
contentWrapper? | string |
page? | string |
pagination? | string |
paginationActiveLink? | string |
paginationArrowLink? | string |
paginationDisabledLink? | string |
paginationLink? | string |
scrollBox? | string |
#
Defined insystem/core/frontend/src/components/CList/types.ts:4
#
TDynamicLoaderƬ TDynamicLoader: (func
: () => Promise
<ComponentType
>, options?
: any
) => ComponentType
#
Type declarationâ–¸ (func
, options?
): ComponentType
#
ParametersName | Type |
---|---|
func | () => Promise <ComponentType > |
options? | any |
#
ReturnsComponentType
#
Defined insystem/core/frontend/src/constants.ts:64
#
TElementsƬ TElements: Object
#
Type declarationName | 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 insystem/core/frontend/src/components/CList/types.ts:21
#
TErrorInfoƬ TErrorInfo: Object
#
Type declarationName | Type |
---|---|
disableLog? | boolean |
message | string |
route | string |
statusCode | number |
#
Defined insystem/core/frontend/src/api/CRestApiClient.ts:32
#
TGetCStoreOptionsƬ TGetCStoreOptions: Object
#
Type declarationName | 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 insystem/core/frontend/src/helpers/CStore.ts:764
#
TGetFilteredOptionsƬ TGetFilteredOptions<TEntity
, TFilter
>: Object
#
Type parametersName |
---|
TEntity |
TFilter |
#
Type declarationName | Type |
---|---|
customFragment? | DocumentNode |
customFragmentName? | string |
filterParams? | TFilter |
pagedParams? | TPagedParams <TEntity > |
#
Defined insystem/core/frontend/src/api/CGraphQLClient.ts:66
#
TGraphQLErrorInfoƬ TGraphQLErrorInfo: Object
#
Type declarationName | Type |
---|---|
message? | string |
path? | string |
stacktrace? | string |
status? | string |
statusCode? | number |
#
Defined insystem/core/frontend/src/api/CGraphQLClient.ts:58
#
TImageComponentƬ TImageComponent: React.ComponentClass
<Partial
<ImageProps
>>
#
Defined insystem/core/frontend/src/components/CGallery/CGallery.tsx:32
#
TListItemPropsƬ TListItemProps<DataType
, ListItemProps
>: Object
#
Type parametersName |
---|
DataType |
ListItemProps |
#
Type declarationName | Type |
---|---|
data? | DataType |
listItemProps? | ListItemProps |
#
Defined insystem/core/frontend/src/components/CList/types.ts:131
#
TListenerTypeƬ TListenerType: "componentDidUpdate"
#
Defined insystem/core/frontend/src/components/CList/types.ts:129
#
TPaginationPropsƬ TPaginationProps: Object
#
Type declarationName | Type |
---|---|
count | number |
page | number |
onChange | (page : number ) => void |
#
Defined insystem/core/frontend/src/components/CList/types.ts:15
#
TRequestOptionsƬ TRequestOptions: Object
#
Type declarationName | 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 insystem/core/frontend/src/api/CRestApiClient.ts:39
#
TSignInFromTypeƬ TSignInFromType: "sign-in"
| "forgot-pass"
| "reset-pass"
#
Defined insystem/core/frontend/src/components/SignIn/SignIn.tsx:10
#
WidgetNamesƬ WidgetNames: keyof WidgetTypes
#
Defined insystem/core/frontend/src/widget-types.ts:35
#
WidgetTypesƬ WidgetTypes: Object
#
Type declarationName | 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 insystem/core/frontend/src/widget-types.ts:15
#
Widget_DashboardPropsƬ Widget_DashboardProps: Object
#
Type declarationName | 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 insystem/core/frontend/src/widget-types.ts:37
#
Widget_EntityActionsƬ Widget_EntityActions<T
>: Object
#
Type parametersName |
---|
T |
#
Type declarationName | Type |
---|---|
data? | T |
setData? | (data : T ) => any |
#
Defined insystem/core/frontend/src/widget-types.ts:48
#
Widget_PostActionsƬ Widget_PostActions: Widget_EntityActions
<TPost
> & { editorInstance
: any
}
#
Defined insystem/core/frontend/src/widget-types.ts:53
#
Variables#
AppPropsContext• Const
AppPropsContext: Context
<TAppPropsContext
<unknown
>>
#
Defined insystem/core/frontend/src/constants.ts:91
#
BaseButton• Const
BaseButton: TBaseButton
#
Defined insystem/core/frontend/src/components/BaseElements/BaseButton.tsx:18
#
BaseTextField• Const
BaseTextField: TBaseTextField
#
Defined insystem/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 insystem/core/frontend/src/constants.ts:16
#
pageRootContainerId• Const
pageRootContainerId: "root"
#
Defined insystem/core/frontend/src/constants.ts:68
#
Functions#
AdminPanelWidgetPlaceâ–¸ Const
AdminPanelWidgetPlace<T
>(props
): null
| Element
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
props | Object |
props.pluginName? | string |
props.widgetName | T |
props.widgetProps? | WidgetTypes [T ] |
#
Returnsnull
| Element
#
Defined insystem/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)
#
ParametersName | 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. |
#
Returnsnull
| Element
#
Defined insystem/core/frontend/src/components/EntityHead/EntityHead.tsx:9
#
Linkâ–¸ Const
Link(props
): Element
#
ParametersName | Type |
---|---|
props | TLinkProps |
#
ReturnsElement
#
Defined insystem/core/frontend/src/components/Link/Link.tsx:11
#
LoadBoxâ–¸ Const
LoadBox(props
): Element
#
ParametersName | Type |
---|---|
props | LoadBoxProps |
#
ReturnsElement
#
Defined insystem/core/frontend/src/components/loadBox/Loadbox.tsx:13
#
SignInâ–¸ SignIn(props
): Element
#
ParametersName | Type |
---|---|
props | SignInProps |
#
ReturnsElement
#
Defined insystem/core/frontend/src/components/SignIn/SignIn.tsx:83
#
SignUpâ–¸ SignUp(props
): Element
#
ParametersName | Type |
---|---|
props | SignUpProps |
#
ReturnsElement
#
Defined insystem/core/frontend/src/components/SignUp/SignUp.tsx:51
#
awaitImporterâ–¸ Const
awaitImporter(): Promise
<void
>
#
ReturnsPromise
<void
>
#
Defined insystem/core/frontend/src/constants.ts:70
#
cleanParseContextâ–¸ Const
cleanParseContext(contextName
): void
#
ParametersName | Type |
---|---|
contextName | string |
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/parserTransform.tsx:48
#
fetchâ–¸ Const
fetch(...args
): any
Isomorphic fetch
#
ParametersName | Type |
---|---|
...args | any [] |
#
Returnsany
#
Defined insystem/core/frontend/src/helpers/isomorphicFetch.ts:7
#
getAuthClientâ–¸ Const
getAuthClient(): AuthClient
#
ReturnsAuthClient
#
Defined insystem/core/frontend/src/helpers/AuthClient.ts:444
#
getBlockByIdâ–¸ Const
getBlockById(blockId?
): undefined
| null
| TCromwellBlock
<Component
<TCromwellBlockProps
<Component
<Object
, Object
, any
>>, Object
, any
>>
#
ParametersName | Type |
---|---|
blockId? | string |
#
Returnsundefined
| null
| TCromwellBlock
<Component
<TCromwellBlockProps
<Component
<Object
, Object
, any
>>, Object
, any
>>
#
Defined insystem/core/frontend/src/constants.ts:29
#
getBlockDataâ–¸ Const
getBlockData(block
): undefined
| TCromwellBlockData
#
ParametersName | Type |
---|---|
block | Node | ParentNode | Element | HTMLElement |
#
Returnsundefined
| TCromwellBlockData
#
Defined insystem/core/frontend/src/constants.ts:43
#
getBlockDataByIdâ–¸ Const
getBlockDataById(blockId
): undefined
| TCromwellBlockData
#
ParametersName | Type |
---|---|
blockId | string |
#
Returnsundefined
| TCromwellBlockData
#
Defined insystem/core/frontend/src/constants.ts:36
#
getBlockElementByIdâ–¸ Const
getBlockElementById(id?
): undefined
| null
| HTMLElement
#
ParametersName | Type |
---|---|
id? | string |
#
Returnsundefined
| null
| HTMLElement
#
Defined insystem/core/frontend/src/constants.ts:48
#
getBlockHtmlIdâ–¸ Const
getBlockHtmlId(id
): string
#
ParametersName | Type |
---|---|
id | string |
#
Returnsstring
#
Defined insystem/core/frontend/src/constants.ts:17
#
getBlockHtmlTypeâ–¸ Const
getBlockHtmlType(type
): string
#
ParametersName | Type |
---|---|
type | TCromwellBlockType |
#
Returnsstring
#
Defined insystem/core/frontend/src/constants.ts:19
#
getBlockIdFromHtmlâ–¸ Const
getBlockIdFromHtml(htmlId
): string
#
ParametersName | Type |
---|---|
htmlId | string |
#
Returnsstring
#
Defined insystem/core/frontend/src/constants.ts:18
#
getBlockTypeFromHtmlâ–¸ Const
getBlockTypeFromHtml(className
): null
| TCromwellBlockType
#
ParametersName | Type |
---|---|
className | string |
#
Returnsnull
| TCromwellBlockType
#
Defined insystem/core/frontend/src/constants.ts:20
#
getCStoreâ–¸ Const
getCStore(options?
): CStore
Get CStore instance
#
ParametersName | Type |
---|---|
options? | TGetCStoreOptions |
#
Returns#
Defined insystem/core/frontend/src/helpers/CStore.ts:782
#
getCentralServerClientâ–¸ Const
getCentralServerClient(): CentralServerClient
Get CentralServerClient instance from global store (singleton)
#
Returns#
Defined insystem/core/frontend/src/api/CentralServerClient.ts:209
#
getDynamicLoaderâ–¸ Const
getDynamicLoader(): TDynamicLoader
#
Returns#
Defined insystem/core/frontend/src/constants.ts:65
#
getGraphQLClientâ–¸ Const
getGraphQLClient(fetch?
): CGraphQLClient
Get CGraphQLClient instance from global store (singleton)
#
ParametersName | Type |
---|---|
fetch? | any |
#
Returns#
Defined insystem/core/frontend/src/api/CGraphQLClient.ts:1215
#
getHtmlPluginBlockNameâ–¸ Const
getHtmlPluginBlockName(name
): string
#
ParametersName | Type |
---|---|
name | string |
#
Returnsstring
#
Defined insystem/core/frontend/src/constants.ts:27
#
getLoadableFrontendBundleâ–¸ Const
getLoadableFrontendBundle(bundleName
, loader
, loadable?
, fallbackComponent?
, dynamicLoaderProps?
): ComponentType
<Object
>
#
ParametersName | Type |
---|---|
bundleName | string |
loader | () => Promise <undefined | null | TFrontendBundle > |
loadable? | TDynamicLoader |
fallbackComponent? | ComponentType <Object > |
dynamicLoaderProps? | Record <string , any > |
#
ReturnsComponentType
<Object
>
#
Defined insystem/core/frontend/src/helpers/loadFrontendBundle.ts:86
#
getModuleImporterâ–¸ Const
getModuleImporter(serverPublicDir?
, serverSide?
): Importer
#
ParametersName | Type |
---|---|
serverPublicDir? | string |
serverSide? | boolean |
#
Returns#
Defined insystem/core/frontend/src/helpers/importer.ts:447
#
getNamedWidgetForPlaceâ–¸ Const
getNamedWidgetForPlace<T
>(widgetName
, pluginName
, widgetProps?
): null
| Element
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
widgetName | T |
pluginName | string |
widgetProps? | WidgetTypes [T ] |
#
Returnsnull
| Element
#
Defined insystem/core/frontend/src/components/AdminPanelWidget/AdminPanelWidgetPlace.tsx:30
#
getParserTransformâ–¸ Const
getParserTransform(contextName
, options?
): (node
: Element
) => null
| void
| ReactElement
<any
, string
| JSXElementConstructor
<any
>>
#
ParametersName | Type |
---|---|
contextName | string |
options? | TParserTransformOptions |
#
Returnsfn
â–¸ (node
): null
| void
| ReactElement
<any
, string
| JSXElementConstructor
<any
>>
#
ParametersName | Type |
---|---|
node | Element |
#
Returnsnull
| void
| ReactElement
<any
, string
| JSXElementConstructor
<any
>>
#
Defined insystem/core/frontend/src/helpers/parserTransform.tsx:61
#
getPluginStaticUrlâ–¸ Const
getPluginStaticUrl(pluginName
): string
#
ParametersName | Type |
---|---|
pluginName | string |
#
Returnsstring
#
Defined insystem/core/frontend/src/helpers/contentGetters.ts:2
#
getRestApiClientâ–¸ Const
getRestApiClient(): CRestApiClient
Get CRestApiClient instance from global store (singleton)
#
Returns#
Defined insystem/core/frontend/src/api/CRestApiClient.ts:869
#
getServiceSecretâ–¸ Const
getServiceSecret(): Promise
<undefined
| string
>
#
ReturnsPromise
<undefined
| string
>
#
Defined insystem/core/frontend/src/helpers/getServiceSecret.ts:3
#
getWidgetsâ–¸ Const
getWidgets<T
>(widgetName
): Record
<string
, ComponentType
<WidgetTypes
[T
]>>
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
widgetName | T |
#
ReturnsRecord
<string
, ComponentType
<WidgetTypes
[T
]>>
#
Defined insystem/core/frontend/src/helpers/registerWidget.ts:32
#
getWidgetsForPlaceâ–¸ Const
getWidgetsForPlace<T
>(widgetName
, widgetProps?
): (null
| Element
)[]
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
widgetName | T |
widgetProps? | WidgetTypes [T ] |
#
Returns(null
| Element
)[]
#
Defined insystem/core/frontend/src/components/AdminPanelWidget/AdminPanelWidgetPlace.tsx:41
#
iconFromPathâ–¸ Const
iconFromPath(path
): ComponentType
<SVGProps
<SVGSVGElement
>>
#
ParametersName | Type |
---|---|
path | any |
#
ReturnsComponentType
<SVGProps
<SVGSVGElement
>>
#
Defined insystem/core/frontend/src/helpers/iconFromPath.tsx:3
#
isAdminPanelâ–¸ Const
isAdminPanel(): boolean
#
Returnsboolean
#
Defined insystem/core/frontend/src/constants.ts:55
#
loadFrontendBundleâ–¸ Const
loadFrontendBundle(bundleName
, loader
): Promise
<any
>
#
ParametersName | Type |
---|---|
bundleName | string |
loader | () => Promise <undefined | null | TFrontendBundle > |
#
ReturnsPromise
<any
>
#
Defined insystem/core/frontend/src/helpers/loadFrontendBundle.ts:10
#
makeParserContextâ–¸ Const
makeParserContext(contextName
): void
#
ParametersName | Type |
---|---|
contextName | string |
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/parserTransform.tsx:40
#
onWidgetRegisterâ–¸ Const
onWidgetRegister<T
>(widgetName
, callback
): void
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
widgetName | T |
callback | (pluginName : string , component : ComponentType <WidgetTypes [T ]>) => any |
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/registerWidget.ts:26
#
parseHtmlâ–¸ Const
parseHtml(html
, options?
): ReactElement
<any
, string
| JSXElementConstructor
<any
>>[]
#
ParametersName | Type |
---|---|
html | string |
options? | TParserTransformOptions |
#
ReturnsReactElement
<any
, string
| JSXElementConstructor
<any
>>[]
#
Defined insystem/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.
#
ParametersName | 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. |
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/registerPlugin.ts:9
#
registerWidgetâ–¸ Const
registerWidget<T
>(options
): void
#
Type parametersName | Type |
---|---|
T | extends keyof WidgetTypes |
#
ParametersName | Type |
---|---|
options | Object |
options.component | ComponentType <WidgetTypes [T ]> |
options.pluginName | string |
options.widgetName | T |
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/registerWidget.ts:6
#
useAppPropsContextâ–¸ Const
useAppPropsContext<TProps
>(): TAppPropsContext
<TProps
>
#
Type parametersName | Type |
---|---|
TProps | unknown |
#
ReturnsTAppPropsContext
<TProps
>
#
Defined insystem/core/frontend/src/constants.ts:93
#
useAuthClientâ–¸ Const
useAuthClient(): AuthClient
#
ReturnsAuthClient
#
Defined insystem/core/frontend/src/helpers/AuthClient.ts:449
#
useCartâ–¸ Const
useCart(options?
): TStoreListItem
[]
#
ParametersName | Type |
---|---|
options? | TUseCStorePropertyOptions |
#
ReturnsTStoreListItem
[]
#
Defined insystem/core/frontend/src/helpers/hooks.ts:11
#
useCmsSettingsâ–¸ Const
useCmsSettings(): undefined
| TCmsSettings
#
Returnsundefined
| TCmsSettings
#
Defined insystem/core/frontend/src/helpers/hooks.ts:81
#
useCurrencyâ–¸ Const
useCurrency(): undefined
| string
#
Returnsundefined
| string
#
Defined insystem/core/frontend/src/helpers/hooks.ts:80
#
useForceUpdateâ–¸ useForceUpdate(): () => void
#
Returnsfn
â–¸ (): void
#
Returnsvoid
#
Defined insystem/core/frontend/src/helpers/forceUpdate.ts:3
#
useUserInfoâ–¸ Const
useUserInfo(): undefined
| TUser
#
Returnsundefined
| TUser
#
Defined insystem/core/frontend/src/helpers/hooks.ts:79
#
useViewedItemsâ–¸ Const
useViewedItems(options?
): TStoreListItem
[]
#
ParametersName | Type |
---|---|
options? | TUseCStorePropertyOptions |
#
ReturnsTStoreListItem
[]
#
Defined insystem/core/frontend/src/helpers/hooks.ts:43
#
useWishlistâ–¸ Const
useWishlist(options?
): TStoreListItem
[]
#
ParametersName | Type |
---|---|
options? | TUseCStorePropertyOptions |
#
ReturnsTStoreListItem
[]