@overmap-ai/core 1.0.53-team-links.0 → 1.0.53-team-links.1

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.
@@ -7143,6 +7143,7 @@ var __publicField = (obj, key, value) => {
7143
7143
  });
7144
7144
  void this.client.userForms.refreshStore().then(() => {
7145
7145
  void this.client.userFormSubmissions.refreshStore().then();
7146
+ void this.client.userFormTeamLinks.refreshStore().then();
7146
7147
  });
7147
7148
  }
7148
7149
  if (currentProjectId) {
@@ -7161,9 +7162,13 @@ var __publicField = (obj, key, value) => {
7161
7162
  store.dispatch(setProjectAttachments(project_attachments));
7162
7163
  store.dispatch(setDocumentAttachments(document_attachments));
7163
7164
  });
7164
- void this.client.documents.refreshStore();
7165
+ void this.client.documents.refreshStore().then(() => {
7166
+ void this.client.documentTeamLinks.refreshStore().then();
7167
+ });
7165
7168
  void this.client.issueUpdates.refreshStore();
7166
- void this.client.issueTypes.refreshStore();
7169
+ void this.client.issueTypes.refreshStore().then(() => {
7170
+ void this.client.issueTypeTeamLinks.refreshStore().then();
7171
+ });
7167
7172
  }
7168
7173
  store.dispatch(setIsFetchingInitialData(false));
7169
7174
  if (overwrite) {
@@ -8957,6 +8962,116 @@ var __publicField = (obj, key, value) => {
8957
8962
  store.dispatch(setDocumentTeamLinks(result));
8958
8963
  }
8959
8964
  }
