@overmap-ai/core 1.0.44-tiptap.5 → 1.0.44-tiptap.7

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.
@@ -1674,8 +1674,14 @@ var __publicField = (obj, key, value) => {
1674
1674
  [selectAllComponentAttachments, (_state, componentId) => componentId],
1675
1675
  (attachments, componentId) => {
1676
1676
  const attachmentsOfComponent = attachments.filter(({ component_id }) => componentId === component_id);
1677
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1678
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1677
+ const fileAttachments = attachmentsOfComponent.filter(
1678
+ // this null check here is necessary, there are cases where file_type is null or undefined
1679
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1680
+ );
1681
+ const imageAttachments = attachmentsOfComponent.filter(
1682
+ // this null check here is necessary, there are cases where file_type is null or undefined
1683
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1684
+ );
1679
1685
  return { fileAttachments, imageAttachments };
1680
1686
  }
1681
1687
  )
@@ -1940,8 +1946,14 @@ var __publicField = (obj, key, value) => {
1940
1946
  const attachmentsOfComponent = attachments.filter(
1941
1947
  ({ component_type_id }) => component_type_id === componentTypeId
1942
1948
  );
1943
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1944
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1949
+ const fileAttachments = attachmentsOfComponent.filter(
1950
+ // this null check here is necessary, there are cases where file_type is null or undefined
1951
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1952
+ );
1953
+ const imageAttachments = attachmentsOfComponent.filter(
1954
+ // this null check here is necessary, there are cases where file_type is null or undefined
1955
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1956
+ );
1945
1957
  return { fileAttachments, imageAttachments };
1946
1958
  }
1947
1959
  )
@@ -2241,8 +2253,14 @@ var __publicField = (obj, key, value) => {
2241
2253
  [selectIssueAttachments, (_state, issueId) => issueId],
2242
2254
  (attachments, issueId) => {
2243
2255
  const attachmentsOfComponent = attachments.filter(({ issue_id }) => issue_id === issueId);
2244
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
2245
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
2256
+ const fileAttachments = attachmentsOfComponent.filter(
2257
+ // this null check here is necessary, there are cases where file_type is null or undefined
2258
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
2259
+ );
2260
+ const imageAttachments = attachmentsOfComponent.filter(
2261
+ // this null check here is necessary, there are cases where file_type is null or undefined
2262
+ ({ file_type }) => file_type && file_type.startsWith("image/")
2263
+ );
2246
2264
  return { fileAttachments, imageAttachments };
2247
2265
  }
2248
2266
  )
@@ -4091,6 +4109,10 @@ var __publicField = (obj, key, value) => {
4091
4109
  ...fileProps
4092
4110
  }
4093
4111
  });
4112
+ promise.catch((error2) => {
4113
+ this.client.store.dispatch(removeIssueAttachment(offlineAttachment.offline_id));
4114
+ throw error2;
4115
+ });
4094
4116
  return [offlineAttachment, promise];
4095
4117
  }
4096
4118
  async addComponentAttachment(attachmentPayload) {
@@ -4121,6 +4143,10 @@ var __publicField = (obj, key, value) => {
4121
4143
  ...fileProps
4122
4144
  }
4123
4145
  });
4146
+ promise.catch((error2) => {
4147
+ this.client.store.dispatch(removeComponentAttachment(offlineAttachment.offline_id));
4148
+ throw error2;
4149
+ });
4124
4150
  return [offlineAttachment, promise];
4125
4151
  }
4126
4152
  async addComponentTypeAttachment(attachmentPayload) {
@@ -4140,7 +4166,7 @@ var __publicField = (obj, key, value) => {
4140
4166
  const promise = this.enqueueRequest({
4141
4167
  description: "Create attachment",
4142
4168
  method: HttpMethod.POST,
4143
- url: `/component_types/${component_type_id}/attach/`,
4169
+ url: `/types/${component_type_id}/attach/`,
4144
4170
  blocks: [offline_id, component_type_id],
4145
4171
  blockers: [file_sha1],
4146
4172
  payload: {
@@ -4151,6 +4177,10 @@ var __publicField = (obj, key, value) => {
4151
4177
  ...fileProps
4152
4178
  }
4153
4179
  });
4180
+ promise.catch((error2) => {
4181
+ this.client.store.dispatch(removeComponentTypeAttachment(offlineAttachment.offline_id));
4182
+ throw error2;
4183
+ });
4154
4184
  return [offlineAttachment, promise];
4155
4185
  }
4156
4186
  /** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
@@ -12520,7 +12550,7 @@ var __publicField = (obj, key, value) => {
12520
12550
  gap: "0",
12521
12551
  ...rest,
12522
12552
  children: [
12523
- !file && /* @__PURE__ */ jsxRuntime.jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }),
12553
+ !file && !error2 && /* @__PURE__ */ jsxRuntime.jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }),
12524
12554
  /* @__PURE__ */ jsxRuntime.jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsxRuntime.jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
12525
12555
  /* @__PURE__ */ jsxRuntime.jsx(
12526
12556
  blocks.OvermapItem,