@exode-team/react-recorder 1.0.3

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.
@@ -0,0 +1,59 @@
1
+ /**
2
+ * AudioRecorder shared types
3
+ *
4
+ * @author: exode <hello@exode.ru>
5
+ */
6
+ export interface StorageFileEntity {
7
+ id?: number;
8
+ url?: string;
9
+ name?: string;
10
+ size?: number;
11
+ mimeType?: string;
12
+ [key: string]: unknown;
13
+ }
14
+ export declare const StorageSpaceEnum: {
15
+ readonly User: "user";
16
+ readonly Shared: "shared";
17
+ readonly System: "system";
18
+ };
19
+ export type StorageSpace = typeof StorageSpaceEnum[keyof typeof StorageSpaceEnum] | (string & {});
20
+ export type UploadStrategy<TFile> = (file: File, ctx: {
21
+ space: StorageSpace;
22
+ uploadId: string;
23
+ }) => Promise<TFile>;
24
+ export interface UseVoiceRecorderOptions<TFile = unknown> {
25
+ space: StorageSpace;
26
+ uploadId: string;
27
+ onUploaded: (file: TFile) => void | Promise<void>;
28
+ fileName?: string;
29
+ mimeType?: string;
30
+ autoResetAfterUpload?: boolean;
31
+ onRecordingStart?: () => void;
32
+ onRecordingStop?: (blob: Blob) => void;
33
+ onRecordingDelete?: () => void;
34
+ onRecordingError?: (error: unknown) => void;
35
+ onPermissionDenied?: (error: unknown) => void;
36
+ uploader?: UploadStrategy<TFile>;
37
+ }
38
+ export interface UseVoiceRecorderResult {
39
+ isRecording: boolean;
40
+ audioURL: string | null;
41
+ isPlaying: boolean;
42
+ isPaused: boolean;
43
+ recordingTime: number;
44
+ playbackTime: number;
45
+ playbackDuration: number;
46
+ audioLevels: number[];
47
+ previewLevels: number[];
48
+ hasRecording: boolean;
49
+ startRecording: () => Promise<void>;
50
+ stopRecording: () => void;
51
+ cancelRecording: () => void;
52
+ deleteRecording: () => void;
53
+ toggleRecordingPause: () => void;
54
+ togglePlayback: () => void;
55
+ stopPlayback: () => void;
56
+ sendRecording: () => Promise<void>;
57
+ formatTime: (seconds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gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,sBAAsB;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@exode-team/react-recorder",
3
+ "version": "1.0.3",
4
+ "description": "Accessible audio recorder UI kit for React applications",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "clean": "rimraf dist",
10
+ "build": "rollup -c",
11
+ "prepare": "yarn build",
12
+ "npm:publish": "npm run build && npm publish"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "peerDependencies": {
27
+ "react": ">=17.0.0",
28
+ "react-dom": ">=17.0.0",
29
+ "styled-components": ">=5.3.0"
30
+ },
31
+ "dependencies": {
32
+ "lodash": "^4.17.21"
33
+ },
34
+ "devDependencies": {
35
+ "@rollup/plugin-commonjs": "^25.0.7",
36
+ "@rollup/plugin-node-resolve": "^15.2.3",
37
+ "@rollup/plugin-typescript": "^11.1.6",
38
+ "rimraf": "^5.0.9",
39
+ "rollup": "^4.6.0",
40
+ "tslib": "^2.8.1",
41
+ "rollup-plugin-peer-deps-external": "^2.2.4",
42
+ "typescript": "^5.2.2"
43
+ },
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/exode-team/exode-app"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/exode-team/exode-app/issues"
51
+ },
52
+ "homepage": "https://github.com/exode-team/exode-app#readme",
53
+ "keywords": [
54
+ "audio",
55
+ "recorder",
56
+ "react",
57
+ "voice",
58
+ "uploader"
59
+ ],
60
+ "publishConfig": {
61
+ "access": "public"
62
+ }
63
+ }