@flopay/vue 1.18.1 → 1.19.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 CHANGED
@@ -102,6 +102,24 @@ h(FloPayCheckout, { sessionId: 'sess_123', nonce: 'nonce_123', showCardBrandIcon
102
102
 
103
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
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
+
105
123
  ### Card field placeholders
106
124
 
107
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):
@@ -1,4 +1,4 @@
1
- import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldPlaceholders, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, PaymentResult, ThemeId, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
1
+ import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldLabels, 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,10 @@ export interface FloPayCheckoutProps {
54
54
  * field as it is. Vault card path only. See React.
55
55
  */
56
56
  showCardBrandIcons?: boolean;
57
+ /** Show the visible labels above the hosted card fields. See React. */
58
+ showCardFieldLabels?: boolean;
59
+ /** Replace the text of the labels (`number`, `expiry`, `cvv`, `name`). See React. */
60
+ cardFieldLabels?: CardFieldLabels;
57
61
  /**
58
62
  * Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
59
63
  * `name`), each optional. Only the fields given are sent; `''` shows no
@@ -231,6 +235,14 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
231
235
  type: BooleanConstructor;
232
236
  default: boolean;
233
237
  };
238
+ showCardFieldLabels: {
239
+ type: BooleanConstructor;
240
+ default: undefined;
241
+ };
242
+ cardFieldLabels: {
243
+ type: PropType<CardFieldLabels>;
244
+ default: undefined;
245
+ };
234
246
  cardFieldPlaceholders: {
235
247
  type: PropType<CardFieldPlaceholders>;
236
248
  default: undefined;
@@ -398,6 +410,14 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
398
410
  type: BooleanConstructor;
399
411
  default: boolean;
400
412
  };
413
+ showCardFieldLabels: {
414
+ type: BooleanConstructor;
415
+ default: undefined;
416
+ };
417
+ cardFieldLabels: {
418
+ type: PropType<CardFieldLabels>;
419
+ default: undefined;
420
+ };
401
421
  cardFieldPlaceholders: {
402
422
  type: PropType<CardFieldPlaceholders>;
403
423
  default: undefined;
@@ -482,6 +502,8 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
482
502
  avsLayout: "column" | "row";
483
503
  cardFieldOrder: VaultCardFieldKey[];
484
504
  showCardBrandIcons: boolean;
505
+ showCardFieldLabels: boolean;
506
+ cardFieldLabels: CardFieldLabels;
485
507
  cardFieldPlaceholders: CardFieldPlaceholders;
486
508
  cardAutoFocus: boolean;
487
509
  cardFieldsTimeoutMs: number;
package/dist/index.cjs CHANGED
@@ -2315,6 +2315,10 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
2315
2315
  className: { type: String, default: void 0 },
2316
2316
  cardFieldOrder: { type: Array, default: void 0 },
2317
2317
  showCardBrandIcons: { type: Boolean, default: false },
2318
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
2319
+ // absent Boolean to `false`), so a form without it sends nothing.
2320
+ showCardFieldLabels: { type: Boolean, default: void 0 },
2321
+ cardFieldLabels: { type: Object, default: void 0 },
2318
2322
  cardFieldPlaceholders: {
2319
2323
  type: Object,
2320
2324
  default: void 0
@@ -3032,6 +3036,41 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
3032
3036
  ([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
3033
3037
  { immediate: true }
3034
3038
  );
3039
+ let showCardFieldLabelsSentTo = null;
3040
+ (0, import_vue6.watch)(
3041
+ [() => capture.value, () => props.showCardFieldLabels],
3042
+ ([adapter, show]) => {
3043
+ if (!adapter) return;
3044
+ if (show === void 0) {
3045
+ if (showCardFieldLabelsSentTo !== adapter) return;
3046
+ showCardFieldLabelsSentTo = null;
3047
+ adapter.setShowCardFieldLabels?.(false);
3048
+ return;
3049
+ }
3050
+ showCardFieldLabelsSentTo = adapter;
3051
+ adapter.setShowCardFieldLabels?.(show === true);
3052
+ },
3053
+ { immediate: true }
3054
+ );
3055
+ const cardFieldLabelsKey = (0, import_vue6.computed)(
3056
+ () => props.cardFieldLabels === void 0 ? void 0 : JSON.stringify((0, import_shared8.buildCardFieldLabelsPayload)(props.cardFieldLabels))
3057
+ );
3058
+ let cardFieldLabelsSentTo = null;
3059
+ (0, import_vue6.watch)(
3060
+ [() => capture.value, cardFieldLabelsKey],
3061
+ ([adapter, key]) => {
3062
+ if (!adapter) return;
3063
+ if (key === void 0) {
3064
+ if (cardFieldLabelsSentTo !== adapter) return;
3065
+ cardFieldLabelsSentTo = null;
3066
+ adapter.setCardFieldLabels?.(null);
3067
+ return;
3068
+ }
3069
+ cardFieldLabelsSentTo = adapter;
3070
+ adapter.setCardFieldLabels?.(JSON.parse(key));
3071
+ },
3072
+ { immediate: true }
3073
+ );
3035
3074
  let placeholdersSentTo = null;
3036
3075
  (0, import_vue6.watch)(
3037
3076
  [() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
@@ -3702,6 +3741,10 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3702
3741
  avsLayout: { type: String, default: void 0 },
3703
3742
  cardFieldOrder: { type: Array, default: void 0 },
3704
3743
  showCardBrandIcons: { type: Boolean, default: false },
3744
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
3745
+ // absent Boolean to `false`), so it is not forwarded to the card form.
3746
+ showCardFieldLabels: { type: Boolean, default: void 0 },
3747
+ cardFieldLabels: { type: Object, default: void 0 },
3705
3748
  cardFieldPlaceholders: {
3706
3749
  type: Object,
3707
3750
  default: void 0
@@ -4115,6 +4158,9 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
4115
4158
  avsLayout: props.avsLayout,
4116
4159
  cardFieldOrder: props.cardFieldOrder,
4117
4160
  showCardBrandIcons: props.showCardBrandIcons === true,
4161
+ // Forwarded only when set, as React does: an omitted prop sends nothing.
4162
+ ...props.showCardFieldLabels === void 0 ? {} : { showCardFieldLabels: props.showCardFieldLabels },
4163
+ ...props.cardFieldLabels === void 0 ? {} : { cardFieldLabels: props.cardFieldLabels },
4118
4164
  cardFieldPlaceholders: props.cardFieldPlaceholders,
4119
4165
  cardAutoFocus: props.cardAutoFocus,
4120
4166
  cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
package/dist/index.mjs CHANGED
@@ -217,6 +217,7 @@ async function chargeSavedPayment(options) {
217
217
  // src/split-card-form.ts
218
218
  import { PaymentAPI as PaymentAPI2, PciVaultCardCapture } from "@flopay/js/card-setup";
219
219
  import {
220
+ buildCardFieldLabelsPayload,
220
221
  buildCheckoutProcessMetadata,
221
222
  buildProcessPaymentAvsAccount,
222
223
  buyerEmailRequiredPrompt,
@@ -1215,6 +1216,10 @@ var SplitCardForm = defineComponent3({
1215
1216
  className: { type: String, default: void 0 },
1216
1217
  cardFieldOrder: { type: Array, default: void 0 },
1217
1218
  showCardBrandIcons: { type: Boolean, default: false },
1219
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
1220
+ // absent Boolean to `false`), so a form without it sends nothing.
1221
+ showCardFieldLabels: { type: Boolean, default: void 0 },
1222
+ cardFieldLabels: { type: Object, default: void 0 },
1218
1223
  cardFieldPlaceholders: {
1219
1224
  type: Object,
1220
1225
  default: void 0
@@ -1932,6 +1937,41 @@ var SplitCardForm = defineComponent3({
1932
1937
  ([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
1933
1938
  { immediate: true }
1934
1939
  );
1940
+ let showCardFieldLabelsSentTo = null;
1941
+ watch2(
1942
+ [() => capture.value, () => props.showCardFieldLabels],
1943
+ ([adapter, show]) => {
1944
+ if (!adapter) return;
1945
+ if (show === void 0) {
1946
+ if (showCardFieldLabelsSentTo !== adapter) return;
1947
+ showCardFieldLabelsSentTo = null;
1948
+ adapter.setShowCardFieldLabels?.(false);
1949
+ return;
1950
+ }
1951
+ showCardFieldLabelsSentTo = adapter;
1952
+ adapter.setShowCardFieldLabels?.(show === true);
1953
+ },
1954
+ { immediate: true }
1955
+ );
1956
+ const cardFieldLabelsKey = computed2(
1957
+ () => props.cardFieldLabels === void 0 ? void 0 : JSON.stringify(buildCardFieldLabelsPayload(props.cardFieldLabels))
1958
+ );
1959
+ let cardFieldLabelsSentTo = null;
1960
+ watch2(
1961
+ [() => capture.value, cardFieldLabelsKey],
1962
+ ([adapter, key]) => {
1963
+ if (!adapter) return;
1964
+ if (key === void 0) {
1965
+ if (cardFieldLabelsSentTo !== adapter) return;
1966
+ cardFieldLabelsSentTo = null;
1967
+ adapter.setCardFieldLabels?.(null);
1968
+ return;
1969
+ }
1970
+ cardFieldLabelsSentTo = adapter;
1971
+ adapter.setCardFieldLabels?.(JSON.parse(key));
1972
+ },
1973
+ { immediate: true }
1974
+ );
1935
1975
  let placeholdersSentTo = null;
1936
1976
  watch2(
1937
1977
  [() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
@@ -2602,6 +2642,10 @@ var FloPayCheckout = defineComponent4({
2602
2642
  avsLayout: { type: String, default: void 0 },
2603
2643
  cardFieldOrder: { type: Array, default: void 0 },
2604
2644
  showCardBrandIcons: { type: Boolean, default: false },
2645
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
2646
+ // absent Boolean to `false`), so it is not forwarded to the card form.
2647
+ showCardFieldLabels: { type: Boolean, default: void 0 },
2648
+ cardFieldLabels: { type: Object, default: void 0 },
2605
2649
  cardFieldPlaceholders: {
2606
2650
  type: Object,
2607
2651
  default: void 0
@@ -3015,6 +3059,9 @@ var FloPayCheckout = defineComponent4({
3015
3059
  avsLayout: props.avsLayout,
3016
3060
  cardFieldOrder: props.cardFieldOrder,
3017
3061
  showCardBrandIcons: props.showCardBrandIcons === true,
3062
+ // Forwarded only when set, as React does: an omitted prop sends nothing.
3063
+ ...props.showCardFieldLabels === void 0 ? {} : { showCardFieldLabels: props.showCardFieldLabels },
3064
+ ...props.cardFieldLabels === void 0 ? {} : { cardFieldLabels: props.cardFieldLabels },
3018
3065
  cardFieldPlaceholders: props.cardFieldPlaceholders,
3019
3066
  cardAutoFocus: props.cardAutoFocus,
3020
3067
  cardFieldsTimeoutMs: props.cardFieldsTimeoutMs,
@@ -1,4 +1,4 @@
1
- import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldPlaceholders, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionPatch, PaymentResult, ThemeId, TokenizedBody, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
1
+ import type { AVSFieldConfig, BeforeButtonClickEvent, ButtonsLayoutStyles, ButtonsLayoutTheme, CardFieldLabels, 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,10 @@ 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
+ /** Show the visible labels above the hosted card fields. See React. */
120
+ showCardFieldLabels?: boolean;
121
+ /** Replace the text of the labels (`number`, `expiry`, `cvv`, `name`). See React. */
122
+ cardFieldLabels?: CardFieldLabels;
119
123
  /**
120
124
  * Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
121
125
  * `name`), each optional. Only the fields given are sent; the rest keep the
@@ -367,6 +371,14 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
367
371
  type: BooleanConstructor;
368
372
  default: boolean;
369
373
  };
374
+ showCardFieldLabels: {
375
+ type: BooleanConstructor;
376
+ default: undefined;
377
+ };
378
+ cardFieldLabels: {
379
+ type: PropType<CardFieldLabels>;
380
+ default: undefined;
381
+ };
370
382
  cardFieldPlaceholders: {
371
383
  type: PropType<CardFieldPlaceholders>;
372
384
  default: undefined;
@@ -605,6 +617,14 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
605
617
  type: BooleanConstructor;
606
618
  default: boolean;
607
619
  };
620
+ showCardFieldLabels: {
621
+ type: BooleanConstructor;
622
+ default: undefined;
623
+ };
624
+ cardFieldLabels: {
625
+ type: PropType<CardFieldLabels>;
626
+ default: undefined;
627
+ };
608
628
  cardFieldPlaceholders: {
609
629
  type: PropType<CardFieldPlaceholders>;
610
630
  default: undefined;
@@ -733,6 +753,8 @@ export declare const SplitCardForm: import("vue").DefineComponent<import("vue").
733
753
  className: string;
734
754
  cardFieldOrder: VaultCardFieldKey[];
735
755
  showCardBrandIcons: boolean;
756
+ showCardFieldLabels: boolean;
757
+ cardFieldLabels: CardFieldLabels;
736
758
  cardFieldPlaceholders: CardFieldPlaceholders;
737
759
  cardAutoFocus: boolean;
738
760
  cardFieldsTimeoutMs: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/vue",
3
- "version": "1.18.1",
3
+ "version": "1.19.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.18.1",
40
- "@flopay/shared": "1.18.1",
39
+ "@flopay/js": "1.19.0",
40
+ "@flopay/shared": "1.19.0",
41
41
  "@paypal/paypal-js": "^11.3.0",
42
42
  "@stripe/stripe-js": "^10.3.0"
43
43
  },