@enhearten/knowledge-base-module 1.0.1 → 1.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataUploadModal.d.ts","sourceRoot":"","sources":["../../src/components/DataUploadModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,UAAU,oBAAoB;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,WAAW,GAAG,UAAU,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAChC;AAmCD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"DataUploadModal.d.ts","sourceRoot":"","sources":["../../src/components/DataUploadModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,UAAU,oBAAoB;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,WAAW,GAAG,UAAU,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAChC;AAmCD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+K1D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, Card, Text, XStack, YStack, Spinner, Sheet } from 'tamagui';
|
|
2
|
+
import { Button, Card, Text, XStack, YStack, Spinner, Sheet, Theme } from 'tamagui';
|
|
3
3
|
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
4
4
|
import * as DocumentPicker from 'expo-document-picker';
|
|
5
5
|
import { uploadUserData } from '../services/api';
|
|
@@ -96,39 +96,40 @@ export const DataUploadModal = ({ open, onClose, serviceName, entityId, onUpload
|
|
|
96
96
|
onClose();
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
return (React.createElement(
|
|
100
|
-
React.createElement(Sheet
|
|
101
|
-
|
|
102
|
-
React.createElement(Sheet.
|
|
103
|
-
|
|
104
|
-
React.createElement(
|
|
105
|
-
React.createElement(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
React.createElement(
|
|
109
|
-
React.createElement(
|
|
110
|
-
|
|
111
|
-
React.createElement(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
React.createElement(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
React.createElement(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
React.createElement(
|
|
128
|
-
|
|
129
|
-
React.createElement(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
React.createElement(
|
|
133
|
-
|
|
99
|
+
return (React.createElement(Theme, { name: "light" },
|
|
100
|
+
React.createElement(Sheet, { modal: true, open: open, onOpenChange: (isOpen) => !isOpen && handleClose(), snapPoints: [85], dismissOnSnapToBottom: true },
|
|
101
|
+
React.createElement(Sheet.Overlay, null),
|
|
102
|
+
React.createElement(Sheet.Frame, { padding: "$4", backgroundColor: "white" },
|
|
103
|
+
React.createElement(Sheet.Handle, null),
|
|
104
|
+
React.createElement(YStack, { space: "$4", paddingTop: "$4" },
|
|
105
|
+
React.createElement(XStack, { alignItems: "center", space: "$2" },
|
|
106
|
+
React.createElement(MaterialCommunityIcons, { name: instructions.icon, size: 28, color: serviceName === 'instagram' ? '#E4405F' : '#25D366' }),
|
|
107
|
+
React.createElement(Text, { fontSize: "$6", fontWeight: "bold" }, instructions.title)),
|
|
108
|
+
React.createElement(Card, { bordered: true, padding: "$3", backgroundColor: "$gray2" },
|
|
109
|
+
React.createElement(YStack, { space: "$2" },
|
|
110
|
+
React.createElement(Text, { fontSize: "$4", fontWeight: "600" }, "How to download your data:"),
|
|
111
|
+
instructions.steps.map((step, index) => (React.createElement(XStack, { key: index, space: "$2", alignItems: "flex-start" },
|
|
112
|
+
React.createElement(Text, { fontSize: "$3", color: "$gray11", minWidth: 20 },
|
|
113
|
+
index + 1,
|
|
114
|
+
"."),
|
|
115
|
+
React.createElement(Text, { fontSize: "$3", color: "$gray11", flex: 1 }, step)))))),
|
|
116
|
+
React.createElement(YStack, { gap: "$3" },
|
|
117
|
+
React.createElement(Button, { size: "$4", onPress: handlePickFiles, disabled: uploading, icon: React.createElement(MaterialCommunityIcons, { name: "file-upload", size: 20, color: "white" }) }, selectedFiles.length > 0
|
|
118
|
+
? `${selectedFiles.length} file(s) selected`
|
|
119
|
+
: 'Select File(s)'),
|
|
120
|
+
selectedFiles.length > 0 && (React.createElement(Card, { bordered: true, padding: "$2", backgroundColor: "$green2" },
|
|
121
|
+
React.createElement(YStack, { space: "$1" }, selectedFiles.map((file, index) => (React.createElement(XStack, { key: index, alignItems: "center", space: "$2" },
|
|
122
|
+
React.createElement(MaterialCommunityIcons, { name: "file-check", size: 16, color: "green" }),
|
|
123
|
+
React.createElement(Text, { fontSize: "$2", flex: 1, numberOfLines: 1 }, file.name),
|
|
124
|
+
React.createElement(Text, { fontSize: "$1", color: "$gray10" },
|
|
125
|
+
(file.size ? file.size / 1024 / 1024 : 0).toFixed(2),
|
|
126
|
+
" MB"))))))),
|
|
127
|
+
error && (React.createElement(Card, { bordered: true, padding: "$2", backgroundColor: "$red2", borderColor: "$red8" },
|
|
128
|
+
React.createElement(Text, { color: "$red10", fontSize: "$3" }, error))),
|
|
129
|
+
uploadProgress && (React.createElement(XStack, { alignItems: "center", space: "$2" },
|
|
130
|
+
React.createElement(Spinner, { size: "small" }),
|
|
131
|
+
React.createElement(Text, { fontSize: "$3", color: "$gray10" }, uploadProgress))),
|
|
132
|
+
React.createElement(XStack, { gap: "$3", justifyContent: "flex-end" },
|
|
133
|
+
React.createElement(Button, { size: "$4", variant: "outlined", onPress: handleClose, disabled: uploading }, "Cancel"),
|
|
134
|
+
React.createElement(Button, { size: "$4", themeInverse: true, onPress: handleUpload, disabled: uploading || selectedFiles.length === 0, icon: uploading ? React.createElement(Spinner, { size: "small", color: "white" }) : undefined }, uploading ? 'Uploading...' : 'Upload Data'))))))));
|
|
134
135
|
};
|
package/dist/services/api.js
CHANGED
|
@@ -148,7 +148,7 @@ export const searchPerson = async (options) => {
|
|
|
148
148
|
const { entityId, personName, context } = options;
|
|
149
149
|
const prompt = context
|
|
150
150
|
? `Search all my connected accounts for information about ${personName}. Context: ${context}`
|
|
151
|
-
: `Search all my connected accounts for information about ${personName}. Look for
|
|
151
|
+
: `Search all my connected accounts for information about ${personName}. Look for any relevant information that could help me understand my relationship with this person, their interests, and recent interactions.`;
|
|
152
152
|
return executeAction(prompt, entityId);
|
|
153
153
|
};
|
|
154
154
|
/**
|
|
@@ -158,7 +158,7 @@ export const searchPerson = async (options) => {
|
|
|
158
158
|
*/
|
|
159
159
|
export const getGiftIdeas = async (options) => {
|
|
160
160
|
const { entityId, personName, occasion, budget } = options;
|
|
161
|
-
let prompt = `Based on my
|
|
161
|
+
let prompt = `Based on my connected accounts, suggest gift ideas for ${personName}.`;
|
|
162
162
|
if (occasion)
|
|
163
163
|
prompt += ` The occasion is: ${occasion}.`;
|
|
164
164
|
if (budget)
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, Card, Text, XStack, YStack, Spinner, Sheet } from 'tamagui';
|
|
2
|
+
import { Button, Card, Text, XStack, YStack, Spinner, Sheet, Theme } from 'tamagui';
|
|
3
3
|
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
4
4
|
import * as DocumentPicker from 'expo-document-picker';
|
|
5
5
|
import { uploadUserData } from '../services/api';
|
|
@@ -120,102 +120,104 @@ export const DataUploadModal: React.FC<DataUploadModalProps> = ({
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
return (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<Sheet.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<Card bordered padding="$3" backgroundColor="$gray2">
|
|
145
|
-
<YStack space="$2">
|
|
146
|
-
<Text fontSize="$4" fontWeight="600">How to download your data:</Text>
|
|
147
|
-
{instructions.steps.map((step, index) => (
|
|
148
|
-
<XStack key={index} space="$2" alignItems="flex-start">
|
|
149
|
-
<Text fontSize="$3" color="$gray11" minWidth={20}>{index + 1}.</Text>
|
|
150
|
-
<Text fontSize="$3" color="$gray11" flex={1}>{step}</Text>
|
|
151
|
-
</XStack>
|
|
152
|
-
))}
|
|
153
|
-
</YStack>
|
|
154
|
-
</Card>
|
|
155
|
-
|
|
156
|
-
<YStack gap="$3">
|
|
157
|
-
<Button
|
|
158
|
-
size="$4"
|
|
159
|
-
onPress={handlePickFiles}
|
|
160
|
-
disabled={uploading}
|
|
161
|
-
icon={<MaterialCommunityIcons name="file-upload" size={20} color="white" />}
|
|
162
|
-
>
|
|
163
|
-
{selectedFiles.length > 0
|
|
164
|
-
? `${selectedFiles.length} file(s) selected`
|
|
165
|
-
: 'Select File(s)'}
|
|
166
|
-
</Button>
|
|
167
|
-
|
|
168
|
-
{selectedFiles.length > 0 && (
|
|
169
|
-
<Card bordered padding="$2" backgroundColor="$green2">
|
|
170
|
-
<YStack space="$1">
|
|
171
|
-
{selectedFiles.map((file, index) => (
|
|
172
|
-
<XStack key={index} alignItems="center" space="$2">
|
|
173
|
-
<MaterialCommunityIcons name="file-check" size={16} color="green" />
|
|
174
|
-
<Text fontSize="$2" flex={1} numberOfLines={1}>{file.name}</Text>
|
|
175
|
-
<Text fontSize="$1" color="$gray10">
|
|
176
|
-
{(file.size ? file.size / 1024 / 1024 : 0).toFixed(2)} MB
|
|
177
|
-
</Text>
|
|
178
|
-
</XStack>
|
|
179
|
-
))}
|
|
180
|
-
</YStack>
|
|
181
|
-
</Card>
|
|
182
|
-
)}
|
|
183
|
-
|
|
184
|
-
{error && (
|
|
185
|
-
<Card bordered padding="$2" backgroundColor="$red2" borderColor="$red8">
|
|
186
|
-
<Text color="$red10" fontSize="$3">{error}</Text>
|
|
187
|
-
</Card>
|
|
188
|
-
)}
|
|
189
|
-
|
|
190
|
-
{uploadProgress && (
|
|
191
|
-
<XStack alignItems="center" space="$2">
|
|
192
|
-
<Spinner size="small" />
|
|
193
|
-
<Text fontSize="$3" color="$gray10">{uploadProgress}</Text>
|
|
194
|
-
</XStack>
|
|
195
|
-
)}
|
|
123
|
+
<Theme name="light">
|
|
124
|
+
<Sheet
|
|
125
|
+
modal
|
|
126
|
+
open={open}
|
|
127
|
+
onOpenChange={(isOpen: boolean) => !isOpen && handleClose()}
|
|
128
|
+
snapPoints={[85]}
|
|
129
|
+
dismissOnSnapToBottom
|
|
130
|
+
>
|
|
131
|
+
<Sheet.Overlay />
|
|
132
|
+
<Sheet.Frame padding="$4" backgroundColor="white">
|
|
133
|
+
<Sheet.Handle />
|
|
134
|
+
|
|
135
|
+
<YStack space="$4" paddingTop="$4">
|
|
136
|
+
<XStack alignItems="center" space="$2">
|
|
137
|
+
<MaterialCommunityIcons
|
|
138
|
+
name={instructions.icon}
|
|
139
|
+
size={28}
|
|
140
|
+
color={serviceName === 'instagram' ? '#E4405F' : '#25D366'}
|
|
141
|
+
/>
|
|
142
|
+
<Text fontSize="$6" fontWeight="bold">{instructions.title}</Text>
|
|
143
|
+
</XStack>
|
|
196
144
|
|
|
197
|
-
<
|
|
145
|
+
<Card bordered padding="$3" backgroundColor="$gray2">
|
|
146
|
+
<YStack space="$2">
|
|
147
|
+
<Text fontSize="$4" fontWeight="600">How to download your data:</Text>
|
|
148
|
+
{instructions.steps.map((step, index) => (
|
|
149
|
+
<XStack key={index} space="$2" alignItems="flex-start">
|
|
150
|
+
<Text fontSize="$3" color="$gray11" minWidth={20}>{index + 1}.</Text>
|
|
151
|
+
<Text fontSize="$3" color="$gray11" flex={1}>{step}</Text>
|
|
152
|
+
</XStack>
|
|
153
|
+
))}
|
|
154
|
+
</YStack>
|
|
155
|
+
</Card>
|
|
156
|
+
|
|
157
|
+
<YStack gap="$3">
|
|
198
158
|
<Button
|
|
199
159
|
size="$4"
|
|
200
|
-
|
|
201
|
-
onPress={handleClose}
|
|
160
|
+
onPress={handlePickFiles}
|
|
202
161
|
disabled={uploading}
|
|
162
|
+
icon={<MaterialCommunityIcons name="file-upload" size={20} color="white" />}
|
|
203
163
|
>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
size="$4"
|
|
208
|
-
themeInverse
|
|
209
|
-
onPress={handleUpload}
|
|
210
|
-
disabled={uploading || selectedFiles.length === 0}
|
|
211
|
-
icon={uploading ? <Spinner size="small" color="white" /> : undefined}
|
|
212
|
-
>
|
|
213
|
-
{uploading ? 'Uploading...' : 'Upload Data'}
|
|
164
|
+
{selectedFiles.length > 0
|
|
165
|
+
? `${selectedFiles.length} file(s) selected`
|
|
166
|
+
: 'Select File(s)'}
|
|
214
167
|
</Button>
|
|
215
|
-
|
|
168
|
+
|
|
169
|
+
{selectedFiles.length > 0 && (
|
|
170
|
+
<Card bordered padding="$2" backgroundColor="$green2">
|
|
171
|
+
<YStack space="$1">
|
|
172
|
+
{selectedFiles.map((file, index) => (
|
|
173
|
+
<XStack key={index} alignItems="center" space="$2">
|
|
174
|
+
<MaterialCommunityIcons name="file-check" size={16} color="green" />
|
|
175
|
+
<Text fontSize="$2" flex={1} numberOfLines={1}>{file.name}</Text>
|
|
176
|
+
<Text fontSize="$1" color="$gray10">
|
|
177
|
+
{(file.size ? file.size / 1024 / 1024 : 0).toFixed(2)} MB
|
|
178
|
+
</Text>
|
|
179
|
+
</XStack>
|
|
180
|
+
))}
|
|
181
|
+
</YStack>
|
|
182
|
+
</Card>
|
|
183
|
+
)}
|
|
184
|
+
|
|
185
|
+
{error && (
|
|
186
|
+
<Card bordered padding="$2" backgroundColor="$red2" borderColor="$red8">
|
|
187
|
+
<Text color="$red10" fontSize="$3">{error}</Text>
|
|
188
|
+
</Card>
|
|
189
|
+
)}
|
|
190
|
+
|
|
191
|
+
{uploadProgress && (
|
|
192
|
+
<XStack alignItems="center" space="$2">
|
|
193
|
+
<Spinner size="small" />
|
|
194
|
+
<Text fontSize="$3" color="$gray10">{uploadProgress}</Text>
|
|
195
|
+
</XStack>
|
|
196
|
+
)}
|
|
197
|
+
|
|
198
|
+
<XStack gap="$3" justifyContent="flex-end">
|
|
199
|
+
<Button
|
|
200
|
+
size="$4"
|
|
201
|
+
variant="outlined"
|
|
202
|
+
onPress={handleClose}
|
|
203
|
+
disabled={uploading}
|
|
204
|
+
>
|
|
205
|
+
Cancel
|
|
206
|
+
</Button>
|
|
207
|
+
<Button
|
|
208
|
+
size="$4"
|
|
209
|
+
themeInverse
|
|
210
|
+
onPress={handleUpload}
|
|
211
|
+
disabled={uploading || selectedFiles.length === 0}
|
|
212
|
+
icon={uploading ? <Spinner size="small" color="white" /> : undefined}
|
|
213
|
+
>
|
|
214
|
+
{uploading ? 'Uploading...' : 'Upload Data'}
|
|
215
|
+
</Button>
|
|
216
|
+
</XStack>
|
|
217
|
+
</YStack>
|
|
216
218
|
</YStack>
|
|
217
|
-
</
|
|
218
|
-
</Sheet
|
|
219
|
-
</
|
|
219
|
+
</Sheet.Frame>
|
|
220
|
+
</Sheet>
|
|
221
|
+
</Theme>
|
|
220
222
|
);
|
|
221
223
|
};
|
package/src/services/api.ts
CHANGED
|
@@ -176,7 +176,7 @@ export const searchPerson = async (options: SearchPersonOptions) => {
|
|
|
176
176
|
const { entityId, personName, context } = options;
|
|
177
177
|
const prompt = context
|
|
178
178
|
? `Search all my connected accounts for information about ${personName}. Context: ${context}`
|
|
179
|
-
: `Search all my connected accounts for information about ${personName}. Look for
|
|
179
|
+
: `Search all my connected accounts for information about ${personName}. Look for any relevant information that could help me understand my relationship with this person, their interests, and recent interactions.`;
|
|
180
180
|
return executeAction(prompt, entityId);
|
|
181
181
|
};
|
|
182
182
|
|
|
@@ -194,7 +194,7 @@ export interface GiftIdeasOptions {
|
|
|
194
194
|
*/
|
|
195
195
|
export const getGiftIdeas = async (options: GiftIdeasOptions) => {
|
|
196
196
|
const { entityId, personName, occasion, budget } = options;
|
|
197
|
-
let prompt = `Based on my
|
|
197
|
+
let prompt = `Based on my connected accounts, suggest gift ideas for ${personName}.`;
|
|
198
198
|
if (occasion) prompt += ` The occasion is: ${occasion}.`;
|
|
199
199
|
if (budget) prompt += ` Budget: ${budget}.`;
|
|
200
200
|
prompt += ` Look for their interests, hobbies, recent conversations, and anything that might hint at what they would appreciate.`;
|