code7-leia 0.2.37 → 1.0.0

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 (76) hide show
  1. package/README.md +107 -1
  2. package/dist/code7-leia.cjs.development.js +1 -1
  3. package/dist/code7-leia.cjs.development.js.map +1 -1
  4. package/dist/code7-leia.cjs.production.min.js +1 -1
  5. package/dist/code7-leia.cjs.production.min.js.map +1 -1
  6. package/dist/code7-leia.esm.js +1 -1
  7. package/dist/code7-leia.esm.js.map +1 -1
  8. package/dist/components/CustomToast/styles.d.ts +1 -1
  9. package/dist/components/EmptyState/styles.d.ts +1 -2
  10. package/dist/components/FileArea/components/AreaUpload/styles.d.ts +2 -3
  11. package/dist/components/FileArea/components/Modal/styles.d.ts +8 -9
  12. package/dist/components/FileArea/components/Search/styles.d.ts +3 -4
  13. package/dist/components/FileArea/components/Spinner/styles.d.ts +1 -2
  14. package/dist/components/FileArea/components/Table/styles.d.ts +3 -4
  15. package/dist/components/FileArea/styles.d.ts +2 -3
  16. package/dist/components/MultiSelect/styles.d.ts +7 -8
  17. package/dist/components/Select/styles.d.ts +1 -2
  18. package/dist/components/Tabs/styles.d.ts +4 -4
  19. package/dist/components/TestArea/components/InputTest/styles.d.ts +3 -4
  20. package/dist/components/TestArea/components/TextArea/styles.d.ts +6 -7
  21. package/dist/components/TestArea/styles.d.ts +4 -5
  22. package/package.json +35 -70
  23. package/src/Leia.tsx +0 -44
  24. package/src/components/CustomToast/index.tsx +0 -62
  25. package/src/components/CustomToast/styles.tsx +0 -73
  26. package/src/components/EmptyState/index.tsx +0 -88
  27. package/src/components/EmptyState/styles.tsx +0 -81
  28. package/src/components/FileArea/components/AreaUpload/index.tsx +0 -137
  29. package/src/components/FileArea/components/AreaUpload/styles.tsx +0 -75
  30. package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +0 -23
  31. package/src/components/FileArea/components/Modal/ModalContent.tsx +0 -26
  32. package/src/components/FileArea/components/Modal/ModalFooter.tsx +0 -18
  33. package/src/components/FileArea/components/Modal/ModalHeader.tsx +0 -18
  34. package/src/components/FileArea/components/Modal/ModalTitle.tsx +0 -18
  35. package/src/components/FileArea/components/Modal/index.tsx +0 -131
  36. package/src/components/FileArea/components/Modal/styles.tsx +0 -121
  37. package/src/components/FileArea/components/Search/index.tsx +0 -44
  38. package/src/components/FileArea/components/Search/styles.tsx +0 -26
  39. package/src/components/FileArea/components/Spinner/index.tsx +0 -22
  40. package/src/components/FileArea/components/Spinner/styles.tsx +0 -59
  41. package/src/components/FileArea/components/Table/index.tsx +0 -34
  42. package/src/components/FileArea/components/Table/styles.tsx +0 -60
  43. package/src/components/FileArea/index.tsx +0 -281
  44. package/src/components/FileArea/styles.tsx +0 -183
  45. package/src/components/MultiSelect/index.tsx +0 -102
  46. package/src/components/MultiSelect/styles.tsx +0 -77
  47. package/src/components/Select/index.tsx +0 -53
  48. package/src/components/Select/styles.tsx +0 -49
  49. package/src/components/Tabs/index.tsx +0 -71
  50. package/src/components/Tabs/styles.tsx +0 -87
  51. package/src/components/TestArea/components/InputTest/index.tsx +0 -21
  52. package/src/components/TestArea/components/InputTest/styles.tsx +0 -28
  53. package/src/components/TestArea/components/TextArea/index.tsx +0 -97
  54. package/src/components/TestArea/components/TextArea/styles.tsx +0 -171
  55. package/src/components/TestArea/index.tsx +0 -101
  56. package/src/components/TestArea/styles.tsx +0 -112
  57. package/src/contexts/SharedPropsProvider.tsx +0 -79
  58. package/src/index.tsx +0 -20
  59. package/src/interface/FileData.ts +0 -11
  60. package/src/interface/Language.ts +0 -93
  61. package/src/interface/Table.ts +0 -12
  62. package/src/service/Api.ts +0 -9
  63. package/src/service/ApiDev.ts +0 -9
  64. package/src/service/ApiHml.ts +0 -9
  65. package/src/store/index.ts +0 -13
  66. package/src/store/modules/actions.ts +0 -88
  67. package/src/store/modules/reducer.ts +0 -46
  68. package/src/store/modules/sagas.ts +0 -127
  69. package/src/store/modules/types.ts +0 -19
  70. package/src/types/image.d.ts +0 -4
  71. package/src/utils/formatAxios.tsx +0 -15
  72. package/src/utils/getApi.tsx +0 -16
  73. package/src/utils/getLanguage.tsx +0 -17
  74. package/src/utils/languages/en.ts +0 -87
  75. package/src/utils/languages/es.ts +0 -87
  76. package/src/utils/languages/pt-br.ts +0 -87
