@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
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const useConversations = require("./useConversations-
|
|
3
|
+
const useConversations = require("./useConversations-CJEaVqch.cjs");
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
function GuideAIScreen({
|
package/dist/index.d.ts
CHANGED
|
@@ -1195,6 +1195,11 @@ type BoardItem = {
|
|
|
1195
1195
|
art: string;
|
|
1196
1196
|
at: Box;
|
|
1197
1197
|
tone: Tone;
|
|
1198
|
+
} | {
|
|
1199
|
+
kind: 'photo';
|
|
1200
|
+
id?: string;
|
|
1201
|
+
photo: string;
|
|
1202
|
+
at: Box;
|
|
1198
1203
|
} | {
|
|
1199
1204
|
kind: 'text';
|
|
1200
1205
|
id?: string;
|
|
@@ -1227,6 +1232,36 @@ type BoardItem = {
|
|
|
1227
1232
|
} | {
|
|
1228
1233
|
kind: 'erase';
|
|
1229
1234
|
erase: string;
|
|
1235
|
+
} | MotionItem;
|
|
1236
|
+
/** Something already drawn, moving: each names its target by id. */
|
|
1237
|
+
type MotionItem =
|
|
1238
|
+
/** Slides so its centre passes through each spot. */
|
|
1239
|
+
{
|
|
1240
|
+
kind: 'move';
|
|
1241
|
+
move: string;
|
|
1242
|
+
path: Point[];
|
|
1243
|
+
}
|
|
1244
|
+
/** Dashes run along a drawn line. */
|
|
1245
|
+
| {
|
|
1246
|
+
kind: 'flow';
|
|
1247
|
+
flow: string;
|
|
1248
|
+
}
|
|
1249
|
+
/** Spins about its centre, in degrees (clockwise is +). */
|
|
1250
|
+
| {
|
|
1251
|
+
kind: 'turn';
|
|
1252
|
+
turn: string;
|
|
1253
|
+
by: number;
|
|
1254
|
+
}
|
|
1255
|
+
/** Swells once and settles. */
|
|
1256
|
+
| {
|
|
1257
|
+
kind: 'pulse';
|
|
1258
|
+
pulse: string;
|
|
1259
|
+
}
|
|
1260
|
+
/** Handwriting whose number counts to *value*. */
|
|
1261
|
+
| {
|
|
1262
|
+
kind: 'count';
|
|
1263
|
+
count: string;
|
|
1264
|
+
value: string;
|
|
1230
1265
|
};
|
|
1231
1266
|
interface BoardStep {
|
|
1232
1267
|
say: string;
|
|
@@ -1239,6 +1274,13 @@ interface ArtInk {
|
|
|
1239
1274
|
transform: string;
|
|
1240
1275
|
contours: string[];
|
|
1241
1276
|
}
|
|
1277
|
+
/** A real picture: our re-hosted copy, its shape, and the site it came from. */
|
|
1278
|
+
interface Photo {
|
|
1279
|
+
url: string;
|
|
1280
|
+
w: number;
|
|
1281
|
+
h: number;
|
|
1282
|
+
credit?: string;
|
|
1283
|
+
}
|
|
1242
1284
|
interface BoardScene {
|
|
1243
1285
|
/** 3: the even 160 x 100 grid. Absent (a host's board): 0-100 both ways. */
|
|
1244
1286
|
v?: 2 | 3;
|
|
@@ -1250,6 +1292,8 @@ interface BoardScene {
|
|
|
1250
1292
|
art: Record<string, {
|
|
1251
1293
|
icon: string;
|
|
1252
1294
|
} | ArtInk>;
|
|
1295
|
+
/** Real pictures by description. Absent on boards built before photos. */
|
|
1296
|
+
photos?: Record<string, Photo>;
|
|
1253
1297
|
}
|
|
1254
1298
|
|
|
1255
1299
|
type WhiteboardStatus = 'closed' | 'loading' | 'playing' | 'error';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as useGuideAIRuntime, S as ScreenRegistry, R as RegistryContext, a as useScreenRegistry, L as LIMITS } from "./useConversations-
|
|
2
|
-
import { G, b, c, d, e } from "./useConversations-
|
|
1
|
+
import { u as useGuideAIRuntime, S as ScreenRegistry, R as RegistryContext, a as useScreenRegistry, L as LIMITS } from "./useConversations-SbhtYN_R.js";
|
|
2
|
+
import { G, b, c, d, e } from "./useConversations-SbhtYN_R.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo, useEffect, useRef } from "react";
|
|
5
5
|
function GuideAIScreen({
|
package/dist/ui.cjs
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactNative = require("react-native");
|
|
6
|
-
const GuideAIChat = require("./GuideAIChat-
|
|
7
|
-
const useConversations = require("./useConversations-
|
|
6
|
+
const GuideAIChat = require("./GuideAIChat-W8KQ4Y6i.cjs");
|
|
7
|
+
const useConversations = require("./useConversations-CJEaVqch.cjs");
|
|
8
8
|
const POLL_INTERVAL_MS = 3e3;
|
|
9
9
|
const CONVERSATION_KEY = "guideai_support_conversation";
|
|
10
10
|
function useStoredConversation() {
|
package/dist/ui.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback, useMemo, useContext, createContext } from "react";
|
|
3
3
|
import { Platform, StatusBar, KeyboardAvoidingView, View, Text, Pressable, ScrollView, TextInput, ActivityIndicator, FlatList, StyleSheet, Dimensions, Animated, PanResponder, Modal, Easing } from "react-native";
|
|
4
|
-
import { r as resolveTheme, G as GuideAIChat } from "./GuideAIChat-
|
|
5
|
-
import { D, a, b, c, d, M, e, l } from "./GuideAIChat-
|
|
6
|
-
import { r as requireConfigured, E as EP, d as useOnboarding } from "./useConversations-
|
|
4
|
+
import { r as resolveTheme, G as GuideAIChat } from "./GuideAIChat-Ba6n1ePs.js";
|
|
5
|
+
import { D, a, b, c, d, M, e, l } from "./GuideAIChat-Ba6n1ePs.js";
|
|
6
|
+
import { r as requireConfigured, E as EP, d as useOnboarding } from "./useConversations-SbhtYN_R.js";
|
|
7
7
|
const POLL_INTERVAL_MS = 3e3;
|
|
8
8
|
const CONVERSATION_KEY = "guideai_support_conversation";
|
|
9
9
|
function useStoredConversation() {
|
|
@@ -3536,8 +3536,9 @@ function reset() {
|
|
|
3536
3536
|
const GuideAI = { configure, identify, setUserProfile, setToolContext, setFollowUps, isConfigured, reset };
|
|
3537
3537
|
const LIMITS = {
|
|
3538
3538
|
steps: 12,
|
|
3539
|
-
|
|
3540
|
-
|
|
3539
|
+
// A label round a photo arrives as two items: its words and its arrow.
|
|
3540
|
+
itemsPerStep: 16,
|
|
3541
|
+
items: 96,
|
|
3541
3542
|
say: 300,
|
|
3542
3543
|
text: 60,
|
|
3543
3544
|
art: 80,
|
|
@@ -3580,6 +3581,7 @@ const ID = /^[A-Za-z0-9_-]{1,24}$/;
|
|
|
3580
3581
|
const SIZES = ["s", "m", "l"];
|
|
3581
3582
|
const TONES = ["ink", "blue", "red", "green"];
|
|
3582
3583
|
const PATH_DATA = /^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/;
|
|
3584
|
+
const PHOTO_URL = /^https:\/\/res\.cloudinary\.com\/[A-Za-z0-9_-]+\/image\/upload\/[^\s"'<>\\]+$/;
|
|
3583
3585
|
const flat = (value, max) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, max) : "";
|
|
3584
3586
|
const clamp = (n, top = BOARD_H) => Math.round(Math.min(top, Math.max(0, n)) * 10) / 10;
|
|
3585
3587
|
function num(value) {
|
|
@@ -3611,7 +3613,7 @@ function item(raw) {
|
|
|
3611
3613
|
var _a;
|
|
3612
3614
|
if (!raw || typeof raw !== "object") return null;
|
|
3613
3615
|
const r = raw;
|
|
3614
|
-
const kinds = ["art", "text", "ink", "rows", "mark", "erase", "point"].filter((k) => r[k] !== void 0 && r[k] !== null && r[k] !== "");
|
|
3616
|
+
const kinds = ["art", "photo", "text", "ink", "rows", "mark", "erase", "point"].filter((k) => r[k] !== void 0 && r[k] !== null && r[k] !== "");
|
|
3615
3617
|
if (kinds.length !== 1) return null;
|
|
3616
3618
|
switch (kinds[0]) {
|
|
3617
3619
|
case "art": {
|
|
@@ -3619,6 +3621,11 @@ function item(raw) {
|
|
|
3619
3621
|
const art = flat(r.art, LIMITS.art);
|
|
3620
3622
|
return at && art ? { kind: "art", id: id(r.id), art, at, tone: tone(r.tone) } : null;
|
|
3621
3623
|
}
|
|
3624
|
+
case "photo": {
|
|
3625
|
+
const at = box(r.at);
|
|
3626
|
+
const photo2 = flat(r.photo, LIMITS.art);
|
|
3627
|
+
return at && photo2 ? { kind: "photo", id: id(r.id), photo: photo2, at } : null;
|
|
3628
|
+
}
|
|
3622
3629
|
case "text": {
|
|
3623
3630
|
const at = point(Array.isArray(r.at) ? r.at.slice(0, 2) : null);
|
|
3624
3631
|
const text = flat(r.text, LIMITS.text);
|
|
@@ -3682,6 +3689,15 @@ function artInk(raw) {
|
|
|
3682
3689
|
const transform = typeof r.transform === "string" && /^[a-z()\d.,\s-]*$/i.test(r.transform) ? r.transform : "";
|
|
3683
3690
|
return contours.length ? { view_box: viewBox, transform, contours } : null;
|
|
3684
3691
|
}
|
|
3692
|
+
function photo(raw) {
|
|
3693
|
+
if (!raw || typeof raw !== "object") return null;
|
|
3694
|
+
const r = raw;
|
|
3695
|
+
const w = num(r.w);
|
|
3696
|
+
const h = num(r.h);
|
|
3697
|
+
if (typeof r.url !== "string" || r.url.length > 600 || !PHOTO_URL.test(r.url) || !w || !h || w <= 0 || h <= 0) return null;
|
|
3698
|
+
const credit = flat(r.credit, 60);
|
|
3699
|
+
return credit ? { url: r.url, w, h, credit } : { url: r.url, w, h };
|
|
3700
|
+
}
|
|
3685
3701
|
function validateScene(raw) {
|
|
3686
3702
|
if (!raw || typeof raw !== "object") throw new SceneError("A scene is an object.");
|
|
3687
3703
|
const r = raw;
|
|
@@ -3723,12 +3739,20 @@ function validateScene(raw) {
|
|
|
3723
3739
|
if (ink) art[name.slice(0, LIMITS.art)] = ink;
|
|
3724
3740
|
}
|
|
3725
3741
|
}
|
|
3742
|
+
const photos = {};
|
|
3743
|
+
if (r.photos && typeof r.photos === "object") {
|
|
3744
|
+
for (const [name, value] of Object.entries(r.photos)) {
|
|
3745
|
+
const pic = photo(value);
|
|
3746
|
+
if (pic) photos[name.slice(0, LIMITS.art)] = pic;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3726
3749
|
return {
|
|
3727
3750
|
v: 3,
|
|
3728
3751
|
title: flat(r.title, LIMITS.title) || "Explanation",
|
|
3729
3752
|
sample: r.sample === true,
|
|
3730
3753
|
steps,
|
|
3731
|
-
art
|
|
3754
|
+
art,
|
|
3755
|
+
photos
|
|
3732
3756
|
};
|
|
3733
3757
|
}
|
|
3734
3758
|
const BLOCKS_PATH = "/api/v1/chat/blocks";
|
|
@@ -3786,7 +3810,8 @@ class WhiteboardStore {
|
|
|
3786
3810
|
try {
|
|
3787
3811
|
const raw = await this.api().post(
|
|
3788
3812
|
WHITEBOARD_PATH,
|
|
3789
|
-
|
|
3813
|
+
// pictures: this board shows real photos with labelled parts.
|
|
3814
|
+
{ question: q, answer: a || void 0, language: this.language(), pictures: true },
|
|
3790
3815
|
6e4
|
|
3791
3816
|
);
|
|
3792
3817
|
if (token !== this.request) return false;
|
|
@@ -4215,4 +4240,4 @@ export {
|
|
|
4215
4240
|
requireConfigured as r,
|
|
4216
4241
|
useGuideAIRuntime as u
|
|
4217
4242
|
};
|
|
4218
|
-
//# sourceMappingURL=useConversations-
|
|
4243
|
+
//# sourceMappingURL=useConversations-B_7km_uH.js.map
|