@flopay/vue 1.20.15 → 2.0.0

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.
Files changed (39) hide show
  1. package/README.md +56 -57
  2. package/dist/card-setup-entry.cjs +184 -569
  3. package/dist/card-setup-entry.d.ts +2 -2
  4. package/dist/card-setup-entry.mjs +3 -7
  5. package/dist/chunk-2VPPDVV7.mjs +218 -0
  6. package/dist/chunk-OCVTEXQA.mjs +20 -0
  7. package/dist/flopay-runtime-checkout.d.ts +11 -0
  8. package/dist/hosted-runtime-components.d.ts +587 -0
  9. package/dist/index.cjs +279 -5402
  10. package/dist/index.d.ts +3 -21
  11. package/dist/index.mjs +231 -3728
  12. package/dist/payment-method-setup-entry.cjs +194 -1852
  13. package/dist/payment-method-setup-entry.d.ts +2 -2
  14. package/dist/payment-method-setup-entry.mjs +4 -4
  15. package/dist/runtime-context.d.ts +11 -0
  16. package/package.json +3 -5
  17. package/dist/automatic-payment-button.d.ts +0 -296
  18. package/dist/buyer-identity-fallback.d.ts +0 -82
  19. package/dist/chunk-2USKULEH.mjs +0 -530
  20. package/dist/chunk-HH25IC76.mjs +0 -98
  21. package/dist/chunk-IJKGJSHH.mjs +0 -333
  22. package/dist/chunk-RAGPQWRA.mjs +0 -923
  23. package/dist/context.d.ts +0 -56
  24. package/dist/direct-paypal-button.d.ts +0 -325
  25. package/dist/flopay-card-setup.d.ts +0 -158
  26. package/dist/flopay-checkout.d.ts +0 -517
  27. package/dist/flopay-payment-method-setup-main.d.ts +0 -152
  28. package/dist/hooks.d.ts +0 -22
  29. package/dist/hosted-setup.d.ts +0 -116
  30. package/dist/payment-method-setup-paypal-D6FEQQJY.mjs +0 -151
  31. package/dist/payment-method-setup-paypal.d.ts +0 -108
  32. package/dist/processing-overlay.d.ts +0 -82
  33. package/dist/provider.d.ts +0 -76
  34. package/dist/saved-payment.d.ts +0 -44
  35. package/dist/split-card-form.d.ts +0 -777
  36. package/dist/stripe-elements-SI2PI6EO.mjs +0 -6
  37. package/dist/stripe-elements.d.ts +0 -280
  38. package/dist/stripe-paypal-continuation.d.ts +0 -28
  39. package/dist/vault-card-fields.d.ts +0 -129
package/README.md CHANGED
@@ -37,34 +37,42 @@ Supplied buyer names: when an inline `createSession.account` has a non-blank `fi
37
37
 
38
38
  ## Examples
39
39
 
40
- Card setup from the Stripe-free subpath:
40
+ Card setup from the `@flopay/vue/card-setup` subpath:
41
41
 
42
42
  ```ts
43
43
  import { FloPayCardSetup } from '@flopay/vue/card-setup';
44
44
  import { h } from 'vue';
45
45
 
46
+ declare const runtimeUrl: string; // the Flo-hosted runtime entry for your environment
47
+
46
48
  const render = () =>
47
49
  h(FloPayCardSetup, {
48
50
  sessionId: 'sess_setup_123',
49
51
  nonce: 'nonce_setup_123',
50
- onComplete: (event) => console.log(event.sessionId),
52
+ runtimeUrl,
53
+ onComplete: (event: unknown) => console.log('saved', event),
51
54
  });
52
55
  ```
53
56
 
54
- One-click payment with the buyer's saved payment method:
57
+ One-click payment with the buyer's saved payment method, from a session your server mints when the buyer clicks:
55
58
 
56
59
  ```ts
60
+ import type { CheckoutRuntimeSuppliedSession } from '@flopay/js';
57
61
  import { FloPayAutomaticPaymentButton } from '@flopay/vue';
58
62
  import { h } from 'vue';
59
63
 
64
+ declare const publishableKey: string;
65
+ declare const runtimeUrl: string;
66
+
60
67
  const render = () =>
