@flopay/vue 2.1.1 → 2.2.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
@@ -91,6 +91,10 @@ const render = () =>
91
91
 
92
92
  ## Public API
93
93
 
94
+ ### Hosted card-form styling
95
+
96
+ The checkout components accept `buttonsStyles` with the existing `ButtonsLayoutStyles` type from runtime contract 2.8.0. It preserves card, input, submit-button and address-field styling through the hosted frame. Updating the prop re-styles the existing frame without remounting or reading the session again. Omitting it keeps the current overrides; `{}` clears them. The billing API and session still own country, address requirements and payment-method availability.
97
+
94
98
  Every `@flopay/react` component and hook has a same-name Vue export. React's notification callbacks are Vue events with the same payloads.
95
99
 
96
100
  | Export | React (`@flopay/react`) | Vue (`@flopay/vue`) |
@@ -1,5 +1,5 @@
1
1
  import type { CheckoutRuntimeAutomaticPayment, CheckoutRuntimeEvent } from '@flopay/js';
2
- import type { PaymentMethodLayoutRules } from '@flopay/shared';
2
+ import type { ButtonsLayoutStyles, PaymentMethodLayoutRules } from '@flopay/shared';
3
3
  import { FloPayError } from '@flopay/shared';
4
4
  import type { PropType } from 'vue';
5
5
  /** The props of {@link FloPayRuntimeCheckout}, the same as @flopay/react's component. */
@@ -14,6 +14,8 @@ export interface FloPayRuntimeCheckoutProps {
14
14
  */
15
15
  createSession?: Record<string, unknown>;
16
16
  appearance?: Record<string, unknown>;
17
+ /** Existing card/button/input/AVS appearance, relayed to the secure frame (2.8.0). */
18
+ buttonsStyles?: ButtonsLayoutStyles;
17
19
  /** Merchant wording overrides, applied by the runtime over the strings the API returns. */
18
20
  strings?: Record<string, string>;
19
21
  /** Merchant language override; only the API chooses the resolved language. */
@@ -74,6 +76,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
74
76
  type: PropType<Record<string, unknown>>;
75
77
  default: undefined;
76
78
  };
79
+ buttonsStyles: {
80
+ type: PropType<ButtonsLayoutStyles>;
81
+ default: undefined;
82
+ };
77
83
  strings: {
78
84
  type: PropType<Record<string, string>>;
79
85
  default: undefined;
@@ -132,6 +138,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
132
138
  type: PropType<Record<string, unknown>>;
133
139
  default: undefined;
134
140
  };
141
+ buttonsStyles: {
142
+ type: PropType<ButtonsLayoutStyles>;
143
+ default: undefined;
144
+ };
135
145
  strings: {
136
146
  type: PropType<Record<string, string>>;
137
147
  default: undefined;
@@ -172,6 +182,7 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
172
182
  nonce: string;
173
183
  createSession: Record<string, unknown>;
174
184
  appearance: Record<string, unknown>;
185
+ buttonsStyles: ButtonsLayoutStyles;
175
186
  strings: Record<string, string>;
176
187
  locale: string;
177
188
  paymentMethodLayout: PaymentMethodLayoutRules;
@@ -1,5 +1,5 @@
1
1
  import type { CheckoutRuntimeAutomaticPayment, CheckoutRuntimeEvent } from '@flopay/js';
2
- import type { FloPayError, PaymentMethodLayoutRules } from '@flopay/shared';
2
+ import type { ButtonsLayoutStyles, FloPayError, PaymentMethodLayoutRules } from '@flopay/shared';
3
3
  import type { PropType } from 'vue';
4
4
  import type { FloPayRuntimeCardSetupProps } from './flopay-runtime-card-setup.js';
5
5
  import type { FloPayRuntimeCheckoutProps as RuntimeCheckoutCoreProps } from './flopay-runtime-checkout.js';
@@ -66,6 +66,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
66
66
  type: PropType<Record<string, unknown>>;
67
67
  default: undefined;
68
68
  };
