@guideai/react-native 0.6.0 → 0.7.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.
@@ -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
- itemsPerStep: 8,
3540
- items: 60,
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
- { question: q, answer: a || void 0, language: this.language() },
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-B4WYG2Qz.js.map
4243
+ //# sourceMappingURL=useConversations-B_7km_uH.js.map