8965
+ class IssueTypeTeamLinkService extends BaseApiService {
8966
+ add(payload) {
8967
+ const { store } = this.client;
8968
+ const offlineIssueTypeTeamLink = offline({
8969
+ ...payload,
8970
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8971
+ });
8972
+ store.dispatch(addIssueTypeTeamLink(offlineIssueTypeTeamLink));
8973
+ const promise = this.enqueueRequest({
8974
+ method: HttpMethod.POST,
8975
+ url: `/organizations/teams/${payload.team}/link-issue-type/`,
8976
+ payload: offlineIssueTypeTeamLink,
8977
+ blockers: [payload.team, payload.issue_type],
8978
+ blocks: [offlineIssueTypeTeamLink.offline_id]
8979
+ });
8980
+ promise.then((createdIssueTypeLink) => {
8981
+ store.dispatch(setIssueTypeTeamLink(createdIssueTypeLink));
8982
+ }).catch(() => {
8983
+ store.dispatch(deleteIssueTypeTeamLink(offlineIssueTypeTeamLink.offline_id));
8984
+ });
8985
+ return [offlineIssueTypeTeamLink, promise];
8986
+ }
8987
+ delete(issueTypeTeamLinkId) {
8988
+ const { store } = this.client;
8989
+ const issueTypeTeamLink = store.getState().issueTypeTeamLinkReducer.issueTypeTeamLinks[issueTypeTeamLinkId];
8990
+ if (!issueTypeTeamLink) {
8991
+ throw new Error(`No issue type team link found for ${issueTypeTeamLinkId}`);
8992
+ }
8993
+ store.dispatch(deleteIssueTypeTeamLink(issueTypeTeamLinkId));
8994
+ const promise = this.enqueueRequest({
8995
+ method: HttpMethod.DELETE,
8996
+ url: `/organizations/teams/issue-type-links/${issueTypeTeamLinkId}/`,
8997
+ blockers: [issueTypeTeamLink.offline_id],
8998
+ blocks: [issueTypeTeamLink.offline_id]
8999
+ });
9000
+ promise.catch(() => {
9001
+ store.dispatch(setIssueTypeTeamLink(issueTypeTeamLink));
9002
+ });
9003
+ return promise;
9004
+ }
9005
+ async refreshStore() {
9006
+ const { store } = this.client;
9007
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9008
+ if (!activeOrganizationId) {
9009
+ throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9010
+ }
9011
+ const result = await this.enqueueRequest({
9012
+ method: HttpMethod.GET,
9013
+ url: `/organizations/${activeOrganizationId}/teams/issue-type-links/`,
9014
+ blockers: [],
9015
+ blocks: []
9016
+ });
9017
+ store.dispatch(setIssueTypeTeamLinks(result));
9018
+ }
9019
+ }
9020
+ class UserFormTeamLinkService extends BaseApiService {
9021
+ add(payload) {
9022
+ const { store } = this.client;
9023
+ const offlineUserFormTeamLink = offline({
9024
+ ...payload,
9025
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
9026
+ });
9027
+ store.dispatch(addUserFormTeamLink(offlineUserFormTeamLink));
9028
+ const promise = this.enqueueRequest({
9029
+ method: HttpMethod.POST,
9030
+ url: `/organizations/teams/${payload.team}/link-form/`,
9031
+ payload: offlineUserFormTeamLink,
9032
+ blockers: [payload.team, payload.form],
9033
+ blocks: [offlineUserFormTeamLink.offline_id]
9034
+ });
9035
+ promise.then((createdUserFormLink) => {
9036
+ store.dispatch(setUserFormTeamLink(createdUserFormLink));
9037
+ }).catch(() => {
9038
+ store.dispatch(deleteUserFormTeamLink(offlineUserFormTeamLink.offline_id));
9039
+ });
9040
+ return [offlineUserFormTeamLink, promise];
9041
+ }
9042
+ delete(userFormTeamLinkId) {
9043
+ const { store } = this.client;
9044
+ const userFormTeamLink = store.getState().userFormTeamLinkReducer.userFormTeamLinks[userFormTeamLinkId];
9045
+ if (!userFormTeamLink) {
9046
+ throw new Error(`No user form team link found for ${userFormTeamLinkId}`);
9047
+ }
9048
+ store.dispatch(deleteUserFormTeamLink(userFormTeamLinkId));
9049
+ const promise = this.enqueueRequest({
9050
+ method: HttpMethod.DELETE,
9051
+ url: `/organizations/teams/form-links/${userFormTeamLinkId}/`,
9052
+ blockers: [userFormTeamLink.offline_id],
9053
+ blocks: [userFormTeamLink.offline_id]
9054
+ });
9055
+ promise.catch(() => {
9056
+ store.dispatch(setUserFormTeamLink(userFormTeamLink));
9057
+ });
9058
+ return promise;
9059
+ }
9060
+ async refreshStore() {
9061
+ const { store } = this.client;
9062
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9063
+ if (!activeOrganizationId) {
9064
+ throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9065
+ }
9066
+ const result = await this.enqueueRequest({
9067
+ method: HttpMethod.GET,
9068
+ url: `/organizations/${activeOrganizationId}/teams/form-links/`,
9069
+ blockers: [],
9070
+ blocks: []
9071
+ });
9072
+ store.dispatch(setUserFormTeamLinks(result));
9073
+ }
9074
+ }
8960
9075
  class OvermapSDK {
8961
9076
  constructor(apiUrl, store) {
8962
9077
  __publicField(this, "API_URL");
@@ -8989,6 +9104,8 @@ var __publicField = (obj, key, value) => {
8989
9104
  __publicField(this, "documents", new DocumentService(this));
8990
9105
  __publicField(this, "teams", new TeamService(this));
8991
9106
  __publicField(this, "documentTeamLinks", new DocumentTeamLinkService(this));
9107
+ __publicField(this, "issueTypeTeamLinks", new IssueTypeTeamLinkService(this));
9108
+ __publicField(this, "userFormTeamLinks", new UserFormTeamLinkService(this));
8992
9109
  this.API_URL = apiUrl;
8993
9110
  this.store = store;
8994
9111
  }