@agent-cards/sdk 0.24.0 → 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 (40) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +61 -4
  3. package/dist/adyen-merchant-hosted.generated.d.ts +1 -1
  4. package/dist/adyen-merchant-hosted.generated.js +128 -35
  5. package/dist/agent-amount.generated.js +1 -1
  6. package/dist/aurus.d.ts +33 -0
  7. package/dist/aurus.js +75 -0
  8. package/dist/builtin-registry.generated.js +1 -1
  9. package/dist/capabilities.generated.js +1 -1
  10. package/dist/card-fields.generated.js +1756 -433
  11. package/dist/cardlink-vpos.d.ts +43 -0
  12. package/dist/cardlink-vpos.js +90 -0
  13. package/dist/cdp.js +13 -0
  14. package/dist/checkout-com.generated.js +5 -1
  15. package/dist/client.d.ts +66 -0
  16. package/dist/client.js +66 -0
  17. package/dist/cybersource-flex.generated.d.ts +39 -1
  18. package/dist/cybersource-flex.generated.js +100 -11
  19. package/dist/eghl.d.ts +40 -0
  20. package/dist/eghl.js +72 -0
  21. package/dist/gmo.generated.js +7 -2
  22. package/dist/hosted-entry.js +2 -0
  23. package/dist/paddle-tokenex.generated.js +7 -2
  24. package/dist/payrails.generated.js +7 -2
  25. package/dist/pre-claim.d.ts +2 -0
  26. package/dist/pre-claim.js +46 -2
  27. package/dist/preflight-catalog.json +154 -1
  28. package/dist/preflight-schemas.json +14 -0
  29. package/dist/preflight.generated.d.ts +5 -0
  30. package/dist/preflight.generated.js +40 -3
  31. package/dist/preparation.d.ts +7 -0
  32. package/dist/preparation.js +21 -0
  33. package/dist/primer.generated.js +1778 -455
  34. package/dist/shiji-sts.generated.js +7 -2
  35. package/dist/stripe-checkout.generated.js +1741 -470
  36. package/dist/substitutions.generated.js +94 -1
  37. package/dist/tap-payments.generated.js +7 -2
  38. package/dist/twoc2p.generated.js +7 -2
  39. package/examples/preflight/kernel-native/inventory.json +1 -1
  40. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  // Generated from @agent-cards/payment-core. Do not edit.
2
- // source-sha256: 761b59c7c043a43a8d462a840e204c1677c55c0022f37e6be4a007d025357af8
2
+ // source-sha256: 1ac6ffa819d0bb72040d0a95cac79f780aeae4f5dea22599fbc4c5ec6c6c8687
3
3
  import { CHECKOUT_PREFLIGHT_CAPABILITIES } from './preflight-capabilities.generated.js';
4
4
  /** Advisory page discovery. These rules never admit a payment destination. */
5
5
  export const CHECKOUT_PREFLIGHT_VERSION = '1';
