@overmap-ai/core 1.0.60-sdk-refactor.17 → 1.0.60-sdk-refactor.20

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 (30) hide show
  1. package/dist/overmap-core.js +130 -166
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +130 -166
  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/sdk/services/index.d.ts +1 -0
  29. package/dist/typings/models/organizations.d.ts +0 -11
  30. package/package.json +1 -1
@@ -15648,12 +15648,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15648
15648
  blocks: []
15649
15649
  });
15650
15650
  }
15651
- async refreshStore() {
15652
- const { store } = this.client;
15653
- const projectId = store.getState().projectReducer.activeProjectId;
15654
- if (!projectId) {
15655
- throw new Error("No active project");
15656
- }
15651
+ async refreshStore(projectId) {
15657
15652
  const result = await this.enqueueRequest({
15658
15653
  description: "Get categories",
15659
15654
  method: HttpMethod.GET,
@@ -15797,16 +15792,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15797
15792
  });
15798
15793
  return batchPromises;
15799
15794
  }
15800
- async refreshStore() {
15801
- const { store } = this.client;
15795
+ async refreshStore(projectId) {
15802
15796
  const result = await this.enqueueRequest({
15803
15797
  description: "Get assets",
15804
15798
  method: HttpMethod.GET,
15805
- url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
15799
+ url: `/projects/${projectId}/assets/`,
15806
15800
  blockers: [],
15807
15801
  blocks: []
15808
15802
  });
15809
- store.dispatch(initializeAssets(result));
15803
+ this.dispatch(initializeAssets(result));
15810
15804
  }
15811
15805
  }
15812
15806
  class AssetStageCompletionService extends BaseApiService {
@@ -15833,12 +15827,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15833
15827
  });
15834
15828
  return [offlineStageCompletion, promise];
15835
15829
  }
15836
- async refreshStore() {
15837
- const { store } = this.client;
15830
+ async refreshStore(projectId) {
15838
15831
  const result = await this.enqueueRequest({
15839
15832
  description: "Get stage completions",
15840
15833
  method: HttpMethod.GET,
15841
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
15834
+ url: `/projects/${projectId}/asset-stage-completions/`,
15842
15835
  blockers: [],
15843
15836
  blocks: []
15844
15837
  });
@@ -16006,12 +15999,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16006
15999
  throw e;
16007
16000
  }
16008
16001
  }
16009
- async refreshStore() {
16010
- const { store } = this.client;
16002
+ async refreshStore(projectId) {
16011
16003
  const result = await this.enqueueRequest({
16012
16004
  description: "Get asset stages",
16013
16005
  method: HttpMethod.GET,
16014
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
16006
+ url: `/projects/${projectId}/asset-stages/`,
16015
16007
  blockers: [],
16016
16008
  blocks: []
16017
16009
  });
@@ -16172,14 +16164,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16172
16164
  }
16173
16165
  // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
16174
16166
  // so for some attachment model services, this method will have to be overridden.
16175
- async refreshStore() {
16176
- const { store } = this.client;
16177
- const activeProjectId = store.getState().projectReducer.activeProjectId;
16167
+ async refreshStore(projectId) {
16178
16168
  const meta = AttachmentModelMeta[this.attachmentModel];
16179
16169
  const result = await this.enqueueRequest({
16180
16170
  description: `Get ${meta.name} attachments`,
16181
16171
  method: HttpMethod.GET,
16182
- url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
16172
+ url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
16183
16173
  blocks: [],
16184
16174
  blockers: []
16185
16175
  });
@@ -16275,12 +16265,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16275
16265
  throw e;
16276
16266
  });
16277
16267
  }
16278
- async refreshStore() {
16279
- const { store } = this.client;
16268
+ async refreshStore(projectId) {
16280
16269
  const result = await this.enqueueRequest({
16281
16270
  description: "Get asset types",
16282
16271
  method: HttpMethod.GET,
16283
- url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
16272
+ url: `/projects/${projectId}/asset-types/`,
16284
16273
  blockers: [],
16285
16274
  blocks: []
16286
16275
  });
@@ -16379,13 +16368,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16379
16368
  });
16380
16369
  return promise;
16381
16370
  }
16382
- async refreshStore() {
16383
- const { store } = this.client;
16371
+ async refreshStore(projectId) {
16384
16372
  const result = await this.enqueueRequest({
16385
16373
  description: "Get comments",
16386
16374
  method: HttpMethod.GET,
16387
- // TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
16388
- url: `/projects/${store.getState().projectReducer.activeProjectId}/comments/`,
16375
+ url: `/projects/${projectId}/comments/`,
16389
16376
  blockers: [],
16390
16377
  blocks: []
16391
16378
  });
@@ -16393,12 +16380,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16393
16380
  }
16394
16381
  }