@@ -1,171 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- type ContainerProps = {
4
- marginBottom?: string;
5
- };
6
-
7
- export const Container = styled.div<ContainerProps>`
8
- display: flex;
9
- flex-flow: column;
10
- margin-bottom: ${({ marginBottom }) => marginBottom};
11
- `;
12
-
13
- export const InputWrapper = styled.div`
14
- display: flex;
15
- align-items: center;
16
- position: relative;
17
- margin-right: 5px;
18
- width: 725px;
19
-
20
- .icon {
21
- position: absolute;
22
- color: #5a5d68;
23
-
24
- &.start-icon {
25
- left: 12px;
26
- }
27
- &.end-icon {
28
- right: 12px;
29
- }
30
- }
31
-
32
- & .pass-view {
33
- position: absolute;
34
- right: 0;
35
- top: 0;
36
- bottom: 0;
37
- padding: 14px;
38
- font-size: 1rem;
39
- color: #5a5d68;
40
- }
41
- `;
42
-
43
- export const LabelWrapper = styled.label`
44
- margin-bottom: 8px;
45
-
46
- .label {
47
- display: block;
48
- color: #5a5d68;
49
-
50
- font-style: normal;
51
- font-weight: 600;
52
- font-size: 0.875rem;
53
- line-height: 114%;
54
- letter-spacing: -0.02em;
55
- }
56
-
57
- .description {
58
- font-style: normal;
59
- font-weight: 500;
60
- font-size: 0.625rem;
61
- line-height: 120%;
62
- color: #5a5d68;
63
- display: block;
64
- }
65
- `;
66
-
67
- export const CustomTextArea = styled.textarea`
68
- font-family: 'Monospace', -apple-system, BlinkMacSystemFont, sans-serif;
69
- font-size: 0.875rem;
70
- font-style: normal;
71
- font-weight: 500;
72
- line-height: 20px;
73
- text-align: left;
74
- letter-spacing: -0.02em;
75
- resize: vertical;
76
- padding: 8px 12px;
77
-
78
- border-radius: 4px;
79
- border: 1px solid #979aa5;
80
- color: #5a5d68 !important;
81
- width: 100%;
82
-
83
- background: #ffffff;
84
- transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
85
- border 0.2s ease-in-out;
86
-
87
- &:focus {
88
- outline: none;
89
- box-shadow: 0 0 0 3px #6690ff;
90
- }
91
-
92
- &:hover {
93
- border: 1px solid #102693;
94
- }
95
- &:active {
96
- border: 1px solid #102693;
97
- }
98
- &:disabled {
99
- border: 1px solid #dadce3;
100
- background: #f3f5f9;
101
- color: #dadce3;
102
- }
103
-
104
- &.small {
105
- height: 32px;
106
- }
107
-
108
- &.medium {
109
- height: 120px;
110
- }
111
-
112
- &.large {
113
- height: 48px;
114
- font-size: 1rem;
115
- }
116
-
117
- &.success {
118
- background: #e3f8cc;
119
- border: 1px solid #19660a;
120
- color: #19660a;
121
- }
122
-
123
- &.danger {
124
- background: #fae0d2;
125
- border: 1px solid #871821;
126
- color: #871821;
127
- }
128
-
129
- &.error {
130
- background: #fae0d2;
131
- border: 1px solid #871821;
132
- color: #871821;
133
- }
134
-
135
- &.has-start-icon {
136
- padding-left: 40px;
137
- }
138
- &.has-end-icon {
139
- padding-right: 40px;
140
- }
141
- `;
142
-
143
- export const Helper = styled.div`
144
- &.helper {
145
- font-style: normal;
146
- font-weight: 500;
147
- font-size: 0.625rem;
148
- line-height: 120%;
149
- color: #5a5d68;
150
- display: block;
151
- margin-top: 4px;
152
-
153
- &.success {
154
- color: #19660a;
155
- }
156
-
157
- &.danger {
158
- color: #871821;
159
- }
160
- }
161
- `;
162
-
163
- export const Error = styled.div`
164
- font-style: normal;
165
- font-weight: 500;
166
- font-size: 0.625rem;
167
- line-height: 120%;
168
- display: block;
169
- margin-top: 4px;
170
- color: #871821;
171
- `;
@@ -1,101 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { getLanguage } from '../../utils/getLanguage'
3
- import * as S from './styles';
4
- import Select from '../Select'
5
- import InputTest from './components/InputTest'
6
- import TextArea from './components/TextArea'
7
- import { PiWaveformBold } from 'react-icons/pi';
8
- import { FaList } from 'react-icons/fa';
9
- import EmptyState from '../EmptyState';
10
- import { SharedPropsProvider, useSharedProps } from '../../contexts/SharedPropsProvider';
11
- import { MdPerson2 } from "react-icons/md";
12
- import { useDispatch, useSelector } from 'react-redux';
13
- import { testAction } from '../../store/modules/actions';
14
-
15
- export const TestArea = () => {
16
- const { id, language, personas, propTags, token, env, readonly } = useSharedProps();
17
- const t = getLanguage(language)
18
- const results = useSelector((state: any) => state.message);
19
- const isloading = useSelector((state: any) => state.isloading);
20
- const [search, setSearch] = useState('');
21
- const [prompt, setPrompt] = useState('');
22
- const [profile, setProfile] = useState('');
23
- const [presset, setPresset] = useState('');
24
- const dispatch = useDispatch();
25
- const tags = propTags ? propTags.tags : [];
26
-
27
-
28
- const optionsPersona = personas && personas.map(persona => {
29
- return { label: persona.name, value: persona.name }
30
- })
31
-
32
- const optionsPresset = tags.map(tag => {
33
- return { label: tag, value: tag }
34
- })
35
-
36
- const handleSelectPersona = (value: string) => {
37
- setProfile(value);
38
- };
39
-
40
- const handleSelectPresset = (value: string) => {
41
- setPresset(value);
42
- };
43
-
44
- const handleSearch = (value: string) => {
45
- setSearch(value);
46
- };
47
-
48
- const handlePrompt = (value: string) => {
49
- setPrompt(value);
50
- };
51
-
52
- const handleTest = () => {
53
- dispatch(testAction(search, prompt, profile, presset, id, token, env))
54
- };
55
-
56
- const returnTest = () => {
57
- return (
58
- <S.Container isloading={isloading}>
59
- <div id='loading' />
60
- <S.Header>
61
- <div className='infos'>
62
- <h2>{t.test}</h2>
63
- <p>{t.testArea.description}</p>
64
- </div>
65
- </S.Header>
66
- <S.Inputs>
67
- <InputTest placeholder={t.testArea.typeSentence} onChange={handleSearch} />
68
- <Select placeholder={t.testArea.selectPersona} options={optionsPersona} onSelect={handleSelectPersona} />
69
- <Select placeholder={t.testArea.selectPresset} options={optionsPresset} onSelect={handleSelectPresset} />
70
- <button onClick={handleTest}><PiWaveformBold /> {t.buttons.test}</button>
71
- </S.Inputs>
72
- <S.Inputs>
73
- {profile === "Custom" && <TextArea className="textarea-message" placeholder={t.testArea.typePrompt} value={prompt} onChange={(e) => { handlePrompt(e.target.value); }} />}
74
- </S.Inputs>
75
- {
76
- !results ? (
77
- <EmptyState
78
- icon={<FaList></FaList>}
79
- title={t.testArea.emptyState.title}
80
- description={t.testArea.emptyState.description}
81
- activeButton={false}
82
- />
83
- ) : <S.Result>
84
- <div className='icon'>
85
- <MdPerson2 />
86
- </div>
87
- <div className='text'>{results}</div>
88
- </S.Result>
89
- }
90
- </S.Container>
91
- )
92
- }
93
-
94
- return (
95
- <SharedPropsProvider id={id} token={token} readonly={readonly} language={language} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
96
- <S.Container>
97
- {returnTest()}
98
- </S.Container>
99
- </SharedPropsProvider>
100
- );
101
- };
@@ -1,112 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
-
3
- interface ContainerProps {
4
- isloading?: boolean;
5
- }
6
-
7
-
8
- export const Container = styled.div<ContainerProps>`
9
- ${(props) =>
10
- props.isloading &&
11
- css`
12
- #loading {
13
- position: fixed;
14
- top: 0;
15
- left: 0;
16
- width: 100%;
17
- height: 100%;
18
- background-color: rgb(151,154,165, 0.7);
19
- display: flex;
20
- justify-content: center;
21
- align-items: center;
22
- z-index: 9999;
23
- }
24
-
25
- #loading::after {
26
- content: "";
27
- border: 4px solid #f3f3f3; /* Cor do símbolo de carregamento */
28
- border-top: 4px solid #5a5d68; /* Cor do símbolo de carregamento */
29
- border-radius: 50%;
30
- width: 13px;
31
- height: 13px;
32
- animation: spin 1s linear infinite;
33
- }
34
-
35
- @keyframes spin {
36
- 0% { transform: rotate(0deg); }
37
- 100% { transform: rotate(360deg); }
38
- }
39
- `}
40
-
41
- `;
42
-
43
- export const Header = styled.div`
44
- display: flex;
45
- flex-direction: column;
46
- .infos {
47
- display: flex;
48
- flex-direction: column;
49
- padding: 14px 0;
50
-
51
- h2 {
52
- font-size: 20px
53
- }
54
-
55
- p {
56
- font-size: 14px
57
- }
58
- }
59
- `
60
-
61
- export const Inputs = styled.div`
62
- display: inline-flex;
63
- justify-content: space-between;
64
- margin-bottom: 10px;
65
- width: 725px;
66
- margin-right: 500px;
67
-
68
- button {
69
- background: #102693;
70
- padding: 10px 20px;
71
- color: white;
72
- border-radius: 4px;
73
- width: 190px;
74
- height: 45px;
75
- display: flex;
76
- justify-content: space-between;
77
- align-items: center;
78
-
79
- svg {
80
- width: 23px;
81
- height: 23px;
82
- }
83
- }
84
- `
85
-
86
- export const Result = styled.div`
87
- display: flex;
88
- justify-content: left;
89
- background: #F3F5F9;
90
- padding: 15px;
91
- border-radius: 5px;
92
- margin-top: 15px;
93
-
94
- .text{
95
- margin-left: 5px;
96
- font-size: 14px;
97
- line-height: 1.5;
98
- }
99
-
100
- .icon {
101
- display: flex;
102
- justify-content: center;
103
- align-items: center;
104
- margin-right: 5px;
105
-
106
- svg {
107
- width: 35px;
108
- height: 35px;
109
- }
110
- }
111
-
112
- `
@@ -1,79 +0,0 @@
1
- import React, { createContext, useContext, useEffect, useState } from 'react';
2
- import { getApi } from '../utils/getApi';
3
-
4
- interface Props {
5
- id: string;
6
- language: "en" | "pt-br" | "es";
7
- propTags: { tags: [] };
8
- personas: [{ name: string, description: string }];
9
- readonly: boolean;
10
- token: string;
11
- env: string;
12
- children?: React.ReactNode;
13
- }
14
-
15
- interface SharedPropsContextType {
16
- props: Props;
17
- }
18
-
19
- const SharedPropsContext = createContext<SharedPropsContextType | undefined>(undefined);
20
-
21
- export const useSharedProps = () => {
22
- const context = useContext(SharedPropsContext);
23
- if (!context) {
24
- throw new Error('useSharedProps deve ser usado dentro de um SharedPropsProvider');
25
- }
26
- return context.props;
27
- };
28
-
29
- export const SharedPropsProvider: React.FC<Props> = ({ children, ...props }) => {
30
- const { id, language, env } = props;
31
- const [tags, setTags] = useState<any>(null);
32
- const [personas, setPersonas] = useState<any>(null);
33
- const api = getApi(env)
34
-
35
- useEffect(() => {
36
- const fetchData = async () => {
37
- try {
38
- const { data } = await api.get(`/tags/${id}`);
39
-
40
- if (data) {
41
- setTags(data);
42
- } else {
43
- console.error('Erro ao fazer a solicitação');
44
- }
45
- } catch (error) {
46
- console.error('Erro ao fazer a solicitação:', error);
47
- }
48
- };
49
-
50
- const personas = async () => {
51
- try {
52
- const { data } = await api.get(`/personas?language=${language}`);
53
-
54
- if (data) {
55
- setPersonas(data);
56
- } else {
57
- console.error('Erro ao fazer a solicitação');
58
- }
59
- } catch (error) {
60
- console.error('Erro ao fazer a solicitação:', error);
61
- }
62
- };
63
-
64
- fetchData();
65
- personas();
66
- }, [id]);
67
-
68
- const sharedProps = {
69
- ...props,
70
- propTags: tags,
71
- personas,
72
- };
73
-
74
- return (
75
- <SharedPropsContext.Provider value={{ props: sharedProps }}>
76
- {children}
77
- </SharedPropsContext.Provider>
78
- );
79
- };
package/src/index.tsx DELETED
@@ -1,20 +0,0 @@
1
- import type { PropsWithChildren, ReactElement } from 'react';
2
- import { Provider } from 'react-redux';
3
- import React from 'react';
4
- import { Leia } from './Leia';
5
- import store from './store';
6
-
7
- export type Props = PropsWithChildren<{
8
- id: string;
9
- activeTab: string;
10
- language: "en" | "pt-br" | "es";
11
- readonly: boolean;
12
- loading: ReactElement;
13
- token: string;
14
- }>;
15
-
16
- export function Code7(props: Props) {
17
- return <Provider store={store}>
18
- <Leia {...props} />
19
- </Provider>;
20
- }
@@ -1,11 +0,0 @@
1
- export interface tag {
2
- name: string,
3
- trained: boolean
4
- }
5
-
6
- export interface FileData {
7
- name: string,
8
- tags: [tag]
9
- trained: boolean,
10
- link: string,
11
- }
@@ -1,93 +0,0 @@
1
- type FileArea = {
2
- description: string;
3
- status: string;
4
- fileName: string;
5
- presset: string;
6
- actions: string;
7
- search: string;
8
- fileUpload: string;
9
- training: string;
10
- emptyState: {
11
- title: string;
12
- description: string;
13
- };
14
- modal: {
15
- descriptionUpload: string;
16
- chooseFile: string;
17
- uploadFile: string;
18
- deleteFileTitle: string;
19
- deleteFile: string;
20
- trainingTitle: string;
21
- trainingDescription: string
22
- };
23
- };
24
-
25
- type Buttons = {
26
- cancel: string;
27
- send: string;
28
- delete: string;
29
- test: string;
30
- addNewPresset: string;
31
- addPresset: string;
32
- training: string;
33
- };
34
-
35
- type TestArea = {
36
- description: string;
37
- typeSentence: string;
38
- typePrompt: string;
39
- selectPersona: string;
40
- selectPresset: string;
41
- emptyState: {
42
- title: string;
43
- description: string;
44
- };
45
- };
46
-
47
- type Toast = {
48
- deleteFile: {
49
- success: {
50
- title: String,
51
- description: String
52
- },
53
- fail: {
54
- title: String,
55
- description: String
56
- }
57
- },
58
- uploadFile: {
59
- success: {
60
- title: String,
61
- description: String
62
- },
63
- fail: {
64
- title: String,
65
- description: String
66
- }
67
- },
68
- Test: {
69
- fail: {
70
- title: String,
71
- description: String
72
- }
73
- },
74
- Train: {
75
- fail: {
76
- title: String,
77
- description: String
78
- },
79
- success: {
80
- title: String,
81
- description: String
82
- }
83
- }
84
- }
85
-
86
- export type Language = {
87
- files: string;
88
- test: string;
89
- fileArea: FileArea;
90
- buttons: Buttons;
91
- testArea: TestArea;
92
- toast: Toast
93
- };
@@ -1,12 +0,0 @@
1
- export interface TableProps {
2
- children: React.ReactNode;
3
- className?: string;
4
- size?: 'small' | 'medium' | 'large';
5
- isloading?: boolean;
6
- }
7
-
8
- export interface SpinnerProps {
9
- color?: string;
10
- size?: 'sm' | 'md' | 'lg';
11
- className?: string;
12
- }
@@ -1,9 +0,0 @@
1
- import axios from 'axios';
2
-
3
- export const API_TOKEN = 'API_TOKEN';
4
-
5
- const url = 'https://api.leia.digitalcontact.cloud';
6
-
7
- axios.defaults.baseURL = `${url}`;
8
-
9
- export default axios.create();
@@ -1,9 +0,0 @@
1
- import axios from 'axios';
2
-
3
- export const API_TOKEN = 'API_TOKEN';
4
-
5
- const url = 'http://localhost:5000';
6
-
7
- axios.defaults.baseURL = `${url}`;
8
-
9
- export default axios.create();
@@ -1,9 +0,0 @@
1
- import axios from 'axios';
2
-
3
- export const API_TOKEN = 'API_TOKEN';
4
-
5
- const url = 'https://api-hml.leia.digitalcontact.cloud';
6
-
7
- axios.defaults.baseURL = `${url}`;
8
-
9
- export default axios.create();
@@ -1,13 +0,0 @@
1
- import { createStore, applyMiddleware } from 'redux';
2
- import createSagaMiddleware from 'redux-saga';
3
- import Reducer from './modules/reducer';
4
- import Sagas from './modules/sagas';
5
-
6
- const sagaMiddleware = createSagaMiddleware();
7
-
8
- const store = createStore(Reducer, applyMiddleware(sagaMiddleware));
9
-
10
- sagaMiddleware.run(Sagas);
11
-
12
- export default store;
13
-