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

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 +6 -2
  2. package/package.json +7 -7
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`). 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.
43
- 3. **User clicks "Pay now" button**: call `validateForm({ iframeRef })`, which returns `Promise<true>` if the embedded form is valid and `Promise<false>` otherwise.
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.
163
+
162
164
  ```tsx
163
165
  import { useRef, useState } from "react";
164
166
  import {
@@ -480,6 +482,8 @@ Renders the secure credit card iframe form. A field-shaped skeleton is shown imm
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.
482
484
 
485
+ 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.
486
+
483
487
  **Also accepts:** standard iframe props (`React.ComponentProps<"iframe">`), minus `src`, `title`, `name`, and `role` (which are controlled by the SDK).
484
488
 
485
489
  ### `AmosBankAccountPaymentMethodForm`
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@amos.com/react-amos-js",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/amos/react-amos-js"
7
+ "url": "git+https://github.com/amos/react-amos-js.git"
8
8
  },
9
9
  "module": "dist/index.mjs",
10
10
  "types": "dist/index.d.ts",
@@ -37,10 +37,10 @@
37
37
  "license": "MIT",
38
38
  "description": "React SDK for embedding Amos payment methods via iframes. Wraps @amos.com/amos-js.",
39
39
  "devDependencies": {
40
- "@amos.com/node": "0.1.53",
41
- "@biomejs/biome": "2.5.10",
40
+ "@amos.com/node": "0.1.57",
41
+ "@biomejs/biome": "2.5.11",
42
42
  "@changesets/cli": "2.31.1",
43
- "@types/node": "26.3.0",
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,11 +48,11 @@
48
48
  "vite-plugin-dts": "5.0.3"
49
49
  },
50
50
  "dependencies": {
51
- "@amos.com/amos-js": "0.11.6",
51
+ "@amos.com/amos-js": "0.11.9",
52
52
  "@types/googlepay": "0.7.12"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": "^17 || ^18 || ^19",
56
- "@amos.com/node": ">=0.1.53"
56
+ "@amos.com/node": ">=0.1.57"
57
57
  }
58
58
  }