@flopay/shared 1.4.1 → 1.4.3
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 +10 -9
- package/dist/index.cjs +32 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -70
- package/dist/index.d.ts +123 -70
- package/dist/index.mjs +29 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ interface ButtonsLayoutStyles {
|
|
|
74
74
|
* style config handed to the vault PCI card form, so these win over the
|
|
75
75
|
* auto-translated `cardInput*` knobs and `appearance.variables`. Keys are
|
|
76
76
|
* passed through verbatim — use vault-supported style property names.
|
|
77
|
-
*
|
|
77
|
+
* Applied only to the hosted vault card form.
|
|
78
78
|
*/
|
|
79
79
|
vaultCardForm?: Record<string, string | number>;
|
|
80
80
|
/** Style for the full-name text input. */
|
|
@@ -273,8 +273,8 @@ interface CheckoutGateway {
|
|
|
273
273
|
* {@link STRIPE_EXPRESS_METHODS} to decide which methods render in the
|
|
274
274
|
* `ExpressCheckoutElement` row (Apple Pay / Google Pay / PayPal / Link /
|
|
275
275
|
* Amazon Pay / Klarna) vs the `PaymentElement` accordion (Cash App Pay /
|
|
276
|
-
* Affirm / iDEAL / Bancontact / …). `card` is always filtered out
|
|
277
|
-
*
|
|
276
|
+
* Affirm / iDEAL / Bancontact / …). `card` is always filtered out because
|
|
277
|
+
* the hosted vault owns the card path. Absent on legacy backends.
|
|
278
278
|
*/
|
|
279
279
|
enabledPaymentMethods?: string[];
|
|
280
280
|
/**
|
|
@@ -311,12 +311,11 @@ interface CheckoutSession {
|
|
|
311
311
|
metadata?: Record<string, string>;
|
|
312
312
|
checkoutMode?: CheckoutMode;
|
|
313
313
|
/**
|
|
314
|
-
* Embedded hosted vault capture credentials (TeamFloPay/backend#823)
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* the block via `POST /v1/checkouts/sessions/{id}/vault/capture` instead.
|
|
314
|
+
* Embedded hosted vault capture credentials (TeamFloPay/backend#823).
|
|
315
|
+
* Card-capable session create/read responses include this block without
|
|
316
|
+
* SDK-version dispatch. The SDK injects {@link VaultCaptureBlock.html} as
|
|
317
|
+
* the card-capture widget; the explicit recovery path remains
|
|
318
|
+
* `POST /v1/checkouts/sessions/{id}/vault/capture`.
|
|
320
319
|
*/
|
|
321
320
|
vault?: VaultCaptureBlock;
|
|
322
321
|
/**
|
|
@@ -377,16 +376,19 @@ interface PaymentResult {
|
|
|
377
376
|
checkoutMethod?: CheckoutButtonMethod;
|
|
378
377
|
error?: FloPayError;
|
|
379
378
|
}
|
|
380
|
-
/** Parameters for confirming a payment. */
|
|
379
|
+
/** Parameters for confirming a wallet/APM payment from a mounted PaymentElement. */
|
|
381
380
|
interface ConfirmPaymentParams {
|
|
382
381
|
clientSecret: string;
|
|
382
|
+
/** Explicit non-card category for the selected payment method. */
|
|
383
|
+
paymentMethodCategory: NonCardPaymentMethodCategory;
|
|
384
|
+
/** Provider method type (for example `cashapp` or `ideal`); `card` is rejected. */
|
|
385
|
+
paymentMethodType: string;
|
|
383
386
|
/** Optional redirect URL after 3-D Secure or wallet authentication. */
|
|
384
387
|
returnUrl?: string;
|
|
385
388
|
/**
|
|
386
389
|
* Optional billing details appended to `payment_method_data` on the confirm call.
|
|
387
390
|
* Ensures `billing_details.email` (and name/address) lands on the PaymentMethod
|
|
388
|
-
* Stripe mints from Elements during 3DS confirmation
|
|
389
|
-
* inherits none of the info we attached at `createPaymentMethod` time.
|
|
391
|
+
* Stripe mints from Elements during 3DS confirmation.
|
|
390
392
|
*/
|
|
391
393
|
billingDetails?: BillingDetails;
|
|
392
394
|
}
|
|
@@ -403,33 +405,75 @@ interface BillingDetails {
|
|
|
403
405
|
state?: string;
|
|
404
406
|
};
|
|
405
407
|
}
|
|
406
|
-
/** Result from
|
|
407
|
-
interface
|
|
408
|
-
paymentMethodId: string | null;
|
|
409
|
-
error?: FloPayError;
|
|
410
|
-
}
|
|
411
|
-
/** Parameters for confirming a card payment with a known client secret. */
|
|
412
|
-
interface ConfirmCardPaymentParams {
|
|
413
|
-
clientSecret: string;
|
|
414
|
-
paymentMethodId: string;
|
|
415
|
-
}
|
|
416
|
-
/** Provider-observed 3DS lifecycle for one opaque, attempt-scoped confirmation. */
|
|
417
|
-
interface CardThreeDsLifecycle {
|
|
418
|
-
/** Opaque in-memory identifier; never derived from payment identifiers. */
|
|
419
|
-
attemptId: string;
|
|
420
|
-
status: 'handoff' | 'returned' | 'failed';
|
|
421
|
-
}
|
|
422
|
-
/** Result from confirming a card payment. */
|
|
423
|
-
interface ConfirmCardPaymentResult {
|
|
408
|
+
/** Result from the Stripe-hosted PayPal confirmation or redirect-resume flow. */
|
|
409
|
+
interface PayPalPaymentResult {
|
|
424
410
|
status: 'succeeded' | 'processing' | 'requires_action' | 'requires_capture' | 'failed';
|
|
425
411
|
paymentIntentId?: string;
|
|
426
412
|
paymentMethodId?: string;
|
|
427
413
|
error?: FloPayError;
|
|
428
|
-
/** @internal Provider-observed lifecycle used for privacy-safe telemetry. */
|
|
429
|
-
threeDs?: CardThreeDsLifecycle;
|
|
430
414
|
}
|
|
415
|
+
/** Non-card method families accepted by the public session intent endpoint. */
|
|
416
|
+
type NonCardPaymentMethodCategory = 'wallet' | 'apm';
|
|
417
|
+
/**
|
|
418
|
+
* Stable identity of one buyer authorization attempt (a v4 UUID).
|
|
419
|
+
*
|
|
420
|
+
* The backend folds this into the provider idempotency key, so reusing the same
|
|
421
|
+
* value makes a transport retry reuse the *same* provider intent, while a fresh
|
|
422
|
+
* value deliberately starts a new authorization. Optional on the SDK request:
|
|
423
|
+
* `PaymentAPI.createSessionIntent` generates one when omitted and only advanced
|
|
424
|
+
* callers that drive their own retries need to pass a stable value.
|
|
425
|
+
*/
|
|
426
|
+
interface SessionIntentAuthorizationAttempt {
|
|
427
|
+
authorizationAttemptId?: string;
|
|
428
|
+
}
|
|
429
|
+
/** Stripe wallet/APM request. Direct card is deliberately not representable. */
|
|
430
|
+
interface StripeSessionIntentRequest extends SessionIntentAuthorizationAttempt {
|
|
431
|
+
provider: 'stripe';
|
|
432
|
+
paymentMethodCategory: NonCardPaymentMethodCategory;
|
|
433
|
+
paymentMethodType: string;
|
|
434
|
+
paymentMethodId: string | null;
|
|
435
|
+
intentKind: 'payment' | 'setup';
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Direct PayPal intent request. Always `intentKind: 'payment'`: the backend
|
|
439
|
+
* derives order vs subscription from the session's products and returns that as
|
|
440
|
+
* the response `providerObjectType`. PayPal setup intents are unsupported —
|
|
441
|
+
* PayPal vaults during a successful Order capture, not via standalone setups.
|
|
442
|
+
*/
|
|
443
|
+
interface PayPalSessionIntentRequest extends SessionIntentAuthorizationAttempt {
|
|
444
|
+
provider: 'paypal';
|
|
445
|
+
paymentMethodCategory: 'wallet';
|
|
446
|
+
paymentMethodType: 'paypal';
|
|
447
|
+
paymentMethodId: null;
|
|
448
|
+
intentKind: 'payment';
|
|
449
|
+
}
|
|
450
|
+
type CreateSessionIntentRequest = StripeSessionIntentRequest | PayPalSessionIntentRequest;
|
|
451
|
+
interface StripeSessionIntent extends StripeSessionIntentRequest {
|
|
452
|
+
clientSecret: string;
|
|
453
|
+
providerObjectId: string;
|
|
454
|
+
}
|
|
455
|
+
interface PayPalSessionIntent extends PayPalSessionIntentRequest {
|
|
456
|
+
clientSecret: null;
|
|
457
|
+
providerObjectId: string;
|
|
458
|
+
/** Server-derived from the session's products (a subscription product → 'subscription'). */
|
|
459
|
+
providerObjectType: 'order' | 'subscription';
|
|
460
|
+
}
|
|
461
|
+
type SessionIntent = StripeSessionIntent | PayPalSessionIntent;
|
|
462
|
+
type SessionIntentDeclineRequest = {
|
|
463
|
+
provider: 'stripe';
|
|
464
|
+
paymentMethodCategory: NonCardPaymentMethodCategory;
|
|
465
|
+
paymentMethodType: string;
|
|
466
|
+
/** Provider classification code only; messages and identifiers are rejected. */
|
|
467
|
+
providerDeclineReason: string;
|
|
468
|
+
} | {
|
|
469
|
+
provider: 'paypal';
|
|
470
|
+
paymentMethodCategory: 'wallet';
|
|
471
|
+
paymentMethodType: 'paypal';
|
|
472
|
+
/** Provider classification code only; messages and identifiers are rejected. */
|
|
473
|
+
providerDeclineReason: string;
|
|
474
|
+
};
|
|
431
475
|
/** The type of payment element to render. */
|
|
432
|
-
type ElementType = 'payment' | '
|
|
476
|
+
type ElementType = 'payment' | 'address';
|
|
433
477
|
/** Emitted when an element's internal state changes. */
|
|
434
478
|
interface ElementChangeEvent {
|
|
435
479
|
elementType: ElementType;
|
|
@@ -445,7 +489,17 @@ interface ElementChangeEvent {
|
|
|
445
489
|
/** Configuration options when creating an element. */
|
|
446
490
|
interface ElementOptions {
|
|
447
491
|
appearance?: FloPayAppearance;
|
|
448
|
-
/**
|
|
492
|
+
/**
|
|
493
|
+
* Explicit non-card provider method types rendered by a payment element.
|
|
494
|
+
* The SDK removes `card`; card collection belongs to the hosted vault.
|
|
495
|
+
*/
|
|
496
|
+
paymentMethodTypes?: readonly string[];
|
|
497
|
+
/**
|
|
498
|
+
* Client secret for an existing non-card PaymentIntent or SetupIntent.
|
|
499
|
+
* The explicit `paymentMethodTypes` allowlist remains required; the SDK uses
|
|
500
|
+
* it to validate the provider intent before mounting. Card checkout uses the
|
|
501
|
+
* hosted vault.
|
|
502
|
+
*/
|
|
449
503
|
clientSecret?: string;
|
|
450
504
|
/**
|
|
451
505
|
* Total amount in the smallest currency unit (e.g. cents).
|
|
@@ -467,19 +521,6 @@ interface ElementOptions {
|
|
|
467
521
|
readOnly?: boolean;
|
|
468
522
|
/** Address element mode: 'billing' or 'shipping'. */
|
|
469
523
|
mode?: 'billing' | 'shipping';
|
|
470
|
-
/**
|
|
471
|
-
* Style object for individual card elements (cardNumber, cardExpiry, cardCvc).
|
|
472
|
-
* Passed directly to the underlying provider element.
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* ```ts
|
|
476
|
-
* style: {
|
|
477
|
-
* base: { color: '#f9fafb', fontSize: '16px', '::placeholder': { color: '#6b7280' } },
|
|
478
|
-
* invalid: { color: '#ef4444' },
|
|
479
|
-
* }
|
|
480
|
-
* ```
|
|
481
|
-
*/
|
|
482
|
-
style?: Record<string, Record<string, unknown>>;
|
|
483
524
|
}
|
|
484
525
|
/**
|
|
485
526
|
* A payment element that has been created and can be mounted into the DOM.
|
|
@@ -528,18 +569,14 @@ interface PaymentProviderAdapter {
|
|
|
528
569
|
submitElements(): Promise<{
|
|
529
570
|
error?: FloPayError;
|
|
530
571
|
}>;
|
|
531
|
-
/**
|
|
532
|
-
createPaymentMethod(billingDetails?: BillingDetails): Promise<CreatePaymentMethodResult>;
|
|
533
|
-
/** Confirm a card payment with a known client secret and payment method. */
|
|
534
|
-
confirmCardPayment(params: ConfirmCardPaymentParams): Promise<ConfirmCardPaymentResult>;
|
|
572
|
+
/** Confirm a non-card wallet/APM payment from mounted elements. */
|
|
535
573
|
confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
|
|
536
574
|
/**
|
|
537
575
|
* Create a PayPal payment: create PM → create intent → confirm with redirect.
|
|
538
576
|
* Returns the confirmed PaymentIntent ID if completed inline, or redirects to PayPal.
|
|
539
577
|
*
|
|
540
|
-
* `nonce` is the session-bound checkout token
|
|
541
|
-
*
|
|
542
|
-
* `x-checkout-session-token` header is missing — pass `nonce` to forward it.
|
|
578
|
+
* `nonce` is the session-bound checkout token forwarded to the
|
|
579
|
+
* session-scoped non-card intent contract.
|
|
543
580
|
*/
|
|
544
581
|
confirmPayPalPayment(params: {
|
|
545
582
|
billingApiUrl: string;
|
|
@@ -547,21 +584,18 @@ interface PaymentProviderAdapter {
|
|
|
547
584
|
email: string;
|
|
548
585
|
returnUrl: string;
|
|
549
586
|
nonce?: string;
|
|
550
|
-
}): Promise<
|
|
587
|
+
}): Promise<PayPalPaymentResult>;
|
|
551
588
|
/**
|
|
552
589
|
* Resume a PayPal payment after redirect return.
|
|
553
590
|
* Checks URL params for payment_intent + redirect_status.
|
|
554
591
|
*/
|
|
555
|
-
resumePayPalPayment(): Promise<
|
|
592
|
+
resumePayPalPayment(): Promise<PayPalPaymentResult | null>;
|
|
556
593
|
/**
|
|
557
594
|
* Get the raw underlying provider instance (e.g. Stripe object).
|
|
558
595
|
* Used internally for creating secondary Elements groups (e.g. PayPal).
|
|
559
596
|
*/
|
|
560
597
|
getRawProvider(): unknown;
|
|
561
|
-
/**
|
|
562
|
-
* Create a secondary Elements group for PayPal.
|
|
563
|
-
* PayPal can't share Elements with card fields that use paymentMethodCreation: 'manual'.
|
|
564
|
-
*/
|
|
598
|
+
/** Create a secondary Elements group for PayPal's automatic payment-method flow. */
|
|
565
599
|
createPayPalElements(options: ElementOptions): unknown;
|
|
566
600
|
destroy(): void;
|
|
567
601
|
}
|
|
@@ -576,8 +610,8 @@ type CardCaptureProviderId = 'pcivault';
|
|
|
576
610
|
/**
|
|
577
611
|
* Server-rendered hosted vault capture credentials (TeamFloPay/backend#823).
|
|
578
612
|
*
|
|
579
|
-
* Returned either embedded on
|
|
580
|
-
*
|
|
613
|
+
* Returned either embedded on every card-capable session create/read response
|
|
614
|
+
* or from the explicit
|
|
581
615
|
* `POST /v1/checkouts/sessions/{id}/vault/capture` endpoint. `html` is a
|
|
582
616
|
* self-contained, Flo-bundled hosted-form widget (PCIVault card fields, its own
|
|
583
617
|
* submit button, status overlay, and — owned entirely by the backend — card
|
|
@@ -739,7 +773,7 @@ interface CardCaptureMountOptions {
|
|
|
739
773
|
}
|
|
740
774
|
/**
|
|
741
775
|
* Merchant style values the SDK pushes into the hosted vault card form so it
|
|
742
|
-
* matches the
|
|
776
|
+
* matches the surrounding checkout fields. The form's own surface stays
|
|
743
777
|
* transparent — these only drive the inputs, submit button, and overlay.
|
|
744
778
|
*/
|
|
745
779
|
interface VaultCardThemeColors {
|
|
@@ -1463,13 +1497,12 @@ declare function getConfiguredBillingApiUrl(): string;
|
|
|
1463
1497
|
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
1464
1498
|
|
|
1465
1499
|
/** Current SDK version. */
|
|
1466
|
-
declare const SDK_VERSION = "1.4.
|
|
1500
|
+
declare const SDK_VERSION = "1.4.3";
|
|
1467
1501
|
/**
|
|
1468
1502
|
* HTTP header the SDK sends on `POST /v1/checkouts/sessions` so the backend
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
* older SDKs are unaffected and keep the legacy Stripe card path.
|
|
1503
|
+
* provides compatibility visibility on session create/read requests. Vault
|
|
1504
|
+
* capability is part of the session contract and must not be gated by this
|
|
1505
|
+
* value.
|
|
1473
1506
|
*
|
|
1474
1507
|
* @see SDK_VERSION — the value sent in this header.
|
|
1475
1508
|
*/
|
|
@@ -1828,7 +1861,7 @@ declare function partitionStripeMethods(enabledPaymentMethods: readonly string[]
|
|
|
1828
1861
|
paymentElementMethods: string[];
|
|
1829
1862
|
};
|
|
1830
1863
|
/** All supported element type identifiers. */
|
|
1831
|
-
declare const ELEMENT_TYPES: readonly ["payment", "
|
|
1864
|
+
declare const ELEMENT_TYPES: readonly ["payment", "address"];
|
|
1832
1865
|
declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard_debit", "amex", "discover"];
|
|
1833
1866
|
/** Country code to currency information mapping. */
|
|
1834
1867
|
declare const CURRENCY_MAP: Record<string, CurrencyInfo>;
|
|
@@ -2114,4 +2147,24 @@ declare function generateIdempotencyKey(): string | undefined;
|
|
|
2114
2147
|
*/
|
|
2115
2148
|
declare function resolveIdempotencyKey(supplied?: string): string | undefined;
|
|
2116
2149
|
|
|
2117
|
-
|
|
2150
|
+
/**
|
|
2151
|
+
* RFC 4122 v4 UUID shape (case-insensitive). Mirrors the backend's `@IsUUID()`
|
|
2152
|
+
* acceptance for the fields the SDK fills, e.g. the session-intent
|
|
2153
|
+
* `authorizationAttemptId`.
|
|
2154
|
+
*/
|
|
2155
|
+
declare const UUID_V4: RegExp;
|
|
2156
|
+
/** True when `value` is a v4 UUID string. */
|
|
2157
|
+
declare function isUuidV4(value: unknown): value is string;
|
|
2158
|
+
/**
|
|
2159
|
+
* Generate a cryptographically-random v4 UUID.
|
|
2160
|
+
*
|
|
2161
|
+
* Prefers `crypto.randomUUID()`, falls back to `crypto.getRandomValues`, and
|
|
2162
|
+
* only as a last resort to `Math.random`, so the SDK still produces a
|
|
2163
|
+
* well-formed UUID in environments without a secure RNG. Unlike
|
|
2164
|
+
* {@link generateIdempotencyKey} this never returns `undefined` or a non-UUID
|
|
2165
|
+
* string, because callers send it to backend fields validated as `@IsUUID()`
|
|
2166
|
+
* (a weak or missing value there is a hard `400`, not a silent downgrade).
|
|
2167
|
+
*/
|
|
2168
|
+
declare function randomUuidV4(): string;
|
|
2169
|
+
|
|
2170
|
+
export { type AVSFieldConfig, BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BOLD_DARK_APPEARANCE, BOLD_LIGHT_APPEARANCE, BUTTONS_LAYOUT_BOLD_DARK, BUTTONS_LAYOUT_BOLD_LIGHT, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_GLASS_DARK, BUTTONS_LAYOUT_GLASS_LIGHT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_MODERN_DARK, BUTTONS_LAYOUT_MODERN_LIGHT, BUTTONS_LAYOUT_ROUNDED, type BeforeButtonClickEvent, type BillingDetails, type BillingProvider, type BuildCheckoutDisplayDataOptions, type BuildTelemetryErrorEventInput, type BuildTelemetryLogEventInput, type BuildTelemetryPerformanceEventInput, type BuildTelemetryTerminalEventInput, type ButtonsLayoutStyles, type ButtonsLayoutTheme, CA_PROVINCES, COUNTRY_OPTIONS, CURRENCY_MAP, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessError, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreateSessionIntentRequest, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DeclineEvent, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, FLO_SDK_VERSION_HEADER, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, type MountedElement, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, type PayPalPaymentResult, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, SUPPORTED_CARD_BRANDS, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type StateOption, type StripeMethodEntry, type StripeMethodThemeVariant, type StripeSessionIntent, type StripeSessionIntentRequest, TELEMETRY_ERROR_CODES, TELEMETRY_LOG_NAMES, TELEMETRY_MAX_BATCH_BYTES, TELEMETRY_MAX_BATCH_EVENTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_SDK_PACKAGES, THEMES, type TagsData, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, buildItemPayload, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, configureFlopay, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCurrency, foldIntoProducts, generateIdempotencyKey, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasVendoredStripeMethodLogo, isAVSEnabled, isAVSFieldVisible, isPostalCodeSupported, isSetupIntentClientSecret, isUuidV4, isValidPostalCode, isValidPublishableKey, isValidSecretKey, needsStripeMethodExplicitConfirm, networkError, normalizeGatewayEnvironment, partitionStripeMethods, randomUuidV4, rateLimitError, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveIdempotencyKey, resolveSessionCurrency, resolveStripeMethodBrandVariant, resolveTheme, serializeTelemetryBatch, stripeExpressMethodToOptionKey, validationError };
|
package/dist/index.mjs
CHANGED
|
@@ -371,7 +371,7 @@ var VENDORED_LOGO_METHODS = [
|
|
|
371
371
|
];
|
|
372
372
|
|
|
373
373
|
// src/constants.ts
|
|
374
|
-
var SDK_VERSION2 = "1.4.
|
|
374
|
+
var SDK_VERSION2 = "1.4.3";
|
|
375
375
|
var FLO_SDK_VERSION_HEADER = "x-flo-sdk-version";
|
|
376
376
|
var BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
377
377
|
var BILLING_API_URL_PRODUCTION = "https://api.flopay.com";
|
|
@@ -1629,10 +1629,6 @@ function partitionStripeMethods(enabledPaymentMethods, options) {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
var ELEMENT_TYPES = [
|
|
1631
1631
|
"payment",
|
|
1632
|
-
"card",
|
|
1633
|
-
"cardNumber",
|
|
1634
|
-
"cardExpiry",
|
|
1635
|
-
"cardCvc",
|
|
1636
1632
|
"address"
|
|
1637
1633
|
];
|
|
1638
1634
|
var SUPPORTED_CARD_BRANDS = [
|
|
@@ -2486,6 +2482,31 @@ function resolveIdempotencyKey(supplied) {
|
|
|
2486
2482
|
}
|
|
2487
2483
|
return supplied;
|
|
2488
2484
|
}
|
|
2485
|
+
|
|
2486
|
+
// src/uuid.ts
|
|
2487
|
+
var UUID_V42 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
2488
|
+
function isUuidV4(value) {
|
|
2489
|
+
return typeof value === "string" && UUID_V42.test(value);
|
|
2490
|
+
}
|
|
2491
|
+
function randomUuidV4() {
|
|
2492
|
+
try {
|
|
2493
|
+
const id = globalThis.crypto.randomUUID();
|
|
2494
|
+
if (UUID_V42.test(id)) return id;
|
|
2495
|
+
} catch {
|
|
2496
|
+
}
|
|
2497
|
+
const bytes = new Uint8Array(16);
|
|
2498
|
+
try {
|
|
2499
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
2500
|
+
} catch {
|
|
2501
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
2502
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
2506
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
2507
|
+
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2508
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
2509
|
+
}
|
|
2489
2510
|
export {
|
|
2490
2511
|
BILLING_API_URL,
|
|
2491
2512
|
BILLING_API_URL_PRODUCTION,
|
|
@@ -2536,6 +2557,7 @@ export {
|
|
|
2536
2557
|
TELEMETRY_SDK_PACKAGES,
|
|
2537
2558
|
THEMES,
|
|
2538
2559
|
US_STATES,
|
|
2560
|
+
UUID_V42 as UUID_V4,
|
|
2539
2561
|
apiError,
|
|
2540
2562
|
authenticationError,
|
|
2541
2563
|
buildCheckoutDisplayData,
|
|
@@ -2567,6 +2589,7 @@ export {
|
|
|
2567
2589
|
isAVSFieldVisible,
|
|
2568
2590
|
isPostalCodeSupported,
|
|
2569
2591
|
isSetupIntentClientSecret,
|
|
2592
|
+
isUuidV4,
|
|
2570
2593
|
isValidPostalCode,
|
|
2571
2594
|
isValidPublishableKey,
|
|
2572
2595
|
isValidSecretKey,
|
|
@@ -2574,6 +2597,7 @@ export {
|
|
|
2574
2597
|
networkError,
|
|
2575
2598
|
normalizeGatewayEnvironment,
|
|
2576
2599
|
partitionStripeMethods,
|
|
2600
|
+
randomUuidV4,
|
|
2577
2601
|
rateLimitError,
|
|
2578
2602
|
resolveAVSConfig,
|
|
2579
2603
|
resolveBillingApiUrl,
|