@agent-cards/sdk 0.23.28 → 0.24.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/PREFLIGHT.md +7 -1
  3. package/README.md +197 -102
  4. package/dist/aci.d.ts +52 -22
  5. package/dist/aci.js +79 -15
  6. package/dist/adyen-merchant-hosted.generated.d.ts +2 -2
  7. package/dist/adyen-merchant-hosted.generated.js +586 -55
  8. package/dist/agent-amount.generated.js +1 -1
  9. package/dist/agentcard.d.ts +4 -5
  10. package/dist/agentcard.js +4 -5
  11. package/dist/amadeus.d.ts +9 -3
  12. package/dist/amadeus.js +33 -4
  13. package/dist/api-module.d.ts +1 -7
  14. package/dist/api-module.js +3 -5
  15. package/dist/{voice-retry.js → api-retry.js} +1 -1
  16. package/dist/api-types.d.ts +53 -0
  17. package/dist/{voice-types.js → api-types.js} +7 -2
  18. package/dist/approvals.d.ts +166 -0
  19. package/dist/approvals.js +213 -0
  20. package/dist/aurus.d.ts +33 -0
  21. package/dist/aurus.js +75 -0
  22. package/dist/builtin-registry.generated.js +1 -1
  23. package/dist/buy.d.ts +20 -101
  24. package/dist/buy.js +19 -74
  25. package/dist/capabilities.generated.js +1 -1
  26. package/dist/card-fields.generated.js +2864 -249
  27. package/dist/cardlink-vpos.d.ts +43 -0
  28. package/dist/cardlink-vpos.js +90 -0
  29. package/dist/cdp.d.ts +3 -13
  30. package/dist/cdp.js +244 -175
  31. package/dist/checkout-com.generated.js +5 -1
  32. package/dist/client.d.ts +170 -22
  33. package/dist/client.js +281 -40
  34. package/dist/creditguard.generated.d.ts +4 -4
  35. package/dist/cybersource-flex.generated.d.ts +39 -1
  36. package/dist/cybersource-flex.generated.js +100 -11
  37. package/dist/datatrans.generated.js +22 -1
  38. package/dist/eghl.d.ts +40 -0
  39. package/dist/eghl.js +72 -0
  40. package/dist/elavon-converge.generated.js +5 -3
  41. package/dist/gmo.generated.js +7 -2
  42. package/dist/hold.d.ts +8 -0
  43. package/dist/hold.js +43 -2
  44. package/dist/hosted-entry.js +4 -0
  45. package/dist/index.d.ts +9 -15
  46. package/dist/index.js +6 -10
  47. package/dist/lifecycle.d.ts +9 -61
  48. package/dist/lifecycle.js +24 -10
  49. package/dist/merchant-card-endpoints.generated.d.ts +6 -1
  50. package/dist/merchant-card-endpoints.generated.js +344 -19
  51. package/dist/merchant-hosted.d.ts +8 -1
  52. package/dist/nike-order.d.ts +51 -0
  53. package/dist/nike-order.js +81 -0
  54. package/dist/oceanpayment.d.ts +38 -0
  55. package/dist/oceanpayment.js +70 -0
  56. package/dist/paddle-tokenex.generated.js +111 -11
  57. package/dist/payplug.d.ts +41 -0
  58. package/dist/payplug.js +71 -0
  59. package/dist/payrails.generated.js +33 -8
  60. package/dist/pre-claim.d.ts +11 -0
  61. package/dist/pre-claim.js +130 -7
  62. package/dist/preflight-capabilities.generated.d.ts +0 -4
  63. package/dist/preflight-capabilities.generated.js +0 -5
  64. package/dist/preflight-catalog.json +200 -6
  65. package/dist/preflight-playwright.d.ts +2 -2
  66. package/dist/preflight-playwright.js +63 -14
  67. package/dist/preflight-schemas.json +18 -0
  68. package/dist/preflight.generated.d.ts +5 -4
  69. package/dist/preflight.generated.js +63 -3
  70. package/dist/preparation.d.ts +7 -0
  71. package/dist/preparation.js +21 -0
  72. package/dist/prepared-processor.d.ts +18 -5
  73. package/dist/prepared-processor.js +48 -8
  74. package/dist/primer.generated.js +2889 -268
  75. package/dist/processout.generated.d.ts +61 -0
  76. package/dist/processout.generated.js +577 -0
  77. package/dist/requests.js +1 -1
  78. package/dist/shiji-sts.generated.js +111 -11
  79. package/dist/stripe-checkout.generated.js +2761 -319
  80. package/dist/substitutions.generated.js +553 -26
  81. package/dist/tap-payments.generated.js +111 -11
  82. package/dist/twoc2p.generated.js +111 -11
  83. package/dist/url-masks/bluesnap.d.ts +2 -0
  84. package/dist/url-masks/bluesnap.js +15 -0
  85. package/dist/url-masks/oceanpayment.d.ts +2 -0
  86. package/dist/url-masks/oceanpayment.js +13 -0
  87. package/dist/url-masks/payplug.d.ts +2 -0
  88. package/dist/url-masks/payplug.js +13 -0
  89. package/dist/url-masks/vtex_payments.d.ts +2 -0
  90. package/dist/url-masks/vtex_payments.js +12 -0
  91. package/dist/url-masks.generated.d.ts +1 -1
  92. package/dist/url-masks.generated.js +6 -2
  93. package/dist/verifone.generated.js +42 -2
  94. package/dist/vtex-payments.generated.d.ts +127 -0
  95. package/dist/vtex-payments.generated.js +544 -0
  96. package/dist/webhooks.d.ts +2 -2
  97. package/dist/webhooks.js +2 -2
  98. package/examples/preflight/kernel-native/inventory.json +1 -1
  99. package/package.json +6 -8
  100. package/dist/languages.d.ts +0 -23
  101. package/dist/languages.js +0 -76
  102. package/dist/voice-pkce.d.ts +0 -49
  103. package/dist/voice-pkce.js +0 -147
  104. package/dist/voice-stream.generated.d.ts +0 -118
  105. package/dist/voice-stream.generated.js +0 -170
  106. package/dist/voice-types.d.ts +0 -735
  107. package/dist/voice.d.ts +0 -373
  108. package/dist/voice.js +0 -815
  109. package/readme.test.mjs +0 -53
  110. /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Cardlink's VPOS (the redirect payment page Greek banks give their merchants: Eurobank's paycenter on
