flowstudio 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +9 -4
  2. package/dist/components/app_layout.d.ts +0 -3
  3. package/dist/components/app_layout.jsx +0 -15
  4. package/dist/components/app_settings/data_sources.d.ts +0 -1
  5. package/dist/components/app_settings/data_sources.jsx +0 -119
  6. package/dist/components/app_settings/deploy.d.ts +0 -1
  7. package/dist/components/app_settings/deploy.jsx +0 -22
  8. package/dist/components/app_settings/index.d.ts +0 -1
  9. package/dist/components/app_settings/index.jsx +0 -41
  10. package/dist/components/app_settings/service_providers.d.ts +0 -1
  11. package/dist/components/app_settings/service_providers.jsx +0 -84
  12. package/dist/components/app_settings/simulator.d.ts +0 -1
  13. package/dist/components/app_settings/simulator.jsx +0 -55
  14. package/dist/components/combo_box/index.d.ts +0 -3
  15. package/dist/components/combo_box/index.jsx +0 -104
  16. package/dist/components/context.d.ts +0 -1
  17. package/dist/components/context.jsx +0 -24
  18. package/dist/components/dock_panel.d.ts +0 -2
  19. package/dist/components/dock_panel.jsx +0 -55
  20. package/dist/components/end.d.ts +0 -1
  21. package/dist/components/end.jsx +0 -4
  22. package/dist/components/input.d.ts +0 -1
  23. package/dist/components/input.jsx +0 -19
  24. package/dist/components/layouts/ThemeLayout.d.ts +0 -2
  25. package/dist/components/layouts/ThemeLayout.jsx +0 -12
  26. package/dist/components/normal.d.ts +0 -1
  27. package/dist/components/normal.jsx +0 -4
  28. package/dist/components/sheet/index.d.ts +0 -1
  29. package/dist/components/sheet/index.jsx +0 -32
  30. package/dist/components/simulator/index.d.ts +0 -1
  31. package/dist/components/simulator/index.jsx +0 -11
  32. package/dist/components/start.d.ts +0 -1
  33. package/dist/components/start.jsx +0 -37
  34. package/dist/components/studio/index.d.ts +0 -1
  35. package/dist/components/studio/index.jsx +0 -89
  36. package/dist/components/xnode.d.ts +0 -2
  37. package/dist/components/xnode.jsx +0 -84
  38. package/dist/index.d.ts +0 -3
  39. package/dist/index.js +0 -3
  40. package/dist/zustand/store.d.ts +0 -414
  41. package/dist/zustand/store.js +0 -47
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowstudio",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "description": "Enterprise Flow Designer",
6
6
  "license": "MIT",
@@ -10,8 +10,9 @@
10
10
  "main": "dist/index.js",
11
11
  "types": "dist/index.d.ts",
12
12
  "scripts": {
13
- "build": "tsc",
14
- "prepublishOnly": "npm run build"
13
+ "build": "rm -rf dist && tsc --emitDeclarationOnly false",
14
+ "prepublishOnly": "npm run build",
15
+ "clean": "rm -rf dist"
15
16
  },
16
17
  "devDependencies": {
17
18
  "@hookform/resolvers": "latest",
@@ -42,5 +43,9 @@
42
43
  "bot",
43
44
  "chatbot"
44
45
  ],
45
- "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0"
46
+ "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0",
47
+ "dependencies": {
48
+ "build": "^0.1.4",
49
+ "flowstudio": "^0.0.4"
50
+ }
46
51
  }
