@stripe/link-cli 0.7.3 → 0.8.0

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 (2) hide show
  1. package/dist/cli.js +670 -423
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8835,19 +8835,19 @@ var require_range = __commonJS({
8835
8835
  var replaceCaret = (comp, options) => {
8836
8836
  debug("caret", comp, options);
8837
8837
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
8838
- const z9 = options.includePrerelease ? "-0" : "";
8838
+ const z10 = options.includePrerelease ? "-0" : "";
8839
8839
  return comp.replace(r, (_, M, m, p, pr) => {
8840
8840
  debug("caret", comp, _, M, m, p, pr);
8841
8841
  let ret;
8842
8842
  if (isX(M)) {
8843
8843
  ret = "";
8844
8844
  } else if (isX(m)) {
8845
- ret = `>=${M}.0.0${z9} <${+M + 1}.0.0-0`;
8845
+ ret = `>=${M}.0.0${z10} <${+M + 1}.0.0-0`;
8846
8846
  } else if (isX(p)) {
8847
8847
  if (M === "0") {
8848
- ret = `>=${M}.${m}.0${z9} <${M}.${+m + 1}.0-0`;
8848
+ ret = `>=${M}.${m}.0${z10} <${M}.${+m + 1}.0-0`;
8849
8849
  } else {
8850
- ret = `>=${M}.${m}.0${z9} <${+M + 1}.0.0-0`;
8850
+ ret = `>=${M}.${m}.0${z10} <${+M + 1}.0.0-0`;
8851
8851
  }
8852
8852
  } else if (pr) {
8853
8853
  debug("replaceCaret pr", pr);
@@ -8864,9 +8864,9 @@ var require_range = __commonJS({
8864
8864
  debug("no pr");
8865
8865
  if (M === "0") {
8866
8866
  if (m === "0") {
8867
- ret = `>=${M}.${m}.${p}${z9} <${M}.${m}.${+p + 1}-0`;
8867
+ ret = `>=${M}.${m}.${p}${z10} <${M}.${m}.${+p + 1}-0`;
8868
8868
  } else {
8869
- ret = `>=${M}.${m}.${p}${z9} <${M}.${+m + 1}.0-0`;
8869
+ ret = `>=${M}.${m}.${p}${z10} <${M}.${+m + 1}.0-0`;
8870
8870
  }
8871
8871
  } else {
8872
8872
  ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
@@ -10974,6 +10974,18 @@ var LinkTransportError = class extends LinkSdkError {
10974
10974
  super(message, { code: "transport_error", ...options });
10975
10975
  }
10976
10976
  };
10977
+ var LinkAuthorizationDeclinedError = class extends LinkSdkError {
10978
+ scopeEligibility;
10979
+ constructor(scopeEligibility) {
10980
+ super(
10981
+ "Authorization declined: account is not eligible for requested scopes",
10982
+ {
10983
+ code: "authorization_declined"
10984
+ }
10985
+ );
10986
+ this.scopeEligibility = scopeEligibility;
10987
+ }
10988
+ };
10977
10989
  var LinkApiError = class extends LinkSdkError {
10978
10990
  status;
10979
10991
  rawBody;
@@ -11402,13 +11414,14 @@ var SpendRequestResource = class {
11402
11414
  }
11403
11415
  return res;
11404
11416
  }
11405
- list() {
11406
- return this.listSpendRequests();
11417
+ list(opts) {
11418
+ return this.listSpendRequests(opts);
11407
11419
  }
11408
- async listSpendRequests() {
11420
+ async listSpendRequests(opts) {
11421
+ const url = opts?.includeHistory ? `${this.spendRequestsEndpoint}?include_history=true` : this.spendRequestsEndpoint;
11409
11422
  const { status, data, rawBody } = await this.apiFetch({
11410
11423
  method: "GET",
11411
- url: this.spendRequestsEndpoint
11424
+ url
11412
11425
  });
11413
11426
  if (status < 200 || status >= 300) {
11414
11427
  throw new LinkApiError(
@@ -11424,11 +11437,13 @@ var SpendRequestResource = class {
11424
11437
  return this.createSpendRequest(params);
11425
11438
  }
11426
11439
  async createSpendRequest(params) {
11440
+ const { approve, ...body } = params;
11441
+ const url = approve ? `${this.spendRequestsEndpoint}/create_delegated` : this.spendRequestsEndpoint;
11427
11442
  const { status, data, rawBody } = await this.apiFetch({
11428
11443
  method: "POST",
11429
- url: this.spendRequestsEndpoint,
11444
+ url,
11430
11445
  headers: { "Content-Type": "application/json" },
11431
- body: JSON.stringify(params)
11446
+ body: JSON.stringify(body)
11432
11447
  });
11433
11448
  if (status < 200 || status >= 300) {
11434
11449
  throw new LinkApiError(
@@ -11601,6 +11616,23 @@ var UserInfoResource = class {
11601
11616
  };
11602
11617
  }
11603
11618
  };
11619
+ var REPORT_OUTCOMES = ["success", "blocked", "abandoned"];
11620
+ var REPORT_TAGS = [
11621
+ "stripe_checkout",
11622
+ "captcha",
11623
+ "anti_bot_script",
11624
+ "cdn_block",
11625
+ "waf_block",
11626
+ "dns_block",
11627
+ "rate_limited",
11628
+ "login_required",
11629
+ "3ds_challenge",
11630
+ "page_inaccessible",
11631
+ "timeout",
11632
+ "site_error",
11633
+ "payment_declined",
11634
+ "other"
11635
+ ];
11604
11636
  var EXPIRY_BUFFER_MS = 3e4;
11605
11637
  var WebBotAuthResource = class {
11606
11638
  verbose;
@@ -11730,12 +11762,92 @@ var WebBotAuthResource = class {
11730
11762
  return webBotAuth;
11731
11763
  }
11732
11764
  };
11765
+ var ReportResource = class {
11766
+ verbose;
11767
+ getAccessToken;
11768
+ fetchImpl;
11769
+ endpoint;
11770
+ logger;
11771
+ constructor(options) {
11772
+ const config = resolveLinkSdkConfig(options);
11773
+ this.verbose = config.verbose;
11774
+ this.getAccessToken = config.getAccessToken;
11775
+ this.fetchImpl = requireFetchImplementation(config);
11776
+ this.endpoint = `${config.apiBaseUrl}/agent_observations`;
11777
+ this.logger = config.logger;
11778
+ }
11779
+ async rawFetch(opts) {
11780
+ if (this.verbose) {
11781
+ const redactedHeaders = { ...opts.headers };
11782
+ if (redactedHeaders.Authorization)
11783
+ redactedHeaders.Authorization = "Bearer <redacted>";
11784
+ this.logger.debug(`> ${opts.method} ${opts.url}`);
11785
+ this.logger.debug(` Headers: ${JSON.stringify(redactedHeaders)}`);
11786
+ if (opts.body) this.logger.debug(opts.body);
11787
+ }
11788
+ let response;
11789
+ try {
11790
+ response = await this.fetchImpl(opts.url, {
11791
+ method: opts.method,
11792
+ headers: opts.headers,
11793
+ body: opts.body
11794
+ });
11795
+ } catch (error) {
11796
+ throw new LinkTransportError(
11797
+ `Request failed: ${opts.method} ${opts.url}`,
11798
+ { cause: error }
11799
+ );
11800
+ }
11801
+ const rawBody = await response.text();
11802
+ let data = null;
11803
+ try {
11804
+ data = JSON.parse(rawBody);
11805
+ } catch {
11806
+ }
11807
+ if (this.verbose) {
11808
+ this.logger.debug(`< ${response.status} ${response.statusText}`);
11809
+ this.logger.debug(JSON.stringify(data, null, 2) ?? rawBody);
11810
+ }
11811
+ return { status: response.status, data, rawBody };
11812
+ }
11813
+ async apiFetch(opts) {
11814
+ const token = await this.getAccessToken();
11815
+ const authedOpts = {
11816
+ ...opts,
11817
+ headers: { ...opts.headers, Authorization: `Bearer ${token}` }
11818
+ };
11819
+ const res = await this.rawFetch(authedOpts);
11820
+ if (res.status === 401) {
11821
+ const refreshedToken = await this.getAccessToken({ forceRefresh: true });
11822
+ authedOpts.headers.Authorization = `Bearer ${refreshedToken}`;
11823
+ return this.rawFetch(authedOpts);
11824
+ }
11825
+ return res;
11826
+ }
11827
+ async create(params) {
11828
+ const { status, data, rawBody } = await this.apiFetch({
11829
+ method: "POST",
11830
+ url: this.endpoint,
11831
+ headers: { "Content-Type": "application/json" },
11832
+ body: JSON.stringify(params)
11833
+ });
11834
+ if (status < 200 || status >= 300) {
11835
+ const message = data && typeof data === "object" && "error" in data && typeof data.error === "object" ? data.error?.message ?? rawBody : rawBody;
11836
+ throw new LinkApiError(
11837
+ `Failed to create report (${status}): ${message}`,
11838
+ { status, rawBody, details: data }
11839
+ );
11840
+ }
11841
+ return data;
11842
+ }
11843
+ };
11733
11844
 
11734
11845
  // src/cli.tsx
11735
- import { Cli as Cli10 } from "incur";
11846
+ import { Cli as Cli11 } from "incur";
11736
11847
 
11737
11848
  // src/commands/auth/index.tsx
11738
11849
  import { Cli } from "incur";
11850
+ import { Text as Text4 } from "ink";
11739
11851
 
11740
11852
  // src/utils/poll-until.ts
11741
11853
  async function* pollUntil(options) {
@@ -11862,6 +11974,7 @@ var Login = ({
11862
11974
  const [verificationUrl, setVerificationUrl] = useState("");
11863
11975
  const [deviceCode, setDeviceCode] = useState("");
11864
11976
  const [error, setError] = useState("");
11977
+ const [scopeEligibility, setScopeEligibility] = useState({});
11865
11978
  const isActive = status === "waiting" || status === "polling";
11866
11979
  useInput(
11867
11980
  (_input, key) => {
@@ -11899,8 +12012,13 @@ var Login = ({
11899
12012
  }
11900
12013
  } catch (err) {
11901
12014
  clearInterval(pollInterval);
11902
- setError(err.message);
11903
- setStatus("error");
12015
+ if (err instanceof LinkAuthorizationDeclinedError) {
12016
+ setScopeEligibility(err.scopeEligibility);
12017
+ setStatus("declined");
12018
+ } else {
12019
+ setError(err.message);
12020
+ setStatus("error");
12021
+ }
11904
12022
  }
11905
12023
  }, 2e3);
11906
12024
  return () => clearInterval(pollInterval);
@@ -11914,6 +12032,22 @@ var Login = ({
11914
12032
  " Initiating authentication..."
11915
12033
  ] }) });
11916
12034
  }
12035
+ if (status === "declined") {
12036
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
12037
+ /* @__PURE__ */ jsx(Text, { color: "red", children: "\u2717 Authorization failed" }),
12038
+ Object.entries(scopeEligibility).map(([scope, info]) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
12039
+ /* @__PURE__ */ jsxs(Text, { children: [
12040
+ /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
12041
+ scope,
12042
+ ":"
12043
+ ] }),
12044
+ " ineligible",
12045
+ info.ineligibility_reasons.length > 0 ? ` (${info.ineligibility_reasons.join(", ")})` : ""
12046
+ ] }),
12047
+ info.description ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: info.description }) : null
12048
+ ] }, scope))
12049
+ ] });
12050
+ }
11917
12051
  if (status === "error") {
11918
12052
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
11919
12053
  /* @__PURE__ */ jsx(Text, { color: "red", children: "\u2717 Authentication failed" }),
@@ -12200,6 +12334,29 @@ function createAuthCli(authResource, getUpdateInfo2, authStorage2, envAccessToke
12200
12334
  message: "client-name must be a non-empty string"
12201
12335
  });
12202
12336
  }
12337
+ const existingAuth = storage2.getAuth();
12338
+ if (existingAuth?.refresh_token) {
12339
+ try {
12340
+ const refreshed = await authResource.refreshToken(
12341
+ existingAuth.refresh_token
12342
+ );
12343
+ storage2.setAuth(refreshed);
12344
+ const alreadyLoggedInMessage = "You are already logged in. To switch accounts, run `link-cli auth logout` first.";
12345
+ const alreadyLoggedIn = sanitizeDeep({
12346
+ authenticated: true,
12347
+ message: alreadyLoggedInMessage
12348
+ });
12349
+ if (!c.agent && !c.formatExplicit) {
12350
+ return renderInteractive(
12351
+ /* @__PURE__ */ jsx4(Text4, { color: "yellow", children: alreadyLoggedInMessage }),
12352
+ () => alreadyLoggedIn
12353
+ );
12354
+ }
12355
+ yield alreadyLoggedIn;
12356
+ return;
12357
+ } catch {
12358
+ }
12359
+ }
12203
12360
  await maybeRevokeAndClearAuth(authResource, storage2);
12204
12361
  if (!c.agent && !c.formatExplicit) {
12205
12362
  return renderInteractive(
@@ -12350,25 +12507,25 @@ function createAuthCli(authResource, getUpdateInfo2, authStorage2, envAccessToke
12350
12507
  import { Cli as Cli2, z as z2 } from "incur";
12351
12508
 
12352
12509
  // src/commands/demo/demo-runner.tsx
12353
- import { Box as Box8, Text as Text9, useApp, useInput as useInput4 } from "ink";
12510
+ import { Box as Box8, Text as Text10, useApp, useInput as useInput4 } from "ink";
12354
12511
  import { useCallback as useCallback2, useState as useState7 } from "react";
12355
12512
 
12356
12513
  // src/utils/markdown-text.tsx
12357
- import { Text as Text4 } from "ink";
12514
+ import { Text as Text5 } from "ink";
12358
12515
  import { jsx as jsx5 } from "react/jsx-runtime";
12359
12516
  var MarkdownText = ({
12360
12517
  children,
12361
12518
  dimColor
12362
12519
  }) => {
12363
12520
  const parts = tokenize(children);
12364
- return /* @__PURE__ */ jsx5(Text4, { dimColor, children: parts.map((part) => {
12521
+ return /* @__PURE__ */ jsx5(Text5, { dimColor, children: parts.map((part) => {
12365
12522
  if (part.type === "bold") {
12366
- return /* @__PURE__ */ jsx5(Text4, { bold: true, children: part.text }, part.key);
12523
+ return /* @__PURE__ */ jsx5(Text5, { bold: true, children: part.text }, part.key);
12367
12524
  }
12368
12525
  if (part.type === "code") {
12369
- return /* @__PURE__ */ jsx5(Text4, { color: "yellow", children: part.text }, part.key);
12526
+ return /* @__PURE__ */ jsx5(Text5, { color: "yellow", children: part.text }, part.key);
12370
12527
  }
12371
- return /* @__PURE__ */ jsx5(Text4, { children: part.text }, part.key);
12528
+ return /* @__PURE__ */ jsx5(Text5, { children: part.text }, part.key);
12372
12529
  }) });
12373
12530
  };
12374
12531
  function tokenize(input) {
@@ -12403,7 +12560,7 @@ function tokenize(input) {
12403
12560
  }
12404
12561
 
12405
12562
  // src/commands/spend-request/app-download-qr-codes.tsx
12406
- import { Box as Box4, Text as Text5 } from "ink";
12563
+ import { Box as Box4, Text as Text6 } from "ink";
12407
12564
  import { useMemo } from "react";
12408
12565
 
12409
12566
  // src/utils/render-qr-matrix.ts
@@ -12445,19 +12602,19 @@ var DOWNLOAD_URL = "https://link.com/download";
12445
12602
  var AppDownloadQrCodes = () => {
12446
12603
  const qrLines = useMemo(() => renderQrMatrix(DOWNLOAD_URL), []);
12447
12604
  return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
12448
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "Get the Link app to approve spend requests from your phone" }),
12605
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "Get the Link app to approve spend requests from your phone" }),
12449
12606
  /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", alignItems: "flex-start", marginTop: 1, children: [
12450
12607
  qrLines.map((line, i) => (
12451
12608
  // biome-ignore lint/suspicious/noArrayIndexKey: stable static array
12452
- /* @__PURE__ */ jsx6(Text5, { children: line }, i)
12609
+ /* @__PURE__ */ jsx6(Text6, { children: line }, i)
12453
12610
  )),
12454
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: DOWNLOAD_URL })
12611
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: DOWNLOAD_URL })
12455
12612
  ] })
12456
12613
  ] });
12457
12614
  };
12458
12615
 
12459
12616
  // src/commands/demo/card-flow.tsx
