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

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,9 @@ 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(),
4545
+ created_by: this.client.store.getState().userReducer.currentUser.id
4534
4546
  };
4535
4547
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4536
4548
  this.client.store.dispatch(addIssueAttachment(offlineAttachment));
@@ -4564,7 +4576,9 @@ class AttachmentService extends BaseApiService {
4564
4576
  ...attachmentPayload,
4565
4577
  file: attachmentPayload.file.objectURL,
4566
4578
  file_name: attachmentPayload.file.name,
4567
- file_type: attachmentPayload.file.type
4579
+ file_type: attachmentPayload.file.type,
4580
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4581
+ created_by: this.client.store.getState().userReducer.currentUser.id
4568
4582
  };
4569
4583
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4570
4584
  this.client.store.dispatch(addComponentAttachment(offlineAttachment));
@@ -4598,7 +4612,9 @@ class AttachmentService extends BaseApiService {
4598
4612
  ...attachmentPayload,
4599
4613
  file: attachmentPayload.file.objectURL,
4600
4614
  file_name: attachmentPayload.file.name,
4601
- file_type: attachmentPayload.file.type
4615
+ file_type: attachmentPayload.file.type,
4616
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4617
+ created_by: this.client.store.getState().userReducer.currentUser.id
4602
4618
  };
4603
4619
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4604
4620
  this.client.store.dispatch(addComponentTypeAttachment(offlineAttachment));
@@ -4632,7 +4648,9 @@ class AttachmentService extends BaseApiService {
4632
4648
  ...attachmentPayload,
4633
4649
  file: attachmentPayload.file.objectURL,
4634
4650
  file_name: attachmentPayload.file.name,
4635
- file_type: attachmentPayload.file.type
4651
+ file_type: attachmentPayload.file.type,
4652
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4653
+ created_by: this.client.store.getState().userReducer.currentUser.id
4636
4654
  };
4637
4655
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4638
4656
  this.client.store.dispatch(addProjectAttachment(offlineAttachment));
@@ -4672,7 +4690,9 @@ class AttachmentService extends BaseApiService {
4672
4690
  file_name: file2.name,
4673
4691
  file_type: file2.type,
4674
4692
  issue: issueId,
4675
- file_sha1: hash
4693
+ file_sha1: hash,
4694
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4695
+ created_by: this.client.store.getState().userReducer.currentUser.id
4676
4696
  });
4677
4697
  return this.addIssueAttachment(attachment);
4678
4698
  };
@@ -4691,7 +4711,9 @@ class AttachmentService extends BaseApiService {
4691
4711
  file_name: file2.name,
4692
4712
  file_type: file2.type,
4693
4713
  component: componentId,
4694
- file_sha1: hash
4714
+ file_sha1: hash,
4715
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4716
+ created_by: this.client.store.getState().userReducer.currentUser.id
4695
4717
  });
4696
4718
  return this.addComponentAttachment(attachment);
4697
4719
  };
@@ -4710,7 +4732,9 @@ class AttachmentService extends BaseApiService {
4710
4732
  file_name: file2.name,
4711
4733
  file_type: file2.type,
4712
4734
  component_type: componentTypeId,
4713
- file_sha1: hash
4735
+ file_sha1: hash,
4736
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4737
+ created_by: this.client.store.getState().userReducer.currentUser.id
4714
4738
  });
4715
4739
  return this.addComponentTypeAttachment(attachment);
4716
4740
  };
@@ -4729,7 +4753,9 @@ class AttachmentService extends BaseApiService {
4729
4753
  file_name: file2.name,
4730
4754
  file_type: file2.type,
4731
4755
  project: projectId,
4732
- file_sha1: hash
4756
+ file_sha1: hash,
4757
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
4758
+ created_by: this.client.store.getState().userReducer.currentUser.id
4733
4759
  });
4734
4760
  return this.addProjectAttachment(attachment);
4735
4761
  };
