@overmap-ai/core 1.0.48-activity-history.4 → 1.0.48-activity-history.5

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.
@@ -6,4 +6,4 @@ export interface ImageCardProps extends Omit<OvermapItemProps, "children" | "lef
6
6
  error?: string;
7
7
  truncateLength?: number;
8
8
  }
9
- export declare const ImageCard: import("react").MemoExoticComponent<(props: ImageCardProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export declare const ImageCard: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ImageCardProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -1,6 +1,7 @@
1
1
  import { FieldTypeIdentifier } from "../typings";
2
2
  export declare const useFieldTypeItems: (onSelect?: (type: Exclude<FieldTypeIdentifier, "section">) => void) => {
3
- content: import("react/jsx-runtime").JSX.Element;
3
+ children: string;
4
+ leftSlot: import("react/jsx-runtime").JSX.Element;
4
5
  value: "string" | "number" | "boolean" | "select" | "text" | "date" | "multi-string" | "multi-select" | "upload";
5
6
  onSelect: () => void;
6
7
  }[][];
@@ -8,7 +8,7 @@ var _a;
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useEffect, useRef, memo, useMemo, useCallback, createContext, createElement, useContext, forwardRef, Children, isValidElement, cloneElement, Fragment as Fragment$1, useLayoutEffect, useReducer, lazy, Suspense } from "react";
10
10
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
- import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, useViewportSize, Overlay, ButtonGroup, Spinner, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, Button, ButtonList, divButtonProps, DropdownItemMenu, Input, useAlertDialog } from "@overmap-ai/blocks";
11
+ import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, useViewportSize, Overlay, ButtonGroup, Spinner, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, Button, ButtonList, divButtonProps, OvermapDropdownMenu, Input, useAlertDialog } from "@overmap-ai/blocks";
12
12
  import { DepGraph } from "dependency-graph";
13
13
  import { offline as offline$1 } from "@redux-offline/redux-offline";
14
14
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
@@ -4346,10 +4346,20 @@ function runMiddleware(action) {
4346
4346
  var _a2;
4347
4347
  return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
4348
4348
  }
4349
- const discardStatuses = [400, 409, 403, 404];
4349
+ const discardStatuses = [400, 409, 403, 404, 405, 500];
4350
4350
  const statusMessages = {
4351
4351
  403: { title: "Forbidden", description: "You are not authorized to perform this action.", severity: "danger" },
4352
- 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" }
4352
+ 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" },
4353
+ 405: {
4354
+ title: "Not supported",
4355
+ description: "It's not you. It's us. Sorry for the inconvenience.",
4356
+ severity: "danger"
4357
+ },
4358
+ 500: {
4359
+ title: "Server error",
4360
+ description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
4361
+ severity: "danger"
4362
+ }
4353
4363
  };
4354
4364
  function discard(reason, action, retries = 0) {
4355
4365
  var _a2;
@@ -4530,7 +4540,8 @@ class AttachmentService extends BaseApiService {
4530
4540
  ...attachmentPayload,
4531
4541
  file: attachmentPayload.file.objectURL,
4532
4542
  file_name: attachmentPayload.file.name,
4533
- file_type: attachmentPayload.file.type
4543
+ file_type: attachmentPayload.file.type,
4544
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4534
4545
  };
4535
4546
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4536
4547
  this.client.store.dispatch(addIssueAttachment(offlineAttachment));
@@ -4564,7 +4575,8 @@ class AttachmentService extends BaseApiService {
4564
4575
  ...attachmentPayload,
4565
4576
  file: attachmentPayload.file.objectURL,
4566
4577
  file_name: attachmentPayload.file.name,
4567
- file_type: attachmentPayload.file.type
4578
+ file_type: attachmentPayload.file.type,
4579
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4568
4580
  };
4569
4581
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4570
4582
  this.client.store.dispatch(addComponentAttachment(offlineAttachment));
@@ -4598,7 +4610,8 @@ class AttachmentService extends BaseApiService {
4598
4610
  ...attachmentPayload,
4599
4611
  file: attachmentPayload.file.objectURL,
4600
4612
  file_name: attachmentPayload.file.name,
4601
- file_type: attachmentPayload.file.type
4613
+ file_type: attachmentPayload.file.type,
4614
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4602
4615
  };
4603
4616
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4604
4617
  this.client.store.dispatch(addComponentTypeAttachment(offlineAttachment));
@@ -4632,7 +4645,8 @@ class AttachmentService extends BaseApiService {
4632
4645
  ...attachmentPayload,
4633
4646
  file: attachmentPayload.file.objectURL,
4634
4647
  file_name: attachmentPayload.file.name,
4635
- file_type: attachmentPayload.file.type
4648
+ file_type: attachmentPayload.file.type,
4649
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4636
4650
  };
4637
4651
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4638
4652
  this.client.store.dispatch(addProjectAttachment(offlineAttachment));
@@ -4672,7 +4686,8 @@ class AttachmentService extends BaseApiService {
4672
4686
  file_name: file2.name,
4673
4687
  file_type: file2.type,
4674
4688
  issue: issueId,
4675
- file_sha1: hash
4689
+ file_sha1: hash,
4690
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4676
4691
  });