12460
- import { Box as Box5, Text as Text6, useInput as useInput2 } from "ink";
12617
+ import { Box as Box5, Text as Text7, useInput as useInput2 } from "ink";
12461
12618
  import { useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
12462
12619
 
12463
12620
  // src/utils/poll-until-approved.ts
@@ -12806,22 +12963,22 @@ var CardFlow = ({
12806
12963
  ];
12807
12964
  return order.indexOf(step) > order.indexOf(target);
12808
12965
  };
12809
- const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
12966
+ const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs5(Text7, { dimColor: true, children: [
12810
12967
  "\n",
12811
12968
  ">",
12812
12969
  " ",
12813
12970
  label
12814
12971
  ] });
12815
12972
  return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, children: [
12816
- /* @__PURE__ */ jsx7(Text6, { bold: true, color: "cyan", children: CARD_FLOW.title }),
12973
+ /* @__PURE__ */ jsx7(Text7, { bold: true, color: "cyan", children: CARD_FLOW.title }),
12817
12974
  /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12818
12975
  /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
12819
- /* @__PURE__ */ jsx7(Text6, { color: "yellow", children: "[testmode]" }),
12820
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: DEMO_MERCHANT_URL })
12976
+ /* @__PURE__ */ jsx7(Text7, { color: "yellow", children: "[testmode]" }),
12977
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: DEMO_MERCHANT_URL })
12821
12978
  ] }),
12822
12979
  /* @__PURE__ */ jsx7(MarkdownText, { children: CARD_FLOW.intro.description }),
12823
12980
  /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "column", children: [
12824
- /* @__PURE__ */ jsx7(Text6, { children: "What happens:" }),
12981
+ /* @__PURE__ */ jsx7(Text7, { children: "What happens:" }),
12825
12982
  CARD_FLOW.intro.steps.map((s, i) => {
12826
12983
  const doneAfter = [
12827
12984
  "pick-pm",
@@ -12837,17 +12994,17 @@ var CardFlow = ({
12837
12994
  ];
12838
12995
  const done = pastStep(doneAfter[i]);
12839
12996
  const active = !done && (step === activeFrom[i] || pastStep(activeFrom[i]));
12840
- return done ? /* @__PURE__ */ jsxs5(Text6, { dimColor: true, strikethrough: true, children: [
12997
+ return done ? /* @__PURE__ */ jsxs5(Text7, { dimColor: true, strikethrough: true, children: [
12841
12998
  " ",
12842
12999
  i + 1,
12843
13000
  ". ",
12844
13001
  s
12845
- ] }, s) : active ? /* @__PURE__ */ jsxs5(Text6, { bold: true, color: "cyan", children: [
13002
+ ] }, s) : active ? /* @__PURE__ */ jsxs5(Text7, { bold: true, color: "cyan", children: [
12846
13003
  " ",
12847
13004
  i + 1,
12848
13005
  ". ",
12849
13006
  s
12850
- ] }, s) : /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
13007
+ ] }, s) : /* @__PURE__ */ jsxs5(Text7, { dimColor: true, children: [
12851
13008
  " ",
12852
13009
  i + 1,
12853
13010
  ". ",
@@ -12857,26 +13014,26 @@ var CardFlow = ({
12857
13014
  ] }),
12858
13015
  step === "intro" && prompt(CARD_FLOW.intro.prompt)
12859
13016
  ] }),
12860
- step === "fetch-pm" && /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", children: /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Fetching payment methods from your Link wallet..." }) }),
13017
+ step === "fetch-pm" && /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Fetching payment methods from your Link wallet..." }) }),
12861
13018
  (step === "pick-pm" || step === "explain-pm") && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12862
13019
  step === "pick-pm" && paymentMethods.length > 1 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12863
- /* @__PURE__ */ jsx7(Text6, { children: "Which payment method should we use for the demo?" }),
12864
- /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", marginTop: 1, children: paymentMethods.map((pm, i) => /* @__PURE__ */ jsx7(Text6, { children: i === selectedPmIndex ? /* @__PURE__ */ jsxs5(Text6, { color: "cyan", bold: true, children: [
13020
+ /* @__PURE__ */ jsx7(Text7, { children: "Which payment method should we use for the demo?" }),
13021
+ /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", marginTop: 1, children: paymentMethods.map((pm, i) => /* @__PURE__ */ jsx7(Text7, { children: i === selectedPmIndex ? /* @__PURE__ */ jsxs5(Text7, { color: "cyan", bold: true, children: [
12865
13022
  ">",
12866
13023
  " ",
12867
13024
  formatPmLabel(pm),
12868
13025
  pm.is_default ? " (default)" : ""
12869
- ] }) : /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
13026
+ ] }) : /* @__PURE__ */ jsxs5(Text7, { dimColor: true, children: [
12870
13027
  " ",
12871
13028
  formatPmLabel(pm),
12872
13029
  pm.is_default ? " (default)" : ""
12873
13030
  ] }) }, pm.id)) }),
12874
- /* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Use \u2191\u2193 to select, [Enter] to confirm" }) })
13031
+ /* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Use \u2191\u2193 to select, [Enter] to confirm" }) })
12875
13032
  ] }),
12876
13033
  paymentMethod && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12877
- /* @__PURE__ */ jsxs5(Text6, { color: "green", children: [
13034
+ /* @__PURE__ */ jsxs5(Text7, { color: "green", children: [
12878
13035
  "\u2713 Using ",
12879
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: pmLabel }),
13036
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: pmLabel }),
12880
13037
  paymentMethod.is_default ? " (default)" : ""
12881
13038
  ] }),
12882
13039
  step === "explain-pm" && prompt(CARD_FLOW.explainPm.prompt)
@@ -12884,16 +13041,16 @@ var CardFlow = ({
12884
13041
  ] }),
12885
13042
  step === "create-spend" && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12886
13043
  /* @__PURE__ */ jsx7(MarkdownText, { children: CARD_FLOW.createSpend.description }),
12887
- /* @__PURE__ */ jsx7(Box5, { marginY: 1, children: /* @__PURE__ */ jsx7(Text6, { color: "cyan", children: CARD_FLOW.createSpend.loading }) })
13044
+ /* @__PURE__ */ jsx7(Box5, { marginY: 1, children: /* @__PURE__ */ jsx7(Text7, { color: "cyan", children: CARD_FLOW.createSpend.loading }) })
12888
13045
  ] }),
12889
13046
  (step === "await-approval" || step === "approval-timeout") && spendRequest && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12890
- /* @__PURE__ */ jsxs5(Text6, { color: "green", children: [
13047
+ /* @__PURE__ */ jsxs5(Text7, { color: "green", children: [
12891
13048
  "\u2713 Spend request created (",
12892
13049
  spendRequest.id,
12893
13050
  ")"
12894
13051
  ] }),
12895
13052
  step === "await-approval" && /* @__PURE__ */ jsxs5(Fragment, { children: [
12896
- /* @__PURE__ */ jsx7(Text6, { children: CARD_FLOW.approval.description }),
13053
+ /* @__PURE__ */ jsx7(Text7, { children: CARD_FLOW.approval.description }),
12897
13054
  /* @__PURE__ */ jsxs5(
12898
13055
  Box5,
12899
13056
  {
@@ -12904,19 +13061,19 @@ var CardFlow = ({
12904
13061
  paddingY: 1,
12905
13062
  marginTop: 1,
12906
13063
  children: [
12907
- /* @__PURE__ */ jsxs5(Text6, { children: [
13064
+ /* @__PURE__ */ jsxs5(Text7, { children: [
12908
13065
  "Approve at:",
12909
13066
  " ",
12910
- /* @__PURE__ */ jsx7(Text6, { bold: true, color: "cyan", children: approvalUrl })
13067
+ /* @__PURE__ */ jsx7(Text7, { bold: true, color: "cyan", children: approvalUrl })
12911
13068
  ] }),
12912
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: CARD_FLOW.approval.browserHint })
13069
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: CARD_FLOW.approval.browserHint })
12913
13070
  ]
12914
13071
  }
12915
13072
  ),
12916
- /* @__PURE__ */ jsx7(Box5, { marginY: 1, children: /* @__PURE__ */ jsx7(Text6, { color: "cyan", children: CARD_FLOW.approval.loading }) })
13073
+ /* @__PURE__ */ jsx7(Box5, { marginY: 1, children: /* @__PURE__ */ jsx7(Text7, { color: "cyan", children: CARD_FLOW.approval.loading }) })
12917
13074
  ] }),
12918
13075
  step === "approval-timeout" && /* @__PURE__ */ jsxs5(Fragment, { children: [
12919
- /* @__PURE__ */ jsx7(Text6, { color: "yellow", children: "\u26A0 Approval timed out (5 min). Still pending \u2014 you can still approve." }),
13076
+ /* @__PURE__ */ jsx7(Text7, { color: "yellow", children: "\u26A0 Approval timed out (5 min). Still pending \u2014 you can still approve." }),
12920
13077
  /* @__PURE__ */ jsxs5(
12921
13078
  Box5,
12922
13079
  {
@@ -12927,38 +13084,38 @@ var CardFlow = ({
12927
13084
  paddingY: 1,
12928
13085
  marginTop: 1,
12929
13086
  children: [
12930
- /* @__PURE__ */ jsxs5(Text6, { children: [
13087
+ /* @__PURE__ */ jsxs5(Text7, { children: [
12931
13088
  "Approve at:",
12932
13089
  " ",
12933
- /* @__PURE__ */ jsx7(Text6, { bold: true, color: "cyan", children: approvalUrl })
13090
+ /* @__PURE__ */ jsx7(Text7, { bold: true, color: "cyan", children: approvalUrl })
12934
13091
  ] }),
12935
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Press [Enter] to open in browser" })
13092
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Press [Enter] to open in browser" })
12936
13093
  ]
12937
13094
  }
12938
13095
  ),
12939
- /* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "r Retry polling q Quit demo" }) })
13096
+ /* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "r Retry polling q Quit demo" }) })
12940
13097
  ] })
12941
13098
  ] }),
12942
13099
  (step === "show-card" || step === "open-url" || step === "done") && card && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12943
- /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u2713 Approved!" }),
13100
+ /* @__PURE__ */ jsx7(Text7, { color: "green", children: "\u2713 Approved!" }),
12944
13101
  /* @__PURE__ */ jsx7(MarkdownText, { children: CARD_FLOW.showCard.description }),
12945
- /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", paddingX: 2, marginTop: 1, children: /* @__PURE__ */ jsxs5(Text6, { children: [
12946
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Number " }),
12947
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: formatCardNumber(card.number) }),
13102
+ /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", paddingX: 2, marginTop: 1, children: /* @__PURE__ */ jsxs5(Text7, { children: [
13103
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Number " }),
13104
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: formatCardNumber(card.number) }),
12948
13105
  " ",
12949
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Exp " }),
12950
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: formatExpiry(card.exp_month, card.exp_year) }),
13106
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Exp " }),
13107
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: formatExpiry(card.exp_month, card.exp_year) }),
12951
13108
  " ",
12952
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "CVC " }),
12953
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: card.cvc }),
13109
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "CVC " }),
13110
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: card.cvc }),
12954
13111
  card.billing_address?.postal_code && /* @__PURE__ */ jsxs5(Fragment, { children: [
12955
13112
  " ",
12956
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "Zip " }),
12957
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: card.billing_address.postal_code })
13113
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Zip " }),
13114
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: card.billing_address.postal_code })
12958
13115
  ] }),
