@flopay/vue 1.14.5 → 1.14.6

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.
@@ -0,0 +1,325 @@
1
+ import type { CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayPaymentCancelEvent, GatewayEnvironment, InlineSessionPatch, PaymentResult, PayPalApprovalPresentation, PayPalBuyerIdentity, PayPalProviderObjectType, TelemetryTerminalReason, TokenizedBody } from '@flopay/shared';
2
+ import { FloPayError } from '@flopay/shared';
3
+ import { type PropType } from 'vue';
4
+ /** Lifecycle of the PayPal JS SDK button, reported through `@initialization-state-change`. */
5
+ export type DirectPayPalInitializationState = 'loading' | 'retrying' | 'ready' | 'exhausted';
6
+ /** React's click-time `runBeforeButtonClick` result. */
7
+ interface DirectPayPalBeforeButtonClickResult {
8
+ proceed: boolean;
9
+ accountPatch?: InlineSessionPatch['account'];
10
+ sessionId?: string;
11
+ nonce?: string;
12
+ }
13
+ /**
14
+ * React's click-time gate: runs before PayPal creates the order, can patch the
15
+ * session, nonce and account for this attempt, or stop it with `proceed: false`.
16
+ */
17
+ type DirectPayPalRunBeforeButtonClick = (method: CheckoutButtonMethod) => Promise<DirectPayPalBeforeButtonClickResult>;
18
+ /** The click-time patch React passes with the tokenized body. */
19
+ interface DirectPayPalTokenizedOverrides {
20
+ accountPatch?: InlineSessionPatch['account'];
21
+ sessionId?: string;
22
+ nonce?: string;
23
+ }
24
+ /** React's `onTokenizedBody`: when set, the host continues the payment from PayPal's approval. */
25
+ type DirectPayPalTokenizedHandler = (body: TokenizedBody, overrides?: DirectPayPalTokenizedOverrides) => void | Promise<void>;
26
+ interface DirectPayPalTechnicalFailureOptions {
27
+ code?: string;
28
+ popupBlocked?: boolean;
29
+ provider?: 'paypal';
30
+ paymentMethodCategory?: 'paypal';
31
+ terminalReason?: TelemetryTerminalReason;
32
+ }
33
+ /**
34
+ * React's `onBuyerIdentityReady`: attaches the buyer identity collected on
35
+ * approval before the payment continues. React awaits it and its presence
36
+ * turns on the email fallback, so it stays a function prop (CTO decision 2).
37
+ */
38
+ type DirectPayPalBuyerIdentityReadyHandler = (identity: PayPalBuyerIdentity) => void | Promise<void>;
39
+ /** React's `onTechnicalFailure`: when set, it receives post-click failures instead of `errorChange`. */
40
+ type DirectPayPalTechnicalFailureHandler = (method: 'paypal', err: unknown, options?: DirectPayPalTechnicalFailureOptions) => void;
41
+ /** Props for {@link DirectPayPalButton} (React's `DirectPayPalButtonProps`; notifying callbacks are emits). */
42
+ export interface DirectPayPalButtonProps {
43
+ sessionId: string;
44
+ /** Session-bound checkout token, sent as `x-checkout-session-token`. */
45
+ nonce?: string;
46
+ billingApiUrl?: string;
47
+ email?: string;
48
+ /** Buyer name already attached to the checkout, when available. */
49
+ billingName?: string;
50
+ /** Attaches the buyer identity collected on PayPal approval before checkout continues. */
51
+ onBuyerIdentityReady?: DirectPayPalBuyerIdentityReadyHandler;
52
+ /** PayPal client id the session advertises in `gateways.paypal`. */
53
+ clientId: string;
54
+ /**
55
+ * React's `GatewayEnvironment`. FloPay's `stage` / `production` aliases are
56
+ * collapsed to PayPal's `sandbox` / `production` before the SDK loads.
57
+ */
58
+ environment?: GatewayEnvironment;
59
+ currency?: string;
60
+ isSubscription?: boolean;
61
+ /**
62
+ * @deprecated The session's `gateways.paypal.providerObjectType` is
63
+ * authoritative; this is the fallback when the session advertises none.
64
+ */
65
+ providerObjectType?: PayPalProviderObjectType;
66
+ /**
67
+ * Backend-advertised approval presentation. The session's
68
+ * `gateways.paypal.approvalPresentation` wins when both are supplied.
69
+ */
70
+ approvalPresentation?: PayPalApprovalPresentation;
71
+ /** The session, whose `gateways.paypal.providerObjectType` selects the channel. */
72
+ session?: CheckoutSession | null;
73
+ /** A PayPal order (or subscription) id to bind the button to; changing it remounts PayPal. */
74
+ existingOrderId?: string;
75
+ /** External processing state: marks the PayPal container busy. */
76
+ isProcessing?: boolean;
77
+ /** `false` turns off the one automatic startup retry. Defaults to `true`. */
78
+ allowAutomaticRetry?: boolean;
79
+ /** Click-time gate that runs before PayPal creates the order. */
80
+ runBeforeButtonClick?: DirectPayPalRunBeforeButtonClick;
81
+ /** When set, PayPal's approval is handed to the host instead of completing here. */
82
+ onTokenizedBody?: DirectPayPalTokenizedHandler;
83
+ /** When set, post-click technical failures go here instead of `errorChange`. */
84
+ onTechnicalFailure?: DirectPayPalTechnicalFailureHandler;
85
+ telemetry?: boolean;
86
+ /** Renders React's on-screen lifecycle tracer above the button. Off by default. */
87
+ debug?: boolean;
88
+ }
89
+ /**
90
+ * Renders PayPal's own JS SDK button for a session that advertises
91
+ * `gateways.paypal` — the path that works inside in-app browsers. The PayPal
92
+ * object (order or subscription) is created by the billing API's
93
+ * session-scoped `/intents` endpoint, unless `existingOrderId` binds the
94
+ * button to one the backend already created; the SDK only relays the buyer's
95
+ * approval.
96
+ *
97
+ * Like React's button, a load or render failure is retried once automatically
98
+ * (`retrying`, unless `allowAutomaticRetry` is false) before the button reports
99
+ * `exhausted`, and every PayPal error is classified with the shared
100
+ * external-method classifier: only a provider decline is reported to
101
+ * `/intents/decline` and emitted as `decline`. A blocked pop-up or PayPal's
102
+ * dead window in an in-app browser is emitted as `error` carrying the shared
103
+ * recovery copy, and that copy also goes to `errorChange` (or to
104
+ * `onTechnicalFailure` when the host passes one).
105
+ *
106
+ * Each click starts an attempt with a fresh `/intents` idempotency key. The
107
+ * buyer's approval goes to the host's `onTokenizedBody` when it passes one;
108
+ * otherwise the button posts it to `/process` itself, as React does. A failed
109
+ * approval is forwarded as a message only, never reported as a decline.
110
+ */
111
+ export declare const DirectPayPalButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
112
+ sessionId: {
113
+ type: StringConstructor;
114
+ default: undefined;
115
+ };
116
+ nonce: {
117
+ type: StringConstructor;
118
+ default: undefined;
119
+ };
120
+ billingApiUrl: {
121
+ type: StringConstructor;
122
+ default: undefined;
123
+ };
124
+ email: {
125
+ type: StringConstructor;
126
+ default: undefined;
127
+ };
128
+ billingName: {
129
+ type: StringConstructor;
130
+ default: undefined;
131
+ };
132
+ onBuyerIdentityReady: {
133
+ type: PropType<DirectPayPalBuyerIdentityReadyHandler>;
134
+ default: undefined;
135
+ };
136
+ clientId: {
137
+ type: StringConstructor;
138
+ default: undefined;
139
+ };
140
+ environment: {
141
+ type: PropType<GatewayEnvironment>;
142
+ default: undefined;
143
+ };
144
+ currency: {
145
+ type: StringConstructor;
146
+ default: undefined;
147
+ };
148
+ isSubscription: {
149
+ type: BooleanConstructor;
150
+ default: undefined;
151
+ };
152
+ providerObjectType: {
153
+ type: PropType<PayPalProviderObjectType>;
154
+ default: undefined;
155
+ };
156
+ approvalPresentation: {
157
+ type: PropType<PayPalApprovalPresentation>;
158
+ default: undefined;
159
+ };
160
+ session: {
161
+ type: PropType<CheckoutSession | null>;
162
+ default: null;
163
+ };
164
+ existingOrderId: {
165
+ type: StringConstructor;
166
+ default: undefined;
167
+ };
168
+ isProcessing: {
169
+ type: BooleanConstructor;
170
+ default: boolean;
171
+ };
172
+ allowAutomaticRetry: {
173
+ type: BooleanConstructor;
174
+ default: boolean;
175
+ };
176
+ runBeforeButtonClick: {
177
+ type: PropType<DirectPayPalRunBeforeButtonClick>;
178
+ default: undefined;
179
+ };
180
+ onTokenizedBody: {
181
+ type: PropType<DirectPayPalTokenizedHandler>;
182
+ default: undefined;
183
+ };
184
+ onTechnicalFailure: {
185
+ type: PropType<DirectPayPalTechnicalFailureHandler>;
186
+ default: undefined;
187
+ };
188
+ telemetry: {
189
+ type: BooleanConstructor;
190
+ default: undefined;
191
+ };
192
+ debug: {
193
+ type: BooleanConstructor;
194
+ default: boolean;
195
+ };
196
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
197
+ [key: string]: any;
198
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
199
+ complete: (_result: PaymentResult) => true;
200
+ decline: (_decline: DeclineEvent) => true;
201
+ /** The buyer closed or left PayPal without approving (once per click attempt). */
202
+ cancel: (_event: FloPayPaymentCancelEvent) => true;
203
+ error: (_error: FloPayError) => true;
204
+ errorChange: (_message: string | null) => true;
205
+ buttonClick: (_method: CheckoutButtonMethod) => true;
206
+ loadStateChange: (_ready: boolean) => true;
207
+ initializationStateChange: (_state: DirectPayPalInitializationState) => true;
208
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
209
+ sessionId: {
210
+ type: StringConstructor;
211
+ default: undefined;
212
+ };
213
+ nonce: {
214
+ type: StringConstructor;
215
+ default: undefined;
216
+ };
217
+ billingApiUrl: {
218
+ type: StringConstructor;
219
+ default: undefined;
220
+ };
221
+ email: {
222
+ type: StringConstructor;
223
+ default: undefined;
224
+ };
225
+ billingName: {
226
+ type: StringConstructor;
227
+ default: undefined;
228
+ };
229
+ onBuyerIdentityReady: {
230
+ type: PropType<DirectPayPalBuyerIdentityReadyHandler>;
231
+ default: undefined;
232
+ };
233
+ clientId: {
234
+ type: StringConstructor;
235
+ default: undefined;
236
+ };
237
+ environment: {
238
+ type: PropType<GatewayEnvironment>;
239
+ default: undefined;
240
+ };
241
+ currency: {
242
+ type: StringConstructor;
243
+ default: undefined;
244
+ };
245
+ isSubscription: {
246
+ type: BooleanConstructor;
247
+ default: undefined;
248
+ };
249
+ providerObjectType: {
250
+ type: PropType<PayPalProviderObjectType>;
251
+ default: undefined;
252
+ };
253
+ approvalPresentation: {
254
+ type: PropType<PayPalApprovalPresentation>;
255
+ default: undefined;
256
+ };
257
+ session: {
258
+ type: PropType<CheckoutSession | null>;
259
+ default: null;
260
+ };
261
+ existingOrderId: {
262
+ type: StringConstructor;
263
+ default: undefined;
264
+ };
265
+ isProcessing: {
266
+ type: BooleanConstructor;
267
+ default: boolean;
268
+ };
269
+ allowAutomaticRetry: {
270
+ type: BooleanConstructor;
271
+ default: boolean;
272
+ };
273
+ runBeforeButtonClick: {
274
+ type: PropType<DirectPayPalRunBeforeButtonClick>;
275
+ default: undefined;
276
+ };
277
+ onTokenizedBody: {
278
+ type: PropType<DirectPayPalTokenizedHandler>;
279
+ default: undefined;
280
+ };
281
+ onTechnicalFailure: {
282
+ type: PropType<DirectPayPalTechnicalFailureHandler>;
283
+ default: undefined;
284
+ };
285
+ telemetry: {
286
+ type: BooleanConstructor;
287
+ default: undefined;
288
+ };
289
+ debug: {
290
+ type: BooleanConstructor;
291
+ default: boolean;
292
+ };
293
+ }>> & Readonly<{
294
+ onButtonClick?: ((_method: CheckoutButtonMethod) => any) | undefined;
295
+ onCancel?: ((_event: FloPayPaymentCancelEvent) => any) | undefined;
296
+ onComplete?: ((_result: PaymentResult) => any) | undefined;
297
+ onDecline?: ((_decline: DeclineEvent) => any) | undefined;
298
+ onError?: ((_error: FloPayError) => any) | undefined;
299
+ onErrorChange?: ((_message: string | null) => any) | undefined;
300
+ onInitializationStateChange?: ((_state: DirectPayPalInitializationState) => any) | undefined;
301
+ onLoadStateChange?: ((_ready: boolean) => any) | undefined;
302
+ }>, {
303
+ sessionId: string;
304
+ nonce: string;
305
+ billingApiUrl: string;
306
+ email: string;
307
+ billingName: string;
308
+ onBuyerIdentityReady: DirectPayPalBuyerIdentityReadyHandler;
309
+ clientId: string;
310
+ environment: GatewayEnvironment;
311
+ currency: string;
312
+ isSubscription: boolean;
313
+ providerObjectType: PayPalProviderObjectType;
314
+ approvalPresentation: PayPalApprovalPresentation;
315
+ session: CheckoutSession | null;
316
+ existingOrderId: string;
317
+ isProcessing: boolean;
318
+ allowAutomaticRetry: boolean;
319
+ runBeforeButtonClick: DirectPayPalRunBeforeButtonClick;
320
+ onTokenizedBody: DirectPayPalTokenizedHandler;
321
+ onTechnicalFailure: DirectPayPalTechnicalFailureHandler;
322
+ telemetry: boolean;
323
+ debug: boolean;
324
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
325
+ export {};
@@ -1,10 +1,10 @@
1
- import * as vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { ThemeId, VaultCardThemeColors, FloPayAppearance, ButtonsLayoutStyles } from '@flopay/shared';
4
- import { a as FloPayCardSetupCompleteEvent, F as FloPayCardSetupCancelEvent, b as FloPayCardSetupDeclineEvent, c as FloPayCardSetupError } from './hosted-setup-jpaaXDFA.cjs';
5
-
1
+ import type { ButtonsLayoutStyles, FloPayAppearance, ThemeId, VaultCardThemeColors } from '@flopay/shared';
2
+ import { type PropType } from 'vue';
3
+ import { type FloPayCardSetupCancelEvent, type FloPayCardSetupCompleteEvent, type FloPayCardSetupDeclineEvent, type FloPayCardSetupError } from './hosted-setup.js';
4
+ export type { FloPayCardSetupCancelEvent, FloPayCardSetupCompleteEvent, FloPayCardSetupDeclineEvent, } from './hosted-setup.js';
5
+ export { FloPayCardSetupError } from './hosted-setup.js';
6
6
  /** Props for the browser-only secure card-setup surface (callbacks are emits). */
7
- interface FloPayCardSetupProps {
7
+ export interface FloPayCardSetupProps {
8
8
  /** Opaque id returned by the merchant-authenticated setup-session endpoint. */
9
9
  sessionId: string;
10
10
  /** Session-bound token returned alongside `sessionId`. */
@@ -62,7 +62,7 @@ interface FloPayCardSetupProps {
62
62
  * and `buttonsStyles` resolve over the preset exactly as in React and
63
63
  * `FloPayCheckout`, and restyle the mounted form in place.
64
64
  */
65
- declare const FloPayCardSetup: vue.DefineComponent<vue.ExtractPropTypes<{
65
+ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
66
66
  sessionId: {
67
67
  type: StringConstructor;
68
68
  default: undefined;
@@ -95,18 +95,18 @@ declare const FloPayCardSetup: vue.DefineComponent<vue.ExtractPropTypes<{
95
95
  type: PropType<ButtonsLayoutStyles>;
96
96
  default: undefined;
97
97
  };
98
- }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
98
+ }>, () => (import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
99
99
  [key: string]: any;
100
- }> | (vue.VNode<vue.RendererNode, vue.RendererElement, {
100
+ }> | null)[] | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
101
101
  [key: string]: any;
102
- }> | null)[] | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
102
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
103
103
  ready: () => true;
104
104
  complete: (_event: FloPayCardSetupCompleteEvent) => true;
105
105
  cancel: (_event: FloPayCardSetupCancelEvent) => true;
106
106
  decline: (_event: FloPayCardSetupDeclineEvent) => true;
107
107
  validation: (_message: string | null) => true;
108
108
  error: (_error: FloPayCardSetupError) => true;
109
- }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
109
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
110
110
  sessionId: {
111
111
  type: StringConstructor;
112
112
  default: undefined;
@@ -140,21 +140,19 @@ declare const FloPayCardSetup: vue.DefineComponent<vue.ExtractPropTypes<{
140
140
  default: undefined;
141
141
  };
142
142
  }>> & Readonly<{
143
- onError?: ((_error: FloPayCardSetupError) => any) | undefined;
144
143
  onCancel?: ((_event: FloPayCardSetupCancelEvent) => any) | undefined;
145
- onReady?: (() => any) | undefined;
146
144
  onComplete?: ((_event: FloPayCardSetupCompleteEvent) => any) | undefined;
147
145
  onDecline?: ((_event: FloPayCardSetupDeclineEvent) => any) | undefined;
146
+ onError?: ((_error: FloPayCardSetupError) => any) | undefined;
147
+ onReady?: (() => any) | undefined;
148
148
  onValidation?: ((_message: string | null) => any) | undefined;
149
149
  }>, {
150
- theme: ThemeId | VaultCardThemeColors;
151
- telemetry: boolean;
152
150
  sessionId: string;
153
151
  nonce: string;
154
- containerStyle: Record<string, string | number>;
155
152
  billingApiUrl: string;
153
+ telemetry: boolean;
154
+ theme: VaultCardThemeColors | ThemeId;
155
+ containerStyle: Record<string, string | number>;
156
156
  appearance: FloPayAppearance;
157
157
  buttonsStyles: ButtonsLayoutStyles;
158
- }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
159
-
160
- export { FloPayCardSetup, FloPayCardSetupCancelEvent, FloPayCardSetupCompleteEvent, FloPayCardSetupDeclineEvent, FloPayCardSetupError, type FloPayCardSetupProps };
158
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;