@flopay/react 1.1.4 → 1.1.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
@@ -115,7 +115,7 @@ Use this code to create or request a fresh checkout session, then send the custo
115
115
  Use `FloPayAutomaticPaymentButton` when you want a single reusable button that:
116
116
 
117
117
  - creates an `auto` checkout session inline or reuses an existing `sessionId`
118
- - processes the saved payment method on click
118
+ - lets the backend resolve and charge the customer's most recently vaulted payment method (across providers)
119
119
  - shows the shared processing / success / failure modal
120
120
  - emits the same success and decline events without rendering a full checkout form
121
121
 
@@ -124,7 +124,9 @@ The button accepts either:
124
124
  - `sessionId`
125
125
  - or the same session-creation props you would normally post to the backend: `clientId`, `items`, `subscriptions`, `account`, `successUrl`, `cancelUrl`, `couponCodes`, `tagsData`, `utmMetadata`
126
126
 
127
- It also reuses the buttons-layout theme props (`buttonsTheme`, `buttonsStyles`) and handles saved-payment auth flows such as 3DS and PayPal redirects.
127
+ It accepts the same `theme` prop as `FloPayCheckout` and `SplitCardForm` (see [Theming](#theming) below) the value is forwarded to the fallback `FloPayCheckout` modal so the entire flow stays visually consistent. When the saved-payment charge can't complete silently, the button opens the standard `FloPayCheckout` inline with the same theme already applied.
128
+
129
+ > **Removed in this version**: the legacy `paymentMethodId` and `checkoutMethod` props are now `@deprecated` and silently ignored. The backend's auto-checkout (`createSingle`) looks up the customer's latest vaulted payment method via `getLatestByUserId` and rebinds the session's gateway to match, so the SDK no longer hand-picks a PM or a provider. Existing integrations that still pass these props continue to work — they have no effect.
128
130
 
129
131
  ```tsx
130
132
  import { FloPayAutomaticPaymentButton } from '@flopay/react';
@@ -146,7 +148,7 @@ function UpsellButton() {
146
148
  ]}
147
149
  successUrl={`${window.location.origin}/success`}
148
150
  cancelUrl={`${window.location.origin}/success`}
149
- buttonsTheme="dark"
151
+ theme="bold-dark"
150
152
  onClick={() => {
151
153
  window.dataLayer?.push({ event: 'automatic_payment_button_click' });
152
154
  }}
@@ -184,6 +186,40 @@ Apple Pay, Google Pay, and PayPal are enabled by default. Toggle them with props
184
186
 
185
187
  Apple Pay and Google Pay only render on supported devices (Apple Pay on Safari/macOS/iOS, Google Pay on Chrome).
186
188
 
189
+ #### Theming
190
+
191
+ `FloPayCheckout`, `FloPayAutomaticPaymentButton`, and `SplitCardForm` accept a single `theme` prop that maps to a coherent `{appearance, buttonsLayout}` bundle in `@flopay/shared`'s `THEMES` map. One value styles the Stripe-side appearance, the React-rendered wrapper, the submit button, the inputs, and — for `FloPayAutomaticPaymentButton` — the fallback modal that opens when a saved-payment charge can't complete silently.
192
+
193
+ | `theme` | Aesthetic |
194
+ |---|---|
195
+ | `'classic'` | Historic FloPay look (no bundle applied — `#EDEDFF` wrapper, indigo submit). |
196
+ | `'modern-light'` / `'modern-dark'` | Clean & airy, Inter, soft shadows, FloPay-blue accents. |
197
+ | `'bold-light'` / `'bold-dark'` | Saturated FloPay blue with gradient pill submit and heavy borders. |
198
+ | `'glass-light'` / `'glass-dark'` | Translucent surfaces with backdrop blur over a blue gradient. |
199
+
200
+ ```tsx
201
+ <FloPayCheckout
202
+ sessionId="sess_abc123"
203
+ theme="bold-dark"
204
+ onComplete={handleSuccess}
205
+ />
206
+
207
+ <FloPayAutomaticPaymentButton
208
+ sessionId="sess_abc123"
209
+ theme="bold-dark" // applied to the button AND the fallback modal
210
+ onSuccess={handleSuccess}
211
+ />
212
+ ```
213
+
214
+ `appearance` (Stripe-side overrides) and `buttonsStyles` (per-field wrapper overrides) still work — both win over the resolved bundle for the fields they touch, so you can layer customizations on top of a theme:
215
+
216
+ ```tsx
217
+ <FloPayCheckout
218
+ theme="modern-light"
219
+ buttonsStyles={{ submitButton: { backgroundColor: '#FF0099' } }} // wins
220
+ />
221
+ ```
222
+
187
223
  #### Buttons Layout
188
224
 
189
225
  Switch from the default form layout to stacked payment buttons with an expandable card form:
@@ -192,19 +228,13 @@ Switch from the default form layout to stacked payment buttons with an expandabl
192
228
  <FloPayCheckout
193
229
  sessionId="sess_abc123"
194
230
  layout="buttons"
195
- buttonsTheme="dark"
196
- buttonsStyles={{
197
- cardInputColor: '#f9fafb',
198
- cardInputPlaceholderColor: '#6b7280',
199
- cardInputBackground: '#1f2937',
200
- submitButtonFontSize: '0.9rem',
201
- }}
231
+ theme="bold-dark"
202
232
  onButtonClick={(method) => console.log('clicked:', method)}
203
233
  onComplete={handleSuccess}
204
234
  />
205
235
  ```
206
236
 
207
- Theme presets: `'default'`, `'minimal'`, `'rounded'`, `'dark'`. Custom styles via `buttonsStyles` merge on top of the theme preset. See the [ButtonsLayoutStyles reference](https://docs.flopay.com/api-reference/react/flopay-checkout#buttonslayoutstyles-reference) for all properties.
237
+ > **Deprecated**: the legacy `buttonsTheme` prop (`'default'` / `'minimal'` / `'rounded'` / `'dark'`) still works but new code should use `theme` so the same value drives both the buttons-layout wrapper and the auto-payment fallback. See [ButtonsLayoutStyles reference](https://docs.flopay.com/api-reference/react/flopay-checkout#buttonslayoutstyles-reference) for the underlying override fields.
208
238
 
209
239
  #### Button Hooks
210
240