@flopay/vue 1.17.1 → 1.18.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.
- package/README.md +14 -0
- package/dist/flopay-checkout.d.ts +17 -1
- package/dist/index.cjs +35 -0
- package/dist/index.mjs +35 -0
- package/dist/split-card-form.d.ts +18 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -100,6 +100,20 @@ h(FloPayCheckout, { sessionId: 'sess_123', nonce: 'nonce_123', showCardBrandIcon
|
|
|
100
100
|
|
|
101
101
|
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.
|
|
102
102
|
|
|
103
|
+
### Card field placeholders
|
|
104
|
+
|
|
105
|
+
`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):
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
h(FloPayCheckout, {
|
|
109
|
+
sessionId: 'sess_123',
|
|
110
|
+
nonce: 'nonce_123',
|
|
111
|
+
cardFieldPlaceholders: { number: 'Card number', expiry: 'MM / YY', cvv: 'CVC', name: 'Name on card' },
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
103
117
|
### PayPal buyer cancel
|
|
104
118
|
|
|
105
119
|
`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`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, PaymentResult, ThemeId, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
|
|
1
|
+
import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldPlaceholders, 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';
|
|
@@ -54,6 +54,13 @@ export interface FloPayCheckoutProps {
|
|
|
54
54
|
* field as it is. Vault card path only. See React.
|
|
55
55
|
*/
|
|
56
56
|
showCardBrandIcons?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
|
|
59
|
+
* `name`), each optional. Only the fields given are sent; `''` shows no
|
|
60
|
+
* placeholder. A change updates the mounted form live. Omitted sends
|
|
61
|
+
* nothing. Vault card path only. See React.
|
|
62
|
+
*/
|
|
63
|
+
cardFieldPlaceholders?: CardFieldPlaceholders;
|
|
57
64
|
/**
|
|
58
65
|
* `false` turns off the card form's automatic initial focus when the
|
|
59
66
|
* checkout opens. Omitted or `true` keeps the default. See React.
|
|
@@ -224,6 +231,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
224
231
|
type: BooleanConstructor;
|
|
225
232
|
default: boolean;
|
|
226
233
|
};
|
|
234
|
+
cardFieldPlaceholders: {
|
|
235
|
+
type: PropType<CardFieldPlaceholders>;
|
|
236
|
+
default: undefined;
|
|
237
|
+
};
|
|
227
238
|
cardAutoFocus: {
|
|
228
239
|
type: BooleanConstructor;
|
|
229
240
|
default: boolean;
|
|
@@ -387,6 +398,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
387
398
|
type: BooleanConstructor;
|
|
388
399
|
default: boolean;
|
|
389
400
|
};
|
|
401
|
+
cardFieldPlaceholders: {
|
|
402
|
+
type: PropType<CardFieldPlaceholders>;
|
|
403
|
+
default: undefined;
|
|
404
|
+
};
|
|
390
405
|
cardAutoFocus: {
|
|
391
406
|
type: BooleanConstructor;
|
|
392
407
|
default: boolean;
|
|
@@ -467,6 +482,7 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
467
482
|
avsLayout: "column" | "row";
|
|
468
483
|
cardFieldOrder: VaultCardFieldKey[];
|
|
469
484
|
showCardBrandIcons: boolean;
|
|
485
|
+
cardFieldPlaceholders: CardFieldPlaceholders;
|
|
470
486
|
cardAutoFocus: boolean;
|
|
471
487
|
cardFieldsTimeoutMs: number;
|
|
472
488
|
showSecurityFooter: boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -2262,6 +2262,16 @@ function noVaultCapabilityError() {
|
|
|
2262
2262
|
{ code: "UnsupportedBackendVaultCapability" }
|
|
2263
2263
|
);
|
|
2264
2264
|
}
|
|
2265
|
+
var CARD_FIELD_PLACEHOLDER_KEYS = ["number", "expiry", "cvv", "name"];
|
|
2266
|
+
function cardFieldPlaceholdersContentKey(value) {
|
|
2267
|
+
if (value === null || typeof value !== "object") return null;
|
|
2268
|
+
const fields = {};
|
|
2269
|
+
for (const key of CARD_FIELD_PLACEHOLDER_KEYS) {
|
|
2270
|
+
const text = value[key];
|
|
2271
|
+
if (typeof text === "string") fields[key] = text;
|
|
2272
|
+
}
|
|
2273
|
+
return JSON.stringify(fields);
|
|
2274
|
+
}
|
|
2265
2275
|
var SplitCardForm = (0, import_vue6.defineComponent)({
|
|
2266
2276
|
name: "SplitCardForm",
|
|
2267
2277
|
props: {
|
|
@@ -2305,6 +2315,10 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
|
|
|
2305
2315
|
className: { type: String, default: void 0 },
|
|
2306
2316
|
cardFieldOrder: { type: Array, default: void 0 },
|
|
2307
2317
|
showCardBrandIcons: { type: Boolean, default: false },
|
|
2318
|
+
cardFieldPlaceholders: {
|
|
2319
|
+
type: Object,
|
|
2320
|
+
default: void 0
|
|
2321
|
+
},
|
|
2308
2322
|
cardAutoFocus: { type: Boolean, default: true },
|
|
2309
2323
|
/** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
|
|
2310
2324
|
cardFieldsTimeoutMs: { type: Number, default: void 0 },
|
|
@@ -3018,6 +3032,22 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
|
|
|
3018
3032
|
([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
|
|
3019
3033
|
{ immediate: true }
|
|
3020
3034
|
);
|
|
3035
|
+
let placeholdersSentTo = null;
|
|
3036
|
+
(0, import_vue6.watch)(
|
|
3037
|
+
[() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
|
|
3038
|
+
([adapter, key]) => {
|
|
3039
|
+
if (!adapter) return;
|
|
3040
|
+
if (key === null) {
|
|
3041
|
+
if (placeholdersSentTo !== adapter) return;
|
|
3042
|
+
placeholdersSentTo = null;
|
|
3043
|
+
adapter.setCardFieldPlaceholders?.(void 0);
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
placeholdersSentTo = adapter;
|
|
3047
|
+
adapter.setCardFieldPlaceholders?.(JSON.parse(key));
|
|
3048
|
+
},
|
|
3049
|
+
{ immediate: true }
|
|
3050
|
+
);
|
|
3021
3051
|
(0, import_vue6.watch)(gateClosed, (closed) => capture.value?.setSubmitGate?.(closed));
|
|
3022
3052
|
});
|
|
3023
3053
|
(0, import_vue6.onBeforeUnmount)(() => {
|
|
@@ -3672,6 +3702,10 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
|
|
|
3672
3702
|
avsLayout: { type: String, default: void 0 },
|
|
3673
3703
|
cardFieldOrder: { type: Array, default: void 0 },
|
|
3674
3704
|
showCardBrandIcons: { type: Boolean, default: false },
|
|
3705
|
+
cardFieldPlaceholders: {
|
|
3706
|
+
type: Object,
|
|
3707
|
+
default: void 0
|
|
3708
|
+
},
|
|
3675
3709
|
cardAutoFocus: { type: Boolean, default: true },
|
|
3676
3710
|
cardFieldsTimeoutMs: { type: Number, default: void 0 },
|
|
3677
3711
|
/** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
|
|
@@ -4081,6 +4115,7 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
|
|
|
4081
4115
|
avsLayout: props.avsLayout,
|
|
4082
4116
|
cardFieldOrder: props.cardFieldOrder,
|
|
4083
4117
|
showCardBrandIcons: props.showCardBrandIcons === true,
|
|
4118
|
+
cardFieldPlaceholders: props.cardFieldPlaceholders,
|
|
4084
4119
|
cardAutoFocus: props.cardAutoFocus,
|
|
4085
4120
|
cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
|
|
4086
4121
|
session,
|
package/dist/index.mjs
CHANGED
|
@@ -1162,6 +1162,16 @@ function noVaultCapabilityError() {
|
|
|
1162
1162
|
{ code: "UnsupportedBackendVaultCapability" }
|
|
1163
1163
|
);
|
|
1164
1164
|
}
|
|
1165
|
+
var CARD_FIELD_PLACEHOLDER_KEYS = ["number", "expiry", "cvv", "name"];
|
|
1166
|
+
function cardFieldPlaceholdersContentKey(value) {
|
|
1167
|
+
if (value === null || typeof value !== "object") return null;
|
|
1168
|
+
const fields = {};
|
|
1169
|
+
for (const key of CARD_FIELD_PLACEHOLDER_KEYS) {
|
|
1170
|
+
const text = value[key];
|
|
1171
|
+
if (typeof text === "string") fields[key] = text;
|
|
1172
|
+
}
|
|
1173
|
+
return JSON.stringify(fields);
|
|
1174
|
+
}
|
|
1165
1175
|
var SplitCardForm = defineComponent3({
|
|
1166
1176
|
name: "SplitCardForm",
|
|
1167
1177
|
props: {
|
|
@@ -1205,6 +1215,10 @@ var SplitCardForm = defineComponent3({
|
|
|
1205
1215
|
className: { type: String, default: void 0 },
|
|
1206
1216
|
cardFieldOrder: { type: Array, default: void 0 },
|
|
1207
1217
|
showCardBrandIcons: { type: Boolean, default: false },
|
|
1218
|
+
cardFieldPlaceholders: {
|
|
1219
|
+
type: Object,
|
|
1220
|
+
default: void 0
|
|
1221
|
+
},
|
|
1208
1222
|
cardAutoFocus: { type: Boolean, default: true },
|
|
1209
1223
|
/** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
|
|
1210
1224
|
cardFieldsTimeoutMs: { type: Number, default: void 0 },
|
|
@@ -1918,6 +1932,22 @@ var SplitCardForm = defineComponent3({
|
|
|
1918
1932
|
([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
|
|
1919
1933
|
{ immediate: true }
|
|
1920
1934
|
);
|
|
1935
|
+
let placeholdersSentTo = null;
|
|
1936
|
+
watch2(
|
|
1937
|
+
[() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
|
|
1938
|
+
([adapter, key]) => {
|
|
1939
|
+
if (!adapter) return;
|
|
1940
|
+
if (key === null) {
|
|
1941
|
+
if (placeholdersSentTo !== adapter) return;
|
|
1942
|
+
placeholdersSentTo = null;
|
|
1943
|
+
adapter.setCardFieldPlaceholders?.(void 0);
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
placeholdersSentTo = adapter;
|
|
1947
|
+
adapter.setCardFieldPlaceholders?.(JSON.parse(key));
|
|
1948
|
+
},
|
|
1949
|
+
{ immediate: true }
|
|
1950
|
+
);
|
|
1921
1951
|
watch2(gateClosed, (closed) => capture.value?.setSubmitGate?.(closed));
|
|
1922
1952
|
});
|
|
1923
1953
|
onBeforeUnmount3(() => {
|
|
@@ -2572,6 +2602,10 @@ var FloPayCheckout = defineComponent4({
|
|
|
2572
2602
|
avsLayout: { type: String, default: void 0 },
|
|
2573
2603
|
cardFieldOrder: { type: Array, default: void 0 },
|
|
2574
2604
|
showCardBrandIcons: { type: Boolean, default: false },
|
|
2605
|
+
cardFieldPlaceholders: {
|
|
2606
|
+
type: Object,
|
|
2607
|
+
default: void 0
|
|
2608
|
+
},
|
|
2575
2609
|
cardAutoFocus: { type: Boolean, default: true },
|
|
2576
2610
|
cardFieldsTimeoutMs: { type: Number, default: void 0 },
|
|
2577
2611
|
/** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
|
|
@@ -2981,6 +3015,7 @@ var FloPayCheckout = defineComponent4({
|
|
|
2981
3015
|
avsLayout: props.avsLayout,
|
|
2982
3016
|
cardFieldOrder: props.cardFieldOrder,
|
|
2983
3017
|
showCardBrandIcons: props.showCardBrandIcons === true,
|
|
3018
|
+
cardFieldPlaceholders: props.cardFieldPlaceholders,
|
|
2984
3019
|
cardAutoFocus: props.cardAutoFocus,
|
|
2985
3020
|
cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
|
|
2986
3021
|
session,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionPatch, PaymentResult, ThemeId, TokenizedBody, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
|
|
1
|
+
import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldPlaceholders, 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,14 @@ export interface SplitCardFormProps {
|
|
|
116
116
|
* field as it is. Vault card path only; an older hosted form ignores it.
|
|
117
117
|
*/
|
|
118
118
|
showCardBrandIcons?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
|
|
121
|
+
* `name`), each optional. Only the fields given are sent; the rest keep the
|
|
122
|
+
* hosted form's wording, and `''` shows no placeholder. A change updates the
|
|
123
|
+
* mounted form live (compared by content). Omitted sends nothing. Vault card
|
|
124
|
+
* path only. See React.
|
|
125
|
+
*/
|
|
126
|
+
cardFieldPlaceholders?: CardFieldPlaceholders;
|
|
119
127
|
/**
|
|
120
128
|
* `false` turns off the hosted card form's automatic initial focus, so the
|
|
121
129
|
* page is not scrolled to the form when it opens. Omitted or `true` keeps
|
|
@@ -359,6 +367,10 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
|
|
|
359
367
|
type: BooleanConstructor;
|
|
360
368
|
default: boolean;
|
|
361
369
|
};
|
|
370
|
+
cardFieldPlaceholders: {
|
|
371
|
+
type: PropType<CardFieldPlaceholders>;
|
|
372
|
+
default: undefined;
|
|
373
|
+
};
|
|
362
374
|
cardAutoFocus: {
|
|
363
375
|
type: BooleanConstructor;
|
|
364
376
|
default: boolean;
|
|
@@ -593,6 +605,10 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
|
|
|
593
605
|
type: BooleanConstructor;
|
|
594
606
|
default: boolean;
|
|
595
607
|
};
|
|
608
|
+
cardFieldPlaceholders: {
|
|
609
|
+
type: PropType<CardFieldPlaceholders>;
|
|
610
|
+
default: undefined;
|
|
611
|
+
};
|
|
596
612
|
cardAutoFocus: {
|
|
597
613
|
type: BooleanConstructor;
|
|
598
614
|
default: boolean;
|
|
@@ -717,6 +733,7 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
|
|
|
717
733
|
className: string;
|
|
718
734
|
cardFieldOrder: VaultCardFieldKey[];
|
|
719
735
|
showCardBrandIcons: boolean;
|
|
736
|
+
cardFieldPlaceholders: CardFieldPlaceholders;
|
|
720
737
|
cardAutoFocus: boolean;
|
|
721
738
|
cardFieldsTimeoutMs: number;
|
|
722
739
|
onBeforeButtonClick: SplitCardFormBeforeButtonClick;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
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.
|
|
40
|
-
"@flopay/shared": "1.
|
|
39
|
+
"@flopay/js": "1.18.0",
|
|
40
|
+
"@flopay/shared": "1.18.0",
|
|
41
41
|
"@paypal/paypal-js": "^11.3.0",
|
|
42
42
|
"@stripe/stripe-js": "^10.3.0"
|
|
43
43
|
},
|