@@ -7710,7 +7736,7 @@ class AgentService extends BaseApiService {
7710
7736
  * @param request The message to prompt the agent with.
7711
7737
  * @param conversationId If continuing an existing message, the UUID of that conversation.
7712
7738
  */
7713
- prompt(request2, conversationId) {
7739
+ async prompt(request2, conversationId) {
7714
7740
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7715
7741
  return this.enqueueRequest({
7716
7742
  description: "Prompt agent",
@@ -7725,6 +7751,16 @@ class AgentService extends BaseApiService {
7725
7751
  queryParams: conversationId ? { conversation_id: conversationId } : {}
7726
7752
  });
7727
7753
  }
7754
+ async rate(responseId, rating) {
7755
+ return this.enqueueRequest({
7756
+ description: "Rate agent response",
7757
+ method: HttpMethod.PUT,
7758
+ url: `/agents/responses/${responseId}/rate/`,
7759
+ payload: { rating },
7760
+ blockers: ["rate"],
7761
+ blocks: ["rate"]
7762
+ });
7763
+ }
7728
7764
  }
7729
7765
  class OvermapSDK {
7730
7766
  constructor(apiUrl, store) {
@@ -13214,52 +13250,54 @@ const styles$4 = {
13214
13250
  Footer,
13215
13251
  Loading
13216
13252
  };
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";
13253
+ const ImageCard = memo(
13254
+ forwardRef((props, forwardedRef) => {
13255
+ const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13256
+ const fileCardRef = useRef(null);
13257
+ const imageInsetRef = useRef(null);
13258
+ const fileCardSize = useSize(fileCardRef);
13259
+ useLayoutEffect(() => {
13260
+ if (!imageInsetRef.current || !fileCardSize)
13261
+ return;
13262
+ imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13263
+ }, [fileCardSize]);
13264
+ const fileName2 = useMemo(() => {
13265
+ if (!file)
13266
+ return;
13267
+ return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13268
+ }, [file, truncateLength]);
13269
+ return /* @__PURE__ */ jsxs(
13270
+ Flex,
13271
+ {
13272
+ className: classNames$1(className, styles$4.ImageCard),
13273
+ width: "100%",
13274
+ direction: "column",
13275
+ position: "relative",
13276
+ height: "max-content",
13277
+ gap: "0",
13278
+ ref: forwardedRef,
13279
+ ...rest,
13280
+ children: [
13281
+ !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13282
+ /* @__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 }) }),
13283
+ /* @__PURE__ */ jsx(
13284
+ OvermapItem,
13285
+ {
13286
+ className: classNames$1(styles$4.Footer, {
13287
+ [styles$4.Loading]: !file
13288
+ }),
13289
+ size,
13290
+ ref: fileCardRef,
13291
+ leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13292
+ rightSlot,
13293
+ children: error2 ?? fileName2
13294
+ }
13295
+ )
13296
+ ]
13297
+ }
13298
+ );
13299
+ })
13300
+ );
13263
13301
  const UploadInput = memo((props) => {
13264
13302
  var _a2;
13265
13303
  const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
@@ -14396,17 +14434,15 @@ const FieldActions = memo((props) => {
14396
14434
  Action.key
14397
14435
  )) }),
14398
14436
  /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
14399
- DropdownItemMenu,
14437
+ OvermapDropdownMenu,
14400
14438
  {
14401
14439
  trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiMore2Line" }) }),
14402
14440
  items: actions.map((Action) => {
14403
14441
  var _a2;
14404
14442
  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
14443
+ leftSlot: /* @__PURE__ */ jsx(Action.Icon, {}),
14444
+ children: Action.text,
14445
+ onClick: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
14410
14446
  };
14411
14447
  })
14412
14448
  }
@@ -14464,10 +14500,8 @@ const useFieldTypeItems = (onSelect = () => null) => {
14464
14500
  const field = FieldTypeToClsMapping[identifier];
14465
14501
  const Icon = field.Icon;
14466
14502
  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),
14503
+ children: field.fieldTypeName,
14504
+ leftSlot: /* @__PURE__ */ jsx(Icon, {}),
14471
14505
  value: identifier,
14472
14506
  onSelect: () => {
14473
14507
  onSelect(identifier);
@@ -14671,7 +14705,7 @@ const FieldBuilder = memo((props) => {
14671
14705
  }
14672
14706
  ),
14673
14707
  /* @__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 }),
14708
+ /* @__PURE__ */ jsx(Badge, { className: styles.typeBadge, children: (_f = fieldTypeItems.flat().find((item) => item.value === type)) == null ? void 0 : _f.children }),
14675
14709
  showPopoverInputs && /* @__PURE__ */ jsx(FieldSettingsPopover, { popoverInputs, hasError: popoverHasErrors })
14676
14710
  ] }),
14677
14711
  resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -15032,7 +15066,7 @@ const FieldSectionWithActions = memo((props) => {
15032
15066
  )),
15033
15067
  droppableProvided.placeholder,
15034
15068
  /* @__PURE__ */ jsx(
15035
- DropdownItemMenu,
15069
+ OvermapDropdownMenu,
15036
15070
  {
15037
15071
  trigger: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", children: [
15038
15072
  /* @__PURE__ */ jsx(RiIcon, { icon: "RiAddLine" }),