reneco-advanced-input-module 0.0.1
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.
- package/.editorconfig +15 -0
- package/.prettierrc.json +13 -0
- package/LICENSE +21 -0
- package/api-key-inject.js +46 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/file-uploader.voice-input-module.entry.cjs.js.map +1 -0
- package/dist/cjs/file-uploader_2.cjs.entry.js +1319 -0
- package/dist/cjs/file-uploader_2.cjs.entry.js.map +1 -0
- package/dist/cjs/index-BTSzTkSZ.js +1494 -0
- package/dist/cjs/index-BTSzTkSZ.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/voice-input-module.cjs.js +28 -0
- package/dist/cjs/voice-input-module.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/file-uploader/file-uploader.css +26 -0
- package/dist/collection/components/file-uploader/file-uploader.js +130 -0
- package/dist/collection/components/file-uploader/file-uploader.js.map +1 -0
- package/dist/collection/components/voice-input-module/voice-input-module.css +251 -0
- package/dist/collection/components/voice-input-module/voice-input-module.js +875 -0
- package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -0
- package/dist/collection/index.js +12 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/services/audio-recorder.service.js +66 -0
- package/dist/collection/services/audio-recorder.service.js.map +1 -0
- package/dist/collection/services/llm.service.js +193 -0
- package/dist/collection/services/llm.service.js.map +1 -0
- package/dist/collection/services/speech-to-text.service.js +62 -0
- package/dist/collection/services/speech-to-text.service.js.map +1 -0
- package/dist/collection/types/form-schema.types.js +2 -0
- package/dist/collection/types/form-schema.types.js.map +1 -0
- package/dist/collection/types/service-providers.types.js +2 -0
- package/dist/collection/types/service-providers.types.js.map +1 -0
- package/dist/collection/utils/schema-converter.js +422 -0
- package/dist/collection/utils/schema-converter.js.map +1 -0
- package/dist/components/file-uploader.d.ts +11 -0
- package/dist/components/file-uploader.js +9 -0
- package/dist/components/file-uploader.js.map +1 -0
- package/dist/components/file-uploader2.js +98 -0
- package/dist/components/file-uploader2.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/voice-input-module.d.ts +11 -0
- package/dist/components/voice-input-module.js +1292 -0
- package/dist/components/voice-input-module.js.map +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +6 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/file-uploader.voice-input-module.entry.js.map +1 -0
- package/dist/esm/file-uploader_2.entry.js +1316 -0
- package/dist/esm/file-uploader_2.entry.js.map +1 -0
- package/dist/esm/index-jmc2yzBp.js +1487 -0
- package/dist/esm/index-jmc2yzBp.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +14 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/voice-input-module.js +24 -0
- package/dist/esm/voice-input-module.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/file-uploader/file-uploader.d.ts +8 -0
- package/dist/types/components/voice-input-module/voice-input-module.d.ts +55 -0
- package/dist/types/components.d.ts +158 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/services/audio-recorder.service.d.ts +9 -0
- package/dist/types/services/llm.service.d.ts +15 -0
- package/dist/types/services/speech-to-text.service.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1709 -0
- package/dist/types/types/form-schema.types.d.ts +70 -0
- package/dist/types/types/service-providers.types.d.ts +20 -0
- package/dist/types/utils/schema-converter.d.ts +22 -0
- package/dist/voice-input-module/file-uploader.voice-input-module.entry.esm.js.map +1 -0
- package/dist/voice-input-module/index.esm.js +2 -0
- package/dist/voice-input-module/index.esm.js.map +1 -0
- package/dist/voice-input-module/loader.esm.js.map +1 -0
- package/dist/voice-input-module/p-7b4f33ba.entry.js +2 -0
- package/dist/voice-input-module/p-7b4f33ba.entry.js.map +1 -0
- package/dist/voice-input-module/p-DQuL1Twl.js +2 -0
- package/dist/voice-input-module/p-DQuL1Twl.js.map +1 -0
- package/dist/voice-input-module/p-jmc2yzBp.js +3 -0
- package/dist/voice-input-module/p-jmc2yzBp.js.map +1 -0
- package/dist/voice-input-module/voice-input-module.esm.js +2 -0
- package/dist/voice-input-module/voice-input-module.esm.js.map +1 -0
- package/env-config.js +4 -0
- package/inject-env.js +20 -0
- package/package.json +37 -0
- package/readme.md +111 -0
- package/src/components/file-uploader/file-uploader.css +26 -0
- package/src/components/file-uploader/file-uploader.tsx +100 -0
- package/src/components/file-uploader/readme.md +31 -0
- package/src/components/voice-input-module/readme.md +114 -0
- package/src/components/voice-input-module/voice-input-module.css +251 -0
- package/src/components/voice-input-module/voice-input-module.tsx +731 -0
- package/src/components.d.ts +158 -0
- package/src/index.html +663 -0
- package/src/index.ts +12 -0
- package/src/services/audio-recorder.service.ts +74 -0
- package/src/services/llm.service.ts +221 -0
- package/src/services/speech-to-text.service.ts +72 -0
- package/src/types/form-schema.types.ts +78 -0
- package/src/types/service-providers.types.ts +22 -0
- package/src/utils/schema-converter.ts +494 -0
- package/stencil.config.ts +24 -0
- package/tsconfig.json +30 -0
package/inject-env.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Script to inject environment variables into the client config
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const envConfigPath = path.join(__dirname, 'www', 'env-config.js');
|
|
8
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
|
9
|
+
|
|
10
|
+
if (apiKey) {
|
|
11
|
+
const configContent = `// Environment configuration for client-side
|
|
12
|
+
window.ENV_CONFIG = {
|
|
13
|
+
OPENAI_API_KEY: '${apiKey}'
|
|
14
|
+
};`;
|
|
15
|
+
|
|
16
|
+
fs.writeFileSync(envConfigPath, configContent);
|
|
17
|
+
console.log('Environment variables injected successfully');
|
|
18
|
+
} else {
|
|
19
|
+
console.log('No OPENAI_API_KEY found in environment');
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reneco-advanced-input-module",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Component to input data into forms by voice",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Natural Solutions",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npm test && stencil build --docs",
|
|
11
|
+
"start": "node inject-env.js && stencil build --dev --watch --serve",
|
|
12
|
+
"inject": "node inject-env.js",
|
|
13
|
+
"test": "stencil test --spec --forceExit --passWithNoTests",
|
|
14
|
+
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
15
|
+
"generate": "stencil generate",
|
|
16
|
+
"generate-doc": "npx stencil docs"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@stencil/core": "^4.36.2",
|
|
20
|
+
"@stencil/router": "^1.0.1",
|
|
21
|
+
"@types/node": "^24.2.0",
|
|
22
|
+
"openai": "^5.11.0",
|
|
23
|
+
"typescript": "^5.9.2"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/jest": "^29.5.14",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"jest-cli": "^29.7.0"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"main": "dist/index.cjs.js",
|
|
32
|
+
"module": "dist/custom-elements/index.js",
|
|
33
|
+
"es2015": "dist/esm/index.mjs",
|
|
34
|
+
"es2017": "dist/esm/index.mjs",
|
|
35
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
36
|
+
"collection:main": "dist/collection/index.js"
|
|
37
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
[](https://stenciljs.com)
|
|
2
|
+
|
|
3
|
+
# Stencil Component Starter
|
|
4
|
+
|
|
5
|
+
> This is a starter project for building a standalone Web Components using Stencil.
|
|
6
|
+
|
|
7
|
+
Stencil is a compiler for building fast web apps using Web Components.
|
|
8
|
+
|
|
9
|
+
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than runtime tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements specification.
|
|
10
|
+
|
|
11
|
+
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
To start building a new web component using Stencil, clone this repo to a new directory:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/stenciljs/component-starter.git my-component
|
|
19
|
+
cd my-component
|
|
20
|
+
git remote rm origin
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
and run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
npm start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
To build the component for production, run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To run the unit tests for the components, run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm test
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).
|
|
43
|
+
|
|
44
|
+
## Naming Components
|
|
45
|
+
|
|
46
|
+
When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
|
|
47
|
+
|
|
48
|
+
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the [Ionic-generated](https://ionicframework.com/) web components use the prefix `ion`.
|
|
49
|
+
|
|
50
|
+
## Using this component
|
|
51
|
+
|
|
52
|
+
There are two strategies we recommend for using web components built with Stencil.
|
|
53
|
+
|
|
54
|
+
The first step for all two of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
55
|
+
|
|
56
|
+
You can read more about these different approaches in the [Stencil docs](https://stenciljs.com/docs/publishing).
|
|
57
|
+
|
|
58
|
+
### Lazy Loading
|
|
59
|
+
|
|
60
|
+
If your Stencil project is built with the [`dist`](https://stenciljs.com/docs/distribution) output target, you can import a small bootstrap script that registers all components and allows you to load individual component scripts lazily.
|
|
61
|
+
|
|
62
|
+
For example, given your Stencil project namespace is called `my-design-system`, to use `my-component` on any website, inject this into your HTML:
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<script type="module" src="https://unpkg.com/my-design-system"></script>
|
|
66
|
+
<!--
|
|
67
|
+
To avoid unpkg.com redirects to the actual file, you can also directly import:
|
|
68
|
+
https://unpkg.com/foobar-design-system@0.0.1/dist/foobar-design-system/foobar-design-system.esm.js
|
|
69
|
+
-->
|
|
70
|
+
<my-component first="Stencil" middle="'Don't call me a framework'" last="JS"></my-component>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This will only load the necessary scripts needed to render `<my-component />`. Once more components of this package are used, they will automatically be loaded lazily.
|
|
74
|
+
|
|
75
|
+
You can also import the script as part of your `node_modules` in your applications entry file:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import 'foobar-design-system/dist/foobar-design-system/foobar-design-system.esm.js';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-y6v26a?file=src%2Fmain.tsx).
|
|
82
|
+
|
|
83
|
+
### Standalone
|
|
84
|
+
|
|
85
|
+
If you are using a Stencil component library with `dist-custom-elements`, we recommend importing Stencil components individually in those files where they are needed.
|
|
86
|
+
|
|
87
|
+
To export Stencil components as standalone components make sure you have the [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements) output target defined in your `stencil.config.ts`.
|
|
88
|
+
|
|
89
|
+
For example, given you'd like to use `<my-component />` as part of a React component, you can import the component directly via:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import 'foobar-design-system/my-component';
|
|
93
|
+
|
|
94
|
+
function App() {
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<div>
|
|
98
|
+
<my-component
|
|
99
|
+
first="Stencil"
|
|
100
|
+
middle="'Don't call me a framework'"
|
|
101
|
+
last="JS"
|
|
102
|
+
></my-component>
|
|
103
|
+
</div>
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default App;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-b6zuds?file=src%2FApp.tsx).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
.upload-container {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
width: 50px;
|
|
6
|
+
height: 50px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.upload-button {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
14
|
+
user-select: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.upload-button svg {
|
|
18
|
+
width: 50px;
|
|
19
|
+
height: 50px;
|
|
20
|
+
stroke: #44ee44;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.upload-button:hover svg{
|
|
24
|
+
transform: scale(1.05);
|
|
25
|
+
stroke: #33dd33;
|
|
26
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component, h, Prop } from '@stencil/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
tag: 'file-uploader',
|
|
5
|
+
styleUrl: 'file-uploader.css',
|
|
6
|
+
shadow: true
|
|
7
|
+
})
|
|
8
|
+
export class FileUploader {
|
|
9
|
+
@Prop() batch: boolean = false;
|
|
10
|
+
@Prop() callback: Function;
|
|
11
|
+
|
|
12
|
+
private fileInput!: HTMLInputElement;
|
|
13
|
+
|
|
14
|
+
private triggerUpload = () => {
|
|
15
|
+
this.fileInput.click();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
private handleFileChange = async (event: Event) => {
|
|
19
|
+
const input = event.target as HTMLInputElement;
|
|
20
|
+
if (!input.files || input.files.length === 0) return;
|
|
21
|
+
|
|
22
|
+
const file = input.files[0];
|
|
23
|
+
|
|
24
|
+
// Here you can handle the file upload to your API
|
|
25
|
+
console.log('Selected file:', file);
|
|
26
|
+
|
|
27
|
+
const formData = new FormData();
|
|
28
|
+
formData.append('file', file);
|
|
29
|
+
|
|
30
|
+
if (this.batch) {
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch('http://127.0.0.1:5001/api/convert-to-xml', {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
body: formData
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
console.error("There has been an error!:", response);
|
|
39
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
40
|
+
}
|
|
41
|
+
// get the file as a blob
|
|
42
|
+
const blob = await response.blob();
|
|
43
|
+
// create a download link
|
|
44
|
+
const url = window.URL.createObjectURL(blob);
|
|
45
|
+
const a = document.createElement('a');
|
|
46
|
+
a.href = url;
|
|
47
|
+
a.download = 'result-'+Date.now().toString()+'.xlsx'; // filename
|
|
48
|
+
document.body.appendChild(a);
|
|
49
|
+
a.click();
|
|
50
|
+
a.remove();
|
|
51
|
+
window.URL.revokeObjectURL(url);
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error(err);
|
|
54
|
+
alert('Error uploading file');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch('http://127.0.0.1:5001/api/convert-to-json', {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
body: formData
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
console.error("There has been an error!:", response);
|
|
66
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
67
|
+
}
|
|
68
|
+
const data = await response.json();
|
|
69
|
+
console.log('Upload successful:', data);
|
|
70
|
+
|
|
71
|
+
if (this.callback && data[0] && data[0].content){
|
|
72
|
+
this.callback(data[0].content);
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error(err);
|
|
76
|
+
alert('Error uploading file');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
render() {
|
|
83
|
+
return (
|
|
84
|
+
<div class="upload-container" onClick={this.triggerUpload}>
|
|
85
|
+
<input
|
|
86
|
+
type="file"
|
|
87
|
+
ref={el => (this.fileInput = el!)}
|
|
88
|
+
onChange={this.handleFileChange}
|
|
89
|
+
style={{ display: 'none' }}
|
|
90
|
+
/>
|
|
91
|
+
<div class="upload-button">
|
|
92
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
93
|
+
<path d="M13.5 3H12H8C6.34315 3 5 4.34315 5 6V18C5 19.6569 6.34315 21 8 21H12M13.5 3L19 8.625M13.5 3V7.625C13.5 8.17728 13.9477 8.625 14.5 8.625H19M19 8.625V11.8125" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
94
|
+
<path d="M17.5 21L17.5 15M17.5 15L20 17.5M17.5 15L15 17.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
95
|
+
</svg>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# file-uploader
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ---------- | ---------- | ----------- | ---------- | ----------- |
|
|
12
|
+
| `batch` | `batch` | | `boolean` | `false` |
|
|
13
|
+
| `callback` | `callback` | | `Function` | `undefined` |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
### Used by
|
|
19
|
+
|
|
20
|
+
- [voice-input-module](../voice-input-module)
|
|
21
|
+
|
|
22
|
+
### Graph
|
|
23
|
+
```mermaid
|
|
24
|
+
graph TD;
|
|
25
|
+
voice-input-module --> file-uploader
|
|
26
|
+
style file-uploader fill:#f9f,stroke:#333,stroke-width:4px
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
----------------------------------------------
|
|
30
|
+
|
|
31
|
+
*Built with [StencilJS](https://stenciljs.com/)*
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# voice-input-module
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ----------------------- | ------------------------- | ----------- | ---------------------------------------------- | -------------------- |
|
|
12
|
+
| `apiKey` | `api-key` | | `string` | `undefined` |
|
|
13
|
+
| `classificationRootUrl` | `classification-root-url` | | `string` | `'http://localhost'` |
|
|
14
|
+
| `context` | `context` | | `"ecoll-veto" \| "ecoteka" \| "ng" \| "track"` | `undefined` |
|
|
15
|
+
| `debug` | `debug` | | `boolean` | `false` |
|
|
16
|
+
| `displayStatus` | `display-status` | | `boolean` | `false` |
|
|
17
|
+
| `formJson` | `form-json` | | `string` | `'{}'` |
|
|
18
|
+
| `language` | `language` | | `"en" \| "fr"` | `'en'` |
|
|
19
|
+
| `renderForm` | `render-form` | | `boolean` | `false` |
|
|
20
|
+
| `serviceConfig` | `service-config` | | `string` | `'{}'` |
|
|
21
|
+
| `voiceOrOcr` | `voice-or-ocr` | | `"both" \| "ocr" \| "voice"` | `undefined` |
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Events
|
|
25
|
+
|
|
26
|
+
| Event | Description | Type |
|
|
27
|
+
| ----------------------- | ----------- | ------------------------------------------------------- |
|
|
28
|
+
| `formFilled` | | `CustomEvent<VoiceFormRecorderResult>` |
|
|
29
|
+
| `recordingStateChanged` | | `CustomEvent<{ isRecording: boolean; state: string; }>` |
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Methods
|
|
33
|
+
|
|
34
|
+
### `convertJsonToXml(jsonForm: FormSchemaFieldsOnlyExtended) => Promise<string>`
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#### Parameters
|
|
39
|
+
|
|
40
|
+
| Name | Type | Description |
|
|
41
|
+
| ---------- | ------------------------------ | ----------- |
|
|
42
|
+
| `jsonForm` | `FormSchemaFieldsOnlyExtended` | |
|
|
43
|
+
|
|
44
|
+
#### Returns
|
|
45
|
+
|
|
46
|
+
Type: `Promise<string>`
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### `convertJsonToXmlLegacy(jsonForm: FormSchema) => Promise<string>`
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#### Parameters
|
|
55
|
+
|
|
56
|
+
| Name | Type | Description |
|
|
57
|
+
| ---------- | ------------ | ----------- |
|
|
58
|
+
| `jsonForm` | `FormSchema` | |
|
|
59
|
+
|
|
60
|
+
#### Returns
|
|
61
|
+
|
|
62
|
+
Type: `Promise<string>`
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### `convertXmlToJson(xmlForm: string) => Promise<FormSchemaFieldsOnly>`
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
#### Parameters
|
|
71
|
+
|
|
72
|
+
| Name | Type | Description |
|
|
73
|
+
| --------- | -------- | ----------- |
|
|
74
|
+
| `xmlForm` | `string` | |
|
|
75
|
+
|
|
76
|
+
#### Returns
|
|
77
|
+
|
|
78
|
+
Type: `Promise<FormSchemaFieldsOnly>`
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### `convertXmlToJsonLegacy(xmlForm: string) => Promise<FormSchema>`
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#### Parameters
|
|
87
|
+
|
|
88
|
+
| Name | Type | Description |
|
|
89
|
+
| --------- | -------- | ----------- |
|
|
90
|
+
| `xmlForm` | `string` | |
|
|
91
|
+
|
|
92
|
+
#### Returns
|
|
93
|
+
|
|
94
|
+
Type: `Promise<FormSchema>`
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Dependencies
|
|
100
|
+
|
|
101
|
+
### Depends on
|
|
102
|
+
|
|
103
|
+
- [file-uploader](../file-uploader)
|
|
104
|
+
|
|
105
|
+
### Graph
|
|
106
|
+
```mermaid
|
|
107
|
+
graph TD;
|
|
108
|
+
voice-input-module --> file-uploader
|
|
109
|
+
style voice-input-module fill:#f9f,stroke:#333,stroke-width:4px
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
----------------------------------------------
|
|
113
|
+
|
|
114
|
+
*Built with [StencilJS](https://stenciljs.com/)*
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.voice-recorder-container {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 1rem;
|
|
11
|
+
padding: 1rem;
|
|
12
|
+
border: 1px solid #e5e7eb;
|
|
13
|
+
border-radius: 0.5rem;
|
|
14
|
+
background: #ffffff;
|
|
15
|
+
max-width: 100px;
|
|
16
|
+
margin: 0 auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.voice-recorder-container-debug {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 1rem;
|
|
24
|
+
padding: 1rem;
|
|
25
|
+
border: 1px solid #e5e7eb;
|
|
26
|
+
border-radius: 0.5rem;
|
|
27
|
+
background: #ffffff;
|
|
28
|
+
max-width: 800px;
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.record-button {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
width: 50px;
|
|
37
|
+
height: 50px;
|
|
38
|
+
border: none;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
background: #ee4444;
|
|
41
|
+
color: white;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
transition: all 0.2s ease;
|
|
44
|
+
position: relative;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.record-button:hover:not(:disabled) {
|
|
49
|
+
background: #dd3333;
|
|
50
|
+
transform: scale(1.05);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.record-button:disabled {
|
|
54
|
+
opacity: 0.6;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.record-button.recording {
|
|
59
|
+
background: #dd3333;
|
|
60
|
+
animation: pulse 1.5s infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.record-button.processing {
|
|
64
|
+
background: #3b82f6;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes pulse {
|
|
68
|
+
0% {
|
|
69
|
+
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
|
|
70
|
+
}
|
|
71
|
+
70% {
|
|
72
|
+
box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
|
|
73
|
+
}
|
|
74
|
+
100% {
|
|
75
|
+
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.record-icon {
|
|
80
|
+
width: 24px;
|
|
81
|
+
height: 24px;
|
|
82
|
+
fill: currentColor;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.status-text {
|
|
86
|
+
font-size: 0.875rem;
|
|
87
|
+
color: #6b7280;
|
|
88
|
+
text-align: center;
|
|
89
|
+
min-height: 1.25rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.status-text.error {
|
|
93
|
+
color: #ee4444;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.status-text.success {
|
|
97
|
+
color: #10b981;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.debug-panel {
|
|
101
|
+
width: 100%;
|
|
102
|
+
margin-top: 1rem;
|
|
103
|
+
padding: 1rem;
|
|
104
|
+
background: #f9fafb;
|
|
105
|
+
border: 1px solid #e5e7eb;
|
|
106
|
+
border-radius: 0.375rem;
|
|
107
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
108
|
+
font-size: 0.75rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.debug-title {
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
margin-bottom: 0.5rem;
|
|
114
|
+
color: #374151;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.debug-content {
|
|
118
|
+
white-space: pre-wrap;
|
|
119
|
+
word-break: break-word;
|
|
120
|
+
color: #6b7280;
|
|
121
|
+
max-height: 200px;
|
|
122
|
+
overflow-y: auto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.permissions-warning {
|
|
126
|
+
padding: 0.75rem;
|
|
127
|
+
background: #fef3c7;
|
|
128
|
+
border: 1px solid #f59e0b;
|
|
129
|
+
border-radius: 0.375rem;
|
|
130
|
+
color: #92400e;
|
|
131
|
+
font-size: 0.875rem;
|
|
132
|
+
text-align: center;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.form-preview {
|
|
136
|
+
width: 100%;
|
|
137
|
+
margin-top: 1rem;
|
|
138
|
+
padding: 1rem;
|
|
139
|
+
background: #f8fafc;
|
|
140
|
+
border: 1px solid #e2e8f0;
|
|
141
|
+
border-radius: 0.375rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.form-preview-title {
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
margin-bottom: 0.5rem;
|
|
147
|
+
color: #1e293b;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.form-field {
|
|
151
|
+
margin-bottom: 0.5rem;
|
|
152
|
+
font-size: 0.875rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.field-name {
|
|
156
|
+
font-weight: 500;
|
|
157
|
+
color: #475569;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.field-value {
|
|
161
|
+
color: #64748b;
|
|
162
|
+
margin-left: 0.5rem;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.field-value.filled {
|
|
166
|
+
color: #059669;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.voice-filled-form {
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
gap: 1rem;
|
|
174
|
+
margin-top: 1rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.form-group {
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
gap: 0.25rem;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.form-label {
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
color: #374151;
|
|
186
|
+
font-size: 0.875rem;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.required {
|
|
190
|
+
color: #ee4444;
|
|
191
|
+
margin-left: 0.125rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.form-input {
|
|
195
|
+
padding: 0.5rem;
|
|
196
|
+
border: 1px solid #d1d5db;
|
|
197
|
+
border-radius: 0.375rem;
|
|
198
|
+
font-size: 0.875rem;
|
|
199
|
+
transition: border-color 0.2s ease;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.form-input:focus {
|
|
203
|
+
outline: none;
|
|
204
|
+
border-color: #3b82f6;
|
|
205
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.form-checkbox {
|
|
209
|
+
width: auto;
|
|
210
|
+
padding: 0;
|
|
211
|
+
margin: 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
select.form-input {
|
|
215
|
+
background-color: white;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
input[type="date"].form-input {
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.readonly-select {
|
|
224
|
+
background: #f9fafb;
|
|
225
|
+
border: 1px solid #d1d5db;
|
|
226
|
+
border-radius: 0.375rem;
|
|
227
|
+
padding: 0.5rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.select-placeholder {
|
|
231
|
+
font-size: 0.875rem;
|
|
232
|
+
color: #6b7280;
|
|
233
|
+
margin-bottom: 0.5rem;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.select-options-list {
|
|
237
|
+
list-style: none;
|
|
238
|
+
margin: 0;
|
|
239
|
+
padding: 0;
|
|
240
|
+
display: flex;
|
|
241
|
+
flex-wrap: wrap;
|
|
242
|
+
gap: 0.25rem;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.select-option {
|
|
246
|
+
background: #e5e7eb;
|
|
247
|
+
padding: 0.25rem 0.5rem;
|
|
248
|
+
border-radius: 0.25rem;
|
|
249
|
+
font-size: 0.875rem;
|
|
250
|
+
color: #374151;
|
|
251
|
+
}
|