@overmap-ai/core 1.0.60-sdk-refactor.16 → 1.0.60-sdk-refactor.19

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.
Files changed (29) hide show
  1. package/dist/overmap-core.js +104 -169
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +104 -169
  4. package/dist/overmap-core.umd.cjs.map +1 -1
  5. package/dist/sdk/services/AgentService.d.ts +1 -1
  6. package/dist/sdk/services/AssetService.d.ts +1 -1
  7. package/dist/sdk/services/AssetStageCompletionService.d.ts +1 -1
  8. package/dist/sdk/services/AssetStageService.d.ts +1 -1
  9. package/dist/sdk/services/AssetTypeService.d.ts +1 -1
  10. package/dist/sdk/services/BaseAttachmentService.d.ts +1 -1
  11. package/dist/sdk/services/CategoryService.d.ts +1 -1
  12. package/dist/sdk/services/DocumentService.d.ts +1 -1
  13. package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
  14. package/dist/sdk/services/IssueCommentService.d.ts +1 -1
  15. package/dist/sdk/services/IssueService.d.ts +1 -1
  16. package/dist/sdk/services/IssueTypeService.d.ts +2 -2
  17. package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
  18. package/dist/sdk/services/LicenseService.d.ts +1 -1
  19. package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
  20. package/dist/sdk/services/OrganizationService.d.ts +2 -3
  21. package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
  22. package/dist/sdk/services/ProjectFileService.d.ts +1 -1
  23. package/dist/sdk/services/TeamService.d.ts +2 -2
  24. package/dist/sdk/services/UserFormService.d.ts +1 -1
  25. package/dist/sdk/services/UserFormSubmissionService.d.ts +1 -1
  26. package/dist/sdk/services/UserService.d.ts +6 -0
  27. package/dist/sdk/services/WorkspaceService.d.ts +1 -0
  28. package/dist/typings/models/organizations.d.ts +0 -11
  29. package/package.json +1 -1
@@ -15462,9 +15462,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15462
15462
  }
15463
15463
  if (!response.access)
15464
15464
  throw new Error("Missing access token");
15465
- if (!response.refresh)
15466
- throw new Error("Missing refresh token");
15467
- return { accessToken: response.access, refreshToken: response.refresh };
15465
+ return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
15468
15466
  });
15469
15467
  }
