@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
@@ -15473,9 +15473,7 @@ class JWTService extends BaseAuthService {
15473
15473
  }
15474
15474
  if (!response.access)
15475
15475
  throw new Error("Missing access token");
15476
- if (!response.refresh)
15477
- throw new Error("Missing refresh token");
15478
- return { accessToken: response.access, refreshToken: response.refresh };
15476
+ return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
15479
15477
  });
15480
15478
  }
15481
15479
  /**
@@ -15661,12 +15659,7 @@ class CategoryService extends BaseApiService {
15661
15659
  blocks: []
15662
15660
  });
15663
15661
  }
15664
- async refreshStore() {
15665
- const { store } = this.client;
15666
- const projectId = store.getState().projectReducer.activeProjectId;
15667
- if (!projectId) {
15668
- throw new Error("No active project");
15669
- }
15662
+ async refreshStore(projectId) {
15670
15663
  const result = await this.enqueueRequest({
15671
15664
  description: "Get categories",
15672
15665
  method: HttpMethod.GET,
@@ -15810,16 +15803,15 @@ class AssetService extends BaseApiService {
15810
15803
  });
15811
15804
  return batchPromises;
15812
15805
  }
15813
- async refreshStore() {
15814
- const { store } = this.client;
15806
+ async refreshStore(projectId) {
15815
15807
  const result = await this.enqueueRequest({
15816
15808
  description: "Get assets",
15817
15809
  method: HttpMethod.GET,
15818
- url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
15810
+ url: `/projects/${projectId}/assets/`,
15819
15811
  blockers: [],
15820
15812
  blocks: []
15821
15813
  });
15822
- store.dispatch(initializeAssets(result));
15814
+ this.dispatch(initializeAssets(result));
15823
15815
  }
15824
15816
  }
15825
15817
  class AssetStageCompletionService extends BaseApiService {
@@ -15846,12 +15838,11 @@ class AssetStageCompletionService extends BaseApiService {
15846
15838
  });
15847
15839
  return [offlineStageCompletion, promise];
15848
15840
  }
15849
- async refreshStore() {
15850
- const { store } = this.client;
15841
+ async refreshStore(projectId) {
15851
15842
  const result = await this.enqueueRequest({
15852
15843
  description: "Get stage completions",
15853
15844
  method: HttpMethod.GET,
15854
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
15845
+ url: `/projects/${projectId}/asset-stage-completions/`,
15855
15846
  blockers: [],
15856
15847
  blocks: []
15857
15848
  });
@@ -16019,12 +16010,11 @@ class AssetStageService extends BaseApiService {
16019
16010
  throw e;
16020
16011
  }
16021
16012
  }
16022
- async refreshStore() {
16023
- const { store } = this.client;
16013
+ async refreshStore(projectId) {
16024
16014
  const result = await this.enqueueRequest({
16025
16015
  description: "Get asset stages",
16026
16016
  method: HttpMethod.GET,
16027
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
16017
+ url: `/projects/${projectId}/asset-stages/`,
16028
16018
  blockers: [],
16029
16019
  blocks: []
16030
16020
  });
@@ -16185,14 +16175,12 @@ class BaseAttachmentService extends BaseApiService {
16185
16175
  }
16186
16176
  // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
16187
16177
  // so for some attachment model services, this method will have to be overridden.
16188
- async refreshStore() {
16189
- const { store } = this.client;
16190
- const activeProjectId = store.getState().projectReducer.activeProjectId;
16178
+ async refreshStore(projectId) {
16191
16179
  const meta = AttachmentModelMeta[this.attachmentModel];
16192
16180
  const result = await this.enqueueRequest({
16193
16181
  description: `Get ${meta.name} attachments`,
16194
16182
  method: HttpMethod.GET,
16195
- url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
16183
+ url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
16196
16184
  blocks: [],
16197
16185
  blockers: []
16198
16186
  });
@@ -16288,12 +16276,11 @@ class AssetTypeService extends BaseApiService {
16288
16276
  throw e;
16289
16277
  });
16290
16278
  }
16291
- async refreshStore() {
16292
- const { store } = this.client;
16279
+ async refreshStore(projectId) {
16293
16280
  const result = await this.enqueueRequest({
16294
16281
  description: "Get asset types",
16295
16282
  method: HttpMethod.GET,
16296
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
16283
+ url: `/projects/${projectId}/asset-types/`,
16297
16284
  blockers: [],
16298
16285
  blocks: []
16299
16286
  });
@@ -16392,13 +16379,11 @@ class IssueCommentService extends BaseApiService {
16392
16379
  });
16393
16380
  return promise;
16394
16381
  }
16395
- async refreshStore() {
16396
- const { store } = this.client;
16382
+ async refreshStore(projectId) {
16397
16383
  const result = await this.enqueueRequest({
16398
16384
  description: "Get comments",
16399
16385
  method: HttpMethod.GET,
16400
- // TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
16401
- url: `/projects/${store.getState().projectReducer.activeProjectId}/comments/`,
16386
+ url: `/projects/${projectId}/comments/`,
16402
16387
  blockers: [],
16403
16388
  blocks: []
16404
16389
  });
@@ -16406,12 +16391,11 @@ class IssueCommentService extends BaseApiService {
16406
16391
  }
16407
16392
  }
16408
16393
  class IssueUpdateService extends BaseApiService {
16409
- async refreshStore() {
16410
- const { store } = this.client;
16394
+ async refreshStore(projectId) {
16411
16395
  const result = await this.enqueueRequest({
16412
16396
  description: "Get issue updates",
16413
16397
  method: HttpMethod.GET,
16414
- url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
16398
+ url: `/projects/${projectId}/issues/updates/`,
16415
16399
  blockers: [],
16416
16400
  blocks: []
16417
16401
  });
@@ -16642,12 +16626,7 @@ class IssueService extends BaseApiService {
16642
16626
  }
16643
16627
  }
16644
16628
  // Special functions
16645
- async refreshStore() {
16646
- const { store } = this.client;
16647
- const projectId = store.getState().projectReducer.activeProjectId;
16648
- if (!projectId) {
16649
- throw new Error("No active project");
16650
- }
16629
+ async refreshStore(projectId) {
16651
16630
  const result = await this.enqueueRequest({
16652
16631
  description: "Get issues",
16653
16632
  method: HttpMethod.GET,
@@ -16668,23 +16647,19 @@ class IssueService extends BaseApiService {
16668
16647
  }
16669
16648
  }
16670
16649
  class IssueTypeService extends BaseApiService {
16671
- add(payload) {
16650
+ add(payload, organizationId) {
16672
16651
  const { store } = this.client;
16673
16652
  const state = store.getState();
16674
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
16675
- if (!activeOrganizationId) {
16676
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16677
- }
16678
16653
  const offlineIssueType = offline({
16679
16654
  ...payload,
16680
16655
  submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
16681
16656
  created_by: state.userReducer.currentUser.id,
16682
- organization: activeOrganizationId
16657
+ organization: organizationId
16683
16658
  });
16684
16659
  this.dispatch(addIssueType(offlineIssueType));
16685
16660
  const promise = this.enqueueRequest({
16686
16661
  method: HttpMethod.POST,
16687
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16662
+ url: `/organizations/${organizationId}/issue-types/`,
16688
16663
  // Sending only whats needed here
16689
16664
  payload: {
16690
16665
  offline_id: offlineIssueType.offline_id,
@@ -16752,15 +16727,10 @@ class IssueTypeService extends BaseApiService {
16752
16727
  });
16753
16728
  return promise;
16754
16729
  }
16755
- async refreshStore() {
16756
- const { store } = this.client;
16757
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
16758
- if (!activeOrganizationId) {
16759
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16760
- }
16730
+ async refreshStore(organizationId) {
16761
16731
  const result = await this.enqueueRequest({
16762
16732
  method: HttpMethod.GET,
16763
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16733
+ url: `/organizations/${organizationId}/issue-types/`,
16764
16734
  blockers: [],
16765
16735
  blocks: []
16766
16736
  });
@@ -16799,25 +16769,18 @@ class ProjectAccessService extends BaseApiService {
16799
16769
  blocks: []
16800
16770
  });
16801
16771
  }
16802
- async refreshStore() {
16803
- const { store } = this.client;
16804
- const state = store.getState();
16805
- const projectId = state.projectReducer.activeProjectId;
16806
- if (!projectId) {
16807
- throw new Error("No active project");
16808
- }
16772
+ async refreshStore(projectId) {
16809
16773
  const promise = this.fetchAll(projectId);
16810
16774
  const result = await promise;
16811
16775
  this.dispatch(setProjectAccesses(result));
16812
16776
  }
16813
16777
  }
16814
16778
  class ProjectFileService extends BaseApiService {
16815
- async refreshStore() {
16816
- const { store } = this.client;
16779
+ async refreshStore(projectId) {
16817
16780
  const result = await this.enqueueRequest({
16818
16781
  description: "Get project files",
16819
16782
  method: HttpMethod.GET,
16820
- url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
16783
+ url: `/projects/${projectId}/files/`,
16821
16784
  blockers: [],
16822
16785
  blocks: []
16823
16786
  });
@@ -16955,10 +16918,6 @@ class ProjectService extends BaseApiService {
16955
16918
  throw new Error("Project type was not chosen when trying to create a project");
16956
16919
  }
16957
16920
  const isOrganizationProject = !!project.owner_organization;
16958
- const activeOrganization = this.client.store.getState().organizationReducer.activeOrganizationId;
16959
- if (isOrganizationProject && (!activeOrganization || project.owner_organization !== activeOrganization)) {
16960
- throw new Error("User tried creating organization project for organization they do not belong to.");
16961
- }
16962
16921
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
16963
16922
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
16964
16923
  const result = await this.enqueueRequest({
@@ -17345,20 +17304,15 @@ class UserFormService extends BaseApiService {
17345
17304
  throw e;
17346
17305
  }
17347
17306
  }
17348
- async refreshStore() {
17349
- const { store } = this.client;
17350
- const activeProjectId = store.getState().projectReducer.activeProjectId;
17351
- if (!activeProjectId) {
17352
- throw new Error("No active project");
17353
- }
17307
+ async refreshStore(projectId) {
17354
17308
  const forms = [];
17355
17309
  const revisions = [];
17356
17310
  const attachments = [];
17357
17311
  const projectFormsResult = await this.enqueueRequest({
17358
17312
  description: "Fetch project forms",
17359
17313
  method: HttpMethod.GET,
17360
- url: `/projects/${activeProjectId}/forms/`,
17361
- blockers: [activeProjectId.toString()],
17314
+ url: `/projects/${projectId}/forms/`,
17315
+ blockers: [projectId.toString()],
17362
17316
  blocks: []
17363
17317
  });
17364
17318
  for (const form of projectFormsResult.forms)
@@ -17370,8 +17324,8 @@ class UserFormService extends BaseApiService {
17370
17324
  const organizationFormsResult = await this.enqueueRequest({
17371
17325
  description: "Fetch organization forms",
17372
17326
  method: HttpMethod.GET,
17373
- url: `/projects/${activeProjectId}/organizations/forms/`,
17374
- blockers: [activeProjectId.toString()],
17327
+ url: `/projects/${projectId}/organizations/forms/`,
17328
+ blockers: [projectId.toString()],
17375
17329
  blocks: []
17376
17330
  });
17377
17331
  for (const form of organizationFormsResult.forms)
@@ -17383,8 +17337,8 @@ class UserFormService extends BaseApiService {
17383
17337
  const assetTypeFormsResult = await this.enqueueRequest({
17384
17338
  description: "Fetch asset type forms",
17385
17339
  method: HttpMethod.GET,
17386
- url: `/projects/${activeProjectId}/asset-types/forms/`,
17387
- blockers: [activeProjectId.toString()],
17340
+ url: `/projects/${projectId}/asset-types/forms/`,
17341
+ blockers: [projectId.toString()],
17388
17342
  blocks: []
17389
17343
  });
17390
17344
  for (const form of assetTypeFormsResult.forms)
@@ -17396,8 +17350,8 @@ class UserFormService extends BaseApiService {
17396
17350
  const issueTypeFormsResult = await this.enqueueRequest({
17397
17351
  description: "Fetch issue type forms",
17398
17352
  method: HttpMethod.GET,
17399
- url: `/projects/${activeProjectId}/issue-types/forms/`,
17400
- blockers: [activeProjectId.toString()],
17353
+ url: `/projects/${projectId}/issue-types/forms/`,
17354
+ blockers: [projectId.toString()],
17401
17355
  blocks: []
17402
17356
  });
17403
17357
  for (const form of issueTypeFormsResult.forms)
@@ -17680,9 +17634,7 @@ class UserFormSubmissionService extends BaseApiService {
17680
17634
  throw e;
17681
17635
  }
17682
17636
  }
17683
- async refreshStore() {
17684
- const { store } = this.client;
17685
- const projectId = store.getState().projectReducer.activeProjectId;
17637
+ async refreshStore(projectId) {
17686
17638
  const submissions = await this.enqueueRequest({
17687
17639
  description: "Fetch form submissions",
17688
17640
  method: HttpMethod.GET,
@@ -17753,6 +17705,16 @@ class WorkspaceService extends BaseApiService {
17753
17705
  });
17754
17706
  return promise;
17755
17707
  }
17708
+ async refreshStore(projectId) {
17709
+ const result = await this.enqueueRequest({
17710
+ description: "Get workspaces",
17711
+ method: HttpMethod.GET,
17712
+ url: `/projects/${projectId}/workspaces/`,
17713
+ blockers: [],
17714
+ blocks: []
17715
+ });
17716
+ this.dispatch(initializeWorkspaces(result));
17717
+ }
17756
17718
  }
17757
17719
  class OrganizationAccessService extends BaseApiService {
17758
17720
  async update(organizationAccess) {
@@ -17780,13 +17742,7 @@ class OrganizationAccessService extends BaseApiService {
17780
17742
  blocks: []
17781
17743
  });
17782
17744
  }
17783
- async refreshStore() {
17784
- const { store } = this.client;
17785
- const state = store.getState();
17786
- const organizationId = state.organizationReducer.activeOrganizationId;
17787
- if (!organizationId) {
17788
- return;
17789
- }
17745
+ async refreshStore(organizationId) {
17790
17746
  const result = await this.enqueueRequest({
17791
17747
  description: "Get organization accesses",
17792
17748
  method: HttpMethod.GET,
@@ -18051,11 +18007,7 @@ class EmailDomainsService extends BaseApiService {
18051
18007
  throw e;
18052
18008
  });
18053
18009
  }
18054
- async refreshStore() {
18055
- const organizationId = this.client.store.getState().organizationReducer.activeOrganizationId;
18056
- if (!organizationId) {
18057
- throw new Error("No active organization");
18058
- }
18010
+ async refreshStore(organizationId) {
18059
18011
  const result = await this.enqueueRequest({
18060
18012
  description: "Fetch email domains for organization",
18061
18013
  method: HttpMethod.GET,
@@ -18067,36 +18019,6 @@ class EmailDomainsService extends BaseApiService {
18067
18019
  }
18068
18020
  }
18069
18021
  class OrganizationService extends BaseApiService {
18070
- async fetchInitialOrganizationData(organizationId, showLoading) {
18071
- if (showLoading) {
18072
- this.dispatch(setIsFetchingInitialData(true));
18073
- }
18074
- return this.enqueueRequest({
18075
- description: "Get initial organization data",
18076
- method: HttpMethod.GET,
18077
- url: `/organizations/${organizationId}/initial-data/`,
18078
- payload: {},
18079
- isAuthNeeded: true,
18080
- blockers: [],
18081
- blocks: [organizationId.toString()]
18082
- }).then((result) => {
18083
- this._processInitialOrganizationData(result, showLoading);
18084
- return result;
18085
- });
18086
- }
18087
- _processInitialOrganizationData(data, showLoading) {
18088
- const activeOrganization = data.organization;
18089
- const organizationAccesses = data.organization_accesses;
18090
- const emailDomains = data.email_domains;
18091
- const users = data.users;
18092
- this.dispatch(addUsers(users));
18093
- this.dispatch(setActiveOrganizationId(activeOrganization.id));
18094
- this.dispatch(initializeOrganizationAccesses(organizationAccesses));
18095
- this.dispatch(initializeEmailDomains(emailDomains));
18096
- if (showLoading) {
18097
- this.dispatch(setIsFetchingInitialData(false));
18098
- }
18099
- }
18100
18022
  create(name) {
18101
18023
  return this.enqueueRequest({
18102
18024
  description: "Create organization",
@@ -18130,26 +18052,30 @@ class OrganizationService extends BaseApiService {
18130
18052
  blocks: []
18131
18053
  });
18132
18054
  }
18133
- }
18134
- class LicenseService extends BaseApiService {
18135
- async fetchLicensesForOrganization(organizationId, showLoading = false) {
18136
- if (showLoading) {
18137
- this.dispatch(setIsFetchingInitialData(true));
18138
- }
18139
- const result = await this.enqueueRequest({
18140
- description: "Get licenses",
18055
+ async refreshStore(projectId, organizationId) {
18056
+ const organizationsRecord = {};
18057
+ const projectOrganizations = await this.enqueueRequest({
18058
+ description: "Get organizations",
18141
18059
  method: HttpMethod.GET,
18142
- url: `/organizations/${organizationId}/licenses/`,
18143
- isAuthNeeded: true,
18144
- blockers: [organizationId.toString()],
18145
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18060
+ url: `/projects/${projectId}/organizations/`,
18061
+ blockers: [],
18062
+ blocks: []
18146
18063
  });
18147
- if (showLoading) {
18148
- this.dispatch(setIsFetchingInitialData(false));
18064
+ for (const organization2 of projectOrganizations) {
18065
+ organizationsRecord[organization2.id] = organization2;
18149
18066
  }
18150
- this.dispatch(addLicenses(result));
18151
- return result;
18067
+ const organization = await this.enqueueRequest({
18068
+ description: "Get organization",
18069
+ method: HttpMethod.GET,
18070
+ url: `/organizations/${organizationId}/`,
18071
+ blockers: [],
18072
+ blocks: []
18073
+ });
18074
+ organizationsRecord[organization.id] = organization;
18075
+ this.dispatch(setOrganizations(Object.values(organizationsRecord)));
18152
18076
  }
18077
+ }
18078
+ class LicenseService extends BaseApiService {
18153
18079
  async getLicense(license) {
18154
18080
  const result = await this.enqueueRequest({
18155
18081
  description: "Get license",
@@ -18246,6 +18172,32 @@ class LicenseService extends BaseApiService {
18246
18172
  blocks: [license.offline_id]
18247
18173
  });
18248
18174
  }
18175
+ async refreshStore(projectId, organizationId) {
18176
+ const licencesRecord = {};
18177
+ const organizationLicences = await this.enqueueRequest({
18178
+ description: "Get licenses",
18179
+ method: HttpMethod.GET,
18180
+ url: `/organizations/${organizationId}/licenses/`,
18181
+ isAuthNeeded: true,
18182
+ blockers: [organizationId.toString()],
18183
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18184
+ });
18185
+ for (const license of organizationLicences) {
18186
+ licencesRecord[license.offline_id] = license;
18187
+ }
18188
+ const projectLicences = await this.enqueueRequest({
18189
+ description: "Get licenses",
18190
+ method: HttpMethod.GET,
18191
+ url: `/projects/${projectId}/licenses/`,
18192
+ isAuthNeeded: true,
18193
+ blockers: [projectId.toString()],
18194
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18195
+ });
18196
+ for (const license of projectLicences) {
18197
+ licencesRecord[license.offline_id] = license;
18198
+ }
18199
+ this.dispatch(setLicenses(Object.values(licencesRecord)));
18200
+ }
18249
18201
  }
18250
18202
  class DocumentService extends BaseApiService {
18251
18203
  // TODO: Support adding for project or organization
@@ -18378,22 +18330,18 @@ class DocumentService extends BaseApiService {
18378
18330
  });
18379
18331
  return promise;
18380
18332
  }
18381
- async refreshStore() {
18382
- const { store } = this.client;
18383
- const state = store.getState();
18384
- const activeProjectId = state.projectReducer.activeProjectId;
18333
+ async refreshStore(projectId, organizationId) {
18385
18334
  const projectDocumentsPromise = this.enqueueRequest({
18386
18335
  description: "Get project documents",
18387
18336
  method: HttpMethod.GET,
18388
- url: `/projects/${activeProjectId}/documents/`,
18337
+ url: `/projects/${projectId}/documents/`,
18389
18338
  blockers: [],
18390
18339
  blocks: []
18391
18340
  });
18392
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18393
18341
  const organizationDocumentsPromise = this.enqueueRequest({
18394
18342
  description: "Get organization documents",
18395
18343
  method: HttpMethod.GET,
18396
- url: `/organizations/${activeOrganizationId}/documents/`,
18344
+ url: `/organizations/${organizationId}/documents/`,
18397
18345
  blockers: [],
18398
18346
  blocks: []
18399
18347
  });
@@ -18506,13 +18454,11 @@ class AgentService extends BaseApiService {
18506
18454
  blocks: ["rate"]
18507
18455
  });
18508
18456
  }
18509
- async refreshStore() {
18510
- const { store } = this.client;
18511
- const activeProject = store.getState().projectReducer.activeProjectId;
18457
+ async refreshStore(projectId) {
18512
18458
  const result = await this.enqueueRequest({
18513
18459
  description: "Get agent conversation history",
18514
18460
  method: HttpMethod.GET,
18515
- url: `/projects/${activeProject}/agent-conversations/`,
18461
+ url: `/projects/${projectId}/agent-conversations/`,
18516
18462
  blockers: ["agent-conversations"],
18517
18463
  blocks: ["agent-conversations"]
18518
18464
  });
@@ -18520,16 +18466,10 @@ class AgentService extends BaseApiService {
18520
18466
  }
18521
18467
  }
18522
18468
  class TeamService extends BaseApiService {
18523
- add(teamPayload) {
18524
- const { store } = this.client;
18525
- const state = store.getState();
18526
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18527
- if (!activeOrganizationId) {
18528
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18529
- }
18469
+ add(teamPayload, organizationId) {
18530
18470
  const offlineTeam = offline({
18531
18471
  ...teamPayload,
18532
- organization: activeOrganizationId,
18472
+ organization: organizationId,
18533
18473
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
18534
18474
  // TODO: uncomment once supported
18535
18475
  // created_by: state.userReducer.currentUser.id,
@@ -18538,7 +18478,7 @@ class TeamService extends BaseApiService {
18538
18478
  const promise = this.enqueueRequest({
18539
18479
  description: "Create team",
18540
18480
  method: HttpMethod.POST,
18541
- url: `/organizations/${activeOrganizationId}/teams/`,
18481
+ url: `/organizations/${organizationId}/teams/`,
18542
18482
  payload: offlineTeam,
18543
18483
  // No blocks since users and organizations are not offline
18544
18484
  blockers: [],
@@ -18642,16 +18582,11 @@ class TeamService extends BaseApiService {
18642
18582
  const newMembers = team.members.filter((member) => !members.includes(member));
18643
18583
  return this.setMembers(teamId, newMembers);
18644
18584
  }
18645
- async refreshStore() {
18646
- const { store } = this.client;
18647
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
18648
- if (!activeOrganizationId) {
18649
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18650
- }
18585
+ async refreshStore(organizationId) {
18651
18586
  const result = await this.enqueueRequest({
18652
18587
  description: "Fetch teams",
18653
18588
  method: HttpMethod.GET,
18654
- url: `/organizations/${activeOrganizationId}/teams/`,
18589
+ url: `/organizations/${organizationId}/teams/`,
18655
18590
  blockers: [],
18656
18591
  blocks: []
18657
18592
  });