@flopay/vue 2.2.15 → 2.3.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 +4 -0
- package/dist/flopay-runtime-checkout.d.ts +14 -0
- package/dist/hosted-runtime-components.d.ts +99 -1
- package/dist/index.cjs +60 -6
- package/dist/index.mjs +61 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -99,6 +99,10 @@ The checkout components accept `buttonsStyles` with the existing `ButtonsLayoutS
|
|
|
99
99
|
|
|
100
100
|
The checkout components accept an optional `country` (ISO 3166-1 alpha-2, any case) from runtime contract 2.9.0, as the 1.x `country` prop. A payment method whose session descriptor lists `countries` (Afterpay, Cash App Pay and so on) is offered only when the buyer's country is in that list. The country the buyer picks in the AVS form wins, then this prop, then the session's `accountData.country`; with none of them every method is offered, because the checkout never looks a country up. Changing the prop updates the mounted checkout without remounting.
|
|
101
101
|
|
|
102
|
+
### Card form options
|
|
103
|
+
|
|
104
|
+
The checkout components accept the 1.x card form props from runtime contract 2.10.0: `enableAVS`, `avsLayout` and `cardFieldOrder` for the billing address fields and the order of the card fields, the buttons layout's `cardButtonContent`, `cardBackButtonContent` and `cardTitleContent` as text or markup (the Flo-hosted card frame keeps only text, layout and image markup; an empty string hides that label), `moreOptionsLabel` and `submitLabel` over `strings.morePaymentOptions` and `strings.payButton`, and `onButtonClick` (or `@button-click`), called with the name of the payment method the buyer chose.
|
|
105
|
+
|
|
102
106
|
Every `@flopay/react` component and hook has a same-name Vue export. React's notification callbacks are Vue events with the same payloads.
|
|
103
107
|
|
|
104
108
|
| Export | React (`@flopay/react`) | Vue (`@flopay/vue`) |
|
|
@@ -51,6 +51,11 @@ export interface FloPayRuntimeCheckoutProps {
|
|
|
51
51
|
runtimeTimeoutMs?: number;
|
|
52
52
|
/** Further mount options, passed to the runtime as given (by value). A change mounts again. */
|
|
53
53
|
extraMountOptions?: Record<string, unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* `true` declares contract 2.10.0, so the runtime relays `buttonClick` (the buyer chose a payment
|
|
56
|
+
* method) as an `event` emit. A change mounts again.
|
|
57
|
+
*/
|
|
58
|
+
buttonClicks?: boolean;
|
|
54
59
|
}
|
|
55
60
|
/** The checkout layouts a merchant chooses from, as in 1.x. */
|
|
56
61
|
type CheckoutLayout = 'default' | 'buttons';
|
|
@@ -123,6 +128,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
123
128
|
type: PropType<Record<string, unknown>>;
|
|
124
129
|
default: undefined;
|
|
125
130
|
};
|
|
131
|
+
buttonClicks: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
126
135
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
127
136
|
[key: string]: any;
|
|
128
137
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -189,6 +198,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
189
198
|
type: PropType<Record<string, unknown>>;
|
|
190
199
|
default: undefined;
|
|
191
200
|
};
|
|
201
|
+
buttonClicks: {
|
|
202
|
+
type: BooleanConstructor;
|
|
203
|
+
default: undefined;
|
|
204
|
+
};
|
|
192
205
|
}>> & Readonly<{
|
|
193
206
|
onError?: ((_error: FloPayError) => any) | undefined;
|
|
194
207
|
onEvent?: ((_event: CheckoutRuntimeEvent) => any) | undefined;
|
|
@@ -206,5 +219,6 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
206
219
|
automaticPayment: CheckoutRuntimeAutomaticPayment;
|
|
207
220
|
runtimeTimeoutMs: number;
|
|
208
221
|
extraMountOptions: Record<string, unknown>;
|
|
222
|
+
buttonClicks: boolean;
|
|
209
223
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
210
224
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CheckoutRuntimeAutomaticPayment, CheckoutRuntimeEvent } from '@flopay/js';
|
|
2
|
-
import type { ButtonsLayoutStyles, FloPayError, PaymentMethodLayoutRules } from '@flopay/shared';
|
|
2
|
+
import type { AVSFieldConfig, ButtonsLayoutStyles, FloPayError, PaymentMethodLayoutRules, VaultCardFieldKey } 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';
|
|
@@ -19,6 +19,21 @@ export interface FloPayCheckoutProps extends Omit<RuntimeCheckoutCoreProps, 'pub
|
|
|
19
19
|
cardFieldPlaceholders?: Record<string, string>;
|
|
20
20
|
enabledPaymentMethods?: string[];
|
|
21
21
|
initialPayPalOrderId?: string;
|
|
22
|
+
/** The billing address fields the card form collects, as in 1.x (contract 2.10.0). */
|
|
23
|
+
enableAVS?: boolean | AVSFieldConfig;
|
|
24
|
+
avsLayout?: 'row' | 'column';
|
|
25
|
+
cardFieldOrder?: VaultCardFieldKey[];
|
|
26
|
+
/**
|
|
27
|
+
* The buttons layout's content slots, as text or markup: the Flo frame keeps only text, layout
|
|
28
|
+
* and image markup. An empty string hides that label. Each wins over the matching `strings` key.
|
|
29
|
+
*/
|
|
30
|
+
cardButtonContent?: string;
|
|
31
|
+
cardBackButtonContent?: string;
|
|
32
|
+
cardTitleContent?: string;
|
|
33
|
+
/** The "More payment options" link's label; wins over `strings.morePaymentOptions`. */
|
|
34
|
+
moreOptionsLabel?: string;
|
|
35
|
+
/** The pay button's label; wins over `strings.payButton`. */
|
|
36
|
+
submitLabel?: string;
|
|
22
37
|
}
|
|
23
38
|
export type FloPayRuntimeCheckoutProps = FloPayCheckoutProps;
|
|
24
39
|
export type SplitCardFormProps = FloPayCheckoutProps;
|
|
@@ -135,6 +150,43 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
135
150
|
type: StringConstructor;
|
|
136
151
|
default: undefined;
|
|
137
152
|
};
|
|
153
|
+
enableAVS: {
|
|
154
|
+
type: PropType<boolean | AVSFieldConfig>;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
157
|
+
avsLayout: {
|
|
158
|
+
type: PropType<'row' | 'column'>;
|
|
159
|
+
default: undefined;
|
|
160
|
+
};
|
|
161
|
+
cardFieldOrder: {
|
|
162
|
+
type: PropType<VaultCardFieldKey[]>;
|
|
163
|
+
default: undefined;
|
|
164
|
+
};
|
|
165
|
+
cardButtonContent: {
|
|
166
|
+
type: StringConstructor;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
cardBackButtonContent: {
|
|
170
|
+
type: StringConstructor;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
cardTitleContent: {
|
|
174
|
+
type: StringConstructor;
|
|
175
|
+
default: undefined;
|
|
176
|
+
};
|
|
177
|
+
moreOptionsLabel: {
|
|
178
|
+
type: StringConstructor;
|
|
179
|
+
default: undefined;
|
|
180
|
+
};
|
|
181
|
+
submitLabel: {
|
|
182
|
+
type: StringConstructor;
|
|
183
|
+
default: undefined;
|
|
184
|
+
};
|
|
185
|
+
/** The buyer chose a payment method, by its name (`card`, `apple_pay`, `paypal`, ...). */
|
|
186
|
+
onButtonClick: {
|
|
187
|
+
type: PropType<(method: string) => void>;
|
|
188
|
+
default: undefined;
|
|
189
|
+
};
|
|
138
190
|
onComplete: {
|
|
139
191
|
type: PropType<MerchantListener>;
|
|
140
192
|
default: undefined;
|
|
@@ -258,6 +310,43 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
258
310
|
type: StringConstructor;
|
|
259
311
|
default: undefined;
|
|
260
312
|
};
|
|
313
|
+
enableAVS: {
|
|
314
|
+
type: PropType<boolean | AVSFieldConfig>;
|
|
315
|
+
default: undefined;
|
|
316
|
+
};
|
|
317
|
+
avsLayout: {
|
|
318
|
+
type: PropType<'row' | 'column'>;
|
|
319
|
+
default: undefined;
|
|
320
|
+
};
|
|
321
|
+
cardFieldOrder: {
|
|
322
|
+
type: PropType<VaultCardFieldKey[]>;
|
|
323
|
+
default: undefined;
|
|
324
|
+
};
|
|
325
|
+
cardButtonContent: {
|
|
326
|
+
type: StringConstructor;
|
|
327
|
+
default: undefined;
|
|
328
|
+
};
|
|
329
|
+
cardBackButtonContent: {
|
|
330
|
+
type: StringConstructor;
|
|
331
|
+
default: undefined;
|
|
332
|
+
};
|
|
333
|
+
cardTitleContent: {
|
|
334
|
+
type: StringConstructor;
|
|
335
|
+
default: undefined;
|
|
336
|
+
};
|
|
337
|
+
moreOptionsLabel: {
|
|
338
|
+
type: StringConstructor;
|
|
339
|
+
default: undefined;
|
|
340
|
+
};
|
|
341
|
+
submitLabel: {
|
|
342
|
+
type: StringConstructor;
|
|
343
|
+
default: undefined;
|
|
344
|
+
};
|
|
345
|
+
/** The buyer chose a payment method, by its name (`card`, `apple_pay`, `paypal`, ...). */
|
|
346
|
+
onButtonClick: {
|
|
347
|
+
type: PropType<(method: string) => void>;
|
|
348
|
+
default: undefined;
|
|
349
|
+
};
|
|
261
350
|
onComplete: {
|
|
262
351
|
type: PropType<MerchantListener>;
|
|
263
352
|
default: undefined;
|
|
@@ -309,6 +398,15 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
309
398
|
cardFieldPlaceholders: Record<string, string>;
|
|
310
399
|
enabledPaymentMethods: string[];
|
|
311
400
|
initialPayPalOrderId: string;
|
|
401
|
+
enableAVS: boolean | AVSFieldConfig;
|
|
402
|
+
avsLayout: "column" | "row";
|
|
403
|
+
cardFieldOrder: VaultCardFieldKey[];
|
|
404
|
+
cardButtonContent: string;
|
|
405
|
+
cardBackButtonContent: string;
|
|
406
|
+
cardTitleContent: string;
|
|
407
|
+
moreOptionsLabel: string;
|
|
408
|
+
submitLabel: string;
|
|
409
|
+
onButtonClick: (method: string) => void;
|
|
312
410
|
onComplete: MerchantListener;
|
|
313
411
|
onDecline: MerchantListener;
|
|
314
412
|
onCancel: MerchantListener;
|
package/dist/index.cjs
CHANGED
|
@@ -271,6 +271,15 @@ var RUNTIME_CONTRACT_VERSION = "2.2.0";
|
|
|
271
271
|
var SAVED_PAYMENT_CONTRACT_VERSION = "2.3.0";
|
|
272
272
|
var HIDDEN_PAYMENT_METHODS_CONTRACT_VERSION = "2.5.0";
|
|
273
273
|
var PRESENTATION_CONTRACT_VERSION = "2.6.0";
|
|
274
|
+
var CARD_FORM_OPTIONS_CONTRACT_VERSION = "2.10.0";
|
|
275
|
+
var CARD_FORM_OPTIONS = /* @__PURE__ */ new Set([
|
|
276
|
+
"enableAVS",
|
|
277
|
+
"avsLayout",
|
|
278
|
+
"cardFieldOrder",
|
|
279
|
+
"cardButtonContent",
|
|
280
|
+
"cardBackButtonContent",
|
|
281
|
+
"cardTitleContent"
|
|
282
|
+
]);
|
|
274
283
|
var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
275
284
|
"publishableKey",
|
|
276
285
|
"sessionId",
|
|
@@ -286,7 +295,10 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
|
286
295
|
"setup",
|
|
287
296
|
"hiddenPaymentMethods"
|
|
288
297
|
]);
|
|
289
|
-
function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country) {
|
|
298
|
+
function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country, buttonClicks) {
|
|
299
|
+
if (buttonClicks || extra !== void 0 && Object.keys(extra).some((name) => CARD_FORM_OPTIONS.has(name))) {
|
|
300
|
+
return CARD_FORM_OPTIONS_CONTRACT_VERSION;
|
|
301
|
+
}
|
|
290
302
|
if (country !== void 0) return "2.9.0";
|
|
291
303
|
if (buttonsStyles !== void 0) return "2.8.0";
|
|
292
304
|
if (locale !== void 0) return "2.7.0";
|
|
@@ -332,7 +344,8 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
332
344
|
},
|
|
333
345
|
runtimeUrl: { type: String, required: true },
|
|
334
346
|
runtimeTimeoutMs: { type: Number, default: void 0 },
|
|
335
|
-
extraMountOptions: { type: Object, default: void 0 }
|
|
347
|
+
extraMountOptions: { type: Object, default: void 0 },
|
|
348
|
+
buttonClicks: { type: Boolean, default: void 0 }
|
|
336
349
|
},
|
|
337
350
|
emits: {
|
|
338
351
|
event: (_event) => true,
|
|
@@ -368,7 +381,8 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
368
381
|
extra,
|
|
369
382
|
props.locale,
|
|
370
383
|
props.buttonsStyles,
|
|
371
|
-
props.country
|
|
384
|
+
props.country,
|
|
385
|
+
props.buttonClicks
|
|
372
386
|
),
|
|
373
387
|
...mode ? {
|
|
374
388
|
automaticPayment: savedPaymentSetting(
|
|
@@ -410,7 +424,8 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
410
424
|
() => props.layout,
|
|
411
425
|
// By value: an equal saved-payment setting in a new object does not mount again.
|
|
412
426
|
() => props.automaticPayment?.mode,
|
|
413
|
-
() => props.automaticPayment?.getSession !== void 0
|
|
427
|
+
() => props.automaticPayment?.getSession !== void 0,
|
|
428
|
+
() => props.buttonClicks
|
|
414
429
|
],
|
|
415
430
|
() => start()
|
|
416
431
|
);
|
|
@@ -473,7 +488,15 @@ var PRESENTATION_PROPS = [
|
|
|
473
488
|
"cardFieldLabels",
|
|
474
489
|
"cardFieldPlaceholders",
|
|
475
490
|
"enabledPaymentMethods",
|
|
476
|
-
"initialPayPalOrderId"
|
|
491
|
+
"initialPayPalOrderId",
|
|
492
|
+
// 2.10.0: the card form's AVS fields, their layout, the card field order and the buttons
|
|
493
|
+
// layout's content slots (text or markup, which the Flo frame sanitises).
|
|
494
|
+
"enableAVS",
|
|
495
|
+
"avsLayout",
|
|
496
|
+
"cardFieldOrder",
|
|
497
|
+
"cardButtonContent",
|
|
498
|
+
"cardBackButtonContent",
|
|
499
|
+
"cardTitleContent"
|
|
477
500
|
];
|
|
478
501
|
var CORE_PROPS = [
|
|
479
502
|
"buttonsStyles",
|
|
@@ -481,7 +504,6 @@ var CORE_PROPS = [
|
|
|
481
504
|
"nonce",
|
|
482
505
|
"createSession",
|
|
483
506
|
"appearance",
|
|
484
|
-
"strings",
|
|
485
507
|
"locale",
|
|
486
508
|
"country",
|
|
487
509
|
"paymentMethodLayout",
|
|
@@ -550,6 +572,20 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
|
|
|
550
572
|
cardFieldPlaceholders: { type: Object, default: void 0 },
|
|
551
573
|
enabledPaymentMethods: { type: Array, default: void 0 },
|
|
552
574
|
initialPayPalOrderId: { type: String, default: void 0 },
|
|
575
|
+
// 2.10.0: the 1.x card form options and labels.
|
|
576
|
+
enableAVS: {
|
|
577
|
+
type: [Boolean, Object],
|
|
578
|
+
default: void 0
|
|
579
|
+
},
|
|
580
|
+
avsLayout: { type: String, default: void 0 },
|
|
581
|
+
cardFieldOrder: { type: Array, default: void 0 },
|
|
582
|
+
cardButtonContent: { type: String, default: void 0 },
|
|
583
|
+
cardBackButtonContent: { type: String, default: void 0 },
|
|
584
|
+
cardTitleContent: { type: String, default: void 0 },
|
|
585
|
+
moreOptionsLabel: { type: String, default: void 0 },
|
|
586
|
+
submitLabel: { type: String, default: void 0 },
|
|
587
|
+
/** The buyer chose a payment method, by its name (`card`, `apple_pay`, `paypal`, ...). */
|
|
588
|
+
onButtonClick: { type: Function, default: void 0 },
|
|
553
589
|
// The 1.x listeners, as props so a throwing one never blocks the others.
|
|
554
590
|
onComplete: listener,
|
|
555
591
|
onDecline: listener,
|
|
@@ -564,8 +600,24 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
|
|
|
564
600
|
},
|
|
565
601
|
setup(props, { emit }) {
|
|
566
602
|
const provided = (0, import_vue4.inject)(FLOPAY_RUNTIME_CONTEXT, {});
|
|
603
|
+
const strings = (0, import_vue4.computed)(() => {
|
|
604
|
+
if (props.moreOptionsLabel === void 0 && props.submitLabel === void 0) {
|
|
605
|
+
return props.strings;
|
|
606
|
+
}
|
|
607
|
+
return {
|
|
608
|
+
...props.strings,
|
|
609
|
+
...props.moreOptionsLabel === void 0 ? {} : { morePaymentOptions: props.moreOptionsLabel },
|
|
610
|
+
...props.submitLabel === void 0 ? {} : { payButton: props.submitLabel }
|
|
611
|
+
};
|
|
612
|
+
});
|
|
567
613
|
const onEvent = (event) => {
|
|
568
614
|
isolated(() => emit("event", event));
|
|
615
|
+
if (event.name === "buttonClick") {
|
|
616
|
+
const method = event.payload?.method;
|
|
617
|
+
const onButtonClick = props.onButtonClick;
|
|
618
|
+
if (onButtonClick && typeof method === "string") isolated(() => onButtonClick(method));
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
569
621
|
if (event.name === "error") {
|
|
570
622
|
isolated(() => emit("error", event.payload));
|
|
571
623
|
return;
|
|
@@ -581,7 +633,9 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
|
|
|
581
633
|
...core,
|
|
582
634
|
publishableKey: props.publishableKey ?? provided.publishableKey ?? "",
|
|
583
635
|
runtimeUrl: props.runtimeUrl ?? provided.runtimeUrl ?? "",
|
|
636
|
+
...strings.value === void 0 ? {} : { strings: strings.value },
|
|
584
637
|
extraMountOptions: passThrough(props),
|
|
638
|
+
buttonClicks: props.onButtonClick !== void 0,
|
|
585
639
|
onEvent,
|
|
586
640
|
onError: (error) => emit("error", error)
|
|
587
641
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { dropThirdPartyOnlyError } from "@flopay/shared";
|
|
10
10
|
|
|
11
11
|
// src/hosted-runtime-components.ts
|
|
12
|
-
import { defineComponent as defineComponent2, h as h2, inject, provide } from "vue";
|
|
12
|
+
import { computed, defineComponent as defineComponent2, h as h2, inject, provide } from "vue";
|
|
13
13
|
|
|
14
14
|
// src/flopay-runtime-checkout.ts
|
|
15
15
|
import { loadCheckoutRuntime } from "@flopay/js";
|
|
@@ -26,6 +26,15 @@ var RUNTIME_CONTRACT_VERSION = "2.2.0";
|
|
|
26
26
|
var SAVED_PAYMENT_CONTRACT_VERSION = "2.3.0";
|
|
27
27
|
var HIDDEN_PAYMENT_METHODS_CONTRACT_VERSION = "2.5.0";
|
|
28
28
|
var PRESENTATION_CONTRACT_VERSION = "2.6.0";
|
|
29
|
+
var CARD_FORM_OPTIONS_CONTRACT_VERSION = "2.10.0";
|
|
30
|
+
var CARD_FORM_OPTIONS = /* @__PURE__ */ new Set([
|
|
31
|
+
"enableAVS",
|
|
32
|
+
"avsLayout",
|
|
33
|
+
"cardFieldOrder",
|
|
34
|
+
"cardButtonContent",
|
|
35
|
+
"cardBackButtonContent",
|
|
36
|
+
"cardTitleContent"
|
|
37
|
+
]);
|
|
29
38
|
var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
30
39
|
"publishableKey",
|
|
31
40
|
"sessionId",
|
|
@@ -41,7 +50,10 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
|
41
50
|
"setup",
|
|
42
51
|
"hiddenPaymentMethods"
|
|
43
52
|
]);
|
|
44
|
-
function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country) {
|
|
53
|
+
function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country, buttonClicks) {
|
|
54
|
+
if (buttonClicks || extra !== void 0 && Object.keys(extra).some((name) => CARD_FORM_OPTIONS.has(name))) {
|
|
55
|
+
return CARD_FORM_OPTIONS_CONTRACT_VERSION;
|
|
56
|
+
}
|
|
45
57
|
if (country !== void 0) return "2.9.0";
|
|
46
58
|
if (buttonsStyles !== void 0) return "2.8.0";
|
|
47
59
|
if (locale !== void 0) return "2.7.0";
|
|
@@ -87,7 +99,8 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
87
99
|
},
|
|
88
100
|
runtimeUrl: { type: String, required: true },
|
|
89
101
|
runtimeTimeoutMs: { type: Number, default: void 0 },
|
|
90
|
-
extraMountOptions: { type: Object, default: void 0 }
|
|
102
|
+
extraMountOptions: { type: Object, default: void 0 },
|
|
103
|
+
buttonClicks: { type: Boolean, default: void 0 }
|
|
91
104
|
},
|
|
92
105
|
emits: {
|
|
93
106
|
event: (_event) => true,
|
|
@@ -123,7 +136,8 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
123
136
|
extra,
|
|
124
137
|
props.locale,
|
|
125
138
|
props.buttonsStyles,
|
|
126
|
-
props.country
|
|
139
|
+
props.country,
|
|
140
|
+
props.buttonClicks
|
|
127
141
|
),
|
|
128
142
|
...mode ? {
|
|
129
143
|
automaticPayment: savedPaymentSetting(
|
|
@@ -165,7 +179,8 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
165
179
|
() => props.layout,
|
|
166
180
|
// By value: an equal saved-payment setting in a new object does not mount again.
|
|
167
181
|
() => props.automaticPayment?.mode,
|
|
168
|
-
() => props.automaticPayment?.getSession !== void 0
|
|
182
|
+
() => props.automaticPayment?.getSession !== void 0,
|
|
183
|
+
() => props.buttonClicks
|
|
169
184
|
],
|
|
170
185
|
() => start()
|
|
171
186
|
);
|
|
@@ -228,7 +243,15 @@ var PRESENTATION_PROPS = [
|
|
|
228
243
|
"cardFieldLabels",
|
|
229
244
|
"cardFieldPlaceholders",
|
|
230
245
|
"enabledPaymentMethods",
|
|
231
|
-
"initialPayPalOrderId"
|
|
246
|
+
"initialPayPalOrderId",
|
|
247
|
+
// 2.10.0: the card form's AVS fields, their layout, the card field order and the buttons
|
|
248
|
+
// layout's content slots (text or markup, which the Flo frame sanitises).
|
|
249
|
+
"enableAVS",
|
|
250
|
+
"avsLayout",
|
|
251
|
+
"cardFieldOrder",
|
|
252
|
+
"cardButtonContent",
|
|
253
|
+
"cardBackButtonContent",
|
|
254
|
+
"cardTitleContent"
|
|
232
255
|
];
|
|
233
256
|
var CORE_PROPS = [
|
|
234
257
|
"buttonsStyles",
|
|
@@ -236,7 +259,6 @@ var CORE_PROPS = [
|
|
|
236
259
|
"nonce",
|
|
237
260
|
"createSession",
|
|
238
261
|
"appearance",
|
|
239
|
-
"strings",
|
|
240
262
|
"locale",
|
|
241
263
|
"country",
|
|
242
264
|
"paymentMethodLayout",
|
|
@@ -305,6 +327,20 @@ var FloPayCheckout = defineComponent2({
|
|
|
305
327
|
cardFieldPlaceholders: { type: Object, default: void 0 },
|
|
306
328
|
enabledPaymentMethods: { type: Array, default: void 0 },
|
|
307
329
|
initialPayPalOrderId: { type: String, default: void 0 },
|
|
330
|
+
// 2.10.0: the 1.x card form options and labels.
|
|
331
|
+
enableAVS: {
|
|
332
|
+
type: [Boolean, Object],
|
|
333
|
+
default: void 0
|
|
334
|
+
},
|
|
335
|
+
avsLayout: { type: String, default: void 0 },
|
|
336
|
+
cardFieldOrder: { type: Array, default: void 0 },
|
|
337
|
+
cardButtonContent: { type: String, default: void 0 },
|
|
338
|
+
cardBackButtonContent: { type: String, default: void 0 },
|
|
339
|
+
cardTitleContent: { type: String, default: void 0 },
|
|
340
|
+
moreOptionsLabel: { type: String, default: void 0 },
|
|
341
|
+
submitLabel: { type: String, default: void 0 },
|
|
342
|
+
/** The buyer chose a payment method, by its name (`card`, `apple_pay`, `paypal`, ...). */
|
|
343
|
+
onButtonClick: { type: Function, default: void 0 },
|
|
308
344
|
// The 1.x listeners, as props so a throwing one never blocks the others.
|
|
309
345
|
onComplete: listener,
|
|
310
346
|
onDecline: listener,
|
|
@@ -319,8 +355,24 @@ var FloPayCheckout = defineComponent2({
|
|
|
319
355
|
},
|
|
320
356
|
setup(props, { emit }) {
|
|
321
357
|
const provided = inject(FLOPAY_RUNTIME_CONTEXT, {});
|
|
358
|
+
const strings = computed(() => {
|
|
359
|
+
if (props.moreOptionsLabel === void 0 && props.submitLabel === void 0) {
|
|
360
|
+
return props.strings;
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
...props.strings,
|
|
364
|
+
...props.moreOptionsLabel === void 0 ? {} : { morePaymentOptions: props.moreOptionsLabel },
|
|
365
|
+
...props.submitLabel === void 0 ? {} : { payButton: props.submitLabel }
|
|
366
|
+
};
|
|
367
|
+
});
|
|
322
368
|
const onEvent = (event) => {
|
|
323
369
|
isolated(() => emit("event", event));
|
|
370
|
+
if (event.name === "buttonClick") {
|
|
371
|
+
const method = event.payload?.method;
|
|
372
|
+
const onButtonClick = props.onButtonClick;
|
|
373
|
+
if (onButtonClick && typeof method === "string") isolated(() => onButtonClick(method));
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
324
376
|
if (event.name === "error") {
|
|
325
377
|
isolated(() => emit("error", event.payload));
|
|
326
378
|
return;
|
|
@@ -336,7 +388,9 @@ var FloPayCheckout = defineComponent2({
|
|
|
336
388
|
...core,
|
|
337
389
|
publishableKey: props.publishableKey ?? provided.publishableKey ?? "",
|
|
338
390
|
runtimeUrl: props.runtimeUrl ?? provided.runtimeUrl ?? "",
|
|
391
|
+
...strings.value === void 0 ? {} : { strings: strings.value },
|
|
339
392
|
extraMountOptions: passThrough(props),
|
|
393
|
+
buttonClicks: props.onButtonClick !== void 0,
|
|
340
394
|
onEvent,
|
|
341
395
|
onError: (error) => emit("error", error)
|
|
342
396
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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.
|
|
40
|
-
"@flopay/shared": "2.
|
|
39
|
+
"@flopay/js": "2.3.0",
|
|
40
|
+
"@flopay/shared": "2.3.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"vue": ">=3.3.0"
|