vdb-ai-chat 1.0.78 → 1.0.80
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/dist/chat-widget.js +189 -164
- package/dist/chat-widget.js.LICENSE.txt +2 -0
- package/lib/commonjs/api.js +84 -4
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/ChatInput.js +227 -65
- package/lib/commonjs/components/ChatInput.js.map +1 -1
- package/lib/commonjs/components/ChatWidget.js +6 -2
- package/lib/commonjs/components/ChatWidget.js.map +1 -1
- package/lib/commonjs/components/MessageBubble.js +22 -2
- package/lib/commonjs/components/MessageBubble.js.map +1 -1
- package/lib/commonjs/components/icons/VDBCustomIcon.js +54 -0
- package/lib/commonjs/components/icons/VDBCustomIcon.js.map +1 -0
- package/lib/commonjs/components/icons/VDBIcon.js +141 -0
- package/lib/commonjs/components/icons/VDBIcon.js.map +1 -0
- package/lib/commonjs/components/icons/VDBIcons.js +16 -0
- package/lib/commonjs/components/icons/VDBIcons.js.map +1 -0
- package/lib/commonjs/components/icons/index.js +34 -0
- package/lib/commonjs/components/icons/index.js.map +1 -0
- package/lib/commonjs/index.js +29 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +30 -1
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/routes.js +1 -0
- package/lib/commonjs/routes.js.map +1 -1
- package/lib/module/api.js +81 -5
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/ChatInput.js +228 -66
- package/lib/module/components/ChatInput.js.map +1 -1
- package/lib/module/components/ChatWidget.js +6 -2
- package/lib/module/components/ChatWidget.js.map +1 -1
- package/lib/module/components/MessageBubble.js +22 -2
- package/lib/module/components/MessageBubble.js.map +1 -1
- package/lib/module/components/icons/VDBCustomIcon.js +47 -0
- package/lib/module/components/icons/VDBCustomIcon.js.map +1 -0
- package/lib/module/components/icons/VDBIcon.js +134 -0
- package/lib/module/components/icons/VDBIcon.js.map +1 -0
- package/lib/module/components/icons/VDBIcons.js +10 -0
- package/lib/module/components/icons/VDBIcons.js.map +1 -0
- package/lib/module/components/icons/index.js +3 -0
- package/lib/module/components/icons/index.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +1 -0
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/routes.js +1 -0
- package/lib/module/routes.js.map +1 -1
- package/lib/typescript/api.d.ts +22 -0
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/ChatInput.d.ts +4 -0
- package/lib/typescript/components/ChatInput.d.ts.map +1 -1
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble.d.ts +2 -0
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -1
- package/lib/typescript/components/icons/VDBCustomIcon.d.ts +11 -0
- package/lib/typescript/components/icons/VDBCustomIcon.d.ts.map +1 -0
- package/lib/typescript/components/icons/VDBIcon.d.ts +34 -0
- package/lib/typescript/components/icons/VDBIcon.d.ts.map +1 -0
- package/lib/typescript/components/icons/VDBIcons.d.ts +9 -0
- package/lib/typescript/components/icons/VDBIcons.d.ts.map +1 -0
- package/lib/typescript/components/icons/index.d.ts +5 -0
- package/lib/typescript/components/icons/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/index.native.d.ts +2 -0
- package/lib/typescript/index.native.d.ts.map +1 -1
- package/lib/typescript/routes.d.ts +1 -0
- package/lib/typescript/routes.d.ts.map +1 -1
- package/package.json +18 -2
- package/src/api.ts +147 -3
- package/src/components/ChatInput.tsx +360 -83
- package/src/components/ChatWidget.tsx +9 -0
- package/src/components/MessageBubble.tsx +27 -1
- package/src/components/icons/VDBCustomIcon.tsx +74 -0
- package/src/components/icons/VDBIcon.tsx +186 -0
- package/src/components/icons/VDBIcons.ts +9 -0
- package/src/components/icons/index.ts +4 -0
- package/src/index.native.tsx +12 -0
- package/src/index.ts +12 -0
- package/src/routes.ts +1 -0
package/lib/module/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["API_VERSION","Routes","AGENCT_CONVERSATIONS","apiUrl","SEARCH_DIAMONDS","REACTION","conversation_id","message_id"],"sourceRoot":"../../src","sources":["routes.ts"],"mappings":"AAAA,MAAMA,WAAW,GAAG,IAAI;AAExB,MAAMC,MAAM,GAAG;EACdC,oBAAoB,EAAGC,MAAc,IAAK,GAAGA,MAAM,GAAGH,WAAW,sBAAsB;EACvFI,
|
|
1
|
+
{"version":3,"names":["API_VERSION","Routes","AGENCT_CONVERSATIONS","apiUrl","TRANSCRIBE","SEARCH_DIAMONDS","REACTION","conversation_id","message_id"],"sourceRoot":"../../src","sources":["routes.ts"],"mappings":"AAAA,MAAMA,WAAW,GAAG,IAAI;AAExB,MAAMC,MAAM,GAAG;EACdC,oBAAoB,EAAGC,MAAc,IAAK,GAAGA,MAAM,GAAGH,WAAW,sBAAsB;EACvFI,UAAU,EAAGD,MAAc,IAAK,GAAGA,MAAM,GAAGH,WAAW,iCAAiC;EACxFK,eAAe,EAAGF,MAAc,IAAK,GAAGA,MAAM,GAAGH,WAAW,sBAAsB;EAClFM,QAAQ,EAAEA,CAACH,MAAc,EAAEI,eAAuB,EAAEC,UAAkB,KAAK,GAAGL,MAAM,GAAGH,WAAW,wBAAwBO,eAAe,0BAA0BC,UAAU;AAC9K,CAAC;AAED,eAAeP,MAAM","ignoreList":[]}
|
package/lib/typescript/api.d.ts
CHANGED
|
@@ -75,5 +75,27 @@ export interface RecommendationResponse {
|
|
|
75
75
|
messages?: RecommendationMessage[];
|
|
76
76
|
}
|
|
77
77
|
export declare function getRecommendations(apiUrl: string, conversationId: number, visibleItems: RecommendationItem[]): Promise<RecommendationResponse>;
|
|
78
|
+
export interface TranscribeResponse {
|
|
79
|
+
transcript: string;
|
|
80
|
+
language_code: string;
|
|
81
|
+
audio_duration_seconds: number;
|
|
82
|
+
}
|
|
83
|
+
export type TranscribeAudioFile = Blob | {
|
|
84
|
+
uri: string;
|
|
85
|
+
name?: string;
|
|
86
|
+
type?: string;
|
|
87
|
+
};
|
|
88
|
+
export declare class TranscribeError extends Error {
|
|
89
|
+
status: number;
|
|
90
|
+
errorCode?: string;
|
|
91
|
+
responseBody?: unknown;
|
|
92
|
+
constructor(message: string, status: number, errorCode?: string, responseBody?: unknown);
|
|
93
|
+
}
|
|
94
|
+
export declare function transcribeAudio(apiUrl: string, file: TranscribeAudioFile, options?: {
|
|
95
|
+
conversationId?: string | number;
|
|
96
|
+
priceMode?: string | null;
|
|
97
|
+
fileName?: string;
|
|
98
|
+
mimeType?: string;
|
|
99
|
+
}): Promise<TranscribeResponse>;
|
|
78
100
|
export declare function mapDiamondToRecommendationItem(diamond: any): RecommendationItem;
|
|
79
101
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAqChD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AA2CD,wBAAsB,qBAAqB,CA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E,MAAM,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,OAAO,CAAC,kBAAkB,CAAC,CA8F7B;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,GAAG,GACX,kBAAkB,CAkBpB"}
|
|
@@ -9,6 +9,10 @@ interface Props {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
theme: ChatTheme;
|
|
11
11
|
inputRef?: React.RefObject<TextInput>;
|
|
12
|
+
apiUrl?: string;
|
|
13
|
+
conversationId?: string | number;
|
|
14
|
+
priceMode?: string | null;
|
|
15
|
+
onTranscribeError?: (error: Error, message: string) => void;
|
|
12
16
|
}
|
|
13
17
|
export declare const ChatInput: React.FC<Props>;
|
|
14
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/components/ChatInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/components/ChatInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,SAAS,EAAwB,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA0B1C,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiUrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAkBf,OAAO,KAAK,EAAe,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA+C5E,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAkBf,OAAO,KAAK,EAAe,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA+C5E,eAAO,MAAM,UAAU,uFA2mDtB,CAAC"}
|
|
@@ -13,6 +13,8 @@ interface Props {
|
|
|
13
13
|
onSuggestionSelect?: (value: string) => void;
|
|
14
14
|
isLatest?: boolean;
|
|
15
15
|
isTyping?: boolean;
|
|
16
|
+
showShowResultsButton?: boolean;
|
|
17
|
+
onViewAll?: (item: any) => void;
|
|
16
18
|
}
|
|
17
19
|
export declare const MessageBubble: React.NamedExoticComponent<Props>;
|
|
18
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,WAAW,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AAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACjC;AAwND,eAAO,MAAM,aAAa,mCAA+B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface VDBCustomIconProps {
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: any;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
declare const VDBCustomIcon: React.FC<VDBCustomIconProps>;
|
|
10
|
+
export default VDBCustomIcon;
|
|
11
|
+
//# sourceMappingURL=VDBCustomIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VDBCustomIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/VDBCustomIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA8BnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAiC/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ImageResizeMode } from "react-native";
|
|
3
|
+
export declare enum IconsVariant {
|
|
4
|
+
AntDesign = "AntDesign",
|
|
5
|
+
FontAwesome = "FontAwesome",
|
|
6
|
+
FontAwesome5 = "FontAwesome5",
|
|
7
|
+
VDBCustom = "VDBCustom",
|
|
8
|
+
CustomUrl = "CustomUrl"
|
|
9
|
+
}
|
|
10
|
+
export declare enum IconsType {
|
|
11
|
+
img = "img",
|
|
12
|
+
svg = "svg",
|
|
13
|
+
img_url = "img-url",
|
|
14
|
+
svg_url = "svg-url",
|
|
15
|
+
url = "url"
|
|
16
|
+
}
|
|
17
|
+
export interface IconProps {
|
|
18
|
+
variant: IconsVariant;
|
|
19
|
+
name?: string;
|
|
20
|
+
color?: string;
|
|
21
|
+
size?: number;
|
|
22
|
+
uri?: string;
|
|
23
|
+
height?: number;
|
|
24
|
+
resizeMode?: ImageResizeMode;
|
|
25
|
+
}
|
|
26
|
+
export interface CustomIconProps extends IconProps {
|
|
27
|
+
others?: object;
|
|
28
|
+
avoidSVGCheck?: boolean;
|
|
29
|
+
thumbSize?: number;
|
|
30
|
+
style?: any;
|
|
31
|
+
}
|
|
32
|
+
declare const VDBIcon: React.FC<CustomIconProps>;
|
|
33
|
+
export default VDBIcon;
|
|
34
|
+
//# sourceMappingURL=VDBIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VDBIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/VDBIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAS,eAAe,EAAY,MAAM,cAAc,CAAC;AAgChE,oBAAY,YAAY;IACtB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAQD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA+GtC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VDBIcons.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/VDBIcons.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,WAAW,gBAAgB;CAC5B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as VDBIcon, IconsVariant, IconsType } from "./VDBIcon";
|
|
2
|
+
export type { IconProps, CustomIconProps } from "./VDBIcon";
|
|
3
|
+
export { default as VDBCustomIcon } from "./VDBCustomIcon";
|
|
4
|
+
export type { VDBCustomIconProps } from "./VDBCustomIcon";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -3,5 +3,7 @@ export * from "./types";
|
|
|
3
3
|
export * from "./theme";
|
|
4
4
|
export { normaliseMessages } from "./api";
|
|
5
5
|
export { initStorage, isStorageInitialized, Storage } from "./storage";
|
|
6
|
+
export { VDBIcon, VDBCustomIcon, IconsVariant, IconsType, } from "./components/icons";
|
|
7
|
+
export type { IconProps, CustomIconProps, VDBCustomIconProps, } from "./components/icons";
|
|
6
8
|
export { initI18n, setTranslations, getTranslations, changeLanguage, getCurrentLanguage, isI18nInitialized, useTranslation, t, } from "./i18n";
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,SAAS,EACT,eAAe,EACf,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,CAAC,GACF,MAAM,QAAQ,CAAC"}
|
|
@@ -3,4 +3,6 @@ export * from "./types";
|
|
|
3
3
|
export * from "./theme";
|
|
4
4
|
export { normaliseMessages } from "./api";
|
|
5
5
|
export { initStorage, isStorageInitialized, Storage } from "./storage";
|
|
6
|
+
export { VDBIcon, VDBCustomIcon, IconsVariant, IconsType, } from "./components/icons";
|
|
7
|
+
export type { IconProps, CustomIconProps, VDBCustomIconProps, } from "./components/icons";
|
|
6
8
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,SAAS,EACT,eAAe,EACf,kBAAkB,GACnB,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;mCACoB,MAAM;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;mCACoB,MAAM;yBAChB,MAAM;8BACD,MAAM;uBACb,MAAM,mBAAmB,MAAM,cAAc,MAAM;CACtE,CAAA;AAED,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vdb-ai-chat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
4
4
|
"description": "Cross-platform AI chat widget for React Native and Web",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -40,11 +40,15 @@
|
|
|
40
40
|
"url": ""
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
+
"@expo/vector-icons": ">=13.0.0",
|
|
43
44
|
"@segment/analytics-next": ">=1.0.0",
|
|
44
45
|
"@segment/analytics-react-native": ">=2.0.0",
|
|
46
|
+
"axios": ">=1.0.0",
|
|
47
|
+
"expo-av": "^16.0.8",
|
|
45
48
|
"expo-image": ">=1.0.0",
|
|
46
49
|
"react": ">=17.0.0",
|
|
47
|
-
"react-native": ">=0.64.0"
|
|
50
|
+
"react-native": ">=0.64.0",
|
|
51
|
+
"react-native-svg": "^15.15.5"
|
|
48
52
|
},
|
|
49
53
|
"peerDependenciesMeta": {
|
|
50
54
|
"react-native": {
|
|
@@ -53,11 +57,23 @@
|
|
|
53
57
|
"expo-image": {
|
|
54
58
|
"optional": true
|
|
55
59
|
},
|
|
60
|
+
"expo-av": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
56
63
|
"@segment/analytics-next": {
|
|
57
64
|
"optional": true
|
|
58
65
|
},
|
|
59
66
|
"@segment/analytics-react-native": {
|
|
60
67
|
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"@expo/vector-icons": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"react-native-svg": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"axios": {
|
|
76
|
+
"optional": true
|
|
61
77
|
}
|
|
62
78
|
},
|
|
63
79
|
"dependencies": {
|
package/src/api.ts
CHANGED
|
@@ -8,7 +8,6 @@ import Routes from "./routes";
|
|
|
8
8
|
import { Storage } from "./storage";
|
|
9
9
|
import type { ChatMessage } from "./types";
|
|
10
10
|
|
|
11
|
-
// Generic params type reused for downstream APIs (e.g. product search payload)
|
|
12
11
|
export type ChatApiParams = Record<string, any>;
|
|
13
12
|
|
|
14
13
|
async function getUserToken(): Promise<string> {
|
|
@@ -17,7 +16,7 @@ async function getUserToken(): Promise<string> {
|
|
|
17
16
|
return userData?.token || "";
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
async function
|
|
19
|
+
async function buildAuthHeaders() {
|
|
21
20
|
const token = await getUserToken();
|
|
22
21
|
const iid = (await Storage.getItem("persist:appState")) || "{}";
|
|
23
22
|
let installationId = "";
|
|
@@ -32,13 +31,19 @@ async function buildHeaders() {
|
|
|
32
31
|
const session = (await Storage.getItem("session_cookie")) || "";
|
|
33
32
|
|
|
34
33
|
return {
|
|
35
|
-
"Content-Type": "application/json",
|
|
36
34
|
Accept: "application/json, text/plain, */*",
|
|
37
35
|
Authorization: `Token token=${token},installation_identifier=${installationId}`,
|
|
38
36
|
Cookie: `vdb-server_session=${session}`,
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
async function buildHeaders() {
|
|
41
|
+
return {
|
|
42
|
+
...(await buildAuthHeaders()),
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
// Structure for storing conversations with session token
|
|
43
48
|
export interface StoredConversations {
|
|
44
49
|
token: string;
|
|
@@ -543,6 +548,145 @@ export async function getRecommendations(
|
|
|
543
548
|
return data;
|
|
544
549
|
}
|
|
545
550
|
|
|
551
|
+
export interface TranscribeResponse {
|
|
552
|
+
transcript: string;
|
|
553
|
+
language_code: string;
|
|
554
|
+
audio_duration_seconds: number;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export type TranscribeAudioFile =
|
|
558
|
+
| Blob
|
|
559
|
+
| { uri: string; name?: string; type?: string };
|
|
560
|
+
export class TranscribeError extends Error {
|
|
561
|
+
status: number;
|
|
562
|
+
errorCode?: string;
|
|
563
|
+
responseBody?: unknown;
|
|
564
|
+
|
|
565
|
+
constructor(
|
|
566
|
+
message: string,
|
|
567
|
+
status: number,
|
|
568
|
+
errorCode?: string,
|
|
569
|
+
responseBody?: unknown,
|
|
570
|
+
) {
|
|
571
|
+
super(message);
|
|
572
|
+
this.name = "TranscribeError";
|
|
573
|
+
this.status = status;
|
|
574
|
+
this.errorCode = errorCode;
|
|
575
|
+
this.responseBody = responseBody;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function stripMimeParams(mimeType: string): string {
|
|
580
|
+
if (!mimeType) return mimeType;
|
|
581
|
+
const semi = mimeType.indexOf(";");
|
|
582
|
+
return (semi >= 0 ? mimeType.slice(0, semi) : mimeType).trim();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export async function transcribeAudio(
|
|
586
|
+
apiUrl: string,
|
|
587
|
+
file: TranscribeAudioFile,
|
|
588
|
+
options?: {
|
|
589
|
+
conversationId?: string | number;
|
|
590
|
+
priceMode?: string | null;
|
|
591
|
+
fileName?: string;
|
|
592
|
+
mimeType?: string;
|
|
593
|
+
},
|
|
594
|
+
): Promise<TranscribeResponse> {
|
|
595
|
+
let conversationId = options?.conversationId;
|
|
596
|
+
|
|
597
|
+
if (conversationId == null && options?.priceMode) {
|
|
598
|
+
const conversations = await getValidConversations();
|
|
599
|
+
const storedId =
|
|
600
|
+
conversations?.[options.priceMode]?.conversation_id ?? null;
|
|
601
|
+
if (storedId != null) {
|
|
602
|
+
conversationId = storedId;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const formData = new FormData();
|
|
607
|
+
|
|
608
|
+
if (typeof Blob !== "undefined" && file instanceof Blob) {
|
|
609
|
+
const name =
|
|
610
|
+
options?.fileName ||
|
|
611
|
+
(file as File).name ||
|
|
612
|
+
`audio-${Date.now()}.wav`;
|
|
613
|
+
|
|
614
|
+
const rawType = options?.mimeType || file.type || "";
|
|
615
|
+
const sanitizedType = stripMimeParams(rawType);
|
|
616
|
+
const blobToSend =
|
|
617
|
+
sanitizedType && sanitizedType !== file.type
|
|
618
|
+
? new Blob([file], { type: sanitizedType })
|
|
619
|
+
: file;
|
|
620
|
+
|
|
621
|
+
formData.append("file", blobToSend, name);
|
|
622
|
+
} else if (typeof file === "object" && file && "uri" in file) {
|
|
623
|
+
const rnFile = {
|
|
624
|
+
uri: file.uri,
|
|
625
|
+
name: options?.fileName || file.name || `audio-${Date.now()}.wav`,
|
|
626
|
+
type: stripMimeParams(
|
|
627
|
+
options?.mimeType || file.type || "audio/wav",
|
|
628
|
+
),
|
|
629
|
+
} as any;
|
|
630
|
+
formData.append("file", rnFile);
|
|
631
|
+
} else {
|
|
632
|
+
throw new Error(
|
|
633
|
+
"transcribeAudio: unsupported file input. Provide a Blob/File (web) or { uri, name?, type? } (React Native).",
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (conversationId != null) {
|
|
638
|
+
formData.append("conversation_id", String(conversationId));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
const res = await fetch(Routes.TRANSCRIBE(apiUrl), {
|
|
642
|
+
method: "POST",
|
|
643
|
+
headers: await buildAuthHeaders(),
|
|
644
|
+
body: formData as any,
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
if (!res.ok) {
|
|
648
|
+
let errorCode: string | undefined;
|
|
649
|
+
let backendMessage: string | undefined;
|
|
650
|
+
let parsedBody: unknown;
|
|
651
|
+
|
|
652
|
+
try {
|
|
653
|
+
const text = await res.text();
|
|
654
|
+
parsedBody = text;
|
|
655
|
+
if (text) {
|
|
656
|
+
try {
|
|
657
|
+
const json = JSON.parse(text);
|
|
658
|
+
parsedBody = json;
|
|
659
|
+
errorCode =
|
|
660
|
+
json?.error_code ??
|
|
661
|
+
json?.errorCode ??
|
|
662
|
+
json?.code ??
|
|
663
|
+
undefined;
|
|
664
|
+
backendMessage =
|
|
665
|
+
typeof json?.message === "string"
|
|
666
|
+
? json.message
|
|
667
|
+
: typeof json?.error === "string"
|
|
668
|
+
? json.error
|
|
669
|
+
: undefined;
|
|
670
|
+
} catch {
|
|
671
|
+
backendMessage = text;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
} catch {
|
|
675
|
+
// ignore body read errors
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
throw new TranscribeError(
|
|
679
|
+
backendMessage ||
|
|
680
|
+
`Transcription failed (HTTP ${res.status})`,
|
|
681
|
+
res.status,
|
|
682
|
+
errorCode,
|
|
683
|
+
parsedBody,
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return (await res.json()) as TranscribeResponse;
|
|
688
|
+
}
|
|
689
|
+
|
|
546
690
|
export function mapDiamondToRecommendationItem(
|
|
547
691
|
diamond: any,
|
|
548
692
|
): RecommendationItem {
|