@flopay/vue 1.16.2 → 1.16.4

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 CHANGED
@@ -131,6 +131,24 @@ export default defineComponent({
131
131
  });
132
132
  ```
133
133
 
134
+ ### Card-field lifecycle
135
+
136
+ `FloPayCheckout` and `SplitCardForm` emit `cardFieldsReady` (`@card-fields-ready` in templates, `onCardFieldsReady` in `h()`, React's `onCardFieldsReady`) once per hosted card form, when the card fields are on screen and the buyer can type in them, with `{ type: 'card_fields_ready', elapsedMs }`: the milliseconds since that card form mounted. They emit `cardFieldsFailed` (`@card-fields-failed`, `onCardFieldsFailed`) when the card fields fail to load, or are not ready within the `cardFieldsTimeoutMs` prop (default 15 000 ms, the same on every device; a value that is not a positive number keeps the default), with `{ type: 'card_fields_failed', reason, elapsedMs }`. `reason` is always one of `load_error` (the form failed to load), `timeout` (not interactive in time), `blocked` (a content-security policy blocked the form's own script or frame) or `other`.
137
+
138
+ A card-field failure is not a declined or failed payment: it never emits `decline`, and on `@instrument` it is `card_fields_failed`, never `checkout_error`. If the fields become ready after a `timeout`, `cardFieldsReady` still follows, with no second failure. Both events also reach `@instrument` (`card_fields_ready`, `card_fields_failed`) and Flo's SDK telemetry with the checkout session id, and never carry card data. A throwing listener does not affect the checkout, and nothing changes if you listen for neither.
139
+
140
+ The `error` event is unchanged: it is still emitted, as before, when the hosted form itself reports that it failed to load. A timeout, a blocked form or any other failure the SDK detects only emits `cardFieldsFailed`. With an older hosted form that does not report when its fields become interactive, `cardFieldsReady` is emitted when that form reports its own ready instead.
141
+
142
+ ```ts
143
+ h(FloPayCheckout, {
144
+ sessionId: 'sess_123',
145
+ nonce: 'nonce_123',
146
+ cardFieldsTimeoutMs: 20_000,
147
+ onCardFieldsReady: (event) => console.log('card fields ready', event.elapsedMs),
148
+ onCardFieldsFailed: (event) => console.warn('card fields failed', event.reason, event.elapsedMs),
149
+ });
150
+ ```
151
+
134
152
  ## Errors
135
153
 
136
154
  Errors are `FloPayError` instances from `@flopay/shared`, emitted through `@error`.
@@ -32,6 +32,7 @@ var CHECKOUT_FORM_DEFAULTS = /* @__PURE__ */ Symbol(
32
32
  import {
33
33
  FLO_INSTRUMENT_ONCE_NAMES,
34
34
  invokeMerchantCallback,
35
+ isCardFieldsInstrumentSource,
35
36
  projectFloInstrument,
36
37
  resolveBillingApiUrl
37
38
  } from "@flopay/shared";
@@ -87,6 +88,9 @@ var FloPayProvider = defineComponent({
87
88
  if (!listener) return emit("instrument", event);
88
89
  for (const handler of [listener].flat()) handler(event);
89
90
  });
91
+ const emitTelemetryInstrument = (source) => {
92
+ if (!isCardFieldsInstrumentSource(source)) emitInstrument(source);
93
+ };
90
94
  provide(FLOPAY_CONTEXT, {
91
95
  flopay,
92
96
  paypalFlopay,
@@ -130,7 +134,7 @@ var FloPayProvider = defineComponent({
130
134
  (instance, _previous, onCleanup) => {
131
135
  if (!instance) return;
132
136
  emitInstrument({ class: "lifecycle", name: "sdk.initialize.ready" });
133
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
137
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
134
138
  onCleanup(() => unsubscribe?.());
135
139
  void nextTick(() => emitInstrument({ class: "lifecycle", name: "checkout.rendered" }));
136
140
  },
@@ -138,7 +142,7 @@ var FloPayProvider = defineComponent({
138
142
  );
139
143
  watch(paypalFlopay, (instance, _previous, onCleanup) => {
140
144
  if (!instance || instance === flopay.value) return;
141
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
145
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
142
146
  onCleanup(() => unsubscribe?.());
143
147
  });
144
148
  });
@@ -38,7 +38,7 @@ function delay(ms) {
38
38
  return new Promise((resolve) => setTimeout(resolve, ms));
39
39
  }
40
40
  var StripeSetupMethods = defineAsyncComponent(
41
- () => import("./stripe-elements-SXMTHEF6.mjs").then((module) => module.StripePaymentMethods)
41
+ () => import("./stripe-elements-SI2PI6EO.mjs").then((module) => module.StripePaymentMethods)
42
42
  );
43
43
  var PayPalSetupMethods = defineAsyncComponent(
44
44
  () => import("./payment-method-setup-paypal-D6FEQQJY.mjs").then((module) => module.PayPalSetupMethod)
@@ -1,4 +1,4 @@
1
- import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, PaymentResult, ThemeId, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
1
+ import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, PaymentResult, ThemeId, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
2
2
  import { FloPayError } from '@flopay/shared';
3
3
  import { type PropType } from 'vue';
4
4
  import { type SplitCardFormBeforeButtonClick } from './split-card-form.js';
@@ -53,6 +53,8 @@ export interface FloPayCheckoutProps {
53
53
  * checkout opens. Omitted or `true` keeps the default. See React.
54
54
  */
55
55
  cardAutoFocus?: boolean;
56
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
57
+ cardFieldsTimeoutMs?: number;
56
58
  /**
57
59
  * @deprecated Not rendered, as in React: the default-layout security footer
58
60
  * was removed. Accepted so integrations ported from React keep compiling.
@@ -216,6 +218,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
216
218
  type: BooleanConstructor;
217
219
  default: boolean;
218
220
  };
221
+ cardFieldsTimeoutMs: {
222
+ type: NumberConstructor;
223
+ default: undefined;
224
+ };
219
225
  /** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
220
226
  showSecurityFooter: {
221
227
  type: BooleanConstructor;
@@ -260,6 +266,8 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
260
266
  error: (_error: FloPayError) => true;
261
267
  instrument: (_event: FloInstrumentEvent) => true;
262
268
  decline: (_decline: DeclineEvent) => true;
269
+ cardFieldsReady: (_event: CardFieldsReadyEvent) => true;
270
+ cardFieldsFailed: (_event: CardFieldsFailedEvent) => true;
263
271
  cancel: (_event: FloPayPaymentCancelEvent) => true;
264
272
  buttonClick: (_method: CheckoutButtonMethod) => true;
265
273
  countryChange: (_country: string) => true;
@@ -369,6 +377,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
369
377
  type: BooleanConstructor;
370
378
  default: boolean;
371
379
  };
380
+ cardFieldsTimeoutMs: {
381
+ type: NumberConstructor;
382
+ default: undefined;
383
+ };
372
384
  /** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
373
385
  showSecurityFooter: {
374
386
  type: BooleanConstructor;
@@ -407,6 +419,8 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
407
419
  }>> & Readonly<{
408
420
  onButtonClick?: ((_method: CheckoutButtonMethod) => any) | undefined;
409
421
  onCancel?: ((_event: FloPayPaymentCancelEvent) => any) | undefined;
422
+ onCardFieldsFailed?: ((_event: CardFieldsFailedEvent) => any) | undefined;
423
+ onCardFieldsReady?: ((_event: CardFieldsReadyEvent) => any) | undefined;
410
424
  onComplete?: ((_result: PaymentResult) => any) | undefined;
411
425
  onCountryChange?: ((_country: string) => any) | undefined;
412
426
  onDecline?: ((_decline: DeclineEvent) => any) | undefined;
@@ -439,6 +453,7 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
439
453
  avsLayout: "column" | "row";
440
454
  cardFieldOrder: VaultCardFieldKey[];
441
455
  cardAutoFocus: boolean;
456
+ cardFieldsTimeoutMs: number;
442
457
  showSecurityFooter: boolean;
443
458
  fallbackPublishableKey: string;
444
459
  confirmLabel: string;
package/dist/index.cjs CHANGED
@@ -99,6 +99,9 @@ var init_provider = __esm({
99
99
  if (!listener) return emit("instrument", event);
100
100
  for (const handler of [listener].flat()) handler(event);
101
101
  });
102
+ const emitTelemetryInstrument = (source) => {
103
+ if (!(0, import_shared.isCardFieldsInstrumentSource)(source)) emitInstrument(source);
104
+ };
102
105
  (0, import_vue.provide)(FLOPAY_CONTEXT, {
103
106
  flopay,
104
107
  paypalFlopay,
@@ -142,7 +145,7 @@ var init_provider = __esm({
142
145
  (instance, _previous, onCleanup) => {
143
146
  if (!instance) return;
144
147
  emitInstrument({ class: "lifecycle", name: "sdk.initialize.ready" });
145
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
148
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
146
149
  onCleanup(() => unsubscribe?.());
147
150
  void (0, import_vue.nextTick)(() => emitInstrument({ class: "lifecycle", name: "checkout.rendered" }));
148
151
  },
@@ -150,7 +153,7 @@ var init_provider = __esm({
150
153
  );
151
154
  (0, import_vue.watch)(paypalFlopay, (instance, _previous, onCleanup) => {
152
155
  if (!instance || instance === flopay.value) return;
153
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
156
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
154
157
  onCleanup(() => unsubscribe?.());
155
158
  });
156
159
  });
@@ -2302,6 +2305,8 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
2302
2305
  className: { type: String, default: void 0 },
2303
2306
  cardFieldOrder: { type: Array, default: void 0 },
2304
2307
  cardAutoFocus: { type: Boolean, default: true },
2308
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
2309
+ cardFieldsTimeoutMs: { type: Number, default: void 0 },
2305
2310
  onBeforeButtonClick: {
2306
2311
  type: Function,
2307
2312
  default: void 0
@@ -2348,7 +2353,11 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
2348
2353
  // React's `onZipChange`.
2349
2354
  zipChange: (_zip) => true,
2350
2355
  // React's `onErrorChange`: the form's own error message changed (`null` when cleared).
2351
- errorChange: (_error) => true
2356
+ errorChange: (_error) => true,
2357
+ // React's `onCardFieldsReady`: the hosted card fields are interactive, once per card form.
2358
+ cardFieldsReady: (_event) => true,
2359
+ // React's `onCardFieldsFailed`: the card fields failed to load or timed out; not a decline.
2360
+ cardFieldsFailed: (_event) => true
2352
2361
  },
2353
2362
  /**
2354
2363
  * Slots (React's content props):
@@ -2948,13 +2957,31 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
2948
2957
  if (!vault.value || !id) return;
2949
2958
  const captureMethod = session.value?.captureMethod;
2950
2959
  const flopay = provider?.flopay.value;
2951
- const adapter = flopay ? flopay.cardCapture({ sessionId: id, ...captureMethod ? { captureMethod } : {} }) : new import_card_setup3.PciVaultCardCapture({
2960
+ const cardFieldsTimeoutMs = props.cardFieldsTimeoutMs;
2961
+ const adapter = flopay ? flopay.cardCapture({
2962
+ sessionId: id,
2963
+ ...captureMethod ? { captureMethod } : {},
2964
+ cardFieldsTimeoutMs
2965
+ }) : new import_card_setup3.PciVaultCardCapture({
2952
2966
  sessionId: id,
2953
2967
  ...captureMethod ? { captureMethod } : {},
2954
2968
  billingApiUrl: billingApiUrl.value,
2955
- telemetry: props.telemetry
2969
+ telemetry: props.telemetry,
2970
+ cardFieldsTimeoutMs
2971
+ });
2972
+ const detachAdapterOutcomes = bindOutcomes(adapter);
2973
+ const detachCardFields = adapter.onCardFields?.((event) => {
2974
+ provider?.emitInstrument((0, import_shared8.cardFieldsInstrumentSource)(event));
2975
+ if (event.type === "card_fields_ready") {
2976
+ (0, import_shared8.invokeMerchantCallback)(() => emit("cardFieldsReady", event));
2977
+ } else {
2978
+ (0, import_shared8.invokeMerchantCallback)(() => emit("cardFieldsFailed", event));
2979
+ }
2956
2980
  });
2957
- detachOutcomes = bindOutcomes(adapter);
2981
+ detachOutcomes = () => {
2982
+ detachAdapterOutcomes?.();
2983
+ detachCardFields?.();
2984
+ };
2958
2985
  adapter.setSubmitGate?.(gateClosed.value);
2959
2986
  capture.value = adapter;
2960
2987
  };
@@ -3639,6 +3666,7 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3639
3666
  avsLayout: { type: String, default: void 0 },
3640
3667
  cardFieldOrder: { type: Array, default: void 0 },
3641
3668
  cardAutoFocus: { type: Boolean, default: true },
3669
+ cardFieldsTimeoutMs: { type: Number, default: void 0 },
3642
3670
  /** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
3643
3671
  showSecurityFooter: { type: Boolean, default: void 0 },
3644
3672
  /** @deprecated Ignored (React parity); see {@link FloPayCheckoutProps.fallbackPublishableKey}. */
@@ -3662,6 +3690,9 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3662
3690
  error: (_error) => true,
3663
3691
  instrument: (_event) => true,
3664
3692
  decline: (_decline) => true,
3693
+ // React's `onCardFieldsReady` / `onCardFieldsFailed`: the hosted card-field lifecycle.
3694
+ cardFieldsReady: (_event) => true,
3695
+ cardFieldsFailed: (_event) => true,
3665
3696
  // React's `onCancel`: a direct PayPal buyer cancel from the built-in form.
3666
3697
  cancel: (_event) => true,
3667
3698
  buttonClick: (_method) => true,
@@ -3773,10 +3804,7 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3773
3804
  if (failure.code === "three_ds_aborted") return;
3774
3805
  modeError.value = failure.message;
3775
3806
  mode.value = "full";
3776
- if (!(sessionId && (0, import_shared9.isExpectedPaymentDecline)(failure))) {
3777
- (0, import_shared9.invokeMerchantCallback)(() => emit("error", failure));
3778
- }
3779
- if (sessionId) {
3807
+ if (sessionId && (0, import_shared9.isDeclineCallbackFailure)(failure)) {
3780
3808
  const decline = {
3781
3809
  method: "card",
3782
3810
  message: failure.message,
@@ -3785,6 +3813,8 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3785
3813
  sessionId
3786
3814
  };
3787
3815
  (0, import_shared9.invokeMerchantCallback)(() => emit("decline", decline));
3816
+ } else {
3817
+ (0, import_shared9.invokeMerchantCallback)(() => emit("error", failure));
3788
3818
  }
3789
3819
  } finally {
3790
3820
  savedPaymentRunning.value = false;
@@ -3905,7 +3935,9 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3905
3935
  onButtonClick: (method) => {
3906
3936
  clearModeError();
3907
3937
  (0, import_shared9.invokeMerchantCallback)(() => emit("buttonClick", method));
3908
- }
3938
+ },
3939
+ onCardFieldsReady: (event) => (0, import_shared9.invokeMerchantCallback)(() => emit("cardFieldsReady", event)),
3940
+ onCardFieldsFailed: (event) => (0, import_shared9.invokeMerchantCallback)(() => emit("cardFieldsFailed", event))
3909
3941
  };
3910
3942
  const withProvider = (content) => (0, import_vue7.h)(
3911
3943
  FloPayProvider,
@@ -4042,6 +4074,7 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
4042
4074
  avsLayout: props.avsLayout,
4043
4075
  cardFieldOrder: props.cardFieldOrder,
4044
4076
  cardAutoFocus: props.cardAutoFocus,
4077
+ cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
4045
4078
  session,
4046
4079
  dataAttachmentPending: Boolean(state.claimPending),
4047
4080
  dataAttachmentRequiresIdentity: Boolean(state.claimRequiresIdentity),
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { BeforeButtonClickEvent, CheckoutButtonMethod, DeclineEvent, FloInstrumentEvent, FloPayPaymentCancelEvent, InlineSessionDraft, InlineSessionPatch, PaymentMethodCountryRule, PaymentMethodGroup, PaymentMethodLayoutRules, SentryEventLike, SentryStackFrameLike, WalletPresentation, } from '@flopay/shared';
1
+ export type { BeforeButtonClickEvent, CardFieldsEvent, CardFieldsFailedEvent, CardFieldsFailureReason, CardFieldsReadyEvent, CheckoutButtonMethod, DeclineEvent, FloInstrumentEvent, FloPayPaymentCancelEvent, InlineSessionDraft, InlineSessionPatch, PaymentMethodCountryRule, PaymentMethodGroup, PaymentMethodLayoutRules, SentryEventLike, SentryStackFrameLike, WalletPresentation, } from '@flopay/shared';
2
2
  export { dropThirdPartyOnlyError } from '@flopay/shared';
3
3
  export type { FloPayAutomaticPaymentButtonProps, FloPayAutomaticPaymentSuccessEvent, } from './automatic-payment-button.js';
4
4
  export { FloPayAutomaticPaymentButton } from './automatic-payment-button.js';
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5N47KHFQ.mjs";
4
4
  import {
5
5
  FloPayPaymentMethodSetup
6
- } from "./chunk-YN3PHIYF.mjs";
6
+ } from "./chunk-XLVMVLVL.mjs";
7
7
  import {
8
8
  FloPayCardSetupError,
9
9
  VaultCardFields
@@ -15,7 +15,7 @@ import {
15
15
  FloPayProvider,
16
16
  StripePaymentMethods,
17
17
  hasStripePayPalReturn
18
- } from "./chunk-RAXPWAR7.mjs";
18
+ } from "./chunk-RAGPQWRA.mjs";
19
19
 
20
20
  // src/index.ts
21
21
  import { dropThirdPartyOnlyError } from "@flopay/shared";
@@ -42,8 +42,8 @@ import {
42
42
  FloPayError as FloPayError4,
43
43
  hashCreateParams,
44
44
  invokeMerchantCallback as invokeMerchantCallback3,
45
+ isDeclineCallbackFailure,
45
46
  isDetachedSessionEligible,
46
- isExpectedPaymentDecline,
47
47
  legacyCachedSessionMatchesDraft,
48
48
  markSessionRecentlyCompleted as markSessionRecentlyCompleted2,
49
49
  persistCachedInlineIdempotencyKey,
@@ -223,6 +223,7 @@ import {
223
223
  CHECKOUT_SESSION_BUYER_EMAIL_REQUIRED,
224
224
  COUNTRY_OPTIONS,
225
225
  canRecoverHostedCardForm,
226
+ cardFieldsInstrumentSource,
226
227
  computeVaultCardThemeColors,
227
228
  derivePrimaryTileStyle,
228
229
  detectPayPalEnvironment as detectPayPalEnvironment2,
@@ -1204,6 +1205,8 @@ var SplitCardForm = defineComponent3({
1204
1205
  className: { type: String, default: void 0 },
1205
1206
  cardFieldOrder: { type: Array, default: void 0 },
1206
1207
  cardAutoFocus: { type: Boolean, default: true },
1208
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
1209
+ cardFieldsTimeoutMs: { type: Number, default: void 0 },
1207
1210
  onBeforeButtonClick: {
1208
1211
  type: Function,
1209
1212
  default: void 0
@@ -1250,7 +1253,11 @@ var SplitCardForm = defineComponent3({
1250
1253
  // React's `onZipChange`.
1251
1254
  zipChange: (_zip) => true,
1252
1255
  // React's `onErrorChange`: the form's own error message changed (`null` when cleared).
1253
- errorChange: (_error) => true
1256
+ errorChange: (_error) => true,
1257
+ // React's `onCardFieldsReady`: the hosted card fields are interactive, once per card form.
1258
+ cardFieldsReady: (_event) => true,
1259
+ // React's `onCardFieldsFailed`: the card fields failed to load or timed out; not a decline.
1260
+ cardFieldsFailed: (_event) => true
1254
1261
  },
1255
1262
  /**
1256
1263
  * Slots (React's content props):
@@ -1850,13 +1857,31 @@ var SplitCardForm = defineComponent3({
1850
1857
  if (!vault.value || !id) return;
1851
1858
  const captureMethod = session.value?.captureMethod;
1852
1859
  const flopay = provider?.flopay.value;
1853
- const adapter = flopay ? flopay.cardCapture({ sessionId: id, ...captureMethod ? { captureMethod } : {} }) : new PciVaultCardCapture({
1860
+ const cardFieldsTimeoutMs = props.cardFieldsTimeoutMs;
1861
+ const adapter = flopay ? flopay.cardCapture({
1862
+ sessionId: id,
1863
+ ...captureMethod ? { captureMethod } : {},
1864
+ cardFieldsTimeoutMs
1865
+ }) : new PciVaultCardCapture({
1854
1866
  sessionId: id,
1855
1867
  ...captureMethod ? { captureMethod } : {},
1856
1868
  billingApiUrl: billingApiUrl.value,
1857
- telemetry: props.telemetry
1869
+ telemetry: props.telemetry,
1870
+ cardFieldsTimeoutMs
1871
+ });
1872
+ const detachAdapterOutcomes = bindOutcomes(adapter);
1873
+ const detachCardFields = adapter.onCardFields?.((event) => {
1874
+ provider?.emitInstrument(cardFieldsInstrumentSource(event));
1875
+ if (event.type === "card_fields_ready") {
1876
+ invokeMerchantCallback2(() => emit("cardFieldsReady", event));
1877
+ } else {
1878
+ invokeMerchantCallback2(() => emit("cardFieldsFailed", event));
1879
+ }
1858
1880
  });
1859
- detachOutcomes = bindOutcomes(adapter);
1881
+ detachOutcomes = () => {
1882
+ detachAdapterOutcomes?.();
1883
+ detachCardFields?.();
1884
+ };
1860
1885
  adapter.setSubmitGate?.(gateClosed.value);
1861
1886
  capture.value = adapter;
1862
1887
  };
@@ -2541,6 +2566,7 @@ var FloPayCheckout = defineComponent4({
2541
2566
  avsLayout: { type: String, default: void 0 },
2542
2567
  cardFieldOrder: { type: Array, default: void 0 },
2543
2568
  cardAutoFocus: { type: Boolean, default: true },
2569
+ cardFieldsTimeoutMs: { type: Number, default: void 0 },
2544
2570
  /** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
2545
2571
  showSecurityFooter: { type: Boolean, default: void 0 },
2546
2572
  /** @deprecated Ignored (React parity); see {@link FloPayCheckoutProps.fallbackPublishableKey}. */
@@ -2564,6 +2590,9 @@ var FloPayCheckout = defineComponent4({
2564
2590
  error: (_error) => true,
2565
2591
  instrument: (_event) => true,
2566
2592
  decline: (_decline) => true,
2593
+ // React's `onCardFieldsReady` / `onCardFieldsFailed`: the hosted card-field lifecycle.
2594
+ cardFieldsReady: (_event) => true,
2595
+ cardFieldsFailed: (_event) => true,
2567
2596
  // React's `onCancel`: a direct PayPal buyer cancel from the built-in form.
2568
2597
  cancel: (_event) => true,
2569
2598
  buttonClick: (_method) => true,
@@ -2675,10 +2704,7 @@ var FloPayCheckout = defineComponent4({
2675
2704
  if (failure.code === "three_ds_aborted") return;
2676
2705
  modeError.value = failure.message;
2677
2706
  mode.value = "full";
2678
- if (!(sessionId && isExpectedPaymentDecline(failure))) {
2679
- invokeMerchantCallback3(() => emit("error", failure));
2680
- }
2681
- if (sessionId) {
2707
+ if (sessionId && isDeclineCallbackFailure(failure)) {
2682
2708
  const decline = {
2683
2709
  method: "card",
2684
2710
  message: failure.message,
@@ -2687,6 +2713,8 @@ var FloPayCheckout = defineComponent4({
2687
2713
  sessionId
2688
2714
  };
2689
2715
  invokeMerchantCallback3(() => emit("decline", decline));
2716
+ } else {
2717
+ invokeMerchantCallback3(() => emit("error", failure));
2690
2718
  }
2691
2719
  } finally {
2692
2720
  savedPaymentRunning.value = false;
@@ -2807,7 +2835,9 @@ var FloPayCheckout = defineComponent4({
2807
2835
  onButtonClick: (method) => {
2808
2836
  clearModeError();
2809
2837
  invokeMerchantCallback3(() => emit("buttonClick", method));
2810
- }
2838
+ },
2839
+ onCardFieldsReady: (event) => invokeMerchantCallback3(() => emit("cardFieldsReady", event)),
2840
+ onCardFieldsFailed: (event) => invokeMerchantCallback3(() => emit("cardFieldsFailed", event))
2811
2841
  };
2812
2842
  const withProvider = (content) => h4(
2813
2843
  FloPayProvider,
@@ -2944,6 +2974,7 @@ var FloPayCheckout = defineComponent4({
2944
2974
  avsLayout: props.avsLayout,
2945
2975
  cardFieldOrder: props.cardFieldOrder,
2946
2976
  cardAutoFocus: props.cardAutoFocus,
2977
+ cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
2947
2978
  session,
2948
2979
  dataAttachmentPending: Boolean(state.claimPending),
2949
2980
  dataAttachmentRequiresIdentity: Boolean(state.claimRequiresIdentity),
@@ -95,6 +95,9 @@ var init_provider = __esm({
95
95
  if (!listener) return emit("instrument", event);
96
96
  for (const handler of [listener].flat()) handler(event);
97
97
  });
98
+ const emitTelemetryInstrument = (source) => {
99
+ if (!(0, import_shared3.isCardFieldsInstrumentSource)(source)) emitInstrument(source);
100
+ };
98
101
  (0, import_vue4.provide)(FLOPAY_CONTEXT, {
99
102
  flopay,
100
103
  paypalFlopay,
@@ -138,7 +141,7 @@ var init_provider = __esm({
138
141
  (instance, _previous, onCleanup) => {
139
142
  if (!instance) return;
140
143
  emitInstrument({ class: "lifecycle", name: "sdk.initialize.ready" });
141
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
144
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
142
145
  onCleanup(() => unsubscribe?.());
143
146
  void (0, import_vue4.nextTick)(() => emitInstrument({ class: "lifecycle", name: "checkout.rendered" }));
144
147
  },
@@ -146,7 +149,7 @@ var init_provider = __esm({
146
149
  );
147
150
  (0, import_vue4.watch)(paypalFlopay, (instance, _previous, onCleanup) => {
148
151
  if (!instance || instance === flopay.value) return;
149
- const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitInstrument);
152
+ const unsubscribe = telemetryBridge(instance)?.subscribe?.(emitTelemetryInstrument);
150
153
  onCleanup(() => unsubscribe?.());
151
154
  });
152
155
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FloPayPaymentMethodSetup
3
- } from "./chunk-YN3PHIYF.mjs";
3
+ } from "./chunk-XLVMVLVL.mjs";
4
4
  import "./chunk-Q7WDXSRE.mjs";
5
5
  export {
6
6
  FloPayPaymentMethodSetup
@@ -1,4 +1,4 @@
1
- import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionPatch, PaymentResult, ThemeId, TokenizedBody, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
1
+ import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionPatch, PaymentResult, ThemeId, TokenizedBody, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
2
2
  import { FloPayError } from '@flopay/shared';
3
3
  import { type PropType, type VNode } from 'vue';
4
4
  /**
@@ -116,6 +116,8 @@ export interface SplitCardFormProps {
116
116
  * the default, which never focuses the card over AVS fields above it.
117
117
  */
118
118
  cardAutoFocus?: boolean;
119
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
120
+ cardFieldsTimeoutMs?: number;
119
121
  /**
120
122
  * React's `onBeforeButtonClick` (a function prop: its result is read). It
121
123
  * runs before the buttons-layout card tile opens and before PayPal creates
@@ -351,6 +353,11 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
351
353
  type: BooleanConstructor;
352
354
  default: boolean;
353
355
  };
356
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
357
+ cardFieldsTimeoutMs: {
358
+ type: NumberConstructor;
359
+ default: undefined;
360
+ };
354
361
  onBeforeButtonClick: {
355
362
  type: PropType<SplitCardFormBeforeButtonClick>;
356
363
  default: undefined;
@@ -429,6 +436,8 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
429
436
  countryChange: (_country: string) => true;
430
437
  zipChange: (_zip: string) => true;
431
438
  errorChange: (_error: string | null) => true;
439
+ cardFieldsReady: (_event: CardFieldsReadyEvent) => true;
440
+ cardFieldsFailed: (_event: CardFieldsFailedEvent) => true;
432
441
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
433
442
  session: {
434
443
  type: PropType<CheckoutSession | null>;
@@ -574,6 +583,11 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
574
583
  type: BooleanConstructor;
575
584
  default: boolean;
576
585
  };
586
+ /** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
587
+ cardFieldsTimeoutMs: {
588
+ type: NumberConstructor;
589
+ default: undefined;
590
+ };
577
591
  onBeforeButtonClick: {
578
592
  type: PropType<SplitCardFormBeforeButtonClick>;
579
593
  default: undefined;
@@ -644,6 +658,8 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
644
658
  }>> & Readonly<{
645
659
  onButtonClick?: ((_method: CheckoutButtonMethod) => any) | undefined;
646
660
  onCancel?: ((_event: FloPayPaymentCancelEvent) => any) | undefined;
661
+ onCardFieldsFailed?: ((_event: CardFieldsFailedEvent) => any) | undefined;
662
+ onCardFieldsReady?: ((_event: CardFieldsReadyEvent) => any) | undefined;
647
663
  onComplete?: ((_result: PaymentResult) => any) | undefined;
648
664
  onCountryChange?: ((_country: string) => any) | undefined;
649
665
  onDecline?: ((_decline: DeclineEvent) => any) | undefined;
@@ -687,6 +703,7 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
687
703
  className: string;
688
704
  cardFieldOrder: VaultCardFieldKey[];
689
705
  cardAutoFocus: boolean;
706
+ cardFieldsTimeoutMs: number;
690
707
  onBeforeButtonClick: SplitCardFormBeforeButtonClick;
691
708
  onBuyerIdentityReady: SplitCardFormBuyerIdentityReady;
692
709
  userId: string;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StripePaymentMethods
3
- } from "./chunk-RAXPWAR7.mjs";
3
+ } from "./chunk-RAGPQWRA.mjs";
4
4
  export {
5
5
  StripePaymentMethods
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/vue",
3
- "version": "1.16.2",
3
+ "version": "1.16.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -36,8 +36,8 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@flopay/js": "1.16.2",
40
- "@flopay/shared": "1.16.2",
39
+ "@flopay/js": "1.16.4",
40
+ "@flopay/shared": "1.16.4",
41
41
  "@paypal/paypal-js": "^11.3.0",
42
42
  "@stripe/stripe-js": "^10.3.0"
43
43
  },