@flopay/vue 1.18.1 → 1.19.1

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
@@ -2973,15 +2977,18 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
2973
2977
  const captureMethod = session.value?.captureMethod;
2974
2978
  const flopay = provider?.flopay.value;
2975
2979
  const cardFieldsTimeoutMs = props.cardFieldsTimeoutMs;
2980
+ const sessionToken = nonce.value;
2976
2981
  const adapter = flopay ? flopay.cardCapture({
2977
2982
  sessionId: id,
2978
2983
  ...captureMethod ? { captureMethod } : {},
2984
+ sessionToken,
2979
2985
  cardFieldsTimeoutMs
2980
2986
  }) : new import_card_setup3.PciVaultCardCapture({
2981
2987
  sessionId: id,
2982
2988
  ...captureMethod ? { captureMethod } : {},
2983
2989
  billingApiUrl: billingApiUrl.value,
2984
2990
  telemetry: props.telemetry,
2991
+ sessionToken,
2985
2992
  cardFieldsTimeoutMs
2986
2993
  });
2987
2994
  const detachAdapterOutcomes = bindOutcomes(adapter);
@@ -3032,6 +3039,41 @@ var SplitCardForm = (0, import_vue6.defineComponent)({
3032
3039
  ([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
3033
3040
  { immediate: true }
3034
3041
  );
3042
+ let showCardFieldLabelsSentTo = null;
3043
+ (0, import_vue6.watch)(
3044
+ [() => capture.value, () => props.showCardFieldLabels],
3045
+ ([adapter, show]) => {
3046
+ if (!adapter) return;
3047
+ if (show === void 0) {
3048
+ if (showCardFieldLabelsSentTo !== adapter) return;
3049
+ showCardFieldLabelsSentTo = null;
3050
+ adapter.setShowCardFieldLabels?.(false);
3051
+ return;
3052
+ }
3053
+ showCardFieldLabelsSentTo = adapter;
3054
+ adapter.setShowCardFieldLabels?.(show === true);
3055
+ },
3056
+ { immediate: true }
3057
+ );
3058
+ const cardFieldLabelsKey = (0, import_vue6.computed)(
3059
+ () => props.cardFieldLabels === void 0 ? void 0 : JSON.stringify((0, import_shared8.buildCardFieldLabelsPayload)(props.cardFieldLabels))
3060
+ );
3061
+ let cardFieldLabelsSentTo = null;
3062
+ (0, import_vue6.watch)(
3063
+ [() => capture.value, cardFieldLabelsKey],
3064
+ ([adapter, key]) => {
3065
+ if (!adapter) return;
3066
+ if (key === void 0) {
3067
+ if (cardFieldLabelsSentTo !== adapter) return;
3068
+ cardFieldLabelsSentTo = null;
3069
+ adapter.setCardFieldLabels?.(null);
3070
+ return;
3071
+ }
3072
+ cardFieldLabelsSentTo = adapter;
3073
+ adapter.setCardFieldLabels?.(JSON.parse(key));
3074
+ },
3075
+ { immediate: true }
3076
+ );
3035
3077
  let placeholdersSentTo = null;
3036
3078
  (0, import_vue6.watch)(
3037
3079
  [() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
@@ -3702,6 +3744,10 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
3702
3744
  avsLayout: { type: String, default: void 0 },
3703
3745
  cardFieldOrder: { type: Array, default: void 0 },
3704
3746
  showCardBrandIcons: { type: Boolean, default: false },
3747
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
3748
+ // absent Boolean to `false`), so it is not forwarded to the card form.
3749
+ showCardFieldLabels: { type: Boolean, default: void 0 },
3750
+ cardFieldLabels: { type: Object, default: void 0 },
3705
3751
  cardFieldPlaceholders: {
3706
3752
  type: Object,
3707
3753
  default: void 0
@@ -4115,6 +4161,9 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
4115
4161
  avsLayout: props.avsLayout,
4116
4162
  cardFieldOrder: props.cardFieldOrder,
4117
4163
  showCardBrandIcons: props.showCardBrandIcons === true,
4164
+ // Forwarded only when set, as React does: an omitted prop sends nothing.
4165
+ ...props.showCardFieldLabels === void 0 ? {} : { showCardFieldLabels: props.showCardFieldLabels },
4166
+ ...props.cardFieldLabels === void 0 ? {} : { cardFieldLabels: props.cardFieldLabels },
4118
4167
  cardFieldPlaceholders: props.cardFieldPlaceholders,
4119
4168
  cardAutoFocus: props.cardAutoFocus,
4120
4169
  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
@@ -1873,15 +1878,18 @@ var SplitCardForm = defineComponent3({
1873
1878
  const captureMethod = session.value?.captureMethod;
1874
1879
  const flopay = provider?.flopay.value;
1875
1880
  const cardFieldsTimeoutMs = props.cardFieldsTimeoutMs;
1881
+ const sessionToken = nonce.value;
1876
1882
  const adapter = flopay ? flopay.cardCapture({
1877
1883
  sessionId: id,
1878
1884
  ...captureMethod ? { captureMethod } : {},
1885
+ sessionToken,
1879
1886
  cardFieldsTimeoutMs
1880
1887
  }) : new PciVaultCardCapture({
1881
1888
  sessionId: id,
1882
1889
  ...captureMethod ? { captureMethod } : {},
1883
1890
  billingApiUrl: billingApiUrl.value,
1884
1891
  telemetry: props.telemetry,
1892
+ sessionToken,
1885
1893
  cardFieldsTimeoutMs
1886
1894
  });
1887
1895
  const detachAdapterOutcomes = bindOutcomes(adapter);
@@ -1932,6 +1940,41 @@ var SplitCardForm = defineComponent3({
1932
1940
  ([adapter, show]) => adapter?.setCardBrandIcons?.(show === true),
1933
1941
  { immediate: true }
1934
1942
  );
1943
+ let showCardFieldLabelsSentTo = null;
1944
+ watch2(
1945
+ [() => capture.value, () => props.showCardFieldLabels],
1946
+ ([adapter, show]) => {
1947
+ if (!adapter) return;
1948
+ if (show === void 0) {
1949
+ if (showCardFieldLabelsSentTo !== adapter) return;
1950
+ showCardFieldLabelsSentTo = null;
1951
+ adapter.setShowCardFieldLabels?.(false);
1952
+ return;
1953
+ }
1954
+ showCardFieldLabelsSentTo = adapter;
1955
+ adapter.setShowCardFieldLabels?.(show === true);
1956
+ },
1957
+ { immediate: true }
1958
+ );
1959
+ const cardFieldLabelsKey = computed2(
1960
+ () => props.cardFieldLabels === void 0 ? void 0 : JSON.stringify(buildCardFieldLabelsPayload(props.cardFieldLabels))
1961
+ );
1962
+ let cardFieldLabelsSentTo = null;
1963
+ watch2(
1964
+ [() => capture.value, cardFieldLabelsKey],
1965
+ ([adapter, key]) => {
1966
+ if (!adapter) return;
1967
+ if (key === void 0) {
1968
+ if (cardFieldLabelsSentTo !== adapter) return;
1969
+ cardFieldLabelsSentTo = null;
1970
+ adapter.setCardFieldLabels?.(null);
1971
+ return;
1972
+ }
1973
+ cardFieldLabelsSentTo = adapter;
1974
+ adapter.setCardFieldLabels?.(JSON.parse(key));
1975
+ },
1976
+ { immediate: true }
1977
+ );
1935
1978
  let placeholdersSentTo = null;
1936
1979
  watch2(
1937
1980
  [() => capture.value, () => cardFieldPlaceholdersContentKey(props.cardFieldPlaceholders)],
@@ -2602,6 +2645,10 @@ var FloPayCheckout = defineComponent4({
2602
2645
  avsLayout: { type: String, default: void 0 },
2603
2646
  cardFieldOrder: { type: Array, default: void 0 },
2604
2647
  showCardBrandIcons: { type: Boolean, default: false },
2648
+ // `default: undefined` keeps an omitted prop `undefined` (Vue would cast an
2649
+ // absent Boolean to `false`), so it is not forwarded to the card form.
2650
+ showCardFieldLabels: { type: Boolean, default: void 0 },
2651
+ cardFieldLabels: { type: Object, default: void 0 },
2605
2652
  cardFieldPlaceholders: {
2606
2653
  type: Object,
2607
2654
  default: void 0
@@ -3015,6 +3062,9 @@ var FloPayCheckout = defineComponent4({
3015
3062
  avsLayout: props.avsLayout,
3016
3063
  cardFieldOrder: props.cardFieldOrder,
3017
3064
  showCardBrandIcons: props.showCardBrandIcons === true,
3065
+ // Forwarded only when set, as React does: an omitted prop sends nothing.
3066
+ ...props.showCardFieldLabels === void 0 ? {} : { showCardFieldLabels: props.showCardFieldLabels },
3067
+ ...props.cardFieldLabels === void 0 ? {} : { cardFieldLabels: props.cardFieldLabels },
3018
3068
  cardFieldPlaceholders: props.cardFieldPlaceholders,
3019
3069
  cardAutoFocus: props.cardAutoFocus,
3020
3070
  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.1",
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.1",
40
+ "@flopay/shared": "1.19.1",
41
41
  "@paypal/paypal-js": "^11.3.0",
42
42
  "@stripe/stripe-js": "^10.3.0"
43
43
  },