12959
13116
  card.valid_until && /* @__PURE__ */ jsxs5(Fragment, { children: [
12960
13117
  " ",
12961
- /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
13118
+ /* @__PURE__ */ jsxs5(Text7, { dimColor: true, children: [
12962
13119
  "expires",
12963
13120
  " ",
12964
13121
  new Date(card.valid_until).toLocaleTimeString([], {
@@ -12971,13 +13128,13 @@ var CardFlow = ({
12971
13128
  step === "show-card" && prompt(CARD_FLOW.showCard.prompt)
12972
13129
  ] }),
12973
13130
  step === "done" && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
12974
- /* @__PURE__ */ jsxs5(Text6, { color: "green", children: [
13131
+ /* @__PURE__ */ jsxs5(Text7, { color: "green", children: [
12975
13132
  "\u2713 ",
12976
13133
  CARD_FLOW.done.success
12977
13134
  ] }),
12978
- /* @__PURE__ */ jsx7(Text6, { children: CARD_FLOW.done.detail })
13135
+ /* @__PURE__ */ jsx7(Text7, { children: CARD_FLOW.done.detail })
12979
13136
  ] }),
12980
- step === "error" && /* @__PURE__ */ jsxs5(Text6, { color: "red", children: [
13137
+ step === "error" && /* @__PURE__ */ jsxs5(Text7, { color: "red", children: [
12981
13138
  "Error: ",
12982
13139
  error
12983
13140
  ] })
@@ -12985,7 +13142,7 @@ var CardFlow = ({
12985
13142
  };
12986
13143
 
12987
13144
  // src/commands/demo/spt-flow.tsx
12988
- import { Box as Box7, Text as Text8, useInput as useInput3 } from "ink";
13145
+ import { Box as Box7, Text as Text9, useInput as useInput3 } from "ink";
12989
13146
  import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
12990
13147
 
12991
13148
  // src/commands/mpp/decode.ts
@@ -13067,7 +13224,7 @@ function decodeStripeChallenge(challengeHeader) {
13067
13224
  }
13068
13225
 
13069
13226
  // src/commands/mpp/pay.tsx
13070
- import { Box as Box6, Text as Text7 } from "ink";
13227
+ import { Box as Box6, Text as Text8 } from "ink";
13071
13228
  import Spinner3 from "ink-spinner";
13072
13229
  import { Credential, Method } from "mppx";
13073
13230
  import { Mppx, Transport } from "mppx/client";
@@ -13247,13 +13404,13 @@ function MppPay({
13247
13404
  done: "Done"
13248
13405
  };
13249
13406
  if (error) {
13250
- return /* @__PURE__ */ jsxs6(Text7, { color: "red", children: [
13407
+ return /* @__PURE__ */ jsxs6(Text8, { color: "red", children: [
13251
13408
  "Error: ",
13252
13409
  error
13253
13410
  ] });
13254
13411
  }
13255
13412
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
13256
- step !== "done" && /* @__PURE__ */ jsx8(Box6, { children: /* @__PURE__ */ jsxs6(Text7, { color: "cyan", children: [
13413
+ step !== "done" && /* @__PURE__ */ jsx8(Box6, { children: /* @__PURE__ */ jsxs6(Text8, { color: "cyan", children: [
13257
13414
  /* @__PURE__ */ jsx8(Spinner3, { type: "dots" }),
13258
13415
  " ",
13259
13416
  stepLabels[step],
@@ -13261,7 +13418,7 @@ function MppPay({
13261
13418
  ] }) }),
13262
13419
  result && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
13263
13420
  /* @__PURE__ */ jsxs6(
13264
- Text7,
13421
+ Text8,
13265
13422
  {
13266
13423
  color: result.status >= 400 ? "red" : result.status >= 300 ? "yellow" : "green",
13267
13424
  children: [
@@ -13270,7 +13427,7 @@ function MppPay({
13270
13427
  ]
13271
13428
  }
13272
13429
  ),
13273
- /* @__PURE__ */ jsx8(Text7, { children: result.body })
13430
+ /* @__PURE__ */ jsx8(Text8, { children: result.body })
13274
13431
  ] })
13275
13432
  ] });
13276
13433
  }
@@ -13459,18 +13616,18 @@ var SptFlow = ({
13459
13616
  ];
13460
13617
  return order.indexOf(step) > order.indexOf(target);
13461
13618
  };
13462
- const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs7(Text8, { dimColor: true, children: [
13619
+ const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs7(Text9, { dimColor: true, children: [
13463
13620
  "\n",
13464
13621
  ">",
13465
13622
  " ",
13466
13623
  label
13467
13624
  ] });
13468
13625
  return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", gap: 1, children: [
13469
- /* @__PURE__ */ jsx9(Text8, { bold: true, color: "cyan", children: SPT_FLOW.title }),
13626
+ /* @__PURE__ */ jsx9(Text9, { bold: true, color: "cyan", children: SPT_FLOW.title }),
13470
13627
  /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13471
13628
  /* @__PURE__ */ jsxs7(Box7, { flexDirection: "row", gap: 1, children: [
13472
- /* @__PURE__ */ jsx9(Text8, { color: "yellow", children: "[testmode]" }),
13473
- /* @__PURE__ */ jsxs7(Text8, { dimColor: true, children: [
13629
+ /* @__PURE__ */ jsx9(Text9, { color: "yellow", children: "[testmode]" }),
13630
+ /* @__PURE__ */ jsxs7(Text9, { dimColor: true, children: [
13474
13631
  DEMO_CLIMATE_API_URL,
13475
13632
  " ",
13476
13633
  DEMO_MPP_DEV_URL
@@ -13478,7 +13635,7 @@ var SptFlow = ({
13478
13635
  ] }),
13479
13636
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.intro.description }),
13480
13637
  /* @__PURE__ */ jsxs7(Box7, { marginTop: 1, flexDirection: "column", children: [
13481
- /* @__PURE__ */ jsx9(Text8, { children: SPT_FLOW.intro.preamble }),
13638
+ /* @__PURE__ */ jsx9(Text9, { children: SPT_FLOW.intro.preamble }),
13482
13639
  SPT_FLOW.intro.steps.map((s, i) => {
13483
13640
  const doneAfter = [
13484
13641
  "pick-pm",
@@ -13497,17 +13654,17 @@ var SptFlow = ({
13497
13654
  const done = pastStep(doneAfter[i]);
13498
13655
  const active = !done && (step === activeFrom[i] || pastStep(activeFrom[i]));
13499
13656
  const label = s.replace(/`/g, "");
13500
- return done ? /* @__PURE__ */ jsxs7(Text8, { dimColor: true, strikethrough: true, children: [
13657
+ return done ? /* @__PURE__ */ jsxs7(Text9, { dimColor: true, strikethrough: true, children: [
13501
13658
  " ",
13502
13659
  i + 1,
13503
13660
  ". ",
13504
13661
  label
13505
- ] }, s) : active ? /* @__PURE__ */ jsxs7(Text8, { bold: true, color: "cyan", children: [
13662
+ ] }, s) : active ? /* @__PURE__ */ jsxs7(Text9, { bold: true, color: "cyan", children: [
13506
13663
  " ",
13507
13664
  i + 1,
13508
13665
  ". ",
13509
13666
  label
13510
- ] }, s) : /* @__PURE__ */ jsxs7(Text8, { dimColor: true, children: [
13667
+ ] }, s) : /* @__PURE__ */ jsxs7(Text9, { dimColor: true, children: [
13511
13668
  " ",
13512
13669
  i + 1,
13513
13670
  ". ",
@@ -13517,45 +13674,45 @@ var SptFlow = ({
13517
13674
  ] }),
13518
13675
  step === "intro" && prompt(SPT_FLOW.intro.prompt)
13519
13676
  ] }),
13520
- step === "fetch-pm" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text8, { color: "cyan", children: "Fetching payment methods..." }) }),
13677
+ step === "fetch-pm" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "cyan", children: "Fetching payment methods..." }) }),
13521
13678
  step === "pick-pm" && paymentMethods.length > 1 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13522
- /* @__PURE__ */ jsx9(Text8, { children: "Which payment method should we use for the demo?" }),
13523
- /* @__PURE__ */ jsx9(Box7, { flexDirection: "column", marginTop: 1, children: paymentMethods.map((pm, i) => /* @__PURE__ */ jsx9(Text8, { children: i === selectedPmIndex ? /* @__PURE__ */ jsxs7(Text8, { color: "cyan", bold: true, children: [
13679
+ /* @__PURE__ */ jsx9(Text9, { children: "Which payment method should we use for the demo?" }),
13680
+ /* @__PURE__ */ jsx9(Box7, { flexDirection: "column", marginTop: 1, children: paymentMethods.map((pm, i) => /* @__PURE__ */ jsx9(Text9, { children: i === selectedPmIndex ? /* @__PURE__ */ jsxs7(Text9, { color: "cyan", bold: true, children: [
13524
13681
  ">",
13525
13682
  " ",
13526
13683
  pm.card_details ? `${pm.card_details.brand} ****${pm.card_details.last4}` : pm.type,
13527
13684
  pm.is_default ? " (default)" : ""
13528
- ] }) : /* @__PURE__ */ jsxs7(Text8, { dimColor: true, children: [
13685
+ ] }) : /* @__PURE__ */ jsxs7(Text9, { dimColor: true, children: [
13529
13686
  " ",
13530
13687
  pm.card_details ? `${pm.card_details.brand} ****${pm.card_details.last4}` : pm.type,
13531
13688
  pm.is_default ? " (default)" : ""
13532
13689
  ] }) }, pm.id)) }),
13533
- /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "Use \u2191\u2193 to select, [Enter] to confirm" }) })
13690
+ /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Use \u2191\u2193 to select, [Enter] to confirm" }) })
13534
13691
  ] }),
13535
13692
  (step === "probe" || step === "explain-402") && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13536
13693
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.probe.description }),
13537
- step === "probe" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text8, { color: "cyan", children: SPT_FLOW.probe.loading }) }),
13694
+ step === "probe" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "cyan", children: SPT_FLOW.probe.loading }) }),
13538
13695
  step === "explain-402" && networkId && /* @__PURE__ */ jsxs7(Fragment2, { children: [
13539
13696
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.probe.detail }),
13540
- /* @__PURE__ */ jsxs7(Text8, { color: "green", children: [
13697
+ /* @__PURE__ */ jsxs7(Text9, { color: "green", children: [
13541
13698
  "\u2713 Got HTTP 402 \u2014 network_id: ",
13542
- /* @__PURE__ */ jsx9(Text8, { bold: true, children: networkId })
13699
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: networkId })
13543
13700
  ] }),
13544
13701
  prompt(SPT_FLOW.probe.prompt)
13545
13702
  ] })
13546
13703
  ] }),
13547
13704
  step === "create-spend" && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13548
13705
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.createSpend.description }),
13549
- /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text8, { color: "cyan", children: SPT_FLOW.createSpend.loading }) })
13706
+ /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "cyan", children: SPT_FLOW.createSpend.loading }) })
13550
13707
  ] }),
13551
13708
  (step === "await-approval" || step === "approval-timeout") && spendRequest && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13552
- /* @__PURE__ */ jsxs7(Text8, { color: "green", children: [
13709
+ /* @__PURE__ */ jsxs7(Text9, { color: "green", children: [
13553
13710
  "\u2713 Spend request created (",
13554
13711
  spendRequest.id,
13555
13712
  ")"
13556
13713
  ] }),
13557
13714
  step === "await-approval" && /* @__PURE__ */ jsxs7(Fragment2, { children: [
13558
- /* @__PURE__ */ jsx9(Text8, { children: SPT_FLOW.approval.description }),
13715
+ /* @__PURE__ */ jsx9(Text9, { children: SPT_FLOW.approval.description }),
13559
13716
  /* @__PURE__ */ jsxs7(
13560
13717
  Box7,
13561
13718
  {
@@ -13566,19 +13723,19 @@ var SptFlow = ({
13566
13723
  paddingY: 1,
13567
13724
  marginTop: 1,
13568
13725
  children: [
13569
- /* @__PURE__ */ jsxs7(Text8, { children: [
13726
+ /* @__PURE__ */ jsxs7(Text9, { children: [
13570
13727
  "Approve at:",
13571
13728
  " ",
13572
- /* @__PURE__ */ jsx9(Text8, { bold: true, color: "cyan", children: approvalUrl })
13729
+ /* @__PURE__ */ jsx9(Text9, { bold: true, color: "cyan", children: approvalUrl })
13573
13730
  ] }),
13574
- /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: SPT_FLOW.approval.browserHint })
13731
+ /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: SPT_FLOW.approval.browserHint })
13575
13732
  ]
13576
13733
  }
13577
13734
  ),
13578
- /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text8, { color: "cyan", children: SPT_FLOW.approval.loading }) })
13735
+ /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "cyan", children: SPT_FLOW.approval.loading }) })
13579
13736
  ] }),
13580
13737
  step === "approval-timeout" && /* @__PURE__ */ jsxs7(Fragment2, { children: [
13581
- /* @__PURE__ */ jsx9(Text8, { color: "yellow", children: "\u26A0 Approval timed out (5 min). Still pending \u2014 you can still approve." }),
13738
+ /* @__PURE__ */ jsx9(Text9, { color: "yellow", children: "\u26A0 Approval timed out (5 min). Still pending \u2014 you can still approve." }),
13582
13739
  /* @__PURE__ */ jsxs7(
13583
13740
  Box7,
13584
13741
  {
@@ -13589,26 +13746,26 @@ var SptFlow = ({
13589
13746
  paddingY: 1,
13590
13747
  marginTop: 1,
13591
13748
  children: [
13592
- /* @__PURE__ */ jsxs7(Text8, { children: [
13749
+ /* @__PURE__ */ jsxs7(Text9, { children: [
13593
13750
  "Approve at:",
13594
13751
  " ",
13595
- /* @__PURE__ */ jsx9(Text8, { bold: true, color: "cyan", children: approvalUrl })
13752
+ /* @__PURE__ */ jsx9(Text9, { bold: true, color: "cyan", children: approvalUrl })
13596
13753
  ] }),
13597
- /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "Press [Enter] to open in browser" })
13754
+ /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Press [Enter] to open in browser" })
13598
13755
  ]
13599
13756
  }
13600
13757
  ),
13601
- /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "r Retry polling q Quit demo" }) })
13758
+ /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "r Retry polling q Quit demo" }) })
13602
13759
  ] })
13603
13760
  ] }),
13604
13761
  (step === "mpp-pay-gate" || step === "mpp-pay") && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13605
- /* @__PURE__ */ jsx9(Text8, { color: "green", children: "\u2713 Approved!" }),
13762
+ /* @__PURE__ */ jsx9(Text9, { color: "green", children: "\u2713 Approved!" }),
13606
13763
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.mppPay.description }),
13607
13764
  step === "mpp-pay-gate" && prompt(SPT_FLOW.mppPay.prompt),
13608
- step === "mpp-pay" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text8, { color: "cyan", children: SPT_FLOW.mppPay.loading }) })
13765
+ step === "mpp-pay" && /* @__PURE__ */ jsx9(Box7, { marginY: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "cyan", children: SPT_FLOW.mppPay.loading }) })
13609
13766
  ] }),
13610
13767
  step === "done" && payResult && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
13611
- /* @__PURE__ */ jsxs7(Text8, { bold: true, color: "green", children: [
13768
+ /* @__PURE__ */ jsxs7(Text9, { bold: true, color: "green", children: [
13612
13769
  "\u2713 ",
13613
13770
  SPT_FLOW.done.success,
13614
13771
  " (HTTP ",
@@ -13617,7 +13774,7 @@ var SptFlow = ({
13617
13774
  ] }),
13618
13775
  /* @__PURE__ */ jsx9(MarkdownText, { children: SPT_FLOW.done.detail })
13619
13776
  ] }),
13620
- step === "error" && /* @__PURE__ */ jsxs7(Text8, { color: "red", children: [
13777
+ step === "error" && /* @__PURE__ */ jsxs7(Text9, { color: "red", children: [
13621
13778
  "Error: ",
13622
13779
  error
13623
13780
  ] })
@@ -13696,8 +13853,8 @@ var DemoRunner = ({
13696
13853
  );
13697
13854
  return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", gap: 1, children: [
13698
13855
  /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
13699
- /* @__PURE__ */ jsx10(Text9, { bold: true, children: DEMO_MENU.title }),
13700
- /* @__PURE__ */ jsx10(Text9, { children: DEMO_MENU.subtitle })
13856
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: DEMO_MENU.title }),
13857
+ /* @__PURE__ */ jsx10(Text10, { children: DEMO_MENU.subtitle })
13701
13858
  ] }),
13702
13859
  phase === "auth" && /* @__PURE__ */ jsx10(
13703
13860
  Login,
@@ -13709,22 +13866,22 @@ var DemoRunner = ({
13709
13866
  }
13710
13867
  ),
13711
13868
  phase === "menu" && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
13712
- /* @__PURE__ */ jsx10(Text9, { children: DEMO_MENU.question }),
13869
+ /* @__PURE__ */ jsx10(Text10, { children: DEMO_MENU.question }),
13713
13870
  /* @__PURE__ */ jsx10(Box8, { flexDirection: "column", marginTop: 1, gap: 1, children: DEMO_MENU.options.map((opt, i) => /* @__PURE__ */ jsx10(Box8, { flexDirection: "column", children: i === menuIndex ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
13714
- /* @__PURE__ */ jsxs8(Text9, { color: "cyan", bold: true, children: [
13871
+ /* @__PURE__ */ jsxs8(Text10, { color: "cyan", bold: true, children: [
13715
13872
  ">",
13716
13873
  " ",
13717
13874
  opt.label
13718
13875
  ] }),
13719
- /* @__PURE__ */ jsxs8(Text9, { color: "cyan", children: [
13876
+ /* @__PURE__ */ jsxs8(Text10, { color: "cyan", children: [
13720
13877
  " ",
13721
13878
  opt.description
13722
13879
  ] })
13723
- ] }) : /* @__PURE__ */ jsxs8(Text9, { dimColor: true, children: [
13880
+ ] }) : /* @__PURE__ */ jsxs8(Text10, { dimColor: true, children: [
13724
13881
  " ",
13725
13882
  opt.label
13726
13883
  ] }) }, opt.key)) }),
13727
- /* @__PURE__ */ jsx10(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: DEMO_MENU.hint }) })
13884
+ /* @__PURE__ */ jsx10(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: DEMO_MENU.hint }) })
13728
13885
  ] }),
13729
13886
  runCard && phase !== "menu" && /* @__PURE__ */ jsx10(
13730
13887
  CardFlow,
@@ -13736,9 +13893,9 @@ var DemoRunner = ({
13736
13893
  }
13737
13894
  ),
13738
13895
  phase === "card-done" && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
13739
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u2500\u2500\u2500" }),
13896
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "\u2500\u2500\u2500" }),
13740
13897
  /* @__PURE__ */ jsx10(MarkdownText, { children: DEMO_MENU.transition }),
13741
- /* @__PURE__ */ jsxs8(Text9, { dimColor: true, children: [
13898
+ /* @__PURE__ */ jsxs8(Text10, { dimColor: true, children: [
13742
13899
  "\n",
13743
13900
  ">",
13744
13901
  " ",
@@ -13746,7 +13903,7 @@ var DemoRunner = ({
13746
13903
  ] })
13747
13904
  ] }),
13748
13905
  runSpt && (phase === "spt-flow" || phase === "summary") && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
13749
- runCard && /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u2500\u2500\u2500" }),
13906
+ runCard && /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "\u2500\u2500\u2500" }),
13750
13907
  /* @__PURE__ */ jsx10(
13751
13908
  SptFlow,
13752
13909
  {
@@ -13758,13 +13915,13 @@ var DemoRunner = ({
13758
13915
  )
13759
13916
  ] }),
13760
13917
  phase === "summary" && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
13761
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u2500\u2500\u2500" }),
13762
- /* @__PURE__ */ jsx10(Text9, { bold: true, children: "Done!" }),
13763
- cardSuccess !== null && /* @__PURE__ */ jsxs8(Text9, { color: cardSuccess ? "green" : "red", children: [
13918
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "\u2500\u2500\u2500" }),
13919
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Done!" }),
13920
+ cardSuccess !== null && /* @__PURE__ */ jsxs8(Text10, { color: cardSuccess ? "green" : "red", children: [
13764
13921
  cardSuccess ? "\u2713" : "\u2717",
13765
13922
  " Virtual card flow"
13766
13923
  ] }),
13767
- sptSuccess !== null && /* @__PURE__ */ jsxs8(Text9, { color: sptSuccess ? "green" : "red", children: [
13924
+ sptSuccess !== null && /* @__PURE__ */ jsxs8(Text10, { color: sptSuccess ? "green" : "red", children: [
13768
13925
  sptSuccess ? "\u2713" : "\u2717",
13769
13926
  " Machine payment flow"
13770
13927
  ] }),
@@ -13840,28 +13997,28 @@ function requireAuthGuard(c, authStorage2, envAccessToken2) {
13840
13997
  }
13841
13998
 
13842
13999
  // src/commands/mpp/decode-view.tsx
13843
- import { Box as Box9, Text as Text10 } from "ink";
14000
+ import { Box as Box9, Text as Text11 } from "ink";
13844
14001
  import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
13845
14002
  function DecodeChallengeView({
13846
14003
  decoded
13847
14004
  }) {
13848
14005
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
13849
- /* @__PURE__ */ jsx12(Text10, { color: "green", children: "\u2713 Stripe challenge decoded" }),
14006
+ /* @__PURE__ */ jsx12(Text11, { color: "green", children: "\u2713 Stripe challenge decoded" }),
13850
14007
  /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
13851
- /* @__PURE__ */ jsxs9(Text10, { children: [
14008
+ /* @__PURE__ */ jsxs9(Text11, { children: [
13852
14009
  "ID: ",
13853
- /* @__PURE__ */ jsx12(Text10, { bold: true, children: decoded.id })
14010
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: decoded.id })
13854
14011
  ] }),
13855
- /* @__PURE__ */ jsxs9(Text10, { children: [
14012
+ /* @__PURE__ */ jsxs9(Text11, { children: [
13856
14013
  "Realm: ",
13857
- /* @__PURE__ */ jsx12(Text10, { bold: true, children: decoded.realm })
14014
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: decoded.realm })
13858
14015
  ] }),
13859
- /* @__PURE__ */ jsxs9(Text10, { children: [
14016
+ /* @__PURE__ */ jsxs9(Text11, { children: [
13860
14017
  "Network ID: ",
13861
- /* @__PURE__ */ jsx12(Text10, { bold: true, children: decoded.network_id })
14018
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: decoded.network_id })
13862
14019
  ] }),
13863
- /* @__PURE__ */ jsx12(Text10, { children: "Request JSON:" }),
13864
- /* @__PURE__ */ jsx12(Text10, { children: JSON.stringify(decoded.request_json, null, 2) })
14020
+ /* @__PURE__ */ jsx12(Text11, { children: "Request JSON:" }),
14021
+ /* @__PURE__ */ jsx12(Text11, { children: JSON.stringify(decoded.request_json, null, 2) })
13865
14022
  ] })
13866
14023
  ] });
13867
14024
  }
@@ -13959,7 +14116,7 @@ function createMppCli(repository, authStorage2, envAccessToken2) {
13959
14116
  import { Cli as Cli4 } from "incur";
13960
14117
 
13961
14118
  // src/commands/onboard/onboard-runner.tsx
13962
- import { Box as Box10, Text as Text11, useApp as useApp2, useInput as useInput5 } from "ink";
14119
+ import { Box as Box10, Text as Text12, useApp as useApp2, useInput as useInput5 } from "ink";
13963
14120
  import { useEffect as useEffect7, useRef as useRef4, useState as useState8 } from "react";
13964
14121
  import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
13965
14122
  var OnboardRunner = ({
@@ -14027,7 +14184,7 @@ var OnboardRunner = ({
14027
14184
  const order = ["welcome", "auth", "payment-methods", "demo"];
14028
14185
  return order.indexOf(phase) > order.indexOf(target);
14029
14186
  };
14030
- const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs10(Text11, { dimColor: true, children: [
14187
+ const prompt = (label = "Press [Enter] to continue") => /* @__PURE__ */ jsxs10(Text12, { dimColor: true, children: [
14031
14188
  "\n",
14032
14189
  ">",
14033
14190
  " ",
@@ -14035,10 +14192,10 @@ var OnboardRunner = ({
14035
14192
  ] });
14036
14193
  return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", gap: 1, children: [
14037
14194
  /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
14038
- /* @__PURE__ */ jsx14(Text11, { bold: true, children: ONBOARD.title }),
14039
- /* @__PURE__ */ jsx14(Text11, { children: ONBOARD.subtitle })
14195
+ /* @__PURE__ */ jsx14(Text12, { bold: true, children: ONBOARD.title }),
14196
+ /* @__PURE__ */ jsx14(Text12, { children: ONBOARD.subtitle })
14040
14197
  ] }),
14041
- /* @__PURE__ */ jsx14(Box10, { flexDirection: "column", children: authSkipped || pastPhase("auth") ? /* @__PURE__ */ jsxs10(Text11, { color: "green", children: [
14198
+ /* @__PURE__ */ jsx14(Box10, { flexDirection: "column", children: authSkipped || pastPhase("auth") ? /* @__PURE__ */ jsxs10(Text12, { color: "green", children: [
14042
14199
  "\u2713 ",
14043
14200
  authSkipped ? ONBOARD.auth.alreadyLoggedIn : ONBOARD.auth.authenticated
14044
14201
  ] }) : phase === "auth" && !storage2.isAuthenticated() ? /* @__PURE__ */ jsx14(
@@ -14051,22 +14208,22 @@ var OnboardRunner = ({
14051
14208
  }
14052
14209
  ) : null }),
14053
14210
  pastPhase("auth") && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
14054
- phase === "payment-methods" && !pmMissing && /* @__PURE__ */ jsx14(Text11, { color: "cyan", children: ONBOARD.paymentMethods.loading }),
14211
+ phase === "payment-methods" && !pmMissing && /* @__PURE__ */ jsx14(Text12, { color: "cyan", children: ONBOARD.paymentMethods.loading }),
14055
14212
  pmMissing && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
14056
- /* @__PURE__ */ jsx14(Text11, { color: "yellow", children: ONBOARD.paymentMethods.missing }),
14057
- /* @__PURE__ */ jsx14(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text11, { children: [
14213
+ /* @__PURE__ */ jsx14(Text12, { color: "yellow", children: ONBOARD.paymentMethods.missing }),
14214
+ /* @__PURE__ */ jsx14(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text12, { children: [
14058
14215
  "Visit",
14059
14216
  " ",
14060
- /* @__PURE__ */ jsx14(Text11, { bold: true, color: "cyan", children: "app.link.com/wallet" }),
14217
+ /* @__PURE__ */ jsx14(Text12, { bold: true, color: "cyan", children: "app.link.com/wallet" }),
14061
14218
  " ",
14062
14219
  "to add a payment method, then press [Enter] to continue."
14063
14220
  ] }) }),
14064
14221
  prompt(ONBOARD.paymentMethods.retryPrompt)
14065
14222
  ] }),
14066
- pastPhase("payment-methods") && /* @__PURE__ */ jsx14(Text11, { color: "green", children: "\u2713 Payment method found" })
14223
+ pastPhase("payment-methods") && /* @__PURE__ */ jsx14(Text12, { color: "green", children: "\u2713 Payment method found" })
14067
14224
  ] }),
14068
14225
  phase === "demo" && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
14069
- /* @__PURE__ */ jsx14(Text11, { dimColor: true, children: "\u2500\u2500\u2500" }),
14226
+ /* @__PURE__ */ jsx14(Text12, { dimColor: true, children: "\u2500\u2500\u2500" }),
14070
14227
  /* @__PURE__ */ jsx14(
14071
14228
  DemoRunner,
14072
14229
  {
@@ -14078,7 +14235,7 @@ var OnboardRunner = ({
14078
14235
  }
14079
14236
  )
14080
14237
  ] }),
14081
- error && /* @__PURE__ */ jsxs10(Text11, { color: "red", children: [
14238
+ error && /* @__PURE__ */ jsxs10(Text12, { color: "red", children: [
14082
14239
  "Error: ",
14083
14240
  error
14084
14241
  ] })
@@ -14121,7 +14278,7 @@ function createOnboardCli(authRepo2, spendRequestRepo2, createPaymentMethodsReso
14121
14278
  import { Cli as Cli5 } from "incur";
14122
14279
 
14123
14280
  // src/commands/payment-methods/add.tsx
14124
- import { Box as Box11, Text as Text12, useApp as useApp3, useInput as useInput6 } from "ink";
14281
+ import { Box as Box11, Text as Text13, useApp as useApp3, useInput as useInput6 } from "ink";
14125
14282
  import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
14126
14283
  var WALLET_URL = "https://app.link.com/wallet";
14127
14284
  var AddPaymentMethod = () => {
@@ -14133,7 +14290,7 @@ var AddPaymentMethod = () => {
14133
14290
  }
14134
14291
  });
14135
14292
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingY: 1, children: [
14136
- /* @__PURE__ */ jsx16(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx16(Text12, { bold: true, children: "Add Payment Method" }) }),
14293
+ /* @__PURE__ */ jsx16(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx16(Text13, { bold: true, children: "Add Payment Method" }) }),
14137
14294
  /* @__PURE__ */ jsxs11(
14138
14295
  Box11,
14139
14296
  {
@@ -14143,12 +14300,12 @@ var AddPaymentMethod = () => {
14143
14300
  paddingX: 2,
14144
14301
  paddingY: 1,
14145
14302
  children: [
14146
- /* @__PURE__ */ jsxs11(Text12, { children: [
14303
+ /* @__PURE__ */ jsxs11(Text13, { children: [
14147
14304
  "Open:",
14148
14305
  " ",
14149
- /* @__PURE__ */ jsx16(Text12, { bold: true, color: "cyan", children: WALLET_URL })
14306
+ /* @__PURE__ */ jsx16(Text13, { bold: true, color: "cyan", children: WALLET_URL })
14150
14307
  ] }),
14151
- /* @__PURE__ */ jsx16(Text12, { dimColor: true, children: "Press Enter to open in browser" })
14308
+ /* @__PURE__ */ jsx16(Text13, { dimColor: true, children: "Press Enter to open in browser" })
14152
14309
  ]
14153
14310
  }
14154
14311
  )
@@ -14156,7 +14313,7 @@ var AddPaymentMethod = () => {
14156
14313
  };
14157
14314
 
14158
14315
  // src/commands/payment-methods/list.tsx
14159
- import { Box as Box12, Text as Text13 } from "ink";
14316
+ import { Box as Box12, Text as Text14 } from "ink";
14160
14317
  import Spinner4 from "ink-spinner";
14161
14318
  import { useCallback as useCallback3 } from "react";
14162
14319
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -14167,34 +14324,41 @@ var PaymentMethodsList = ({
14167
14324
  const action = useCallback3(() => resource.listPaymentMethods(), [resource]);
14168
14325
  const { status, data: methods, error } = useAsyncAction(action, onComplete);
14169
14326
  if (status === "loading") {
14170
- return /* @__PURE__ */ jsx17(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { color: "cyan", children: [
14327
+ return /* @__PURE__ */ jsx17(Box12, { children: /* @__PURE__ */ jsxs12(Text14, { color: "cyan", children: [
14171
14328
  /* @__PURE__ */ jsx17(Spinner4, { type: "dots" }),
14172
14329
  " Loading payment methods..."
14173
14330
  ] }) });
14174
14331
  }
14175
14332
  if (status === "error") {
14176
14333
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
14177
- /* @__PURE__ */ jsx17(Text13, { color: "red", children: "\u2717 Failed to load payment methods" }),
14178
- /* @__PURE__ */ jsx17(Text13, { color: "red", children: error })
14334
+ /* @__PURE__ */ jsx17(Text14, { color: "red", children: "\u2717 Failed to load payment methods" }),
14335
+ /* @__PURE__ */ jsx17(Text14, { color: "red", children: error })
14179
14336
  ] });
14180
14337
  }
14181
14338
  if (!methods || methods.length === 0) {
14182
- return /* @__PURE__ */ jsx17(Box12, { children: /* @__PURE__ */ jsx17(Text13, { dimColor: true, children: "No payment methods found" }) });
14339
+ return /* @__PURE__ */ jsx17(Box12, { children: /* @__PURE__ */ jsx17(Text14, { dimColor: true, children: "No payment methods found" }) });
14183
14340
  }
14184
14341
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
14185
- /* @__PURE__ */ jsx17(Text13, { bold: true, children: "Payment Methods" }),
14342
+ /* @__PURE__ */ jsx17(Text14, { bold: true, children: "Payment Methods" }),
14186
14343
  /* @__PURE__ */ jsx17(Box12, { flexDirection: "column", marginTop: 1, children: methods.map((pm) => {
14187
14344
  const label = pm.card_details?.brand ?? pm.bank_account_details?.bank_name ?? "Bank account";
14188
14345
  const last4 = pm.card_details?.last4 ?? pm.bank_account_details?.last4;
14189
14346
  const suffix = pm.nickname ? `(${pm.nickname})` : "";
14190
- return /* @__PURE__ */ jsx17(Box12, { paddingX: 2, children: /* @__PURE__ */ jsxs12(Text13, { children: [
14191
- /* @__PURE__ */ jsx17(Text13, { dimColor: true, children: pm.id }),
14347
+ const agenticCap = pm.capabilities?.agentic_payments;
14348
+ const ineligible = agenticCap && !agenticCap.eligible;
14349
+ return /* @__PURE__ */ jsx17(Box12, { paddingX: 2, children: /* @__PURE__ */ jsxs12(Text14, { children: [
14350
+ /* @__PURE__ */ jsx17(Text14, { dimColor: true, children: pm.id }),
14192
14351
  " ",
14193
14352
  label,
14194
14353
  " ****",
14195
14354
  last4,
14196
14355
  suffix ? ` ${suffix}` : "",
14197
- pm.is_default ? /* @__PURE__ */ jsx17(Text13, { color: "green", children: " (default)" }) : ""
14356
+ pm.is_default ? /* @__PURE__ */ jsx17(Text14, { color: "green", children: " (default)" }) : "",
14357
+ ineligible ? /* @__PURE__ */ jsxs12(Text14, { dimColor: true, children: [
14358
+ " ",
14359
+ "agentic_payments: ineligible",
14360
+ agenticCap.ineligibility_reasons?.length > 0 ? ` (${agenticCap.ineligibility_reasons.join(", ")})` : ""
14361
+ ] }) : null
14198
14362
  ] }) }, pm.id);
14199
14363
  }) })
14200
14364
  ] });
@@ -14238,11 +14402,48 @@ function createPaymentMethodsCli(createResource, authStorage2, envAccessToken2)
14238
14402
  return cli2;
14239
14403
  }
14240
14404
 
14405
+ // src/commands/report/index.tsx
14406
+ import { Cli as Cli6 } from "incur";
14407
+
14408
+ // src/commands/report/schema.ts
14409
+ import { z as z5 } from "incur";
14410
+ var reportOptions = z5.object({
14411
+ domain: z5.string().describe("Domain where the outcome occurred"),
14412
+ outcome: z5.enum(REPORT_OUTCOMES).describe("What happened: success, blocked, or abandoned"),
14413
+ spendRequestId: z5.string().describe("Spend request ID (lsrq_...)"),
14414
+ tag: z5.array(z5.enum(REPORT_TAGS)).optional().describe("Outcome tags (repeatable)"),
14415
+ step: z5.string().max(500).optional().describe("Where in the flow the agent was"),
14416
+ freeformContext: z5.string().max(500).optional().describe("Additional context (max 500 chars)")
14417
+ });
14418
+
14419
+ // src/commands/report/index.tsx
14420
+ function createReportCli(createResource, authStorage2, envAccessToken2) {
14421
+ const cli2 = Cli6.create("report", {
14422
+ description: "Report the outcome of an agent action on a domain. Call after every purchase attempt.",
14423
+ options: reportOptions,
14424
+ outputPolicy: "agent-only",
14425
+ async run(c) {
14426
+ requireAuthGuard(c, authStorage2, envAccessToken2);
14427
+ const resource = createResource();
14428
+ const result = await resource.create({
14429
+ domain: c.options.domain,
14430
+ outcome: c.options.outcome,
14431
+ spend_request_id: c.options.spendRequestId,
14432
+ tags: c.options.tag,
14433
+ step: c.options.step,
14434
+ freeform_context: c.options.freeformContext
14435
+ });
14436
+ return result;
14437
+ }
14438
+ });
14439
+ return cli2;
14440
+ }
14441
+
14241
14442
  // src/commands/serve/index.ts
14242
14443
  import {
14243
14444
  createServer
14244
14445
  } from "http";
14245
- import { Cli as Cli6, z as z5 } from "incur";
14446
+ import { Cli as Cli7, z as z6 } from "incur";
14246
14447
  async function nodeRequestToWebRequest(req, port) {
14247
14448
  const body = await new Promise((resolve) => {
14248
14449
  const chunks = [];
@@ -14268,10 +14469,10 @@ async function sendWebResponse(webRes, res) {
14268
14469
  res.end(Buffer.from(buffer));
14269
14470
  }
14270
14471
  function createServeCli(rootCli) {
14271
- return Cli6.create("serve", {
14472
+ return Cli7.create("serve", {
14272
14473
  description: "Start an HTTP server exposing link-cli as an MCP endpoint at /mcp",
14273
- options: z5.object({
14274
- port: z5.coerce.number().default(54321).describe("Port to listen on")
14474
+ options: z6.object({
14475
+ port: z6.coerce.number().default(54321).describe("Port to listen on")
14275
14476
  }),
14276
14477
  async run(c) {
14277
14478
  const { port } = c.options;
@@ -14316,10 +14517,10 @@ function createServeCli(rootCli) {
14316
14517
  }
14317
14518
 
14318
14519
  // src/commands/shipping-address/index.tsx
14319
- import { Cli as Cli7 } from "incur";
14520
+ import { Cli as Cli8 } from "incur";
14320
14521
 
14321
14522
  // src/commands/shipping-address/list.tsx
14322
- import { Box as Box13, Text as Text14 } from "ink";
14523
+ import { Box as Box13, Text as Text15 } from "ink";
14323
14524
  import Spinner5 from "ink-spinner";
14324
14525
  import { useCallback as useCallback4 } from "react";
14325
14526
  import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
@@ -14364,22 +14565,22 @@ var ShippingAddressList = ({
14364
14565
  error
14365
14566
  } = useAsyncAction(action, onComplete);
14366
14567
  if (status === "loading") {
14367
- return /* @__PURE__ */ jsx19(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: "cyan", children: [
14568
+ return /* @__PURE__ */ jsx19(Box13, { children: /* @__PURE__ */ jsxs13(Text15, { color: "cyan", children: [
14368
14569
  /* @__PURE__ */ jsx19(Spinner5, { type: "dots" }),
14369
14570
  " Loading shipping addresses..."
14370
14571
  ] }) });
14371
14572
  }
14372
14573
  if (status === "error") {
14373
14574
  return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
14374
- /* @__PURE__ */ jsx19(Text14, { color: "red", children: "\u2717 Failed to load shipping addresses" }),
14375
- /* @__PURE__ */ jsx19(Text14, { color: "red", children: error })
14575
+ /* @__PURE__ */ jsx19(Text15, { color: "red", children: "\u2717 Failed to load shipping addresses" }),
14576
+ /* @__PURE__ */ jsx19(Text15, { color: "red", children: error })
14376
14577
  ] });
14377
14578
  }
14378
14579
  if (!shippingAddresses || shippingAddresses.length === 0) {
14379
- return /* @__PURE__ */ jsx19(Box13, { children: /* @__PURE__ */ jsx19(Text14, { dimColor: true, children: "No shipping addresses found" }) });
14580
+ return /* @__PURE__ */ jsx19(Box13, { children: /* @__PURE__ */ jsx19(Text15, { dimColor: true, children: "No shipping addresses found" }) });
14380
14581
  }
14381
14582
  return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
14382
- /* @__PURE__ */ jsx19(Text14, { bold: true, children: "Shipping Addresses" }),
14583
+ /* @__PURE__ */ jsx19(Text15, { bold: true, children: "Shipping Addresses" }),
14383
14584
  /* @__PURE__ */ jsx19(Box13, { flexDirection: "column", marginTop: 1, children: shippingAddresses.map((shippingAddress) => {
14384
14585
  const addressName = shippingAddress.address?.name;
14385
14586
  const nickname = shippingAddress.nickname ? ` (${shippingAddress.nickname})` : "";
@@ -14390,14 +14591,14 @@ var ShippingAddressList = ({
14390
14591
  paddingX: 2,
14391
14592
  marginBottom: 1,
14392
14593
  children: [
14393
- /* @__PURE__ */ jsxs13(Text14, { children: [
14394
- /* @__PURE__ */ jsx19(Text14, { dimColor: true, children: shippingAddress.id }),
14594
+ /* @__PURE__ */ jsxs13(Text15, { children: [
14595
+ /* @__PURE__ */ jsx19(Text15, { dimColor: true, children: shippingAddress.id }),
14395
14596
  nickname,
14396
- shippingAddress.is_default ? /* @__PURE__ */ jsx19(Text14, { color: "green", children: " (default)" }) : null
14597
+ shippingAddress.is_default ? /* @__PURE__ */ jsx19(Text15, { color: "green", children: " (default)" }) : null
14397
14598
  ] }),
14398
14599
  /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", marginTop: 1, children: [
14399
- addressName ? /* @__PURE__ */ jsx19(Text14, { bold: true, children: addressName }) : null,
14400
- formatAddressLines(shippingAddress).map((line) => /* @__PURE__ */ jsx19(Text14, { children: line }, `${shippingAddress.id}:${line}`))
14600
+ addressName ? /* @__PURE__ */ jsx19(Text15, { bold: true, children: addressName }) : null,
14601
+ formatAddressLines(shippingAddress).map((line) => /* @__PURE__ */ jsx19(Text15, { children: line }, `${shippingAddress.id}:${line}`))
14401
14602
  ] })
14402
14603
  ]
14403
14604
  },
@@ -14410,7 +14611,7 @@ var ShippingAddressList = ({
14410
14611
  // src/commands/shipping-address/index.tsx
14411
14612
  import { jsx as jsx20 } from "react/jsx-runtime";
14412
14613
  function createShippingAddressCli(createResource, authStorage2, envAccessToken2) {
14413
- const cli2 = Cli7.create("shipping-address", {
14614
+ const cli2 = Cli8.create("shipping-address", {
14414
14615
  description: "Shipping address management commands"
14415
14616
  });
14416
14617
  cli2.command("list", {
@@ -14433,7 +14634,7 @@ function createShippingAddressCli(createResource, authStorage2, envAccessToken2)
14433
14634
  }
14434
14635
 
14435
14636
  // src/commands/spend-request/index.tsx
14436
- import { Cli as Cli8, z as z8 } from "incur";
14637
+ import { Cli as Cli9, z as z9 } from "incur";
14437
14638
 
14438
14639
  // src/utils/credential-output.ts
14439
14640
  import { constants } from "fs";
@@ -14491,21 +14692,21 @@ async function writeCredentialFile(filePath, data, force) {
14491
14692
  }
14492
14693
 
14493
14694
  // src/utils/line-item-parser.ts
14494
- import { z as z6 } from "zod";
14495
- var LineItemSchema = z6.object({
14496
- name: z6.string(),
14497
- url: z6.string().optional(),
14498
- image_url: z6.string().optional(),
14499
- description: z6.string().optional(),
14500
- sku: z6.string().optional(),
14501
- quantity: z6.coerce.number().optional(),
14502
- unit_amount: z6.coerce.number().optional(),
14503
- product_url: z6.string().optional()
14695
+ import { z as z7 } from "zod";
14696
+ var LineItemSchema = z7.object({
14697
+ name: z7.string(),
14698
+ url: z7.string().optional(),
14699
+ image_url: z7.string().optional(),
14700
+ description: z7.string().optional(),
14701
+ sku: z7.string().optional(),
14702
+ quantity: z7.coerce.number().optional(),
14703
+ unit_amount: z7.coerce.number().optional(),
14704
+ product_url: z7.string().optional()
14504
14705
  }).strict();
14505
- var TotalSchema = z6.object({
14506
- type: z6.string(),
14507
- display_text: z6.string(),
14508
- amount: z6.coerce.number()
14706
+ var TotalSchema = z7.object({
14707
+ type: z7.string(),
14708
+ display_text: z7.string(),
14709
+ amount: z7.coerce.number()
14509
14710
  }).strict();
14510
14711
  function parseKvString(raw) {
14511
14712
  const result = {};
@@ -14535,7 +14736,7 @@ function parseLineItemFlag(raw) {
14535
14736
  try {
14536
14737
  return LineItemSchema.parse(obj);
14537
14738
  } catch (err) {
14538
- if (err instanceof z6.ZodError)
14739
+ if (err instanceof z7.ZodError)
14539
14740
  throw formatZodError(err, "Line item", LineItemSchema);
14540
14741
  throw err;
14541
14742
  }
@@ -14545,14 +14746,14 @@ function parseTotalFlag(raw) {
14545
14746
  try {
14546
14747
  return TotalSchema.parse(obj);
14547
14748
  } catch (err) {
14548
- if (err instanceof z6.ZodError)
14749
+ if (err instanceof z7.ZodError)
14549
14750
  throw formatZodError(err, "Total", TotalSchema);
14550
14751
  throw err;
14551
14752
  }
14552
14753
  }
14553
14754
 
14554
14755
  // src/commands/spend-request/cancel.tsx
14555
- import { Box as Box14, Text as Text15 } from "ink";
14756
+ import { Box as Box14, Text as Text16 } from "ink";
14556
14757
  import Spinner6 from "ink-spinner";
14557
14758
  import { useCallback as useCallback5 } from "react";
14558
14759
  import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -14567,7 +14768,7 @@ var CancelSpendRequest = ({
14567
14768
  );
14568
14769
  const { status, data: request, error } = useAsyncAction(action, onComplete);
14569
14770
  if (status === "loading") {
14570
- return /* @__PURE__ */ jsx21(Box14, { children: /* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
14771
+ return /* @__PURE__ */ jsx21(Box14, { children: /* @__PURE__ */ jsxs14(Text16, { color: "cyan", children: [
14571
14772
  /* @__PURE__ */ jsx21(Spinner6, { type: "dots" }),
14572
14773
  " Canceling spend request ",
14573
14774
  id,
@@ -14576,26 +14777,26 @@ var CancelSpendRequest = ({
14576
14777
  }
14577
14778
  if (status === "error") {
14578
14779
  return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
14579
- /* @__PURE__ */ jsx21(Text15, { color: "red", children: "\u2717 Failed to cancel spend request" }),
14580
- /* @__PURE__ */ jsx21(Text15, { color: "red", children: error })
14780
+ /* @__PURE__ */ jsx21(Text16, { color: "red", children: "\u2717 Failed to cancel spend request" }),
14781
+ /* @__PURE__ */ jsx21(Text16, { color: "red", children: error })
14581
14782
  ] });
14582
14783
  }
14583
14784
  return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
14584
- /* @__PURE__ */ jsx21(Text15, { color: "green", children: "\u2713 Spend request canceled" }),
14585
- /* @__PURE__ */ jsx21(Box14, { flexDirection: "column", marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsxs14(Text15, { children: [
14785
+ /* @__PURE__ */ jsx21(Text16, { color: "green", children: "\u2713 Spend request canceled" }),
14786
+ /* @__PURE__ */ jsx21(Box14, { flexDirection: "column", marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsxs14(Text16, { children: [
14586
14787
  "ID: ",
14587
- /* @__PURE__ */ jsx21(Text15, { bold: true, children: request?.id })
14788
+ /* @__PURE__ */ jsx21(Text16, { bold: true, children: request?.id })
14588
14789
  ] }) })
14589
14790
  ] });
14590
14791
  };
14591
14792
 
14592
14793
  // src/commands/spend-request/create.tsx
14593
- import { Box as Box16, Text as Text17 } from "ink";
14794
+ import { Box as Box16, Text as Text18 } from "ink";
14594
14795
  import Spinner8 from "ink-spinner";
14595
14796
  import { useCallback as useCallback6, useEffect as useEffect9, useState as useState9 } from "react";
14596
14797
 
14597
14798
  // src/commands/spend-request/approval-waiting-view.tsx
14598
- import { Box as Box15, Text as Text16 } from "ink";
14799
+ import { Box as Box15, Text as Text17 } from "ink";
14599
14800
  import Spinner7 from "ink-spinner";
14600
14801
  import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
14601
14802
  var ApprovalWaitingView = ({
@@ -14611,20 +14812,20 @@ var ApprovalWaitingView = ({
14611
14812
  paddingX: 2,
14612
14813
  paddingY: 1,
14613
14814
  children: [
14614
- /* @__PURE__ */ jsxs15(Text16, { children: [
14815
+ /* @__PURE__ */ jsxs15(Text17, { children: [
14615
14816
  "Approve at:",
14616
14817
  " ",
14617
- /* @__PURE__ */ jsx22(Text16, { bold: true, color: "cyan", children: approvalUrl })
14818
+ /* @__PURE__ */ jsx22(Text17, { bold: true, color: "cyan", children: approvalUrl })
14618
14819
  ] }),
14619
- /* @__PURE__ */ jsx22(Text16, { dimColor: true, children: "Press Enter to open in browser" })
14820
+ /* @__PURE__ */ jsx22(Text17, { dimColor: true, children: "Press Enter to open in browser" })
14620
14821
  ]
14621
14822
  }
14622
14823
  ),
14623
14824
  /* @__PURE__ */ jsx22(AppDownloadQrCodes, {}),
14624
- /* @__PURE__ */ jsx22(Box15, { marginTop: 1, children: status === "polling" ? /* @__PURE__ */ jsxs15(Text16, { color: "cyan", children: [
14825
+ /* @__PURE__ */ jsx22(Box15, { marginTop: 1, children: status === "polling" ? /* @__PURE__ */ jsxs15(Text17, { color: "cyan", children: [
14625
14826
  /* @__PURE__ */ jsx22(Spinner7, { type: "dots" }),
14626
14827
  " Waiting for approval..."
14627
- ] }) : /* @__PURE__ */ jsx22(Text16, { dimColor: true, children: "Waiting..." }) })
14828
+ ] }) : /* @__PURE__ */ jsx22(Text17, { dimColor: true, children: "Waiting..." }) })
14628
14829
  ] });
14629
14830
 
14630
14831
  // src/commands/spend-request/use-approval-polling.ts
@@ -14755,87 +14956,87 @@ var CreateSpendRequest = ({
14755
14956
  writeCredentialFile(outputFile, fileData, force ?? false).then((path7) => setOutputFilePath(path7)).catch((err) => setFileError(err.message));
14756
14957
  }, [status, outputFile, force, request]);
14757
14958
  if (status === "creating") {
14758
- return /* @__PURE__ */ jsx23(Box16, { children: /* @__PURE__ */ jsxs16(Text17, { color: "cyan", children: [
14959
+ return /* @__PURE__ */ jsx23(Box16, { children: /* @__PURE__ */ jsxs16(Text18, { color: "cyan", children: [
14759
14960
  /* @__PURE__ */ jsx23(Spinner8, { type: "dots" }),
14760
14961
  " Creating spend request..."
14761
14962
  ] }) });
14762
14963
  }
14763
14964
  if (status === "error") {
14764
14965
  return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
14765
- /* @__PURE__ */ jsx23(Text17, { color: "red", children: "\u2717 Failed to create spend request" }),
14766
- /* @__PURE__ */ jsx23(Text17, { color: "red", children: error })
14966
+ /* @__PURE__ */ jsx23(Text18, { color: "red", children: "\u2717 Failed to create spend request" }),
14967
+ /* @__PURE__ */ jsx23(Text18, { color: "red", children: error })
14767
14968
  ] });
14768
14969
  }
14769
14970
  if (status === "success") {
14770
14971
  return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
14771
- /* @__PURE__ */ jsx23(Text17, { color: "green", children: "\u2713 Spend request created" }),
14972
+ /* @__PURE__ */ jsx23(Text18, { color: "green", children: "\u2713 Spend request created" }),
14772
14973
  /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
14773
- /* @__PURE__ */ jsxs16(Text17, { children: [
14974
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14774
14975
  "ID: ",
14775
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.id })
14976
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.id })
14776
14977
  ] }),
14777
- /* @__PURE__ */ jsxs16(Text17, { children: [
14978
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14778
14979
  "Status: ",
14779
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.status })
14980
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.status })
14780
14981
  ] }),
14781
- /* @__PURE__ */ jsxs16(Text17, { children: [
14982
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14782
14983
  "Amount:",
14783
14984
  " ",
14784
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.amount != null ? `${request.amount} ${request.currency?.toUpperCase() ?? ""}`.trim() : "N/A" })
14985
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.amount != null ? `${request.amount} ${request.currency?.toUpperCase() ?? ""}`.trim() : "N/A" })
14785
14986
  ] }),
14786
- /* @__PURE__ */ jsxs16(Text17, { children: [
14987
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14787
14988
  "Merchant: ",
14788
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.merchant_name })
14989
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.merchant_name })
14789
14990
  ] }),
14790
- /* @__PURE__ */ jsxs16(Text17, { children: [
14991
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14791
14992
  "Line Items:",
14792
14993
  " ",
14793
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") || "N/A" })
14994
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") || "N/A" })
14794
14995
  ] }),
14795
- request?.credential_type === "shared_payment_token" && request.shared_payment_token && /* @__PURE__ */ jsxs16(Text17, { children: [
14996
+ request?.credential_type === "shared_payment_token" && request.shared_payment_token && /* @__PURE__ */ jsxs16(Text18, { children: [
14796
14997
  "Token: ",
14797
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request.shared_payment_token.id })
14998
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request.shared_payment_token.id })
14798
14999
  ] })
14799
15000
  ] }),
14800
15001
  request?.card && !outputFile && /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, children: [
14801
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: "Card Details:" }),
14802
- /* @__PURE__ */ jsxs16(Text17, { children: [
15002
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: "Card Details:" }),
15003
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14803
15004
  " ",
14804
15005
  "Number: ",
14805
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request.card.number })
15006
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request.card.number })
14806
15007
  ] }),
14807
- /* @__PURE__ */ jsxs16(Text17, { children: [
15008
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14808
15009
  " ",
14809
15010
  "Brand: ",
14810
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request.card.brand })
15011
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request.card.brand })
14811
15012
  ] }),
14812
- /* @__PURE__ */ jsxs16(Text17, { children: [
15013
+ /* @__PURE__ */ jsxs16(Text18, { children: [
14813
15014
  " ",
14814
15015
  "Expiry:",
14815
15016
  " ",
14816
- /* @__PURE__ */ jsxs16(Text17, { bold: true, children: [
15017
+ /* @__PURE__ */ jsxs16(Text18, { bold: true, children: [
14817
15018
  String(request.card.exp_month).padStart(2, "0"),
14818
15019
  "/",
14819
15020
  request.card.exp_year
14820
15021
  ] })
14821
15022
  ] }),
14822
- request.card.cvc && /* @__PURE__ */ jsxs16(Text17, { children: [
15023
+ request.card.cvc && /* @__PURE__ */ jsxs16(Text18, { children: [
14823
15024
  " ",
14824
15025
  "CVC: ",
14825
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request.card.cvc })
15026
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request.card.cvc })
14826
15027
  ] }),
14827
- request.card.valid_until && /* @__PURE__ */ jsxs16(Text17, { children: [
15028
+ request.card.valid_until && /* @__PURE__ */ jsxs16(Text18, { children: [
14828
15029
  " ",
14829
15030
  "Valid Until: ",
14830
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request.card.valid_until })
15031
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request.card.valid_until })
14831
15032
  ] })
14832
15033
  ] }),
14833
15034
  request?.card && outputFile && /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, children: [
14834
- outputFilePath && /* @__PURE__ */ jsxs16(Text17, { color: "green", children: [
15035
+ outputFilePath && /* @__PURE__ */ jsxs16(Text18, { color: "green", children: [
14835
15036
  "Card credentials written to ",
14836
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: outputFilePath })
15037
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: outputFilePath })
14837
15038
  ] }),
14838
- fileError && /* @__PURE__ */ jsxs16(Text17, { color: "red", children: [
15039
+ fileError && /* @__PURE__ */ jsxs16(Text18, { color: "red", children: [
14839
15040
  "Failed to write card file: ",
14840
15041
  fileError
14841
15042
  ] })
@@ -14844,9 +15045,9 @@ var CreateSpendRequest = ({
14844
15045
  ] });
14845
15046
  }
14846
15047
  return /* @__PURE__ */ jsxs16(Fragment4, { children: [
14847
- /* @__PURE__ */ jsx23(Box16, { children: /* @__PURE__ */ jsxs16(Text17, { color: "green", children: [
15048
+ /* @__PURE__ */ jsx23(Box16, { children: /* @__PURE__ */ jsxs16(Text18, { color: "green", children: [
14848
15049
  "\u2713 Spend request created (ID: ",
14849
- /* @__PURE__ */ jsx23(Text17, { bold: true, children: request?.id }),
15050
+ /* @__PURE__ */ jsx23(Text18, { bold: true, children: request?.id }),
14850
15051
  ")"
14851
15052
  ] }) }),
14852
15053
  /* @__PURE__ */ jsx23(
@@ -14860,18 +15061,19 @@ var CreateSpendRequest = ({
14860
15061
  };
14861
15062
 
14862
15063
  // src/commands/spend-request/list.tsx
14863
- import { Box as Box17, Text as Text18, useApp as useApp4 } from "ink";
15064
+ import { Box as Box17, Text as Text19, useApp as useApp4 } from "ink";
14864
15065
  import Spinner9 from "ink-spinner";
14865
15066
  import { useCallback as useCallback7 } from "react";
14866
15067
  import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
14867
15068
  var SpendRequestList = ({
14868
15069
  repository,
15070
+ includeHistory = false,
14869
15071
  onComplete
14870
15072
  }) => {
14871
15073
  const { exit } = useApp4();
14872
15074
  const action = useCallback7(
14873
- () => repository.listSpendRequests(),
14874
- [repository]
15075
+ () => repository.listSpendRequests({ includeHistory }),
15076
+ [repository, includeHistory]
14875
15077
  );
14876
15078
  const wrappedOnComplete = useCallback7(
14877
15079
  (result) => {
@@ -14886,29 +15088,29 @@ var SpendRequestList = ({
14886
15088
  error
14887
15089
  } = useAsyncAction(action, wrappedOnComplete);
14888
15090
  if (status === "loading") {
14889
- return /* @__PURE__ */ jsx24(Box17, { children: /* @__PURE__ */ jsxs17(Text18, { color: "cyan", children: [
15091
+ return /* @__PURE__ */ jsx24(Box17, { children: /* @__PURE__ */ jsxs17(Text19, { color: "cyan", children: [
14890
15092
  /* @__PURE__ */ jsx24(Spinner9, { type: "dots" }),
14891
15093
  " Loading spend requests..."
14892
15094
  ] }) });
14893
15095
  }
14894
15096
  if (status === "error") {
14895
15097
  return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", children: [
14896
- /* @__PURE__ */ jsx24(Text18, { color: "red", children: "\u2717 Failed to load spend requests" }),
14897
- /* @__PURE__ */ jsx24(Text18, { color: "red", children: error })
15098
+ /* @__PURE__ */ jsx24(Text19, { color: "red", children: "\u2717 Failed to load spend requests" }),
15099
+ /* @__PURE__ */ jsx24(Text19, { color: "red", children: error })
14898
15100
  ] });
14899
15101
  }
14900
15102
  if (!requests || requests.length === 0) {
14901
- return /* @__PURE__ */ jsx24(Box17, { children: /* @__PURE__ */ jsx24(Text18, { dimColor: true, children: "No active spend requests found" }) });
15103
+ return /* @__PURE__ */ jsx24(Box17, { children: /* @__PURE__ */ jsx24(Text19, { dimColor: true, children: includeHistory ? "No spend requests found" : "No active spend requests found" }) });
14902
15104
  }
14903
15105
  return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", children: [
14904
- /* @__PURE__ */ jsx24(Text18, { bold: true, children: "Active Spend Requests" }),
15106
+ /* @__PURE__ */ jsx24(Text19, { bold: true, children: includeHistory ? "All Spend Requests" : "Active Spend Requests" }),
14905
15107
  /* @__PURE__ */ jsx24(Box17, { flexDirection: "column", marginTop: 1, children: requests.map((sr) => {
14906
15108
  const statusColor = sr.status === "approved" ? "green" : sr.status === "pending_approval" ? "yellow" : "white";
14907
15109
  const amount = sr.amount != null ? `$${(sr.amount / 100).toFixed(2)} ${(sr.currency ?? "usd").toUpperCase()}` : "";
14908
- return /* @__PURE__ */ jsx24(Box17, { paddingX: 2, children: /* @__PURE__ */ jsxs17(Text18, { children: [
14909
- /* @__PURE__ */ jsx24(Text18, { dimColor: true, children: sr.id }),
15110
+ return /* @__PURE__ */ jsx24(Box17, { paddingX: 2, children: /* @__PURE__ */ jsxs17(Text19, { children: [
15111
+ /* @__PURE__ */ jsx24(Text19, { dimColor: true, children: sr.id }),
14910
15112
  " ",
14911
- /* @__PURE__ */ jsx24(Text18, { color: statusColor, children: sr.status }),
15113
+ /* @__PURE__ */ jsx24(Text19, { color: statusColor, children: sr.status }),
14912
15114
  sr.merchant_name ? ` ${sr.merchant_name}` : "",
14913
15115
  amount ? ` ${amount}` : ""
14914
15116
  ] }) }, sr.id);
@@ -14917,7 +15119,7 @@ var SpendRequestList = ({
14917
15119
  };
14918
15120
 
14919
15121
  // src/commands/spend-request/request-approval.tsx
14920
- import { Box as Box18, Text as Text19 } from "ink";
15122
+ import { Box as Box18, Text as Text20 } from "ink";
14921
15123
  import Spinner10 from "ink-spinner";
14922
15124
  import { useCallback as useCallback8, useEffect as useEffect10, useState as useState10 } from "react";
14923
15125
  import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -14956,41 +15158,41 @@ var RequestApproval = ({
14956
15158
  request();
14957
15159
  }, [repository, id]);
14958
15160
  if (status === "requesting") {
14959
- return /* @__PURE__ */ jsx25(Box18, { children: /* @__PURE__ */ jsxs18(Text19, { color: "cyan", children: [
15161
+ return /* @__PURE__ */ jsx25(Box18, { children: /* @__PURE__ */ jsxs18(Text20, { color: "cyan", children: [
14960
15162
  /* @__PURE__ */ jsx25(Spinner10, { type: "dots" }),
14961
15163
  " Requesting approval..."
14962
15164
  ] }) });
14963
15165
  }
14964
15166
  if (status === "error") {
14965
15167
  return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
14966
- /* @__PURE__ */ jsx25(Text19, { color: "red", children: "\u2717 Failed to request approval" }),
14967
- /* @__PURE__ */ jsx25(Text19, { color: "red", children: error })
15168
+ /* @__PURE__ */ jsx25(Text20, { color: "red", children: "\u2717 Failed to request approval" }),
15169
+ /* @__PURE__ */ jsx25(Text20, { color: "red", children: error })
14968
15170
  ] });
14969
15171
  }
14970
15172
  if (status === "success") {
14971
15173
  return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
14972
- /* @__PURE__ */ jsx25(Text19, { color: "green", children: "\u2713 Approval completed" }),
15174
+ /* @__PURE__ */ jsx25(Text20, { color: "green", children: "\u2713 Approval completed" }),
14973
15175
  /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
14974
- /* @__PURE__ */ jsxs18(Text19, { children: [
15176
+ /* @__PURE__ */ jsxs18(Text20, { children: [
14975
15177
  "ID: ",
14976
- /* @__PURE__ */ jsx25(Text19, { bold: true, children: result?.id })
15178
+ /* @__PURE__ */ jsx25(Text20, { bold: true, children: result?.id })
14977
15179
  ] }),
14978
- /* @__PURE__ */ jsxs18(Text19, { children: [
15180
+ /* @__PURE__ */ jsxs18(Text20, { children: [
14979
15181
  "Status: ",
14980
- /* @__PURE__ */ jsx25(Text19, { bold: true, children: result?.status })
15182
+ /* @__PURE__ */ jsx25(Text20, { bold: true, children: result?.status })
14981
15183
  ] }),
14982
- /* @__PURE__ */ jsxs18(Text19, { children: [
15184
+ /* @__PURE__ */ jsxs18(Text20, { children: [
14983
15185
  "Amount:",
14984
15186
  " ",
14985
- /* @__PURE__ */ jsx25(Text19, { bold: true, children: result?.amount != null ? `${result.amount} ${result.currency?.toUpperCase() ?? ""}`.trim() : "N/A" })
15187
+ /* @__PURE__ */ jsx25(Text20, { bold: true, children: result?.amount != null ? `${result.amount} ${result.currency?.toUpperCase() ?? ""}`.trim() : "N/A" })
14986
15188
  ] }),
14987
- /* @__PURE__ */ jsxs18(Text19, { children: [
15189
+ /* @__PURE__ */ jsxs18(Text20, { children: [
14988
15190
  "Merchant: ",
14989
- /* @__PURE__ */ jsx25(Text19, { bold: true, children: result?.merchant_name })
15191
+ /* @__PURE__ */ jsx25(Text20, { bold: true, children: result?.merchant_name })
14990
15192
  ] }),
14991
- result?.credential_type === "shared_payment_token" && result.shared_payment_token && /* @__PURE__ */ jsxs18(Text19, { children: [
15193
+ result?.credential_type === "shared_payment_token" && result.shared_payment_token && /* @__PURE__ */ jsxs18(Text20, { children: [
14992
15194
  "Token: ",
14993
- /* @__PURE__ */ jsx25(Text19, { bold: true, children: result.shared_payment_token.id })
15195
+ /* @__PURE__ */ jsx25(Text20, { bold: true, children: result.shared_payment_token.id })
14994
15196
  ] })
14995
15197
  ] })
14996
15198
  ] });
@@ -15005,7 +15207,7 @@ var RequestApproval = ({
15005
15207
  };
15006
15208
 
15007
15209
  // src/commands/spend-request/retrieve.tsx
15008
- import { Box as Box19, Text as Text20 } from "ink";
15210
+ import { Box as Box19, Text as Text21 } from "ink";
15009
15211
  import Spinner11 from "ink-spinner";
15010
15212
  import { useEffect as useEffect11, useRef as useRef5, useState as useState11 } from "react";
15011
15213
  import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
@@ -15132,7 +15334,7 @@ var RetrieveSpendRequest = ({
15132
15334
  };
15133
15335
  }, [phase, repository, id, include, timeout, onComplete]);
15134
15336
  if (phase === "fetching") {
15135
- return /* @__PURE__ */ jsx26(Box19, { children: /* @__PURE__ */ jsxs19(Text20, { color: "cyan", children: [
15337
+ return /* @__PURE__ */ jsx26(Box19, { children: /* @__PURE__ */ jsxs19(Text21, { color: "cyan", children: [
15136
15338
  /* @__PURE__ */ jsx26(Spinner11, { type: "dots" }),
15137
15339
  " Retrieving spend request ",
15138
15340
  id,
@@ -15140,113 +15342,113 @@ var RetrieveSpendRequest = ({
15140
15342
  ] }) });
15141
15343
  }
15142
15344
  if (phase === "error") {
15143
- return /* @__PURE__ */ jsx26(Box19, { flexDirection: "column", children: /* @__PURE__ */ jsxs19(Text20, { color: "red", children: [
15345
+ return /* @__PURE__ */ jsx26(Box19, { flexDirection: "column", children: /* @__PURE__ */ jsxs19(Text21, { color: "red", children: [
15144
15346
  "\u2717 ",
15145
15347
  error
15146
15348
  ] }) });
15147
15349
  }
15148
15350
  if (phase === "timeout") {
15149
15351
  return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
15150
- /* @__PURE__ */ jsxs19(Text20, { color: "yellow", children: [
15352
+ /* @__PURE__ */ jsxs19(Text21, { color: "yellow", children: [
15151
15353
  "\u2717 Timed out waiting for approval after ",
15152
15354
  timeout,
15153
15355
  "s"
15154
15356
  ] }),
15155
15357
  request && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15156
- /* @__PURE__ */ jsxs19(Text20, { children: [
15358
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15157
15359
  "ID: ",
15158
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.id })
15360
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.id })
15159
15361
  ] }),
15160
- /* @__PURE__ */ jsxs19(Text20, { children: [
15362
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15161
15363
  "Status: ",
15162
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.status })
15364
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.status })
15163
15365
  ] })
15164
15366
  ] })
15165
15367
  ] });
15166
15368
  }
15167
15369
  if (phase === "polling") {
15168
15370
  return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
15169
- /* @__PURE__ */ jsx26(Box19, { children: /* @__PURE__ */ jsxs19(Text20, { color: "cyan", children: [
15371
+ /* @__PURE__ */ jsx26(Box19, { children: /* @__PURE__ */ jsxs19(Text21, { color: "cyan", children: [
15170
15372
  /* @__PURE__ */ jsx26(Spinner11, { type: "dots" }),
15171
15373
  " Awaiting approval... (",
15172
15374
  elapsed,
15173
15375
  "s elapsed)"
15174
15376
  ] }) }),
15175
- request?.approval_url && /* @__PURE__ */ jsx26(Box19, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsxs19(Text20, { dimColor: true, children: [
15377
+ request?.approval_url && /* @__PURE__ */ jsx26(Box19, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsxs19(Text21, { dimColor: true, children: [
15176
15378
  "Approval URL: ",
15177
- /* @__PURE__ */ jsx26(Text20, { color: "cyan", children: request.approval_url })
15379
+ /* @__PURE__ */ jsx26(Text21, { color: "cyan", children: request.approval_url })
15178
15380
  ] }) })
15179
15381
  ] });
15180
15382
  }
15181
15383
  if (phase === "finalized") {
15182
15384
  const psd = request?.payment_status_details;
15183
15385
  return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
15184
- /* @__PURE__ */ jsxs19(Text20, { color: "yellow", children: [
15386
+ /* @__PURE__ */ jsxs19(Text21, { color: "yellow", children: [
15185
15387
  "Spend request reached terminal status: ",
15186
15388
  request?.status
15187
15389
  ] }),
15188
15390
  /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15189
- /* @__PURE__ */ jsxs19(Text20, { children: [
15391
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15190
15392
  "ID: ",
15191
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.id })
15393
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.id })
15192
15394
  ] }),
15193
- /* @__PURE__ */ jsxs19(Text20, { children: [
15395
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15194
15396
  "Status: ",
15195
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.status })
15397
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.status })
15196
15398
  ] }),
15197
15399
  psd && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15198
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: "Payment Details:" }),
15199
- /* @__PURE__ */ jsxs19(Text20, { children: [
15400
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: "Payment Details:" }),
15401
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15200
15402
  " ",
15201
15403
  "Outcome:",
15202
15404
  " ",
15203
- /* @__PURE__ */ jsx26(Text20, { bold: true, color: psd.outcome === "success" ? "green" : "red", children: psd.outcome })
15405
+ /* @__PURE__ */ jsx26(Text21, { bold: true, color: psd.outcome === "success" ? "green" : "red", children: psd.outcome })
15204
15406
  ] }),
15205
- psd.code && /* @__PURE__ */ jsxs19(Text20, { children: [
15407
+ psd.code && /* @__PURE__ */ jsxs19(Text21, { children: [
15206
15408
  " ",
15207
15409
  "Code: ",
15208
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: psd.code })
15410
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: psd.code })
15209
15411
  ] }),
15210
- psd.decline_code && /* @__PURE__ */ jsxs19(Text20, { children: [
15412
+ psd.decline_code && /* @__PURE__ */ jsxs19(Text21, { children: [
15211
15413
  " ",
15212
15414
  "Decline Reason: ",
15213
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: psd.decline_code })
15415
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: psd.decline_code })
15214
15416
  ] }),
15215
- /* @__PURE__ */ jsxs19(Text20, { children: [
15417
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15216
15418
  " ",
15217
15419
  "Amount:",
15218
15420
  " ",
15219
- /* @__PURE__ */ jsxs19(Text20, { bold: true, children: [
15421
+ /* @__PURE__ */ jsxs19(Text21, { bold: true, children: [
15220
15422
  psd.amount,
15221
15423
  " ",
15222
15424
  psd.currency
15223
15425
  ] })
15224
15426
  ] }),
15225
- psd.created && /* @__PURE__ */ jsxs19(Text20, { children: [
15427
+ psd.created && /* @__PURE__ */ jsxs19(Text21, { children: [
15226
15428
  " ",
15227
15429
  "Charged At:",
15228
15430
  " ",
15229
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: new Date(psd.created * 1e3).toISOString() })
15431
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: new Date(psd.created * 1e3).toISOString() })
15230
15432
  ] }),
15231
15433
  psd.refund_details && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15232
- /* @__PURE__ */ jsxs19(Text20, { bold: true, children: [
15434
+ /* @__PURE__ */ jsxs19(Text21, { bold: true, children: [
15233
15435
  " ",
15234
15436
  "Refund:"
15235
15437
  ] }),
15236
- /* @__PURE__ */ jsxs19(Text20, { children: [
15438
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15237
15439
  " ",
15238
15440
  "Amount:",
15239
15441
  " ",
15240
- /* @__PURE__ */ jsxs19(Text20, { bold: true, children: [
15442
+ /* @__PURE__ */ jsxs19(Text21, { bold: true, children: [
15241
15443
  psd.refund_details.amount,
15242
15444
  " ",
15243
15445
  psd.refund_details.currency
15244
15446
  ] })
15245
15447
  ] }),
15246
- /* @__PURE__ */ jsxs19(Text20, { children: [
15448
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15247
15449
  " ",
15248
15450
  "State: ",
15249
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: psd.refund_details.state })
15451
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: psd.refund_details.state })
15250
15452
  ] })
15251
15453
  ] })
15252
15454
  ] })
@@ -15255,63 +15457,70 @@ var RetrieveSpendRequest = ({
15255
15457
  }
15256
15458
  if (phase === "declined") {
15257
15459
  return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
15258
- /* @__PURE__ */ jsx26(Text20, { color: "red", children: "\u2717 Spend request declined" }),
15460
+ /* @__PURE__ */ jsx26(Text21, { color: "red", children: "\u2717 Spend request declined" }),
15259
15461
  /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15260
- /* @__PURE__ */ jsxs19(Text20, { children: [
15462
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15261
15463
  "ID: ",
15262
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.id })
15464
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.id })
15263
15465
  ] }),
15264
- /* @__PURE__ */ jsxs19(Text20, { children: [
15466
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15265
15467
  "Status:",
15266
15468
  " ",
15267
- /* @__PURE__ */ jsx26(Text20, { bold: true, color: "red", children: request?.status })
15469
+ /* @__PURE__ */ jsx26(Text21, { bold: true, color: "red", children: request?.status })
15268
15470
  ] }),
15269
- /* @__PURE__ */ jsxs19(Text20, { children: [
15471
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15270
15472
  "Amount:",
15271
15473
  " ",
15272
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.amount != null ? String(request.amount) : "N/A" })
15474
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.amount != null ? String(request.amount) : "N/A" })
15273
15475
  ] }),
15274
- /* @__PURE__ */ jsxs19(Text20, { children: [
15476
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15275
15477
  "Merchant: ",
15276
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.merchant_name })
15478
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.merchant_name })
15277
15479
  ] })
15278
15480
  ] })
15279
15481
  ] });
15280
15482
  }
15281
15483
  return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
15282
- /* @__PURE__ */ jsx26(Text20, { color: "green", children: "\u2713 Spend request approved" }),
15484
+ /* @__PURE__ */ jsx26(Text21, { color: "green", children: "\u2713 Spend request approved" }),
15283
15485
  /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15284
- /* @__PURE__ */ jsxs19(Text20, { children: [
15486
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15285
15487
  "ID: ",
15286
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.id })
15488
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.id })
15287
15489
  ] }),
15288
- /* @__PURE__ */ jsxs19(Text20, { children: [
15490
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15289
15491
  "Status:",
15290
15492
  " ",
15291
- /* @__PURE__ */ jsx26(Text20, { bold: true, color: "green", children: request?.status })
15493
+ /* @__PURE__ */ jsx26(Text21, { bold: true, color: "green", children: request?.status })
15292
15494
  ] }),
15293
- /* @__PURE__ */ jsxs19(Text20, { children: [
15495
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15294
15496
  "Amount:",
15295
15497
  " ",
15296
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.amount != null ? String(request.amount) : "N/A" })
15498
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.amount != null ? String(request.amount) : "N/A" })
15297
15499
  ] }),
15298
- /* @__PURE__ */ jsxs19(Text20, { children: [
15500
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15299
15501
  "Merchant: ",
15300
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.merchant_name })
15502
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.merchant_name })
15301
15503
  ] }),
15302
- /* @__PURE__ */ jsxs19(Text20, { children: [
15504
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15303
15505
  "Line Items:",
15304
15506
  " ",
15305
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") })
15507
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") })
15508
+ ] }),
15509
+ request?.link_pay_token && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15510
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: "Link Pay Token:" }),
15511
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15512
+ " ",
15513
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.link_pay_token })
15514
+ ] })
15306
15515
  ] }),
15307
15516
  request?.payment_status_details && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15308
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: "Last Payment Attempt:" }),
15309
- /* @__PURE__ */ jsxs19(Text20, { children: [
15517
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: "Last Payment Attempt:" }),
15518
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15310
15519
  " ",
15311
15520
  "Outcome:",
15312
15521
  " ",
15313
15522
  /* @__PURE__ */ jsx26(
15314
- Text20,
15523
+ Text21,
15315
15524
  {
15316
15525
  bold: true,
15317
15526
  color: request.payment_status_details.outcome === "success" ? "green" : "red",
@@ -15319,79 +15528,79 @@ var RetrieveSpendRequest = ({
15319
15528
  }
15320
15529
  )
15321
15530
  ] }),
15322
- request.payment_status_details.code && /* @__PURE__ */ jsxs19(Text20, { children: [
15531
+ request.payment_status_details.code && /* @__PURE__ */ jsxs19(Text21, { children: [
15323
15532
  " ",
15324
15533
  "Code:",
15325
15534
  " ",
15326
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.payment_status_details.code })
15535
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.payment_status_details.code })
15327
15536
  ] }),
15328
- request.payment_status_details.decline_code && /* @__PURE__ */ jsxs19(Text20, { children: [
15537
+ request.payment_status_details.decline_code && /* @__PURE__ */ jsxs19(Text21, { children: [
15329
15538
  " ",
15330
15539
  "Decline Reason:",
15331
15540
  " ",
15332
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.payment_status_details.decline_code })
15541
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.payment_status_details.decline_code })
15333
15542
  ] })
15334
15543
  ] }),
15335
15544
  request?.shared_payment_token && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15336
- /* @__PURE__ */ jsxs19(Text20, { bold: true, children: [
15545
+ /* @__PURE__ */ jsxs19(Text21, { bold: true, children: [
15337
15546
  "\x1B]8;;https://docs.stripe.com/agentic-commerce/concepts/shared-payment-tokens\x07",
15338
15547
  "Shared Payment Token",
15339
15548
  "\x1B]8;;\x07",
15340
15549
  ":"
15341
15550
  ] }),
15342
- /* @__PURE__ */ jsxs19(Text20, { children: [
15551
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15343
15552
  " ",
15344
15553
  "Token: ",
15345
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.shared_payment_token.id })
15554
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.shared_payment_token.id })
15346
15555
  ] })
15347
15556
  ] }),
15348
15557
  request?.card && !outputFile && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15349
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: "Card Details:" }),
15350
- /* @__PURE__ */ jsxs19(Text20, { children: [
15558
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: "Card Details:" }),
15559
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15351
15560
  " ",
15352
15561
  "Number: ",
15353
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.card.number })
15562
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.card.number })
15354
15563
  ] }),
15355
- /* @__PURE__ */ jsxs19(Text20, { children: [
15564
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15356
15565
  " ",
15357
15566
  "Brand: ",
15358
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request?.card.brand })
15567
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request?.card.brand })
15359
15568
  ] }),
15360
- /* @__PURE__ */ jsxs19(Text20, { children: [
15569
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15361
15570
  " ",
15362
15571
  "Expiry:",
15363
15572
  " ",
15364
- /* @__PURE__ */ jsxs19(Text20, { bold: true, children: [
15573
+ /* @__PURE__ */ jsxs19(Text21, { bold: true, children: [
15365
15574
  String(request?.card.exp_month).padStart(2, "0"),
15366
15575
  "/",
15367
15576
  request?.card.exp_year
15368
15577
  ] })
15369
15578
  ] }),
15370
- request?.card.cvc && /* @__PURE__ */ jsxs19(Text20, { children: [
15579
+ request?.card.cvc && /* @__PURE__ */ jsxs19(Text21, { children: [
15371
15580
  " ",
15372
15581
  "CVC: ",
15373
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.card.cvc })
15582
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.card.cvc })
15374
15583
  ] }),
15375
- request?.card.valid_until && /* @__PURE__ */ jsxs19(Text20, { children: [
15584
+ request?.card.valid_until && /* @__PURE__ */ jsxs19(Text21, { children: [
15376
15585
  " ",
15377
15586
  "Valid Until: ",
15378
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: request.card.valid_until })
15587
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: request.card.valid_until })
15379
15588
  ] }),
15380
15589
  request?.card.billing_address && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15381
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: " Billing Address:" }),
15382
- /* @__PURE__ */ jsxs19(Text20, { children: [
15590
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: " Billing Address:" }),
15591
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15383
15592
  " ",
15384
15593
  request.card.billing_address.name
15385
15594
  ] }),
15386
- /* @__PURE__ */ jsxs19(Text20, { children: [
15595
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15387
15596
  " ",
15388
15597
  request.card.billing_address.line1
15389
15598
  ] }),
15390
- request.card.billing_address.line2 && /* @__PURE__ */ jsxs19(Text20, { children: [
15599
+ request.card.billing_address.line2 && /* @__PURE__ */ jsxs19(Text21, { children: [
15391
15600
  " ",
15392
15601
  request.card.billing_address.line2
15393
15602
  ] }),
15394
- /* @__PURE__ */ jsxs19(Text20, { children: [
15603
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15395
15604
  " ",
15396
15605
  [
15397
15606
  request.card.billing_address.city,
@@ -15399,18 +15608,18 @@ var RetrieveSpendRequest = ({
15399
15608
  request.card.billing_address.postal_code
15400
15609
  ].filter(Boolean).join(", ")
15401
15610
  ] }),
15402
- /* @__PURE__ */ jsxs19(Text20, { children: [
15611
+ /* @__PURE__ */ jsxs19(Text21, { children: [
15403
15612
  " ",
15404
15613
  request.card.billing_address.country
15405
15614
  ] })
15406
15615
  ] })
15407
15616
  ] }),
15408
15617
  request?.card && outputFile && /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", marginTop: 1, children: [
15409
- outputFilePath && /* @__PURE__ */ jsxs19(Text20, { color: "green", children: [
15618
+ outputFilePath && /* @__PURE__ */ jsxs19(Text21, { color: "green", children: [
15410
15619
  "Card credentials written to ",
15411
- /* @__PURE__ */ jsx26(Text20, { bold: true, children: outputFilePath })
15620
+ /* @__PURE__ */ jsx26(Text21, { bold: true, children: outputFilePath })
15412
15621
  ] }),
15413
- fileError && /* @__PURE__ */ jsxs19(Text20, { color: "red", children: [
15622
+ fileError && /* @__PURE__ */ jsxs19(Text21, { color: "red", children: [
15414
15623
  "Failed to write card file: ",
15415
15624
  fileError
15416
15625
  ] })
@@ -15420,74 +15629,78 @@ var RetrieveSpendRequest = ({
15420
15629
  };
15421
15630
 
15422
15631
  // src/commands/spend-request/schema.ts
15423
- import { z as z7 } from "incur";
15424
- var createOptions = z7.object({
15425
- paymentMethodId: z7.string().describe("Payment method ID"),
15426
- credentialType: z7.enum(["shared_payment_token", "card"]).default("card").describe(
15632
+ import { z as z8 } from "incur";
15633
+ var createOptions = z8.object({
15634
+ paymentMethodId: z8.string().describe("Payment method ID"),
15635
+ credentialType: z8.enum(["shared_payment_token", "card"]).default("card").describe(
15427
15636
  '"card" for checkout forms/Stripe Elements; "shared_payment_token" for HTTP 402/machine payment flows'
15428
15637
  ),
15429
- networkId: z7.string().optional().describe(
15638
+ networkId: z8.string().optional().describe(
15430
15639
  "Network ID (required for shared_payment_token) \u2014 use `link-cli mpp decode` to extract"
15431
15640
  ),
15432
- amount: z7.coerce.number().int().positive().max(5e5).describe("Amount in cents, max 500000 ($5,000.00)"),
15433
- currency: z7.string().length(3).default("usd").describe("Currency code"),
15434
- merchantName: z7.string().optional().describe(
15641
+ amount: z8.coerce.number().int().positive().max(5e5).describe("Amount in cents, max 500000 ($5,000.00)"),
15642
+ currency: z8.string().length(3).default("usd").describe("Currency code"),
15643
+ merchantName: z8.string().optional().describe(
15435
15644
  "Merchant name (required for card; forbidden for shared_payment_token)"
15436
15645
  ),
15437
- merchantUrl: z7.string().optional().describe(
15646
+ merchantUrl: z8.string().optional().describe(
15438
15647
  "Merchant URL (required for card; forbidden for shared_payment_token)"
15439
15648
  ),
15440
- context: z7.string().min(100).describe(
15649
+ context: z8.string().min(100).describe(
15441
15650
  "Min 100 chars \u2014 describe the purchase and rationale; the user reads this when approving"
15442
15651
  ),
15443
- lineItem: z7.array(z7.union([z7.string(), z7.record(z7.string(), z7.unknown())])).default([]).describe(
15652
+ lineItem: z8.array(z8.union([z8.string(), z8.record(z8.string(), z8.unknown())])).default([]).describe(
15444
15653
  'Line item (repeatable, key:value format). Keys: name (required), quantity, unit_amount, description, sku, url, image_url, product_url. Example: "name:Shoes,unit_amount:5000,quantity:2"'
15445
15654
  ),
15446
- total: z7.array(z7.union([z7.string(), z7.record(z7.string(), z7.unknown())])).default([]).describe(
15655
+ total: z8.array(z8.union([z8.string(), z8.record(z8.string(), z8.unknown())])).default([]).describe(
15447
15656
  'Total (repeatable, key:value format). Keys: type (required; one of: subtotal, tax, total, items_base_amount, items_discount, discount, fulfillment, shipping, fee, gift_wrap, tip, store_credit), display_text (required), amount (required). Example: "type:total,display_text:Total,amount:5000"'
15448
15657
  ),
15449
- requestApproval: z7.boolean().default(true).describe("Request approval and poll until approved/denied/expired"),
15450
- test: z7.boolean().default(false).describe(
15658
+ requestApproval: z8.boolean().default(true).describe("Request approval and poll until approved/denied/expired"),
15659
+ test: z8.boolean().default(false).describe(
15451
15660
  "Use test mode (creates testmode credentials from test card data)"
15452
15661
  ),
15453
- outputFile: z7.string().optional().describe(
15662
+ approve: z8.boolean().default(false).describe(""),
15663
+ outputFile: z8.string().optional().describe(
15454
15664
  "Write full card credentials to this file path; stdout shows redacted card data only"
15455
15665
  ),
15456
- force: z7.boolean().default(false).describe("Overwrite output file if it already exists")
15666
+ force: z8.boolean().default(false).describe("Overwrite output file if it already exists")
15457
15667
  });
15458
- var retrieveOptions = z7.object({
15459
- timeout: z7.coerce.number().default(600).describe(
15668
+ var listOptions = z8.object({
15669
+ includeHistory: z8.boolean().default(false).describe("Include expired and terminal spend requests")
15670
+ });
15671
+ var retrieveOptions = z8.object({
15672
+ timeout: z8.coerce.number().default(600).describe(
15460
15673
  "Polling timeout in seconds. When reached during active polling, exits non-zero with POLLING_TIMEOUT. Default exceeds the server-side spend-request expiry so polling outlives the request itself."
15461
15674
  ),
15462
- interval: z7.coerce.number().default(0).describe(
15675
+ interval: z8.coerce.number().default(0).describe(
15463
15676
  "Poll interval in seconds. When > 0, polls until status is terminal, timeout is reached, or max attempts are exhausted."
15464
15677
  ),
15465
- maxAttempts: z7.coerce.number().default(0).describe(
15678
+ maxAttempts: z8.coerce.number().default(0).describe(
15466
15679
  "Max poll attempts. 0 = unlimited. Exhaustion during active polling exits non-zero with POLLING_TIMEOUT."
15467
15680
  ),
15468
- include: z7.array(z7.string()).default([]).describe("Include extra data (repeatable, e.g. --include card)"),
15469
- outputFile: z7.string().optional().describe(
15681
+ include: z8.array(z8.string()).default([]).describe("Include extra data (repeatable, e.g. --include card)"),
15682
+ outputFile: z8.string().optional().describe(
15470
15683
  "Write full card credentials to this file path; stdout shows redacted card data only"
15471
15684
  ),
15472
- force: z7.boolean().default(false).describe("Overwrite output file if it already exists")
15685
+ force: z8.boolean().default(false).describe("Overwrite output file if it already exists")
15473
15686
  });
15474
- var updateOptions = z7.object({
15475
- paymentMethodId: z7.string().optional().describe("Payment method ID"),
15476
- amount: z7.coerce.number().optional().describe("Amount in cents"),
15477
- merchantUrl: z7.string().optional().describe("Merchant URL"),
15478
- profileId: z7.string().optional().describe("Profile ID"),
15479
- merchantId: z7.string().optional().describe("Merchant ID"),
15480
- currency: z7.string().optional().describe("Currency code"),
15481
- lineItem: z7.array(z7.union([z7.string(), z7.record(z7.string(), z7.unknown())])).default([]).describe(
15687
+ var updateOptions = z8.object({
15688
+ paymentMethodId: z8.string().optional().describe("Payment method ID"),
15689
+ amount: z8.coerce.number().optional().describe("Amount in cents"),
15690
+ merchantUrl: z8.string().optional().describe("Merchant URL"),
15691
+ profileId: z8.string().optional().describe("Profile ID"),
15692
+ merchantId: z8.string().optional().describe("Merchant ID"),
15693
+ currency: z8.string().optional().describe("Currency code"),
15694
+ lineItem: z8.array(z8.union([z8.string(), z8.record(z8.string(), z8.unknown())])).default([]).describe(
15482
15695
  'Line item (repeatable, key:value format). Keys: name (required), quantity, unit_amount, description, sku, url, image_url, product_url. Example: "name:Shoes,unit_amount:5000,quantity:2"'
15483
15696
  ),
15484
- total: z7.array(z7.union([z7.string(), z7.record(z7.string(), z7.unknown())])).default([]).describe(
15697
+ total: z8.array(z8.union([z8.string(), z8.record(z8.string(), z8.unknown())])).default([]).describe(
15485
15698
  'Total (repeatable, key:value format). Keys: type (required; one of: subtotal, tax, total, items_base_amount, items_discount, discount, fulfillment, shipping, fee, gift_wrap, tip, store_credit), display_text (required), amount (required). Example: "type:total,display_text:Total,amount:5000"'
15486
15699
  )
15487
15700
  });
15488
15701
 
15489
15702
  // src/commands/spend-request/update.tsx
15490
- import { Box as Box20, Text as Text21 } from "ink";
15703
+ import { Box as Box20, Text as Text22 } from "ink";
15491
15704
  import Spinner12 from "ink-spinner";
15492
15705
  import { useCallback as useCallback9 } from "react";
15493
15706
  import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
@@ -15503,7 +15716,7 @@ var UpdateSpendRequest = ({
15503
15716
  );
15504
15717
  const { status, data: request, error } = useAsyncAction(action, onComplete);
15505
15718
  if (status === "loading") {
15506
- return /* @__PURE__ */ jsx27(Box20, { children: /* @__PURE__ */ jsxs20(Text21, { color: "cyan", children: [
15719
+ return /* @__PURE__ */ jsx27(Box20, { children: /* @__PURE__ */ jsxs20(Text22, { color: "cyan", children: [
15507
15720
  /* @__PURE__ */ jsx27(Spinner12, { type: "dots" }),
15508
15721
  " Updating spend request ",
15509
15722
  id,
@@ -15512,37 +15725,37 @@ var UpdateSpendRequest = ({
15512
15725
  }
15513
15726
  if (status === "error") {
15514
15727
  return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
15515
- /* @__PURE__ */ jsx27(Text21, { color: "red", children: "\u2717 Failed to update spend request" }),
15516
- /* @__PURE__ */ jsx27(Text21, { color: "red", children: error })
15728
+ /* @__PURE__ */ jsx27(Text22, { color: "red", children: "\u2717 Failed to update spend request" }),
15729
+ /* @__PURE__ */ jsx27(Text22, { color: "red", children: error })
15517
15730
  ] });
15518
15731
  }
15519
15732
  return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
15520
- /* @__PURE__ */ jsx27(Text21, { color: "green", children: "\u2713 Spend request updated" }),
15733
+ /* @__PURE__ */ jsx27(Text22, { color: "green", children: "\u2713 Spend request updated" }),
15521
15734
  /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15522
- /* @__PURE__ */ jsxs20(Text21, { children: [
15735
+ /* @__PURE__ */ jsxs20(Text22, { children: [
15523
15736
  "ID: ",
15524
- /* @__PURE__ */ jsx27(Text21, { bold: true, children: request?.id })
15737
+ /* @__PURE__ */ jsx27(Text22, { bold: true, children: request?.id })
15525
15738
  ] }),
15526
- /* @__PURE__ */ jsxs20(Text21, { children: [
15739
+ /* @__PURE__ */ jsxs20(Text22, { children: [
15527
15740
  "Status: ",
15528
- /* @__PURE__ */ jsx27(Text21, { bold: true, children: request?.status })
15741
+ /* @__PURE__ */ jsx27(Text22, { bold: true, children: request?.status })
15529
15742
  ] }),
15530
- /* @__PURE__ */ jsxs20(Text21, { children: [
15743
+ /* @__PURE__ */ jsxs20(Text22, { children: [
15531
15744
  "Amount:",
15532
15745
  " ",
15533
- /* @__PURE__ */ jsx27(Text21, { bold: true, children: (() => {
15746
+ /* @__PURE__ */ jsx27(Text22, { bold: true, children: (() => {
15534
15747
  const t = request?.totals.find((t2) => t2.type === "total");
15535
15748
  return t ? String(t.amount) : "N/A";
15536
15749
  })() })
15537
15750
  ] }),
15538
- /* @__PURE__ */ jsxs20(Text21, { children: [
15751
+ /* @__PURE__ */ jsxs20(Text22, { children: [
15539
15752
  "Merchant: ",
15540
- /* @__PURE__ */ jsx27(Text21, { bold: true, children: request?.merchant_name })
15753
+ /* @__PURE__ */ jsx27(Text22, { bold: true, children: request?.merchant_name })
15541
15754
  ] }),
15542
- /* @__PURE__ */ jsxs20(Text21, { children: [
15755
+ /* @__PURE__ */ jsxs20(Text22, { children: [
15543
15756
  "Line Items:",
15544
15757
  " ",
15545
- /* @__PURE__ */ jsx27(Text21, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") })
15758
+ /* @__PURE__ */ jsx27(Text22, { bold: true, children: request?.line_items.map((li) => li.name).join(", ") })
15546
15759
  ] })
15547
15760
  ] })
15548
15761
  ] });
@@ -15568,22 +15781,31 @@ async function applyOutputFile(request, outputFile, force) {
15568
15781
  };
15569
15782
  }
15570
15783
  function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15571
- const cli2 = Cli8.create("spend-request", {
15784
+ const cli2 = Cli9.create("spend-request", {
15572
15785
  description: "Spend request management commands"
15573
15786
  });
15574
15787
  cli2.command("list", {
15575
- description: "List active spend requests (created, pending_approval, approved)",
15788
+ description: "List spend requests. By default returns only active requests (created, pending_approval, approved). Use --include-history to return all spend requests including expired and terminal states.",
15576
15789
  outputPolicy: "agent-only",
15790
+ options: listOptions,
15577
15791
  middleware: [requireAuth(authStorage2, envAccessToken2)],
15578
15792
  async run(c) {
15793
+ const opts = { includeHistory: c.options.includeHistory ?? false };
15579
15794
  if (!c.agent && !c.formatExplicit) {
15580
15795
  return renderInteractive(
15581
- /* @__PURE__ */ jsx28(SpendRequestList, { repository, onComplete: () => {
15582
- } }),
15583
- () => repository.listSpendRequests()
15796
+ /* @__PURE__ */ jsx28(
15797
+ SpendRequestList,
15798
+ {
15799
+ repository,
15800
+ includeHistory: opts.includeHistory,
15801
+ onComplete: () => {
15802
+ }
15803
+ }
15804
+ ),
15805
+ () => repository.listSpendRequests(opts)
15584
15806
  );
15585
15807
  }
15586
- return repository.listSpendRequests();
15808
+ return repository.listSpendRequests(opts);
15587
15809
  }
15588
15810
  });
15589
15811
  cli2.command("create", {
@@ -15647,7 +15869,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15647
15869
  line_items: lineItems,
15648
15870
  totals,
15649
15871
  request_approval: requestApproval || void 0,
15650
- test: opts.test ? true : void 0
15872
+ test: opts.test ? true : void 0,
15873
+ approve: opts.approve ? true : void 0
15651
15874
  };
15652
15875
  const outputFile = opts.outputFile;
15653
15876
  const forceOverwrite = opts.force;
@@ -15699,8 +15922,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15699
15922
  });
15700
15923
  cli2.command("update", {
15701
15924
  description: "Update a spend request",
15702
- args: z8.object({
15703
- id: z8.string().describe("Spend request ID")
15925
+ args: z9.object({
15926
+ id: z9.string().describe("Spend request ID")
15704
15927
  }),
15705
15928
  options: updateOptions,
15706
15929
  outputPolicy: "agent-only",
@@ -15751,8 +15974,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15751
15974
  });
15752
15975
  cli2.command("request-approval", {
15753
15976
  description: "Request approval for a spend request",
15754
- args: z8.object({
15755
- id: z8.string().describe("Spend request ID")
15977
+ args: z9.object({
15978
+ id: z9.string().describe("Spend request ID")
15756
15979
  }),
15757
15980
  outputPolicy: "agent-only",
15758
15981
  async *run(c) {
@@ -15791,8 +16014,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15791
16014
  });
15792
16015
  cli2.command("retrieve", {
15793
16016
  description: "Retrieve a spend request",
15794
- args: z8.object({
15795
- id: z8.string().describe("Spend request ID")
16017
+ args: z9.object({
16018
+ id: z9.string().describe("Spend request ID")
15796
16019
  }),
15797
16020
  options: retrieveOptions,
15798
16021
  outputPolicy: "agent-only",
@@ -15882,8 +16105,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15882
16105
  });
15883
16106
  cli2.command("cancel", {
15884
16107
  description: "Cancel a spend request",
15885
- args: z8.object({
15886
- id: z8.string().describe("Spend request ID")
16108
+ args: z9.object({
16109
+ id: z9.string().describe("Spend request ID")
15887
16110
  }),
15888
16111
  outputPolicy: "agent-only",
15889
16112
  middleware: [requireAuth(authStorage2, envAccessToken2)],
@@ -15916,10 +16139,10 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
15916
16139
  }
15917
16140
 
15918
16141
  // src/commands/user-info/index.tsx
15919
- import { Cli as Cli9 } from "incur";
16142
+ import { Cli as Cli10 } from "incur";
15920
16143
 
15921
16144
  // src/commands/user-info/retrieve.tsx
15922
- import { Box as Box21, Text as Text22 } from "ink";
16145
+ import { Box as Box21, Text as Text23 } from "ink";
15923
16146
  import Spinner13 from "ink-spinner";
15924
16147
  import { useCallback as useCallback10 } from "react";
15925
16148
  import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -15930,31 +16153,31 @@ var UserInfoRetrieve = ({
15930
16153
  const action = useCallback10(() => resource.retrieve(), [resource]);
15931
16154
  const { status, data: userInfo, error } = useAsyncAction(action, onComplete);
15932
16155
  if (status === "loading") {
15933
- return /* @__PURE__ */ jsx29(Box21, { children: /* @__PURE__ */ jsxs21(Text22, { color: "cyan", children: [
16156
+ return /* @__PURE__ */ jsx29(Box21, { children: /* @__PURE__ */ jsxs21(Text23, { color: "cyan", children: [
15934
16157
  /* @__PURE__ */ jsx29(Spinner13, { type: "dots" }),
15935
16158
  " Loading user info..."
15936
16159
  ] }) });
15937
16160
  }
15938
16161
  if (status === "error") {
15939
16162
  return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", children: [
15940
- /* @__PURE__ */ jsx29(Text22, { color: "red", children: "\u2717 Failed to load user info" }),
15941
- /* @__PURE__ */ jsx29(Text22, { color: "red", children: error })
16163
+ /* @__PURE__ */ jsx29(Text23, { color: "red", children: "\u2717 Failed to load user info" }),
16164
+ /* @__PURE__ */ jsx29(Text23, { color: "red", children: error })
15942
16165
  ] });
15943
16166
  }
15944
16167
  return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", children: [
15945
- /* @__PURE__ */ jsx29(Text22, { bold: true, children: "User Info" }),
16168
+ /* @__PURE__ */ jsx29(Text23, { bold: true, children: "User Info" }),
15946
16169
  /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", marginTop: 1, paddingX: 2, children: [
15947
- /* @__PURE__ */ jsxs21(Text22, { children: [
15948
- /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Email: " }),
15949
- userInfo?.email ?? /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Not set" })
16170
+ /* @__PURE__ */ jsxs21(Text23, { children: [
16171
+ /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Email: " }),
16172
+ userInfo?.email ?? /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Not set" })
15950
16173
  ] }),
15951
- /* @__PURE__ */ jsxs21(Text22, { children: [
15952
- /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Name: " }),
15953
- userInfo?.name ?? /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Not set" })
16174
+ /* @__PURE__ */ jsxs21(Text23, { children: [
16175
+ /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Name: " }),
16176
+ userInfo?.name ?? /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Not set" })
15954
16177
  ] }),
15955
- /* @__PURE__ */ jsxs21(Text22, { children: [
15956
- /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Phone: " }),
15957
- userInfo?.phone ?? /* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Not set" })
16178
+ /* @__PURE__ */ jsxs21(Text23, { children: [
16179
+ /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Phone: " }),
16180
+ userInfo?.phone ?? /* @__PURE__ */ jsx29(Text23, { dimColor: true, children: "Not set" })
15958
16181
  ] })
15959
16182
  ] })
15960
16183
  ] });
@@ -15963,7 +16186,7 @@ var UserInfoRetrieve = ({
15963
16186
  // src/commands/user-info/index.tsx
15964
16187
  import { jsx as jsx30 } from "react/jsx-runtime";
15965
16188
  function createUserInfoCli(createResource, authStorage2, envAccessToken2) {
15966
- const cli2 = Cli9.create("user-info", {
16189
+ const cli2 = Cli10.create("user-info", {
15967
16190
  description: "User information commands"
15968
16191
  });
15969
16192
  cli2.command("retrieve", {
@@ -16145,6 +16368,8 @@ ${JSON.stringify(redacted, null, 2)}`
16145
16368
  rawBody,
16146
16369
  details: data
16147
16370
  });
16371
+ case "authorization_failed":
16372
+ throw new LinkAuthorizationDeclinedError(err.scope_eligibility ?? {});
16148
16373
  }
16149
16374
  }
16150
16375
  throw new LinkApiError(
@@ -16264,6 +16489,7 @@ var ResourceFactory = class {
16264
16489
  shippingAddressResource;
16265
16490
  userInfoResource;
16266
16491
  webBotAuthResource;
16492
+ reportResource;
16267
16493
  constructor(options = {}) {
16268
16494
  this.verbose = options.verbose ?? false;
16269
16495
  this.defaultHeaders = options.defaultHeaders;
@@ -16390,6 +16616,20 @@ var ResourceFactory = class {
16390
16616
  );
16391
16617
  return this.webBotAuthResource;
16392
16618
  }
16619
+ createReportResource() {
16620
+ if (this.reportResource) {
16621
+ return this.reportResource;
16622
+ }
16623
+ const getAccessToken = this.createSdkAccessTokenProvider();
16624
+ this.reportResource = sanitizeResource(
16625
+ new ReportResource({
16626
+ verbose: this.verbose,
16627
+ defaultHeaders: this.defaultHeaders,
16628
+ getAccessToken
16629
+ })
16630
+ );
16631
+ return this.reportResource;
16632
+ }
16393
16633
  };
16394
16634
 
16395
16635
  // src/utils/update-info.ts
@@ -16463,7 +16703,7 @@ function cacheUpdateInfo(value, ttlMs = UPDATE_CACHE_TTL_MS) {
16463
16703
  }
16464
16704
 
16465
16705
  // src/cli.tsx
16466
- var cliVersion = "0.7.3";
16706
+ var cliVersion = "0.8.0";
16467
16707
  var cliName = "@stripe/link-cli";
16468
16708
  var defaultHeaders = {
16469
16709
  "User-Agent": `link-cli/${cliVersion}`
@@ -16488,7 +16728,7 @@ var factory = new ResourceFactory({
16488
16728
  });
16489
16729
  var authRepo = factory.createAuthResource();
16490
16730
  var spendRequestRepo = factory.createSpendRequestResource();
16491
- var cli = Cli10.create("link-cli", {
16731
+ var cli = Cli11.create("link-cli", {
16492
16732
  description: "Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.",
16493
16733
  version: cliVersion
16494
16734
  });
@@ -16533,6 +16773,13 @@ cli.command(
16533
16773
  )
16534
16774
  );
16535
16775
  cli.command(createMppCli(spendRequestRepo, authStorage, envAccessToken));
16776
+ cli.command(
16777
+ createReportCli(
16778
+ () => factory.createReportResource(),
16779
+ authStorage,
16780
+ envAccessToken
16781
+ )
16782
+ );
16536
16783
  cli.command(
16537
16784
  createDemoCli(
16538
16785
  authRepo,