69
+ buttonsStyles: {
70
+ type: PropType<ButtonsLayoutStyles>;
71
+ default: undefined;
72
+ };
69
73
  strings: {
70
74
  type: PropType<Record<string, string>>;
71
75
  default: undefined;
@@ -180,6 +184,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
180
184
  type: PropType<Record<string, unknown>>;
181
185
  default: undefined;
182
186
  };
187
+ buttonsStyles: {
188
+ type: PropType<ButtonsLayoutStyles>;
189
+ default: undefined;
190
+ };
183
191
  strings: {
184
192
  type: PropType<Record<string, string>>;
185
193
  default: undefined;
@@ -274,6 +282,7 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
274
282
  nonce: string;
275
283
  createSession: Record<string, unknown>;
276
284
  appearance: Record<string, unknown>;
285
+ buttonsStyles: ButtonsLayoutStyles;
277
286
  strings: Record<string, string>;
278
287
  locale: string;
279
288
  paymentMethodLayout: PaymentMethodLayoutRules;
@@ -323,7 +332,7 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
323
332
  readonly default: undefined;
324
333
  };
325
334
  readonly buttonsStyles: {
326
- readonly type: PropType<import("@flopay/shared").ButtonsLayoutStyles>;
335
+ readonly type: PropType<ButtonsLayoutStyles>;
327
336
  readonly default: undefined;
328
337
  };
329
338
  readonly containerStyle: {
@@ -373,7 +382,7 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
373
382
  readonly default: undefined;
374
383
  };
375
384
  readonly buttonsStyles: {
376
- readonly type: PropType<import("@flopay/shared").ButtonsLayoutStyles>;
385
+ readonly type: PropType<ButtonsLayoutStyles>;
377
386
  readonly default: undefined;
378
387
  };
379
388
  readonly containerStyle: {
@@ -403,7 +412,7 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
403
412
  readonly locale: string;
404
413
  readonly theme: import("@flopay/shared").VaultCardThemeColors | import("@flopay/shared").ThemeId;
405
414
  readonly appearance: import("@flopay/shared").FloPayAppearance;
406
- readonly buttonsStyles: import("@flopay/shared").ButtonsLayoutStyles;
415
+ readonly buttonsStyles: ButtonsLayoutStyles;
407
416
  readonly containerStyle: Record<string, string | number>;
408
417
  readonly strings: Record<string, string>;
409
418
  readonly runtimeTimeoutMs: number;
@@ -431,7 +440,7 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
431
440
  readonly default: undefined;
432
441
  };
433
442
  readonly buttonsStyles: {
434
- readonly type: PropType<import("@flopay/shared").ButtonsLayoutStyles>;
443
+ readonly type: PropType<ButtonsLayoutStyles>;
435
444
  readonly default: undefined;
436
445
  };
437
446
  readonly containerStyle: {
@@ -481,7 +490,7 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
481
490
  readonly default: undefined;
482
491
  };
483
492
  readonly buttonsStyles: {
484
- readonly type: PropType<import("@flopay/shared").ButtonsLayoutStyles>;
493
+ readonly type: PropType<ButtonsLayoutStyles>;
485
494
  readonly default: undefined;
486
495
  };
487
496
  readonly containerStyle: {
@@ -511,7 +520,7 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
511
520
  readonly locale: string;
512
521
  readonly theme: import("@flopay/shared").VaultCardThemeColors | import("@flopay/shared").ThemeId;
513
522
  readonly appearance: import("@flopay/shared").FloPayAppearance;
514
- readonly buttonsStyles: import("@flopay/shared").ButtonsLayoutStyles;
523
+ readonly buttonsStyles: ButtonsLayoutStyles;
515
524
  readonly containerStyle: Record<string, string | number>;
516
525
  readonly strings: Record<string, string>;
517
526
  readonly runtimeTimeoutMs: number;
package/dist/index.cjs CHANGED
@@ -286,7 +286,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
286
286
  "setup",
287
287
  "hiddenPaymentMethods"
288
288
  ]);
