@guideai/react-native 0.6.0 → 0.8.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 +1 -1
- package/dist/GuideAIChat-Ba6n1ePs.js +2795 -0
- package/dist/GuideAIChat-Ba6n1ePs.js.map +1 -0
- package/dist/{GuideAIChat-DQEa_Ff0.cjs → GuideAIChat-CxyWFl_o.cjs} +67 -12
- package/dist/GuideAIChat-CxyWFl_o.cjs.map +1 -0
- package/dist/{GuideAIChat-DLtQYk2N.js → GuideAIChat-DOC4zx-a.js} +68 -13
- package/dist/GuideAIChat-DOC4zx-a.js.map +1 -0
- package/dist/GuideAIChat-W8KQ4Y6i.cjs +2794 -0
- package/dist/GuideAIChat-W8KQ4Y6i.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +44 -0
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +2 -2
- package/dist/ui.mjs +3 -3
- package/dist/{useConversations-B4WYG2Qz.js → useConversations-B_7km_uH.js} +31 -6
- package/dist/{useConversations-B4WYG2Qz.js.map → useConversations-B_7km_uH.js.map} +1 -1
- package/dist/useConversations-CJEaVqch.cjs +4290 -0
- package/dist/useConversations-CJEaVqch.cjs.map +1 -0
- package/dist/{useConversations-C9ivx2l-.cjs → useConversations-CTbQBTz-.cjs} +31 -6
- package/dist/{useConversations-C9ivx2l-.cjs.map → useConversations-CTbQBTz-.cjs.map} +1 -1
- package/dist/useConversations-SbhtYN_R.js +4291 -0
- package/dist/useConversations-SbhtYN_R.js.map +1 -0
- package/dist/voice.cjs +2 -2
- package/dist/voice.mjs +3 -3
- package/package.json +1 -1
- package/dist/GuideAIChat-DLtQYk2N.js.map +0 -1
- package/dist/GuideAIChat-DQEa_Ff0.cjs.map +0 -1
|
@@ -3537,8 +3537,9 @@ function reset() {
|
|
|
3537
3537
|
const GuideAI = { configure, identify, setUserProfile, setToolContext, setFollowUps, isConfigured, reset };
|
|
3538
3538
|
const LIMITS = {
|
|
3539
3539
|
steps: 12,
|
|
3540
|
-
|
|
3541
|
-
|
|
3540
|
+
// A label round a photo arrives as two items: its words and its arrow.
|
|
3541
|
+
itemsPerStep: 16,
|
|
3542
|
+
items: 96,
|
|
3542
3543
|
say: 300,
|
|
3543
3544
|
text: 60,
|
|
3544
3545
|
art: 80,
|
|
@@ -3581,6 +3582,7 @@ const ID = /^[A-Za-z0-9_-]{1,24}$/;
|
|
|
3581
3582
|
const SIZES = ["s", "m", "l"];
|
|
3582
3583
|
const TONES = ["ink", "blue", "red", "green"];
|
|
3583
3584
|
const PATH_DATA = /^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/;
|
|
3585
|
+
const PHOTO_URL = /^https:\/\/res\.cloudinary\.com\/[A-Za-z0-9_-]+\/image\/upload\/[^\s"'<>\\]+$/;
|
|
3584
3586
|
const flat = (value, max) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, max) : "";
|
|
3585
3587
|
const clamp = (n, top = BOARD_H) => Math.round(Math.min(top, Math.max(0, n)) * 10) / 10;
|
|
3586
3588
|
function num(value) {
|
|
@@ -3612,7 +3614,7 @@ function item(raw) {
|
|
|
3612
3614
|
var _a;
|
|
3613
3615
|
if (!raw || typeof raw !== "object") return null;
|
|
3614
3616
|
const r = raw;
|
|
3615
|
-
const kinds = ["art", "text", "ink", "rows", "mark", "erase", "point"].filter((k) => r[k] !== void 0 && r[k] !== null && r[k] !== "");
|
|
3617
|
+
const kinds = ["art", "photo", "text", "ink", "rows", "mark", "erase", "point"].filter((k) => r[k] !== void 0 && r[k] !== null && r[k] !== "");
|
|
3616
3618
|
if (kinds.length !== 1) return null;
|
|
3617
3619
|
switch (kinds[0]) {
|
|
3618
3620
|
case "art": {
|
|
@@ -3620,6 +3622,11 @@ function item(raw) {
|
|
|
3620
3622
|
const art = flat(r.art, LIMITS.art);
|
|
3621
3623
|
return at && art ? { kind: "art", id: id(r.id), art, at, tone: tone(r.tone) } : null;
|
|
3622
3624
|
}
|
|
3625
|
+
case "photo": {
|
|
3626
|
+
const at = box(r.at);
|
|
3627
|
+
const photo2 = flat(r.photo, LIMITS.art);
|
|
3628
|
+
return at && photo2 ? { kind: "photo", id: id(r.id), photo: photo2, at } : null;
|
|
3629
|
+
}
|
|
3623
3630
|
case "text": {
|
|
3624
3631
|
const at = point(Array.isArray(r.at) ? r.at.slice(0, 2) : null);
|
|
3625
3632
|
const text = flat(r.text, LIMITS.text);
|
|
@@ -3683,6 +3690,15 @@ function artInk(raw) {
|
|
|
3683
3690
|
const transform = typeof r.transform === "string" && /^[a-z()\d.,\s-]*$/i.test(r.transform) ? r.transform : "";
|
|
3684
3691
|
return contours.length ? { view_box: viewBox, transform, contours } : null;
|
|
3685
3692
|
}
|
|
3693
|
+
function photo(raw) {
|
|
3694
|
+
if (!raw || typeof raw !== "object") return null;
|
|
3695
|
+
const r = raw;
|
|
3696
|
+
const w = num(r.w);
|
|
3697
|
+
const h = num(r.h);
|
|
3698
|
+
if (typeof r.url !== "string" || r.url.length > 600 || !PHOTO_URL.test(r.url) || !w || !h || w <= 0 || h <= 0) return null;
|
|
3699
|
+
const credit = flat(r.credit, 60);
|
|
3700
|
+
return credit ? { url: r.url, w, h, credit } : { url: r.url, w, h };
|
|
3701
|
+
}
|
|
3686
3702
|
function validateScene(raw) {
|
|
3687
3703
|
if (!raw || typeof raw !== "object") throw new SceneError("A scene is an object.");
|
|
3688
3704
|
const r = raw;
|
|
@@ -3724,12 +3740,20 @@ function validateScene(raw) {
|
|
|
3724
3740
|
if (ink) art[name.slice(0, LIMITS.art)] = ink;
|
|
3725
3741
|
}
|
|
3726
3742
|
}
|
|
3743
|
+
const photos = {};
|
|
3744
|
+
if (r.photos && typeof r.photos === "object") {
|
|
3745
|
+
for (const [name, value] of Object.entries(r.photos)) {
|
|
3746
|
+
const pic = photo(value);
|
|
3747
|
+
if (pic) photos[name.slice(0, LIMITS.art)] = pic;
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3727
3750
|
return {
|
|
3728
3751
|
v: 3,
|
|
3729
3752
|
title: flat(r.title, LIMITS.title) || "Explanation",
|
|
3730
3753
|
sample: r.sample === true,
|
|
3731
3754
|
steps,
|
|
3732
|
-
art
|
|
3755
|
+
art,
|
|
3756
|
+
photos
|
|
3733
3757
|
};
|
|
3734
3758
|
}
|
|
3735
3759
|
const BLOCKS_PATH = "/api/v1/chat/blocks";
|
|
@@ -3787,7 +3811,8 @@ class WhiteboardStore {
|
|
|
3787
3811
|
try {
|
|
3788
3812
|
const raw = await this.api().post(
|
|
3789
3813
|
WHITEBOARD_PATH,
|
|
3790
|
-
|
|
3814
|
+
// pictures: this board shows real photos with labelled parts.
|
|
3815
|
+
{ question: q, answer: a || void 0, language: this.language(), pictures: true },
|
|
3791
3816
|
6e4
|
|
3792
3817
|
);
|
|
3793
3818
|
if (token !== this.request) return false;
|
|
@@ -4214,4 +4239,4 @@ exports.useGuideAIRuntime = useGuideAIRuntime;
|
|
|
4214
4239
|
exports.useOnboarding = useOnboarding;
|
|
4215
4240
|
exports.useScreenRegistry = useScreenRegistry;
|
|
4216
4241
|
exports.useWhiteboard = useWhiteboard;
|
|
4217
|
-
//# sourceMappingURL=useConversations-
|
|
4242
|
+
//# sourceMappingURL=useConversations-CTbQBTz-.cjs.map
|