@amos.com/react-amos-js 0.11.3 → 0.11.5

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 CHANGED
@@ -16,7 +16,7 @@ npm install @amos.com/react-amos-js @amos.com/node
16
16
 
17
17
  - React components for the iframe payment method forms: `AmosCreditCardPaymentMethodForm`, `AmosBankAccountPaymentMethodForm`, `AmosGooglePayButton`, `AmosApplePayButton`.
18
18
  - React-flavoured iframe message helpers that accept a React `ref`: `validateForm({ iframeRef })`, `confirmPayment({ iframeRef, token })`, `confirmSetup({ iframeRef, token })`, `resetForm({ iframeRef })`.
19
- - Re-exports of the `@amos.com/amos-js` helpers and types that come up in client code: `createMessage`, `decodeJwt`, `getEmbedOrigin`, `formatGooglePayPaymentData`, `resetForm`, `ConfirmResult`, `FormattedGooglePayPaymentData`, `Appearance`, `Message`, etc.
19
+ - Re-exports of the `@amos.com/amos-js` helpers and types that come up in client code: `createMessage`, `decodeJwt`, `getEmbedOrigin`, `formatGooglePayPaymentData`, `resetForm`, `ConfirmPaymentResult`, `ConfirmSetupResult`, `FormattedGooglePayPaymentData`, `Appearance`, `Message`, etc.
20
20
 
21
21
  > **Note:** `@amos.com/react-amos-js` is the client-side half of the Amos integration. For end-to-end payment processing you also need `@amos.com/node` on your server (creating payment intents, handling webhooks, etc.). The same `@amos.com/node` package is listed as a peer dependency so you can import its OpenAPI types in client-side TypeScript code.
22
22
 
