@flopay/vue 1.20.4 → 1.20.5
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/dist/flopay-runtime-checkout.d.ts +18 -1
- package/dist/index.cjs +23 -1
- package/dist/index.mjs +23 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CheckoutRuntimeEvent } from '@flopay/js';
|
|
2
|
+
import type { PaymentMethodLayoutRules } from '@flopay/shared';
|
|
2
3
|
import { FloPayError } from '@flopay/shared';
|
|
3
4
|
import type { PropType } from 'vue';
|
|
4
5
|
/** The props of {@link FloPayRuntimeCheckout}, the same as @flopay/react's component. */
|
|
@@ -15,6 +16,12 @@ export interface FloPayRuntimeCheckoutProps {
|
|
|
15
16
|
appearance?: Record<string, unknown>;
|
|
16
17
|
/** Merchant wording overrides, applied by the runtime over the strings the API returns. */
|
|
17
18
|
strings?: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* The merchant's payment method layout rules. The runtime has the billing API resolve them
|
|
21
|
+
* for the buyer and lays out the payment method groups in that order, with the groups behind
|
|
22
|
+
* "More payment options"; without them the checkout keeps the 1.x default layout.
|
|
23
|
+
*/
|
|
24
|
+
paymentMethodLayout?: PaymentMethodLayoutRules;
|
|
18
25
|
/** The Flo-origin runtime script. */
|
|
19
26
|
runtimeUrl: string;
|
|
20
27
|
/** How long the runtime has to load before the `error` emit. Defaults to 10 seconds. */
|
|
@@ -25,7 +32,8 @@ export interface FloPayRuntimeCheckoutProps {
|
|
|
25
32
|
* logic: it loads the runtime, mounts it in a container, passes its props through, relays the
|
|
26
33
|
* runtime's events as `event` emits, and reports a runtime that cannot load as an `error` emit.
|
|
27
34
|
* A change to the session (`sessionId`, `nonce`, `createSession`), the key or the runtime
|
|
28
|
-
* mounts the checkout again; `appearance` and `
|
|
35
|
+
* mounts the checkout again; `appearance`, `strings` and `paymentMethodLayout` update the
|
|
36
|
+
* mounted checkout.
|
|
29
37
|
*/
|
|
30
38
|
export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
31
39
|
publishableKey: {
|
|
@@ -52,6 +60,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
52
60
|
type: PropType<Record<string, string>>;
|
|
53
61
|
default: undefined;
|
|
54
62
|
};
|
|
63
|
+
paymentMethodLayout: {
|
|
64
|
+
type: PropType<PaymentMethodLayoutRules>;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
55
67
|
runtimeUrl: {
|
|
56
68
|
type: StringConstructor;
|
|
57
69
|
required: true;
|
|
@@ -90,6 +102,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
90
102
|
type: PropType<Record<string, string>>;
|
|
91
103
|
default: undefined;
|
|
92
104
|
};
|
|
105
|
+
paymentMethodLayout: {
|
|
106
|
+
type: PropType<PaymentMethodLayoutRules>;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
93
109
|
runtimeUrl: {
|
|
94
110
|
type: StringConstructor;
|
|
95
111
|
required: true;
|
|
@@ -107,5 +123,6 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
107
123
|
createSession: Record<string, unknown>;
|
|
108
124
|
appearance: Record<string, unknown>;
|
|
109
125
|
strings: Record<string, string>;
|
|
126
|
+
paymentMethodLayout: PaymentMethodLayoutRules;
|
|
110
127
|
runtimeTimeoutMs: number;
|
|
111
128
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/index.cjs
CHANGED
|
@@ -5353,7 +5353,13 @@ function asFloPayError(caught) {
|
|
|
5353
5353
|
cause: caught
|
|
5354
5354
|
});
|
|
5355
5355
|
}
|
|
5356
|
-
var RUNTIME_CONTRACT_VERSION = "2.
|
|
5356
|
+
var RUNTIME_CONTRACT_VERSION = "2.1.0";
|
|
5357
|
+
function rulesKey(rules) {
|
|
5358
|
+
return rules === void 0 ? void 0 : JSON.stringify(rules);
|
|
5359
|
+
}
|
|
5360
|
+
function rulesFromKey(key) {
|
|
5361
|
+
return key === void 0 ? void 0 : JSON.parse(key);
|
|
5362
|
+
}
|
|
5357
5363
|
var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
5358
5364
|
name: "FloPayRuntimeCheckout",
|
|
5359
5365
|
props: {
|
|
@@ -5363,6 +5369,10 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5363
5369
|
createSession: { type: Object, default: void 0 },
|
|
5364
5370
|
appearance: { type: Object, default: void 0 },
|
|
5365
5371
|
strings: { type: Object, default: void 0 },
|
|
5372
|
+
paymentMethodLayout: {
|
|
5373
|
+
type: Object,
|
|
5374
|
+
default: void 0
|
|
5375
|
+
},
|
|
5366
5376
|
runtimeUrl: { type: String, required: true },
|
|
5367
5377
|
runtimeTimeoutMs: { type: Number, default: void 0 }
|
|
5368
5378
|
},
|
|
@@ -5373,6 +5383,7 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5373
5383
|
setup(props, { emit }) {
|
|
5374
5384
|
const container = (0, import_vue14.ref)(null);
|
|
5375
5385
|
let handle = null;
|
|
5386
|
+
let mountedLayoutRules;
|
|
5376
5387
|
let run = 0;
|
|
5377
5388
|
const stop = () => {
|
|
5378
5389
|
run += 1;
|
|
@@ -5385,6 +5396,7 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5385
5396
|
(0, import_js4.loadCheckoutRuntime)({ runtimeUrl: props.runtimeUrl, timeoutMs: props.runtimeTimeoutMs }).then(
|
|
5386
5397
|
(runtime) => {
|
|
5387
5398
|
if (current !== run || !container.value) return;
|
|
5399
|
+
mountedLayoutRules = rulesKey(props.paymentMethodLayout);
|
|
5388
5400
|
handle = runtime.mount(container.value, {
|
|
5389
5401
|
contractVersion: RUNTIME_CONTRACT_VERSION,
|
|
5390
5402
|
publishableKey: props.publishableKey,
|
|
@@ -5393,6 +5405,7 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5393
5405
|
createSession: props.createSession,
|
|
5394
5406
|
appearance: props.appearance,
|
|
5395
5407
|
strings: props.strings,
|
|
5408
|
+
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
5396
5409
|
onEvent: (event) => emit("event", event)
|
|
5397
5410
|
});
|
|
5398
5411
|
},
|
|
@@ -5426,6 +5439,15 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5426
5439
|
if (strings !== void 0) handle?.update({ strings });
|
|
5427
5440
|
}
|
|
5428
5441
|
);
|
|
5442
|
+
(0, import_vue14.watch)(
|
|
5443
|
+
// By value, so equal rules in a new (or reactive) object ask for no new layout.
|
|
5444
|
+
() => rulesKey(props.paymentMethodLayout),
|
|
5445
|
+
(key) => {
|
|
5446
|
+
if (key === void 0 || key === mountedLayoutRules || !handle) return;
|
|
5447
|
+
mountedLayoutRules = key;
|
|
5448
|
+
handle.update({ paymentMethodLayout: rulesFromKey(key) });
|
|
5449
|
+
}
|
|
5450
|
+
);
|
|
5429
5451
|
(0, import_vue14.onBeforeUnmount)(stop);
|
|
5430
5452
|
return () => (0, import_vue14.h)("div", { ref: container, "data-flopay-runtime-checkout": "" });
|
|
5431
5453
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3487,7 +3487,13 @@ function asFloPayError(caught) {
|
|
|
3487
3487
|
cause: caught
|
|
3488
3488
|
});
|
|
3489
3489
|
}
|
|
3490
|
-
var RUNTIME_CONTRACT_VERSION = "2.
|
|
3490
|
+
var RUNTIME_CONTRACT_VERSION = "2.1.0";
|
|
3491
|
+
function rulesKey(rules) {
|
|
3492
|
+
return rules === void 0 ? void 0 : JSON.stringify(rules);
|
|
3493
|
+
}
|
|
3494
|
+
function rulesFromKey(key) {
|
|
3495
|
+
return key === void 0 ? void 0 : JSON.parse(key);
|
|
3496
|
+
}
|
|
3491
3497
|
var FloPayRuntimeCheckout = defineComponent6({
|
|
3492
3498
|
name: "FloPayRuntimeCheckout",
|
|
3493
3499
|
props: {
|
|
@@ -3497,6 +3503,10 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3497
3503
|
createSession: { type: Object, default: void 0 },
|
|
3498
3504
|
appearance: { type: Object, default: void 0 },
|
|
3499
3505
|
strings: { type: Object, default: void 0 },
|
|
3506
|
+
paymentMethodLayout: {
|
|
3507
|
+
type: Object,
|
|
3508
|
+
default: void 0
|
|
3509
|
+
},
|
|
3500
3510
|
runtimeUrl: { type: String, required: true },
|
|
3501
3511
|
runtimeTimeoutMs: { type: Number, default: void 0 }
|
|
3502
3512
|
},
|
|
@@ -3507,6 +3517,7 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3507
3517
|
setup(props, { emit }) {
|
|
3508
3518
|
const container = ref6(null);
|
|
3509
3519
|
let handle = null;
|
|
3520
|
+
let mountedLayoutRules;
|
|
3510
3521
|
let run = 0;
|
|
3511
3522
|
const stop = () => {
|
|
3512
3523
|
run += 1;
|
|
@@ -3519,6 +3530,7 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3519
3530
|
loadCheckoutRuntime({ runtimeUrl: props.runtimeUrl, timeoutMs: props.runtimeTimeoutMs }).then(
|
|
3520
3531
|
(runtime) => {
|
|
3521
3532
|
if (current !== run || !container.value) return;
|
|
3533
|
+
mountedLayoutRules = rulesKey(props.paymentMethodLayout);
|
|
3522
3534
|
handle = runtime.mount(container.value, {
|
|
3523
3535
|
contractVersion: RUNTIME_CONTRACT_VERSION,
|
|
3524
3536
|
publishableKey: props.publishableKey,
|
|
@@ -3527,6 +3539,7 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3527
3539
|
createSession: props.createSession,
|
|
3528
3540
|
appearance: props.appearance,
|
|
3529
3541
|
strings: props.strings,
|
|
3542
|
+
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
3530
3543
|
onEvent: (event) => emit("event", event)
|
|
3531
3544
|
});
|
|
3532
3545
|
},
|
|
@@ -3560,6 +3573,15 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3560
3573
|
if (strings !== void 0) handle?.update({ strings });
|
|
3561
3574
|
}
|
|
3562
3575
|
);
|
|
3576
|
+
watch4(
|
|
3577
|
+
// By value, so equal rules in a new (or reactive) object ask for no new layout.
|
|
3578
|
+
() => rulesKey(props.paymentMethodLayout),
|
|
3579
|
+
(key) => {
|
|
3580
|
+
if (key === void 0 || key === mountedLayoutRules || !handle) return;
|
|
3581
|
+
mountedLayoutRules = key;
|
|
3582
|
+
handle.update({ paymentMethodLayout: rulesFromKey(key) });
|
|
3583
|
+
}
|
|
3584
|
+
);
|
|
3563
3585
|
onBeforeUnmount6(stop);
|
|
3564
3586
|
return () => h6("div", { ref: container, "data-flopay-runtime-checkout": "" });
|
|
3565
3587
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/vue",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.5",
|
|
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.20.
|
|
40
|
-
"@flopay/shared": "1.20.
|
|
39
|
+
"@flopay/js": "1.20.5",
|
|
40
|
+
"@flopay/shared": "1.20.5",
|
|
41
41
|
"@paypal/paypal-js": "^11.3.0",
|
|
42
42
|
"@stripe/stripe-js": "^10.3.0"
|
|
43
43
|
},
|