@overmap-ai/core 1.0.51-issue-types.1 → 1.0.51-issue-types.3

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.
@@ -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
  });
@@ -6683,7 +6691,7 @@ class IssueTypeService extends BaseApiService {
6683
6691
  }
6684
6692
  const result = await this.enqueueRequest({
6685
6693
  method: HttpMethod.GET,
6686
- url: `/organizations/${activeOrganizationId}/issue_types/`,
6694
+ url: `/organizations/${activeOrganizationId}/issue-types/`,
6687
6695
  blockers: [],
6688
6696
  blocks: []
6689
6697
  });
@@ -7235,7 +7243,7 @@ class UserFormService extends BaseApiService {
7235
7243
  });
7236
7244
  });
7237
7245
  }
7238
- async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId) {
7246
+ async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, issueTypeId) {
7239
7247
  if (!!ownerUser === !!ownerOrganization) {
7240
7248
  throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
7241
7249
  }
@@ -7255,6 +7263,7 @@ class UserFormService extends BaseApiService {
7255
7263
  submitted_at: submittedAt,
7256
7264
  created_by: currentUser.id,
7257
7265
  ...componentTypeId && { component_type: componentTypeId },
7266
+ ...issueTypeId && { issue_type: issueTypeId },
7258
7267
  ...ownerAttrs
7259
7268
  };
7260
7269
  const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
@@ -7278,9 +7287,10 @@ class UserFormService extends BaseApiService {
7278
7287
  payload: {
7279
7288
  ...offlineFormPayload,
7280
7289
  ...componentTypeId && { component_type: componentTypeId },
7290
+ ...issueTypeId && { issue_type: issueTypeId },
7281
7291
  initial_revision: payloadWithoutImage
7282
7292
  },
7283
- blockers: componentTypeId ? [componentTypeId] : [],
7293
+ blockers: componentTypeId ? [componentTypeId] : issueTypeId ? [issueTypeId] : [],
7284
7294
  blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
7285
7295
  });
7286
7296
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
@@ -7292,7 +7302,7 @@ class UserFormService extends BaseApiService {
7292
7302
  const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
7293
7303
  return [retForm, retRevision, formPromise, settledPromise];
7294
7304
  }
7295
- async addForOrganization(initialRevision, componentTypeId) {
7305
+ async addForOrganization(initialRevision, attachedTo) {
7296
7306
  const state = this.client.store.getState();
7297
7307
  const activeOrganizationId = state.organizationReducer.activeOrganizationId;
7298
7308
  if (!activeOrganizationId) {
@@ -7304,13 +7314,22 @@ class UserFormService extends BaseApiService {
7304
7314
  `/forms/in-organization/${activeOrganizationId}/`,
7305
7315
  void 0,
7306
7316
  activeOrganizationId,
7307
- componentTypeId
7317
+ attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
7318
+ attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
7308
7319
  );
7309
7320
  }
7310
- async addForCurrentUser(initialRevision, componentTypeId) {
7321
+ async addForCurrentUser(initialRevision, attachedTo) {
7311
7322
  const state = this.client.store.getState();
7312
7323
  const currentUser = state.userReducer.currentUser;
7313
- return await this.add(state, initialRevision, "/forms/my-forms/", currentUser.id, void 0, componentTypeId);
7324
+ return await this.add(
7325
+ state,
7326
+ initialRevision,
7327
+ "/forms/my-forms/",
7328
+ currentUser.id,
7329
+ void 0,
7330
+ attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
7331
+ attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
7332
+ );
7314
7333
  }
7315
7334
  async createRevision(formId2, revision) {
7316
7335
  const offlineRevision = offline(revision);
@@ -16854,6 +16873,7 @@ export {
16854
16873
  selectForm,
16855
16874
  selectFormMapping,
16856
16875
  selectFormOfComponentType,
16876
+ selectFormOfIssueType,
16857
16877
  selectFormRevision,
16858
16878
  selectFormRevisionMapping,
16859
16879
  selectFormRevisions,