@overmap-ai/core 1.0.38-component-fields.31 → 1.0.38-component-fields.33
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.
|
@@ -3212,7 +3212,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3212
3212
|
const selectSubmissionMapping = (state) => state.userFormReducer.submissions;
|
|
3213
3213
|
const selectSubmissions = toolkit.createSelector([selectSubmissionMapping], (submissions) => Object.values(submissions));
|
|
3214
3214
|
const selectRevisionMapping = (state) => state.userFormReducer.revisions;
|
|
3215
|
-
const selectRevisionAttachmentsMapping = (state) => state.userFormReducer.revisionAttachments;
|
|
3216
3215
|
const selectRevisions = toolkit.createSelector([selectRevisionMapping], (revisions) => Object.values(revisions));
|
|
3217
3216
|
const selectRevisionsForForm = restructureCreateSelectorWithArgs(
|
|
3218
3217
|
toolkit.createSelector([selectRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
@@ -3325,19 +3324,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3325
3324
|
}
|
|
3326
3325
|
return latestRevisions;
|
|
3327
3326
|
});
|
|
3328
|
-
const selectAllRevisionAttachmentsByLatestRevisionId = toolkit.createSelector(
|
|
3329
|
-
[selectUserFormMapping, selectRevisionMapping, selectRevisionAttachmentsMapping],
|
|
3330
|
-
(forms, revisions, attachments) => {
|
|
3331
|
-
const mappedAttachments = {};
|
|
3332
|
-
for (const form of Object.values(forms)) {
|
|
3333
|
-
const latestRevision = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3334
|
-
if (attachments[latestRevision.offline_id] !== void 0) {
|
|
3335
|
-
mappedAttachments[latestRevision.offline_id] = attachments[latestRevision.offline_id];
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
return mappedAttachments;
|
|
3339
|
-
}
|
|
3340
|
-
);
|
|
3341
3327
|
const selectNumberOfUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3342
3328
|
return Object.keys(userForms).length;
|
|
3343
3329
|
});
|
|
@@ -5656,21 +5642,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5656
5642
|
}
|
|
5657
5643
|
async attachToComponentStage(formId2, componentStageId) {
|
|
5658
5644
|
const { store } = this.client;
|
|
5659
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5660
|
-
if (!activeProjectId) {
|
|
5661
|
-
throw new Error("Expected an active project.");
|
|
5662
|
-
}
|
|
5663
5645
|
store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
|
|
5664
5646
|
try {
|
|
5665
5647
|
await this.enqueueRequest({
|
|
5666
5648
|
description: "Attach form to component stage",
|
|
5667
|
-
method: HttpMethod.
|
|
5668
|
-
url: `/forms/${formId2}/`,
|
|
5649
|
+
method: HttpMethod.POST,
|
|
5650
|
+
url: `/forms/${formId2}/associate-with-stage/`,
|
|
5669
5651
|
payload: { component_stage: componentStageId },
|
|
5670
|
-
queryParams: {
|
|
5671
|
-
project_id: activeProjectId.toString(),
|
|
5672
|
-
component_stage: componentStageId
|
|
5673
|
-
},
|
|
5674
5652
|
blockers: [formId2, componentStageId],
|
|
5675
5653
|
blocks: [formId2]
|
|
5676
5654
|
});
|
|
@@ -5681,21 +5659,12 @@ var __publicField = (obj, key, value) => {
|
|
|
5681
5659
|
}
|
|
5682
5660
|
async removeFromComponentStage(formId2, componentStageId) {
|
|
5683
5661
|
const { store } = this.client;
|
|
5684
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5685
|
-
if (!activeProjectId) {
|
|
5686
|
-
throw new Error("Expected an active project.");
|
|
5687
|
-
}
|
|
5688
5662
|
store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
|
|
5689
5663
|
try {
|
|
5690
5664
|
await this.enqueueRequest({
|
|
5691
5665
|
description: "Remove form from component stage",
|
|
5692
|
-
method: HttpMethod.
|
|
5693
|
-
url: `/forms/${formId2}/`,
|
|
5694
|
-
payload: { component_stage: void 0 },
|
|
5695
|
-
queryParams: {
|
|
5696
|
-
project_id: activeProjectId.toString(),
|
|
5697
|
-
component_stage: componentStageId
|
|
5698
|
-
},
|
|
5666
|
+
method: HttpMethod.DELETE,
|
|
5667
|
+
url: `/forms/${formId2}/associate-with-stage/`,
|
|
5699
5668
|
blockers: [formId2, componentStageId],
|
|
5700
5669
|
blocks: [formId2]
|
|
5701
5670
|
});
|
|
@@ -10384,10 +10353,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10384
10353
|
};
|
|
10385
10354
|
const useAttachImagesToFormRevisionFields = (revision) => {
|
|
10386
10355
|
const { sdk } = useSDK();
|
|
10387
|
-
const attachments = useAppSelector(selectRevisionAttachments(revision.offline_id));
|
|
10356
|
+
const attachments = useAppSelector(selectRevisionAttachments((revision == null ? void 0 : revision.offline_id) ?? ""));
|
|
10388
10357
|
return React.useMemo(() => {
|
|
10358
|
+
if (!revision || !attachments)
|
|
10359
|
+
return revision;
|
|
10389
10360
|
const revisionCopy = structuredClone(revision);
|
|
10390
|
-
for (const attachment of attachments
|
|
10361
|
+
for (const attachment of attachments) {
|
|
10391
10362
|
const filePromise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
|
|
10392
10363
|
let sectionIndex = -1;
|
|
10393
10364
|
let fieldIndex = -1;
|
|
@@ -10472,6 +10443,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10472
10443
|
);
|
|
10473
10444
|
}
|
|
10474
10445
|
const revisionWithImages = useAttachImagesToFormRevisionFields(revision);
|
|
10446
|
+
if (!revisionWithImages) {
|
|
10447
|
+
throw new Error("Expected revisionWithImages to be defined");
|
|
10448
|
+
}
|
|
10475
10449
|
const schema = React.useMemo(() => {
|
|
10476
10450
|
return formRevisionToSchema(revisionWithImages, { readonly: true });
|
|
10477
10451
|
}, [revisionWithImages]);
|
|
@@ -11797,8 +11771,9 @@ var __publicField = (obj, key, value) => {
|
|
|
11797
11771
|
}),
|
|
11798
11772
|
[initialTitle]
|
|
11799
11773
|
);
|
|
11774
|
+
const revisionWithImages = useAttachImagesToFormRevisionFields(revision);
|
|
11800
11775
|
const formik$1 = formik.useFormik({
|
|
11801
|
-
initialValues: wrapRootFieldsWithFieldSection(
|
|
11776
|
+
initialValues: wrapRootFieldsWithFieldSection(revisionWithImages) ?? initialValues,
|
|
11802
11777
|
validate,
|
|
11803
11778
|
onSubmit: onSave,
|
|
11804
11779
|
validateOnChange: false,
|
|
@@ -12195,7 +12170,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12195
12170
|
exports2.selectActiveWorkspace = selectActiveWorkspace;
|
|
12196
12171
|
exports2.selectActiveWorkspaceId = selectActiveWorkspaceId;
|
|
12197
12172
|
exports2.selectAllAttachments = selectAllAttachments;
|
|
12198
|
-
exports2.selectAllRevisionAttachmentsByLatestRevisionId = selectAllRevisionAttachmentsByLatestRevisionId;
|
|
12199
12173
|
exports2.selectAppearance = selectAppearance;
|
|
12200
12174
|
exports2.selectCategories = selectCategories;
|
|
12201
12175
|
exports2.selectCategoriesOfWorkspace = selectCategoriesOfWorkspace;
|