@visa/cli 4.1.0-rc.91 → 4.1.0-rc.92
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/dist/checkout-engine/adapters/index.d.ts +3 -1
- package/dist/checkout-engine/adapters/index.js +5 -2
- package/dist/checkout-engine/executor.js +6 -3
- package/dist/cli.js +32 -32
- package/dist/mcp-server/index.js +23 -23
- package/native/bin/win32-x64/visa-keychain-win.exe +0 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -5,4 +5,6 @@ export { GenericAdapter } from './generic.js';
|
|
|
5
5
|
export { ShopifyAdapter } from './shopify.js';
|
|
6
6
|
export { StripeLikeAdapter } from './stripe-like.js';
|
|
7
7
|
export { fillFieldMap, resolveLocator } from './generic.js';
|
|
8
|
-
export declare function selectAdapter(detected: DetectResult
|
|
8
|
+
export declare function selectAdapter(detected: DetectResult, pageKind?: {
|
|
9
|
+
shopify?: boolean;
|
|
10
|
+
}): CheckoutAdapter;
|
|
@@ -9,10 +9,13 @@ export { ShopifyAdapter } from './shopify.js';
|
|
|
9
9
|
export { StripeLikeAdapter } from './stripe-like.js';
|
|
10
10
|
export { fillFieldMap, resolveLocator } from './generic.js';
|
|
11
11
|
const FALLBACK = new GenericAdapter();
|
|
12
|
-
export function selectAdapter(detected) {
|
|
12
|
+
export function selectAdapter(detected, pageKind = {}) {
|
|
13
13
|
// Shopify owns the outer checkout form and can still delegate card fields to
|
|
14
14
|
// an iframe, so it gets first crack and reuses fillFieldMap for both.
|
|
15
|
-
const
|
|
15
|
+
const shopify = new ShopifyAdapter(detected);
|
|
16
|
+
if (pageKind.shopify === true)
|
|
17
|
+
return shopify;
|
|
18
|
+
const specific = [shopify, new StripeLikeAdapter()];
|
|
16
19
|
for (const a of specific) {
|
|
17
20
|
if (a.matches(detected))
|
|
18
21
|
return a;
|
|
@@ -718,7 +718,8 @@ export async function prepareCheckout(opts, store = defaultPreparedCheckoutStore
|
|
|
718
718
|
// Detection is read-only here. In particular, no adapter fill and no
|
|
719
719
|
// Instrument.getCredential() call can occur before an explicit approval.
|
|
720
720
|
let detected = await detectFields(page);
|
|
721
|
-
|
|
721
|
+
const shopifyPage = await isShopifyCheckoutPage(page);
|
|
722
|
+
let adapter = selectAdapter(detected, { shopify: shopifyPage });
|
|
722
723
|
if (options.contact && adapter.prepareContact) {
|
|
723
724
|
const preparedContact = await adapter.prepareContact(page, options.contact);
|
|
724
725
|
for (const field of preparedContact.filled) {
|
|
@@ -769,7 +770,7 @@ export async function prepareCheckout(opts, store = defaultPreparedCheckoutStore
|
|
|
769
770
|
};
|
|
770
771
|
}
|
|
771
772
|
detected = await detectFields(page);
|
|
772
|
-
adapter = selectAdapter(detected);
|
|
773
|
+
adapter = selectAdapter(detected, { shopify: shopifyPage });
|
|
773
774
|
evidence.step('adapter-selected', { adapter: adapter.name, phase: 'review' });
|
|
774
775
|
}
|
|
775
776
|
fields = detected.fields;
|
|
@@ -1006,7 +1007,9 @@ export async function submitApprovedCheckout(reviewId, opts, store = defaultPrep
|
|
|
1006
1007
|
evidence.step('psp-detected', { psp: p.psp, requiresAdapter: p.requiresAdapter });
|
|
1007
1008
|
}
|
|
1008
1009
|
}
|
|
1009
|
-
const adapter = selectAdapter(detected
|
|
1010
|
+
const adapter = selectAdapter(detected, {
|
|
1011
|
+
shopify: await isShopifyCheckoutPage(page),
|
|
1012
|
+
});
|
|
1010
1013
|
if (adapter.name !== adapterName) {
|
|
1011
1014
|
adapterName = adapter.name;
|
|
1012
1015
|
evidence.step('adapter-selected', { adapter: adapter.name });
|