@flopay/shared 0.1.6 → 0.3.1
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 +3 -1
- package/dist/index.cjs +339 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -4
- package/dist/index.d.ts +115 -4
- package/dist/index.mjs +331 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -46,6 +46,49 @@ interface FloPayAppearance {
|
|
|
46
46
|
/** CSS-like rules keyed by selector (e.g. `".Input"`, `".Label"`). */
|
|
47
47
|
rules?: Record<string, Record<string, string>>;
|
|
48
48
|
}
|
|
49
|
+
/** Style overrides for the `buttons` layout mode. */
|
|
50
|
+
interface ButtonsLayoutStyles {
|
|
51
|
+
/** Style for the "Credit / Debit Card" button. */
|
|
52
|
+
cardButton?: Record<string, string | number>;
|
|
53
|
+
/** Font size for the "Credit / Debit Card" button label. */
|
|
54
|
+
cardButtonFontSize?: string;
|
|
55
|
+
/** Style for the card form container when expanded. */
|
|
56
|
+
cardFormContainer?: Record<string, string | number>;
|
|
57
|
+
/** Border color for card input fields. */
|
|
58
|
+
cardInputBorder?: string;
|
|
59
|
+
/** Text color inside Stripe card input fields (number, expiry, CVC). */
|
|
60
|
+
cardInputColor?: string;
|
|
61
|
+
/** Placeholder text color for Stripe card input fields. */
|
|
62
|
+
cardInputPlaceholderColor?: string;
|
|
63
|
+
/** Font size for Stripe card input fields. */
|
|
64
|
+
cardInputFontSize?: string;
|
|
65
|
+
/** Background color for card input fields. */
|
|
66
|
+
cardInputBackground?: string;
|
|
67
|
+
/** Style for the full-name text input. */
|
|
68
|
+
nameInput?: Record<string, string | number>;
|
|
69
|
+
/** Style for the "Go back" button text/container. */
|
|
70
|
+
backButton?: Record<string, string | number>;
|
|
71
|
+
/** Font size for the "Go back" button label. */
|
|
72
|
+
backButtonFontSize?: string;
|
|
73
|
+
/** Style for the back button circle icon. */
|
|
74
|
+
backButtonIcon?: Record<string, string | number>;
|
|
75
|
+
/** Style for the submit/confirm button. */
|
|
76
|
+
submitButton?: Record<string, string | number>;
|
|
77
|
+
/** Font size for the submit button label. */
|
|
78
|
+
submitButtonFontSize?: string;
|
|
79
|
+
/** Style for the "Secure card checkout" title. */
|
|
80
|
+
title?: Record<string, string | number>;
|
|
81
|
+
/** Font size for the "Secure card checkout" title. */
|
|
82
|
+
titleFontSize?: string;
|
|
83
|
+
/** Style for the error banner. */
|
|
84
|
+
errorBanner?: Record<string, string | number>;
|
|
85
|
+
/** Style for the country select dropdown container (AVS). */
|
|
86
|
+
countrySelect?: Record<string, string | number>;
|
|
87
|
+
/** Style for the ZIP/postcode input container (AVS). */
|
|
88
|
+
zipInput?: Record<string, string | number>;
|
|
89
|
+
}
|
|
90
|
+
/** Predefined theme for the `buttons` layout. */
|
|
91
|
+
type ButtonsLayoutTheme = 'default' | 'minimal' | 'rounded' | 'dark';
|
|
49
92
|
/** A customer attached to a checkout session. */
|
|
50
93
|
interface Customer {
|
|
51
94
|
id: string;
|
|
@@ -157,6 +200,18 @@ interface ConfirmPaymentParams {
|
|
|
157
200
|
/** Optional redirect URL after 3-D Secure or wallet authentication. */
|
|
158
201
|
returnUrl?: string;
|
|
159
202
|
}
|
|
203
|
+
/** Billing details passed to Stripe for AVS (Address Verification). */
|
|
204
|
+
interface BillingDetails {
|
|
205
|
+
name?: string;
|
|
206
|
+
address?: {
|
|
207
|
+
country?: string;
|
|
208
|
+
postal_code?: string;
|
|
209
|
+
city?: string;
|
|
210
|
+
line1?: string;
|
|
211
|
+
line2?: string;
|
|
212
|
+
state?: string;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
160
215
|
/** Result from creating a payment method (tokenizing card fields). */
|
|
161
216
|
interface CreatePaymentMethodResult {
|
|
162
217
|
paymentMethodId: string | null;
|
|
@@ -208,6 +263,19 @@ interface ElementOptions {
|
|
|
208
263
|
readOnly?: boolean;
|
|
209
264
|
/** Address element mode: 'billing' or 'shipping'. */
|
|
210
265
|
mode?: 'billing' | 'shipping';
|
|
266
|
+
/**
|
|
267
|
+
* Style object for individual card elements (cardNumber, cardExpiry, cardCvc).
|
|
268
|
+
* Passed directly to the underlying provider element.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* style: {
|
|
273
|
+
* base: { color: '#f9fafb', fontSize: '16px', '::placeholder': { color: '#6b7280' } },
|
|
274
|
+
* invalid: { color: '#ef4444' },
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
style?: Record<string, Record<string, unknown>>;
|
|
211
279
|
}
|
|
212
280
|
/**
|
|
213
281
|
* A payment element that has been created and can be mounted into the DOM.
|
|
@@ -251,7 +319,7 @@ interface PaymentProviderAdapter {
|
|
|
251
319
|
error?: FloPayError;
|
|
252
320
|
}>;
|
|
253
321
|
/** Create a payment method from the current elements (tokenize card). */
|
|
254
|
-
createPaymentMethod(): Promise<CreatePaymentMethodResult>;
|
|
322
|
+
createPaymentMethod(billingDetails?: BillingDetails): Promise<CreatePaymentMethodResult>;
|
|
255
323
|
/** Confirm a card payment with a known client secret and payment method. */
|
|
256
324
|
confirmCardPayment(params: ConfirmCardPaymentParams): Promise<ConfirmCardPaymentResult>;
|
|
257
325
|
confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
|
|
@@ -403,6 +471,33 @@ interface CreateSessionParams {
|
|
|
403
471
|
/** UTM and funnel tracking metadata. */
|
|
404
472
|
utmMetadata?: Record<string, string | null | undefined>[];
|
|
405
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Parameters for inline session creation via `FloPayCheckout.createSession`.
|
|
476
|
+
* Subset of `CreateSessionParams` — no redirect fields needed since the
|
|
477
|
+
* component handles the checkout flow inline.
|
|
478
|
+
*/
|
|
479
|
+
interface InlineSessionParams {
|
|
480
|
+
/** The client ID for the checkout session. */
|
|
481
|
+
clientId: string;
|
|
482
|
+
/** One-time purchase items. */
|
|
483
|
+
items?: CheckoutItem[];
|
|
484
|
+
/** Recurring subscription plans. */
|
|
485
|
+
subscriptions?: CheckoutSubscription[];
|
|
486
|
+
/** Buyer's account information. */
|
|
487
|
+
account: CheckoutAccount;
|
|
488
|
+
/** URL to redirect to after successful payment. */
|
|
489
|
+
successUrl: string;
|
|
490
|
+
/** URL to redirect to if the user cancels. */
|
|
491
|
+
cancelUrl: string;
|
|
492
|
+
/** Checkout mode: 'full' (default), 'auto', or 'confirm'. */
|
|
493
|
+
checkoutMode?: 'full' | 'auto' | 'confirm';
|
|
494
|
+
/** Coupon codes to apply. */
|
|
495
|
+
couponCodes?: string[];
|
|
496
|
+
/** Pixel / analytics tags. */
|
|
497
|
+
tagsData?: TagsData;
|
|
498
|
+
/** UTM and funnel tracking metadata. */
|
|
499
|
+
utmMetadata?: Record<string, string | null | undefined>[];
|
|
500
|
+
}
|
|
406
501
|
/** Result from creating a checkout session. */
|
|
407
502
|
type CheckoutSessionResult = {
|
|
408
503
|
status: 201;
|
|
@@ -465,7 +560,7 @@ interface CountryOption {
|
|
|
465
560
|
}
|
|
466
561
|
|
|
467
562
|
/** FloPay environment — determines which billing API URL is used. */
|
|
468
|
-
type FloPayEnvironment = 'staging' | 'production';
|
|
563
|
+
type FloPayEnvironment = 'staging' | 'production' | 'local';
|
|
469
564
|
/**
|
|
470
565
|
* Configure the FloPay SDK globally. Call once at app startup.
|
|
471
566
|
*
|
|
@@ -495,7 +590,7 @@ declare function getConfiguredBillingApiUrl(): string;
|
|
|
495
590
|
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
496
591
|
|
|
497
592
|
/** Current SDK version. */
|
|
498
|
-
declare const SDK_VERSION = "0.1
|
|
593
|
+
declare const SDK_VERSION = "0.3.1";
|
|
499
594
|
/** Billing API URL for staging environment. */
|
|
500
595
|
declare const BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
501
596
|
/** Billing API URL for production environment. */
|
|
@@ -533,6 +628,16 @@ declare const DEFAULT_APPEARANCE: FloPayAppearance;
|
|
|
533
628
|
declare const FLAT_APPEARANCE: FloPayAppearance;
|
|
534
629
|
/** Night theme — dark background. */
|
|
535
630
|
declare const NIGHT_APPEARANCE: FloPayAppearance;
|
|
631
|
+
/** Default buttons layout — white card button, neutral borders. */
|
|
632
|
+
declare const BUTTONS_LAYOUT_DEFAULT: ButtonsLayoutStyles;
|
|
633
|
+
/** Minimal buttons layout — borderless, subtle hover. */
|
|
634
|
+
declare const BUTTONS_LAYOUT_MINIMAL: ButtonsLayoutStyles;
|
|
635
|
+
/** Rounded buttons layout — large border radius, soft shadows. */
|
|
636
|
+
declare const BUTTONS_LAYOUT_ROUNDED: ButtonsLayoutStyles;
|
|
637
|
+
/** Dark buttons layout — dark backgrounds, light text. */
|
|
638
|
+
declare const BUTTONS_LAYOUT_DARK: ButtonsLayoutStyles;
|
|
639
|
+
/** Resolve a buttons layout theme name to its style preset. */
|
|
640
|
+
declare function resolveButtonsLayoutTheme(theme?: ButtonsLayoutTheme): ButtonsLayoutStyles;
|
|
536
641
|
/** All supported element type identifiers. */
|
|
537
642
|
declare const ELEMENT_TYPES: readonly ["payment", "card", "cardNumber", "cardExpiry", "cardCvc", "address"];
|
|
538
643
|
declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard_debit", "amex", "discover"];
|
|
@@ -540,6 +645,12 @@ declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard
|
|
|
540
645
|
declare const CURRENCY_MAP: Record<string, CurrencyInfo>;
|
|
541
646
|
/** Default currency info when country is unknown. */
|
|
542
647
|
declare const DEFAULT_CURRENCY: CurrencyInfo;
|
|
648
|
+
/** Returns the correct postal code label for a country code (ISO 3166-1 alpha-2). */
|
|
649
|
+
declare function getPostalCodeLabel(countryCode: string): string;
|
|
650
|
+
/** All countries for dropdown select, priority countries first. */
|
|
651
|
+
declare const COUNTRY_OPTIONS: CountryOption[];
|
|
652
|
+
/** Look up a country option by ISO 3166-1 alpha-2 code. */
|
|
653
|
+
declare function getCountryByCode(code: string): CountryOption | undefined;
|
|
543
654
|
|
|
544
655
|
/** A single line item formatted for display in the checkout UI. */
|
|
545
656
|
interface DisplayLineItem {
|
|
@@ -599,4 +710,4 @@ declare function isValidPublishableKey(key: string): boolean;
|
|
|
599
710
|
/** Returns `true` if the string looks like a Stripe secret key. */
|
|
600
711
|
declare function isValidSecretKey(key: string): boolean;
|
|
601
712
|
|
|
602
|
-
export { BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, type BillingProvider, CURRENCY_MAP, type CheckoutAccount, type CheckoutDisplayData, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutSession, type CheckoutSessionItem, type CheckoutSessionResult, type CheckoutSessionSubscription, type CheckoutSubscription, type ConfirmCardPaymentParams, type ConfirmCardPaymentResult, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreatePaymentMethodResult, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, type LineItem, type MountedElement, NIGHT_APPEARANCE, type NormalizedCheckoutSession, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, SUPPORTED_CARD_BRANDS, type TagsData, type TokenizedBody, type UpdateCustomerParams, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, configureFlopay, getConfiguredBillingApiUrl, getCurrencyByCountry, getFloPayEnvironment, isValidPublishableKey, isValidSecretKey, networkError, rateLimitError, resolveBillingApiUrl, validationError };
|
|
713
|
+
export { BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_ROUNDED, type BillingDetails, type BillingProvider, type ButtonsLayoutStyles, type ButtonsLayoutTheme, COUNTRY_OPTIONS, CURRENCY_MAP, type CheckoutAccount, type CheckoutDisplayData, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutSession, type CheckoutSessionItem, type CheckoutSessionResult, type CheckoutSessionSubscription, type CheckoutSubscription, type ConfirmCardPaymentParams, type ConfirmCardPaymentResult, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreatePaymentMethodResult, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, type InlineSessionParams, type LineItem, type MountedElement, NIGHT_APPEARANCE, type NormalizedCheckoutSession, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, SUPPORTED_CARD_BRANDS, type TagsData, type TokenizedBody, type UpdateCustomerParams, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, configureFlopay, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeLabel, isValidPublishableKey, isValidSecretKey, networkError, rateLimitError, resolveBillingApiUrl, resolveButtonsLayoutTheme, validationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,49 @@ interface FloPayAppearance {
|
|
|
46
46
|
/** CSS-like rules keyed by selector (e.g. `".Input"`, `".Label"`). */
|
|
47
47
|
rules?: Record<string, Record<string, string>>;
|
|
48
48
|
}
|
|
49
|
+
/** Style overrides for the `buttons` layout mode. */
|
|
50
|
+
interface ButtonsLayoutStyles {
|
|
51
|
+
/** Style for the "Credit / Debit Card" button. */
|
|
52
|
+
cardButton?: Record<string, string | number>;
|
|
53
|
+
/** Font size for the "Credit / Debit Card" button label. */
|
|
54
|
+
cardButtonFontSize?: string;
|
|
55
|
+
/** Style for the card form container when expanded. */
|
|
56
|
+
cardFormContainer?: Record<string, string | number>;
|
|
57
|
+
/** Border color for card input fields. */
|
|
58
|
+
cardInputBorder?: string;
|
|
59
|
+
/** Text color inside Stripe card input fields (number, expiry, CVC). */
|
|
60
|
+
cardInputColor?: string;
|
|
61
|
+
/** Placeholder text color for Stripe card input fields. */
|
|
62
|
+
cardInputPlaceholderColor?: string;
|
|
63
|
+
/** Font size for Stripe card input fields. */
|
|
64
|
+
cardInputFontSize?: string;
|
|
65
|
+
/** Background color for card input fields. */
|
|
66
|
+
cardInputBackground?: string;
|
|
67
|
+
/** Style for the full-name text input. */
|
|
68
|
+
nameInput?: Record<string, string | number>;
|
|
69
|
+
/** Style for the "Go back" button text/container. */
|
|
70
|
+
backButton?: Record<string, string | number>;
|
|
71
|
+
/** Font size for the "Go back" button label. */
|
|
72
|
+
backButtonFontSize?: string;
|
|
73
|
+
/** Style for the back button circle icon. */
|
|
74
|
+
backButtonIcon?: Record<string, string | number>;
|
|
75
|
+
/** Style for the submit/confirm button. */
|
|
76
|
+
submitButton?: Record<string, string | number>;
|
|
77
|
+
/** Font size for the submit button label. */
|
|
78
|
+
submitButtonFontSize?: string;
|
|
79
|
+
/** Style for the "Secure card checkout" title. */
|
|
80
|
+
title?: Record<string, string | number>;
|
|
81
|
+
/** Font size for the "Secure card checkout" title. */
|
|
82
|
+
titleFontSize?: string;
|
|
83
|
+
/** Style for the error banner. */
|
|
84
|
+
errorBanner?: Record<string, string | number>;
|
|
85
|
+
/** Style for the country select dropdown container (AVS). */
|
|
86
|
+
countrySelect?: Record<string, string | number>;
|
|
87
|
+
/** Style for the ZIP/postcode input container (AVS). */
|
|
88
|
+
zipInput?: Record<string, string | number>;
|
|
89
|
+
}
|
|
90
|
+
/** Predefined theme for the `buttons` layout. */
|
|
91
|
+
type ButtonsLayoutTheme = 'default' | 'minimal' | 'rounded' | 'dark';
|
|
49
92
|
/** A customer attached to a checkout session. */
|
|
50
93
|
interface Customer {
|
|
51
94
|
id: string;
|
|
@@ -157,6 +200,18 @@ interface ConfirmPaymentParams {
|
|
|
157
200
|
/** Optional redirect URL after 3-D Secure or wallet authentication. */
|
|
158
201
|
returnUrl?: string;
|
|
159
202
|
}
|
|
203
|
+
/** Billing details passed to Stripe for AVS (Address Verification). */
|
|
204
|
+
interface BillingDetails {
|
|
205
|
+
name?: string;
|
|
206
|
+
address?: {
|
|
207
|
+
country?: string;
|
|
208
|
+
postal_code?: string;
|
|
209
|
+
city?: string;
|
|
210
|
+
line1?: string;
|
|
211
|
+
line2?: string;
|
|
212
|
+
state?: string;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
160
215
|
/** Result from creating a payment method (tokenizing card fields). */
|
|
161
216
|
interface CreatePaymentMethodResult {
|
|
162
217
|
paymentMethodId: string | null;
|
|
@@ -208,6 +263,19 @@ interface ElementOptions {
|
|
|
208
263
|
readOnly?: boolean;
|
|
209
264
|
/** Address element mode: 'billing' or 'shipping'. */
|
|
210
265
|
mode?: 'billing' | 'shipping';
|
|
266
|
+
/**
|
|
267
|
+
* Style object for individual card elements (cardNumber, cardExpiry, cardCvc).
|
|
268
|
+
* Passed directly to the underlying provider element.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* style: {
|
|
273
|
+
* base: { color: '#f9fafb', fontSize: '16px', '::placeholder': { color: '#6b7280' } },
|
|
274
|
+
* invalid: { color: '#ef4444' },
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
style?: Record<string, Record<string, unknown>>;
|
|
211
279
|
}
|
|
212
280
|
/**
|
|
213
281
|
* A payment element that has been created and can be mounted into the DOM.
|
|
@@ -251,7 +319,7 @@ interface PaymentProviderAdapter {
|
|
|
251
319
|
error?: FloPayError;
|
|
252
320
|
}>;
|
|
253
321
|
/** Create a payment method from the current elements (tokenize card). */
|
|
254
|
-
createPaymentMethod(): Promise<CreatePaymentMethodResult>;
|
|
322
|
+
createPaymentMethod(billingDetails?: BillingDetails): Promise<CreatePaymentMethodResult>;
|
|
255
323
|
/** Confirm a card payment with a known client secret and payment method. */
|
|
256
324
|
confirmCardPayment(params: ConfirmCardPaymentParams): Promise<ConfirmCardPaymentResult>;
|
|
257
325
|
confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
|
|
@@ -403,6 +471,33 @@ interface CreateSessionParams {
|
|
|
403
471
|
/** UTM and funnel tracking metadata. */
|
|
404
472
|
utmMetadata?: Record<string, string | null | undefined>[];
|
|
405
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Parameters for inline session creation via `FloPayCheckout.createSession`.
|
|
476
|
+
* Subset of `CreateSessionParams` — no redirect fields needed since the
|
|
477
|
+
* component handles the checkout flow inline.
|
|
478
|
+
*/
|
|
479
|
+
interface InlineSessionParams {
|
|
480
|
+
/** The client ID for the checkout session. */
|
|
481
|
+
clientId: string;
|
|
482
|
+
/** One-time purchase items. */
|
|
483
|
+
items?: CheckoutItem[];
|
|
484
|
+
/** Recurring subscription plans. */
|
|
485
|
+
subscriptions?: CheckoutSubscription[];
|
|
486
|
+
/** Buyer's account information. */
|
|
487
|
+
account: CheckoutAccount;
|
|
488
|
+
/** URL to redirect to after successful payment. */
|
|
489
|
+
successUrl: string;
|
|
490
|
+
/** URL to redirect to if the user cancels. */
|
|
491
|
+
cancelUrl: string;
|
|
492
|
+
/** Checkout mode: 'full' (default), 'auto', or 'confirm'. */
|
|
493
|
+
checkoutMode?: 'full' | 'auto' | 'confirm';
|
|
494
|
+
/** Coupon codes to apply. */
|
|
495
|
+
couponCodes?: string[];
|
|
496
|
+
/** Pixel / analytics tags. */
|
|
497
|
+
tagsData?: TagsData;
|
|
498
|
+
/** UTM and funnel tracking metadata. */
|
|
499
|
+
utmMetadata?: Record<string, string | null | undefined>[];
|
|
500
|
+
}
|
|
406
501
|
/** Result from creating a checkout session. */
|
|
407
502
|
type CheckoutSessionResult = {
|
|
408
503
|
status: 201;
|
|
@@ -465,7 +560,7 @@ interface CountryOption {
|
|
|
465
560
|
}
|
|
466
561
|
|
|
467
562
|
/** FloPay environment — determines which billing API URL is used. */
|
|
468
|
-
type FloPayEnvironment = 'staging' | 'production';
|
|
563
|
+
type FloPayEnvironment = 'staging' | 'production' | 'local';
|
|
469
564
|
/**
|
|
470
565
|
* Configure the FloPay SDK globally. Call once at app startup.
|
|
471
566
|
*
|
|
@@ -495,7 +590,7 @@ declare function getConfiguredBillingApiUrl(): string;
|
|
|
495
590
|
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
496
591
|
|
|
497
592
|
/** Current SDK version. */
|
|
498
|
-
declare const SDK_VERSION = "0.1
|
|
593
|
+
declare const SDK_VERSION = "0.3.1";
|
|
499
594
|
/** Billing API URL for staging environment. */
|
|
500
595
|
declare const BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
501
596
|
/** Billing API URL for production environment. */
|
|
@@ -533,6 +628,16 @@ declare const DEFAULT_APPEARANCE: FloPayAppearance;
|
|
|
533
628
|
declare const FLAT_APPEARANCE: FloPayAppearance;
|
|
534
629
|
/** Night theme — dark background. */
|
|
535
630
|
declare const NIGHT_APPEARANCE: FloPayAppearance;
|
|
631
|
+
/** Default buttons layout — white card button, neutral borders. */
|
|
632
|
+
declare const BUTTONS_LAYOUT_DEFAULT: ButtonsLayoutStyles;
|
|
633
|
+
/** Minimal buttons layout — borderless, subtle hover. */
|
|
634
|
+
declare const BUTTONS_LAYOUT_MINIMAL: ButtonsLayoutStyles;
|
|
635
|
+
/** Rounded buttons layout — large border radius, soft shadows. */
|
|
636
|
+
declare const BUTTONS_LAYOUT_ROUNDED: ButtonsLayoutStyles;
|
|
637
|
+
/** Dark buttons layout — dark backgrounds, light text. */
|
|
638
|
+
declare const BUTTONS_LAYOUT_DARK: ButtonsLayoutStyles;
|
|
639
|
+
/** Resolve a buttons layout theme name to its style preset. */
|
|
640
|
+
declare function resolveButtonsLayoutTheme(theme?: ButtonsLayoutTheme): ButtonsLayoutStyles;
|
|
536
641
|
/** All supported element type identifiers. */
|
|
537
642
|
declare const ELEMENT_TYPES: readonly ["payment", "card", "cardNumber", "cardExpiry", "cardCvc", "address"];
|
|
538
643
|
declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard_debit", "amex", "discover"];
|
|
@@ -540,6 +645,12 @@ declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard
|
|
|
540
645
|
declare const CURRENCY_MAP: Record<string, CurrencyInfo>;
|
|
541
646
|
/** Default currency info when country is unknown. */
|
|
542
647
|
declare const DEFAULT_CURRENCY: CurrencyInfo;
|
|
648
|
+
/** Returns the correct postal code label for a country code (ISO 3166-1 alpha-2). */
|
|
649
|
+
declare function getPostalCodeLabel(countryCode: string): string;
|
|
650
|
+
/** All countries for dropdown select, priority countries first. */
|
|
651
|
+
declare const COUNTRY_OPTIONS: CountryOption[];
|
|
652
|
+
/** Look up a country option by ISO 3166-1 alpha-2 code. */
|
|
653
|
+
declare function getCountryByCode(code: string): CountryOption | undefined;
|
|
543
654
|
|
|
544
655
|
/** A single line item formatted for display in the checkout UI. */
|
|
545
656
|
interface DisplayLineItem {
|
|
@@ -599,4 +710,4 @@ declare function isValidPublishableKey(key: string): boolean;
|
|
|
599
710
|
/** Returns `true` if the string looks like a Stripe secret key. */
|
|
600
711
|
declare function isValidSecretKey(key: string): boolean;
|
|
601
712
|
|
|
602
|
-
export { BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, type BillingProvider, CURRENCY_MAP, type CheckoutAccount, type CheckoutDisplayData, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutSession, type CheckoutSessionItem, type CheckoutSessionResult, type CheckoutSessionSubscription, type CheckoutSubscription, type ConfirmCardPaymentParams, type ConfirmCardPaymentResult, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreatePaymentMethodResult, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, type LineItem, type MountedElement, NIGHT_APPEARANCE, type NormalizedCheckoutSession, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, SUPPORTED_CARD_BRANDS, type TagsData, type TokenizedBody, type UpdateCustomerParams, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, configureFlopay, getConfiguredBillingApiUrl, getCurrencyByCountry, getFloPayEnvironment, isValidPublishableKey, isValidSecretKey, networkError, rateLimitError, resolveBillingApiUrl, validationError };
|
|
713
|
+
export { BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_ROUNDED, type BillingDetails, type BillingProvider, type ButtonsLayoutStyles, type ButtonsLayoutTheme, COUNTRY_OPTIONS, CURRENCY_MAP, type CheckoutAccount, type CheckoutDisplayData, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutSession, type CheckoutSessionItem, type CheckoutSessionResult, type CheckoutSessionSubscription, type CheckoutSubscription, type ConfirmCardPaymentParams, type ConfirmCardPaymentResult, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreatePaymentMethodResult, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, type InlineSessionParams, type LineItem, type MountedElement, NIGHT_APPEARANCE, type NormalizedCheckoutSession, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, SUPPORTED_CARD_BRANDS, type TagsData, type TokenizedBody, type UpdateCustomerParams, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, configureFlopay, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeLabel, isValidPublishableKey, isValidSecretKey, networkError, rateLimitError, resolveBillingApiUrl, resolveButtonsLayoutTheme, validationError };
|