@flopay/shared 1.16.3 → 1.16.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 +5 -0
- package/dist/card-fields.d.ts +31 -0
- package/dist/constants.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +1 -1
- package/dist/instrument-dispatch.d.ts +14 -0
- package/dist/instruments.d.ts +19 -1
- package/dist/merchant-auth.d.ts +27 -0
- package/dist/telemetry.d.ts +7 -1
- package/dist/types.d.ts +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,6 +172,9 @@ try {
|
|
|
172
172
|
|------|-------------|
|
|
173
173
|
| `FloPayConfig` | Top-level config: `publishableKey`, `locale?`, `appearance?`, `apiVersion?`, `telemetry?` (set `false` to opt out of browser operational telemetry) |
|
|
174
174
|
| `FloPayEnvironment` | Billing API environment accepted by `configureFlopay()`: `'staging'` / `'production'` |
|
|
175
|
+
| `MerchantCredentials` | `{ clientUuid, apiToken }`: the merchant credentials a server passes to `@flopay/node` to mint one-click sessions. Never send them to a browser |
|
|
176
|
+
| `OneClickSession` | `{ sessionId, nonce }`: a server-minted one-click session. `@flopay/node` `checkout.sessions.createOneClick()` returns it, and the React one-click button's session callback resolves with it |
|
|
177
|
+
| `CreateOneClickSessionParams` | Parameters for `checkout.sessions.createOneClick()`: the same fields as `CreateSessionParams`; the mode is always `'confirm'` |
|
|
175
178
|
| `FloPayAppearance` | Theme config: `theme` (`'default'`/`'flat'`/`'night'`/`'none'`), `variables?`, `rules?` |
|
|
176
179
|
| `FloPayThemeVariables` | CSS custom property overrides: `colorPrimary`, `colorBackground`, `colorText`, `colorDanger`, `borderRadius`, `fontFamily`, `fontSizeBase`, `spacingUnit` |
|
|
177
180
|
| `ButtonsLayoutStyles` | Style overrides for the React checkout's `layout="buttons"` surface: `cardButton`, `cardButtonFontSize`, `cardFormContainer`, `cardInputBorder`, `cardInputColor`, `cardInputPlaceholderColor`, `cardInputFontSize`, `cardInputBackground`, `nameInput`, `backButton`, `backButtonFontSize`, `backButtonIcon`, `submitButton`, `submitButtonFontSize`, `title`, `titleFontSize`, `errorBanner` |
|
|
@@ -261,6 +264,7 @@ try {
|
|
|
261
264
|
| Constant | Description |
|
|
262
265
|
|----------|-------------|
|
|
263
266
|
| `SDK_VERSION` | The exact version of this release, identical to the installed package version |
|
|
267
|
+
| `MERCHANT_AUTH_REQUIRED_CODE` | `'merchant_auth_required'`: the code the billing API returns when it did not accept a one-click create's merchant authentication and created a Full checkout instead |
|
|
264
268
|
| `BILLING_API_URL_PRODUCTION` | `'https://api.flopay.com'` |
|
|
265
269
|
| `BILLING_API_URL_STAGING` | `'https://api.stage.flopay.com'` |
|
|
266
270
|
| `DEFAULT_API_BASE_URL` | Alias of the staging billing API, `'https://api.stage.flopay.com'`. Prefer `resolveBillingApiUrl()`. |
|
|
@@ -342,6 +346,7 @@ try {
|
|
|
342
346
|
|--------|-------------|
|
|
343
347
|
| `FloPayError` | Error class with `type`, `code?`, `declineCode?`, `param?`, `statusCode?`, `cause?`, optional `sessionId?`, and optional bounded `details?` |
|
|
344
348
|
| `FloPayErrorType` | `'validation_error'` / `'api_error'` / `'authentication_error'` / `'rate_limit_error'` / `'network_error'` |
|
|
349
|
+
| `isMerchantAuthRequired` | `true` when a billing API failure carries `MERCHANT_AUTH_REQUIRED_CODE` as its `code` or `gatewayErrorCode`. Such a failure is never a decline |
|
|
345
350
|
| `validationError(message, param?)` | Creates a `validation_error` |
|
|
346
351
|
| `apiError(message, code?, statusCode?)` | Creates an `api_error` |
|
|
347
352
|
| `authenticationError(message)` | Creates an `authentication_error` |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card-field lifecycle: when the hosted card fields became usable, or failed to
|
|
3
|
+
* load. Shared by `@flopay/js` (which detects it), `@flopay/react` and
|
|
4
|
+
* `@flopay/vue` (which surface it as callbacks), the merchant event feed and
|
|
5
|
+
* Flo telemetry.
|
|
6
|
+
*/
|
|
7
|
+
/** Closed vocabulary for why the card fields did not load. No free text. */
|
|
8
|
+
export type CardFieldsFailureReason = 'load_error' | 'timeout' | 'blocked' | 'other';
|
|
9
|
+
/** The card fields are on screen and the buyer can type in them. */
|
|
10
|
+
export interface CardFieldsReadyEvent {
|
|
11
|
+
type: 'card_fields_ready';
|
|
12
|
+
/** Milliseconds from card-form mount to the fields being interactive. */
|
|
13
|
+
elapsedMs: number;
|
|
14
|
+
}
|
|
15
|
+
/** The card fields failed to load, or were not ready within the timeout. */
|
|
16
|
+
export interface CardFieldsFailedEvent {
|
|
17
|
+
type: 'card_fields_failed';
|
|
18
|
+
reason: CardFieldsFailureReason;
|
|
19
|
+
/** Milliseconds from card-form mount to the failure being reported. */
|
|
20
|
+
elapsedMs: number;
|
|
21
|
+
}
|
|
22
|
+
export type CardFieldsEvent = CardFieldsReadyEvent | CardFieldsFailedEvent;
|
|
23
|
+
export declare const CARD_FIELDS_FAILURE_REASONS: readonly CardFieldsFailureReason[];
|
|
24
|
+
/** Flo's default for how long the card fields may take to become ready, on every device. */
|
|
25
|
+
export declare const DEFAULT_CARD_FIELDS_TIMEOUT_MS = 15000;
|
|
26
|
+
/** Merchant override of the timeout; an invalid or non-positive value falls back to the default. */
|
|
27
|
+
export declare function resolveCardFieldsTimeoutMs(value: unknown): number;
|
|
28
|
+
/** Reduce any value to the closed reason set: anything unrecognised is `other`, never echoed. */
|
|
29
|
+
export declare function toCardFieldsFailureReason(value: unknown): CardFieldsFailureReason;
|
|
30
|
+
/** A non-negative whole number of milliseconds; anything else is 0. */
|
|
31
|
+
export declare function toCardFieldsElapsedMs(value: unknown): number;
|
package/dist/constants.d.ts
CHANGED
|
@@ -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.16.
|
|
3
|
+
export declare const SDK_VERSION = "1.16.5";
|
|
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
|