@stripe/link-cli 0.10.0 → 0.10.1
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/README.md +1 -1
- package/dist/cli.js +48 -7
- package/package.json +3 -1
- package/postinstall.mjs +50 -0
package/README.md
CHANGED
|
@@ -231,7 +231,7 @@ A spend request moves through: **create** → **request approval** → **approve
|
|
|
231
231
|
**Required fields for create:** `merchant_name`, `merchant_url`, `context`, `amount`. `payment_method_id` is optional — if omitted, your default payment method will be used, or the first eligible one if no default is set.
|
|
232
232
|
|
|
233
233
|
**Constraints:** `context` must be at least 100 characters; `amount` must not exceed 500000 (cents); `currency` must be a 3-letter ISO code. The user has 10 minutes from when approval is requested to approve. Approved credentials (card or SPT) are valid for 12 hours from spend request creation.
|
|
234
|
-
**Test mode:** Pass `--test` to create testmode credentials (
|
|
234
|
+
**Test mode:** Pass `--test` to create a testmode SpendRequest. A testmode SpendRequest will return test payment credentials (e.g test card `4000009990001984`) rather than a real payment credential. Testmode SpendRequests will not charge the underlying payment method of the SpendRequest. This is useful for development and integration testing without real payment methods.
|
|
235
235
|
|
|
236
236
|
```bash
|
|
237
237
|
# Update before approval
|
package/dist/cli.js
CHANGED
|
@@ -13894,7 +13894,11 @@ function buildHeaders(data, headers) {
|
|
|
13894
13894
|
async function readPayResult(response) {
|
|
13895
13895
|
const responseHeaders = Object.fromEntries(response.headers.entries());
|
|
13896
13896
|
const body = await response.text();
|
|
13897
|
-
return {
|
|
13897
|
+
return sanitizeDeep({
|
|
13898
|
+
status: response.status,
|
|
13899
|
+
headers: responseHeaders,
|
|
13900
|
+
body
|
|
13901
|
+
});
|
|
13898
13902
|
}
|
|
13899
13903
|
function createStripePaymentClient(spt) {
|
|
13900
13904
|
const stripeCharge = Method.toClient(StripeMethods.charge, {
|
|
@@ -15998,6 +16002,7 @@ var CreateSpendRequest = ({
|
|
|
15998
16002
|
const [request, setRequest] = useState9(null);
|
|
15999
16003
|
const [error, setError] = useState9("");
|
|
16000
16004
|
const [verificationUrl, setVerificationUrl] = useState9("");
|
|
16005
|
+
const [supportUrl, setSupportUrl] = useState9("");
|
|
16001
16006
|
const [outputFilePath, setOutputFilePath] = useState9(null);
|
|
16002
16007
|
const [fileError, setFileError] = useState9("");
|
|
16003
16008
|
const approvalUrl = request?.approval_url ?? "";
|
|
@@ -16038,8 +16043,11 @@ var CreateSpendRequest = ({
|
|
|
16038
16043
|
} catch (err) {
|
|
16039
16044
|
setError(err.message);
|
|
16040
16045
|
if (err instanceof LinkApiError) {
|
|
16041
|
-
const
|
|
16042
|
-
if (
|
|
16046
|
+
const errDetail = err.details;
|
|
16047
|
+
if (errDetail?.error?.verification_url)
|
|
16048
|
+
setVerificationUrl(errDetail.error.verification_url);
|
|
16049
|
+
if (errDetail?.error?.support_url)
|
|
16050
|
+
setSupportUrl(errDetail.error.support_url);
|
|
16043
16051
|
}
|
|
16044
16052
|
setStatus("error");
|
|
16045
16053
|
setTimeout(() => completeAndExit(null), DISPLAY_DELAY_MS);
|
|
@@ -16072,6 +16080,10 @@ var CreateSpendRequest = ({
|
|
|
16072
16080
|
verificationUrl && /* @__PURE__ */ jsxs18(Text20, { color: "red", children: [
|
|
16073
16081
|
"Complete additional verification at: ",
|
|
16074
16082
|
verificationUrl
|
|
16083
|
+
] }),
|
|
16084
|
+
supportUrl && /* @__PURE__ */ jsxs18(Text20, { color: "red", children: [
|
|
16085
|
+
"Identity verification failed. Contact support at: ",
|
|
16086
|
+
supportUrl
|
|
16075
16087
|
] })
|
|
16076
16088
|
] });
|
|
16077
16089
|
}
|
|
@@ -16241,6 +16253,7 @@ var RequestApproval = ({
|
|
|
16241
16253
|
const [result, setResult] = useState10(null);
|
|
16242
16254
|
const [error, setError] = useState10("");
|
|
16243
16255
|
const [verificationUrl, setVerificationUrl] = useState10("");
|
|
16256
|
+
const [supportUrl, setSupportUrl] = useState10("");
|
|
16244
16257
|
const { exit } = useApp6();
|
|
16245
16258
|
const completeAndExit = useCallback10(
|
|
16246
16259
|
(result2) => {
|
|
@@ -16270,8 +16283,11 @@ var RequestApproval = ({
|
|
|
16270
16283
|
} catch (err) {
|
|
16271
16284
|
setError(err.message);
|
|
16272
16285
|
if (err instanceof LinkApiError) {
|
|
16273
|
-
const
|
|
16274
|
-
if (
|
|
16286
|
+
const errDetail = err.details;
|
|
16287
|
+
if (errDetail?.error?.verification_url)
|
|
16288
|
+
setVerificationUrl(errDetail.error.verification_url);
|
|
16289
|
+
if (errDetail?.error?.support_url)
|
|
16290
|
+
setSupportUrl(errDetail.error.support_url);
|
|
16275
16291
|
}
|
|
16276
16292
|
setStatus("error");
|
|
16277
16293
|
setTimeout(() => {
|
|
@@ -16295,6 +16311,10 @@ var RequestApproval = ({
|
|
|
16295
16311
|
verificationUrl && /* @__PURE__ */ jsxs20(Text22, { color: "red", children: [
|
|
16296
16312
|
"Complete additional verification at: ",
|
|
16297
16313
|
verificationUrl
|
|
16314
|
+
] }),
|
|
16315
|
+
supportUrl && /* @__PURE__ */ jsxs20(Text22, { color: "red", children: [
|
|
16316
|
+
"Identity verification failed. Contact support at: ",
|
|
16317
|
+
supportUrl
|
|
16298
16318
|
] })
|
|
16299
16319
|
] });
|
|
16300
16320
|
}
|
|
@@ -16580,7 +16600,16 @@ var RetrieveSpendRequest = ({
|
|
|
16580
16600
|
/* @__PURE__ */ jsx30(Text23, { bold: true, children: psd.refund_details.state })
|
|
16581
16601
|
] })
|
|
16582
16602
|
] })
|
|
16583
|
-
] })
|
|
16603
|
+
] }),
|
|
16604
|
+
request?.link_transaction_id && /* @__PURE__ */ jsx30(Box21, { marginTop: 1, children: /* @__PURE__ */ jsxs21(Text23, { children: [
|
|
16605
|
+
"Transaction ID: ",
|
|
16606
|
+
/* @__PURE__ */ jsx30(Text23, { bold: true, children: request.link_transaction_id })
|
|
16607
|
+
] }) }),
|
|
16608
|
+
request?.status === "succeeded" && request?.activity_url && /* @__PURE__ */ jsx30(Box21, { marginTop: 1, children: /* @__PURE__ */ jsxs21(Text23, { children: [
|
|
16609
|
+
"Activity URL:",
|
|
16610
|
+
" ",
|
|
16611
|
+
/* @__PURE__ */ jsx30(Text23, { bold: true, color: "cyan", children: request.activity_url })
|
|
16612
|
+
] }) })
|
|
16584
16613
|
] })
|
|
16585
16614
|
] });
|
|
16586
16615
|
}
|
|
@@ -17044,6 +17073,12 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17044
17073
|
message: `${err.message} Verification URL: ${apiErr.error.verification_url}`
|
|
17045
17074
|
});
|
|
17046
17075
|
}
|
|
17076
|
+
if (apiErr?.error?.support_url) {
|
|
17077
|
+
return c.error({
|
|
17078
|
+
code: err.code,
|
|
17079
|
+
message: `${err.message} Support URL: ${apiErr.error.support_url}`
|
|
17080
|
+
});
|
|
17081
|
+
}
|
|
17047
17082
|
}
|
|
17048
17083
|
throw err;
|
|
17049
17084
|
}
|
|
@@ -17163,6 +17198,12 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17163
17198
|
message: `${err.message} Verification URL: ${apiErr.error.verification_url}`
|
|
17164
17199
|
});
|
|
17165
17200
|
}
|
|
17201
|
+
if (apiErr?.error?.support_url) {
|
|
17202
|
+
return c.error({
|
|
17203
|
+
code: err.code,
|
|
17204
|
+
message: `${err.message} Support URL: ${apiErr.error.support_url}`
|
|
17205
|
+
});
|
|
17206
|
+
}
|
|
17166
17207
|
}
|
|
17167
17208
|
throw err;
|
|
17168
17209
|
}
|
|
@@ -18115,7 +18156,7 @@ function cacheUpdateInfo(value, ttlMs = UPDATE_CACHE_TTL_MS) {
|
|
|
18115
18156
|
}
|
|
18116
18157
|
|
|
18117
18158
|
// src/cli.tsx
|
|
18118
|
-
var cliVersion = "0.10.
|
|
18159
|
+
var cliVersion = "0.10.1";
|
|
18119
18160
|
var cliName = "@stripe/link-cli";
|
|
18120
18161
|
var defaultHeaders = {
|
|
18121
18162
|
"User-Agent": `link-cli/${cliVersion}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/link-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"link-cli": "./dist/cli.js"
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"!dist/sea",
|
|
11
|
+
"postinstall.mjs",
|
|
11
12
|
"README.md",
|
|
12
13
|
"LICENSE"
|
|
13
14
|
],
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "tsup",
|
|
51
52
|
"build:sea": "tsup --config tsup.sea.config.ts",
|
|
53
|
+
"postinstall": "node postinstall.mjs",
|
|
52
54
|
"typecheck": "tsc",
|
|
53
55
|
"test": "vitest run",
|
|
54
56
|
"dev": "tsx src/cli.tsx"
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Refresh the create-payment-credential skill whenever the CLI is (re)installed
|
|
4
|
+
// or upgraded via npm. Delegates to the openclaw `skills` CLI so the skill file
|
|
5
|
+
// stays in sync with the installed CLI version. Must never fail the install.
|
|
6
|
+
|
|
7
|
+
import { spawnSync } from 'node:child_process';
|
|
8
|
+
import process from 'node:process';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
|
|
11
|
+
const REPO = 'stripe/link-cli';
|
|
12
|
+
|
|
13
|
+
function run() {
|
|
14
|
+
// Skip when running from the source monorepo (dev `pnpm install`). Installed
|
|
15
|
+
// copies live under node_modules; the dev tree does not.
|
|
16
|
+
if (!fileURLToPath(import.meta.url).includes('node_modules')) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (process.env.CI || process.env.LINK_CLI_SKIP_SKILL_INSTALL) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
process.stdout.write(
|
|
25
|
+
'link-cli: refreshing the create-payment-credential skill…\n',
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const result = spawnSync(
|
|
29
|
+
'npx',
|
|
30
|
+
['--yes', 'skills', 'add', REPO, '-g', '-y'],
|
|
31
|
+
{
|
|
32
|
+
stdio: 'inherit',
|
|
33
|
+
timeout: 60_000,
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (result.error || result.status !== 0) {
|
|
38
|
+
process.stdout.write(
|
|
39
|
+
`link-cli: skipped skill refresh; run 'npx skills add ${REPO}' manually.\n`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
run();
|
|
46
|
+
} catch {
|
|
47
|
+
// Never fail the install.
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
process.exit(0);
|