@webex/contact-center 3.12.0-next.149 → 3.12.0-next.150

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 (37) hide show
  1. package/.sdd/manifest.json +1 -1
  2. package/ai-docs/CONTRACTS.md +1 -0
  3. package/dist/cc.js +4 -4
  4. package/dist/cc.js.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/services/config/Util.js +38 -45
  7. package/dist/services/config/Util.js.map +1 -1
  8. package/dist/services/config/constants.js +15 -71
  9. package/dist/services/config/constants.js.map +1 -1
  10. package/dist/services/config/index.js +49 -226
  11. package/dist/services/config/index.js.map +1 -1
  12. package/dist/services/config/types.js +33 -11
  13. package/dist/services/config/types.js.map +1 -1
  14. package/dist/types/cc.d.ts +3 -3
  15. package/dist/types/index.d.ts +16 -8
  16. package/dist/types/services/config/Util.d.ts +4 -8
  17. package/dist/types/services/config/constants.d.ts +15 -71
  18. package/dist/types/services/config/index.d.ts +16 -64
  19. package/dist/types/services/config/types.d.ts +97 -160
  20. package/dist/webex.js +1 -1
  21. package/package.json +1 -1
  22. package/src/cc.ts +4 -4
  23. package/src/index.ts +16 -8
  24. package/src/services/agent/ai-docs/AGENTS.md +1 -1
  25. package/src/services/config/Util.ts +43 -82
  26. package/src/services/config/ai-docs/AGENTS.md +34 -39
  27. package/src/services/config/ai-docs/ARCHITECTURE.md +88 -101
  28. package/src/services/config/ai-docs/config-spec.md +115 -132
  29. package/src/services/config/constants.ts +18 -80
  30. package/src/services/config/index.ts +52 -278
  31. package/src/services/config/types.ts +101 -185
  32. package/test/unit/spec/index.ts +6 -2
  33. package/test/unit/spec/services/config/Util.ts +442 -70
  34. package/test/unit/spec/services/config/index.ts +246 -544
  35. package/typedoc.md +1 -1
  36. package/umd/contact-center.min.js +2 -2
  37. package/umd/contact-center.min.js.map +1 -1
