@amos.com/react-amos-js 0.11.6 → 0.11.8
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 +8 -3
- package/dist/index.d.ts +18 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +33 -29
- package/package.json +4 -4
- package/src/index.tsx +22 -0
package/README.md
CHANGED
|
@@ -39,8 +39,8 @@ The render token configures the iframe's allowed origin(s), allowed payment meth
|
|
|
39
39
|
The following flow is for credit card and bank account payment method types only.
|
|
40
40
|
|
|
41
41
|
1. **Set up prerequisites**: create a `renderToken` (safe for client), and keep `apiKey` and `accountId` server-side only.
|
|
42
|
-
2. **Render your checkout UI** with one of the payment method components (e.g. `AmosCreditCardPaymentMethodForm`)
|
|
43
|
-
3. **User clicks "Pay now"
|
|
42
|
+
2. **Render your checkout UI** with one of the payment method components (e.g. `AmosCreditCardPaymentMethodForm`) **inside a host `<form>`**. Card and bank forms show a field-shaped skeleton immediately (sized from `appearance`, `additionalFields`, and `billingAddressRequirement`); Google Pay and Apple Pay paint a button-shaped skeleton in the parent document on first render so the 48px slot is reserved before the iframe loads. Enter in the iframe submits that enclosing form (PCI-safe; no field values). No-op without a host form, or while Plaid Embedded Institution Search is showing.
|
|
43
|
+
3. **User clicks "Pay now" or presses Enter in the iframe**: call `validateForm({ iframeRef })`, which returns `Promise<true>` if the embedded form is valid and `Promise<false>` otherwise.
|
|
44
44
|
4. **Create payment intent on your server**: use your server-side Amos client to call `POST /payment_intents`. You may also associate this payment intent with a new or existing customer via `POST /customers`. This must be server-side because it uses your private API key.
|
|
45
45
|
5. **Return the payment intent token to the browser**: your backend responds with the embed token (`components["schemas"]["EmbedToken"]`) needed for confirmation.
|
|
46
46
|
6. **Confirm the payment intent from the client**: `await confirmPayment({ iframeRef, token })`.
|
|
@@ -159,6 +159,8 @@ Radio groups (e.g. account type) always use an above-style group label regardles
|
|
|
159
159
|
|
|
160
160
|
### Rendering the credit card inputs within your custom form
|
|
161
161
|
|
|
162
|
+
Wrap the component in a host `<form>`. Enter in the iframe submits it (same as Stripe Elements). The parent cannot listen for that key itself because the iframe is cross-origin. If you render the iframe inside a modal, pass `onEscapeKeyPressed` to close it — Escape inside the iframe is likewise invisible to the parent.
|
|
163
|
+
|
|
162
164
|
```tsx
|
|
163
165
|
import { useRef, useState } from "react";
|
|
164
166
|
import {
|
|
@@ -479,6 +481,9 @@ Renders the secure credit card iframe form. A field-shaped skeleton is shown imm
|
|
|
479
481
|
- `billingAddressRequirement` (`"country" | "full"`, defaults to `"country"`) — how much billing address the iframe collects. `country` collects country / region and, for CA / PR / GB / US, a postal code (labeled ZIP for the United States). `full` shows a full street address form with Smarty autocomplete.
|
|
480
482
|
- `onValidityChange` (`(event: { isValid: boolean }) => void`) — called when form validity changes. `isValid` is true when all required fields are present and valid. Does not include PCI data. Use this to enable or disable your checkout button.
|
|
481
483
|
- `onCardBrandChanged` (`(event: { brand: CardBrand | null }) => void`) — called when the detected card brand changes. `brand` is `"visa"`, `"mastercard"`, `"amex"`, `"discover"`, `"diners"`, or `"jcb"`, or `null` when the field is empty or the number does not match a known brand. Does not include PCI data.
|
|
484
|
+
- `onEscapeKeyPressed` (`() => void`) — called when the customer presses Escape in the iframe. PCI-safe — no field values. Use this to close a host modal that contains the iframe. Not fired while an iframe dropdown or address suggestion list is open, or while Plaid Embedded Institution Search is showing. The parent cannot attach a keydown listener for this itself because the iframe is cross-origin.
|
|
485
|
+
|
|
486
|
+
Enter in a card or bank iframe field submits the enclosing host `<form>` via `requestSubmit()` (same as Stripe Elements). Handle that form's `onSubmit` — the parent page cannot see keys typed in the cross-origin iframe. No-op if the component is not inside a `<form>`, or while Plaid Embedded Institution Search is showing.
|
|
482
487
|
|
|
483
488
|
**Also accepts:** standard iframe props (`React.ComponentProps<"iframe">`), minus `src`, `title`, `name`, and `role` (which are controlled by the SDK).
|
|
484
489
|
|
|
@@ -490,7 +495,7 @@ When `requireAchVerification` is true (or `intent` is `"setup"`), and the render
|
|
|
490
495
|
|
|
491
496
|
**Required props:** same as `AmosCreditCardPaymentMethodForm` — `renderToken`.
|
|
492
497
|
|
|
493
|
-
**Optional props:** same as `AmosCreditCardPaymentMethodForm` — `appearance`, `billingAddressRequirement`, `onValidityChange` (`isValid` is also true after Plaid returns credentials) — plus:
|
|
498
|
+
**Optional props:** same as `AmosCreditCardPaymentMethodForm` — `appearance`, `billingAddressRequirement`, `onValidityChange` (`isValid` is also true after Plaid returns credentials), `onEscapeKeyPressed` — plus:
|
|
494
499
|
|
|
495
500
|
- `requireAchVerification` (`boolean`, defaults to `false`) — when true, show Plaid Embedded Link instead of routing/account fields. Ignored for `intent="setup"` (always Plaid) and when the render token has bank `verification: false`. Hosts that still have an ACH threshold should compute this themselves and pass a new value when the charge changes.
|
|
496
501
|
- `intent` (`"payment" | "setup"`, defaults to `"payment"`) — `"setup"` always shows Plaid unless the render token disables verification. Use this when saving a bank account for later charges.
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,14 @@ type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
71
71
|
onCardBrandChanged?: (event: {
|
|
72
72
|
brand: "visa" | "mastercard" | "amex" | "discover" | "diners" | "jcb" | null;
|
|
73
73
|
}) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Called when the customer presses Escape in the iframe. PCI-safe —
|
|
76
|
+
* no field values. Use this to close a host modal that contains the
|
|
77
|
+
* iframe. Not fired while an iframe dropdown or address suggestion
|
|
78
|
+
* list is open, or while Plaid Embedded Institution Search is
|
|
79
|
+
* showing.
|
|
80
|
+
*/
|
|
81
|
+
onEscapeKeyPressed?: () => void;
|
|
74
82
|
additionalFields?: CreditCardAdditionalFields;
|
|
75
83
|
billingAddressRequirement?: BillingAddressRequirement;
|
|
76
84
|
/**
|
|
@@ -80,7 +88,7 @@ type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
80
88
|
*/
|
|
81
89
|
defaultValues?: PaymentMethodFormDefaultValues;
|
|
82
90
|
};
|
|
83
|
-
export declare function AmosCreditCardPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, onCardBrandChanged, additionalFields, billingAddressRequirement, defaultValues, style, ...rest }: AmosCreditCardPaymentMethodFormProps): import("react").JSX.Element;
|
|
91
|
+
export declare function AmosCreditCardPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, onCardBrandChanged, onEscapeKeyPressed, additionalFields, billingAddressRequirement, defaultValues, style, ...rest }: AmosCreditCardPaymentMethodFormProps): import("react").JSX.Element;
|
|
84
92
|
type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
|
|
85
93
|
renderToken: string;
|
|
86
94
|
appearance?: Appearance;
|
|
@@ -92,6 +100,14 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
92
100
|
onValidityChange?: (event: {
|
|
93
101
|
isValid: boolean;
|
|
94
102
|
}) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Called when the customer presses Escape in the iframe. PCI-safe —
|
|
105
|
+
* no field values. Use this to close a host modal that contains the
|
|
106
|
+
* iframe. Not fired while an iframe dropdown or address suggestion
|
|
107
|
+
* list is open, or while Plaid Embedded Institution Search is
|
|
108
|
+
* showing.
|
|
109
|
+
*/
|
|
110
|
+
onEscapeKeyPressed?: () => void;
|
|
95
111
|
billingAddressRequirement?: BillingAddressRequirement;
|
|
96
112
|
/**
|
|
97
113
|
* Seed account holder name and billing address. Provided keys
|
|
@@ -117,7 +133,7 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
117
133
|
*/
|
|
118
134
|
intent?: "payment" | "setup";
|
|
119
135
|
};
|
|
120
|
-
export declare function AmosBankAccountPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, billingAddressRequirement, defaultValues, requireAchVerification, intent, style, ...rest }: AmosBankAccountPaymentMethodFormProps): import("react").JSX.Element;
|
|
136
|
+
export declare function AmosBankAccountPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, onEscapeKeyPressed, billingAddressRequirement, defaultValues, requireAchVerification, intent, style, ...rest }: AmosBankAccountPaymentMethodFormProps): import("react").JSX.Element;
|
|
121
137
|
type AmosGooglePayButtonProps = {
|
|
122
138
|
ref?: ForwardedIframeRef;
|
|
123
139
|
renderToken: string;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@amos.com/amos-js"),t=require("react"),n=require("react/jsx-runtime");function r(e){return e?e.current??null:null}function i({iframeRef:t}){return(0,e.validateForm)({iframe:r(t)})}function a({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmPayment)({iframe:r(t),token:n,defaultValues:i})}function o({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmSetup)({iframe:r(t),token:n,defaultValues:i})}function s({iframeRef:t}){(0,e.resetForm)({iframe:r(t)})}function c({iframeRef:t,field:n}){(0,e.focusField)({iframe:r(t),field:n})}function l(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function u(e,{style:t,className:n,id:r,...i}){n!=null&&(e.className=n),r!=null&&(e.id=r),Object.assign(e.style,t);for(let[t,n]of Object.entries(i))n!=null&&(t in e?Reflect.set(e,t,n):e.setAttribute(t,String(n)))}function d({containerRef:e,iframeRef:n,mount:r,options:i,remountDeps:a,iframePassthrough:o,updateDeps:s}){let c=(0,t.useRef)(null);(0,t.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let a=r(t,i);return c.current=a,l(n,a.iframe),u(a.iframe,o),()=>{a.destroy(),c.current=null,l(n,null)}},[...a]),(0,t.useEffect)(()=>{c.current?.update(i)},[...s]),(0,t.useEffect)(()=>{let e=c.current?.iframe;e&&u(e,o)})}var f=`oklch(0.97 0 0)`;function p({height:r,borderRadius:i,containerRef:a}){return(0,t.useLayoutEffect)(()=>{(0,e.ensureSkeletonStyles)()},[]),(0,n.jsxs)(`div`,{style:{boxSizing:`border-box`,position:`relative`,width:`100%`,height:r,minHeight:r,overflow:`hidden`},children:[(0,n.jsx)(`div`,{className:`amos-js-form-skeleton-input amos-js-wallet-skeleton`,style:{position:`absolute`,inset:0,height:r,borderRadius:i,background:f,pointerEvents:`none`,zIndex:0},"aria-hidden":!0}),(0,n.jsx)(`div`,{ref:a,style:{position:`absolute`,inset:0,zIndex:1,width:`100%`,height:`100%`}})]})}function m({ref:r,renderToken:i,appearance:a,onValidityChange:o,onCardBrandChanged:s,additionalFields:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@amos.com/amos-js"),t=require("react"),n=require("react/jsx-runtime");function r(e){return e?e.current??null:null}function i({iframeRef:t}){return(0,e.validateForm)({iframe:r(t)})}function a({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmPayment)({iframe:r(t),token:n,defaultValues:i})}function o({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmSetup)({iframe:r(t),token:n,defaultValues:i})}function s({iframeRef:t}){(0,e.resetForm)({iframe:r(t)})}function c({iframeRef:t,field:n}){(0,e.focusField)({iframe:r(t),field:n})}function l(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function u(e,{style:t,className:n,id:r,...i}){n!=null&&(e.className=n),r!=null&&(e.id=r),Object.assign(e.style,t);for(let[t,n]of Object.entries(i))n!=null&&(t in e?Reflect.set(e,t,n):e.setAttribute(t,String(n)))}function d({containerRef:e,iframeRef:n,mount:r,options:i,remountDeps:a,iframePassthrough:o,updateDeps:s}){let c=(0,t.useRef)(null);(0,t.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let a=r(t,i);return c.current=a,l(n,a.iframe),u(a.iframe,o),()=>{a.destroy(),c.current=null,l(n,null)}},[...a]),(0,t.useEffect)(()=>{c.current?.update(i)},[...s]),(0,t.useEffect)(()=>{let e=c.current?.iframe;e&&u(e,o)})}var f=`oklch(0.97 0 0)`;function p({height:r,borderRadius:i,containerRef:a}){return(0,t.useLayoutEffect)(()=>{(0,e.ensureSkeletonStyles)()},[]),(0,n.jsxs)(`div`,{style:{boxSizing:`border-box`,position:`relative`,width:`100%`,height:r,minHeight:r,overflow:`hidden`},children:[(0,n.jsx)(`div`,{className:`amos-js-form-skeleton-input amos-js-wallet-skeleton`,style:{position:`absolute`,inset:0,height:r,borderRadius:i,background:f,pointerEvents:`none`,zIndex:0},"aria-hidden":!0}),(0,n.jsx)(`div`,{ref:a,style:{position:`absolute`,inset:0,zIndex:1,width:`100%`,height:`100%`}})]})}function m({ref:r,renderToken:i,appearance:a,onValidityChange:o,onCardBrandChanged:s,onEscapeKeyPressed:c,additionalFields:l={cardholderName:!1},billingAddressRequirement:u=`country`,defaultValues:f,style:p,...m}){let h=(0,t.useRef)(null);return d({containerRef:h,iframeRef:r,mount:e.mountAmosCreditCardPaymentMethodForm,options:{renderToken:i,appearance:a,additionalFields:l,billingAddressRequirement:u,defaultValues:f,onValidityChange:o,onCardBrandChanged:s,onEscapeKeyPressed:c},remountDeps:[i,l.cardholderName,u],iframePassthrough:{style:p,...m},updateDeps:[a,l,u,f,o,s,c]}),(0,n.jsx)(`div`,{ref:h})}function h({ref:r,renderToken:i,appearance:a,onValidityChange:o,onEscapeKeyPressed:s,billingAddressRequirement:c=`country`,defaultValues:l,requireAchVerification:u=!1,intent:f=`payment`,style:p,...m}){let h=(0,t.useRef)(null);return d({containerRef:h,iframeRef:r,mount:e.mountAmosBankAccountPaymentMethodForm,options:{renderToken:i,appearance:a,billingAddressRequirement:c,defaultValues:l,requireAchVerification:u,intent:f,onValidityChange:o,onEscapeKeyPressed:s},remountDeps:[i,c,f],iframePassthrough:{style:p,...m},updateDeps:[a,c,l,u,f,o,s]}),(0,n.jsx)(`div`,{ref:h})}function g({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:u}){let f=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l?.style,buttonProps:c});return d({containerRef:f,iframeRef:r,mount:e.mountAmosGooglePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:u},remountDeps:[i],iframePassthrough:l??{},updateDeps:[a,o,s,c,u]}),(0,n.jsx)(p,{height:s,borderRadius:m,containerRef:f})}function _({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:u}){let f=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l?.style,buttonProps:c});return d({containerRef:f,iframeRef:r,mount:e.mountAmosApplePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:u},remountDeps:[i],iframePassthrough:l??{},updateDeps:[a,o,s,c,u]}),(0,n.jsx)(p,{height:s,borderRadius:m,containerRef:f})}exports.AmosApplePayButton=_,exports.AmosBankAccountPaymentMethodForm=h,exports.AmosCreditCardPaymentMethodForm=m,exports.AmosGooglePayButton=g,exports.confirmPayment=a,exports.confirmSetup=o,exports.focusField=c,exports.resetForm=s,exports.validateForm=i,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/index.mjs
CHANGED
|
@@ -92,73 +92,77 @@ function E({ height: e, borderRadius: t, containerRef: r }) {
|
|
|
92
92
|
})]
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
function D({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onCardBrandChanged: i,
|
|
96
|
-
let
|
|
95
|
+
function D({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onCardBrandChanged: i, onEscapeKeyPressed: a, additionalFields: s = { cardholderName: !1 }, billingAddressRequirement: c = "country", defaultValues: l, style: u, ...d }) {
|
|
96
|
+
let f = p(null);
|
|
97
97
|
return w({
|
|
98
|
-
containerRef:
|
|
98
|
+
containerRef: f,
|
|
99
99
|
iframeRef: e,
|
|
100
100
|
mount: o,
|
|
101
101
|
options: {
|
|
102
102
|
renderToken: t,
|
|
103
103
|
appearance: n,
|
|
104
|
-
additionalFields:
|
|
105
|
-
billingAddressRequirement:
|
|
106
|
-
defaultValues:
|
|
104
|
+
additionalFields: s,
|
|
105
|
+
billingAddressRequirement: c,
|
|
106
|
+
defaultValues: l,
|
|
107
107
|
onValidityChange: r,
|
|
108
|
-
onCardBrandChanged: i
|
|
108
|
+
onCardBrandChanged: i,
|
|
109
|
+
onEscapeKeyPressed: a
|
|
109
110
|
},
|
|
110
111
|
remountDeps: [
|
|
111
112
|
t,
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
s.cardholderName,
|
|
114
|
+
c
|
|
114
115
|
],
|
|
115
116
|
iframePassthrough: {
|
|
116
|
-
style:
|
|
117
|
-
...
|
|
117
|
+
style: u,
|
|
118
|
+
...d
|
|
118
119
|
},
|
|
119
120
|
updateDeps: [
|
|
120
121
|
n,
|
|
121
|
-
a,
|
|
122
122
|
s,
|
|
123
123
|
c,
|
|
124
|
+
l,
|
|
124
125
|
r,
|
|
125
|
-
i
|
|
126
|
+
i,
|
|
127
|
+
a
|
|
126
128
|
]
|
|
127
|
-
}), /* @__PURE__ */ m("div", { ref:
|
|
129
|
+
}), /* @__PURE__ */ m("div", { ref: f });
|
|
128
130
|
}
|
|
129
|
-
function O({ ref: e, renderToken: t, appearance: n, onValidityChange: r,
|
|
130
|
-
let
|
|
131
|
+
function O({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onEscapeKeyPressed: i, billingAddressRequirement: o = "country", defaultValues: s, requireAchVerification: c = !1, intent: l = "payment", style: u, ...d }) {
|
|
132
|
+
let f = p(null);
|
|
131
133
|
return w({
|
|
132
|
-
containerRef:
|
|
134
|
+
containerRef: f,
|
|
133
135
|
iframeRef: e,
|
|
134
136
|
mount: a,
|
|
135
137
|
options: {
|
|
136
138
|
renderToken: t,
|
|
137
139
|
appearance: n,
|
|
138
|
-
billingAddressRequirement:
|
|
139
|
-
defaultValues:
|
|
140
|
-
requireAchVerification:
|
|
141
|
-
intent:
|
|
142
|
-
onValidityChange: r
|
|
140
|
+
billingAddressRequirement: o,
|
|
141
|
+
defaultValues: s,
|
|
142
|
+
requireAchVerification: c,
|
|
143
|
+
intent: l,
|
|
144
|
+
onValidityChange: r,
|
|
145
|
+
onEscapeKeyPressed: i
|
|
143
146
|
},
|
|
144
147
|
remountDeps: [
|
|
145
148
|
t,
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
o,
|
|
150
|
+
l
|
|
148
151
|
],
|
|
149
152
|
iframePassthrough: {
|
|
150
|
-
style:
|
|
151
|
-
...
|
|
153
|
+
style: u,
|
|
154
|
+
...d
|
|
152
155
|
},
|
|
153
156
|
updateDeps: [
|
|
154
157
|
n,
|
|
155
|
-
i,
|
|
156
158
|
o,
|
|
157
159
|
s,
|
|
158
160
|
c,
|
|
159
|
-
|
|
161
|
+
l,
|
|
162
|
+
r,
|
|
163
|
+
i
|
|
160
164
|
]
|
|
161
|
-
}), /* @__PURE__ */ m("div", { ref:
|
|
165
|
+
}), /* @__PURE__ */ m("div", { ref: f });
|
|
162
166
|
}
|
|
163
167
|
function k({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48px", buttonProps: a, iframeProps: o, onConfirm: c }) {
|
|
164
168
|
let u = p(null), d = l({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amos.com/react-amos-js",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"description": "React SDK for embedding Amos payment methods via iframes. Wraps @amos.com/amos-js.",
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@amos.com/node": "0.1.57",
|
|
41
|
-
"@biomejs/biome": "2.5.
|
|
41
|
+
"@biomejs/biome": "2.5.11",
|
|
42
42
|
"@changesets/cli": "2.31.1",
|
|
43
|
-
"@types/node": "26.
|
|
43
|
+
"@types/node": "26.4.0",
|
|
44
44
|
"@types/react": "19.2.18",
|
|
45
45
|
"@typescript/typescript6": "6.0.2",
|
|
46
46
|
"typescript": "7.0.2",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vite-plugin-dts": "5.0.3"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@amos.com/amos-js": "0.11.
|
|
51
|
+
"@amos.com/amos-js": "0.11.10",
|
|
52
52
|
"@types/googlepay": "0.7.12"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
package/src/index.tsx
CHANGED
|
@@ -304,6 +304,14 @@ type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
304
304
|
| "jcb"
|
|
305
305
|
| null;
|
|
306
306
|
}) => void;
|
|
307
|
+
/**
|
|
308
|
+
* Called when the customer presses Escape in the iframe. PCI-safe —
|
|
309
|
+
* no field values. Use this to close a host modal that contains the
|
|
310
|
+
* iframe. Not fired while an iframe dropdown or address suggestion
|
|
311
|
+
* list is open, or while Plaid Embedded Institution Search is
|
|
312
|
+
* showing.
|
|
313
|
+
*/
|
|
314
|
+
onEscapeKeyPressed?: () => void;
|
|
307
315
|
additionalFields?: CreditCardAdditionalFields;
|
|
308
316
|
billingAddressRequirement?: BillingAddressRequirement;
|
|
309
317
|
/**
|
|
@@ -320,6 +328,7 @@ export function AmosCreditCardPaymentMethodForm({
|
|
|
320
328
|
appearance,
|
|
321
329
|
onValidityChange,
|
|
322
330
|
onCardBrandChanged,
|
|
331
|
+
onEscapeKeyPressed,
|
|
323
332
|
additionalFields = { cardholderName: false },
|
|
324
333
|
billingAddressRequirement = "country",
|
|
325
334
|
defaultValues,
|
|
@@ -340,6 +349,7 @@ export function AmosCreditCardPaymentMethodForm({
|
|
|
340
349
|
defaultValues,
|
|
341
350
|
onValidityChange,
|
|
342
351
|
onCardBrandChanged,
|
|
352
|
+
onEscapeKeyPressed,
|
|
343
353
|
},
|
|
344
354
|
remountDeps: [
|
|
345
355
|
renderToken,
|
|
@@ -354,6 +364,7 @@ export function AmosCreditCardPaymentMethodForm({
|
|
|
354
364
|
defaultValues,
|
|
355
365
|
onValidityChange,
|
|
356
366
|
onCardBrandChanged,
|
|
367
|
+
onEscapeKeyPressed,
|
|
357
368
|
],
|
|
358
369
|
});
|
|
359
370
|
|
|
@@ -369,6 +380,14 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
|
|
|
369
380
|
* has returned credentials. Does not include PCI data.
|
|
370
381
|
*/
|
|
371
382
|
onValidityChange?: (event: { isValid: boolean }) => void;
|
|
383
|
+
/**
|
|
384
|
+
* Called when the customer presses Escape in the iframe. PCI-safe —
|
|
385
|
+
* no field values. Use this to close a host modal that contains the
|
|
386
|
+
* iframe. Not fired while an iframe dropdown or address suggestion
|
|
387
|
+
* list is open, or while Plaid Embedded Institution Search is
|
|
388
|
+
* showing.
|
|
389
|
+
*/
|
|
390
|
+
onEscapeKeyPressed?: () => void;
|
|
372
391
|
billingAddressRequirement?: BillingAddressRequirement;
|
|
373
392
|
/**
|
|
374
393
|
* Seed account holder name and billing address. Provided keys
|
|
@@ -400,6 +419,7 @@ export function AmosBankAccountPaymentMethodForm({
|
|
|
400
419
|
renderToken,
|
|
401
420
|
appearance,
|
|
402
421
|
onValidityChange,
|
|
422
|
+
onEscapeKeyPressed,
|
|
403
423
|
billingAddressRequirement = "country",
|
|
404
424
|
defaultValues,
|
|
405
425
|
requireAchVerification = false,
|
|
@@ -421,6 +441,7 @@ export function AmosBankAccountPaymentMethodForm({
|
|
|
421
441
|
requireAchVerification,
|
|
422
442
|
intent,
|
|
423
443
|
onValidityChange,
|
|
444
|
+
onEscapeKeyPressed,
|
|
424
445
|
},
|
|
425
446
|
remountDeps: [renderToken, billingAddressRequirement, intent],
|
|
426
447
|
iframePassthrough: { style, ...rest },
|
|
@@ -431,6 +452,7 @@ export function AmosBankAccountPaymentMethodForm({
|
|
|
431
452
|
requireAchVerification,
|
|
432
453
|
intent,
|
|
433
454
|
onValidityChange,
|
|
455
|
+
onEscapeKeyPressed,
|
|
434
456
|
],
|
|
435
457
|
});
|
|
436
458
|
|