16395
16382
  class IssueUpdateService extends BaseApiService {
16396
- async refreshStore() {
16397
- const { store } = this.client;
16383
+ async refreshStore(projectId) {
16398
16384
  const result = await this.enqueueRequest({
16399
16385
  description: "Get issue updates",
16400
16386
  method: HttpMethod.GET,
16401
- url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
16387
+ url: `/projects/${projectId}/issues/updates/`,
16402
16388
  blockers: [],
16403
16389
  blocks: []
16404
16390
  });
@@ -16629,12 +16615,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16629
16615
  }
16630
16616
  }
16631
16617
  // Special functions
16632
- async refreshStore() {
16633
- const { store } = this.client;
16634
- const projectId = store.getState().projectReducer.activeProjectId;
16635
- if (!projectId) {
16636
- throw new Error("No active project");
16637
- }
16618
+ async refreshStore(projectId) {
16638
16619
  const result = await this.enqueueRequest({
16639
16620
  description: "Get issues",
16640
16621
  method: HttpMethod.GET,
@@ -16655,23 +16636,19 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16655
16636
  }
16656
16637
  }
16657
16638
  class IssueTypeService extends BaseApiService {
16658
- add(payload) {
16639
+ add(payload, organizationId) {
16659
16640
  const { store } = this.client;
16660
16641
  const state = store.getState();
16661
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
16662
- if (!activeOrganizationId) {
16663
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16664
- }
16665
16642
  const offlineIssueType = offline({
16666
16643
  ...payload,
16667
16644
  submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
16668
16645
  created_by: state.userReducer.currentUser.id,
16669
- organization: activeOrganizationId
16646
+ organization: organizationId
16670
16647
  });
16671
16648
  this.dispatch(addIssueType(offlineIssueType));
16672
16649
  const promise = this.enqueueRequest({
16673
16650
  method: HttpMethod.POST,
16674
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16651
+ url: `/organizations/${organizationId}/issue-types/`,
16675
16652
  // Sending only whats needed here
16676
16653
  payload: {
16677
16654
  offline_id: offlineIssueType.offline_id,
@@ -16739,15 +16716,10 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16739
16716
  });
16740
16717
  return promise;
16741
16718
  }
16742
- async refreshStore() {
16743
- const { store } = this.client;
16744
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
16745
- if (!activeOrganizationId) {
16746
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
16747
- }
16719
+ async refreshStore(organizationId) {
16748
16720
  const result = await this.enqueueRequest({
16749
16721
  method: HttpMethod.GET,
16750
- url: `/organizations/${activeOrganizationId}/issue-types/`,
16722
+ url: `/organizations/${organizationId}/issue-types/`,
16751
16723
  blockers: [],
16752
16724
  blocks: []
16753
16725
  });
@@ -16786,25 +16758,18 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16786
16758
  blocks: []
16787
16759
  });
16788
16760
  }
16789
- async refreshStore() {
16790
- const { store } = this.client;
16791
- const state = store.getState();
16792
- const projectId = state.projectReducer.activeProjectId;
16793
- if (!projectId) {
16794
- throw new Error("No active project");
16795
- }
16761
+ async refreshStore(projectId) {
16796
16762
  const promise = this.fetchAll(projectId);
16797
16763
  const result = await promise;
16798
16764
  this.dispatch(setProjectAccesses(result));
16799
16765
  }
16800
16766
  }
16801
16767
  class ProjectFileService extends BaseApiService {
16802
- async refreshStore() {
16803
- const { store } = this.client;
16768
+ async refreshStore(projectId) {
16804
16769
  const result = await this.enqueueRequest({
16805
16770
  description: "Get project files",
16806
16771
  method: HttpMethod.GET,
16807
- url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
16772
+ url: `/projects/${projectId}/files/`,
16808
16773
  blockers: [],
16809
16774
  blocks: []
16810
16775
  });
@@ -16942,10 +16907,6 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
16942
16907
  throw new Error("Project type was not chosen when trying to create a project");
16943
16908
  }
16944
16909
  const isOrganizationProject = !!project.owner_organization;
16945
- const activeOrganization = this.client.store.getState().organizationReducer.activeOrganizationId;
16946
- if (isOrganizationProject && (!activeOrganization || project.owner_organization !== activeOrganization)) {
16947
- throw new Error("User tried creating organization project for organization they do not belong to.");
16948
- }
16949
16910
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
16950
16911
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
16951
16912
  const result = await this.enqueueRequest({
@@ -17332,20 +17293,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17332
17293
  throw e;
17333
17294
  }
17334
17295
  }
17335
- async refreshStore() {
17336
- const { store } = this.client;
17337
- const activeProjectId = store.getState().projectReducer.activeProjectId;
17338
- if (!activeProjectId) {
17339
- throw new Error("No active project");
17340
- }
17296
+ async refreshStore(projectId) {
17341
17297
  const forms = [];
17342
17298
  const revisions = [];
17343
17299
  const attachments = [];
17344
17300
  const projectFormsResult = await this.enqueueRequest({
17345
17301
  description: "Fetch project forms",
17346
17302
  method: HttpMethod.GET,
17347
- url: `/projects/${activeProjectId}/forms/`,
17348
- blockers: [activeProjectId.toString()],
17303
+ url: `/projects/${projectId}/forms/`,
17304
+ blockers: [projectId.toString()],
17349
17305
  blocks: []
17350
17306
  });
17351
17307
  for (const form of projectFormsResult.forms)
@@ -17357,8 +17313,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17357
17313
  const organizationFormsResult = await this.enqueueRequest({
17358
17314
  description: "Fetch organization forms",
17359
17315
  method: HttpMethod.GET,
17360
- url: `/projects/${activeProjectId}/organizations/forms/`,
17361
- blockers: [activeProjectId.toString()],
17316
+ url: `/projects/${projectId}/organizations/forms/`,
17317
+ blockers: [projectId.toString()],
17362
17318
  blocks: []
17363
17319
  });
17364
17320
  for (const form of organizationFormsResult.forms)
@@ -17370,8 +17326,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17370
17326
  const assetTypeFormsResult = await this.enqueueRequest({
17371
17327
  description: "Fetch asset type forms",
17372
17328
  method: HttpMethod.GET,
17373
- url: `/projects/${activeProjectId}/asset-types/forms/`,
17374
- blockers: [activeProjectId.toString()],
17329
+ url: `/projects/${projectId}/asset-types/forms/`,
17330
+ blockers: [projectId.toString()],
17375
17331
  blocks: []
17376
17332
  });
17377
17333
  for (const form of assetTypeFormsResult.forms)
@@ -17383,8 +17339,8 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17383
17339
  const issueTypeFormsResult = await this.enqueueRequest({
17384
17340
  description: "Fetch issue type forms",
17385
17341
  method: HttpMethod.GET,
17386
- url: `/projects/${activeProjectId}/issue-types/forms/`,
17387
- blockers: [activeProjectId.toString()],
17342
+ url: `/projects/${projectId}/issue-types/forms/`,
17343
+ blockers: [projectId.toString()],
17388
17344
  blocks: []
17389
17345
  });
17390
17346
  for (const form of issueTypeFormsResult.forms)
@@ -17667,9 +17623,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17667
17623
  throw e;
17668
17624
  }
17669
17625
  }
17670
- async refreshStore() {
17671
- const { store } = this.client;
17672
- const projectId = store.getState().projectReducer.activeProjectId;
17626
+ async refreshStore(projectId) {
17673
17627
  const submissions = await this.enqueueRequest({
17674
17628
  description: "Fetch form submissions",
17675
17629
  method: HttpMethod.GET,
@@ -17740,6 +17694,16 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17740
17694
  });
17741
17695
  return promise;
17742
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
+ }
17743
17707
  }
17744
17708
  class OrganizationAccessService extends BaseApiService {
17745
17709
  async update(organizationAccess) {
@@ -17767,13 +17731,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
17767
17731
  blocks: []
17768
17732
  });
17769
17733
  }
17770
- async refreshStore() {
17771
- const { store } = this.client;
17772
- const state = store.getState();
17773
- const organizationId = state.organizationReducer.activeOrganizationId;
17774
- if (!organizationId) {
17775
- return;
17776
- }
17734
+ async refreshStore(organizationId) {
17777
17735
  const result = await this.enqueueRequest({
17778
17736
  description: "Get organization accesses",
17779
17737
  method: HttpMethod.GET,
@@ -18038,11 +17996,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18038
17996
  throw e;
18039
17997
  });
18040
17998
  }
18041
- async refreshStore() {
18042
- const organizationId = this.client.store.getState().organizationReducer.activeOrganizationId;
18043
- if (!organizationId) {
18044
- throw new Error("No active organization");
18045
- }
17999
+ async refreshStore(organizationId) {
18046
18000
  const result = await this.enqueueRequest({
18047
18001
  description: "Fetch email domains for organization",
18048
18002
  method: HttpMethod.GET,
@@ -18054,36 +18008,6 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18054
18008
  }
18055
18009
  }
18056
18010
  class OrganizationService extends BaseApiService {
18057
- async fetchInitialOrganizationData(organizationId, showLoading) {
18058
- if (showLoading) {
18059
- this.dispatch(setIsFetchingInitialData(true));
18060
- }
18061
- return this.enqueueRequest({
18062
- description: "Get initial organization data",
18063
- method: HttpMethod.GET,
18064
- url: `/organizations/${organizationId}/initial-data/`,
18065
- payload: {},
18066
- isAuthNeeded: true,
18067
- blockers: [],
18068
- blocks: [organizationId.toString()]
18069
- }).then((result) => {
18070
- this._processInitialOrganizationData(result, showLoading);
18071
- return result;
18072
- });
18073
- }
18074
- _processInitialOrganizationData(data, showLoading) {
18075
- const activeOrganization = data.organization;
18076
- const organizationAccesses = data.organization_accesses;
18077
- const emailDomains = data.email_domains;
18078
- const users = data.users;
18079
- this.dispatch(addUsers(users));
18080
- this.dispatch(setActiveOrganizationId(activeOrganization.id));
18081
- this.dispatch(initializeOrganizationAccesses(organizationAccesses));
18082
- this.dispatch(initializeEmailDomains(emailDomains));
18083
- if (showLoading) {
18084
- this.dispatch(setIsFetchingInitialData(false));
18085
- }
18086
- }
18087
18011
  create(name) {
18088
18012
  return this.enqueueRequest({
18089
18013
  description: "Create organization",
@@ -18117,26 +18041,30 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18117
18041
  blocks: []
18118
18042
  });
18119
18043
  }
18120
- }
18121
- class LicenseService extends BaseApiService {
18122
- async fetchLicensesForOrganization(organizationId, showLoading = false) {
18123
- if (showLoading) {
18124
- this.dispatch(setIsFetchingInitialData(true));
18125
- }
18126
- const result = await this.enqueueRequest({
18127
- description: "Get licenses",
18044
+ async refreshStore(projectId, organizationId) {
18045
+ const organizationsRecord = {};
18046
+ const projectOrganizations = await this.enqueueRequest({
18047
+ description: "Get organizations",
18128
18048
  method: HttpMethod.GET,
18129
- url: `/organizations/${organizationId}/licenses/`,
18130
- isAuthNeeded: true,
18131
- blockers: [organizationId.toString()],
18132
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
18049
+ url: `/projects/${projectId}/organizations/`,
18050
+ blockers: [],
18051
+ blocks: []
18133
18052
  });
18134
- if (showLoading) {
18135
- this.dispatch(setIsFetchingInitialData(false));
18053
+ for (const organization2 of projectOrganizations) {
18054
+ organizationsRecord[organization2.id] = organization2;
18136
18055
  }
18137
- this.dispatch(addLicenses(result));
18138
- 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)));
18139
18065
  }
18066
+ }
18067
+ class LicenseService extends BaseApiService {
18140
18068
  async getLicense(license) {
18141
18069
  const result = await this.enqueueRequest({
18142
18070
  description: "Get license",
@@ -18233,6 +18161,32 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18233
18161
  blocks: [license.offline_id]
18234
18162
  });
18235
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
+ }
18236
18190
  }
18237
18191
  class DocumentService extends BaseApiService {
18238
18192
  // TODO: Support adding for project or organization
@@ -18365,22 +18319,18 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18365
18319
  });
18366
18320
  return promise;
18367
18321
  }
18368
- async refreshStore() {
18369
- const { store } = this.client;
18370
- const state = store.getState();
18371
- const activeProjectId = state.projectReducer.activeProjectId;
18322
+ async refreshStore(projectId, organizationId) {
18372
18323
  const projectDocumentsPromise = this.enqueueRequest({
18373
18324
  description: "Get project documents",
18374
18325
  method: HttpMethod.GET,
18375
- url: `/projects/${activeProjectId}/documents/`,
18326
+ url: `/projects/${projectId}/documents/`,
18376
18327
  blockers: [],
18377
18328
  blocks: []
18378
18329
  });
18379
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18380
18330
  const organizationDocumentsPromise = this.enqueueRequest({
18381
18331
  description: "Get organization documents",
18382
18332
  method: HttpMethod.GET,
18383
- url: `/organizations/${activeOrganizationId}/documents/`,
18333
+ url: `/organizations/${organizationId}/documents/`,
18384
18334
  blockers: [],
18385
18335
  blocks: []
18386
18336
  });
@@ -18493,13 +18443,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18493
18443
  blocks: ["rate"]
18494
18444
  });
18495
18445
  }
18496
- async refreshStore() {
18497
- const { store } = this.client;
18498
- const activeProject = store.getState().projectReducer.activeProjectId;
18446
+ async refreshStore(projectId) {
18499
18447
  const result = await this.enqueueRequest({
18500
18448
  description: "Get agent conversation history",
18501
18449
  method: HttpMethod.GET,
18502
- url: `/projects/${activeProject}/agent-conversations/`,
18450
+ url: `/projects/${projectId}/agent-conversations/`,
18503
18451
  blockers: ["agent-conversations"],
18504
18452
  blocks: ["agent-conversations"]
18505
18453
  });
@@ -18507,16 +18455,10 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18507
18455
  }
18508
18456
  }
18509
18457
  class TeamService extends BaseApiService {
18510
- add(teamPayload) {
18511
- const { store } = this.client;
18512
- const state = store.getState();
18513
- const activeOrganizationId = state.organizationReducer.activeOrganizationId;
18514
- if (!activeOrganizationId) {
18515
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18516
- }
18458
+ add(teamPayload, organizationId) {
18517
18459
  const offlineTeam = offline({
18518
18460
  ...teamPayload,
18519
- organization: activeOrganizationId,
18461
+ organization: organizationId,
18520
18462
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
18521
18463
  // TODO: uncomment once supported
18522
18464
  // created_by: state.userReducer.currentUser.id,
@@ -18525,7 +18467,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18525
18467
  const promise = this.enqueueRequest({
18526
18468
  description: "Create team",
18527
18469
  method: HttpMethod.POST,
18528
- url: `/organizations/${activeOrganizationId}/teams/`,
18470
+ url: `/organizations/${organizationId}/teams/`,
18529
18471
  payload: offlineTeam,
18530
18472
  // No blocks since users and organizations are not offline
18531
18473
  blockers: [],
@@ -18629,22 +18571,43 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18629
18571
  const newMembers = team.members.filter((member) => !members.includes(member));
18630
18572
  return this.setMembers(teamId, newMembers);
18631
18573
  }
18632
- async refreshStore() {
18633
- const { store } = this.client;
18634
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
18635
- if (!activeOrganizationId) {
18636
- throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
18637
- }
18574
+ async refreshStore(organizationId) {
18638
18575
  const result = await this.enqueueRequest({
18639
18576
  description: "Fetch teams",
18640
18577
  method: HttpMethod.GET,
18641
- url: `/organizations/${activeOrganizationId}/teams/`,
18578
+ url: `/organizations/${organizationId}/teams/`,
18642
18579
  blockers: [],
18643
18580
  blocks: []
18644
18581
  });
18645
18582
  this.dispatch(setTeams(result));
18646
18583
  }
18647
18584
  }
18585
+ class UserService extends BaseApiService {
18586
+ async refreshStore(projectId, organizationId) {
18587
+ const usersRecord = {};
18588
+ const organizationUsers = await this.enqueueRequest({
18589
+ description: "Fetch organization users",
18590
+ method: HttpMethod.GET,
18591
+ url: `/organizations/${organizationId}/users/`,
18592
+ blockers: [],
18593
+ blocks: []
18594
+ });
18595
+ for (const user of organizationUsers) {
18596
+ usersRecord[user.id] = user;
18597
+ }
18598
+ const projectUsers = await this.enqueueRequest({
18599
+ description: "Fetch project users",
18600
+ method: HttpMethod.GET,
18601
+ url: `/projects/${projectId}/users/`,
18602
+ blockers: [],
18603
+ blocks: []
18604
+ });
18605
+ for (const user of projectUsers) {
18606
+ usersRecord[user.id] = user;
18607
+ }
18608
+ this.dispatch(setUsers(Object.values(usersRecord)));
18609
+ }
18610
+ }
18648
18611
  exports2.APIError = APIError;
18649
18612
  exports2.AgentService = AgentService;
18650
18613
  exports2.AssetAttachmentService = AssetAttachmentService;
@@ -18739,6 +18702,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
18739
18702
  exports2.TextInput = TextInput;
18740
18703
  exports2.UserFormService = UserFormService;
18741
18704
  exports2.UserFormSubmissionService = UserFormSubmissionService;
18705
+ exports2.UserService = UserService;
18742
18706
  exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
18743
18707
  exports2.VerificationCodeType = VerificationCodeType;
18744
18708
  exports2.WorkspaceService = WorkspaceService;