@agent-cards/sdk 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/PREFLIGHT.md +314 -0
  3. package/README.md +864 -0
  4. package/dist/adyen-merchant-hosted.generated.d.ts +277 -0
  5. package/dist/adyen-merchant-hosted.generated.js +1902 -0
  6. package/dist/adyen.generated.d.ts +24 -0
  7. package/dist/adyen.generated.js +64 -0
  8. package/dist/agentcard.d.ts +72 -0
  9. package/dist/agentcard.js +71 -0
  10. package/dist/api-module.d.ts +54 -0
  11. package/dist/api-module.js +85 -0
  12. package/dist/attachment.d.ts +11 -0
  13. package/dist/attachment.js +50 -0
  14. package/dist/braintree.d.ts +2 -0
  15. package/dist/braintree.generated.d.ts +10 -0
  16. package/dist/braintree.generated.js +302 -0
  17. package/dist/braintree.js +2 -0
  18. package/dist/builtin-registry.generated.d.ts +2 -0
  19. package/dist/builtin-registry.generated.js +1 -0
  20. package/dist/buy.d.ts +374 -0
  21. package/dist/buy.js +314 -0
  22. package/dist/card-fields.generated.d.ts +3 -0
  23. package/dist/card-fields.generated.js +88 -0
  24. package/dist/cdp.d.ts +202 -0
  25. package/dist/cdp.js +2540 -0
  26. package/dist/checkout-com.generated.d.ts +4 -0
  27. package/dist/checkout-com.generated.js +183 -0
  28. package/dist/client.d.ts +929 -0
  29. package/dist/client.js +1896 -0
  30. package/dist/cse-body.d.ts +25 -0
  31. package/dist/cse-body.js +41 -0
  32. package/dist/fiserv.d.ts +65 -0
  33. package/dist/fiserv.generated.d.ts +73 -0
  34. package/dist/fiserv.generated.js +830 -0
  35. package/dist/fiserv.js +104 -0
  36. package/dist/hosted-form.d.ts +44 -0
  37. package/dist/hosted-form.js +78 -0
  38. package/dist/index.d.ts +37 -0
  39. package/dist/index.js +26 -0
  40. package/dist/languages.d.ts +23 -0
  41. package/dist/languages.js +76 -0
  42. package/dist/lifecycle.d.ts +235 -0
  43. package/dist/lifecycle.js +405 -0
  44. package/dist/mercado-checkout.d.ts +20 -0
  45. package/dist/mercado-checkout.generated.d.ts +52 -0
  46. package/dist/mercado-checkout.generated.js +198 -0
  47. package/dist/mercado-checkout.js +108 -0
  48. package/dist/merchant-handoff.d.ts +54 -0
  49. package/dist/merchant-handoff.js +100 -0
  50. package/dist/merchant-hosted.d.ts +140 -0
  51. package/dist/merchant-hosted.js +170 -0
  52. package/dist/merchant-total-watch.d.ts +115 -0
  53. package/dist/merchant-total-watch.js +268 -0
  54. package/dist/merchant-total.d.ts +257 -0
  55. package/dist/merchant-total.js +383 -0
  56. package/dist/owned-shop.generated.d.ts +24 -0
  57. package/dist/owned-shop.generated.js +108 -0
  58. package/dist/paysafe.generated.d.ts +12 -0
  59. package/dist/paysafe.generated.js +87 -0
  60. package/dist/playwright.d.ts +3 -0
  61. package/dist/playwright.js +3 -0
  62. package/dist/pre-claim.d.ts +123 -0
  63. package/dist/pre-claim.js +386 -0
  64. package/dist/preflight-capabilities.generated.d.ts +1311 -0
  65. package/dist/preflight-capabilities.generated.js +2007 -0
  66. package/dist/preflight-catalog.json +5031 -0
  67. package/dist/preflight-playwright.d.ts +34 -0
  68. package/dist/preflight-playwright.js +355 -0
  69. package/dist/preflight-schemas.json +1144 -0
  70. package/dist/preflight.d.ts +1 -0
  71. package/dist/preflight.generated.d.ts +2023 -0
  72. package/dist/preflight.generated.js +604 -0
  73. package/dist/preflight.js +2 -0
  74. package/dist/preparation.d.ts +38 -0
  75. package/dist/preparation.js +191 -0
  76. package/dist/prepared-processor.d.ts +43 -0
  77. package/dist/prepared-processor.js +172 -0
  78. package/dist/recurly.generated.d.ts +1 -0
  79. package/dist/recurly.generated.js +87 -0
  80. package/dist/registry.d.ts +145 -0
  81. package/dist/registry.js +338 -0
  82. package/dist/requests.d.ts +66 -0
  83. package/dist/requests.js +76 -0
  84. package/dist/spreedly.generated.d.ts +10 -0
  85. package/dist/spreedly.generated.js +332 -0
  86. package/dist/stripe-checkout.d.ts +81 -0
  87. package/dist/stripe-checkout.generated.d.ts +82 -0
  88. package/dist/stripe-checkout.generated.js +1153 -0
  89. package/dist/stripe-checkout.js +140 -0
  90. package/dist/substitute.d.ts +38 -0
  91. package/dist/substitute.js +23 -0
  92. package/dist/substitutions.generated.d.ts +11 -0
  93. package/dist/substitutions.generated.js +818 -0
  94. package/dist/voice-pkce.d.ts +49 -0
  95. package/dist/voice-pkce.js +147 -0
  96. package/dist/voice-retry.d.ts +6 -0
  97. package/dist/voice-retry.js +27 -0
  98. package/dist/voice-stream.generated.d.ts +118 -0
  99. package/dist/voice-stream.generated.js +170 -0
  100. package/dist/voice-types.d.ts +708 -0
  101. package/dist/voice-types.js +16 -0
  102. package/dist/voice.d.ts +365 -0
  103. package/dist/voice.js +807 -0
  104. package/dist/webhooks.d.ts +87 -0
  105. package/dist/webhooks.js +136 -0
  106. package/examples/existing-browser.mjs +62 -0
  107. package/examples/preflight/classify-direct.mjs +21 -0
  108. package/examples/preflight/classify-kernel.mjs +30 -0
  109. package/examples/preflight/inspect-browser.mjs +44 -0
  110. package/examples/preflight/kernel-native/README.md +112 -0
  111. package/examples/preflight/kernel-native/documented-adapters.json +113 -0
  112. package/examples/preflight/kernel-native/inventory.json +242 -0
  113. package/examples/preflight/kernel-native/qualification.mjs +182 -0
  114. package/examples/preflight/kernel-profile.empty.json +11 -0
  115. package/examples/preflight/mollie-hosted.observations.json +23 -0
  116. package/examples/preflight/mollie-hosted.result.json +103 -0
  117. package/examples/preflight/stripe-script.direct.result.json +92 -0
  118. package/examples/preflight/stripe-script.observations.json +16 -0
  119. package/examples/preflight/stripe-script.result.json +87 -0
  120. package/package.json +53 -0
  121. package/readme.test.mjs +53 -0
