2
0

feat(integration): Add Google Sheets integration

This commit is contained in:
Baptiste Arnaud
2022-01-18 18:25:18 +01:00
parent 2814a352b2
commit f49b5143cf
67 changed files with 2560 additions and 391 deletions

View File

@ -0,0 +1,12 @@
import { StepBase } from '.'
export type BubbleStep = TextStep
export enum BubbleStepType {
TEXT = 'text',
}
export type TextStep = StepBase & {
type: BubbleStepType.TEXT
content: { html: string; richText: unknown[]; plainText: string }
}

View File

@ -1,3 +1,5 @@
export * from './steps'
export * from './bubble'
export * from './inputs'
export * from './logic'
export * from './integration'

View File

@ -20,6 +20,13 @@ export enum InputStepType {
CHOICE = 'choice input',
}
export type InputStepOptions =
| TextInputOptions
| NumberInputOptions
| EmailInputOptions
| DateInputOptions
| UrlInputOptions
export type TextInputStep = StepBase & {
type: InputStepType.TEXT
options?: TextInputOptions

View File

@ -0,0 +1,52 @@
import { StepBase } from '.'
import { Table } from '../..'
export type IntegrationStep = GoogleSheetsStep
export type IntegrationStepOptions = GoogleSheetsOptions
export enum IntegrationStepType {
GOOGLE_SHEETS = 'Google Sheets',
}
export type GoogleSheetsStep = StepBase & {
type: IntegrationStepType.GOOGLE_SHEETS
options?: GoogleSheetsOptions
}
export enum GoogleSheetsAction {
GET = 'Get data from sheet',
INSERT_ROW = 'Insert a row',
UPDATE_ROW = 'Update a row',
}
export type GoogleSheetsOptions =
| GoogleSheetsGetOptions
| GoogleSheetsInsertRowOptions
| GoogleSheetsUpdateRowOptions
type GoogleSheetsOptionsBase = {
credentialsId?: string
spreadsheetId?: string
sheetId?: string
}
export type Cell = { column?: string; value?: string }
export type ExtractingCell = { column?: string; variableId?: string }
export type GoogleSheetsGetOptions = GoogleSheetsOptionsBase & {
action?: GoogleSheetsAction.GET
referenceCell?: Cell
cellsToExtract?: Table<ExtractingCell>
}
export type GoogleSheetsInsertRowOptions = GoogleSheetsOptionsBase & {
action?: GoogleSheetsAction.INSERT_ROW
cellsToInsert?: Table<Cell>
}
export type GoogleSheetsUpdateRowOptions = GoogleSheetsOptionsBase & {
action?: GoogleSheetsAction.UPDATE_ROW
referenceCell?: Cell
cellsToUpsert?: Table<Cell>
}

View File

@ -8,6 +8,8 @@ export enum LogicStepType {
CONDITION = 'Condition',
}
export type LogicStepOptions = SetVariableOptions | ConditionOptions
export type SetVariableStep = StepBase & {
type: LogicStepType.SET_VARIABLE
options?: SetVariableOptions

View File

@ -1,15 +1,40 @@
import {
InputStepOptions,
IntegrationStepOptions,
IntegrationStepType,
LogicStepOptions,
} from '.'
import { BubbleStep, BubbleStepType } from './bubble'
import { InputStep, InputStepType } from './inputs'
import { IntegrationStep } from './integration'
import { LogicStep, LogicStepType } from './logic'
export type Step = StartStep | BubbleStep | InputStep | LogicStep
export type Step =
| StartStep
| BubbleStep
| InputStep
| LogicStep
| IntegrationStep
export type BubbleStep = TextStep
export type DraggableStep = BubbleStep | InputStep | LogicStep | IntegrationStep
export type StepType = 'start' | BubbleStepType | InputStepType | LogicStepType
export type StepType =
| 'start'
| BubbleStepType
| InputStepType
| LogicStepType
| IntegrationStepType
export enum BubbleStepType {
TEXT = 'text',
}
export type DraggableStepType =
| BubbleStepType
| InputStepType
| LogicStepType
| IntegrationStepType
export type StepOptions =
| InputStepOptions
| LogicStepOptions
| IntegrationStepOptions
export type StepBase = { id: string; blockId: string; target?: Target }
@ -18,9 +43,4 @@ export type StartStep = StepBase & {
label: string
}
export type TextStep = StepBase & {
type: BubbleStepType.TEXT
content: { html: string; richText: unknown[]; plainText: string }
}
export type Target = { blockId: string; stepId?: string }