@intercom/cli 0.8.1 → 0.8.2

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  View it from the CLI with `intercom changelog`.
9
9
 
10
+ ## [0.8.2] - 2026-06-17
11
+
12
+ ### Fixed
13
+
14
+ - EU- and AU-hosted workspaces now send API requests to their regional host (`api.eu.intercom.io` / `api.au.intercom.io`) automatically. `intercom auth login` detects the workspace's region from `/me` and stores it, so commands route correctly. This fixes `fin workflows upload` (and `enable`/`disable`) failing with `No file provided` for EU/AU workspaces, which happened because uploads to the US host were proxied cross-region in a way that dropped the file. Existing EU/AU users should run `intercom auth login --token <token>` once to record their region. You can still override the host with `INTERCOM_API_BASE_URL`, or set `INTERCOM_REGION=eu|au|us` when authenticating via the `INTERCOM_TOKEN` environment variable.
15
+
10
16
  ## [0.8.1] - 2026-06-16
11
17
 
12
18
  ### Fixed
@@ -106,4 +106,4 @@ export {
106
106
  formatJson,
107
107
  applyJq
108
108
  };
109
- //# sourceMappingURL=chunk-3V2ONMAU.js.map
109
+ //# sourceMappingURL=chunk-HMPO42TQ.js.map
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  applyJq,
10
10
  detectAuthType,
11
11
  formatJson
12
- } from "./chunk-3V2ONMAU.js";
12
+ } from "./chunk-HMPO42TQ.js";
13
13
 
14
14
  // src/index.ts
15
15
  import { Command } from "commander";
@@ -347,6 +347,43 @@ var IntercomClient = class _IntercomClient {
347
347
  }
348
348
  };
349
349
 
350
+ // src/api/regions.ts
351
+ var REGION_BASE_URLS = {
352
+ us: "https://api.intercom.io",
353
+ eu: "https://api.eu.intercom.io",
354
+ au: "https://api.au.intercom.io"
355
+ };
356
+ function regionBaseUrl(region) {
357
+ if (!region) return void 0;
358
+ return REGION_BASE_URLS[region];
359
+ }
360
+ function normalizeRegion(value) {
361
+ if (typeof value !== "string") return void 0;
362
+ switch (value.trim().toLowerCase()) {
363
+ case "us":
364
+ case "usa":
365
+ case "united states":
366
+ return "us";
367
+ case "eu":
368
+ case "europe":
369
+ return "eu";
370
+ case "au":
371
+ case "australia":
372
+ return "au";
373
+ default:
374
+ return void 0;
375
+ }
376
+ }
377
+ function detectRegion(me) {
378
+ if (!me || typeof me !== "object") return void 0;
379
+ const m = me;
380
+ const app = m.app;
381
+ return normalizeRegion(app?.region ?? m.region);
382
+ }
383
+ function resolveBaseUrl(region) {
384
+ return process.env.INTERCOM_API_BASE_URL || regionBaseUrl(region) || void 0;
385
+ }
386
+
350
387
  // src/auth/store.ts
351
388
  import { readFileSync, mkdirSync } from "fs";
352
389
 
@@ -583,7 +620,7 @@ async function resolveClient(options = {}) {
583
620
  token: envToken,
584
621
  authType: detectAuthType(envToken),
585
622
  appId: process.env.INTERCOM_APP_ID ?? "",
586
- baseUrl: process.env.INTERCOM_API_BASE_URL || void 0,
623
+ baseUrl: resolveBaseUrl(normalizeRegion(process.env.INTERCOM_REGION)),
587
624
  verbose: options.verbose,
588
625
  maxRetries: options.retry === false ? 0 : void 0,
589
626
  timeoutMs: options.timeout ? parseInt(options.timeout, 10) * 1e3 : void 0
@@ -613,7 +650,7 @@ async function resolveClient(options = {}) {
613
650
  token: cred.token,
614
651
  authType: cred.auth_type,
615
652
  appId: cred.app_id,
616
- baseUrl: process.env.INTERCOM_API_BASE_URL || void 0,
653
+ baseUrl: resolveBaseUrl(cred.region),
617
654
  verbose: options.verbose,
618
655
  maxRetries: options.retry === false ? 0 : void 0,
619
656
  timeoutMs: options.timeout ? parseInt(options.timeout, 10) * 1e3 : void 0
@@ -833,11 +870,13 @@ async function loginWithToken(token) {
833
870
  const app = me.app;
834
871
  const appId = app?.id_code ?? me.id;
835
872
  const name = app?.name ?? "Unknown";
873
+ const region = detectRegion(me);
836
874
  const configDir2 = process.env.INTERCOM_CONFIG_DIR;
837
875
  const store = new CredentialStore(createDefaultBackend(configDir2));
838
- await store.set(appId, { token, auth_type: authType, app_id: appId });
839
- await addWorkspace(configDir2, { app_id: appId, name });
840
- console.log(`Authenticated to ${name} (${appId})`);
876
+ await store.set(appId, { token, auth_type: authType, app_id: appId, region });
877
+ await addWorkspace(configDir2, { app_id: appId, name, region });
878
+ const regionLabel = region ? ` [${region.toUpperCase()}]` : "";
879
+ console.log(`Authenticated to ${name} (${appId})${regionLabel}`);
841
880
  emitClaudeCodeHint();
842
881
  }
843
882
 
@@ -4090,7 +4129,7 @@ function registerPricingCommand(program) {
4090
4129
  }
4091
4130
  const markdown = await response.text();
4092
4131
  if (opts.json) {
4093
- const { formatJson: formatJson2 } = await import("./json-OEUXXCTX.js");
4132
+ const { formatJson: formatJson2 } = await import("./json-BJB55URV.js");
4094
4133
  console.log(formatJson2({ url: PRICING_URL, content: markdown }));
4095
4134
  } else {
4096
4135
  console.log(markdown);
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  applyJq,
4
4
  formatJson
5
- } from "./chunk-3V2ONMAU.js";
5
+ } from "./chunk-HMPO42TQ.js";
6
6
  export {
7
7
  applyJq,
8
8
  formatJson
9
9
  };
10
- //# sourceMappingURL=json-OEUXXCTX.js.map
10
+ //# sourceMappingURL=json-BJB55URV.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intercom/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "CLI tool for managing Intercom workspaces",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.23.0",