@overmap-ai/core 1.0.58-asset-description.8 → 1.0.58-no-hardcoding-api-urls.0

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @overmap-ai/core
2
-
3
- The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
- packages.
1
+ # @overmap-ai/core
2
+
3
+ The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
+ packages.
@@ -3,9 +3,9 @@ import { ToolkitStore } from "@reduxjs/toolkit/dist/configureStore";
3
3
  import { RootState } from "../typings";
4
4
  interface OvermapProviderProps {
5
5
  children: React.ReactNode;
6
- production?: boolean;
7
6
  disableDefaultTheme?: boolean;
8
7
  store: ToolkitStore<RootState>;
8
+ apiUrl: string;
9
9
  }
10
10
  declare const OvermapContext: React.Context<null>;
11
11
  declare const OvermapProvider: (props: OvermapProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,9 +7,9 @@ export interface ISDKContext {
7
7
  }
8
8
  interface SDKProviderProps {
9
9
  children: React.ReactNode;
10
- API_URL: string;
10
+ apiUrl: string;
11
11
  store: ToolkitStore<RootState>;
12
12
  }
13
13
  declare const SDKContext: React.Context<ISDKContext>;
14
- declare const SDKProvider: React.MemoExoticComponent<({ children, API_URL, store }: SDKProviderProps) => import("react/jsx-runtime").JSX.Element>;
14
+ declare const SDKProvider: React.MemoExoticComponent<({ children, apiUrl, store }: SDKProviderProps) => import("react/jsx-runtime").JSX.Element>;
15
15
  export { SDKProvider, SDKContext };
@@ -6,7 +6,7 @@ import { FieldOptions } from "./typings";
6
6
  import { FormikUserFormRevision } from "../../builder";
7
7
  export declare abstract class BaseFormElement<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> {
8
8
  readonly type: TIdentifier;
9
- readonly identifier: string;
9
+ protected readonly identifier: string;
10
10
  readonly description: string | null;
11
11
  protected constructor(options: BaseSerializedObject);
12
12
  getId(): string;
@@ -47,6 +47,4 @@ export declare abstract class BaseField<TValue extends FieldValue, TIdentifier e
47
47
  abstract serialize(): ISerializedOnlyField;
48
48
  getFieldValidators(): InputFieldLevelValidator<TValue>[];
49
49
  getFormValidators(): InputFormLevelValidator<TValue>[];
50
- encodeValueToJson(value: TValue): string;
51
- decodeJsonToValue(json: string): TValue;
52
50
  }
@@ -2,8 +2,8 @@ import { BaseField, ChildFieldOptions } from "../BaseField";
2
2
  import { GetInputProps, InputFieldLevelValidator } from "../typings";
3
3
  import { ChangeEvent, ReactNode } from "react";
4
4
  import { RiListCheck } from "react-icons/ri";
5
- import { ISerializedField, SerializedMultiStringField } from "../../typings";
6
- type MultiStringFieldOptions = ChildFieldOptions<string[]> & {
5
+ import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from "../../typings";
6
+ type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
7
7
  minimum_length?: number;
8
8
  maximum_length?: number;
9
9
  placeholder?: string;
@@ -21,7 +21,7 @@ export declare const emptyMultiStringField: {
21
21
  * - Specifying the options of a SelectField (used in `SelectField.getFieldCreationSchema`
22
22
  * - Listing serial numbers and similar
23
23
  */
24
- export declare class MultiStringField extends BaseField<string[], "multi-string"> {
24
+ export declare class MultiStringField extends BaseField<SelectFieldOption[], "multi-string"> {
25
25
  static readonly fieldTypeName = "Multi-string";
26
26
  static readonly fieldTypeDescription = "Allows the user to provide multiple unique strings.";
27
27
  readonly minLength: number;
@@ -30,11 +30,11 @@ export declare class MultiStringField extends BaseField<string[], "multi-string"
30
30
  readonly placeholder: string;
31
31
  static Icon: typeof RiListCheck;
32
32
  constructor(options: MultiStringFieldOptions);
33
- getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | string[]): string[];
33
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | SelectFieldOption[]): SelectFieldOption[];
34
34
  getInput(props: GetInputProps<this>): ReactNode;
35
35
  serialize(): SerializedMultiStringField;
36
- protected isBlank(value: string[]): boolean;
37
- getFieldValidators(): InputFieldLevelValidator<string[]>[];
36
+ protected isBlank(value: SelectFieldOption[]): boolean;
37
+ getFieldValidators(): InputFieldLevelValidator<SelectFieldOption[]>[];
38
38
  static deserialize(data: ISerializedField): MultiStringField;
39
39
  }
40
40
  export {};
@@ -23,5 +23,5 @@ export interface ComponentProps<TField extends BaseFormElement> extends Omit<HTM
23
23
  showInputOnly?: boolean;
24
24
  }
25
25
  export type GetInputProps<TField extends BaseFormElement> = Omit<ComponentProps<TField>, "field">;
26
- export type AnyField = BaseField<any, any>;
26
+ export type AnyField = BaseField<any>;
27
27
  export type ISerializedOnlyField = Exclude<ISerializedField, SerializedFieldSection>;
@@ -10,7 +10,5 @@ export declare const deserializeField: (serializedField: ISerializedOnlyField) =
10
10
  export declare const deserialize: (serialized: ISerializedField) => AnyField | FieldSection;
11
11
  export type PartialFormRevision = Pick<UserFormRevision, "title" | "fields" | "description"> & Partial<UserFormRevision>;
12
12
  export declare function formRevisionToSchema(formRevision: PartialFormRevision, meta?: Partial<SchemaMeta>): ISchema;
13
- export declare function decodeFormValues(schema: ISchema, values: Record<string, string>): Record<string, FieldValue>;
14
- export declare function encodeFormValues(schema: ISchema, values: Record<string, FieldValue>): Record<string, string>;
15
13
  export declare function valueIsFile(v: FieldValue | Promise<File>[] | undefined): v is File[] | Promise<File>[];
16
14
  export declare function isConditionMet<TValue extends FieldValue | Promise<File>[]>(condition: TValue extends FieldValue ? SerializedCondition<TValue> | null : null, value: TValue): boolean;
@@ -2,4 +2,3 @@ export * from "./typings";
2
2
  export * from "./builder";
3
3
  export * from "./fields";
4
4
  export * from "./renderer";
5
- export { validateForm, initialFormValues } from "./utils";
@@ -1738,16 +1738,6 @@ const assetSlice = createSlice({
1738
1738
  }
1739
1739
  prevAssets = null;
1740
1740
  },
1741
- updateAssets: (state, action) => {
1742
- for (const asset of action.payload) {
1743
- if (asset.offline_id in state.assets) {
1744
- state.assets[asset.offline_id] = asset;
1745
- } else {
1746
- throw new Error(`Tried to update asset with ID that doesn't exist: ${asset.offline_id}`);
1747
- }
1748
- }
1749
- prevAssets = null;
1750
- },
1751
1741
  removeAsset: (state, action) => {
1752
1742
  if (action.payload in state.assets) {
1753
1743
  delete state.assets[action.payload];
@@ -1756,16 +1746,6 @@ const assetSlice = createSlice({
1756
1746
  }
1757
1747
  prevAssets = null;
1758
1748
  },
1759
- removeAssets: (state, action) => {
1760
- for (const assetId of action.payload) {
1761
- if (assetId in state.assets) {
1762
- delete state.assets[assetId];
1763
- } else {
1764
- throw new Error(`Failed to remove asset because ID doesn't exist: ${assetId}`);
1765
- }
1766
- }
1767
- prevAssets = null;
1768
- },
1769
1749
  removeAllAssetsOfType: (state, action) => {
1770
1750
  var _a2;
1771
1751
  for (const componentId in state.assets) {
@@ -1789,9 +1769,7 @@ const assetSlice = createSlice({
1789
1769
  const {
1790
1770
  addAsset,
1791
1771
  updateAsset,
1792
- updateAssets,
1793
1772
  removeAsset,
1794
- removeAssets,
1795
1773
  addAssetsInBatches,
1796
1774
  setAssets,
1797
1775
  removeAllAssetsOfType,
@@ -5400,16 +5378,6 @@ class CategoryService extends BaseApiService {
5400
5378
  store.dispatch(setCategories(result));
5401
5379
  }
5402
5380
  }
5403
- function chunkArray(arr, chunkSize) {
5404
- const chunks = [];
5405
- let index2 = 0;
5406
- const arrLength = arr.length;
5407
- while (index2 < arrLength) {
5408
- chunks.push(arr.slice(index2, index2 += chunkSize));
5409
- }
5410
- return chunks;
5411
- }
5412
- const BULK_ADD_ASSET_BATCH_SIZE = 1e3;
5413
5381
  class AssetService extends BaseApiService {
5414
5382
  // Basic CRUD functions
5415
5383
  add(asset, workspaceId) {
@@ -5486,45 +5454,36 @@ class AssetService extends BaseApiService {
5486
5454
  throw err;
5487
5455
  });
5488
5456
  }
5489
- addBulk(assetsToCreate, workspaceId, assetTypeId) {
5490
- const { store } = this.client;
5457
+ async addBatch(assetsToCreate, workspaceId, assetTypeId) {
5491
5458
  const fullAssets = assetsToCreate.map((asset) => {
5492
5459
  return { ...offline(asset), submitted_at: (/* @__PURE__ */ new Date()).toISOString() };
5493
5460
  });
5494
- const assetBatches = chunkArray(fullAssets, BULK_ADD_ASSET_BATCH_SIZE).map((assetBatch) => {
5495
- return {
5496
- batchId: v4(),
5497
- payload: {
5498
- assets: assetBatch
5499
- }
5500
- };
5501
- });
5461
+ const { store } = this.client;
5502
5462
  store.dispatch(addAssetsInBatches(fullAssets));
5503
- let prevBatchId = null;
5504
- const batchPromises = Promise.all(
5505
- assetBatches.map((assetBatch) => {
5506
- const { batchId, payload } = assetBatch;
5507
- const promise = this.client.enqueueRequest({
5508
- description: "Batch create assets",
5509
- method: HttpMethod.POST,
5510
- url: `/assets/types/${assetTypeId}/add-assets/`,
5511
- queryParams: {
5512
- workspace_id: workspaceId.toString()
5513
- },
5514
- payload,
5515
- blockers: prevBatchId ? [assetTypeId, prevBatchId] : [assetTypeId],
5516
- blocks: assetBatch.payload.assets.map((c) => c.offline_id).concat([batchId])
5517
- });
5518
- promise.then((result) => {
5519
- store.dispatch(updateAssets(Object.values(result)));
5520
- }).catch(() => {
5521
- store.dispatch(removeAssets(assetBatch.payload.assets.map((c) => c.offline_id)));
5522
- });
5523
- prevBatchId = assetBatch.batchId;
5524
- return promise;
5525
- })
5526
- );
5527
- return [fullAssets, batchPromises.then((result) => result)];
5463
+ const promise = this.client.enqueueRequest({
5464
+ description: "Batch create assets",
5465
+ method: HttpMethod.POST,
5466
+ url: `/assets/types/${assetTypeId}/add-assets/`,
5467
+ queryParams: {
5468
+ workspace_id: workspaceId.toString()
5469
+ },
5470
+ payload: {
5471
+ assets: fullAssets
5472
+ },
5473
+ blockers: [assetTypeId],
5474
+ blocks: fullAssets.map((c) => c.offline_id)
5475
+ });
5476
+ void promise.then((result) => {
5477
+ for (const assets of Object.values(result)) {
5478
+ store.dispatch(updateAsset(assets));
5479
+ }
5480
+ }).catch((e) => {
5481
+ for (const asset of fullAssets) {
5482
+ store.dispatch(removeAsset(asset.offline_id));
5483
+ }
5484
+ throw e;
5485
+ });
5486
+ return promise;
5528
5487
  }
5529
5488
  async refreshStore() {
5530
5489
  const { store } = this.client;
@@ -7310,7 +7269,6 @@ const separateFilesFromValues = (values) => {
7310
7269
  }
7311
7270
  return { values: newValues, files };
7312
7271
  };
7313
- const MAX_BULK_ADD_SUBMISSIONS = 1e3;
7314
7272
  class UserFormSubmissionService extends BaseApiService {
7315
7273
  constructor() {
7316
7274
  super(...arguments);
@@ -7392,134 +7350,99 @@ class UserFormSubmissionService extends BaseApiService {
7392
7350
  // Note currently the bulkAdd method is specific to form submissions for assets
7393
7351
  // TODO: adapt the support bulk adding to any model type
7394
7352
  async bulkAdd(args) {
7395
- const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
7353
+ const { formRevision, values: argsValues, assetOfflineIds } = args;
7396
7354
  const { store } = this.client;
7397
7355
  const offlineSubmissions = [];
7398
7356
  const offlineAttachments = [];
7399
7357
  const submissionOfflineIds = [];
7400
- const allFilesRecord = {};
7401
- const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
7358
+ const submissionsPayload = [];
7359
+ const attachmentsPayload = [];
7360
+ const { values, files } = separateFilesFromValues(argsValues);
7402
7361
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7403
7362
  const createdBy = store.getState().userReducer.currentUser.id;
7404
- const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), MAX_BULK_ADD_SUBMISSIONS);
7405
- const bulkAddBatches = await Promise.all(
7406
- assetIdBatches.map(async (assetIdBatch) => {
7407
- const batchId = v4();
7408
- const submissionsPayload = [];
7409
- const attachmentsPayload = [];
7410
- let files = { ...commonFiles };
7411
- for (const assetId of assetIdBatch) {
7412
- const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
7413
- files = Object.assign(files, submissionSpecificFiles);
7414
- const submissionValues = {
7415
- ...fileSeperatedCommonFieldValues,
7416
- ...fileSeperatedSubmissionSpecificValues
7417
- };
7418
- const submission = offline({
7419
- form_revision: formRevision,
7420
- values: submissionValues,
7421
- created_by: createdBy,
7422
- submitted_at: submittedAt,
7423
- asset: assetId
7424
- });
7425
- submissionOfflineIds.push(submission.offline_id);
7426
- submissionsPayload.push({
7427
- offline_id: submission.offline_id,
7428
- asset_id: assetId,
7429
- form_data: fileSeperatedSubmissionSpecificValues
7430
- });
7431
- offlineSubmissions.push(submission);
7432
- for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
7433
- for (const file of fileArray) {
7434
- const sha1 = await hashFile(file);
7435
- await this.client.files.addCache(file, sha1);
7436
- const offlineAttachment = offline({
7437
- file_name: file.name,
7438
- file_sha1: sha1,
7439
- file: URL.createObjectURL(file),
7440
- submission: submission.offline_id,
7441
- field_identifier: fieldIdentifier
7442
- });
7443
- offlineAttachments.push(offlineAttachment);
7444
- attachmentsPayload.push({
7445
- offline_id: offlineAttachment.offline_id,
7446
- submission_id: submission.offline_id,
7447
- sha1,
7448
- name: file.name,
7449
- field_identifier: fieldIdentifier
7450
- });
7451
- }
7452
- }
7453
- }
7454
- const filePaylods = [];
7455
- for (const file of Object.values(files).flat()) {
7363
+ for (const assetId of assetOfflineIds) {
7364
+ const submission = offline({
7365
+ form_revision: formRevision,
7366
+ values,
7367
+ created_by: createdBy,
7368
+ submitted_at: submittedAt,
7369
+ asset: assetId
7370
+ });
7371
+ submissionOfflineIds.push(submission.offline_id);
7372
+ submissionsPayload.push({ offline_id: submission.offline_id, asset_id: assetId });
7373
+ offlineSubmissions.push(submission);
7374
+ for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
7375
+ for (const file of fileArray) {
7456
7376
  const sha1 = await hashFile(file);
7457
- const filePayload = {
7377
+ await this.client.files.addCache(file, sha1);
7378
+ const offlineAttachment = offline({
7379
+ file_name: file.name,
7380
+ file_sha1: sha1,
7381
+ file: URL.createObjectURL(file),
7382
+ submission: submission.offline_id,
7383
+ field_identifier: fieldIdentifier
7384
+ });
7385
+ offlineAttachments.push(offlineAttachment);
7386
+ attachmentsPayload.push({
7387
+ offline_id: offlineAttachment.offline_id,
7388
+ submission_id: submission.offline_id,
7458
7389
  sha1,
7459
- extension: file.name.split(".").pop() || "",
7460
- file_type: file.type,
7461
- size: file.size
7462
- };
7463
- allFilesRecord[sha1] = filePayload;
7464
- filePaylods.push(filePayload);
7390
+ name: file.name,
7391
+ field_identifier: fieldIdentifier
7392
+ });
7465
7393
  }
7466
- return {
7467
- batchId,
7468
- payload: {
7469
- form_data: fileSeperatedCommonFieldValues,
7470
- submitted_at: submittedAt,
7471
- submissions: submissionsPayload,
7472
- attachments: attachmentsPayload,
7473
- files: filePaylods
7474
- }
7475
- };
7476
- })
7477
- );
7394
+ }
7395
+ }
7396
+ const filesRecord = {};
7397
+ for (const file of Object.values(files).flat()) {
7398
+ const sha1 = await hashFile(file);
7399
+ filesRecord[sha1] = {
7400
+ sha1,
7401
+ extension: file.name.split(".").pop() || "",
7402
+ file_type: file.type,
7403
+ size: file.size
7404
+ };
7405
+ }
7478
7406
  store.dispatch(addFormSubmissions(offlineSubmissions));
7479
7407
  store.dispatch(addFormSubmissionAttachments(offlineAttachments));
7480
- let prevBatchId = null;
7481
- const batchPromises = Promise.all(
7482
- bulkAddBatches.map((batch) => {
7483
- const { payload, batchId } = batch;
7484
- const batchAssetIds = payload.submissions.map((x) => x.asset_id);
7485
- const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
7486
- const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
7487
- const promise = this.client.enqueueRequest({
7488
- description: "Bulk add form submissions",
7408
+ const promise = this.client.enqueueRequest({
7409
+ description: "Bulk add form submissions",
7410
+ method: HttpMethod.POST,
7411
+ url: `/forms/revisions/${formRevision}/bulk-respond/`,
7412
+ payload: {
7413
+ form_data: values,
7414
+ submitted_at: submittedAt,
7415
+ submissions: submissionsPayload,
7416
+ attachments: attachmentsPayload,
7417
+ files: Object.values(filesRecord)
7418
+ },
7419
+ blockers: assetOfflineIds,
7420
+ blocks: submissionOfflineIds
7421
+ });
7422
+ promise.then(({ submissions, attachments, presigned_urls }) => {
7423
+ store.dispatch(updateFormSubmissions(submissions));
7424
+ store.dispatch(updateFormSubmissionAttachments(attachments));
7425
+ for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
7426
+ const file = filesRecord[sha1];
7427
+ if (!file)
7428
+ continue;
7429
+ void this.client.enqueueRequest({
7430
+ url: presigned_url.url,
7431
+ description: "Upload file",
7489
7432
  method: HttpMethod.POST,
7490
- url: `/forms/revisions/${formRevision}/bulk-respond/`,
7491
- payload,
7492
- blockers: prevBatchId ? batchAssetIds.concat([prevBatchId]) : batchAssetIds,
7493
- blocks: batchSubmissionOfflineIds.concat([batchId])
7494
- });
7495
- promise.then(({ submissions, attachments, presigned_urls }) => {
7496
- store.dispatch(updateFormSubmissions(submissions));
7497
- store.dispatch(updateFormSubmissionAttachments(attachments));
7498
- for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
7499
- const file = allFilesRecord[sha1];
7500
- if (!file)
7501
- continue;
7502
- void this.client.enqueueRequest({
7503
- url: presigned_url.url,
7504
- description: "Upload file",
7505
- method: HttpMethod.POST,
7506
- isExternalUrl: true,
7507
- isAuthNeeded: false,
7508
- attachmentHash: sha1,
7509
- blockers: [`s3-${file.sha1}.${file.extension}`],
7510
- blocks: [sha1],
7511
- s3url: presigned_url
7512
- });
7513
- }
7514
- }).catch(() => {
7515
- store.dispatch(deleteFormSubmissions(batchSubmissionOfflineIds));
7516
- store.dispatch(deleteFormSubmissionAttachments(batchAttachmentsOfflineIds));
7433
+ isExternalUrl: true,
7434
+ isAuthNeeded: false,
7435
+ attachmentHash: sha1,
7436
+ blockers: [`s3-${file.sha1}.${file.extension}`],
7437
+ blocks: [sha1],
7438
+ s3url: presigned_url
7517
7439
  });
7518
- prevBatchId = batchId;
7519
- return promise;
7520
- })
7521
- );
7522
- return [offlineSubmissions, batchPromises.then((results) => results.map(({ submissions }) => submissions))];
7440
+ }
7441
+ }).catch(() => {
7442
+ store.dispatch(deleteFormSubmissions(submissionOfflineIds));
7443
+ store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
7444
+ });
7445
+ return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
7523
7446
  }
7524
7447
  update(submission) {
7525
7448
  const { store } = this.client;
@@ -8729,8 +8652,8 @@ class OvermapSDK {
8729
8652
  }
8730
8653
  const makeClient = (apiUrl, store) => new OvermapSDK(apiUrl, store);
8731
8654
  const SDKContext = React__default.createContext({});
8732
- const SDKProvider = memo(({ children, API_URL, store }) => {
8733
- const client = useMemo(() => makeClient(API_URL, store), [API_URL, store]);
8655
+ const SDKProvider = memo(({ children, apiUrl, store }) => {
8656
+ const client = useMemo(() => makeClient(apiUrl, store), [apiUrl, store]);
8734
8657
  useEffect(() => {
8735
8658
  setClientStore(store);
8736
8659
  }, [store]);
@@ -8741,11 +8664,9 @@ const useSDK = () => {
8741
8664
  return React__default.useContext(SDKContext);
8742
8665
  };
8743
8666
  const OvermapContext = React__default.createContext(null);
8744
- const PRODUCTION_URL = "https://api.wordn.io";
8745
- const STAGING_URL = "https://test-api.hemora.ca";
8746
8667
  const OvermapProvider = (props) => {
8747
- const { children, production, disableDefaultTheme = false, store } = props;
8748
- let ret = /* @__PURE__ */ jsx(AlertDialogProvider, { children: /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(SDKProvider, { API_URL: production ? PRODUCTION_URL : STAGING_URL, store, children }) }) });
8668
+ const { children, disableDefaultTheme = false, store, apiUrl } = props;
8669
+ let ret = /* @__PURE__ */ jsx(AlertDialogProvider, { children: /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(SDKProvider, { store, apiUrl, children }) }) });
8749
8670
  if (!disableDefaultTheme) {
8750
8671
  ret = /* @__PURE__ */ jsx(DefaultTheme, { children: ret });
8751
8672
  }
@@ -8874,12 +8795,6 @@ class BaseField extends BaseFormElement {
8874
8795
  getFormValidators() {
8875
8796
  return [...this.formValidators];
8876
8797
  }
8877
- encodeValueToJson(value) {
8878
- return JSON.stringify(value);
8879
- }
8880
- decodeJsonToValue(json) {
8881
- return JSON.parse(json);
8882
- }
8883
8798
  }
8884
8799
  __publicField(BaseField, "fieldTypeName");
8885
8800
  __publicField(BaseField, "fieldTypeDescription");
@@ -13153,7 +13068,7 @@ const MultiStringInput = memo((props) => {
13153
13068
  );
13154
13069
  const handleChange = useCallback(
13155
13070
  (e) => {
13156
- if (value.findIndex((option) => option === e.target.value.trim()) >= 0) {
13071
+ if (value.findIndex((option) => option.value === e.target.value.trim()) >= 0) {
13157
13072
  setInternalError("All options must be unique");
13158
13073
  } else if (!e.target.value) {
13159
13074
  setInternalError("Option cannot be empty");
@@ -13172,7 +13087,7 @@ const MultiStringInput = memo((props) => {
13172
13087
  return;
13173
13088
  }
13174
13089
  const trimmedValue = intermediateValue.trim();
13175
- setValueAndTouched([...value, trimmedValue]);
13090
+ setValueAndTouched([...value, { value: trimmedValue, label: trimmedValue }]);
13176
13091
  setIntermediateValue("");
13177
13092
  }, [intermediateValue, internalError, setValueAndTouched, value]);
13178
13093
  const handleKeyDown = useCallback(
@@ -13242,7 +13157,7 @@ const MultiStringInput = memo((props) => {
13242
13157
  value.map((option, index2) => /* @__PURE__ */ jsx(
13243
13158
  Draggable,
13244
13159
  {
13245
- draggableId: `${option}-draggable`,
13160
+ draggableId: `${option.value}-draggable`,
13246
13161
  index: index2,
13247
13162
  isDragDisabled: disabled,
13248
13163
  children: ({ draggableProps, dragHandleProps, innerRef }) => /* @__PURE__ */ jsx(
@@ -13257,7 +13172,7 @@ const MultiStringInput = memo((props) => {
13257
13172
  mb: "1",
13258
13173
  asChild: true,
13259
13174
  children: /* @__PURE__ */ jsxs(Badge, { color: "gray", size: "2", children: [
13260
- /* @__PURE__ */ jsx("span", { children: option }),
13175
+ /* @__PURE__ */ jsx("span", { children: option.label }),
13261
13176
  /* @__PURE__ */ jsx(
13262
13177
  IconButton,
13263
13178
  {
@@ -13277,7 +13192,7 @@ const MultiStringInput = memo((props) => {
13277
13192
  }
13278
13193
  )
13279
13194
  },
13280
- option
13195
+ option.value
13281
13196
  )),
13282
13197
  droppableProvided.placeholder
13283
13198
  ] }) })
@@ -14952,46 +14867,6 @@ function formRevisionToSchema(formRevision, meta = {}) {
14952
14867
  meta: { readonly }
14953
14868
  };
14954
14869
  }
14955
- function decodeFormValues(schema, values) {
14956
- let allFields = [];
14957
- for (const field of schema.fields) {
14958
- if (field instanceof FieldSection) {
14959
- allFields = allFields.concat(field.fields);
14960
- } else {
14961
- if (!(field instanceof BaseField)) {
14962
- throw new Error("Invalid field type");
14963
- }
14964
- allFields.push(field);
14965
- }
14966
- }
14967
- const result = {};
14968
- for (const field of allFields) {
14969
- if (!(field.identifier in values))
14970
- ;
14971
- const value = values[field.identifier];
14972
- result[field.identifier] = field.decodeJsonToValue(value);
14973
- }
14974
- return result;
14975
- }
14976
- function encodeFormValues(schema, values) {
14977
- let allFields = [];
14978
- for (const field of schema.fields) {
14979
- if (field instanceof FieldSection) {
14980
- allFields = allFields.concat(field.fields);
14981
- } else {
14982
- if (!(field instanceof BaseField)) {
14983
- throw new Error("Invalid field type");
14984
- }
14985
- allFields.push(field);
14986
- }
14987
- }
14988
- const result = {};
14989
- for (const field of allFields) {
14990
- const value = values[field.identifier];
14991
- result[field.identifier] = field.encodeValueToJson(value);
14992
- }
14993
- return result;
14994
- }
14995
14870
  function valueIsFile(v) {
14996
14871
  return Array.isArray(v) && v.some((v2) => v2 instanceof File || v2 instanceof Promise);
14997
14872
  }
@@ -16773,7 +16648,6 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16773
16648
  StringInput,
16774
16649
  TextField,
16775
16650
  TextInput,
16776
- decodeFormValues,
16777
16651
  deserialize,
16778
16652
  deserializeField,
16779
16653
  emptyBaseField,
@@ -16786,14 +16660,11 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16786
16660
  emptySelectField,
16787
16661
  emptyStringField,
16788
16662
  emptyTextField,
16789
- encodeFormValues,
16790
16663
  formRevisionToSchema,
16791
- initialFormValues,
16792
16664
  isConditionMet,
16793
16665
  useFieldInput,
16794
16666
  useFieldInputs,
16795
16667
  useFormikInput,
16796
- validateForm,
16797
16668
  valueIsFile
16798
16669
  }, Symbol.toStringTag, { value: "Module" }));
16799
16670
  export {
@@ -16985,7 +16856,6 @@ export {
16985
16856
  coordinatesToUrlText,
16986
16857
  createOfflineAction,
16987
16858
  createPointMarker,
16988
- decodeFormValues,
16989
16859
  defaultBadgeColor,
16990
16860
  defaultStore,
16991
16861
  deleteAssetType,
@@ -17021,7 +16891,6 @@ export {
17021
16891
  emptySelectField,
17022
16892
  emptyStringField,
17023
16893
  emptyTextField,
17024
- encodeFormValues,
17025
16894
  enqueue,
17026
16895
  enqueueRequest,
17027
16896
  errorColor,
@@ -17052,7 +16921,6 @@ export {
17052
16921
  hashFile,
17053
16922
  hideAllCategories,
17054
16923
  hideCategory,
17055
- initialFormValues,
17056
16924
  isConditionMet,
17057
16925
  isToday,
17058
16926
  issueReducer,
@@ -17106,7 +16974,6 @@ export {
17106
16974
  removeAssetAttachments,
17107
16975
  removeAssetTypeAttachment,
17108
16976
  removeAssetTypeAttachments,
17109
- removeAssets,
17110
16977
  removeAttachmentsOfIssue,
17111
16978
  removeCategory,
17112
16979
  removeColor,
@@ -17424,7 +17291,6 @@ export {
17424
17291
  updateAssetAttachments,
17425
17292
  updateAssetTypeAttachment,
17426
17293
  updateAssetTypeAttachments,
17427
- updateAssets,
17428
17294
  updateConversation,
17429
17295
  updateDocumentAttachment,
17430
17296
  updateDocumentAttachments,
@@ -17455,7 +17321,6 @@ export {
17455
17321
  useSDK,
17456
17322
  userReducer,
17457
17323
  userSlice,
17458
- validateForm,
17459
17324
  valueIsFile,
17460
17325
  warningColor,
17461
17326
  workspaceReducer,