@flopay/js 1.6.0 → 1.8.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/dist/index.d.cts CHANGED
@@ -1,63 +1,38 @@
1
- import * as _flopay_shared from '@flopay/shared';
2
- import { PaymentProviderAdapter, ElementOptions, ElementType, MountedElement, FloPayError, FloPayConfig, CaptureMethod, CardCaptureAdapter, PayPalPaymentResult, ConfirmPaymentParams, PaymentResult, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance, CreateSessionParams, CheckoutSessionResult } from '@flopay/shared';
1
+ import { CreateSessionParams, CheckoutSessionResult, PaymentProviderAdapter, FloPayConfig, CaptureMethod, CardCaptureAdapter, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance } from '@flopay/shared';
3
2
  export { SentryEventLike, SentryStackFrameLike, dropThirdPartyOnlyError } from '@flopay/shared';
4
3
  export { C as CardCaptureOperation, P as PaymentAPI, a as PciVaultCardCapture, b as PciVaultCardCaptureConfig, S as SESSION_CREATE_TELEMETRY, c as SessionDisplayCacheData, d as SessionDisplayProduct, e as cacheSessionDisplayData, f as clearSessionDisplayData, g as getSessionDisplayData } from './card-setup-B8II-Etg.cjs';
5
4
 
5
+ declare function createCheckoutSession(options: CreateSessionParams): Promise<CheckoutSessionResult>;
6
6
  /**
7
- * Manages the creation and lifecycle of payment elements.
7
+ * Creates a checkout session with automatic retry on transient transport,
8
+ * timeout/abort, and idempotency-in-progress errors.
8
9
  *
9
- * Each `FloPayElements` instance is bound to a single provider adapter
10
- * and tracks all created elements for cleanup.
10
+ * Uses jittered exponential backoff under the same total deadline as a single
11
+ * create (12 seconds by default, configurable with `timeoutMs`).
12
+ *
13
+ * The idempotency key (supplied or generated) is resolved **once**, before the
14
+ * retry loop, and reused for every attempt — so a timeout, a lost response, or
15
+ * a documented in-progress reply all replay the *same* key and cannot mint a
16
+ * second checkout session (TeamFloPay/backend#972). A later independent call
17
+ * resolves its own fresh key. A payload-conflict (`409`) is surfaced without
18
+ * retrying, since only the exact same request may safely replay a key.
11
19
  */
12
- declare class FloPayElements {
13
- private readonly provider;
14
- private readonly elementMap;
15
- private readonly baseOptions;
16
- constructor(provider: PaymentProviderAdapter, options?: ElementOptions);
17
- /**
18
- * Creates a new element of the given type.
19
- * If an element of that type already exists, it is destroyed first.
20
- */
21
- create(type: ElementType, options?: ElementOptions): Promise<MountedElement>;
22
- /** Returns a previously created element, or `null`. */
23
- getElement(type: ElementType): MountedElement | null;
24
- /**
25
- * Submits all mounted elements for validation.
26
- *
27
- * Returns an object with an optional error if validation fails.
28
- * This does NOT confirm the payment — call `floPay.confirmPayment()` for that.
29
- */
30
- submit(): Promise<{
31
- error?: FloPayError;
32
- }>;
33
- /** Destroys all created elements and clears the internal map. */
34
- destroy(): void;
35
- }
20
+ declare function createCheckoutSessionWithRetries(options: CreateSessionParams & {
21
+ maxRetries?: number;
22
+ }): Promise<CheckoutSessionResult>;
36
23
 
37
24
  /**
38
25
  * The main FloPay SDK instance.
39
26
  *
40
- * Created via `loadFloPay(publishableKey)`. Provides element management,
41
- * payment confirmation, and session retrieval.
27
+ * Created via `loadFloPay(publishableKey)`. Provides hosted card capture,
28
+ * raw-provider access, and session retrieval.
42
29
  */
43
30
  declare class FloPay {
44
31
  private readonly provider;
45
32
  private readonly config;
46
33
  private readonly telemetryReporter?;
47
- private currentElements;
48
34
  private now;
49
35
  constructor(provider: PaymentProviderAdapter, config: FloPayConfig);
50
- /**
51
- * Creates a new `FloPayElements` group for mounting payment fields.
52
- *
53
- * Only one elements group is active at a time. Creating a new one
54
- * destroys the previous group.
55
- */
56
- elements(options?: ElementOptions): FloPayElements;
57
- /** Submit elements for validation. */
58
- submitElements(): Promise<{
59
- error?: _flopay_shared.FloPayError;
60
- }>;
61
36
  /**
62
37
  * Create a {@link CardCaptureAdapter} for collecting card details through the
63
38
  * backend-rendered hosted vault PCI widget (TeamFloPay/backend#823).
@@ -75,22 +50,6 @@ declare class FloPay {
75
50
  /** Capture behavior used to classify legacy vault outcomes safely. */
76
51
  captureMethod?: CaptureMethod;
77
52
  }): CardCaptureAdapter;
78
- /** Confirm a PayPal payment: create intent via billing API → confirm → redirect if needed. */
79
- confirmPayPalPayment(params: {
80
- billingApiUrl: string;
81
- sessionId: string;
82
- email: string;
83
- returnUrl: string;
84
- /**
85
- * Session-bound checkout token forwarded to the session-scoped non-card
86
- * intent contract as `x-checkout-session-token`.
87
- */
88
- nonce?: string;
89
- }): Promise<PayPalPaymentResult>;
90
- /** Resume a PayPal payment after redirect return. Returns null if no PayPal params in URL. */
91
- resumePayPalPayment(): Promise<PayPalPaymentResult | null>;
92
- /** Confirms a non-card wallet/APM payment using the mounted PaymentElement. */
93
- confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
94
53
  /**
95
54
  * Retrieves a checkout session by ID via the billing API.
96
55
  *
@@ -111,8 +70,7 @@ declare class FloPay {
111
70
  retrieveUnifiedSession(sessionId: string, billingApiUrl?: string): Promise<NormalizedCheckoutSession>;
112
71
  /**
113
72
  * Returns the raw underlying provider instance (e.g. Stripe object).
114
- * Used internally by components that need direct provider access,
115
- * such as PayPal which requires its own Elements instance.
73
+ * Used internally by components that need direct provider access.
116
74
  */
117
75
  getRawProvider(): unknown;
118
76
  /** Tears down the SDK instance and releases resources. */