3
+ * vpos.eurocommerce.gr, Cardlink's own on ecommerce.cardlink.gr, Nexi Greece's on www.alphaecommerce.gr), as this SDK
4
+ * reads it.
5
+ *
6
+ * The merchant's order page posts a signed entry form, top-level, to https://<host>/vpos/shophandlermpi, and the VPOS
7
+ * answers with its card page, whose form posts the card back to that same URL. The entry carries no card, and it is the
8
+ * one request this SDK pauses: the cardholder's device repeats it over the end-to-end TLS relay and fills the card into
9
+ * the page the VPOS returns to it (payment-core processors/cardlink_vpos.js). Every other POST the agent's browser makes
10
+ * to these hosts carries a card the agent typed or leads to a page that asks for one: the card page's own post and its
11
+ * card check, which share the entry's URL and carry the page's own fields, and anything posted to Cardlink's test
12
+ * hosts. This SDK aborts every one of them, so a placeholder card never reaches the VPOS.
13
+ *
14
+ * CARDLINK_VPOS_ENTRY_HOSTS is payment-core's CARDLINK_VPOS_HOSTS, and isCardlinkVposEntryUrl is payment-core's
15
+ * isCardlinkVposEntryUrl; cardlink-vpos.test.mjs pins both to payment-core.
16
+ */
17
+ export declare const CARDLINK_VPOS_PSP = "cardlink_vpos";
18
+ export declare const CARDLINK_VPOS_ENTRY_HOSTS: readonly string[];
19
+ export declare const CARDLINK_VPOS_TEST_HOSTS: readonly string[];
20
+ /**
21
+ * Whether a URL is an entry exactly as a merchant's form action writes it: https, one of the three live hosts in lower
22
+ * case, the default port, no credentials, the path /vpos/shophandlermpi, and no query or fragment, not even an empty one.
23
+ */
24
+ export declare function isCardlinkVposEntryUrl(raw: unknown): boolean;
25
+ /** Whether a URL is on one of the VPOS's hosts, live or test: https, no credentials, any port, any case, a trailing dot or not. */
26
+ export declare function isCardlinkVposHost(raw: string): boolean;
27
+ /**
28
+ * Whether a body reads as a merchant's entry and never as the card page's post: a form whose every pair decodes, that
29
+ * names a mid and a digest, and that carries none of the card page's fields or a card field. payment-core's entry rules
30
+ * judge the rest at create.
31
+ */
32
+ export declare function isCardlinkVposEntryBody(body: string | null | undefined): boolean;
33
+ /** The one request on the VPOS's hosts this SDK pauses: a POST of an entry body to an entry URL. */
34
+ export declare function isCardlinkVposEntry(url: string, method: string, body: string | null | undefined): boolean;
35
+ /**
36
+ * Whether an adapter must hand this request to the pre-claim gates: it is on one of the VPOS's hosts and this build's
37
+ * registry serves the entry. The card page's posts share the entry's URL, so the CDP adapter pauses them through the
38
+ * recognizer's host patterns, and attachToPlaywright's route predicate asks this, so both adapters show the gates every
39
+ * request to a VPOS host once the lane is armed.
40
+ */
41
+ export declare function isArmedCardlinkVposUrl(vault: {
42
+ isCardRequest(url: string, method?: string): boolean;
43
+ } | undefined, url: string): boolean;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Cardlink's VPOS (the redirect payment page Greek banks give their merchants: Eurobank's paycenter on
3
+ * vpos.eurocommerce.gr, Cardlink's own on ecommerce.cardlink.gr, Nexi Greece's on www.alphaecommerce.gr), as this SDK
4
+ * reads it.
5
+ *
6
+ * The merchant's order page posts a signed entry form, top-level, to https://<host>/vpos/shophandlermpi, and the VPOS
7
+ * answers with its card page, whose form posts the card back to that same URL. The entry carries no card, and it is the
8
+ * one request this SDK pauses: the cardholder's device repeats it over the end-to-end TLS relay and fills the card into
9
+ * the page the VPOS returns to it (payment-core processors/cardlink_vpos.js). Every other POST the agent's browser makes
10
+ * to these hosts carries a card the agent typed or leads to a page that asks for one: the card page's own post and its
11
+ * card check, which share the entry's URL and carry the page's own fields, and anything posted to Cardlink's test
12
+ * hosts. This SDK aborts every one of them, so a placeholder card never reaches the VPOS.
13
+ *
14
+ * CARDLINK_VPOS_ENTRY_HOSTS is payment-core's CARDLINK_VPOS_HOSTS, and isCardlinkVposEntryUrl is payment-core's
15
+ * isCardlinkVposEntryUrl; cardlink-vpos.test.mjs pins both to payment-core.
16
+ */
17
+ export const CARDLINK_VPOS_PSP = 'cardlink_vpos';
18
+ export const CARDLINK_VPOS_ENTRY_HOSTS = Object.freeze(['vpos.eurocommerce.gr', 'ecommerce.cardlink.gr', 'www.alphaecommerce.gr']);
19
+ export const CARDLINK_VPOS_TEST_HOSTS = Object.freeze(['eurocommerce-test.cardlink.gr', 'ecommerce-test.cardlink.gr',
20
+ 'alphaecommerce-test.cardlink.gr']);
21
+ const ENTRY_PATH = '/vpos/shophandlermpi';
22
+ // An entry URL, for asking whether this build's registry serves the entry.
23
+ const PROBE = 'https://vpos.eurocommerce.gr/vpos/shophandlermpi';
24
+ // A field of the card page's form or of its card check, or any card field: an entry never carries one.
25
+ const PAGE_FIELD = /^(?:card[._]|cvv|cmd$|trid$|st$|paystep$|paymentmethod$|startbonus$|bonusdata$|what$|tds2_)/i;
26
+ /**
27
+ * Whether a URL is an entry exactly as a merchant's form action writes it: https, one of the three live hosts in lower
28
+ * case, the default port, no credentials, the path /vpos/shophandlermpi, and no query or fragment, not even an empty one.
29
+ */
30
+ export function isCardlinkVposEntryUrl(raw) {
31
+ if (typeof raw !== 'string' || raw.length > 256 || raw.includes('?') || raw.includes('#'))
32
+ return false;
33
+ let url;
34
+ try {
35
+ url = new URL(raw);
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ return url.href === raw && url.protocol === 'https:' && !url.port && !url.username && !url.password
41
+ && CARDLINK_VPOS_ENTRY_HOSTS.includes(url.hostname) && url.pathname === ENTRY_PATH;
42
+ }
43
+ /** Whether a URL is on one of the VPOS's hosts, live or test: https, no credentials, any port, any case, a trailing dot or not. */
44
+ export function isCardlinkVposHost(raw) {
45
+ let url;
46
+ try {
47
+ url = new URL(raw);
48
+ }
49
+ catch {
50
+ return false;
51
+ }
52
+ const host = url.hostname.toLowerCase().replace(/\.$/, '');
53
+ return url.protocol === 'https:' && !url.username && !url.password && (CARDLINK_VPOS_ENTRY_HOSTS.includes(host) || CARDLINK_VPOS_TEST_HOSTS.includes(host));
54
+ }
55
+ /**
56
+ * Whether a body reads as a merchant's entry and never as the card page's post: a form whose every pair decodes, that
57
+ * names a mid and a digest, and that carries none of the card page's fields or a card field. payment-core's entry rules
58
+ * judge the rest at create.
59
+ */
60
+ export function isCardlinkVposEntryBody(body) {
61
+ if (typeof body !== 'string' || body === '')
62
+ return false;
63
+ const names = [];
64
+ for (const chunk of body.split('&')) {
65
+ const eq = chunk.indexOf('=');
66
+ if (eq < 1)
67
+ return false;
68
+ try {
69
+ names.push(decodeURIComponent(chunk.slice(0, eq).replace(/\+/g, ' ')));
70
+ decodeURIComponent(chunk.slice(eq + 1).replace(/\+/g, ' '));
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }
76
+ return names.includes('mid') && names.includes('digest') && !names.some((name) => PAGE_FIELD.test(name));
77
+ }
78
+ /** The one request on the VPOS's hosts this SDK pauses: a POST of an entry body to an entry URL. */
79
+ export function isCardlinkVposEntry(url, method, body) {
80
+ return String(method).toUpperCase() === 'POST' && isCardlinkVposEntryUrl(url) && isCardlinkVposEntryBody(body);
81
+ }
82
+ /**
83
+ * Whether an adapter must hand this request to the pre-claim gates: it is on one of the VPOS's hosts and this build's
84
+ * registry serves the entry. The card page's posts share the entry's URL, so the CDP adapter pauses them through the
85
+ * recognizer's host patterns, and attachToPlaywright's route predicate asks this, so both adapters show the gates every
86
+ * request to a VPOS host once the lane is armed.
87
+ */
88
+ export function isArmedCardlinkVposUrl(vault, url) {
89
+ return isCardlinkVposHost(url) && typeof vault?.isCardRequest === 'function' && vault.isCardRequest(PROBE, 'POST');
90
+ }
package/dist/cdp.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type VaultClient, type ExecutionMetadata } from './client.js';
2
2
  import { type StripeCheckoutOptions } from './stripe-checkout.js';
3
3
  import { type HoldOptions } from './hold.js';
4
- import { type CheckoutController, type LifecycleOptions, type PaymentEndpointGuard, type PausedCheckout } from './lifecycle.js';
4
+ import { type CheckoutController, type LifecycleOptions, type PaymentEndpointGuard } from './lifecycle.js';
5
5
  /**
6
6
  * The CORS headers a fulfilled CROSS-ORIGIN request needs, or null when the
7
7
  * request is same-origin (or carries no Origin, so no CORS check applies).
@@ -103,16 +103,6 @@ export interface CdpTargetInfo {
103
103
  browserContextId?: string;
104
104
  }
105
105
  export interface AttachOptions extends LifecycleOptions, ExecutionMetadata {
106
- /**
107
- * Pause only: the card request pauses and is handed to `onPaused` with the page's request,
108
- * and this transport creates no authorization. The business creates it (`voice.authorizations.create`
109
- * with its posture, user and return link, as on its other purchases), reads the result, and calls
110
- * `controller.resume(result)`; the processor's answer then reaches the page exactly as on the default
111
- * path. Default false: the transport creates and polls the authorization itself. Raw CDP only.
112
- */
113
- pauseOnly?: boolean;
114
- /** With `pauseOnly`: the paused request and the controller to resume it on. Required when `pauseOnly` is set. */
115
- onPaused?: (paused: PausedCheckout) => void | Promise<void>;
116
106
  /**
117
107
  * Hold mode (CARD-REQUEST-HOLD.md): the first card request pauses and is HELD with nothing created, and
118
108
  * `controller.hold` (CardRequestHold) answers it. `controller.release({ amount, currency, pageTotal })` creates the
@@ -121,8 +111,8 @@ export interface AttachOptions extends LifecycleOptions, ExecutionMetadata {
121
111
  * fails it. A request held past its processor's own wait is cancelled first. One request is held at a time; every
122
112
  * other card request, and every one after a decision, fails at once. Besides the registry's processors, a hold
123
113
  * catches Bolt's sealed tokenizer and, with `placeholderNumbers`, any request carrying the placeholder card (both
124
- * cancel-only, except a sandbox placeholder post released with `continuePlaceholder`). Raw CDP only; not with
125
- * `pauseOnly`. Service workers are bypassed in this mode unless `serviceWorkers: 'refuse'`.
114
+ * cancel-only, except a sandbox placeholder post released with `continuePlaceholder`). Raw CDP only.
115
+ * Service workers are bypassed in this mode unless `serviceWorkers: 'refuse'`.
126
116
  */
127
117
  hold?: boolean | HoldOptions;
128
118
  /**