@flopay/shared 1.18.1 → 1.19.0

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
@@ -182,11 +182,13 @@ try {
182
182
  | `ThemeBundle` | A coherent theme bundle: `{ appearance: FloPayAppearance, buttonsLayout: ButtonsLayoutStyles }` |
183
183
  | `ThemeBundleId` | Bundle id: `'modern-light'` / `'modern-dark'` / `'bold-light'` / `'bold-dark'` / `'glass-light'` / `'glass-dark'` |
184
184
  | `ThemeId` | Accepted by the React components' `theme` prop: `'classic'` or any `ThemeBundleId` |
185
- | `VaultCardThemeColors` | Theme directive sent to the hosted card form: the flat keys every hosted form understands (`primaryColor`, `primaryHoverColor`, `inputBackgroundColor`, `textColor`, `borderColor`, `placeholderColor`, `errorColor`, `successColor`, `fontFamily`, `fontSize`, `fontWeight`, `borderRadius`) plus the optional `submitButton` snapshot. Partial objects stay valid and are forwarded unchanged. |
185
+ | `VaultCardThemeColors` | Theme directive sent to the hosted card form: the flat keys every hosted form understands (`primaryColor`, `primaryHoverColor`, `inputBackgroundColor`, `textColor`, `borderColor`, `placeholderColor`, `errorColor`, `successColor`, `fontFamily`, `fontSize`, `fontWeight`, `borderRadius`) plus the optional `submitButton` snapshot and the optional `labels` style (a `VaultLabelTheme`, present only when `appearance.rules['.Label']` sets a supported property). Partial objects stay valid and are forwarded unchanged. |
186
+ | `CardFieldLabels` | Text for the visible labels above the hosted card fields: optional `number`, `expiry`, `cvv` and `name`. The hosted form shows the text literally. |
187
+ | `VaultLabelTheme` | Label style in the hosted card form's theme: `color`, `fontSize` (px), `fontWeight`, `letterSpacing` (em), `textTransform` (`none` / `uppercase` / `lowercase` / `capitalize`) and `gap` (px between the label and its field), all optional |
186
188
  | `ExternalMethodFailureDetails` | Optional bounded diagnostics for an external-method failure: sanitized provider code, popup-block status, normalized browser family, mount-lifetime popup capability, and presentation mode |
187
189
  | `VaultSubmitButtonTheme` | Complete, bounded snapshot for the hosted submit control (billing API v1.9.6+): `foregroundColor`, `background` / `hoverBackground` / `disabledBackground` (`VaultSubmitBackground`), `typography` (`VaultSubmitTypography`), `spacing` (`VaultSubmitSpacing`), `shadow` (zero to four `VaultShadowLayer` values), `borderRadius`, `disabledOpacity`, `backdropBlur`. Structured values only, never raw CSS: the hosted form ignores an invalid or out-of-range member, and theme input never blocks capture. |
188
190
  | `VaultSubmitBackground` | `VaultSolidBackground` (`{ type: 'solid', color }`) or `VaultLinearGradientBackground` (`{ type: 'linearGradient', angle, stops }` with two to five `VaultGradientStop` values in non-decreasing order). Colors are `VaultThemeColor`: `#RRGGBB`, integer-channel `rgb()`, or `rgba()` with alpha `0..1`. |
189
- | `CardCaptureAdapter` | Hosted card-capture abstraction the React card surfaces depend on: `mount()`, `on()`, `unmount()`, plus the optional live controls `applyTheme(theme \| null)` (`null` is the explicit classic reset), `setSubmitGate()`, `setCardFieldOrder()`, `setCardBrandIcons(show)` (shows the Visa, Mastercard, Amex and Discover icons in the hosted card number field; off by default, retained and replayed on every `'ready'` event), `setCardFieldPlaceholders(placeholders)` (a `CardFieldPlaceholders` object, see below; only the fields given are sent and `''` shows no placeholder; `undefined` sends nothing; retained and replayed on every `'ready'` event, and posted only to the exact `VaultCaptureBlock.expectedOrigin` with its `VaultCaptureBlock.messageToken`), and `setSubmitLabel(label \| null)` (hosted submit wording, billing API v1.9.35+; `null` resets to the session default, `CONFIRM PAYMENT` or `ADD CARD`; retained and replayed on every `'ready'` event, and posted only to the exact `VaultCaptureBlock.expectedOrigin` with its `VaultCaptureBlock.messageToken`). `CardCaptureMountOptions.submitLabel` sets the initial wording. |
191
+ | `CardCaptureAdapter` | Hosted card-capture abstraction the React card surfaces depend on: `mount()`, `on()`, `unmount()`, plus the optional live controls `applyTheme(theme \| null)` (`null` is the explicit classic reset), `setSubmitGate()`, `setCardFieldOrder()`, `setCardBrandIcons(show)` (shows the Visa, Mastercard, Amex and Discover icons in the hosted card number field; off by default, retained and replayed on every `'ready'` event), `setShowCardFieldLabels(show)` and `setCardFieldLabels(labels \| null)` (show the visible labels above the hosted card fields and replace their text with a `CardFieldLabels`; only the string fields that were set are sent, `null` clears the text, nothing is sent until the host calls either, and the latest settings are retained and replayed on every `'ready'` event), `setCardFieldPlaceholders(placeholders)` (a `CardFieldPlaceholders` object, see below; only the fields given are sent and `''` shows no placeholder; `undefined` sends nothing; retained and replayed on every `'ready'` event, and posted only to the exact `VaultCaptureBlock.expectedOrigin` with its `VaultCaptureBlock.messageToken`), and `setSubmitLabel(label \| null)` (hosted submit wording, billing API v1.9.35+; `null` resets to the session default, `CONFIRM PAYMENT` or `ADD CARD`; retained and replayed on every `'ready'` event, and posted only to the exact `VaultCaptureBlock.expectedOrigin` with its `VaultCaptureBlock.messageToken`). `CardCaptureMountOptions.submitLabel` sets the initial wording. |
190
192
  | `CardFieldPlaceholders` | Placeholder text for the hosted card fields, passed to `CardCaptureAdapter.setCardFieldPlaceholders` and to the React and Vue checkout and card form placeholder prop: `number`, `expiry`, `cvv` and `name`, each an optional string. Only the fields given are sent; `''` shows no placeholder. The hosted form enforces length limits; the SDK checks the type only. |
191
193
  | `CheckoutMode` | Checkout mode: `'full'` / `'auto'` / `'confirm'` |
192
194
  | `CheckoutSessionMode` | Mode accepted on session reads: any `CheckoutMode` plus `'setup'`. Browser session-creation types deliberately reject `'setup'`. |
@@ -314,6 +316,8 @@ try {
314
316
  |----------|-------------|
315
317
  | `resolveTheme(id)` | Resolves a `ThemeId` to its `ThemeBundle`; `'classic'` and missing ids return `undefined` |
316
318
  | `resolveButtonsLayoutTheme(name)` | Maps a `ButtonsLayoutTheme` name to its `ButtonsLayoutStyles` preset |
319
+ | `computeVaultLabelTheme(appearance)` | Maps the supported `appearance.rules['.Label']` properties (`color`, `fontSize`, `fontWeight`, `letterSpacing`, `textTransform`, and `marginBottom` as `gap`) to a `VaultLabelTheme`. Other properties, empty values and wrong-typed values are ignored without error; no `.Label` rule gives `{}` |
320
+ | `buildCardFieldLabelsPayload(labels)` | The label text sent to the hosted card form: only the string `number`, `expiry`, `cvv` and `name` fields, verbatim. `null`, `undefined` or no string field gives `{}` |
317
321
  | `partitionStripeMethods(enabledMethods, options?)` | Splits the billing API's enabled Stripe methods into `{ expressMethods, paymentElementMethods }`. Drops `card`, and also `paypal` when `excludePaypal` is true. |
318
322
  | `stripeExpressMethodToOptionKey(method)` | Maps Stripe wire identifiers (`apple_pay`, `google_pay`, `amazon_pay`) to the camelCase option keys Stripe's express checkout expects |
319
323
 
@@ -0,0 +1,43 @@
1
+ import type { FloPayAppearance } from './types.js';
2
+ /**
3
+ * Merchant text for the labels above the hosted card form's fields. Every member
4
+ * is optional; only the fields that were set travel to the hosted form.
5
+ */
6
+ export interface CardFieldLabels {
7
+ number?: string;
8
+ expiry?: string;
9
+ cvv?: string;
10
+ name?: string;
11
+ }
12
+ /**
13
+ * Label style the hosted card form accepts in its theme, mapped from the
14
+ * `.Label` rule of `appearance.rules`. Every member is optional: an unset
15
+ * member follows the form's own text colour and font.
16
+ */
17
+ export interface VaultLabelTheme {
18
+ color?: string;
19
+ /** Pixels. */
20
+ fontSize?: number;
21
+ fontWeight?: number;
22
+ /** Em. */
23
+ letterSpacing?: number;
24
+ textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
25
+ /** Pixels between the label and its field (from the rule's `marginBottom`). */
26
+ gap?: number;
27
+ }
28
+ /**
29
+ * Map the supported properties of `appearance.rules['.Label']` to the label
30
+ * style of the hosted card form's theme: `color`, `fontSize` (px),
31
+ * `fontWeight` (`normal` and `bold` become 400 and 700), `letterSpacing` (em),
32
+ * `textTransform`, and `marginBottom` as `gap` (px). Unsupported properties,
33
+ * empty values and values of the wrong type are dropped without throwing.
34
+ * The SDK checks only the type: bounds are the hosted form's job.
35
+ */
36
+ export declare function computeVaultLabelTheme(appearance?: FloPayAppearance): VaultLabelTheme;
37
+ /**
38
+ * The label text sent to the hosted card form: only the string text of the
39
+ * four known fields (`number`, `expiry`, `cvv`, `name`), exactly as given. The
40
+ * hosted form shows it literally, so nothing is escaped, trimmed or rewritten.
41
+ * `null`, `undefined` or an object with no string text yields `{}`.
42
+ */
43
+ export declare function buildCardFieldLabelsPayload(labels?: CardFieldLabels | null): CardFieldLabels;
@@ -1,6 +1,6 @@
1
1
  import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CountryOption, CurrencyInfo, FloPayAppearance, ThemeBundle, ThemeBundleId, ThemeId } from './types.js';
2
2
  /** Current SDK version. */
3
- export declare const SDK_VERSION = "1.18.1";
3
+ export declare const SDK_VERSION = "1.19.0";
4
4
  /**
5
5
  * HTTP header the SDK sends on checkout-session create/read requests so the
6
6
  * backend can observe compatibility. Version 1.4.9 is the first release that