4677
4692
  return this.addIssueAttachment(attachment);
4678
4693
  };
@@ -4691,7 +4706,8 @@ class AttachmentService extends BaseApiService {
4691
4706
  file_name: file2.name,
4692
4707
  file_type: file2.type,
4693
4708
  component: componentId,
4694
- file_sha1: hash
4709
+ file_sha1: hash,
4710
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4695
4711
  });
4696
4712
  return this.addComponentAttachment(attachment);
4697
4713
  };
@@ -4710,7 +4726,8 @@ class AttachmentService extends BaseApiService {
4710
4726
  file_name: file2.name,
4711
4727
  file_type: file2.type,
4712
4728
  component_type: componentTypeId,
4713
- file_sha1: hash
4729
+ file_sha1: hash,
4730
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4714
4731
  });
4715
4732
  return this.addComponentTypeAttachment(attachment);
4716
4733
  };
@@ -4729,7 +4746,8 @@ class AttachmentService extends BaseApiService {
4729
4746
  file_name: file2.name,
4730
4747
  file_type: file2.type,
4731
4748
  project: projectId,
4732
- file_sha1: hash
4749
+ file_sha1: hash,
4750
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
4733
4751
  });
4734
4752
  return this.addProjectAttachment(attachment);
4735
4753
  };