61
68
  h(FloPayAutomaticPaymentButton, {
62
- clientId: 'client_123',
63
- account: { userId: 'user_123', email: 'buyer@example.com' },
64
- products: [{ code: 'pro-monthly', quantity: 1 }],
65
- successUrl: 'https://example.com/success',
66
- cancelUrl: 'https://example.com/cancel',
67
- onSuccess: (event) => console.log(event.autoCompleted),
69
+ publishableKey,
70
+ runtimeUrl,
71
+ getSession: async ({ signal }: { signal: AbortSignal }) => {
72
+ const response = await fetch('/api/one-click-session', { method: 'POST', signal });
73
+ return (await response.json()) as CheckoutRuntimeSuppliedSession;
74
+ },
75
+ onSuccess: (event: unknown) => console.log('paid', event),
68
76
  });
69
77
  ```
70
78
 
@@ -82,58 +90,12 @@ Every `@flopay/react` component and hook has a same-name Vue export. React's not
82
90
  | `FloPayAutomaticPaymentButton` | `<FloPayAutomaticPaymentButton>` | `FloPayAutomaticPaymentButton`: `@success`, `@error`, `@decline` |
83
91
  | `FloPayCardSetup` | `<FloPayCardSetup>` | `FloPayCardSetup`: `@ready`, `@complete`, `@decline`, `@cancel`, `@error` |
84
92
  | `FloPayPaymentMethodSetup` | `<FloPayPaymentMethodSetup>` | `FloPayPaymentMethodSetup` |
85
- | `useFloPay` | `useFloPay()` | `useFloPay()`: a ref, `null` until `loadFloPay()` resolves |
86
- | `usePayPalFloPay` | `usePayPalFloPay()` | `usePayPalFloPay()`: a ref |
87
- | `useCheckout` | `useCheckout()` | `useCheckout()`: a reactive checkout state |
88
- | `FloPayCardSetupError` | `FloPayCardSetupError` | `FloPayCardSetupError` |
89
93
  | `dropThirdPartyOnlyError` | `dropThirdPartyOnlyError` | `dropThirdPartyOnlyError` |
90
94
 
91
95
  React `children` and custom layouts are slots. `FloPayCheckout`'s `layout` slot replaces the built-in form, and a `SplitCardForm` inside it receives the session, nonce and `submitLabel` unless it sets them itself.
92
96
 
93
97
  Entry points: `@flopay/vue`, `@flopay/vue/card-setup` and `@flopay/vue/payment-method-setup`.
94
98
 
95
- ### Card brand icons
96
-
97
- `FloPayCheckout` and `SplitCardForm` take the same `showCardBrandIcons` prop as React. Set it to `true` to show the Visa, Mastercard, Amex and Discover icons on the right of the hosted card number field:
98
-
99
- ```ts
100
- h(FloPayCheckout, { sessionId: 'sess_123', nonce: 'nonce_123', showCardBrandIcons: true });
101
- ```
102
-
103
- Only `true` turns the icons on; omitted or `false` leaves the card form exactly as it was. Changing the prop updates the hosted form in place, and the SDK re-sends it whenever the hosted form becomes ready again. The hosted form narrows the icons to the brand the buyer types; no brand is reported back to your page. A card form that predates the icons ignores the setting.
104
-
105
- ### Card field labels
106
-
107
- `FloPayCheckout` and `SplitCardForm` take the same `showCardFieldLabels` and `cardFieldLabels` props as React. `showCardFieldLabels: true` shows visible labels above the hosted card fields, and `cardFieldLabels` (optional `number`, `expiry`, `cvv` and `name` text) changes their wording:
108
-
109
- ```ts
110
- h(FloPayCheckout, {
111
- sessionId: 'sess_123',
112
- nonce: 'nonce_123',
113
- showCardFieldLabels: true,
114
- cardFieldLabels: { number: 'Card number', cvv: 'Security code' },
115
- appearance: { rules: { '.Label': { color: '#475569', marginBottom: '6px' } } },
116
- });
117
- ```
118
-
119
- When both props are omitted, nothing is sent and the card form looks as it does today; an omitted `showCardFieldLabels` stays unset rather than becoming `false`. Only the label fields you set are sent, exactly as given, and removing `cardFieldLabels` restores the hosted form's default wording. Changing either prop updates the hosted form in place, without a remount, and the SDK re-sends the settings whenever the hosted form becomes ready again. As with a custom submit label, the settings are bound to the session and the card form's `messageToken` and are sent only to the hosted form's exact `expectedOrigin`, never to `'*'`; a card form without them (an older billing API) keeps its default look.
120
-
121
- The labels are styled by `appearance.rules['.Label']`, the same rule that styles Stripe's labels. The supported `.Label` properties are `color`, `fontSize` (px), `fontWeight`, `letterSpacing` (em), `textTransform`, and `marginBottom`, which sets the gap between the label and its field. Every other `.Label` property (for example `padding`, `border` or `fontFamily`) is ignored without error, as are empty or wrong-typed values. Without a supported `.Label` property the theme sent to the hosted form is unchanged.
122
-
123
- ### Card field placeholders
124
-
125
- `FloPayCheckout` and `SplitCardForm` take the same `cardFieldPlaceholders` prop as React, with the same shape. It sets the placeholder text of the hosted card fields; every field is optional: `number` (card number), `expiry` (expiry date), `cvv` (security code) and `name` (name on card):
126
-
127
- ```ts
128
- h(FloPayCheckout, {
129
- sessionId: 'sess_123',
130
- nonce: 'nonce_123',
131
- cardFieldPlaceholders: { number: 'Card number', expiry: 'MM / YY', cvv: 'CVC', name: 'Name on card' },
132
- });
133
- ```
134
-
135
- Omitted, nothing is sent and the card form looks as it does today. A field you leave out keeps the hosted form's own wording, and an empty string (`''`) shows no placeholder. The text is sent as given; the hosted form enforces its own limits and shows it literally. Changing the prop updates the hosted form in place without a remount (compared by content, so a new object with the same text sends nothing), and the SDK re-sends the latest text whenever the hosted form becomes ready again. Removing the prop restores the hosted form's wording. Like the submit label, the text is sent only to the hosted form's exact origin.
136
-
137
99
  ### PayPal buyer cancel
138
100
 
139
101
  `FloPayCheckout`, `SplitCardForm` and `DirectPayPalButton` emit `cancel` (`@cancel`, React's `onCancel`) once per click when the buyer closes the PayPal pop-up, or returns from PayPal's app switch, without approving. The payload is a `FloPayPaymentCancelEvent`: `{ status: 'cancelled', sessionId, provider: 'paypal', paymentMethodType }`. `sessionId` is the attempt's session (the click-time patch's, otherwise the checkout's), and `paymentMethodType` is `paypal_vaulted` when the session advertises an `order` or `setup_token`, otherwise `paypal`.
@@ -195,9 +157,46 @@ h(FloPayCheckout, {
195
157
 
196
158
  ### Stripe account switch
197
159
 
198
- `@flopay/react`'s `FloPayCheckout` re-mounts its wallet buttons when a claim moves the checkout to another Stripe account, and tells the billing API it can. The Vue port of that Stripe account switch follows with SDK 2.0, and `FloPayCheckout` here gets no account-switch code before then.
160
+ In 1.x, `@flopay/react`'s `FloPayCheckout` re-mounted its wallet buttons when a claim moved the checkout to another Stripe account, and the Vue port of that Stripe account switch was planned for SDK 2.0. SDK 2.0 instead moves checkout into the hosted runtime: `@flopay/vue` no longer creates, claims or renders the session itself, and has no account-switch code of its own.
161
+
162
+ `@flopay/vue` does not send the `stripe-account-switch-v1` capability or a `routingProducts` hint. The hosted runtime that the Vue components mount creates and claims the session, and it is the same runtime `@flopay/react` mounts, so the Vue checkout behaves exactly as the React checkout does when a claim changes the Stripe account.
163
+
164
+ ### Breaking changes in 2.0.0
165
+
166
+ `@flopay/vue` 2.0.0 keeps every 1.x component name (`FloPayProvider`, `FloPayCheckout`, `FloPayAutomaticPaymentButton`, `DirectPayPalButton`, `FloPayCardSetup`, `FloPayPaymentMethodSetup`, `SplitCardForm`, `VaultCardFields`). Each one now loads the hosted checkout runtime, passes its props to it and relays its events as the same emits with the payload unchanged. The package holds no business rules, no buyer-facing wording and no payment processor SDK: `@stripe/stripe-js` and `@paypal/paypal-js` are no longer dependencies. `FloPayRuntimeCheckout`, `FloPayRuntimeCardSetup` and `FloPayRuntimePaymentMethodSetup` are aliases of `FloPayCheckout`, `FloPayCardSetup` and `FloPayPaymentMethodSetup`. `@flopay/js`, `@flopay/react`, `@flopay/vue`, `@flopay/node` and `@flopay/shared` are released together as 2.0.0.
167
+
168
+ No public prop, option or type names a payment processor any more. Payment methods are hidden by method with `hiddenPaymentMethods`, a list of `'card' | 'paypal' | 'apple_pay' | 'google_pay' | 'apms'` forwarded to the runtime, which does the hiding.
169
+
170
+ - `showStripe`: `:show-stripe="false"` / `showStripe: false` becomes `hiddenPaymentMethods: ['apple_pay', 'google_pay', 'apms']` (the wallets and other methods, not the card form and not PayPal).
171
+ - `showApplePay`: `showApplePay: false` becomes `hiddenPaymentMethods: ['apple_pay']`.
172
+ - `showGooglePay`: `showGooglePay: false` becomes `hiddenPaymentMethods: ['google_pay']`.
173
+ - `fallbackPublishableKey`: `fallbackPublishableKey` is deleted with no replacement.
174
+ - CheckoutGateways (`gateways.stripe`, `gateways.paypal`): `paymentMethods`: availability of `card`, `paypal`, `wallets` and `apms`, with no processor key. `gateways.stripe` becomes `card`, `wallets` and `apms`; `gateways.paypal` becomes `paypal`.
175
+
176
+ `showPayPal` stays: `showPayPal: false` is forwarded as hiding `paypal`, merged with any `hiddenPaymentMethods` you pass. Omitting both hides nothing. The presentation props the runtime accepts (`appearance`, `strings`, `layout`, `paymentMethodLayout`, and the setup components' `theme`, `appearance` and `buttonsStyles`) are forwarded, not interpreted. Seven more 1.x checkout props stay and are forwarded too; see **Known limits in 2.0.0** below.
177
+
178
+ **Default checkout mode.** A session created with no `checkoutMode` now defaults to `'full'` (it was `'confirm'` in 1.x), in `@flopay/js` and `@flopay/node`. An explicit `'confirm'`, `'auto'` or `'full'` is sent unchanged. Merchants who want the old default must set `checkoutMode: 'confirm'` and create the session from a server with merchant credentials (`@flopay/node` `checkout.sessions.createOneClick`, handed to `getSession`).
199
179
 
200
- Until then `@flopay/vue` does not send the `stripe-account-switch-v1` capability, so when a claim would change the Stripe account the billing API hides Apple Pay and Google Pay for the Vue checkout, as it does today; card and PayPal stay available. The detached create's `routingProducts` hint (the cart's product codes) comes from `@flopay/js` and is sent by the Vue checkout too, so a cart whose products use another Stripe account normally starts on that account from the first response and the claim does not move it.
180
+ ### Known limits in 2.0.0
181
+
182
+ `FloPayCheckout`, `SplitCardForm`, `FloPayAutomaticPaymentButton`, `DirectPayPalButton` and `VaultCardFields` take the same seven 1.x props as React and forward them to the hosted runtime unchanged, but **the runtime does not act on them yet, so in 2.0.0 they have no effect**: `theme`, `showCardBrandIcons`, `showCardFieldLabels`, `cardFieldLabels`, `cardFieldPlaceholders`, `enabledPaymentMethods` and `initialPayPalOrderId`. They are not removed. A component that sets them keeps type-checking and emits no error, and it needs no change once the runtime supports them. Omitted, nothing is sent.
183
+
184
+ - `theme` leaves the checkout's look as it is. On `FloPayCardSetup` and `FloPayPaymentMethodSetup`, `theme` is applied.
185
+ - `showCardBrandIcons`, `showCardFieldLabels`, `cardFieldLabels` and `cardFieldPlaceholders` leave the hosted card form's own icons, labels and placeholder text as they are. `cardFieldLabels` and `cardFieldPlaceholders` take optional `number`, `expiry`, `cvv` and `name` text.
186
+ - `enabledPaymentMethods` does not narrow the payment methods on offer. The session's `paymentMethods` decide which methods the runtime offers, and `hiddenPaymentMethods` hides them.
187
+ - `initialPayPalOrderId` does not resume a PayPal order.
188
+
189
+ `appearance` still carries any `.Label` rule you set for the labels. In 1.x the labels used its `color`, `fontSize`, `fontWeight`, `letterSpacing`, `textTransform` and `marginBottom`, and every other `.Label` property was ignored.
190
+
191
+ ```ts
192
+ // Forwarded unchanged in 2.0.0.
193
+ h(FloPayCheckout, {
194
+ sessionId: 'sess_123',
195
+ nonce: 'nonce_123',
196
+ showCardFieldLabels: true,
197
+ cardFieldPlaceholders: { number: 'Card number', expiry: 'MM / YY', cvv: 'CVC', name: 'Name on card' },
198
+ });
199
+ ```
201
200
 
202
201
  ## Errors
203
202