289
- function declaredContractVersion(savedPayment, extra, locale) {
289
+ function declaredContractVersion(savedPayment, extra, locale, buttonsStyles) {
290
+ if (buttonsStyles !== void 0) return "2.8.0";
290
291
  if (locale !== void 0) return "2.7.0";
291
292
  if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
292
293
  return PRESENTATION_CONTRACT_VERSION;
@@ -315,6 +316,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
315
316
  nonce: { type: String, default: void 0 },
316
317
  createSession: { type: Object, default: void 0 },
317
318
  appearance: { type: Object, default: void 0 },
319
+ buttonsStyles: { type: Object, default: void 0 },
318
320
  strings: { type: Object, default: void 0 },
319
321
  locale: { type: String, default: void 0 },
320
322
  paymentMethodLayout: {
@@ -338,6 +340,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
338
340
  const container = (0, import_vue3.ref)(null);
339
341
  let handle = null;
340
342
  let mountedLayoutRules;
343
+ let mountedStyles;
341
344
  let run = 0;
342
345
  const stop = () => {
343
346
  run += 1;
@@ -351,11 +354,17 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
351
354
  (runtime) => {
352
355
  if (current !== run || !container.value) return;
353
356
  mountedLayoutRules = rulesKey(props.paymentMethodLayout);
357
+ mountedStyles = props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles);
354
358
  const mode = props.automaticPayment?.mode;
355
359
  const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
356
360
  handle = runtime.mount(container.value, {
357
361
  ...extra,
358
- contractVersion: declaredContractVersion(Boolean(mode), extra, props.locale),
362
+ contractVersion: declaredContractVersion(
363
+ Boolean(mode),
364
+ extra,
365
+ props.locale,
366
+ props.buttonsStyles
367
+ ),
359
368
  ...mode ? {
360
369
  automaticPayment: savedPaymentSetting(
361
370
  mode,
@@ -367,6 +376,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
367
376
  nonce: props.nonce,
368
377
  createSession: props.createSession,
369
378
  appearance: props.appearance,
379
+ buttonsStyles: props.buttonsStyles,
370
380
  strings: props.strings,
371
381
  locale: props.locale,
372
382
  paymentMethodLayout: rulesFromKey(mountedLayoutRules),
@@ -404,6 +414,14 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
404
414
  if (appearance !== void 0) handle?.update({ appearance });
405
415
  }
406
416
  );
417
+ (0, import_vue3.watch)(
418
+ () => props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles),
419
+ (key) => {
420
+ if (key === void 0 || key === mountedStyles || !handle) return;
421
+ mountedStyles = key;
422
+ handle.update({ buttonsStyles: props.buttonsStyles });
423
+ }
424
+ );
407
425
  (0, import_vue3.watch)(
408
426
  () => props.strings,
409
427
  (strings) => {
@@ -444,6 +462,7 @@ var PRESENTATION_PROPS = [
444
462
  "initialPayPalOrderId"
445
463
  ];
446
464
  var CORE_PROPS = [
465
+ "buttonsStyles",
447
466
  "sessionId",
448
467
  "nonce",
449
468
  "createSession",
@@ -492,6 +511,7 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
492
511
  nonce: { type: String, default: void 0 },
493
512
  createSession: { type: Object, default: void 0 },
494
513
  appearance: { type: Object, default: void 0 },
514
+ buttonsStyles: { type: Object, default: void 0 },
495
515
  strings: { type: Object, default: void 0 },
496
516
  locale: { type: String, default: void 0 },
497
517
  paymentMethodLayout: { type: Object, default: void 0 },
package/dist/index.mjs CHANGED
@@ -41,7 +41,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
41
41
  "setup",
42
42
  "hiddenPaymentMethods"
43
43
  ]);
44
- function declaredContractVersion(savedPayment, extra, locale) {
44
+ function declaredContractVersion(savedPayment, extra, locale, buttonsStyles) {
45
+ if (buttonsStyles !== void 0) return "2.8.0";
45
46
  if (locale !== void 0) return "2.7.0";
46
47
  if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
47
48
  return PRESENTATION_CONTRACT_VERSION;
@@ -70,6 +71,7 @@ var FloPayRuntimeCheckout = defineComponent({
70
71
  nonce: { type: String, default: void 0 },
71
72
  createSession: { type: Object, default: void 0 },
72
73
  appearance: { type: Object, default: void 0 },
74
+ buttonsStyles: { type: Object, default: void 0 },
73
75
  strings: { type: Object, default: void 0 },
74
76
  locale: { type: String, default: void 0 },
75
77
  paymentMethodLayout: {
@@ -93,6 +95,7 @@ var FloPayRuntimeCheckout = defineComponent({
93
95
  const container = ref(null);
94
96
  let handle = null;
95
97
  let mountedLayoutRules;
98
+ let mountedStyles;
96
99
  let run = 0;
97
100
  const stop = () => {
98
101
  run += 1;
@@ -106,11 +109,17 @@ var FloPayRuntimeCheckout = defineComponent({
106
109
  (runtime) => {
107
110
  if (current !== run || !container.value) return;
108
111
  mountedLayoutRules = rulesKey(props.paymentMethodLayout);
112
+ mountedStyles = props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles);
109
113
  const mode = props.automaticPayment?.mode;
110
114
  const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
111
115
  handle = runtime.mount(container.value, {
112
116
  ...extra,
113
- contractVersion: declaredContractVersion(Boolean(mode), extra, props.locale),
117
+ contractVersion: declaredContractVersion(
118
+ Boolean(mode),
119
+ extra,
120
+ props.locale,
121
+ props.buttonsStyles
122
+ ),
114
123
  ...mode ? {
115
124
  automaticPayment: savedPaymentSetting(
116
125
  mode,
@@ -122,6 +131,7 @@ var FloPayRuntimeCheckout = defineComponent({
122
131
  nonce: props.nonce,
123
132
  createSession: props.createSession,
124
133
  appearance: props.appearance,
134
+ buttonsStyles: props.buttonsStyles,
125
135
  strings: props.strings,
126
136
  locale: props.locale,
127
137
  paymentMethodLayout: rulesFromKey(mountedLayoutRules),
@@ -159,6 +169,14 @@ var FloPayRuntimeCheckout = defineComponent({
159
169
  if (appearance !== void 0) handle?.update({ appearance });
160
170
  }
161
171
  );
172
+ watch(
173
+ () => props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles),
174
+ (key) => {
175
+ if (key === void 0 || key === mountedStyles || !handle) return;
176
+ mountedStyles = key;
177
+ handle.update({ buttonsStyles: props.buttonsStyles });
178
+ }
179
+ );
162
180
  watch(
163
181
  () => props.strings,
164
182
  (strings) => {
@@ -199,6 +217,7 @@ var PRESENTATION_PROPS = [
199
217
  "initialPayPalOrderId"
200
218
  ];
201
219
  var CORE_PROPS = [
220
+ "buttonsStyles",
202
221
  "sessionId",
203
222
  "nonce",
204
223
  "createSession",
@@ -247,6 +266,7 @@ var FloPayCheckout = defineComponent2({
247
266
  nonce: { type: String, default: void 0 },
248
267
  createSession: { type: Object, default: void 0 },
249
268
  appearance: { type: Object, default: void 0 },
269
+ buttonsStyles: { type: Object, default: void 0 },
250
270
  strings: { type: Object, default: void 0 },
251
271
  locale: { type: String, default: void 0 },
252
272
  paymentMethodLayout: { type: Object, default: void 0 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/vue",
3
- "version": "2.1.1",
3
+ "version": "2.2.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": "2.1.1",
40
- "@flopay/shared": "2.1.1"
39
+ "@flopay/js": "2.2.0",
40
+ "@flopay/shared": "2.2.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "vue": ">=3.3.0"