@@ -1,3 +0,0 @@
1
- import '@radix-ui/themes/styles.css';
2
- import '@xyflow/react/dist/style.css';
3
- export default function AppLayout({ theme, accent, children }: any): import("react").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { Theme } from '@radix-ui/themes';
2
- import '@radix-ui/themes/styles.css';
3
- // import '../styles/sheet.css'
4
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
- import '@xyflow/react/dist/style.css';
6
- import { useConfigStore } from '../zustand/store';
7
- export default function AppLayout({ theme = 'system', accent = 'purple', children }) {
8
- const { appTheme } = useConfigStore();
9
- const queryClient = new QueryClient();
10
- return (<Theme appearance={theme} accentColor={accent}>
11
- <QueryClientProvider client={queryClient}>
12
- {children}
13
- </QueryClientProvider>
14
- </Theme>);
15
- }
@@ -1 +0,0 @@
1
- export default function DataSources({ open, setOpen, projectIdentifier }: any): import("react").JSX.Element;
@@ -1,119 +0,0 @@
1
- import { Card, Text, Select, Button, Separator, Table, TextArea, Flex, TextField } from "@radix-ui/themes";
2
- import { useState } from "react";
3
- import { FaDatabase, FaTimes } from "react-icons/fa";
4
- import * as Yup from 'yup';
5
- import { useForm } from 'react-hook-form';
6
- import { yupResolver } from "@hookform/resolvers/yup";
7
- import { useQuery } from "@tanstack/react-query";
8
- import * as Form from '@radix-ui/react-form';
9
- import ComboBox from "../combo_box";
10
- export default function DataSources({ open, setOpen, projectIdentifier }) {
11
- const { data: project, status: projectStatus, refetch: projectRefetch } = useQuery({
12
- queryKey: [`project_${projectIdentifier}`], queryFn: async () => {
13
- const res = await fetch(`/api/projects/${projectIdentifier}`);
14
- return res?.json();
15
- }, ...{ enabled: !!projectIdentifier }
16
- });
17
- const dataSourceFormSchema = Yup.object().shape({
18
- database_type: Yup.string().required('Database Type is required'),
19
- connection_string: Yup.string().url('This has to be a URL').required('Connection String is required'),
20
- });
21
- const { register: registerInput, handleSubmit: handleFormSubmit, reset: resetForm, formState: { errors, isSubmitting }, } = useForm({
22
- resolver: yupResolver(dataSourceFormSchema),
23
- });
24
- const handleSubmit = async (data) => {
25
- try {
26
- const post_data = JSON.stringify({
27
- database_type: data.database_type,
28
- connection_string: data.connection_string
29
- });
30
- const response = await fetch('/api/providers', { method: 'POST', body: post_data });
31
- if (await response) {
32
- const data = await response.json();
33
- if (response.ok) {
34
- }
35
- }
36
- }
37
- catch (err) {
38
- console.log(err);
39
- }
40
- };
41
- const functions_list = [
42
- { identifier: 1, name: 'Source Finder' },
43
- { identifier: 2, name: 'Whitelist Checker' },
44
- { identifier: 3, name: 'Request Serializer' },
45
- { identifier: 4, name: 'Account Checker' },
46
- { identifier: 5, name: 'Session GET' },
47
- { identifier: 6, name: 'Menu Finder' },
48
- { identifier: 1, name: 'Paginator' },
49
- { identifier: 1, name: 'Session SET' },
50
- { identifier: 1, name: 'Response Serializer' }
51
- ];
52
- const [getFunctionsList, setFunctionsList] = useState(functions_list?.map((val) => { return { value: val.identifier, label: val.name }; }));
53
- return (<>
54
- <Flex direction={'column'} height={'100%'} width={'100%'} gap={'5'}>
55
-
56
-
57
- <Form.Root onSubmit={handleFormSubmit(handleSubmit)}>
58
- <Flex width={'100%'} align={'center'} mb={'3'}>
59
- <Flex flexGrow={'1'}>
60
- <Text>Database Type:</Text>
61
- {/* <FormLabel htmlFor='database_type'>Database Type:</FormLabel> */}
62
- </Flex>
63
- <Flex flexShrink={'0'} direction={'column'}>
64
- <Form.Field name={'connection_string'} serverInvalid={errors.connection_string != null}>
65
- <Select.Root {...registerInput('database_type')} size={'1'}>
66
- <Select.Trigger placeholder="Select Type"/>
67
- <Select.Content position={'popper'}>
68
- <Select.Item value={'oracle'}>Oracle</Select.Item>
69
- <Select.Item value={'postgres'}>PostgreSQL</Select.Item>
70
- <Select.Item value={'mssql'}>Microsoft SQL Server</Select.Item>
71
- <Select.Item value={'mysql'}>MySQL</Select.Item>
72
- <Select.Item value={'mariadb'}>MariaDB</Select.Item>
73
- <Select.Item value={'mongo'}>MongoDB</Select.Item>
74
- <Select.Item value={'cockroachdb'}>Cockroach DB</Select.Item>
75
- <Select.Item value={'sap'}>SAP HANA</Select.Item>
76
- <Select.Item value={'sqljs'}>SQLJS</Select.Item>
77
- <Select.Item value={'aurora-mysql'}>Aurora MySQL</Select.Item>
78
- </Select.Content>
79
- </Select.Root>
80
- {errors.database_type?.message && <Form.Message>{errors.database_type?.message}</Form.Message>}
81
- </Form.Field>
82
- </Flex>
83
-
84
- </Flex>
85
-
86
-
87
- <Form.Field name={'connection_string'} serverInvalid={errors.connection_string != null}>
88
- <Form.Label htmlFor='connection_string'>Database Connection String</Form.Label>
89
- <TextField.Root type={'url'} size={'1'} id={'connection_string'} placeholder={'Data Source URL'} {...registerInput('connection_string')}/>
90
- {errors.connection_string?.message && <Form.Message>{errors.connection_string?.message}</Form.Message>}
91
- <Text mt={'1'} size={'1'} color={'gray'}>This is a single database connection string that will be your primary source of data</Text>
92
- </Form.Field>
93
-
94
- <Flex gap={'3'}>
95
- <Button color={'teal'} size={'1'} type={'submit'} variant={'soft'} loading={isSubmitting}><FaDatabase /> Connect</Button>
96
- <Button color={'red'} size={'1'} type={'button'} variant={'soft'} loading={isSubmitting}><FaTimes /> Disconnect</Button>
97
- </Flex>
98
- </Form.Root>
99
-
100
-
101
- <Separator size={'4'}/>
102
-
103
- <Flex direction={'column'} mb={'3'}>
104
- <Text>Functions List</Text>
105
- <ComboBox placeholder={'Select Warehouses'} value={''} onValueChange={() => { }} items={getFunctionsList} isMulti/>
106
- </Flex>
107
-
108
- <Separator size={'4'}/>
109
-
110
- <Text mb={'3'}>Templates Setup</Text>
111
- <Card>
112
- <Table.Root>
113
- <Table.Header><Table.Row><Table.ColumnHeaderCell>Name</Table.ColumnHeaderCell><Table.ColumnHeaderCell>SQL Statement</Table.ColumnHeaderCell></Table.Row></Table.Header>
114
- <Table.Body><Table.Row><Table.Cell><TextField.Root type={'text'}/></Table.Cell><Table.Cell><TextArea rows={3}></TextArea></Table.Cell></Table.Row></Table.Body>
115
- </Table.Root>
116
- </Card>
117
- </Flex>
118
- </>);
119
- }
@@ -1 +0,0 @@
1
- export default function Deploy({ open, setOpen, projectIdentifier }: any): import("react").JSX.Element;
@@ -1,22 +0,0 @@
1
- import { Text, Button, Flex } from "@radix-ui/themes";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { BiPlay } from "react-icons/bi";
4
- export default function Deploy({ open, setOpen, projectIdentifier }) {
5
- const { data: project, status: projectStatus, refetch: projectRefetch } = useQuery({
6
- queryKey: [`project_${projectIdentifier}`], queryFn: async () => {
7
- const res = await fetch(`/api/projects/${projectIdentifier}`);
8
- return res?.json();
9
- }, ...{ enabled: !!projectIdentifier }
10
- });
11
- return (<>
12
- {/* <Sheet title={'Deployment'} open={open} setOpen={setOpen} size={'lg'} placement='right' maxWidth={'350px'}> */}
13
- <Flex direction={'column'} gap={'3'} height={'100%'}>
14
-
15
- <Text color={'gray'} size={'2'}>Are you sure you want to Deploy Live? NB: This would replace the current state of the project.</Text>
16
- <Text color={'gray'} size={'2'}>This process would take some seconds</Text>
17
- <Button color={'teal'} type={'submit'}><BiPlay /> Deploy Live</Button>
18
-
19
- </Flex>
20
- {/* </Sheet> */}
21
- </>);
22
- }
@@ -1 +0,0 @@
1
- export default function AppSettings(): import("react").JSX.Element;
@@ -1,41 +0,0 @@
1
- 'use client';
2
- import { Button, Flex, Tabs } from "@radix-ui/themes";
3
- import { useState } from "react";
4
- import { IoIosCog } from "react-icons/io";
5
- import Sheet from "../sheet";
6
- import DataSources from "./data_sources";
7
- import ServiceProviders from "./service_providers";
8
- import Simulator from "./simulator";
9
- import Deploy from "./deploy";
10
- export default function AppSettings() {
11
- const [open, setOpen] = useState(false);
12
- return (<>
13
- <Button aria-label='Settings' variant={'soft'} onClick={() => { setOpen(true); }}><IoIosCog /></Button>
14
-
15
- <Sheet title={'Settings'} open={open} setOpen={setOpen} maxWidth={'550px'}>
16
- <Flex direction={'column'} gap={'5'} height={'100%'} width={'100%'}>
17
- <Tabs.Root defaultValue="data_sources" style={{ width: "100%", height: "100%" }}>
18
- <Tabs.List mb={"3"}>
19
- <Tabs.Trigger value={"data_sources"}>Data Sources</Tabs.Trigger>
20
-
21
- <Tabs.Trigger value={"service_providers"}>Service Providers</Tabs.Trigger>
22
- <Tabs.Trigger value={"simulator"}>Simulator</Tabs.Trigger>
23
- <Tabs.Trigger value={"deployment"}>Deployment</Tabs.Trigger>
24
- </Tabs.List>
25
- <Tabs.Content value={"data_sources"}>
26
- <DataSources />
27
- </Tabs.Content>
28
- <Tabs.Content value={"service_providers"}>
29
- <ServiceProviders />
30
- </Tabs.Content>
31
- <Tabs.Content value={"simulator"}>
32
- <Simulator />
33
- </Tabs.Content>
34
- <Tabs.Content value={"deployment"}>
35
- <Deploy />
36
- </Tabs.Content>
37
- </Tabs.Root>
38
- </Flex>
39
- </Sheet>
40
- </>);
41
- }
@@ -1 +0,0 @@
1
- export default function ServiceProviders({ open, setOpen, projectIdentifier }: any): import("react").JSX.Element;
@@ -1,84 +0,0 @@
1
- import { Card, Flex, Select, TextField, Text, Button, Separator, } from "@radix-ui/themes";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { BiCopy } from "react-icons/bi";
4
- import { FaCog, FaSave, FaTimes } from 'react-icons/fa';
5
- const service_providers = require('../../service_providers.json');
6
- export default function ServiceProviders({ open, setOpen, projectIdentifier }) {
7
- const { data: project, status: projectStatus, refetch: projectRefetch } = useQuery({
8
- queryKey: [`project_${projectIdentifier}`], queryFn: async () => {
9
- const res = await fetch(`/api/projects/${projectIdentifier}`);
10
- return res?.json();
11
- }, ...{ enabled: !!projectIdentifier }
12
- });
13
- return (<>
14
- {/* <Sheet title={'Service Providers'} open={open} setOpen={setOpen} maxWidth={'500px'}> */}
15
- <Flex direction={'column'} height={'100%'} width={'100%'}>
16
- <Flex direction={'column'} gap={'1'}>
17
- {project?.providers?.map((val, ind) => (<Flex key={ind} align={'center'}>
18
- <Flex flexGrow={'1'}>
19
- <Text color={'gray'} size={'1'}>{val.name}</Text>
20
- </Flex>
21
- <Flex flexShrink={'0'} gap={'3'}>
22
- <Select.Root size={'1'} defaultValue={val.type}>
23
- <Select.Trigger placeholder="Select Type"/>
24
- <Select.Content position={'popper'}>
25
- <Select.Item value={'ussd'}>USSD</Select.Item>
26
- <Select.Item value={'sms'}>SMS</Select.Item>
27
- <Select.Item value={'payment'}>Payment</Select.Item>
28
- </Select.Content>
29
- </Select.Root>
30
- <Select.Root size={'1'} defaultValue={val.identifier}>
31
- <Select.Trigger placeholder="Select Provider"/>
32
- <Select.Content position={'popper'}>
33
- {service_providers?.map((prov_val, prov_ind) => (<Select.Item key={prov_ind} value={prov_val.identifier}>{prov_val.name}</Select.Item>))}
34
- </Select.Content>
35
- </Select.Root>
36
- <Button size={'1'} aria-label={'Setting'} variant={'outline'}><FaCog /></Button>
37
- <Button size={'1'} aria-label={'Remove'} color={'red'} variant={'soft'}><FaTimes /></Button>
38
- </Flex>
39
- </Flex>))}
40
- <Flex align={'center'}>
41
- <Flex flexGrow={'1'}>
42
- <Text color={'gray'} size={'1'}>New Provider</Text>
43
- </Flex>
44
- <Flex flexShrink={'0'} gap={'3'}>
45
- <Select.Root size={'1'} defaultValue={''}>
46
- <Select.Trigger placeholder="Select Type"/>
47
- <Select.Content position={'popper'}>
48
- <Select.Item value={'ussd'}>USSD</Select.Item>
49
- <Select.Item value={'sms'}>SMS</Select.Item>
50
- <Select.Item value={'payment'}>Payment</Select.Item>
51
- </Select.Content>
52
- </Select.Root>
53
- <Select.Root size={'1'} defaultValue={''}>
54
- <Select.Trigger placeholder="Select Provider"/>
55
- <Select.Content position={'popper'}>
56
- {service_providers?.map((prov_val, prov_ind) => (<Select.Item key={prov_ind} value={prov_val.identifier}>{prov_val.name}</Select.Item>))}
57
- </Select.Content>
58
- </Select.Root>
59
- <Button size={'1'} aria-label={'Remove'} color={'teal'} variant={'soft'}><FaSave /></Button>
60
- </Flex>
61
- </Flex>
62
- </Flex>
63
-
64
- {/* USSD Callback */}
65
-
66
- <Separator my={'3'} size={'4'}/>
67
-
68
- <Card>
69
- <form>
70
- <Flex direction={'column'} gap={'3'}>
71
- <Text color={'gray'} size={'2'}>USSD Callback Endpoint</Text>
72
- <TextField.Root readOnly type={'url'} placeholder={'URL'} autoComplete={'off'} defaultValue={'https://uxxd.osanim.com/api/123456789/callback?network=mtn&mode=start&msisdn=233241844442&sessionid=1234567&userdata=800*008&username=uxxd&trafficid=1234567&other=g4m&serviceCode=1234'}>
73
- <TextField.Slot side={'right'} pr={'1'}>
74
- <Button aria-label={'copy'} size={'1'} color={'teal'} variant={'soft'}><BiCopy /></Button>
75
- </TextField.Slot>
76
- </TextField.Root>
77
- <Text color={'gray'} size={'1'}>This link should be shared with all your Providers (Itt helps them redirect all USSD requests from their end to you.)</Text>
78
- </Flex>
79
- </form>
80
- </Card>
81
- </Flex>
82
- {/* </Sheet> */}
83
- </>);
84
- }
@@ -1 +0,0 @@
1
- export default function Simulator({ open, setOpen, projectIdentifier }: any): import("react").JSX.Element;
@@ -1,55 +0,0 @@
1
- import { Text, Flex, TextField, Button, Card } from "@radix-ui/themes";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { useEffect, useState } from "react";
4
- import { FaPlay } from "react-icons/fa";
5
- export default function Simulator({ open, setOpen, projectIdentifier }) {
6
- const { data: project, status: projectStatus, refetch: projectRefetch } = useQuery({
7
- queryKey: [`project_${projectIdentifier}`], queryFn: async () => {
8
- const res = await fetch(`/api/projects/${projectIdentifier}`);
9
- return res?.json();
10
- }, ...{ enabled: !!projectIdentifier }
11
- });
12
- const [getMessage, setMessage] = useState('');
13
- useEffect(() => {
14
- fetchCallback();
15
- }, []);
16
- const fetchCallback = async () => {
17
- try {
18
- const response = await fetch('/api/123456789/callback?network=mtn&mode=start&msisdn=233241844442&sessionid=1234567&userdata=800*008&username=uxxd&trafficid=1234567&other=g4m&serviceCode=1234');
19
- if (await response) {
20
- const data = await response.text();
21
- if (response.ok) {
22
- setMessage(data);
23
- }
24
- }
25
- }
26
- catch (err) {
27
- console.log(err);
28
- }
29
- };
30
- const [loading, setLoading] = useState(false);
31
- return (<>
32
- {/* <Sheet title={'Simulator'} open={open} setOpen={setOpen} size={'1'} placement='right'> */}
33
- <Flex direction={'column'} gap={'5'} width={'100%'} height={'100%'}>
34
- <Card>
35
- <Flex width={'100%'} height={'100%'} direction={'column'}>
36
- <Flex flexShrink={'0'} width={'100%'} justify={'between'} p={'2'} align={'center'}>
37
- <Flex align={'center'}><Text>12:00PM</Text></Flex>
38
- <Flex align={'center'}><Text>59%</Text></Flex>
39
- </Flex>
40
- <Flex flexGrow={'1'}>
41
- <Text>
42
- {/* {parse(getMessage)} */}
43
- {getMessage}
44
- </Text>
45
- </Flex>
46
- <Flex flexShrink={'0'} gap={'2'}>
47
- <Flex flexGrow={'1'}><TextField.Root size={'1'} type={'text'} placeholder={'Your Input'} style={{ width: '100%' }}/></Flex>
48
- <Flex flexShrink={'0'}><Button loading={loading} size={'1'} onClick={() => { setLoading(true); }} color={'teal'} variant={'soft'}><FaPlay /> Send</Button></Flex>
49
- </Flex>
50
- </Flex>
51
- </Card>
52
- </Flex>
53
- {/* </Sheet> */}
54
- </>);
55
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import './style.css';
3
- export default function ComboBox({ type, value, onValueChange, placeholder, items, noItemsText, isMulti, width, ...rest }: any): React.JSX.Element;
@@ -1,104 +0,0 @@
1
- 'use client';
2
- import React, { useState, useEffect } from 'react';
3
- import { Flex, TextField, Text, ScrollArea, Popover, Button, Badge } from '@radix-ui/themes';
4
- import { ChevronsUpDown, Search } from 'lucide-react';
5
- import './style.css';
6
- import { IoMdClose } from 'react-icons/io';
7
- export default function ComboBox({ type = 'text', value, onValueChange, placeholder, items, noItemsText = 'No', isMulti = false, width = '100%', ...rest }) {
8
- const [getSearchText, setSearchText] = useState('');
9
- const [open, setOpen] = useState(false);
10
- const [getSortedItems, setSortedItems] = useState([]);
11
- const [getValue, setValue] = useState(isMulti ? [] : value);
12
- // useEffect(()=>{
13
- // if(value){
14
- // setValue(value);
15
- // }else{
16
- // setValue(null)
17
- // }
18
- // },[value])
19
- useEffect(() => {
20
- if (getValue?.length > 0) {
21
- onValueChange(getValue);
22
- }
23
- else {
24
- onValueChange(null);
25
- }
26
- }, [getValue]);
27
- useEffect(() => {
28
- if (items && getSearchText) {
29
- setSortedItems(items?.filter((item) => item.text.toLowerCase().includes(getSearchText.toLowerCase())));
30
- }
31
- else {
32
- setSortedItems(items);
33
- }
34
- }, [items, getSearchText]);
35
- const handleSelectItem = (item) => {
36
- if (!isMulti) {
37
- setValue(item?.value);
38
- setOpen(false);
39
- }
40
- else {
41
- if (!getValue?.includes(item?.value)) {
42
- setValue([...getValue, item?.value]);
43
- }
44
- setOpen(false);
45
- }
46
- };
47
- const handleRemoveItem = (val) => {
48
- setValue(getValue.filter((item) => item !== val));
49
- };
50
- return (<>
51
- {/* {JSON.stringify(getValue)} */}
52
- <Popover.Root open={open} onOpenChange={setOpen}>
53
- <Popover.Trigger>
54
- <Button variant={'outline'} style={{ width: width, height: 'auto', minHeight: 30, paddingTop: 5, paddingBottom: 5, justifyContent: 'space-between' }} {...rest}>
55
- <Flex wrap={'wrap'} gap={'2'}>
56
- {!isMulti && (<Text style={{
57
- display: '-webkit-box',
58
- WebkitBoxOrient: 'vertical',
59
- WebkitLineClamp: 1,
60
- overflow: 'hidden',
61
- textOverflow: 'ellipsis',
62
- whiteSpace: 'normal'
63
- }}>
64
- {items?.find((item) => item.value === getValue)?.text || placeholder}
65
- </Text>)}
66
- {isMulti && (<>
67
- {getValue?.length > 0 ? <>
68
- {getValue?.map((val, ind) => (<Badge key={ind} variant="soft" highContrast>
69
- {items?.find((item) => item.value === val)?.text || placeholder}
70
- {/* <IoMdClose onClick={() => handleRemoveItem(val)} style={{ marginLeft: 5, cursor: 'pointer' }} /> */}
71
- </Badge>))}
72
- </> :
73
- <Text style={{ display: '-webkit-box', WebkitBoxOrient: 'vertical', WebkitLineClamp: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'normal' }}>{placeholder}</Text>}
74
- </>)}
75
- </Flex>
76
- <ChevronsUpDown size={'12'}/>
77
- </Button>
78
- </Popover.Trigger>
79
- <Popover.Content maxWidth={'250px'} style={{ padding: 5, marginTop: 3 }}>
80
- <Flex direction='column' p='1' gap={'2'}>
81
- <TextField.Root placeholder='Search' value={getSearchText} onChange={(e) => { setSearchText(e.target.value); }}>
82
- <TextField.Slot side='left'>
83
- <Search size={16}/>
84
- </TextField.Slot>
85
- <TextField.Slot side='right' pr={'1'}>
86
- <Button size={'1'} variant={'soft'} color={'red'} highContrast onClick={() => { setSearchText(''); setOpen(false); }}><IoMdClose /></Button>
87
- </TextField.Slot>
88
- </TextField.Root>
89
-
90
- <ScrollArea type='auto' scrollbars='vertical' style={{ height: '200px' }}>
91
- <Flex align='center' gap='2' className={'widget_item'} p={'2'} onClick={() => { setValue(isMulti ? [] : ''); setOpen(false); }}>
92
- <Text size={'2'} color={'gray'} style={{ userSelect: 'none' }}>{noItemsText}</Text>
93
- </Flex>
94
- {/* {items?.length} */}
95
- {getSortedItems?.map((item, ind) => (<Flex align='center' gap='2' className={'widget_item'} key={ind} p={'2'} onClick={() => handleSelectItem(item)}>
96
- {item?.icon}
97
- <Text size={'2'} color={'gray'} style={{ userSelect: 'none' }}>{item.text}</Text>
98
- </Flex>))}
99
- </ScrollArea>
100
- </Flex>
101
- </Popover.Content>
102
- </Popover.Root>
103
- </>);
104
- }
@@ -1 +0,0 @@
1
- export default function ContextMenu({ showMenu, setShowMenu, menuPosition }: any): import("react").JSX.Element;
@@ -1,24 +0,0 @@
1
- import { Card, Flex, Button } from "@radix-ui/themes";
2
- import { BiMessage, BiTrash } from "react-icons/bi";
3
- import { FaMessage } from "react-icons/fa6";
4
- export default function ContextMenu({ showMenu, setShowMenu, menuPosition }) {
5
- // const {showMenu, menuPosition} = useConfigStore()
6
- const handleMenuItemClick = (action) => {
7
- setShowMenu(false);
8
- // Perform action based on the selected menu item
9
- // console.log('Selected action:', action);
10
- };
11
- return (<Card onBlur={() => { setShowMenu(false); }} style={{
12
- position: 'fixed',
13
- top: menuPosition.y,
14
- left: menuPosition.x,
15
- zIndex: 1000,
16
- }}>
17
- <Flex direction={'column'} gap={'3'}>
18
- {/* <Button variant={'ghost'} size={'1'} leftIcon={<FaPlus/>} justify={'start'} rounded={0} onClick={() => handleMenuItemClick('Action 1')} fontWeight={'thin'} >Start Node</Button> */}
19
- <Button variant={'ghost'} size={'1'} onClick={() => handleMenuItemClick('Action 1')} style={{ justifyContent: 'start', width: '100%' }}><FaMessage /> Normal Node</Button>
20
- <Button variant={'ghost'} size={'1'} onClick={() => handleMenuItemClick('Action 1')} style={{ justifyContent: 'start', width: '100%' }}><BiMessage /> End Node</Button>
21
- <Button variant={'ghost'} size={'1'} onClick={() => handleMenuItemClick('Action 1')} color={'red'} style={{ justifyContent: 'start', width: '100%' }}><BiTrash /> Delete Node</Button>
22
- </Flex>
23
- </Card>);
24
- }
@@ -1,2 +0,0 @@
1
- declare const DockPanel: ({ projectIdentifier }: any) => import("react").JSX.Element;
2
- export default DockPanel;
@@ -1,55 +0,0 @@
1
- import { Button, Card, Flex, SegmentedControl, TextField, Link } from "@radix-ui/themes";
2
- import { BiHome } from "react-icons/bi";
3
- // import { IoIosCog } from "react-icons/io";
4
- // import NextLink from 'next/link'
5
- // import DataSources from "./app_settings/data_sources";
6
- // import ServiceProviders from "./app_settings/service_providers";
7
- // import Simulator from "./app_settings/simulator";
8
- // import Deploy from "./app_settings/deploy";
9
- // import { FaDatabase } from "react-icons/fa";
10
- // import Link from "next/link";
11
- import { useState } from "react";
12
- import { useConfigStore } from "../zustand/store";
13
- import AppSettings from "./app_settings";
14
- import { IoSave } from "react-icons/io5";
15
- import { useQuery } from "@tanstack/react-query";
16
- const DockPanel = ({ projectIdentifier }) => {
17
- const [dataSourcesOpen, setDataSourcesOpen] = useState(false);
18
- const [serviceProvidersOpen, setServiceProvidersOpen] = useState(false);
19
- const [simulatorOpen, setSimulatorOpen] = useState(false);
20
- const [deployOpen, setDeployOpen] = useState(false);
21
- const { stateType, setStateType } = useConfigStore();
22
- // const { isOpen: isFunctionsDrawerOpen, onOpen: onFunctionsDrawerOpen, onClose: onFunctionsDrawerClose } = useDisclosure()
23
- // const { isOpen: isServiceProvidersDrawerOpen, onOpen: onServiceProvidersDrawerOpen, onClose: onServiceProvidersDrawerClose } = useDisclosure()
24
- // const { isOpen: isSimulatorDrawerOpen, onOpen: onSimulatorDrawerOpen, onClose: onSimulatorDrawerClose } = useDisclosure()
25
- // const { isOpen: isDeployModalOpen, onOpen: onDeployModalOpen, onClose: onDeployModalClose } = useDisclosure()
26
- const { data: project, status: projectStatus } = useQuery({
27
- queryKey: [`project_${projectIdentifier}`, projectIdentifier],
28
- queryFn: async () => {
29
- const res = await fetch(`/api/projects/${projectIdentifier}`);
30
- return res?.ok ? res.json() : [];
31
- },
32
- ...{ enabled: !!projectIdentifier },
33
- });
34
- return (<>
35
- <Flex width={'100%'} justify={'center'} align={'center'}>
36
- <Card size={'1'} style={{ padding: 7 }}>
37
- <Flex gap={'2'}>
38
- <Link href={'/app'} aria-label='Home'><Button variant={'soft'}><BiHome /></Button></Link>
39
- <TextField.Root placeholder="Project Title" defaultValue={project?.title || ''}>
40
- <TextField.Slot side={'right'} pr={'1'}>
41
- <Button size={'1'} variant={'soft'}><IoSave /></Button>
42
- </TextField.Slot>
43
- </TextField.Root>
44
- <SegmentedControl.Root defaultValue="build" variant={'surface'}>
45
- <SegmentedControl.Item onClick={() => setStateType('build')} value="build">Build</SegmentedControl.Item>
46
- <SegmentedControl.Item onClick={() => setStateType('analytics')} value="analytics">Analytics</SegmentedControl.Item>
47
- </SegmentedControl.Root>
48
- <AppSettings />
49
- </Flex>
50
-
51
- </Card>
52
- </Flex>
53
- </>);
54
- };
55
- export default DockPanel;
@@ -1 +0,0 @@
1
- export default function EndNode({ data }: any): import("react").JSX.Element;
@@ -1,4 +0,0 @@
1
- import XNode from "./xnode";
2
- export default function EndNode({ data }) {
3
- return (<XNode id={data.id} type={'end'} data={{ message: data.message }} inputs={data.inputs}/>);
4
- }
@@ -1 +0,0 @@
1
- export default function InputNode({ id, y, data }: any): import("react").JSX.Element;
@@ -1,19 +0,0 @@
1
- import { Button, Flex, TextField, } from "@radix-ui/themes";
2
- import { useState } from "react";
3
- import { LiaTimesSolid } from "react-icons/lia";
4
- import { Handle, Position } from "@xyflow/react";
5
- export default function InputNode({ id = 'i', y = 100, data }) {
6
- const [show, setShow] = useState(false);
7
- const handleClick = () => setShow(!show);
8
- return (<Flex position={'relative'}>
9
- <TextField.Root type={'text'} id={'text_value'} placeholder={'Option Text'} autoComplete={'off'} className="nodrag">
10
- <TextField.Slot>
11
- <Button aria-label={'close'} size={'1'} variant={'outline'} onClick={handleClick}><LiaTimesSolid /></Button>
12
- </TextField.Slot>
13
-
14
- </TextField.Root>
15
-
16
- {/* <Input size={'1'} type={'text'} textAlign={'end'} className="nodrag" placeholder={'Option Text'} /> */}
17
- <Handle type="source" position={Position.Right} id={id} style={{ right: -15, background: '#009688', borderColor: '#fff', borderWidth: 1, width: 10, height: 15, borderRadius: 3, position: 'absolute', top: 16 }}/>
18
- </Flex>);
19
- }
@@ -1,2 +0,0 @@
1
- import "@radix-ui/themes/styles.css";
2
- export default function ThemeLayout({ children }: any): import("react").JSX.Element;