@@ -44,7 +44,7 @@ The following flow is for credit card and bank account payment method types only
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 })`.
47
- 7. **Handle UX**: show the user a "processing" state while awaiting `confirmPayment`. Do not treat `{ status: "succeeded" }` as settlement proof — verify payment success on your backend via webhooks. Recoverable field errors stay in the iframe; `confirmPayment` still resolves `{ status: "failed" }`.
47
+ 7. **Handle UX**: show the user a "processing" state while awaiting `confirmPayment`. Do not treat `{ status: "succeeded" }` as settlement proof — verify payment success on your backend via webhooks. Recoverable field errors stay in the iframe; `confirmPayment` still resolves `{ status: "failed" }` (with `paymentIntent` when the confirm API returned a body, including `last_payment_error` on declines).
48
48
 
49
49
  ### Google Pay & Apple Pay
50
50
 
@@ -62,7 +62,7 @@ Setup intents are used to save payment methods for future use (e.g. recurring pa
62
62
 
63
63
  - On the server, call `POST /setup_intents` instead of `POST /payment_intents`.
64
64
  - On the client, `await confirmSetup({ iframeRef, token })` instead of `confirmPayment({ iframeRef, token })`.
65
- - Both resolve `{ status: "succeeded" | "failed" }`.
65
+ - Both resolve with a status and the matching intent object when the confirm API returned a body (`ConfirmPaymentResult` / `ConfirmSetupResult`).
66
66
 
67
67
  The same `AmosCreditCardPaymentMethodForm` / `AmosBankAccountPaymentMethodForm` components support both payment intents and setup intents — they are differentiated by which confirmation function you call. For bank setup, pass `intent="setup"` so Plaid is always shown (unless the render token disables verification).
68
68
 
@@ -243,7 +243,7 @@ import { useState } from "react";
243
243
  import {
244
244
  AmosApplePayButton,
245
245
  AmosGooglePayButton,
246
- type ConfirmResult,
246
+ type ConfirmPaymentResult,
247
247
  } from "@amos.com/react-amos-js";
248
248
  import type { components } from "@amos.com/node";
249
249
 
@@ -279,8 +279,8 @@ function CheckoutWallets({ renderToken }: { renderToken: string }) {
279
279
  }: {
280
280
  paymentIntentCreateAttributes: components["schemas"]["CreatePaymentIntentInput"];
281
281
  customerCreateAttributes: components["schemas"]["CreateCustomerInput"];
282
- confirmPayment: (token: string) => Promise<ConfirmResult>;
283
- }): Promise<ConfirmResult> {
282
+ confirmPayment: (token: string) => Promise<ConfirmPaymentResult>;
283
+ }): Promise<ConfirmPaymentResult> {
284
284
  try {
285
285
  const token = await createPaymentIntentToken({
286
286
  paymentIntentCreateAttributes,
@@ -433,14 +433,14 @@ Validates the embedded card/bank iframe form before payment confirmation.
433
433
 
434
434
  ### `confirmPayment({ iframeRef, token })`
435
435
 
436
- Confirms a payment intent in the embedded iframe flow. Resolves `{ status: "succeeded" }` or `{ status: "failed" }`.
436
+ Confirms a payment intent in the embedded iframe flow. Resolves `{ status: "succeeded", paymentIntent }` or `{ status: "failed", paymentIntent? }`.
437
437
 
438
438
  **Parameters:**
439
439
 
440
440
  - `iframeRef` (`React.RefObject<HTMLIFrameElement | null> | undefined`, required)
441
441
  - `token` (typed as `Pick<components["schemas"]["EmbedToken"], "token">` — the embed JWT string returned by your server)
442
442
 
443
- **Returns:** `Promise<ConfirmResult>`
443
+ **Returns:** `Promise<ConfirmPaymentResult>`
444
444
 
445
445
  ### `confirmSetup({ iframeRef, token })`
446
446
 
@@ -451,7 +451,7 @@ Confirms a setup intent in the embedded iframe flow. Use this when saving a paym
451
451
  - `iframeRef` (`React.RefObject<HTMLIFrameElement | null> | undefined`, required)
452
452
  - `token` (same `Pick<components["schemas"]["EmbedToken"], "token">` embed JWT string as for payment confirmation)
453
453
 
454
- **Returns:** `Promise<ConfirmResult>`
454
+ **Returns:** `Promise<ConfirmSetupResult>`
455
455
 
456
456
  ### `resetForm({ iframeRef })`
457
457
 
@@ -526,7 +526,7 @@ Renders the secure Google Pay iframe button (express checkout flow). A button-sh
526
526
  - `renderToken` (`string`)
527
527
  - `amount` (`string`) — major-currency decimal string shown in the wallet sheet (e.g. `"50.00"` for $50.00). The iframe converts this to cents in `paymentIntentCreateAttributes.amount`.
528
528
  - `merchantName` (`string`)
529
- - `onConfirm` (callback receiving `{ paymentIntentCreateAttributes, customerCreateAttributes, confirmPayment }`. Create a payment intent, then `return confirmPayment(token)` — `Promise<ConfirmResult>`)
529
+ - `onConfirm` (callback receiving `{ paymentIntentCreateAttributes, customerCreateAttributes, confirmPayment }`. Create a payment intent, then `return confirmPayment(token)` — `Promise<ConfirmPaymentResult>`)
530
530
 
531
531
  **Optional props:**
532
532
 
@@ -582,12 +582,12 @@ Re-exports of the same advanced helpers exposed by `@amos.com/amos-js`. Most int
582
582
 
583
583
  ### Exported types
584
584
 
585
- `@amos.com/react-amos-js` re-exports everything from `@amos.com/amos-js`, including `ConfirmResult`, `PaymentMethodFormValidityChangeEvent`, `CardBrand`, `PaymentMethodFormCardBrandChangeEvent`, `FormattedGooglePayPaymentData`, `Message`, `Appearance`, `ThemeVariable`, and the per-form `*Options` / `*Controller` types. For OpenAPI schema types (e.g. `PaymentIntent`, `CreatePaymentIntentInput`), import `components` from `@amos.com/node`.
585
+ `@amos.com/react-amos-js` re-exports everything from `@amos.com/amos-js`, including `ConfirmPaymentResult`, `ConfirmSetupResult`, `PaymentMethodFormValidityChangeEvent`, `CardBrand`, `PaymentMethodFormCardBrandChangeEvent`, `FormattedGooglePayPaymentData`, `Message`, `Appearance`, `ThemeVariable`, and the per-form `*Options` / `*Controller` types. For OpenAPI schema types (e.g. `PaymentIntent`, `CreatePaymentIntentInput`), import `components` from `@amos.com/node`.
586
586
 
587
587
  ## Notes and potential gotchas
588
588
 
589
589
  - **`ref` / `iframeRef`**: for card and bank forms, pass `ref={iframeRef}` to the form component. The same `iframeRef` must be used when calling `validateForm`, `confirmPayment`, `confirmSetup`, or `resetForm`. The component forwards the ref to the inner iframe.
590
- - **`confirmPayment` / `confirmSetup` are not settlement proof**: `{ status: "succeeded" }` means authorization succeeded (capture may still finish asynchronously). Verify payment or setup success on your backend via webhooks. Recoverable field errors stay in the iframe; the Promise still resolves `{ status: "failed" }`.
590
+ - **`confirmPayment` / `confirmSetup` are not settlement proof**: `{ status: "succeeded" }` means authorization succeeded (capture may still finish asynchronously). Verify payment or setup success on your backend via webhooks. Recoverable field errors stay in the iframe; the Promise still resolves `{ status: "failed" }`. Declined confirms include the intent so you can read `last_payment_error` without a follow-up GET.
591
591
  - **Same components for payment vs setup intents**: `AmosCreditCardPaymentMethodForm` and `AmosBankAccountPaymentMethodForm` support both payment intents and setup intents. The flow differs only by which server call you make and which confirmation function you use (`confirmPayment` vs `confirmSetup`).
592
592
  - **Amount format**: for `AmosGooglePayButton` and `AmosApplePayButton`, `amount` is a major-currency decimal string (e.g. `"50.00"` for $50.00). For `components["schemas"]["CreatePaymentIntentInput"]` on the server (card/bank create, and the object the wallet iframe sends to `onConfirm`), `amount` is a number in cents (e.g. `5000`).
593
593
  - **Plaid Embedded Link (ACH verification)**: load `cdn.plaid.com` from the **parent** document (see CSP on `AmosBankAccountPaymentMethodForm`). Merchants do not proxy Pay API; the bank iframe mints link tokens. Pass `requireAchVerification` when the host wants Plaid, or `intent="setup"` to always show it, unless the render token disables verification. Confirm still goes through the bank iframe so Amos can attach `plaid` to the payment method.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="googlepay" />
2
- import { Appearance, ApplePayButtonElementProps, BillingAddressRequirement, ConfirmResult, CreditCardAdditionalFields, GooglePayButtonElementProps } from '@amos.com/amos-js';
2
+ import { Appearance, ApplePayButtonElementProps, BillingAddressRequirement, ConfirmPaymentResult, ConfirmSetupResult, CreditCardAdditionalFields, GooglePayButtonElementProps, PaymentMethodFormDefaultValues, PaymentMethodFormField } from '@amos.com/amos-js';
3
3
  import { components } from '@amos.com/node';
4
4
  import { ComponentProps, Ref, RefObject } from 'react';
5
5
  export * from '@amos.com/amos-js';
@@ -20,9 +20,10 @@ export declare function validateForm({ iframeRef, }: {
20
20
  * Pass the embed JWT (`token`) returned by your server's
21
21
  * `POST /payment_intents` call.
22
22
  */
23
- export declare function confirmPayment({ iframeRef, token, }: {
23
+ export declare function confirmPayment({ iframeRef, token, defaultValues, }: {
24
24
  iframeRef: IframeRef;
25
- } & Pick<components["schemas"]["EmbedToken"], "token">): Promise<ConfirmResult>;
25
+ defaultValues?: PaymentMethodFormDefaultValues;
26
+ } & Pick<components["schemas"]["EmbedToken"], "token">): Promise<ConfirmPaymentResult>;
26
27
  /**
27
28
  * Confirm a setup intent in the embedded iframe flow. Use this when
28
29
  * saving a payment method for future use.
@@ -30,9 +31,10 @@ export declare function confirmPayment({ iframeRef, token, }: {
30
31
  * Pass the embed JWT (`token`) returned by your server's
31
32
  * `POST /setup_intents` call.
32
33
  */
33
- export declare function confirmSetup({ iframeRef, token, }: {
34
+ export declare function confirmSetup({ iframeRef, token, defaultValues, }: {
34
35
  iframeRef: IframeRef;
35
- } & Pick<components["schemas"]["EmbedToken"], "token">): Promise<ConfirmResult>;
36
+ defaultValues?: PaymentMethodFormDefaultValues;
37
+ } & Pick<components["schemas"]["EmbedToken"], "token">): Promise<ConfirmSetupResult>;
36
38
  /**
37
39
  * Clear all field values and API errors in the embedded card/bank iframe
38
40
  * form. Call after a failed confirm when the customer wants to try again.
@@ -40,6 +42,15 @@ export declare function confirmSetup({ iframeRef, token, }: {
40
42
  export declare function resetForm({ iframeRef }: {
41
43
  iframeRef: IframeRef;
42
44
  }): void;
45
+ /**
46
+ * Focus a named control inside the embedded card/bank iframe. No-op if
47
+ * the field is not rendered, or while Plaid Embedded Institution Search
48
+ * is showing. Call from a click or keydown handler.
49
+ */
50
+ export declare function focusField({ iframeRef, field, }: {
51
+ iframeRef: IframeRef;
52
+ field: PaymentMethodFormField;
53
+ }): void;
43
54
  type ForwardedIframeRef = Ref<HTMLIFrameElement> | undefined;
44
55
  type IframePassthroughProps = Omit<ComponentProps<"iframe">, "src" | "title" | "name" | "role" | "allow">;
45
56
  type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
@@ -62,8 +73,14 @@ type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
62
73
  }) => void;
63
74
  additionalFields?: CreditCardAdditionalFields;
64
75
  billingAddressRequirement?: BillingAddressRequirement;
76
+ /**
77
+ * Seed cardholder name and billing address. Provided keys overwrite
78
+ * matching fields, including ones the customer already edited. Values
79
+ * are sent on confirm even when those inputs are hidden.
80
+ */
81
+ defaultValues?: PaymentMethodFormDefaultValues;
65
82
  };
66
- export declare function AmosCreditCardPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, onCardBrandChanged, additionalFields, billingAddressRequirement, style, ...rest }: AmosCreditCardPaymentMethodFormProps): import("react").JSX.Element;
83
+ export declare function AmosCreditCardPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, onCardBrandChanged, additionalFields, billingAddressRequirement, defaultValues, style, ...rest }: AmosCreditCardPaymentMethodFormProps): import("react").JSX.Element;
67
84
  type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
68
85
  renderToken: string;
69
86
  appearance?: Appearance;
@@ -76,6 +93,12 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
76
93
  isValid: boolean;
77
94
  }) => void;
78
95
  billingAddressRequirement?: BillingAddressRequirement;
96
+ /**
97
+ * Seed account holder name and billing address. Provided keys
98
+ * overwrite matching fields, including ones the customer already
99
+ * edited.
100
+ */
101
+ defaultValues?: PaymentMethodFormDefaultValues;
79
102
  /**
80
103
  * When true, hide the routing/account iframe and mount Plaid Embedded
81
104
  * Institution Search in the parent. Ignored when `intent` is `"setup"`
@@ -94,7 +117,7 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
94
117
  */
95
118
  intent?: "payment" | "setup";
96
119
  };
97
- export declare function AmosBankAccountPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, billingAddressRequirement, requireAchVerification, intent, style, ...rest }: AmosBankAccountPaymentMethodFormProps): import("react").JSX.Element;
120
+ export declare function AmosBankAccountPaymentMethodForm({ ref, renderToken, appearance, onValidityChange, billingAddressRequirement, defaultValues, requireAchVerification, intent, style, ...rest }: AmosBankAccountPaymentMethodFormProps): import("react").JSX.Element;
98
121
  type AmosGooglePayButtonProps = {
99
122
  ref?: ForwardedIframeRef;
100
123
  renderToken: string;
@@ -126,8 +149,8 @@ type AmosGooglePayButtonProps = {
126
149
  onConfirm: ({ paymentIntentCreateAttributes, customerCreateAttributes, confirmPayment, }: {
127
150
  paymentIntentCreateAttributes: components["schemas"]["CreatePaymentIntentInput"];
128
151
  customerCreateAttributes: components["schemas"]["CreateCustomerInput"];
129
- confirmPayment: (token: string) => Promise<ConfirmResult>;
130
- }) => Promise<ConfirmResult>;
152
+ confirmPayment: (token: string) => Promise<ConfirmPaymentResult>;
153
+ }) => Promise<ConfirmPaymentResult>;
131
154
  };
132
155
  /**
133
156
  * Renders the secure Google Pay iframe button. A button-shaped
@@ -166,8 +189,8 @@ type AmosApplePayButtonProps = {
166
189
  onConfirm: ({ paymentIntentCreateAttributes, customerCreateAttributes, confirmPayment, }: {
167
190
  paymentIntentCreateAttributes: components["schemas"]["CreatePaymentIntentInput"];
168
191
  customerCreateAttributes: components["schemas"]["CreateCustomerInput"];
169
- confirmPayment: (token: string) => Promise<ConfirmResult>;
170
- }) => Promise<ConfirmResult>;
192
+ confirmPayment: (token: string) => Promise<ConfirmPaymentResult>;
193
+ }) => Promise<ConfirmPaymentResult>;
171
194
  };
172
195
  /**
173
196
  * Renders the secure Apple Pay iframe button. A button-shaped
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}){return(0,e.confirmPayment)({iframe:r(t),token:n})}function o({iframeRef:t,token:n}){return(0,e.confirmSetup)({iframe:r(t),token:n})}function s({iframeRef:t}){(0,e.resetForm)({iframe:r(t)})}function c(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function l(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 u({containerRef:e,iframeRef:n,mount:r,options:i,remountDeps:a,iframePassthrough:o,updateDeps:s}){let u=(0,t.useRef)(null);(0,t.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let a=r(t,i);return u.current=a,c(n,a.iframe),l(a.iframe,o),()=>{a.destroy(),u.current=null,c(n,null)}},[...a]),(0,t.useEffect)(()=>{u.current?.update(i)},[...s]),(0,t.useEffect)(()=>{let e=u.current?.iframe;e&&l(e,o)})}var d=`oklch(0.97 0 0)`;function f({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:d,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 p({ref:r,renderToken:i,appearance:a,onValidityChange:o,onCardBrandChanged:s,additionalFields:c={cardholderName:!1},billingAddressRequirement:l=`country`,style:d,...f}){let p=(0,t.useRef)(null);return u({containerRef:p,iframeRef:r,mount:e.mountAmosCreditCardPaymentMethodForm,options:{renderToken:i,appearance:a,additionalFields:c,billingAddressRequirement:l,onValidityChange:o,onCardBrandChanged:s},remountDeps:[i,c.cardholderName,l],iframePassthrough:{style:d,...f},updateDeps:[a,c,l,o,s]}),(0,n.jsx)(`div`,{ref:p})}function m({ref:r,renderToken:i,appearance:a,onValidityChange:o,billingAddressRequirement:s=`country`,requireAchVerification:c=!1,intent:l=`payment`,style:d,...f}){let p=(0,t.useRef)(null);return u({containerRef:p,iframeRef:r,mount:e.mountAmosBankAccountPaymentMethodForm,options:{renderToken:i,appearance:a,billingAddressRequirement:s,requireAchVerification:c,intent:l,onValidityChange:o},remountDeps:[i,s,l],iframePassthrough:{style:d,...f},updateDeps:[a,s,c,l,o]}),(0,n.jsx)(`div`,{ref:p})}function h({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:d}){let p=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l?.style,buttonProps:c});return u({containerRef:p,iframeRef:r,mount:e.mountAmosGooglePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:d},remountDeps:[i],iframePassthrough:l??{},updateDeps:[a,o,s,c,d]}),(0,n.jsx)(f,{height:s,borderRadius:m,containerRef:p})}function g({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:d}){let p=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l?.style,buttonProps:c});return u({containerRef:p,iframeRef:r,mount:e.mountAmosApplePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:d},remountDeps:[i],iframePassthrough:l??{},updateDeps:[a,o,s,c,d]}),(0,n.jsx)(f,{height:s,borderRadius:m,containerRef:p})}exports.AmosApplePayButton=g,exports.AmosBankAccountPaymentMethodForm=m,exports.AmosCreditCardPaymentMethodForm=p,exports.AmosGooglePayButton=h,exports.confirmPayment=a,exports.confirmSetup=o,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]}})});
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:c={cardholderName:!1},billingAddressRequirement:l=`country`,defaultValues:u,style:f,...p}){let m=(0,t.useRef)(null);return d({containerRef:m,iframeRef:r,mount:e.mountAmosCreditCardPaymentMethodForm,options:{renderToken:i,appearance:a,additionalFields:c,billingAddressRequirement:l,defaultValues:u,onValidityChange:o,onCardBrandChanged:s},remountDeps:[i,c.cardholderName,l],iframePassthrough:{style:f,...p},updateDeps:[a,c,l,u,o,s]}),(0,n.jsx)(`div`,{ref:m})}function h({ref:r,renderToken:i,appearance:a,onValidityChange:o,billingAddressRequirement:s=`country`,defaultValues:c,requireAchVerification:l=!1,intent:u=`payment`,style:f,...p}){let m=(0,t.useRef)(null);return d({containerRef:m,iframeRef:r,mount:e.mountAmosBankAccountPaymentMethodForm,options:{renderToken:i,appearance:a,billingAddressRequirement:s,defaultValues:c,requireAchVerification:l,intent:u,onValidityChange:o},remountDeps:[i,s,u],iframePassthrough:{style:f,...p},updateDeps:[a,s,c,l,u,o]}),(0,n.jsx)(`div`,{ref:m})}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
@@ -1,57 +1,65 @@
1
- import { confirmPayment as e, confirmSetup as t, ensureSkeletonStyles as n, mountAmosApplePayButton as r, mountAmosBankAccountPaymentMethodForm as i, mountAmosCreditCardPaymentMethodForm as a, mountAmosGooglePayButton as o, resetForm as s, resolveWalletButtonSkeletonBorderRadius as c, validateForm as l } from "@amos.com/amos-js";
2
- import { useEffect as u, useLayoutEffect as d, useRef as f } from "react";
3
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
1
+ import { confirmPayment as e, confirmSetup as t, ensureSkeletonStyles as n, focusField as r, mountAmosApplePayButton as i, mountAmosBankAccountPaymentMethodForm as a, mountAmosCreditCardPaymentMethodForm as o, mountAmosGooglePayButton as s, resetForm as c, resolveWalletButtonSkeletonBorderRadius as l, validateForm as u } from "@amos.com/amos-js";
2
+ import { useEffect as d, useLayoutEffect as f, useRef as p } from "react";
3
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
4
4
  export * from "@amos.com/amos-js";
5
5
  //#region src/index.tsx
6
- function h(e) {
6
+ function g(e) {
7
7
  return e ? e.current ?? null : null;
8
8
  }
9
- function g({ iframeRef: e }) {
10
- return l({ iframe: h(e) });
9
+ function _({ iframeRef: e }) {
10
+ return u({ iframe: g(e) });
11
11
  }
12
- function _({ iframeRef: t, token: n }) {
12
+ function v({ iframeRef: t, token: n, defaultValues: r }) {
13
13
  return e({
14
- iframe: h(t),
15
- token: n
14
+ iframe: g(t),
15
+ token: n,
16
+ defaultValues: r
16
17
  });
17
18
  }
18
- function v({ iframeRef: e, token: n }) {
19
+ function y({ iframeRef: e, token: n, defaultValues: r }) {
19
20
  return t({
20
- iframe: h(e),
21
- token: n
21
+ iframe: g(e),
22
+ token: n,
23
+ defaultValues: r
22
24
  });
23
25
  }
24
- function y({ iframeRef: e }) {
25
- s({ iframe: h(e) });
26
+ function b({ iframeRef: e }) {
27
+ c({ iframe: g(e) });
26
28
  }
27
- function b(e, t) {
29
+ function x({ iframeRef: e, field: t }) {
30
+ r({
31
+ iframe: g(e),
32
+ field: t
33
+ });
34
+ }
35
+ function S(e, t) {
28
36
  typeof e == "function" ? e(t) : e && (e.current = t);
29
37
  }
30
- function x(e, { style: t, className: n, id: r, ...i }) {
38
+ function C(e, { style: t, className: n, id: r, ...i }) {
31
39
  n != null && (e.className = n), r != null && (e.id = r), Object.assign(e.style, t);
32
40
  for (let [t, n] of Object.entries(i)) n != null && (t in e ? Reflect.set(e, t, n) : e.setAttribute(t, String(n)));
33
41
  }
34
- function S({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i, iframePassthrough: a, updateDeps: o }) {
35
- let s = f(null);
36
- d(() => {
42
+ function w({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i, iframePassthrough: a, updateDeps: o }) {
43
+ let s = p(null);
44
+ f(() => {
37
45
  let i = e.current;
38
46
  if (!i) return;
39
47
  let o = n(i, r);
40
- return s.current = o, b(t, o.iframe), x(o.iframe, a), () => {
41
- o.destroy(), s.current = null, b(t, null);
48
+ return s.current = o, S(t, o.iframe), C(o.iframe, a), () => {
49
+ o.destroy(), s.current = null, S(t, null);
42
50
  };
43
- }, [...i]), u(() => {
51
+ }, [...i]), d(() => {
44
52
  s.current?.update(r);
45
- }, [...o]), u(() => {
53
+ }, [...o]), d(() => {
46
54
  let e = s.current?.iframe;
47
- e && x(e, a);
55
+ e && C(e, a);
48
56
  });
49
57
  }
50
- var C = "oklch(0.97 0 0)";
51
- function w({ height: e, borderRadius: t, containerRef: r }) {
52
- return d(() => {
58
+ var T = "oklch(0.97 0 0)";
59
+ function E({ height: e, borderRadius: t, containerRef: r }) {
60
+ return f(() => {
53
61
  n();
54
- }, []), /* @__PURE__ */ m("div", {
62
+ }, []), /* @__PURE__ */ h("div", {
55
63
  style: {
56
64
  boxSizing: "border-box",
57
65
  position: "relative",
@@ -60,19 +68,19 @@ function w({ height: e, borderRadius: t, containerRef: r }) {
60
68
  minHeight: e,
61
69
  overflow: "hidden"
62
70
  },
63
- children: [/* @__PURE__ */ p("div", {
71
+ children: [/* @__PURE__ */ m("div", {
64
72
  className: "amos-js-form-skeleton-input amos-js-wallet-skeleton",
65
73
  style: {
66
74
  position: "absolute",
67
75
  inset: 0,
68
76
  height: e,
69
77
  borderRadius: t,
70
- background: C,
78
+ background: T,
71
79
  pointerEvents: "none",
72
80
  zIndex: 0
73
81
  },
74
82
  "aria-hidden": !0
75
- }), /* @__PURE__ */ p("div", {
83
+ }), /* @__PURE__ */ m("div", {
76
84
  ref: r,
77
85
  style: {
78
86
  position: "absolute",
@@ -84,133 +92,137 @@ function w({ height: e, borderRadius: t, containerRef: r }) {
84
92
  })]
85
93
  });
86
94
  }
87
- function T({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onCardBrandChanged: i, additionalFields: o = { cardholderName: !1 }, billingAddressRequirement: s = "country", style: c, ...l }) {
88
- let u = f(null);
89
- return S({
90
- containerRef: u,
95
+ function D({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onCardBrandChanged: i, additionalFields: a = { cardholderName: !1 }, billingAddressRequirement: s = "country", defaultValues: c, style: l, ...u }) {
96
+ let d = p(null);
97
+ return w({
98
+ containerRef: d,
91
99
  iframeRef: e,
92
- mount: a,
100
+ mount: o,
93
101
  options: {
94
102
  renderToken: t,
95
103
  appearance: n,
96
- additionalFields: o,
104
+ additionalFields: a,
97
105
  billingAddressRequirement: s,
106
+ defaultValues: c,
98
107
  onValidityChange: r,
99
108
  onCardBrandChanged: i
100
109
  },
101
110
  remountDeps: [
102
111
  t,
103
- o.cardholderName,
112
+ a.cardholderName,
104
113
  s
105
114
  ],
106
115
  iframePassthrough: {
107
- style: c,
108
- ...l
116
+ style: l,
117
+ ...u
109
118
  },
110
119
  updateDeps: [
111
120
  n,
112
- o,
121
+ a,
113
122
  s,
123
+ c,
114
124
  r,
115
125
  i
116
126
  ]
117
- }), /* @__PURE__ */ p("div", { ref: u });
127
+ }), /* @__PURE__ */ m("div", { ref: d });
118
128
  }
119
- function E({ ref: e, renderToken: t, appearance: n, onValidityChange: r, billingAddressRequirement: a = "country", requireAchVerification: o = !1, intent: s = "payment", style: c, ...l }) {
120
- let u = f(null);
121
- return S({
122
- containerRef: u,
129
+ function O({ ref: e, renderToken: t, appearance: n, onValidityChange: r, billingAddressRequirement: i = "country", defaultValues: o, requireAchVerification: s = !1, intent: c = "payment", style: l, ...u }) {
130
+ let d = p(null);
131
+ return w({
132
+ containerRef: d,
123
133
  iframeRef: e,
124
- mount: i,
134
+ mount: a,
125
135
  options: {
126
136
  renderToken: t,
127
137
  appearance: n,
128
- billingAddressRequirement: a,
129
- requireAchVerification: o,
130
- intent: s,
138
+ billingAddressRequirement: i,
139
+ defaultValues: o,
140
+ requireAchVerification: s,
141
+ intent: c,
131
142
  onValidityChange: r
132
143
  },
133
144
  remountDeps: [
134
145
  t,
135
- a,
136
- s
146
+ i,
147
+ c
137
148
  ],
138
149
  iframePassthrough: {
139
- style: c,
140
- ...l
150
+ style: l,
151
+ ...u
141
152
  },
142
153
  updateDeps: [
143
154
  n,
144
- a,
155
+ i,
145
156
  o,
146
157
  s,
158
+ c,
147
159
  r
148
160
  ]
149
- }), /* @__PURE__ */ p("div", { ref: u });
161
+ }), /* @__PURE__ */ m("div", { ref: d });
150
162
  }
151
- function D({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48px", buttonProps: a, iframeProps: s, onConfirm: l }) {
152
- let u = f(null), d = c({
153
- iframeStyle: s?.style,
163
+ function k({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48px", buttonProps: a, iframeProps: o, onConfirm: c }) {
164
+ let u = p(null), d = l({
165
+ iframeStyle: o?.style,
154
166
  buttonProps: a
155
167
  });
156
- return S({
168
+ return w({
157
169
  containerRef: u,
158
170
  iframeRef: e,
159
- mount: o,
171
+ mount: s,
160
172
  options: {
161
173
  renderToken: t,
162
174
  amount: n,
163
175
  merchantName: r,
164
176
  height: i,
165
177
  buttonProps: a,
166
- onConfirm: l
178
+ onConfirm: c
167
179
  },
168
180
  remountDeps: [t],
169
- iframePassthrough: s ?? {},
181
+ iframePassthrough: o ?? {},
170
182
  updateDeps: [
171
183
  n,
172
184
  r,
173
185
  i,
174
186
  a,
175
- l
187
+ c
176
188
  ]
177
- }), /* @__PURE__ */ p(w, {
189
+ }), /* @__PURE__ */ m(E, {
178
190
  height: i,
179
191
  borderRadius: d,
180
192
  containerRef: u
181
193
  });
182
194
  }
183
- function O({ ref: e, renderToken: t, amount: n, merchantName: i, height: a = "48px", buttonProps: o, iframeProps: s, onConfirm: l }) {
184
- let u = f(null), d = c({
195
+ function A({ ref: e, renderToken: t, amount: n, merchantName: r, height: a = "48px", buttonProps: o, iframeProps: s, onConfirm: c }) {
196
+ let u = p(null), d = l({
185
197
  iframeStyle: s?.style,
186
198
  buttonProps: o
187
199
  });
188
- return S({
200
+ return w({
189
201
  containerRef: u,
190
202
  iframeRef: e,
191
- mount: r,
203
+ mount: i,
192
204
  options: {
193
205
  renderToken: t,
194
206
  amount: n,
195
- merchantName: i,
207
+ merchantName: r,
196
208
  height: a,
197
209
  buttonProps: o,
198
- onConfirm: l
210
+ onConfirm: c
199
211
  },
200
212
  remountDeps: [t],
201
213
  iframePassthrough: s ?? {},
202
214
  updateDeps: [
203
215
  n,
204
- i,
216
+ r,
205
217
  a,
206
218
  o,
207
- l
219
+ c
208
220
  ]
209
- }), /* @__PURE__ */ p(w, {
221
+ }), /* @__PURE__ */ m(E, {
210
222
  height: a,
211
223
  borderRadius: d,
212
224
  containerRef: u
213
225
  });
214
226
  }
215
227
  //#endregion
216
- export { O as AmosApplePayButton, E as AmosBankAccountPaymentMethodForm, T as AmosCreditCardPaymentMethodForm, D as AmosGooglePayButton, _ as confirmPayment, v as confirmSetup, y as resetForm, g as validateForm };
228
+ export { A as AmosApplePayButton, O as AmosBankAccountPaymentMethodForm, D as AmosCreditCardPaymentMethodForm, k as AmosGooglePayButton, v as confirmPayment, y as confirmSetup, x as focusField, b as resetForm, _ as validateForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/react-amos-js",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "vite-plugin-dts": "5.0.3"
49
49
  },
50
50
  "dependencies": {
51
- "@amos.com/amos-js": "0.11.4",
51
+ "@amos.com/amos-js": "0.11.6",
52
52
  "@types/googlepay": "0.7.12"
53
53
  },
54
54
  "peerDependencies": {
package/src/index.tsx CHANGED
@@ -5,10 +5,12 @@ import {
5
5
  type ApplePayButtonElementProps,
6
6
  confirmPayment as amosConfirmPayment,
7
7
  confirmSetup as amosConfirmSetup,
8
+ focusField as amosFocusField,
8
9
  resetForm as amosResetForm,
9
10
  validateForm as amosValidateForm,
10
11
  type BillingAddressRequirement,
11
- type ConfirmResult,
12
+ type ConfirmPaymentResult,
13
+ type ConfirmSetupResult,
12
14
  type CreditCardAdditionalFields,
13
15
  ensureSkeletonStyles,
14
16
  type GooglePayButtonElementProps,
@@ -16,6 +18,8 @@ import {
16
18
  mountAmosBankAccountPaymentMethodForm,
17
19
  mountAmosCreditCardPaymentMethodForm,
18
20
  mountAmosGooglePayButton,
21
+ type PaymentMethodFormDefaultValues,
22
+ type PaymentMethodFormField,
19
23
  resolveWalletButtonSkeletonBorderRadius,
20
24
  } from "@amos.com/amos-js";
21
25
  import type { components } from "@amos.com/node";
@@ -63,13 +67,19 @@ export function validateForm({
63
67
  export function confirmPayment({
64
68
  iframeRef,
65
69
  token,
70
+ defaultValues,
66
71
  }: {
67
72
  iframeRef: IframeRef;
73
+ defaultValues?: PaymentMethodFormDefaultValues;
68
74
  } & Pick<
69
75
  components["schemas"]["EmbedToken"],
70
76
  "token"
71
- >): Promise<ConfirmResult> {
72
- return amosConfirmPayment({ iframe: resolveIframe(iframeRef), token });
77
+ >): Promise<ConfirmPaymentResult> {
78
+ return amosConfirmPayment({
79
+ iframe: resolveIframe(iframeRef),
80
+ token,
81
+ defaultValues,
82
+ });
73
83
  }
74
84
 
75
85
  /**
@@ -82,13 +92,19 @@ export function confirmPayment({
82
92
  export function confirmSetup({
83
93
  iframeRef,
84
94
  token,
95
+ defaultValues,
85
96
  }: {
86
97
  iframeRef: IframeRef;
98
+ defaultValues?: PaymentMethodFormDefaultValues;
87
99
  } & Pick<
88
100
  components["schemas"]["EmbedToken"],
89
101
  "token"
90
- >): Promise<ConfirmResult> {
91
- return amosConfirmSetup({ iframe: resolveIframe(iframeRef), token });
102
+ >): Promise<ConfirmSetupResult> {
103
+ return amosConfirmSetup({
104
+ iframe: resolveIframe(iframeRef),
105
+ token,
106
+ defaultValues,
107
+ });
92
108
  }
93
109
 
94
110
  /**
@@ -99,6 +115,21 @@ export function resetForm({ iframeRef }: { iframeRef: IframeRef }): void {
99
115
  amosResetForm({ iframe: resolveIframe(iframeRef) });
100
116
  }
101
117
 
118
+ /**
119
+ * Focus a named control inside the embedded card/bank iframe. No-op if
120
+ * the field is not rendered, or while Plaid Embedded Institution Search
121
+ * is showing. Call from a click or keydown handler.
122
+ */
123
+ export function focusField({
124
+ iframeRef,
125
+ field,
126
+ }: {
127
+ iframeRef: IframeRef;
128
+ field: PaymentMethodFormField;
129
+ }): void {
130
+ amosFocusField({ iframe: resolveIframe(iframeRef), field });
131
+ }
132
+
102
133
  type ForwardedIframeRef = Ref<HTMLIFrameElement> | undefined;
103
134
 
104
135
  function setForwardedRef(
@@ -275,6 +306,12 @@ type AmosCreditCardPaymentMethodFormProps = IframePassthroughProps & {
275
306
  }) => void;
276
307
  additionalFields?: CreditCardAdditionalFields;
277
308
  billingAddressRequirement?: BillingAddressRequirement;
309
+ /**
310
+ * Seed cardholder name and billing address. Provided keys overwrite
311
+ * matching fields, including ones the customer already edited. Values
312
+ * are sent on confirm even when those inputs are hidden.
313
+ */
314
+ defaultValues?: PaymentMethodFormDefaultValues;
278
315
  };
279
316
 
280
317
  export function AmosCreditCardPaymentMethodForm({
@@ -285,6 +322,7 @@ export function AmosCreditCardPaymentMethodForm({
285
322
  onCardBrandChanged,
286
323
  additionalFields = { cardholderName: false },
287
324
  billingAddressRequirement = "country",
325
+ defaultValues,
288
326
  style,
289
327
  ...rest
290
328
  }: AmosCreditCardPaymentMethodFormProps) {
@@ -299,6 +337,7 @@ export function AmosCreditCardPaymentMethodForm({
299
337
  appearance,
300
338
  additionalFields,
301
339
  billingAddressRequirement,
340
+ defaultValues,
302
341
  onValidityChange,
303
342
  onCardBrandChanged,
304
343
  },
@@ -312,6 +351,7 @@ export function AmosCreditCardPaymentMethodForm({
312
351
  appearance,
313
352
  additionalFields,
314
353
  billingAddressRequirement,
354
+ defaultValues,
315
355
  onValidityChange,
316
356
  onCardBrandChanged,
317
357
  ],
@@ -330,6 +370,12 @@ type AmosBankAccountPaymentMethodFormProps = IframePassthroughProps & {
330
370
  */
331
371
  onValidityChange?: (event: { isValid: boolean }) => void;
332
372
  billingAddressRequirement?: BillingAddressRequirement;
373
+ /**
374
+ * Seed account holder name and billing address. Provided keys
375
+ * overwrite matching fields, including ones the customer already
376
+ * edited.
377
+ */
378
+ defaultValues?: PaymentMethodFormDefaultValues;
333
379
  /**
334
380
  * When true, hide the routing/account iframe and mount Plaid Embedded
335
381
  * Institution Search in the parent. Ignored when `intent` is `"setup"`
@@ -355,6 +401,7 @@ export function AmosBankAccountPaymentMethodForm({
355
401
  appearance,
356
402
  onValidityChange,
357
403
  billingAddressRequirement = "country",
404
+ defaultValues,
358
405
  requireAchVerification = false,
359
406
  intent = "payment",
360
407
  style,
@@ -370,6 +417,7 @@ export function AmosBankAccountPaymentMethodForm({
370
417
  renderToken,
371
418
  appearance,
372
419
  billingAddressRequirement,
420
+ defaultValues,
373
421
  requireAchVerification,
374
422
  intent,
375
423
  onValidityChange,
@@ -379,6 +427,7 @@ export function AmosBankAccountPaymentMethodForm({
379
427
  updateDeps: [
380
428
  appearance,
381
429
  billingAddressRequirement,
430
+ defaultValues,
382
431
  requireAchVerification,
383
432
  intent,
384
433
  onValidityChange,
@@ -423,8 +472,8 @@ type AmosGooglePayButtonProps = {
423
472
  }: {
424
473
  paymentIntentCreateAttributes: components["schemas"]["CreatePaymentIntentInput"];
425
474
  customerCreateAttributes: components["schemas"]["CreateCustomerInput"];
426
- confirmPayment: (token: string) => Promise<ConfirmResult>;
427
- }) => Promise<ConfirmResult>;
475
+ confirmPayment: (token: string) => Promise<ConfirmPaymentResult>;
476
+ }) => Promise<ConfirmPaymentResult>;
428
477
  };
429
478
 
430
479
  /**
@@ -509,8 +558,8 @@ type AmosApplePayButtonProps = {
509
558
  }: {
510
559
  paymentIntentCreateAttributes: components["schemas"]["CreatePaymentIntentInput"];
511
560
  customerCreateAttributes: components["schemas"]["CreateCustomerInput"];
512
- confirmPayment: (token: string) => Promise<ConfirmResult>;
513
- }) => Promise<ConfirmResult>;
561
+ confirmPayment: (token: string) => Promise<ConfirmPaymentResult>;
562
+ }) => Promise<ConfirmPaymentResult>;
514
563
  };
515
564
 
516
565
  /**