@@ -136,17 +94,16 @@ declare class FloPay {
136
94
  * import { loadFloPay } from '@flopay/js';
137
95
  *
138
96
  * const flopay = await loadFloPay('pk_test_...');
139
- * const elements = flopay.elements({ paymentMethodTypes: ['cashapp', 'ideal'] });
140
- * const paymentElement = await elements.create('payment');
141
- * paymentElement.mount('#payment-container');
97
+ * const session = await flopay.retrieveSession('session_uuid');
98
+ * console.log(session.status);
142
99
  * ```
143
100
  */
144
101
  declare function loadFloPay(publishableKey: string, options?: Omit<FloPayConfig, 'publishableKey'>): Promise<FloPay>;
145
102
 
146
103
  /**
147
104
  * A `FloPayAppearance` whose `theme` has been normalized to the set Stripe's
148
- * Appearance API accepts, so it can be handed straight to `stripe.elements()`
149
- * or `@stripe/react-stripe-js`'s `<Elements options={{ appearance }}>` without
105
+ * Appearance API accepts, so it can be handed straight to
106
+ * `@stripe/react-stripe-js`'s `<Elements options={{ appearance }}>` without
150
107
  * tripping Stripe.js's `Invalid value … provided to "theme"` warning.
151
108
  */
152
109
  interface StripeSafeAppearance {
@@ -154,81 +111,17 @@ interface StripeSafeAppearance {
154
111
  variables?: FloPayThemeVariables;
155
112
  rules?: Record<string, Record<string, string>>;
156
113
  }
157
- /**
158
- * Maps a `FloPayAppearance.theme` ('default' | 'flat' | 'night' | 'none') to a
159
- * Stripe Elements Appearance `theme` ('stripe' | 'flat' | 'night'). Stripe's
160
- * Appearance API only accepts those three; anything else triggers a console
161
- * warning and silently falls back. We normalize here so the bundles can keep
162
- * `'default'` as their public token.
163
- */
114
+ /** Maps FloPay's public appearance token to Stripe's accepted theme set. */
164
115
  declare function toStripeAppearanceTheme(theme: 'default' | 'flat' | 'night' | 'none' | undefined): 'stripe' | 'night' | 'flat';
165
- /**
166
- * Normalizes a whole `FloPayAppearance` into a Stripe-safe appearance by mapping
167
- * FloPay's public `theme` token onto Stripe's accepted set via
168
- * {@link toStripeAppearanceTheme}. `variables` and `rules` (including FloPay's
169
- * superset variable keys, which Stripe ignores at runtime) pass through
170
- * untouched. Every site that forwards an appearance to `@stripe/react-stripe-js`
171
- * must route it through here so `theme: 'default'` never reaches Stripe.js —
172
- * `StripeAdapter` already normalizes via `toStripeAppearanceTheme` internally,
173
- * and this keeps the React-mounted Elements groups on the same mapping.
174
- */
116
+ /** Normalizes a FloPay appearance before React passes it to Stripe Elements. */
175
117
  declare function toStripeAppearance(appearance: FloPayAppearance): StripeSafeAppearance;
176
- /**
177
- * Payment provider adapter backed by Stripe.
178
- *
179
- * Implements the `PaymentProviderAdapter` interface so that FloPay consumers
180
- * interact with a stable API regardless of the upstream provider.
181
- */
118
+ /** Payment provider adapter backed by Stripe. */
182
119
  declare class StripeAdapter implements PaymentProviderAdapter {
183
120
  readonly name = "stripe";
184
121
  private stripe;
185
- private elements;
186
- private appliedAppearanceKey;
187
- private appliedPaymentMethodTypesKey;
188
- private appliedClientSecret;
189
- private verifiedClientSecret;
190
- private verifiedPaymentMethodTypesKey;
191
122
  initialize(config: FloPayConfig): Promise<void>;
192
- /** Lazily creates the Stripe Elements group for the given options. */
193
- private getElements;
194
- private assertClientSecretPaymentMethods;
195
- createElement(type: ElementType, options: ElementOptions): Promise<MountedElement>;
196
- getElement(type: ElementType): MountedElement | null;
197
- submitElements(): Promise<{
198
- error?: FloPayError;
199
- }>;
200
- confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
201
- private extractPaymentMethodId;
202
- confirmPayPalPayment(params: {
203
- billingApiUrl: string;
204
- sessionId: string;
205
- email: string;
206
- returnUrl: string;
207
- nonce?: string;
208
- }): Promise<PayPalPaymentResult>;
209
- resumePayPalPayment(): Promise<PayPalPaymentResult | null>;
210
123
  getRawProvider(): unknown;
211
- createPayPalElements(options: ElementOptions): unknown;
212
124
  destroy(): void;
213
125
  }
214
126
 
215
- declare function createCheckoutSession(options: CreateSessionParams): Promise<CheckoutSessionResult>;
216
- /**
217
- * Creates a checkout session with automatic retry on transient transport,
218
- * timeout/abort, and idempotency-in-progress errors.
219
- *
220
- * Uses jittered exponential backoff under the same total deadline as a single
221
- * create (12 seconds by default, configurable with `timeoutMs`).
222
- *
223
- * The idempotency key (supplied or generated) is resolved **once**, before the
224
- * retry loop, and reused for every attempt — so a timeout, a lost response, or
225
- * a documented in-progress reply all replay the *same* key and cannot mint a
226
- * second checkout session (TeamFloPay/backend#972). A later independent call
227
- * resolves its own fresh key. A payload-conflict (`409`) is surfaced without
228
- * retrying, since only the exact same request may safely replay a key.
229
- */
230
- declare function createCheckoutSessionWithRetries(options: CreateSessionParams & {
231
- maxRetries?: number;
232
- }): Promise<CheckoutSessionResult>;
233
-
234
- export { FloPay, FloPayElements, StripeAdapter, type StripeSafeAppearance, createCheckoutSession, createCheckoutSessionWithRetries, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };
127
+ export { FloPay, StripeAdapter, type StripeSafeAppearance, createCheckoutSession, createCheckoutSessionWithRetries, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };
package/dist/index.d.ts CHANGED
@@ -1,63 +1,38 @@
1
- import * as _flopay_shared from '@flopay/shared';
2
- import { PaymentProviderAdapter, ElementOptions, ElementType, MountedElement, FloPayError, FloPayConfig, CaptureMethod, CardCaptureAdapter, PayPalPaymentResult, ConfirmPaymentParams, PaymentResult, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance, CreateSessionParams, CheckoutSessionResult } from '@flopay/shared';
1
+ import { CreateSessionParams, CheckoutSessionResult, PaymentProviderAdapter, FloPayConfig, CaptureMethod, CardCaptureAdapter, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance } from '@flopay/shared';
3
2
  export { SentryEventLike, SentryStackFrameLike, dropThirdPartyOnlyError } from '@flopay/shared';
4
3
  export { C as CardCaptureOperation, P as PaymentAPI, a as PciVaultCardCapture, b as PciVaultCardCaptureConfig, S as SESSION_CREATE_TELEMETRY, c as SessionDisplayCacheData, d as SessionDisplayProduct, e as cacheSessionDisplayData, f as clearSessionDisplayData, g as getSessionDisplayData } from './card-setup-B8II-Etg.js';
5
4
 
5
+ declare function createCheckoutSession(options: CreateSessionParams): Promise<CheckoutSessionResult>;
6
6
  /**
7
- * Manages the creation and lifecycle of payment elements.
7
+ * Creates a checkout session with automatic retry on transient transport,
8
+ * timeout/abort, and idempotency-in-progress errors.
8
9
  *
9
- * Each `FloPayElements` instance is bound to a single provider adapter
10
- * and tracks all created elements for cleanup.
10
+ * Uses jittered exponential backoff under the same total deadline as a single
11
+ * create (12 seconds by default, configurable with `timeoutMs`).
12
+ *
13
+ * The idempotency key (supplied or generated) is resolved **once**, before the
14
+ * retry loop, and reused for every attempt — so a timeout, a lost response, or
15
+ * a documented in-progress reply all replay the *same* key and cannot mint a
16
+ * second checkout session (TeamFloPay/backend#972). A later independent call
17
+ * resolves its own fresh key. A payload-conflict (`409`) is surfaced without
18
+ * retrying, since only the exact same request may safely replay a key.
11
19
  */
12
- declare class FloPayElements {
13
- private readonly provider;
14
- private readonly elementMap;
15
- private readonly baseOptions;
16
- constructor(provider: PaymentProviderAdapter, options?: ElementOptions);
17
- /**
18
- * Creates a new element of the given type.
19
- * If an element of that type already exists, it is destroyed first.
20
- */
21
- create(type: ElementType, options?: ElementOptions): Promise<MountedElement>;
22
- /** Returns a previously created element, or `null`. */
23
- getElement(type: ElementType): MountedElement | null;
24
- /**
25
- * Submits all mounted elements for validation.
26
- *
27
- * Returns an object with an optional error if validation fails.
28
- * This does NOT confirm the payment — call `floPay.confirmPayment()` for that.
29
- */
30
- submit(): Promise<{
31
- error?: FloPayError;
32
- }>;
33
- /** Destroys all created elements and clears the internal map. */
34
- destroy(): void;
35
- }
20
+ declare function createCheckoutSessionWithRetries(options: CreateSessionParams & {
21
+ maxRetries?: number;
22
+ }): Promise<CheckoutSessionResult>;
36
23
 
37
24
  /**
38
25
  * The main FloPay SDK instance.
39
26
  *
40
- * Created via `loadFloPay(publishableKey)`. Provides element management,
41
- * payment confirmation, and session retrieval.
27
+ * Created via `loadFloPay(publishableKey)`. Provides hosted card capture,
28
+ * raw-provider access, and session retrieval.
42
29
  */
43
30
  declare class FloPay {
44
31
  private readonly provider;
45
32
  private readonly config;
46
33
  private readonly telemetryReporter?;
47
- private currentElements;
48
34
  private now;
49
35
  constructor(provider: PaymentProviderAdapter, config: FloPayConfig);
50
- /**
51
- * Creates a new `FloPayElements` group for mounting payment fields.
52
- *
53
- * Only one elements group is active at a time. Creating a new one
54
- * destroys the previous group.
55
- */
56
- elements(options?: ElementOptions): FloPayElements;
57
- /** Submit elements for validation. */
58
- submitElements(): Promise<{
59
- error?: _flopay_shared.FloPayError;
60
- }>;
61
36
  /**
62
37
  * Create a {@link CardCaptureAdapter} for collecting card details through the
63
38
  * backend-rendered hosted vault PCI widget (TeamFloPay/backend#823).
@@ -75,22 +50,6 @@ declare class FloPay {
75
50
  /** Capture behavior used to classify legacy vault outcomes safely. */
76
51
  captureMethod?: CaptureMethod;
77
52
  }): CardCaptureAdapter;
78
- /** Confirm a PayPal payment: create intent via billing API → confirm → redirect if needed. */
79
- confirmPayPalPayment(params: {
80
- billingApiUrl: string;
81
- sessionId: string;
82
- email: string;
83
- returnUrl: string;
84
- /**
85
- * Session-bound checkout token forwarded to the session-scoped non-card
86
- * intent contract as `x-checkout-session-token`.
87
- */
88
- nonce?: string;
89
- }): Promise<PayPalPaymentResult>;
90
- /** Resume a PayPal payment after redirect return. Returns null if no PayPal params in URL. */
91
- resumePayPalPayment(): Promise<PayPalPaymentResult | null>;
92
- /** Confirms a non-card wallet/APM payment using the mounted PaymentElement. */
93
- confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
94
53
  /**
95
54
  * Retrieves a checkout session by ID via the billing API.
96
55
  *
@@ -111,8 +70,7 @@ declare class FloPay {
111
70
  retrieveUnifiedSession(sessionId: string, billingApiUrl?: string): Promise<NormalizedCheckoutSession>;
112
71
  /**
113
72
  * Returns the raw underlying provider instance (e.g. Stripe object).
114
- * Used internally by components that need direct provider access,
115
- * such as PayPal which requires its own Elements instance.
73
+ * Used internally by components that need direct provider access.
116
74
  */
117
75
  getRawProvider(): unknown;
118
76
  /** Tears down the SDK instance and releases resources. */
@@ -136,17 +94,16 @@ declare class FloPay {
136
94
  * import { loadFloPay } from '@flopay/js';
137
95
  *
138
96
  * const flopay = await loadFloPay('pk_test_...');
139
- * const elements = flopay.elements({ paymentMethodTypes: ['cashapp', 'ideal'] });
140
- * const paymentElement = await elements.create('payment');
141
- * paymentElement.mount('#payment-container');
97
+ * const session = await flopay.retrieveSession('session_uuid');
98
+ * console.log(session.status);
142
99
  * ```
143
100
  */
144
101
  declare function loadFloPay(publishableKey: string, options?: Omit<FloPayConfig, 'publishableKey'>): Promise<FloPay>;
145
102
 
146
103
  /**
147
104
  * A `FloPayAppearance` whose `theme` has been normalized to the set Stripe's
148
- * Appearance API accepts, so it can be handed straight to `stripe.elements()`
149
- * or `@stripe/react-stripe-js`'s `<Elements options={{ appearance }}>` without
105
+ * Appearance API accepts, so it can be handed straight to
106
+ * `@stripe/react-stripe-js`'s `<Elements options={{ appearance }}>` without
150
107
  * tripping Stripe.js's `Invalid value … provided to "theme"` warning.
151
108
  */
152
109
  interface StripeSafeAppearance {
@@ -154,81 +111,17 @@ interface StripeSafeAppearance {
154
111
  variables?: FloPayThemeVariables;
155
112
  rules?: Record<string, Record<string, string>>;
156
113
  }
157
- /**
158
- * Maps a `FloPayAppearance.theme` ('default' | 'flat' | 'night' | 'none') to a
159
- * Stripe Elements Appearance `theme` ('stripe' | 'flat' | 'night'). Stripe's
160
- * Appearance API only accepts those three; anything else triggers a console
161
- * warning and silently falls back. We normalize here so the bundles can keep
162
- * `'default'` as their public token.
163
- */
114
+ /** Maps FloPay's public appearance token to Stripe's accepted theme set. */
164
115
  declare function toStripeAppearanceTheme(theme: 'default' | 'flat' | 'night' | 'none' | undefined): 'stripe' | 'night' | 'flat';
165
- /**
166
- * Normalizes a whole `FloPayAppearance` into a Stripe-safe appearance by mapping
167
- * FloPay's public `theme` token onto Stripe's accepted set via
168
- * {@link toStripeAppearanceTheme}. `variables` and `rules` (including FloPay's
169
- * superset variable keys, which Stripe ignores at runtime) pass through
170
- * untouched. Every site that forwards an appearance to `@stripe/react-stripe-js`
171
- * must route it through here so `theme: 'default'` never reaches Stripe.js —
172
- * `StripeAdapter` already normalizes via `toStripeAppearanceTheme` internally,
173
- * and this keeps the React-mounted Elements groups on the same mapping.
174
- */
116
+ /** Normalizes a FloPay appearance before React passes it to Stripe Elements. */
175
117
  declare function toStripeAppearance(appearance: FloPayAppearance): StripeSafeAppearance;
176
- /**
177
- * Payment provider adapter backed by Stripe.
178
- *
179
- * Implements the `PaymentProviderAdapter` interface so that FloPay consumers
180
- * interact with a stable API regardless of the upstream provider.
181
- */
118
+ /** Payment provider adapter backed by Stripe. */
182
119
  declare class StripeAdapter implements PaymentProviderAdapter {
183
120
  readonly name = "stripe";
184
121
  private stripe;
185
- private elements;
186
- private appliedAppearanceKey;
187
- private appliedPaymentMethodTypesKey;
188
- private appliedClientSecret;
189
- private verifiedClientSecret;
190
- private verifiedPaymentMethodTypesKey;
191
122
  initialize(config: FloPayConfig): Promise<void>;
192
- /** Lazily creates the Stripe Elements group for the given options. */
193
- private getElements;
194
- private assertClientSecretPaymentMethods;
195
- createElement(type: ElementType, options: ElementOptions): Promise<MountedElement>;
196
- getElement(type: ElementType): MountedElement | null;
197
- submitElements(): Promise<{
198
- error?: FloPayError;
199
- }>;
200
- confirmPayment(params: ConfirmPaymentParams): Promise<PaymentResult>;
201
- private extractPaymentMethodId;
202
- confirmPayPalPayment(params: {
203
- billingApiUrl: string;
204
- sessionId: string;
205
- email: string;
206
- returnUrl: string;
207
- nonce?: string;
208
- }): Promise<PayPalPaymentResult>;
209
- resumePayPalPayment(): Promise<PayPalPaymentResult | null>;
210
123
  getRawProvider(): unknown;
211
- createPayPalElements(options: ElementOptions): unknown;
212
124
  destroy(): void;
213
125
  }
214
126
 
215
- declare function createCheckoutSession(options: CreateSessionParams): Promise<CheckoutSessionResult>;
216
- /**
217
- * Creates a checkout session with automatic retry on transient transport,
218
- * timeout/abort, and idempotency-in-progress errors.
219
- *
220
- * Uses jittered exponential backoff under the same total deadline as a single
221
- * create (12 seconds by default, configurable with `timeoutMs`).
222
- *
223
- * The idempotency key (supplied or generated) is resolved **once**, before the
224
- * retry loop, and reused for every attempt — so a timeout, a lost response, or
225
- * a documented in-progress reply all replay the *same* key and cannot mint a
226
- * second checkout session (TeamFloPay/backend#972). A later independent call
227
- * resolves its own fresh key. A payload-conflict (`409`) is surfaced without
228
- * retrying, since only the exact same request may safely replay a key.
229
- */
230
- declare function createCheckoutSessionWithRetries(options: CreateSessionParams & {
231
- maxRetries?: number;
232
- }): Promise<CheckoutSessionResult>;
233
-
234
- export { FloPay, FloPayElements, StripeAdapter, type StripeSafeAppearance, createCheckoutSession, createCheckoutSessionWithRetries, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };
127
+ export { FloPay, StripeAdapter, type StripeSafeAppearance, createCheckoutSession, createCheckoutSessionWithRetries, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as E,b as K,c as Re,d as Te,e as x,f as g,g as j,h as Z,i as ke,j as O,k as ee,l as z,m as te}from"./chunk-DQAAZZ2X.mjs";import{FloPayError as qe,resolveBillingApiUrl as $,SDK_VERSION as de}from"@flopay/shared";import{loadStripe as be}from"@stripe/stripe-js";import{FloPayError as p,isMoneySettledOutcome as Ae,isSetupIntentClientSecret as Ie}from"@flopay/shared";function re(r){return{payment:"payment",address:"address"}[r]}function U(r){switch(r){case"night":return"night";case"flat":return"flat";default:return"stripe"}}function Fe(r){return{...r,theme:U(r.theme)}}function B(r){return r?JSON.stringify(r.map(e=>e.trim().toLowerCase())):null}function ne(r){let e=r;return{mount(n){e.mount(n)},unmount(){e.unmount()},update(n){e.update(n)},on(n,t){e.on?.(n,t)},off(n,t){e.off?.(n,t)},destroy(){e.destroy()}}}function xe(r){return{billing_details:{...r.email?{email:r.email}:{},...r.name?{name:r.name}:{},...r.address?{address:{...r.address.country?{country:r.address.country}:{},...r.address.postal_code?{postal_code:r.address.postal_code}:{},...r.address.city?{city:r.address.city}:{},...r.address.line1?{line1:r.address.line1}:{},...r.address.line2?{line2:r.address.line2}:{},...r.address.state?{state:r.address.state}:{}}}:{}}}}var R=class{constructor(){this.name="stripe";this.stripe=null;this.elements=null;this.appliedAppearanceKey=null;this.appliedPaymentMethodTypesKey=null;this.appliedClientSecret=null;this.verifiedClientSecret=null;this.verifiedPaymentMethodTypesKey=null}async initialize(e){if(typeof window>"u")return;let n=await be(e.publishableKey,{locale:e.locale??"auto"});if(!n)throw new p("Failed to initialize Stripe. Check your publishable key.","authentication_error");this.stripe=n}getElements(e){if(!this.stripe)throw new p("StripeAdapter not initialized. Call initialize() first.","api_error");let n=e?.appearance?{theme:U(e.appearance.theme),variables:e.appearance.variables,rules:e.appearance.rules}:void 0,t=n?JSON.stringify(n):null,a=B(e?.paymentMethodTypes),o=e?.clientSecret??null;if(this.elements&&a&&(a!==this.appliedPaymentMethodTypesKey||o!==this.appliedClientSecret)&&(this.elements=null,this.appliedAppearanceKey=null,this.appliedPaymentMethodTypesKey=null,this.appliedClientSecret=null,this.verifiedClientSecret=null,this.verifiedPaymentMethodTypesKey=null),this.elements)t!==this.appliedAppearanceKey&&(this.elements.update({appearance:n??{}}),this.appliedAppearanceKey=t);else{let l,s=e?.amount??0,i=(e?.currency??"usd").toLowerCase(),d=e?.paymentMethodCreation??"manual";e?.clientSecret?l={clientSecret:e.clientSecret}:s>0?(l={mode:"payment",amount:s,currency:i,paymentMethodCreation:d},e?.setupFutureUsage&&(l.setupFutureUsage=e.setupFutureUsage)):l={mode:"setup",currency:i,paymentMethodCreation:d},!e?.clientSecret&&e?.paymentMethodTypes&&(l.paymentMethodTypes=e.paymentMethodTypes),n&&(l.appearance=n),this.elements=this.stripe.elements(l),this.appliedAppearanceKey=t,this.appliedPaymentMethodTypesKey=a,this.appliedClientSecret=o,this.verifiedClientSecret=null,this.verifiedPaymentMethodTypesKey=null}return this.elements}async assertClientSecretPaymentMethods(e,n){if(!this.stripe)throw new p("StripeAdapter not initialized. Call initialize() first.","api_error");let t,a=!1;if(Ie(e)){let{setupIntent:i,error:d}=await this.stripe.retrieveSetupIntent(e);t=i,a=!!d}else{let{paymentIntent:i,error:d}=await this.stripe.retrievePaymentIntent(e);t=i,a=!!d}let o=t?.payment_method_types;if(a||!Array.isArray(o))throw new p("Unable to verify the payment methods configured for this client secret.","api_error",{param:"clientSecret"});let l=new Set(n.map(i=>i.toLowerCase()));if(o.some(i=>typeof i!="string"||!l.has(i.trim().toLowerCase()))||o.length===0)throw new p("The client-secret intent must enable only declared non-card payment methods.","validation_error",{param:"clientSecret"})}async createElement(e,n){let t=n;if(e==="payment"){let i=n.paymentMethodTypes?.map(d=>d.trim()).filter(d=>d&&d.toLowerCase()!=="card");if(!i?.length)throw new p("At least one supported non-card payment method is required.","validation_error",{param:"paymentMethodTypes"});if(t={...n,paymentMethodTypes:i},t.clientSecret){let d=B(i);this.elements&&this.appliedClientSecret===t.clientSecret&&this.appliedPaymentMethodTypesKey===d&&this.verifiedClientSecret===t.clientSecret&&this.verifiedPaymentMethodTypesKey===d||await this.assertClientSecretPaymentMethods(t.clientSecret,i)}}let a=this.getElements(t);e==="payment"&&t.clientSecret&&(this.verifiedClientSecret=t.clientSecret,this.verifiedPaymentMethodTypesKey=B(t.paymentMethodTypes));let o=re(e),l={};t.layout&&(l.layout=t.layout),t.defaultValues&&(l.defaultValues=t.defaultValues),t.readOnly&&(l.readOnly=t.readOnly),t.mode&&(l.mode=t.mode);let s=a.create(o,l);return ne(s)}getElement(e){if(!this.elements)return null;let n=re(e),t=this.elements.getElement(n);return t?ne(t):null}async submitElements(){if(!this.stripe||!this.elements)return{error:new p("Stripe not initialized","api_error")};let{error:e}=await this.elements.submit();return e?{error:new p(e.message??"Validation failed","validation_error")}:{}}async confirmPayment(e){if(!this.stripe||!this.elements)throw new p("StripeAdapter not initialized or no elements created.","api_error");let n=e.billingDetails,t=n?xe(n):void 0,{error:a,paymentIntent:o}=await this.stripe.confirmPayment({elements:this.elements,clientSecret:e.clientSecret,confirmParams:{return_url:e.returnUrl??window.location.href,...t?{payment_method_data:t}:{}},redirect:"if_required"});return a?{status:"failed",error:new p(a.message??"Payment failed","api_error",{code:a.code,declineCode:a.decline_code})}:o?{status:{succeeded:"succeeded",processing:"processing",requires_action:"requires_action",requires_payment_method:"failed",canceled:"failed"}[o.status]??"failed",paymentIntentId:o.id,paymentMethodId:this.extractPaymentMethodId(o.payment_method)}:{status:"failed",error:new p("No payment intent returned","api_error")}}extractPaymentMethodId(e){if(typeof e=="string"&&e.startsWith("pm_"))return e;if(e&&typeof e=="object"&&typeof e.id=="string")return e.id}async confirmPayPalPayment(e){if(!this.stripe)return{status:"failed",error:new p("Stripe not initialized","api_error")};let n=e.billingApiUrl.replace(/\/+$/,"");if(this.elements){let{error:o}=await this.elements.submit();if(o)return{status:"failed",error:new p(o.message??"PayPal payment failed","validation_error",{code:o.code})}}let t;try{let o=await new O(n).createSessionIntent(e.sessionId,e.nonce??"",{provider:"stripe",paymentMethodCategory:"wallet",paymentMethodType:"paypal",paymentMethodId:null,intentKind:"payment"});if(o.provider!=="stripe")throw new p("Invalid provider returned for PayPal intent","api_error");t=o.clientSecret}catch(o){return{status:"failed",error:o instanceof p?o:new p("Failed to create PayPal payment intent","api_error")}}let{error:a}=await this.stripe.confirmPayment({clientSecret:t,elements:this.elements??void 0,confirmParams:{return_url:e.returnUrl}});if(a){if(e.nonce)try{await new O(n).reportSessionIntentDecline(e.sessionId,e.nonce,{provider:"stripe",paymentMethodCategory:"wallet",paymentMethodType:"paypal",providerDeclineReason:a.code??"provider_declined"})}catch{}return{status:"failed",error:new p(a.message??"PayPal payment failed","api_error",{code:a.code})}}return{status:"processing"}}async resumePayPalPayment(){if(!this.stripe||typeof window>"u")return null;let e=new URLSearchParams(window.location.search),n=e.get("payment_intent"),t=e.get("payment_intent_client_secret"),a=e.get("redirect_status");if(!n||!t)return null;if(a==="failed")return{status:"failed",error:new p("PayPal payment was declined. Please try again.","api_error")};let{paymentIntent:o,error:l}=await this.stripe.retrievePaymentIntent(t);if(l)return{status:"failed",error:new p(l.message??"Failed to retrieve PayPal payment","api_error")};if(o&&Ae(o.status)){let s=typeof o.payment_method=="string"?o.payment_method:o.payment_method?.id,i=new URL(window.location.href);return i.searchParams.delete("payment_intent"),i.searchParams.delete("payment_intent_client_secret"),i.searchParams.delete("redirect_status"),window.history.replaceState({},"",i.toString()),{status:o.status,paymentIntentId:o.id,paymentMethodId:s}}return{status:"failed",error:new p("PayPal payment was not completed. Please try again.","api_error")}}getRawProvider(){return this.stripe}createPayPalElements(e){if(!this.stripe)return null;let n={mode:"payment",amount:e.amount??0,currency:(e.currency??"usd").toLowerCase(),captureMethod:"manual"};return e.setupFutureUsage&&(n.setupFutureUsage=e.setupFutureUsage),e.appearance&&(n.appearance={theme:U(e.appearance.theme),variables:e.appearance.variables,rules:e.appearance.rules}),this.stripe.elements(n)}destroy(){this.elements=null,this.appliedAppearanceKey=null,this.appliedPaymentMethodTypesKey=null,this.appliedClientSecret=null,this.verifiedClientSecret=null,this.verifiedPaymentMethodTypesKey=null,this.stripe=null}};import{FloPayError as m,classifyTelemetryFailure as V,resolveBillingApiUrl as se,SDK_VERSION as Ue}from"@flopay/shared";import{FloPayError as Oe}from"@flopay/shared";var T=class{constructor(e,n){this.elementMap=new Map;this.provider=e,this.baseOptions=n??{}}async create(e,n){let t={...this.baseOptions,...n};if(e==="payment"){let s=t.paymentMethodTypes?.map(i=>i.trim()).filter(i=>i&&i.toLowerCase()!=="card");if(!s?.length)throw new Oe("At least one supported non-card payment method is required.","validation_error",{param:"paymentMethodTypes"});t.paymentMethodTypes=s}let a=this.provider.getElement(e);if(a)return this.elementMap.set(e,a),a;let o=this.elementMap.get(e);o&&o.destroy();let l=await this.provider.createElement(e,t);return this.elementMap.set(e,l),l}getElement(e){return this.elementMap.get(e)??null}async submit(){return{}}destroy(){for(let e of this.elementMap.values())e.destroy();this.elementMap.clear()}};var ae=Symbol.for("@flopay/js.telemetry.bridge.v1");function oe(r,e,n){let t=()=>e?.now()??n();Object.defineProperty(r,ae,{configurable:!1,enumerable:!1,writable:!1,value:{error:o=>e?.error(o),log:o=>e?.log(o),performance:o=>e?.performance(o),terminal:o=>e?.terminal(o),now:t,elapsed:o=>Math.max(0,t()-o),setCheckoutContext:o=>e?.setCheckoutContext(o),beginCheckout:(o={})=>e?.beginCheckout(o)??t(),disable:()=>e?.disable()}})}function ie(r){return r[ae]}function v(r){if(!r)return!1;let e=r.code?.toLowerCase()??"";return!!r.declineCode||e.includes("declin")}function De(r){return r==="stripe"||r==="paypal"||r==="pcivault"?r:"other"}var D=class{constructor(e,n,t){this.currentElements=null;this.provider=e,this.config=n,this.telemetryReporter=t??new g({billingApiUrl:se(n.billingApiUrl),sdkVersion:Ue,enabled:n.telemetry!==!1}),oe(this,this.telemetryReporter,x)}now(){return this.telemetryReporter?.now?.()??x()}elements(e){return this.currentElements&&this.currentElements.destroy(),this.currentElements=new T(this.provider,{appearance:this.config.appearance,...e}),this.currentElements}async submitElements(){return this.provider.submitElements()}cardCapture(e){return this.telemetryReporter?.log({name:"vault.capture.requested",stage:"vault_request",provider:"pcivault",paymentMethodCategory:"card"}),this.telemetryReporter?te({sessionId:e?.sessionId,captureMethod:e?.captureMethod},this.telemetryReporter):new z({sessionId:e?.sessionId,captureMethod:e?.captureMethod,telemetry:!1})}async confirmPayPalPayment(e){let n=this.now();this.telemetryReporter?.log({name:"payment.method.selected",stage:"processing",provider:"paypal",paymentMethodCategory:"paypal"}),this.telemetryReporter?.log({name:"payment.intent.started",stage:"processing",provider:"paypal",paymentMethodCategory:"paypal",requestCategory:"intent_create"});try{let t=await this.provider.confirmPayPalPayment(e);return this.telemetryReporter?.performance({stage:"processing",durationMs:this.now()-n,durationMode:"machine",provider:"paypal",paymentMethodCategory:"paypal"}),t.error||this.telemetryReporter?.log({name:"payment.intent.completed",stage:"processing",provider:"paypal",paymentMethodCategory:"paypal",requestCategory:"intent_create",statusClass:"2xx"}),t.status==="requires_action"?(this.telemetryReporter?.log({name:"provider.redirect.started",stage:"redirect",provider:"paypal",paymentMethodCategory:"paypal"}),this.telemetryReporter?.terminal({outcome:"action_required",stage:"redirect",provider:"paypal",paymentMethodCategory:"paypal"})):t.status==="succeeded"?this.telemetryReporter?.terminal({outcome:"payment_succeeded",provider:"paypal",paymentMethodCategory:"paypal"}):t.status!=="processing"&&(v(t.error)?this.telemetryReporter?.terminal({outcome:"payment_declined",provider:"paypal",paymentMethodCategory:"paypal"}):t.error?.type==="validation_error"?this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:"paypal",paymentMethodCategory:"paypal"}):t.error&&this.telemetryReporter?.error({errorCode:"PAYMENT_PROCESSING_FAILED",failureCategory:"provider_runtime",stage:"processing",provider:"paypal",paymentMethodCategory:"paypal",requestCategory:"intent_create"})),t}catch(t){if(this.telemetryReporter?.performance({stage:"processing",durationMs:this.now()-n,durationMode:"machine",provider:"paypal",paymentMethodCategory:"paypal"}),t instanceof m&&v(t))this.telemetryReporter?.terminal({outcome:"payment_declined",provider:"paypal",paymentMethodCategory:"paypal"});else if(t instanceof m&&t.type==="validation_error")this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:"paypal",paymentMethodCategory:"paypal"});else{let a=V(t,"PAYMENT_PROCESSING_FAILED","unknown");this.telemetryReporter?.error({...a,failureCategory:a.failureCategory??"provider_runtime",stage:"processing",provider:"paypal",paymentMethodCategory:"paypal",requestCategory:"intent_create"})}throw t}}async resumePayPalPayment(){let e=this.now();try{let n=await this.provider.resumePayPalPayment();return n===null?null:(this.telemetryReporter?.log({name:"provider.redirect.resumed",stage:"redirect_resume",provider:"paypal",paymentMethodCategory:"paypal"}),this.telemetryReporter?.performance({stage:"redirect_resume",durationMs:this.now()-e,durationMode:"machine",provider:"paypal",paymentMethodCategory:"paypal"}),n.status==="succeeded"?this.telemetryReporter?.terminal({outcome:"payment_succeeded",provider:"paypal",paymentMethodCategory:"paypal"}):v(n.error)?this.telemetryReporter?.terminal({outcome:"payment_declined",provider:"paypal",paymentMethodCategory:"paypal"}):n.error?.type==="validation_error"?this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:"paypal",paymentMethodCategory:"paypal"}):n.error&&this.telemetryReporter?.error({errorCode:"REDIRECT_RESUME_FAILED",failureCategory:"provider_runtime",stage:"redirect_resume",provider:"paypal",paymentMethodCategory:"paypal"}),n)}catch(n){if(this.telemetryReporter?.performance({stage:"redirect_resume",durationMs:this.now()-e,durationMode:"machine",provider:"paypal",paymentMethodCategory:"paypal"}),n instanceof m&&v(n))this.telemetryReporter?.terminal({outcome:"payment_declined",provider:"paypal",paymentMethodCategory:"paypal"});else if(n instanceof m&&n.type==="validation_error")this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:"paypal",paymentMethodCategory:"paypal"});else{let t=V(n,"REDIRECT_RESUME_FAILED","unknown");this.telemetryReporter?.error({...t,failureCategory:t.failureCategory??"provider_runtime",stage:"redirect_resume",provider:"paypal",paymentMethodCategory:"paypal"})}throw n}}async confirmPayment(e){if(e.paymentMethodCategory!=="wallet"&&e.paymentMethodCategory!=="apm"||!e.paymentMethodType?.trim()||e.paymentMethodType.trim().toLowerCase()==="card")throw new m("A supported non-card payment method is required.","validation_error",{param:"paymentMethodType"});let n=this.now(),t=De(this.provider.name);this.telemetryReporter?.log({name:"payment.processing.started",stage:"processing",provider:t,paymentMethodCategory:e.paymentMethodCategory});try{let a=await this.provider.confirmPayment(e),o=this.now()-n;return this.telemetryReporter?.performance({stage:"processing",durationMs:o,durationMode:"machine",provider:t,paymentMethodCategory:e.paymentMethodCategory}),a.status==="succeeded"?this.telemetryReporter?.terminal({outcome:"payment_succeeded",provider:t,paymentMethodCategory:e.paymentMethodCategory}):v(a.error)?this.telemetryReporter?.terminal({outcome:"payment_declined",provider:t,paymentMethodCategory:e.paymentMethodCategory}):a.error?.type==="validation_error"?this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:t,paymentMethodCategory:e.paymentMethodCategory}):a.status==="requires_action"?this.telemetryReporter?.terminal({outcome:"action_required",stage:"three_ds_handoff",provider:t,paymentMethodCategory:e.paymentMethodCategory}):a.status==="failed"&&a.error&&this.telemetryReporter?.error({errorCode:"PAYMENT_PROCESSING_FAILED",failureCategory:"provider_runtime",stage:"processing",provider:t,paymentMethodCategory:e.paymentMethodCategory}),a.status==="succeeded"||a.status==="failed"?this.telemetryReporter?.log({name:"payment.processing.completed",stage:"processing",provider:t,paymentMethodCategory:e.paymentMethodCategory}):this.telemetryReporter?.log({name:"operation.state_transition",stage:a.status==="requires_action"?"three_ds_handoff":"processing",provider:t,paymentMethodCategory:e.paymentMethodCategory}),a}catch(a){throw this.telemetryReporter?.performance({stage:"processing",durationMs:this.now()-n,durationMode:"machine",provider:t,paymentMethodCategory:e.paymentMethodCategory}),a instanceof m&&v(a)?this.telemetryReporter?.terminal({outcome:"payment_declined",provider:t,paymentMethodCategory:e.paymentMethodCategory}):a instanceof m&&a.type==="validation_error"?this.telemetryReporter?.terminal({outcome:"validation_rejected",provider:t,paymentMethodCategory:e.paymentMethodCategory}):this.telemetryReporter?.error({errorCode:"PAYMENT_PROCESSING_FAILED",failureCategory:"provider_runtime",stage:"processing",provider:t,paymentMethodCategory:e.paymentMethodCategory}),a}}async retrieveSession(e,n){if(!e)throw new m("sessionId is required to retrieve a session.","validation_error",{param:"sessionId"});let t=await this.retrieveUnifiedSession(e,n);if(!t.data.session)throw new m("Session not found","api_error");return t.data.session}async retrieveUnifiedSession(e,n){if(!e)throw new m("sessionId is required.","validation_error",{param:"sessionId"});let t=se(n??this.config.billingApiUrl),a=this.now();this.telemetryReporter?.log({name:"session.read.started",stage:"session_read",requestCategory:"session_read"});let o,l=ee(t,{now:()=>this.telemetryReporter?.now()??x(),onFirstByte:s=>{o=s},onRetry:(s,i)=>{this.telemetryReporter?.log({name:"operation.retry",stage:s==="session_read"?"session_read":"processing",requestCategory:s,attempt:i})}});try{let s=await l.getUnifiedCheckoutSession(e);return o!==void 0&&(this.telemetryReporter?.log({name:"session.request.first_byte",stage:"session_first_byte",requestCategory:"session_read",statusClass:"2xx"}),this.telemetryReporter?.performance({stage:"session_first_byte",durationMs:o,durationMode:"machine",requestCategory:"session_read",statusClass:"2xx"})),this.telemetryReporter?.log({name:"session.request.completed",stage:"session_complete",requestCategory:"session_read",statusClass:"2xx"}),this.telemetryReporter?.log({name:"checkout.data.ready",stage:"checkout_data_ready"}),this.telemetryReporter?.performance({stage:"session_complete",durationMs:this.now()-a,durationMode:"machine",requestCategory:"session_read",statusClass:"2xx"}),s}catch(s){let i=V(s,s instanceof m&&s.code==="checkout_processing_timeout"?"REQUEST_TIMEOUT":"NETWORK_REQUEST_FAILED");throw this.telemetryReporter?.error({...i,stage:"session_read",provider:"flo",paymentMethodCategory:"unknown"}),this.telemetryReporter?.performance({stage:"session_complete",durationMs:this.now()-a,durationMode:"machine",requestCategory:"session_read",statusClass:i.statusClass}),s}}getRawProvider(){return this.provider.getRawProvider()}destroy(){this.telemetryReporter?.log({name:"checkout.unmount",stage:"unmount"}),this.telemetryReporter?.destroy(),this.currentElements?.destroy(),this.currentElements=null,this.provider.destroy()}};function le(r,e,n){let t=D;return new t(r,e,n)}var pe=new Map;function Y(r){return Array.isArray(r)?r.map(Y):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,Y(n)])):r}function Le(r,e){return JSON.stringify([r,$(e?.billingApiUrl),e?.telemetry!==!1,e?.locale??"auto",e?.apiVersion??null,Y(e?.appearance??null)])}var q=new Map;async function Ne(r,e){if(!r){let s=new g({billingApiUrl:$(e?.billingApiUrl),sdkVersion:de,enabled:e?.telemetry!==!1});throw s.error({errorCode:"CONFIGURATION_INVALID",stage:"sdk_initialize",paymentMethodCategory:"unknown"}),s.flush().catch(()=>{}).finally(()=>s.destroy()),new qe("A publishable key is required to initialize FloPay.","validation_error",{param:"publishableKey"})}let n=Le(r,e),t=pe.get(n);if(t)return e?.telemetry!==!1&&ie(t)?.log({name:"sdk.cache.hit",stage:"sdk_initialize"}),t;let a=q.get(n);if(a)return a;let o={...e,publishableKey:r},l=(async()=>{let s=new g({billingApiUrl:$(o.billingApiUrl),sdkVersion:de,enabled:o.telemetry!==!1}),i=s.now();s.log({name:"sdk.initialize.started",stage:"sdk_initialize"}),s.log({name:"sdk.cache.miss",stage:"sdk_initialize"}),s.log({name:"provider.load.started",stage:"provider_load",provider:"stripe"});let d=new R,h=s.now();try{await d.initialize(o)}catch(f){throw s.error({errorCode:"SDK_INITIALIZATION_FAILED",failureCategory:"provider_runtime",stage:"sdk_initialize",provider:"stripe",paymentMethodCategory:"unknown"}),s.destroy(),f}let C=s.now();s.log({name:"provider.ready",stage:"provider_ready",provider:"stripe"}),s.log({name:"provider.availability.checked",stage:"provider_ready",provider:"stripe"}),s.log({name:"sdk.initialize.ready",stage:"sdk_initialize"}),s.performance({stage:"sdk_initialize",durationMs:C-i,durationMode:"machine",provider:"stripe"}),s.performance({stage:"provider_ready",durationMs:C-h,durationMode:"machine",provider:"stripe"});let y=le(d,o,s);return pe.set(n,y),y})();q.set(n,l);try{return await l}finally{q.get(n)===l&&q.delete(n)}}import{FloPayError as S,IDEMPOTENCY_IN_PROGRESS_CODE as Ke,IDEMPOTENCY_KEY_HEADER as je,SDK_VERSION as ce,assertCaptureMethodEligible as ze,buildProductPayload as Be,classifyTelemetryFailure as Ve,foldIntoProducts as $e,resolveIdempotencyKey as me,resolveSessionCurrency as Ye,telemetryStatusClass as ye}from"@flopay/shared";var H=5,ue=new WeakSet;function Ge(r){(typeof r=="object"&&r!==null||typeof r=="function")&&ue.add(r)}function He(r){return(typeof r=="object"&&r!==null||typeof r=="function")&&ue.has(r)}function Je(r,e){let n=e?.error,t=E(e?.code)??E(n?.code)??`http_${r}`,a=E(e?.message)??E(n?.message)??We(t,r);return new S(a,"api_error",{code:t,statusCode:r})}function We(r,e){switch(r){case"CouponLimitExceeded":return`Too many coupon codes \u2014 a checkout session accepts at most ${H}.`;case"CouponCurrencyUnsupported":return"One of the applied coupons has no price configured for the cart currency.";default:return`Failed to create checkout session (HTTP ${e}).`}}async function he(r,e,n){let{billingApiUrl:t,checkoutBaseUrl:a,items:o=[],subscriptions:l=[],products:s,account:i,successUrl:d,cancelUrl:h,checkoutMode:C="confirm",captureMethod:y,couponCodes:f=[],tagsData:J,redirectParams:Pe={},setCookie:we=!0,clientId:ve,currency:_e,utmMetadata:W,idempotencyKey:Se}=r,Q=me(Se);if(f.length>H)throw new S(`Too many coupon codes \u2014 a checkout session accepts at most ${H}.`,"validation_error",{code:"CouponLimitExceeded",param:"couponCodes"});let M=s??$e(o,l);ze({captureMethod:y,products:M});let P=Ye(_e,o,l,M);if(!P)throw new S("currency is required: pass `currency` on the session, or include a `currency` on the first item/subscription/product.","validation_error",{code:"CurrencyRequired",param:"currency"});let k={clientId:ve,checkoutVersion:ce,successUrl:d,cancelUrl:h,currency:P,checkoutMode:C,products:M.map(u=>Be(u,P)),accountData:{userId:i.userId,firstName:i.firstName??null,lastName:i.lastName??null,email:i.email,country:i.country??null,gender:i.gender??null,city:i.city??null,state:i.state??null,zip:i.zip??null,addressLine1:i.addressLine1??null,addressLine2:i.addressLine2??null},couponCodes:f};y==="manual"&&(k.captureMethod=y),J&&(k.tagsData=J),W?.length&&(k.utmMetadata=W);let Me=`${t.replace(/\/+$/,"")}/v1/checkouts/sessions`,X={"Content-Type":"application/json"};Q&&(X[je]=Q);let w,b,Ee={method:"POST",headers:X,body:JSON.stringify(k),signal:e},A;try{A=await fetch(Me,Ee)}catch(u){throw Ge(u),u}try{n?.(A.status)}catch{}w=A.status;try{b=await A.json()}catch{}if(w>=400)throw Je(w,b);if(w===201){let u=b?.data?.uuid,N=b?.data?.nonce;if(!u)throw new Error("Checkout session created but no UUID was returned by the billing API");if(!N)throw new S("Checkout session created but no `nonce` was returned by the billing API. Upgrade the billing service to TeamFloPay/backend#640 or later.","api_error",{code:"MissingCheckoutSessionToken"});(M.length||P)&&K(u,{currency:P,products:M.map(c=>({code:c.code??c.providerItemId??c.providerPlanId,type:c.type,name:c.name??c.itemName??c.providerItemName??c.subscriptionName??c.providerPlanName??null,totalAmount:c.totalAmount,overrideAmount:c.overrideAmount,currency:c.currency??P}))});let I=new URL(`${a.replace(/\/+$/,"")}/secure`);I.searchParams.set("id",u);for(let[c,F]of Object.entries(Pe))I.searchParams.set(c,F);if(we&&typeof window<"u"&&typeof document<"u"){let c=JSON.stringify({origin_url:h}),F=window.location.hostname.split(".").slice(-2).join(".");document.cookie=`checkout_data=${encodeURIComponent(c)}; domain=.${F}; path=/; max-age=3600; SameSite=Lax; Secure;`,document.cookie=`flopay_checkout_token=${encodeURIComponent(N)}; domain=.${F}; path=/; max-age=3600; SameSite=Lax; Secure;`}return typeof window<"u"&&(window.location.href=I.toString()),{status:201,redirectUrl:I.toString(),nonce:N}}return w===204?(typeof window<"u"&&(window.location.href=d),{status:204}):{status:w}}async function Qe(r){let e=ge(r),n=fe(e),t=j(r.timeoutMs);try{let a=await he(r,t.signal,n);return Ce(e,a),a}catch(a){throw L(e,a),a}finally{t.clear(),_(e.reporter)}}function fe(r){let e=!1;return n=>{if(e)return;e=!0;let t=ye(n);r.reporter.log({name:"session.request.first_byte",stage:"session_first_byte",requestCategory:"session_create",statusClass:t,attempt:r.attempt}),r.reporter.performance({stage:"session_first_byte",durationMs:r.reporter.now()-r.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:t,attempt:r.attempt})}}function ge(r){let e=new g({billingApiUrl:r.billingApiUrl,sdkVersion:ce,enabled:r.telemetry!==!1}),n=e.now();return e.log({name:"session.create.started",stage:"session_create",requestCategory:"session_create"}),{reporter:e,startedAt:n,attempt:0}}function Ce(r,e){let n=ye(e.status);r.reporter.log({name:"session.request.completed",stage:"session_create",requestCategory:"session_create",statusClass:n}),r.reporter.performance({stage:"session_create",durationMs:r.reporter.now()-r.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:n,attempt:r.attempt})}function L(r,e){let{reporter:n}=r,t=Ve(e,"CHECKOUT_SESSION_CREATE_FAILED");if(n.performance({stage:"session_create",durationMs:n.now()-r.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:t.statusClass,attempt:r.attempt}),e instanceof S&&e.type==="validation_error"){n.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create"});return}if(t.statusClass==="4xx"){n.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create",statusClass:"4xx"});return}n.error({...t,stage:"session_create",requestCategory:"session_create"})}function _(r){r.flush().catch(()=>{}).finally(()=>r.destroy())}async function Xe(r){let{maxRetries:e=2,...n}=r,t=ge(r),a=fe(t);if(!Number.isFinite(e)||!Number.isInteger(e)||e<0||e>=3)throw t.reporter.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create"}),_(t.reporter),new Error(`Number of retries must be an integer between 0 and ${2}`);let o={...n,idempotencyKey:me(n.idempotencyKey)},l=j(n.timeoutMs),s;for(let i=0;i<=e;i++){t.attempt=i;try{let d=await he(o,l.signal,a);return Ce(t,d),l.clear(),_(t.reporter),d}catch(d){s=d;let h=d instanceof Error&&d.name==="AbortError",C=He(d),y=d instanceof S&&d.code===Ke;if((h||C||y)&&!l.signal.aborted&&i<e){t.reporter.log({name:"operation.retry",stage:"session_create",requestCategory:"session_create",attempt:i+1});try{await Z(i,l.signal)}catch(f){throw L(t,f),l.clear(),_(t.reporter),f}continue}throw L(t,d),l.clear(),_(t.reporter),d}}throw L(t,s),l.clear(),_(t.reporter),s??new Error("Unknown error during checkout session creation")}import{dropThirdPartyOnlyError as Dt}from"@flopay/shared";export{D as FloPay,T as FloPayElements,O as PaymentAPI,z as PciVaultCardCapture,ke as SESSION_CREATE_TELEMETRY,R as StripeAdapter,K as cacheSessionDisplayData,Te as clearSessionDisplayData,Qe as createCheckoutSession,Xe as createCheckoutSessionWithRetries,Dt as dropThirdPartyOnlyError,Re as getSessionDisplayData,Ne as loadFloPay,Fe as toStripeAppearance,U as toStripeAppearanceTheme};
1
+ import{a as S,b as U,c as Y,d as N,e as Ce,f as we,g as E,h as y,i as be,j as Pe,k as W,l as D,m as G}from"./chunk-CR4J5H7I.mjs";import{dropThirdPartyOnlyError as mt}from"@flopay/shared";import{assertCaptureMethodEligible as Se,buildProductPayload as _e,classifyTelemetryFailure as ke,FloPayError as b,foldIntoProducts as ve,IDEMPOTENCY_IN_PROGRESS_CODE as Re,IDEMPOTENCY_KEY_HEADER as Te,resolveIdempotencyKey as H,resolveSessionCurrency as Ae,SDK_VERSION as J,telemetryStatusClass as Q}from"@flopay/shared";var j=5,X=new WeakSet;function Ee(t){(typeof t=="object"&&t!==null||typeof t=="function")&&X.add(t)}function Ie(t){return(typeof t=="object"&&t!==null||typeof t=="function")&&X.has(t)}function Fe(t,e){let r=e?.error,o=S(e?.code)??S(r?.code)??`http_${t}`,a=S(e?.message)??S(r?.message)??xe(o,t);return new b(a,"api_error",{code:o,statusCode:t})}function xe(t,e){switch(t){case"CouponLimitExceeded":return`Too many coupon codes \u2014 a checkout session accepts at most ${j}.`;case"CouponCurrencyUnsupported":return"One of the applied coupons has no price configured for the cart currency.";default:return`Failed to create checkout session (HTTP ${e}).`}}async function Z(t,e,r){let{billingApiUrl:o,checkoutBaseUrl:a,items:n=[],subscriptions:l=[],products:s,account:i,successUrl:c,cancelUrl:f,checkoutMode:g="confirm",captureMethod:u,couponCodes:m=[],tagsData:L,redirectParams:ue={},setCookie:pe=!0,clientId:me,currency:ye,utmMetadata:K,idempotencyKey:fe}=t,V=H(fe);if(m.length>j)throw new b(`Too many coupon codes \u2014 a checkout session accepts at most ${j}.`,"validation_error",{code:"CouponLimitExceeded",param:"couponCodes"});let P=s??ve(n,l);Se({captureMethod:u,products:P});let h=Ae(ye,n,l,P);if(!h)throw new b("currency is required: pass `currency` on the session, or include a `currency` on the first item/subscription/product.","validation_error",{code:"CurrencyRequired",param:"currency"});let k={clientId:me,checkoutVersion:J,successUrl:c,cancelUrl:f,currency:h,checkoutMode:g,products:P.map(p=>_e(p,h)),accountData:{userId:i.userId,firstName:i.firstName??null,lastName:i.lastName??null,email:i.email,country:i.country??null,gender:i.gender??null,city:i.city??null,state:i.state??null,zip:i.zip??null,addressLine1:i.addressLine1??null,addressLine2:i.addressLine2??null},couponCodes:m};u==="manual"&&(k.captureMethod=u),L&&(k.tagsData=L),K?.length&&(k.utmMetadata=K);let ge=`${o.replace(/\/+$/,"")}/v1/checkouts/sessions`,$={"Content-Type":"application/json"};V&&($[Te]=V);let C,v,he={method:"POST",headers:$,body:JSON.stringify(k),signal:e},R;try{R=await fetch(ge,he)}catch(p){throw Ee(p),p}try{r?.(R.status)}catch{}C=R.status;try{v=await R.json()}catch{}if(C>=400)throw Fe(C,v);if(C===201){let p=v?.data?.uuid,O=v?.data?.nonce;if(!p)throw new Error("Checkout session created but no UUID was returned by the billing API");if(!O)throw new b("Checkout session created but no `nonce` was returned by the billing API. Upgrade the billing service to TeamFloPay/backend#640 or later.","api_error",{code:"MissingCheckoutSessionToken"});(P.length||h)&&N(p,{currency:h,products:P.map(d=>({code:d.code??d.providerItemId??d.providerPlanId,type:d.type,name:d.name??d.itemName??d.providerItemName??d.subscriptionName??d.providerPlanName??null,totalAmount:d.totalAmount,overrideAmount:d.overrideAmount,currency:d.currency??h}))});let T=new URL(`${a.replace(/\/+$/,"")}/secure`);T.searchParams.set("id",p);for(let[d,A]of Object.entries(ue))T.searchParams.set(d,A);if(pe&&typeof window<"u"&&typeof document<"u"){let d=JSON.stringify({origin_url:f}),A=window.location.hostname.split(".").slice(-2).join(".");document.cookie=`checkout_data=${encodeURIComponent(d)}; domain=.${A}; path=/; max-age=3600; SameSite=Lax; Secure;`,document.cookie=`flopay_checkout_token=${encodeURIComponent(O)}; domain=.${A}; path=/; max-age=3600; SameSite=Lax; Secure;`}return typeof window<"u"&&(window.location.href=T.toString()),{status:201,redirectUrl:T.toString(),nonce:O}}return C===204?(typeof window<"u"&&(window.location.href=c),{status:204}):{status:C}}async function Me(t){let e=te(t),r=ee(e),o=U(t.timeoutMs);try{let a=await Z(t,o.signal,r);return re(e,a),a}catch(a){throw I(e,a),a}finally{o.clear(),w(e.reporter)}}function ee(t){let e=!1;return r=>{if(e)return;e=!0;let o=Q(r);t.reporter.log({name:"session.request.first_byte",stage:"session_first_byte",requestCategory:"session_create",statusClass:o,attempt:t.attempt}),t.reporter.performance({stage:"session_first_byte",durationMs:t.reporter.now()-t.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:o,attempt:t.attempt})}}function te(t){let e=new y({billingApiUrl:t.billingApiUrl,sdkVersion:J,enabled:t.telemetry!==!1}),r=e.now();return e.log({name:"session.create.started",stage:"session_create",requestCategory:"session_create"}),{reporter:e,startedAt:r,attempt:0}}function re(t,e){let r=Q(e.status);t.reporter.log({name:"session.request.completed",stage:"session_create",requestCategory:"session_create",statusClass:r}),t.reporter.performance({stage:"session_create",durationMs:t.reporter.now()-t.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:r,attempt:t.attempt})}function I(t,e){let{reporter:r}=t,o=ke(e,"CHECKOUT_SESSION_CREATE_FAILED");if(r.performance({stage:"session_create",durationMs:r.now()-t.startedAt,durationMode:"machine",requestCategory:"session_create",statusClass:o.statusClass,attempt:t.attempt}),e instanceof b&&e.type==="validation_error"){r.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create"});return}if(o.statusClass==="4xx"){r.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create",statusClass:"4xx"});return}r.error({...o,stage:"session_create",requestCategory:"session_create"})}function w(t){t.flush().catch(()=>{}).finally(()=>t.destroy())}async function Oe(t){let{maxRetries:e=2,...r}=t,o=te(t),a=ee(o);if(!Number.isFinite(e)||!Number.isInteger(e)||e<0||e>=3)throw o.reporter.terminal({outcome:"validation_rejected",stage:"session_create",requestCategory:"session_create"}),w(o.reporter),new Error(`Number of retries must be an integer between 0 and ${2}`);let n={...r,idempotencyKey:H(r.idempotencyKey)},l=U(r.timeoutMs),s;for(let i=0;i<=e;i++){o.attempt=i;try{let c=await Z(n,l.signal,a);return re(o,c),l.clear(),w(o.reporter),c}catch(c){s=c;let f=c instanceof Error&&c.name==="AbortError",g=Ie(c),u=c instanceof b&&c.code===Re;if((f||g||u)&&!l.signal.aborted&&i<e){o.reporter.log({name:"operation.retry",stage:"session_create",requestCategory:"session_create",attempt:i+1});try{await Y(i,l.signal)}catch(m){throw I(o,m),l.clear(),w(o.reporter),m}continue}throw I(o,c),l.clear(),w(o.reporter),c}}throw I(o,s),l.clear(),w(o.reporter),s??new Error("Unknown error during checkout session creation")}import{classifyTelemetryFailure as Ue,FloPayError as F,resolveBillingApiUrl as ie,SDK_VERSION as Ne}from"@flopay/shared";var oe=Symbol.for("@flopay/js.telemetry.bridge.v1");function se(t,e,r){let o=()=>e?.now()??r();Object.defineProperty(t,oe,{configurable:!1,enumerable:!1,writable:!1,value:{error:n=>e?.error(n),log:n=>e?.log(n),performance:n=>e?.performance(n),terminal:n=>e?.terminal(n),now:o,elapsed:n=>Math.max(0,o()-n),setCheckoutContext:n=>e?.setCheckoutContext(n),beginCheckout:(n={})=>e?.beginCheckout(n)??o(),disable:()=>e?.disable(),subscribe:n=>e?.subscribe(n)??(()=>{})}})}function ne(t){return t[oe]}var x=class{now(){return this.telemetryReporter?.now?.()??E()}constructor(e,r,o){this.provider=e,this.config=r,this.telemetryReporter=o??new y({billingApiUrl:ie(r.billingApiUrl),sdkVersion:Ne,enabled:r.telemetry!==!1}),se(this,this.telemetryReporter,E)}cardCapture(e){return this.telemetryReporter?.log({name:"vault.capture.requested",stage:"vault_request",provider:"pcivault",paymentMethodCategory:"card"}),this.telemetryReporter?G({sessionId:e?.sessionId,captureMethod:e?.captureMethod},this.telemetryReporter):new D({sessionId:e?.sessionId,captureMethod:e?.captureMethod,telemetry:!1})}async retrieveSession(e,r){if(!e)throw new F("sessionId is required to retrieve a session.","validation_error",{param:"sessionId"});let o=await this.retrieveUnifiedSession(e,r);if(!o.data.session)throw new F("Session not found","api_error");return o.data.session}async retrieveUnifiedSession(e,r){if(!e)throw new F("sessionId is required.","validation_error",{param:"sessionId"});let o=ie(r??this.config.billingApiUrl),a=this.now();this.telemetryReporter?.log({name:"session.read.started",stage:"session_read",requestCategory:"session_read"});let n,l=W(o,{now:()=>this.telemetryReporter?.now()??E(),onFirstByte:s=>{n=s},onRetry:(s,i)=>{this.telemetryReporter?.log({name:"operation.retry",stage:s==="session_read"?"session_read":"processing",requestCategory:s,attempt:i})}});try{let s=await l.getUnifiedCheckoutSession(e);return n!==void 0&&(this.telemetryReporter?.log({name:"session.request.first_byte",stage:"session_first_byte",requestCategory:"session_read",statusClass:"2xx"}),this.telemetryReporter?.performance({stage:"session_first_byte",durationMs:n,durationMode:"machine",requestCategory:"session_read",statusClass:"2xx"})),this.telemetryReporter?.log({name:"session.request.completed",stage:"session_complete",requestCategory:"session_read",statusClass:"2xx"}),this.telemetryReporter?.log({name:"checkout.data.ready",stage:"checkout_data_ready"}),this.telemetryReporter?.performance({stage:"session_complete",durationMs:this.now()-a,durationMode:"machine",requestCategory:"session_read",statusClass:"2xx"}),s}catch(s){let i=Ue(s,s instanceof F&&s.code==="checkout_processing_timeout"?"REQUEST_TIMEOUT":"NETWORK_REQUEST_FAILED");throw this.telemetryReporter?.error({...i,stage:"session_read",provider:"flo",paymentMethodCategory:"unknown"}),this.telemetryReporter?.performance({stage:"session_complete",durationMs:this.now()-a,durationMode:"machine",requestCategory:"session_read",statusClass:i.statusClass}),s}}getRawProvider(){return this.provider.getRawProvider()}destroy(){this.telemetryReporter?.log({name:"checkout.unmount",stage:"unmount"}),this.telemetryReporter?.destroy(),this.provider.destroy()}};function ae(t,e,r){let o=x;return new o(t,e,r)}import{FloPayError as ze,resolveBillingApiUrl as z,SDK_VERSION as le}from"@flopay/shared";import{FloPayError as De}from"@flopay/shared";import{loadStripe as qe}from"@stripe/stripe-js";function ce(t){switch(t){case"night":return"night";case"flat":return"flat";default:return"stripe"}}function je(t){return{...t,theme:ce(t.theme)}}var _=class{constructor(){this.name="stripe";this.stripe=null}async initialize(e){if(typeof window>"u")return;let r=await qe(e.publishableKey,{locale:e.locale??"auto"});if(!r)throw new De("Failed to initialize Stripe. Check your publishable key.","authentication_error");this.stripe=r}getRawProvider(){return this.stripe}destroy(){this.stripe=null}};var de=new Map;function B(t){return Array.isArray(t)?t.map(B):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0).sort(([e],[r])=>e.localeCompare(r)).map(([e,r])=>[e,B(r)])):t}function Be(t,e){return JSON.stringify([t,z(e?.billingApiUrl),e?.telemetry!==!1,e?.locale??"auto",e?.apiVersion??null,B(e?.appearance??null)])}var M=new Map;async function Le(t,e){if(!t){let s=new y({billingApiUrl:z(e?.billingApiUrl),sdkVersion:le,enabled:e?.telemetry!==!1});throw s.error({errorCode:"CONFIGURATION_INVALID",stage:"sdk_initialize",paymentMethodCategory:"unknown"}),s.flush().catch(()=>{}).finally(()=>s.destroy()),new ze("A publishable key is required to initialize FloPay.","validation_error",{param:"publishableKey"})}let r=Be(t,e),o=de.get(r);if(o)return e?.telemetry!==!1&&ne(o)?.log({name:"sdk.cache.hit",stage:"sdk_initialize"}),o;let a=M.get(r);if(a)return a;let n={...e,publishableKey:t},l=(async()=>{let s=new y({billingApiUrl:z(n.billingApiUrl),sdkVersion:le,enabled:n.telemetry!==!1}),i=s.now();s.log({name:"sdk.initialize.started",stage:"sdk_initialize"}),s.log({name:"sdk.cache.miss",stage:"sdk_initialize"}),s.log({name:"provider.load.started",stage:"provider_load",provider:"stripe"});let c=new _,f=s.now();try{await c.initialize(n)}catch(m){throw s.error({errorCode:"SDK_INITIALIZATION_FAILED",failureCategory:"provider_runtime",stage:"sdk_initialize",provider:"stripe",paymentMethodCategory:"unknown"}),s.destroy(),m}let g=s.now();s.log({name:"provider.ready",stage:"provider_ready",provider:"stripe"}),s.log({name:"provider.availability.checked",stage:"provider_ready",provider:"stripe"}),s.log({name:"sdk.initialize.ready",stage:"sdk_initialize"}),s.performance({stage:"sdk_initialize",durationMs:g-i,durationMode:"machine",provider:"stripe"}),s.performance({stage:"provider_ready",durationMs:g-f,durationMode:"machine",provider:"stripe"});let u=ae(c,n,s);return de.set(r,u),u})();M.set(r,l);try{return await l}finally{M.get(r)===l&&M.delete(r)}}export{x as FloPay,Pe as PaymentAPI,D as PciVaultCardCapture,be as SESSION_CREATE_TELEMETRY,_ as StripeAdapter,N as cacheSessionDisplayData,we as clearSessionDisplayData,Me as createCheckoutSession,Oe as createCheckoutSessionWithRetries,mt as dropThirdPartyOnlyError,Ce as getSessionDisplayData,Le as loadFloPay,je as toStripeAppearance,ce as toStripeAppearanceTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/js",
3
- "version": "1.6.0",
3
+ "version": "1.8.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@stripe/stripe-js": "^9.8.0",
35
- "@flopay/shared": "1.6.0"
35
+ "@flopay/shared": "1.8.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "jsdom": "^29.1.1",