@overmap-ai/core 1.0.51-issue-types.2 → 1.0.51-issue-types.4
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 +65 -6
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +65 -6
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/UserFormService.d.ts +10 -2
- package/dist/store/slices/formSlice.d.ts +7 -0
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -0
- package/dist/typings/models/forms.d.ts +1 -0
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3869,6 +3869,14 @@ const selectFormOfComponentType = restructureCreateSelectorWithArgs(
|
|
|
3869
3869
|
}
|
|
3870
3870
|
)
|
|
3871
3871
|
);
|
|
3872
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
3873
|
+
createSelector(
|
|
3874
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
3875
|
+
(userForms, issueTypeId) => {
|
|
3876
|
+
return Object.values(userForms).find((userForm) => userForm.issue_type === issueTypeId);
|
|
3877
|
+
}
|
|
3878
|
+
)
|
|
3879
|
+
);
|
|
3872
3880
|
const selectFormsCount = createSelector([selectFormMapping], (userForms) => {
|
|
3873
3881
|
return Object.keys(userForms).length;
|
|
3874
3882
|
});
|
|
@@ -4034,6 +4042,43 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
4034
4042
|
}
|
|
4035
4043
|
)
|
|
4036
4044
|
);
|
|
4045
|
+
const selectFormSubmissionsByFormRevisions = createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
4046
|
+
var _a2;
|
|
4047
|
+
const submissionMapping = {};
|
|
4048
|
+
for (const revisionId in revisions) {
|
|
4049
|
+
submissionMapping[revisionId] = [];
|
|
4050
|
+
}
|
|
4051
|
+
for (const submission of submissions) {
|
|
4052
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
4053
|
+
}
|
|
4054
|
+
return submissionMapping;
|
|
4055
|
+
});
|
|
4056
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
4057
|
+
createSelector(
|
|
4058
|
+
[
|
|
4059
|
+
selectFormRevisionMapping,
|
|
4060
|
+
selectFormSubmissionsByFormRevisions,
|
|
4061
|
+
(_state, formId2) => formId2
|
|
4062
|
+
],
|
|
4063
|
+
(revisionsMapping, submissionsByRevision, formId2) => {
|
|
4064
|
+
const submissionsByFormRevisions = {};
|
|
4065
|
+
for (const revisionId in revisionsMapping) {
|
|
4066
|
+
const revision = revisionsMapping[revisionId];
|
|
4067
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
4068
|
+
if (revision && submissionsOfRevision && revision.form === formId2) {
|
|
4069
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
4070
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
4071
|
+
);
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
4075
|
+
const aRevision = revisionsMapping[a[0]];
|
|
4076
|
+
const bRevision = revisionsMapping[b[0]];
|
|
4077
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
4078
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
4079
|
+
}
|
|
4080
|
+
)
|
|
4081
|
+
);
|
|
4037
4082
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
4038
4083
|
createSelector(
|
|
4039
4084
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -7235,7 +7280,7 @@ class UserFormService extends BaseApiService {
|
|
|
7235
7280
|
});
|
|
7236
7281
|
});
|
|
7237
7282
|
}
|
|
7238
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId) {
|
|
7283
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, issueTypeId) {
|
|
7239
7284
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7240
7285
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7241
7286
|
}
|
|
@@ -7255,6 +7300,7 @@ class UserFormService extends BaseApiService {
|
|
|
7255
7300
|
submitted_at: submittedAt,
|
|
7256
7301
|
created_by: currentUser.id,
|
|
7257
7302
|
...componentTypeId && { component_type: componentTypeId },
|
|
7303
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7258
7304
|
...ownerAttrs
|
|
7259
7305
|
};
|
|
7260
7306
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -7278,9 +7324,10 @@ class UserFormService extends BaseApiService {
|
|
|
7278
7324
|
payload: {
|
|
7279
7325
|
...offlineFormPayload,
|
|
7280
7326
|
...componentTypeId && { component_type: componentTypeId },
|
|
7327
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7281
7328
|
initial_revision: payloadWithoutImage
|
|
7282
7329
|
},
|
|
7283
|
-
blockers: componentTypeId ? [componentTypeId] : [],
|
|
7330
|
+
blockers: componentTypeId ? [componentTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7284
7331
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7285
7332
|
});
|
|
7286
7333
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7292,7 +7339,7 @@ class UserFormService extends BaseApiService {
|
|
|
7292
7339
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
7293
7340
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
7294
7341
|
}
|
|
7295
|
-
async addForOrganization(initialRevision,
|
|
7342
|
+
async addForOrganization(initialRevision, attachedTo) {
|
|
7296
7343
|
const state = this.client.store.getState();
|
|
7297
7344
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
7298
7345
|
if (!activeOrganizationId) {
|
|
@@ -7304,13 +7351,22 @@ class UserFormService extends BaseApiService {
|
|
|
7304
7351
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7305
7352
|
void 0,
|
|
7306
7353
|
activeOrganizationId,
|
|
7307
|
-
componentTypeId
|
|
7354
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7355
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7308
7356
|
);
|
|
7309
7357
|
}
|
|
7310
|
-
async addForCurrentUser(initialRevision,
|
|
7358
|
+
async addForCurrentUser(initialRevision, attachedTo) {
|
|
7311
7359
|
const state = this.client.store.getState();
|
|
7312
7360
|
const currentUser = state.userReducer.currentUser;
|
|
7313
|
-
return await this.add(
|
|
7361
|
+
return await this.add(
|
|
7362
|
+
state,
|
|
7363
|
+
initialRevision,
|
|
7364
|
+
"/forms/my-forms/",
|
|
7365
|
+
currentUser.id,
|
|
7366
|
+
void 0,
|
|
7367
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7368
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7369
|
+
);
|
|
7314
7370
|
}
|
|
7315
7371
|
async createRevision(formId2, revision) {
|
|
7316
7372
|
const offlineRevision = offline(revision);
|
|
@@ -16854,6 +16910,7 @@ export {
|
|
|
16854
16910
|
selectForm,
|
|
16855
16911
|
selectFormMapping,
|
|
16856
16912
|
selectFormOfComponentType,
|
|
16913
|
+
selectFormOfIssueType,
|
|
16857
16914
|
selectFormRevision,
|
|
16858
16915
|
selectFormRevisionMapping,
|
|
16859
16916
|
selectFormRevisions,
|
|
@@ -16862,6 +16919,7 @@ export {
|
|
|
16862
16919
|
selectFormSubmissionAttachmentsMapping,
|
|
16863
16920
|
selectFormSubmissions,
|
|
16864
16921
|
selectFormSubmissionsByComponents,
|
|
16922
|
+
selectFormSubmissionsByFormRevisions,
|
|
16865
16923
|
selectFormSubmissionsMapping,
|
|
16866
16924
|
selectFormSubmissionsOfComponent,
|
|
16867
16925
|
selectFormSubmissionsOfForm,
|
|
@@ -16930,6 +16988,7 @@ export {
|
|
|
16930
16988
|
selectRootDocuments,
|
|
16931
16989
|
selectShowTooltips,
|
|
16932
16990
|
selectSortedEmailDomains,
|
|
16991
|
+
selectSortedFormSubmissionsOfForm,
|
|
16933
16992
|
selectSortedOrganizationLicenses,
|
|
16934
16993
|
selectSortedOrganizationUsers,
|
|
16935
16994
|
selectSortedProjectUsers,
|