@overmap-ai/core 1.0.48-activity-history.3 → 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
  };
@@ -5812,8 +5830,7 @@ class IssueCommentService extends BaseApiService {
5812
5830
  const offlineComment = offline({
5813
5831
  ...comment,
5814
5832
  author: store.getState().userReducer.currentUser.id,
5815
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5816
- resolved: false
5833
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
5817
5834
  });
5818
5835
  store.dispatch(addIssueComment(offlineComment));
5819
5836
  const promise = this.enqueueRequest({
@@ -7711,7 +7728,7 @@ class AgentService extends BaseApiService {
7711
7728
  * @param request The message to prompt the agent with.
7712
7729
  * @param conversationId If continuing an existing message, the UUID of that conversation.
7713
7730
  */
7714
- prompt(request2, conversationId) {
7731
+ async prompt(request2, conversationId) {
7715
7732
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7716
7733
  return this.enqueueRequest({
7717
7734
  description: "Prompt agent",
@@ -7726,6 +7743,16 @@ class AgentService extends BaseApiService {
7726
7743
  queryParams: conversationId ? { conversation_id: conversationId } : {}
7727
7744
  });
7728
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
+ }
7729
7756
  }
7730
7757
  class OvermapSDK {
7731
7758
  constructor(apiUrl, store) {
@@ -13215,52 +13242,54 @@ const styles$4 = {
13215
13242
  Footer,
13216
13243
  Loading
13217
13244
  };
13218
- const ImageCard = memo((props) => {
13219
- const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13220
- const fileCardRef = useRef(null);
13221
- const imageInsetRef = useRef(null);
13222
- const fileCardSize = useSize(fileCardRef);
13223
- useLayoutEffect(() => {
13224
- if (!imageInsetRef.current || !fileCardSize)
13225
- return;
13226
- imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13227
- }, [fileCardSize]);
13228
- const fileName2 = useMemo(() => {
13229
- if (!file)
13230
- return;
13231
- return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13232
- }, [file, truncateLength]);
13233
- return /* @__PURE__ */ jsxs(
13234
- Flex,
13235
- {
13236
- className: classNames$1(className, styles$4.ImageCard),
13237
- width: "100%",
13238
- direction: "column",
13239
- position: "relative",
13240
- height: "max-content",
13241
- gap: "0",
13242
- ...rest,
13243
- children: [
13244
- !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13245
- /* @__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 }) }),
13246
- /* @__PURE__ */ jsx(
13247
- OvermapItem,
13248
- {
13249
- className: classNames$1(styles$4.Footer, {
13250
- [styles$4.Loading]: !file
13251
- }),
13252
- size,
13253
- ref: fileCardRef,
13254
- leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13255
- rightSlot,
13256
- children: error2 ?? fileName2
13257
- }
13258
- )
13259
- ]
13260
- }
13261
- );
13262
- });
13263
- 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
+ );
13264
13293
  const UploadInput = memo((props) => {
13265
13294
  var _a2;
13266
13295
  const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
@@ -14397,17 +14426,15 @@ const FieldActions = memo((props) => {
14397
14426
  Action.key
14398
14427
  )) }),
14399
14428
  /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
14400
- DropdownItemMenu,
14429
+ OvermapDropdownMenu,
14401
14430
  {
14402
14431
  trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiMore2Line" }) }),
14403
14432
  items: actions.map((Action) => {
14404
14433
  var _a2;
14405
14434
  return {
14406
- content: /* @__PURE__ */ jsxs(Flex$1, { gap: "2", align: "center", children: [
14407
- /* @__PURE__ */ jsx(Action.Icon, {}),
14408
- Action.text
14409
- ] }, Action.key),
14410
- 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
14411
14438
  };
14412
14439
  })
14413
14440
  }
@@ -14465,10 +14492,8 @@ const useFieldTypeItems = (onSelect = () => null) => {
14465
14492
  const field = FieldTypeToClsMapping[identifier];
14466
14493
  const Icon = field.Icon;
14467
14494
  return {
14468
- content: /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "2", children: [
14469
- /* @__PURE__ */ jsx(Icon, {}),
14470
- /* @__PURE__ */ jsx(Text$1, { children: field.fieldTypeName })
14471
- ] }, identifier),
14495
+ children: field.fieldTypeName,
14496
+ leftSlot: /* @__PURE__ */ jsx(Icon, {}),
14472
14497
  value: identifier,
14473
14498
  onSelect: () => {
14474
14499
  onSelect(identifier);
@@ -14672,7 +14697,7 @@ const FieldBuilder = memo((props) => {
14672
14697
  }
14673
14698
  ),
14674
14699
  /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "3", children: [
14675
- /* @__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 }),
14676
14701
  showPopoverInputs && /* @__PURE__ */ jsx(FieldSettingsPopover, { popoverInputs, hasError: popoverHasErrors })
14677
14702
  ] }),
14678
14703
  resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -15033,7 +15058,7 @@ const FieldSectionWithActions = memo((props) => {
15033
15058
  )),
15034
15059
  droppableProvided.placeholder,
15035
15060
  /* @__PURE__ */ jsx(
15036
- DropdownItemMenu,
15061
+ OvermapDropdownMenu,
15037
15062
  {
15038
15063
  trigger: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", children: [
15039
15064
  /* @__PURE__ */ jsx(RiIcon, { icon: "RiAddLine" }),