@webex/webex-core 3.12.0-next.64 → 3.12.0-next.65

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.
@@ -218,13 +218,23 @@ const Services = WebexPlugin.extend({
218
218
  },
219
219
 
220
220
  /**
221
- * Checks if the current environment is an integration (INT) environment
222
- * by examining the u2c discovery URL from webex config.
221
+ * Checks if the current environment is an integration (INT) environment.
222
+ * Uses the explicit environment config when set, otherwise examines the u2c discovery URL.
223
223
  * INT environments use discovery URLs containing 'intb' (e.g., u2c-intb.ciscospark.com).
224
224
  * @returns {boolean} True if INT environment, false otherwise
225
225
  */
226
226
  isIntegrationEnvironment(): boolean {
227
227
  try {
228
+ const configuredEnvironment = this.webex?.config?.environment;
229
+
230
+ if (configuredEnvironment !== undefined) {
231
+ const isIntFromConfig = configuredEnvironment === 'integration';
232
+
233
+ this.logger.info(`services: isIntegrationEnvironment: ${isIntFromConfig} (config)`);
234
+
235
+ return isIntFromConfig;
236
+ }
237
+
228
238
  const u2cUrl = this.webex?.config?.services?.discovery?.u2c || '';
229
239
  const isInt = u2cUrl.includes('intb');
230
240
 
@@ -1361,6 +1361,32 @@ describe('webex-core', () => {
1361
1361
  });
1362
1362
 
1363
1363
  describe('#isIntegrationEnvironment', () => {
1364
+ it('uses the integration environment config when set, regardless of the u2c URL', () => {
1365
+ services.webex.config = {
1366
+ environment: 'integration',
1367
+ services: {
1368
+ discovery: {
1369
+ u2c: 'https://u2c.wbx2.com/u2c/api/v1',
1370
+ },
1371
+ },
1372
+ };
1373
+
1374
+ assert.isTrue(services.isIntegrationEnvironment());
1375
+ });
1376
+
1377
+ it('uses the production environment config when set, regardless of the u2c URL', () => {
1378
+ services.webex.config = {
1379
+ environment: 'production',
1380
+ services: {
1381
+ discovery: {
1382
+ u2c: 'https://u2c-intb.ciscospark.com/u2c/api/v1',
1383
+ },
1384
+ },
1385
+ };
1386
+
1387
+ assert.isFalse(services.isIntegrationEnvironment());
1388
+ });
1389
+
1364
1390
  it('returns true when u2c URL contains "intb"', () => {
1365
1391
  services.webex.config = {
1366
1392
  services: {
@@ -1283,6 +1283,32 @@ describe('webex-core', () => {
1283
1283
  });
1284
1284
 
1285
1285
  describe('#isIntegrationEnvironment', () => {
1286
+ it('uses the integration environment config when set, regardless of the u2c URL', () => {
1287
+ services.webex.config = {
1288
+ environment: 'integration',
1289
+ services: {
1290
+ discovery: {
1291
+ u2c: 'https://u2c.wbx2.com/u2c/api/v1',
1292
+ },
1293
+ },
1294
+ };
1295
+
1296
+ assert.isTrue(services.isIntegrationEnvironment());
1297
+ });
1298
+
1299
+ it('uses the production environment config when set, regardless of the u2c URL', () => {
1300
+ services.webex.config = {
1301
+ environment: 'production',
1302
+ services: {
1303
+ discovery: {
1304
+ u2c: 'https://u2c-intb.ciscospark.com/u2c/api/v1',
1305
+ },
1306
+ },
1307
+ };
1308
+
1309
+ assert.isFalse(services.isIntegrationEnvironment());
1310
+ });
1311
+
1286
1312
  it('returns true when u2c URL contains "intb"', () => {
1287
1313
  services.webex.config = {
1288
1314
  services: {