Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.10.4",
"version": "0.11.0",
"npmClient": "yarn",
"command": {
"publish": {
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas-theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/atlas-theme",
"version": "0.10.4",
"version": "0.11.0",
"description": "> ATLAS Theme",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/aurora-theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/aurora-theme",
"version": "0.10.4",
"version": "0.11.0",
"description": "> AURORA Theme",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/blueberry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/blueberry-theme",
"version": "0.10.4",
"version": "0.11.0",
"description": "> TODO: description",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/br-addons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/br-addons",
"version": "0.10.4",
"version": "0.11.0",
"description": "> TODO: description",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down
110 changes: 80 additions & 30 deletions packages/client-core/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ export interface IFormAccess {
formName: string
}

// ----------- V2-todo ------------

export interface RemoteFormConfig {
access: IFormAccess
debug: boolean
requestMetadata: any
requestMetadata: Record<string, unknown>
}

export interface LocalFormConfig {
schema: Object
schema: Record<string, unknown>
debug: boolean
}

// --------- end v2

export interface IApiService {
formAccess: IFormAccess
debug?: boolean
Expand All @@ -47,42 +43,51 @@ export interface IUrlParams {
export interface IPropsPresetCollection {
name: string
presets: {
[key: string]: any
[key: string]: unknown
}
}
export interface IAddonsConfig {
uiPropsPresets?: IPropsPresetCollection[]
}

export interface WebhookResult<T = Record<string, unknown>> {
preventContinue?: boolean
errorSlugField?: string
errorMessage?: string
newTrackSlug?: string
processedData?: T
inputFieldErrors?: Array<{
slug: string
message: string
}>
[key: string]: unknown
}

export interface IFormEngineOptions {
requestsMetadata?: Object
requestsMetadata?: Record<string, unknown>
debug?: boolean
addons?: IAddonsConfig
enforceNewSession?: boolean
mockStep?: IStepData // provisional way to mock step response - remove on albus version
mockStep?: IStepData
}
export interface IDefaultStep {
data: {
slug: string
type: string
friendlyName: string
fields: IStepConfigField[]
}
data: IStepData
position: number
webhookResult: Object
webhookResult: WebhookResult
}

export interface IFormResponseData {
auth: string
meta: IFormMetadata
capturedData: {
[key: string]: any
[key: string]: unknown
}
step: IFormStep
}

export interface IFormStep {
data: IStepData
webhookResult: Object
webhookResult: WebhookResult
position: number
}

Expand All @@ -97,45 +102,90 @@ export interface IFormMetadata {
steps: IFormStepBasicInfo[]
}

export interface IStepData {
export interface IStepData<T = Record<string, unknown>> {
slug: string
type: string
friendlyName: string
stepName: string
fields: IStepConfigField[]
extraInfo?: string
position?: number
webhookResult?: WebhookResult<T>
}

export interface IStepConfigFieldUiProps {
label?: string
sublabel?: string
placeholder?: string
[key: string]: any
htmlType?: string
options?: {
value: string
label: string
}[]
[key: string]: unknown
}

export interface IStepConfigFieldValidator {
type: string
context?: 'server' | 'client'
properties?: {
[key: string]: unknown
}
}

export interface IStepConfigField {
slug: string
"ui:widget": string
"ui:props": IStepConfigFieldUiProps
validators: IStepConfigFieldValidator[]
conditional?: string
"ui:props-conditional"?: {
"ui:props-preset"?: string
"ui:props-conditional"?: Array<{
conditional: string
props: {
[propKey: string]: any
[propKey: string]: unknown
}
}[]
}>
"ui:styles"?: {
size: "full" | "half"
grow?: "1" | "2" | "3"

}
meta: Object
validators: IStepConfigFieldValidator[]
conditional?: string
meta: Record<string, unknown>
component: string
value?: any
value?: unknown
}

export interface IRequestMetadata {
extraRequestsMetaData?: Object
[key: string]: any
extraRequestsMetaData?: Record<string, unknown>
[key: string]: unknown
}

export interface ICustomField {
clearManuallySetError: () => void
errorMessage: string
fieldId: string
fieldValidators: IStepConfigFieldValidator[]
hasError: boolean
inputRef: { current: HTMLElement | null }
isOptional: boolean
isRequired: boolean
isValid: boolean
label: string
manuallySetFieldError: (message: string) => void
meta: Record<string, unknown>
modifyPayloadKeys: (newData?: Record<string, unknown>) => void
onBlur: (value: string) => void
onChange: (value: string) => void
onFocus: () => void
payload: Record<string, unknown>
placeholder: string
slug: string
sublabel: string
value: string
options?: Array<{ label: string; value: string }>
uploadLabels?: {
button: string
description: string
sentButton: string
}
}
2 changes: 1 addition & 1 deletion packages/client-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/client-core",
"version": "0.10.4",
"version": "0.11.0",
"description": "> TODO: description",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down
6 changes: 3 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iq-firebolt/client",
"version": "0.10.4",
"version": "0.11.0",
"description": "> TODO: description",
"author": "iq team",
"homepage": "https://github.com/IQ-tech/firebolt#readme",
Expand Down Expand Up @@ -36,8 +36,8 @@
},
"dependencies": {
"@babel/runtime": "^7.16.3",
"@iq-firebolt/client-core": "0.9.9",
"@iq-firebolt/validators": "0.9.9",
"@iq-firebolt/client-core": "^0.11.0",
"@iq-firebolt/validators": "^0.11.0",
"classnames": "^2.3.1",
"fast-levenshtein": "^3.0.0",
"regex-parser": "^2.2.11",
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/components/FireboltProvider/hook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function useFireboltProvider({
function goNextStep(
stepFieldsPayload?: IFieldsObject,
{ extraRequestsMetaData = {} }: IRequestMetadata = {}
): Promise<void | Object> {
): Promise<void | Record<string, unknown>> {
setIsFormLoading(true)
setBeforeProceedPayload(stepFieldsPayload)
setLastSentPayload(stepFieldsPayload)
Expand Down Expand Up @@ -136,7 +136,7 @@ function useFireboltProvider({
.catch((err) => _handleTransitionError(err, stepFieldsPayload))
}

function goPreviousStep(): Promise<void | Object> {
function goPreviousStep(): Promise<void | Record<string, unknown>> {
setIsFormLoading(true)
return formEngine.current
.previousStep(currentStep.data.slug)
Expand All @@ -163,7 +163,7 @@ function useFireboltProvider({
formEngine.current.removeRequestMetadataItem(key)
}

function getRequestsMetadata(): Object {
function getRequestsMetadata(): Record<string, unknown> {
return formEngine.current.requestsMetadata
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const defaultStep: IDefaultStep = {
slug: "",
type: "",
friendlyName: "",
stepName: "",
fields: [],
},
position: 0,
Expand Down
7 changes: 4 additions & 3 deletions packages/client/src/components/Wizard/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"

export function filterChildren(
children: React.ReactElement,
children: React.ReactElement | React.ReactElement[],
currentStepSlug: string
) {
): React.ReactElement | null {
if (!children) return null

const childrenArray = React.Children.toArray(children)
Expand All @@ -18,5 +18,6 @@ export function filterChildren(
return !childMatch || childMatch === "*"
})

return exactMatch ? exactMatch : getFirstGeneralCaseItem()
const result = exactMatch ? exactMatch : getFirstGeneralCaseItem()
return result as React.ReactElement | null
}
2 changes: 1 addition & 1 deletion packages/client/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
IFormStep,
IFormMetadata,
} from "@iq-firebolt/client-core"
import { IFieldsObject, INextStepFunction } from "./types"
import { IFieldsObject, INextStepFunction, ThemeConfig, IFormEndPayload } from "./types"

export interface IFireboltContext {
//states
Expand Down
Loading