@cayuse-test/react 1.0.9 → 1.0.10

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.
@@ -11,7 +11,7 @@ var UploadError = class extends Error {
11
11
  this.stack = e?.stack;
12
12
  }
13
13
  };
14
- var DefaultProps = {
14
+ var serviceDefaultProps = {
15
15
  shouldUseMultipart: (fileSize) => fileSize > 10 * 2 ** 20,
16
16
  maxConcurrentUploads: 5,
17
17
  request: fetch
@@ -22,7 +22,7 @@ var throwIfFalse = (condition, message) => {
22
22
  }
23
23
  };
24
24
  var createUploadService = (props) => {
25
- const options = { ...DefaultProps, ...props || {} };
25
+ const options = { ...serviceDefaultProps, ...props || {} };
26
26
  const limit = pLimit(options.maxConcurrentUploads);
27
27
  const calcNumberOfParts = (fileSize) => Math.floor(fileSize / (5 * 2 ** 20));
28
28
  const createMultipartPresignedUrls = async (fileName, fileSize) => {
@@ -202,4 +202,4 @@ export {
202
202
  createUploadService,
203
203
  UploadService
204
204
  };
205
- //# sourceMappingURL=chunk-M2L7SQBQ.js.map
205
+ //# sourceMappingURL=chunk-6DB5M6WN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/services/upload-s3/UploadService.ts"],"sourcesContent":["import pLimit from 'p-limit';\n\nexport class UploadError extends Error {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tcause: any;\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tconstructor(message: string, e?: any) {\n\t\tsuper(message);\n\t\tthis.name = 'UploadError';\n\t\tthis.cause = e;\n\t\tthis.stack = e?.stack;\n\t}\n}\n\ntype SimpleUploadData = {\n\tpreSignedUrl: string;\n\tuploadMetadataId: string;\n};\n\ntype UploadData = {\n\tuploadMetadataId: string;\n\tuploadUrls: string[];\n\tuploadId?: string;\n};\n\ntype ETag = {\n\tpartNumber: number;\n\tetagId: string;\n};\n\nexport type UploadMetadataResource = {\n\tid: string;\n\ttenantId: string;\n\tfileName: string;\n\tcreatedAt: Date;\n\tfinalizedAt: Date;\n\tcompletedAt: Date;\n\tuploadedBy: string;\n\tfileSize: number;\n};\n\nexport type ProgressState = {\n\tstatus:\n\t\t| 'ready'\n\t\t| 'preparing'\n\t\t| 'uploading'\n\t\t| 'finalizing'\n\t\t| 'completed'\n\t\t| 'error'\n\t\t| 'cancelled';\n\tuploaded: number;\n\ttotalSize: number;\n\terror?: UploadError;\n};\n\nexport type IUploadService = {\n\tupload: (\n\t\tfile: File,\n\t\tonProgress: (progress: ProgressState) => void,\n\t) => Promise<UploadMetadataResource>;\n\tdownloadUrl: (fileId: string) => Promise<string>;\n\tdownload: (fileId: string, fileName: string) => Promise<void>;\n};\n\nconst serviceDefaultProps = {\n\tshouldUseMultipart: (fileSize: number) => fileSize > 10 * 2 ** 20,\n\tmaxConcurrentUploads: 5,\n\trequest: fetch,\n};\n\nexport type UploadServiceProps = Partial<typeof serviceDefaultProps>;\n\nconst throwIfFalse = (condition: boolean, message: string) => {\n\tif (!condition) {\n\t\tthrow new UploadError(message);\n\t}\n};\n\nexport const createUploadService = (props?: UploadServiceProps): IUploadService => {\n\tconst options = { ...serviceDefaultProps, ...(props || {}) };\n\n\tconst limit = pLimit(options.maxConcurrentUploads);\n\tconst calcNumberOfParts = (fileSize: number) =>\n\t\tMath.floor(fileSize / (5 * 2 ** 20));\n\n\tconst createMultipartPresignedUrls = async (\n\t\tfileName: string,\n\t\tfileSize: number,\n\t): Promise<UploadData> => {\n\t\tconst numberOfParts = calcNumberOfParts(fileSize);\n\n\t\tconst response = await options.request('/api/v2/attachments/multipart/upload', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify({ fileName, fileSize, numberOfParts }),\n\t\t});\n\n\t\treturn await response.json();\n\t};\n\n\tconst downloadUrl = async (fileId: string): Promise<string> => {\n\t\tconst response = await options.request(\n\t\t\t`/api/v2/attachments/download?uploadMetadataId=${fileId}`,\n\t\t);\n\n\t\treturn response.json();\n\t};\n\n\tconst download = async (fileId: string, fileName: string): Promise<void> => {\n\t\tconst url = await downloadUrl(fileId);\n\t\tconst link = document.createElement('a');\n\t\tlink.href = url;\n\t\tlink.download = fileName;\n\t\tlink.click();\n\t};\n\n\tconst createSinglePresignedUrl = async (\n\t\tfileName: string,\n\t\tfileSize: number,\n\t): Promise<SimpleUploadData> => {\n\t\tconst response = await options.request('/api/v2/attachments/upload', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify({ fileName, fileSize }),\n\t\t});\n\n\t\treturn await response.json();\n\t};\n\n\tconst preparePart = (blob: Blob, partNumber: number, partSize: number): Blob => {\n\t\tconst start = (partNumber - 1) * partSize;\n\t\tconst end = Math.min(start + partSize, blob.size);\n\n\t\treturn blob.slice(start, end);\n\t};\n\n\tconst uploadPart = async (uploadUrl: string, part: Blob) => {\n\t\tconst response = await fetch(uploadUrl, {\n\t\t\tmethod: 'PUT',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/octet-stream',\n\t\t\t},\n\t\t\tbody: part,\n\t\t});\n\n\t\treturn response.headers.get('ETag');\n\t};\n\n\tconst completeUpload = async (\n\t\tuploadData: UploadData,\n\t\teTags: ETag[],\n\t): Promise<UploadMetadataResource> => {\n\t\tconst handle = async (response: Response) => {\n\t\t\tconst obj = await response.json();\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new UploadError(obj?.message || 'Unknown error occured');\n\t\t\t}\n\n\t\t\treturn obj;\n\t\t};\n\n\t\tif (eTags && eTags.length > 1) {\n\t\t\tconst response = await options.request(\n\t\t\t\t`/api/v2/attachments/multipart/upload/${uploadData.uploadMetadataId}/complete`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tuploadId: uploadData.uploadId,\n\t\t\t\t\t\tetags: eTags,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn await handle(response);\n\t\t}\n\t\tconst response = await options.request(\n\t\t\t`/api/v2/attachments/upload/${uploadData.uploadMetadataId}/complete`,\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t},\n\t\t);\n\n\t\treturn await handle(response);\n\t};\n\n\tconst createPresignedUrls = async (file: File): Promise<UploadData> => {\n\t\tif (options.shouldUseMultipart(file.size)) {\n\t\t\treturn await createMultipartPresignedUrls(file.name, file.size);\n\t\t}\n\t\tconst data = await createSinglePresignedUrl(file.name, file.size);\n\n\t\treturn {\n\t\t\tuploadMetadataId: data.uploadMetadataId,\n\t\t\tuploadUrls: [data.preSignedUrl],\n\t\t};\n\t};\n\n\tconst createState = <T>(\n\t\tinitialState: T,\n\t\tonStateChange: (state: T) => void,\n\t): [T, (s: Partial<T>) => void] => {\n\t\tconst state = {};\n\n\t\tconst setState = (newState: Partial<T>): void => {\n\t\t\tObject.assign(state, newState);\n\t\t\tonStateChange({ ...(state as T) });\n\t\t};\n\n\t\tsetState(initialState); // initial state\n\n\t\treturn [state as T, setState];\n\t};\n\n\tconst uploadFile = async (\n\t\tfile: File,\n\t\tonProgress: (progress: ProgressState) => void,\n\t): Promise<UploadMetadataResource> => {\n\t\tconst initialState: ProgressState = {\n\t\t\tuploaded: 0,\n\t\t\ttotalSize: file.size,\n\t\t\tstatus: 'ready',\n\t\t};\n\t\tconst [state, setState] = createState(initialState, onProgress);\n\n\t\tsetState({ status: 'preparing' });\n\n\t\ttry {\n\t\t\tconst uploadData = await createPresignedUrls(file);\n\t\t\tsetState({ status: 'uploading' });\n\n\t\t\tconst numberOfParts = uploadData.uploadUrls.length;\n\t\t\tconst partSize = Math.ceil(file.size / numberOfParts);\n\n\t\t\t// prepare parts\n\t\t\tconst queuedParts = uploadData.uploadUrls.map((uploadUrl, index) =>\n\t\t\t\tlimit(async () => {\n\t\t\t\t\tconst partNumber = index + 1;\n\t\t\t\t\tconst part = preparePart(file, partNumber, partSize);\n\t\t\t\t\tconst etagId = await uploadPart(uploadUrl, part);\n\t\t\t\t\tsetState({\n\t\t\t\t\t\tuploaded: Math.min(state.uploaded + partSize, state.totalSize),\n\t\t\t\t\t});\n\n\t\t\t\t\treturn { partNumber, etagId };\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\tconst results = await Promise.all(queuedParts);\n\n\t\t\tconst parts = results.filter((x) => !!x.etagId) as ETag[];\n\n\t\t\t// complete upload\n\t\t\tconst fileMetadata = await completeUpload(uploadData, parts);\n\t\t\tsetState({ status: 'completed' });\n\n\t\t\treturn fileMetadata;\n\t\t} catch (e) {\n\t\t\tif (e instanceof UploadError) {\n\t\t\t\tsetState({ status: 'error', error: e });\n\t\t\t\tthrow e;\n\t\t\t} else {\n\t\t\t\tconst overrideErr = new UploadError(\n\t\t\t\t\t'An error occurred while uploading the file',\n\t\t\t\t\te,\n\t\t\t\t);\n\t\t\t\tsetState({ status: 'error', error: overrideErr });\n\t\t\t\tthrow overrideErr;\n\t\t\t}\n\t\t}\n\t};\n\n\tconst getFilextension = (filename: string) => {\n\t\tconst parts = filename.toLocaleLowerCase().split('.');\n\t\tif (parts.length === 1) return;\n\t\treturn parts.pop();\n\t};\n\n\tconst upload = (\n\t\tfile: File,\n\t\tonProgress: (progress: ProgressState) => void,\n\t): Promise<UploadMetadataResource> => {\n\t\tthrowIfFalse(file.name.length > 0, 'File name must not be blank');\n\t\tthrowIfFalse(file.size > 0, 'File must not be blank');\n\t\tthrowIfFalse(file.size <= 75 * 2 ** 20, 'File size must be less than 75MB');\n\t\tthrowIfFalse(\n\t\t\tgetFilextension(file.name) !== 'exe',\n\t\t\t'Attachments with filetype .exe cannot be accepted. Please try a different file type.',\n\t\t);\n\n\t\treturn uploadFile(file, onProgress);\n\t};\n\n\treturn {\n\t\tdownloadUrl,\n\t\tdownload,\n\t\tupload,\n\t};\n};\n\nexport const UploadService = createUploadService({\n\trequest: (url, options) => {\n\t\tconst storedToken = localStorage?.getItem('fk_accessToken');\n\n\t\tconst opt = { headers: {}, ...(options ?? {}) };\n\n\t\treturn fetch(url, {\n\t\t\t...opt,\n\t\t\theaders: {\n\t\t\t\t...opt.headers,\n\t\t\t\tAuthorization: `Bearer ${storedToken}`,\n\t\t\t},\n\t\t});\n\t},\n});\n\nexport default UploadService;\n"],"mappings":";AAAA,OAAO,YAAY;AAEZ,IAAM,cAAN,cAA0B,MAAM;AAAA;AAAA,EAEtC;AAAA;AAAA,EAGA,YAAY,SAAiB,GAAS;AACrC,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,QAAQ,GAAG;AAAA,EACjB;AACD;AAoDA,IAAM,sBAAsB;AAAA,EAC3B,oBAAoB,CAAC,aAAqB,WAAW,KAAK,KAAK;AAAA,EAC/D,sBAAsB;AAAA,EACtB,SAAS;AACV;AAIA,IAAM,eAAe,CAAC,WAAoB,YAAoB;AAC7D,MAAI,CAAC,WAAW;AACf,UAAM,IAAI,YAAY,OAAO;AAAA,EAC9B;AACD;AAEO,IAAM,sBAAsB,CAAC,UAA+C;AAClF,QAAM,UAAU,EAAE,GAAG,qBAAqB,GAAI,SAAS,CAAC,EAAG;AAE3D,QAAM,QAAQ,OAAO,QAAQ,oBAAoB;AACjD,QAAM,oBAAoB,CAAC,aAC1B,KAAK,MAAM,YAAY,IAAI,KAAK,GAAG;AAEpC,QAAM,+BAA+B,OACpC,UACA,aACyB;AACzB,UAAM,gBAAgB,kBAAkB,QAAQ;AAEhD,UAAM,WAAW,MAAM,QAAQ,QAAQ,wCAAwC;AAAA,MAC9E,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,EAAE,UAAU,UAAU,cAAc,CAAC;AAAA,IAC3D,CAAC;AAED,WAAO,MAAM,SAAS,KAAK;AAAA,EAC5B;AAEA,QAAM,cAAc,OAAO,WAAoC;AAC9D,UAAM,WAAW,MAAM,QAAQ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K,IAAI,kCAAkC;AAC1E;AAAA,MACC,gBAAgB,KAAK,IAAI,MAAM;AAAA,MAC/B;AAAA,IACD;AAEA,WAAO,WAAW,MAAM,UAAU;AAAA,EACnC;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,IAAM,gBAAgB,oBAAoB;AAAA,EAChD,SAAS,CAAC,KAAK,YAAY;AAC1B,UAAM,cAAc,cAAc,QAAQ,gBAAgB;AAE1D,UAAM,MAAM,EAAE,SAAS,CAAC,GAAG,GAAI,WAAW,CAAC,EAAG;AAE9C,WAAO,MAAM,KAAK;AAAA,MACjB,GAAG;AAAA,MACH,SAAS;AAAA,QACR,GAAG,IAAI;AAAA,QACP,eAAe,UAAU,WAAW;AAAA,MACrC;AAAA,IACD,CAAC;AAAA,EACF;AACD,CAAC;","names":["response"]}
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-MJBMK4OG.js";
35
35
  import {
36
36
  UploadService
37
- } from "./chunk-M2L7SQBQ.js";
37
+ } from "./chunk-6DB5M6WN.js";
38
38
 
39
39
  // packages/components/attachments-form/attachments-form.tsx
40
40
  import React10, { useState as useState2, useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo2, useRef } from "react";
@@ -4051,11 +4051,10 @@ function AttachmentsSection({
4051
4051
  setAttachmentType
4052
4052
  }) {
4053
4053
  return /* @__PURE__ */ jsxs34("div", { className: "attachments-section", children: [
4054
- /* @__PURE__ */ jsx53("div", { className: "attachmentTypeWrapper", children: /* @__PURE__ */ jsx53(
4054
+ /* @__PURE__ */ jsx53(
4055
4055
  Combobox,
4056
4056
  {
4057
4057
  label: dictionary.attachmentTypeSelector?.label,
4058
- className: "attachmentType",
4059
4058
  onChange: setAttachmentType,
4060
4059
  options: attachmentTypes.filter((attachment2) => attachment2.active).map((attachment2) => ({
4061
4060
  value: attachment2.value,
@@ -4065,7 +4064,7 @@ function AttachmentsSection({
4065
4064
  isSearchable: true,
4066
4065
  value: attachmentType
4067
4066
  }
4068
- ) }),
4067
+ ),
4069
4068
  /* @__PURE__ */ jsx53("div", { className: "fileUploadWrapper", children: /* @__PURE__ */ jsx53(
4070
4069
  MultiFileUpload,
4071
4070
  {
@@ -4307,9 +4306,9 @@ var initialUpdates = {
4307
4306
  removedAttachments: []
4308
4307
  };
4309
4308
  var EditNoteModal = ({
4310
- attachments,
4311
- attachmentTypes,
4312
- dictionary,
4309
+ attachments = [],
4310
+ attachmentTypes = [],
4311
+ dictionary = dictionaryDefaults,
4313
4312
  note,
4314
4313
  isVisible,
4315
4314
  onClose,
@@ -4319,7 +4318,7 @@ var EditNoteModal = ({
4319
4318
  }) => {
4320
4319
  const { message, noteId } = note;
4321
4320
  const [attachmentType, setAttachmentType] = useState9(
4322
- findFirstActiveAttachmentType(attachmentTypes)
4321
+ () => findFirstActiveAttachmentType(attachmentTypes)
4323
4322
  );
4324
4323
  const [updates, setUpdates] = useState9({
4325
4324
  ...initialUpdates,
@@ -4462,13 +4461,6 @@ var EditNoteModal = ({
4462
4461
  ] }) })
4463
4462
  ] });
4464
4463
  };
4465
- EditNoteModal.defaultProps = {
4466
- attachments: [],
4467
- attachmentTypes: [],
4468
- dictionary: {
4469
- ...dictionaryDefaults
4470
- }
4471
- };
4472
4464
 
4473
4465
  // packages/components/form-note-attachments-view/form-note-attachments-view.tsx
4474
4466
  import { jsx as jsx56, jsxs as jsxs37 } from "react/jsx-runtime";
@@ -4554,7 +4546,7 @@ function FormNoteAttachmentsView({
4554
4546
  const dictionary = merge4({}, baseDictionary3, externalDictionary);
4555
4547
  const [newNoteMessage, setNewNoteMessage] = useState10("");
4556
4548
  const [attachmentType, setAttachmentType] = useState10(
4557
- findFirstActiveAttachmentType(attachmentTypes)
4549
+ () => findFirstActiveAttachmentType(attachmentTypes)
4558
4550
  );
4559
4551
  const [attachments, setAttachments] = useState10([]);
4560
4552
  const [reloadItems, setReloadItems] = useState10(true);
@@ -8961,8 +8953,29 @@ var TableRow2 = (props) => {
8961
8953
 
8962
8954
  // packages/components/task-form/comments/table-comment-list.tsx
8963
8955
  import { jsx as jsx90, jsxs as jsxs62 } from "react/jsx-runtime";
8956
+ var defaultDictionary10 = {
8957
+ columns: ["Comment History", "Date and Time"],
8958
+ removeCommentButtonLabel: "Remove comment",
8959
+ editCommentButtonLabel: "Edit comment",
8960
+ removeCommentDialog: {
8961
+ title: "Delete your comment?",
8962
+ cancelText: "Cancel",
8963
+ confirmText: "Delete Comment"
8964
+ },
8965
+ cancelCommentEditingDialog: {
8966
+ title: "Discard Changes?",
8967
+ description: "There are unsaved changes. Are you sure you want to discard your changes?",
8968
+ cancelText: "Cancel",
8969
+ confirmText: "Discard Changes"
8970
+ }
8971
+ };
8964
8972
  var TableCommentList = (props) => {
8965
- const { comments: comments2, disabled, dictionary: dctnr, allowToRemoveByRoles } = props;
8973
+ const {
8974
+ comments: comments2 = [],
8975
+ disabled = false,
8976
+ dictionary: d,
8977
+ allowToRemoveByRoles
8978
+ } = props;
8966
8979
  const [order, setOrder] = useState28("descending");
8967
8980
  const { values } = useFormContext();
8968
8981
  if (!comments2 || comments2?.length === 0) {
@@ -8982,7 +8995,7 @@ var TableCommentList = (props) => {
8982
8995
  }
8983
8996
  return order === "ascending" ? leftCreatedAt - rightCreatedAt : rightCreatedAt - leftCreatedAt;
8984
8997
  });
8985
- const dictionary = merge7({}, TableCommentList.defaultProps.dictionary, dctnr);
8998
+ const dictionary = merge7({}, defaultDictionary10, d);
8986
8999
  const recordIdsToRemove = new Set(values.commentsToRemove || []);
8987
9000
  return /* @__PURE__ */ jsxs62("table", { className: "ui sortable fixed table table-comment-list", children: [
8988
9001
  /* @__PURE__ */ jsx90("thead", { children: /* @__PURE__ */ jsxs62("tr", { children: [
@@ -9024,26 +9037,6 @@ var TableCommentList = (props) => {
9024
9037
  })
9025
9038
  ] });
9026
9039
  };
9027
- TableCommentList.defaultProps = {
9028
- disabled: false,
9029
- comments: [],
9030
- dictionary: {
9031
- columns: ["Comment History", "Date and Time"],
9032
- removeCommentButtonLabel: "Remove comment",
9033
- editCommentButtonLabel: "Edit comment",
9034
- removeCommentDialog: {
9035
- title: "Delete your comment?",
9036
- cancelText: "Cancel",
9037
- confirmText: "Delete Comment"
9038
- },
9039
- cancelCommentEditingDialog: {
9040
- title: "Discard Changes?",
9041
- description: "There are unsaved changes. Are you sure you want to discard your changes?",
9042
- cancelText: "Cancel",
9043
- confirmText: "Discard Changes"
9044
- }
9045
- }
9046
- };
9047
9040
 
9048
9041
  // packages/components/task-form/comments/comments.tsx
9049
9042
  import { jsx as jsx91, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -10416,4 +10409,4 @@ export {
10416
10409
  MilestoneProgress2 as MilestoneProgress,
10417
10410
  TaskFormHeader
10418
10411
  };
10419
- //# sourceMappingURL=chunk-XU6XYQR5.js.map
10412
+ //# sourceMappingURL=chunk-RJUCILWA.js.map