@@ -7710,7 +7728,7 @@ class AgentService extends BaseApiService {
7710
7728
  * @param request The message to prompt the agent with.
7711
7729
  * @param conversationId If continuing an existing message, the UUID of that conversation.
7712
7730
  */
7713
- prompt(request2, conversationId) {
7731
+ async prompt(request2, conversationId) {
7714
7732
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7715
7733
  return this.enqueueRequest({
7716
7734
  description: "Prompt agent",
@@ -7725,6 +7743,16 @@ class AgentService extends BaseApiService {
7725
7743
  queryParams: conversationId ? { conversation_id: conversationId } : {}
7726
7744
  });
7727
7745
  }
7746
+ async rate(responseId, rating) {
7747
+ return this.enqueueRequest({
7748
+ description: "Rate agent response",
7749
+ method: HttpMethod.PUT,
7750
+ url: `/agents/responses/${responseId}/rate/`,
7751
+ payload: { rating },
7752
+ blockers: ["rate"],
7753
+ blocks: ["rate"]
7754
+ });
7755
+ }
7728
7756
  }
7729
7757
  class OvermapSDK {
7730
7758
  constructor(apiUrl, store) {
@@ -13214,52 +13242,54 @@ const styles$4 = {
13214
13242
  Footer,
13215
13243
  Loading
13216
13244
  };
13217
- const ImageCard = memo((props) => {
13218
- const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13219
- const fileCardRef = useRef(null);
13220
- const imageInsetRef = useRef(null);
13221
- const fileCardSize = useSize(fileCardRef);
13222
- useLayoutEffect(() => {
13223
- if (!imageInsetRef.current || !fileCardSize)
13224
- return;
13225
- imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13226
- }, [fileCardSize]);
13227
- const fileName2 = useMemo(() => {
13228
- if (!file)
13229
- return;
13230
- return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13231
- }, [file, truncateLength]);
13232
- return /* @__PURE__ */ jsxs(
13233
- Flex,
13234
- {
13235
- className: classNames$1(className, styles$4.ImageCard),
13236
- width: "100%",
13237
- direction: "column",
13238
- position: "relative",
13239
- height: "max-content",
13240
- gap: "0",
13241
- ...rest,
13242
- children: [
13243
- !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13244
- /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13245
- /* @__PURE__ */ jsx(
13246
- OvermapItem,
13247
- {
13248
- className: classNames$1(styles$4.Footer, {
13249
- [styles$4.Loading]: !file
13250
- }),
13251
- size,
13252
- ref: fileCardRef,
13253
- leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13254
- rightSlot,
13255
- children: error2 ?? fileName2
13256
- }
13257
- )
13258
- ]
13259
- }
13260
- );
13261
- });
13262
- ImageCard.displayName = "ImageCard";
13245
+ const ImageCard = memo(
13246
+ forwardRef((props, forwardedRef) => {
13247
+ const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13248
+ const fileCardRef = useRef(null);
13249
+ const imageInsetRef = useRef(null);
13250
+ const fileCardSize = useSize(fileCardRef);
13251
+ useLayoutEffect(() => {
13252
+ if (!imageInsetRef.current || !fileCardSize)
13253
+ return;
13254
+ imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13255
+ }, [fileCardSize]);
13256
+ const fileName2 = useMemo(() => {
13257
+ if (!file)
13258
+ return;
13259
+ return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13260
+ }, [file, truncateLength]);
13261
+ return /* @__PURE__ */ jsxs(
13262
+ Flex,
13263
+ {
13264
+ className: classNames$1(className, styles$4.ImageCard),
13265
+ width: "100%",
13266
+ direction: "column",
13267
+ position: "relative",
13268
+ height: "max-content",
13269
+ gap: "0",
13270
+ ref: forwardedRef,
13271
+ ...rest,
13272
+ children: [
13273
+ !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13274
+ /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13275
+ /* @__PURE__ */ jsx(
13276
+ OvermapItem,
13277
+ {
13278
+ className: classNames$1(styles$4.Footer, {
13279
+ [styles$4.Loading]: !file
13280
+ }),
13281
+ size,
13282
+ ref: fileCardRef,
13283
+ leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13284
+ rightSlot,
13285
+ children: error2 ?? fileName2
13286
+ }
13287
+ )
13288
+ ]
13289
+ }
13290
+ );
13291
+ })
13292
+ );
13263
13293
  const UploadInput = memo((props) => {
13264
13294
  var _a2;
13265
13295
  const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
@@ -14396,17 +14426,15 @@ const FieldActions = memo((props) => {
14396
14426
  Action.key
14397
14427
  )) }),
14398
14428
  /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
14399
- DropdownItemMenu,
14429
+ OvermapDropdownMenu,
14400
14430
  {
14401
14431
  trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiMore2Line" }) }),
14402
14432
  items: actions.map((Action) => {
14403
14433
  var _a2;
14404
14434
  return {
14405
- content: /* @__PURE__ */ jsxs(Flex$1, { gap: "2", align: "center", children: [
14406
- /* @__PURE__ */ jsx(Action.Icon, {}),
14407
- Action.text
14408
- ] }, Action.key),
14409
- onSelect: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
14435
+ leftSlot: /* @__PURE__ */ jsx(Action.Icon, {}),
14436
+ children: Action.text,
14437
+ onClick: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
14410
14438
  };
14411
14439
  })
14412
14440
  }
@@ -14464,10 +14492,8 @@ const useFieldTypeItems = (onSelect = () => null) => {
14464
14492
  const field = FieldTypeToClsMapping[identifier];
14465
14493
  const Icon = field.Icon;
14466
14494
  return {
14467
- content: /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "2", children: [
14468
- /* @__PURE__ */ jsx(Icon, {}),
14469
- /* @__PURE__ */ jsx(Text$1, { children: field.fieldTypeName })
14470
- ] }, identifier),
14495
+ children: field.fieldTypeName,
14496
+ leftSlot: /* @__PURE__ */ jsx(Icon, {}),
14471
14497
  value: identifier,
14472
14498
  onSelect: () => {
14473
14499
  onSelect(identifier);
@@ -14671,7 +14697,7 @@ const FieldBuilder = memo((props) => {
14671
14697
  }
14672
14698
  ),
14673
14699
  /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "3", children: [
14674
- /* @__PURE__ */ jsx(Badge, { className: styles.typeBadge, children: (_f = fieldTypeItems.flat().find((item) => item.value === type)) == null ? void 0 : _f.content }),
14700
+ /* @__PURE__ */ jsx(Badge, { className: styles.typeBadge, children: (_f = fieldTypeItems.flat().find((item) => item.value === type)) == null ? void 0 : _f.children }),
14675
14701
  showPopoverInputs && /* @__PURE__ */ jsx(FieldSettingsPopover, { popoverInputs, hasError: popoverHasErrors })
14676
14702
  ] }),
14677
14703
  resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -15032,7 +15058,7 @@ const FieldSectionWithActions = memo((props) => {
15032
15058
  )),
15033
15059
  droppableProvided.placeholder,
15034
15060
  /* @__PURE__ */ jsx(
15035
- DropdownItemMenu,
15061
+ OvermapDropdownMenu,
15036
15062
  {
15037
15063
  trigger: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", children: [
15038
15064
  /* @__PURE__ */ jsx(RiIcon, { icon: "RiAddLine" }),