@@ -67,26 +67,20 @@ export const DEFAULT_AUXCODE_ATTRIBUTES = [
67
67
  export const METHODS = {
68
68
  // AgentConfigService methods
69
69
  GET_AGENT_CONFIG: 'getAgentConfig',
70
- GET_USER_USING_CI: 'getUserUsingCI',
71
- GET_DESKTOP_PROFILE_BY_ID: 'getDesktopProfileById',
70
+ GET_ORG_DESKTOP_LOGIN_CONFIG: 'getOrgDesktopLoginConfig',
71
+ GET_USER_DESKTOP_LOGIN_CONFIG: 'getUserDesktopLoginConfig',
72
72
  GET_MULTIMEDIA_PROFILE_BY_ID: 'getMultimediaProfileById',
73
73
  GET_LIST_OF_TEAMS: 'getListOfTeams',
74
74
  GET_ALL_TEAMS: 'getAllTeams',
75
75
  GET_LIST_OF_AUX_CODES: 'getListOfAuxCodes',
76
76
  GET_ALL_AUX_CODES: 'getAllAuxCodes',
77
77
  GET_SITE_INFO: 'getSiteInfo',
78
- GET_ORG_INFO: 'getOrgInfo',
79
- GET_ORGANIZATION_SETTING: 'getOrganizationSetting',
80
- GET_TENANT_DATA: 'getTenantData',
81
- GET_URL_MAPPING: 'getURLMapping',
82
78
  GET_DIAL_PLAN_DATA: 'getDialPlanData',
83
- GET_AI_FEATURE_FLAGS: 'getAIFeatureFlags',
84
79
  GET_WELLBEING_BREAK_IDLE_CODE: 'getWellbeingBreakIdleCode',
85
80
  GET_QUEUES: 'getQueues',
86
81
 
87
82
  // Util methods
88
83
  PARSE_AGENT_CONFIGS: 'parseAgentConfigs',
89
- GET_URL_MAPPING_UTIL: 'getUrlMapping',
90
84
  GET_MSFT_CONFIG: 'getMsftConfig',
91
85
  GET_WEBEX_CONFIG: 'getWebexConfig',
92
86
  GET_DEFAULT_AGENT_DN: 'getDefaultAgentDN',
@@ -99,34 +93,32 @@ export const METHODS = {
99
93
  * Maps API endpoint names to functions that generate endpoint URLs for various organization resources.
100
94
  * @public
101
95
  * @example
102
- * const url = endPointMap.userByCI('org123', 'agent456');
96
+ * const url = endPointMap.userDesktopLogin('org123', 'agent456');
103
97
  */
104
98
  export const endPointMap = {
105
99
  /**
106
- * Gets the endpoint for a user by CI user ID.
100
+ * Gets the endpoint for the aggregated organization desktop-login configuration.
107
101
  * @param orgId - Organization ID.
108
- * @param agentId - Agent ID.
109
102
  * @returns The endpoint URL string.
110
103
  * @public
111
104
  * @example
112
- * const url = endPointMap.userByCI('org123', 'agent456');
105
+ * const url = endPointMap.orgDesktopLogin('org123');
113
106
  * @ignore
114
107
  */
115
- userByCI: (orgId: string, agentId: string) =>
116
- `organization/${orgId}/user/by-ci-user-id/${agentId}`,
108
+ orgDesktopLogin: (orgId: string) => `organization/${orgId}/desktop-login`,
117
109
 
118
110
  /**
119
- * Gets the endpoint for a desktop profile.
111
+ * Gets the endpoint for the aggregated user desktop-login configuration.
120
112
  * @param orgId - Organization ID.
121
- * @param desktopProfileId - Desktop profile ID.
113
+ * @param ciUserId - CI user ID of the agent.
122
114
  * @returns The endpoint URL string.
123
115
  * @public
124
116
  * @example
125
- * const url = endPointMap.desktopProfile('org123', 'profile789');
117
+ * const url = endPointMap.userDesktopLogin('org123', 'agent456');
126
118
  * @ignore
127
119
  */
128
- desktopProfile: (orgId: string, desktopProfileId: string) =>
129
- `organization/${orgId}/agent-profile/${desktopProfileId}`,
120
+ userDesktopLogin: (orgId: string, ciUserId: string) =>
121
+ `organization/${orgId}/v2/user/by-ci-user-id/${ciUserId}/desktop-login`,
130
122
 
131
123
  /**
132
124
  * Gets the endpoint for a multimedia profile.
@@ -142,21 +134,21 @@ export const endPointMap = {
142
134
  `organization/${orgId}/multimedia-profile/${multimediaProfileId}`,
143
135
 
144
136
  /**
145
- * Gets the endpoint for listing teams with optional filters.
137
+ * Gets the endpoint for listing the teams a user belongs to.
138
+ * The filter value must stay unquoted — the quoted form returns HTTP 400.
146
139
  * @param orgId - Organization ID.
147
140
  * @param page - Page number.
148
141
  * @param pageSize - Page size.
149
- * @param filter - Array of team IDs to filter.
142
+ * @param userDbId - Database ID of the user whose teams are requested.
150
143
  * @returns The endpoint URL string.
151
144
  * @public
152
145
  * @example
153
- * const url = endPointMap.listTeams('org123', 0, 100, ['team1', 'team2']);
146
+ * const url = endPointMap.listTeams('org123', 0, 100, 'userDb456');
154
147
  * @ignore
155
148
  */
156
- listTeams: (orgId: string, page: number, pageSize: number, filter: string[]) =>
157
- `organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}${
158
- filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
159
- }`,
149
+ listTeams: (orgId: string, page: number, pageSize: number, userDbId: string) =>
150
+ `organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}` +
151
+ `&agentView=true&filter=userId==${userDbId}`,
160
152
 
161
153
  /**
162
154
  * Gets the endpoint for listing auxiliary codes with optional filters and attributes.
@@ -187,28 +179,6 @@ export const endPointMap = {
187
179
  `organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}` +
188
180
  '&workType=IDLE_CODE&customFilter=isSystemCode==true&desktopProfileFilter=false',
189
181
 
190
- /**
191
- * Gets the endpoint for organization info.
192
- * @param orgId - Organization ID.
193
- * @returns The endpoint URL string.
194
- * @public
195
- * @example
196
- * const url = endPointMap.orgInfo('org123');
197
- * @ignore
198
- */
199
- orgInfo: (orgId: string) => `organization/${orgId}`,
200
-
201
- /**
202
- * Gets the endpoint for organization settings.
203
- * @param orgId - Organization ID.
204
- * @returns The endpoint URL string.
205
- * @public
206
- * @example
207
- * const url = endPointMap.orgSettings('org123');
208
- * @ignore
209
- */
210
- orgSettings: (orgId: string) => `organization/${orgId}/v2/organization-setting?agentView=true`,
211
-
212
182
  /**
213
183
  * Gets the endpoint for site info.
214
184
  * @param orgId - Organization ID.
@@ -221,28 +191,6 @@ export const endPointMap = {
221
191
  */
222
192
  siteInfo: (orgId: string, siteId: string) => `organization/${orgId}/site/${siteId}`,
223
193
 
224
- /**
225
- * Gets the endpoint for tenant configuration data.
226
- * @param orgId - Organization ID.
227
- * @returns The endpoint URL string.
228
- * @public
229
- * @example
230
- * const url = endPointMap.tenantData('org123');
231
- * @ignore
232
- */
233
- tenantData: (orgId: string) => `organization/${orgId}/v2/tenant-configuration?agentView=true`,
234
-
235
- /**
236
- * Gets the endpoint for organization URL mapping.
237
- * @param orgId - Organization ID.
238
- * @returns The endpoint URL string.
239
- * @public
240
- * @example
241
- * const url = endPointMap.urlMapping('org123');
242
- * @ignore
243
- */
244
- urlMapping: (orgId: string) => `organization/${orgId}/v2/org-url-mapping?sort=name,ASC`,
245
-
246
194
  /**
247
195
  * Gets the endpoint for dial plan.
248
196
  * @param orgId - Organization ID.
@@ -253,16 +201,6 @@ export const endPointMap = {
253
201
  * @ignore
254
202
  */
255
203
  dialPlan: (orgId: string) => `organization/${orgId}/dial-plan?agentView=true`,
256
- /**
257
- * Gets the endpoint for listing AI feature flags.
258
- * @param orgId - Organization ID.
259
- * @returns The endpoint URL string.
260
- * @public
261
- * @example
262
- * const url = endPointMap.aiFeatureFlags('org123');
263
- * @ignore
264
- */
265
- aiFeature: (orgId: string) => `organization/${orgId}/v2/ai-feature?page=0&pageSize=100`,
266
204
 
267
205
  /**
268
206
  * Gets the endpoint for the queue list with custom query parameters.
@@ -6,13 +6,9 @@
6
6
  import {HTTP_METHODS} from '../../types';
7
7
  import LoggerProxy from '../../logger-proxy';
8
8
  import {
9
- DesktopProfileResponse,
10
9
  ListAuxCodesResponse,
11
- AgentResponse,
12
- TenantData,
13
- OrgInfo,
14
- OrgSettings,
15
- URLMapping,
10
+ OrgDesktopLoginResponse,
11
+ UserDesktopLoginResponse,
16
12
  TeamList,
17
13
  DialPlanEntity,
18
14
  Profile,
@@ -22,7 +18,6 @@ import {
22
18
  SiteInfo,
23
19
  OutdialAniEntriesResponse,
24
20
  OutdialAniParams,
25
- AIFeatureFlagsResponse,
26
21
  Entity,
27
22
  } from './types';
28
23
  import WebexRequest from '../core/WebexRequest';
@@ -59,12 +54,8 @@ export default class AgentConfigService {
59
54
  */
60
55
  public async getAgentConfig(orgId: string, agentId: string): Promise<Profile> {
61
56
  try {
62
- const userConfigPromise = this.getUserUsingCI(orgId, agentId);
63
- const orgInfoPromise = this.getOrgInfo(orgId);
64
- const orgSettingsPromise = this.getOrganizationSetting(orgId);
65
- const tenantDataPromise = this.getTenantData(orgId);
66
- const urlMappingPromise = this.getURLMapping(orgId);
67
- const aiFeatureFlagsPromise = this.getAIFeatureFlags(orgId);
57
+ const orgConfigPromise = this.getOrgDesktopLoginConfig(orgId);
58
+ const userConfigPromise = this.getUserDesktopLoginConfig(orgId, agentId);
68
59
  const auxCodesPromise = this.getAllAuxCodes(
69
60
  orgId,
70
61
  DEFAULT_PAGE_SIZE,
@@ -72,50 +63,24 @@ export default class AgentConfigService {
72
63
  DEFAULT_AUXCODE_ATTRIBUTES
73
64
  );
74
65
 
75
- const userConfigData = await userConfigPromise;
76
- LoggerProxy.info(`Fetched user data, userId: ${userConfigData.ciUserId}`, {
66
+ const userConfig = await userConfigPromise;
67
+ const {user: userData, agentProfile: agentProfileData} = userConfig;
68
+ LoggerProxy.info(`Fetched user data, userId: ${userData.ciUserId}`, {
77
69
  module: CONFIG_FILE_NAME,
78
70
  method: METHODS.GET_AGENT_CONFIG,
79
71
  });
80
72
 
81
- const agentProfilePromise = this.getDesktopProfileById(orgId, userConfigData.agentProfileId);
82
- const siteInfoPromise = this.getSiteInfo(orgId, userConfigData.siteId);
83
-
84
- const userDialPlanPromise = agentProfilePromise.then((agentProfileConfigData) =>
85
- agentProfileConfigData.dialPlanEnabled ? this.getDialPlanData(orgId) : []
86
- );
87
-
88
- const userTeamPromise = userConfigData.teamIds
89
- ? this.getAllTeams(orgId, DEFAULT_PAGE_SIZE, userConfigData.teamIds)
73
+ const siteInfoPromise = this.getSiteInfo(orgId, userData.siteId);
74
+ const userTeamPromise = this.getAllTeams(orgId, DEFAULT_PAGE_SIZE, userData.dbId);
75
+ const userDialPlanPromise = agentProfileData.dialPlanEnabled
76
+ ? this.getDialPlanData(orgId)
90
77
  : Promise.resolve([]);
91
78
 
92
- const [
93
- agentProfileConfigData,
94
- siteInfo,
95
- userDialPlanData,
96
- userTeamData,
97
- orgInfo,
98
- orgSettingsData,
99
- tenantData,
100
- urlMappingData,
101
- aiFeatureFlagsData,
102
- auxCodesData,
103
- ] = await Promise.all([
104
- agentProfilePromise,
105
- siteInfoPromise,
106
- userDialPlanPromise,
107
- userTeamPromise,
108
- orgInfoPromise,
109
- orgSettingsPromise,
110
- tenantDataPromise,
111
- urlMappingPromise,
112
- aiFeatureFlagsPromise,
113
- auxCodesPromise,
114
- ]);
79
+ const [siteInfo, userDialPlanData, userTeamData, orgConfig, auxCodesData] = await Promise.all(
80
+ [siteInfoPromise, userDialPlanPromise, userTeamPromise, orgConfigPromise, auxCodesPromise]
81
+ );
115
82
  const multimediaProfileId =
116
- userConfigData.multimediaProfileId ||
117
- userTeamData[0]?.multiMediaProfileId ||
118
- siteInfo.multimediaProfileId;
83
+ userTeamData[0]?.multiMediaProfileId || siteInfo.multimediaProfileId;
119
84
 
120
85
  LoggerProxy.info('Fetched all required data', {
121
86
  module: CONFIG_FILE_NAME,
@@ -123,17 +88,13 @@ export default class AgentConfigService {
123
88
  });
124
89
 
125
90
  const response = parseAgentConfigs({
126
- userData: userConfigData,
91
+ orgConfig,
92
+ userData,
93
+ agentProfileData,
127
94
  teamData: userTeamData,
128
- tenantData,
129
- orgInfoData: orgInfo,
130
95
  auxCodes: auxCodesData,
131
- orgSettingsData,
132
- agentProfileData: agentProfileConfigData,
133
96
  dialPlanData: userDialPlanData,
134
- urlMapping: urlMappingData,
135
97
  multimediaProfileId,
136
- aiFeatureFlags: aiFeatureFlagsData,
137
98
  });
138
99
 
139
100
  LoggerProxy.info('Parsing completed for agent-config', {
@@ -156,22 +117,21 @@ export default class AgentConfigService {
156
117
  }
157
118
 
158
119
  /**
159
- * Fetches the agent configuration data for the given orgId and agentId.
120
+ * Fetches the aggregated organization desktop-login configuration for the given orgId.
160
121
  * @ignore
161
- * @param {string} orgId - organization ID for which the agent configuration is to be fetched.
162
- * @param {string} agentId - agent ID for which the configuration is to be fetched.
163
- * @returns {Promise<AgentResponse>} - A promise that resolves to the agent configuration response.
122
+ * @param {string} orgId - organization ID for which the configuration is to be fetched.
123
+ * @returns {Promise<OrgDesktopLoginResponse>} - A promise that resolves to the organization configuration.
164
124
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
165
125
  * @private
166
126
  */
167
- public async getUserUsingCI(orgId: string, agentId: string): Promise<AgentResponse> {
168
- LoggerProxy.info('Fetching user data using CI', {
127
+ public async getOrgDesktopLoginConfig(orgId: string): Promise<OrgDesktopLoginResponse> {
128
+ LoggerProxy.info('Fetching organization desktop-login configuration', {
169
129
  module: CONFIG_FILE_NAME,
170
- method: METHODS.GET_USER_USING_CI,
130
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
171
131
  });
172
132
 
173
133
  try {
174
- const resource = endPointMap.userByCI(orgId, agentId);
134
+ const resource = endPointMap.orgDesktopLogin(orgId);
175
135
  const response = await this.webexReq.request({
176
136
  service: WCC_API_GATEWAY,
177
137
  resource,
@@ -182,41 +142,41 @@ export default class AgentConfigService {
182
142
  throw new Error(`API call failed with ${response.statusCode}`);
183
143
  }
184
144
 
185
- LoggerProxy.log('getUserUsingCI api success.', {
145
+ LoggerProxy.log('getOrgDesktopLoginConfig api success.', {
186
146
  module: CONFIG_FILE_NAME,
187
- method: METHODS.GET_USER_USING_CI,
147
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
188
148
  });
189
149
 
190
150
  return Promise.resolve(response.body);
191
151
  } catch (error) {
192
- LoggerProxy.error(`getUserUsingCI API call failed with ${error}`, {
152
+ LoggerProxy.error(`getOrgDesktopLoginConfig API call failed with ${error}`, {
193
153
  module: CONFIG_FILE_NAME,
194
- method: METHODS.GET_USER_USING_CI,
154
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
195
155
  });
196
156
  throw error;
197
157
  }
198
158
  }
199
159
 
200
160
  /**
201
- * Fetches the desktop profile data for the given orgId and desktopProfileId.
161
+ * Fetches the aggregated user desktop-login configuration for the given orgId and ciUserId.
202
162
  * @ignore
203
- * @param {string} orgId - organization ID for which the desktop profile is to be fetched.
204
- * @param {string} desktopProfileId - desktop profile ID for which the data is to be fetched.
205
- * @returns {Promise<DesktopProfileResponse>} - A promise that resolves to the desktop profile response.
163
+ * @param {string} orgId - organization ID for which the configuration is to be fetched.
164
+ * @param {string} ciUserId - CI user ID of the agent whose configuration is to be fetched.
165
+ * @returns {Promise<UserDesktopLoginResponse>} - A promise that resolves to the user configuration.
206
166
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
207
167
  * @private
208
168
  */
209
- public async getDesktopProfileById(
169
+ public async getUserDesktopLoginConfig(
210
170
  orgId: string,
211
- desktopProfileId: string
212
- ): Promise<DesktopProfileResponse> {
213
- LoggerProxy.info('Fetching desktop profile', {
171
+ ciUserId: string
172
+ ): Promise<UserDesktopLoginResponse> {
173
+ LoggerProxy.info('Fetching user desktop-login configuration', {
214
174
  module: CONFIG_FILE_NAME,
215
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
175
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
216
176
  });
217
177
 
218
178
  try {
219
- const resource = endPointMap.desktopProfile(orgId, desktopProfileId);
179
+ const resource = endPointMap.userDesktopLogin(orgId, ciUserId);
220
180
  const response = await this.webexReq.request({
221
181
  service: WCC_API_GATEWAY,
222
182
  resource,
@@ -227,16 +187,16 @@ export default class AgentConfigService {
227
187
  throw new Error(`API call failed with ${response.statusCode}`);
228
188
  }
229
189
 
230
- LoggerProxy.log('getDesktopProfileById api success.', {
190
+ LoggerProxy.log('getUserDesktopLoginConfig api success.', {
231
191
  module: CONFIG_FILE_NAME,
232
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
192
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
233
193
  });
234
194
 
235
195
  return Promise.resolve(response.body);
236
196
  } catch (error) {
237
- LoggerProxy.error(`getDesktopProfileById API call failed with ${error}`, {
197
+ LoggerProxy.error(`getUserDesktopLoginConfig API call failed with ${error}`, {
238
198
  module: CONFIG_FILE_NAME,
239
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
199
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
240
200
  });
241
201
  throw error;
242
202
  }
@@ -288,13 +248,12 @@ export default class AgentConfigService {
288
248
  }
289
249
 
290
250
  /**
291
- * fetches the list of teams for the given orgId.
251
+ * fetches the list of teams the given user belongs to.
292
252
  * @ignore
293
253
  * @param {string} orgId - organization ID for which the teams are to be fetched.
294
254
  * @param {number} page - the page number to fetch.
295
255
  * @param {number} pageSize - the number of teams to fetch per page.
296
- * @param {string[]} filter - optional filter criteria for the teams.
297
- * @param {string[]} attributes - optional attributes to include in the response.
256
+ * @param {string} userDbId - database ID of the user whose teams are to be fetched.
298
257
  * @returns {Promise<ListTeamsResponse>} - A promise that resolves to the list of teams response.
299
258
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
300
259
  * @private
@@ -303,7 +262,7 @@ export default class AgentConfigService {
303
262
  orgId: string,
304
263
  page: number,
305
264
  pageSize: number,
306
- filter: string[]
265
+ userDbId: string
307
266
  ): Promise<ListTeamsResponse> {
308
267
  LoggerProxy.info('Fetching list of teams', {
309
268
  module: CONFIG_FILE_NAME,
@@ -311,7 +270,7 @@ export default class AgentConfigService {
311
270
  });
312
271
 
313
272
  try {
314
- const resource = endPointMap.listTeams(orgId, page, pageSize, filter);
273
+ const resource = endPointMap.listTeams(orgId, page, pageSize, userDbId);
315
274
  const response = await this.webexReq.request({
316
275
  service: WCC_API_GATEWAY,
317
276
  resource,
@@ -338,26 +297,25 @@ export default class AgentConfigService {
338
297
  }
339
298
 
340
299
  /**
341
- * Fetches all teams from all pages for the given orgId
300
+ * Fetches all teams the given user belongs to, from all pages
342
301
  * @ignore
343
302
  * @param {string} orgId - organization ID for which the teams are to be fetched.
344
303
  * @param {number} pageSize - the number of teams to fetch per page.
345
- * @param {string[]} filter - optional filter criteria for the teams.
346
- * @param {string[]} attributes - optional attributes to include in the response.
304
+ * @param {string} userDbId - database ID of the user whose teams are to be fetched.
347
305
  * @returns {Promise<TeamList[]>} - A promise that resolves to the list of teams.
348
306
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
349
307
  * @private
350
308
  */
351
- public async getAllTeams(orgId: string, pageSize: number, filter: string[]): Promise<TeamList[]> {
309
+ public async getAllTeams(orgId: string, pageSize: number, userDbId: string): Promise<TeamList[]> {
352
310
  try {
353
311
  let allTeams: TeamList[] = [];
354
312
  let page = DEFAULT_PAGE;
355
- const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
313
+ const firstResponse = await this.getListOfTeams(orgId, page, pageSize, userDbId);
356
314
  const totalPages = firstResponse.meta.totalPages;
357
315
  allTeams = allTeams.concat(firstResponse.data);
358
316
  const requests = [];
359
317
  for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
360
- requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
318
+ requests.push(this.getListOfTeams(orgId, page, pageSize, userDbId));
361
319
  }
362
320
  const responses = await Promise.all(requests);
363
321
 
@@ -576,190 +534,6 @@ export default class AgentConfigService {
576
534
  }
577
535
  }
578
536
 
579
- /**
580
- * Fetches the organization info for the given orgId.
581
- * @ignore
582
- * @param {string} orgId - organization ID for which the organization info is to be fetched.
583
- * @returns {Promise<OrgInfo>} - A promise that resolves to the organization info response.
584
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
585
- * @private
586
- */
587
- public async getOrgInfo(orgId: string): Promise<OrgInfo> {
588
- try {
589
- const resource = endPointMap.orgInfo(orgId);
590
- const response = await this.webexReq.request({
591
- service: WCC_API_GATEWAY,
592
- resource,
593
- method: HTTP_METHODS.GET,
594
- });
595
-
596
- if (response.statusCode !== 200) {
597
- throw new Error(`API call failed with ${response.statusCode}`);
598
- }
599
-
600
- LoggerProxy.log('getOrgInfo api success.', {
601
- module: CONFIG_FILE_NAME,
602
- method: METHODS.GET_ORG_INFO,
603
- });
604
-
605
- return Promise.resolve(response.body);
606
- } catch (error) {
607
- LoggerProxy.error(`getOrgInfo API call failed with ${error}`, {
608
- module: CONFIG_FILE_NAME,
609
- method: METHODS.GET_ORG_INFO,
610
- });
611
- throw error;
612
- }
613
- }
614
-
615
- /**
616
- * Fetches the organization settings for the given orgId.
617
- * @ignore
618
- * @param {string} orgId - organization ID for which the organization settings are to be fetched.
619
- * @returns {Promise<OrgSettings>} - A promise that resolves to the organization settings response.
620
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
621
- * @private
622
- */
623
- public async getOrganizationSetting(orgId: string): Promise<OrgSettings> {
624
- try {
625
- const resource = endPointMap.orgSettings(orgId);
626
- const response = await this.webexReq.request({
627
- service: WCC_API_GATEWAY,
628
- resource,
629
- method: HTTP_METHODS.GET,
630
- });
631
-
632
- if (response.statusCode !== 200) {
633
- throw new Error(`API call failed with ${response.statusCode}`);
634
- }
635
-
636
- LoggerProxy.log('getOrganizationSetting api success.', {
637
- module: CONFIG_FILE_NAME,
638
- method: METHODS.GET_ORGANIZATION_SETTING,
639
- });
640
-
641
- return Promise.resolve(response.body.data[0]);
642
- } catch (error) {
643
- LoggerProxy.error(`getOrganizationSetting API call failed with ${error}`, {
644
- module: CONFIG_FILE_NAME,
645
- method: METHODS.GET_ORGANIZATION_SETTING,
646
- });
647
- throw error;
648
- }
649
- }
650
-
651
- /**
652
- * Fetches the tenant data for the given orgId.
653
- * @ignore
654
- * @param {string} orgId - organization ID for which the tenant data is to be fetched.
655
- * @returns {Promise<TenantData>} - A promise that resolves to the tenant data response.
656
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
657
- * @private
658
- */
659
- public async getTenantData(orgId: string): Promise<TenantData> {
660
- try {
661
- const resource = endPointMap.tenantData(orgId);
662
- const response = await this.webexReq.request({
663
- service: WCC_API_GATEWAY,
664
- resource,
665
- method: HTTP_METHODS.GET,
666
- });
667
-
668
- if (response.statusCode !== 200) {
669
- throw new Error(`API call failed with ${response.statusCode}`);
670
- }
671
-
672
- LoggerProxy.log('getTenantData api success.', {
673
- module: CONFIG_FILE_NAME,
674
- method: METHODS.GET_TENANT_DATA,
675
- });
676
-
677
- return Promise.resolve(response.body.data[0]);
678
- } catch (error) {
679
- LoggerProxy.error(`getTenantData API call failed with ${error}`, {
680
- module: CONFIG_FILE_NAME,
681
- method: METHODS.GET_TENANT_DATA,
682
- });
683
- throw error;
684
- }
685
- }
686
-
687
- /**
688
- * Fetches the URL mapping data for the given orgId.
689
- * @ignore
690
- * @param {string} orgId - organization ID for which the URL mapping is to be fetched.
691
- * @returns {Promise<URLMapping[]>} - A promise that resolves to the URL mapping response.
692
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
693
- * @private
694
- */
695
- public async getURLMapping(orgId: string): Promise<URLMapping[]> {
696
- try {
697
- const resource = endPointMap.urlMapping(orgId);
698
- const response = await this.webexReq.request({
699
- service: WCC_API_GATEWAY,
700
- resource,
701
- method: HTTP_METHODS.GET,
702
- });
703
-
704
- if (response.statusCode !== 200) {
705
- throw new Error(`API call failed with ${response.statusCode}`);
706
- }
707
-
708
- LoggerProxy.log('getURLMapping api success.', {
709
- module: CONFIG_FILE_NAME,
710
- method: METHODS.GET_URL_MAPPING,
711
- });
712
-
713
- return Promise.resolve(response.body.data);
714
- } catch (error) {
715
- LoggerProxy.error(`getURLMapping API call failed with ${error}`, {
716
- module: CONFIG_FILE_NAME,
717
- method: METHODS.GET_URL_MAPPING,
718
- });
719
- throw error;
720
- }
721
- }
722
-
723
- /**
724
- * Fetches AI feature resources for the organization.
725
- * @ignore
726
- * @param {string} orgId - organization ID for which AI feature resources are to be fetched.
727
- * @returns {Promise<AIFeatureFlagsResponse>} - AI feature resources response.
728
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
729
- * @private
730
- */
731
- public async getAIFeatureFlags(orgId: string): Promise<AIFeatureFlagsResponse> {
732
- LoggerProxy.info('Fetching AI feature resources', {
733
- module: CONFIG_FILE_NAME,
734
- method: METHODS.GET_AI_FEATURE_FLAGS,
735
- });
736
- try {
737
- const resource = endPointMap.aiFeature(orgId);
738
- const response = await this.webexReq.request({
739
- service: WCC_API_GATEWAY,
740
- resource,
741
- method: HTTP_METHODS.GET,
742
- });
743
-
744
- if (response.statusCode !== 200) {
745
- throw new Error(`API call failed with ${response.statusCode}`);
746
- }
747
-
748
- LoggerProxy.log('getAIFeatureFlags api success.', {
749
- module: CONFIG_FILE_NAME,
750
- method: METHODS.GET_AI_FEATURE_FLAGS,
751
- });
752
-
753
- return Promise.resolve(response.body);
754
- } catch (error) {
755
- LoggerProxy.error(`getAIFeatureFlags API call failed with ${error}`, {
756
- module: CONFIG_FILE_NAME,
757
- method: METHODS.GET_AI_FEATURE_FLAGS,
758
- });
759
- throw error;
760
- }
761
- }
762
-
763
537
  /**
764
538
  * Fetches the dial plan data for the given orgId.
765
539
  * @ignore