shopstack 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/package.json +1 -1
- package/specs/openapi.json +51 -3
- package/src/cli.js +11 -0
- package/src/client.d.ts +11 -1
- package/src/client.js +7 -1
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ guest restaurant reservations.
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
npm install shopstack@0.3.
|
|
9
|
+
npm install shopstack@0.3.2
|
|
10
10
|
# or
|
|
11
|
-
npm install -g shopstack@0.3.
|
|
11
|
+
npm install -g shopstack@0.3.2
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Node.js 18 or newer is required.
|
|
@@ -18,7 +18,7 @@ WebSocket (Node.js 22 or newer). It reads the authenticated checkout resource
|
|
|
18
18
|
after each notification. Older runtimes, or a failed socket connection, use the
|
|
19
19
|
bounded HTTP update wait. The one-time socket token is never placed in a URL.
|
|
20
20
|
|
|
21
|
-
This preview release pairs `shopstack@0.3.
|
|
21
|
+
This preview release pairs `shopstack@0.3.2` with `shopstack-mcp@0.2.2`.
|
|
22
22
|
Both packages use the `preview` distribution tag. The `latest` versions are
|
|
23
23
|
unchanged. Use the exact versions above to install this release.
|
|
24
24
|
|
|
@@ -79,7 +79,7 @@ Configure any stdio MCP client to run:
|
|
|
79
79
|
"mcpServers": {
|
|
80
80
|
"shopstack": {
|
|
81
81
|
"command": "npx",
|
|
82
|
-
"args": ["-y", "shopstack-mcp@0.2.
|
|
82
|
+
"args": ["-y", "shopstack-mcp@0.2.2"],
|
|
83
83
|
"env": {
|
|
84
84
|
"SHOPSTACK_API_URL": "https://shopstack-release-preview.shopstack.workers.dev/v1",
|
|
85
85
|
"SHOPSTACK_CONFIG_FILE": "/absolute/private/path/shopstack-config.json"
|
|
@@ -122,8 +122,12 @@ shopstack connect list
|
|
|
122
122
|
shopstack connect link
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
Link is currently the only persistent payment provider. Connecting it
|
|
126
|
-
optional.
|
|
125
|
+
Link is currently the only persistent payment provider. Connecting it in advance
|
|
126
|
+
is optional. Select `payment_provider: "link"` to prepare the cart first; at card
|
|
127
|
+
issuance Shopstack returns the Link sign-in or approval URL and waits. After Link
|
|
128
|
+
responds, checkout resumes automatically. No “done” message is needed. The CLI
|
|
129
|
+
keeps watching; MCP agents use `wait_checkout_update` with the latest
|
|
130
|
+
`presentation_revision`. Final order approval is still a separate step.
|
|
127
131
|
|
|
128
132
|
## Run a guest reservation
|
|
129
133
|
|
|
@@ -199,7 +203,7 @@ form, then asks for card details through a no-echo terminal prompt. Card data is
|
|
|
199
203
|
sent only to the protected payment-details endpoint. The CLI separately shows
|
|
200
204
|
the exact final amount and asks for approval before Shopstack can submit.
|
|
201
205
|
|
|
202
|
-
To use
|
|
206
|
+
To use Link, with or without a prior connection, add `"payment_provider": "link"` to the
|
|
203
207
|
request.
|
|
204
208
|
|
|
205
209
|
Card values are never accepted as command-line flags.
|
package/package.json
CHANGED
package/specs/openapi.json
CHANGED
|
@@ -2670,7 +2670,7 @@
|
|
|
2670
2670
|
},
|
|
2671
2671
|
"payment_provider": {
|
|
2672
2672
|
"$ref": "#/components/schemas/PaymentProvider",
|
|
2673
|
-
"description": "Optional. Select Link
|
|
2673
|
+
"description": "Optional. Select Link without connecting first. At card issuance the checkout returns a Link login or approval URL in required_input and waits. Omission requests protected one-checkout card input instead. Link approval does not approve final order submission."
|
|
2674
2674
|
},
|
|
2675
2675
|
"external_reference": {
|
|
2676
2676
|
"type": "string",
|
|
@@ -2790,14 +2790,62 @@
|
|
|
2790
2790
|
}
|
|
2791
2791
|
},
|
|
2792
2792
|
"RequiredInput": {
|
|
2793
|
+
"oneOf": [
|
|
2794
|
+
{
|
|
2795
|
+
"type": "object",
|
|
2796
|
+
"additionalProperties": false,
|
|
2797
|
+
"required": [
|
|
2798
|
+
"type"
|
|
2799
|
+
],
|
|
2800
|
+
"properties": {
|
|
2801
|
+
"type": {
|
|
2802
|
+
"const": "payment_card"
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
},
|
|
2806
|
+
{
|
|
2807
|
+
"$ref": "#/components/schemas/LinkRequiredInput"
|
|
2808
|
+
}
|
|
2809
|
+
]
|
|
2810
|
+
},
|
|
2811
|
+
"LinkRequiredInput": {
|
|
2793
2812
|
"type": "object",
|
|
2794
2813
|
"additionalProperties": false,
|
|
2814
|
+
"description": "Owner-private Link login or credential approval. Open the exact URL or approve in Link. This does not approve Shopstack order submission. The checkout resumes automatically after Link responds.",
|
|
2795
2815
|
"required": [
|
|
2796
|
-
"type"
|
|
2816
|
+
"type",
|
|
2817
|
+
"action",
|
|
2818
|
+
"url",
|
|
2819
|
+
"amount_cents",
|
|
2820
|
+
"currency"
|
|
2797
2821
|
],
|
|
2798
2822
|
"properties": {
|
|
2799
2823
|
"type": {
|
|
2800
|
-
"const": "
|
|
2824
|
+
"const": "link"
|
|
2825
|
+
},
|
|
2826
|
+
"action": {
|
|
2827
|
+
"enum": [
|
|
2828
|
+
"connect",
|
|
2829
|
+
"approve"
|
|
2830
|
+
]
|
|
2831
|
+
},
|
|
2832
|
+
"url": {
|
|
2833
|
+
"type": "string",
|
|
2834
|
+
"format": "uri",
|
|
2835
|
+
"maxLength": 2048
|
|
2836
|
+
},
|
|
2837
|
+
"phrase": {
|
|
2838
|
+
"type": "string",
|
|
2839
|
+
"minLength": 1,
|
|
2840
|
+
"maxLength": 100
|
|
2841
|
+
},
|
|
2842
|
+
"amount_cents": {
|
|
2843
|
+
"type": "integer",
|
|
2844
|
+
"minimum": 1,
|
|
2845
|
+
"maximum": 500000
|
|
2846
|
+
},
|
|
2847
|
+
"currency": {
|
|
2848
|
+
"$ref": "#/components/schemas/Currency"
|
|
2801
2849
|
}
|
|
2802
2850
|
}
|
|
2803
2851
|
},
|
package/src/cli.js
CHANGED
|
@@ -649,6 +649,17 @@ export async function runCli(args, supplied = {}) {
|
|
|
649
649
|
`[${checkout.status}]${intent} ${checkout.activity ?? ""}`.trimEnd() +
|
|
650
650
|
"\n",
|
|
651
651
|
);
|
|
652
|
+
if (checkout.required_input?.type === "link") {
|
|
653
|
+
const input = checkout.required_input;
|
|
654
|
+
dependencies.stderr.write(
|
|
655
|
+
`${input.action === "connect" ? "Connect Link" : "Approve in Link"}: ${input.url}\n` +
|
|
656
|
+
`Amount: ${input.currency} ${(input.amount_cents / 100).toFixed(2)}\n` +
|
|
657
|
+
(input.action === "connect" && input.phrase
|
|
658
|
+
? `Code: ${input.phrase}\n`
|
|
659
|
+
: "") +
|
|
660
|
+
"The checkout resumes automatically. Final order approval is separate.\n",
|
|
661
|
+
);
|
|
662
|
+
}
|
|
652
663
|
},
|
|
653
664
|
approve: async (approval) => {
|
|
654
665
|
const summary = [
|
package/src/client.d.ts
CHANGED
|
@@ -138,7 +138,17 @@ export interface Checkout {
|
|
|
138
138
|
item_url: string;
|
|
139
139
|
/** Present this exact owner-only URL verbatim. Never reconstruct its token. */
|
|
140
140
|
live_view_url?: string;
|
|
141
|
-
required_input?:
|
|
141
|
+
required_input?:
|
|
142
|
+
| { type: "payment_card" }
|
|
143
|
+
| {
|
|
144
|
+
type: "link";
|
|
145
|
+
action: "connect" | "approve";
|
|
146
|
+
/** Owner-private Link URL. Present it verbatim; never reconstruct it. */
|
|
147
|
+
url: string;
|
|
148
|
+
phrase?: string;
|
|
149
|
+
amount_cents: number;
|
|
150
|
+
currency: string;
|
|
151
|
+
};
|
|
142
152
|
approval?: PaymentApproval;
|
|
143
153
|
result?: Record<string, unknown>;
|
|
144
154
|
failure?: Record<string, unknown>;
|
package/src/client.js
CHANGED
|
@@ -576,7 +576,7 @@ export class ShopstackClient {
|
|
|
576
576
|
current.intent?.name,
|
|
577
577
|
current.intent?.phase,
|
|
578
578
|
current.intent?.updated_at,
|
|
579
|
-
current.required_input
|
|
579
|
+
current.required_input,
|
|
580
580
|
current.approval?.id,
|
|
581
581
|
]);
|
|
582
582
|
if (fingerprint === progressFingerprint) return;
|
|
@@ -597,6 +597,12 @@ export class ShopstackClient {
|
|
|
597
597
|
}
|
|
598
598
|
checkout = await this.getCheckout(checkout.id);
|
|
599
599
|
await publishProgress(checkout);
|
|
600
|
+
if (
|
|
601
|
+
checkout.required_input?.type === "link" &&
|
|
602
|
+
typeof options.onProgress !== "function"
|
|
603
|
+
) {
|
|
604
|
+
return checkout;
|
|
605
|
+
}
|
|
600
606
|
if (
|
|
601
607
|
checkout.required_input?.type === "payment_card" &&
|
|
602
608
|
handledPaymentRevision !== checkout.revision
|