package/dist/buy.d.ts ADDED
@@ -0,0 +1,374 @@
1
+ /**
2
+ * The buy module of the SDK: `agentcard.buy.*`. The Purchase API from the
3
+ * same client the voice module uses: one pair of client credentials, one
4
+ * token. A business asks for a cart on behalf of a person it connected,
5
+ * confirms the cart by its hash, and, when it already holds an approval the
6
+ * person gave by voice, names that approval on the confirm so the API places
7
+ * against it and asks the person for nothing a second time (decision 234).
8
+ * With `approval: 'voice'` the confirm asks the API to mint the purchase's
9
+ * own approval instead of an approval page, the business runs the key word
10
+ * in its app on that id, and the same confirm placed again completes the
11
+ * order (decision 237).
12
+ *
13
+ * Every call names `user_id`, the person the connect exchange returned, so a
14
+ * server serving many people never buys for the wrong one. A person who is
15
+ * not connected to this client is refused with `user_not_connected`.
16
+ */
17
+ import { ApiModule, type ApiTransport } from './api-module.js';
18
+ import { AgentcardError } from './voice-types.js';
19
+ /** Where a turn stands. `needs_input` is the common case: a question, or a cart waiting for its confirm; `needs_approval` is a confirm under `approval: 'voice'` waiting for the person's verdict on `authorization_id`. */
20
+ export type BuyStatus = 'needs_input' | 'needs_approval' | 'order_placed' | 'partially_placed' | 'declined';
21
+ /** How a confirm that pays with the person's own card asks them: `page`, Agentcard's approval page on `approval_url` (the default); `voice`, the key word inside your app on the purchase's own `authorization_id`. */
22
+ export type BuyApproval = 'voice' | 'page';
23
+ /** The two ways a purchase approved by voice ends without an order: the person declined it, or the approval ran out before a confirm placed against it. */
24
+ export type BuyVoiceDeclineCode = 'voice_declined' | 'approval_expired';
25
+ /** The one refusal a store makes under `approval: 'voice'`: its connector cannot place under a voice verdict, and the business takes its own path. A 409, as `BuyError.code`. */
26
+ export declare const VOICE_EXECUTION_UNSUPPORTED = "voice_execution_unsupported";
27
+ /** One line of a cart as the API shows it; `product_id` is the merchant's id for the line, null on a cart recorded before it was kept. */
28
+ export interface BuyCartLine {
29
+ name: string;
30
+ qty: number;
31
+ priceCents?: number;
32
+ product_id: string | null;
33
+ }
34
+ /**
35
+ * A cart on the table, as the API answers it. `hash` is what a confirm echoes;
36
+ * `totalCents` is the all-in figure the person saw (the merchant's total, the
37
+ * service fees and the tip); `approvedCeilingCents` is the most a confirm may
38
+ * authorize when the merchant finalizes tax and shipping at placement, null
39
+ * when the ceiling is the total. The hash covers every field here except `store`, which the API
40
+ * derives from the lines when it answers and which is a label, not confirmation-bound information.
41
+ */
42
+ /** A store a cart or a search result is at: the retailer's id (`amazon`) and its name (`Amazon`) when known. */
43
+ export interface BuyStore {
44
+ id: string;
45
+ name?: string;
46
+ }
47
+ export interface BuyCart {
48
+ merchant: string;
49
+ merchant_name: string;
50
+ /** The store the cart is at, when one is known: for `retail`, the retailer every line is at. Null otherwise. */
51
+ store: BuyStore | null;
52
+ items: BuyCartLine[];
53
+ serviceFeesCents: number;
54
+ tipCents: number;
55
+ totalCents: number;
56
+ approvedCeilingCents: number | null;
57
+ hash: string;
58
+ }
59
+ /** A delivery address the business already holds for the person; the API binds these values and asks the person for none of them. */
60
+ export interface BuyDeliveryAddress {
61
+ street: string;
62
+ city: string;
63
+ state: string;
64
+ zip: string;
65
+ address2?: string;
66
+ phone?: string;
67
+ name?: string;
68
+ country?: string;
69
+ can_leave_at_door?: boolean;
70
+ }
71
+ /** What paid, or would have paid. */
72
+ export interface BuyPaymentSource {
73
+ source: string;
74
+ brand: string | null;
75
+ last4: string | null;
76
+ }
77
+ /**
78
+ * The typed outcome of a checkout attempt, every field null when no checkout
79
+ * ran on the call. `decline_code` is a refusal's machine code
80
+ * (`authorization_not_approved`, `authorization_mismatch`,
81
+ * `authorization_spent`, `user_not_connected`, `voice_declined`,
82
+ * `approval_expired`, a gate's or a merchant's code); `approval_url` is
83
+ * where the person approves when the confirm paused for one;
84
+ * `authorization_id` is the approval the order was placed against, or, on a
85
+ * `needs_approval` turn, the one the person is about to give by voice.
86
+ */
87
+ export interface BuyOutcome {
88
+ order_id: string | null;
89
+ payment_source: BuyPaymentSource | null;
90
+ decline_code: string | null;
91
+ refusal_code: string | null;
92
+ approval_url: string | null;
93
+ charge_status: string | null;
94
+ merchant_total_cents: number | null;
95
+ merchant_currency: string | null;
96
+ authorization_id: string | null;
97
+ }
98
+ /** One cart's outcome on a confirm of several carts; each order is its own turn, so some may place and others not. */
99
+ export interface BuyPlacement extends BuyOutcome {
100
+ merchant: string;
101
+ merchant_name: string;
102
+ status: BuyStatus;
103
+ reply: string;
104
+ error_code: string | null;
105
+ }
106
+ /** The last product search as data, for a picker of your own. */
107
+ export interface BuyCatalog {
108
+ merchant: string;
109
+ merchant_name: string;
110
+ /** The store searched, or the one store every result is at. Null when the results span stores; each item then names its own. */
111
+ store: (BuyStore & {
112
+ eta_minutes?: number | null;
113
+ }) | null;
114
+ /** `store`: the retailer this result is at, on a `retail` search across stores. */
115
+ items: Array<{
116
+ id: string;
117
+ name?: string;
118
+ priceCents?: number;
119
+ image_url?: string;
120
+ store?: BuyStore;
121
+ }>;
122
+ as_of: string;
123
+ }
124
+ /** An ask that reached no cart, with the reason the API derived. */
125
+ export interface BuyUnmatched {
126
+ merchant: string;
127
+ requested: string;
128
+ reason: 'not_found' | 'unavailable';
129
+ detail: string | null;
130
+ at: string;
131
+ }
132
+ /**
133
+ * One turn's answer. Branch on `status`; read `cart.hash` for the confirm
134
+ * that follows; never parse `reply`. `error_code: 'turn_timeout'` means the
135
+ * turn is still running: the carts here are what it had shown so far, and
136
+ * `buy.conversation` reads when it is done. A `declined` turn carries its
137
+ * `decline_code`; a `partially_placed` one names each cart's outcome in
138
+ * `placements`.
139
+ */
140
+ export interface BuyTurn extends BuyOutcome {
141
+ conversation_id: string;
142
+ status: BuyStatus;
143
+ reply: string;
144
+ messages: string[];
145
+ message_id: string | null;
146
+ cart: BuyCart | null;
147
+ carts: BuyCart[];
148
+ placements: BuyPlacement[] | null;
149
+ catalog: BuyCatalog | null;
150
+ error_code: string | null;
151
+ unmatched: BuyUnmatched[];
152
+ }
153
+ /** A turn the API declined: `status: 'declined'` with the code that says why. `isBuyDeclined` narrows to it. */
154
+ export type BuyDeclined = BuyTurn & {
155
+ status: 'declined';
156
+ };
157
+ /** True for a turn the API declined; `decline_code` says why (it is null when the loop refused in prose only). */
158
+ export declare function isBuyDeclined(turn: BuyTurn | BuyVoiceUnsupported): turn is BuyDeclined;
159
+ /** A confirm under `approval: 'voice'` waiting for the person: `authorization_id` is the purchase's own approval, minted by the API, for `voice.challengeForHost`. `isBuyNeedsApproval` narrows to it. */
160
+ export type BuyNeedsApproval = BuyTurn & {
161
+ status: 'needs_approval';
162
+ authorization_id: string;
163
+ };
164
+ /** True for a confirm waiting for the person's verdict by voice; `authorization_id` is the id your app runs the key word on. */
165
+ export declare function isBuyNeedsApproval(turn: BuyTurn | BuyVoiceUnsupported): turn is BuyNeedsApproval;
166
+ /**
167
+ * The store's refusal to place under a voice verdict, as `buy.approveByVoice`
168
+ * returns it instead of throwing: `status: 'voice_execution_unsupported'`,
169
+ * the conversation, the approval the API had minted when it had, and the
170
+ * `BuyError` as the confirm raised it. The business takes its own path.
171
+ */
172
+ export interface BuyVoiceUnsupported {
173
+ status: typeof VOICE_EXECUTION_UNSUPPORTED;
174
+ conversation_id: string;
175
+ authorization_id: string | null;
176
+ error: BuyError;
177
+ }
178
+ /** True when the store could not place under a voice verdict; `error` is the refusal. */
179
+ export declare function isBuyVoiceUnsupported(turn: BuyTurn | BuyVoiceUnsupported): turn is BuyVoiceUnsupported;
180
+ /** What `buy.approveByVoice` returns: the final turn (`order_placed`, `declined`, or `needs_approval` when the verdict was still out on the retry), or the store's refusal to run under a voice verdict. */
181
+ export type BuyVoiceTurn = BuyTurn | BuyVoiceUnsupported;
182
+ /** An order a conversation placed, from the ledger. */
183
+ export interface BuyOrder {
184
+ order_id: string | null;
185
+ merchant: string;
186
+ merchant_name: string;
187
+ status: 'settled' | 'confirming' | 'failed' | 'cancelled';
188
+ total_cents: number;
189
+ payment_source: BuyPaymentSource | null;
190
+ placed_at: string | null;
191
+ retailer_order_id: string | null;
192
+ delivery_window: string | null;
193
+ confirmed_at: string | null;
194
+ merchant_total_cents: number | null;
195
+ merchant_currency: string | null;
196
+ }
197
+ /** The most recent checkout attempt on a conversation, whatever its outcome. */
198
+ export interface BuyLastCheckout extends BuyOutcome {
199
+ at: string;
200
+ merchant: string;
201
+ merchant_name: string;
202
+ status: string;
203
+ code: string | null;
204
+ message: string | null;
205
+ total_cents: number;
206
+ items: unknown;
207
+ }
208
+ /**
209
+ * The API's view of one conversation, for a caller whose confirm timed out or
210
+ * whose webhook never came: is a turn still running, what the last checkout
211
+ * did, and every order the conversation placed, from the ledger.
212
+ */
213
+ export interface BuyConversation {
214
+ conversation_id: string;
215
+ status: 'open' | 'closed';
216
+ turn_in_progress: boolean;
217
+ last_checkout: BuyLastCheckout | null;
218
+ orders: BuyOrder[];
219
+ carts: BuyCart[];
220
+ unmatched: BuyUnmatched[];
221
+ created_at: string;
222
+ updated_at: string;
223
+ }
224
+ /** `buy.ask`: a question or an order in words, for the person `user_id` names. */
225
+ export interface BuyAskInput {
226
+ /** The person the connect exchange returned. Required on every call. */
227
+ user_id: string;
228
+ /** What the person wants, in words. */
229
+ ask: string;
230
+ /** The conversation to continue; leave it out to start one. */
231
+ conversation_id?: string;
232
+ /** The person's delivery address as you hold it; the cart is built for it and the person is asked for nothing. */
233
+ delivery_address?: BuyDeliveryAddress;
234
+ /** How long this call waits for the turn. Default 130 seconds, past the API's own soft budget, so a slow turn answers `turn_timeout` rather than a client-side abort. */
235
+ timeout_ms?: number;
236
+ }
237
+ /** `buy.confirm`: the cart, by its hash, and the approval the business already holds for it. */
238
+ export interface BuyConfirmInput {
239
+ /** The person the connect exchange returned. Required on every call. */
240
+ user_id: string;
241
+ /** The conversation the cart was shown in. */
242
+ conversation_id: string;
243
+ /** The hash of the cart the person saw (`turn.cart.hash`), or several carts' hashes to place each as its own order. */
244
+ confirm: string | string[];
245
+ /**
246
+ * An approval the business already holds for this purchase, `cauth_…`, as
247
+ * `voice.authorizations.create` minted it and `voice.awaitResult` read it
248
+ * approved. The API places the cart against it and asks the person for
249
+ * nothing a second time. Sent only when named.
250
+ */
251
+ authorization_id?: string;
252
+ /** The delivery address the cart was built for, when the ask named one. */
253
+ delivery_address?: BuyDeliveryAddress;
254
+ /** `'vault'`: pay with the person's own stored card; the confirm pauses with an `approval_url` until they approve. */
255
+ payment_source?: 'vault';
256
+ /**
257
+ * How the person approves a confirm that pays with their own card. `page`
258
+ * (the default, and today's behaviour): the API answers `declined` with the
259
+ * `approval_url` they approve on. `voice`: the API mints the purchase's
260
+ * own approval and answers `needs_approval` with its `authorization_id`;
261
+ * your app runs the key word on it (`voice.challengeForHost(id)`), and the
262
+ * same confirm sent again places the order, or answers `declined` with
263
+ * `voice_declined` or `approval_expired`. Sent only when named.
264
+ */
265
+ approval?: BuyApproval;
266
+ /** How long this call waits for the turn. Default 130 seconds. */
267
+ timeout_ms?: number;
268
+ }
269
+ /** `buy.approveByVoice`: the cart, the person, and the approval your app runs on the id the API mints. */
270
+ export interface BuyApproveByVoiceInput {
271
+ /** The person the connect exchange returned. Required on every call. */
272
+ user_id: string;
273
+ /** The conversation the cart was shown in. */
274
+ conversation_id: string;
275
+ /** The hash of the cart the person saw (`turn.cart.hash`), or several carts' hashes. */
276
+ confirm: string | string[];
277
+ /** The delivery address the cart was built for, when the ask named one. */
278
+ delivery_address?: BuyDeliveryAddress;
279
+ /**
280
+ * Your app's approval: given the `authorization_id` the API minted (and the
281
+ * `needs_approval` turn it rode on), mint the key word with
282
+ * `voice.challengeForHost(authorizationId)`, hand the bundle to the app,
283
+ * and resolve once the verdict is in (`voice.awaitResult`, or the app's
284
+ * own word). The confirm is sent again when this resolves; a rejection is
285
+ * thrown as it came and nothing is placed.
286
+ */
287
+ challenge: (authorizationId: string, turn: BuyNeedsApproval) => Promise<void>;
288
+ /** How long each confirm waits for its turn. Default 130 seconds. */
289
+ timeout_ms?: number;
290
+ }
291
+ /** `buy.conversation`: one read of where a conversation stands. */
292
+ export interface BuyConversationInput {
293
+ /** The person the connect exchange returned. Required on every call. */
294
+ user_id: string;
295
+ conversation_id: string;
296
+ }
297
+ /**
298
+ * A refusal from the Purchase API, as an `AgentcardError` whose `code` is the
299
+ * API's (`user_not_connected`, `authorization_not_approved`,
300
+ * `authorization_mismatch`, `authorization_spent`, `turn_in_progress`,
301
+ * `delivery_address_changed`, `cart_changed`, `nothing_to_confirm`,
302
+ * `conversation_not_found`, `conversation_closed`,
303
+ * `voice_execution_unsupported`) or the client's own before any call
304
+ * (`not_connected`, `invalid_ask`, `invalid_cart_hash`,
305
+ * `invalid_authorization_id`, `invalid_payment_source`, `invalid_approval`,
306
+ * `missing_conversation_id`, `missing_authorization_id`). `carts` carries the
307
+ * carts as they stand when the refusal named them, so a confirm of a changed
308
+ * cart reads the fresh hash from the error.
309
+ */
310
+ export declare class BuyError extends AgentcardError {
311
+ /** The same code, under the name the turn envelope uses. */
312
+ readonly error_code: string;
313
+ readonly conversation_id: string | null;
314
+ readonly cart: BuyCart | null;
315
+ readonly carts: BuyCart[];
316
+ constructor(code: string, message: string, status?: number, details?: Record<string, unknown>);
317
+ /** The refusal's code when it is one of a checkout's decline codes; the same string as `code`. */
318
+ get decline_code(): string;
319
+ }
320
+ /** The wait for one turn: past the API's soft budget (110 s), so a slow turn answers `turn_timeout` with its carts rather than aborting here. */
321
+ export declare const BUY_TURN_TIMEOUT_MS = 130000;
322
+ /** A turn as the API answers it, every field read for its type; a field an older API does not carry reads as null or empty. */
323
+ export declare function turnOf(body: Record<string, unknown>): BuyTurn;
324
+ /** `agentcard.buy`: constructed by the client, never on its own. */
325
+ export declare class BuyModule extends ApiModule {
326
+ constructor(t: ApiTransport);
327
+ /**
328
+ * One turn: the person's words go in, a question or a cart comes back.
329
+ * `status: 'needs_input'` is the normal answer, not a failure: read
330
+ * `turn.cart` and confirm its hash. The turn is sent once, with no retry,
331
+ * so a lost answer never runs the turn twice; `buy.conversation` reads
332
+ * what became of it.
333
+ */
334
+ ask(input: BuyAskInput): Promise<BuyTurn>;
335
+ /**
336
+ * Places the cart the person saw, by its hash, for the person `user_id`
337
+ * names. With `authorization_id`, the approval the person already gave by
338
+ * voice for this purchase, the API places against that approval and asks
339
+ * for nothing a second time; the answer carries `authorization_id` back.
340
+ * Without it the confirm runs as before: the person's rules, or the
341
+ * approval the API asks for on `approval_url`. A cart that changed since
342
+ * its hash was issued is `cart_changed` with the fresh carts on the error;
343
+ * an approval that is not approved, is for another purchase, or already
344
+ * paid one is `authorization_not_approved`, `authorization_mismatch` or
345
+ * `authorization_spent`, and nothing is charged.
346
+ */
347
+ confirm(input: BuyConfirmInput): Promise<BuyTurn>;
348
+ /**
349
+ * The whole approval by voice, for a business whose app holds the person:
350
+ * confirms the cart with the person's own card and `approval: 'voice'`,
351
+ * hands the `authorization_id` the API minted to your `challenge` (your
352
+ * app runs the key word on it; you resolve when the verdict is in), then
353
+ * sends the same confirm again and returns what it answered:
354
+ * `order_placed` with `order_id`, `declined` with `voice_declined` or
355
+ * `approval_expired`, or `needs_approval` again when the verdict was still
356
+ * out. A store whose connector cannot place under a voice verdict is
357
+ * returned as `status: 'voice_execution_unsupported'`, not thrown, so the
358
+ * business falls back to its own path; every other refusal throws as
359
+ * `buy.confirm` does. A first confirm the API completes without asking (a
360
+ * rule took it, or it declined outright) is returned as it came and
361
+ * `challenge` is never called. Two confirms at most; nothing is polled.
362
+ */
363
+ approveByVoice(input: BuyApproveByVoiceInput): Promise<BuyVoiceTurn>;
364
+ /**
365
+ * One read of a conversation, with no wait: whether a turn is still
366
+ * running, the last checkout attempt, every order it placed from the
367
+ * ledger, and the carts still on the table. The way an ambiguous confirm
368
+ * resolves: a `turn_timeout` answer, a lost connection, a webhook that
369
+ * never came. `slow_down` is waited out.
370
+ */
371
+ conversation(input: BuyConversationInput): Promise<BuyConversation>;
372
+ /** One POST /buy, sent once: a turn is a model run against live merchants, and a retry after a lost answer would run it again. */
373
+ private turn;
374
+ }