Skip to content

Commit

Permalink
feat: added initial collection flow docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chesterkmr committed Jun 27, 2024
1 parent c587d95 commit b5e661c
Show file tree
Hide file tree
Showing 9 changed files with 1,512 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations
7 changes: 7 additions & 0 deletions websites/docs/.astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ declare module 'astro:content' {
collection: 'docs';
data: InferEntrySchema<'docs'>;
} & { render(): Render['.md'] };
'en/collection-flow/introduction.mdx': {
id: 'en/collection-flow/introduction.mdx';
slug: 'en/collection-flow/introduction';
body: string;
collection: 'docs';
data: InferEntrySchema<'docs'>;
} & { render(): Render['.mdx'] };
'en/contributing.mdx': {
id: 'en/contributing.mdx';
slug: 'en/contributing';
Expand Down
47 changes: 46 additions & 1 deletion websites/docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';

import tailwind from '@astrojs/tailwind';

Expand Down Expand Up @@ -240,6 +240,51 @@ export default defineConfig({
},
],
},
{
label: 'KYB Collection Flow',
collapsed: true,
items: [
{
label: 'Introduction',
link: '/en/collection-flow/introduction',
},
{
label: 'Schema Breakdown',
link: '/en/collection-flow/schema-breakdown',
},
{
label: 'UI Elements',
items: [
{
label: 'Overview',
link: '/en/collection-flow/ui-elements',
},
{
label: 'JSONForm',
link: '/en/collection-flow/json-form',
},
],
},
{
label: 'Customization',
items: [
{
label: 'Theming',
link: '/en/collection-flow/theming',
},
],
},
{
label: 'API',
items: [
{
label: 'UI Definition updating',
link: '/en/collection-flow/ui-definition-updating',
},
],
},
],
},
],
customCss: [`/src/styles/custom.css`],
}),
Expand Down
215 changes: 215 additions & 0 deletions websites/docs/src/content/docs/en/collection-flow/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---
title: KYB Collection Flow
description: About Collection Flow

---

## Introduction to Collection Flow

Welcome to the documentation for the Collection Flow feature. The Collection Flow is designed to streamline the process of gathering data from customers through dynamic, wizard-style forms. This feature leverages a custom schema format, enabling the creation of multi-step forms that adapt to the specific needs of your application. Each step in the wizard is represented by a schema, which defines the structure, validation, and user interface elements required for that step.

### Key Features

- **Dynamic Form Creation**: Define forms dynamically using a custom schema format. This flexibility allows you to tailor the data collection process to suit various use cases and requirements.
- **Wizard-Style Navigation**: Break down the data collection process into manageable steps, guiding users through a sequence of pages to ensure a smooth and logical flow.
- **Custom Validation**: Integrate JSON schema-based validation to ensure the collected data meets your specified criteria before allowing users to proceed to the next step.
- **Reusable Components**: Utilize predefined UI components and form elements, such as text inputs, date pickers, and checkboxes, to build consistent and user-friendly forms.
- **Action Triggers**: Define actions that are triggered based on user interactions, such as clicking a button, to perform specific tasks like updating user information or navigating to the next step.

### Example Schema

Here is an example of a schema definition for a single step in the Collection Flow:

```json
{
"type": "page",
"name": "Personal Details",
"number": 1,
"stateName": "personal_details",
"pageValidation": [
{
"type": "json-schema",
"value": "validationSchema"
}
],
"elements": [
{
"type": "mainContainer",
"elements": [
{
"type": "container",
"elements": [
{
"type": "h1",
"options": {
"text": "Personal Information"
}
}
]
},
{
"type": "json-form",
"valueDestination": "entity.data.additionalInfo.mainRepresentative",
"name": "json-form:personal-information",
"options": {
"jsonFormDefinition": {
"required": [
"first-name-input",
"last-name-input",
"job-title-input",
"date-of-birth-input",
"phone-number-input"
]
}
},
"availableOn": [
{
"type": "json-schema",
"value": "validationSchema"
}
],
"elements": [
{
"name": "first-name-input",
"type": "json-form:text",
"valueDestination": "entity.data.additionalInfo.mainRepresentative.firstName",
"options": {
"label": "text.name",
"hint": "text.firstName",
"jsonFormDefinition": {
"type": "string"
}
}
},
{
"name": "last-name-input",
"type": "json-form:text",
"valueDestination": "entity.data.additionalInfo.mainRepresentative.lastName",
"options": {
"hint": "text.lastName",
"jsonFormDefinition": {
"type": "string"
}
}
},
{
"name": "job-title-input",
"type": "json-form:text",
"valueDestination": "entity.data.additionalInfo.mainRepresentative.additionalInfo.jobTitle",
"options": {
"label": "text.jobTitle.label",
"hint": "text.jobTitle.hint",
"jsonFormDefinition": {
"type": "string"
}
}
},
{
"name": "date-of-birth-input",
"type": "json-form:date",
"valueDestination": "entity.data.additionalInfo.mainRepresentative.dateOfBirth",
"options": {
"label": "text.dateOfBirth.label",
"hint": "text.dateHint",
"jsonFormDefinition": {
"type": "string"
},
"uiSchema": {
"ui:field": "DateInput",
"ui:label": true
}
}
},
{
"name": "phone-number-input",
"type": "international-phone-number",
"valueDestination": "entity.data.additionalInfo.mainRepresentative.phone",
"options": {
"label": "text.phoneNumber",
"jsonFormDefinition": {
"type": "string"
},
"uiSchema": {
"ui:field": "PhoneInput",
"ui:label": true
}
}
},
{
"name": "authority-checkbox",
"type": "authority-checkbox",
"valueDestination": "entity.data.additionalInfo.iHaveSigningAuthority",
"options": {
"label": "text.iHaveAuthority.label",
"jsonFormDefinition": {
"type": "boolean"
},
"uiSchema": {
"ui:label": false
}
}
}
]
},
{
"name": "controls-container",
"type": "container",
"options": {
"align": "right"
},
"elements": [
{
"name": "next-page-button",
"type": "submit-button",
"options": {
"uiDefinition": {
"classNames": ["align-right", "padding-top-10"]
},
"text": "text.continue"
},
"availableOn": [
{
"type": "json-schema",
"value": "validationSchema"
}
]
}
]
}
]
}
],
"actions": [
{
"type": "definitionPlugin",
"params": {
"pluginName": "update_end_user"
},
"dispatchOn": {
"uiEvents": [{ "event": "onClick", "uiElementName": "next-page-button" }],
"rules": [
{
"type": "json-schema",
"value": "validationSchema"
}
]
}
},
{
"type": "definitionEvent",
"params": {
"eventName": "NEXT"
},
"dispatchOn": {
"uiEvents": [{ "event": "onClick", "uiElementName": "next-page-button" }],
"rules": [
{
"type": "json-schema",
"value": "validationSchema"
}
]
}
}
]
}

Loading

0 comments on commit b5e661c

Please sign in to comment.