@overmap-ai/core 1.0.37 → 1.0.38-component-fields.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/dist/overmap-core.js +18 -5
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +18 -5
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/UserFormService.d.ts +2 -2
- package/dist/store/slices/userFormSlice.d.ts +5 -0
- package/dist/typings/models/forms.d.ts +1 -0
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3241,6 +3241,16 @@ const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
|
|
|
3241
3241
|
const selectUserFormMapping = (state) => {
|
|
3242
3242
|
return state.userFormReducer.userForms;
|
|
3243
3243
|
};
|
|
3244
|
+
const selectFormsForComponentType = restructureCreateSelectorWithArgs(
|
|
3245
|
+
createSelector(
|
|
3246
|
+
[selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3247
|
+
(userForms, componentTypeId) => {
|
|
3248
|
+
return Object.values(userForms).filter((userForm) => {
|
|
3249
|
+
return userForm.component_type === componentTypeId;
|
|
3250
|
+
});
|
|
3251
|
+
}
|
|
3252
|
+
)
|
|
3253
|
+
);
|
|
3244
3254
|
const selectLatestRevisionByFormId = createSelector([selectRevisionMapping], (revisions) => {
|
|
3245
3255
|
const latestRevisions = {};
|
|
3246
3256
|
for (const revision of Object.values(revisions)) {
|
|
@@ -5418,7 +5428,7 @@ class UserFormService extends BaseApiService {
|
|
|
5418
5428
|
});
|
|
5419
5429
|
});
|
|
5420
5430
|
}
|
|
5421
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization) {
|
|
5431
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentType) {
|
|
5422
5432
|
if (!!ownerUser === !!ownerOrganization) {
|
|
5423
5433
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
5424
5434
|
}
|
|
@@ -5436,6 +5446,7 @@ class UserFormService extends BaseApiService {
|
|
|
5436
5446
|
favorite: true,
|
|
5437
5447
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5438
5448
|
created_by: currentUser.id,
|
|
5449
|
+
...componentType && { component_type: componentType },
|
|
5439
5450
|
...ownerAttrs
|
|
5440
5451
|
};
|
|
5441
5452
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -5468,7 +5479,7 @@ class UserFormService extends BaseApiService {
|
|
|
5468
5479
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
5469
5480
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
5470
5481
|
}
|
|
5471
|
-
async addForOrganization(initialRevision) {
|
|
5482
|
+
async addForOrganization(initialRevision, componentType) {
|
|
5472
5483
|
const state = this.client.store.getState();
|
|
5473
5484
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
5474
5485
|
if (!activeOrganizationId) {
|
|
@@ -5479,13 +5490,14 @@ class UserFormService extends BaseApiService {
|
|
|
5479
5490
|
initialRevision,
|
|
5480
5491
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
5481
5492
|
void 0,
|
|
5482
|
-
activeOrganizationId
|
|
5493
|
+
activeOrganizationId,
|
|
5494
|
+
componentType
|
|
5483
5495
|
);
|
|
5484
5496
|
}
|
|
5485
|
-
async addForCurrentUser(initialRevision) {
|
|
5497
|
+
async addForCurrentUser(initialRevision, componentType) {
|
|
5486
5498
|
const state = this.client.store.getState();
|
|
5487
5499
|
const currentUser = state.userReducer.currentUser;
|
|
5488
|
-
return await this.add(state, initialRevision, "/forms/my-forms/", currentUser.id);
|
|
5500
|
+
return await this.add(state, initialRevision, "/forms/my-forms/", currentUser.id, void 0, componentType);
|
|
5489
5501
|
}
|
|
5490
5502
|
async createRevision(formId2, revision) {
|
|
5491
5503
|
const offlineRevision = offline(revision);
|
|
@@ -12020,6 +12032,7 @@ export {
|
|
|
12020
12032
|
selectFileAttachmentsOfIssue,
|
|
12021
12033
|
selectFilteredUserForms,
|
|
12022
12034
|
selectFormRevision,
|
|
12035
|
+
selectFormsForComponentType,
|
|
12023
12036
|
selectHiddenCategoryCount,
|
|
12024
12037
|
selectHiddenComponentTypeIds,
|
|
12025
12038
|
selectIsFetchingInitialData,
|