vdb-ai-chat 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.
- package/README.md +153 -0
- package/dist/chat-widget.js +2 -0
- package/dist/chat-widget.js.LICENSE.txt +29 -0
- package/lib/commonjs/api.js +157 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/components/ChatHeader.js +111 -0
- package/lib/commonjs/components/ChatHeader.js.map +1 -0
- package/lib/commonjs/components/ChatInput.js +144 -0
- package/lib/commonjs/components/ChatInput.js.map +1 -0
- package/lib/commonjs/components/ChatWidget.js +469 -0
- package/lib/commonjs/components/ChatWidget.js.map +1 -0
- package/lib/commonjs/components/MessageBubble.js +122 -0
- package/lib/commonjs/components/MessageBubble.js.map +1 -0
- package/lib/commonjs/components/ProductsList.js +139 -0
- package/lib/commonjs/components/ProductsList.js.map +1 -0
- package/lib/commonjs/components/SuggestionsRow.js +59 -0
- package/lib/commonjs/components/SuggestionsRow.js.map +1 -0
- package/lib/commonjs/components/utils.js +37 -0
- package/lib/commonjs/components/utils.js.map +1 -0
- package/lib/commonjs/index.js +70 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.native.js +70 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/index.web.js +30 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/storage.js +136 -0
- package/lib/commonjs/storage.js.map +1 -0
- package/lib/commonjs/theme.js +29 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/api.js +146 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/components/ChatHeader.js +105 -0
- package/lib/module/components/ChatHeader.js.map +1 -0
- package/lib/module/components/ChatInput.js +136 -0
- package/lib/module/components/ChatInput.js.map +1 -0
- package/lib/module/components/ChatWidget.js +461 -0
- package/lib/module/components/ChatWidget.js.map +1 -0
- package/lib/module/components/MessageBubble.js +116 -0
- package/lib/module/components/MessageBubble.js.map +1 -0
- package/lib/module/components/ProductsList.js +133 -0
- package/lib/module/components/ProductsList.js.map +1 -0
- package/lib/module/components/SuggestionsRow.js +52 -0
- package/lib/module/components/SuggestionsRow.js.map +1 -0
- package/lib/module/components/utils.js +29 -0
- package/lib/module/components/utils.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.native.js +7 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/index.web.js +23 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/storage.js +129 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/theme.js +22 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/api.d.ts +10 -0
- package/lib/typescript/api.d.ts.map +1 -0
- package/lib/typescript/components/ChatHeader.d.ts +6 -0
- package/lib/typescript/components/ChatHeader.d.ts.map +1 -0
- package/lib/typescript/components/ChatInput.d.ts +15 -0
- package/lib/typescript/components/ChatInput.d.ts.map +1 -0
- package/lib/typescript/components/ChatWidget.d.ts +4 -0
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble.d.ts +13 -0
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -0
- package/lib/typescript/components/ProductsList.d.ts +9 -0
- package/lib/typescript/components/ProductsList.d.ts.map +1 -0
- package/lib/typescript/components/SuggestionsRow.d.ts +8 -0
- package/lib/typescript/components/SuggestionsRow.d.ts.map +1 -0
- package/lib/typescript/components/utils.d.ts +8 -0
- package/lib/typescript/components/utils.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/index.native.d.ts +6 -0
- package/lib/typescript/index.native.d.ts.map +1 -0
- package/lib/typescript/index.web.d.ts +3 -0
- package/lib/typescript/index.web.d.ts.map +1 -0
- package/lib/typescript/storage.d.ts +28 -0
- package/lib/typescript/storage.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +4 -0
- package/lib/typescript/theme.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +51 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +90 -0
- package/src/api.ts +200 -0
- package/src/components/ChatHeader.tsx +114 -0
- package/src/components/ChatInput.tsx +163 -0
- package/src/components/ChatWidget.tsx +679 -0
- package/src/components/MessageBubble.tsx +181 -0
- package/src/components/ProductsList.tsx +160 -0
- package/src/components/SuggestionsRow.tsx +73 -0
- package/src/components/utils.ts +43 -0
- package/src/index.native.tsx +6 -0
- package/src/index.ts +7 -0
- package/src/index.web.tsx +33 -0
- package/src/storage.ts +142 -0
- package/src/theme.ts +21 -0
- package/src/types.ts +56 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { View, Image, StyleSheet, Text, ScrollView, TouchableOpacity, Platform } from "react-native";
|
|
2
|
+
import React, { memo } from "react";
|
|
3
|
+
|
|
4
|
+
// Use expo-image on native if available, fallback to RN Image
|
|
5
|
+
let ImageComponent = Image;
|
|
6
|
+
if (Platform.OS !== "web") {
|
|
7
|
+
try {
|
|
8
|
+
const ExpoImage = require("expo-image").Image;
|
|
9
|
+
if (ExpoImage) ImageComponent = ExpoImage;
|
|
10
|
+
} catch {
|
|
11
|
+
// expo-image not installed, use React Native Image
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const ProductsListComponent = ({
|
|
15
|
+
data,
|
|
16
|
+
onViewAll,
|
|
17
|
+
onItemPress
|
|
18
|
+
}) => {
|
|
19
|
+
if (!data || !data.length) return null;
|
|
20
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
21
|
+
style: styles.wrapper
|
|
22
|
+
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
23
|
+
horizontal: true,
|
|
24
|
+
showsHorizontalScrollIndicator: false,
|
|
25
|
+
contentContainerStyle: styles.listContent
|
|
26
|
+
}, data.map(item => /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
27
|
+
key: item.id,
|
|
28
|
+
onPress: () => {
|
|
29
|
+
onItemPress?.(item);
|
|
30
|
+
}
|
|
31
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
32
|
+
key: item.id,
|
|
33
|
+
style: styles.card
|
|
34
|
+
}, /*#__PURE__*/React.createElement(ImageComponent, {
|
|
35
|
+
style: styles.image,
|
|
36
|
+
source: {
|
|
37
|
+
uri: item.image_thumb_url
|
|
38
|
+
}
|
|
39
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
40
|
+
style: styles.content
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
42
|
+
numberOfLines: 2,
|
|
43
|
+
style: styles.title
|
|
44
|
+
}, item.short_title), /*#__PURE__*/React.createElement(Text, {
|
|
45
|
+
style: styles.price
|
|
46
|
+
}, "$", item.total_sales_price)))))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
47
|
+
style: styles.button,
|
|
48
|
+
activeOpacity: 0.8,
|
|
49
|
+
onPress: onViewAll
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
51
|
+
style: styles.buttonText
|
|
52
|
+
}, "View All ", ">>")));
|
|
53
|
+
};
|
|
54
|
+
const styles = StyleSheet.create({
|
|
55
|
+
wrapper: {
|
|
56
|
+
paddingHorizontal: 12,
|
|
57
|
+
marginHorizontal: 12,
|
|
58
|
+
marginBottom: 12,
|
|
59
|
+
paddingTop: 6,
|
|
60
|
+
paddingBottom: 14,
|
|
61
|
+
backgroundColor: "#fff",
|
|
62
|
+
borderRadius: 8,
|
|
63
|
+
borderWidth: 1,
|
|
64
|
+
borderColor: "#e8e8e8",
|
|
65
|
+
elevation: 3,
|
|
66
|
+
shadowColor: "#000",
|
|
67
|
+
shadowOpacity: 0.08,
|
|
68
|
+
shadowOffset: {
|
|
69
|
+
width: 0,
|
|
70
|
+
height: 2
|
|
71
|
+
},
|
|
72
|
+
shadowRadius: 6
|
|
73
|
+
},
|
|
74
|
+
listContent: {
|
|
75
|
+
gap: 12,
|
|
76
|
+
paddingVertical: 6
|
|
77
|
+
},
|
|
78
|
+
card: {
|
|
79
|
+
width: 150,
|
|
80
|
+
backgroundColor: "#fff",
|
|
81
|
+
borderRadius: 14,
|
|
82
|
+
overflow: "hidden",
|
|
83
|
+
borderColor: "#e8e8e8",
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
elevation: 3,
|
|
86
|
+
shadowColor: "#000",
|
|
87
|
+
shadowOpacity: 0.08,
|
|
88
|
+
shadowOffset: {
|
|
89
|
+
width: 0,
|
|
90
|
+
height: 2
|
|
91
|
+
},
|
|
92
|
+
shadowRadius: 6
|
|
93
|
+
},
|
|
94
|
+
image: {
|
|
95
|
+
width: "100%",
|
|
96
|
+
height: 120,
|
|
97
|
+
borderBottomWidth: 1,
|
|
98
|
+
borderBottomColor: "#e8e8e8"
|
|
99
|
+
},
|
|
100
|
+
content: {
|
|
101
|
+
padding: 10,
|
|
102
|
+
gap: 4
|
|
103
|
+
},
|
|
104
|
+
title: {
|
|
105
|
+
fontSize: 13,
|
|
106
|
+
color: "#222",
|
|
107
|
+
fontWeight: "500"
|
|
108
|
+
},
|
|
109
|
+
price: {
|
|
110
|
+
marginTop: 4,
|
|
111
|
+
fontSize: 14,
|
|
112
|
+
fontWeight: "700",
|
|
113
|
+
color: "#000"
|
|
114
|
+
},
|
|
115
|
+
button: {
|
|
116
|
+
marginTop: 12,
|
|
117
|
+
alignSelf: "center",
|
|
118
|
+
paddingHorizontal: 20,
|
|
119
|
+
paddingVertical: 8,
|
|
120
|
+
backgroundColor: "#804195",
|
|
121
|
+
borderRadius: 20,
|
|
122
|
+
width: 300,
|
|
123
|
+
alignItems: "center"
|
|
124
|
+
},
|
|
125
|
+
buttonText: {
|
|
126
|
+
color: "#fff",
|
|
127
|
+
fontSize: 14,
|
|
128
|
+
fontWeight: "600"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const ProductsList = /*#__PURE__*/memo(ProductsListComponent);
|
|
132
|
+
export default ProductsList;
|
|
133
|
+
//# sourceMappingURL=ProductsList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","Image","StyleSheet","Text","ScrollView","TouchableOpacity","Platform","React","memo","ImageComponent","OS","ExpoImage","require","ProductsListComponent","data","onViewAll","onItemPress","length","createElement","style","styles","wrapper","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","listContent","map","item","key","id","onPress","card","image","source","uri","image_thumb_url","content","numberOfLines","title","short_title","price","total_sales_price","button","activeOpacity","buttonText","create","paddingHorizontal","marginHorizontal","marginBottom","paddingTop","paddingBottom","backgroundColor","borderRadius","borderWidth","borderColor","elevation","shadowColor","shadowOpacity","shadowOffset","width","height","shadowRadius","gap","paddingVertical","overflow","borderBottomWidth","borderBottomColor","padding","fontSize","color","fontWeight","marginTop","alignSelf","alignItems","ProductsList"],"sourceRoot":"../../../src","sources":["components/ProductsList.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,QAAQ,QACH,cAAc;AACrB,OAAOC,KAAK,IAAIC,IAAI,QAAQ,OAAO;;AAEnC;AACA,IAAIC,cAA4B,GAAGR,KAAK;AACxC,IAAIK,QAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;EACzB,IAAI;IACF,MAAMC,SAAS,GAAGC,OAAO,CAAC,YAAY,CAAC,CAACX,KAAK;IAC7C,IAAIU,SAAS,EAAEF,cAAc,GAAGE,SAAS;EAC3C,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ;AAQA,MAAME,qBAAkD,GAAGA,CAAC;EAC1DC,IAAI;EACJC,SAAS;EACTC;AACF,CAAC,KAAK;EACJ,IAAI,CAACF,IAAI,IAAI,CAACA,IAAI,CAACG,MAAM,EAAE,OAAO,IAAI;EAEtC,oBACEV,KAAA,CAAAW,aAAA,CAAClB,IA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C,UAAU,EAAE;EACd,CAAC;EAED9B,KAAK,EAAE;IACL+B,SAAS,EAAE,CAAC;IACZH,QAAQ,EAAE,EAAE;IACZE,UAAU,EAAE,KAAK;IACjBD,KAAK,EAAE;EACT,CAAC;EAED3B,MAAM,EAAE;IACN6B,SAAS,EAAE,EAAE;IACbC,SAAS,EAAE,QAAQ;IACnB1B,iBAAiB,EAAE,EAAE;IACrBiB,eAAe,EAAE,CAAC;IAClBZ,eAAe,EAAE,SAAS;IAC1BC,YAAY,EAAE,EAAE;IAChBO,KAAK,EAAE,GAAG;IACVc,UAAU,EAAE;EACd,CAAC;EAED7B,UAAU,EAAE;IACVyB,KAAK,EAAE,MAAM;IACbD,QAAQ,EAAE,EAAE;IACZE,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,MAAMI,YAAY,gBAAGlE,IAAI,CAACK,qBAAqB,CAAC;AAChD,eAAe6D,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { Text, TouchableOpacity, StyleSheet, ScrollView } from "react-native";
|
|
3
|
+
const SuggestionsRowComponent = ({
|
|
4
|
+
suggestions,
|
|
5
|
+
onSelect
|
|
6
|
+
}) => {
|
|
7
|
+
if (!suggestions.length) return null;
|
|
8
|
+
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
9
|
+
horizontal: true,
|
|
10
|
+
showsHorizontalScrollIndicator: false,
|
|
11
|
+
contentContainerStyle: styles.container
|
|
12
|
+
}, suggestions.map(s => /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
13
|
+
key: s,
|
|
14
|
+
style: styles.chip,
|
|
15
|
+
onPress: () => onSelect(s),
|
|
16
|
+
activeOpacity: 0.75
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
18
|
+
style: styles.chipText
|
|
19
|
+
}, s))));
|
|
20
|
+
};
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
container: {
|
|
23
|
+
paddingHorizontal: 12,
|
|
24
|
+
paddingBottom: 8,
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
gap: 10
|
|
27
|
+
},
|
|
28
|
+
chip: {
|
|
29
|
+
backgroundColor: "#ffffff",
|
|
30
|
+
paddingHorizontal: 16,
|
|
31
|
+
paddingVertical: 8,
|
|
32
|
+
borderRadius: 18,
|
|
33
|
+
// Modern soft shadow (Material 3 / iOS style)
|
|
34
|
+
shadowColor: "#000",
|
|
35
|
+
shadowOpacity: 0.07,
|
|
36
|
+
shadowRadius: 4,
|
|
37
|
+
shadowOffset: {
|
|
38
|
+
width: 0,
|
|
39
|
+
height: 2
|
|
40
|
+
},
|
|
41
|
+
elevation: 2
|
|
42
|
+
},
|
|
43
|
+
chipText: {
|
|
44
|
+
fontSize: 14,
|
|
45
|
+
color: "#1A1A1A",
|
|
46
|
+
fontWeight: "500",
|
|
47
|
+
letterSpacing: 0.3
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const SuggestionsRow = /*#__PURE__*/memo(SuggestionsRowComponent);
|
|
51
|
+
export default SuggestionsRow;
|
|
52
|
+
//# sourceMappingURL=SuggestionsRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","memo","Text","TouchableOpacity","StyleSheet","ScrollView","SuggestionsRowComponent","suggestions","onSelect","length","createElement","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","styles","container","map","s","key","style","chip","onPress","activeOpacity","chipText","create","paddingHorizontal","paddingBottom","flexDirection","gap","backgroundColor","paddingVertical","borderRadius","shadowColor","shadowOpacity","shadowRadius","shadowOffset","width","height","elevation","fontSize","color","fontWeight","letterSpacing","SuggestionsRow"],"sourceRoot":"../../../src","sources":["components/SuggestionsRow.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAEEC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,QACL,cAAc;AAOrB,MAAMC,uBA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C,cAAc,gBAAG1C,IAAI,CAACK,uBAAuB,CAAC;AACpD,eAAeqC,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Storage } from "../storage";
|
|
2
|
+
export function formatToTime(timestamp) {
|
|
3
|
+
const date = new Date(timestamp);
|
|
4
|
+
let hours = date.getHours();
|
|
5
|
+
const minutes = date.getMinutes();
|
|
6
|
+
const ampm = hours >= 12 ? "pm" : "am";
|
|
7
|
+
hours = hours % 12;
|
|
8
|
+
hours = hours ? hours : 12; // 0 → 12
|
|
9
|
+
|
|
10
|
+
const mins = minutes < 10 ? `0${minutes}` : minutes;
|
|
11
|
+
return `${hours}:${mins} ${ampm}`;
|
|
12
|
+
}
|
|
13
|
+
export let FeedbackAction = /*#__PURE__*/function (FeedbackAction) {
|
|
14
|
+
FeedbackAction["LIKE"] = "1";
|
|
15
|
+
FeedbackAction["DISLIKE"] = "2";
|
|
16
|
+
FeedbackAction["UNSET"] = "0";
|
|
17
|
+
return FeedbackAction;
|
|
18
|
+
}({});
|
|
19
|
+
export const fetchConversationId = async _priceMode => {
|
|
20
|
+
const conversations = await Storage.getJSON("vdbchat_conversations", {});
|
|
21
|
+
if (!conversations) return null;
|
|
22
|
+
let priceMode = _priceMode;
|
|
23
|
+
if (!priceMode) {
|
|
24
|
+
const userData = await Storage.getJSON("userData", {});
|
|
25
|
+
priceMode = userData?.price_mode || "";
|
|
26
|
+
}
|
|
27
|
+
return conversations[priceMode]?.conversation_id || null;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Storage","formatToTime","timestamp","date","Date","hours","getHours","minutes","getMinutes","ampm","mins","FeedbackAction","fetchConversationId","_priceMode","conversations","getJSON","priceMode","userData","price_mode","conversation_id"],"sourceRoot":"../../../src","sources":["components/utils.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAEpC,OAAO,SAASC,YAAYA,CAACC,SAAiB,EAAU;EACtD,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACF,SAAS,CAAC;EAEhC,IAAIG,KAAK,GAAGF,IAAI,CAACG,QAAQ,CAAC,CAAC;EAC3B,MAAMC,OAAO,GAAGJ,IAAI,CAACK,UAAU,CAAC,CAAC;EACjC,MAAMC,IAAI,GAAGJ,KAAK,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI;EAEtCA,KAAK,GAAGA,KAAK,GAAG,EAAE;EAClBA,KAAK,GAAGA,KAAK,GAAGA,KAAK,GAAG,EAAE,CAAC,CAAC;;EAE5B,MAAMK,IAAI,GAAGH,OAAO,GAAG,EAAE,GAAG,IAAIA,OAAO,EAAE,GAAGA,OAAO;EAEnD,OAAO,GAAGF,KAAK,IAAIK,IAAI,IAAID,IAAI,EAAE;AACnC;AAEA,WAAYE,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAM1B,OAAO,MAAMC,mBAAmB,GAAG,MACjCC,UAAkB,IACS;EAC3B,MAAMC,aAAa,GAAG,MAAMd,OAAO,CAACe,OAAO,CACzC,uBAAuB,EACvB,CAAC,CACH,CAAC;EACD,IAAI,CAACD,aAAa,EAAE,OAAO,IAAI;EAE/B,IAAIE,SAAS,GAAGH,UAAU;EAC1B,IAAI,CAACG,SAAS,EAAE;IACd,MAAMC,QAAQ,GAAG,MAAMjB,OAAO,CAACe,OAAO,CACpC,UAAU,EACV,CAAC,CACH,CAAC;IACDC,SAAS,GAAGC,QAAQ,EAAEC,UAAU,IAAI,EAAE;EACxC;EAEA,OAAOJ,aAAa,CAACE,SAAS,CAAC,EAAEG,eAAe,IAAI,IAAI;AAC1D,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Main entry for package consumers
|
|
2
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './theme';
|
|
5
|
+
export { normaliseMessages } from './api';
|
|
6
|
+
export { initStorage, isStorageInitialized, Storage } from './storage';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ChatWidget","normaliseMessages","initStorage","isStorageInitialized","Storage"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA,SAASA,UAAU,QAAQ,yBAAyB;AACpD,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,SAASC,iBAAiB,QAAQ,OAAO;AACzC,SAASC,WAAW,EAAEC,oBAAoB,EAAEC,OAAO,QAAQ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// React Native entry point - re-export everything from main index
|
|
2
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './theme';
|
|
5
|
+
export { normaliseMessages } from './api';
|
|
6
|
+
export { initStorage, isStorageInitialized, Storage } from './storage';
|
|
7
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ChatWidget","normaliseMessages","initStorage","isStorageInitialized","Storage"],"sourceRoot":"../../src","sources":["index.native.tsx"],"mappings":"AAAA;AACA,SAASA,UAAU,QAAQ,yBAAyB;AACpD,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,SAASC,iBAAiB,QAAQ,OAAO;AACzC,SAASC,WAAW,EAAEC,oBAAoB,EAAEC,OAAO,QAAQ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { View, StyleSheet } from "react-native";
|
|
4
|
+
import { ChatWidget } from "./components/ChatWidget";
|
|
5
|
+
export function renderChatApp(domElement, apiUrl, theme, onClose, onClearChat) {
|
|
6
|
+
const root = createRoot(domElement);
|
|
7
|
+
root.render(/*#__PURE__*/React.createElement(View, {
|
|
8
|
+
style: styles.root
|
|
9
|
+
}, /*#__PURE__*/React.createElement(ChatWidget, {
|
|
10
|
+
apiUrl: apiUrl,
|
|
11
|
+
theme: theme,
|
|
12
|
+
onClose: onClose,
|
|
13
|
+
onClearChat: onClearChat
|
|
14
|
+
})));
|
|
15
|
+
}
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
root: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
height: "100%",
|
|
20
|
+
width: "100%"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createRoot","View","StyleSheet","ChatWidget","renderChatApp","domElement","apiUrl","theme","onClose","onClearChat","root","render","createElement","style","styles","create","flex","height","width"],"sourceRoot":"../../src","sources":["index.web.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,UAAU,QAAQ,yBAAyB;AAGpD,OAAO,SAASC,aAAaA,CAC3BC,UAAuB,EACvBC,MAAc,EACdC,KAA0B,EAC1BC,OAAoB,EACpBC,WAAwB,EACxB;EACA,MAAMC,IAAI,GAAGV,UAAU,CAACK,UAAU,CAAC;EACnCK,IAAI,CAACC,MAAM,cACTZ,KAAA,CAAAa,aAAA,CAACX,IAAI;IAACY,KAAK,EAAEC,MAAM,CAACJ;EAAK,gBACvBX,KAAA,CAAAa,aAAA,CAACT,UAAU;IACTG,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBC,WAAW,EAAEA;EAAY,CAC1B,CACG,CACR,CAAC;AACH;AAEA,MAAMK,MAAM,GAAGZ,UAAU,CAACa,MAAM,CAAC;EAC/BL,IAAI,EAAE;IACJM,IAAI,EAAE,CAAC;IACPC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
// Storage interface that works across platforms
|
|
4
|
+
|
|
5
|
+
// Helper to safely get localStorage (only available on web)
|
|
6
|
+
function getLocalStorage() {
|
|
7
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
8
|
+
return window.localStorage;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Web storage implementation using localStorage (lazy access)
|
|
14
|
+
const webStorage = {
|
|
15
|
+
getItem: async key => {
|
|
16
|
+
try {
|
|
17
|
+
const storage = getLocalStorage();
|
|
18
|
+
return storage ? storage.getItem(key) : null;
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setItem: async (key, value) => {
|
|
24
|
+
try {
|
|
25
|
+
const storage = getLocalStorage();
|
|
26
|
+
if (storage) {
|
|
27
|
+
storage.setItem(key, value);
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
// ignore
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
removeItem: async key => {
|
|
34
|
+
try {
|
|
35
|
+
const storage = getLocalStorage();
|
|
36
|
+
if (storage) {
|
|
37
|
+
storage.removeItem(key);
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
// ignore
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Native storage - will be set by the app
|
|
46
|
+
let nativeStorage = null;
|
|
47
|
+
let hasWarnedAboutStorage = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initialize storage with AsyncStorage for React Native.
|
|
51
|
+
* Call this once at app startup before using ChatWidget.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
55
|
+
* import { initStorage } from 'vdb-ai-chat';
|
|
56
|
+
* initStorage(AsyncStorage);
|
|
57
|
+
*/
|
|
58
|
+
export function initStorage(asyncStorage) {
|
|
59
|
+
nativeStorage = asyncStorage;
|
|
60
|
+
hasWarnedAboutStorage = false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check if storage is properly initialized for the current platform
|
|
65
|
+
*/
|
|
66
|
+
export function isStorageInitialized() {
|
|
67
|
+
if (Platform.OS === 'web') {
|
|
68
|
+
return getLocalStorage() !== null;
|
|
69
|
+
}
|
|
70
|
+
return nativeStorage !== null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// No-op storage for when native storage isn't initialized
|
|
74
|
+
const noopStorage = {
|
|
75
|
+
getItem: async () => null,
|
|
76
|
+
setItem: async () => {},
|
|
77
|
+
removeItem: async () => {}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Get the appropriate storage based on platform
|
|
81
|
+
function getStorage() {
|
|
82
|
+
if (Platform.OS === 'web') {
|
|
83
|
+
return webStorage;
|
|
84
|
+
}
|
|
85
|
+
if (!nativeStorage) {
|
|
86
|
+
// Only warn once to avoid console spam
|
|
87
|
+
if (!hasWarnedAboutStorage) {
|
|
88
|
+
console.warn('[vdb-ai-chat] AsyncStorage not initialized. Call initStorage(AsyncStorage) at app startup.');
|
|
89
|
+
hasWarnedAboutStorage = true;
|
|
90
|
+
}
|
|
91
|
+
return noopStorage;
|
|
92
|
+
}
|
|
93
|
+
return nativeStorage;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Exported storage methods
|
|
97
|
+
export const Storage = {
|
|
98
|
+
getItem: async key => {
|
|
99
|
+
return getStorage().getItem(key);
|
|
100
|
+
},
|
|
101
|
+
setItem: async (key, value) => {
|
|
102
|
+
return getStorage().setItem(key, value);
|
|
103
|
+
},
|
|
104
|
+
removeItem: async key => {
|
|
105
|
+
return getStorage().removeItem(key);
|
|
106
|
+
},
|
|
107
|
+
// Convenience method to get and parse JSON
|
|
108
|
+
getJSON: async (key, defaultValue = null) => {
|
|
109
|
+
try {
|
|
110
|
+
const value = await getStorage().getItem(key);
|
|
111
|
+
if (value) {
|
|
112
|
+
return JSON.parse(value);
|
|
113
|
+
}
|
|
114
|
+
return defaultValue;
|
|
115
|
+
} catch {
|
|
116
|
+
return defaultValue;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
// Convenience method to stringify and set JSON
|
|
120
|
+
setJSON: async (key, value) => {
|
|
121
|
+
try {
|
|
122
|
+
await getStorage().setItem(key, JSON.stringify(value));
|
|
123
|
+
} catch {
|
|
124
|
+
// ignore
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
export default Storage;
|
|
129
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","getLocalStorage","window","localStorage","webStorage","getItem","key","storage","setItem","value","removeItem","nativeStorage","hasWarnedAboutStorage","initStorage","asyncStorage","isStorageInitialized","OS","noopStorage","getStorage","console","warn","Storage","getJSON","defaultValue","JSON","parse","setJSON","stringify"],"sourceRoot":"../../src","sources":["storage.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;;AAOA;AACA,SAASC,eAAeA,CAAA,EAAmB;EACzC,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,EAAE;IACxD,OAAOD,MAAM,CAACC,YAAY;EAC5B;EACA,OAAO,IAAI;AACb;;AAEA;AACA,MAAMC,UAA4B,GAAG;EACnCC,OAAO,EAAE,MAAOC,GAAW,IAAK;IAC9B,IAAI;MACF,MAAMC,OAAO,GAAGN,eAAe,CAAC,CAAC;MACjC,OAAOM,OAAO,GAAGA,OAAO,CAACF,OAAO,CAACC,GAAG,CAAC,GAAG,IAAI;IAC9C,CAAC,CAAC,MAAM;MACN,OAA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const defaultTheme = {
|
|
2
|
+
primaryColor: "#0b93f6",
|
|
3
|
+
backgroundColor: "#ffffff",
|
|
4
|
+
inputColor: "#FFF",
|
|
5
|
+
inputBackgroundColor: "#f5f5f5",
|
|
6
|
+
inputBorderRadius: 8,
|
|
7
|
+
inputTextColor: "#000000",
|
|
8
|
+
userBubbleColor: "#804195",
|
|
9
|
+
userTextColor: "#ffffff",
|
|
10
|
+
botBubbleColor: "#e5e5ea",
|
|
11
|
+
botTextColor: "#000000",
|
|
12
|
+
borderRadius: 18,
|
|
13
|
+
fontFamily: undefined,
|
|
14
|
+
fontSize: 16
|
|
15
|
+
};
|
|
16
|
+
export function mergeTheme(overrides) {
|
|
17
|
+
return {
|
|
18
|
+
...defaultTheme,
|
|
19
|
+
...(overrides || {})
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultTheme","primaryColor","backgroundColor","inputColor","inputBackgroundColor","inputBorderRadius","inputTextColor","userBubbleColor","userTextColor","botBubbleColor","botTextColor","borderRadius","fontFamily","undefined","fontSize","mergeTheme","overrides"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":"AAEA,OAAO,MAAMA,YAAuB,GAAG;EACrCC,YAAY,EAAE,SAAS;EACvBC,eAAe,EAAE,SAAS;EAC1BC,UAAU,EAAE,MAAM;EAClBC,oBAAoB,EAAE,SAAS;EAC/BC,iBAAiB,EAAE,CAAC;EACpBC,cAAc,EAAE,SAAS;EACzBC,eAAe,EAAE,SAAS;EAC1BC,aAAa,EAAE,SAAS;EACxBC,cAAc,EAAE,SAAS;EACzBC,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE,EAAE;EAChBC,UAAU,EAAEC,SAAS;EACrBC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,UAAUA,CAACC,SAA8B,EAAa;EACpE,OAAO;IAAE,GAAGhB,YAAY;IAAE,IAAIgB,SAAS,IAAI,CAAC,CAAC;EAAE,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FeedbackAction } from "./components/utils";
|
|
2
|
+
import type { ChatMessage } from "./types";
|
|
3
|
+
export type ChatApiParams = Record<string, any>;
|
|
4
|
+
export declare function normaliseMessages(raw: any): ChatMessage[];
|
|
5
|
+
export declare function fetchInitialMessages(apiUrl: string, _params?: ChatApiParams, priceMode?: any): Promise<any>;
|
|
6
|
+
export declare function sendUserMessage(apiUrl: string, userMessage: string, _params: ChatApiParams, _history: ChatMessage[], priceMode: any): Promise<any>;
|
|
7
|
+
export declare function clearChatHistory(apiUrl: string, priceMode: any): Promise<void>;
|
|
8
|
+
export declare function getProducts(params: ChatApiParams): Promise<any>;
|
|
9
|
+
export declare const handleFeedbackActionApi: (action: FeedbackAction, conversation_id: string, message_id: string) => Promise<Response>;
|
|
10
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAwBhD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,EAAE,CAkBzD;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,EACvB,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,GAAG,CAAC,CAkCd;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,GAAG,GACb,OAAO,CAAC,GAAG,CAAC,CAsCd;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBpF;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAuBrE;AAED,eAAO,MAAM,uBAAuB,GAClC,QAAQ,cAAc,EACtB,iBAAiB,MAAM,EACvB,YAAY,MAAM,sBAanB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatHeader.d.ts","sourceRoot":"","sources":["../../../src/components/ChatHeader.tsx"],"names":[],"mappings":"AAiCA,QAAA,MAAM,UAAU,GAAI,2BAGjB;IACD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,4CAwBA,CAAC;AAkDF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextInput } from "react-native";
|
|
3
|
+
import type { ChatTheme } from "../types";
|
|
4
|
+
interface Props {
|
|
5
|
+
value: string;
|
|
6
|
+
onChangeText: (t: string) => void;
|
|
7
|
+
onSend: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
theme: ChatTheme;
|
|
11
|
+
inputRef?: React.RefObject<TextInput>;
|
|
12
|
+
}
|
|
13
|
+
export declare const ChatInput: React.FC<Props>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ChatInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/components/ChatInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,SAAS,EAMV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAa1C,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;CACvC;AAsBD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2CrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAe,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgB5E,eAAO,MAAM,UAAU,uFAqmBtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ChatMessage, ChatTheme } from "../types";
|
|
3
|
+
import { FeedbackAction } from "./utils";
|
|
4
|
+
interface Props {
|
|
5
|
+
message: ChatMessage;
|
|
6
|
+
theme: ChatTheme;
|
|
7
|
+
conversationId: string | null;
|
|
8
|
+
handleFeedbackAction: (action: FeedbackAction, conversation_id: string, message_id: string) => void;
|
|
9
|
+
onReloadResults?: (message: ChatMessage) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const MessageBubble: React.NamedExoticComponent<Props>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=MessageBubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AAavD,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oBAAoB,EAAE,CACpB,MAAM,EAAE,cAAc,EACtB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,KACf,IAAI,CAAC;IACV,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAClD;AAkHD,eAAO,MAAM,aAAa,mCAA+B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ProductsListProps {
|
|
3
|
+
data: any;
|
|
4
|
+
onViewAll?: () => void;
|
|
5
|
+
onItemPress?: (item: any) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const ProductsList: React.NamedExoticComponent<ProductsListProps>;
|
|
8
|
+
export default ProductsList;
|
|
9
|
+
//# sourceMappingURL=ProductsList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductsList.d.ts","sourceRoot":"","sources":["../../../src/components/ProductsList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAe,MAAM,OAAO,CAAC;AAapC,UAAU,iBAAiB;IACzB,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC;AAoID,QAAA,MAAM,YAAY,+CAA8B,CAAC;AACjD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface SuggestionsRowProps {
|
|
3
|
+
suggestions: string[];
|
|
4
|
+
onSelect: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const SuggestionsRow: React.NamedExoticComponent<SuggestionsRowProps>;
|
|
7
|
+
export default SuggestionsRow;
|
|
8
|
+
//# sourceMappingURL=SuggestionsRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuggestionsRow.d.ts","sourceRoot":"","sources":["../../../src/components/SuggestionsRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AASpC,UAAU,mBAAmB;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AA2DD,QAAA,MAAM,cAAc,iDAAgC,CAAC;AACrD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function formatToTime(timestamp: number): string;
|
|
2
|
+
export declare enum FeedbackAction {
|
|
3
|
+
LIKE = "1",
|
|
4
|
+
DISLIKE = "2",
|
|
5
|
+
UNSET = "0"
|
|
6
|
+
}
|
|
7
|
+
export declare const fetchConversationId: (_priceMode: string) => Promise<string | null>;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAatD;AAED,oBAAY,cAAc;IACxB,IAAI,MAAM;IACV,OAAO,MAAM;IACb,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,mBAAmB,GAC9B,YAAY,MAAM,KACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAiBvB,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './theme';
|
|
4
|
+
export { normaliseMessages } from './api';
|
|
5
|
+
export { initStorage, isStorageInitialized, Storage } from './storage';
|
|
6
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../src/index.web.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,aAAa,CAC3B,UAAU,EAAE,WAAW,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,EACpB,WAAW,CAAC,EAAE,MAAM,IAAI,QAazB"}
|