@amos.com/react-amos-js 0.11.20 → 0.11.21

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 (2) hide show
  1. package/README.md +9 -9
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -60,8 +60,8 @@ The key differences between the express and non-express payment flows are:
60
60
 
61
61
  Setup intents are used to save payment methods for future use (e.g. recurring payments, subscriptions) without charging the customer immediately. The flow is identical to a payment intent, except:
62
62
 
63
- - On the server, call `POST /setup_intents` instead of `POST /payment_intents`.
64
- - On the client, `await confirmSetup({ iframeRef, token })` instead of `confirmPayment({ iframeRef, token })`.
63
+ - On the server, call `POST /setup_intents` instead of `POST /payment_intents`. Setup intents are organization-scoped (`X-Account-Id` is ignored if sent). The embed JWT carries `organization_id` + `setup_intent_id` (`account_id` is null). Payment-intent tokens remain account-scoped (`account_id` + `payment_intent_id`).
64
+ - On the client, `await confirmSetup({ iframeRef, token })` instead of `confirmPayment({ iframeRef, token })`. `confirmSetup` reads `setup_intent_id` from the JWT; it does not need `account_id`.
65
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).
@@ -141,7 +141,7 @@ appearance={{
141
141
 
142
142
  Rules override `themeVariables` for the properties they set (Stripe). `--input-height` / `--floating-input-height` are a **minimum**; `.Input` `padding`, `fontSize`, and `lineHeight` can grow the field. Rule values may reference allowlisted tokens as `var(--primary)` (no fallback argument).
143
143
 
144
- The host skeleton (shown until `UPDATED_APPEARANCE`, or 1.5s after `IFRAME_READY` if appearance never acks) copies `themeVariables` and resting **`.Input` / `.Label`** declarations (the same allowlisted properties as iframe rules). It does not inject webfonts: it uses `--font-family` / `fontFamily` when that face is already on the host page, and falls back to `ui-sans-serif, system-ui, sans-serif`. Hover, invalid, placeholder, dropdown, and radio rules have no skeleton equivalent. Floating labels sit inside the control, so `.Label` / `.Label--floating` do not change skeleton height.
144
+ The host skeleton (shown until `UPDATED_APPEARANCE`, or 1.5s after `IFRAME_READY` if appearance never acks) copies `themeVariables` and resting **`.Input` / `.Label`** declarations (the same allowlisted properties as iframe rules). It covers a visible iframe (`opacity: 1`) so WebKit still runs iframe JS. It does not inject webfonts: it uses `--font-family` / `fontFamily` when that face is already on the host page, and falls back to `ui-sans-serif, system-ui, sans-serif`. Hover, invalid, placeholder, dropdown, and radio rules have no skeleton equivalent. Floating labels sit inside the control, so `.Label` / `.Label--floating` do not change skeleton height.
145
145
 
146
146
  | Selector | Targets |
147
147
  | --- | --- |
@@ -560,7 +560,7 @@ Focus a named control inside the card or bank iframe. No-op if the field is not
560
560
 
561
561
  ### `AmosCreditCardPaymentMethodForm`
562
562
 
563
- Renders the secure credit card iframe form. A field-shaped skeleton is shown immediately (sized from `appearance`, including resting `.Input` / `.Label` rules) and replaced by the iframe once appearance is applied.
563
+ Renders the secure credit card iframe form. A field-shaped skeleton covers a visible iframe immediately (sized from `appearance`, including resting `.Input` / `.Label` rules) and is removed once appearance is applied, or 1.5s after `IFRAME_READY` if appearance never acks.
564
564
 
565
565
  **Required props:**
566
566
 
@@ -583,7 +583,7 @@ Enter in a card or bank iframe field submits the enclosing host `<form>` via `re
583
583
 
584
584
  ### `AmosBankAccountPaymentMethodForm`
585
585
 
586
- Renders the secure bank account iframe form. A field-shaped skeleton is shown immediately (sized from `appearance`, including resting `.Input` / `.Label` rules) and replaced by the iframe once appearance is applied.
586
+ Renders the secure bank account iframe form. A field-shaped skeleton covers a visible iframe immediately (sized from `appearance`, including resting `.Input` / `.Label` rules) and is removed once appearance is applied, or 1.5s after `IFRAME_READY` if appearance never acks.
587
587
 
588
588
  When `requireAchVerification` is true (or `intent` is `"setup"`), and the render token allows verification, the SDK hides the routing/account iframe and mounts [Plaid Embedded Institution Search](https://plaid.com/docs/link/embedded-institution-search/) in the parent. A **350px pulse skeleton** covers that slot until Plaid's `onLoad` (1.5s fallback). Do not overlay a host loader. Hosts do not proxy Pay API (`GET /merchants`, `POST /plaid_link_tokens`); embed does that with `PAY_API_KEY`. Do not put Plaid secrets in the browser.
589
589
 
@@ -618,7 +618,7 @@ Setup (always Plaid, unless the render token disables verification):
618
618
 
619
619
  ### `AmosGooglePayButton`
620
620
 
621
- Renders the secure Google Pay iframe button (express checkout flow). A button-shaped skeleton is shown immediately and replaced by the iframe once appearance is applied.
621
+ Renders the secure Google Pay iframe button (express checkout flow). A button-shaped skeleton covers a visible iframe immediately and is removed once appearance is applied, or 1.5s after `IFRAME_READY` if appearance never acks.
622
622
 
623
623
  **Required props:**
624
624
 
@@ -645,7 +645,7 @@ Renders the secure Google Pay iframe button (express checkout flow). A button-sh
645
645
 
646
646
  ### `AmosApplePayButton`
647
647
 
648
- Renders the secure Apple Pay iframe button (express checkout flow). Same required props and callbacks as `AmosGooglePayButton`. A button-shaped skeleton is shown immediately and replaced by the iframe once appearance is applied.
648
+ Renders the secure Apple Pay iframe button (express checkout flow). Same required props and callbacks as `AmosGooglePayButton`. A button-shaped skeleton covers a visible iframe immediately and is removed once appearance is applied, or 1.5s after `IFRAME_READY` if appearance never acks.
649
649
 
650
650
  **Optional props:**
651
651
 
@@ -687,7 +687,7 @@ Re-exports of the same advanced helpers exposed by `@amos.com/amos-js`. Most int
687
687
 
688
688
  Re-exports from `@amos.com/amos-js`. Build the iframe `src` URL for each form type. The React components call these for you.
689
689
 
690
- Each URL includes the embed's canonical search params (`token`, `additionalFields`, `billingAddressRequirement`, `intent`) so the embed router does not 307 to fill in defaults. After the iframe `load` event, if `IFRAME_READY` never arrives (stale HTML, missing JS chunk), the SDK rewrites `src` once with `amosReload` so the next document is a real navigation. Appearance is applied after handshake via `UPDATE_APPEARANCE` (the iframe stays hidden until then, or for 1.5s after `IFRAME_READY` if appearance never acks).
690
+ Each URL includes the embed's canonical search params (`token`, `additionalFields`, `billingAddressRequirement`, `intent`) so the embed router does not 307 to fill in defaults. After the iframe `load` event, if `IFRAME_READY` never arrives (stale HTML, missing JS chunk), the SDK rewrites `src` once with `amosReload` so the next document is a real navigation. Appearance is applied after handshake via `UPDATE_APPEARANCE`. A host-page skeleton covers the visible iframe until then, or for 1.5s after `IFRAME_READY` if appearance never acks.
691
691
 
692
692
  ### `updateDefaultValues({ iframe, defaultValues })`
693
693
 
@@ -708,7 +708,7 @@ Re-export from `@amos.com/amos-js`. Fills omitted Inter `fonts` / `--font-family
708
708
  - **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`).
709
709
  - **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`).
710
710
  - **Embed host / CSP**: iframes load from `https://js.amos.com` (production) and `https://js-sandbox.amos.com` (sandbox) via `getEmbedOrigin`. Parent pages that pin CSP must allow `frame-src https://js.amos.com https://js-sandbox.amos.com` (and `Permissions-Policy payment=` for those origins) **before** upgrading this package. Older SDK versions still load `embed.amos.com` / `embed-sandbox.amos.com`.
711
- - **Iframe handshake**: iframe URLs include canonical search params so the embed does not 307. If the document loads but never posts `IFRAME_READY`, the SDK rewrites `src` once with `amosReload`. Appearance is applied after handshake; the iframe stays hidden until `UPDATED_APPEARANCE`, or for 1.5s after `IFRAME_READY` if appearance never acks.
711
+ - **Iframe handshake**: iframe URLs include canonical search params so the embed does not 307. If the document loads but never posts `IFRAME_READY`, the SDK rewrites `src` once with `amosReload`. Appearance is applied after handshake. The iframe stays visible under the skeleton until `UPDATED_APPEARANCE`, or for 1.5s after `IFRAME_READY` if appearance never acks. Embed messages match on origin plus `iframeName` when `contentWindow` identity changes.
712
712
  - **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. Toggling that prop hides or shows the existing Embedded handler — it does not reload Institution Search. Confirm still goes through the bank iframe so Amos can attach `plaid` to the payment method. While Link loads, the SDK shows a 350px pulse skeleton until `onLoad` (1.5s fallback) — do not overlay a host loader.
713
713
  - **Apple Pay waiting overlay**: on browsers where Apple's QR handoff opens in a popup (non-Safari), `AmosApplePayButton` shows a fixed full-viewport overlay on the host page. **Cancel payment** is available until the buyer authorizes; after that the overlay shows **Completing your payment…** with no Cancel, then hides when `onConfirm` settles. Avoid stacking other fixed UI above it.
714
714
  - **Going framework-free**: if you need to use Amos outside of React (vanilla JS, another framework, etc.), use [`@amos.com/amos-js`](../amos-js) directly.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/react-amos-js",
3
- "version": "0.11.20",
3
+ "version": "0.11.21",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "description": "React SDK for embedding Amos payment methods via iframes. Wraps @amos.com/amos-js.",
48
48
  "devDependencies": {
49
- "@amos.com/node": "0.1.57",
49
+ "@amos.com/node": "0.1.61",
50
50
  "@biomejs/biome": "2.5.11",
51
51
  "@changesets/cli": "2.31.1",
52
52
  "@types/node": "26.4.0",
@@ -57,11 +57,11 @@
57
57
  "vite-plugin-dts": "5.0.3"
58
58
  },
59
59
  "dependencies": {
60
- "@amos.com/amos-js": "0.11.21",
60
+ "@amos.com/amos-js": "0.11.23",
61
61
  "@types/googlepay": "0.7.12"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "react": "^17 || ^18 || ^19",
65
- "@amos.com/node": ">=0.1.57"
65
+ "@amos.com/node": ">=0.1.61"
66
66
  }
67
67
  }