@@ -23,7 +23,13 @@ const RULES = [
23
23
  // A braintree-web build whose version carries -payments-sdk (3.32.0-payments-sdk-dev) is PayPal's
24
24
  // (paypal-hosted-fields-payments-sdk below): its card goes to PayPal, never to Braintree, so neither
25
25
  // Braintree rule takes one.
26
- { id: 'braintree-web-sdk', psp: 'braintree', kinds: ['script'], hostname: /^js\.braintreegateway\.com$/, pathname: /^\/web\/(?![^/]*-payments-sdk)[^/]+\/js\//, origin: 'https://js.braintreegateway.com', path_pattern: '/web/:version/js/*' },
26
+ { id: 'braintree-web-sdk', psp: 'braintree', kinds: ['script'], hostname: /^js\.braintreegateway\.com$/, pathname: /^\/web\/(?![^/]*-payments-sdk)[^/]+\/js\/(?!(?:client|paypal|paypal-checkout|venmo|apple-pay|google-payment|data-collector|local-payment)(?:\.min)?\.js$)/, origin: 'https://js.braintreegateway.com', path_pattern: '/web/:version/js/*' },
27
+ // braintree-web's client and its wallet and fraud components take no card: a page that loads only these runs a
28
+ // PayPal, Venmo, Apple Pay or Google Pay button through Braintree, and its card boxes belong to another processor.
29
+ // AutoZone's checkout loads client, paypal-checkout and data-collector 3.125.0 beside Worldpay eProtect's JS API, whose
30
+ // script reads the card from the page's own fields (2026-10-31).
31
+ { id: 'braintree-web-wallet', psp: 'braintree', kinds: ['script'], hostname: /^js\.braintreegateway\.com$/, pathname: /^\/web\/(?![^/]*-payments-sdk)[^/]+\/js\/(?:client|paypal|paypal-checkout|venmo|apple-pay|google-payment|data-collector|local-payment)(?:\.min)?\.js$/, origin: 'https://js.braintreegateway.com', path_pattern: '/web/:version/js/{client,paypal,paypal-checkout,venmo,apple-pay,google-payment,data-collector,local-payment}[.min].js',
32
+ card_free: 'braintree-web\'s client, wallet and fraud components collect no card; Hosted Fields and Drop-in do.' },
27
33
  { id: 'braintree-hosted-fields', psp: 'braintree', kinds: ['frame', 'iframe'], hostname: /^assets\.braintreegateway\.com$/, pathname: /^\/web\/(?![^/]*-payments-sdk)/, origin: 'https://assets.braintreegateway.com', path_pattern: '/web/*' },
28
34
  { id: 'paysafe-js', psp: 'paysafe', kinds: ['script', 'frame', 'iframe'], hostname: /^hosted\.paysafe\.com$/, pathname: /^\/(?:js|checkout)\//, origin: 'https://hosted.paysafe.com', path_pattern: '/{js,checkout}/*' },
29
35
  { id: 'worldpay-checkout-sdk', psp: 'worldpay', kinds: ['script', 'frame', 'iframe'], hostname: /^access\.worldpay\.com$/, pathname: /^\/access-checkout\//, origin: 'https://access.worldpay.com', path_pattern: '/access-checkout/*' },
@@ -197,6 +203,27 @@ const cybersourceSources = [
197
203
  RULES.push({ id: 'cybersource-flex-microform-script', psp: 'cybersource_flex', kinds: ['script'], hostname: /^flex\.cybersource\.com$/, pathname: /^\/microform\/bundle\/v2(?:\.[0-9]+\.[0-9]+)?\/flex-microform\.min\.js$/, origin: 'https://flex.cybersource.com', path_pattern: '/microform/bundle/v2{,.:minor.:patch}/flex-microform.min.js',
198
204
  sources: cybersourceSources }, { id: 'cybersource-flex-microform-field', psp: 'cybersource_flex', kinds: ['frame', 'iframe', 'document'], hostname: /^flex\.cybersource\.com$/, pathname: /^\/microform\/bundle\/v2\.[0-9]+\.[0-9]+\/iframe\.html$/, origin: 'https://flex.cybersource.com', path_pattern: '/microform/bundle/v:version/iframe.html',
199
205
  sources: cybersourceSources });
206
+ // CyberSource Unified Checkout v1 sends the card to the same Flex v2 tokens URL, sealed by its orchestrator frame
207
+ // under the capture context (cybersource-unified-checkout.js), so its script and frames name cybersource_flex too.
208
+ // Reviewed 2026-10-31 from napaonline.com's checkout (UnifiedCheckout.js v1.8.2), with no card sent.
209
+ const unifiedCheckoutSources = [
210
+ { kind: 'saved_observation', reference: 'napaonline-2026-10-31:unified-checkout-v1.8.2-mce-orc-ga-frames', reviewed_on: '2026-10-31' },
211
+ { kind: 'official_documentation', reference: 'https://developer.cybersource.com/docs/cybs/en-us/unified-checkout/developer/all/rest/unified-checkout/uc-intro.html', reviewed_on: '2026-10-31' },
212
+ ];
213
+ RULES.push({ id: 'cybersource-unified-checkout-script', psp: 'cybersource_flex', kinds: ['script'], hostname: /^up\.cybersource\.com$/, pathname: /^\/uc\/v1\/assets\/[A-Za-z0-9_-]{16,1024}\/UnifiedCheckout\.js$/, origin: 'https://up.cybersource.com', path_pattern: '/uc/v1/assets/:asset/UnifiedCheckout.js',
214
+ sources: unifiedCheckoutSources }, { id: 'cybersource-unified-checkout-frame', psp: 'cybersource_flex', kinds: ['frame', 'iframe', 'document'], hostname: /^up\.cybersource\.com$/, pathname: /^\/uc\/v1\/assets\/[A-Za-z0-9_-]{16,1024}\/(?:mce\/mce|orc\/orc|ga\/ga)\.html$/, origin: 'https://up.cybersource.com', path_pattern: '/uc/v1/assets/:asset/{mce,orc,ga}/*.html',
215
+ sources: unifiedCheckoutSources });
216
+ // Aurus Pay's ecom card frame (processors/aurus.js): the store frames /storeservices/ecom/getiframe on
217
+ // pecst<NN>.aurusepay.com, the card fields sit inside it, and its own ecominitjs sends the sealed card to
218
+ // /storeservices/ecom/oneTimeToken on the same host. Reviewed 2026-10-31 at oreillyauto.com's payment step, with every
219
+ // aurusepay.com request but a GET aborted and only a public test card typed. Aurus is served dark, so no catalog
220
+ // processor entry backs the candidate and the result stays unknown unless the caller is served Aurus.
221
+ const aurusSources = [
222
+ { kind: 'saved_observation', reference: 'oreillyauto-2026-10-31:aurus-ecom-getiframe-oneTimeToken', reviewed_on: '2026-10-31' },
223
+ ];
224
+ RULES.push({ id: 'aurus-ecom-iframe', psp: 'aurus', kinds: ['frame', 'iframe', 'document'], hostname: /^pecst[0-9]{2}\.aurusepay\.com$/, pathname: /^\/storeservices\/ecom\/getiframe$/, origin: 'https://pecst01.aurusepay.com', path_pattern: '/storeservices/ecom/getiframe',
225
+ sources: aurusSources }, { id: 'aurus-ecom-init-script', psp: 'aurus', kinds: ['script'], hostname: /^pecst[0-9]{2}\.aurusepay\.com$/, pathname: /^\/storeservices\/ecom\/ecominitjs$/, origin: 'https://pecst01.aurusepay.com', path_pattern: '/storeservices/ecom/ecominitjs',
226
+ sources: aurusSources });
200
227
  // Juspay HyperCheckout: Juspay's own hosted payment page (the Session API's payment_links.web),
201
228
  // which a merchant embeds in an iframe (IndiGo's payment step). The card request that page makes
202
229
  // has not been observed, so the Vault does not take it over, and the rule tells the agent so
@@ -382,6 +409,8 @@ for (const [baseId, suffix, hostname, origin] of [
382
409
  ['gmo-link-hosted-page', 'test', /^pt01\.mul-pay\.jp$/, 'https://pt01.mul-pay.jp'],
383
410
  ['cybersource-flex-microform-script', 'test', /^testflex\.cybersource\.com$/, 'https://testflex.cybersource.com'],
384
411
  ['cybersource-flex-microform-field', 'test', /^testflex\.cybersource\.com$/, 'https://testflex.cybersource.com'],
412
+ ['cybersource-unified-checkout-script', 'test', /^testup\.cybersource\.com$/, 'https://testup.cybersource.com'],
413
+ ['cybersource-unified-checkout-frame', 'test', /^testup\.cybersource\.com$/, 'https://testup.cybersource.com'],
385
414
  // Secure Acceptance's test host and its production host in India serve the same /silent/ paths.
386
415
  ['cybersource-secure-acceptance-silent-order-post', 'test', /^testsecureacceptance\.cybersource\.com$/, 'https://testsecureacceptance.cybersource.com'],
387
416
  ['cybersource-secure-acceptance-silent-order-post', 'in', /^secureacceptance\.in\.cybersource\.com$/, 'https://secureacceptance.in.cybersource.com'],
@@ -788,19 +817,27 @@ export function assessCheckoutSupport(input, options = {}) {
788
817
  result.candidates = [...candidates.values()].sort((a, b) => a.psp.localeCompare(b.psp));
789
818
  if (missingCorroboration && activeFlows.size === 0)
790
819
  result.reason_codes.push('flow_corroboration_missing');
820
+ // Scripts alone naming several processors: one whose every asset is card-free (a wallet button, a fraud collector)
821
+ // is not the card form's. When exactly one other is left, the page's card form is that one's.
822
+ const cardCapable = activePsps.size === 0 && candidates.size > 1
823
+ ? [...candidates.values()].filter(candidate => candidate.evidence.some(evidence => !RULE_BY_ID.get(evidence.rule_id).card_free))
824
+ : [];
825
+ const cardFormPsp = cardCapable.length === 1 ? cardCapable[0].psp : null;
791
826
  if (activePsps.size === 1)
792
827
  result.psp = [...activePsps][0];
793
828
  // Script-only evidence names the processor only when the scan saw everything. On a partial scan
794
829
  // the sole candidate stays listed as undetermined instead of becoming the selected route.
795
830
  else if (activePsps.size === 0 && candidates.size === 1 && result.observation.complete)
796
831
  result.psp = [...candidates.keys()][0];
832
+ else if (cardFormPsp !== null && result.observation.complete)
833
+ result.psp = cardFormPsp;
797
834
  if (!result.observation.complete)
798
835
  result.reason_codes.push('observation_incomplete');
799
836
  if (!input.signals.length) {
800
837
  result.reason_codes.push('psp_not_detected');
801
838
  result.missing_evidence.push('payment_page_signal');
802
839
  }
803
- if (activePsps.size > 1 || activeFlows.size > 1 || activeFlowFrames.size > 1 || activePsps.size === 0 && candidates.size > 1)
840
+ if (activePsps.size > 1 || activeFlows.size > 1 || activeFlowFrames.size > 1 || activePsps.size === 0 && candidates.size > 1 && cardFormPsp === null)
804
841
  result.reason_codes.push('ambiguous_checkout');
805
842
  if (activeFlows.size !== 1 || result.psp === null) {
806
843
  result.reason_codes.push('checkout_flow_unidentified');
@@ -25,6 +25,13 @@ export declare class PreparationGate {
25
25
  * own method is what binds: a POST for most processors, the registration GET for Worldpay eProtect.
26
26
  */
27
27
  claim(requestUrl: string, requestMethod: string, requestBody?: string | null, requestHeaders?: Record<string, string>): PreparedCheckout | undefined;
28
+ /**
29
+ * Whether a same-document navigation of the prepared page to `url` leaves the document this
30
+ * preparation read: the same origin, path and query, whatever the fragment. A single-page checkout
31
+ * that calls history.replaceState with its own URL after each server action (Al's on VTEX) keeps
32
+ * its preparation; a history update to another path or query does not.
33
+ */
34
+ keepsDocument(url: unknown): boolean;
28
35
  assertDocument(): Promise<void>;
29
36
  private readDocument;
30
37
  isEngaged(): boolean;
@@ -3,6 +3,17 @@ import { amountRefusal, validAmountInput } from './client.js';
3
3
  import { matchesPreparation, validPreparationEnvironment, preparationEndpoint, preparationBindsByShape, preparationRequestMethod, preparedRequestRefusal } from './prepared-processor.js';
4
4
  import { SECURE_ACCEPTANCE_PSP, secureAcceptanceCheckoutProfile } from './cybersource-secure-acceptance.js';
5
5
  import { creditguardPageProcessUrl, creditguardProcessTxId } from './creditguard.generated.js';
6
+ /** A page URL without its fragment, or undefined when it does not parse. */
7
+ function documentWithoutFragment(url) {
8
+ try {
9
+ const parsed = new URL(url);
10
+ parsed.hash = '';
11
+ return parsed.href;
12
+ }
13
+ catch {
14
+ return undefined;
15
+ }
16
+ }
6
17
  /** A local, one-use rendezvous. It never starts or retries a merchant request. */
7
18
  export class PreparationGate {
8
19
  opts;
@@ -195,6 +206,16 @@ export class PreparationGate {
195
206
  clearTimeout(this.expiryTimer);
196
207
  return prepared;
197
208
  }
209
+ /**
210
+ * Whether a same-document navigation of the prepared page to `url` leaves the document this
211
+ * preparation read: the same origin, path and query, whatever the fragment. A single-page checkout
212
+ * that calls history.replaceState with its own URL after each server action (Al's on VTEX) keeps
213
+ * its preparation; a history update to another path or query does not.
214
+ */
215
+ keepsDocument(url) {
216
+ const kept = typeof url === 'string' ? documentWithoutFragment(url) : undefined;
217
+ return kept !== undefined && this.documentUrl !== '' && kept === documentWithoutFragment(this.documentUrl);
218
+ }
198
219
  async assertDocument() {
199
220
  if (this.documentUrl && await this.readDocument() !== this.documentUrl)
200
221
  throw new CheckoutPreparationError(this.prepared?.id ?? null, 'merchant_document_changed');