15470
15468
  /**
@@ -15650,12 +15648,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15650
15648
  blocks: []
15651
15649
  });
15652
15650
  }
15653
- async refreshStore() {
15654
- const { store } = this.client;
15655
- const projectId = store.getState().projectReducer.activeProjectId;
15656
- if (!projectId) {
15657
- throw new Error("No active project");
15658
- }
15651
+ async refreshStore(projectId) {
15659
15652
  const result = await this.enqueueRequest({
15660
15653
  description: "Get categories",
15661
15654
  method: HttpMethod.GET,
@@ -15799,16 +15792,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15799
15792
  });
15800
15793
  return batchPromises;
15801
15794
  }
15802
- async refreshStore() {
15803
- const { store } = this.client;
15795
+ async refreshStore(projectId) {
15804
15796
  const result = await this.enqueueRequest({
15805
15797
  description: "Get assets",
15806
15798
  method: HttpMethod.GET,
15807
- url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
15799
+ url: `/projects/${projectId}/assets/`,
15808
15800
  blockers: [],
15809
15801
  blocks: []
15810
15802
  });
15811
- store.dispatch(initializeAssets(result));
15803
+ this.dispatch(initializeAssets(result));
15812
15804
  }
15813
15805
  }
15814
15806
  class AssetStageCompletionService extends BaseApiService {
@@ -15835,12 +15827,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15835
15827
  });
15836
15828
  return [offlineStageCompletion, promise];
15837
15829
  }
15838
- async refreshStore() {
15839
- const { store } = this.client;
15830
+ async refreshStore(projectId) {
15840
15831
  const result = await this.enqueueRequest({
15841
15832
  description: "Get stage completions",
15842
15833
  method: HttpMethod.GET,
15843
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
15834
+ url: `/projects/${projectId}/asset-stage-completions/`,
15844
15835
  blockers: [],
15845
15836
  blocks: []
15846
15837
  });
@@ -16008,12 +15999,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16008
15999
  throw e;
16009
16000
  }
16010
16001
  }
16011
- async refreshStore() {
16012
- const { store } = this.client;
16002
+ async refreshStore(projectId) {
16013
16003
  const result = await this.enqueueRequest({
16014
16004
  description: "Get asset stages",
16015
16005
  method: HttpMethod.GET,
16016
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
16006
+ url: `/projects/${projectId}/asset-stages/`,
16017
16007
  blockers: [],
16018
16008
  blocks: []
16019
16009
  });
@@ -16174,14 +16164,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16174
16164
  }
16175
16165
  // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
16176
16166
  // so for some attachment model services, this method will have to be overridden.
16177
- async refreshStore() {
16178
- const { store } = this.client;
16179
- const activeProjectId = store.getState().projectReducer.activeProjectId;
16167
+ async refreshStore(projectId) {
16180
16168
  const meta = AttachmentModelMeta[this.attachmentModel];
16181
16169
  const result = await this.enqueueRequest({
16182
16170
  description: `Get ${meta.name} attachments`,
16183
16171
  method: HttpMethod.GET,
16184
- url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
16172
+ url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
16185
16173
  blocks: [],
16186
16174
  blockers: []
16187
16175
  });
@@ -16277,12 +16265,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16277
16265
  throw e;
16278
16266
  });
16279
16267
  }
16280
- async refreshStore() {
16281
- const { store } = this.client;
16268
+ async refreshStore(projectId) {
16282
16269
  const result = await this.enqueueRequest({
16283
16270
  description: "Get asset types",
16284
16271
  method: HttpMethod.GET,
16285
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
16272
+ url: `/projects/${projectId}/asset-types/`,
16286
16273
  blockers: [],
16287
16274
  blocks: []
16288
16275
  });
@@ -16381,13 +16368,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16381
16368
  });
16382
16369
  return promise;
16383
16370
  }
16384
- async refreshStore() {
16385
- const { store } = this.client;
16371
+ async refreshStore(projectId) {
16386
16372
  const result = await this.enqueueRequest({
16387
16373
  description: "Get comments",
16388
16374
  method: HttpMethod.GET,
16389
- // TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
16390
- url: `/projects/${store.getState().projectReducer.activeProjectId}/comments/`,
16375
+ url: `/projects/${projectId}/comments/`,
16391
16376
  blockers: [],
16392
16377
  blocks: []
16393
16378
  });
@@ -16395,12 +16380,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16395
16380
  }
16396
16381
  }
16397
16382
  class IssueUpdateService extends BaseApiService {
16398
- async refreshStore() {
16399
- const { store } = this.client;
16383
+ async refreshStore(projectId) {
16400
16384
  const result = await this.enqueueRequest({
16401
16385
  description: "Get issue updates",
16402
16386
  method: HttpMethod.GET,
16403
- url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
16387
+ url: `/projects/${projectId}/issues/updates/`,
16404
16388
  blockers: [],
16405
16389
  blocks: []
16406
16390
  });
@@ -16631,12 +16615,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16631
16615
  }
16632
16616
  }
16633
16617
  // Special functions
16634
- async refreshStore() {
16635
- const { store } = this.client;
16636
- const projectId = store.getState().projectReducer.activeProjectId;
16637
- if (!projectId) {
16638
- throw new Error("No active project");
16639
- }
16618
+ async refreshStore(projectId) {
16640
16619
  const result = await this.enqueueRequest({
16641
16620
  description: "Get issues",
16642
16621
  method: HttpMethod.GET,
@@ -16657,23 +16636,19 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16657
16636
  }
16658
16637
  }
16659
16638
  class IssueTypeService extends BaseApiService {
16660
- add(payload) {
16639
+ add(payload, organizationId) {
16661
16640
  const { store } = this.client;
16662
16641
  const state = store.getState();
16663
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
16664
- if (!activeOrganizationId) {
16665
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16666
- }
16667
16642
  const offlineIssueType = offline({
16668
16643
  ...payload,
16669
16644
  submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
16670
16645
  created_by: state.userReducer.currentUser.id,
16671
- organization: activeOrganizationId
16646
+ organization: organizationId
16672
16647
  });
16673
16648
  this.dispatch(addIssueType(offlineIssueType));
16674
16649
  const promise = this.enqueueRequest({
16675
16650
  method: HttpMethod.POST,
16676
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16651
+ url: `/organizations/${organizationId}/issue-types/`,
16677
16652
  // Sending only whats needed here
16678
16653
  payload: {
16679
16654
  offline_id: offlineIssueType.offline_id,
@@ -16741,15 +16716,10 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16741
16716
  });
16742
16717
  return promise;
16743
16718
  }
16744
- async refreshStore() {
16745
- const { store } = this.client;
16746
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
16747
- if (!activeOrganizationId) {
16748
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16749
- }
16719
+ async refreshStore(organizationId) {
16750
16720
  const result = await this.enqueueRequest({
16751
16721
  method: HttpMethod.GET,
16752
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16722
+ url: `/organizations/${organizationId}/issue-types/`,
16753
16723
  blockers: [],
16754
16724
  blocks: []
16755
16725
  });
@@ -16788,25 +16758,18 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16788
16758
  blocks: []
16789
16759
  });
16790
16760
  }
16791
- async refreshStore() {
16792
- const { store } = this.client;
16793
- const state = store.getState();
16794
- const projectId = state.projectReducer.activeProjectId;
16795
- if (!projectId) {
16796
- throw new Error("No active project");
16797
- }
16761
+ async refreshStore(projectId) {
16798
16762
  const promise = this.fetchAll(projectId);
16799
16763
  const result = await promise;
16800
16764
  this.dispatch(setProjectAccesses(result));
16801
16765
  }
16802
16766
  }
16803
16767
  class ProjectFileService extends BaseApiService {
16804
- async refreshStore() {
16805
- const { store } = this.client;
16768
+ async refreshStore(projectId) {
16806
16769
  const result = await this.enqueueRequest({
16807
16770
  description: "Get project files",
16808
16771
  method: HttpMethod.GET,
16809
- url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
16772
+ url: `/projects/${projectId}/files/`,
16810
16773
  blockers: [],
16811
16774
  blocks: []
16812
16775
  });
@@ -16944,10 +16907,6 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16944
16907
  throw new Error("Project type was not chosen when trying to create a project");
16945
16908
  }
16946
16909
  const isOrganizationProject = !!project.owner_organization;
16947
- const activeOrganization = this.client.store.getState().organizationReducer.activeOrganizationId;
16948
- if (isOrganizationProject && (!activeOrganization || project.owner_organization !== activeOrganization)) {
16949
- throw new Error("User tried creating organization project for organization they do not belong to.");
16950
- }
16951
16910
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
16952
16911
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
16953
16912
  const result = await this.enqueueRequest({
@@ -17334,20 +17293,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17334
17293
  throw e;
17335
17294
  }
17336
17295
  }
17337
- async refreshStore() {
17338
- const { store } = this.client;
17339
- const activeProjectId = store.getState().projectReducer.activeProjectId;
17340
- if (!activeProjectId) {
17341
- throw new Error("No active project");
17342
- }
17296
+ async refreshStore(projectId) {
17343
17297
  const forms = [];
17344
17298
  const revisions = [];
17345
17299
  const attachments = [];
17346
17300
  const projectFormsResult = await this.enqueueRequest({
17347
17301
  description: "Fetch project forms",
17348
17302
  method: HttpMethod.GET,
17349
- url: `/projects/${activeProjectId}/forms/`,
17350
- blockers: [activeProjectId.toString()],
17303
+ url: `/projects/${projectId}/forms/`,
17304
+ blockers: [projectId.toString()],
17351
17305
  blocks: []
17352
17306
  });
17353
17307
  for (const form of projectFormsResult.forms)
@@ -17359,8 +17313,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17359
17313
  const organizationFormsResult = await this.enqueueRequest({
17360
17314
  description: "Fetch organization forms",
17361
17315
  method: HttpMethod.GET,
17362
- url: `/projects/${activeProjectId}/organizations/forms/`,
17363
- blockers: [activeProjectId.toString()],
17316
+ url: `/projects/${projectId}/organizations/forms/`,
17317
+ blockers: [projectId.toString()],
17364
17318
  blocks: []
17365
17319
  });
17366
17320
  for (const form of organizationFormsResult.forms)
@@ -17372,8 +17326,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17372
17326
  const assetTypeFormsResult = await this.enqueueRequest({
17373
17327
  description: "Fetch asset type forms",
17374
17328
  method: HttpMethod.GET,
17375
- url: `/projects/${activeProjectId}/asset-types/forms/`,
17376
- blockers: [activeProjectId.toString()],
17329
+ url: `/projects/${projectId}/asset-types/forms/`,
17330
+ blockers: [projectId.toString()],
17377
17331
  blocks: []
17378
17332
  });
17379
17333
  for (const form of assetTypeFormsResult.forms)
@@ -17385,8 +17339,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17385
17339
  const issueTypeFormsResult = await this.enqueueRequest({
17386
17340
  description: "Fetch issue type forms",
17387
17341
  method: HttpMethod.GET,
17388
- url: `/projects/${activeProjectId}/issue-types/forms/`,
17389
- blockers: [activeProjectId.toString()],
17342
+ url: `/projects/${projectId}/issue-types/forms/`,
17343
+ blockers: [projectId.toString()],
17390
17344
  blocks: []
17391
17345
  });
17392
17346
  for (const form of issueTypeFormsResult.forms)
@@ -17669,9 +17623,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17669
17623
  throw e;
17670
17624
  }
17671
17625
  }
17672
- async refreshStore() {
17673
- const { store } = this.client;
17674
- const projectId = store.getState().projectReducer.activeProjectId;
17626
+ async refreshStore(projectId) {
17675
17627
  const submissions = await this.enqueueRequest({
17676
17628
  description: "Fetch form submissions",
17677
17629
  method: HttpMethod.GET,
@@ -17742,6 +17694,16 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17742
17694
  });
17743
17695
  return promise;
17744
17696
  }
17697
+ async refreshStore(projectId) {
17698
+ const result = await this.enqueueRequest({
17699
+ description: "Get workspaces",
17700
+ method: HttpMethod.GET,
17701
+ url: `/projects/${projectId}/workspaces/`,
17702
+ blockers: [],
17703
+ blocks: []
17704
+ });
17705
+ this.dispatch(initializeWorkspaces(result));
17706
+ }
17745
17707
  }
17746
17708
  class OrganizationAccessService extends BaseApiService {
17747
17709
  async update(organizationAccess) {
@@ -17769,13 +17731,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17769
17731
  blocks: []
17770
17732
  });
17771
17733
  }
17772
- async refreshStore() {
17773
- const { store } = this.client;
17774
- const state = store.getState();
17775
- const organizationId = state.organizationReducer.activeOrganizationId;
17776
- if (!organizationId) {
17777
- return;
17778
- }
17734
+ async refreshStore(organizationId) {
17779
17735
  const result = await this.enqueueRequest({
17780
17736
  description: "Get organization accesses",
17781
17737
  method: HttpMethod.GET,
@@ -18040,11 +17996,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18040
17996
  throw e;
18041
17997
  });
18042
17998
  }
18043
- async refreshStore() {
18044
- const organizationId = this.client.store.getState().organizationReducer.activeOrganizationId;
18045
- if (!organizationId) {
18046
- throw new Error("No active organization");
18047
- }
17999
+ async refreshStore(organizationId) {
18048
18000
  const result = await this.enqueueRequest({
18049
18001
  description: "Fetch email domains for organization",
18050
18002
  method: HttpMethod.GET,
@@ -18056,36 +18008,6 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18056
18008
  }
18057
18009
  }
18058
18010
  class OrganizationService extends BaseApiService {
18059
- async fetchInitialOrganizationData(organizationId, showLoading) {
18060
- if (showLoading) {
18061
- this.dispatch(setIsFetchingInitialData(true));
18062
- }
18063
- return this.enqueueRequest({
18064
- description: "Get initial organization data",
18065
- method: HttpMethod.GET,
18066
- url: `/organizations/${organizationId}/initial-data/`,
18067
- payload: {},
18068
- isAuthNeeded: true,
18069
- blockers: [],
18070
- blocks: [organizationId.toString()]
18071
- }).then((result) => {
18072
- this._processInitialOrganizationData(result, showLoading);
18073
- return result;
18074
- });
18075
- }
18076
- _processInitialOrganizationData(data, showLoading) {
18077
- const activeOrganization = data.organization;
18078
- const organizationAccesses = data.organization_accesses;
18079
- const emailDomains = data.email_domains;
18080
- const users = data.users;
18081
- this.dispatch(addUsers(users));
18082
- this.dispatch(setActiveOrganizationId(activeOrganization.id));
18083
- this.dispatch(initializeOrganizationAccesses(organizationAccesses));
18084
- this.dispatch(initializeEmailDomains(emailDomains));
18085
- if (showLoading) {
18086
- this.dispatch(setIsFetchingInitialData(false));
18087
- }
18088
- }
18089
18011
  create(name) {
18090
18012
  return this.enqueueRequest({
18091
18013
  description: "Create organization",
@@ -18119,26 +18041,30 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18119
18041
  blocks: []
18120
18042
  });
18121
18043
  }
18122
- }
18123
- class LicenseService extends BaseApiService {
18124
- async fetchLicensesForOrganization(organizationId, showLoading = false) {
18125
- if (showLoading) {
18126
- this.dispatch(setIsFetchingInitialData(true));
18127
- }
18128
- const result = await this.enqueueRequest({
18129
- description: "Get licenses",
18044
+ async refreshStore(projectId, organizationId) {
18045
+ const organizationsRecord = {};
18046
+ const projectOrganizations = await this.enqueueRequest({
18047
+ description: "Get organizations",
18130
18048
  method: HttpMethod.GET,
18131
- url: `/organizations/${organizationId}/licenses/`,
18132
- isAuthNeeded: true,
18133
- blockers: [organizationId.toString()],
18134
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18049
+ url: `/projects/${projectId}/organizations/`,
18050
+ blockers: [],
18051
+ blocks: []
18135
18052
  });
18136
- if (showLoading) {
18137
- this.dispatch(setIsFetchingInitialData(false));
18053
+ for (const organization2 of projectOrganizations) {
18054
+ organizationsRecord[organization2.id] = organization2;
18138
18055
  }
18139
- this.dispatch(addLicenses(result));
18140
- return result;
18056
+ const organization = await this.enqueueRequest({
18057
+ description: "Get organization",
18058
+ method: HttpMethod.GET,
18059
+ url: `/organizations/${organizationId}/`,
18060
+ blockers: [],
18061
+ blocks: []
18062
+ });
18063
+ organizationsRecord[organization.id] = organization;
18064
+ this.dispatch(setOrganizations(Object.values(organizationsRecord)));
18141
18065
  }
18066
+ }
18067
+ class LicenseService extends BaseApiService {
18142
18068
  async getLicense(license) {
18143
18069
  const result = await this.enqueueRequest({
18144
18070
  description: "Get license",
@@ -18235,6 +18161,32 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18235
18161
  blocks: [license.offline_id]
18236
18162
  });
18237
18163
  }
18164
+ async refreshStore(projectId, organizationId) {
18165
+ const licencesRecord = {};
18166
+ const organizationLicences = await this.enqueueRequest({
18167
+ description: "Get licenses",
18168
+ method: HttpMethod.GET,
18169
+ url: `/organizations/${organizationId}/licenses/`,
18170
+ isAuthNeeded: true,
18171
+ blockers: [organizationId.toString()],
18172
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18173
+ });
18174
+ for (const license of organizationLicences) {
18175
+ licencesRecord[license.offline_id] = license;
18176
+ }
18177
+ const projectLicences = await this.enqueueRequest({
18178
+ description: "Get licenses",
18179
+ method: HttpMethod.GET,
18180
+ url: `/projects/${projectId}/licenses/`,
18181
+ isAuthNeeded: true,
18182
+ blockers: [projectId.toString()],
18183
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18184
+ });
18185
+ for (const license of projectLicences) {
18186
+ licencesRecord[license.offline_id] = license;
18187
+ }
18188
+ this.dispatch(setLicenses(Object.values(licencesRecord)));
18189
+ }
18238
18190
  }
18239
18191
  class DocumentService extends BaseApiService {
18240
18192
  // TODO: Support adding for project or organization
@@ -18367,22 +18319,18 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18367
18319
  });
18368
18320
  return promise;
18369
18321
  }
18370
- async refreshStore() {
18371
- const { store } = this.client;
18372
- const state = store.getState();
18373
- const activeProjectId = state.projectReducer.activeProjectId;
18322
+ async refreshStore(projectId, organizationId) {
18374
18323
  const projectDocumentsPromise = this.enqueueRequest({
18375
18324
  description: "Get project documents",
18376
18325
  method: HttpMethod.GET,
18377
- url: `/projects/${activeProjectId}/documents/`,
18326
+ url: `/projects/${projectId}/documents/`,
18378
18327
  blockers: [],
18379
18328
  blocks: []
18380
18329
  });
18381
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18382
18330
  const organizationDocumentsPromise = this.enqueueRequest({
18383
18331
  description: "Get organization documents",
18384
18332
  method: HttpMethod.GET,
18385
- url: `/organizations/${activeOrganizationId}/documents/`,
18333
+ url: `/organizations/${organizationId}/documents/`,
18386
18334
  blockers: [],
18387
18335
  blocks: []
18388
18336
  });
@@ -18495,13 +18443,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18495
18443
  blocks: ["rate"]
18496
18444
  });
18497
18445
  }
18498
- async refreshStore() {
18499
- const { store } = this.client;
18500
- const activeProject = store.getState().projectReducer.activeProjectId;
18446
+ async refreshStore(projectId) {
18501
18447
  const result = await this.enqueueRequest({
18502
18448
  description: "Get agent conversation history",
18503
18449
  method: HttpMethod.GET,
18504
- url: `/projects/${activeProject}/agent-conversations/`,
18450
+ url: `/projects/${projectId}/agent-conversations/`,
18505
18451
  blockers: ["agent-conversations"],
18506
18452
  blocks: ["agent-conversations"]
18507
18453
  });
@@ -18509,16 +18455,10 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18509
18455
  }
18510
18456
  }
18511
18457
  class TeamService extends BaseApiService {
18512
- add(teamPayload) {
18513
- const { store } = this.client;
18514
- const state = store.getState();
18515
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18516
- if (!activeOrganizationId) {
18517
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18518
- }
18458
+ add(teamPayload, organizationId) {
18519
18459
  const offlineTeam = offline({
18520
18460
  ...teamPayload,
18521
- organization: activeOrganizationId,
18461
+ organization: organizationId,
18522
18462
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
18523
18463
  // TODO: uncomment once supported
18524
18464
  // created_by: state.userReducer.currentUser.id,
@@ -18527,7 +18467,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18527
18467
  const promise = this.enqueueRequest({
18528
18468
  description: "Create team",
18529
18469
  method: HttpMethod.POST,
18530
- url: `/organizations/${activeOrganizationId}/teams/`,
18470
+ url: `/organizations/${organizationId}/teams/`,
18531
18471
  payload: offlineTeam,
18532
18472
  // No blocks since users and organizations are not offline
18533
18473
  blockers: [],
@@ -18631,16 +18571,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18631
18571
  const newMembers = team.members.filter((member) => !members.includes(member));
18632
18572
  return this.setMembers(teamId, newMembers);
18633
18573
  }
18634
- async refreshStore() {
18635
- const { store } = this.client;
18636
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
18637
- if (!activeOrganizationId) {
18638
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18639
- }
18574
+ async refreshStore(organizationId) {
18640
18575
  const result = await this.enqueueRequest({
18641
18576
  description: "Fetch teams",
18642
18577
  method: HttpMethod.GET,
18643
- url: `/organizations/${activeOrganizationId}/teams/`,
18578
+ url: `/organizations/${organizationId}/teams/`,
18644
18579
  blockers: [],
18645
18580
  blocks: []
18646
18581
  });