@overmap-ai/core 1.0.38-component-fields.9 → 1.0.38-component-fields.10
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 +41 -8
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +41 -8
- 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
|
@@ -3291,6 +3291,24 @@ const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithA
|
|
|
3291
3291
|
}
|
|
3292
3292
|
)
|
|
3293
3293
|
);
|
|
3294
|
+
const selectLatestRevisionsForComponentStageForms = restructureCreateSelectorWithArgs(
|
|
3295
|
+
createSelector(
|
|
3296
|
+
[
|
|
3297
|
+
selectUserFormMapping,
|
|
3298
|
+
selectRevisionMapping,
|
|
3299
|
+
(_state, componentStageId) => componentStageId
|
|
3300
|
+
],
|
|
3301
|
+
(userForms, revisions, componentStageId) => {
|
|
3302
|
+
const latestRevisions = [];
|
|
3303
|
+
for (const form of Object.values(userForms)) {
|
|
3304
|
+
if (form.component_stage === componentStageId) {
|
|
3305
|
+
latestRevisions.push(_selectLatestFormRevision(revisions, form.offline_id));
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
return latestRevisions;
|
|
3309
|
+
}
|
|
3310
|
+
)
|
|
3311
|
+
);
|
|
3294
3312
|
const selectLatestRevisionByFormId = createSelector([selectRevisionMapping], (revisions) => {
|
|
3295
3313
|
const latestRevisions = {};
|
|
3296
3314
|
for (const revision of Object.values(revisions)) {
|
|
@@ -5468,10 +5486,13 @@ class UserFormService extends BaseApiService {
|
|
|
5468
5486
|
});
|
|
5469
5487
|
});
|
|
5470
5488
|
}
|
|
5471
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization,
|
|
5489
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, componentStageId) {
|
|
5472
5490
|
if (!!ownerUser === !!ownerOrganization) {
|
|
5473
5491
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
5474
5492
|
}
|
|
5493
|
+
if (componentTypeId && componentStageId) {
|
|
5494
|
+
throw new Error("At most one of componentTypeId and componentStageId should be defined.");
|
|
5495
|
+
}
|
|
5475
5496
|
const ownerAttrs = {
|
|
5476
5497
|
owner_user: ownerUser,
|
|
5477
5498
|
owner_organization: ownerOrganization
|
|
@@ -5486,7 +5507,8 @@ class UserFormService extends BaseApiService {
|
|
|
5486
5507
|
favorite: true,
|
|
5487
5508
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5488
5509
|
created_by: currentUser.id,
|
|
5489
|
-
...
|
|
5510
|
+
...componentTypeId && { component_type: componentTypeId },
|
|
5511
|
+
...componentStageId && { component_stage: componentStageId },
|
|
5490
5512
|
...ownerAttrs
|
|
5491
5513
|
};
|
|
5492
5514
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -5508,10 +5530,11 @@ class UserFormService extends BaseApiService {
|
|
|
5508
5530
|
} : void 0,
|
|
5509
5531
|
payload: {
|
|
5510
5532
|
...offlineFormPayload,
|
|
5511
|
-
...
|
|
5533
|
+
...componentTypeId && { component_type: componentTypeId },
|
|
5534
|
+
...componentStageId && { component_stage: componentStageId },
|
|
5512
5535
|
initial_revision: payloadWithoutImage
|
|
5513
5536
|
},
|
|
5514
|
-
blockers: [],
|
|
5537
|
+
blockers: [componentTypeId, componentStageId].filter((x) => x !== void 0),
|
|
5515
5538
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
5516
5539
|
});
|
|
5517
5540
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -5523,7 +5546,7 @@ class UserFormService extends BaseApiService {
|
|
|
5523
5546
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
5524
5547
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
5525
5548
|
}
|
|
5526
|
-
async addForOrganization(initialRevision,
|
|
5549
|
+
async addForOrganization(initialRevision, componentTypeId, componentStageId) {
|
|
5527
5550
|
const state = this.client.store.getState();
|
|
5528
5551
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
5529
5552
|
if (!activeOrganizationId) {
|
|
@@ -5535,13 +5558,22 @@ class UserFormService extends BaseApiService {
|
|
|
5535
5558
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
5536
5559
|
void 0,
|
|
5537
5560
|
activeOrganizationId,
|
|
5538
|
-
|
|
5561
|
+
componentTypeId,
|
|
5562
|
+
componentStageId
|
|
5539
5563
|
);
|
|
5540
5564
|
}
|
|
5541
|
-
async addForCurrentUser(initialRevision,
|
|
5565
|
+
async addForCurrentUser(initialRevision, componentTypeId, componentStageId) {
|
|
5542
5566
|
const state = this.client.store.getState();
|
|
5543
5567
|
const currentUser = state.userReducer.currentUser;
|
|
5544
|
-
return await this.add(
|
|
5568
|
+
return await this.add(
|
|
5569
|
+
state,
|
|
5570
|
+
initialRevision,
|
|
5571
|
+
"/forms/my-forms/",
|
|
5572
|
+
currentUser.id,
|
|
5573
|
+
void 0,
|
|
5574
|
+
componentTypeId,
|
|
5575
|
+
componentStageId
|
|
5576
|
+
);
|
|
5545
5577
|
}
|
|
5546
5578
|
async createRevision(formId2, revision) {
|
|
5547
5579
|
const offlineRevision = offline(revision);
|
|
@@ -12102,6 +12134,7 @@ export {
|
|
|
12102
12134
|
selectLatestFormRevision,
|
|
12103
12135
|
selectLatestRetryTime,
|
|
12104
12136
|
selectLatestRevisionByFormId,
|
|
12137
|
+
selectLatestRevisionsForComponentStageForms,
|
|
12105
12138
|
selectLatestRevisionsForComponentTypeForms,
|
|
12106
12139
|
selectLatestRevisionsFromComponentTypeIds,
|
|
12107
12140
|
selectMainWorkspace,
|