@overmap-ai/core 1.0.38-component-fields.33 → 1.0.38-component-fields.35
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/dist/overmap-core.js +58 -108
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +58 -108
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/ComponentStageService.d.ts +2 -0
- package/dist/sdk/services/UserFormService.d.ts +2 -4
- package/dist/store/slices/componentStageSlice.d.ts +17 -1
- package/dist/store/slices/userFormSlice.d.ts +1 -23
- package/dist/typings/models/components.d.ts +1 -0
- package/dist/typings/models/forms.d.ts +0 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -1677,6 +1677,22 @@ const componentStageSlice = createSlice({
|
|
|
1677
1677
|
action.payload.forEach((id) => {
|
|
1678
1678
|
delete state.stages[id];
|
|
1679
1679
|
});
|
|
1680
|
+
},
|
|
1681
|
+
linkStageToForm: (state, action) => {
|
|
1682
|
+
const { stageId, formId: formId2 } = action.payload;
|
|
1683
|
+
const stage = state.stages[stageId];
|
|
1684
|
+
if (!stage) {
|
|
1685
|
+
throw new Error("No stage exists with the id " + stageId);
|
|
1686
|
+
}
|
|
1687
|
+
stage.user_form = formId2;
|
|
1688
|
+
},
|
|
1689
|
+
unlinkStageToForm: (state, action) => {
|
|
1690
|
+
const { stageId } = action.payload;
|
|
1691
|
+
const stage = state.stages[stageId];
|
|
1692
|
+
if (!stage) {
|
|
1693
|
+
throw new Error("No stage exists with the id " + stageId);
|
|
1694
|
+
}
|
|
1695
|
+
delete stage.user_form;
|
|
1680
1696
|
}
|
|
1681
1697
|
}
|
|
1682
1698
|
});
|
|
@@ -1721,7 +1737,7 @@ const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1721
1737
|
return stageIds.map((offline_id) => stageMapping[offline_id]).filter((stage) => !!stage);
|
|
1722
1738
|
})
|
|
1723
1739
|
);
|
|
1724
|
-
const { addStages, updateStages, removeStages } = componentStageSlice.actions;
|
|
1740
|
+
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1725
1741
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1726
1742
|
const initialState$g = {
|
|
1727
1743
|
componentTypes: {},
|
|
@@ -3097,22 +3113,6 @@ const userFormSlice = createSlice({
|
|
|
3097
3113
|
}
|
|
3098
3114
|
form.favorite = false;
|
|
3099
3115
|
},
|
|
3100
|
-
attachFormToComponentStage: (state, action) => {
|
|
3101
|
-
const { formId: formId2, componentStageId } = action.payload;
|
|
3102
|
-
const form = state.userForms[formId2];
|
|
3103
|
-
if (!form) {
|
|
3104
|
-
throw new Error("No form exists with the id " + formId2);
|
|
3105
|
-
}
|
|
3106
|
-
form.component_stage = componentStageId;
|
|
3107
|
-
},
|
|
3108
|
-
removeFormFromComponentStage: (state, action) => {
|
|
3109
|
-
const { formId: formId2 } = action.payload;
|
|
3110
|
-
const form = state.userForms[formId2];
|
|
3111
|
-
if (!form) {
|
|
3112
|
-
throw new Error("No form exists with the id " + formId2);
|
|
3113
|
-
}
|
|
3114
|
-
form.component_stage = void 0;
|
|
3115
|
-
},
|
|
3116
3116
|
deleteUserForm: (state, action) => {
|
|
3117
3117
|
delete state.userForms[action.payload];
|
|
3118
3118
|
}
|
|
@@ -3128,8 +3128,6 @@ const {
|
|
|
3128
3128
|
deleteUserFormSubmissions,
|
|
3129
3129
|
favoriteForm,
|
|
3130
3130
|
unfavoriteForm,
|
|
3131
|
-
attachFormToComponentStage,
|
|
3132
|
-
removeFormFromComponentStage,
|
|
3133
3131
|
deleteUserForm,
|
|
3134
3132
|
deleteUserFormRevision,
|
|
3135
3133
|
deleteUserFormRevisions,
|
|
@@ -3285,38 +3283,6 @@ const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithA
|
|
|
3285
3283
|
}
|
|
3286
3284
|
)
|
|
3287
3285
|
);
|
|
3288
|
-
const selectComponentStageFormLatestRevision = restructureCreateSelectorWithArgs(
|
|
3289
|
-
createSelector(
|
|
3290
|
-
[
|
|
3291
|
-
selectUserFormMapping,
|
|
3292
|
-
selectRevisionMapping,
|
|
3293
|
-
(_state, componentStageId) => componentStageId
|
|
3294
|
-
],
|
|
3295
|
-
(userForms, revisions, componentStageId) => {
|
|
3296
|
-
const form = Object.values(userForms).find((userForm) => userForm.component_stage === componentStageId);
|
|
3297
|
-
return form ? _selectLatestFormRevision(revisions, form.offline_id) : void 0;
|
|
3298
|
-
}
|
|
3299
|
-
)
|
|
3300
|
-
);
|
|
3301
|
-
const selectLatestRevisionsFromComponentStageIds = restructureCreateSelectorWithArgs(
|
|
3302
|
-
createSelector(
|
|
3303
|
-
[
|
|
3304
|
-
selectUserFormMapping,
|
|
3305
|
-
selectRevisionMapping,
|
|
3306
|
-
(_state, componentStageIds) => componentStageIds
|
|
3307
|
-
],
|
|
3308
|
-
(userForms, revisions, componentStageIds) => {
|
|
3309
|
-
const componentStageIdsSet = new Set(componentStageIds);
|
|
3310
|
-
const ret = {};
|
|
3311
|
-
for (const form of Object.values(userForms)) {
|
|
3312
|
-
if (form.component_stage && componentStageIdsSet.has(form.component_stage)) {
|
|
3313
|
-
ret[form.component_stage] = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3314
|
-
}
|
|
3315
|
-
}
|
|
3316
|
-
return ret;
|
|
3317
|
-
}
|
|
3318
|
-
)
|
|
3319
|
-
);
|
|
3320
3286
|
const selectLatestRevisionByFormId = createSelector([selectRevisionMapping], (revisions) => {
|
|
3321
3287
|
const latestRevisions = {};
|
|
3322
3288
|
for (const revision of Object.values(revisions)) {
|
|
@@ -4699,6 +4665,39 @@ class ComponentStageService extends BaseApiService {
|
|
|
4699
4665
|
blocks: [componentStage.offline_id]
|
|
4700
4666
|
});
|
|
4701
4667
|
}
|
|
4668
|
+
async linkForm(stageId, formId2) {
|
|
4669
|
+
const { store } = this.client;
|
|
4670
|
+
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
4671
|
+
try {
|
|
4672
|
+
await this.enqueueRequest({
|
|
4673
|
+
description: "Link component stage to form",
|
|
4674
|
+
method: HttpMethod.POST,
|
|
4675
|
+
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
4676
|
+
payload: { user_form: formId2 },
|
|
4677
|
+
blockers: [stageId, formId2],
|
|
4678
|
+
blocks: [stageId]
|
|
4679
|
+
});
|
|
4680
|
+
} catch (e) {
|
|
4681
|
+
store.dispatch(unlinkStageToForm({ stageId }));
|
|
4682
|
+
throw e;
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
async unlinkForm(stageId, formId2) {
|
|
4686
|
+
const { store } = this.client;
|
|
4687
|
+
store.dispatch(unlinkStageToForm({ stageId }));
|
|
4688
|
+
try {
|
|
4689
|
+
await this.enqueueRequest({
|
|
4690
|
+
description: "Unlink component stage from form",
|
|
4691
|
+
method: HttpMethod.DELETE,
|
|
4692
|
+
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
4693
|
+
blockers: [stageId, formId2],
|
|
4694
|
+
blocks: [stageId]
|
|
4695
|
+
});
|
|
4696
|
+
} catch (e) {
|
|
4697
|
+
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
4698
|
+
throw e;
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4702
4701
|
async refreshStore() {
|
|
4703
4702
|
const { store } = this.client;
|
|
4704
4703
|
const result = await this.enqueueRequest({
|
|
@@ -5484,13 +5483,10 @@ class UserFormService extends BaseApiService {
|
|
|
5484
5483
|
});
|
|
5485
5484
|
});
|
|
5486
5485
|
}
|
|
5487
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId
|
|
5486
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId) {
|
|
5488
5487
|
if (!!ownerUser === !!ownerOrganization) {
|
|
5489
5488
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
5490
5489
|
}
|
|
5491
|
-
if (componentTypeId && componentStageId) {
|
|
5492
|
-
throw new Error("At most one of componentTypeId and componentStageId should be defined.");
|
|
5493
|
-
}
|
|
5494
5490
|
const ownerAttrs = {
|
|
5495
5491
|
owner_user: ownerUser,
|
|
5496
5492
|
owner_organization: ownerOrganization
|
|
@@ -5506,7 +5502,6 @@ class UserFormService extends BaseApiService {
|
|
|
5506
5502
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5507
5503
|
created_by: currentUser.id,
|
|
5508
5504
|
...componentTypeId && { component_type: componentTypeId },
|
|
5509
|
-
...componentStageId && { component_stage: componentStageId },
|
|
5510
5505
|
...ownerAttrs
|
|
5511
5506
|
};
|
|
5512
5507
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -5529,10 +5524,9 @@ class UserFormService extends BaseApiService {
|
|
|
5529
5524
|
payload: {
|
|
5530
5525
|
...offlineFormPayload,
|
|
5531
5526
|
...componentTypeId && { component_type: componentTypeId },
|
|
5532
|
-
...componentStageId && { component_stage: componentStageId },
|
|
5533
5527
|
initial_revision: payloadWithoutImage
|
|
5534
5528
|
},
|
|
5535
|
-
blockers: [componentTypeId
|
|
5529
|
+
blockers: [componentTypeId].filter((x) => x !== void 0),
|
|
5536
5530
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
5537
5531
|
});
|
|
5538
5532
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -5544,7 +5538,7 @@ class UserFormService extends BaseApiService {
|
|
|
5544
5538
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
5545
5539
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
5546
5540
|
}
|
|
5547
|
-
async addForOrganization(initialRevision, componentTypeId
|
|
5541
|
+
async addForOrganization(initialRevision, componentTypeId) {
|
|
5548
5542
|
const state = this.client.store.getState();
|
|
5549
5543
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
5550
5544
|
if (!activeOrganizationId) {
|
|
@@ -5556,22 +5550,13 @@ class UserFormService extends BaseApiService {
|
|
|
5556
5550
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
5557
5551
|
void 0,
|
|
5558
5552
|
activeOrganizationId,
|
|
5559
|
-
componentTypeId
|
|
5560
|
-
componentStageId
|
|
5553
|
+
componentTypeId
|
|
5561
5554
|
);
|
|
5562
5555
|
}
|
|
5563
|
-
async addForCurrentUser(initialRevision, componentTypeId
|
|
5556
|
+
async addForCurrentUser(initialRevision, componentTypeId) {
|
|
5564
5557
|
const state = this.client.store.getState();
|
|
5565
5558
|
const currentUser = state.userReducer.currentUser;
|
|
5566
|
-
return await this.add(
|
|
5567
|
-
state,
|
|
5568
|
-
initialRevision,
|
|
5569
|
-
"/forms/my-forms/",
|
|
5570
|
-
currentUser.id,
|
|
5571
|
-
void 0,
|
|
5572
|
-
componentTypeId,
|
|
5573
|
-
componentStageId
|
|
5574
|
-
);
|
|
5559
|
+
return await this.add(state, initialRevision, "/forms/my-forms/", currentUser.id, void 0, componentTypeId);
|
|
5575
5560
|
}
|
|
5576
5561
|
async createRevision(formId2, revision) {
|
|
5577
5562
|
const offlineRevision = offline(revision);
|
|
@@ -5644,39 +5629,6 @@ class UserFormService extends BaseApiService {
|
|
|
5644
5629
|
throw e;
|
|
5645
5630
|
}
|
|
5646
5631
|
}
|
|
5647
|
-
async attachToComponentStage(formId2, componentStageId) {
|
|
5648
|
-
const { store } = this.client;
|
|
5649
|
-
store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
|
|
5650
|
-
try {
|
|
5651
|
-
await this.enqueueRequest({
|
|
5652
|
-
description: "Attach form to component stage",
|
|
5653
|
-
method: HttpMethod.POST,
|
|
5654
|
-
url: `/forms/${formId2}/associate-with-stage/`,
|
|
5655
|
-
payload: { component_stage: componentStageId },
|
|
5656
|
-
blockers: [formId2, componentStageId],
|
|
5657
|
-
blocks: [formId2]
|
|
5658
|
-
});
|
|
5659
|
-
} catch (e) {
|
|
5660
|
-
store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
|
|
5661
|
-
throw e;
|
|
5662
|
-
}
|
|
5663
|
-
}
|
|
5664
|
-
async removeFromComponentStage(formId2, componentStageId) {
|
|
5665
|
-
const { store } = this.client;
|
|
5666
|
-
store.dispatch(removeFormFromComponentStage({ formId: formId2 }));
|
|
5667
|
-
try {
|
|
5668
|
-
await this.enqueueRequest({
|
|
5669
|
-
description: "Remove form from component stage",
|
|
5670
|
-
method: HttpMethod.DELETE,
|
|
5671
|
-
url: `/forms/${formId2}/associate-with-stage/`,
|
|
5672
|
-
blockers: [formId2, componentStageId],
|
|
5673
|
-
blocks: [formId2]
|
|
5674
|
-
});
|
|
5675
|
-
} catch (e) {
|
|
5676
|
-
store.dispatch(attachFormToComponentStage({ formId: formId2, componentStageId }));
|
|
5677
|
-
throw e;
|
|
5678
|
-
}
|
|
5679
|
-
}
|
|
5680
5632
|
async delete(formId2) {
|
|
5681
5633
|
const { store } = this.client;
|
|
5682
5634
|
const state = store.getState();
|
|
@@ -12019,7 +11971,6 @@ export {
|
|
|
12019
11971
|
addUsers,
|
|
12020
11972
|
addWorkspace,
|
|
12021
11973
|
areArraysEqual,
|
|
12022
|
-
attachFormToComponentStage,
|
|
12023
11974
|
authReducer,
|
|
12024
11975
|
authSlice,
|
|
12025
11976
|
blobToBase64,
|
|
@@ -12098,6 +12049,7 @@ export {
|
|
|
12098
12049
|
issueReducer,
|
|
12099
12050
|
issueSlice,
|
|
12100
12051
|
issueToSearchResult,
|
|
12052
|
+
linkStageToForm,
|
|
12101
12053
|
literalToCoordinates,
|
|
12102
12054
|
logOnlyOnce,
|
|
12103
12055
|
makeClient,
|
|
@@ -12142,7 +12094,6 @@ export {
|
|
|
12142
12094
|
removeComponent,
|
|
12143
12095
|
removeEmailDomain,
|
|
12144
12096
|
removeFavouriteProjectId,
|
|
12145
|
-
removeFormFromComponentStage,
|
|
12146
12097
|
removeIssue,
|
|
12147
12098
|
removeIssueComment,
|
|
12148
12099
|
removeOrganizationAccess,
|
|
@@ -12187,7 +12138,6 @@ export {
|
|
|
12187
12138
|
selectCompletedStageIdsForComponent,
|
|
12188
12139
|
selectCompletedStages,
|
|
12189
12140
|
selectComponent,
|
|
12190
|
-
selectComponentStageFormLatestRevision,
|
|
12191
12141
|
selectComponentType,
|
|
12192
12142
|
selectComponentTypeForm,
|
|
12193
12143
|
selectComponentTypeFromComponent,
|
|
@@ -12227,7 +12177,6 @@ export {
|
|
|
12227
12177
|
selectLatestFormRevision,
|
|
12228
12178
|
selectLatestRetryTime,
|
|
12229
12179
|
selectLatestRevisionByFormId,
|
|
12230
|
-
selectLatestRevisionsFromComponentStageIds,
|
|
12231
12180
|
selectLatestRevisionsFromComponentTypeIds,
|
|
12232
12181
|
selectMainWorkspace,
|
|
12233
12182
|
selectMapStyle,
|
|
@@ -12342,6 +12291,7 @@ export {
|
|
|
12342
12291
|
unfavoriteForm,
|
|
12343
12292
|
unhideAllCategories,
|
|
12344
12293
|
unhideCategory,
|
|
12294
|
+
unlinkStageToForm,
|
|
12345
12295
|
updateActiveOrganization,
|
|
12346
12296
|
updateAttachment,
|
|
12347
12297
|
updateComponent,
|