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